/* Light theme (default). Dark values below; js/theme.js sets <html data-theme>. */
:root {
    color-scheme: light;
    --bg: #f2f4f7;
    --surface: #ffffff;
    --surface-2: #fafbfc;      /* table heads, summary rows */
    --hover: #f5f7fa;
    --text: #1b2230;
    --label: #344054;
    --muted: #667085;
    --border: #d5dbe3;
    --line: #edf0f3;           /* row separators */
    --head: #14202e;           /* top bar */
    --head-hover: #22354a;
    --primary: #1d63d8;
    --primary-hover: #174fae;
    --primary-soft: #eaf2ff;
    --success: #17803a;
    --success-hover: #116a2f;
    --success-soft: #e3f4e8;
    --danger: #c62828;
    --danger-hover: #a51f1f;
    --danger-soft: #fdecec;
    --focus: #ffb020;
    --selected: #fff4d1;
    --kbd-bg: #f3f5f8;
    --kbd-border: #c3cad5;
    --chip-bg: #e6ecf5;
    --info-bg: #efe7ff;  --info-text: #3b1d78;
    --warn-bg: #fff4d1;  --warn-text: #5c4200;  --warn-border: #f3d48a;
    --bad-bg: #fdecec;   --bad-text: #8a1c1c;
    --notice-bg: #eaf2ff; --notice-border: #bcd3fb;
    --shadow: rgba(16, 24, 40, 0.18);
    --chart: #1d63d8;          /* single-series chart colour (validated vs surface) */
    --chart-hover: #174fae;
    --radius: 10px;
}
:root[data-theme="dark"] {
    color-scheme: dark;
    --bg: #0f1620;
    --surface: #17212d;
    --surface-2: #1c2836;
    --hover: #213042;
    --text: #e6ebf2;
    --label: #c7d0dc;
    --muted: #93a1b3;
    --border: #2e3c4e;
    --line: #243242;
    --head: #0a1018;
    --head-hover: #1a2636;
    --primary: #3b82f6;
    --primary-hover: #2f6fdb;
    --primary-soft: #1d2f4d;
    --success: #1f9d4c;
    --success-hover: #188040;
    --success-soft: #16301f;
    --danger: #e5484d;
    --danger-hover: #c93a3f;
    --danger-soft: #3a1f23;
    --selected: #3a3217;
    --kbd-bg: #223043;
    --kbd-border: #3a4a5e;
    --chip-bg: #223043;
    --info-bg: #2a2146;  --info-text: #d9ccff;
    --warn-bg: #3a3217;  --warn-text: #ffe7a3;  --warn-border: #6b5a22;
    --bad-bg: #3a1f23;   --bad-text: #ffc9c9;
    --notice-bg: #1d2f4d; --notice-border: #2f4a73;
    --shadow: rgba(0, 0, 0, 0.45);
    --chart: #3b82f6;
    --chart-hover: #60a5fa;
}

* { box-sizing: border-box; }
html { font-size: 15px; }
body {
    margin: 0;
    font-family: "Segoe UI", system-ui, -apple-system, Arial, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.4;
}
a { color: var(--primary); }
h1 { font-size: 1.4rem; margin: 0; }
h2 { font-size: 1.1rem; margin: 0 0 10px; }
.muted { color: var(--muted); }
.small { font-size: 0.85rem; }
[hidden] { display: none !important; }

