:root {
    color-scheme: light;
    --serif: Didot, "Bodoni 72", "Playfair Display", "Iowan Old Style", Georgia, serif;
    --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;

    /* Colour scales shared with the WaveTeam portal */
    --navy-50: #eef5fc;
    --navy-100: #d6e6f7;
    --navy-200: #aecdee;
    --navy-600: #0f58a2;
    --navy-700: #0d4783;
    --navy-800: #0c3a6a;
    --navy-900: #0a2c50;
    --navy-950: #061a31;
    --teal-50: #effafa;
    --teal-100: #d5f2f3;
    --teal-300: #84d6d8;
    --teal-400: #5cc5c8;
    --teal-700: #286d71;
    --volt-50: #f3faec;
    --volt-100: #e3f3d3;
    --volt-400: #7bc443;
    --volt-700: #3d6720;
    --slate-100: #f1f5f9;
    --slate-300: #cbd5e1;
    --slate-400: #94a3b8;
    --slate-600: #475569;

    --bg: #f8fafc;
    --night: radial-gradient(900px 420px at 92% -10%, rgb(92 197 200 / 22%), transparent 62%),
             radial-gradient(700px 380px at 0% 110%, rgb(15 88 162 / 34%), transparent 60%),
             var(--navy-950);
    --strip: linear-gradient(90deg, var(--navy-600), var(--teal-400), var(--volt-400));
    --soft-blend: linear-gradient(105deg, var(--navy-50), var(--teal-50), var(--volt-50));
    --surface: #ffffff;
    --ink: var(--navy-900);
    --ink-soft: var(--navy-800);
    --muted: var(--slate-600);
    --line: #e2e8f0;
    --field: var(--slate-300);
    --danger: #be123c;
    --radius: 16px;
    --shadow: 0 1px 2px rgb(10 44 80 / 6%), 0 8px 24px rgb(10 44 80 / 7%);

    --accent: var(--navy-600);
    --accent-deep: var(--navy-800);
    --accent-soft: var(--navy-50);
    --accent-track: var(--navy-100);
}

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

body { margin: 0; background: var(--bg); color: var(--ink); font: 15px/1.45 var(--sans); }
a { color: var(--accent); }
h2 { display: flex; align-items: center; gap: 10px; margin: 0 0 16px; font-size: 16px; }
small { display: block; color: var(--muted); font-size: 12.5px; }
.icon { width: 1.25em; height: 1.25em; flex: none; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }

/* Shell */
.shell { display: grid; grid-template-columns: 232px minmax(0, 1fr); min-height: 100vh; }
main { width: 100%; max-width: 1480px; margin: 0 auto; padding: 24px 28px 40px; }

