:root {
  --app-bg: #f5f7fb;
  --app-navbar: #111827;
  --app-navbar-deep: #0b1220;
  --app-primary: #5b67f1;
  --app-primary-soft: rgba(111, 124, 255, .15);
  --app-border: #e7eaf0;
  --app-text-muted: #6b7280;
}

body {
  display: flex;
  min-height: 100vh;
  flex-direction: column;
  background: var(--app-bg);
  color: #1f2937;
}

/* Main navigation --------------------------------------------------------- */
.app-navbar {
  min-height: 72px;
  padding: .65rem 0;
  background:
    radial-gradient(circle at 12% -70%, rgba(109, 93, 251, .52), transparent 37%),
    linear-gradient(115deg, var(--app-navbar-deep), var(--app-navbar) 62%, #151d2f);
  border-bottom: 1px solid rgba(255, 255, 255, .08);
  box-shadow: 0 10px 30px rgba(15, 23, 42, .12);
}

.app-navbar-inner {
  gap: 1rem;
  padding-left: clamp(1rem, 2vw, 2rem);
  padding-right: clamp(1rem, 2vw, 2rem);
}

.app-brand {
  display: inline-flex;
  align-items: center;
  gap: .7rem;
  min-width: max-content;
  margin-right: 0;
  padding: 0;
  color: #fff;
}

.app-brand:hover,
.app-brand:focus {
  color: #fff;
}

.app-brand-logo {
  flex: 0 0 auto;
  filter: drop-shadow(0 6px 11px rgba(0, 0, 0, .22));
  transition: transform .2s ease;
}

.app-brand:hover .app-brand-logo {
  transform: translateY(-1px) rotate(-2deg);
}

.app-brand-copy {
  display: flex;
  flex-direction: column;
  line-height: 1.05;
}

.app-brand-name {
  font-size: 1rem;
  font-weight: 750;
  letter-spacing: -.015em;
}

.app-brand-subtitle {
  margin-top: .25rem;
  color: rgba(255, 255, 255, .56);
  font-size: .68rem;
  font-weight: 500;
  letter-spacing: .045em;
  text-transform: uppercase;
}

.app-nav-links {
  align-items: center;
  gap: .22rem;
}

.app-nav-links .nav-link {
  display: flex;
  align-items: center;
  gap: .4rem;
  position: relative;
  border-radius: .72rem;
  padding: .54rem .68rem !important;
  color: rgba(255, 255, 255, .68);
  font-size: .88rem;
  font-weight: 550;
  white-space: nowrap;
  transition: color .18s ease, background-color .18s ease, transform .18s ease;
}

.app-nav-links .nav-link:hover,
.app-nav-links .nav-link:focus-visible {
  background: rgba(255, 255, 255, .07);
  color: #fff;
}

.app-nav-links .nav-link.active {
  background: rgba(255, 255, 255, .12);
  color: #fff;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .06);
}

.app-nav-links .nav-link.active::after {
  content: "";
  position: absolute;
  right: .68rem;
  bottom: .25rem;
  left: .68rem;
  height: 2px;
  border-radius: 999px;
  background: linear-gradient(90deg, #8d82ff, #65d4c8);
}

.nav-link-icon,
.nav-icon-link svg,
.menu-icon {
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.nav-link-icon {
  width: 16px;
  height: 16px;
  opacity: .92;
}

.nav-icon-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, .08);
  border-radius: .75rem;
  background: rgba(255, 255, 255, .055);
  color: rgba(255, 255, 255, .76);
  text-decoration: none;
  transition: background-color .18s ease, border-color .18s ease, color .18s ease, transform .18s ease;
}

button.nav-icon-link {
  appearance: none;
}

.nav-icon-link:hover,
.nav-icon-link:focus-visible,
.nav-icon-link.active {
  border-color: rgba(255, 255, 255, .16);
  background: rgba(255, 255, 255, .11);
  color: #fff;
  transform: translateY(-1px);
}

.nav-icon-link svg {
  width: 19px;
  height: 19px;
}

.notification-badge {
  position: absolute;
  top: -5px;
  right: -5px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 19px;
  height: 19px;
  padding: 0 5px;
  border: 2px solid var(--app-navbar);
  border-radius: 999px;
  background: #ef4444;
  color: #fff;
  font-size: .63rem;
  font-weight: 700;
  line-height: 1;
}

.user-menu-button {
  display: flex;
  align-items: center;
  gap: .55rem;
  max-width: 250px;
  padding: .28rem .55rem .28rem .3rem;
  border: 1px solid rgba(255, 255, 255, .08);
  border-radius: .85rem;
  background: rgba(255, 255, 255, .055);
  color: #fff;
  text-align: left;
  transition: background-color .18s ease, border-color .18s ease;
}

.user-menu-button:hover,
.user-menu-button:focus-visible,
.user-menu-button.show {
  border-color: rgba(255, 255, 255, .16);
  background: rgba(255, 255, 255, .1);
}

.user-menu-button::after {
  margin-left: .15rem;
  opacity: .55;
}

.user-avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 32px;
  width: 32px;
  height: 32px;
  border: 1px solid rgba(255, 255, 255, .18);
  border-radius: .68rem;
  background: linear-gradient(145deg, rgba(119, 106, 255, .92), rgba(44, 190, 170, .92));
  color: #fff;
  font-size: .78rem;
  font-weight: 750;
  box-shadow: 0 5px 14px rgba(0, 0, 0, .14);
}

