﻿body { font-family: 'Inter', sans-serif; }
    h1, h2, h3, .font-heading { font-family: 'Plus Jakarta Sans', sans-serif; }

    /* Keep the shared application sidebar fixed while the workspace scrolls. */
    body[data-page] { height: 100vh; overflow: hidden; }
    body[data-page] > .flex.min-h-screen { height: 100vh; min-height: 0; overflow: hidden; }
    body[data-page] > .flex.min-h-screen > #sidebar {
      position: fixed;
      top: 0;
      left: 0;
      width: 16rem;
      height: 100vh;
      max-height: 100dvh;
      display: flex;
      flex-direction: column;
      overflow: hidden;
      z-index: 30;
    }

/* Shared Quick Add dropdown used by every authenticated application header. */
.app-create-dropdown { position: relative; display: inline-flex; }
.app-create-dropdown__details { position: relative; }
.app-create-dropdown__trigger { cursor: pointer; list-style: none; user-select: none; }
.app-create-dropdown__trigger::-webkit-details-marker { display: none; }
.app-create-dropdown__arrow { transition: transform 0.2s ease; }
.app-create-dropdown__details[open] .app-create-dropdown__arrow { transform: rotate(180deg); }
.app-create-dropdown__menu {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  min-width: 245px;
  padding: 6px;
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  box-shadow: 0 10px 30px rgba(15, 23, 42, 0.14);
  z-index: 1000;
}
.app-create-dropdown__item {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 11px 12px;
  border-radius: 7px;
  color: #334155;
  font: 550 13px Inter, sans-serif;
  text-decoration: none;
  white-space: nowrap;
  transition: background 0.15s ease, color 0.15s ease;
}
.app-create-dropdown__item:hover { background: #eff6ff; color: #2563eb; }
.app-create-dropdown__icon { width: 22px; text-align: center; font-size: 16px; }
@media (max-width: 760px) {
  .app-create-dropdown { flex: 1 1 auto; }
  .app-create-dropdown__details, .app-create-dropdown__trigger { width: 100%; }
  .app-create-dropdown__menu { left: 0; right: auto; width: 100%; }
}
    body[data-page] > .flex.min-h-screen > #sidebar > div:first-child,
    body[data-page] > .flex.min-h-screen > #sidebar > div:last-child {
      flex: 0 0 auto;
    }
    body[data-page] > .flex.min-h-screen > #sidebar nav {
      flex: 1 1 auto;
      min-height: 0;
      overflow-x: hidden;
      overflow-y: auto;
      overscroll-behavior-y: contain;
      scrollbar-width: thin;
      scrollbar-color: #475569 #0f172a;
    }
    body[data-page] > .flex.min-h-screen > #sidebar + div {
      flex: 0 0 calc(100% - 16rem);
      width: calc(100% - 16rem);
      height: 100vh;
      min-height: 0;
      min-width: 0;
      margin-left: 16rem;
      overflow: hidden;
    }
    body[data-page] > .flex.min-h-screen > #sidebar + div > main {
      min-height: 0;
      overflow-y: auto;
      overscroll-behavior-y: contain;
    }

    /* Shared page header */
    .app-topbar {
      min-height: 84px;
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 24px;
      padding: 14px 28px;
      background: linear-gradient(110deg, #ffffff 0%, #ffffff 72%, #f8faff 100%);
      border-bottom: 1px solid #dbe4f0;
      box-shadow: 0 2px 10px rgba(15, 23, 42, 0.035);
    }
    .app-topbar__heading { min-width: 0; }
    .app-topbar__title {
      margin: 0;
      color: #0f172a;
      font-size: 22px;
      font-weight: 700;
      line-height: 1.2;
      letter-spacing: -0.035em;
    }
    .app-topbar__subtitle {
      margin: 4px 0 0;
      color: #64748b;
      font-size: 14px;
      line-height: 1.4;
    }
    .app-topbar__actions { display: flex; flex: 0 0 auto; align-items: center; gap: 10px; }
    .app-topbar__primary {
      display: inline-flex;
      min-height: 42px;
      align-items: center;
      justify-content: center;
      gap: 8px;
      padding: 0 16px;
      border: 1px solid #2563eb;
      border-radius: 10px;
      background: #2563eb;
      box-shadow: 0 2px 5px rgba(37, 99, 235, 0.2);
      color: #fff;
      font-size: 13px;
      font-weight: 650;
      text-decoration: none;
      transition: background-color .15s ease, box-shadow .15s ease, transform .15s ease;
    }
    .app-topbar__primary:hover { transform: translateY(-1px); background: #1d4ed8; box-shadow: 0 4px 10px rgba(37, 99, 235, 0.24); }
    .app-topbar__plus { font-size: 18px; line-height: 1; }
    .app-topbar__profile {
      display: inline-flex;
      min-height: 42px;
      align-items: center;
      gap: 9px;
      padding: 4px 13px 4px 5px;
      border: 1px solid #e2e8f0;
      border-radius: 999px;
      background: rgba(255, 255, 255, .9);
      color: #1e293b;
      font-size: 13px;
      font-weight: 550;
      text-decoration: none;
      transition: border-color .15s ease, background-color .15s ease;
    }
    .app-topbar__profile:hover { border-color: #bfdbfe; background: #eff6ff; }
    .app-topbar__avatar {
      display: inline-flex;
      width: 31px;
      height: 31px;
      flex: 0 0 31px;
      align-items: center;
      justify-content: center;
      border: 2px solid #dbeafe;
      border-radius: 50%;
      background: #1e293b;
      color: #fff;
      font-size: 10px;
      font-weight: 700;
      letter-spacing: .02em;
    }
    .app-topbar__username { max-width: 150px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
    .app-topbar__logout { margin: 0 0 0 2px; }
    .app-topbar__logout-button {
      min-height: 40px;
      padding: 0 15px;
      border: 1px solid #dbe4f0;
      border-radius: 9px;
      background: #fff;
      color: #334155;
      font: inherit;
      font-size: 13px;
      font-weight: 600;
      cursor: pointer;
      transition: border-color .15s ease, background-color .15s ease, color .15s ease;
    }
    .app-topbar__logout-button:hover { border-color: #fecaca; background: #fff7f7; color: #b91c1c; }
    .pi-number-input { display: inline-block; width: 11ch; padding: 0; border: 1px solid transparent; border-radius: 3px; background: transparent; text-align: right; vertical-align: baseline; outline: none; }
    .pi-number-input:hover { border-color: #cbd5e1; }
    .pi-number-input:focus { border-color: #93c5fd; background: #fff; box-shadow: 0 0 0 2px rgba(219, 234, 254, .8); }
    @media (max-width: 760px) {
      body[data-page] > .flex.min-h-screen > #sidebar {
        width: 4.5rem;
      }
      body[data-page] > .flex.min-h-screen > #sidebar + div {
        flex-basis: calc(100% - 4.5rem);
        width: calc(100% - 4.5rem);
        margin-left: 4.5rem;
      }
      body[data-page] > .flex.min-h-screen > #sidebar > div:first-child {
        justify-content: center;
        padding-left: 0;
        padding-right: 0;
      }
      body[data-page] > .flex.min-h-screen > #sidebar > div:first-child > div > div:last-child,
      body[data-page] > .flex.min-h-screen > #sidebar nav > div > div:first-child,
      body[data-page] > .flex.min-h-screen > #sidebar nav [data-nav] > span:nth-child(2),
      body[data-page] > .flex.min-h-screen > #sidebar > div:last-child {
        display: none;
      }
      body[data-page] > .flex.min-h-screen > #sidebar nav { padding-left: 8px; padding-right: 8px; }
      body[data-page] > .flex.min-h-screen > #sidebar nav [data-nav] { justify-content: center; padding-left: 8px; padding-right: 8px; }
      .app-topbar { align-items: flex-start; flex-direction: column; gap: 13px; padding: 16px; }
      .app-topbar__title { font-size: 20px; }
      .app-topbar__subtitle { font-size: 12px; }
      .app-topbar__actions { width: 100%; flex-wrap: wrap; gap: 8px; }
      .app-topbar__primary { flex: 1 1 auto; padding: 0 12px; }
      .app-topbar__profile { padding-right: 10px; }
      .app-topbar__logout { margin-left: auto; }
    }
    .page-navigation-loader {
      position: fixed;
      inset: 0;
      z-index: 10000;
      display: flex;
      align-items: center;
      justify-content: center;
      background: #f8fafc;
      opacity: 1;
      visibility: visible;
      transition: opacity .12s ease, visibility .12s ease;
    }
    .page-navigation-loader.is-hidden { opacity: 0; visibility: hidden; pointer-events: none; }
    .page-navigation-loader__spinner {
      width: 34px;
      height: 34px;
      border: 3px solid #dbeafe;
      border-top-color: #2563eb;
      border-radius: 50%;
      animation: page-navigation-spin .7s linear infinite;
    }
    @keyframes page-navigation-spin { to { transform: rotate(360deg); } }
    @media (prefers-reduced-motion: reduce) {
      .page-navigation-loader__spinner { animation-duration: 1.6s; }
    }

    /* Print sheet styling */
    .pdf-sheet {
      width: 210mm;
      min-height: 297mm;
      box-sizing: border-box;
      background: #ffffff;
      color: #0f172a;
      box-shadow: 0 10px 30px -5px rgba(15, 23, 42, 0.12), 0 4px 12px -2px rgba(15, 23, 42, 0.06);
      border: 1px solid #cbd5e1;
      margin: 0 auto;
      padding: 14mm 14mm;
      font-size: 13px;
      line-height: 1.45;
    }
    .pdf-document { display: block; }
    .pdf-annexure-page { margin-top: 24px; }
    .annexure-heading { margin: 0 0 5mm; text-align: center; font-size: 16px; font-weight: 700; text-decoration: underline; }
    .annexure-subheading { margin: 0 0 5mm; font-size: 14px; font-weight: 700; }
    .annexure-copy { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; font: 12px/1.42 Inter, sans-serif; }
    .annexure-signature { margin-top: 12mm; text-align: right; font-size: 14px; font-weight: 700; }
    #pdf-company-name, #si-company-name { font-size: 20px !important; }
    #pdf-company-addr, #pdf-company-gst, #si-company-address, #si-company-gst { font-size: 13px !important; }
    #pdf-doc-title, #si-doc-heading, #pdf-kind-title, #si-kind-title { font-size: 18px !important; }
    #pdf-pi-number, #pdf-pi-date, #si-doc-number, #si-doc-date { font-size: 13px !important; }
    #pdf-client-name, #pdf-client-address, #pdf-client-attn, #pdf-client-gstin-row, #pdf-client-pos-row,
    .pdf-bill-info,
    #si-printable-area #si-bill-name, #si-printable-area #si-bill-contact, #si-printable-area #si-bill-address,
    #si-printable-area #si-bill-email, #si-printable-area #si-bill-phone, #si-printable-area #si-bill-gstin,
    #si-printable-area #si-bill-pos, #si-printable-area #si-bill-state-code { font-size: 13px !important; }
    .pdf-table th { font-size: 13px; }
    .pdf-table td { font-size: 12.5px; }
    .pdf-table tr.bg-slate-100, .pdf-table tr.bg-slate-100 td { font-size: 16px !important; }
    #pdf-bank-details, #pdf-payment-terms, #si-bank-details, #si-payment-terms, #si-notes { font-size: 11.5px !important; }
    #pdf-grand-total, #si-total-payable { font-size: 16px !important; }
    #si-bill-contact { width: 150px; }
    #si-bill-email { width: 210px; }
    #si-bill-phone { width: 105px; }
    #si-bill-gstin { width: 180px; }
    #si-bill-pos { width: 165px; }
    #si-bill-state-code { width: 55px; }

    .pdf-table {
      width: 100%;
      border-collapse: collapse;
    }
    .pdf-table th, .pdf-table td {
      border: 1px solid #334155;
      padding: 6px 8px;
      vertical-align: top;
    }
    .pdf-table th {
      background-color: #f1f5f9;
      font-weight: 700;
      color: #0f172a;
      text-align: left;
    }
    .pdf-table thead { display: table-header-group; }
    .pdf-table tfoot { display: table-row-group; }
    .pdf-table tr { break-inside: avoid; page-break-inside: avoid; }

    .doc-input {
      background: #f8fafc;
      border: 1px dashed #94a3b8;
      border-radius: 3px;
      padding: 2px 6px;
      font-size: 12px;
      color: #0f172a;
      transition: all 0.15s;
    }
    .doc-input:focus {
      outline: none;
      background: #eff6ff;
      border: 1px solid #2563eb;
    }

    .subtotal-edit-input {
      width: 100%;
      max-width: 95px;
      padding: 1px 3px;
      border: 1px solid transparent;
      border-radius: 3px;
      background: transparent;
      color: inherit;
      font: inherit;
      text-align: right;
      outline: none;
      appearance: textfield;
      -moz-appearance: textfield;
    }
    .subtotal-edit-input::-webkit-inner-spin-button,
    .subtotal-edit-input::-webkit-outer-spin-button { margin: 0; -webkit-appearance: none; }
    .subtotal-edit-input:hover { border-color: #cbd5e1; }
    .subtotal-edit-input:focus { border-color: #93c5fd; background: #fff; box-shadow: 0 0 0 2px rgba(219, 234, 254, .8); }

    @media screen and (max-width: 760px) {
      #si-printable-area.pdf-sheet { width: 100%; min-height: 0; padding: 16px; }
      #si-items-table-scroll .pdf-table { min-width: 640px; }
      #si-items-table-scroll .pdf-table th,
      #si-items-table-scroll .pdf-table td { padding: 4px 5px; font-size: 10px; }
    }

    /* Clean Print Output */
    @media print {
      @page { size: A4; margin: 0; }
      html, body, body[data-page] { height: auto !important; min-height: 0 !important; overflow: visible !important; }
      body[data-page] > .flex.min-h-screen {
        display: block !important;
        height: auto !important;
        min-height: 0 !important;
        overflow: visible !important;
      }
      body[data-page] > .flex.min-h-screen > #sidebar { display: none !important; }
      body[data-page] > .flex.min-h-screen > #sidebar + div {
        display: block !important;
        width: auto !important;
        height: auto !important;
        min-height: 0 !important;
        margin: 0 !important;
        overflow: visible !important;
      }
      body[data-page] > .flex.min-h-screen > #sidebar + div > header { display: none !important; }
      body[data-page] > .flex.min-h-screen > #sidebar + div > main {
        display: block !important;
        height: auto !important;
        min-height: 0 !important;
        overflow: visible !important;
        padding: 0 !important;
      }
      body * { visibility: hidden; }
      #pdf-document, #pdf-document *, #si-pdf-document, #si-pdf-document * { visibility: visible; }
      #view-proforma-create, #view-sales-invoice-create {
        display: block !important;
        position: static !important;
        width: auto !important;
        height: auto !important;
        margin: 0 !important;
        padding: 0 !important;
        overflow: visible !important;
      }
      #pdf-document, #si-pdf-document {
        position: static !important;
        display: block !important;
        width: 100% !important;
        margin: 0 !important;
        padding: 0 !important;
      }
      #printable-area, #si-printable-area, #pdf-annexure-page, #si-annexure-wrap {
        position: relative !important;
        width: 210mm !important;
        min-height: 297mm !important;
        box-sizing: border-box !important;
        padding: 14mm !important;
        margin: 0 auto !important;
        box-shadow: none !important;
        border: none !important;
      }
      #pdf-annexure-page, #si-annexure-wrap {
        break-before: page !important;
        page-break-before: always !important;
      }
      .no-print { display: none !important; }
      .doc-input {
        background: transparent !important;
        border: none !important;
        padding: 0 !important;
        appearance: none;
        -webkit-appearance: none;
      }
      .subtotal-edit-input { border: none !important; background: transparent !important; box-shadow: none !important; }
      select.doc-input {
        background-image: none !important;
      }
      #si-items-table-scroll { overflow: visible !important; }
      #printable-area .pdf-table th, #printable-area .pdf-table td,
      #si-printable-area .pdf-table th, #si-printable-area .pdf-table td { padding: 4px 5px !important; }
      #printable-area .mb-4, #si-printable-area .mb-4 { margin-bottom: 8px !important; }
      #printable-area .mb-3 { margin-bottom: 6px !important; }
      #printable-area .mt-6, #printable-area .mb-6,
      #si-printable-area .mt-6, #si-printable-area .mb-6 { margin-top: 8px !important; margin-bottom: 8px !important; }
      #si-printable-area .mb-3 { margin-bottom: 6px !important; }
      #si-printable-area .mt-5 { margin-top: 8px !important; }
      #si-printable-area .mt-4 { margin-top: 6px !important; }
      #pdf-bank-details, #pdf-payment-terms { min-height: 18mm !important; }
      .si-empty-note { display: none !important; }
      .pdf-annexure-page, .si-annexure-page { break-inside: auto !important; page-break-inside: auto !important; }
      #si-annexure {
        white-space: pre-wrap !important;
        overflow: visible !important;
      }
    }

