/* GH Sales Dashboard - shared styles. Tokens copied from the approved mockup. */
@font-face { font-family: "Cabinet Grotesk"; src: url(/assets/fonts/CabinetGrotesk-Regular.woff2) format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Cabinet Grotesk"; src: url(/assets/fonts/CabinetGrotesk-Medium.woff2) format("woff2"); font-weight: 500; font-display: swap; }
@font-face { font-family: "Cabinet Grotesk"; src: url(/assets/fonts/CabinetGrotesk-Bold.woff2) format("woff2"); font-weight: 700; font-display: swap; }
@font-face { font-family: "Cabinet Grotesk"; src: url(/assets/fonts/CabinetGrotesk-Extrabold.woff2) format("woff2"); font-weight: 800; font-display: swap; }

:root {
    --forest: #1C312C; --teal: #267F70; --teal-ink: #1F6A5D; --cream: #FCF2D7;
    --card: #FFFBEF; --line: #E9D9B4; --line-soft: #EFE2C2; --track: #EFE2C2;
    --alert: #D04E38; --alert-ink: #8C2E1F; --alert-bg: #FBE3DC;
    --amber: #F7CD45; --amber-ink: #8A5A00; --amber-bg: #FCEFD0;
    --hatch-a: #F4E3BD; --hatch-b: #FCF2D7; --hatch-line: #9A6B4F; --hatch-ink: #7A3A26;
    --ink: #1C312C; --muted: #4F564E; --eyebrow: #5A5F55;
    --bar: #267F70; --bar-dark: #1C312C;
    --btn-bg: #267F70; --btn-ink: #FFFFFF; --focus: #F7CD45;
    --nav-bg: #1C312C; --nav-ink: #FCF2D7; --nav-muted: #C9D3C8;
    --field-bg: #FFFBEF; --field-line: #C9B58A;
    color-scheme: light;
}
@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        --cream: #13201D; --card: #1B2B27; --line: #33463F; --line-soft: #2A3B35; --track: #2A3B35;
        --alert: #E0664F; --alert-ink: #F4A897; --alert-bg: #3A211C;
        --amber-ink: #F7CD45; --amber-bg: #3A3220;
        --hatch-a: #22322D; --hatch-b: #1A2824; --hatch-line: #B8896B; --hatch-ink: #E8B89A;
        --ink: #F3EBD3; --muted: #B9C2B7; --eyebrow: #AEB6AA;
        --bar: #3FA792; --bar-dark: #F3EBD3; --teal-ink: #6FCBB6;
        --btn-bg: #2F9784; --nav-bg: #0D1714; --field-bg: #1B2B27; --field-line: #4A5E56;
        color-scheme: dark;
    }
}
:root[data-theme="dark"] {
    --cream: #13201D; --card: #1B2B27; --line: #33463F; --line-soft: #2A3B35; --track: #2A3B35;
    --alert: #E0664F; --alert-ink: #F4A897; --alert-bg: #3A211C;
    --amber-ink: #F7CD45; --amber-bg: #3A3220;
    --hatch-a: #22322D; --hatch-b: #1A2824; --hatch-line: #B8896B; --hatch-ink: #E8B89A;
    --ink: #F3EBD3; --muted: #B9C2B7; --eyebrow: #AEB6AA;
    --bar: #3FA792; --bar-dark: #F3EBD3; --teal-ink: #6FCBB6;
    --btn-bg: #2F9784; --nav-bg: #0D1714; --field-bg: #1B2B27; --field-line: #4A5E56;
    color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
    margin: 0; background: var(--cream); color: var(--ink);
    font-family: "Cabinet Grotesk", "Segoe UI", system-ui, sans-serif; font-size: 16px; line-height: 1.45;
    font-variant-numeric: tabular-nums;
}
a { color: var(--teal-ink); }
a:hover { color: var(--ink); }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 4px; }
h1, h2, h3 { margin: 0; line-height: 1.15; }
p { margin: 0; }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

