/*
  Vahivat design tokens — the same palette sampled from the brand artwork for
  the earlier HTML prototype (see docs/03-Architecture-Decisions.md §12): navy
  ink, blue brand, amber accent, Jama green / Udhar red for the ledger sign
  convention. The prototype's bespoke "ledger book" ruled-paper motifs were
  deliberately simplified here to plain, solid admin-panel patterns so the Web
  build could cover more screens in the time available — a conscious trade of
  visual fidelity for functional breadth, not an oversight.
*/
:root {
  --ink: #0A2263;
  --ink-2: #12306F;
  --brand: #0F55C4;
  --brand-600: #0C4AAC;
  --brand-soft: #E9F0FC;
  --amber: #F2A20A;
  --amber-soft: #FEF4DC;
  --jama: #0A7A43;
  --jama-soft: #E4F4EB;
  --jama-line: #9ED4B4;
  --udhar: #BF2F2A;
  --udhar-soft: #FBEAE9;
  --udhar-line: #EDB6B2;
  --paper: #F3F4F7;
  --rule: #E2E5EB;
  --rule-soft: #ECEEF2;
  --rule-strong: #C9CED8;
  --muted: #5A6280;
  --faint: #838AA3;
  --ink-3: #1C3E85;
  --margin-red: #DE8F88;
  --r-lg: 14px;
  --r: 10px;
  --r-sm: 7px;
  --sb-w-mini: 76px;
  --font: "Segoe UI", "Noto Sans Gujarati", system-ui, -apple-system, Roboto, sans-serif;
}

body { font-family: var(--font); background: var(--paper); color: var(--ink); }

.amt-jama { color: var(--jama) !important; font-weight: 600; }
.amt-udhar { color: var(--udhar) !important; font-weight: 600; }
.gu-text { font-size: .86em; color: var(--muted); margin-left: 4px; }

/* Form controls — applies everywhere, no per-page markup needed */
.form-control, .form-select { border-color: var(--rule-strong); border-radius: var(--r-sm); min-height: 40px; font-size: 15px; color: var(--ink); }
.form-control:focus, .form-select:focus { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(15,85,196,.18); }
.form-control[readonly] { background: var(--paper); color: var(--muted); }
.form-check-input:checked { background-color: var(--brand); border-color: var(--brand); }
.form-check-input:focus { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(15,85,196,.18); }
.input-group-text { background: var(--paper); border-color: var(--rule-strong); color: var(--muted); border-radius: var(--r-sm); }

