/* ===== Triniteq Billing — brand theme ===== */
:root {
    /* Brand */
    --tq-orange: #E68A48;
    --tq-orange-soft: rgba(230, 138, 72, .14);
    --tq-orange-text: #c9722f;
    --tq-coral: #DD5B61;
    --tq-grey: #55565B;

    /* Surfaces */
    --bg: #F0F2F6;
    --surface: #FFFFFF;
    --panel: #F4F5F8;

    /* Text */
    --text: #101828;
    --text-sub: #344054;
    --muted: #667085;

    /* Lines & status */
    --border: rgba(17, 24, 39, .10);
    --border-strong: rgba(17, 24, 39, .16);
    --success: #22c55e;
    --success-bg: #ecfdf3;
    --success-text: #176a37;
    --error: #ef4444;
    --error-bg: #fef3f2;
    --error-text: #b42318;
    --warn-bg: #fffaeb;
    --warn-text: #b54708;

    /* Shape & depth */
    --radius-sm: 7px;
    --radius: 10px;
    --radius-lg: 14px;
    --shadow-sm: 0 1px 3px rgba(16,24,40,.07), 0 1px 2px rgba(16,24,40,.04);
    --shadow: 0 4px 16px rgba(16,24,40,.08), 0 1px 4px rgba(16,24,40,.04);

    --sidebar-w: 232px;
    --topbar-h: 56px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
    font-family: 'Segoe UI', system-ui, -apple-system, 'Inter', sans-serif;
    background: var(--bg);
    color: var(--text);
    font-size: 14px;
    line-height: 1.5;
}
h1 { font-size: 1.6rem; font-weight: 650; letter-spacing: -.01em; margin: 0 0 4px; }
h2 { font-size: 1.2rem; font-weight: 650; }
h3 { font-size: 1.02rem; font-weight: 650; margin: 0 0 12px; }
a { color: var(--tq-orange-text); text-decoration: none; }
a:hover { text-decoration: underline; }
.muted { color: var(--muted); }
h1:focus { outline: none; }

/* ===== App shell ===== */
.app-shell { display: flex; min-height: 100vh; }

.sidebar {
    width: var(--sidebar-w);
    flex-shrink: 0;
    background: #1e2025;
    color: rgba(255,255,255,.80);
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 0;
    height: 100vh;
}
.sidebar .app-version {
    margin-top: auto;
    padding: 12px 20px;
    font-size: .72rem;
    letter-spacing: .02em;
    color: rgba(255,255,255,.40);
}
.sidebar .brand {
    display: flex; align-items: center; gap: 8px;
    color: #fff; font-size: .78rem; font-weight: 700; letter-spacing: .04em; text-transform: uppercase;
    padding: 16px 20px;
    border-bottom: 1px solid rgba(255,255,255,.07);
    text-decoration: none;
}
.sidebar .brand:hover { text-decoration: none; }
.sidebar .brand img { height: 24px; width: auto; display: block; }
.sidebar .brand .brand-sub { color: rgba(255,255,255,.55); align-self: flex-end; padding-bottom: 2px; }

