/* =====================================================================
   Travel Tea ERP — Green & Gold design system
   ===================================================================== */

:root {
    /* Tea green */
    --green-950: #06291b;
    --green-900: #0a3a27;
    --green-800: #0e4a32;
    --green-700: #135f40;
    --green-600: #18774f;
    --green-500: #1f8f5f;
    --green-200: #bfe0cd;
    --green-100: #e3f1e9;
    --green-50:  #f1f8f4;

    /* Gold */
    --gold-700: #8f6a0c;
    --gold-600: #b8870f;
    --gold-500: #d4a72c;
    --gold-400: #e6be4f;
    --gold-300: #f2d67f;
    --gold-100: #fbf1d3;
    --gold-50:  #fdf8ea;

    /* Status */
    --red-600: #b3261e;
    --red-100: #fbe4e2;
    --blue-600: #1e5aa8;
    --blue-100: #e2ecf9;
    --grey-600: #5d6b63;
    --grey-100: #eef0ec;

    /* Surfaces & text */
    --bg: #f4f5ef;
    --surface: #ffffff;
    --border: #e1e5da;
    --border-strong: #cfd6c8;
    --text: #1a2a21;
    --muted: #65746b;

    --radius: 12px;
    --radius-sm: 8px;
    --shadow: 0 1px 2px rgba(10, 58, 39, .06), 0 4px 16px rgba(10, 58, 39, .06);
    --shadow-lg: 0 12px 40px rgba(6, 41, 27, .18);

    --font: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
    --font-head: 'Poppins', 'Inter', system-ui, sans-serif;
    --font-urdu: 'Noto Nastaliq Urdu', serif;
}

*, *::before, *::after { box-sizing: border-box; }

html, body { margin: 0; padding: 0; }

