/* Mizan — base styles. RTL first. Colors are tokens so a dark theme can be added later. */
:root {
    --ink: #1b2540;
    --ink-soft: #4a5672;
    --muted: #6a7591;
    --paper: #f4f6fb;
    --card: #ffffff;
    --line: #e1e6f0;
    --line-strong: #c9d1e2;
    --primary: #2f5bd3;
    --primary-dark: #2449b0;
    --primary-ink: #ffffff;
    --primary-soft: #e3e9fb;
    --navy: #1b2a4a;
    --accent: #ee8a1f;
    --accent-soft: #fdecd7;
    --danger: #c0392b;
    --danger-soft: #fbe6e3;
    --success: #1f8a4c;
    --success-soft: #def3e6;
    --radius: 14px;
    --radius-sm: 10px;
    --shadow: 0 1px 2px rgba(27, 42, 74, .04), 0 4px 16px rgba(27, 42, 74, .05);
    --font: "IBM Plex Sans Arabic", "IBM Plex Sans", "Segoe UI", Tahoma, sans-serif;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html, body {
    margin: 0;
    background: var(--paper);
    color: var(--ink);
    font-family: var(--font);
    font-size: 15px;
    line-height: 1.6;
}

h1 { font-size: 1.6rem; margin: 0 0 .25rem; color: var(--navy); font-weight: 700; letter-spacing: -.01em; }
h2 { font-size: 1.1rem; margin: 0 0 .75rem; color: var(--navy); }
a { color: var(--primary); }
.muted { color: var(--muted); }

.boot { display: grid; place-items: center; min-height: 100vh; color: var(--muted); }

/* ---- Shell ---- */
.shell { display: flex; min-height: 100vh; }
.sidebar {
    width: 264px; flex-shrink: 0; display: flex; flex-direction: column;
    background: var(--card); color: var(--ink-soft); border-inline-end: 1px solid var(--line);
    padding: 1rem .85rem .75rem;
    position: sticky; top: 0; height: 100vh;
}
.sidebar nav { flex: 1; overflow-y: auto; margin: 0 -.35rem; padding: 0 .35rem; }
.brand { display: flex; align-items: center; justify-content: space-between; gap: .6rem; padding: .25rem .5rem 1.1rem; }
.brand-mark {
    display: inline-grid; place-items: center; width: 2.25rem; height: 2.25rem;
    border-radius: 10px; background: var(--accent); color: #fff; font-weight: 700; font-size: 1.1rem;
}
.brand-name { font-size: 1.3rem; font-weight: 700; color: var(--navy); margin-inline-start: .5rem; }
.nav-item {
    display: flex; align-items: center; gap: .7rem; padding: .55rem .8rem; border-radius: 10px;
    color: var(--ink-soft); text-decoration: none; font-weight: 500;
}
.nav-item:hover { background: var(--paper); color: var(--ink); }
.nav-item.active { background: var(--primary-soft); color: var(--primary-dark); font-weight: 700; }
.nav-item .icon, .nav-head .icon { flex-shrink: 0; color: var(--muted); }
.nav-item.active .icon { color: var(--primary); }
.nav-group { margin-top: .15rem; }
.nav-head {
    display: flex; align-items: center; gap: .7rem; width: 100%; padding: .55rem .8rem; border-radius: 10px;
    border: 0; background: none; font: inherit; font-weight: 500; color: var(--ink-soft); cursor: pointer; text-align: start;
}
.nav-head span { flex: 1; }
.nav-head:hover { background: var(--paper); color: var(--ink); }
.nav-head .caret { transition: transform .15s; }
.nav-group.open .caret { transform: rotate(180deg); }
.nav-group.current > .nav-head { color: var(--navy); font-weight: 700; }
.nav-group.current > .nav-head .icon { color: var(--primary); }
.nav-sub { display: flex; flex-direction: column; gap: 1px; margin: .1rem 0 .4rem; padding-inline-start: 2.1rem; position: relative; }
.nav-sub::before { content: ""; position: absolute; inset-inline-start: 1.4rem; top: .3rem; bottom: .3rem; width: 1px; background: var(--line); }
.nav-sub .nav-item { padding: .38rem .7rem; font-size: .92rem; }
.side-foot { display: flex; align-items: center; gap: .6rem; border-top: 1px solid var(--line); padding: .8rem .35rem 0; margin-top: .5rem; }
.side-foot .who { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.3; }
.side-foot .who b { color: var(--navy); font-size: .92rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.side-foot .who small { color: var(--muted); font-size: .78rem; }
.avatar {
    display: inline-grid; place-items: center; width: 2.3rem; height: 2.3rem; flex-shrink: 0;
    border-radius: 50%; background: var(--primary); color: #fff; font-weight: 700;
}
.icon-btn {
    display: inline-grid; place-items: center; width: 2.4rem; height: 2.4rem; flex-shrink: 0;
    border: 1px solid transparent; border-radius: 10px; background: none; color: var(--ink-soft); cursor: pointer;
}
.icon-btn:hover { background: var(--paper); color: var(--ink); }
.only-mobile { display: none !important; }
.backdrop { display: none; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
    display: flex; align-items: center; justify-content: space-between; gap: 1rem;
    padding: .7rem 1.75rem; background: var(--card); border-bottom: 1px solid var(--line);
    position: sticky; top: 0; z-index: 20;
}
.topbar-start, .topbar-end { display: flex; align-items: center; gap: .75rem; min-width: 0; }
.company { font-weight: 700; color: var(--navy); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.content { padding: 1.75rem; max-width: 1600px; width: 100%; }
/* With the menu folded the page takes the whole width, so lists and item grids show more. */
.nav-collapsed .content { max-width: none; }

/* ---- Auth ---- */
.auth-shell { min-height: 100vh; display: grid; place-items: center; padding: 1.5rem 1rem; }
.auth-card {
    width: 100%; max-width: 420px; background: var(--card);
    border: 1px solid var(--line); border-radius: 16px; padding: 2rem;
}
.auth-card.wide { max-width: 640px; }
.auth-brand { display: flex; align-items: center; gap: .5rem; font-weight: 700; font-size: 1.2rem; margin-bottom: 1.25rem; }
.auth-switch { text-align: center; margin-top: 1rem; color: var(--ink-soft); }
.tenant-list { display: grid; gap: .5rem; margin: 1rem 0; }
.tenant {
    display: flex; justify-content: space-between; align-items: center;
    padding: .8rem 1rem; border: 1px solid var(--line); border-radius: var(--radius);
    background: var(--card); font: inherit; cursor: pointer; text-align: start;
}
.tenant:hover { border-color: var(--primary); background: var(--primary-soft); }
.tenant span { color: var(--muted); }

/* ---- Building blocks ---- */
.page-head { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 1rem; margin-bottom: 1.25rem; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.15rem; margin-bottom: 1rem; overflow-x: auto; box-shadow: var(--shadow); }
.form-card { border-color: var(--primary); }
.toolbar { display: flex; flex-wrap: wrap; align-items: flex-end; gap: .75rem; margin-bottom: 1rem; }
.actions { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; margin-top: 1rem; }
.empty { padding: 2rem; text-align: center; color: var(--muted); }

.grid-2, .grid-4 { display: grid; gap: .75rem 1rem; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.span-2 { grid-column: span 2; }

.field { display: flex; flex-direction: column; gap: .3rem; margin-bottom: .75rem; }
.field > span { font-size: .85rem; color: var(--ink-soft); }
.field small { color: var(--muted); font-size: .78rem; }
.field.inline { margin-bottom: 0; }
.check { display: flex; align-items: center; gap: .4rem; color: var(--ink-soft); }

input, select, textarea {
    font: inherit; color: var(--ink);
    padding: .55rem .75rem; border: 1px solid var(--line-strong); border-radius: var(--radius-sm);
    background: #fff; width: 100%; min-height: 2.6rem;
}
input:focus, select:focus, textarea:focus { outline: 3px solid var(--primary-soft); border-color: var(--primary); }
input:disabled, select:disabled { background: #f1f3f8; color: var(--ink-soft); }
input[type="checkbox"] { width: auto; }
.search { max-width: 260px; }

.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: .4rem;
    font: inherit; font-weight: 600; padding: .55rem 1.1rem; border-radius: var(--radius-sm); min-height: 2.6rem;
    border: 1px solid var(--line-strong); background: var(--card); color: var(--navy);
    cursor: pointer; text-decoration: none; white-space: nowrap;
}
.btn:hover { border-color: var(--primary); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-primary { background: var(--primary); border-color: var(--primary); color: var(--primary-ink); box-shadow: 0 4px 12px rgba(47, 91, 211, .25); }
.btn-primary:hover { background: var(--primary-dark); border-color: var(--primary-dark); }
.btn-accent { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-sm { min-height: 2.25rem; padding: .35rem .85rem; font-size: .92rem; }
.btn .icon { flex-shrink: 0; }
.btn-danger { color: var(--danger); border-color: #efc4be; }
.btn-ghost { background: transparent; border-color: transparent; color: var(--ink-soft); }
.btn-block { width: 100%; margin-top: .5rem; }
.link { background: none; border: 0; padding: 0; font: inherit; color: var(--primary); cursor: pointer; text-decoration: none; }
.link.danger { color: var(--danger); }

.alert { padding: .7rem 1rem; border-radius: var(--radius-sm); margin: .5rem 0 1rem; }
.alert-error { background: var(--danger-soft); color: var(--danger); }
.alert-success { background: var(--success-soft); color: var(--success); }
.alert-info { background: var(--primary-soft); color: var(--primary-dark); }
.alert-info a { color: inherit; font-weight: 700; }

.badge { display: inline-block; padding: .12rem .65rem; border-radius: 999px; font-size: .8rem; font-weight: 600; }
.badge-draft { background: var(--accent-soft); color: #9a5205; }
.badge-posted { background: var(--success-soft); color: var(--success); }
.badge-reversed { background: #eceff5; color: var(--ink-soft); }

/* ---- Tables ---- */
table.grid { width: 100%; border-collapse: collapse; }
.grid th {
    text-align: start; font-size: .8rem; font-weight: 600; color: var(--muted);
    padding: .6rem .65rem; border-bottom: 1px solid var(--line); background: #f8f9fc;
}
.grid td { padding: .6rem .65rem; border-bottom: 1px solid #edf0f6; vertical-align: middle; }
.grid .num { text-align: end; font-variant-numeric: tabular-nums; white-space: nowrap; }
.grid th.num { text-align: end; }
.grid td[dir="ltr"].num { text-align: right; }
.grid .center { text-align: center; }
.grid tfoot td { font-weight: 700; border-top: 2px solid var(--line-strong); border-bottom: 0; }
.grid .total { color: var(--ink); }
.row-group td { font-weight: 700; background: #f8f9fc; }
.row-actions { text-align: end; white-space: nowrap; }
.row-actions > * + * { margin-inline-start: .75rem; }
table.clickable tbody tr { cursor: pointer; }
table.clickable tbody tr:hover td { background: var(--primary-soft); }
.lines td { padding: .3rem .35rem; }
.lines input { padding: .4rem .5rem; }
.lines input.num { text-align: end; direction: ltr; }
.diff { color: var(--danger); }
.balanced { color: var(--success); }

.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 1rem; margin-top: 1.25rem; }
.tile {
    display: flex; flex-direction: column; gap: .25rem; padding: 1.1rem 1.2rem;
    background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
    color: var(--ink); text-decoration: none;
}
.tile:hover { border-color: var(--primary); box-shadow: var(--shadow); }
.tile span { color: var(--muted); font-size: .9rem; }

.pager { display: flex; justify-content: center; align-items: center; gap: 1rem; color: var(--ink-soft); }

/* ---- Side menu folded to icons (wide screens) ---- */
@media (min-width: 861px) {
    .sidebar { transition: width .15s ease, padding .15s ease; }
    .nav-collapsed .sidebar { width: 72px; padding-inline: .6rem; }
    .nav-collapsed .brand { justify-content: center; padding-inline: 0; }
    .nav-collapsed .brand-name,
    .nav-collapsed .sidebar nav .nav-item > span,
    .nav-collapsed .nav-head > span,
    .nav-collapsed .nav-head .caret,
    .nav-collapsed .side-foot .who,
    .nav-collapsed .side-foot .lang-toggle { display: none; }
    .nav-collapsed .nav-item, .nav-collapsed .nav-head { justify-content: center; padding-inline: 0; }
    .nav-collapsed .side-foot { flex-direction: column; padding-inline: 0; }
}

/* ---- Small screens (phones) ---- */
@media (max-width: 860px) {
    .sidebar {
        position: fixed; inset-block: 0; inset-inline-start: 0; z-index: 50; height: 100%;
        width: min(300px, 86vw); transform: translateX(100%); transition: transform .2s ease;
        box-shadow: 0 0 40px rgba(27, 42, 74, .18);
    }
    [dir="ltr"] .sidebar { transform: translateX(-100%); }
    .menu-open .sidebar, [dir="ltr"] .menu-open .sidebar { transform: none; }
    .menu-open .backdrop { display: block; position: fixed; inset: 0; z-index: 40; background: rgba(27, 42, 74, .35); }
    .only-mobile { display: inline-grid !important; }
    .hide-mobile { display: none !important; }
    .content { padding: 1rem; }
    .grid-2, .grid-4 { grid-template-columns: 1fr; }
    .span-2 { grid-column: auto; }
    .topbar { padding: .55rem .75rem; }
}

#blazor-error-ui {
    display: none; position: fixed; bottom: 0; inset-inline: 0; z-index: 1000;
    padding: .75rem 1.25rem; background: #fff4d6; border-top: 1px solid #e8d49a;
}
#blazor-error-ui .reload { margin-inline-start: .75rem; }
.auth-brand .brand-name { color: var(--ink); font-size: 1.2rem; }

/* ---- Branch selector & treasury ---- */
.topbar-start { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; }
.branch-select { display: flex; align-items: center; gap: .4rem; color: var(--ink-soft); font-size: .9rem; }
.branch-select select { width: auto; min-height: 2.25rem; padding: .3rem .75rem; border-radius: 999px; }
.branch-badge { background: var(--primary-soft); color: var(--primary-dark); border-radius: 999px; padding: .25rem .8rem; font-size: .85rem; font-weight: 600; white-space: nowrap; }
.badge-cancelled { background: var(--danger-soft); color: var(--danger); }
.tabs { display: flex; gap: .25rem; border-bottom: 1px solid var(--line); margin-bottom: 1rem; flex-wrap: wrap; }
.tab { padding: .55rem 1rem; border: 0; background: none; font: inherit; color: var(--ink-soft); cursor: pointer; border-bottom: 2px solid transparent; }
.tab.active { color: var(--primary); border-bottom-color: var(--primary); font-weight: 600; }
.amount-pos { color: var(--success); }
.amount-neg { color: var(--danger); }
.checks { display: flex; flex-wrap: wrap; gap: .5rem 1.25rem; margin: .25rem 0 .75rem; }
.voucher-type { font-size: .8rem; font-weight: 600; padding: .1rem .55rem; border-radius: 6px; }
.voucher-type.receipt { background: var(--success-soft); color: var(--success); }
.voucher-type.payment { background: #fdeee2; color: #9a4b12; }
.voucher-type.transfer { background: var(--primary-soft); color: var(--primary); }
.total-box { font-size: 1.1rem; font-weight: 700; }

/* ---- date input (dd/MM/yyyy, optional Hijri) ---- */
.date-input { display: flex; flex-direction: column; gap: .15rem; min-width: 0; }
.date-row { display: flex; align-items: stretch; gap: .25rem; }
.date-row .date-text { flex: 1; min-width: 7.5rem; text-align: start; font-variant-numeric: tabular-nums; }
.date-row .date-picker {
    width: 2.6rem; flex: none; padding: 0 .3rem; color: transparent; cursor: pointer;
    background: #fff;
}
.date-row .date-picker::-webkit-datetime-edit { display: none; }
.date-row .date-picker::-webkit-calendar-picker-indicator { margin: 0; cursor: pointer; opacity: .7; }
.date-input.invalid .date-text { border-color: var(--danger, #b42318); outline-color: #f6c9c4; }
.date-hint { font-size: .75rem; color: var(--muted); }
.date-hint.error { color: var(--danger, #b42318); }
.field.inline .date-row .date-text { min-width: 7rem; width: 7.5rem; }
.fx-note { font-size: .8rem; color: var(--muted); }
.cur { font-size: .78rem; color: var(--ink-soft); margin-inline-start: .25rem; }
.grid-4.align-end { align-items: end; }
tr.selected td { background: var(--primary-soft); }

/* ---- sales ---- */
.badges { display: flex; gap: .4rem; flex-wrap: wrap; }
.lines-wrap { overflow-x: auto; }
.sales-lines td { vertical-align: top; }
.sales-lines .line-desc { margin-top: .3rem; font-size: .85rem; padding: .3rem .5rem; }
.line-kind { display: flex; gap: .35rem; }
.line-kind > select:first-child { flex: 0 0 6.75rem; }
.line-kind > :last-child { flex: 1; min-width: 0; }
.sales-lines small { display: block; margin-top: .2rem; font-size: .75rem; }
.totals { margin-inline-start: auto; max-width: 360px; margin-top: 1rem; display: flex; flex-direction: column; gap: .35rem; }
.totals-row { display: flex; justify-content: space-between; align-items: center; gap: 1rem; font-variant-numeric: tabular-nums; }
.totals-row.grand { font-weight: 700; font-size: 1.05rem; border-top: 1px solid var(--line); padding-top: .4rem; }
.disc-inputs { display: flex; gap: .4rem; }
.disc-inputs input { width: 6rem; }
@media (max-width: 860px) {
    .sales-lines { min-width: 760px; }
    .totals { max-width: none; }
}
.section-title { font-size: 1rem; margin: 1.25rem 0 .5rem; }

/* ---- printed invoice (A4) ---- */
.invoice-sheet { background: #fff; color: #111; max-width: 210mm; margin: 0 auto; padding: 14mm 12mm; border: 1px solid var(--line); font-size: 13px; }
.inv-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; border-bottom: 2px solid #111; padding-bottom: .75rem; }
.inv-company { font-size: 1.25rem; font-weight: 700; margin-bottom: .2rem; }
.inv-title { text-align: center; flex: 1; }
.inv-kind { font-size: 1.3rem; font-weight: 700; }
.inv-draft { color: #a4342a; font-weight: 700; margin-top: .3rem; }
.inv-qr svg { display: block; }
.inv-meta { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .35rem 1rem; margin: .75rem 0; }
.inv-meta span { color: #555; margin-inline-end: .4rem; }
.inv-lines { width: 100%; border-collapse: collapse; margin-top: .5rem; }
.inv-lines th, .inv-lines td { border: 1px solid #999; padding: .35rem .4rem; text-align: center; font-variant-numeric: tabular-nums; }
.inv-lines th { background: #f0f0f0; }
.inv-lines td:nth-child(2) { text-align: start; }
.inv-desc, .inv-lines small { color: #555; font-size: .85em; }
.inv-foot { display: flex; justify-content: space-between; gap: 1rem; margin-top: .75rem; }
.inv-words { flex: 1; font-weight: 600; }
.inv-notes { font-weight: 400; color: #444; margin-top: .4rem; }
.inv-totals { min-width: 260px; }
.inv-totals div { display: flex; justify-content: space-between; gap: 1rem; padding: .2rem 0; border-bottom: 1px dotted #bbb; font-variant-numeric: tabular-nums; }
.inv-grand { font-size: 1.1rem; font-weight: 700; border-bottom: 2px solid #111 !important; }
.inv-sign { display: flex; justify-content: space-between; margin-top: 2.5rem; }
.inv-ltr { unicode-bidi: plaintext; }
@media (max-width: 860px) {
    .invoice-sheet { padding: 1rem; }
    .inv-head, .inv-foot { flex-direction: column; }
    .inv-meta { grid-template-columns: 1fr 1fr; }
    .inv-lines { font-size: 11px; }
}
/* ---- Financial statements ---- */
.statement-table td.num, .statement-table th.num { width: 9.5rem; white-space: nowrap; }
.statement-table .pct { width: 5rem; font-size: .85rem; }
.statement-table .code { font-size: .78rem; margin: 0 .5rem; }
.statement-table tr.st-section td { background: var(--paper); font-weight: 700; color: var(--primary); padding-top: .9rem; }
.statement-table tr.st-group td { font-weight: 600; }
.statement-table tr.st-subtotal td { font-weight: 700; border-top: 1px solid var(--line-strong); }
.statement-table tr.st-total td { font-weight: 800; font-size: 1.02rem; border-top: 2px solid var(--ink); background: var(--primary-soft); }
.statement-check { margin: .5rem 0 1rem; }
.cc-table th.num, .cc-table td.num { min-width: 8.5rem; }
.cc-table th.num .link { font-weight: 700; text-align: inherit; }
.statement-head { display: none; }

/* ---- Dashboard ---- */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(13rem, 1fr)); gap: .9rem; margin: 1rem 0; }
.kpi { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem 1.15rem; box-shadow: var(--shadow); }
.kpi.featured { background: var(--navy); border-color: var(--navy); color: #fff; }
.kpi.featured .label { color: #a6b2cc; }
.kpi.featured .delta.up { color: #8fe0b4; }
.kpi.featured .delta.down { color: #ffb4a8; }
.kpi.featured .delta:not(.up):not(.down) { color: #a6b2cc; }
.kpi .label { color: var(--ink-soft); font-size: .88rem; }
.kpi .value { font-size: 1.6rem; font-weight: 700; margin: .25rem 0; font-variant-numeric: tabular-nums; }
.kpi .delta { font-size: .82rem; }
.kpi .delta.up { color: var(--success); }
.kpi .delta.down { color: var(--danger); }
.dash-grid { display: grid; grid-template-columns: 2fr 1fr; gap: .9rem; margin-bottom: 1.25rem; }
.dash-grid .card h2 { font-size: 1rem; margin: 0 0 .75rem; }
.chart { width: 100%; height: auto; display: block; }
.chart .bar-rev { fill: var(--primary); }
.chart .bar-exp { fill: var(--accent); }
.chart text { font-size: 10px; fill: var(--muted); font-family: var(--font); }
.chart .axis { stroke: var(--line-strong); }
.legend { display: flex; gap: 1rem; font-size: .82rem; color: var(--ink-soft); margin-top: .4rem; }
.legend i { display: inline-block; width: .7rem; height: .7rem; border-radius: 2px; margin-inline-end: .3rem; vertical-align: middle; }
.bars-list { list-style: none; padding: 0; margin: 0; }
.bars-list li { margin-bottom: .6rem; font-size: .9rem; }
.bars-list .row { display: flex; justify-content: space-between; gap: .5rem; }
.bars-list .track { height: 6px; background: var(--paper); border-radius: 3px; margin-top: .25rem; }
.bars-list .fill { height: 6px; background: var(--accent); border-radius: 3px; }
@media (max-width: 900px) { .dash-grid { grid-template-columns: 1fr; } }

@media print {
    @page { size: A4; margin: 8mm; }
    body { background: #fff !important; }
    .sidebar, .topbar, .no-print { display: none !important; }
    .shell, .main, .content { display: block !important; padding: 0 !important; margin: 0 !important; }
    .invoice-sheet { border: none; padding: 0; max-width: none; }
    .statement-head { display: block; text-align: center; margin-bottom: .5rem; }
    .statement { border: none; }
}
.kpi.featured .value.amount-neg { color: #ffb4a8; }

/* ---- Utilities ---- */
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.flip { transform: scaleX(-1); }
.segmented { display: inline-flex; gap: 2px; padding: 3px; background: #e9edf5; border-radius: 12px; }
.segmented button {
    display: inline-flex; align-items: center; justify-content: center; gap: .4rem; flex: 1;
    border: 0; background: none; font: inherit; font-weight: 600; color: var(--muted);
    padding: .45rem .95rem; border-radius: 9px; cursor: pointer; white-space: nowrap;
}
.segmented button.on { background: #fff; color: var(--navy); box-shadow: 0 1px 3px rgba(27, 42, 74, .12); }
.segmented button:disabled { cursor: default; opacity: .55; }
.segmented button.on:disabled { opacity: 1; }
.segmented.wide { display: flex; }
kbd {
    display: inline-block; min-width: 1.9rem; padding: .05rem .35rem; margin-inline-end: .3rem; text-align: center;
    font: 600 .75rem/1.5 "IBM Plex Sans", monospace; color: var(--ink-soft); background: #fff;
    border: 1px solid var(--line-strong); border-bottom-width: 2px; border-radius: 6px;
}

/* ---- Item photos ---- */
.thumb {
    display: inline-grid; place-items: center; overflow: hidden; flex-shrink: 0;
    width: 100%; aspect-ratio: 4 / 3; border-radius: 12px; background: #f6f7fa;
    font-weight: 700; font-size: 1.9rem; color: rgba(27, 37, 64, .55);
}
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.thumb.sm { width: 2.25rem; height: 2.25rem; aspect-ratio: auto; border-radius: 8px; font-size: 1rem; }
.thumb.lg { width: 7.5rem; height: 7.5rem; aspect-ratio: auto; border-radius: 14px; font-size: 2.6rem; }
.t-clay { background: #fbe3d6; } .t-sage { background: #dcf1e4; } .t-slate { background: #e3e8f8; }
.t-sand { background: #fbefd9; } .t-sea { background: #dcebfb; }
.name-cell { display: inline-flex; align-items: center; gap: .6rem; }
.photo-field { display: flex; align-items: center; gap: 1rem; margin-bottom: 1rem; }
.photo-actions { display: flex; flex-direction: column; }
.photo-actions label.btn { position: relative; cursor: pointer; }

/* ---- Sale document ---- */
.doc-page .page-head { align-items: flex-end; }
.doc-page .badges { margin-top: .35rem; }
.doc-fields { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: .75rem 1rem; align-items: start; }
.doc-fields .field { margin: 0; }
.doc-fields .tax-check { align-self: center; }
.doc-head { padding: 1.1rem 1.25rem; }
.lines-card { padding: .5rem .75rem; }
.doc-page .sales-lines td.center, .doc-page .sales-lines td.muted, .doc-page .sales-lines td.num { padding-top: 1.1rem; }
.line-item { display: flex; align-items: baseline; gap: .55rem; padding-top: .55rem; }
.line-item .code, .item-search .code { color: var(--muted); font-size: .85rem; font-variant-numeric: tabular-nums; }
.doc-page .sales-lines .line-desc { margin-top: .35rem; font-size: .85rem; padding: .3rem .55rem; min-height: 2rem; border-style: dashed; }
.doc-page .sales-lines small { display: block; margin-top: .2rem; font-size: .78rem; }
.lines-card { overflow: visible; }
.add-line { display: flex; align-items: center; gap: .75rem; padding: .7rem .4rem .45rem; }
.add-line > .muted { width: 2.1rem; text-align: center; flex-shrink: 0; }
.add-line .item-search { flex: 1; }
.item-search { position: relative; }
.item-search .lead { position: absolute; inset-inline-start: .8rem; top: .75rem; color: var(--muted); pointer-events: none; }
.item-search input { padding-inline-start: 2.5rem; border: 1.5px solid var(--line-strong); min-height: 2.8rem; }
.item-search input:focus { border-color: var(--primary); }
.suggest {
    position: absolute; z-index: 30; inset-inline: 0; top: calc(100% + 6px); margin: 0; padding: .35rem; list-style: none;
    background: #fff; border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 12px 32px rgba(27, 42, 74, .16);
    max-height: 22rem; overflow-y: auto;
}
.suggest li { display: flex; align-items: baseline; gap: .65rem; padding: .55rem .75rem; border-radius: 9px; cursor: pointer; }
.suggest li.active { background: var(--primary-soft); }
.suggest li b { font-weight: 600; color: var(--navy); }
.suggest li .price { margin-inline-start: auto; font-weight: 600; font-variant-numeric: tabular-nums; }
.suggest li.hint { cursor: default; color: var(--muted); font-size: .8rem; justify-content: flex-end; }
.doc-bottom { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: 1rem; }
.doc-bottom .card { margin-bottom: 0; }
.pay-box { display: flex; flex-direction: column; gap: .8rem; }
.pay-box .field { margin: 0; }
.pay-fields { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: .75rem 1rem; }
.pay-fields:empty { display: none; }
.doc-page .totals { margin: 0; max-width: none; display: flex; flex-direction: column; gap: .45rem; color: var(--ink-soft); }
.doc-page .totals-row.grand { color: var(--navy); font-weight: 700; font-size: 1.35rem; border-top: 1px solid var(--line); padding-top: .65rem; margin-top: .2rem; }
.totals-row.due { color: var(--primary); font-weight: 700; }
.action-bar {
    position: sticky; bottom: 0; z-index: 15; display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap;
    margin: 1rem -1.75rem -1.75rem; padding: .8rem 1.75rem; background: rgba(255, 255, 255, .96); border-top: 1px solid var(--line);
    backdrop-filter: blur(6px);
}
.action-bar .keys { display: flex; gap: 1rem; color: var(--muted); font-size: .85rem; }
.action-bar .buttons { margin-inline-start: auto; }
.action-bar .actions { margin: 0; }

/* item grid (selling by buttons) */
.customer-chip {
    display: inline-flex; align-items: center; gap: .45rem; margin-bottom: .85rem; padding: .45rem .9rem;
    border: 1px solid var(--line-strong); border-radius: 999px; background: #fff; font: inherit; font-weight: 600; color: var(--navy); cursor: pointer;
}
.grid-tools { margin-bottom: .75rem; }
.chips { display: flex; gap: .5rem; overflow-x: auto; padding-bottom: .35rem; margin-bottom: .85rem; scrollbar-width: none; }
.chip {
    flex-shrink: 0; padding: .45rem 1.05rem; border-radius: 999px; border: 1px solid var(--line-strong);
    background: #fff; font: inherit; font-weight: 600; color: var(--ink-soft); cursor: pointer;
}
.chip.on { background: var(--navy); border-color: var(--navy); color: #fff; }
.tiles-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(168px, 1fr)); gap: .85rem; padding-bottom: 6rem; }
.item-tile {
    position: relative; display: flex; flex-direction: column; background: #fff; border: 1.5px solid var(--line);
    border-radius: 16px; overflow: hidden; transition: border-color .12s, box-shadow .12s;
}
.item-tile:hover { box-shadow: var(--shadow); }
.item-tile.in { border-color: var(--primary); box-shadow: 0 0 0 1px var(--primary); }
.tile-hit {
    display: flex; flex-direction: column; gap: .3rem; padding: .6rem .6rem .7rem; border: 0; background: none;
    font: inherit; text-align: start; color: var(--ink); cursor: pointer;
}
.tile-hit .thumb { margin-bottom: .25rem; }
.t-name { font-weight: 600; color: var(--navy); line-height: 1.35; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; min-height: 2.7em; }
.t-meta { display: flex; align-items: baseline; justify-content: space-between; gap: .4rem; }
.t-meta b { font-size: 1.05rem; font-variant-numeric: tabular-nums; }
.t-meta small { color: var(--muted); }
.t-badge {
    position: absolute; top: .45rem; inset-inline-end: .45rem; min-width: 1.75rem; height: 1.75rem; padding: 0 .4rem;
    display: grid; place-items: center; border-radius: 999px; background: var(--primary); color: #fff; font-weight: 700; font-size: .85rem;
}
.stepper { display: flex; align-items: center; justify-content: space-between; margin: 0 .6rem .6rem; background: var(--primary-soft); border-radius: 10px; }
.stepper button { display: grid; place-items: center; width: 2.4rem; height: 2.3rem; border: 0; background: none; color: var(--primary); cursor: pointer; }
.stepper b { color: var(--primary-dark); font-variant-numeric: tabular-nums; }
.stepper.sm { margin: 0; background: #f1f4fa; }
.stepper.sm button { width: 2rem; height: 2rem; }
.stepper.sm input { width: 3.6rem; min-height: 2rem; padding: .2rem; border: 0; background: transparent; text-align: center; font-weight: 700; }
.pay-bar {
    position: sticky; bottom: 1rem; z-index: 25; display: flex; align-items: center; gap: .85rem;
    max-width: 640px; margin: -4.5rem auto 0; padding: .6rem .6rem .6rem 1rem;
    background: var(--navy); color: #fff; border-radius: 18px; box-shadow: 0 12px 30px rgba(27, 42, 74, .3);
}
.pay-bar .count { display: grid; place-items: center; min-width: 2.6rem; height: 2.6rem; border-radius: 12px; background: rgba(255, 255, 255, .12); font-weight: 700; }
.pay-bar .sum { flex: 1; display: flex; flex-direction: column; line-height: 1.3; }
.pay-bar .sum b { font-size: 1.3rem; font-variant-numeric: tabular-nums; }
.pay-bar .sum small { color: #a6b2cc; }
.pay-bar .btn-accent { min-height: 3rem; padding: .5rem 1.5rem; font-size: 1.05rem; border-radius: 12px; }
.sheet-backdrop { position: fixed; inset: 0; z-index: 60; background: rgba(27, 42, 74, .4); }
.sheet {
    position: fixed; z-index: 61; inset-block: 0; inset-inline-end: 0; width: min(520px, 100%);
    display: flex; flex-direction: column; background: var(--paper); box-shadow: 0 0 40px rgba(27, 42, 74, .25);
}
.sheet-head { display: flex; align-items: center; justify-content: space-between; padding: .9rem 1.1rem; background: #fff; border-bottom: 1px solid var(--line); }
.sheet-head h2 { margin: 0; }
.sheet-body { flex: 1; overflow-y: auto; padding: 1rem 1.1rem; display: flex; flex-direction: column; gap: 1rem; }
.sheet-body .doc-fields { grid-template-columns: 1fr 1fr; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: .9rem; }
.sheet-body .section-title { margin: .25rem 0 -.4rem; color: var(--ink-soft); font-size: .95rem; }
.sheet-body .pay-box, .sheet-body .totals, .sheet-body .cart { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: .9rem; }
.sheet-foot { padding: .8rem 1.1rem; background: #fff; border-top: 1px solid var(--line); }
.sheet-foot .actions { margin: 0; }
.cart-line {
    display: grid; grid-template-columns: minmax(0, 1fr) auto 5.5rem auto; grid-template-areas: "name step total del";
    align-items: center; gap: .4rem .6rem; padding: .6rem 0; border-bottom: 1px solid #edf0f6;
}
.cart-line .cl-name { grid-area: name; } .cart-line .stepper { grid-area: step; } .cart-line .cl-total { grid-area: total; } .cart-line .link { grid-area: del; }
.cart-line:last-child { border-bottom: 0; }
.cl-name { display: flex; flex-direction: column; min-width: 0; }
.cl-name b { color: var(--navy); font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cl-name small { color: var(--muted); font-variant-numeric: tabular-nums; }
.cl-total { text-align: end; font-variant-numeric: tabular-nums; }

@media (max-width: 860px) {
    .doc-page .sales-lines { min-width: 900px; }
    .doc-bottom { grid-template-columns: 1fr; }
    .doc-page .page-head { align-items: stretch; }
    .doc-page .segmented { width: 100%; }
    .action-bar { margin: 1rem -1rem -1rem; padding: .7rem 1rem; }
    .action-bar .buttons, .action-bar .actions { width: 100%; }
    .action-bar .actions .btn { flex: 1; }
    .tiles-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .65rem; }
    .pay-bar { bottom: .75rem; }
    .sheet-body .doc-fields { grid-template-columns: 1fr; }
    .cart-line { grid-template-columns: auto minmax(0, 1fr) auto; grid-template-areas: "name name del" "step total total"; }
    .cart-line .cl-name b { white-space: normal; }
    .grid-mode h1 { font-size: 1.3rem; }
}
.sheet-foot .actions > .btn-ghost { display: none; }
h1:focus { outline: none; }
a.tab { text-decoration: none; }
.doc-page .sales-lines td.muted { white-space: nowrap; }
.grid-head { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: .75rem 1rem; align-items: end; margin-bottom: .5rem; }
.grid-head .field { margin: 0; }
.hint-line { margin: .35rem 0 .75rem; color: #9a5205; background: var(--accent-soft); border-radius: 10px; padding: .45rem .8rem; font-size: .88rem; }
.pay-box .hint-line { margin: 0; }
@media (max-width: 860px) { .grid-head { grid-template-columns: 1fr; } }

/* ---- Registration: activity cards ---- */
.activity-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: .6rem; }
.activity {
    display: flex; flex-direction: column; align-items: flex-start; gap: .2rem; padding: .75rem .85rem;
    border: 1.5px solid var(--line-strong); border-radius: 12px; background: #fff; font: inherit; color: var(--ink-soft);
    text-align: start; cursor: pointer;
}
.activity .icon { color: var(--muted); margin-bottom: .2rem; }
.activity b { color: var(--navy); font-weight: 600; }
.activity small { color: var(--muted); font-size: .78rem; line-height: 1.4; }
.activity:hover { border-color: var(--primary); }
.activity.on { border-color: var(--primary); background: var(--primary-soft); box-shadow: 0 0 0 1px var(--primary); }
.activity.on .icon { color: var(--primary); }

/* ---- Company features ---- */
.feature-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: .85rem; }
.feature-card {
    display: flex; align-items: flex-start; gap: .85rem; padding: 1rem 1.1rem;
    background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow);
}
.feature-card.on { border-color: #c9d6f6; }
.feature-icon { display: grid; place-items: center; width: 2.6rem; height: 2.6rem; flex-shrink: 0; border-radius: 12px; background: var(--paper); color: var(--muted); }
.feature-card.on .feature-icon { background: var(--primary-soft); color: var(--primary); }
.feature-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: .2rem; }
.feature-text b { color: var(--navy); }
.feature-text span { color: var(--ink-soft); font-size: .9rem; line-height: 1.5; }
.feature-text small { font-size: .8rem; }
.switch {
    position: relative; flex-shrink: 0; width: 2.9rem; height: 1.65rem; margin-top: .2rem; padding: 0;
    border: 0; border-radius: 999px; background: var(--line-strong); cursor: pointer; transition: background .15s;
}
.switch i { position: absolute; top: .2rem; inset-inline-start: .2rem; width: 1.25rem; height: 1.25rem; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.2); transition: inset-inline-start .15s; }
.switch.on { background: var(--primary); }
.switch.on i { inset-inline-start: 1.45rem; }
.switch:disabled { opacity: .55; cursor: not-allowed; }
.sys-badge { display: inline-block; margin-inline-start: .5rem; padding: 0 .5rem; border-radius: 999px; font-size: .72rem; font-weight: 600; background: var(--primary-soft); color: var(--primary-dark); vertical-align: middle; }

/* ---- Roles ---- */
.roles-layout { display: grid; grid-template-columns: 280px minmax(0, 1fr); gap: 1rem; align-items: start; }
.roles-list { display: flex; flex-direction: column; gap: .25rem; padding: .5rem; position: sticky; top: 5rem; }
.role-item {
    display: grid; grid-template-columns: 1fr auto; gap: .1rem .5rem; align-items: center; width: 100%;
    padding: .6rem .75rem; border: 0; border-radius: 10px; background: none; font: inherit; text-align: start; cursor: pointer; color: var(--ink);
}
.role-item b { color: var(--navy); font-weight: 600; }
.role-item small { grid-column: 1; color: var(--muted); font-size: .8rem; }
.role-item .badge { grid-row: 1 / span 2; grid-column: 2; }
.role-item:hover { background: var(--paper); }
.role-item.on { background: var(--primary-soft); }
.role-editor-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-bottom: .5rem; }
.role-editor-head .field { flex: 1; max-width: 420px; margin: 0; }
.perm-group { border: 1px solid var(--line); border-radius: var(--radius-sm); padding: .4rem 1rem .8rem; margin: 0 0 .75rem; }
.perm-group legend { display: flex; align-items: center; gap: .75rem; padding: 0 .4rem; }
.perm-group legend b { color: var(--navy); }
.perm-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: .35rem 1.25rem; }
.perm-list .check { align-items: flex-start; line-height: 1.5; }
.perm-list .check input { margin-top: .3rem; }
.perm-list .check.off { color: var(--muted); }
@media (max-width: 860px) {
    .roles-layout { grid-template-columns: 1fr; }
    .roles-list { position: static; }
}

/* ---------- multi-units ---------- */
.units-field { border: 1px dashed var(--line); border-radius: var(--radius-sm); padding: .4rem 1rem .9rem; margin: .5rem 0 .9rem; }
.units-field legend { padding: 0 .4rem; font-weight: 600; color: var(--navy); }
.units-field legend .muted { font-weight: 400; font-size: .85rem; }
.units-table { margin-bottom: .5rem; }
.units-table input, .units-table select { width: 100%; min-width: 6rem; }
.units-table input[type=checkbox] { width: auto; min-width: 0; }
.unit-select { width: 100%; padding: .3rem .4rem; font-size: .9rem; }
.lines td .unit-select { margin-top: .25rem; }
@media (max-width: 640px) {
    .units-table thead { display: none; }
    .units-table tr { display: grid; grid-template-columns: 1fr 1fr; gap: .4rem; padding: .5rem 0; border-bottom: 1px solid var(--line); }
    .units-table td { padding: 0; border: 0; }
    .units-table td:last-child { grid-column: 1 / -1; text-align: end; }
    .units-table td[data-label]::before { content: attr(data-label); display: block; color: var(--muted); font-size: .75rem; margin-bottom: .15rem; }
    .units-table td.center[data-label] { display: flex; gap: .5rem; align-items: center; }
    .units-table td.center[data-label]::before { margin: 0; }
}

/* ---------- price lists ---------- */
.price-rows tr.sub td { border-top: 0; padding-top: .15rem; }
.price-rows input.num { width: 100%; }
.price-rows input.changed { border-color: var(--accent); background: var(--accent-soft); }
@media (max-width: 640px) {
    .price-rows thead { display: none; }
    .price-rows tr { display: grid; grid-template-columns: 1fr auto 7.5rem; gap: .5rem; align-items: center; padding: .45rem 0; border-top: 1px solid var(--line); }
    .price-rows tr.sub { border-top: 0; padding-top: 0; }
    .price-rows td { padding: 0; border: 0; }
    .price-rows td.item-cell { grid-column: 1 / -1; }
    .price-rows td.item-cell.blank { display: none; }
}

/* ---------- recipes ---------- */
.recipe-table .item-picker { width: 100%; min-width: 12rem; }
.recipe-cost { margin: .2rem 0 .6rem; }
.toolbar .kind-filter { width: auto; min-width: 9rem; }
@media (max-width: 640px) {
    .recipe-table tr { grid-template-columns: 1fr auto auto auto; align-items: center; }
    .recipe-table td:first-child { grid-column: 1 / -1; }
    .recipe-table td:last-child { grid-column: auto; }
}

/* ---------- language ---------- */
.lang-toggle {
    border: 1px solid var(--line); background: var(--card); color: var(--ink-soft); border-radius: 999px;
    padding: .2rem .7rem; font: inherit; font-size: .8rem; cursor: pointer; white-space: nowrap;
}
.lang-toggle:hover { border-color: var(--primary); color: var(--primary); }
.auth-card { position: relative; }
.auth-lang { position: absolute; top: 1rem; inset-inline-end: 1rem; }
html[lang="en"] { --font: "IBM Plex Sans", "IBM Plex Sans Arabic", system-ui, sans-serif; }
[dir="ltr"] .flip { transform: none; }
/* A label in both languages (printed invoice): Arabic, then the English smaller. */
.bi { display: inline-flex; flex-direction: column; line-height: 1.15; }
.bi > [lang="en"] { font-family: "IBM Plex Sans", sans-serif; font-size: .78em; color: var(--muted); font-weight: 400; }
.inv-lines th .bi { align-items: center; }

/* Restaurant settings */
.area-card.off { opacity: .6; }
.area-head { display: flex; flex-wrap: wrap; gap: .75rem; align-items: center; justify-content: space-between; margin-bottom: .75rem; }
.area-head h2 { margin: 0; }
.area-head small { font-weight: 400; font-size: .85rem; }
.area-head .actions { display: flex; gap: .75rem; align-items: center; margin: 0; }
.add-tables { display: inline-flex; gap: .4rem; align-items: center; }
.add-tables input { width: 4.5rem; }
.tables-grid { display: grid; align-items: start; grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: .6rem; }
.table-chip {
    display: flex; flex-direction: column; align-items: center; gap: .15rem; padding: .7rem .4rem;
    border: 1px solid var(--line-strong); border-radius: var(--radius-sm); background: var(--card); color: var(--ink);
    font: inherit; cursor: pointer;
}
.table-chip:hover { border-color: var(--primary); background: var(--primary-soft); }
.table-chip b { font-size: 1.15rem; }
.table-chip small { color: var(--muted); font-size: .75rem; }
.table-chip.off { opacity: .5; border-style: dashed; }
.table-chip.editing { grid-column: span 2; align-items: stretch; cursor: default; border-color: var(--primary); gap: .4rem; }
.table-chip.editing label:not(.check) { display: flex; gap: .4rem; align-items: center; font-size: .85rem; }
.table-chip.editing input.num { width: 4rem; }
.table-chip.editing .actions { display: flex; gap: .4rem; margin: 0; }
.tag-list { display: flex; flex-wrap: wrap; gap: .4rem; margin-bottom: .6rem; }
.tag { display: inline-flex; align-items: center; gap: .3rem; padding: .25rem .6rem; border-radius: 999px; background: var(--primary-soft); color: var(--primary-dark); font-size: .85rem; }
.options-table td input:not([type=checkbox]) { width: 100%; }

/* Restaurant: floor plan */
.badge-accent { background: var(--accent-soft); color: #9a5205; }
.badge-success { background: var(--success-soft); color: var(--success); }
.badge:not([class*="badge-"]) { background: #eceff5; color: var(--ink-soft); }
.count-badge {
    display: inline-grid; place-items: center; min-width: 1.4rem; height: 1.4rem; padding: 0 .35rem; margin-inline-start: .3rem;
    border-radius: 999px; background: var(--primary); color: #fff; font-size: .75rem; font-weight: 700;
}
.order-badges { display: inline-flex; gap: .3rem; flex-wrap: wrap; }
.floor-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: .85rem; align-items: start; }
.floor-grid.compact { grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); }
.floor-table {
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .3rem; min-height: 120px; padding: .8rem .5rem;
    border: 1.5px dashed var(--line-strong); border-radius: 16px; background: #fff; color: var(--ink); font: inherit; cursor: pointer;
}
.floor-table b { font-size: 1.5rem; color: var(--navy); }
.floor-table small { color: var(--muted); font-size: .8rem; }
.floor-table:hover:not(:disabled) { border-color: var(--primary); background: var(--primary-soft); }
.floor-table:disabled { cursor: default; opacity: .7; }
.floor-table.busy { border: 1.5px solid var(--primary); background: var(--primary-soft); }
.floor-table.busy.ready { border-color: var(--success); background: var(--success-soft); }
.floor-table .ft-total { font-weight: 700; font-variant-numeric: tabular-nums; }
.floor-orders { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: .85rem; }
.floor-order {
    display: flex; flex-direction: column; gap: .4rem; padding: .85rem 1rem; border: 1px solid var(--line); border-radius: var(--radius);
    background: #fff; color: var(--ink); text-decoration: none;
}
.floor-order:hover { border-color: var(--primary); }
.fo-head, .fo-foot { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; }
.fo-head small { margin-inline-start: auto; }
.fo-foot { justify-content: space-between; }
.fo-foot b { font-variant-numeric: tabular-nums; }
.sheet-sm { width: min(440px, 100%); }

/* Restaurant: the order screen */
.order-screen { display: grid; grid-template-columns: minmax(0, 1fr) 400px; gap: 1.25rem; align-items: start; }
.order-menu .page-head { gap: .75rem; justify-content: flex-start; }
.order-menu .page-head h1 small { font-size: 1rem; }
.order-panel {
    position: sticky; top: 1rem; display: flex; flex-direction: column; gap: .75rem; max-height: calc(100vh - 6rem);
    padding: 1rem; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow);
}
.op-head { display: flex; align-items: flex-start; justify-content: space-between; gap: .5rem; }
.op-head h2 { margin: 0; }
.panel-close, .panel-backdrop, .order-bar { display: none; }
.op-guests { display: flex; align-items: center; justify-content: space-between; gap: .5rem; }
.op-delivery { display: flex; flex-direction: column; gap: .25rem; padding: .6rem .75rem; border-radius: var(--radius-sm); background: var(--paper); }
.op-delivery .link { align-self: flex-start; }
.op-lines { flex: 1; overflow-y: auto; min-height: 6rem; }
.op-line {
    display: grid; grid-template-columns: minmax(0, 1fr) auto 5rem; grid-template-areas: "main qty amount" "meta meta meta";
    gap: .25rem .6rem; align-items: center; padding: .6rem 0; border-bottom: 1px solid #edf0f6;
}
.op-line .ol-main { grid-area: main; display: flex; flex-direction: column; gap: .1rem; }
.op-line .ol-main small { color: var(--muted); font-size: .8rem; }
.op-line .ol-note { color: #9a5205 !important; }
.op-line .ol-void { color: var(--danger) !important; }
.op-line .stepper, .op-line .ol-qty { grid-area: qty; }
.op-line .ol-amount { grid-area: amount; text-align: end; font-weight: 600; font-variant-numeric: tabular-nums; }
.op-line .ol-meta { grid-area: meta; display: flex; align-items: center; gap: .75rem; font-size: .82rem; }
.op-line.voided .ol-main b, .op-line.voided .ol-amount { text-decoration: line-through; color: var(--muted); }
.kstate { padding: .05rem .5rem; border-radius: 999px; font-size: .75rem; font-weight: 600; }
.kstate.st-new { background: var(--accent-soft); color: #9a5205; }
.kstate.st-sent { background: var(--primary-soft); color: var(--primary-dark); }
.kstate.st-ready { background: var(--success-soft); color: var(--success); }
.op-foot { display: flex; flex-direction: column; gap: .5rem; border-top: 1px solid var(--line); padding-top: .75rem; }
.op-foot .totals-row { display: flex; justify-content: space-between; font-size: 1.2rem; color: var(--navy); }
.op-foot .btn-block { margin: 0; min-height: 3rem; font-size: 1.05rem; }
.op-tools { display: flex; flex-wrap: wrap; gap: .4rem; }
.mod-group { border: 0; padding: 0; margin: 0; }
.mod-group legend { font-weight: 700; color: var(--navy); margin-bottom: .5rem; padding: 0; }
.mod-options { display: flex; flex-wrap: wrap; gap: .5rem; }
.mod-option {
    display: inline-flex; align-items: baseline; gap: .4rem; padding: .55rem 1rem; border: 1.5px solid var(--line-strong); border-radius: 12px;
    background: #fff; font: inherit; font-weight: 600; color: var(--ink); cursor: pointer;
}
.mod-option small { color: var(--muted); }
.mod-option.on { border-color: var(--primary); background: var(--primary-soft); color: var(--primary-dark); }
.split-row { display: grid; grid-template-columns: minmax(0, 1fr) auto 3.2rem; gap: .5rem; align-items: center; padding: .55rem .7rem; background: #fff; border: 1px solid var(--line); border-radius: var(--radius-sm); }
.split-row.on { border-color: var(--primary); background: var(--primary-soft); }
.split-row .sr-name { display: grid; }
.split-row .stepper input { width: 3.6rem; text-align: center; }
.table-bills { display: flex; gap: .4rem; overflow-x: auto; padding-bottom: .2rem; }
.table-bill { display: flex; flex-direction: column; align-items: center; min-width: 5.5rem; padding: .35rem .7rem; border: 1px solid var(--line-strong); border-radius: 10px; text-decoration: none; color: var(--ink-soft); font-size: .85rem; background: #fff; }
.table-bill bdi { font-weight: 700; color: var(--navy); }
.table-bill.on { border-color: var(--navy); background: var(--navy); color: #fff; }
.table-bill.on bdi { color: #fff; }
@media (max-width: 1100px) {
    .order-screen { display: block; }
    .order-panel {
        position: fixed; z-index: 61; inset-block: 0; inset-inline-end: 0; width: min(440px, 100%); max-height: none; top: 0;
        border-radius: 0; transform: translateX(-110%); transition: transform .2s; visibility: hidden;
    }
    [dir="ltr"] .order-panel { transform: translateX(110%); }
    .panel-open .order-panel { transform: none; visibility: visible; }
    .panel-open .panel-backdrop { display: block; }
    .panel-close { display: inline-flex; }
    .order-bar {
        position: sticky; bottom: 1rem; z-index: 25; display: flex; align-items: center; gap: .85rem;
        max-width: 640px; margin: -4.5rem auto 0; padding: .6rem .6rem .6rem 1rem;
        background: var(--navy); color: #fff; border-radius: 18px; box-shadow: 0 12px 30px rgba(27, 42, 74, .3);
    }
    .order-bar .count { display: grid; place-items: center; min-width: 2.6rem; height: 2.6rem; border-radius: 12px; background: rgba(255, 255, 255, .12); font-weight: 700; }
    .order-bar .sum { flex: 1; display: flex; flex-direction: column; line-height: 1.3; }
    .order-bar .sum b { font-size: 1.3rem; font-variant-numeric: tabular-nums; }
    .order-bar .sum small { color: #a6b2cc; }
    .order-bar .btn-accent { min-height: 3rem; padding: .5rem 1.5rem; font-size: 1.05rem; border-radius: 12px; }
}

/* Restaurant: the kitchen screen */
.kds-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 1rem; align-items: start; }
.kds-ticket { display: flex; flex-direction: column; background: #fff; border: 2px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.kds-ticket header { display: flex; justify-content: space-between; gap: .5rem; padding: .7rem .85rem; background: var(--navy); color: #fff; }
.kds-ticket header div { display: flex; flex-direction: column; }
.kds-ticket header small { color: #c3cbe0; font-size: .78rem; }
.kds-time { text-align: end; align-items: flex-end; }
.kds-ticket.doing { border-color: var(--primary); }
.kds-ticket.late header { background: #b7650f; }
.kds-ticket.very-late header { background: var(--danger); }
.kds-ticket.void { border-color: var(--danger); }
.kds-ticket.void header { background: #6b1d14; }
.kds-void { padding: .4rem .85rem; background: var(--danger-soft); color: var(--danger); font-weight: 700; }
.kds-ticket ul { list-style: none; margin: 0; padding: .4rem .85rem; }
.kds-ticket li { display: flex; gap: .65rem; padding: .45rem 0; border-bottom: 1px dashed var(--line); }
.kds-ticket li:last-child { border-bottom: 0; }
.kds-ticket li > div { display: flex; flex-direction: column; }
.kds-ticket li small { color: var(--ink-soft); }
.kds-ticket .kq { min-width: 2rem; font-size: 1.2rem; font-weight: 700; color: var(--navy); }
.kds-ticket li b { font-size: 1.05rem; }
.kds-ticket footer { display: flex; gap: .5rem; padding: .6rem .85rem .85rem; }
.kds-ticket footer .btn-block { margin: 0; }
.kds-empty { display: flex; flex-direction: column; align-items: center; gap: .5rem; padding: 4rem 1rem; }

/* Restaurant: printed kitchen ticket (80 mm) */
.kitchen-slip { width: 74mm; margin: 0 auto 1rem; padding: 3mm; border: 1px dashed var(--line-strong); background: #fff; color: #000; font-size: 13px; }
.ks-station { text-align: center; font-weight: 700; font-size: 15px; border-bottom: 1px solid #000; padding-bottom: 2mm; }
.ks-void { text-align: center; font-weight: 700; font-size: 18px; margin-top: 2mm; border: 2px solid #000; }
.ks-head { display: flex; justify-content: space-between; font-size: 18px; margin-top: 2mm; }
.ks-meta { font-size: 11px; }
.kitchen-slip ul { list-style: none; padding: 0; margin: 2mm 0 0; border-top: 1px dashed #000; }
.kitchen-slip li { padding: 1.5mm 0; border-bottom: 1px dashed #000; }
.kitchen-slip li b { font-size: 15px; }
.ks-note { font-weight: 700; }
@media print {
    .kitchen-slip { width: auto; border: 0; margin: 0; padding: 0; break-after: page; }
    .kitchen-slip:last-of-type { break-after: auto; }
}

/* Restaurant: the bill */
.op-main-actions { display: grid; grid-template-columns: 1fr 1fr; gap: .5rem; }
.op-main-actions .btn-block { margin: 0; min-height: 3rem; }
.op-paid { display: flex; flex-direction: column; gap: .4rem; }
.op-delivery-status { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; }
.bill-box { display: flex; flex-direction: column; gap: .35rem; padding: .85rem; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); }
.bill-row { display: flex; justify-content: space-between; gap: .75rem; font-variant-numeric: tabular-nums; }
.bill-row.sum { border-top: 1px dashed var(--line-strong); padding-top: .4rem; margin-top: .2rem; font-weight: 600; }
.bill-row.grand { border-top: 1px solid var(--line); padding-top: .5rem; margin-top: .2rem; font-size: 1.2rem; color: var(--navy); }
.bill-row.change { padding: .6rem .8rem; border-radius: var(--radius-sm); background: var(--success-soft); color: var(--success); font-size: 1.1rem; }
.bill-row.change.short { background: var(--danger-soft); color: var(--danger); }
.bill-slip .bill-row { padding: 1mm 0; }
.bill-slip li.bill-row { border-bottom: 1px dashed #000; }
.bill-slip .bill-row.grand { border-top: 2px solid #000; color: #000; font-size: 16px; }
.bill-slip .center { text-align: center; margin-top: 2mm; }

/* Cashier shifts */
.shift-report { display: flex; flex-direction: column; gap: .85rem; }
.shift-head h2 { margin: 0 0 .25rem; display: flex; align-items: center; gap: .5rem; }
.shift-table { max-width: 560px; }
.shift-report .bill-box { max-width: 560px; }
.close-shift { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: .75rem; align-items: end; margin-top: 1rem; padding-top: 1rem; border-top: 1px solid var(--line); }
.close-shift .actions { margin: 0; }
.close-shift .bill-row.change { margin: 0; }
@media print { .shift-print { border: 0; box-shadow: none; } }

/* 80 mm sales receipt */
.receipt-slip { font-size: 12px; }
.rc-company { text-align: center; font-weight: 700; font-size: 16px; }
.rc-center { text-align: center; }
.rc-title { text-align: center; font-weight: 700; margin: 2mm 0; padding: 1mm 0; border-block: 1px solid #000; }
.rc-meta div, .rc-row { display: flex; justify-content: space-between; gap: 2mm; }
.rc-meta span { color: #444; }
.rc-lines { list-style: none; padding: 0; margin: 2mm 0; border-top: 1px dashed #000; }
.rc-lines li { padding: 1.2mm 0; border-bottom: 1px dashed #000; }
.rc-name { font-weight: 700; }
.rc-desc { font-size: 11px; color: #333; }
.rc-totals .bill-row { padding: .6mm 0; }
.rc-totals .bill-row.grand { border-top: 2px solid #000; color: #000; font-size: 15px; margin-top: 1mm; padding-top: 1.5mm; }
.rc-qr { display: flex; justify-content: center; margin-top: 2mm; }
.rc-thanks { margin-top: 2mm; font-weight: 600; }

/* Delivery desk */
.big-input { font-size: 1.15rem; min-height: 3rem; }
.contact-card { display: flex; flex-direction: column; gap: .4rem; padding: .75rem .85rem; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); }
.cc-head { display: flex; justify-content: space-between; gap: .5rem; flex-wrap: wrap; }
.cc-head small { color: var(--muted); }
.cc-address {
    display: flex; flex-direction: column; align-items: flex-start; gap: .1rem; padding: .55rem .75rem; text-align: start;
    border: 1px solid var(--line-strong); border-radius: var(--radius-sm); background: var(--paper); font: inherit; color: var(--ink); cursor: pointer;
}
.cc-address:hover:not(:disabled) { border-color: var(--primary); background: var(--primary-soft); }
.cc-address small { color: var(--muted); }
.cc-actions { display: flex; align-items: center; gap: .75rem; }
.cc-phones { display: inline-flex; flex-wrap: wrap; gap: .6rem; }

/* ---- Installments ---- */
.plan-card { margin-top: 1rem; }
.plan-head { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.plan-head h2 { margin: 0; }
.plan-each { font-weight: 700; color: var(--primary-dark); font-variant-numeric: tabular-nums; }
.plan-terms { display: grid; grid-template-columns: repeat(auto-fit, minmax(10.5rem, 1fr)); gap: .75rem 1rem; margin: .9rem 0; align-items: end; }
.plan-body { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(16rem, 1fr); gap: 1.25rem; align-items: start; }
.plan-schedule, .plan-side { min-width: 0; }
.plan-schedule-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.plan-schedule-head .section-title { margin: .25rem 0 .5rem; }
.plan-table input.num { width: 7.5rem; }
.plan-table .date-input { min-width: 9rem; }
.plan-side .totals { border: 1px solid var(--line); border-radius: var(--radius-sm); padding: .75rem 1rem; }
.guarantor-row { display: grid; grid-template-columns: 1.4fr 1fr 1fr .8fr 2fr auto; gap: .5rem .75rem; align-items: end; padding: .6rem 0; border-bottom: 1px dashed var(--line); }
.guarantor-row .span-2 { grid-column: auto; }
.guarantor-row > .link { padding-bottom: .55rem; }
.plan-notes { margin-top: .9rem; }
.contract-strip { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem 1.25rem; margin-top: 1rem; }
.contract-strip b { margin-inline-end: .5rem; }
.contract-sub { display: flex; flex-wrap: wrap; gap: .35rem 1.1rem; color: var(--ink-soft); margin: -.25rem 0 0; }
.progress { height: 8px; background: var(--line); border-radius: 99px; overflow: hidden; margin: -.25rem 0 1.1rem; }
.progress i { display: block; height: 100%; background: var(--success); border-radius: inherit; }
.contract-grid { display: grid; grid-template-columns: minmax(0, 1.7fr) minmax(17rem, 1fr); gap: 1rem; align-items: start; }
.contract-side { display: grid; gap: 1rem; }
.contract-side h2 { font-size: 1rem; }
.guarantor-card { display: flex; flex-direction: column; gap: .15rem; padding: .55rem 0; border-bottom: 1px solid var(--line); }
.guarantor-card:last-child { border-bottom: 0; }
.row-paid td { color: var(--muted); }
@media (max-width: 860px) {
    .plan-body, .contract-grid { grid-template-columns: minmax(0, 1fr); }
    .guarantor-row { grid-template-columns: 1fr 1fr; }
    .guarantor-row > .field:last-of-type { grid-column: 1 / -1; }
}
.kpi-btn { font: inherit; text-align: start; cursor: pointer; color: inherit; }
.kpi-btn:hover { border-color: var(--primary); }
.collect-who { font-size: 1.05rem; }
.collect-lines { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: .75rem .9rem; display: grid; gap: .5rem; }
.collect-lines small { margin-inline-start: .35rem; }
.round-total { display: flex; justify-content: space-between; align-items: center; background: var(--navy); color: #fff; border-radius: var(--radius); padding: .9rem 1.1rem; margin-bottom: 1rem; }
.round-total b { font-size: 1.4rem; font-variant-numeric: tabular-nums; }
.round-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(19rem, 1fr)); gap: .8rem; }
.round-stop { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: .85rem 1rem; display: grid; gap: .45rem; box-shadow: var(--shadow); }
.rs-head { display: flex; justify-content: space-between; align-items: center; gap: .5rem; }
.rs-meta { display: flex; flex-wrap: wrap; gap: .25rem .9rem; color: var(--ink-soft); font-size: .9rem; }
.rs-foot { display: flex; justify-content: space-between; align-items: flex-end; gap: .5rem; flex-wrap: wrap; }
.rs-foot > div:first-child { display: grid; }
.rs-amount { font-size: 1.3rem; color: var(--navy); font-variant-numeric: tabular-nums; }
.rs-actions { display: flex; gap: .4rem; }
@media (max-width: 640px) { .round-list { grid-template-columns: minmax(0, 1fr); } }
.rate-bar { position: relative; height: 1.4rem; background: var(--line); border-radius: 6px; overflow: hidden; }
.rate-bar i { position: absolute; inset-block: 0; inset-inline-start: 0; background: var(--success-soft); border-inline-end: 2px solid var(--success); }
.rate-bar span { position: relative; padding-inline: .5rem; font-size: .82rem; font-weight: 600; line-height: 1.4rem; font-variant-numeric: tabular-nums; }
.contract-counts { font-size: 1.05rem !important; }
.statement-contract { margin-bottom: 1rem; }
.promissory { max-width: 190mm; margin: 0 auto 1rem; padding: 7mm 9mm; border: 1.5px solid #b89b5e; border-radius: 6px; background: #fffdf6; color: #222; break-inside: avoid; }
.promissory h2 { text-align: center; margin: 0 0 3mm; font-size: 1.5rem; color: #5a4520; }
.promissory p { margin: 3mm 0; line-height: 1.9; }
.pn-row { display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap; }
.pn-amount { border: 1px solid #b89b5e; padding: 1mm 4mm; font-variant-numeric: tabular-nums; }
.pn-parties { display: grid; grid-template-columns: repeat(auto-fit, minmax(60mm, 1fr)); gap: 4mm 8mm; font-size: .9rem; }
.pn-sign { margin-top: 9mm; border-top: 1px dashed #b89b5e; padding-top: 1mm; color: #5a4520; }
@media print {
    .promissory { margin: 0 0 5mm; }
    .promissory:nth-of-type(3n) { break-after: page; }
    .statement-contract { break-inside: avoid; }
}
/* The payment sheet: its parts keep their height and the body scrolls; on installments it widens for the plan. */
.sheet-body > * { flex-shrink: 0; }
.sheet.sheet-wide { width: min(980px, 100%); }
.sheet-body .plan-card { margin-top: 0; }
/* Customer / supplier box with its list */
.party-combo { position: relative; width: 100%; }
.party-combo input { padding-inline-end: 2.4rem; }
.party-combo .pc-arrow {
    position: absolute; inset-inline-end: .3rem; top: 50%; transform: translateY(-50%); width: 2rem; height: 2rem;
    display: grid; place-items: center; border: 0; border-radius: 8px; background: none; color: var(--muted); cursor: pointer;
}
.party-combo .pc-arrow:hover { background: var(--paper); color: var(--ink); }
.party-combo.open .pc-arrow svg { transform: rotate(180deg); }
.party-combo .suggest { max-height: 18rem; }
.party-combo .suggest li.current b { color: var(--primary-dark); }
.party-combo .suggest li.current::after { content: "✓"; margin-inline-start: auto; color: var(--primary); font-weight: 700; }

/* ---- Printing: 58 mm receipts, barcode labels ---- */
html[data-receipt="58"] .kitchen-slip { width: 54mm; font-size: 11px; padding: 2mm; }
html[data-receipt="58"] .kitchen-slip li b { font-size: 13px; }
.label-print { display: none; }
@media print {
    .label-print .label-row { display: block; break-after: page; }
    .label-print .label-row:last-child { break-after: auto; }
    .label-print .label-sheet { position: relative; width: 210mm; height: 296mm; overflow: hidden; break-after: page; }
    .label-print .label-sheet:last-child { break-after: auto; }
}
.print-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; }
.print-grid .span-all { grid-column: 1 / -1; }
.print-grid h2 { display: flex; align-items: center; gap: .5rem; font-size: 1.05rem; }
.bt-box { margin: .75rem 0; }
.agent-head { display: flex; align-items: center; justify-content: space-between; gap: .75rem; flex-wrap: wrap; }
.agent-head h2 { margin: 0; }
.agent-steps { margin: .5rem 0 1rem; padding-inline-start: 1.25rem; line-height: 1.9; }
.agent-grid .field .btn { align-self: flex-start; margin-top: .35rem; }
.agent-card .buttons { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; }
.bt-status { display: flex; align-items: center; gap: .75rem; flex-wrap: wrap; padding: .75rem; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--paper); }
.labels-layout { display: grid; grid-template-columns: minmax(0, 1fr) 21rem; gap: 1rem; align-items: start; }
.labels-main, .labels-side { display: grid; gap: 1rem; min-width: 0; }
.labels-side .card { display: grid; gap: .75rem; }
.from-purchase { display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; padding: .2rem .4rem .5rem; }
.from-purchase select { flex: 1; min-width: 12rem; }
.labels-table select { min-width: 6rem; }
.labels-table input.num { width: 7rem; }
.label-size { margin: -.25rem 0 0; font-size: .88rem; }
.label-previews { display: flex; flex-wrap: wrap; gap: .6rem; justify-content: center; padding: .6rem; background: var(--paper); border-radius: var(--radius-sm); min-height: 4rem; }
.label-previews img { max-width: 100%; height: auto; border: 1px solid var(--line-strong); border-radius: 4px; background: #fff; image-rendering: pixelated; }
.print-box .btn-block { margin: 0; }
.rowx { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; }
.label-editor { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 1.25rem; align-items: start; }
.le-form { display: grid; gap: .75rem; min-width: 0; }
.le-fields { display: grid; gap: .55rem; }
.le-row { display: flex; align-items: center; justify-content: space-between; gap: .75rem; flex-wrap: wrap; }
.le-row select { width: auto; min-width: 10rem; }
.inline-num { display: flex; align-items: center; gap: .4rem; font-size: .85rem; color: var(--muted); }
.inline-num input { width: 5rem; }
.le-preview { position: sticky; top: 0; display: grid; justify-items: center; gap: .5rem; padding: 1rem; background: var(--paper); border-radius: var(--radius); }
.le-preview img { max-width: 100%; height: auto; border: 1px solid var(--line-strong); border-radius: 4px; background: #fff; box-shadow: var(--shadow); image-rendering: pixelated; }
@media (max-width: 860px) {
    .print-grid, .labels-layout, .label-editor { grid-template-columns: minmax(0, 1fr); }
    .print-grid .segmented.wide { flex-wrap: wrap; }
    .print-grid .segmented.wide button { flex: 1 1 30%; min-width: 0; padding-inline: .5rem; white-space: normal; }
    .print-grid .field select { min-width: 0; max-width: 100%; }
    .le-preview { position: static; order: -1; }
}
@media (max-width: 640px) {
    .labels-table th:nth-child(2), .labels-table td:nth-child(2), .labels-table th:nth-child(3), .labels-table td:nth-child(3) { display: none; }
    .labels-table td > input.num { width: 5.2rem; }
    .labels-table .stepper input.num { width: 2.4rem; }
    .labels-table .stepper button { width: 1.7rem; }
    .labels-table .line-item .code { display: none; }
}

/* ---- Company logo on prints (Settings › Company) ---- */
.co-logo { display: block; width: auto; object-fit: contain; }
.co-logo-invoice { margin-bottom: .4rem; max-width: 70mm; }
.co-logo-invoice.co-size-small { height: 14mm; }
.co-logo-invoice.co-size-medium { height: 20mm; }
.co-logo-invoice.co-size-large { height: 28mm; }
.co-logo-receipt { margin: 0 auto 1.5mm; max-width: 90%; filter: grayscale(1) contrast(1.15); }
.co-logo-receipt.co-size-small { height: 10mm; }
.co-logo-receipt.co-size-medium { height: 15mm; }
.co-logo-receipt.co-size-large { height: 22mm; }
.co-logo-report { margin: 0 auto .35rem; max-width: 60mm; }
.co-logo-report.co-size-small { height: 11mm; }
.co-logo-report.co-size-medium { height: 15mm; }
.co-logo-report.co-size-large { height: 21mm; }
.logo-field { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; }
.logo-box { width: 12rem; height: 6rem; display: grid; place-items: center; border: 1px dashed var(--line-strong); border-radius: 12px; background: #fff; padding: .5rem; }
.logo-box img { max-width: 100%; max-height: 100%; object-fit: contain; }
.logo-box .muted { font-size: .85rem; text-align: center; }
.logo-switches { display: flex; flex-wrap: wrap; gap: .5rem 1.25rem; margin-top: .75rem; }

/* ---- Stock alerts (home) and shortages ---- */
.stock-alerts { display: grid; grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr)); gap: .75rem; margin: 1rem 0; }
.stock-alert { display: flex; align-items: center; gap: .75rem; padding: .8rem 1rem; border-radius: var(--radius-sm); background: var(--accent-soft); color: #7a4204; text-decoration: none; border: 1px solid #f6cf9f; }
.stock-alert span { display: flex; flex-direction: column; }
.stock-alert small { color: inherit; opacity: .8; }
.stock-alert.danger { background: var(--danger-soft); color: var(--danger); border-color: #f3b8b0; }
.badge-danger { background: var(--danger-soft); color: var(--danger); }
.shortage-table tr.row-out td:first-child { box-shadow: inset -3px 0 0 var(--danger); }
.reorder-field .grid-4 { margin-bottom: .5rem; }

/* ---- Batches on document lines ---- */
.batch-fields { display: flex; gap: .4rem; margin-top: .3rem; flex-wrap: wrap; }
.batch-fields input { flex: 1 1 7rem; min-width: 0; }
.batch-fields .date-input, .batch-fields > :last-child { flex: 1 1 8.5rem; }
.batch-select { margin-top: .3rem; width: 100%; font-size: .85rem; }
.batch-list { display: flex; flex-wrap: wrap; gap: .25rem; margin-top: .25rem; }
.batch-chip { background: var(--accent-soft); color: #7a4204; border-radius: 6px; padding: .05rem .4rem; font-size: .78rem; }
.batch-check { display: flex; flex-wrap: wrap; gap: .35rem; align-items: center; margin: .25rem 0 .5rem; }
.expiry-table tr.row-expired td { background: var(--danger-soft); }
.expiry-table tr.row-expired td:first-child { box-shadow: inset -3px 0 0 var(--danger); }
.batch-no { font-family: ui-monospace, monospace; font-size: .9rem; }
.export-buttons { display: inline-flex; gap: .4rem; flex-wrap: wrap; }
.expiry-table td:first-child, .shortage-table td:nth-child(2) { min-width: 10rem; }
.expiry-table td:nth-child(4) { white-space: nowrap; }
@media (max-width: 860px) {
    .toolbar .segmented { flex-wrap: wrap; max-width: 100%; }
    .toolbar .segmented button { flex: 1 1 auto; white-space: normal; }
}

/* ---- Import from Excel ---- */
.import-kinds { display: grid; grid-template-columns: repeat(auto-fit, minmax(10rem, 1fr)); gap: .6rem; margin-bottom: 1rem; }
.import-kind { display: flex; align-items: center; gap: .55rem; padding: .8rem 1rem; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--card); cursor: pointer; font: inherit; color: var(--ink); text-align: start; }
.import-kind.on { border-color: var(--primary, #2f5bd3); box-shadow: 0 0 0 2px rgba(47, 91, 211, .15); color: var(--navy); }
.step-no { display: inline-grid; place-items: center; width: 1.5rem; height: 1.5rem; border-radius: 50%; background: #e9edf5; color: var(--navy); font-size: .8rem; font-weight: 700; flex: none; }
.import-kind.on .step-no { background: var(--primary, #2f5bd3); color: #fff; }
.import-steps { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1rem; margin: 1rem 0; }
.import-step { border: 1px dashed var(--line-strong); border-radius: var(--radius-sm); padding: .9rem 1rem; display: flex; flex-direction: column; gap: .55rem; align-items: flex-start; }
.import-step h3 { display: flex; align-items: center; gap: .5rem; margin: 0; font-size: 1rem; }
.import-step .muted { margin: 0; font-size: .88rem; }
.import-step .field, .import-step .grid-2 { width: 100%; }
.file-btn { position: relative; cursor: pointer; }
.file-name { word-break: break-all; }
.import-summary { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; margin: .5rem 0 .75rem; }
.import-table-wrap { max-height: 28rem; overflow: auto; border: 1px solid var(--line); border-radius: var(--radius-sm); }
.import-table tr.row-error td { background: var(--danger-soft); }
.import-table td:last-child { min-width: 14rem; }
@media (max-width: 860px) {
    .import-steps { grid-template-columns: minmax(0, 1fr); }
}

/* ---- Cheques ---- */
.cheque-tabs { margin-bottom: .25rem; }
.kpi.warn .value { color: var(--accent, #c76a00); }
.cheque-detail-head { display: flex; justify-content: space-between; align-items: center; gap: 1rem; }
.cheque-detail-head h2 { display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; }
.cheque-facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(12rem, 1fr)); gap: .75rem 1.25rem; margin: .5rem 0 1rem; }
.cheque-facts dt { color: var(--ink-soft); font-size: .82rem; }
.cheque-facts dd { margin: .1rem 0 0; font-weight: 600; }
.cheque-events { list-style: none; padding: 0; margin: 0 0 1rem; border-inline-start: 2px solid var(--line); }
.cheque-events li { padding: .3rem .9rem; display: flex; gap: .5rem; flex-wrap: wrap; align-items: baseline; }
.cheque-actions { display: grid; gap: .75rem; max-width: 34rem; border-top: 1px solid var(--line); padding-top: 1rem; }
.cheque-actions .btn { justify-self: start; }
.cheque-kpis { grid-template-columns: repeat(auto-fit, minmax(10rem, 1fr)); }
@media (max-width: 640px) {
    .cheque-kpis { grid-template-columns: 1fr 1fr; gap: .6rem; }
    .cheque-kpis .kpi { padding: .75rem .85rem; }
    .cheque-kpis .kpi .value { font-size: 1.2rem; }
}
@media (max-width: 640px) {
    .cheque-tabs { flex-wrap: wrap; }
    .cheque-tabs button { flex: 1 1 8rem; white-space: normal; }
}

/* ---- Landed costs ---- */
.lc-invoices { display: grid; gap: .4rem; margin-bottom: .75rem; }
.lc-invoice { display: flex; flex-wrap: wrap; align-items: baseline; gap: .4rem 1rem; padding: .55rem .8rem; border: 1px solid var(--line); border-radius: 10px; background: var(--paper); }
.lc-invoice .num { margin-inline-start: auto; }
.lc-found { display: grid; gap: .3rem; margin-bottom: 1rem; }
.lc-pick { display: flex; flex-wrap: wrap; gap: .3rem .9rem; align-items: baseline; text-align: start; padding: .5rem .8rem; border: 1px dashed var(--line-strong); border-radius: 10px; background: var(--card); font: inherit; cursor: pointer; }
.lc-pick:hover { border-color: var(--primary); background: var(--primary-soft); }
.lc-pick .num { margin-inline-start: auto; }
.lc-charges { min-width: 42rem; }

/* Bank reconciliation */
.rec-import-head { display: flex; justify-content: space-between; align-items: center; }
.rec-columns { display: grid; grid-template-columns: repeat(auto-fill, minmax(9.5rem, 1fr)); gap: .5rem .75rem; margin-bottom: .75rem; }
.rec-warn { color: var(--danger); margin-inline-start: .5rem; }
.rec-summary { display: grid; grid-template-columns: repeat(7, 1fr); gap: .25rem; padding: .75rem; margin-bottom: 1rem; }
.rec-summary > div { display: flex; flex-direction: column; gap: .2rem; padding: .35rem .5rem; border-inline-start: 1px solid var(--line); }
.rec-summary > div:first-child { border-inline-start: 0; }
.rec-summary span { font-size: .8rem; color: var(--muted); }
.rec-summary b { font-variant-numeric: tabular-nums; }
.rec-summary .ok b { color: var(--success); }
.rec-summary .bad { background: var(--danger-soft); border-radius: 8px; }
.rec-summary .bad b { color: var(--danger); }
.rec-toolbar { align-items: center; }
.rec-spacer { flex: 1; }
.rec-panels { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; align-items: start; }
.rec-panel h2 { font-size: 1rem; margin: 0 0 .5rem; }
.rec-scroll { overflow-x: auto; max-height: 70vh; overflow-y: auto; }
.rec-grid { min-width: 30rem; }
.rec-grid td.neg { color: var(--danger); }
.rec-grid tr.matched td { color: var(--muted); }
.rec-grid tr.later td { opacity: .7; }
.rec-grid .rec-state { white-space: nowrap; }
.rec-grid .rec-state .link { margin-inline-start: .35rem; }
.rec-record td { background: var(--primary-soft); }
@media (max-width: 1100px) {
    .rec-summary { grid-template-columns: repeat(4, 1fr); }
    .rec-summary > div:nth-child(5) { border-inline-start: 0; }
    .rec-panels { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
    .rec-summary { grid-template-columns: 1fr 1fr; }
    .rec-summary > div { border-inline-start: 0; }
}
.rec-file { display: block; font-size: .85rem; }
@media (max-width: 640px) { .rec-grid { min-width: 26rem; } }

/* Fixed assets */
.grid-3 { display: grid; gap: .75rem 1rem; grid-template-columns: repeat(3, minmax(0, 1fr)); }
.fa-schedule-head { display: flex; justify-content: space-between; align-items: center; gap: 1rem; }
.fa-schedule-head h2 { margin: 0 0 .5rem; }
.fa-run-bar { align-items: end; margin-bottom: .5rem; }
@media (max-width: 760px) { .grid-3 { grid-template-columns: 1fr; } }

/* Point of sale: the whole screen, the cart beside the item grid */
.fullscreen-shell { min-height: 100vh; background: var(--paper); }
.pos { display: flex; flex-direction: column; height: 100vh; }
.pos-head { display: flex; align-items: center; gap: .75rem; padding: .6rem 1rem; background: var(--navy); color: #fff; flex-wrap: wrap; }
.pos-head .icon-btn { color: #fff; }
.pos-head .btn { background: rgba(255, 255, 255, .1); color: #fff; border-color: rgba(255, 255, 255, .25); }
.pos-title { display: flex; flex-direction: column; line-height: 1.2; }
.pos-title small { color: #a6b2cc; }
.pos-chip { padding: .25rem .7rem; border-radius: 999px; font-size: .85rem; font-weight: 600; border: 0; text-decoration: none; cursor: pointer; }
.pos-chip.ok { background: var(--success-soft); color: var(--success); }
.pos-chip.warn { background: var(--accent-soft); color: #9a5205; }
.pos-chip.off { background: var(--danger-soft); color: var(--danger); cursor: default; }
.pos-chip.bad { background: var(--danger); color: #fff; }
.danger-text { color: var(--danger); font-size: .85rem; }
.pos-spacer { flex: 1; }
.pos > .alert { margin: .5rem 1rem 0; }
.pos-banner { display: flex; align-items: center; gap: .75rem; flex-wrap: wrap; padding: .6rem 1rem; background: var(--accent-soft); }
.pos-banner select, .pos-banner input { max-width: 12rem; }
.pos-held { margin: .5rem 1rem 0; padding: .5rem 1rem; }
.pos-held-row { display: flex; align-items: center; gap: 1rem; padding: .35rem 0; border-bottom: 1px solid var(--line); }
.pos-held-row:last-child { border-bottom: 0; }
.pos-held-row > span:first-child { flex: 1; }
.pos-body { flex: 1; min-height: 0; display: grid; grid-template-columns: minmax(340px, 420px) 1fr; }
.pos-cart { display: flex; flex-direction: column; min-height: 0; background: var(--card); border-inline-end: 1px solid var(--line); }
.pos-customer { display: flex; justify-content: space-between; align-items: center; padding: .7rem 1rem; border-bottom: 1px solid var(--line); }
.pos-cart > .party-combo, .pos-cart > div:has(> input) { padding: .5rem 1rem; }
.pos-lines { flex: 1; overflow-y: auto; padding: .25rem 0; }
.pos-empty { color: var(--muted); text-align: center; padding: 3rem 1rem; }
.pos-line { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: .25rem .5rem; padding: .45rem 1rem; border-bottom: 1px solid var(--line); }
.pos-line.editing { background: var(--primary-soft); }
.pos-line-main { all: unset; cursor: pointer; display: grid; grid-template-columns: 1fr auto; gap: 0 .5rem; }
.pl-name { font-weight: 600; grid-column: 1 / -1; }
.pl-calc { color: var(--muted); font-size: .9rem; text-align: start; }
.pl-total { font-variant-numeric: tabular-nums; }
.pos-line .stepper { display: flex; gap: .25rem; }
.pos-line .stepper button { width: 2rem; height: 2rem; border-radius: 8px; border: 1px solid var(--line-strong); background: var(--card); display: grid; place-items: center; cursor: pointer; }
.pos-line-edit { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .5rem; align-items: end; }
.pos-totals { padding: .6rem 1rem; border-top: 1px solid var(--line); }
.pos-discount { margin: .25rem 0; }
.pos-discount input { max-width: 6rem; }
.pos-total { display: flex; justify-content: space-between; align-items: baseline; font-size: 1.15rem; margin-top: .25rem; }
.pos-total b { font-size: 1.7rem; font-variant-numeric: tabular-nums; }
.pos-actions { display: flex; gap: .5rem; padding: .6rem 1rem 1rem; }
.pos-actions .pos-pay { flex: 1; font-size: 1.15rem; padding-block: .8rem; }
.pos kbd, .pos-modal kbd { font-size: .7rem; opacity: .7; margin-inline-start: .35rem; }
.pos-items { min-height: 0; overflow-y: auto; padding: 1rem; }
.pos-items .tiles-grid { padding-bottom: 1rem; }
.pos-tabs { display: none; }

.pos-modal { position: fixed; inset: 0; background: rgba(15, 23, 42, .45); display: grid; place-items: center; z-index: 60; padding: 1rem; }
.pos-dialog { background: var(--card); border-radius: var(--radius); box-shadow: 0 20px 60px rgba(0, 0, 0, .25); width: min(520px, 100%); max-height: 100%;
    overflow-y: auto; padding: 1.25rem; display: flex; flex-direction: column; gap: .75rem; }
.pos-dialog-head { display: flex; justify-content: space-between; align-items: center; }
.pos-dialog-head h2 { margin: 0; }
.pos-due { font-size: 1.1rem; display: flex; justify-content: space-between; align-items: baseline; }
.pos-due b { font-size: 1.8rem; }
.pos-methods { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }
.pos-method { padding: .7rem 1rem; border-radius: var(--radius-sm); border: 1px solid var(--line-strong); background: var(--card); font-weight: 600; cursor: pointer; }
.pos-method.cash { border-color: var(--success); color: var(--success); }
.pos-method:disabled { opacity: .45; cursor: default; }
.pos-payline { display: grid; grid-template-columns: 1fr 9rem auto; gap: .5rem; align-items: center; }
.pos-payline input { text-align: end; font-size: 1.05rem; }
.pos-tender { display: flex; flex-direction: column; gap: .5rem; padding: .75rem; background: var(--paper); border-radius: var(--radius-sm); }
.pos-quick { display: flex; flex-wrap: wrap; gap: .4rem; }
.pos-change { display: flex; justify-content: space-between; align-items: baseline; color: var(--success); font-weight: 600; }
.pos-change b { font-size: 1.5rem; }
.pos-change.big b { font-size: 2.4rem; }
.pos-due-left { min-height: 1.4rem; color: var(--danger); font-weight: 600; }
.pos-due-left.ok { color: var(--success); }
.pos-confirm { font-size: 1.15rem; padding-block: .8rem; }
.pos-done { align-items: center; text-align: center; }
.pos-done .icon { color: var(--success); }
.pos-done .pos-change { width: 100%; }
.pos-done .pos-actions { width: 100%; padding: 0; }
.pos-done .pos-actions .btn { flex: 1; }
.pos-return-find { display: flex; gap: .5rem; }
.pos-return-find input { flex: 1; }
.pos-return-hit { display: grid; grid-template-columns: auto auto 1fr auto; gap: .75rem; padding: .6rem .75rem; border: 1px solid var(--line); border-radius: var(--radius-sm);
    color: inherit; text-decoration: none; }
.pos-return-hit:hover { background: var(--primary-soft); }
.pos-print { position: fixed; left: -10000px; top: 0; }
@media print { .pos-print { position: static; } }

@media (max-width: 760px) {
    .pos-head { padding: .5rem .75rem; gap: .5rem; }
    .pos-head .btn { padding: .3rem .6rem; }
    .pos-tabs { display: grid !important; grid-template-columns: 1fr 1fr; background: var(--card); border-bottom: 1px solid var(--line); }
    .pos-tabs button { padding: .7rem; border: 0; background: none; font-weight: 600; color: var(--muted); border-bottom: 3px solid transparent; }
    .pos-tabs button.on { color: var(--primary); border-bottom-color: var(--primary); }
    .pos-body { grid-template-columns: 1fr; }
    .pos.show-items .pos-cart { display: none; }
    .pos.show-cart .pos-items { display: none; }
    .pos-cart { border: 0; }
    .pos-items { padding: .75rem; }
    .pos-items .tiles-grid { grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: .5rem; }
    .pos-line-edit { grid-template-columns: 1fr 1fr; }
    .pos-modal { padding: 0; place-items: end stretch; }
    .pos-dialog { width: 100%; border-radius: var(--radius) var(--radius) 0 0; max-height: 92vh; }
}
.pos-discount { display: flex !important; flex-direction: row !important; justify-content: space-between; align-items: center; gap: .5rem; }
.statement-account .account-picker { min-width: 18rem; }
@media (max-width: 760px) { .statement-account .account-picker { min-width: 0; width: 100%; } }
.danger-zone { border-color: #efc4be; }
.danger-zone h2 { color: var(--danger); }
.danger-zone ul { margin: .35rem 0 0; padding-inline-start: 1.2rem; color: var(--ink-soft); }
.party-pick .party-combo { min-width: 16rem; }
@media (max-width: 760px) { .party-pick .party-combo { min-width: 0; } }
.audit-detail td { background: var(--paper); }
.audit-detail .grid { margin-top: .5rem; background: var(--card); }
.audit-grid td:last-child { max-width: 24rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.exp-lines { min-width: 46rem; }
.exp-lines select, .exp-lines input { width: 100%; }
.exp-cancel { display: flex; gap: .75rem; align-items: end; margin-top: 1rem; flex-wrap: wrap; }
.exp-cancel .field { flex: 1; min-width: 14rem; }

/* Payroll */
.payroll-sheet td, .payroll-sheet th { white-space: nowrap; }
.payslip { max-width: 760px; margin: 0 auto 1rem; display: flex; flex-direction: column; gap: .75rem; }
.payslip-head { display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap; border-bottom: 1px solid var(--line); padding-bottom: .5rem; }
.payslip-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.payslip-sign { display: flex; justify-content: space-between; margin-top: 2rem; color: var(--ink-soft); }
.payslip-sign span { border-top: 1px solid var(--line-strong); padding-top: .3rem; min-width: 10rem; text-align: center; }
@media (max-width: 640px) { .payslip-cols { grid-template-columns: 1fr; } }
@media print { .payslip { border: 0; box-shadow: none; max-width: none; } }

/* Branches side by side */
.branch-table td, .branch-table th { white-space: nowrap; }
.branch-bars { display: flex; flex-direction: column; gap: .6rem; }
.bb-row { display: grid; grid-template-columns: 9rem 1fr; gap: .75rem; align-items: center; }
.bb-name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bb-bars { display: flex; flex-direction: column; gap: .2rem; padding-inline-end: 6.5rem; }
.bb-bar { height: 1.15rem; border-radius: 4px; position: relative; min-width: 2%; }
.bb-bar span { position: absolute; inset-inline-start: calc(100% + .4rem); top: 0; font-size: .78rem; line-height: 1.15rem; white-space: nowrap; color: var(--ink-soft); font-variant-numeric: tabular-nums; }
.bb-bar.sales { background: var(--primary); }
.bb-bar.profit { background: var(--success); }
.bb-bar.loss { background: var(--danger); }
.bb-legend { display: flex; gap: 1rem; font-size: .8rem; color: var(--ink-soft); }
.bb-legend span::before { content: ""; display: inline-block; width: .7rem; height: .7rem; border-radius: 2px; margin-inline-end: .3rem; vertical-align: middle; }
.bb-legend .sales::before { background: var(--primary); }
.bb-legend .profit::before { background: var(--success); }
@media (max-width: 640px) { .bb-row { grid-template-columns: 1fr; gap: .25rem; } }

/* Budgets */
.budget-grid td, .budget-grid th { white-space: nowrap; }
.budget-grid input.num { width: 6.5rem; }
.budget-grid .acc { min-width: 14rem; }
.budget-good { color: var(--success); }
.budget-bad { color: var(--danger); }

/* ---------- e-invoice setup ---------- */
.tab .badge { margin-inline-start: 6px; padding: 0 7px; font-size: .75rem; }
.eta-ready { display: flex; align-items: center; gap: 8px; margin: 0 0 14px; font-weight: 600; color: var(--ink-soft); }
.eta-ready.ok { color: var(--success); }
.eta-areas { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 10px; }
.eta-area {
    display: flex; flex-direction: column; gap: 4px; padding: 12px 14px; text-align: start; cursor: pointer;
    border: 1px solid var(--line); border-inline-start: 4px solid var(--danger); border-radius: var(--radius-sm); background: var(--card); font: inherit;
}
.eta-area span { color: var(--danger); font-size: .9rem; }
.eta-area.done { border-inline-start-color: var(--success); }
.eta-area.done span { color: var(--success); }
.eta-area:hover { background: var(--paper); }
.eta-codes select { width: 100%; min-width: 11rem; }
.eta-codes .card { overflow-x: auto; }
.eta-items input { min-width: 13rem; }
.eta-items select { min-width: 5.5rem; }
.eta-items td:nth-child(2) { min-width: 9rem; }
.eta-problems { margin: 0 0 12px; padding-inline-start: 20px; color: var(--danger); line-height: 1.9; }
.eta-totals { display: flex; flex-wrap: wrap; gap: 8px 28px; margin: 14px 0 6px; }
.eta-totals b { margin-inline-start: 6px; }
.eta-json summary { cursor: pointer; font-weight: 600; }
.eta-json pre { margin: 12px 0 0; max-height: 60vh; overflow: auto; padding: 12px; background: var(--paper); border-radius: var(--radius-sm); font-size: .8rem; text-align: left; }
.page-head h1 .badge { margin-inline-start: 8px; font-size: .8rem; vertical-align: middle; }
.eta-facts { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 10px 20px; margin: 0 0 12px; }
.eta-facts dt { color: var(--muted); font-size: .85rem; }
.eta-facts dd { margin: 2px 0 0; font-weight: 600; }
.eta-uuid { font-family: monospace; word-break: break-all; }
.eta-error { margin-top: 14px; padding: 12px 14px; border: 1px solid var(--danger-soft); border-inline-start: 4px solid var(--danger); border-radius: var(--radius-sm); background: #fff8f7; }
.eta-error pre { margin: 8px 0 10px; white-space: pre-wrap; overflow-wrap: anywhere; unicode-bidi: plaintext; text-align: start; font-size: .85rem; }
.eta-error pre.eta-report { max-height: 22rem; overflow: auto; padding: 10px; background: #fff; border: 1px solid var(--line); border-radius: var(--radius-sm); font-size: .78rem; unicode-bidi: normal; text-align: left; white-space: pre-wrap; word-break: break-all; }
.eta-event { padding: 8px 0; border-bottom: 1px solid var(--line); }
.eta-event.bad b { color: var(--danger); }
.eta-event pre { margin: 6px 0 0; max-height: 240px; white-space: pre-wrap; overflow-wrap: anywhere; }
.eta-error, .eta-json { min-width: 0; max-width: 100%; }
.eta-first-line { max-width: 28rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--danger); font-size: .85rem; }
.eta-filter { margin-bottom: 14px; flex-wrap: wrap; }
.grid td.nowrap { white-space: nowrap; }
.grid .check-col { width: 36px; text-align: center; }
.grid .check-col input { width: 18px; height: 18px; }
.eta-unsent .eta-first-line { display: block; max-width: 18rem; }
.eta-results { margin: 0; padding: 0; list-style: none; }
.eta-results li { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 6px 0; border-bottom: 1px solid var(--line); }
.eta-results small { color: var(--danger); }
.eta-signer { margin: 10px 0; padding: 8px 12px; border-radius: var(--radius-sm); background: var(--danger-soft); color: var(--danger); }
.eta-signer.ok { background: var(--success-soft); color: var(--success); }
.eta-match-summary { display: flex; flex-wrap: wrap; gap: .5rem; margin-bottom: 1rem; }
.eta-map-item { min-width: 14rem; }
.auth-or { display: flex; align-items: center; gap: .75rem; margin: 1rem 0; color: var(--ink-soft); font-size: .85rem; }
.auth-or::before, .auth-or::after { content: ""; flex: 1; border-top: 1px solid var(--line); }
.crmiva-companies { display: grid; gap: .5rem; margin: .75rem 0; }
.crmiva-companies .btn { justify-content: flex-start; gap: .5rem; }