.user-copy {
  display: flex;
  min-width: 0;
  flex-direction: column;
}

.user-email {
  max-width: 150px;
  overflow: hidden;
  color: rgba(255, 255, 255, .88);
  font-size: .77rem;
  font-weight: 600;
  line-height: 1.2;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.user-role {
  margin-top: .08rem;
  color: rgba(255, 255, 255, .48);
  font-size: .65rem;
  line-height: 1.2;
}

.app-nav-dropdown,
.app-user-dropdown {
  margin-top: .65rem !important;
  padding: .45rem;
  border: 1px solid var(--app-border);
  border-radius: .9rem;
  box-shadow: 0 18px 42px rgba(15, 23, 42, .16);
}

.app-nav-dropdown .dropdown-item,
.app-user-dropdown .dropdown-item {
  border-radius: .6rem;
  padding: .55rem .7rem;
  font-size: .88rem;
}

.app-nav-dropdown .dropdown-item.active,
.app-nav-dropdown .dropdown-item:active {
  background: #eef0ff;
  color: #4954d6;
  font-weight: 600;
}

.app-nav-dropdown .dropdown-header {
  padding: .4rem .7rem .3rem;
  color: #9ca3af;
  font-size: .66rem;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
}

.menu-icon {
  width: 17px;
  height: 17px;
}

.app-toggler {
  width: 38px;
  height: 38px;
  padding: .35rem;
  border-color: rgba(255, 255, 255, .12);
  border-radius: .75rem;
  background: rgba(255, 255, 255, .055);
}

.app-toggler:focus {
  box-shadow: 0 0 0 .2rem rgba(109, 93, 251, .25);
}

.mobile-account-panel {
  margin-top: .5rem;
  padding: .75rem;
  border-top: 1px solid rgba(255, 255, 255, .09);
}

.min-w-0 {
  min-width: 0;
}

/* App content ------------------------------------------------------------- */
.app-main {
  flex: 1 0 auto;
  max-width: 1920px;
  margin: 0 auto;
}

.app-alert {
  border: 0;
  box-shadow: 0 5px 18px rgba(15, 23, 42, .06);
}

.card {
  border: 0;
  box-shadow: 0 .15rem .75rem rgba(0,0,0,.06);
}

.metric {
  font-size: 1.8rem;
  font-weight: 700;
}

.table td,
.table th {
  vertical-align: middle;
}

.bill-preview {
  min-height: 420px;
  width: 100%;
  background: #fff;
  border: 1px solid #dee2e6;
  border-radius: .5rem;
}

.sticky-actions {
  position: sticky;
  bottom: 0;
  z-index: 10;
  padding: .75rem;
  border-top: 1px solid #dee2e6;
  background: rgba(255,255,255,.96);
}

@media (max-width: 1199.98px) {
  .app-navbar {
    padding: .55rem 0;
  }

  .navbar-collapse {
    width: 100%;
    margin-top: .7rem;
    padding-top: .7rem;
    border-top: 1px solid rgba(255, 255, 255, .08);
  }

  .app-nav-links {
    align-items: stretch;
    gap: .2rem;
  }

  .app-nav-links .nav-link {
    padding: .7rem .8rem !important;
  }

  .app-nav-links .nav-link.active::after {
    top: .55rem;
    right: auto;
    bottom: .55rem;
    left: .2rem;
    width: 3px;
    height: auto;
  }

  .app-nav-dropdown {
    margin-top: .2rem !important;
    border-color: rgba(255, 255, 255, .08);
    background: rgba(0, 0, 0, .12);
    box-shadow: none;
  }

  .app-nav-dropdown .dropdown-header {
    color: rgba(255, 255, 255, .4);
  }

  .app-nav-dropdown .dropdown-item {
    color: rgba(255, 255, 255, .72);
  }

  .app-nav-dropdown .dropdown-item:hover,
  .app-nav-dropdown .dropdown-item:focus,
  .app-nav-dropdown .dropdown-item.active {
    background: rgba(255, 255, 255, .09);
    color: #fff;
  }
}

@media (max-width: 575.98px) {
  .app-brand-copy {
    max-width: 155px;
  }

  .app-brand-name {
    font-size: .92rem;
  }

  .app-brand-subtitle {
    font-size: .58rem;
  }

  .app-brand-logo {
    width: 38px;
    height: 38px;
  }

  .app-navbar-inner {
    gap: .6rem;
  }
}


/* Application footer ----------------------------------------------------- */
.app-footer {
  position: relative;
  flex: 0 0 auto;
  margin-top: 2.25rem;
  overflow: hidden;
  border-top: 1px solid rgba(255, 255, 255, .07);
  background:
    radial-gradient(circle at 88% 0%, rgba(101, 212, 200, .10), transparent 26%),
    radial-gradient(circle at 8% 120%, rgba(109, 93, 251, .16), transparent 34%),
    linear-gradient(118deg, #0b1220, #111827 62%, #151d2f);
  color: rgba(255, 255, 255, .78);
}

.app-footer::before {
  content: "";
  position: absolute;
  inset: 0 auto auto 0;
  width: 100%;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(141, 130, 255, .55), rgba(101, 212, 200, .4), transparent);
}

.app-footer-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 2rem;
  max-width: 1920px;
  margin: 0 auto;
  padding: 1.55rem clamp(1rem, 2vw, 2rem) 1.45rem;
}