ul.nav { list-style: none; margin: 0; padding: 10px 0; display: block; overflow-y: auto; }
ul.nav li { padding: 0; }
ul.nav li.group {
    padding: 16px 20px 5px; font-size: .68rem; font-weight: 700;
    text-transform: uppercase; letter-spacing: .07em; color: rgba(255,255,255,.40);
}
ul.nav a {
    display: block; padding: 8px 20px; color: rgba(255,255,255,.80);
    border-left: 3px solid transparent; font-size: .9rem;
}
ul.nav a:hover { background: rgba(255,255,255,.05); color: #fff; text-decoration: none; }
ul.nav a.active {
    background: var(--tq-orange-soft); color: #f5a26a;
    border-left-color: var(--tq-orange); font-weight: 600;
}

.main { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.topbar {
    height: var(--topbar-h); background: var(--surface);
    border-bottom: 1px solid var(--border);
    display: flex; align-items: center; justify-content: flex-end; gap: 16px;
    padding: 0 28px; position: sticky; top: 0; z-index: 5;
}
.topbar .user { font-weight: 600; color: var(--text-sub); }
.topbar .signout { color: var(--muted); font-size: .88rem; }
.content { padding: 26px 36px; width: 100%; }

/* ===== Buttons ===== */
.btn {
    display: inline-flex; align-items: center; gap: 7px; justify-content: center;
    padding: 8px 15px; border-radius: var(--radius-sm); border: 1px solid transparent;
    font: inherit; font-weight: 600; font-size: .88rem; cursor: pointer; text-decoration: none;
    transition: background .12s, border-color .12s, box-shadow .12s;
}
.btn:hover { text-decoration: none; }
.btn-primary { background: var(--tq-orange); color: #fff; }
.btn-primary:hover { background: #d97b38; color: #fff; }
.btn-secondary { background: var(--surface); color: var(--text-sub); border-color: var(--border-strong); }
.btn-secondary:hover { background: var(--panel); }
.btn-ghost { background: transparent; color: var(--muted); }
.btn-ghost:hover { background: var(--panel); color: var(--text); }
.btn-danger { background: var(--error); color: #fff; }
.btn[disabled] { opacity: .55; cursor: default; }
.btn-sm { padding: 5px 10px; font-size: .82rem; }

/* ===== Cards ===== */
.card {
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius); box-shadow: var(--shadow-sm); padding: 22px 24px;
    margin-bottom: 20px;
}
.card > h3:first-child { margin-top: 0; }

/* Stat tiles */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(165px, 1fr)); gap: 16px; margin-bottom: 20px; }
/* Dashboard KPIs: tidy fixed grid on wide screens so 10 tiles sit as even rows of five. */
@media (min-width: 1280px) { .dash-stats { grid-template-columns: repeat(5, minmax(0, 1fr)); } }
.stat-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-sm); padding: 15px 18px; }
.stat-card .stat-label { font-size: .68rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin-bottom: 6px; }
.stat-card .stat-value { font-size: 1.4rem; font-weight: 700; color: var(--text); line-height: 1.15; }
.stat-card .stat-value.sm { font-size: 1.05rem; }
.stat-card .stat-sub { font-size: .76rem; color: var(--muted); margin-top: 4px; }
.stat-card.accent { border-left: 3px solid var(--tq-orange-text, #c25e1f); }
.stat-card .ok { color: var(--success-text); }
.stat-card .bad { color: var(--error-text); }

/* Two-column tile grid for cards */
.tile-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; align-items: start; margin-bottom: 20px; }
.tile-grid > .card { margin-bottom: 0; height: 100%; }
.tile-grid .span-2 { grid-column: 1 / -1; }
@media (max-width: 1024px) { .tile-grid { grid-template-columns: 1fr; } }

.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 20px; }
.head-right { display: flex; align-items: center; gap: 18px; }
.header-gp { text-align: right; line-height: 1.2; }
.header-gp .label { display: block; font-size: .68rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.header-gp .val { font-size: 1.2rem; font-weight: 700; color: var(--text); }
.header-gp .val small { color: var(--muted); font-weight: 600; font-size: .82rem; }
.page-head .sub { color: var(--muted); margin: 0; }
.toolbar { display: flex; gap: 10px; align-items: center; margin-bottom: 16px; flex-wrap: wrap; }
.spacer { flex: 1; }

/* ===== Tables ===== */
table.grid { width: 100%; border-collapse: collapse; background: var(--surface);
    border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow-sm); }
