:root {
    --ink: #1c1915;
    --ink-soft: #4e463c;
    --muted: #746b60;
    --line: #e4d9c8;
    --paper: #f3eee6;
    --paper-deep: #e7dfd2;
    --card: #fffcf8;
    --forest: #1b3029;
    --forest-2: #25443a;
    --leaf: #2f6a52;
    --gold: #c6a15a;
    --gold-2: #e7c27a;
    --danger: #8d2f2f;
    --ok: #1f6b45;
    --shadow: 0 18px 40px rgba(48, 36, 18, 0.08);
    --sidebar: 272px;
    --serif: "Fraunces", Georgia, "Times New Roman", serif;
    --sans: "Outfit", "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
    min-height: 100vh;
    color: var(--ink);
    background: var(--paper);
    font-family: var(--sans);
    font-size: 15px;
    line-height: 1.5;
}
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }

.shell { display: flex; min-height: 100vh; }
.sidebar {
    width: var(--sidebar);
    flex: 0 0 var(--sidebar);
    background:
        radial-gradient(1200px 400px at -10% -10%, rgba(198, 161, 90, 0.18), transparent 50%),
        var(--forest);
    color: #f6f1e7;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow: auto;
    padding: 22px 16px 28px;
}
.brand {
    display: flex;
    gap: 12px;
    align-items: center;
    padding: 4px 8px 18px;
}
.brand-mark {
    width: 42px;
    height: 42px;
    border-radius: 12px;
    display: grid;
    place-items: center;
    background: rgba(231, 194, 122, 0.12);
    border: 1px solid rgba(231, 194, 122, 0.35);
}
.brand-kicker {
    display: block;
    font-size: 11px;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: var(--gold-2);
}
.brand-name {
    display: block;
    font-family: var(--serif);
    font-size: 22px;
    font-weight: 560;
    line-height: 1;
}
.side-link, .nav-link {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 9px 12px;
    border-radius: 10px;
    color: #e7efe9;
    font-size: 14.5px;
}
.side-link:hover, .nav-link:hover { background: rgba(255, 255, 255, 0.06); }
.side-link.is-current, .nav-link.is-current {
    background: rgba(231, 194, 122, 0.16);
    color: #f8edd4;
}
.nav-group { margin-top: 18px; }
.nav-label {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    width: 100%;
    margin: 0 0 6px;
    padding: 4px 12px;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: #c9d5ce;
    font: inherit;
    font-size: 11px;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    text-align: left;
    cursor: pointer;
}
.nav-label:hover { background: rgba(255, 255, 255, 0.06); color: #f8edd4; }
.nav-group.is-collapsed .nav-group-body { display: none; }
.nav-group.is-collapsed > .nav-label .nav-chevron,
.nav-branch.is-collapsed .nav-caret .nav-chevron { transform: rotate(-90deg); }
.nav-chevron { flex: none; transition: transform .15s ease; }
.nav-row { display: flex; align-items: center; gap: 2px; }
.nav-row > .nav-link { flex: 1; min-width: 0; }
.nav-caret {
    flex: 0 0 auto;
    width: 28px;
    height: 28px;
    display: grid;
    place-items: center;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: #d5e3da;
    cursor: pointer;
}
.nav-caret:hover { background: rgba(255, 255, 255, 0.08); }
.nav-branch.is-collapsed .nav-subs { display: none; }
.nav-subs { display: grid; gap: 1px; margin: 2px 0 8px; }
.nav-sub-label {
    margin: 8px 12px 2px 22px;
    font-size: 10px;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: #b7c6bd;
}
.nav-sub {
    display: block;
    padding: 5px 12px 5px 22px;
    border-radius: 8px;
    color: #d5e3da;
    font-size: 13px;
    line-height: 1.35;
}
.nav-sub:hover { background: rgba(255, 255, 255, 0.06); }
.nav-sub.is-current { background: rgba(231, 194, 122, 0.16); color: #f8edd4; }
.nav-link small, .chip {
    font-size: 10px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--gold-2);
}
.main { flex: 1; min-width: 0; overflow: hidden; }
.topbar {
    height: 68px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 0 28px;
    border-bottom: 1px solid transparent;
}
.who { display: flex; align-items: center; gap: 12px; margin-left: auto; flex: 0 0 auto; }
.who-name { font-weight: 600; }
.who-role { color: var(--muted); font-size: 13px; }
.top-search,
.top-search-spacer {
    flex: 1 1 auto;
    display: flex;
    justify-content: center;
    max-width: 420px;
    margin: 0 auto;
    min-width: 0;
}
.top-search input {
    width: min(100%, 360px);
    height: 40px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: var(--card);
    padding: 0 16px;
    outline: none;
}
.top-search input:focus { border-color: #cfc3b0; }
.top-chat {
    position: relative;
    width: 40px;
    height: 40px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
    border: 1px solid var(--line);
    background: var(--card);
    color: var(--ink);
}
.top-chat:hover { border-color: #cfc3b0; }
.top-chat.is-current {
    background: var(--forest);
    border-color: var(--forest);
    color: #f6f1e7;
}
.top-chat-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    border-radius: 999px;
    background: #ed4956;
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    line-height: 18px;
    text-align: center;
    border: 2px solid var(--paper);
    box-sizing: border-box;
}
.top-chat-badge[hidden] { display: none !important; }
.top-chat.is-current .top-chat-badge { border-color: var(--paper); }
.nav-toggle {
    display: none;
    flex: 0 0 auto;
    border: 1px solid var(--line);
    background: var(--card);
    border-radius: 10px;
    padding: 8px 12px;
}
.content { padding: 6px 28px 56px; }
.page-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    gap: 16px;
    margin-bottom: 18px;
}
.eyebrow {
    margin: 0 0 4px;
    color: var(--leaf);
    font-size: 12px;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    font-weight: 600;
}
h1 {
    margin: 0;
    font-family: var(--serif);
    font-size: 36px;
    font-weight: 560;
    letter-spacing: -0.03em;
    line-height: 1.1;
}
h1.rate-title { font-size: 52px; }
.lede { margin: 8px 0 0; max-width: 62ch; color: var(--ink-soft); }
.page-actions { display: flex; gap: 8px; flex-wrap: wrap; }

.btn[hidden] { display: none !important; }
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    border-radius: 11px;
    border: 1px solid transparent;
    padding: 10px 14px;
    background: transparent;
    text-decoration: none;
    line-height: 1;
}
.btn-primary { background: var(--forest); color: #f7f3ea; }
.btn-primary:hover { background: var(--forest-2); }
.btn-ghost { border-color: var(--line); background: var(--card); }
.btn-ghost:hover { border-color: #cfc3b0; }
.btn-danger { color: var(--danger); border-color: #efd4d4; background: #fff8f8; }
.btn-small { padding: 7px 10px; border-radius: 9px; font-size: 13px; }

.flash {
    background: #e7f4ec;
    color: #145233;
    border: 1px solid #c7e6d4;
    padding: 12px 14px;
    border-radius: 12px;
    margin-bottom: 16px;
}
.flash.is-warn {
    background: #f8f1e2;
    color: #8a6a2f;
    border-color: #ead9b4;
}
.flash.is-warn strong { display: block; margin-bottom: 6px; }
.linked-notes-list {
    margin: 0;
    padding-left: 1.2em;
}
.linked-notes-list li + li { margin-top: 4px; }
.form-errors {
    background: #fdf2f2;
    color: var(--danger);
    border: 1px solid #f0d0d0;
    padding: 12px 14px;
    border-radius: 12px;
    margin-bottom: 16px;
}

.stats {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 12px;
    margin-bottom: 22px;
}
.stat {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 16px;
    padding: 16px 16px 14px;
    box-shadow: var(--shadow);
}
.stat span { color: var(--muted); font-size: 13px; }
.stat em { display: block; margin-top: 4px; color: var(--muted); font-style: normal; font-size: 13px; }
.report-figure { margin-top: 6px; font-family: var(--serif); font-size: 22px; font-weight: 560; }
table.data th .muted { letter-spacing: 0; text-transform: none; font-weight: 500; }
.stat strong {
    display: block;
    margin-top: 6px;
    font-family: var(--serif);
    font-size: 32px;
    font-weight: 560;
    letter-spacing: -0.03em;
}
a.stat { transition: border-color 0.15s ease, box-shadow 0.15s ease; }
a.stat:hover { border-color: #d9c7a4; }
a.stat.is-selected {
    border-color: var(--gold);
    box-shadow: 0 0 0 1px rgba(198, 161, 90, 0.35), var(--shadow);
}
.audit-year-grids {
    grid-template-columns: repeat(5, minmax(0, 1fr));
}
.audit-year-grids .stat {
    padding: 12px 12px 10px;
    border-radius: 12px;
}
.audit-year-grids .stat strong { font-size: 22px; margin-top: 4px; }
.audit-year-grids .stat span { font-size: 12px; }
.audit-year-grids .stat em { font-size: 11px; margin-top: 2px; }
#bifurcation {
    max-width: 100%;
    height: auto;
    overflow: hidden;
    padding-bottom: 8px;
}
#bifurcation .panel-head {
    padding: 10px 14px 0;
}
#bifurcation .panel-head h2 { font-size: 15px; }
#bifurcation .table-wrap {
    margin-top: 6px;
    max-height: min(16rem, calc(100vh - 18rem));
    overflow: auto;
}
#bifurcation table.data {
    min-width: 0;
    width: 100%;
    table-layout: fixed;
}
#bifurcation table.data th,
#bifurcation table.data td {
    padding: 7px 12px;
    font-size: 13px;
    white-space: normal;
}
#bifurcation .empty {
    padding: 10px 12px;
}
.panel {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 18px;
    box-shadow: var(--shadow);
}
.panel-head {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    align-items: baseline;
    padding: 16px 18px 0;
}
.panel-head h2 {
    margin: 0;
    font-size: 16px;
    font-weight: 620;
}
.panel-head p { margin: 4px 0 0; color: var(--muted); font-size: 13px; }
.rate-freight-gap { margin-top: 1in; }
.freight-note { padding: 10px 18px 2px; text-align: left; }
.freight-note strong { display: block; font-size: 13px; font-weight: 600; }
.freight-note p { margin: 4px 0 0; color: var(--muted); font-size: 13px; line-height: 1.55; text-align: left; }
.freight-boxes { display: flex; flex-direction: column; gap: 8px; padding: 10px 18px 14px; }
.freight-box { border: 1px solid var(--line); border-radius: 8px; background: #fff; padding: 8px 10px; }
.freight-box-head { display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: flex-end; margin-bottom: 6px; }
.freight-box-head .field { width: 10.5rem; }
.freight-city { font-size: 14px; font-weight: 650; min-width: 5.5rem; padding-bottom: 4px; }
.freight-box-actions { margin-left: auto; display: flex; align-items: center; gap: 6px; }
.freight-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(96px, 1fr));
    gap: 4px;
}
.freight-stack { display: contents; }
.freight-cell {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    justify-content: center;
    gap: 1px;
    border: 1px solid transparent;
    border-radius: 4px;
    padding: 4px 7px;
    min-height: 38px;
    aspect-ratio: 2.1 / 1;
    color: #1c1915;
}
.freight-cell span {
    display: block;
    color: #1c1915;
    font-size: 9px;
    line-height: 1.15;
    letter-spacing: 0.01em;
    width: 100%;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.freight-cell strong {
    display: block;
    margin-top: 0;
    min-height: 0;
    font-size: 12px;
    font-weight: 650;
    font-variant-numeric: tabular-nums;
    color: #1c1915;
    white-space: nowrap;
    line-height: 1.2;
}
.freight-can .freight-cell { background: #d9f3e2; border-color: #b7e0c6; }
.freight-bottle500 .freight-cell { background: #d7e8f8; border-color: #b7d2ec; }
.freight-bottle750 .freight-cell { background: #ffe3c4; border-color: #f3c99a; }
.freight-calc-row {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 6px 8px;
    flex: 1 1 auto;
    min-width: 0;
}
.freight-calc-field { width: 7.5rem; margin: 0; }
.freight-calc-field input { width: 100%; }
.freight-calc-pill {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 1px;
    min-width: 6.5rem;
    min-height: 38px;
    padding: 4px 8px;
    border: 1px solid #c9d6c4;
    border-radius: 4px;
    background: #eef6ea;
}
.freight-calc-pill span { font-size: 9px; line-height: 1.15; color: #1c1915; }
.freight-calc-pill strong {
    font-size: 13px;
    font-weight: 650;
    font-variant-numeric: tabular-nums;
    line-height: 1.2;
    color: #1c1915;
}
.freight-calc-total { background: #d9f3e2; border-color: #b7e0c6; }
.freight-editor { padding: 10px 18px 8px; border-bottom: 1px solid var(--line); }
.freight-editor-grid {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 8px 10px;
}
.freight-editor-grid .field { width: 11rem; margin: 0; }
.freight-editor-active { margin: 0 0 2px; padding-bottom: 8px; }
.freight-editor-actions { margin-left: auto; display: flex; align-items: center; gap: 8px; padding-bottom: 2px; }
.freight-editor-preview { margin-top: 8px; }
.bar-chart { display: flex; align-items: flex-end; gap: 8px; min-height: 230px; padding: 8px 18px 4px; }
.bar-col { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; min-width: 0; height: 210px; }
.bar { display: block; width: 100%; max-width: 42px; background: var(--forest); border-radius: 8px 8px 3px 3px; }
.bar.is-empty { background: var(--paper-deep); }
.bar-year { background: #c6a15a; }
.bar-year.is-current { background: var(--forest); }
.bar-value { min-height: 16px; margin-bottom: 4px; font-size: 11px; font-variant-numeric: tabular-nums; }
.bar-label { margin-top: 6px; font-size: 11px; color: var(--muted); text-align: center; }
@media (max-width: 800px) {
    .freight-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .freight-cell { aspect-ratio: auto; min-height: 36px; }
}
@media (max-width: 520px) {
    .freight-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
.access-grid, .card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 12px;
    padding: 16px;
}
.access-card {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
    min-height: 118px;
    padding: 14px;
    border-radius: 14px;
    border: 1px solid var(--line);
    background: #fff;
}
.access-card:hover { border-color: #d9c7a4; }
.access-card strong { font-size: 15px; }
.access-card em { font-style: normal; color: var(--muted); font-size: 13px; }

.toolbar {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    align-items: flex-end;
    margin-bottom: 12px;
}
.toolbar input, .toolbar select, .field input, .field select, .field textarea {
    width: 100%;
    background: #fff;
    border: 1px solid #ddd3c4;
    border-radius: 11px;
    padding: 11px 12px;
    outline: none;
}
.toolbar input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]),
.toolbar select,
.toolbar .btn,
.toolbar .icon-btn,
.toolbar .annual-compare-toggle {
    box-sizing: border-box;
    height: 44px;
    min-height: 44px;
}
.toolbar input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]),
.toolbar select {
    padding: 0 12px;
}
.toolbar .btn {
    padding: 0 16px;
}
.toolbar .icon-btn {
    width: 44px;
    padding: 0;
}
.toolbar input[type="checkbox"],
.toolbar input[type="radio"] {
    width: auto;
    height: auto;
    min-height: 0;
    max-width: none;
    padding: 0;
}
.toolbar .annual-compare-toggle {
    padding: 0 12px;
}
.toolbar input { max-width: 320px; }
.toolbar select { max-width: 180px; }
.field input:focus, .field select:focus, .field textarea:focus, .toolbar input:focus, .toolbar select:focus {
    border-color: #b89a58;
    box-shadow: 0 0 0 3px rgba(198, 161, 90, 0.2);
}
.field input[readonly] {
    background: #f6f1e8;
    color: var(--ink-soft);
}
.table-wrap { overflow-x: auto; max-width: 100%; }
table.data { width: 100%; border-collapse: collapse; min-width: 760px; }
table.data th { white-space: nowrap; }
#results .table-wrap { overflow-x: auto; }
#results table.data { min-width: 760px; }
#results table.data th,
#results table.data td {
    white-space: nowrap;
}
.row-actions { white-space: nowrap; }
table.data th {
    text-align: left;
    font-size: 12px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--muted);
    font-weight: 600;
    padding: 12px 14px;
    background: #f7f1e8;
    border-bottom: 1px solid var(--line);
}
table.data td {
    padding: 13px 14px;
    border-bottom: 1px solid #f0e8dc;
    vertical-align: middle;
}
table.data tr:last-child td { border-bottom: 0; }
table.data tbody tr:hover td { background: #fffaf3; }
.row-actions { display: flex; gap: 6px; justify-content: flex-end; align-items: center; }
.row-actions .row-actions { display: contents; }
.row-actions form { display: inline-flex; margin: 0; }
.icon-btn {
    width: 34px;
    height: 34px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    border: 1px solid var(--line);
    background: #fff;
    color: var(--ink-soft);
    padding: 0;
}
.icon-btn:hover { border-color: #c4b49a; color: var(--ink); }
.icon-btn-danger { color: var(--danger); border-color: #efd4d4; background: #fff8f8; }
.icon-btn-danger:hover { border-color: #e4b4b4; color: #6f2222; }
.muted { color: var(--muted); }
.code { font-variant-numeric: tabular-nums; letter-spacing: 0.02em; }

.pill {
    display: inline-flex;
    align-items: center;
    border-radius: 999px;
    padding: 3px 8px;
    font-size: 11px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    font-weight: 650;
    background: #f3eee6;
    color: var(--ink-soft);
}
.pill-live { background: #e5f3eb; color: var(--ok); }
.pill-next { background: #f6efe2; color: #8a6a2f; }
.pill-off { background: #f4e8e8; color: var(--danger); }

.empty {
    padding: 28px 16px;
    text-align: center;
    color: var(--muted);
}
.pager {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 16px 16px;
}
.pager-link {
    border: 1px solid var(--line);
    background: #fff;
    border-radius: 10px;
    padding: 8px 12px;
}
.pager-link.is-disabled { opacity: 0.45; }
.pager-status { color: var(--muted); font-size: 13px; }

.form-card { padding: 18px; }
.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px 18px;
}
.field { display: flex; flex-direction: column; gap: 6px; }
.field[hidden], .field-span[hidden] { display: none; }
.field span { font-size: 13px; font-weight: 600; }
.eyebrow a { color: inherit; text-decoration: none; }
.spaced { margin-bottom: 16px; }
.field-span { grid-column: 1 / -1; }
.form-section { grid-column: 1 / -1; margin-top: 4px; padding-top: 12px; border-top: 1px solid var(--line); }
.form-section:first-child { margin-top: 0; padding-top: 0; border-top: 0; }
.form-section h2 { margin: 0; font-family: var(--serif); font-size: 22px; font-weight: 560; }
.form-section p { margin: 4px 0 0; color: var(--muted); font-size: 13px; }
.file-note { color: var(--muted); font-size: 12px; }
.proof-link { font-size: 13px; }
.proof-board > span { display: block; margin-bottom: 8px; }
.proof-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 12px;
    margin: 0 0 12px;
}
.proof-grid-typed {
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
}
.proof-slot {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 10px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: var(--card);
}
.proof-slot > strong {
    font-size: 13px;
    line-height: 1.3;
    min-height: 2.6em;
}
.proof-slot-preview { min-height: 130px; }
.proof-slot-empty {
    display: grid;
    place-items: center;
    height: 130px;
    border-radius: 8px;
    border: 1px dashed var(--line);
    color: var(--muted);
    font-size: 12px;
    background: rgba(231, 244, 236, 0.25);
}
.proof-slot-upload {
    display: grid;
    place-items: center;
    padding: 8px 10px;
    border-radius: 8px;
    background: #e7f4ec;
    color: var(--forest);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
}
.proof-slot-upload input {
    position: absolute;
    width: 1px;
    height: 1px;
    opacity: 0;
    overflow: hidden;
}
.proof-slot { position: relative; }
.proof-card {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-height: 150px;
    padding: 8px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: var(--card);
    color: inherit;
    text-decoration: none;
    overflow: hidden;
}
.proof-card img {
    width: 100%;
    height: 110px;
    object-fit: cover;
    border-radius: 6px;
    background: #f3f1ec;
}
.proof-card em {
    font-style: normal;
    font-size: 12px;
    color: var(--muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.proof-card-pdf {
    display: grid;
    place-items: center;
    height: 110px;
    border-radius: 6px;
    background: #e7f4ec;
    color: var(--forest);
    font-weight: 700;
    font-size: 18px;
}
.proof-card-remove {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 28px;
    height: 28px;
    border: 0;
    border-radius: 50%;
    background: rgba(28, 25, 21, 0.72);
    color: #fff;
    cursor: pointer;
    line-height: 1;
    font-size: 18px;
}
.proof-add {
    display: grid;
    gap: 4px;
    place-items: center;
    min-height: 120px;
    margin: 0 0 8px;
    padding: 18px;
    border: 1.5px dashed var(--line);
    border-radius: 10px;
    background: rgba(231, 244, 236, 0.35);
    cursor: pointer;
    text-align: center;
}
.proof-add input { position: absolute; width: 1px; height: 1px; opacity: 0; overflow: hidden; }
.proof-add strong { color: var(--forest); font-size: 15px; }
.proof-add small { color: var(--muted); font-size: 12px; max-width: 28rem; }
.proof-board { position: relative; }
.icon-btn[hidden] { display: none !important; }
.tab-back { margin: 0 0 14px; }
.lines-head, .line {
    display: grid;
    grid-template-columns: minmax(180px, 2.2fr) 0.7fr 0.8fr 0.7fr 0.9fr 36px;
    gap: 8px;
    align-items: end;
}
.lines-head {
    margin: 0 0 8px;
    color: var(--muted);
    font-size: 12px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    font-weight: 600;
}
.line { margin-bottom: 8px; }
.line > input[type="hidden"] { display: none; }
.struck-note {
    grid-column: 1 / -1;
    margin: 0;
    color: var(--muted);
    font-size: 12px;
}
td.is-struck,
.struck-note.is-struck {
    text-decoration: line-through;
    color: var(--muted);
}
.line-label {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
}
.line-add { margin-top: 4px; }
.doc-totals { display: flex; justify-content: flex-end; gap: 18px; margin-top: 12px; }
.doc-totals div { text-align: right; }
.doc-totals span { display: block; color: var(--muted); font-size: 12px; letter-spacing: 0.08em; text-transform: uppercase; }
.doc-totals strong { font-family: var(--serif); font-size: 22px; font-weight: 560; }
.field-error { color: var(--danger); font-size: 12px; }
.form-footer {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    margin-top: 18px;
}
.checkline {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 560;
}
.checkline input { width: auto; }

.admin-switch {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    align-items: center;
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: #fbf7f1;
    margin-bottom: 16px;
}
.admin-note { display: none; color: var(--ink-soft); margin: 0 0 12px; }
.permission-card:has(#is_admin:checked) .matrix { display: none; }
.permission-card:has(#is_admin:checked) .admin-note { display: block; }
.matrix-group { margin-top: 8px; border-top: 1px solid var(--line); padding-top: 12px; }
.matrix-group h3 { margin: 0 0 8px; font-size: 14px; }
.matrix-band { margin: 14px 0 4px; font-size: 12px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); font-weight: 600; }
.matrix-table { width: 100%; border-collapse: collapse; }
.matrix-table th, .matrix-table td { padding: 8px 6px; text-align: center; }
.matrix-table th:first-child, .matrix-table td:first-child { text-align: left; }
.matrix-table th { font-size: 12px; color: var(--muted); font-weight: 600; }
.matrix-live { margin-left: 8px; }

.module-hero { padding: 28px; }
.module-hero h1 { font-size: 42px; }
.rights { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 16px; }
.steps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-top: 18px; }
.step {
    padding: 14px;
    border-radius: 14px;
    background: #f8f4ee;
    border: 1px solid var(--line);
}
.step strong { display: block; margin-bottom: 4px; }

.gate {
    min-height: 100vh;
    display: grid;
}
.gate-panel {
    display: grid;
    place-items: center;
    padding: 32px 20px;
}
.login-card {
    width: min(420px, 100%);
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 22px;
    padding: 28px;
    box-shadow: var(--shadow);
}
.login-card h2 {
    font-family: var(--serif);
    font-weight: 560;
    font-size: 32px;
    margin: 0 0 6px;
}
.stack { display: grid; gap: 14px; margin-top: 18px; }
.remember { display: flex; align-items: center; gap: 8px; color: var(--ink-soft); }
.remember input { width: auto; }
.login-links { display: flex; justify-content: space-between; gap: 12px; margin: 0; }
.login-links a { color: var(--leaf); font-weight: 600; text-decoration: underline; }

.solo {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 24px;
}
.solo-card {
    width: min(520px, 100%);
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 22px;
    padding: 32px;
    box-shadow: var(--shadow);
}

@media (max-width: 1100px) {
    .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .audit-year-grids { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .steps { grid-template-columns: 1fr; }
}
@media (max-width: 860px) {
    .nav-toggle { display: inline-flex; }
    .sidebar {
        position: fixed;
        z-index: 30;
        transform: translateX(-105%);
        transition: transform 0.2s ease;
    }
    .shell.is-open .sidebar { transform: none; }
    .backdrop {
        display: none;
        position: fixed;
        inset: 0;
        background: rgba(22, 18, 12, 0.35);
        z-index: 20;
    }
    .shell.is-open .backdrop { display: block; }
    .content, .topbar { padding-left: 16px; padding-right: 16px; }
    .form-grid { grid-template-columns: 1fr; }
    .lines-head { display: none; }
    .line { grid-template-columns: 1fr 1fr; }
    .line .field:first-child { grid-column: 1 / -1; }
    .line-label { position: static; width: auto; height: auto; overflow: visible; clip: auto; }
    .page-head { align-items: flex-start; flex-direction: column; }
    h1 { font-size: 30px; }
}

.veil[hidden] { display: none !important; }
.veil {
    position: fixed;
    inset: 0;
    z-index: 10000;
    display: grid;
    place-items: center;
    padding: 24px;
    background: rgba(27, 48, 41, 0.46);
}
.veil-card {
    width: min(440px, 100%);
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 22px;
    padding: 28px 28px 22px;
    box-shadow: 0 28px 70px rgba(20, 16, 10, 0.28);
    text-align: center;
}
.veil-card h2 {
    margin: 12px 0 0;
    font-family: var(--serif);
    font-size: 28px;
    font-weight: 560;
}
.wait-kicker { margin: 14px 0 0; color: var(--ink); font-size: 18px; font-weight: 600; }
.wait-note { margin: 4px 0 0; color: var(--muted); }
.spinner {
    width: 52px;
    height: 52px;
    margin: 4px auto 0;
    border-radius: 50%;
    border: 3px solid #efe6d6;
    border-top-color: var(--gold);
    animation: house-spin 0.75s linear infinite;
}
@keyframes house-spin { to { transform: rotate(360deg); } }
.notice-card { position: relative; overflow: hidden; text-align: left; }
.notice-card::before {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    top: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--forest), var(--gold-2));
}
.notice-badge {
    width: 52px;
    height: 52px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    background: #f3eee6;
    color: var(--forest);
}
.notice-card.is-ok .notice-badge { background: #e7f4ec; color: var(--ok); }
.notice-card.is-error .notice-badge { background: #fdecec; color: var(--danger); }
.notice-card.is-confirm .notice-badge { background: #f8f1e2; color: #8a6a2f; }
.notice-copy { margin-top: 10px; color: var(--ink-soft); }
.notice-copy p { margin: 0 0 8px; }
.notice-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 18px;
}

.checkout-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.15fr) minmax(0, 0.85fr);
    gap: 16px;
    align-items: start;
}
.checkout-grid > form:only-child { grid-column: 1 / -1; max-width: 760px; }
.pay-summary h2 { margin: 0 0 12px; font-size: 28px; }
.pay-methods {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 8px;
}
.pay-method {
    position: relative;
    display: block;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: #fff;
    padding: 12px;
    cursor: pointer;
    font-weight: 600;
}
.pay-method input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}
.pay-method:has(input:checked) {
    border-color: var(--ok);
    background: #f4faf6;
    box-shadow: inset 0 0 0 1px var(--ok);
}
.pay-note { color: var(--muted); font-size: 13px; margin: 14px 0 0; }
.remittance-sheet { padding: 22px; }
.remittance-head {
    display: flex;
    justify-content: space-between;
    gap: 18px;
    align-items: flex-start;
    margin-bottom: 18px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--line);
}
.remittance-head h2 {
    margin: 4px 0 6px;
    font-family: var(--serif);
    font-size: 34px;
    font-weight: 560;
}
.remittance-amount { text-align: right; }
.remittance-amount span {
    display: block;
    color: var(--muted);
    font-size: 12px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}
.remittance-amount strong {
    font-family: var(--serif);
    font-size: 34px;
    font-weight: 560;
}
.report-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 18px;
    padding: 12px 18px 16px;
    min-width: 0;
}
.report-col { min-width: 0; }
.report-grid h3 {
    margin: 0 0 10px;
    font-size: 15px;
    font-weight: 620;
}
@media (max-width: 900px) {
    .report-grid { grid-template-columns: 1fr; }
}
.remittance-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 22px;
}
.remittance-grid h3 {
    margin: 0 0 10px;
    font-size: 15px;
    font-weight: 620;
}
.remittance-pay { margin-top: 16px; }
.remittance-pay .field-span small,
#reference-hint { display: block; margin-top: 6px; }
@media (max-width: 900px) {
    .remittance-grid { grid-template-columns: 1fr; }
    .remittance-head { flex-direction: column; }
    .remittance-amount { text-align: left; }
}
.sample-block { margin-top: 18px; }
.sample-block[hidden] { display: none; }
.lines-head.sample-head,
.line.sample-line { grid-template-columns: minmax(180px, 1fr) 160px 36px; }
.lines-head.recipe-manual-head,
.line.recipe-manual-line { grid-template-columns: 2rem minmax(180px, 1fr) 160px; }
.recipe-slot-no { align-self: center; font-variant-numeric: tabular-nums; }
.lines-head.recipe-manual-head,
.line.recipe-manual-line { grid-template-columns: 36px minmax(180px, 1fr) 160px; }
.recipe-slot {
    display: grid;
    place-items: center;
    align-self: end;
    height: 42px;
    color: var(--ink-soft);
    font-size: 0.9rem;
}
.lines-head.journal-lines:not(.journal-lines-group),
.line.journal-line:not(.journal-line-group) {
    grid-template-columns: minmax(0, 1.4fr) 7.5rem minmax(0, 1fr) 36px;
}
.lines-head.journal-lines-group,
.line.journal-line-group {
    display: grid;
    grid-template-columns: minmax(0, 1fr) !important;
    margin-bottom: 14px;
}
.line.journal-line-group > .field {
    grid-column: 1 / -1;
    width: 100%;
}
.line.journal-line:not(.journal-line-group) > .field { min-width: 0; }
.line.journal-line:not(.journal-line-group) > .field input,
.line.journal-line:not(.journal-line-group) > .field select {
    width: 100%;
    min-width: 0;
    box-sizing: border-box;
}
.line.journal-line:not(.journal-line-group) > .field input[data-name="amount"] {
    font-variant-numeric: tabular-nums;
}
@media (max-width: 860px) {
    .lines-head.journal-lines:not(.journal-lines-group),
    .line.journal-line:not(.journal-line-group) {
        grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) 36px;
    }
    .line.journal-line:not(.journal-line-group) > .field:first-child { grid-column: 1 / -1; }
    .line.journal-line:not(.journal-line-group) > .field:nth-child(2),
    .line.journal-line:not(.journal-line-group) > .field:nth-child(3) {
        grid-column: auto;
        width: 100%;
        min-width: 0;
    }
    .line.journal-line-group {
        grid-template-columns: minmax(0, 1fr) !important;
    }
}
.doc-totals strong.is-off { color: var(--danger); }
.tab-board { display: grid; gap: 12px; margin-bottom: 14px; }
.tab-pulls {
    display: flex;
    flex-wrap: wrap;
    gap: 12px 18px;
    align-items: end;
}
.tab-head-pull {
    display: inline-flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
    font-weight: 650;
    color: var(--ink-soft);
    font-size: 16px;
    min-width: 0;
}
.tab-head-pull select,
.tab-head-fixed {
    display: block;
    box-sizing: border-box;
    -webkit-appearance: none;
    appearance: none;
    width: 2.75in !important;
    min-width: 2.75in !important;
    height: 48px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: var(--card);
    padding: 0 14px;
    font-weight: 650;
    color: var(--ink);
    font-size: 16px;
    line-height: 48px;
}
.tab-head-pull select {
    background: var(--card) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='10' viewBox='0 0 14 10'%3E%3Cpath fill='%231c1915' d='M1 1.5 7 8l6-6.5'/%3E%3C/svg%3E") no-repeat right 14px center;
    padding: 0 36px 0 14px;
    line-height: 1.35;
}
.tab-head-pull select optgroup {
    font-weight: 700;
    font-size: 17px;
    color: var(--forest);
    font-style: normal;
}
.tab-head-pull select option {
    font-weight: 500;
    font-size: 18px;
    color: var(--ink);
    padding: 12px 14px;
}
.tab-head-pull-compact select {
    width: 11rem !important;
    min-width: 11rem !important;
    max-width: 11rem !important;
    height: 40px;
    font-size: 14px;
    padding: 0 32px 0 12px;
    background-position: right 12px center;
}
.testing-checklist {
    display: grid;
    gap: 8px;
    padding: 12px 18px 18px;
}
.testing-check {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    margin: 0;
    font-weight: 500;
    color: var(--ink);
    line-height: 1.45;
}
.testing-check input {
    margin-top: 3px;
    width: 1.05rem;
    height: 1.05rem;
    flex: 0 0 auto;
}
.quality-test-pick {
    padding: 0;
}
.quality-test-row {
    display: grid;
    grid-template-columns: minmax(10rem, 1.4fr) minmax(8rem, 1fr) minmax(7.5rem, 9rem);
    gap: 10px;
    align-items: center;
    margin: 0;
    color: var(--ink);
}
.quality-test-check {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    margin: 0;
    font-weight: 650;
    line-height: 1.35;
}
.quality-test-check input[type="checkbox"] {
    margin-top: 3px;
    width: 1.05rem;
    height: 1.05rem;
    flex: 0 0 auto;
}
.quality-test-row input[type="text"],
.quality-test-row select {
    width: 100%;
    min-width: 0;
}
.quality-test-row input[disabled],
.quality-test-row select[disabled] {
    opacity: 0.45;
}
@media (max-width: 720px) {
    .quality-test-row {
        grid-template-columns: 1fr;
        gap: 8px;
    }
}
.coa-mode-choices {
    display: grid;
    gap: 8px;
    margin-top: 6px;
}
.coa-mode-choices .remember {
    margin: 0;
    padding: 10px 12px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: var(--card);
}
.coa-camera-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 10px;
}
.coa-camera-status {
    margin: 0 0 8px;
    color: var(--muted);
    font-size: 0.92rem;
}
.coa-camera-status.is-error {
    color: #9b2c2c;
    font-weight: 600;
}
.coa-camera-dialog {
    border: 0;
    padding: 0;
    max-width: min(960px, 96vw);
    width: 100%;
    background: transparent;
}
.coa-camera-dialog::backdrop {
    background: rgba(15, 24, 20, 0.72);
}
.coa-camera-dialog-card {
    background: var(--card);
    border-radius: 14px;
    padding: 14px;
    box-shadow: 0 18px 40px rgba(0, 0, 0, 0.28);
}
.coa-camera-stage {
    position: relative;
    background: #0b0f0d;
    border-radius: 10px;
    overflow: hidden;
    aspect-ratio: 3 / 4;
    max-height: min(70vh, 640px);
}
.coa-camera-stage video,
.coa-camera-stage canvas {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}
.coa-camera-dialog-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 8px;
    margin-top: 12px;
}
/* Sub head uses the same box size as group head (.tab-head-pull select). */
.tabs { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.tab {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    border: 1px solid var(--line);
    background: var(--card);
    border-radius: 999px;
    padding: 8px 14px;
    color: var(--ink-soft);
    font-weight: 600;
}
.tab small { color: var(--muted); font-weight: 500; }
.tab.is-current { background: var(--forest); border-color: var(--forest); color: #f7f3ea; }
.tab.is-current small { color: #e7c27a; }
.rate-table input[type="number"], .rate-table input[type="text"], .rate-table input:not([type="checkbox"]):not([type="hidden"]) { width: 7.5rem; }
.rate-table td, .rate-table th { white-space: nowrap; }
.rate-table th.mrp-col,
.rate-table td.mrp-col {
    background: #d9f3e2;
    color: #1c1915;
}
.rate-table td.mrp-col input {
    background: #f3fbf6;
    border-color: #b7e0c6;
}
.rate-table th.margin-amt-col,
.rate-table td.margin-amt-col {
    background: #d6eaf8;
    color: #1c1915;
}
.rate-table th.margin-amt-col {
    white-space: normal;
    line-height: 1.2;
    font-size: 11px;
    font-weight: 600;
    max-width: 4.5rem;
    min-width: 3.5rem;
    padding: 6px 4px;
    text-align: center;
    vertical-align: bottom;
}
.rate-table td.margin-amt-col {
    font-size: 12px;
    padding: 6px 4px;
    text-align: right;
    font-variant-numeric: tabular-nums;
}
.rate-table td.mrp-readonly {
    cursor: default;
    font-variant-numeric: tabular-nums;
}
.inline-form { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
@media (max-width: 900px) {
    .checkout-grid { grid-template-columns: 1fr; }
}
@media print {
    .sidebar, .topbar, .backdrop, .tabs, .page-actions, .toolbar, .form-footer, .flash, .form-errors, .veil { display: none !important; }
    .shell, .main, .content { display: block !important; background: #fff; }
}

.content:has(.wa) { padding: 0; height: calc(100vh - 68px); }
.wa-thread[hidden],
.wa-compose[hidden],
.wa-readonly[hidden],
.wa-empty[hidden],
.wa [hidden] { display: none !important; }
.wa {
    --wa-green: #0b5c45;
    --wa-mint: #d8f3e4;
    --wa-panel: #12382c;
    display: grid;
    grid-template-columns: minmax(260px, 340px) 1fr;
    height: 100%;
    background: #0f2a22;
    color: #f4efe6;
}
.wa-side {
    display: flex;
    flex-direction: column;
    border-right: 1px solid rgba(255,255,255,0.08);
    background: #12382c;
    min-height: 0;
}
.wa-side-head {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    align-items: center;
    padding: 14px 16px 10px;
}
.wa-side-actions { display: flex; gap: 6px; }
.wa-icon {
    width: 36px;
    height: 36px;
    border-radius: 999px;
    border: 0;
    background: rgba(255,255,255,0.1);
    color: #f4efe6;
    font-weight: 700;
}
.wa-chats { overflow: auto; flex: 1; padding: 0 8px 16px; }
.wa-side-empty {
    margin: 8px 10px;
    padding: 10px 14px;
    color: #d7e4de;
    background: #0b5c45;
    border-radius: 10px;
    text-align: center;
    font-size: 14px;
}
.wa-centre-search {
    width: min(100%, 420px);
    margin: 0 auto;
    display: grid;
    gap: 12px;
    justify-items: stretch;
}
.wa-search-shell {
    display: flex;
    align-items: center;
    gap: 10px;
    background: #fffcf8;
    color: var(--ink);
    border-radius: 999px;
    padding: 0 16px;
    height: 48px;
    box-shadow: 0 10px 28px rgba(0,0,0,0.18);
}
.wa-search-shell svg { flex: 0 0 auto; color: #746b60; }
.wa-search-shell input {
    flex: 1 1 auto;
    min-width: 0;
    border: 0;
    background: transparent;
    outline: none;
    font-size: 15px;
    height: 100%;
}
.wa-search-hits {
    background: rgba(15, 47, 38, 0.92);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 16px;
    overflow: hidden;
    max-height: 280px;
    overflow-y: auto;
    text-align: left;
}
.wa-search-hit {
    width: 100%;
    display: grid;
    grid-template-columns: 36px 1fr;
    gap: 10px;
    align-items: center;
    border: 0;
    background: transparent;
    color: #f4efe6;
    padding: 10px 12px;
    text-align: left;
}
.wa-search-hit:hover { background: rgba(255,255,255,0.08); }
.wa-search-hit strong { display: block; font-size: 14px; }
.wa-search-hit em { color: #b7c6bf; font-style: normal; font-size: 12px; }
.wa-search-hits[hidden] { display: none !important; }
.wa-chat {
    width: 100%;
    display: grid;
    grid-template-columns: 42px 1fr auto;
    gap: 10px;
    align-items: center;
    text-align: left;
    border: 0;
    background: transparent;
    color: inherit;
    padding: 10px 10px;
    border-radius: 14px;
}
.wa-chat:hover, .wa-chat.is-current { background: rgba(255,255,255,0.08); }
.wa-avatar {
    width: 42px;
    height: 42px;
    border-radius: 999px;
    display: grid;
    place-items: center;
    background: #2f6a52;
    font-weight: 700;
}
.wa-chat-copy { min-width: 0; }
.wa-chat-top { display: flex; justify-content: space-between; gap: 8px; }
.wa-chat-top strong { font-size: 15px; }
.wa-chat-top em { color: #9eb0a8; font-style: normal; font-size: 12px; }
.wa-chat-preview {
    display: block;
    margin-top: 2px;
    color: #b7c6bf;
    font-size: 13px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.wa-unread {
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    border-radius: 999px;
    background: #25d366;
    color: #073b22;
    font-size: 11px;
    font-weight: 700;
    line-height: 18px;
    text-align: center;
}
.wa-main {
    display: flex;
    flex-direction: column;
    min-width: 0;
    min-height: 0;
    background:
        linear-gradient(rgba(18, 56, 44, 0.92), rgba(18, 56, 44, 0.92)),
        radial-gradient(circle at 20% 20%, rgba(231, 194, 122, 0.08), transparent 40%);
}
.wa-empty {
    margin: auto;
    text-align: center;
    padding: 24px;
    color: #d7e4de;
    width: min(100%, 520px);
}
.wa-thread { display: flex; flex-direction: column; height: 100%; min-height: 0; }
.wa-thread-head {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    align-items: center;
    padding: 14px 18px;
    background: #0f2f26;
    border-bottom: 1px solid rgba(255,255,255,0.06);
}
.wa-thread-head h2 { margin: 0; font-size: 18px; }
.wa-subtitle { margin: 2px 0 0; color: #9eb0a8; font-size: 13px; }
.wa-messages {
    flex: 1;
    overflow: auto;
    padding: 18px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.wa-bubble {
    max-width: min(72%, 520px);
    align-self: flex-start;
    background: #1d4a3b;
    border-radius: 14px 14px 14px 4px;
    padding: 8px 10px 6px;
    box-shadow: 0 8px 18px rgba(0,0,0,0.12);
}
.wa-bubble.is-mine {
    align-self: flex-end;
    background: #1f6b45;
    border-radius: 14px 14px 4px 14px;
}
.wa-bubble.is-rates { border: 1px solid rgba(231, 194, 122, 0.45); }
.wa-bubble-name { font-size: 12px; color: #e7c27a; font-weight: 600; margin-bottom: 2px; }
.wa-bubble-body { white-space: pre-wrap; word-break: break-word; line-height: 1.4; }
.wa-bubble-time { text-align: right; color: #b7c6bf; font-size: 11px; margin-top: 4px; }
.wa-compose {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: end;
    padding: 12px 14px 16px;
    background: #0f2f26;
}
.wa-clip {
    width: 1in;
    height: 1in;
    border-radius: 18px;
    background: #fffcf8;
    color: #073b22;
    display: grid;
    place-items: center;
    cursor: pointer;
    flex: none;
}
.wa-picked {
    flex: 1 0 100%;
    margin: 0;
    color: #d7e4dd;
    font-size: 13px;
}
.wa-photo {
    display: block;
    max-width: 240px;
    max-height: 280px;
    border-radius: 10px;
    margin-bottom: 6px;
}
.wa-voice { width: 220px; max-width: 100%; }
.wa-file { font-weight: 700; }
.wa-gone { font-size: 13px; opacity: 0.8; }
.wa-compose textarea {
    flex: 1;
    min-width: 0;
    width: 100%;
    resize: vertical;
    min-height: 1.2in;
    max-height: 2.4in;
    border: 0;
    border-radius: 18px;
    padding: 14px 16px;
    background: #fffcf8;
    color: var(--ink);
    font-size: 16px;
    line-height: 1.45;
}
.wa-send {
    width: 1in;
    height: 1in;
    border: 0;
    border-radius: 18px;
    background: #25d366;
    color: #073b22;
    font-weight: 700;
    padding: 0;
    flex: 0 0 1in;
}
.wa-readonly {
    margin: 0;
    padding: 14px 18px 18px;
    color: #c9d7d0;
    background: #0f2f26;
}
.wa-dialog {
    border: 0;
    padding: 0;
    background: transparent;
    max-width: 420px;
    width: calc(100% - 24px);
}
.wa-dialog::backdrop { background: rgba(15, 24, 20, 0.55); }
.wa-dialog-card {
    background: var(--card);
    color: var(--ink);
    border-radius: 18px;
    padding: 18px;
    border: 1px solid var(--line);
}
.wa-dialog-card h3 { margin: 0 0 6px; font-family: var(--serif); font-size: 26px; }
.wa-dialog-note { margin: 0 0 14px; color: var(--muted); }
.wa-people { max-height: 280px; overflow: auto; display: grid; gap: 6px; margin-bottom: 14px; }
.wa-person {
    display: grid;
    grid-template-columns: 18px 1fr;
    gap: 10px;
    align-items: start;
    padding: 8px;
    border-radius: 10px;
    border: 1px solid var(--line);
}
.wa-person strong { display: block; }
.wa-person em { color: var(--muted); font-style: normal; font-size: 13px; }
.wa-dialog-actions { display: flex; justify-content: flex-end; gap: 8px; }
@media (max-width: 860px) {
    .wa { grid-template-columns: 1fr; }
    .wa-side { max-height: 42vh; }
}

/* Chat page: white canvas, light green text, white top labels */
body.is-chat-page {
    background: #ffffff;
    color: #6fd39a;
}
body.is-chat-page .shell.is-chat .main {
    background: #ffffff;
}
body.is-chat-page .shell.is-chat .topbar {
    background: var(--forest);
    border-bottom-color: rgba(255, 255, 255, 0.08);
}
body.is-chat-page .shell.is-chat .nav-toggle {
    display: inline-flex;
    align-items: center;
    color: #ffffff;
    border-color: rgba(255, 255, 255, 0.35);
    background: transparent;
}
body.is-chat-page .shell.is-chat .who-name,
body.is-chat-page .shell.is-chat .who-role {
    color: #ffffff;
}
body.is-chat-page .shell.is-chat .who-role {
    opacity: 0.88;
}
body.is-chat-page .shell.is-chat .top-chat {
    border-color: rgba(255, 255, 255, 0.35);
    background: transparent;
    color: #ffffff;
}
body.is-chat-page .shell.is-chat .top-chat.is-current {
    background: rgba(255, 255, 255, 0.14);
    border-color: rgba(255, 255, 255, 0.45);
    color: #ffffff;
}
body.is-chat-page .shell.is-chat .top-chat-badge {
    border-color: var(--forest);
}
body.is-chat-page .shell.is-chat .content {
    background: #ffffff;
    color: #6fd39a;
}
body.is-chat-page .wa {
    background: #ffffff;
    color: #6fd39a;
}
body.is-chat-page .wa-side {
    background: #ffffff;
    border-right: 1px solid #d9f0e3;
    color: #6fd39a;
}
body.is-chat-page .wa-side-head {
    background: #ffffff;
}
body.is-chat-page .wa-icon {
    background: #e8f8ef;
    color: #2f9d68;
}
body.is-chat-page .wa-side-empty {
    background: #0b5c45;
    color: #d7e4de;
}
body.is-chat-page .wa-chat {
    color: #3a9f6d;
}
body.is-chat-page .wa-chat:hover,
body.is-chat-page .wa-chat.is-current {
    background: #eefaf3;
}
body.is-chat-page .wa-avatar {
    background: #6fd39a;
    color: #ffffff;
}
body.is-chat-page .wa-chat-top em,
body.is-chat-page .wa-chat-preview {
    color: #8fd9b0;
}
body.is-chat-page .wa-main {
    background: #ffffff;
    color: #6fd39a;
}
body.is-chat-page .wa-empty {
    color: #6fd39a;
}
body.is-chat-page .wa-search-shell {
    background: #ffffff;
    border: 1px solid #cfeedd;
    color: #2f9d68;
    box-shadow: 0 8px 24px rgba(47, 157, 104, 0.08);
}
body.is-chat-page .wa-search-shell svg { color: #6fd39a; }
body.is-chat-page .wa-search-shell input { color: #2f9d68; }
body.is-chat-page .wa-search-hits {
    background: #ffffff;
    border-color: #cfeedd;
}
body.is-chat-page .wa-search-hit {
    color: #3a9f6d;
}
body.is-chat-page .wa-search-hit:hover { background: #eefaf3; }
body.is-chat-page .wa-search-hit em { color: #8fd9b0; }
body.is-chat-page .wa-thread-head {
    background: #ffffff;
    border-bottom-color: #d9f0e3;
    color: #3a9f6d;
}
body.is-chat-page .wa-subtitle { color: #8fd9b0; }
body.is-chat-page .wa-messages { background: #ffffff; }
body.is-chat-page .wa-bubble {
    background: #e8f8ef;
    color: #2f9d68;
}
body.is-chat-page .wa-bubble.is-mine {
    background: #6fd39a;
    color: #ffffff;
}
body.is-chat-page .wa-bubble-name { color: #2f9d68; }
body.is-chat-page .wa-bubble.is-mine .wa-bubble-time { color: rgba(255,255,255,0.85); }
body.is-chat-page .wa-bubble-time { color: #8fd9b0; }
body.is-chat-page .wa-compose,
body.is-chat-page .wa-readonly {
    background: #ffffff;
    border-top: 1px solid #d9f0e3;
    color: #6fd39a;
}
body.is-chat-page .wa-compose textarea {
    background: #f4fcf7;
    color: #2f9d68;
    border: 1px solid #cfeedd;
}
body.is-chat-page .wa-send {
    background: #6fd39a;
    color: #ffffff;
}
body.is-chat-page .wa-unread {
    background: #6fd39a;
    color: #ffffff;
}

.annual-compare-toggle {
    display: inline-flex;
    flex-direction: row;
    align-items: center;
    gap: 8px;
    margin: 0;
    padding: 10px 12px;
    border: 1px solid var(--line);
    border-radius: 11px;
    background: var(--card);
    color: var(--ink-soft);
    font-size: 14px;
    cursor: pointer;
    user-select: none;
}
.annual-compare-toggle span { color: var(--ink-soft); }
.annual-compare-toggle input {
    width: auto;
    max-width: none;
    margin: 0;
    accent-color: var(--forest);
}
.toolbar .annual-compare-year {
    min-width: 6.5rem;
}
.toolbar .annual-compare-year input[type="number"] {
    max-width: 7.5rem;
}
.toolbar .annual-compare-year input[type="month"] {
    max-width: 11rem;
}
.annual-compare {
    margin: 0 0 18px;
    padding: 18px 18px 12px;
    border: 1px solid var(--line);
    border-radius: 14px;
    background:
        linear-gradient(160deg, rgba(255, 252, 248, 0.96), rgba(243, 238, 230, 0.92)),
        var(--card);
    box-shadow: var(--shadow);
}
.annual-compare-head h2 {
    margin: 0;
    font-family: var(--serif);
    font-size: 1.35rem;
    font-weight: 560;
    color: var(--ink);
}
.annual-compare-head p {
    margin: 6px 0 0;
    color: var(--muted);
    font-size: 13px;
}
.annual-compare-charts {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
    margin-top: 16px;
}
.annual-compare-panel {
    min-width: 0;
    padding: 12px 12px 8px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: #fffcf8;
}
.annual-compare-panel h3 {
    margin: 0 0 10px;
    font-size: 12px;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--muted);
    font-weight: 600;
}
.annual-compare-panel canvas {
    width: 100% !important;
    max-height: 260px;
}
@media (max-width: 860px) {
    .annual-compare-charts { grid-template-columns: 1fr; }
}

.social-week-nav {
    justify-content: flex-start;
    gap: 10px;
}
.social-week-label {
    min-width: 220px;
    text-align: center;
    color: var(--ink);
}
.social-calendar {
    padding: 12px;
    overflow-x: auto;
}
.social-week {
    display: grid;
    grid-template-columns: repeat(var(--social-days, 7), minmax(140px, 1fr));
    gap: 8px;
    min-width: 0;
}
.social-day {
    border: 1px solid var(--line);
    border-radius: 12px;
    background: #fff;
    min-height: 220px;
    display: flex;
    flex-direction: column;
}
.social-day.is-today {
    border-color: #c6a15a;
    box-shadow: inset 0 0 0 1px rgba(198, 161, 90, 0.35);
}
.social-week-nav .btn.is-disabled {
    opacity: 0.45;
    pointer-events: none;
}
.social-day-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 6px;
    padding: 10px 10px 8px;
    border-bottom: 1px solid var(--line);
}
.social-day-head strong {
    display: block;
    font-size: 13px;
}
.social-day-head .muted {
    font-size: 12px;
}
.social-day-body {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 8px;
    flex: 1;
}
.social-day-empty {
    font-size: 12px;
    padding: 8px 2px;
}
.social-slot {
    border: 1px solid var(--line);
    border-radius: 10px;
    min-height: 4.5rem;
    background: var(--card);
    padding: 8px;
}
.social-slot-empty {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 6px;
    padding: 8px 10px;
    background: #faf6f0;
    border-style: dashed;
}
.social-slot.is-verified {
    border-color: #b9d0c2;
    background: #f4faf6;
}
.social-slot.is-planned {
    border-color: #e2d3b4;
}
.social-slot-link {
    display: block;
}
.social-slot-title {
    margin: 4px 0;
    font-size: 13px;
    font-weight: 600;
    color: var(--ink);
    line-height: 1.35;
}
.social-slot-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: center;
    font-size: 11px;
    color: var(--ink-soft);
}
.social-slot-actions {
    display: flex;
    align-items: center;
    gap: 4px;
    margin-top: 6px;
}
.social-import {
    margin-bottom: 14px;
    padding: 14px 16px;
}
.social-import-form {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 12px 16px;
}
.social-import-file {
    min-width: min(100%, 18rem);
    flex: 1;
    margin: 0;
}
.social-import-file input[type="file"] {
    padding: 8px 10px;
}
@media (max-width: 900px) {
    .social-week {
        grid-template-columns: 1fr;
        min-width: 0;
    }
    .social-day { min-height: 0; }
}
.work-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
    gap: 12px;
}
.work-card {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 14px 16px;
    border: 1px solid var(--line, #e6dfd2);
    border-radius: 14px;
    background: #fff;
    text-decoration: none;
    color: inherit;
}
.work-card span { font-size: 12px; letter-spacing: .04em; text-transform: uppercase; color: #8a7b64; }
.work-card strong { font-size: 16px; }
.work-card em { font-style: normal; color: #64748b; font-size: 13px; }
.home-block { margin-top: 16px; padding: 16px 18px 18px; min-width: 0; overflow: hidden; }
.home-block h2 { margin: 0 0 12px; font-size: 18px; font-weight: 650; font-family: inherit; }
.home-block .page-head h2 { margin: 0; }
.home-note { margin: 0; color: var(--muted); }
.home-block .page-head { padding: 0; margin-bottom: 12px; }
.trade-bars { display: flex; align-items: flex-end; gap: 8px; min-height: 148px; }
.trade-col { flex: 1 1 0; min-width: 0; display: flex; flex-direction: column; align-items: center; }
.trade-pair { display: flex; align-items: flex-end; justify-content: center; gap: 3px; width: 100%; height: 120px; }
.trade-pair i { display: block; width: 10px; max-width: 18px; border-radius: 4px 4px 2px 2px; }
.trade-pair i.sales { background: #c4a15a; }
.trade-pair i.purchase { background: #17382c; }
.trade-col span { margin-top: 6px; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 11px; color: #64748b; }
.chart-key { display: flex; gap: 14px; align-items: center; margin: 10px 0 12px; color: #64748b; font-size: 13px; }
table.data.fit { min-width: 0; }
table.data.fit th, table.data.fit td { white-space: normal; }
.swatch { display: inline-block; width: 12px; height: 12px; border-radius: 3px; margin-right: 4px; }
.swatch.sales { background: #c4a15a; }
.swatch.purchase { background: #17382c; }
.city-chart { display: grid; gap: 8px; margin-top: 18px; }
.city-row { display: grid; grid-template-columns: 140px 1fr; gap: 10px; align-items: center; }
.city-row i { display: block; height: 10px; border-radius: 999px; background: linear-gradient(90deg, #17382c, #c4a15a); }