.sidebar {
    position: sticky;
    top: 0;
    height: 100vh;
    display: flex;
    flex-direction: column;
    padding: 22px 14px 14px;
    overflow: hidden;
    color: #fff;
    background: var(--night);
}
.brand { display: block; margin-bottom: 20px; padding: 10px; border-radius: 14px; background: #fff; }
.brand img { display: block; width: 100%; max-width: 150px; height: auto; margin: 0 auto; }
.login-brand em { font-style: normal; color: var(--teal-300); }
.sidebar nav { display: grid; gap: 4px; }
.sidebar nav a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 11px 12px;
    border-radius: 10px;
    color: var(--slate-300);
    font-weight: 500;
    text-decoration: none;
}
.sidebar nav a:hover { background: rgb(255 255 255 / 8%); color: #fff; }
.sidebar nav a.active { background: rgb(92 197 200 / 16%); color: #fff; font-weight: 600; box-shadow: inset 3px 0 0 var(--teal-400); }
.sidebar nav a.active .icon { color: var(--teal-300); }
.sidebar a:focus-visible, .sidebar button:focus-visible { outline-color: var(--teal-400); }
.sidebar small { color: var(--slate-400); }
.sidebar-bloom { position: absolute; left: -70px; bottom: 30px; width: 300px; height: 300px; color: var(--teal-400); opacity: 0.13; pointer-events: none; }
.account {
    position: relative;
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: auto;
    padding: 8px;
    border-radius: 12px;
    background: rgb(255 255 255 / 7%);
}
.account form { flex: none; }
.account-link { display: flex; flex: 1; align-items: center; gap: 10px; min-width: 0; padding: 2px; border-radius: 8px; color: inherit; text-decoration: none; }
.account-link:hover, .account-link.active { background: rgb(255 255 255 / 10%); }
.account-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; line-height: 1.2; }
.account .avatar { background: var(--teal-400); color: var(--navy-950); }

.avatar {
    display: inline-grid;
    place-items: center;
    flex: none;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: var(--accent-soft);
    color: var(--accent);
    font-weight: 700;
}
.icon-btn { display: inline-grid; place-items: center; width: 34px; height: 34px; border: 0; border-radius: 8px; background: none; color: inherit; cursor: pointer; }
.icon-btn:hover { background: rgb(255 255 255 / 14%); }

/* Section banner */
.hero {
    position: relative;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 16px;
    padding: 26px 30px 70px;
    overflow: hidden;
    border-radius: 20px;
    color: #fff;
    background: var(--night);
}
.hero > div, .hero > a { position: relative; }
.hero h1 { margin: 0; font: 400 38px/1.1 var(--serif); }
.hero p { margin: 6px 0 0; color: var(--slate-300); }
.hero-compact { padding-bottom: 26px; margin-bottom: 20px; }
.hero-bloom { position: absolute; right: 12%; top: -90px; width: 340px; height: 340px; color: var(--teal-400); opacity: 0.22; }
.hero-compact .hero-bloom { top: -120px; }

.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin: -46px 20px 20px; position: relative; }
.stats-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.stat { display: flex; align-items: center; gap: 12px; padding: 14px 16px; border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow); min-width: 0; }
.stat-icon { display: grid; place-items: center; flex: none; width: 42px; height: 42px; border-radius: 12px; background: var(--accent-soft); color: var(--accent); font-size: 16px; }
.stat:nth-child(even) .stat-icon { background: var(--teal-100); color: var(--teal-700); }
.stat dt { color: var(--muted); font-size: 13px; }
.stat dd { margin: 1px 0 0; font-size: 20px; font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }

.stats-flat { margin: 0 0 20px; }
.stats-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.stats-5 { grid-template-columns: repeat(6, minmax(0, 1fr)); }
.stats-5 .stat { grid-column: span 2; }
.stats-5 .stat:nth-child(-n+2) { grid-column: span 3; }
.stat dd.stat-note { margin-top: 2px; color: var(--muted); font-size: 12.5px; font-weight: 400; white-space: normal; }

/* Dashboard */
.period-bar { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 10px 16px; margin-bottom: 16px; }
.period-bar .tabs { margin: 0; }
.period-custom { display: flex; align-items: center; gap: 10px; }
.fy-picker label { display: flex; align-items: center; gap: 6px; margin: 0; white-space: nowrap; }
.fy-picker select { width: 112px; margin: 0; }
.fy-now { margin: 0 0 8px; }
.period-custom label { display: flex; align-items: center; gap: 6px; margin: 0; }
.period-custom input { width: 150px; margin: 0; }
.chart-card h2 { margin-bottom: 2px; }
.chart-sub { margin: 0 0 14px; color: var(--muted); font-size: 13px; }
.chart-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; margin-top: 20px; }
.trend { width: 100%; height: 270px; border-radius: 8px; }
.trend:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.trend svg { display: block; }
.trend .grid { stroke: var(--line); stroke-width: 1; }
.trend .axis { fill: var(--muted); font-size: 12px; }
.trend .area { fill: var(--accent); opacity: 0.1; }
.trend .line { fill: none; stroke: var(--accent); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.trend .cross { stroke: var(--slate-400); stroke-width: 1; }
.trend .dot { fill: var(--accent); stroke: var(--surface); stroke-width: 2; }
.chart-table { margin-top: 12px; font-size: 14px; }
.chart-table summary { color: var(--accent); cursor: pointer; }
.chart-table .table-wrap { max-height: 320px; margin-top: 8px; overflow-y: auto; }
.chart-table table { min-width: 420px; }
.rank { margin: 0; padding: 0; list-style: none; }
.rank li { display: grid; grid-template-columns: minmax(96px, 34%) minmax(0, 1fr) 96px; gap: 10px; align-items: center; min-height: 34px; padding: 3px 4px; border-radius: 6px; }
.rank li:hover { background: var(--navy-50); }
.rank li:focus-visible { outline: 2px solid var(--accent); }
.rank-label { min-width: 0; font-size: 14px; font-weight: 500; overflow-wrap: anywhere; }
.rank-label small { font-weight: 400; }
.rank-track { display: block; }
.rank-bar { display: block; min-width: 2px; height: 12px; border-radius: 0 4px 4px 0; background: var(--accent); }
.rank-value { font-size: 14px; font-weight: 600; font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; }
.section-title { display: block; margin: 26px 0 12px; font-size: 18px; }
.section-title small { display: inline; margin-left: 6px; font-weight: 400; }
.card-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 16px 18px 12px; }
.card-head h2 { margin: 0; }
.chart-tip { position: fixed; z-index: 10; max-width: 240px; padding: 8px 11px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); box-shadow: var(--shadow); pointer-events: none; }
.chart-tip strong, .chart-tip span, .chart-tip small { display: block; }
.chart-tip strong { font-size: 15px; font-variant-numeric: tabular-nums; }
.chart-tip span { font-size: 13px; }