table.grid th, table.grid td { text-align: left; padding: 11px 14px; border-bottom: 1px solid var(--border); font-size: .89rem; }
table.grid thead th { background: var(--panel); color: var(--text-sub); font-weight: 600; font-size: .8rem; text-transform: uppercase; letter-spacing: .03em; }
table.grid tbody tr:last-child td { border-bottom: none; }
table.grid tbody tr:hover { background: #fafbfd; }
table.grid th.num, table.grid td.num { text-align: right; }
table.grid tfoot td { background: var(--panel); border-top: 2px solid var(--border-strong); border-bottom: none; padding: 12px 14px; }
.row-link { cursor: pointer; }

/* Compact inputs inside grid rows */
/* Let the item tables overflow so an open combobox dropdown isn't clipped. */
table.grid.items { overflow: visible; }
table.grid.items td { vertical-align: middle; overflow: visible; }
table.grid select, table.grid input {
    width: 100%; padding: 6px 8px; border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm); font: inherit; background: var(--surface);
}
table.grid input.cell-num { width: 96px; text-align: right; margin-left: auto; }
/* Hide number spin buttons so the value isn't clipped in the narrow cells. */
table.grid input.cell-num::-webkit-outer-spin-button,
table.grid input.cell-num::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
table.grid input.cell-num[type=number] { -moz-appearance: textfield; appearance: textfield; }
table.grid select:focus, table.grid input:focus { outline: none; border-color: var(--tq-orange); box-shadow: 0 0 0 3px var(--tq-orange-soft); }

/* Payment-setup choices (customer landing) */
.pay-choices { display:flex; flex-direction:column; gap:12px; margin-top:18px; }
.pay-choice { display:flex; flex-direction:column; gap:2px; padding:16px 18px; border:1px solid var(--border-strong);
    border-radius:10px; text-decoration:none; color:var(--text); background:var(--surface); transition:border-color .12s, box-shadow .12s; }
.pay-choice:hover { border-color:var(--tq-orange); box-shadow:0 0 0 3px var(--tq-orange-soft); }
.pay-choice .pc-title { font-weight:700; font-size:1.02rem; }
.pay-choice .pc-sub { color:var(--muted); font-size:.88rem; }

/* Email-template picker */
.tpl-pick { display:block; width:100%; text-align:left; background:none; border:none; padding:8px 10px; border-radius:6px; cursor:pointer; font:inherit; color:var(--text); }
.tpl-pick:hover { background:var(--panel); }
.tpl-pick.active { background:var(--tq-orange-soft); color:var(--tq-orange-text); font-weight:600; }

/* Deliveries (order detail hardware) */
.deliveries { margin-top: 18px; }
.deliveries-title { margin: 0 0 10px; font-size: .82rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.delivery-card { border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface);
    box-shadow: var(--shadow-sm); margin-bottom: 10px; overflow: hidden; }
.delivery-card .dc-head { display: flex; align-items: center; justify-content: space-between; gap: 12px;
    padding: 10px 14px; background: var(--panel); border-bottom: 1px solid var(--border); }
.delivery-card .dc-supplier { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.delivery-card .dc-name { font-weight: 700; }
.delivery-card .dc-actions { display: flex; gap: 4px; flex: 0 0 auto; }
.delivery-card .dc-body { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; padding: 12px 14px; flex-wrap: wrap; }
.delivery-card ul.dc-items { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px 8px; }
.delivery-card ul.dc-items li { background: var(--panel); border: 1px solid var(--border); border-radius: 999px; padding: 3px 10px; font-size: .84rem; }
.delivery-card ul.dc-items .dc-qty { font-weight: 700; color: var(--tq-orange-text); }
.delivery-card .dc-meta { display: flex; align-items: center; gap: 14px; margin-left: auto; font-size: .85rem; white-space: nowrap; }
.delivery-card .dc-track { font-weight: 600; }

/* Xero contact link card + search results */
.xero-contact-card { margin-bottom: 18px; }
.xero-contact-card .card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
ul.xero-results { list-style: none; margin: 0; padding: 0; max-height: 340px; overflow-y: auto;
    border: 1px solid var(--border); border-radius: var(--radius); }
ul.xero-results li { padding: 10px 12px; border-bottom: 1px solid var(--border); cursor: pointer;
    display: flex; flex-direction: column; gap: 2px; }
ul.xero-results li:last-child { border-bottom: none; }
ul.xero-results li:hover { background: var(--tq-orange-soft); }
ul.xero-results .xr-name { font-weight: 600; }
ul.xero-results .xr-sub { font-size: .82rem; }

/* FilterSelect — styled searchable combobox */
.fsel { position: relative; width: 100%; }
.fsel-input { width: 100%; padding: 6px 26px 6px 8px; border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm); font: inherit; background: var(--surface); }
.fsel-input:focus { outline: none; border-color: var(--tq-orange); box-shadow: 0 0 0 3px var(--tq-orange-soft); }
.fsel-caret { position: absolute; right: 9px; top: 50%; transform: translateY(-50%);
    pointer-events: none; color: var(--text-muted); font-size: .75rem; }