/* Top bar */
.topbar { background: var(--nav-bg); color: var(--nav-ink); padding: 14px 16px; }
.topbar-inner { max-width: 1320px; margin: 0 auto; display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.topbar img { width: 150px; height: auto; display: block; }
.topbar .who { display: flex; align-items: center; gap: 14px; font-size: 15px; flex-wrap: wrap; }
.topbar .who strong { font-weight: 700; }
.topbar .who .role { color: var(--nav-muted); }
.topbar a, .topbar button.link { color: var(--nav-ink); }

/* Page */
main { max-width: 1320px; margin: 0 auto; padding: 24px 16px 64px; display: flex; flex-direction: column; gap: 28px; }
.page-head { display: flex; flex-direction: column; gap: 4px; }
.page-head h1 { font-size: clamp(30px, 5vw, 44px); font-weight: 800; letter-spacing: -0.01em; }
section.block { display: flex; flex-direction: column; gap: 16px; }
section.block > h2 { font-size: 24px; font-weight: 800; }
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(300px, 100%), 1fr)); gap: 16px; }
.grid.wide { grid-template-columns: repeat(auto-fit, minmax(min(420px, 100%), 1fr)); }

.card { background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 20px; display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.card.accent { border-top: 6px solid var(--teal); }
.card.accent-alert { border-top: 6px solid var(--alert); }
.card.accent-amber { border-top: 6px solid var(--amber); }
.card-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.asof { font-size: 13px; color: var(--muted); }
.asof.warn { color: var(--alert-ink); font-weight: 700; }
.eyebrow { font-size: 13px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--eyebrow); }
.big { font-size: 52px; font-weight: 800; line-height: 1; }
.caption { font-size: 14px; color: var(--muted); }
.count { background: var(--forest); color: var(--cream); border-radius: 99px; padding: 2px 12px; font-weight: 800; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .count { background: var(--cream); color: var(--ink); border: 1px solid var(--line); } }

.gap { background: repeating-linear-gradient(135deg, var(--hatch-a) 0 10px, var(--hatch-b) 10px 20px); border: 1.5px dashed var(--hatch-line); border-radius: 16px; padding: 20px; display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.gap .eyebrow { color: var(--hatch-ink); }
.gap h3 { font-size: 24px; font-weight: 800; color: var(--muted); }

.unavailable { background: repeating-linear-gradient(135deg, var(--hatch-a) 0 10px, var(--hatch-b) 10px 20px); border: 1.5px dashed var(--hatch-line); border-radius: 12px; padding: 14px 16px; color: var(--hatch-ink); font-weight: 700; }
.note { background: var(--amber-bg); border-radius: 12px; padding: 12px 14px; font-size: 15px; }
.note.alert { background: var(--alert-bg); color: var(--alert-ink); }

.stale { background: var(--amber-bg); border: 1.5px solid var(--amber); color: var(--ink); border-radius: 12px; padding: 12px 16px; font-weight: 700; }
.stale[hidden] { display: none; }

/* Bars */
.track { height: 14px; background: var(--track); border-radius: 7px; overflow: hidden; }
.track > span { display: block; height: 100%; background: var(--bar); border-radius: 7px; }
.track.target > span { background: var(--amber); }
.bars { display: flex; flex-direction: column; gap: 10px; font-size: 15px; }
.bar-row { display: grid; grid-template-columns: minmax(0, 11em) minmax(0, 1fr) 3.2em; gap: 10px; align-items: center; }
.bar-row > span:first-child { overflow-wrap: anywhere; }
.bar-row .b { height: 14px; background: var(--bar); border-radius: 4px; min-width: 2px; }
.bar-row .b.dark { background: var(--bar-dark); }
.bar-row strong { text-align: right; }
.subhead { font-weight: 700; font-size: 15px; margin-top: 4px; }

/* Rows / lists */
.rows { display: flex; flex-direction: column; }
.row { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line-soft); flex-wrap: wrap; }
.row:last-child { border-bottom: 0; }
.row .main { display: flex; flex-direction: column; gap: 2px; min-width: 0; flex: 1 1 14em; }
.row .main .title { font-weight: 700; font-size: 17px; overflow-wrap: anywhere; }
.row .main .sub { color: var(--muted); font-size: 14px; overflow-wrap: anywhere; }
.row.stuck { background: var(--alert-bg); border-left: 5px solid var(--alert); padding-left: 12px; padding-right: 8px; border-radius: 8px; margin: 4px 0; }
.stuck-label { color: var(--alert-ink); font-weight: 800; font-size: 14px; }
.left { font-weight: 800; color: var(--amber-ink); white-space: nowrap; }
.empty { color: var(--muted); }