/* Accounts */
.subnav { flex-wrap: wrap; margin-bottom: 16px; padding-bottom: 12px; border-bottom: 1px solid var(--line); }
.notice { display: flex; justify-content: space-between; align-items: center; gap: 16px; margin-bottom: 12px; padding: 12px 16px; border-radius: 10px; background: #fef3c7; color: #78350f; }
.notice strong { display: block; }
.notice .btn { flex: none; }
.quick-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.spaced { margin-top: 22px; }
.page-note { margin: 0 0 14px; color: var(--muted); }
.ledger-picker { display: flex; align-items: flex-end; gap: 10px; margin-bottom: 16px; }
.ledger-picker label { width: 320px; max-width: 100%; margin: 0; }
.entry-card { max-width: 960px; }
.journal-line { display: grid; grid-template-columns: minmax(0, 1fr) 150px 150px 32px; gap: 0 10px; align-items: start; }
.journal-line .line-remove { margin-top: 28px; }
.journal-totals { margin: 0; color: var(--muted); font-variant-numeric: tabular-nums; }
.journal-totals strong { color: var(--ink); }
.check { display: flex; align-items: center; gap: 8px; }
.check input { width: 18px; height: 18px; margin: 0; }
.report-card { max-width: 760px; margin: 0 auto; }
.report-period { margin: 0 0 12px; color: var(--muted); }
.report { min-width: 0; }
.report td { padding: 7px 4px; border-bottom: 0; }
.report th { background: none; padding: 7px 4px; }
.report a { color: var(--ink); text-decoration: none; }
.report a:hover { color: var(--accent); text-decoration: underline; }
.report tbody tr:hover { background: none; }
.report-heading td { padding-top: 16px; color: var(--muted); font-size: 12.5px; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; }
.report-total td { border-top: 1px solid var(--line); font-weight: 600; }
.report-key td { border-top: 1px solid var(--ink); border-bottom: 1px solid var(--ink); font-size: 16px; font-weight: 700; }
.report-check { margin: 14px 0 0; padding: 9px 12px; border-radius: 8px; font-weight: 600; }
.report-check.ok { background: var(--volt-100); color: var(--volt-700); }
.report-check.bad { background: #ffe4e6; color: #9f1239; }

@media print {
    .sidebar, .no-print, .hero .btn, .hero-bloom { display: none !important; }
    body { background: #fff; }
    .shell { display: block; }
    main { max-width: none; padding: 0; }
    .hero { padding: 0 0 12px; border-radius: 0; background: none; color: #000; }
    .hero p { color: #000; }
    .card { border: 0; box-shadow: none; background: none; }
    .report-card { max-width: none; }
}

/* Cards and layout */
.card { padding: 22px; border-top: 3px solid transparent; border-radius: var(--radius); background: linear-gradient(var(--surface), var(--surface)) padding-box, var(--strip) border-box; box-shadow: var(--shadow); }
.card-table { padding: 0; min-width: 0; overflow: hidden; }
.split { display: grid; grid-template-columns: 340px minmax(0, 1fr); gap: 20px; align-items: start; }
.sticky { position: sticky; top: 20px; }

/* Forms */
label, .field-label { display: block; margin-bottom: 14px; font-size: 13px; font-weight: 500; color: var(--muted); }
.field-label { margin-bottom: 6px; }
input, select {
    display: block;
    width: 100%;
    height: 40px;
    margin-top: 5px;
    padding: 0 11px;
    border: 1px solid var(--field);
    border-radius: 9px;
    background: var(--surface);
    color: var(--ink);
    font: inherit;
    font-size: 15px;
}
input:hover, select:hover { border-color: var(--slate-400); }
input:focus-visible, select:focus-visible, button:focus-visible, a:focus-visible, .chip input:focus-visible + span {
    outline: 2px solid var(--accent);
    outline-offset: 1px;
}
input[readonly] { background: var(--slate-100); border-color: var(--line); color: var(--muted); }
input.total { color: var(--ink); font-size: 17px; font-weight: 600; font-variant-numeric: tabular-nums; }

.grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0 14px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; }
.field { margin-bottom: 14px; }
.actions { display: flex; gap: 10px; margin-top: 6px; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { margin: 0; }
.chip input { position: absolute; width: 1px; height: 1px; margin: 0; opacity: 0; }
.chip span {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    height: 36px;
    padding: 0 13px;
    border: 1px solid var(--field);
    border-radius: 18px;
    color: var(--ink);
    font-size: 14px;
    cursor: pointer;
}
.chip span:hover { border-color: var(--accent); }
.chip input:checked + span { border-color: var(--accent); background: var(--accent); color: #fff; font-weight: 600; }

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    height: 40px;
    padding: 0 18px;
    border: 1px solid transparent;
    border-radius: 10px;
    font: inherit;
    font-weight: 600;
    text-decoration: none;
    white-space: nowrap;
    cursor: pointer;
}
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-deep); }
.btn-quiet { background: var(--surface); border-color: var(--field); color: var(--ink); }
.btn-quiet:hover { background: var(--navy-50); }
.btn-hero { background: var(--teal-400); color: var(--navy-950); }
.btn-hero:hover { background: var(--teal-300); }
.hero a:focus-visible { outline-color: #fff; }
.btn-block { width: 100%; }

/* Sale form */
.sale-layout { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 20px; align-items: start; }
.sale-main { display: grid; gap: 16px; }
.sale-main .card > :last-child, .sale-main .grid > label { margin-bottom: 8px; }
.step { display: grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; background: var(--teal-100); color: var(--teal-700); font-size: 13px; font-weight: 700; }
.summary { position: sticky; top: 20px; }
.summary h2 { margin-bottom: 6px; font: 400 22px var(--serif); }
.summary-item { min-height: 21px; margin: 0 0 14px; color: var(--muted); }
.summary dl { margin: 0; }
.summary dl div { display: flex; justify-content: space-between; gap: 12px; padding: 5px 0; font-variant-numeric: tabular-nums; }
.summary dt { color: var(--muted); }
.summary dd { margin: 0; }
.summary-total {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 12px;
    margin: 10px -22px 18px;
    padding: 14px 22px;
    background: var(--soft-blend);
    font-weight: 600;
}
.summary-total output { font-size: 24px; color: var(--accent-deep); font-variant-numeric: tabular-nums; white-space: nowrap; }

.line {
    display: grid;
    grid-template-columns: minmax(130px, 1fr) minmax(150px, 1.5fr) 76px 120px 104px 32px;
    gap: 0 10px;
    align-items: start;
    padding-bottom: 10px;
    margin-bottom: 10px;
    border-bottom: 1px solid var(--line);
}
.line label { margin-bottom: 0; }
.line-total { text-align: right; }
.line-total .field-label { margin-bottom: 5px; }
.line-amount { display: block; line-height: 40px; font-weight: 600; font-variant-numeric: tabular-nums; }
.line-remove { margin-top: 28px; }
.line-footer { display: flex; justify-content: space-between; align-items: flex-end; flex-wrap: wrap; gap: 12px; }
.line-footer label { width: 200px; margin-bottom: 0; }
.summary-lines { margin: 0 0 6px; padding: 0; list-style: none; font-variant-numeric: tabular-nums; }
.summary-lines li { display: flex; justify-content: space-between; gap: 12px; padding: 4px 0; }
.summary-lines li span:first-child { min-width: 0; overflow-wrap: anywhere; }

/* Status tabs and filters */
.tabs { display: flex; gap: 6px; margin-bottom: 14px; overflow-x: auto; padding: 2px; }
.tabs a {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    height: 36px;
    padding: 0 14px;
    border-radius: 18px;
    color: var(--muted);
    font-weight: 500;
    text-decoration: none;
    white-space: nowrap;
}
.tabs a:hover { background: var(--accent-soft); color: var(--accent-deep); }
.tabs a span { min-width: 22px; padding: 0 6px; border-radius: 10px; background: var(--navy-100); color: var(--ink); font-size: 12px; font-weight: 600; text-align: center; }
.tabs a.active { background: var(--accent); color: #fff; }
.tabs a.active span { background: rgb(255 255 255 / 22%); color: #fff; }

.filters { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 10px 12px; padding: 14px 16px; border-bottom: 1px solid var(--line); }
.filters label { margin: 0; min-width: 140px; }
.filters .grow { flex: 1 1 260px; }
.search-field { position: relative; display: block; }
.search-field .icon { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--muted); }
.search-field input { padding-left: 36px; }

/* Tables */
.table-wrap { overflow-x: auto; }
table { width: 100%; min-width: 760px; border-collapse: collapse; }
td.wide { min-width: 165px; }
td.medium { min-width: 140px; }
.sale-line + .sale-line { margin-top: 6px; }
.line-price { color: var(--muted); font-size: 12.5px; }
th { padding: 11px 8px; background: var(--navy-50); border-bottom: 1px solid var(--line); font-size: 12.5px; font-weight: 600; color: var(--muted); text-align: left; white-space: nowrap; }
td { padding: 10px 8px; border-bottom: 1px solid var(--line); vertical-align: middle; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: var(--teal-50); }
.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.strong { font-weight: 600; }
.negative { color: var(--danger); font-weight: 600; }
.nowrap { white-space: nowrap; }
.no-invoice { color: var(--muted); }
.person { display: flex; align-items: center; gap: 10px; }
.referral { display: inline-flex; align-items: center; gap: 5px; }
.referral .icon { color: var(--muted); }
.date-chip { display: inline-flex; align-items: center; gap: 8px; color: var(--muted); font-size: 13px; white-space: nowrap; }
.date-chip b { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 9px; background: var(--teal-100); color: var(--navy-800); font-size: 14px; }

.row-actions { white-space: nowrap; text-align: right; }
td.row-actions { position: sticky; right: 0; background: var(--surface); }
tbody tr:hover td.row-actions { background: var(--teal-50); }
.row-actions form, .product-actions form { display: inline; }
.icon-link { display: inline-grid; place-items: center; width: 32px; height: 32px; padding: 0; border: 0; border-radius: 8px; background: none; color: var(--muted); cursor: pointer; vertical-align: middle; }
.icon-link:hover { background: var(--accent-soft); color: var(--accent); }
.icon-link.danger:hover { background: #ffe4e6; color: var(--danger); }

select.pill { width: auto; height: 30px; margin: 0; padding: 0 6px; border: 0; border-radius: 15px; font-size: 13px; font-weight: 600; cursor: pointer; }
.pill-in-progress, .pill-pending { background: #fef3c7; color: #78350f; }
.pill-handed-to-delivery { background: var(--navy-100); color: var(--navy-700); }
.pill-rescheduled { background: var(--teal-100); color: var(--teal-700); }
.pill-delivered, .pill-received { background: var(--volt-100); color: var(--volt-700); }
.pill-cancelled { background: var(--slate-100); color: var(--slate-600); }
.pill-returned, .pill-refund { background: #ffe4e6; color: #9f1239; }

/* Product cards */
.catalogue-search { margin-bottom: 14px; }
.catalogue-search input { margin-top: 0; }
.products { display: grid; grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); gap: 16px; }
.product { position: relative; padding: 18px; border-top: 3px solid transparent; border-radius: var(--radius); background: linear-gradient(var(--surface), var(--surface)) padding-box, var(--strip) border-box; box-shadow: var(--shadow); transition: transform 0.15s ease; }
.product:hover { transform: translateY(-2px); }
.product-head { display: flex; gap: 12px; padding-right: 58px; }
.monogram { display: grid; place-items: center; flex: none; width: 52px; height: 52px; border-radius: 14px; background: linear-gradient(140deg, var(--navy-100), var(--teal-100)); color: var(--navy-800); font: 400 26px var(--serif); }
.product-code { color: var(--muted); font-size: 12.5px; font-weight: 600; }
.product h3 { margin: 1px 0 0; font-size: 15.5px; line-height: 1.3; overflow-wrap: anywhere; }
.product-price { margin: 14px 0 0; font-size: 21px; font-weight: 600; font-variant-numeric: tabular-nums; }
.product-price-missing { font-size: 16px; color: var(--muted); }
.product-cost { margin: 1px 0 0; font-size: 13px; font-variant-numeric: tabular-nums; }
.product-buyer { margin: 0 0 14px; color: var(--muted); font-size: 13px; }
.product-stock { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 6px; margin-top: 9px; font-size: 13px; color: var(--muted); }
.product-stock strong { color: var(--ink); }
.product-actions { position: absolute; top: 10px; right: 10px; display: flex; }

.meter { height: 8px; overflow: hidden; border-radius: 4px; background: var(--accent-track); }
.meter span { display: block; height: 100%; border-radius: 4px; background: var(--accent); }
.meter-low { background: #fef3c7; }
.meter-low span { background: #f59e0b; }
.meter-out { background: #ffe4e6; }
.meter-none { background: var(--line); }

.badge { display: inline-flex; align-items: center; gap: 4px; padding: 2px 9px 2px 6px; border-radius: 11px; font-size: 12.5px; font-weight: 600; white-space: nowrap; }
.badge .icon { width: 14px; height: 14px; }
.badge-ok { background: var(--volt-100); color: var(--volt-700); }
.badge-low { background: #fef3c7; color: #78350f; }
.badge-out { background: #ffe4e6; color: #9f1239; }
.badge-none { background: var(--slate-100); color: var(--slate-600); }
.badge-admin { background: var(--navy-100); color: var(--navy-700); }
.badge-staff { background: var(--teal-100); color: var(--teal-700); }

/* Users */
.user-list { margin: 0; padding: 0; list-style: none; }
.user-list li { display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.user-list li:last-child { border-bottom: 0; }
.user-name { flex: 1; min-width: 0; overflow-wrap: anywhere; font-weight: 600; }
.user-name em { margin-left: 4px; color: var(--muted); font-size: 12.5px; font-style: normal; font-weight: 500; }
.user-list .row-actions { min-width: 68px; }
.hint { margin-top: 5px; font-weight: 400; }
.form-hint { margin: -6px 0 14px; }
.narrow { max-width: 460px; }
.narrow + .narrow { margin-top: 16px; }
.narrow .actions { flex-wrap: wrap; }

/* Messages */
.alert { padding: 11px 15px; margin-bottom: 16px; border-radius: 10px; }
.alert ul { margin: 0; padding-left: 18px; }
.alert-success { background: var(--volt-100); color: var(--volt-700); }
.alert-error { background: #ffe4e6; color: #9f1239; }

.empty { padding: 36px 20px; text-align: center; color: var(--muted); }
.empty .bloom { width: 76px; height: 76px; color: var(--accent); stroke-width: 1.4; opacity: 0.7; }
.empty p { max-width: 340px; margin: 10px auto 0; }

.pager { display: flex; align-items: center; justify-content: center; gap: 14px; padding: 12px; border-top: 1px solid var(--line); color: var(--muted); }

/* Login */
.login-page { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); min-height: 100vh; background: var(--surface); }
.login-art {
    position: relative;
    display: flex;
    align-items: flex-end;
    padding: 48px;
    overflow: hidden;
    color: #fff;
    background: var(--night);
}
.login-bloom { position: absolute; top: 50%; left: 50%; width: min(92%, 620px, 72vh); aspect-ratio: 1; height: auto; transform: translate(-50%, -62%); color: var(--teal-400); opacity: 0.42; }
.login-art > div { position: relative; }
.login-brand { margin: 0; font: 400 52px/1.1 var(--serif); }
.login-tagline { margin: 8px 0 0; font-size: 17px; color: var(--slate-300); }
.login-panel { display: grid; place-items: center; padding: 32px 24px; }
.login-form { width: 100%; max-width: 360px; }
.login-logo { display: block; width: 190px; height: auto; margin: 0 auto 22px; }
.login-form h1 { margin: 0; font: 400 36px/1.15 var(--serif); }
.login-intro { margin: 8px 0 24px; color: var(--muted); }
.login-form .btn { margin-top: 8px; height: 44px; }
.qr-box { width: 200px; height: 200px; margin: 0 auto 12px; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; background: #fff; }
.qr-box svg { display: block; width: 100%; height: 100%; }
.manual-key { margin-bottom: 16px; color: var(--muted); font-size: 14px; }
.manual-key summary { cursor: pointer; text-align: center; }
.manual-key p { margin: 8px 0 4px; }
.manual-key code { display: block; color: var(--ink); font-size: 13px; overflow-wrap: anywhere; }
.code-input { font-variant-numeric: tabular-nums; letter-spacing: .08em; }
.recovery-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px 16px; margin: 14px 0; padding: 0; list-style: none; font: 15px/1.5 ui-monospace, Menlo, Consolas, monospace; }
.password-field { position: relative; display: block; }
.password-field input { padding-right: 42px; }
.password-field .icon-btn { position: absolute; right: 3px; top: 3px; color: var(--muted); }
.password-field .icon-btn:hover { background: var(--navy-50); }

/* Smaller screens */
@media (max-width: 1180px) {
    .split, .sale-layout, .chart-grid { grid-template-columns: minmax(0, 1fr); }
    .sticky, .summary { position: static; }
}
@media (max-width: 860px) {
    .line { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; position: relative; }
    .line-desc { grid-column: span 2; order: 1; }
    .line label:first-child { grid-column: span 2; padding-right: 40px; }
    .line > label, .line-total { order: 2; }
    .line-desc { order: 2; }
    .line-total { grid-column: span 2; display: flex; justify-content: space-between; align-items: center; order: 3; }
    .line-total .field-label { margin: 0; }
    .line-remove { position: absolute; top: 0; right: 0; }
    .shell { grid-template-columns: minmax(0, 1fr); }
    .sidebar { position: static; height: auto; flex-direction: row; flex-wrap: wrap; align-items: center; gap: 8px; padding: 10px 16px; }
    .brand { margin: 0 auto 0 0; padding: 4px 8px; border-radius: 10px; }
    .brand img { width: auto; height: 44px; }
    .sidebar nav { display: flex; order: 3; width: 100%; }
    .sidebar nav a { flex: 1; justify-content: center; padding: 8px; gap: 6px; }
    .sidebar-bloom { display: none; }
    .account { margin: 0; padding: 0; background: none; }
    .account-link { flex: none; }
    .account-name { display: none; }
    .stats, .stats-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .stats-3 .stat:last-child { grid-column: span 2; }
    .stats-5 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .stats-5 .stat, .stats-5 .stat:nth-child(-n+2) { grid-column: auto; }
    .stats-5 .stat:last-child { grid-column: span 2; }
    .sidebar nav a { font-size: 14px; }
    .login-page { grid-template-columns: minmax(0, 1fr); grid-template-rows: 190px 1fr; }
    .login-art { padding: 22px 24px; }
    .login-brand { font-size: 36px; }
    .login-tagline { font-size: 15px; }
}
@media (max-width: 560px) {
    main { padding: 16px 16px 32px; }
    .hero { padding: 20px 20px 62px; }
    .hero-compact { padding-bottom: 20px; }
    .hero h1 { font-size: 30px; }
    .stats { margin: -44px 10px 16px; gap: 10px; }
    .stat { padding: 11px; gap: 9px; }
    .stat-icon { display: none; }
    .stat dd { font-size: 16px; }
    .grid, .grid-2, .grid-4 { grid-template-columns: minmax(0, 1fr); }
    .filters label { flex: 1 1 100%; }
    .sidebar nav a { gap: 4px; padding: 8px 4px; font-size: 13px; }
    .sidebar nav a .icon { display: none; }
    .stats-flat { margin: 0 0 16px; }
    .notice { flex-direction: column; align-items: flex-start; }
    .journal-line { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 0 10px; }
    .journal-line label:first-child { grid-column: span 2; }
    .journal-line .line-remove { grid-column: span 2; margin: 0 0 10px auto; }
    .period-custom { flex-wrap: wrap; }
    .period-custom input { width: 136px; }
    .rank li { grid-template-columns: minmax(84px, 36%) minmax(0, 1fr) 84px; }
}
@media (prefers-reduced-motion: reduce) {
    .product { transition: none; }
    .product:hover { transform: none; }
}