.fsel-menu { position: absolute; z-index: 60; left: 0; right: 0; top: calc(100% + 4px); margin: 0; padding: 4px;
    list-style: none; max-height: 260px; overflow-y: auto; background: var(--surface);
    border: 1px solid var(--border-strong); border-radius: var(--radius); box-shadow: var(--shadow-md, 0 8px 24px rgba(0,0,0,.14)); }
.fsel-opt { padding: 8px 10px; border-radius: var(--radius-sm); cursor: pointer; font-size: .9rem;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fsel-opt:hover { background: var(--tq-orange-soft); color: var(--tq-orange-strong, var(--tq-orange)); }

/* Bulk action bar */
.bulk-bar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
    background: var(--tq-orange-soft); border: 1px solid var(--tq-orange); border-radius: var(--radius);
    padding: 10px 14px; margin-bottom: 14px; }
.bulk-bar select, .bulk-bar input[type="number"] { padding: 6px 9px; border: 1px solid var(--border-strong); border-radius: 6px; font: inherit; }
.bulk-bar .check { font-weight: 500; }
table.grid tbody tr.row-selected { background: var(--tq-orange-soft); }

.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.card-head h3 { margin: 0; }
.check { display: inline-flex; gap: 8px; align-items: center; font-weight: 500; cursor: pointer; }
.check input[type="checkbox"] { width: 16px; height: 16px; flex: 0 0 auto; margin: 0; padding: 0; }

/* ===== Forms ===== */
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px 20px; }
.form-grid.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.form-grid .full { grid-column: 1 / -1; }
@media (max-width: 760px) { .form-grid, .form-grid.cols-3 { grid-template-columns: 1fr; } }
.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-weight: 600; font-size: .84rem; color: var(--text-sub); }
.field input, .field select, .field textarea {
    width: 100%; padding: 9px 11px; border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm); font: inherit; background: var(--surface); color: var(--text);
}
.field input:focus, .field select:focus, .field textarea:focus {
    outline: none; border-color: var(--tq-orange); box-shadow: 0 0 0 3px var(--tq-orange-soft);
}
.form-actions { display: flex; gap: 10px; margin-top: 22px; }

/* Compact form — denser 3-col grid + smaller controls for header-style detail cards */
.card.tight { padding: 16px 18px; margin-bottom: 16px; }
.card.tight > h3:first-child { font-size: .95rem; margin-bottom: 14px; }
/* Wizard step indicator (new order) */
.wizard-steps { list-style: none; display: flex; gap: 10px; margin: 0 0 18px; padding: 0; flex-wrap: wrap; }
.wizard-steps .wstep { display: flex; align-items: center; gap: 9px; flex: 1; min-width: 180px; cursor: pointer;
    padding: 12px 16px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); color: var(--muted); }
.wizard-steps .wstep .wnum { display: inline-flex; align-items: center; justify-content: center; width: 26px; height: 26px;
    border-radius: 50%; background: var(--border); color: var(--text-sub); font-weight: 700; font-size: .85rem; flex: 0 0 auto; }