/* Udhar/Jama party fields — colored dot + tinted input, ported from the prototype's Hawala/Special entry forms */
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; flex: 0 0 auto; background: var(--rule-strong); margin-right: 4px; }
.party-udhar .dot { background: var(--udhar); }
.party-jama .dot { background: var(--jama); }
.party-udhar .form-control { border-color: var(--udhar-line); background-color: #FFFBFB; }
.party-jama .form-control { border-color: var(--jama-line); background-color: #FBFEFC; }
.party-udhar .form-control:focus { border-color: var(--udhar); box-shadow: 0 0 0 3px rgba(191,47,42,.14); }
.party-jama .form-control:focus { border-color: var(--jama); box-shadow: 0 0 0 3px rgba(13,122,85,.14); }
.tag-auto { font-size: 11px; font-weight: 500; color: var(--muted); background: var(--paper); border: 1px solid var(--rule); border-radius: 999px; padding: 0 7px; line-height: 17px; }

/* App shell */
.app-shell { display: flex; min-height: 100vh; }
.sidebar { width: 250px; flex: 0 0 250px; background: var(--ink); color: #D3DBEF; display: flex; flex-direction: column; }
.sidebar .brand { display: flex; align-items: center; gap: 12px; padding: 18px 18px 12px; min-height: var(--topbar-h, 64px); }
.sidebar .brand img { width: 40px; height: 40px; border-radius: 11px; box-shadow: 0 2px 8px rgba(0,0,0,.28); }
.sidebar .brand-name { color: #fff; font-weight: 700; font-size: 20px; letter-spacing: .08em; line-height: 1.1; }
.sidebar .brand-tag { font-size: 12.5px; color: #94A2CA; }
.sidebar nav { flex: 1; overflow-y: auto; padding: 4px 12px 12px; scrollbar-width: thin; scrollbar-color: #2C4288 transparent; }
.sidebar .nav-link { color: #D3DBEF; padding: 7px 10px; border-radius: 8px; display: flex; align-items: center; gap: 12px; font-size: 14.5px; font-weight: 500; position: relative; }
.sidebar .nav-link i { font-size: 17px; width: 20px; text-align: center; color: #A3B2D8; flex: 0 0 auto; }
.sidebar .nav-link:hover { background: var(--ink-2); color: #fff; }
.sidebar .nav-link.active { background: var(--ink-3); color: #fff; }
.sidebar .nav-link.active::before { content: ""; position: absolute; left: -12px; top: 7px; bottom: 7px; width: 3px; border-radius: 0 3px 3px 0; background: var(--amber); }
.sidebar .nav-link.active i { color: var(--amber); }
.sidebar .nav-group { font-size: 12.5px; color: #8D9CC6; padding: 16px 10px 6px; font-weight: 500; }
.sidebar .user-box { border-top: 1px solid #26397B; padding: 14px 16px; font-size: 13.5px; color: #C4CBE8; }

.main-col { flex: 1; min-width: 0; }
.topbar { background: rgba(255,255,255,.97); border-bottom: 1px solid var(--rule); min-height: var(--topbar-h, 64px); padding: 8px 24px; display: flex; align-items: center; gap: 14px; }
.topbar h1 { font-size: 19px; font-weight: 600; margin: 0; color: var(--ink); }
.page-sub { font-size: 13.5px; color: var(--muted); margin: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.content-area { padding: 24px; max-width: 1480px; }

/* Form section dividers — groups a long entry form into scannable parts */
.form-section { font-size: 14px; font-weight: 600; color: var(--ink); margin: 0 0 12px; display: flex; align-items: center; gap: 10px; }
.form-section::after { content: ""; flex: 1; height: 1px; background: var(--rule); }

/* Dashboard date hero */
.day-head { display: flex; flex-wrap: wrap; align-items: center; gap: 14px 26px; margin-bottom: 18px; }
.day-stamp { display: flex; align-items: center; gap: 14px; }
.day-num { font-size: 50px; font-weight: 600; line-height: .9; color: var(--ink); letter-spacing: -.02em; font-variant-numeric: lining-nums tabular-nums; padding: 4px 16px 0 0; border-right: 4px double var(--margin-red); }
.day-meta { display: flex; flex-direction: column; line-height: 1.25; }
.day-meta .wd { font-size: 18px; font-weight: 600; color: var(--ink); }
.day-meta .my { font-size: 14.5px; color: var(--muted); }
.day-sub { margin: 0; color: var(--muted); font-size: 14px; max-width: 40ch; }
@media (max-width: 575.98px) { .day-num { font-size: 40px; } }

/* Language toggle */
.lang-toggle .btn { font-weight: 600; }

/* Cards / panels */
.panel { background: #fff; border: 1px solid var(--rule); border-radius: var(--r-lg); margin-bottom: 20px; }
.panel-head { padding: 15px 20px; border-bottom: 1px solid var(--rule); display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.panel-head h2 { font-size: 16.5px; font-weight: 600; margin: 0; }
.panel-body { padding: 20px; }

/* Reports — side nav, filter row, summary chips */
.rpt-nav { background: #fff; border: 1px solid var(--rule); border-radius: var(--r-lg); padding: 8px; }
.rpt-group { font-size: 12.5px; color: var(--faint); padding: 10px 10px 4px; font-weight: 500; }
.rpt-link { display: flex; align-items: center; gap: 10px; width: 100%; text-align: left; border: 0; background: none; padding: 8px 10px; border-radius: 8px; font-size: 14.5px; color: var(--ink); line-height: 1.3; text-decoration: none; }
.rpt-link:hover { background: var(--paper); }
.rpt-link.active { background: var(--brand-soft); color: var(--brand); font-weight: 600; }
.rpt-filters { display: flex; flex-wrap: wrap; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--rule); background: #FCFCFD; }
.rf { flex: 0 1 170px; min-width: 140px; }
.rf-q { flex: 1 1 220px; }
.rf .form-label { font-size: 12.5px; color: var(--muted); }
.rf .form-control, .rf .form-select { min-height: 38px; font-size: 14px; }
.sum-row { display: flex; flex-wrap: wrap; gap: 10px 30px; padding: 14px 20px; border-bottom: 1px solid var(--rule); }
.sum-item { display: flex; flex-direction: column; line-height: 1.25; }
.sum-item .l { font-size: 12.5px; color: var(--muted); }
.sum-item .v { font-size: 17px; font-weight: 600; font-variant-numeric: tabular-nums; }

/* KPI strip */
.kpi-strip { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 1px; background: var(--rule); border: 1px solid var(--rule); border-radius: var(--r-lg); overflow: hidden; }
.kpi-cell { background: #fff; padding: 16px 18px; }
.kpi-cell .l { font-size: 13px; color: var(--muted); font-weight: 500; }
.kpi-cell .v { font-size: 27px; font-weight: 600; color: var(--ink); font-variant-numeric: tabular-nums; }
.kpi-cell .n { font-size: 12.5px; color: var(--faint); }

/* Two-sided book (Dashboard / Balance Sheet) */
.book-row { display: grid; grid-template-columns: 1fr 1fr; gap: 0; border: 1px solid var(--rule); border-radius: var(--r-lg); overflow: hidden; }
.book-side { background: #fff; padding: 0; }
.book-side + .book-side { border-left: 3px double var(--margin-red); }
.book-side .side-head { padding: 12px 16px; border-bottom: 2px solid var(--ink); font-weight: 600; display: flex; justify-content: space-between; }
.book-side table { width: 100%; font-size: 14px; margin: 0; }
.book-side td { padding: 8px 16px; border-bottom: 1px solid #eee; }
.book-side .total-row td { font-weight: 700; border-top: 1px solid var(--rule-strong); background: #FBFBFD; }

/* Tables */
.table-tools { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
table.data-table { font-size: 14px; font-variant-numeric: tabular-nums; }
table.data-table th { font-size: 12.5px; color: var(--muted); font-weight: 600; white-space: nowrap; background: #FAFBFC; border-bottom: 1px solid var(--rule-strong); }
table.data-table td { vertical-align: middle; border-bottom: 1px solid var(--rule-soft); }
table.data-table tbody tr.clickable { cursor: pointer; }
table.data-table tbody tr.clickable:hover { background: #F6F7FA; }

.badge-cash { background: #EDEFF4; color: #3E4560; }
.badge-credit { background: var(--brand-soft); color: var(--brand); }
.badge-jama { background: var(--jama-soft); color: var(--jama); }
.badge-udhar { background: var(--udhar-soft); color: var(--udhar); }
.badge-active { background: var(--jama-soft); color: var(--jama); }
.badge-inactive { background: #EDEFF4; color: var(--muted); }

/* Ledger effect slip */
.slip { border: 1px solid var(--rule); border-radius: var(--r-lg); background: #fff; overflow: hidden; }
.slip-head { padding: 13px 18px 11px; border-bottom: 2px solid var(--ink); font-weight: 600; font-size: 15.5px; }
.slip-row { padding: 12px 16px; border-bottom: 1px solid #eee; font-size: 13.5px; }
.slip-warn { color: #8A5A00; background: #FFFBF2; padding: 12px 16px; font-size: 14px; }

.req::after { content: " *"; color: var(--udhar); }
.form-text-note { font-size: 12.5px; color: var(--muted); }

.pager .page-link { color: var(--brand); }
.pager .active .page-link { background: var(--brand); border-color: var(--brand); }

.btn { border-radius: 8px; font-weight: 500; }
.btn-primary { background: var(--brand); border-color: var(--brand); }
.btn-primary:hover { background: var(--brand-600); border-color: var(--brand-600); }

/* Segmented toggle — pill-style alternative to a plain btn-group */
.seg { display: inline-flex; flex-wrap: nowrap; background: #E8EAF0; border-radius: 11px; padding: 4px; gap: 2px; max-width: 100%; overflow-x: auto; scrollbar-width: none; }
.seg::-webkit-scrollbar { display: none; }
.seg .seg-btn { border: 0; background: transparent; color: var(--muted); font-weight: 500; font-size: 14.5px; padding: 7px 14px; border-radius: 8px; white-space: nowrap; display: inline-flex; align-items: center; justify-content: center; gap: 7px; line-height: 1.3; text-decoration: none; }
.seg .seg-btn:hover { color: var(--ink); }
.seg .seg-btn.active, .seg .btn-check:checked + .seg-btn { background: #fff; color: var(--ink); box-shadow: 0 1px 2px rgba(10,34,99,.16), 0 0 0 1px rgba(10,34,99,.05); }
.seg .btn-check:checked + .seg-btn.is-jama { color: var(--jama); }
.seg .btn-check:checked + .seg-btn.is-udhar { color: var(--udhar); }
.seg-radio { display: flex; width: 100%; min-height: 40px; }
.seg-radio .seg-btn { flex: 1; }

/* ==========================================================================
   Bilingual labels — ported from the v3 HTML prototype
   --------------------------------------------------------------------------
   The prototype writes the Gujarati inline after every English label, styled
   smaller and quieter so it reads as a gloss rather than as a second label
   competing for attention. IBilingual produces the same markup from the
   resource files; these are the prototype's rules, kept close to the original
   values so the two builds look like the same product.
   ========================================================================== */
:root { --font: "Hind Vadodara", "Segoe UI", system-ui, -apple-system, Roboto, "Noto Sans Gujarati", sans-serif; }

.gu { font-family: var(--font); font-weight: 400; font-size: .86em; color: var(--muted); margin-left: 5px; white-space: nowrap; }
.form-label .gu { color: var(--muted); font-size: .82em; margin-left: 4px; }
h1 .gu, h2 .gu, h3 .gu, .panel-head h2 .gu, .nav-group .gu { font-size: .8em; font-weight: 500; color: var(--muted); }
table.data-table thead th .gu, .kpi-cell .l .gu { color: var(--faint); margin-left: 4px; font-weight: 500; }
.btn .gu, .nav-link .gu { color: inherit; opacity: .68; font-size: .84em; }
.sidebar .nav-link .gu { color: #93A0C8; margin-left: 0; font-size: 11.5px; display: block; }
.sidebar .nav-group .gu { color: #8D9CC6; }
@media print { .gu { color: #555; } }

/* Language control — three modes, one segmented control */
.lang-seg { display: inline-flex; border: 1px solid var(--rule); border-radius: 8px; overflow: hidden; background: #fff; }
.lang-btn { border: 0; background: #fff; color: var(--muted); font-size: 12.5px; font-weight: 600; padding: 5px 10px; line-height: 1.4; }
.lang-btn + .lang-btn { border-left: 1px solid var(--rule); }
.lang-btn:hover { background: var(--brand-soft); color: var(--brand); }
.lang-btn.active { background: var(--brand); color: #fff; }

/* Topbar extras */
.today-chip { align-items: center; gap: 7px; font-size: 14px; color: var(--muted); padding: 0 4px; }
.icon-btn { border: 1px solid var(--rule); background: #fff; color: var(--ink); border-radius: 9px; width: 38px; height: 38px; display: inline-flex; align-items: center; justify-content: center; font-size: 18px; }
.icon-btn:hover { background: var(--paper); }

/* Collapsible sidebar */
.sb-mini .sidebar { width: 62px; flex: 0 0 62px; }
.sb-mini .sb-hide { display: none !important; }
.sb-mini .sidebar .nav-link { justify-content: center; }
.sb-mini .sidebar .brand { justify-content: center; padding: 18px 8px; }
.sidebar .nav-link.is-blocked { opacity: .45; }
.sidebar .nav-link .nav-lock { margin-left: auto; font-size: 11px; }
.sidebar .u-plan { font-size: 11.5px; color: #9AA6CC; }

/* Account state strips */
.acting-bar { display: flex; align-items: center; gap: 10px; padding: 8px 20px; background: #3B2A6B; color: #fff; font-size: 13.5px; }
.account-banner { display: flex; align-items: center; gap: 10px; padding: 9px 20px; font-size: 13.5px; border-bottom: 1px solid var(--rule); }
.account-banner.is-danger { background: var(--udhar-soft); color: #7A1E1A; }
.account-banner.is-warning { background: var(--amber-soft); color: #7A5200; }
.account-banner.is-info { background: var(--brand-soft); color: var(--ink); }

/* ==========================================================================
   Platform (Super Admin) console
   ========================================================================== */
body.platform .sidebar .nav-link.active { background: #2A3A7A; }

.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 1px; background: var(--rule); border: 1px solid var(--rule); border-radius: 12px; overflow: hidden; margin-bottom: 20px; }
.stat-cell { background: #fff; padding: 14px 16px; }
.stat-cell .l { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.stat-cell .v { font-size: 23px; font-weight: 600; color: var(--ink); line-height: 1.25; }
.stat-cell .n { font-size: 12px; color: var(--faint); }
.stat-cell.is-alert .v { color: var(--udhar); }
.stat-cell.is-good .v { color: var(--jama); }

/* Status chips */
.chip { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 600; border-radius: 999px; padding: 2px 10px; white-space: nowrap; }
.chip-trial { background: var(--amber-soft); color: #7A5200; }
.chip-active { background: var(--jama-soft); color: var(--jama); }
.chip-suspended, .chip-pastdue { background: var(--udhar-soft); color: var(--udhar); }
.chip-cancelled, .chip-expired { background: #EDEFF4; color: var(--muted); }
.chip-readonly { background: var(--amber-soft); color: #7A5200; }
.chip-locked { background: var(--udhar-soft); color: var(--udhar); }
.chip-neutral { background: #EDEFF4; color: var(--muted); }
.chip-brand { background: var(--brand-soft); color: var(--brand); }

/* Usage meters */
.meter { height: 6px; border-radius: 999px; background: #E8EBF2; overflow: hidden; margin-top: 5px; }
.meter > span { display: block; height: 100%; background: var(--brand); }
.meter.is-warn > span { background: var(--amber); }
.meter.is-full > span { background: var(--udhar); }
.meter-row { display: flex; justify-content: space-between; font-size: 12.5px; color: var(--muted); }

/* Inline bar chart — enough to read a trend, with no charting library */
.spark { display: flex; align-items: flex-end; gap: 2px; height: 90px; padding: 6px 0; }
.spark > i { flex: 1 1 0; background: var(--brand-soft); border-radius: 2px 2px 0 0; min-height: 2px; display: block; }
.spark > i:hover { background: var(--brand); }
.spark-axis { display: flex; justify-content: space-between; font-size: 11.5px; color: var(--faint); border-top: 1px solid var(--rule); padding-top: 5px; }

/* Tabs on the tenant detail page */
.tab-strip { display: flex; gap: 2px; flex-wrap: wrap; border-bottom: 1px solid var(--rule); margin-bottom: 18px; }
.tab-strip a { padding: 9px 14px; font-size: 14px; color: var(--muted); border-bottom: 2px solid transparent; text-decoration: none; }
.tab-strip a:hover { color: var(--brand); }
.tab-strip a.active { color: var(--ink); font-weight: 600; border-bottom-color: var(--brand); }

/* Event / audit timeline */
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { position: relative; padding: 0 0 14px 20px; border-left: 2px solid var(--rule); }
.timeline li:last-child { border-left-color: transparent; padding-bottom: 0; }
.timeline li::before { content: ""; position: absolute; left: -5px; top: 4px; width: 8px; height: 8px; border-radius: 50%; background: var(--brand); }
.timeline .t-when { font-size: 12px; color: var(--faint); }
.timeline .t-what { font-size: 13.5px; }

.definition-list { display: grid; grid-template-columns: max-content 1fr; gap: 6px 18px; font-size: 14px; }
.definition-list dt { color: var(--muted); font-weight: 500; }
.definition-list dd { margin: 0; }

.danger-zone { border: 1px solid #F0C9C6; border-radius: 12px; background: #FDF6F5; padding: 16px; }

/* ==========================================================================
   Mobile first — ported from the v3 prototype's own responsive rules
   --------------------------------------------------------------------------
   The desktop layout above was written first and is what most of this file
   describes. These rules make the app work on a phone, which is where a
   booking counter's second device actually is. Three things carry the weight:
   an off-canvas sidebar below the lg breakpoint, a sticky topbar so the
   language control and page title never scroll away, and tables that stop
   being tables below 576px and become label/value cards instead. The last one
   is the important one: a ledger table with nine columns is unreadable on a
   phone however much you let it scroll sideways.
   ========================================================================== */

:root { --topbar-h: 64px; --sb-w: 250px; }

html { -webkit-text-size-adjust: 100%; }

/* ---- Shell ---- */
.app-shell { display: flex; min-height: 100vh; }
.main-col { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.topbar {
  position: sticky; top: 0; z-index: 1020;
  background: rgba(255,255,255,.97); backdrop-filter: saturate(180%) blur(6px);
  border-bottom: 1px solid var(--rule);
  min-height: var(--topbar-h);
  display: flex; align-items: center; gap: 14px; padding: 8px 24px;
}
.topbar h1 { font-size: 19px; font-weight: 600; margin: 0; line-height: 1.2; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.content-area { padding: 24px; width: 100%; max-width: 1480px; }

/* The sidebar is a Bootstrap offcanvas everywhere; above lg it is pinned open
   and behaves as an ordinary column, which is how one piece of markup serves
   both layouts without duplicating the navigation. */
.sidebar {
  --sb-bg: var(--ink);
  --bs-offcanvas-bg: var(--sb-bg);
  --bs-offcanvas-color: #D3DBEF;
  background-color: var(--sb-bg);
  color: #D3DBEF;
}
body.platform .sidebar { --sb-bg: #16204A; }
.sidebar .offcanvas-body,
.sidebar-inner { display: flex; flex-direction: column; height: 100%; width: 100%; padding: 0; }

@media (min-width: 992px) {
  .sidebar {
    position: sticky; top: 0; height: 100vh;
    width: var(--sb-w); flex: 0 0 var(--sb-w);
    transform: none !important; visibility: visible !important;
    /* Bootstrap 5.3's .offcanvas-lg sets a transparent !important background above lg. */
    background-color: var(--sb-bg) !important;
    transition: width .18s ease, flex-basis .18s ease;
    z-index: 1030;
  }
  .sb-open-btn { display: none !important; }
}

@media (max-width: 991.98px) {
  .sidebar { --bs-offcanvas-width: 272px; }
  /* Collapsing a drawer that is already hidden makes no sense. */
  #sbToggle { display: none !important; }
  body.sb-mini .sb-hide { display: block !important; }
}

/* ---- Touch targets. 44px is the smallest reliably tappable control. ---- */
@media (max-width: 991.98px) {
  .btn, .form-control, .form-select { min-height: 44px; }
  .btn-sm, .form-control-sm, .form-select-sm { min-height: 38px; }
  .sidebar .nav-link { padding: 11px 12px; }
  .form-check-input { width: 1.15em; height: 1.15em; margin-top: .18em; }
  .icon-btn { width: 42px; height: 42px; }
  .lang-btn { padding: 8px 12px; }
}

/* ---- Phones ---- */
@media (max-width: 575.98px) {
  .content-area { padding: 14px 12px 32px; }
  .topbar { padding: 6px 12px; gap: 8px; }
  .topbar h1 { font-size: 17px; }
  .panel-body { padding: 16px; }
  .panel-head { padding: 13px 16px; }
  .panel { border-radius: 12px; margin-bottom: 14px; }

  /* Two across rather than one: these are short numbers, and a single column
     turns the dashboard into a page of scrolling. */
  .stat-grid, .kpi-strip { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stat-cell .v, .kpi-cell .v { font-size: 20px; }

  .book-row { grid-template-columns: 1fr; }
  .book-side + .book-side { border-left: 0; border-top: 3px double #DE8F88; }

  .account-banner, .acting-bar { padding: 9px 12px; font-size: 13px; align-items: flex-start; }
  .acting-bar { flex-wrap: wrap; }
  .acting-bar form { margin-left: 0 !important; width: 100%; }
  .acting-bar .btn { width: 100%; }

  .definition-list { grid-template-columns: 1fr; gap: 2px 0; }
  .definition-list dt { margin-top: 8px; }

  /* Buttons stop being inline-sized and fill the row, which is both easier to
     hit and stops a form's actions wrapping into a ragged stack. */
  .form-actions .btn, .panel-body > form > .btn { width: 100%; }
}

/* ---- Tables become label/value cards ----
   The labels are injected at runtime from each table's own <thead> (see the
   script in _Layout), so no table markup has to carry a duplicate of its own
   column headings, and a heading can never drift from the label under it. */
.cell-label { display: none; }

@media (max-width: 575.98px) {
  table.tbl-stack thead { display: none; }
  table.tbl-stack, table.tbl-stack tbody, table.tbl-stack tfoot, table.tbl-stack tr { display: block; width: 100%; }
  table.tbl-stack tr { padding: 10px 14px; border-bottom: 1px solid var(--rule); }
  table.tbl-stack tr:last-child { border-bottom: 0; }
  table.tbl-stack td {
    display: flex; justify-content: space-between; align-items: baseline; gap: 14px;
    border: 0 !important; padding: 3px 0; text-align: right; white-space: normal;
  }
  table.tbl-stack td .cell-label { display: inline-flex; flex: 0 0 auto; color: var(--muted); font-size: 13px; font-weight: 500; text-align: left; }
  table.tbl-stack td:not(:has(.cell-label)) { justify-content: flex-end; }
  table.tbl-stack td:empty { display: none; }
  table.tbl-stack td[colspan] { display: block; text-align: center; }
  table.tbl-stack tfoot tr { background: #FAFBFC; }

  /* A row of actions reads better as a row than as another label/value pair. */
  table.tbl-stack td:last-child:has(.btn) { justify-content: flex-end; padding-top: 8px; }
  .table-responsive { overflow: visible; }
}

/* ---- Tab strip scrolls rather than wraps into three ragged lines ---- */
.tab-strip { overflow-x: auto; flex-wrap: nowrap; scrollbar-width: thin; -webkit-overflow-scrolling: touch; }
.tab-strip a { white-space: nowrap; }

/* ---- Filter bars stack ---- */
@media (max-width: 575.98px) {
  .panel-body.d-flex.flex-wrap > div,
  form.panel-body > div { flex: 1 1 100%; min-width: 0; }
  .panel-head { flex-direction: column; align-items: flex-start; }
  .panel-head .ms-auto { margin-left: 0 !important; width: 100%; }
  .table-tools { width: 100%; }
}

/* The inline bar charts are decorative at phone width; halving them keeps the
   numbers underneath above the fold, which is what an operator opens for. */
@media (max-width: 575.98px) { .spark { height: 56px; } }

@media print {
  .sidebar, .topbar, .acting-bar, .lang-seg, .tab-strip, .btn { display: none !important; }
  .content-area { padding: 0; max-width: none; }
  .panel { border-color: #bbb; break-inside: avoid; }
}

/* ---- Bilingual labels must wrap, not overflow ----
   `.gu` is nowrap so a two-word Gujarati gloss never breaks mid-phrase. In a
   narrow column that is exactly how "Booking commission બુકિંગ કમિશન" pushed
   26px past the right edge of a 375px screen. The v3 prototype avoids this by
   making .form-label a wrapping flex container, so the gloss drops to its own
   line instead; below the phone breakpoint the gloss is allowed to wrap
   internally too, because at that width an unbroken phrase is what overflows. */
.form-label { display: flex; align-items: center; flex-wrap: wrap; gap: 2px 6px; }
.form-label .gu { margin-left: 0; }

@media (max-width: 575.98px) {
  .gu { white-space: normal; }
}