/* Buttons and forms */
.btn { display: inline-flex; align-items: center; justify-content: center; min-height: 48px; padding: 0 18px; border-radius: 10px; font: 700 15px "Cabinet Grotesk", system-ui, sans-serif; text-decoration: none; border: 0; cursor: pointer; background: var(--btn-bg); color: var(--btn-ink); }
.btn:hover { color: var(--btn-ink); filter: brightness(1.08); }
.btn.ghost { background: transparent; color: var(--ink); border: 1.5px solid var(--ink); }
.btn.ghost:hover { color: var(--ink); }
.btn.danger { background: var(--alert); color: #fff; }
.btn[disabled] { opacity: .55; cursor: not-allowed; }
button.link { background: none; border: 0; padding: 0; font: inherit; text-decoration: underline; cursor: pointer; min-height: 32px; }
.actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
form.inline { display: flex; flex-direction: column; gap: 10px; }
label.field { display: flex; flex-direction: column; gap: 4px; font-size: 14px; font-weight: 700; }
input, select, textarea { min-height: 48px; border-radius: 10px; border: 1px solid var(--field-line); background: var(--field-bg); color: var(--ink); padding: 0 12px; font: 500 16px "Cabinet Grotesk", system-ui, sans-serif; max-width: 100%; }
textarea { padding: 10px 12px; min-height: 80px; }
label.check { display: flex; gap: 8px; align-items: center; font-weight: 700; min-height: 48px; }
label.check input { min-height: 0; width: 22px; height: 22px; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(200px, 100%), 1fr)); gap: 10px; }
.msg { font-size: 14px; }
.msg.err { color: var(--alert-ink); font-weight: 700; }
.msg.ok { color: var(--teal-ink); font-weight: 700; }
.msg:empty { display: none; }

/* Stock */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(7em, 1fr)); gap: 12px; }
.stats .n { font-size: 36px; font-weight: 800; line-height: 1; }
.stats .l { color: var(--muted); }
table.plain { width: 100%; border-collapse: collapse; font-size: 15px; }
table.plain th, table.plain td { text-align: left; padding: 8px 6px; border-bottom: 1px solid var(--line-soft); }
table.plain th { font-size: 13px; color: var(--eyebrow); text-transform: uppercase; letter-spacing: .06em; }
table.plain td.num, table.plain th.num { text-align: right; }
.scroll-x { overflow-x: auto; max-width: 100%; }

.loading { color: var(--muted); }

/* Expired session: a small fixed banner, so nothing on the page moves or clears. */
.reauth { position: fixed; left: 16px; right: 16px; bottom: 16px; z-index: 50; max-width: 640px; margin: 0 auto;
    background: var(--forest); color: var(--cream); border: 2px solid var(--amber); border-radius: 14px; padding: 12px 14px;
    display: flex; gap: 12px; align-items: center; justify-content: space-between; flex-wrap: wrap; box-shadow: 0 8px 24px rgba(0,0,0,.25); }
.reauth span { flex: 1 1 14em; font-weight: 700; }