.app-footer-copy {
  min-width: 0;
}

.app-footer-kicker,
.app-footer-standards-label {
  color: rgba(255, 255, 255, .42);
  font-size: .65rem;
  font-weight: 750;
  letter-spacing: .105em;
  line-height: 1.2;
  text-transform: uppercase;
}

.trint-wordmark {
  display: inline-flex;
  align-items: flex-start;
  margin-top: .15rem;
  background: linear-gradient(95deg, #ffffff 6%, #d9dcff 45%, #83e6dc 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  font-size: 1.52rem;
  font-weight: 820;
  letter-spacing: -.055em;
  line-height: 1.08;
}

.trint-mark {
  margin: .08rem 0 0 .08rem;
  color: rgba(255, 255, 255, .62);
  font-size: .48em;
  font-weight: 650;
  letter-spacing: 0;
}

.app-footer-restriction,
.app-footer-copyright {
  margin: 0;
  line-height: 1.45;
}

.app-footer-restriction {
  margin-top: .55rem;
  color: rgba(255, 255, 255, .62);
  font-size: .74rem;
  font-weight: 520;
}

.app-footer-copyright {
  margin-top: .2rem;
  color: rgba(255, 255, 255, .38);
  font-size: .7rem;
}

.app-footer-standards {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: .52rem;
  flex: 0 0 auto;
}

.app-footer-badges {
  display: flex;
  align-items: center;
  gap: .58rem;
}

.compliance-badge {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: .44rem .62rem;
  border: 1px solid rgba(255, 255, 255, .09);
  border-radius: .8rem;
  background: rgba(255, 255, 255, .045);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .035);
  transition: border-color .18s ease, background-color .18s ease, transform .18s ease;
}

.compliance-badge:hover {
  transform: translateY(-1px);
  border-color: rgba(255, 255, 255, .16);
  background: rgba(255, 255, 255, .07);
}

