/* Store Console: one stylesheet, no build step. Tokens first, light then dark. */
:root {
    --bg: #f3f5f4;
    --surface: #ffffff;
    --surface-2: #f8faf9;
    --ink: #13201e;
    --ink-2: #44524f;
    --muted: #6b7a76;
    --line: #dfe5e2;
    --line-2: #eaefec;
    --accent: #0b7a73;
    --accent-ink: #ffffff;
    --accent-soft: #e2f3f1;
    --chart: #0b7a73;
    --chart-fill: rgba(11, 122, 115, .12);
    --good: #1f7a3d;
    --good-soft: #e3f4e8;
    --warn: #9a5b00;
    --warn-soft: #fbf0dc;
    --bad: #b42318;
    --bad-soft: #fdecea;
    --side: #10201d;
    --side-ink: #d7e3df;
    --side-muted: #86a39c;
    --side-active: #1d3732;
    --radius: 10px;
    --shadow: 0 1px 2px rgba(16, 32, 29, .06), 0 1px 1px rgba(16, 32, 29, .04);
    --font: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
    --display: "Space Grotesk", var(--font);
    color-scheme: light;
}
@media (prefers-color-scheme: dark) {
    :root {
        --bg: #0d1513;
        --surface: #141f1d;
        --surface-2: #182421;
        --ink: #e5eeeb;
        --ink-2: #b9c7c3;
        --muted: #8a9c97;
        --line: #26342f;
        --line-2: #1f2c28;
        --accent: #3cc4b8;
        --accent-ink: #062320;
        --accent-soft: #143430;
        --chart: #3cc4b8;
        --chart-fill: rgba(60, 196, 184, .14);
        --good: #5fd08a;
        --good-soft: #15301f;
        --warn: #f0b456;
        --warn-soft: #34270f;
        --bad: #ff8a7e;
        --bad-soft: #3a1915;
        --side: #0a1110;
        --side-ink: #d7e3df;
        --side-muted: #7f988f;
        --side-active: #172925;
        --shadow: none;
        color-scheme: dark;
    }
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 14px/1.5 var(--font); font-feature-settings: "cv11", "ss01"; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
h1, h2, h3 { font-family: var(--display); letter-spacing: -.01em; margin: 0; text-wrap: balance; }
h1 { font-size: 1.5rem; font-weight: 600; }
h2 { font-size: 1rem; font-weight: 600; }
h3 { font-size: .9rem; font-weight: 600; }
code, .mono { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-size: .85em; }
.num { font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.small { font-size: .82rem; }
.nowrap { white-space: nowrap; }
.hidden { display: none !important; }

/* Shell */
.shell { display: grid; grid-template-columns: 248px minmax(0, 1fr); min-height: 100vh; }
.side { background: var(--side); color: var(--side-ink); display: flex; flex-direction: column; padding: 18px 14px; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.brandmark { display: flex; align-items: center; gap: 10px; padding: 4px 8px 18px; }
.brandmark .logo { width: 30px; height: 30px; border-radius: 8px; background: linear-gradient(135deg, #12a397, #0b5f59); display: grid; place-items: center; color: #fff; font: 700 13px var(--display); }
.brandmark strong { display: block; font: 600 15px var(--display); color: #fff; }
.brandmark span { font-size: 12px; color: var(--side-muted); }
.side-label { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--side-muted); padding: 14px 10px 6px; }
.channel { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 8px; color: var(--side-ink); }
.channel.active { background: var(--side-active); }
.channel.soon { opacity: .55; cursor: default; }
.channel .dot { width: 8px; height: 8px; border-radius: 50%; background: #ff9f1a; flex: none; }
.channel.soon .dot { background: #5d7a72; }
.channel .tag { margin-left: auto; font-size: 10px; text-transform: uppercase; letter-spacing: .06em; border: 1px solid #3a564f; padding: 1px 6px; border-radius: 999px; color: var(--side-muted); }
.markets { display: flex; gap: 6px; padding: 6px 10px 4px 28px; }
.markets a { font-size: 12px; padding: 2px 9px; border-radius: 999px; color: var(--side-muted); border: 1px solid #2c4540; }
.markets a.on { background: #12a397; border-color: #12a397; color: #fff; }
.markets a:hover { text-decoration: none; color: #fff; }
.nav { display: flex; flex-direction: column; gap: 2px; padding-left: 18px; margin-top: 6px; }
.nav a { display: flex; align-items: center; gap: 10px; padding: 7px 10px; border-radius: 7px; color: var(--side-ink); }
.nav a svg { width: 16px; height: 16px; flex: none; opacity: .8; }
.nav a:hover { background: var(--side-active); text-decoration: none; }
.nav a.on { background: var(--side-active); color: #fff; box-shadow: inset 2px 0 0 #12a397; }
.nav .count { margin-left: auto; font-size: 11px; background: #12a397; color: #fff; border-radius: 999px; padding: 0 7px; }
.side-foot { margin-top: auto; padding: 12px 10px 0; border-top: 1px solid #23393a; display: flex; align-items: center; gap: 10px; }
.avatar { width: 30px; height: 30px; border-radius: 50%; background: #23413b; color: #cfe7e1; display: grid; place-items: center; font-weight: 600; font-size: 12px; flex: none; }
.side-foot .who { min-width: 0; }
.side-foot .who strong { display: block; color: #fff; font-weight: 500; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.side-foot button { margin-left: auto; background: none; border: 1px solid #2c4540; color: var(--side-muted); border-radius: 6px; padding: 4px 8px; font: inherit; font-size: 12px; cursor: pointer; }
.side-foot button:hover { color: #fff; border-color: #4a6a62; }

.main { min-width: 0; padding: 22px max(16px, 2.2vw) 48px; }
.topbar { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px 20px; margin-bottom: 18px; }
.topbar .crumbs { font-size: 12px; color: var(--muted); margin-bottom: 4px; }
.topbar .right { margin-left: auto; display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.fresh { font-size: 12px; color: var(--muted); display: inline-flex; align-items: center; gap: 6px; }
.fresh::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--good); }
.btn.menu-btn { display: none; }

/* Cards and grid */
.grid { display: grid; gap: 14px; }
.kpis { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
.cols-2 { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }
.cols-even { grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); min-width: 0; }
.card-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; padding: 14px 16px 0; }
.card-head .aside { margin-left: auto; font-size: 12px; color: var(--muted); }
.card-body { padding: 12px 16px 16px; }
.card-body.flush { padding: 8px 0 4px; }
.section { margin-top: 14px; }

.kpi { padding: 14px 16px; }
.kpi .label { font-size: 12px; color: var(--muted); display: flex; align-items: center; gap: 6px; }
.kpi .value { font: 600 1.6rem/1.2 var(--display); margin-top: 6px; font-variant-numeric: tabular-nums; }
.kpi .delta { font-size: 12px; margin-top: 4px; color: var(--muted); }
.delta .up { color: var(--good); font-weight: 600; }
.delta .down { color: var(--bad); font-weight: 600; }

/* Tables */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 9px 12px; border-bottom: 1px solid var(--line-2); vertical-align: top; }
th { font-size: 11.5px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; white-space: nowrap; background: var(--surface); position: sticky; top: 0; }
td.r, th.r { text-align: right; }
tbody tr:hover td { background: var(--surface-2); }
tbody tr:last-child td { border-bottom: 0; }
.title-cell { min-width: 280px; max-width: 460px; }
.title-cell .t { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.sku { font-weight: 600; color: var(--ink); }
.sub { font-size: 12px; color: var(--muted); }
th a { color: inherit; }
th a.on { color: var(--accent); }

/* Pills and badges */
.badge { display: inline-flex; align-items: center; gap: 5px; font-size: 11.5px; font-weight: 500; padding: 2px 8px; border-radius: 999px; white-space: nowrap; border: 1px solid transparent; }
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge.plain::before { display: none; }
.b-good { background: var(--good-soft); color: var(--good); }
.b-warn { background: var(--warn-soft); color: var(--warn); }
.b-bad { background: var(--bad-soft); color: var(--bad); }
.b-muted { background: var(--surface-2); color: var(--muted); border-color: var(--line); }
.b-accent { background: var(--accent-soft); color: var(--accent); }

/* Forms */
.filters { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 12px; }
.input, select.input { font: inherit; color: var(--ink); background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 7px 10px; min-width: 0; }
.input:focus { outline: 2px solid var(--accent-soft); border-color: var(--accent); }
.search { flex: 1 1 260px; max-width: 360px; }
textarea.input { width: 100%; font: inherit; resize: vertical; }
details.card > summary { list-style: none; }
details.card > summary::-webkit-details-marker { display: none; }
.btn { font: inherit; font-weight: 500; display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 8px 14px; border-radius: 8px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); cursor: pointer; text-decoration: none; }
.btn:hover { text-decoration: none; border-color: var(--muted); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { filter: brightness(1.05); }
.btn.danger { color: var(--bad); }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; background: var(--surface); }
.seg a { padding: 6px 12px; color: var(--ink-2); border-right: 1px solid var(--line); font-size: 13px; }
.seg a:last-child { border-right: 0; }
.seg a.on { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.seg a:hover { text-decoration: none; }

/* Lists */
.list { list-style: none; margin: 0; padding: 0; }
.list li { display: flex; gap: 12px; align-items: flex-start; padding: 10px 16px; border-top: 1px solid var(--line-2); }
.list li:first-child { border-top: 0; }
.list .grow { min-width: 0; flex: 1; }
.list .end { margin-left: auto; text-align: right; white-space: nowrap; }
.bar { height: 6px; border-radius: 3px; background: var(--line-2); overflow: hidden; margin-top: 6px; }
.bar span { display: block; height: 100%; background: var(--chart); border-radius: 3px; }
.empty { padding: 18px 16px; color: var(--muted); }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; margin: 0; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
.bullets { margin: 0; padding-left: 18px; display: grid; gap: 6px; }
.note { padding: 10px 14px; border-radius: 8px; background: var(--warn-soft); color: var(--warn); margin-bottom: 14px; }
.note.ok { background: var(--good-soft); color: var(--good); }
.note.bad { background: var(--bad-soft); color: var(--bad); }
.stack { display: grid; gap: 6px; }

/* Charts */
.chart { position: relative; }
.chart svg { display: block; width: 100%; height: auto; overflow: visible; }
.chart .grid-line { stroke: var(--line-2); stroke-width: 1; }
.chart .axis { fill: var(--muted); font-size: 11px; font-family: var(--font); }
.chart .line { fill: none; stroke: var(--chart); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.chart .area { fill: var(--chart-fill); stroke: none; }
.chart .hit { fill: transparent; }
.chart .hover-line { stroke: var(--muted); stroke-width: 1; stroke-dasharray: 3 3; }
.chart .hover-dot { fill: var(--surface); stroke: var(--chart); stroke-width: 2; }
.chart .barmark { fill: var(--chart); }
.tip { position: fixed; pointer-events: none; z-index: 50; background: var(--ink); color: var(--surface); border-radius: 6px; padding: 6px 9px; font-size: 12px; line-height: 1.35; white-space: nowrap; transform: translate(-50%, calc(-100% - 10px)); box-shadow: 0 4px 14px rgba(0,0,0,.18); }
.tip strong { font-variant-numeric: tabular-nums; }
.chart-tabs { display: flex; gap: 4px; }
.chart-tabs button { font: inherit; font-size: 12px; border: 1px solid var(--line); background: var(--surface); color: var(--ink-2); border-radius: 6px; padding: 3px 9px; cursor: pointer; }
.chart-tabs button.on { background: var(--accent-soft); color: var(--accent); border-color: transparent; font-weight: 600; }
details.table-view summary { cursor: pointer; font-size: 12px; color: var(--muted); padding: 0 16px 12px; }

/* Pagination */
.pager { display: flex; gap: 8px; align-items: center; justify-content: space-between; padding: 12px 16px; border-top: 1px solid var(--line-2); font-size: 13px; color: var(--muted); }

/* Sign-in */
.auth { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); }
.auth-art { background: radial-gradient(1200px 600px at 10% 0%, #17423c 0%, #0c1c19 55%), #0c1c19; color: #d6e6e2; padding: 48px clamp(24px, 5vw, 72px); display: flex; flex-direction: column; justify-content: space-between; }
.auth-art .brandmark strong { font-size: 17px; }
.auth-art h2 { font-size: clamp(1.6rem, 2.6vw, 2.3rem); line-height: 1.15; color: #fff; max-width: 18ch; }
.auth-art p { color: #9fb9b2; max-width: 44ch; }
.auth-points { display: grid; gap: 10px; margin: 24px 0 0; padding: 0; list-style: none; color: #c3d6d1; }
.auth-points li { display: flex; gap: 10px; align-items: center; }
.auth-points li::before { content: ""; width: 18px; height: 18px; border-radius: 50%; background: rgba(18, 163, 151, .18) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M4 8.5l2.5 2.5L12 5.5' stroke='%2333c7b9' stroke-width='2' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center/12px no-repeat; flex: none; }
.auth-form { display: grid; place-items: center; padding: 40px max(16px, 4vw); background: var(--surface); }
.auth-box { width: 100%; max-width: 380px; }
.auth-box h1 { font-size: 1.6rem; }
.auth-box .lead { color: var(--muted); margin: 6px 0 24px; }
.field { display: grid; gap: 6px; margin-bottom: 14px; }
.field label { font-size: 13px; font-weight: 500; }
.field .input { width: 100%; padding: 10px 12px; }
.check { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--ink-2); margin: 4px 0 18px; }
.btn.block { width: 100%; padding: 11px 14px; }
.or { display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: 12px; margin: 18px 0; }
.or::before, .or::after { content: ""; height: 1px; background: var(--line); flex: 1; }
.auth-foot { margin-top: 26px; font-size: 12px; color: var(--muted); }

/* Approval page */
.legacy > .card { padding: 16px; margin-bottom: 12px; }
.legacy .card p { margin: 8px 0; }
.legacy .row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.legacy .scroll { overflow-x: auto; margin: 10px 0; border: 1px solid var(--line-2); border-radius: 8px; }
.legacy button { font: inherit; font-weight: 500; padding: 7px 14px; border-radius: 8px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); cursor: pointer; }
.legacy .row form:first-child button { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.legacy button[disabled] { opacity: .5; cursor: not-allowed; }
.legacy h2 { margin: 24px 0 10px; }
.legacy > .scroll { background: var(--surface); }
.legacy code { overflow-wrap: anywhere; }
.legacy small { color: var(--muted); }

@media (max-width: 1100px) { .cols-2 { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 860px) {
    .shell { grid-template-columns: minmax(0, 1fr); }
    .side { position: fixed; inset: 0 auto 0 0; width: 260px; z-index: 40; transform: translateX(-100%); transition: transform .2s; }
    .side.open { transform: none; box-shadow: 0 0 0 100vmax rgba(0,0,0,.35); }
    .btn.menu-btn { display: inline-flex; }
    .auth { grid-template-columns: minmax(0, 1fr); }
    .auth-art { padding: 28px 20px; }
    .auth-art .pitch { display: none; }
}
