* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; background: #f4f6f8; color: #1f2937; font-size: 14px; }

/* ── Auth gate: hide protected-page content until nav.js confirms the
   session via GET /api/auth/me and adds `auth-confirmed` on body.
   Every protected page wraps its content in <main>; login.html has no
   <main>, so the login form stays visible by default. The sidebar sits
   outside <main>, so it also needs gating to avoid a dark-panel flash. */
main { visibility: hidden; }
body.auth-confirmed main { visibility: visible; }
aside.sidebar { visibility: hidden; }
body.auth-confirmed aside.sidebar { visibility: visible; }

.layout { display: flex; min-height: 100vh; }

aside.sidebar {
  width: 220px; background: #0f172a; color: #e2e8f0;
  display: flex; flex-direction: column; padding: 24px 0;
}
aside .brand { padding: 0 20px 24px; font-size: 18px; font-weight: 700; color: #fff; border-bottom: 1px solid #1e293b; }
aside nav { display: flex; flex-direction: column; padding: 16px 0; }
aside nav a {
  padding: 11px 20px; color: #cbd5e1; text-decoration: none;
  border-left: 3px solid transparent; font-weight: 500;
}
aside nav a:hover { background: #1e293b; color: #fff; }
aside nav a.active { background: #1e293b; color: #fff; border-left-color: #3b82f6; }

main { flex: 1; padding: 32px 40px; overflow: auto; }
main h1 { font-size: 22px; font-weight: 600; margin-bottom: 24px; color: #0f172a; }

.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; margin-bottom: 28px; }
.card { background: #fff; border-radius: 8px; padding: 20px; box-shadow: 0 1px 3px rgba(0,0,0,0.06); }
.card .label { font-size: 12px; color: #64748b; text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 8px; }
.card .value { font-size: 24px; font-weight: 700; color: #0f172a; }
.card .sub { font-size: 12px; color: #64748b; margin-top: 4px; }

.panel { background: #fff; border-radius: 8px; padding: 20px; box-shadow: 0 1px 3px rgba(0,0,0,0.06); margin-bottom: 20px; }
.panel h2 { font-size: 15px; font-weight: 600; margin-bottom: 14px; color: #0f172a; }

.aging-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 12px; }
.aging-cell { padding: 14px; border-radius: 6px; background: #f8fafc; border: 1px solid #e2e8f0; }
.aging-cell .label { font-size: 11px; color: #64748b; text-transform: uppercase; }
.aging-cell .value { font-size: 18px; font-weight: 700; margin-top: 6px; }
.aging-cell.b1 { background: #ecfdf5; border-color: #a7f3d0; }
.aging-cell.b2 { background: #fef3c7; border-color: #fde68a; }
.aging-cell.b3 { background: #fed7aa; border-color: #fdba74; }
.aging-cell.b4 { background: #fecaca; border-color: #fca5a5; }
.aging-cell.b5 { background: #fee2e2; border-color: #f87171; }

.filters { display: flex; flex-wrap: wrap; gap: 10px; align-items: end; margin-bottom: 16px; }
.filters .f { display: flex; flex-direction: column; }
.filters label { font-size: 11px; color: #64748b; text-transform: uppercase; margin-bottom: 4px; }
.filters input, .filters select {
  padding: 7px 10px; border: 1px solid #cbd5e1; border-radius: 6px; font-size: 13px; background: #fff;
}
/* Filter-bar buttons don't shrink and don't break their labels across
   lines, so Apply / Clear / Export CSV stay intact when the bar wraps. */
.filters .btn { flex: 0 0 auto; white-space: nowrap; }

/* Panel header row — h2 on the left, action button (e.g. Export CSV)
   on the right. Injected by supplier-funding.js + available-cash.js
   around the existing <h2> so the static HTML stays untouched. */
.panel-header-row {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 14px; gap: 12px;
}
.panel-header-row h2 { margin: 0; }

/* Supplier-count pill row (bookings page) — compact, horizontally
   wrapping pills above the table that show booking count per
   supplier for the current filter set. */
.supplier-count-row {
  display: flex; flex-wrap: wrap; gap: 6px;
  margin-bottom: 12px;
}
.supplier-count-row:empty { display: none; }
.supplier-pill {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 10px;
  background: #eef3fa;
  border: 1px solid #cfddf0;
  border-radius: 999px;
  font-size: 12px;
  color: #1f2937;
  line-height: 1.5;
}
.supplier-pill .sp-name  { font-weight: 500; }
.supplier-pill .sp-count { font-weight: 700; color: #036193; }

/* Success-button variant (used by Save on the Booking Detail page and
   the "+ New Booking" link on the Bookings page). Green so Save is
   visually distinct from the neutral blue primary button. */
.btn.success {
  background: #16a34a; color: #fff; border: 1px solid #15803d;
}
.btn.success:hover { background: #15803d; }
.btn.success:disabled { opacity: 0.6; cursor: not-allowed; }
a.btn.success { text-decoration: none; display: inline-block; }

/* Booking Detail page — toolbar + two-column label/value grid. */
.booking-toolbar {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 16px; gap: 10px; flex-wrap: wrap;
}
.booking-toolbar .toolbar-right {
  display: flex; gap: 8px; flex-wrap: wrap;
}
.booking-detail { padding: 20px 24px; }
.detail-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 4px 32px;
}
.detail-financial {
  margin-top: 16px; padding-top: 14px;
  border-top: 1px solid #e2e8f0;
  display: grid; grid-template-columns: 1fr 1fr; gap: 4px 32px;
}
.detail-row {
  display: grid; grid-template-columns: 170px 1fr;
  padding: 6px 0; border-bottom: 1px dashed #eef2f7;
  align-items: center; gap: 12px; min-height: 36px;
}
.detail-row:last-child { border-bottom: none; }
.detail-row-wide { grid-column: 1 / -1; }
.detail-row .label { color: #64748b; font-size: 12px; text-transform: uppercase; letter-spacing: 0.3px; }
.detail-row .value { color: #0f172a; font-size: 14px; word-break: break-word; }
.detail-row .value .req { color: #dc2626; }
.detail-row .value .value-readonly { color: #475569; font-style: italic; }
.detail-row .value input[type=text],
.detail-row .value input[type=number],
.detail-row .value input[type=date],
.detail-row .value select,
.detail-row .value textarea {
  width: 100%; padding: 6px 8px;
  border: 1px solid #cbd5e1; border-radius: 6px;
  font-size: 13px; background: #fff; font-family: inherit;
}
.detail-row .value textarea { resize: vertical; }
.detail-row .value input[type=number] { max-width: 200px; }
/* Amount + currency side-by-side on the financial rows. */
.detail-financial .detail-row .value {
  display: flex; flex-wrap: wrap; gap: 6px; align-items: center;
}
.detail-financial .detail-row .value input[type=number] { flex: 0 0 160px; }
.detail-financial .detail-row .value select { flex: 0 0 90px; }
.detail-financial .detail-row.detail-row-wide .value { display: block; }
.detail-financial .detail-row.detail-row-wide .value textarea { width: 100%; }

/* BOOKING REF table cell — keep the Session 22-UI blue color even
   though the content is now an anchor. */
.data-table-bookings td.bk-ref a,
.data-table-bookings td.bk-ref a:visited {
  color: #005DFF; font-weight: 600; text-decoration: none;
}
.data-table-bookings td.bk-ref a:hover { text-decoration: underline; }
.data-table-bookings tbody tr.row-cancelled td.bk-ref a { color: #dc3545; }

/* Booking Detail — view-mode color accents that match the bookings
   table palette (Session 22-UI). BOOKING REF / SELLING / NET in
   Etravia blue; PROFIT in bold magenta. */
.booking-detail .detail-row .value.bv-color-blue   { color: #005DFF; font-weight: 600; }
.booking-detail .detail-row .value.bv-color-profit { color: #CC0066; font-weight: 700; }

/* Issue Credit button — amber so it's visually separate from Edit
   (blue), Delete (red), and Save (green). */
.btn.warning {
  background: #f59e0b; color: #fff; border: 1px solid #d97706;
}
.btn.warning:hover { background: #d97706; }
.btn.warning:disabled { opacity: 0.6; cursor: not-allowed; }

/* Credit modal summary strip + live net-preview hint. */
.cr-summary {
  background: #f8fafc; border: 1px solid #e2e8f0; border-radius: 6px;
  padding: 10px 12px; margin-bottom: 12px; font-size: 13px; line-height: 1.7;
}
.cr-summary span { color: #64748b; }
.cr-hint { font-size: 12px; color: #475569; margin-top: 4px; min-height: 18px; }

/* Parent-booking link strip above the detail grid on credit entries. */
.bv-parent-link {
  margin: -6px 0 16px 0; padding: 8px 12px;
  background: #eef3fa; border: 1px solid #cfddf0; border-radius: 6px;
  font-size: 13px;
}
.bv-parent-link span { color: #64748b; }
.bv-parent-link a { color: #036193; font-weight: 600; text-decoration: none; }
.bv-parent-link a:hover { text-decoration: underline; }

/* Credits section appended below the booking detail panel. */
.bv-credits { padding: 20px 24px; margin-top: 16px; }
.bv-credits h2 { margin-bottom: 12px; font-size: 15px; font-weight: 600; color: #0f172a; }

/* Bookings-list badges for the new INVOICE + PAYMENT columns. Small
   rounded pills, sized to match the existing `.badge` cells without
   forcing a wider column. */
.badge-inv,
.badge-paid,
.badge-partial,
.badge-unpaid {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.2px;
  white-space: nowrap;
}
.badge-inv     { background: #e8f0fe; color: #036193; }
.badge-paid    { background: #d4edda; color: #155724; }
.badge-partial { background: #fff3cd; color: #856404; }
.badge-unpaid  { background: #f8d7da; color: #721c24; }

/* Transaction Statement — small under-filter help hint. */
.ts-hint { color: #64748b; font-size: 12px; margin-top: 8px; }

/* Value colors in summary cards + tables — match the bookings-table
   palette (Session 22-UI). SELLING + NET in Etravia blue; PROFIT in
   bold magenta. */
.ts-val-blue   { color: #005DFF; }
.ts-val-profit { color: #CC0066; font-weight: 700; }
.cards .card .value.ts-val-blue   { color: #005DFF; }
.cards .card .value.ts-val-profit { color: #CC0066; }

/* Monthly breakdown: each month is its own <tbody> that toggles
   `.expanded` when the month row is clicked. Agent rows are rendered
   eagerly but hidden by default — CSS handles all visibility so the
   JS can be a single-line classList.toggle. */
#ts-monthly tbody.ts-month .ts-month-row { cursor: pointer; }
#ts-monthly tbody.ts-month .ts-month-row:hover > td { background: #eef3fa; }
#ts-monthly tbody.ts-month .ts-caret::before {
  content: '▶';
  display: inline-block;
  margin-right: 8px;
  color: #64748b;
  font-size: 10px;
  transition: transform 0.15s ease;
}
#ts-monthly tbody.ts-month.expanded .ts-caret::before {
  transform: rotate(90deg);
}
#ts-monthly tbody.ts-month .ts-agent-row { display: none; }
#ts-monthly tbody.ts-month.expanded .ts-agent-row { display: table-row; }
#ts-monthly tbody.ts-month .ts-agent-row > td { background: #f0f7ff; font-size: 12px; }
#ts-monthly tbody.ts-month .ts-agent-row .ts-agent-name { padding-left: 36px; color: #334155; }

/* Total row (monthly + supplier tables) — muted blue band. */
.ts-total-row > td { background: #e8f0fe !important; font-weight: 700; }

/* Expenses module — reuses the `.ts-val-blue` / `.ts-val-profit`
   palette but aliased for readability so a future restyle of the
   Transaction Statement page doesn't have to grep across modules.
   `.exp-ccy-badge` is the small currency label next to the Amount
   input in the New/Edit Expense modal; it updates live when the
   user picks a Market. */
.exp-val-blue   { color: #005DFF; }
.exp-val-profit { color: #CC0066; font-weight: 700; }
.cards .card .value.exp-val-blue   { color: #005DFF; }
.cards .card .value.exp-val-profit { color: #CC0066; }
.exp-ccy-badge {
  display: inline-block; margin-left: 6px; padding: 1px 8px;
  background: #eef2ff; color: #1e3a8a; border-radius: 999px;
  font-size: 11px; font-weight: 600; letter-spacing: 0.3px;
}

/* Company logo in the sidebar brand slot — replaces the text when an
   /api/settings/company response includes a logo_url. */
aside .brand { text-align: center; }
aside .brand img.brand-logo {
  max-height: 50px;
  max-width: 100%;
  display: block;
  margin: 0 auto;
}

/* Company logo in the print-view header (invoice / supplier-payment /
   reconciliation). Keep the same vertical footprint as the original
   text brand so surrounding layout is unchanged. */
.inv-brand-logo {
  max-height: 60px;
  max-width: 240px;
  display: block;
  margin-bottom: 10px;
}
@media print {
  .inv-brand-logo {
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }
}

/* Admin-only "Company Logo" panel on the Dashboard. */
.logo-admin-row {
  display: flex; flex-wrap: wrap; gap: 20px; align-items: flex-start;
}
.logo-preview-box {
  width: 220px; min-height: 80px;
  background: #f8fafc; border: 1px dashed #cbd5e1; border-radius: 6px;
  display: flex; align-items: center; justify-content: center;
  padding: 10px;
}
.logo-preview-box img {
  max-width: 100%; max-height: 80px; display: block;
}
.logo-preview-box .logo-empty {
  color: #64748b; font-size: 12px; font-style: italic;
}
#logo-form { flex: 1 1 260px; display: flex; flex-direction: column; gap: 10px; }
#logo-form .logo-file-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
#logo-form .logo-hint { color: #64748b; font-size: 12px; }

.btn {
  padding: 8px 14px; border: none; border-radius: 6px; font-size: 13px; font-weight: 500;
  cursor: pointer; background: #3b82f6; color: #fff;
}
.btn:hover { background: #2563eb; }
.btn.secondary { background: #e2e8f0; color: #1f2937; }
.btn.secondary:hover { background: #cbd5e1; }
.btn.danger { background: #ef4444; }

table { width: 100%; border-collapse: collapse; background: #fff; }
thead { background: #f1f5f9; }
th, td { padding: 10px 12px; text-align: left; border-bottom: 1px solid #e2e8f0; font-size: 13px; }
th { font-weight: 600; color: #475569; font-size: 12px; text-transform: uppercase; letter-spacing: 0.3px; }
tbody tr:hover { background: #f8fafc; }
.table-wrap { overflow: auto; background: #fff; border-radius: 8px; box-shadow: 0 1px 3px rgba(0,0,0,0.06); }

.badge { padding: 3px 8px; border-radius: 12px; font-size: 11px; font-weight: 500; display: inline-block; }
.badge.ok { background: #dcfce7; color: #166534; }
.badge.warn { background: #fef3c7; color: #92400e; }
.badge.bad { background: #fee2e2; color: #991b1b; }
.badge.gray { background: #e2e8f0; color: #475569; }

.num { text-align: right; font-variant-numeric: tabular-nums; }

.loading, .empty { padding: 40px; text-align: center; color: #64748b; }

.modal-bg {
  display: none; position: fixed; inset: 0; background: rgba(15,23,42,0.5);
  align-items: center; justify-content: center; z-index: 100;
}
.modal-bg.open { display: flex; }
.modal { background: #fff; padding: 24px; border-radius: 10px; width: 440px; max-width: 92vw; }
.modal h3 { margin-bottom: 16px; }
.modal .f { display: flex; flex-direction: column; margin-bottom: 12px; }
.modal label { font-size: 12px; color: #64748b; margin-bottom: 4px; }
.modal input, .modal select { padding: 8px 10px; border: 1px solid #cbd5e1; border-radius: 6px; font-size: 13px; }
.modal .actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px; }

.upload-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.upload-card { background: #fff; padding: 28px; border-radius: 8px; box-shadow: 0 1px 3px rgba(0,0,0,0.06); }
.upload-card h3 { margin-bottom: 8px; }
.upload-card p { color: #64748b; margin-bottom: 16px; }
.upload-card input[type=file] { display: block; margin-bottom: 14px; width: 100%; }
.result { margin-top: 14px; padding: 12px; border-radius: 6px; font-size: 13px; white-space: pre-wrap; }
.result.ok { background: #dcfce7; color: #166534; }
.result.err { background: #fee2e2; color: #991b1b; }

.toast { position: fixed; top: 20px; right: 20px; padding: 12px 18px; border-radius: 6px; color: #fff; z-index: 200; display: none; }
.toast.ok { background: #10b981; }
.toast.err { background: #ef4444; }
.toast.show { display: block; }

.actions-cell { display: flex; gap: 8px; justify-content: center; }
.btn-icon {
  background: transparent; border: 1px solid #e5e7eb; border-radius: 6px;
  padding: 6px 10px; cursor: pointer; font-size: 16px; transition: all .15s;
}
.btn-icon:hover { background: #f3f4f6; border-color: #9ca3af; }

.service-cell .service-type   { font-weight: 600; color: #111; font-size: .875rem; }
.service-cell .service-detail {
  font-size: .75rem; color: #6b7280; margin-top: 2px;
  max-width: 200px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

.modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,.5);
  display: flex; align-items: center; justify-content: center; z-index: 1000;
}
.modal {
  background: white; border-radius: 8px; padding: 24px; width: 420px;
  max-height: 90vh; overflow-y: auto;
}
.modal.modal-wide { width: 680px; max-width: 92vw; }
.modal h2 { margin-top: 0; }
.modal label { display: block; margin-top: 12px; font-size: .875rem; font-weight: 500; }
.modal input, .modal select, .modal textarea {
  width: 100%; padding: 8px; border: 1px solid #d1d5db; border-radius: 6px; margin-top: 4px;
  font-family: inherit; font-size: 13px;
}
.modal textarea { resize: vertical; }
.modal-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 20px; }
.checkbox-label { display: flex; align-items: center; gap: 8px; }

/* Two-column form grid used by the Suppliers page modal. */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 16px; }
.form-grid .fg-field label { margin-top: 10px; }
.form-grid .fg-full { grid-column: 1 / -1; }

/* Supplier-payments detail-modal meta strip. */
.detail-meta { display: grid; grid-template-columns: 1fr 1fr; gap: 4px 16px; font-size: 13px; }
.detail-meta strong { color: #334155; }

/* Fixed-layout data tables (used on the Supplier Payments page) — column
   widths come from <colgroup>; text cells truncate with an ellipsis so a
   long SERVICE / NOTE / PAX value can't shove the ACTIONS column off
   screen. Number + action cells opt out of truncation. */
.data-table.tbl-fixed { table-layout: fixed; width: 100%; }
.data-table.tbl-fixed th,
.data-table.tbl-fixed td {
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.data-table.tbl-fixed td.num,
.data-table.tbl-fixed th.num,
.data-table.tbl-fixed td.col-actions,
.data-table.tbl-fixed th.col-actions { overflow: visible; }
.data-table.tbl-fixed td.col-actions,
.data-table.tbl-fixed th.col-actions { text-align: right; white-space: nowrap; }
.data-table.tbl-fixed td.col-actions .btn,
.data-table.tbl-fixed td.col-actions .btn-icon { vertical-align: middle; }

/* Supplier Payments — Payment History: centre the BOOKINGS count and
   make long notes reveal on hover via the title attribute. */
#sp-history-table th:nth-child(6),
#sp-history-table td:nth-child(6) { text-align: center; }
#sp-history-table td:nth-child(8) { text-align: right; }

.upload-section {
  background: white; padding: 20px; border-radius: 8px;
  margin-bottom: 20px; border: 1px solid #e5e7eb;
}
.upload-section h2 { margin-top: 0; }
.btn-row { display: flex; gap: 8px; margin-top: 12px; }
.preview { margin-top: 16px; padding: 12px; background: #f9fafb; border-radius: 6px; }
.preview-stats { display: flex; gap: 20px; flex-wrap: wrap; }
.stat-ok   { color: #059669; }
.stat-warn { color: #d97706; }
.stat-err  { color: #dc2626; }
.preview details { margin-top: 10px; }
.preview ul { max-height: 200px; overflow-y: auto; font-size: .8rem; }

.badge-yes { background: #d1fae5; color: #065f46; }
.badge-no  { background: #fee2e2; color: #991b1b; }

.stats-row { display: flex; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.stat-card {
  background: white; border: 1px solid #e5e7eb; border-radius: 8px;
  padding: 12px 16px; min-width: 120px; flex: 1;
}
.stat-label { font-size: .75rem; color: #6b7280; text-transform: uppercase; letter-spacing: .05em; }
.stat-sub   { font-size: .75rem; color: #6b7280; margin-top: 4px; min-height: 1em; }
.pay-credit   { background: #e0e7ff; color: #3730a3; }
.pay-overpaid { background: #f3e8ff; color: #6b21a8; }
.amt-overpaid { color: #6b21a8; font-weight: 600; }

/* Print-view footer block (used by supplier-payment-view and reconciliation-view) */
.inv-foot { margin-top: 24px; padding-top: 14px; border-top: 1px solid #e5e7eb; font-size: 12px; line-height: 1.7; }
.inv-foot span, .inv-foot-line span, .inv-note span { color: #64748b; }
.inv-note { margin-bottom: 6px; }

/* Available Cash — summary cards (one per currency). */
.cash-card-row { display: flex; gap: 12px; flex-wrap: wrap; }
.cash-card {
  flex: 1 1 260px; min-width: 240px;
  background: #fff; border: 1px solid #e5e7eb; border-radius: 8px;
  padding: 16px; box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}
.cash-card .cc-ccy {
  font-size: 18px; font-weight: 700; color: #0f172a;
  margin-bottom: 10px; padding-bottom: 6px; border-bottom: 2px solid #e5e7eb;
}
.cash-card .cc-line {
  display: flex; justify-content: space-between; font-size: 13px; padding: 3px 0;
}
.cash-card .cc-line span { color: #475569; }
.cash-card .cc-line strong { font-variant-numeric: tabular-nums; }
.cash-card .cc-divider { border-top: 1px solid #cbd5e1; margin: 8px 0; }
.cash-card .cc-total { font-size: 14px; font-weight: 600; }
.cash-card .cc-total strong { font-size: 15px; }

/* Settings panel header row */
.settings-header { display: flex; justify-content: space-between; align-items: center; }
.stat-value { font-size: 1.5rem; font-weight: 600; color: #111; margin-top: 4px; }

input[type=number]::-webkit-inner-spin-button,
input[type=number]::-webkit-outer-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
input[type=number] {
  -moz-appearance: textfield;
}

.row-cancelled {
  background-color: rgba(220, 53, 69, 0.08);
}
.row-cancelled td {
  color: #dc3545;
}
tbody tr.row-cancelled:hover { background: rgba(220, 53, 69, 0.14); }

.filters .f.search-wrap { position: relative; }
.autocomplete {
  position: absolute;
  top: 100%;
  left: 0;
  min-width: 280px;
  max-width: 360px;
  background: #fff;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  box-shadow: 0 6px 18px rgba(15, 23, 42, 0.12);
  max-height: 260px;
  overflow-y: auto;
  z-index: 50;
  margin-top: 2px;
}
.autocomplete .suggestion {
  padding: 8px 10px;
  font-size: 13px;
  cursor: pointer;
  border-bottom: 1px solid #f1f5f9;
}
.autocomplete .suggestion:last-child { border-bottom: none; }
.autocomplete .suggestion:hover { background: #f1f5f9; }
.autocomplete .suggestion .ref {
  color: #64748b;
  font-size: 11px;
  margin-top: 2px;
  font-variant-numeric: tabular-nums;
}
.autocomplete .suggestion.empty {
  color: #94a3b8;
  cursor: default;
  font-style: italic;
}
.autocomplete .suggestion.empty:hover { background: transparent; }

/* ── Invoices page ─────────────────────────────────────────── */
.data-table tr.row-credit td { background: #fff1f2; }
.amt-neg { color: #dc2626; font-weight: 600; }
.amt-paid    { color: #0C447C; font-weight: 600; }
.amt-due     { color: #A32D2D; font-weight: 600; }
.amt-settled { color: #166534; font-weight: 600; }
.amt-muted   { color: #6b7280; }
.amt-total   { color: #0C447C; font-weight: 700; }
.pay-input-bold { font-weight: 600; }
.result { margin-top: 12px; padding: 10px 12px; border-radius: 6px; font-size: 13px; }
.warn-line { margin-top: 8px; padding: 8px 12px; background: #fef3c7; border-left: 3px solid #f59e0b; color: #92400e; font-size: 13px; border-radius: 4px; }
.btn[disabled] { opacity: 0.5; cursor: not-allowed; }
.data-table tfoot th { background: #f1f5f9; font-weight: 600; padding: 10px 12px; }

/* ── Invoice view — Etravia template ────────────────────────── */
.invoice-main { padding: 24px 40px; background: #f4f6f8; }
.invoice-toolbar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; }
.invoice-doc {
  background: #fff; padding: 40px 48px; border-radius: 6px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.08);
  max-width: 900px; margin: 0 auto; color: #0f172a;
}

.inv-head { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 28px; padding-bottom: 16px; border-bottom: 2px solid #e5e7eb; }
.inv-brand { font-size: 28px; font-weight: 800; letter-spacing: 2px; color: #0f172a; margin-bottom: 10px; }
.inv-meta { font-size: 13px; line-height: 1.7; }
.inv-meta span { color: #64748b; }
.inv-logo {
  font-size: 20px; font-weight: 700; color: #3b82f6;
  padding: 10px 16px; border: 2px solid #3b82f6; border-radius: 6px;
  letter-spacing: 1px;
}

.inv-top { display: flex; justify-content: space-between; gap: 24px; margin-bottom: 28px; }
.bill-to { flex: 1; }
.bt-label { font-size: 11px; color: #64748b; text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 6px; }
.bt-name { font-size: 16px; font-weight: 700; color: #0f172a; }
.bt-country { font-size: 13px; color: #475569; margin-top: 2px; }

.summary-box {
  border: 1px solid #cbd5e1; border-radius: 6px; padding: 14px 16px;
  min-width: 280px; background: #f8fafc;
}
.summary-box .sb-row { display: flex; justify-content: space-between; padding: 4px 0; font-size: 13px; }
.summary-box .sb-row span { color: #475569; }
.summary-box .sb-row strong { color: #0f172a; font-variant-numeric: tabular-nums; }
.summary-box .sb-row.total { border-top: 1px solid #cbd5e1; margin-top: 6px; padding-top: 8px; font-size: 14px; }

.inv-lines { width: 100%; border-collapse: collapse; margin-top: 8px; }
.inv-lines th, .inv-lines td {
  padding: 10px 12px; border: 1px solid #e2e8f0; font-size: 13px; text-align: left;
}
.inv-lines tr.hdr-yellow th {
  background: #fde68a; color: #78350f;
  font-weight: 700; text-transform: uppercase; letter-spacing: 0.3px; font-size: 12px;
}
.inv-lines tr.row-credit td { background: #fff1f2; }
.inv-lines .num { text-align: right; font-variant-numeric: tabular-nums; }
.inv-lines tr.inv-total-row th {
  background: #fde68a; color: #78350f; font-size: 14px; font-weight: 800;
  padding: 12px; letter-spacing: 0.3px;
}
.inv-lines tr.inv-total-row th.total-label { text-align: right; }

/* ── Print styles ────────────────────────────────────────────── */
@media print {
  body { background: #fff; }
  aside.sidebar, .no-print, .invoice-toolbar { display: none !important; }
  .layout { display: block; }
  main, .invoice-main { padding: 0; background: #fff; }
  .invoice-doc { box-shadow: none; border: none; padding: 0; max-width: 100%; margin: 0; }
  .inv-lines tr { break-inside: avoid; }
  @page { margin: 14mm; }
}

/* ── Auth: top-right user menu (injected by nav.js::mountUserMenu)
   Fixed-position pill in the page's top-right that drops a menu with
   Change Password + Logout. Uses `.no-print` so it disappears on the
   invoice / supplier-payment / reconciliation print views. */
.user-menu {
  position: fixed; top: 14px; right: 20px; z-index: 50;
  font-size: 13px;
}
.user-menu-button {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 12px; border: 1px solid #cbd5e1; border-radius: 999px;
  background: #fff; color: #0f172a; cursor: pointer; font-size: 13px;
  box-shadow: 0 1px 2px rgba(0,0,0,0.04);
}
.user-menu-button:hover { background: #f1f5f9; }
.user-menu-name { font-weight: 600; }
.user-menu-caret { color: #64748b; font-size: 11px; }
.user-menu-dropdown {
  position: absolute; top: calc(100% + 6px); right: 0;
  min-width: 180px; background: #fff; border: 1px solid #e2e8f0;
  border-radius: 8px; box-shadow: 0 8px 20px rgba(0,0,0,0.10);
  padding: 6px; display: flex; flex-direction: column;
}
.user-menu-dropdown[hidden] { display: none; }
.user-menu-item {
  padding: 8px 12px; background: transparent; border: 0; text-align: left;
  font-size: 13px; color: #0f172a; cursor: pointer; border-radius: 6px;
}
.user-menu-item:hover { background: #f1f5f9; }

/* Change-password modal — password field + eye-icon toggle. The
   input stays the standard `.modal input` style; the wrapper lets the
   toggle button overlay the input's right edge without shifting the
   form layout. */
.cp-pw-wrap { position: relative; display: block; }
.cp-pw-wrap input {
  width: 100%;
  padding-right: 38px; /* reserve space for the overlaid toggle */
}
.cp-pw-toggle {
  position: absolute; top: 50%; right: 6px;
  transform: translateY(-50%);
  width: 28px; height: 28px; padding: 0;
  display: inline-flex; align-items: center; justify-content: center;
  background: transparent; border: 0; border-radius: 6px;
  cursor: pointer; font-size: 14px; line-height: 1; color: #64748b;
}
.cp-pw-toggle:hover  { background: #f1f5f9; color: #0f172a; }
.cp-pw-toggle:focus  { outline: 2px solid #3b82f6; outline-offset: 1px; }
.cp-pw-toggle-active { color: #0f172a; }

/* Change-password modal feedback line — .cp-msg is rendered inside a
   `.modal-bg.open` so the dialog frame is already handled. Only the
   inline success/error banner needs styling. */
.cp-msg {
  margin-top: 8px; padding: 8px 10px; border-radius: 6px;
  font-size: 12px;
}
.cp-msg-error { background: #fee2e2; color: #991b1b; border: 1px solid #fca5a5; }
.cp-msg-ok    { background: #dcfce7; color: #166534; border: 1px solid #86efac; }

/* ── Auth: logged-in user chip + logout button in sidebar ────── */
aside .user-chip {
  padding: 14px 20px; border-bottom: 1px solid #1e293b;
  color: #cbd5e1;
}
aside .user-chip .u-name { font-size: 13px; font-weight: 600; color: #f1f5f9; }
aside .user-chip .u-role {
  font-size: 10px; margin-top: 2px; color: #64748b;
  text-transform: uppercase; letter-spacing: 0.5px;
}
aside .sidebar-foot {
  margin-top: auto; padding: 16px 20px;
  border-top: 1px solid #1e293b;
}
.btn-logout { width: 100%; }

/* ── Auth: login page ────────────────────────────────────────── */
body.login-body { background: #0f172a; }
.login-shell {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  padding: 24px;
}
.login-card {
  width: 100%; max-width: 380px; background: #fff; border-radius: 10px;
  padding: 32px 28px; box-shadow: 0 8px 24px rgba(0,0,0,0.25);
}
.login-brand {
  font-size: 20px; font-weight: 700; color: #0f172a; text-align: center;
}
.login-sub {
  text-align: center; color: #64748b; font-size: 13px; margin-top: 6px;
  margin-bottom: 22px;
}
#login-form .f { display: flex; flex-direction: column; margin-bottom: 14px; }
#login-form label {
  font-size: 11px; color: #64748b; text-transform: uppercase;
  letter-spacing: 0.4px; margin-bottom: 6px;
}
#login-form input {
  padding: 10px 12px; border: 1px solid #cbd5e1; border-radius: 6px;
  font-size: 14px; background: #fff;
}
#login-form input:focus { outline: 2px solid #3b82f6; outline-offset: 1px; }
.btn-login {
  width: 100%; padding: 10px; font-size: 14px; font-weight: 600; margin-top: 6px;
}
.btn-login:disabled { opacity: 0.6; cursor: not-allowed; }

/* ── Bookings: Export CSV button ─────────────────────────────── */
.btn.btn-export {
  background: #fff; color: #0f172a;
  border: 1px solid #0f172a;
}
.btn.btn-export:hover { background: #0f172a; color: #fff; }
.login-error {
  background: #fee2e2; color: #991b1b; border: 1px solid #fecaca;
  padding: 10px 12px; border-radius: 6px; font-size: 13px; margin-bottom: 14px;
}

/* ── Session 16 — Receipts on invoice-view ───────────────────── */
.receipts-section {
  max-width: 900px; margin: 24px auto 48px;
}
.receipts-card {
  background: #fff; padding: 20px 24px; border-radius: 8px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.06); margin-bottom: 16px;
}
.receipts-card h2 {
  font-size: 15px; font-weight: 600; margin-bottom: 14px; color: #0f172a;
}
.receipts-header {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 14px;
}
.receipts-header h2 { margin-bottom: 0; }

.payment-summary { max-width: 420px; }
.payment-summary .ps-row {
  display: flex; justify-content: space-between; padding: 6px 0;
  font-size: 14px; border-bottom: 1px dashed #e2e8f0;
}
.payment-summary .ps-row:last-child { border-bottom: none; }
.payment-summary .ps-row span { color: #475569; }
.payment-summary .ps-row strong { color: #0f172a; font-variant-numeric: tabular-nums; }
.payment-summary .ps-balance strong { font-weight: 700; }

/* Payment-status badges (invoice-view + invoice list). */
.pay-badge {
  display: inline-block; padding: 3px 10px; border-radius: 12px;
  font-size: 11px; font-weight: 600; letter-spacing: 0.3px;
  text-transform: uppercase;
}
.pay-unpaid         { background: #fee2e2; color: #b91c1c; }
.pay-partially_paid { background: #fef3c7; color: #92400e; }
.pay-paid           { background: #dcfce7; color: #166534; }

.receipt-form { margin-bottom: 14px; }
.receipt-form .filters { margin-bottom: 10px; }
.receipt-form input[readonly] {
  background: #f1f5f9; color: #475569;
}

/* ── Session B — shared data-table restyle ─────────────────────
   Framed header bar (#036193 on #024b73 border, white centered
   text), light grid on body cells, alternating row backgrounds.
   Applied to every table that carries `.data-table`. Beats the
   generic `th, td` rules near the top of this file by specificity. */
.data-table {
  width: 100%;
  border-collapse: collapse;
  background: #fff;
}
.data-table thead th {
  background: #036193;
  color: #ffffff;
  text-align: center;
  vertical-align: middle;
  font-weight: 700;
  font-size: 12px;
  letter-spacing: 0.3px;
  text-transform: uppercase;
  border: 1px solid #024b73;
  padding: 10px 10px;
}
.data-table tbody td {
  border: 1px solid #e0e0e0;
  padding: 8px 10px;
  font-size: 13px;
  text-align: center;
  vertical-align: middle;
  color: #1f2937;
}
.data-table tbody tr > td                       { background: #ffffff; }
.data-table tbody tr:nth-child(even) > td       { background: #f8f9fa; }
.data-table tbody tr:hover > td                 { background: #eef3fa; }
.data-table tbody tr.row-credit > td,
.data-table tbody tr.row-credit:hover > td      { background: #fff1f2; }
.data-table tbody tr.row-cancelled > td,
.data-table tbody tr.row-cancelled:hover > td   { background: rgba(220, 53, 69, 0.08); color: #dc3545; }

/* Alignment helpers — opt-in left / right per column. `.num` is kept
   right-aligned (existing convention) and exempt from the centered
   default above. */
.data-table th.num, .data-table td.num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}
.data-table th.txt-left, .data-table td.txt-left { text-align: left; }

/* Compact density modifier (bookings page — 15 cols need tighter cells). */
.data-table-compact thead th { padding: 4px 8px; font-size: 11px; }
.data-table-compact tbody td { padding: 4px 8px; font-size: 12px; }

/* ── Bookings table: natural widths, horizontal scroll, sticky REF ─
   The 15-column bookings table is allowed to take its natural width.
   When that exceeds the viewport, the `.table-wrap` parent scrolls
   horizontally (scrollbar is always visible so users see the scroll
   affordance). BOOKING REF is sticky with a white background so it
   stays readable while scrolling.

   No `table-layout: fixed`, no `max-width`, no `text-overflow: ellipsis`
   — values render in full, with `white-space: nowrap` so nothing wraps
   awkwardly onto a second line.

   Column colors preserved: BOOKING REF / AGENT / SELLING / NET in
   Etravia blue (#005DFF); PROFIT in bold magenta (#CC0066). Numeric
   <th>s carry .num which the global rule right-aligns; bookings
   wants the header centered, so it's re-centered here. */
.data-table-bookings thead th.num { text-align: center; }
.data-table-bookings th,
.data-table-bookings td             { white-space: nowrap; }
.data-table-bookings td.bk-ref      { color: #005DFF; font-weight: 600; }
.data-table-bookings td.bk-agent    { color: #005DFF; text-align: left; }
.data-table-bookings td.bk-selling  { color: #005DFF; text-align: right; font-variant-numeric: tabular-nums; }
.data-table-bookings td.bk-net      { color: #005DFF; text-align: right; font-variant-numeric: tabular-nums; }
.data-table-bookings td.bk-profit   { color: #CC0066; font-weight: 700; text-align: right; font-variant-numeric: tabular-nums; }
.data-table-bookings td.bk-cname,
.data-table-bookings td.bk-supplier,
.data-table-bookings td.bk-pax,
.data-table-bookings td.bk-service  { text-align: left; }

/* Preserve the cancelled-row red across bk-* colored columns so
   status is never lost under a column tint. */
.data-table-bookings tbody tr.row-cancelled td.bk-ref,
.data-table-bookings tbody tr.row-cancelled td.bk-agent,
.data-table-bookings tbody tr.row-cancelled td.bk-selling,
.data-table-bookings tbody tr.row-cancelled td.bk-net,
.data-table-bookings tbody tr.row-cancelled td.bk-profit { color: #dc3545; }

/* Force the wrapper's horizontal scrollbar to always show (not just
   on hover) so the scroll affordance is obvious. Scoped to the
   wrapper that contains the bookings table via :has so other pages'
   .table-wrap stays on the default `overflow: auto`. */
.table-wrap:has(.data-table-bookings) { overflow-x: scroll; }

/* Sticky BOOKING REF so it stays visible during horizontal scroll.
   An opaque background is required — a transparent sticky cell
   would let the scrolled columns bleed through. Body cells are
   white per spec; the header keeps the #036193 table-header blue. */
.data-table-bookings thead th:first-child,
.data-table-bookings tbody td:first-child {
  position: sticky;
  left: 0;
  z-index: 1;
  background: #ffffff;
  box-shadow: 1px 0 0 #024b73;
}
.data-table-bookings thead th:first-child { z-index: 3; background: #036193; }