body {
    font-family: var(--font);
    font-size: 14px;
    line-height: 1.5;
    color: var(--text);
    background: var(--bg);
    -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 { font-family: var(--font-head); color: var(--green-900); margin: 0; line-height: 1.25; }
h1 { font-size: 22px; font-weight: 600; }
/* the top menu uses its own font when one is set in Appearance (else the body font) */
.nav-link, .dropdown a, .dropdown button, .dd-subtoggle, .dd-head, .brand-text { font-family: var(--font-menu, var(--font)); }
h2 { font-size: 17px; font-weight: 600; }
h3 { font-size: 15px; font-weight: 600; }

a { color: var(--green-700); text-decoration: none; }
a:hover { color: var(--green-900); text-decoration: underline; }

.urdu { font-family: var(--font-urdu); direction: rtl; }
.num, .money { font-variant-numeric: tabular-nums; white-space: nowrap; }
.text-right { text-align: right; }
.text-center { text-align: center; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.strong { font-weight: 600; }
.nowrap { white-space: nowrap; }
.mt-0 { margin-top: 0; } .mt-1 { margin-top: 8px; } .mt-2 { margin-top: 16px; } .mt-3 { margin-top: 24px; }
.mb-1 { margin-bottom: 8px; } .mb-2 { margin-bottom: 16px; }
.flex { display: flex; gap: 8px; align-items: center; }
.flex-wrap { flex-wrap: wrap; }
.spacer { flex: 1; }
.hidden { display: none !important; }

/* ------------------------------ Splash ------------------------------ */

.splash {
    min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 20px;
    background: radial-gradient(circle at 50% 35%, var(--green-700), var(--green-950) 70%);
}
.splash-logo { width: 220px; filter: drop-shadow(0 8px 24px rgba(0,0,0,.35)); }
.splash-bar { width: 220px; height: 4px; border-radius: 4px; background: rgba(255,255,255,.15); overflow: hidden; }
.splash-bar span {
    display: block; height: 100%; background: linear-gradient(90deg, var(--gold-500), var(--gold-300));
    width: var(--blazor-load-percentage, 10%); transition: width .2s;
}
.splash-text { color: var(--gold-300); font-family: var(--font-head); letter-spacing: .04em; font-size: 13px; }

#blazor-error-ui {
    display: none; position: fixed; bottom: 0; left: 0; right: 0; z-index: 2000;
    padding: 12px 20px; background: var(--red-600); color: #fff;
}
#blazor-error-ui .reload { color: var(--gold-300); margin-left: 8px; }
#blazor-error-ui .dismiss { float: right; cursor: pointer; }

/* ------------------------------ Top bar ----------------------------- */

.topbar {
    position: sticky; top: 0; z-index: 100;
    background: linear-gradient(90deg, var(--green-950), var(--green-800) 55%, var(--green-700));
    box-shadow: 0 2px 12px rgba(6, 41, 27, .25);
}
.topbar::after {
    content: ""; display: block; height: 3px;
    background: linear-gradient(90deg, var(--gold-600), var(--gold-300) 50%, var(--gold-600));
}
.topbar-inner {
    max-width: 1440px; margin: 0 auto; padding: 0 20px;
    display: flex; align-items: center; gap: 18px; height: 62px;
}

.brand { display: flex; align-items: center; gap: 10px; color: #fff; text-decoration: none; flex-shrink: 0; }
.brand:hover { text-decoration: none; color: #fff; }
.brand img { height: 44px; filter: drop-shadow(0 2px 6px rgba(0,0,0,.3)); }
.brand-text { display: flex; flex-direction: column; line-height: 1.1; }
.brand-text strong { font-family: var(--font-head); font-size: 15px; letter-spacing: .02em; }
.brand-text span { font-size: 11px; color: var(--gold-300); letter-spacing: .08em; text-transform: uppercase; }

.nav { display: flex; align-items: stretch; gap: 2px; height: 100%; flex: 1; }
.nav-item { position: relative; display: flex; align-items: stretch; }
.nav-link {
    display: flex; align-items: center; gap: 6px; padding: 0 13px; height: 100%;
    color: rgba(255,255,255,.86); font-weight: 500; font-size: 13.5px; background: none; border: 0;
    font-family: inherit; cursor: pointer; text-decoration: none; position: relative; white-space: nowrap;
}
.nav-link:hover, .nav-item.open > .nav-link { color: var(--gold-300); text-decoration: none; background: rgba(255,255,255,.05); }
.nav-link.active { color: #fff; }
.nav-link.active::after {
    content: ""; position: absolute; left: 12px; right: 12px; bottom: 0; height: 3px; border-radius: 3px 3px 0 0;
    background: var(--gold-400);
}
.nav-link .caret { font-size: 9px; opacity: .7; transition: transform .15s; }
.nav-item.open .caret { transform: rotate(180deg); }

.dropdown {
    position: absolute; top: calc(100% + 3px); left: 0; min-width: 230px; padding: 6px;
    background: var(--surface); border-radius: var(--radius-sm); box-shadow: var(--shadow-lg);
    border-top: 3px solid var(--gold-500); display: none; z-index: 200;
    /* no overflow clipping here: it would trap the fly-out submenus and force scrollbars */
}
.nav-item.open .dropdown, .user-menu.open .dropdown { display: block; animation: drop .12s ease-out; }
/* fly-out submenus (e.g. Transactions -> Orders -> items) */
.dd-subwrap { position: relative; }
.dd-subtoggle {
    display: flex; align-items: center; justify-content: space-between; gap: 10px; width: 100%; padding: 9px 12px;
    border-radius: 6px; color: var(--text); font-size: 13.5px; text-align: left; background: none; border: 0;
    cursor: pointer; font-family: inherit;
}
.dd-subtoggle:hover, .dd-subwrap.open > .dd-subtoggle, .dd-subwrap:hover > .dd-subtoggle { background: var(--green-50); color: var(--green-800); }
.dd-subtoggle .caret { font-size: 10px; opacity: .7; }
.subdropdown {
    display: none; position: absolute; left: 100%; top: -6px; min-width: 220px; padding: 6px;
    background: var(--surface); border-radius: var(--radius-sm); box-shadow: var(--shadow-lg);
    border-top: 3px solid var(--gold-500); z-index: 210; max-height: calc(100vh - 90px); overflow-y: auto;
}
.dd-subwrap:hover > .subdropdown, .dd-subwrap.open > .subdropdown { display: block; animation: drop .12s ease-out; }
@keyframes drop { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }
.dropdown a, .dropdown button {
    display: flex; align-items: center; gap: 10px; width: 100%; padding: 9px 12px; border-radius: 6px;
    color: var(--text); font-size: 13.5px; text-align: left; background: none; border: 0; cursor: pointer;
    font-family: inherit; text-decoration: none;
}
.dropdown a:hover, .dropdown button:hover { background: var(--green-50); color: var(--green-800); text-decoration: none; }
.dropdown a.active { background: var(--gold-50); color: var(--green-900); font-weight: 600; box-shadow: inset 3px 0 0 var(--gold-500); }
.dropdown .dd-icon { width: 20px; text-align: center; font-size: 15px; }
.dropdown .dd-sep { height: 1px; background: var(--border); margin: 6px 4px; }
.dropdown .dd-head { padding: 6px 12px 4px; font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }

.user-menu { position: relative; margin-left: auto; }
.user-btn {
    display: flex; align-items: center; gap: 10px; padding: 6px 10px 6px 6px; border-radius: 30px;
    background: rgba(255,255,255,.08); border: 1px solid rgba(255,255,255,.14); color: #fff; cursor: pointer;
    font-family: inherit;
}
.user-btn:hover { background: rgba(255,255,255,.14); }
.avatar {
    width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; font-size: 13px;
    background: linear-gradient(135deg, var(--gold-300), var(--gold-500)); color: var(--green-950);
}
.avatar-img { object-fit: cover; border: 2px solid var(--gold-400); background: #fff; }
.user-meta { display: flex; flex-direction: column; line-height: 1.15; text-align: left; }
.user-meta strong { font-size: 13px; }
.user-meta span { font-size: 11px; color: var(--gold-300); }
.user-menu .dropdown { left: auto; right: 0; }

.menu-toggle { display: none; background: none; border: 0; color: #fff; font-size: 24px; cursor: pointer; padding: 4px 8px; }

.branch-strip {
    background: var(--gold-50); border-bottom: 1px solid var(--gold-100); font-size: 12.5px; color: var(--green-900);
}
.branch-strip .inner { max-width: 1440px; margin: 0 auto; padding: 6px 20px; display: flex; gap: 16px; align-items: center; }
.branch-pill {
    display: inline-flex; align-items: center; gap: 6px; padding: 2px 10px; border-radius: 20px; font-weight: 600;
    background: var(--green-800); color: var(--gold-300); font-size: 11.5px; letter-spacing: .03em;
}

/* ------------------------------ Page ------------------------------ */

.page { max-width: 1440px; margin: 0 auto; padding: 22px 20px 48px; }

.page-header { display: flex; align-items: flex-end; gap: 16px; flex-wrap: wrap; margin-bottom: 18px; }
.page-header .titles { flex: 1; min-width: 220px; }
.page-header .subtitle { color: var(--muted); margin-top: 3px; font-size: 13px; }
.page-header .actions { display: flex; gap: 8px; flex-wrap: wrap; }
.crumbs { font-size: 12px; color: var(--muted); margin-bottom: 4px; }
.crumbs a { color: var(--muted); }

.card {
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow);
}
.card-head { display: flex; align-items: center; gap: 10px; padding: 14px 18px; border-bottom: 1px solid var(--border); }
.card-head h2, .card-head h3 { flex: 1; }
.card-body { padding: 18px; }
.card.accent { border-top: 3px solid var(--gold-500); }
.card + .card { margin-top: 16px; }
.grid > .card + .card { margin-top: 0; }   /* cards side by side in a grid stay aligned */

.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.span-2 { grid-column: span 2; }
.span-3 { grid-column: span 3; }
.span-all { grid-column: 1 / -1; }

/* ------------------------------ Buttons ------------------------------ */

.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 7px; height: 38px; padding: 0 16px;
    border-radius: var(--radius-sm); border: 1px solid transparent; font-family: inherit; font-size: 13.5px; font-weight: 600;
    cursor: pointer; text-decoration: none; white-space: nowrap; transition: background .12s, box-shadow .12s, transform .05s;
    background: var(--surface); color: var(--green-800); border-color: var(--border-strong);
}
.btn:hover { background: var(--green-50); text-decoration: none; color: var(--green-900); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn:focus-visible { outline: 3px solid var(--gold-300); outline-offset: 1px; }
.btn-primary { background: var(--green-700); border-color: var(--green-700); color: #fff; }
.btn-primary:hover { background: var(--green-800); color: #fff; }
.btn-gold { background: linear-gradient(180deg, var(--gold-400), var(--gold-500)); border-color: var(--gold-600); color: var(--green-950); }
.btn-gold:hover { background: linear-gradient(180deg, var(--gold-300), var(--gold-400)); color: var(--green-950); }
.btn-danger { background: var(--surface); color: var(--red-600); border-color: #e7b9b5; }
.btn-danger:hover { background: var(--red-100); color: var(--red-600); }
.btn-ghost { background: none; border-color: transparent; }
.btn-sm { height: 30px; padding: 0 10px; font-size: 12.5px; }
.btn-icon { width: 30px; padding: 0; }

/* ------------------------------- Forms ------------------------------- */

.form-grid { display: grid; gap: 14px 16px; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); }
.field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.field.wide { grid-column: span 2; }
.field.full { grid-column: 1 / -1; }
.field label, .label { font-size: 12px; font-weight: 600; color: var(--green-900); letter-spacing: .01em; }
.field .hint { font-size: 11.5px; color: var(--muted); }

.input, select.input, textarea.input {
    width: 100%; height: 38px; padding: 0 11px; font-family: inherit; font-size: 13.5px; color: var(--text);
    background: #fff; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); transition: border .12s, box-shadow .12s;
}
textarea.input { height: auto; min-height: 70px; padding: 9px 11px; resize: vertical; }
.input:focus { outline: none; border-color: var(--green-500); box-shadow: 0 0 0 3px rgba(31, 143, 95, .15); }
.input:disabled, .input[readonly] { background: var(--grey-100); color: var(--muted); }
.input.num { text-align: right; }
.input-sm { height: 32px; font-size: 13px; padding: 0 8px; }

.check { display: inline-flex; align-items: center; gap: 8px; font-size: 13.5px; cursor: pointer; user-select: none; }
.check input { width: 16px; height: 16px; accent-color: var(--green-600); }

.validation-message { color: var(--red-600); font-size: 12px; }
.invalid { border-color: var(--red-600) !important; }

.filters { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; padding: 14px 18px; border-bottom: 1px solid var(--border); background: var(--green-50); border-radius: var(--radius) var(--radius) 0 0; }
.filters .field { min-width: 150px; }
.filters .field.grow { flex: 1; min-width: 200px; }

.segmented { display: inline-flex; background: var(--grey-100); border-radius: var(--radius-sm); padding: 3px; gap: 2px; flex-wrap: wrap; }
.segmented button {
    border: 0; background: none; padding: 6px 12px; border-radius: 6px; font-family: inherit; font-size: 12.5px;
    font-weight: 600; color: var(--muted); cursor: pointer;
}
.segmented button.on { background: #fff; color: var(--green-800); box-shadow: 0 1px 3px rgba(0,0,0,.08); }

/* ------------------------------- Tables ------------------------------ */

.table-wrap { overflow-x: auto; }
/* for small editor tables holding a search dropdown: let the dropdown overflow instead of being clipped/scrolled */
.table-wrap--open { overflow: visible; }
.table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.table th {
    text-align: left; font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em;
    color: var(--green-800); background: var(--green-50); padding: 10px 12px; border-bottom: 1px solid var(--border);
    white-space: nowrap; position: sticky; top: 0;
}
.table th.text-right { text-align: right; }     /* numeric headers line up with their right-aligned figures */
.table th.text-center { text-align: center; }
.table td { padding: 10px 12px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tbody tr:hover td { background: var(--gold-50); }
.table tbody tr.clickable { cursor: pointer; }
.table tfoot td { font-weight: 700; background: var(--green-50); border-top: 2px solid var(--green-200); }
.table .actions-cell { text-align: right; white-space: nowrap; }
.table.compact td, .table.compact th { padding: 6px 10px; }
.table .row-muted td { color: var(--muted); text-decoration: line-through; }
.table tr.brand-row td { background: var(--gold-50); color: var(--green-900); border-top: 2px solid var(--gold-300); font-size: 14px; }
.print-only { display: none; }

.empty { padding: 42px 20px; text-align: center; color: var(--muted); }
.empty .empty-icon { font-size: 34px; margin-bottom: 6px; opacity: .6; }

/* ------------------------------- Badges ------------------------------ */

.badge {
    display: inline-flex; align-items: center; gap: 5px; padding: 2px 9px; border-radius: 20px; font-size: 11px;
    font-weight: 700; letter-spacing: .04em; text-transform: uppercase; white-space: nowrap;
    background: var(--grey-100); color: var(--grey-600);
}
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge.green { background: var(--green-100); color: var(--green-700); }
.badge.gold { background: var(--gold-100); color: var(--gold-700); }
.badge.blue { background: var(--blue-100); color: var(--blue-600); }
.badge.red { background: var(--red-100); color: var(--red-600); }
.badge.grey { background: var(--grey-100); color: var(--grey-600); }

/* -------------------------------- KPIs ------------------------------- */

.kpis { display: grid; gap: 14px; grid-template-columns: repeat(4, minmax(0, 1fr)); }
.kpi {
    position: relative; overflow: hidden; background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius); padding: 16px 18px; box-shadow: var(--shadow); display: block; color: inherit;
}
a.kpi:hover { text-decoration: none; border-color: var(--gold-400); transform: translateY(-1px); }
.kpi::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: var(--green-600); }
.kpi.gold::before { background: var(--gold-500); }
.kpi.red::before { background: var(--red-600); }
.kpi.blue::before { background: var(--blue-600); }
.kpi-label { font-size: 12px; color: var(--muted); font-weight: 600; }
.kpi-value { font-family: var(--font-head); font-size: 24px; font-weight: 600; color: var(--green-900); margin-top: 4px; font-variant-numeric: tabular-nums; }
.kpi-value small { font-size: 13px; color: var(--muted); font-weight: 500; margin-right: 3px; }

/* ------------------------------- Charts ------------------------------ */

.bars { display: flex; align-items: flex-end; gap: 4px; height: 190px; padding-top: 10px; }
.bars .bar-col { flex: 1; height: 100%; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; min-width: 0; position: relative; }
.bars .bar {
    width: 100%; max-width: 28px; border-radius: 4px 4px 0 0; min-height: 2px;
    background: var(--green-600); transition: background .12s;
}
.bars .bar-col:hover .bar { background: var(--gold-500); }
.bars .bar-col.today .bar { background: var(--gold-500); }
.bars .bar-tip {
    position: absolute; bottom: calc(100% + 4px); left: 50%; transform: translateX(-50%); display: none; z-index: 5;
    background: var(--green-950); color: #fff; font-size: 11.5px; padding: 4px 8px; border-radius: 6px; white-space: nowrap;
}
.bars .bar-col:hover .bar-tip { display: block; }
.bars-axis { display: flex; justify-content: space-between; font-size: 11px; color: var(--muted); margin-top: 6px; }

.hbars { display: flex; flex-direction: column; gap: 10px; }
.hbar-row { display: grid; grid-template-columns: minmax(90px, 38%) 1fr auto; gap: 10px; align-items: center; font-size: 13px; }
.hbar-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hbar-track { height: 10px; background: var(--grey-100); border-radius: 6px; overflow: hidden; }
.hbar-fill { height: 100%; background: var(--green-600); border-radius: 0 4px 4px 0; }
.hbar-row:hover .hbar-fill { background: var(--green-700); }

/* ------------------------------- Modal ------------------------------- */

.modal-backdrop {
    position: fixed; inset: 0; z-index: 1000; background: rgba(6, 41, 27, .45); backdrop-filter: blur(2px);
    display: flex; align-items: flex-start; justify-content: center; padding: 6vh 16px; overflow-y: auto;
    animation: fade .12s ease-out;
}
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
.modal {
    width: 100%; max-width: 640px; background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow-lg);
    border-top: 4px solid var(--gold-500); animation: pop .15s ease-out;
}
.modal.lg { max-width: 920px; }
.modal.sm { max-width: 440px; }
@keyframes pop { from { transform: translateY(8px) scale(.98); opacity: 0; } to { transform: none; opacity: 1; } }
.modal-head { display: flex; align-items: center; padding: 16px 20px; border-bottom: 1px solid var(--border); }
.modal-head h2 { flex: 1; }
.modal-close { background: none; border: 0; font-size: 20px; color: var(--muted); cursor: pointer; line-height: 1; }
.modal-body { padding: 20px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 14px 20px; border-top: 1px solid var(--border); background: var(--green-50); border-radius: 0 0 var(--radius) var(--radius); }
/* Without the permission to print: no print buttons, and a printout (Ctrl+P) comes out blank. */
.cannot-print .btn-print { display: none !important; }
@media print { .cannot-print { display: none !important; } }

/* Columns button of a report: tick the columns to show (ColumnPicker) */
.col-picker { position: relative; display: inline-block; }
.col-picker-backdrop { position: fixed; inset: 0; z-index: 499; }
.col-picker-menu {
    position: absolute; right: 0; top: calc(100% + 6px); z-index: 500; min-width: 230px; max-height: 65vh; overflow-y: auto;
    background: #fff; border: 1px solid var(--border); border-radius: var(--radius-sm, 8px); box-shadow: var(--shadow); padding: 10px 12px;
}
/* open to the right (used when the Columns button sits on the left of a card, e.g. inside a report table) so the menu is
   not pushed off the left edge of the screen */
.col-picker-menu.col-picker-menu--start { left: 0; right: auto; max-width: calc(100vw - 32px); }
.col-picker-menu label { display: flex; align-items: center; gap: 8px; padding: 4px 2px; cursor: pointer; white-space: nowrap; font-size: 13.5px; }
/* one row per column: the name takes the space, the move-up/down buttons sit beside it (not wrapping underneath) */
.rt-colrow { display: flex; align-items: center; gap: 4px; }
.rt-colrow label { flex: 1; min-width: 0; }
.rt-colrow .btn { flex: 0 0 auto; padding: 2px 7px; line-height: 1; }
.col-picker-foot { display: flex; justify-content: space-between; gap: 8px; border-top: 1px solid var(--border); margin-top: 8px; padding-top: 8px; }

/* Data Maintenance: even count boxes and reset-option boxes with top-aligned checkboxes (no more ragged alignment) */
.dm-counts { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; }
.dm-count { border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 12px 14px; }
.dm-options { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 12px; margin-top: 4px; }
.dm-options .check { display: flex; align-items: flex-start; gap: 8px; border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 11px 13px; margin: 0; line-height: 1.45; }
.dm-options .check input[type=checkbox] { margin-top: 3px; flex: 0 0 auto; }

/* Transaction Summary: route/group heading and per-group subtotal rows */
.ts-group td { background: var(--green-50); color: var(--green-900); border-top: 2px solid var(--gold-400); padding-top: 7px; padding-bottom: 7px; }
.ts-subtotal td { background: var(--soft, #f1f8f4); border-top: 1px solid var(--border); }

/* Report table filters (ReportTable): Find, the funnel in a column heading, the active filters as chips */
.rt-tools { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin: 0 0 12px; }
.rt-find { position: relative; flex: 0 1 260px; min-width: 180px; }
.rt-find svg { position: absolute; left: 9px; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.rt-find .input { padding-left: 28px; width: 100%; background: #fff; }
.rt-chip { display: inline-flex; align-items: center; border: 1px solid var(--gold-400); background: #fff8e6; border-radius: 999px; font-size: 12.5px; overflow: hidden; }
.rt-chip button { border: 0; background: transparent; cursor: pointer; font: inherit; color: var(--green-900); }
.rt-chip-text { padding: 3px 4px 3px 10px; max-width: 360px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rt-chip-x { padding: 3px 9px 3px 4px; color: var(--muted) !important; }
.rt-chip-x:hover { color: var(--red-600) !important; }
.rt-hint svg { vertical-align: -1px; }
.rt-funnel {
    border: 0; background: transparent; cursor: pointer; padding: 2px 3px; margin-left: 3px; border-radius: 4px;
    color: var(--muted); opacity: .55; vertical-align: middle; line-height: 0;
}
.rt-funnel:hover { opacity: 1; background: var(--green-50); }
.rt-funnel.on { opacity: 1; color: #fff; background: var(--gold-500); }
.rt-values { max-height: 46vh; overflow-y: auto; margin-top: 10px; border-top: 1px solid var(--border); padding-top: 6px; }
.rt-values label { display: flex; align-items: center; gap: 8px; padding: 4px 2px; cursor: pointer; font-size: 13.5px; }
.rt-values label span:first-of-type { flex: 1; }
/* a value's row: "only" ticks just it; a column with levels (routes) is a tree - ▸ shows the routes under one */
.rt-node { display: flex; align-items: center; gap: 6px; padding-right: 4px; border-radius: 6px; }
.rt-node:hover { background: var(--green-50); }
.rt-node label { flex: 1; min-width: 0; }
.rt-node input[type=checkbox] { flex: 0 0 auto; }
.rt-node label span:first-of-type { overflow-wrap: anywhere; }
.rt-node.top label span:first-of-type { font-weight: 600; color: var(--green-900); }
.rt-node.place { color: var(--muted); font-size: 12.5px; padding-top: 4px; padding-bottom: 2px; }
.rt-open { flex: 0 0 22px; width: 22px; height: 22px; border: 1px solid var(--green-200); border-radius: 6px; background: var(--surface);
           color: var(--green-700); font-size: 15px; font-weight: 700; line-height: 1; padding: 0; cursor: pointer; }
.rt-open::before { content: "▸"; }
.rt-open.on::before { content: "▾"; }
.rt-open:hover { background: var(--green-100); }
.rt-gap { flex: 0 0 22px; }
.rt-only { border: 0; background: transparent; color: var(--green-700); font: inherit; font-size: 12px; padding: 1px 6px; border-radius: 4px; cursor: pointer; opacity: 0; }
.rt-only:hover { background: var(--green-100); }
.rt-node:hover .rt-only, .rt-only:focus-visible { opacity: 1; }
@media (hover: none) { .rt-only { opacity: .75; } }
.rt-part { color: var(--gold-700); font-weight: 600; }
.rt-modes { display: grid; gap: 6px; }
.rt-modes label { display: flex; align-items: center; gap: 8px; cursor: pointer; }
.rt-print-filter { font-size: 11px; color: var(--muted); margin: 0 0 6px; }
.table .col-name { min-width: 180px; }
.modal-foot .delete-record { margin-right: auto; display: inline-flex; align-items: center; gap: 8px; flex-wrap: wrap; }

/* ------------------------------- Toasts ------------------------------ */

.toasts { position: fixed; right: 18px; bottom: 18px; z-index: 3000; display: flex; flex-direction: column; gap: 10px; max-width: 380px; }
.toast {
    display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: var(--radius-sm);
    background: var(--green-900); color: #fff; box-shadow: var(--shadow-lg); animation: pop .15s ease-out;
    border-left: 4px solid var(--gold-400); font-size: 13.5px;
}
.toast.error { background: #5a1410; border-left-color: #ff8a80; }
.toast .toast-close { margin-left: auto; background: none; border: 0; color: rgba(255,255,255,.7); cursor: pointer; }

.alert { padding: 11px 14px; border-radius: var(--radius-sm); font-size: 13.5px; display: flex; gap: 10px; align-items: flex-start; }
.alert.error { background: var(--red-100); color: var(--red-600); border: 1px solid #efc4c0; }
.alert.info { background: var(--gold-50); color: var(--gold-700); border: 1px solid var(--gold-100); }
.alert.success { background: var(--green-100); color: var(--green-700); border: 1px solid var(--green-200); }

/* ------------------------------ Loading ------------------------------ */

.loading { padding: 40px; display: flex; justify-content: center; align-items: center; gap: 10px; color: var(--muted); }
.spinner {
    width: 20px; height: 20px; border-radius: 50%; border: 3px solid var(--green-100); border-top-color: var(--green-600);
    animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------------------------- Search select --------------------------- */

.search-select { position: relative; }
.search-select .options {
    position: absolute; top: calc(100% + 4px); left: 0; right: 0; z-index: 300; max-height: 300px; overflow-y: auto;
    background: #fff; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); box-shadow: var(--shadow-lg);
}
.search-select .option { padding: 8px 12px; cursor: pointer; display: flex; justify-content: space-between; gap: 12px; }
.search-select .option.hl { background: var(--gold-50); box-shadow: inset 3px 0 0 var(--gold-500); }
.search-select .option .sub { color: var(--muted); font-size: 12px; white-space: nowrap; }
.search-select .no-options { padding: 10px 12px; color: var(--muted); font-size: 13px; }

/* ----------------------------- Line editor ---------------------------- */

.line-entry {
    display: grid; gap: 10px; align-items: end; padding: 14px 18px; background: var(--gold-50);
    border-bottom: 1px solid var(--gold-100); grid-template-columns: minmax(240px, 3fr) repeat(3, minmax(90px, 1fr)) auto;
}
.line-entry.with-disc { grid-template-columns: minmax(220px, 3fr) repeat(4, minmax(90px, 1fr)) auto; }
.line-entry .line-add { white-space: nowrap; padding-left: 16px; padding-right: 16px; }
.line-table .input-sm { max-width: 110px; margin-left: auto; }
.totals { display: grid; grid-template-columns: auto auto; gap: 6px 22px; justify-content: end; padding: 16px 18px; font-size: 14px; }
.totals .t-label { color: var(--muted); text-align: right; }
.totals .t-value { text-align: right; font-variant-numeric: tabular-nums; min-width: 120px; }
.totals .grand { font-family: var(--font-head); font-size: 20px; font-weight: 600; color: var(--green-900); padding-top: 6px; border-top: 2px solid var(--gold-400); }

/* ---------------------------- Bill sundries ---------------------------- */

.totals .t-full { grid-column: 1 / -1; display: flex; flex-direction: column; align-items: flex-end; gap: 6px; padding: 6px 0; border-top: 1px dashed var(--border); border-bottom: 1px dashed var(--border); }
.sundries { display: flex; flex-direction: column; gap: 6px; align-items: flex-end; width: 100%; }
.sundry-row { display: grid; grid-template-columns: minmax(150px, 1fr) auto 90px 120px 30px; gap: 6px; align-items: center; width: 100%; max-width: 560px; }
.sundry-mode { padding: 2px; }
.sundry-mode button { padding: 4px 9px; }
.sundry-result { text-align: right; font-variant-numeric: tabular-nums; font-weight: 600; line-height: 1.15; }
.sundry-result small { display: block; font-weight: 400; color: var(--muted); font-size: 11.5px; }
.sundry-result.add { color: var(--green-700); }
.sundry-result.less { color: var(--red-600); }
@media (max-width: 640px) {
    .sundry-row { grid-template-columns: 1fr auto 80px; }
    .sundry-result { grid-column: 1 / 3; text-align: left; }
}

/* ------------------------------ Calculator ------------------------------ */

.calc {
    position: fixed; right: 18px; bottom: 18px; z-index: 1200; width: 290px; background: #fff; border: 1px solid var(--border);
    border-top: 3px solid var(--gold-400); border-radius: var(--radius); box-shadow: 0 12px 32px rgba(0,0,0,.22); padding: 10px 12px 12px;
}
.calc-head { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.calc-head strong { color: var(--green-900); }
.calc-head .muted { margin-left: auto; }
.calc-expr { font-size: 17px; text-align: right; }
.calc-result { text-align: right; font-size: 20px; font-weight: 700; color: var(--green-900); min-height: 30px; padding: 2px 2px 6px; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.calc-result.error { font-size: 13px; font-weight: 600; color: var(--red-600); }
.calc-keys { display: grid; grid-template-columns: repeat(4, 1fr); gap: 5px; }
.calc-keys button {
    border: 1px solid var(--border); background: var(--grey-100); border-radius: 6px; padding: 9px 0; font: inherit; font-size: 15px;
    font-weight: 600; cursor: pointer; color: var(--text);
}
.calc-keys button:hover { filter: brightness(.96); }
.calc-keys button.op { background: var(--gold-50); color: var(--green-800); }
.calc-keys button.clear { color: var(--red-600); }
.calc-keys button.eq { background: var(--green-800); color: #fff; border-color: var(--green-800); }
.calc-foot { display: flex; gap: 6px; justify-content: flex-end; margin-top: 8px; }
.calc-history { margin-top: 8px; border-top: 1px dashed var(--border); padding-top: 6px; display: flex; flex-direction: column; }
.calc-history button { display: flex; justify-content: space-between; gap: 8px; border: 0; background: none; padding: 3px 2px; font: inherit; font-size: 12px; color: var(--muted); cursor: pointer; text-align: left; }
.calc-history button:hover { color: var(--green-800); }
.calc-history strong { color: var(--text); font-variant-numeric: tabular-nums; }
@media (max-width: 640px) { .calc { right: 8px; left: 8px; bottom: 8px; width: auto; } }

/* ---------------------------- Image picker ---------------------------- */

.image-picker { display: flex; gap: 14px; align-items: center; }
.image-picker-preview {
    flex-shrink: 0; border-radius: var(--radius-sm); border: 1px dashed var(--border-strong); background: var(--green-50);
    display: grid; place-items: center; overflow: hidden;
}
.image-picker.round .image-picker-preview { border-radius: 50%; }
.image-picker-preview img { width: 100%; height: 100%; object-fit: contain; background: #fff; }
.image-picker.round .image-picker-preview img { object-fit: cover; }
.image-picker-empty { font-size: 11.5px; color: var(--muted); text-align: center; padding: 4px; }
.image-picker-actions { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; }
.image-picker-actions .btn { cursor: pointer; }
.item-thumb {
    width: 44px; height: 44px; border-radius: 8px; object-fit: contain; background: #fff; border: 1px solid var(--border);
    flex-shrink: 0;
}
.item-thumb.no-photo { display: grid; place-items: center; font-size: 18px; color: var(--muted); background: var(--green-50); }
.item-cell { display: flex; gap: 10px; align-items: center; }

/* ------------------------------- Login ------------------------------- */

.login { min-height: 100vh; display: grid; grid-template-columns: 1.1fr 1fr; background: var(--bg); }
.login-hero {
    position: relative; overflow: hidden; display: flex; flex-direction: column; justify-content: center; align-items: center;
    padding: 40px; color: #fff; text-align: center;
    background:
        radial-gradient(circle at 20% 15%, rgba(230, 190, 79, .22), transparent 40%),
        radial-gradient(circle at 80% 90%, rgba(230, 190, 79, .16), transparent 45%),
        linear-gradient(160deg, var(--green-700), var(--green-950));
}
.login-hero::after {
    content: ""; position: absolute; inset: 0; pointer-events: none; opacity: .07;
    background-image: radial-gradient(var(--gold-300) 1px, transparent 1px); background-size: 18px 18px;
}
.login-hero img { width: min(420px, 80%); position: relative; z-index: 1; filter: drop-shadow(0 20px 40px rgba(0,0,0,.35)); }
.login-hero h2 { color: #fff; font-size: 26px; margin-top: 24px; position: relative; z-index: 1; }
.login-hero .tagline { font-family: var(--font-urdu); color: var(--gold-300); font-size: 22px; margin-top: 10px; position: relative; z-index: 1; line-height: 2; }
.login-hero p { color: rgba(255,255,255,.75); max-width: 440px; position: relative; z-index: 1; }
.login-panel { display: flex; align-items: center; justify-content: center; padding: 32px 20px; }
.login-card { width: 100%; max-width: 400px; }
.login-card .logo { width: 170px; display: block; margin: 0 auto 18px; }
.login-card h1 { text-align: center; }
.login-card .sub { text-align: center; color: var(--muted); margin: 6px 0 24px; }
.login-card .btn { width: 100%; height: 44px; font-size: 15px; }
.login-foot { text-align: center; font-size: 12px; color: var(--muted); margin-top: 22px; }

/* --------------------------- Printable docs --------------------------- */

.doc { background: #fff; max-width: 900px; margin: 0 auto; padding: 32px 36px; border-radius: var(--radius); box-shadow: var(--shadow); border: 1px solid var(--border); }
.doc-head { display: flex; gap: 20px; align-items: center; padding-bottom: 16px; border-bottom: 3px solid var(--green-700); position: relative; }
.doc-head::after { content: ""; position: absolute; left: 0; right: 0; bottom: -7px; height: 2px; background: var(--gold-500); }
.doc-head img { height: 78px; }
.doc-company { flex: 1; }
.doc-company h2 { font-size: 20px; }
.doc-company div { font-size: 12.5px; color: var(--muted); }
.doc-title { text-align: right; }
.doc-title h1 { font-size: 22px; letter-spacing: .06em; text-transform: uppercase; color: var(--green-800); }
.doc-title .doc-no { font-family: var(--font-head); font-size: 15px; color: var(--gold-700); font-weight: 600; }
.doc-parties { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin: 22px 0 18px; }
.doc-box { border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 12px 14px; background: var(--green-50); }
.doc-box .label { text-transform: uppercase; letter-spacing: .06em; font-size: 10.5px; color: var(--gold-700); margin-bottom: 4px; }
.doc-box .name { font-weight: 700; font-size: 15px; color: var(--green-900); }
.doc-box div { font-size: 12.5px; }
.doc .table th { background: var(--green-800); color: #fff; }
.doc .table td { padding: 8px 10px; }
.doc-foot { display: flex; gap: 24px; margin-top: 18px; align-items: flex-start; }
.doc-foot .notes { flex: 1; font-size: 12.5px; color: var(--muted); }
.doc-sign { display: grid; grid-template-columns: repeat(3, 1fr); gap: 30px; margin-top: 60px; font-size: 12px; text-align: center; color: var(--muted); }
.doc-sign div { border-top: 1px solid var(--border-strong); padding-top: 6px; }
.doc-stamp {
    display: inline-block; padding: 4px 14px; border: 2px solid var(--red-600); color: var(--red-600); border-radius: 6px;
    font-weight: 800; letter-spacing: .1em; transform: rotate(-6deg); font-size: 18px;
}

/* --------------------------- Branded reports --------------------------- */

.report { position: relative; background: #f4f5ef; border-radius: 0 0 var(--radius) var(--radius); overflow: hidden; }
.report-band {
    background: linear-gradient(90deg, #062b1c, var(--green-800) 55%, #16664a); color: #fff;
    -webkit-print-color-adjust: exact; print-color-adjust: exact;
}
.report-head { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 16px; padding: 14px 28px; min-height: 96px; }
.report-logo { height: 66px; }
.report-title { font-family: var(--font); font-size: 30px; font-weight: 500; color: var(--gold-400); text-align: center; letter-spacing: .01em; }
.report-meta { text-align: right; justify-self: end; }
.report-subject { font-family: var(--font-head); font-size: 18px; font-weight: 600; color: var(--gold-400); }
.report-subject small { font-size: 12.5px; font-weight: 600; }
.report-period { font-weight: 600; font-size: 14px; }
.report-watermark { position: absolute; inset: 96px 0 56px; display: flex; align-items: center; justify-content: center; pointer-events: none; z-index: 0; }
.report-watermark img { width: min(360px, 40%); opacity: .07; }
.report-sheet { width: 100%; border-collapse: collapse; position: relative; z-index: 1; }
/* On screen a wide report scrolls sideways inside its frame: an auto-sized layout table grows to its widest table and
   the frame then cut the right-hand columns off. Print and print preview keep the full width (they scale it to fit). */
@media screen { body:not(.pp) .report-sheet { table-layout: fixed; } }
/* A wide table whose first column (the name) stays in place while the figures scroll sideways. */
@media screen {
    body:not(.pp) .table.sticky-first td:first-child, body:not(.pp) .table.sticky-first th:first-child {
        position: sticky; left: 0; z-index: 1; background: #fff; box-shadow: 1px 0 0 var(--border);
    }
    body:not(.pp) .table.sticky-first th:first-child { z-index: 2; }
}
.report-sheet > thead { display: none; }
.report-content { padding: 26px 28px 30px; vertical-align: top; }
.report-heading { margin: 0 0 18px 6px; }
.report-heading h2 { font-size: 20px; color: var(--green-900); }
.report-heading h2 small { font-size: 13px; font-weight: 700; color: var(--text); }
.report-heading div { color: var(--text); font-size: 14px; margin-top: 2px; }
.report .table { background: rgba(255, 255, 255, .72); }
.report .table th { background: #fff; }
.report-foot { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 10px 28px; }
.report-foot img { height: 40px; }
.report-site { font-size: 19px; color: var(--gold-400); }
.report-printed { font-size: 12px; color: rgba(255, 255, 255, .8); min-width: 170px; text-align: right; }

/* ---------------------------- Print preview ---------------------------- */

.pp-bar { display: none; }

@media screen {
    body.pp { background: #3b3f3c; }
    body.pp .topbar, body.pp .branch-strip, body.pp .no-print, body.pp .toasts, body.pp .page-header { display: none !important; }
    body.pp main { padding: 84px 20px 48px; }
    body.pp .page {
        width: var(--pp-w); min-height: var(--pp-h); max-width: none; margin: 0 auto; padding: var(--pp-m);
        background: #fff; box-shadow: 0 8px 36px rgba(0, 0, 0, .5); zoom: var(--pp-view); overflow: hidden;
    }
    body.pp .page > * { zoom: var(--pp-scale); }
    body.pp .doc { box-shadow: none; border: 0; padding: 0; max-width: none; border-radius: 0; }
    body.pp .card { border: 0; box-shadow: none; border-radius: 0; }
    body.pp .card + .card, body.pp .mt-2 { margin-top: 0; }
    body.pp .report { border-radius: 0; }
    body.pp .page:has(.report) { background: #f4f4ef; }
    body.pp .card:has(.report) { background: transparent; }

    body.pp .pp-bar {
        display: flex; align-items: center; gap: 14px; flex-wrap: wrap; position: fixed; top: 0; left: 0; right: 0; z-index: 4000;
        padding: 12px 20px; background: linear-gradient(90deg, var(--green-950), var(--green-800)); color: #fff;
        border-bottom: 3px solid var(--gold-500); box-shadow: 0 4px 18px rgba(0, 0, 0, .35); font-size: 13px;
    }
    .pp-bar .pp-title { font-family: var(--font-head); color: var(--gold-300); font-size: 15px; margin-right: 6px; }
    .pp-bar label { display: inline-flex; align-items: center; gap: 6px; color: rgba(255, 255, 255, .85); }
    .pp-bar [hidden] { display: none !important; }
    .pp-bar select {
        height: 30px; border-radius: 6px; border: 1px solid rgba(255, 255, 255, .25); background: rgba(255, 255, 255, .1);
        color: #fff; padding: 0 6px; font-family: inherit;
    }
    .pp-bar select option { color: var(--text); }
    .pp-bar input[type=range] { accent-color: var(--gold-400); width: 110px; }
    .pp-bar .pp-scale-val { min-width: 38px; color: var(--gold-300); font-variant-numeric: tabular-nums; }
    .pp-bar .pp-pages { color: var(--gold-300); }
    .pp-bar .pp-spacer { flex: 1; }
    .pp-bar .pp-btn {
        height: 34px; padding: 0 16px; border-radius: 8px; border: 1px solid rgba(255, 255, 255, .3); cursor: pointer;
        font-family: inherit; font-weight: 600; font-size: 13.5px; background: rgba(255, 255, 255, .1); color: #fff;
    }
    .pp-bar .pp-print { background: linear-gradient(180deg, var(--gold-400), var(--gold-500)); color: var(--green-950); border-color: var(--gold-600); }
    .pp-bar .pp-kind { color: #fff; font-weight: 600; padding: 3px 10px; border-radius: 999px; background: rgba(255, 255, 255, .12); }
    .pp-bar .pp-papers { display: inline-flex; border: 1px solid rgba(255, 255, 255, .3); border-radius: 8px; overflow: hidden; }
    .pp-bar .pp-paper {
        height: 32px; padding: 0 13px; border: 0; border-left: 1px solid rgba(255, 255, 255, .2); background: rgba(255, 255, 255, .06);
        color: #fff; font-family: inherit; font-size: 13px; font-weight: 600; cursor: pointer;
    }
    .pp-bar .pp-paper:first-child { border-left: 0; }
    .pp-bar .pp-paper:hover { background: rgba(255, 255, 255, .16); }
    .pp-bar .pp-paper.on { background: linear-gradient(180deg, var(--gold-400), var(--gold-500)); color: var(--green-950); }
    .pp-bar .pp-setup { color: var(--gold-300); font-size: 12.5px; }
    body.pp[data-paper="POS80"] .page:has(.doc) { box-shadow: 0 8px 36px rgba(0, 0, 0, .5), inset 0 -1px 0 #ccc; }
}

@media print {
    .pp-bar { display: none !important; }
    body.pp .page > * { zoom: var(--pp-scale); }
}

/* ------------------- Papers: half page (A5) and POS 80 mm receipt ------------------- */
/* Chosen in the print preview (body[data-paper]); the same rules give the preview and the print. */

.pos-lines { display: none; }

/* Half page: the A4 layout, tighter, so a normal bill fits half a sheet */
body.pp[data-paper="A5"] .doc { font-size: 10.5px; line-height: 1.3; }
body.pp[data-paper="A5"] .doc-head { gap: 10px; padding-bottom: 5px; }
body.pp[data-paper="A5"] .doc-head::after { bottom: -5px; }
body.pp[data-paper="A5"] .doc-head img { height: 36px; }
body.pp[data-paper="A5"] .doc-company h2 { font-size: 14px; }
body.pp[data-paper="A5"] .doc-company div { font-size: 9.5px; }
body.pp[data-paper="A5"] .doc-title h1 { font-size: 14px; }
body.pp[data-paper="A5"] .doc-title .doc-no { font-size: 11.5px; }
body.pp[data-paper="A5"] .doc-title .small { font-size: 9.5px; }
body.pp[data-paper="A5"] .doc-stamp { font-size: 12px; padding: 1px 8px; }
body.pp[data-paper="A5"] .doc-parties { gap: 8px; margin: 9px 0 6px; }
body.pp[data-paper="A5"] .doc-box { padding: 3px 8px; }
body.pp[data-paper="A5"] .doc-box .label { font-size: 8.5px; margin-bottom: 0; }
body.pp[data-paper="A5"] .doc-box .name { font-size: 11.5px; }
body.pp[data-paper="A5"] .doc-box div { font-size: 9.5px; }
body.pp[data-paper="A5"] .doc .table th, body.pp[data-paper="A5"] .doc .table td { padding: 2px 6px; font-size: 9.5px; line-height: 1.25; }
body.pp[data-paper="A5"] .doc .table .small { font-size: 8.5px; }
body.pp[data-paper="A5"] .doc-foot { margin-top: 5px; gap: 14px; }
body.pp[data-paper="A5"] .doc-foot .notes { font-size: 9.5px; }
body.pp[data-paper="A5"] .doc .totals { font-size: 10.5px; gap: 0 14px; }
body.pp[data-paper="A5"] .doc .totals .t-value { min-width: 84px; }
body.pp[data-paper="A5"] .doc .totals .grand { font-size: 12.5px; padding-top: 2px; }
body.pp[data-paper="A5"] .doc-sign { margin-top: 20px; font-size: 9.5px; gap: 24px; }
body.pp[data-paper="A5"] .doc-sign div { padding-top: 2px; }
body.pp[data-paper="A5"] .money-amount { padding: 6px 10px; margin: 8px 0; }
body.pp[data-paper="A5"] .money-amount .figure { font-size: 18px; }

/* POS 80 mm: one narrow black-and-white column; each item over "qty × price  amount" */
body.pp[data-paper="POS80"] .doc { font-size: 11px; line-height: 1.35; }
body.pp[data-paper="POS80"] .doc, body.pp[data-paper="POS80"] .doc * {
    color: #000 !important; background: transparent !important; box-shadow: none !important;
}
body.pp[data-paper="POS80"] .doc-head { flex-direction: column; align-items: center; gap: 2px; text-align: center; padding-bottom: 6px; border-bottom: 1px dashed #000; }
body.pp[data-paper="POS80"] .doc-head::after { display: none; }
body.pp[data-paper="POS80"] .doc-head img { height: 12mm; filter: grayscale(1) contrast(1.3); }
body.pp[data-paper="POS80"] .doc-company h2 { font-size: 15px; }
body.pp[data-paper="POS80"] .doc-company div { font-size: 10px; }
body.pp[data-paper="POS80"] .doc-title { text-align: center; margin-top: 4px; }
body.pp[data-paper="POS80"] .doc-title h1 { font-size: 13px; letter-spacing: .04em; }
body.pp[data-paper="POS80"] .doc-title .doc-no { font-size: 12px; }
body.pp[data-paper="POS80"] .doc-title .small { font-size: 10px; }
body.pp[data-paper="POS80"] .doc-stamp { transform: none; font-size: 12px; padding: 1px 8px; border: 1px solid #000; }
body.pp[data-paper="POS80"] .doc-parties { display: block; margin: 6px 0 4px; }
body.pp[data-paper="POS80"] .doc-box { border: 0; border-radius: 0; padding: 0 0 5px; }
body.pp[data-paper="POS80"] .doc-box .label { font-size: 9px; margin: 0; }
body.pp[data-paper="POS80"] .doc-box .name { font-size: 12px; }
body.pp[data-paper="POS80"] .doc-box div { font-size: 10.5px; }
body.pp[data-paper="POS80"] .doc > .table { display: none; }
body.pp[data-paper="POS80"] .pos-lines { display: block; border-top: 1px dashed #000; padding-top: 2px; }
.pos-line { padding: 3px 0; break-inside: avoid; }
.pos-line + .pos-line { border-top: 1px dotted #000; }
.pos-row { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.pos-row .num { white-space: nowrap; font-variant-numeric: tabular-nums; }
.pos-note { font-size: 10px; }
.pos-total { font-weight: 700; border-top: 1px solid #000; margin-top: 3px; padding-top: 4px; }
body.pp[data-paper="POS80"] .doc-foot { display: flex; flex-direction: column; align-items: stretch; gap: 6px; margin-top: 6px; }
body.pp[data-paper="POS80"] .doc-foot .totals { order: -1; display: grid; grid-template-columns: 1fr auto; justify-content: stretch; gap: 2px 8px; font-size: 11px; }
body.pp[data-paper="POS80"] .doc-foot .totals .t-label { text-align: left; }
body.pp[data-paper="POS80"] .doc-foot .totals .t-value { min-width: 0; }
body.pp[data-paper="POS80"] .doc-foot .totals .grand { font-family: inherit; font-size: 13px; font-weight: 700; border-top: 1px solid #000; padding-top: 3px; }
body.pp[data-paper="POS80"] .doc-foot .notes { font-size: 10px; text-align: center; border-top: 1px dashed #000; padding-top: 4px; }
body.pp[data-paper="POS80"] .doc-sign { display: none; }
body.pp[data-paper="POS80"] .money-amount { border: 1px solid #000; border-radius: 0; padding: 6px 8px; margin: 6px 0; text-align: center; }
body.pp[data-paper="POS80"] .money-amount .figure { font-size: 16px; }
body.pp[data-paper="POS80"] .money-amount .words { font-size: 10px; }

/* ----------------------------- Responsive ----------------------------- */

/* a full menu (eleven items) still fits next to the brand and the user's name */
@media (max-width: 1500px) {
    .topbar-inner { gap: 12px; }
    .nav-link { padding: 0 9px; }
}
@media (max-width: 1300px) {
    .user-meta { display: none; }
}
@media (max-width: 1240px) {
    .topbar-inner { gap: 8px; }
    .nav-link { padding: 0 6px; font-size: 13px; }
}

@media (max-width: 1180px) {
    .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .brand-text { display: none; }
}

@media (max-width: 960px) {
    .menu-toggle { display: block; }
    .topbar-inner { flex-wrap: wrap; height: auto; min-height: 58px; padding: 8px 16px; }
    .nav { display: none; order: 3; flex-basis: 100%; flex-direction: column; height: auto; padding: 6px 0 10px; }
    .nav.show { display: flex; }
    .nav-item { flex-direction: column; }
    .nav-link { height: 42px; }
    .nav-link.active::after { display: none; }
    .dropdown { position: static; box-shadow: none; border-top: 0; background: rgba(255,255,255,.06); margin: 0 0 6px 12px; }
    /* submenus expand inline on phones (no side fly-out, no hover) */
    .subdropdown { position: static; box-shadow: none; border-top: 0; background: rgba(255,255,255,.06); margin: 2px 0 4px 12px; max-height: none; overflow-y: visible; }
    .dd-subwrap:hover > .subdropdown { display: none; }
    .dd-subwrap.open > .subdropdown { display: block; }
    .dd-subtoggle { color: rgba(255,255,255,.9); }
    .dropdown a, .dropdown button { color: rgba(255,255,255,.9); }
    .dropdown a:hover, .dropdown a.active { background: rgba(255,255,255,.1); color: var(--gold-300); }
    .user-menu { margin-left: auto; }
    .user-meta { display: none; }
    .grid-2, .grid-3, .grid-4 { grid-template-columns: minmax(0, 1fr); }
    .span-2, .span-3 { grid-column: auto; }
    .login { grid-template-columns: 1fr; }
    .login-hero { padding: 30px 16px; min-height: 260px; }
    .login-hero p { display: none; }
    .line-entry, .line-entry.with-disc { grid-template-columns: 1fr 1fr; }
    .line-entry > :first-child { grid-column: 1 / -1; }
    .doc-parties { grid-template-columns: 1fr; }
    .field.wide { grid-column: auto; }
}

@media (max-width: 560px) {
    .page { padding: 16px 16px 40px; }
    .kpis { grid-template-columns: minmax(0, 1fr); }
    .doc { padding: 18px; }
    .doc-head { flex-direction: column; align-items: flex-start; }
    .doc-title { text-align: left; }
}

/* -------------------------------- Print ------------------------------- */

/* Reports print on their own named page: full-bleed green header (repeated via position:fixed)
   and a green footer band drawn in the page-margin boxes so it can carry "Page x of y". */
@page report {
    size: A4;
    margin: 0 0 15mm 0;
    @bottom-left {
        content: "www.travelteaofficial.com"; padding-left: 12mm; vertical-align: middle;
        font: 400 15pt 'Inter', sans-serif; color: #e6be4f;
        background: linear-gradient(90deg, #062b1c, #0c4430);
    }
    @bottom-center {
        content: url("../images/logo-sm.png"); vertical-align: middle; text-align: center;
        background: linear-gradient(90deg, #0c4430, #10543a);
    }
    @bottom-right {
        content: "Page " counter(page) " of " counter(pages); padding-right: 12mm; vertical-align: middle; text-align: right;
        font: 400 14pt 'Inter', sans-serif; color: #fff;
        background: linear-gradient(90deg, #10543a, #16664a);
    }
}

@media print {
    @page { size: A4; margin: 12mm; }
    :root { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
    .card { border: 0; }
    .card:has(.report) > .card-body.no-print, .card:has(.report) > .filters { display: none !important; }
    .card:has(.report) { background: transparent; border-radius: 0; }
    .report { page: report; background: none; border-radius: 0; overflow: visible; }
    /* Off-white paper tone behind every printed report page (fixed = repeated on each page). */
    .report::before { content: ""; position: fixed; inset: 0; background: #f4f4ef; z-index: -1; }
    .report-head { position: fixed; top: 0; left: 0; right: 0; height: 30mm; padding: 0 12mm; min-height: 0; z-index: 5; }
    .report-logo { height: 20mm; }
    .report-title { font-size: 24pt; }
    .report-subject { font-size: 14pt; }
    .report-period { font-size: 11pt; }
    .report-sheet > thead { display: table-header-group; }
    .report-head-space { height: 36mm; }
    .report-content { padding: 0 12mm 4mm; }
    .report-watermark { position: fixed; inset: 30mm 0 0 0; }
    .report-watermark img { width: 90mm; opacity: .06; }
    .report-foot { display: none; }
    .report .table { background: transparent; }
    .report .table th { background: transparent; }
    .report .table tr { break-inside: avoid; }
    .report .table tfoot { display: table-row-group; }   /* totals once, at the end — not on every page */
    body { background: #fff; font-size: 12px; }
    .topbar, .branch-strip, .no-print, .toasts, .page-header, .page-header .actions { display: none !important; }
    .print-only { display: block; }
    .table tr.brand-row td { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
    .page { padding: 0; max-width: none; }
    .doc { box-shadow: none; border: 0; padding: 0; max-width: none; }
    .doc-parties { grid-template-columns: 1fr 1fr; }   /* side by side as in the preview (the paper is narrower than the 960px screen rule) */
    .doc .table th { background: #0e4a32 !important; color: #fff !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
    .doc-box, .doc-head::after { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
    .card { box-shadow: none; }
}

/* ---------- Distributor cards (dashboard) ---------- */
.dcards { display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(420px, 1fr)); }
@media (max-width: 520px) { .dcards { grid-template-columns: 1fr; } }
.dcard {
    background: var(--surface); border: 1px solid var(--border); border-top: 4px solid var(--green-700);
    border-radius: var(--radius); box-shadow: var(--shadow); padding: 14px 16px; display: flex; flex-direction: column; gap: 8px;
}
.dcard.is-active { border-top-color: var(--gold-500); }
.dcard-head { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; }
.dcard-name { font-family: var(--font-head); font-weight: 700; font-size: 16px; color: var(--green-900); }
.dcard-code { font-size: 11px; font-weight: 700; color: var(--grey-600); background: var(--grey-100); border-radius: 999px; padding: 1px 8px; margin-left: 4px; vertical-align: middle; }
.dcard-sub { font-size: 12.5px; color: var(--muted); margin-top: 2px; }
.dcard-bal { text-align: right; white-space: nowrap; }
.dcard-bal .lbl { font-size: 11px; color: var(--muted); }
.dcard-bal .val { font-weight: 700; font-size: 15px; color: var(--green-800); }
.dcard-bal .val.over { color: var(--red-600); }
.dcard-section { display: flex; justify-content: space-between; gap: 8px; align-items: baseline; flex-wrap: wrap;
    font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--green-800);
    border-bottom: 1px solid var(--border); padding-bottom: 4px; margin-top: 4px; }
.dcard-section .muted { text-transform: none; letter-spacing: 0; font-weight: 400; font-size: 12px; }
.dcard-live { color: var(--gold-700); text-transform: none; letter-spacing: 0; font-size: 12px; }
.dcard-stats { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.dstat { display: flex; flex-direction: column; gap: 1px; border-radius: var(--radius-sm); padding: 8px 10px; color: inherit; border-left: 3px solid; }
a.dstat:hover { text-decoration: none; filter: brightness(.98); }
.dstat.green { background: var(--green-50); border-color: var(--green-600); }
.dstat.gold { background: var(--gold-50); border-color: var(--gold-500); }
.dstat.red { background: var(--red-100); border-color: var(--red-600); }
.dstat.blue { background: var(--blue-100); border-color: var(--blue-600); }
.dstat .lbl { font-size: 11.5px; color: var(--muted); }
.dstat .val { font-weight: 700; font-size: 17px; color: var(--text); }
.dstat .sub { font-size: 11.5px; color: var(--muted); }
.dcard-flags { display: flex; gap: 6px; flex-wrap: wrap; }
.dcard-items { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.dcard-items th { text-align: left; font-size: 11px; color: var(--muted); font-weight: 600; padding: 3px 4px; border-bottom: 1px solid var(--border); }
.dcard-items th.text-right { text-align: right; }
.dcard-items td { padding: 4px; border-bottom: 1px dashed var(--border); }
.dcard-items tr.low td:first-child { color: var(--red-600); font-weight: 600; }
.dcard-empty { font-size: 12.5px; color: var(--muted); padding: 4px 0; }
.dcard-more { background: none; border: 0; color: var(--green-700); font-size: 12px; cursor: pointer; padding: 2px 0; text-align: left; }
.dcard-foot { font-size: 12.5px; display: grid; gap: 3px; border-top: 1px solid var(--border); padding-top: 8px; margin-top: auto; }
.dcard-foot .lbl { display: inline-block; min-width: 76px; color: var(--muted); }
.dcard-links { display: flex; gap: 14px; font-size: 12.5px; font-weight: 600; }

.section-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; flex-wrap: wrap; margin-bottom: 10px; }
.section-head h2 { margin: 0; font-family: var(--font-head); font-size: 18px; color: var(--green-900); }

/* ---------- Bulk entry sheets (receipts, vouchers) ---------- */
.bulk-table td { padding: 5px 6px; vertical-align: top; }
.bulk-table .input { min-height: 34px; padding-top: 5px; padding-bottom: 5px; }
.bulk-table .hint { font-size: 11.5px; margin-top: 2px; }

/* ---------- Business analysis and audit ---------- */
.tabbar { display: flex; gap: 2px; flex-wrap: wrap; border-bottom: 2px solid var(--border); margin: 0 0 14px; }
.tabbar button { border: 0; background: none; padding: 9px 14px; font: inherit; font-weight: 600; font-size: 13.5px; color: var(--muted);
    cursor: pointer; border-bottom: 3px solid transparent; margin-bottom: -2px; }
.tabbar button:hover { color: var(--green-700); }
.tabbar button.on { color: var(--green-800); border-bottom-color: var(--gold-500); }
.good { color: var(--green-700); font-weight: 600; }
.bad { color: var(--red-600); font-weight: 600; }
.table th.sortable { cursor: pointer; user-select: none; }
.table th.sortable:hover, .table th.sorted { color: var(--green-800); }
.table td.sub-cell { color: var(--muted); font-size: 12px; }
.note { font-size: 12.5px; color: var(--muted); padding: 10px 18px; border-top: 1px solid var(--border); }
.mono { font-family: ui-monospace, Consolas, monospace; font-size: 12px; white-space: pre-wrap; word-break: break-word;
    background: var(--grey-100); border-radius: var(--radius-sm); padding: 10px; max-height: 360px; overflow: auto; }

.pl-table tr.sec td { background: var(--green-50); color: var(--green-800); font-weight: 700; font-size: 11.5px; text-transform: uppercase; letter-spacing: .05em; }
.pl-table td.lbl { padding-left: 26px; }
.pl-table tr.sub td { font-weight: 700; border-top: 1px solid var(--border-strong); }
.pl-table tr.big td { font-weight: 800; font-size: 15px; background: var(--gold-50); border-top: 2px solid var(--gold-400); }
.pl-table tr.pct td { color: var(--muted); font-size: 12px; font-style: italic; }
.pl-table tr.info td { color: var(--muted); font-size: 12.5px; }

.hub { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 14px; }
.hub a { display: flex; flex-direction: column; gap: 4px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
    padding: 16px 18px; box-shadow: var(--shadow); color: inherit; }
.hub a:hover { border-color: var(--green-500); text-decoration: none; }
.hub .hub-icon { font-size: 22px; line-height: 1; }
.hub h3 { margin: 4px 0 0; color: var(--green-800); font-size: 15px; }
.hub p { margin: 0; color: var(--muted); font-size: 13px; }
.hub-group { margin: 18px 0 8px; font-family: var(--font-head); color: var(--green-900); font-size: 16px; }

.pace { display: grid; gap: 14px; grid-template-columns: repeat(4, minmax(0, 1fr)); }
.pace-tile { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; box-shadow: var(--shadow);
    display: flex; flex-direction: column; gap: 4px; color: inherit; }
a.pace-tile:hover { text-decoration: none; border-color: var(--green-500); }
.pace-tile .lbl { font-size: 12px; color: var(--muted); }
.pace-tile .val { font-size: 20px; font-weight: 800; color: var(--green-900); }
.pace-tile .val small { font-size: 12px; font-weight: 600; color: var(--muted); margin-right: 3px; }
.pace-tile .val .pace-kg { float: right; margin-top: 4px; font-size: 14px; font-weight: 700; color: var(--gold-700, #8a6a12);
    background: var(--gold-50, #fbf5e3); border-radius: 999px; padding: 1px 10px; }
.pace-tile .cmp { font-size: 12.5px; color: var(--muted); }
.delta { font-weight: 700; }
.delta.up { color: var(--green-700); }
.delta.down { color: var(--red-600); }
.progress { height: 8px; background: var(--grey-100); border-radius: 999px; overflow: hidden; margin-top: 4px; }
.progress > span { display: block; height: 100%; background: var(--green-600); border-radius: 999px; }
.progress.behind > span { background: var(--gold-500); }

.alerts { display: grid; gap: 8px; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); }
.alert-row { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border-radius: var(--radius-sm); border: 1px solid var(--border);
    border-left-width: 4px; background: var(--surface); color: inherit; }
a.alert-row:hover { text-decoration: none; background: var(--green-50); }
.alert-row.critical { border-left-color: var(--red-600); }
.alert-row.warning { border-left-color: var(--gold-500); }
.alert-row.info { border-left-color: var(--blue-600); }
.alert-row .a-icon { font-size: 16px; line-height: 1.3; }
.alert-row .a-title { font-weight: 700; font-size: 13.5px; }
.alert-row .a-detail { color: var(--muted); font-size: 12.5px; }
.alert-row .a-count { margin-left: auto; font-weight: 800; color: var(--green-900); }

.target-input { width: 130px; text-align: right; }
.count-sheet td.blank { border-bottom: 1px solid var(--text); min-width: 90px; }

@media (max-width: 900px) {
    .pace { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.after { margin-left: 5px; }
.report-subject small, .report-heading h2 small { margin-left: 6px; }
.mono-inline { font-family: ui-monospace, Consolas, monospace; font-size: 12px; }
.user-meta strong, .user-meta span { white-space: nowrap; max-width: 170px; overflow: hidden; text-overflow: ellipsis; }

/* Users: picking the distributors a Head Office user can see */
.dist-pick-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 8px; }
.dist-pick-bar .input { flex: 1 1 240px; max-width: 360px; }
.dist-pick { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 4px 12px; margin-top: 8px;
             max-height: 260px; overflow-y: auto; padding: 8px 10px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: #fff; }
.dist-pick .check { padding: 4px 6px; border-radius: 6px; align-items: flex-start; }
.dist-pick .check.on { background: var(--gold-50); }
.text-danger { color: var(--red-600); }
/* the branch switcher of a distributor login with several branches */
.branch-switch { font: inherit; font-weight: 600; color: var(--green-900); background: #fff; border: 1px solid var(--gold-300);
                 border-radius: var(--radius-sm); padding: 3px 28px 3px 10px; max-width: 360px; cursor: pointer; }
/* ---------------------------- Import from Excel ---------------------------- */
.import-steps { margin: 0 0 6px 18px; padding: 0; }
.import-steps li { margin: 4px 0; }
.import-steps .btn { margin-left: 8px; }

/* --------------------------- Salesman route map --------------------------- */
.track-report { display: flex; flex-wrap: wrap; gap: 10px 28px; padding: 10px 18px 12px; border-bottom: 1px solid var(--border); background: var(--soft, #f1f8f4); }
.track-report .label { font-size: 11px; }
.track-report .strong { font-size: 15px; }
.track-grid { display: grid; grid-template-columns: minmax(0, 1fr) 260px; gap: 14px; padding: 14px 18px; }
.track-map { height: 520px; border-radius: var(--radius-sm); border: 1px solid var(--border); background: var(--grey-100); }
.track-list { max-height: 520px; overflow-y: auto; }
.track-steps { list-style: none; margin: 8px 0 0; padding: 0; }
.track-steps li { padding: 6px 8px 6px 14px; border-left: 3px solid var(--gold-400); margin-bottom: 4px; cursor: pointer; font-size: 13px; border-radius: 4px; }
.track-steps li:hover { background: var(--gold-50); }
.track-steps li.start { border-left-color: #16a34a; }
.track-steps li.end { border-left-color: var(--red-600); }
.track-steps li .num { color: var(--muted); margin-right: 6px; }
@media (max-width: 860px) { .track-grid { grid-template-columns: 1fr; } .track-map { height: 380px; } }