.compliance-badge img {
  display: block;
  width: auto;
  height: 34px;
  max-width: 138px;
}

@media (max-width: 767.98px) {
  .app-footer {
    margin-top: 1.5rem;
  }

  .app-footer-inner {
    align-items: flex-start;
    flex-direction: column;
    gap: 1.2rem;
    padding-top: 1.35rem;
  }

  .app-footer-standards {
    align-items: flex-start;
    width: 100%;
    padding-top: 1rem;
    border-top: 1px solid rgba(255, 255, 255, .07);
  }

  .app-footer-badges {
    flex-wrap: wrap;
  }
}

@media print {
  nav,
  .app-footer,
  .no-print,
  .alert {
    display: none !important;
  }

  body {
    background: white;
  }

  main {
    padding: 0 !important;
  }

  .card {
    border: 1px solid #ddd;
    box-shadow: none;
  }
}

/* Supplier consolidation: dedicated supplier-facing print/PDF layout. */
.print-only {
  display: none !important;
}

@media print {
  .supplier-print-sheet.print-only {
    display: block !important;
  }

  .supplier-print-sheet {
    width: 100%;
    color: #111827;
    background: #fff;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
    font-size: 8.25pt;
    line-height: 1.22;
  }

  .supplier-print-sheet *,
  .supplier-print-sheet *::before,
  .supplier-print-sheet *::after {
    box-sizing: border-box;
  }

  .supplier-print-header {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8mm;
    align-items: end;
    padding: 0 0 3mm;
    margin-bottom: 3mm;
    border-bottom: 1.25pt solid #111827;
  }

  .supplier-print-eyebrow,
  .supplier-print-label {
    margin-bottom: .7mm;
    color: #6b7280;
    font-size: 6.8pt;
    font-weight: 700;
    letter-spacing: .08em;
  }

  .supplier-print-header h1 {
    margin: 0;
    font-size: 16pt;
    line-height: 1.05;
    font-weight: 750;
  }

  .supplier-print-reference {
    margin-top: 1mm;
    color: #4b5563;
    font-size: 8pt;
  }

  .supplier-print-total-block {
    min-width: 38mm;
    text-align: right;
  }

  .supplier-print-total-block span,
  .supplier-print-total-block small,
  .supplier-print-group-meta small {
    display: block;
    color: #6b7280;
    font-size: 7pt;
  }

  .supplier-print-total-block strong {
    display: block;
    margin: .3mm 0;
    font-size: 13.5pt;
    line-height: 1.05;
  }

  .supplier-print-summary {
    display: grid;
    grid-template-columns: minmax(0, .85fr) minmax(0, 1.5fr);
    gap: 4mm;
    align-items: stretch;
    margin-bottom: 3mm;
  }

  .supplier-print-summary > div {
    padding: 2.3mm 2.7mm;
    border: .6pt solid #d1d5db;
    border-radius: 2mm;
  }

  .supplier-print-shop {
    margin-bottom: .4mm;
    font-size: 10pt;
    font-weight: 750;
  }

  .supplier-print-instruction {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    gap: 2.5mm;
    align-items: start;
  }

  .supplier-print-instruction strong {
    white-space: nowrap;
  }

  .supplier-print-group {
    margin: 0 0 3mm;
    border: .6pt solid #cbd5e1;
    border-radius: 2mm;
    overflow: hidden;
    break-inside: auto;
    page-break-inside: auto;
  }

  .supplier-print-recipient {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 4mm;
    align-items: start;
    padding: 2.2mm 2.7mm;
    background: #f8fafc;
    border-bottom: .6pt solid #cbd5e1;
    break-after: avoid;
    page-break-after: avoid;
  }

  .supplier-print-recipient-main > div:not(.supplier-print-label):not(.supplier-print-recipient-name) {
    margin-top: .35mm;
  }

  .supplier-print-recipient-name {
    margin-bottom: .5mm;
    font-size: 10pt;
    font-weight: 750;
  }

  .supplier-print-address {
    max-width: 135mm;
  }

  .supplier-print-group-meta {
    min-width: 34mm;
    text-align: right;
  }

  .supplier-print-group-meta > strong {
    display: block;
    margin: .8mm 0 .2mm;
    font-size: 10pt;
  }

  .supplier-print-status {
    display: inline-block;
    max-width: 48mm;
    padding: .7mm 1.4mm;
    border: .6pt solid #9ca3af;
    border-radius: 999px;
    color: #374151;
    background: #fff;
    font-size: 6.6pt;
    font-weight: 700;
    line-height: 1.15;
  }

  .supplier-print-status-warning {
    border-color: #d6a400;
    background: #fff8db;
    color: #664d03;
  }

  .supplier-print-status-success {
    border-color: #8ab89a;
    background: #edf8f0;
    color: #255c36;
  }

  .supplier-print-status-danger {
    border-color: #d9a3a9;
    background: #fff1f2;
    color: #842029;
  }

  .supplier-print-table {
    width: 100%;
    margin: 0;
    border-collapse: collapse;
    table-layout: fixed;
    font-size: 7.65pt;
  }

  .supplier-print-table .col-item { width: 4.5%; }
  .supplier-print-table .col-date { width: 13.5%; }
  .supplier-print-table .col-bill-no { width: 12%; }
  .supplier-print-table .col-description { width: 30%; }
  .supplier-print-table .col-money { width: 13%; }
  .supplier-print-table .col-gst { width: 10.5%; }
  .supplier-print-table .col-total { width: 16.5%; }

  .supplier-print-table thead {
    display: table-header-group;
  }

  .supplier-print-table tfoot {
    display: table-row-group;
  }

  .supplier-print-table th,
  .supplier-print-table td {
    padding: 1.25mm 1.4mm;
    border-bottom: .45pt solid #e5e7eb;
    vertical-align: top;
    overflow-wrap: anywhere;
  }

  .supplier-print-table th {
    color: #374151;
    background: #f3f4f6;
    font-size: 7pt;
    font-weight: 750;
    text-align: left;
  }

  .supplier-print-table tr {
    break-inside: avoid;
    page-break-inside: avoid;
  }

  .supplier-print-table tbody tr:last-child td {
    border-bottom: .6pt solid #cbd5e1;
  }

  .supplier-print-table tfoot td {
    padding-top: 1.5mm;
    padding-bottom: 1.5mm;
    background: #f8fafc;
    border-bottom: 0;
    font-weight: 700;
  }

  .supplier-print-table .money {
    text-align: right;
    white-space: nowrap;
  }

  .supplier-print-table .nowrap {
    white-space: nowrap;
  }

  .supplier-print-table .strong {
    font-weight: 750;
  }

  .supplier-print-empty {
    padding: 4mm;
    border: .6pt solid #d1d5db;
  }

  .supplier-print-footer {
    margin-top: 2.5mm;
    padding-top: 2.5mm;
    border-top: 1.25pt solid #111827;
    break-inside: avoid;
    page-break-inside: avoid;
  }

  .supplier-print-footer > div {
    display: flex;
    justify-content: flex-end;
    align-items: baseline;
    gap: 4mm;
  }

  .supplier-print-footer > div span {
    font-size: 8pt;
    font-weight: 700;
  }

  .supplier-print-footer > div strong {
    font-size: 13pt;
  }

  .supplier-print-footer p {
    margin: 1mm 0 0;
    color: #6b7280;
    font-size: 7pt;
    text-align: right;
  }
}

/* Optional client-side GST breakup helper. The Django model still stores only
   the combined GST amount; CGST/SGST/IGST inputs are intentionally unnamed. */
.gst-breakup-helper .gst-breakup-toggle {
  --bs-btn-padding-y: .2rem;
  --bs-btn-padding-x: .55rem;
  --bs-btn-font-size: .78rem;
}

.gst-breakup-panel {
  border-style: dashed !important;
}

.gst-breakup-result {
  padding-top: .6rem;
  border-top: 1px solid var(--bs-border-color);
}

.form-control.gst-total-calculated {
  background-color: var(--bs-tertiary-bg);
  font-weight: 600;
}

/* All raw bills: lightweight AJAX pagination. The list remains fully usable
   without JavaScript; this only adds visual feedback while a fragment loads. */
#billListResults {
  scroll-margin-top: 1rem;
  transition: opacity .16s ease;
}

#billListResults.bill-list-loading {
  opacity: .55;
  pointer-events: none;
}