.wizard-steps .wstep .wlabel { font-weight: 600; font-size: .9rem; }
.wizard-steps .wstep.active { border-color: var(--tq-orange); box-shadow: 0 0 0 3px var(--tq-orange-soft); color: var(--text); }
.wizard-steps .wstep.active .wnum { background: var(--tq-orange); color: #fff; }
.wizard-steps .wstep.done { color: var(--text-sub); }
.wizard-steps .wstep.done .wnum { background: var(--tq-green, #2e9e5b); color: #fff; }
@media (max-width: 640px) { .wizard-steps { flex-direction: column; } }

/* Contacts editor (customer form) — compact inputs inside the grid table */
.contacts-edit input[type="text"], .contacts-edit input:not([type]), .contacts-edit input[type="email"] {
    width: 100%; padding: 6px 8px; border: 1px solid var(--border-strong); border-radius: 6px; box-sizing: border-box;
}

/* Toggle switch (e.g. GST exempt on the customer form) */
.switch { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; user-select: none; min-height: 38px; }
.switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.switch .switch-track { position: relative; flex: 0 0 auto; width: 42px; height: 24px; border-radius: 999px;
    background: var(--border-strong, #c9ced6); transition: background .15s; }
.switch .switch-thumb { position: absolute; top: 2px; left: 2px; width: 20px; height: 20px; border-radius: 50%;
    background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.3); transition: transform .15s; }
.switch input:checked + .switch-track { background: var(--tq-orange); }
.switch input:checked + .switch-track .switch-thumb { transform: translateX(18px); }
.switch input:focus-visible + .switch-track { box-shadow: 0 0 0 3px var(--tq-orange-soft); }
.switch .switch-label { font-size: .85rem; font-weight: 600; color: var(--text-sub);
    text-transform: none; letter-spacing: normal; }

.form-grid.compact { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px 16px; }
.form-grid.compact .field { gap: 4px; }
.form-grid.compact .field label { font-size: .72rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.form-grid.compact .field input, .form-grid.compact .field select {
    padding: 7px 10px; font-size: .88rem; border-radius: var(--radius-sm);
}
@media (max-width: 980px) { .form-grid.compact { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 620px) { .form-grid.compact { grid-template-columns: 1fr; } }

/* ===== Badges ===== */
.badge { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: .76rem; font-weight: 600; }
.badge-grey { background: #eef0f4; color: var(--text-sub); }
.badge-orange { background: var(--tq-orange-soft); color: var(--tq-orange-text); }
.badge-green { background: var(--success-bg); color: var(--success-text); }
.badge-red { background: var(--error-bg); color: var(--error-text); }
.badge-amber { background: var(--warn-bg); color: var(--warn-text); }
.badge-blue { background: #e4eefc; color: #1b4f9c; }

/* ===== Notes / alerts ===== */
.note { padding: 11px 14px; border-radius: var(--radius-sm); margin: 14px 0; font-size: .9rem; }
.note.success { background: var(--success-bg); color: var(--success-text); }
.note.error { background: var(--error-bg); color: var(--error-text); }

/* Lightweight CSS bar chart. */
.barchart { display: flex; align-items: stretch; gap: 4px; width: 100%; }
.barchart .bc-col { flex: 1 1 0; display: flex; flex-direction: column; min-width: 0; }
.barchart .bc-bar-wrap { flex: 1; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; gap: 3px; border-bottom: 1px solid var(--border); }
.barchart .bc-bar { width: 74%; max-width: 28px; min-height: 3px; border-radius: 3px 3px 0 0; transition: height .25s; }
.barchart .bc-val { font-size: .66rem; color: var(--muted); font-weight: 600; white-space: nowrap; }
.barchart .bc-xlabel { margin-top: 6px; font-size: .66rem; color: var(--muted); text-align: center; overflow: hidden; white-space: nowrap; }
.chart-empty { display: flex; align-items: center; justify-content: center; color: var(--muted); font-size: .88rem; background:
    repeating-linear-gradient(0deg, transparent, transparent 31px, var(--border) 31px, var(--border) 32px); border-radius: var(--radius-sm); }

/* Contract-status info banner (admin + portal). */
.contract-banner {
    display: flex; gap: 12px; align-items: flex-start;
    padding: 14px 16px; margin: 0 0 18px; border-radius: var(--radius);
    border: 1px solid var(--tq-orange); background: var(--tq-orange-soft);
}
.contract-banner.ended { border-color: #d1495b; background: rgba(209, 73, 91, .10); }
.contract-banner .cb-icon { font-size: 1.2rem; line-height: 1.4; }
.contract-banner .cb-body { font-size: .9rem; }
.contract-banner .cb-body strong { display: block; margin-bottom: 4px; }
.contract-banner .cb-body ul { margin: 0; padding-left: 18px; }
.contract-banner .cb-body li { margin: 2px 0; }
.errors { color: var(--error-text); font-size: .85rem; margin-top: 8px; }
.empty { color: var(--muted); padding: 28px; text-align: center; background: var(--surface);
    border: 1px dashed var(--border-strong); border-radius: var(--radius); }

/* Two-column detail layout */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 20px; align-items: start; }
@media (max-width: 900px) { .grid-2 { grid-template-columns: 1fr; } }

/* Order detail: main content + sticky checklist aside */
.order-layout { display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 0 20px; align-items: start; }
.order-aside { position: sticky; top: 76px; }
@media (max-width: 1100px) {
    .order-layout { grid-template-columns: 1fr; }
    .order-aside { position: static; }
}
.count { font-size: .8rem; font-weight: 600; color: var(--tq-orange-text); background: var(--tq-orange-soft); padding: 2px 9px; border-radius: 999px; margin-left: 6px; }

/* Gross-profit summary */
.gp .gp-row { display: flex; justify-content: space-between; padding: 7px 0; border-bottom: 1px solid var(--border); }
.gp .gp-row:last-of-type { border-bottom: none; }
.gp .gp-row.total { font-size: 1.05rem; border-top: 2px solid var(--border-strong); margin-top: 4px; padding-top: 12px; border-bottom: none; }
.progress { height: 7px; background: var(--panel); border-radius: 999px; overflow: hidden; margin-top: 12px; }
.progress .bar { height: 100%; background: var(--tq-orange); border-radius: 999px; transition: width .2s; }

/* Checklist */
ul.checklist { list-style: none; margin: 10px 0 0; padding: 0; }
ul.checklist li { display: flex; align-items: center; justify-content: space-between; padding: 7px 0; border-bottom: 1px solid var(--border); }
ul.checklist li:last-child { border-bottom: none; }
ul.checklist label { display: flex; align-items: center; gap: 9px; cursor: pointer; }
ul.checklist .done { color: var(--muted); text-decoration: line-through; }
ul.checklist .ts { color: var(--muted); font-size: .78rem; }
ul.checklist .li-actions { display: flex; align-items: center; gap: 8px; }
ul.checklist .li-del { background: none; border: none; cursor: pointer; color: var(--muted); font-size: .8rem; padding: 2px 4px; border-radius: 4px; }
ul.checklist .li-del:hover { color: var(--error-text); background: var(--error-bg); }
ul.checklist .li-move { background: none; border: none; cursor: pointer; color: var(--muted); font-size: .72rem; padding: 2px 3px; border-radius: 4px; line-height: 1; }
ul.checklist .li-move:hover:not(:disabled) { color: var(--tq-orange); background: var(--tq-orange-soft); }
ul.checklist .li-move:disabled { opacity: .3; cursor: default; }

/* Comments */
ul.comments { list-style: none; margin: 0; padding: 0; }
ul.comments li { padding: 10px 0; border-bottom: 1px solid var(--border); }
ul.comments li:last-child { border-bottom: none; }
ul.comments .meta { color: var(--muted); font-size: .82rem; margin-bottom: 3px; }

/* Definition lists for detail views */
.dl { display: grid; grid-template-columns: 180px 1fr; gap: 10px 16px; }
.dl dt { color: var(--muted); font-size: .86rem; }
.dl dd { margin: 0; color: var(--text); font-weight: 500; }

/* ===== Portal ===== */
.portal-shell { min-height: 100vh; background: var(--bg); }
.portal-header { height: 60px; background: #1e2025; color: #fff; display: flex; align-items: center; justify-content: space-between; padding: 0 24px; }
.portal-header .brand { display: flex; align-items: center; gap: 9px; text-decoration: none; }
.portal-header .brand:hover { text-decoration: none; }
.portal-header .brand img { height: 26px; width: auto; display: block; }
.portal-header .brand .brand-sub { color: rgba(255,255,255,.6); font-size: .78rem; font-weight: 600; letter-spacing: .03em; text-transform: uppercase; align-self: flex-end; padding-bottom: 3px; }
.portal-header .inline { display: flex; align-items: center; gap: 12px; }
.portal-header .user { color: rgba(255,255,255,.75); }
.portal-header .linkbtn { color: #fff; background: none; border: none; cursor: pointer; font: inherit; }
.portal-header .portal-right { display: flex; align-items: center; gap: 24px; }
.portal-nav { display: flex; gap: 18px; }
.portal-nav a { color: rgba(255,255,255,.8); text-decoration: none; font-size: .92rem; }
.portal-nav a:hover { color: #fff; }
.portal-switch { color: rgba(255,255,255,.8); text-decoration: none; font-size: .92rem; }
.portal-switch:hover { color: #fff; }

/* Payment methods list (portal home) */
.method-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.method-row { display: flex; align-items: center; justify-content: space-between; gap: 12px;
    padding: 10px 12px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); }
.method-info { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.method-name { font-weight: 600; }
.method-detail { color: var(--muted); font-size: .85rem; }
.method-actions { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.portal-content { display: flex; justify-content: center; padding: 48px 16px; }
.portal-page { width: 100%; max-width: 960px; }

/* Standalone auth (staff sign-in) screen — full-bleed hospitality photo behind a centred card */
.auth-shell { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px; position: relative; overflow: hidden; }
/* Background photo */
.auth-shell::before { content: ""; position: fixed; inset: 0; z-index: 0;
    background: url('/img/login-bg.jpg') center 35% / cover no-repeat; }
/* Brand wash for card contrast */
.auth-shell::after { content: ""; position: fixed; inset: 0; z-index: 1;
    background: linear-gradient(135deg, rgba(20,12,8,.62) 0%, rgba(216,123,56,.45) 55%, rgba(20,12,8,.62) 100%); }
.auth-card { position: relative; z-index: 2; background: rgba(255,255,255,.98); border: 1px solid rgba(255,255,255,.25); border-radius: 18px;
    box-shadow: 0 18px 60px rgba(0,0,0,.45), 0 4px 14px rgba(0,0,0,.25);
    padding: 38px 40px 36px; width: 100%; max-width: 410px; text-align: center; color-scheme: light; }
.auth-card h1 { font-size: 1.35rem; margin: 6px 0 8px; }
.auth-card .muted { margin-bottom: 22px; }
.auth-brand { margin-bottom: 14px; }
.auth-brand img { height: 46px; width: auto; display: inline-block; }
.auth-product-label { display: inline-block; margin: 0 0 22px; padding: 5px 14px; border-radius: 999px;
    background: var(--tq-orange-soft, rgba(229,138,71,.14)); color: var(--tq-orange, #d97b38);
    font-size: .72rem; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
.auth-btn { display: block; width: 100%; margin-top: 10px; }
.account-list { display: flex; flex-direction: column; gap: 10px; margin-top: 16px; }
.account-option { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 16px;
    border: 1px solid var(--border); border-radius: 10px; background: var(--surface); color: var(--text);
    font-weight: 600; text-decoration: none; }
.account-option:hover { border-color: var(--tq-orange); box-shadow: var(--shadow-sm); }
.portal-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow); padding: 34px; max-width: 420px; width: 100%; }
.portal-card label { display: block; margin: 16px 0 6px; font-weight: 600; }
.portal-card input { width: 100%; padding: 10px 12px; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); box-sizing: border-box; }
.portal-card input:focus { outline: none; border-color: var(--tq-orange); box-shadow: 0 0 0 3px var(--tq-orange-soft); }
.portal-card button { margin-top: 18px; width: 100%; background: var(--tq-orange); color: #fff; border: none; padding: 11px; border-radius: var(--radius-sm); cursor: pointer; font-weight: 600; }
.portal-card button:hover { background: #d97b38; }

/* ===== Modal ===== */
.modal-backdrop {
    position: fixed; inset: 0; background: rgba(16,24,40,.45); z-index: 1050;
    display: flex; align-items: flex-start; justify-content: center; padding: 56px 16px; overflow-y: auto;
}
.modal-dialog {
    background: var(--surface); border-radius: var(--radius-lg); box-shadow: var(--shadow);
    width: 100%; max-width: 660px; animation: toast-in .15s ease-out;
}
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 16px 22px; border-bottom: 1px solid var(--border); }
.modal-head h3 { margin: 0; }
.modal-x { background: none; border: none; font-size: 1.05rem; cursor: pointer; color: var(--muted); }
.modal-x:hover { color: var(--text); }
.modal-body { padding: 22px; }

/* ===== Read-only summary header ===== */
.order-summary { padding: 0; overflow: hidden; }
.summary {
    display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 18px 28px; padding: 20px 24px;
}
.summary-item { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.summary-item .k { font-size: .68rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.summary-item .v { font-weight: 600; color: var(--text); overflow-wrap: anywhere; }
.summary-item .v a { font-weight: 600; }

/* Financial strip inside the summary header */
.finance-strip {
    display: flex; flex-wrap: wrap; align-items: center; gap: 8px 40px;
    background: var(--panel); border-top: 1px solid var(--border);
    padding: 14px 24px;
}
.finance-stat { display: flex; flex-direction: column; gap: 2px; }
.finance-stat .k { font-size: .68rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.finance-stat .v { font-weight: 700; font-size: 1.1rem; color: var(--text); }
.finance-stat.gp .v { color: var(--tq-orange-text); }
.finance-stat .v small { color: var(--muted); font-weight: 600; font-size: .8rem; }
.finance-cap { margin-left: auto; color: var(--muted); font-size: .78rem; }

/* ===== Toasts (fixed bottom-right, no layout shift, no focus) ===== */
.toast-host {
    position: fixed; bottom: 20px; right: 20px; z-index: 1100;
    display: flex; flex-direction: column; gap: 10px; align-items: flex-end;
    pointer-events: none;
}
.toast {
    pointer-events: auto; cursor: pointer; min-width: 240px; max-width: 360px;
    display: flex; align-items: center; gap: 10px;
    background: var(--surface); color: var(--text);
    border: 1px solid var(--border); border-left: 4px solid var(--muted);
    border-radius: var(--radius); box-shadow: var(--shadow);
    padding: 11px 14px; font-size: .9rem;
    animation: toast-in .18s ease-out;
}
.toast-icon {
    flex: 0 0 auto; width: 20px; height: 20px; border-radius: 50%;
    display: inline-flex; align-items: center; justify-content: center;
    font-size: .75rem; font-weight: 700; color: #fff;
}
.toast-text { flex: 1; }
.toast-success { border-left-color: var(--success); }
.toast-success .toast-icon { background: var(--success); }
.toast-error { border-left-color: var(--error); }
.toast-error .toast-icon { background: var(--error); }
.toast-info { border-left-color: var(--tq-orange); }
.toast-info .toast-icon { background: var(--tq-orange); }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }

/* ===== Blazor framework bits ===== */
.valid.modified:not([type=checkbox]) { outline: 1px solid var(--success); }
.invalid { outline: 1px solid var(--error); }
.validation-message { color: var(--error-text); font-size: .82rem; }

#blazor-error-ui {
    color-scheme: light only; background: lightyellow; bottom: 0; box-shadow: 0 -1px 2px rgba(0,0,0,.2);
    display: none; left: 0; padding: 0.6rem 1.25rem 0.7rem 1.25rem; position: fixed; width: 100%; z-index: 1000;
}
#blazor-error-ui .dismiss { cursor: pointer; position: absolute; right: 0.75rem; top: 0.5rem; }
.blazor-error-boundary {
    background: var(--error); padding: 1rem 1rem 1rem 1rem; color: white;
}
.blazor-error-boundary::after { content: "An error has occurred." }