/* ---------- top bar ---------- */
.topbar {
    position: sticky;
    top: 0;
    z-index: 20;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px;
    padding: 6px 16px;
    background: var(--head);
    color: #fff;
}
.brand { display: flex; align-items: center; gap: 10px; min-width: 0; color: #fff; text-decoration: none; font-weight: 700; font-size: 1rem; }
.brand .logo { width: 34px; height: 34px; border-radius: 6px; object-fit: contain; background: #fff; }
.logo-letter { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 8px; background: var(--primary); font-weight: 800; }
.account { display: flex; align-items: center; gap: 8px; }
.topbar .btn-ghost { border-color: rgba(255, 255, 255, 0.3); background: transparent; color: #d0d8e2; }
.topbar .btn-ghost:hover { background: var(--head-hover); color: #fff; }
.chip { display: inline-block; padding: 2px 10px; border-radius: 999px; background: var(--chip-bg); color: var(--label); font-size: 0.8rem; font-weight: 600; white-space: nowrap; }
.topbar .chip { background: rgba(255, 255, 255, 0.14); color: #fff; }
.chip-ok { background: var(--success-soft); color: var(--success); }
.chip-warn, .topbar .chip-warn { background: #ffb020; color: #3d2800; }
.chip-trial, .topbar .chip-trial { background: #7c3aed; color: #fff; }
.chip-expired, .topbar .chip-expired { background: var(--danger); color: #fff; }
.account-banner { padding: 8px 16px; font-size: 0.9rem; text-align: center; }
.account-banner.info { background: var(--info-bg); color: var(--info-text); }
.account-banner.warn { background: var(--warn-bg); color: var(--warn-text); }
.account-banner.danger { background: var(--bad-bg); color: var(--bad-text); }
.account-banner a { color: inherit; font-weight: 700; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* Gear icon with the settings panel (hover, click or keyboard) */
.settings-menu { position: relative; }
.gear-btn { display: grid; place-items: center; width: 36px; height: 36px; border: none; border-radius: 8px; background: transparent; color: #d0d8e2; cursor: pointer; }
.gear-btn:hover, .settings-menu:hover .gear-btn, .settings-menu.open .gear-btn { background: var(--head-hover); color: #fff; }
.gear-btn.active { background: var(--primary); color: #fff; }
.gear-btn:focus-visible { outline: 3px solid var(--focus); outline-offset: 1px; }
.settings-panel {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    z-index: 40;
    display: none;
    width: 270px;
    padding: 6px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--surface);
    color: var(--text);
    box-shadow: 0 16px 40px var(--shadow);
}
.settings-panel::before { content: ""; position: absolute; top: -10px; left: 0; right: 0; height: 10px; } /* hover bridge */
.settings-menu:hover .settings-panel, .settings-menu.open .settings-panel, .settings-menu:focus-within .settings-panel { display: block; }
.settings-panel a { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 9px 10px; border-radius: 8px; color: var(--text); text-decoration: none; }
.settings-panel a > span { display: flex; flex-direction: column; }
.settings-panel a:hover, .settings-panel a:focus-visible { background: var(--hover); outline: none; }
.settings-panel a.active { background: var(--primary-soft); }
.due { color: var(--danger); }
.brand .name { max-width: 340px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav { display: flex; flex-wrap: wrap; gap: 4px; margin-left: auto; }
.nav a { display: flex; align-items: center; gap: 6px; padding: 6px 10px; border-radius: 8px; color: #d0d8e2; text-decoration: none; font-weight: 600; }
.nav a:hover { background: var(--head-hover); color: #fff; }
.nav a.active { background: var(--primary); color: #fff; }

kbd {
    display: inline-block;
    padding: 1px 6px;
    border: 1px solid var(--kbd-border);
    border-bottom-width: 2px;
    border-radius: 5px;
    background: var(--kbd-bg);
    color: var(--label);
    font: 600 0.72rem/1.4 "Segoe UI", system-ui, sans-serif;
    white-space: nowrap;
    vertical-align: middle;
}
.nav kbd, .btn-primary kbd, .btn-success kbd, .btn-danger kbd, .tile-primary kbd {
    background: rgba(255, 255, 255, 0.18);
    border-color: rgba(255, 255, 255, 0.35);
    color: #fff;
}

/* ---------- layout ---------- */
main { max-width: 1100px; margin: 0 auto; padding: 24px 16px 60px; }
main.wide { max-width: 1300px; }
.page-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; }
.card + .card { margin-top: 12px; }
.card.flush { padding: 0; overflow: hidden; }
.notice { margin-bottom: 18px; padding: 14px 18px; border: 1px solid var(--notice-border); border-radius: var(--radius); background: var(--notice-bg); }
.notice.warn { border-color: var(--warn-border); background: var(--warn-bg); color: var(--warn-text); }
.empty { margin: 0; padding: 20px 16px; color: var(--muted); text-align: center; }

/* ---------- buttons ---------- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 7px 12px;
    border: 1.5px solid var(--border);
    border-radius: 8px;
    background: var(--surface);
    color: var(--text);
    font: inherit;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
}
.btn:hover { background: var(--hover); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn-primary { border-color: var(--primary); background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-hover); }
.btn-success { border-color: var(--success); background: var(--success); color: #fff; }
.btn-success:hover { background: var(--success-hover); }
.btn-danger { border-color: var(--danger); background: var(--danger); color: #fff; }
.btn-danger:hover { background: var(--danger-hover); }
.btn-danger-outline { border-color: color-mix(in srgb, var(--danger) 45%, transparent); color: var(--danger); }
.btn-sm { padding: 4px 8px; font-size: 0.85rem; }
.btn-lg { width: 100%; padding: 9px 14px; font-size: 1rem; }
.btn-icon { padding: 2px 8px; border: none; border-radius: 6px; background: none; color: var(--danger); font-size: 1.4rem; line-height: 1; cursor: pointer; }
.btn-icon:hover { background: var(--danger-soft); }

/* ---------- forms ---------- */
label { display: flex; flex-direction: column; gap: 4px; color: var(--label); font-size: 0.9rem; font-weight: 600; }
input, select, textarea {
    width: 100%;
    min-width: 0;
    padding: 7px 10px;
    border: 1.5px solid var(--border);
    border-radius: 8px;
    background: var(--surface);
    color: var(--text);
    font: inherit;
    font-size: 1rem;
    font-weight: 400;
}
input[type=number] { text-align: right; }
textarea { resize: vertical; font-family: inherit; line-height: 1.4; }
input:focus, select:focus, textarea:focus { border-color: var(--primary); }
input:focus, select:focus, textarea:focus, .btn:focus-visible, .btn-icon:focus-visible, a:focus-visible, .list-box:focus-visible {
    outline: 3px solid var(--focus);
    outline-offset: 1px;
}
input.invalid { border-color: var(--danger); background: var(--danger-soft); }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.form-stack { display: flex; flex-direction: column; gap: 10px; }
.form-error { margin: 0; color: var(--danger); font-weight: 600; }
.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-bottom: 10px; }
.toolbar .search { flex: 1 1 320px; }
.toolbar label.inline { flex-direction: row; align-items: center; gap: 8px; }
.toolbar label.inline input { width: auto; }
.segmented { display: flex; flex-wrap: wrap; gap: 6px; }
.segmented .btn.active { border-color: var(--primary); background: var(--primary-soft); color: var(--primary); }

/* ---------- tables ---------- */
.list-box { max-height: calc(100vh - 230px); min-height: 120px; overflow: auto; outline: none; }
table.list { width: 100%; border-collapse: collapse; }
table.list th {
    position: sticky;
    top: 0;
    z-index: 1;
    padding: 7px 12px;
    border-bottom: 2px solid var(--border);
    background: var(--surface-2);
    color: var(--muted);
    font-size: 0.8rem;
    letter-spacing: 0.03em;
    text-align: left;
    text-transform: uppercase;
}
table.list td { padding: 7px 12px; border-bottom: 1px solid var(--line); }
table.list tr[data-id] { cursor: pointer; }
table.list tbody tr:hover { background: var(--hover); }
table.list tr.selected, table.list tr.selected:hover { background: var(--selected); box-shadow: inset 4px 0 0 var(--focus); }
.num { text-align: right; white-space: nowrap; }
table.list th.num { text-align: right; }
th.actions, td.actions { width: 1%; text-align: right; white-space: nowrap; }
.summary { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 12px; padding: 8px 14px; border-top: 1px solid var(--border); background: var(--surface-2); font-weight: 600; }

/* ---------- home ---------- */
.shop-card { display: flex; align-items: center; gap: 14px; margin-bottom: 12px; }
.shop-card > div { flex: 1; min-width: 0; }
.shop-card h1 { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.shop-card p { margin: 2px 0 0; }
.shop-logo { width: 56px; height: 56px; border-radius: 10px; object-fit: contain; background: #fff; border: 1px solid var(--border); }

/* ---------- settings & signup ---------- */
.logo-row { display: flex; align-items: center; gap: 14px; }
.logo-preview { display: grid; place-items: center; flex: none; width: 84px; height: 84px; border: 1.5px dashed var(--border); border-radius: 10px; background: #fff; overflow: hidden; }
.logo-preview img { max-width: 100%; max-height: 100%; object-fit: contain; }
.account-grid { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; }
.account-card { display: grid; grid-template-columns: auto 1fr; gap: 12px 28px; align-items: center; }
.account-status { display: flex; flex-direction: column; gap: 2px; padding-right: 28px; border-right: 1px solid var(--line); }
.account-days { font-size: 1.6rem; line-height: 1.2; }
.account-days.warn { color: var(--warn-text); }
.account-help { grid-column: 1 / -1; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; padding-top: 12px; border-top: 1px solid var(--line); }
.help-card { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; }
.theme-options { display: flex; flex-wrap: wrap; gap: 10px; }
.theme-option { flex-direction: row; align-items: center; gap: 10px; padding: 8px 14px 8px 10px; border: 1.5px solid var(--border); border-radius: 10px; cursor: pointer; font-weight: 600; }
.theme-option input { width: auto; margin: 0; accent-color: var(--primary); }
.theme-option:has(input:checked) { border-color: var(--primary); background: var(--primary-soft); }
.theme-option:has(input:focus-visible) { outline: 3px solid var(--focus); outline-offset: 1px; }
.theme-swatch { width: 34px; height: 24px; border-radius: 6px; border: 1px solid var(--border); }
.theme-swatch-light { background: linear-gradient(#14202e 0 30%, #f2f4f7 30%); }
.theme-swatch-dark { background: linear-gradient(#0a1018 0 30%, #17212d 30%); }
.theme-swatch-system { background: linear-gradient(90deg, #f2f4f7 0 50%, #17212d 50%); }
@media (max-width: 600px) {
    .account-card { grid-template-columns: 1fr; }
    .account-status { padding-right: 0; border-right: none; }
}
label.check { flex-direction: row; align-items: center; gap: 8px; font-weight: 400; }
label.check input { width: auto; }

/* ---------- login ---------- */
.auth-page { min-height: 100vh; background: linear-gradient(#14202e, #14202e) top / 100% 190px no-repeat, var(--bg); }
main.auth { max-width: 520px; padding-top: 40px; }
.auth-brand { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; color: #fff; text-decoration: none; }
.auth-brand img { border-radius: 12px; }
.auth-brand .muted { color: #b8c4d3; }
.tabs { display: flex; gap: 4px; margin: -4px 0 14px; border-bottom: 2px solid var(--border); }
.tab { padding: 8px 16px; border: none; border-bottom: 3px solid transparent; margin-bottom: -2px; background: none; color: var(--muted); font: inherit; font-weight: 600; cursor: pointer; }
.tab.active { border-bottom-color: var(--primary); color: var(--primary); }
.auth-help { margin: 14px 0 0; color: var(--muted); font-size: 0.9rem; text-align: center; }
.link-btn { padding: 0; border: none; background: none; color: var(--primary); font: inherit; font-weight: 600; text-decoration: underline; cursor: pointer; }
.trial-card { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; }
main.narrow { max-width: 560px; }
.blocked-card { max-width: 560px; margin: 30px auto; text-align: center; }

/* ---------- admin ---------- */
.admin-table td { vertical-align: middle; }
.admin-table td.actions .btn { margin-left: 2px; }
.banner { display: block; width: 100%; height: auto; aspect-ratio: 2400 / 280; margin-bottom: 12px; border-radius: 10px; background: #090807; }
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 12px; margin: 0 0 12px; }
.tile {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
    padding: 12px 16px;
    border: 1.5px solid var(--border);
    border-radius: 12px;
    background: var(--surface);
    color: var(--text);
    text-decoration: none;
}
.tile:hover { border-color: var(--primary); }
.tile-icon { font-size: 1.5rem; line-height: 1; }
.tile-label { font-size: 1.1rem; font-weight: 700; }
.tile-desc { color: var(--muted); font-size: 0.85rem; }
.tile-primary { border-color: var(--primary); background: var(--primary); color: #fff; }
.tile-primary:hover { background: var(--primary-hover); }
.tile-primary .tile-desc { color: #dce7fb; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 12px; margin-bottom: 12px; }
.stat { padding: 8px 14px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
.stat-label { color: var(--muted); font-size: 0.8rem; font-weight: 600; text-transform: uppercase; }
.stat-value { margin-top: 2px; font-size: 1.3rem; font-weight: 700; }

/* ---------- billing ---------- */
.bill-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 14px; font-size: 1rem; }
.bill-meta label { flex-direction: row; align-items: center; gap: 8px; }
.bill-meta input { width: auto; }
.billing { display: grid; grid-template-columns: minmax(0, 1fr) 300px; align-items: start; gap: 12px; }
.billing-main .card + .card { margin-top: 12px; }
.billing-side { position: sticky; top: 58px; display: flex; flex-direction: column; gap: 8px; }
.section-title { display: flex; align-items: center; gap: 8px; }
.entry { display: grid; grid-template-columns: minmax(0, 1fr) 90px 130px auto; align-items: end; gap: 8px; margin-bottom: 10px; }
.entry-item { position: relative; }
.suggest {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    z-index: 30;
    max-height: 340px;
    margin: 4px 0 0;
    padding: 4px;
    overflow: auto;
    border: 1.5px solid var(--primary);
    border-radius: 8px;
    background: var(--surface);
    box-shadow: 0 12px 28px var(--shadow);
    list-style: none;
    font-weight: 400;
}
.suggest li { display: flex; justify-content: space-between; gap: 12px; padding: 7px 10px; border-radius: 6px; cursor: pointer; }
.suggest li small { margin-left: 6px; opacity: 0.7; }
.suggest li.active { background: var(--primary); color: #fff; }
.suggest li.none { color: var(--muted); font-size: 0.9rem; cursor: default; }
table.lines td { padding: 4px 8px; vertical-align: middle; }
table.lines input { width: 100px; padding: 4px 6px; }
th.idx, td.idx { width: 40px; color: var(--muted); }
.total-row { display: flex; flex-direction: row; align-items: center; justify-content: space-between; gap: 10px; font-size: 1rem; }
label.total-row input { width: 130px; }
.total-row.grand { padding-top: 8px; border-top: 2px solid var(--text); font-size: 1.35rem; }
.total-row .due { color: var(--danger); }
.side-actions { display: flex; flex-direction: column; gap: 6px; margin-top: 4px; }

/* ---------- dialogs, toasts, hint bar ---------- */
dialog { width: min(460px, calc(100vw - 32px)); padding: 18px; border: 1px solid var(--border); border-radius: 14px; background: var(--surface); color: var(--text); box-shadow: 0 24px 60px var(--shadow); }
dialog::backdrop { background: rgba(16, 24, 40, 0.45); }
dialog h2 { margin-bottom: 12px; }
.dialog-message { margin: 0; font-size: 1.05rem; white-space: pre-line; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 14px; }
.share-options, .contact-list { display: flex; flex-direction: column; gap: 8px; }
.contact-option { justify-content: flex-start; gap: 12px; padding: 8px 12px; font-weight: 400; text-align: left; }
.share-option { justify-content: flex-start; gap: 12px; padding: 8px 12px; text-align: left; font-weight: 400; }
.share-option > span:nth-child(2) { flex: 1; }
.share-icon { font-size: 1.3rem; line-height: 1; }
.toasts { position: fixed; right: 16px; bottom: 44px; z-index: 100; display: flex; flex-direction: column; gap: 8px; }
.toast { max-width: 380px; padding: 12px 16px; border-radius: 8px; background: var(--head); color: #fff; box-shadow: 0 8px 24px rgba(16, 24, 40, 0.25); animation: toast-in 0.2s ease-out; }
.toast.success { background: var(--success); }
.toast.error { background: var(--danger); }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } }
.hintbar {
    position: fixed;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: 10;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 4px 18px;
    padding: 5px 12px;
    border-top: 1px solid var(--border);
    background: var(--surface);
    color: var(--muted);
    font-size: 0.8rem;
}

/* ---------- printed bill ---------- */
.view-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin-bottom: 12px; }
.paper { max-width: 760px; margin: 0 auto; padding: 28px 36px; border: 1px solid var(--border); border-radius: 4px; background: #fff; color: #1b2230; color-scheme: light; }
.paper-head { margin-bottom: 16px; padding-bottom: 14px; border-bottom: 2px solid #1b2230; text-align: center; }
.paper-logo { display: block; width: 90px; height: auto; margin: 0 auto 8px; }
.paper.receipt .paper-logo { width: 56px; margin-bottom: 4px; }
.paper-head h2 { margin: 0 0 4px; font-size: 1.5rem; letter-spacing: 0.02em; text-transform: uppercase; }
.paper-head p { margin: 2px 0; color: #475467; }
.paper-meta { display: flex; justify-content: space-between; gap: 20px; margin-bottom: 18px; }
.paper-meta p { margin: 2px 0; }
.paper table { width: 100%; border-collapse: collapse; }
.paper th { padding: 8px 6px; border-bottom: 2px solid #1b2230; font-size: 0.85rem; text-align: left; }
.paper th.num { text-align: right; }
.paper td { padding: 7px 6px; border-bottom: 1px solid #e6e9ee; }
.paper-totals { width: min(300px, 100%); margin: 14px 0 0 auto; }
.paper-totals div { display: flex; justify-content: space-between; padding: 4px 0; }
.paper-totals .grand { margin-top: 4px; padding-top: 8px; border-top: 2px solid #1b2230; font-size: 1.25rem; font-weight: 700; }
.paper-foot { margin-top: 28px; color: #475467; font-size: 0.9rem; font-style: italic; text-align: center; }
.paper-credit { margin: 14px 0 0; color: #98a2b3; font-size: 0.75rem; text-align: center; }
.paper { position: relative; overflow: hidden; }
.watermark { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%) rotate(-30deg); color: rgba(198, 40, 40, 0.14); font-size: 7rem; font-weight: 800; letter-spacing: 0.1em; pointer-events: none; }
.paper.receipt { max-width: 80mm; padding: 16px; font-size: 12px; }
.paper.receipt .paper-head h2 { font-size: 16px; }
.paper.receipt .paper-meta { flex-direction: column; gap: 6px; }
.paper.receipt .paper-totals { width: 100%; }
.paper.receipt .paper-totals .grand { font-size: 15px; }

@media (max-width: 900px) {
    .billing { grid-template-columns: 1fr; }
    .billing-side { position: static; }
    .grid3 { grid-template-columns: 1fr; }
    .entry { grid-template-columns: 1fr 1fr; }
    .entry-item { grid-column: 1 / -1; }
}
@media (max-width: 600px) {
    .grid2 { grid-template-columns: 1fr; }
    .nav kbd, .hintbar { display: none; }
    .paper { padding: 20px; }
}

@media print {
    .account-banner { display: none !important; }
    html { font-size: 16px; }
    .topbar, .hintbar, .toasts, .view-actions, .no-print { display: none !important; }
    body { background: #fff; }
    main { max-width: none; padding: 0; }
    .paper { max-width: none; padding: 0; border: none; }
    .paper.receipt { max-width: none; }
}

/* ---------- analytics ---------- */
#report.loading { opacity: 0.55; transition: opacity 0.15s; }
.kpis { grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); }
.stat-delta { min-height: 1.2em; margin-top: 2px; color: var(--muted); font-size: 0.8rem; }
.stat-delta.up { color: var(--success); }
.stat-delta.down { color: var(--danger); }
.stat-hero .stat-value { font-size: 1.7rem; }
.stat-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 1.1rem; line-height: 1.6; }
.card-head { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: 10px; margin-bottom: 8px; }
.card-head h2 { margin: 0; }
.card-head p { margin: 2px 0 0; }
.card-head.padded { padding: 12px 14px 4px; margin: 0; }
.analytics-grid { margin-top: 12px; align-items: start; }
.analytics-grid .card + .card { margin-top: 0; }
.rank-table td { font-variant-numeric: tabular-nums; }
.rank-table .bar-col { width: 22%; }
.rank-bar { display: block; height: 8px; border-radius: 0 4px 4px 0; background: var(--chart); }
.walkin { margin: 0; padding: 8px 14px 12px; }
.chart { position: relative; }
.chart svg { display: block; overflow: visible; }
.chart-grid { stroke: var(--line); stroke-width: 1; }
.chart-base { stroke: var(--border); stroke-width: 1; }
.chart-tick { fill: var(--muted); font-size: 11px; font-variant-numeric: tabular-nums; }
.chart-value { fill: var(--text); font-size: 11px; font-weight: 700; }
.chart-bar { fill: var(--chart); }
.chart-bar.hover { fill: var(--chart-hover); }
.chart-hit { fill: transparent; cursor: default; outline: none; }
.chart-hit:focus-visible { stroke: var(--focus); stroke-width: 2; }
.chart-tooltip {
    position: absolute;
    z-index: 5;
    display: flex;
    flex-direction: column;
    padding: 6px 10px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--surface);
    box-shadow: 0 8px 20px var(--shadow);
    font-size: 0.8rem;
    color: var(--muted);
    pointer-events: none;
    white-space: nowrap;
}
.chart-tooltip strong { color: var(--text); font-size: 0.95rem; }
