/* ============================================================
   WHTE MOSS Global Supply Chain Dashboard
   Luxury Global Ops visual system
   FastAPI + Jinja + vanilla JS
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Manrope:wght@400;500;600;700;800&family=Newsreader:opsz,wght@6..72,500;6..72,600;6..72,700&family=Noto+Sans+TC:wght@400;500;600;700&family=Noto+Serif+TC:wght@500;600;700&display=swap');

:root {
    --bg: #111713;
    --bg-2: #172119;
    --bg-3: #253126;
    --surface: #fffaf0;
    --surface-2: #f5ecdc;
    --surface-3: #e8dcc8;
    --surface-dark: #18231b;
    --surface-dark-2: #223027;
    --hover: #f0e4cf;

    --ink: #182019;
    --ink-soft: #5f6258;
    --muted: #8b877c;
    --muted-dark: #b9b29e;
    --line: rgba(52, 45, 31, .14);
    --line-soft: rgba(52, 45, 31, .08);
    --line-strong: rgba(52, 45, 31, .24);
    --line-dark: rgba(255, 250, 240, .16);

    --accent: #b9853e;
    --accent-hover: #d29b4d;
    --accent-deep: #745020;
    --accent-soft: #f2dfbd;
    --accent-line: rgba(185, 133, 62, .35);
    --emerald: #2f8068;
    --emerald-soft: #dcefe8;

    --red: #bd493c;
    --red-soft: #fae5df;
    --yellow: #c58a2c;
    --yellow-soft: #f8eccd;
    --green: #34765b;
    --green-soft: #dcefe5;
    --blue: #346e8d;
    --blue-soft: #ddebf1;
    --purple: #7559a5;
    --purple-soft: #ece5f6;

    --font-sans: "Manrope", "Noto Sans TC", -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang TC", "Microsoft JhengHei", system-ui, sans-serif;
    --font-serif: "Newsreader", "Noto Serif TC", Georgia, serif;
    --font-mono: "SF Mono", ui-monospace, Menlo, Consolas, monospace;

    --radius: 18px;
    --radius-sm: 12px;
    --radius-xs: 8px;
    --tap: 44px;

    --shadow-sm: 0 1px 2px rgba(12, 14, 10, .08);
    --shadow: 0 16px 42px rgba(10, 14, 10, .12), 0 1px 2px rgba(10, 14, 10, .06);
    --shadow-lg: 0 30px 100px rgba(0, 0, 0, .38), 0 2px 8px rgba(0, 0, 0, .16);
    --t: 160ms cubic-bezier(.2, .8, .2, 1);
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
    min-height: 100vh;
    color: var(--ink);
    font-family: var(--font-sans);
    font-size: 14px;
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
    background:
        radial-gradient(circle at 8% 0%, rgba(185, 133, 62, .20), transparent 26%),
        radial-gradient(circle at 94% 12%, rgba(47, 128, 104, .20), transparent 30%),
        linear-gradient(135deg, var(--bg), var(--bg-2) 52%, #0f1411);
    background-attachment: fixed;
}

body::before {
    content: "";
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: -1;
    opacity: .36;
    background-image:
        linear-gradient(rgba(255, 250, 240, .045) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 250, 240, .035) 1px, transparent 1px);
    background-size: 42px 42px;
    mask-image: linear-gradient(to bottom, #000, transparent 82%);
}

::selection {
    background: rgba(185, 133, 62, .28);
    color: #fffaf0;
}

a {
    color: var(--accent-deep);
    text-decoration: none;
    transition: color var(--t), opacity var(--t);
}
a:hover { color: var(--accent); text-decoration: underline; }

/* Header */
.app-header {
    position: sticky;
    top: 0;
    z-index: 50;
    display: flex;
    align-items: center;
    gap: 18px;
    padding: 14px clamp(16px, 3vw, 36px);
    border-bottom: 1px solid var(--line-dark);
    background: rgba(16, 23, 18, .82);
    color: #fffaf0;
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
}

.app-title {
    margin: 0;
    display: flex;
    align-items: center;
    min-width: 0;
    flex-shrink: 0;
    color: #fffaf0;
    font-family: var(--font-serif);
    font-size: 16px;
    font-weight: 650;
    letter-spacing: .2px;
    line-height: 1.2;
}
.app-title .seg { padding: 0 4px; color: rgba(255, 250, 240, .80); }
.app-title .brand {
    color: #fffaf0;
    letter-spacing: 1.7px;
    text-transform: uppercase;
    font-weight: 700;
}
.app-title .dot {
    color: var(--accent);
    margin: 0 3px;
    font-weight: 700;
}

.app-nav {
    display: flex;
    gap: 6px;
    margin-left: auto;
    align-items: center;
    flex-wrap: wrap;
}
.app-nav a,
.app-nav .nav-link {
    min-height: 38px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 8px 13px;
    color: rgba(255, 250, 240, .76);
    border: 1px solid transparent;
    border-radius: 999px;
    font-size: 13px;
    font-weight: 700;
    line-height: 1.2;
    text-decoration: none;
    background: transparent;
    transition: all var(--t);
}
.app-nav a:hover,
.app-nav .nav-link:hover {
    color: #fffaf0;
    background: rgba(255, 250, 240, .09);
    border-color: rgba(255, 250, 240, .10);
    text-decoration: none;
}
.app-nav a.active {
    color: #191f19;
    background: linear-gradient(135deg, #f3d89e, var(--accent));
    border-color: rgba(255, 250, 240, .18);
    box-shadow: 0 10px 28px rgba(185, 133, 62, .24);
}
.user-pill {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    min-height: 34px;
    padding: 6px 12px;
    border: 1px solid rgba(255, 250, 240, .14);
    border-radius: 999px;
    color: rgba(255, 250, 240, .75);
    background: rgba(255, 250, 240, .06);
    font-size: 12px;
    font-weight: 700;
}

/* Layout */
.container {
    width: min(1460px, calc(100% - 48px));
    margin: 0 auto;
    padding: 30px 0 84px;
}

.page-title {
    margin: 0 0 7px;
    color: #fffaf0;
    font-family: var(--font-serif);
    font-size: clamp(34px, 5vw, 62px);
    font-weight: 650;
    letter-spacing: 0;
    line-height: .98;
}
.page-sub {
    margin: 0;
    max-width: 760px;
    color: rgba(255, 250, 240, .72);
    font-size: 14px;
}
.eyebrow {
    margin-bottom: 10px;
    color: var(--accent);
    font-size: 11px;
    font-weight: 800;
    letter-spacing: .18em;
    line-height: 1.2;
    text-transform: uppercase;
}

.ops-hero {
    position: relative;
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(360px, auto);
    align-items: end;
    gap: 26px;
    margin-bottom: 20px;
    padding: 30px;
    overflow: hidden;
    border: 1px solid rgba(255, 250, 240, .14);
    border-radius: 28px;
    background:
        linear-gradient(135deg, rgba(255, 250, 240, .08), rgba(255, 250, 240, .02)),
        radial-gradient(circle at 0% 0%, rgba(185, 133, 62, .24), transparent 34%),
        radial-gradient(circle at 88% 20%, rgba(47, 128, 104, .28), transparent 30%),
        rgba(17, 24, 19, .76);
    box-shadow: var(--shadow-lg);
}
.ops-hero::after {
    content: "";
    position: absolute;
    inset: auto 30px 0 30px;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(255, 250, 240, .40), transparent);
}
.maintain-hero { margin-bottom: 18px; }

.status-rail {
    display: grid;
    grid-template-columns: repeat(3, minmax(112px, 1fr));
    gap: 10px;
    align-items: stretch;
}
.status-rail--compact { grid-template-columns: repeat(2, minmax(150px, 1fr)); }
.status-chip {
    min-width: 0;
    padding: 12px 13px;
    border: 1px solid rgba(255, 250, 240, .15);
    border-radius: 16px;
    background: rgba(255, 250, 240, .07);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, .06);
}
.status-chip span {
    display: block;
    margin-bottom: 3px;
    color: rgba(255, 250, 240, .52);
    font-size: 10px;
    font-weight: 800;
    letter-spacing: .13em;
    text-transform: uppercase;
}
.status-chip strong {
    display: block;
    max-width: 200px;
    overflow: hidden;
    color: #fffaf0;
    font-size: 12px;
    font-weight: 800;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Control panels */
.control-panel {
    display: grid;
    grid-template-columns: 330px minmax(0, 1fr);
    gap: 16px;
    margin-bottom: 18px;
}
.control-block {
    min-width: 0;
    padding: 18px;
    border: 1px solid rgba(255, 250, 240, .14);
    border-radius: 22px;
    background: rgba(255, 250, 240, .10);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, .05);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}
.control-block--markets { min-width: 0; }
.section-title {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
}
.section-title h2 {
    margin: 0;
    color: #fffaf0;
    font-size: 13px;
    font-weight: 800;
    letter-spacing: .04em;
}
.section-title span,
.inline-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    color: rgba(255, 250, 240, .58);
    font-size: 12px;
}
.seasonal-strip,
.filter-strip {
    margin-top: 12px;
    color: rgba(255, 250, 240, .72);
    font-size: 12px;
}
.filter-strip {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 9px 11px;
    border: 1px solid rgba(255, 250, 240, .12);
    border-radius: 999px;
    background: rgba(47, 128, 104, .20);
}

/* Cards */
.card,
.chart-card {
    position: relative;
    margin-bottom: 18px;
    padding: 20px;
    overflow: hidden;
    border: 1px solid rgba(255, 250, 240, .74);
    border-radius: var(--radius);
    background:
        linear-gradient(180deg, rgba(255, 255, 255, .70), rgba(255, 255, 255, .12)),
        var(--surface);
    box-shadow: var(--shadow);
}
.card::before,
.chart-card::before {
    content: "";
    position: absolute;
    inset: 0 0 auto 0;
    height: 3px;
    background: linear-gradient(90deg, var(--accent), var(--emerald), transparent 82%);
    opacity: .85;
}
.card:hover,
.chart-card:hover {
    border-color: rgba(255, 250, 240, .95);
    box-shadow: 0 18px 50px rgba(10, 14, 10, .16), 0 1px 2px rgba(10, 14, 10, .07);
}
.card h2,
.chart-card h2 {
    display: flex;
    align-items: baseline;
    gap: 10px;
    flex-wrap: wrap;
    margin: 0 0 15px;
    color: var(--ink);
    font-family: var(--font-serif);
    font-size: 20px;
    font-weight: 650;
    line-height: 1.16;
}
.card .card-meta,
.chart-card h2 .card-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    margin-left: auto;
    color: var(--muted);
    font-family: var(--font-sans);
    font-size: 11px;
    font-weight: 800;
    letter-spacing: .08em;
    text-transform: uppercase;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    min-height: 40px;
    padding: 9px 15px;
    border: 1px solid rgba(24, 32, 25, .18);
    border-radius: 999px;
    background: linear-gradient(135deg, var(--surface-dark-2), var(--surface-dark));
    color: #fffaf0;
    box-shadow: 0 8px 18px rgba(13, 17, 14, .12);
    cursor: pointer;
    font-family: inherit;
    font-size: 13px;
    font-weight: 800;
    line-height: 1.2;
    text-decoration: none;
    white-space: nowrap;
    transition: transform var(--t), background var(--t), border-color var(--t), box-shadow var(--t), opacity var(--t);
}
.btn:hover {
    transform: translateY(-1px);
    background: linear-gradient(135deg, #2a3a2f, #17231c);
    color: #fffaf0;
    text-decoration: none;
}
.btn:active { transform: translateY(0); opacity: .88; }
.btn.primary {
    border-color: rgba(255, 250, 240, .18);
    background: linear-gradient(135deg, #f0cf86, var(--accent) 58%, #7e5a27);
    color: #141a15;
    box-shadow: 0 12px 28px rgba(185, 133, 62, .28);
}
.btn.primary:hover {
    background: linear-gradient(135deg, #f5daa4, var(--accent-hover) 58%, #8b652e);
    color: #141a15;
}
.btn.secondary {
    background: rgba(255, 250, 240, .74);
    color: var(--ink);
    border-color: var(--line-strong);
    box-shadow: none;
}
.btn.secondary:hover {
    background: var(--surface);
    border-color: var(--accent-line);
    color: var(--ink);
}
.btn.ghost {
    background: transparent;
    border-color: transparent;
    box-shadow: none;
    color: var(--ink-soft);
}
.btn.ghost:hover {
    background: rgba(185, 133, 62, .10);
    color: var(--ink);
}
.btn.tiny {
    min-height: 32px;
    padding: 6px 11px;
    font-size: 11.5px;
}
.btn.danger {
    background: linear-gradient(135deg, #d96756, var(--red));
    color: #fffaf0;
    border-color: rgba(189, 73, 60, .32);
}
.btn.danger:hover { background: linear-gradient(135deg, #e17566, #a93f34); }

/* Form elements */
.input,
select.input,
textarea.input {
    width: 100%;
    min-height: 40px;
    padding: 9px 11px;
    border: 1px solid var(--line-strong);
    border-radius: 12px;
    background: rgba(255, 253, 247, .86);
    color: var(--ink);
    font-family: inherit;
    font-size: 13px;
    line-height: 1.35;
    transition: border-color var(--t), box-shadow var(--t), background var(--t);
}
.input:focus,
select.input:focus,
textarea.input:focus {
    outline: none;
    border-color: var(--accent);
    background: #fffef9;
    box-shadow: 0 0 0 4px rgba(185, 133, 62, .16);
}
.input:disabled {
    background: rgba(232, 220, 200, .58);
    color: var(--muted);
    cursor: not-allowed;
}
.input::placeholder { color: #aaa293; }
label.field { display: block; margin-bottom: 12px; }
label.field .label {
    display: block;
    margin-bottom: 5px;
    color: var(--ink-soft);
    font-size: 12px;
    font-weight: 800;
}
label.field .desc {
    display: block;
    margin-top: 5px;
    color: var(--muted);
    font-size: 11px;
}

/* Tables */
.table-wrap {
    width: 100%;
    overflow-x: auto;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: rgba(255, 253, 247, .64);
    -webkit-overflow-scrolling: touch;
}
table.data {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}
table.data th {
    position: relative;
    padding: 10px 12px;
    border-bottom: 1px solid var(--line);
    background: rgba(245, 236, 220, .92);
    color: #6d675c;
    font-size: 10.5px;
    font-weight: 900;
    letter-spacing: .11em;
    line-height: 1.2;
    text-align: left;
    text-transform: uppercase;
    white-space: nowrap;
}
table.data td {
    padding: 10px 12px;
    border-bottom: 1px solid var(--line-soft);
    color: var(--ink);
    vertical-align: middle;
}
table.data tr:last-child td { border-bottom: none; }
table.data tbody tr { transition: background var(--t); }
table.data tbody tr:hover td { background: rgba(185, 133, 62, .075); }
table.data td.num {
    text-align: right;
    font-family: var(--font-mono);
    font-size: 12px;
    font-variant-numeric: tabular-nums;
}
table.data .sku-cell {
    color: var(--ink);
    font-weight: 800;
}
.sku-link {
    all: unset;
    display: inline-flex;
    align-items: center;
    max-width: 260px;
    min-height: 30px;
    padding: 4px 7px;
    margin: -4px -7px;
    border-radius: 8px;
    color: var(--ink);
    cursor: pointer;
    font-weight: 900;
    line-height: 1.25;
}
.sku-link:hover {
    background: rgba(47, 128, 104, .10);
    color: var(--emerald);
}
.sku-link:focus-visible {
    outline: 3px solid rgba(185, 133, 62, .30);
    outline-offset: 2px;
}

/* Badges */
.alert-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 9px;
    border: 1px solid transparent;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 900;
    line-height: 1.25;
    white-space: nowrap;
}
.alert-badge .dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
}
.alert-red {
    background: var(--red-soft);
    color: var(--red);
    border-color: rgba(189, 73, 60, .18);
}
.alert-red .dot { background: var(--red); }
.alert-yellow {
    background: var(--yellow-soft);
    color: #9a6419;
    border-color: rgba(197, 138, 44, .18);
}
.alert-yellow .dot { background: var(--yellow); }
.alert-green {
    background: var(--green-soft);
    color: var(--green);
    border-color: rgba(52, 118, 91, .18);
}
.alert-green .dot { background: var(--green); }
.alert-unknown {
    background: var(--surface-2);
    color: var(--muted);
    border-color: var(--line);
}
.no-po-tag,
.season-tag {
    display: inline-flex;
    align-items: center;
    margin-left: 7px;
    padding: 3px 7px;
    border-radius: 999px;
    font-size: 10.5px;
    font-weight: 900;
    line-height: 1.2;
    vertical-align: middle;
}
.no-po-tag {
    background: var(--red-soft);
    color: var(--red);
}
.season-tag {
    gap: 4px;
    background: var(--blue-soft);
    color: var(--blue);
}

/* Platform and market controls */
.platform-tabs {
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
    max-width: 100%;
}
.platform-tab {
    min-height: 44px;
    padding: 10px 14px;
    border: 1px solid rgba(255, 250, 240, .14);
    border-radius: 14px;
    background: rgba(255, 250, 240, .07);
    color: rgba(255, 250, 240, .70);
    cursor: pointer;
    font-family: inherit;
    font-size: 13px;
    font-weight: 900;
    text-align: left;
    transition: all var(--t);
}
.platform-tab:hover {
    color: #fffaf0;
    background: rgba(255, 250, 240, .11);
}
.platform-tab.active {
    color: #151b15;
    border-color: rgba(255, 250, 240, .20);
    background: linear-gradient(135deg, #f2d79d, var(--accent));
    box-shadow: 0 10px 24px rgba(185, 133, 62, .22);
}
.platform-tab:disabled {
    cursor: not-allowed;
    opacity: .48;
}
.platform-tab.coming { font-style: normal; }

.market-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(145px, 1fr));
    gap: 8px;
    margin: 4px 0;
}
.market-chip {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    min-height: 40px;
    padding: 8px 10px;
    border: 1px solid rgba(255, 250, 240, .14);
    border-radius: 13px;
    background: rgba(255, 250, 240, .07);
    color: rgba(255, 250, 240, .74);
    cursor: pointer;
    font-size: 12.5px;
    font-weight: 800;
    user-select: none;
    transition: all var(--t);
}
.market-chip:hover {
    background: rgba(255, 250, 240, .12);
    color: #fffaf0;
}
.market-chip input {
    margin: 0;
    accent-color: var(--accent);
}
.market-chip.checked {
    background: rgba(185, 133, 62, .18);
    border-color: rgba(185, 133, 62, .46);
    color: #fffaf0;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, .06);
}
.market-chip .code {
    margin-left: auto;
    color: rgba(255, 250, 240, .42);
    font-family: var(--font-mono);
    font-size: 10px;
}
.market-chip.checked .code {
    color: #f0cf86;
    opacity: .95;
}
.card .market-chip,
.drawer-section .market-chip,
.auth-card .market-chip {
    border-color: var(--line-strong);
    background: rgba(255, 253, 247, .72);
    color: var(--ink-soft);
}
.card .market-chip:hover,
.drawer-section .market-chip:hover,
.auth-card .market-chip:hover {
    background: var(--hover);
    color: var(--ink);
}
.card .market-chip.checked,
.drawer-section .market-chip.checked,
.auth-card .market-chip.checked {
    border-color: var(--accent-line);
    background: var(--accent-soft);
    color: var(--accent-deep);
}
.card .market-chip .code,
.drawer-section .market-chip .code,
.auth-card .market-chip .code {
    color: var(--muted);
}

/* Toolbar and maintain nav */
.toolbar {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 14px;
}
.toolbar .grow { flex: 1; }

.subnav {
    position: sticky;
    top: 66px;
    z-index: 30;
    display: flex;
    gap: 7px;
    margin: 0 0 18px;
    padding: 9px;
    overflow-x: auto;
    border: 1px solid rgba(255, 250, 240, .14);
    border-radius: 18px;
    background: rgba(17, 24, 19, .72);
    box-shadow: 0 18px 40px rgba(0, 0, 0, .18);
    -webkit-overflow-scrolling: touch;
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
}
.subnav .sub-tab {
    flex: 0 0 auto;
    min-height: 38px;
    padding: 9px 13px;
    border: 1px solid transparent;
    border-radius: 999px;
    background: transparent;
    color: rgba(255, 250, 240, .64);
    cursor: pointer;
    font-family: inherit;
    font-size: 12px;
    font-weight: 900;
    white-space: nowrap;
    transition: all var(--t);
}
.subnav .sub-tab:hover {
    color: #fffaf0;
    background: rgba(255, 250, 240, .08);
}
.subnav .sub-tab.active {
    color: #141a15;
    background: linear-gradient(135deg, #f0d9a3, var(--accent));
    border-color: rgba(255, 250, 240, .16);
}

/* Auth */
.auth-shell {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background:
        radial-gradient(circle at 15% 10%, rgba(185, 133, 62, .30), transparent 30%),
        radial-gradient(circle at 84% 76%, rgba(47, 128, 104, .30), transparent 28%),
        linear-gradient(135deg, var(--bg), #0d120f);
}
.auth-card {
    width: min(430px, 100%);
    padding: 40px 34px 30px;
    border: 1px solid rgba(255, 250, 240, .70);
    border-radius: 28px;
    background: var(--surface);
    box-shadow: var(--shadow-lg);
}
.auth-card h1 {
    margin: 0 0 6px;
    color: var(--ink);
    font-family: var(--font-serif);
    font-size: 34px;
    font-weight: 700;
    letter-spacing: .08em;
}
.auth-card .brand-sub {
    margin: 0 0 18px;
    color: var(--accent-deep);
    font-size: 12px;
    font-weight: 900;
    letter-spacing: .12em;
    text-transform: uppercase;
}
.auth-card .sub {
    margin: 0 0 20px;
    color: var(--ink-soft);
    font-size: 13px;
}
.auth-card .btn {
    width: 100%;
    min-height: 46px;
    margin-top: 4px;
    font-size: 14px;
}
.auth-error,
.auth-msg {
    margin-bottom: 12px;
    padding: 10px 12px;
    border-radius: 14px;
    font-size: 12.5px;
    font-weight: 800;
}
.auth-error {
    color: var(--red);
    background: var(--red-soft);
    border: 1px solid rgba(189, 73, 60, .18);
}
.auth-msg {
    color: var(--green);
    background: var(--green-soft);
    border: 1px solid rgba(52, 118, 91, .18);
}

/* Summary tiles */
.summary-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 14px;
    margin-bottom: 18px;
}
.summary-tile {
    position: relative;
    overflow: hidden;
    min-height: 118px;
    padding: 18px;
    border: 1px solid rgba(255, 250, 240, .16);
    border-radius: 22px;
    background:
        linear-gradient(145deg, rgba(255, 250, 240, .18), rgba(255, 250, 240, .06)),
        rgba(255, 250, 240, .08);
    color: #fffaf0;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, .06);
}
.summary-tile::after {
    content: "";
    position: absolute;
    inset: auto -24px -40px auto;
    width: 110px;
    height: 110px;
    border-radius: 50%;
    background: rgba(185, 133, 62, .16);
}
.summary-tile .num {
    position: relative;
    z-index: 1;
    color: #fffaf0;
    font-family: var(--font-serif);
    font-size: 44px;
    font-weight: 700;
    line-height: .9;
}
.summary-tile .lbl {
    position: relative;
    z-index: 1;
    margin-top: 10px;
    color: rgba(255, 250, 240, .66);
    font-size: 12px;
    font-weight: 900;
    letter-spacing: .08em;
    text-transform: uppercase;
}
.summary-tile.red { border-color: rgba(189, 73, 60, .34); }
.summary-tile.yellow { border-color: rgba(197, 138, 44, .40); }
.summary-tile.green { border-color: rgba(52, 118, 91, .36); }
.summary-tile.red .num { color: #f29b8c; }
.summary-tile.yellow .num { color: #f1c26a; }
.summary-tile.green .num { color: #9bd8bd; }

/* Charts */
.charts-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 18px;
    margin-bottom: 24px;
}
.chart-card {
    min-height: 444px;
}
.chart-card--wide {
    grid-column: 1 / -1;
    min-height: 478px;
}
.chart-host {
    position: relative;
    width: 100%;
    height: 370px;
}
.chart-host canvas { max-width: 100%; }
.chart-card--donut .chart-host { height: 370px; }
.chart-center {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    pointer-events: none;
    text-align: center;
}
.chart-center .big {
    color: var(--ink);
    font-family: var(--font-serif);
    font-size: 54px;
    font-weight: 700;
    line-height: .9;
}
.chart-center .small {
    margin-top: 8px;
    color: var(--muted);
    font-size: 11px;
    font-weight: 900;
    letter-spacing: .14em;
    text-transform: uppercase;
}

/* Drawer */
.drawer-backdrop {
    position: fixed;
    inset: 0;
    z-index: 80;
    pointer-events: none;
    opacity: 0;
    background: rgba(4, 7, 5, .48);
    backdrop-filter: blur(3px);
    -webkit-backdrop-filter: blur(3px);
    transition: opacity var(--t);
}
.drawer-backdrop.open {
    pointer-events: auto;
    opacity: 1;
}
.sku-drawer {
    position: fixed;
    top: 12px;
    right: 12px;
    bottom: 12px;
    z-index: 90;
    display: flex;
    flex-direction: column;
    width: min(540px, calc(100vw - 24px));
    overflow: hidden;
    border: 1px solid rgba(255, 250, 240, .76);
    border-radius: 28px;
    background: var(--surface);
    box-shadow: var(--shadow-lg);
    transform: translateX(calc(100% + 28px));
    transition: transform 220ms cubic-bezier(.2, .8, .2, 1);
}
.sku-drawer.open { transform: translateX(0); }
.drawer-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    padding: 22px 22px 16px;
    border-bottom: 1px solid rgba(255, 250, 240, .14);
    background:
        radial-gradient(circle at 100% 0%, rgba(185, 133, 62, .26), transparent 36%),
        linear-gradient(135deg, #17231c, #0f1512);
}
.drawer-head h2 {
    margin: 0;
    color: #fffaf0;
    font-family: var(--font-serif);
    font-size: 26px;
    font-weight: 700;
    line-height: 1.05;
}
.icon-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border: 1px solid rgba(255, 250, 240, .14);
    border-radius: 999px;
    background: rgba(255, 250, 240, .08);
    color: #fffaf0;
    cursor: pointer;
    font-family: inherit;
    font-size: 24px;
    line-height: 1;
    transition: all var(--t);
}
.icon-btn:hover {
    background: rgba(255, 250, 240, .16);
}
.drawer-body {
    padding: 18px 20px 28px;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}
.drawer-section {
    margin-bottom: 14px;
    padding: 15px;
    border: 1px solid var(--line);
    border-radius: 18px;
    background:
        linear-gradient(180deg, rgba(255, 255, 255, .56), rgba(255, 255, 255, 0)),
        rgba(245, 236, 220, .68);
}
.drawer-section h3 {
    margin: 0 0 12px;
    color: var(--ink);
    font-size: 13px;
    font-weight: 900;
    letter-spacing: .05em;
    text-transform: uppercase;
}
.drawer-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    margin-bottom: 12px;
}
.drawer-grid .field:first-child:nth-last-child(3),
.drawer-grid .field:first-child:nth-last-child(3) ~ .field {
    grid-column: auto;
}
.drawer-stat {
    padding: 11px;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: rgba(255, 253, 247, .76);
}
.drawer-stat span,
.drawer-metric label span {
    display: block;
    color: var(--muted);
    font-size: 11px;
    font-weight: 800;
}
.drawer-stat strong {
    display: block;
    margin-top: 3px;
    color: var(--ink);
    font-family: var(--font-mono);
    font-size: 16px;
}
.drawer-metric {
    display: grid;
    grid-template-columns: minmax(150px, 1fr) 118px;
    align-items: center;
    gap: 10px;
    padding: 9px 0;
    border-bottom: 1px solid var(--line-soft);
}
.drawer-metric:last-of-type { border-bottom: none; }
.drawer-metric label {
    color: var(--ink);
    font-size: 12.5px;
    font-weight: 900;
}
.drawer-list {
    margin: 8px 0 0;
    padding-left: 18px;
    color: var(--ink-soft);
    font-size: 12px;
}
.drawer-list li { margin: 5px 0; }
.drawer-columns {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-bottom: 12px;
}

/* Utility */
.setting-row {
    display: grid;
    grid-template-columns: minmax(180px, 250px) minmax(0, 1fr) 86px;
    gap: 12px;
    align-items: center;
    padding: 10px 0;
    border-bottom: 1px solid var(--line-soft);
}
.kbd {
    padding: 2px 7px;
    border: 1px solid var(--line);
    border-radius: 7px;
    background: var(--surface-2);
    color: var(--ink);
    font-family: var(--font-mono);
    font-size: 11px;
}
code {
    padding: 2px 6px;
    border-radius: 7px;
    background: rgba(185, 133, 62, .12);
    color: var(--accent-deep);
    font-family: var(--font-mono);
    font-size: 12px;
}
pre {
    overflow-x: auto;
    padding: 13px;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: rgba(245, 236, 220, .84);
    color: var(--ink);
    font-family: var(--font-mono);
    font-size: 11.5px;
    line-height: 1.5;
}
.empty {
    padding: 34px 12px;
    color: var(--muted);
    font-size: 13px;
    text-align: center;
}
.legend {
    display: flex;
    align-items: center;
    gap: 13px;
    flex-wrap: wrap;
    color: var(--muted);
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 0;
    text-transform: none;
}
.legend .dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    margin-right: 5px;
    border-radius: 50%;
}
.footnote {
    margin: 28px auto 0;
    padding: 14px 18px;
    width: fit-content;
    max-width: 100%;
    border: 1px solid rgba(255, 250, 240, .14);
    border-radius: 999px;
    background: rgba(255, 250, 240, .08);
    color: rgba(255, 250, 240, .65);
    font-size: 12px;
    text-align: center;
}
.footnote .label { color: rgba(255, 250, 240, .78); font-weight: 800; }
.footnote .ts {
    color: #fffaf0;
    font-family: var(--font-mono);
    font-size: 11.5px;
}
.swipe-area { touch-action: pan-y; }
.hidden { display: none !important; }

/* Tablet */
@media (min-width: 769px) and (max-width: 1120px) {
    .container { width: min(100% - 36px, 1120px); padding-top: 24px; }
    .ops-hero { grid-template-columns: 1fr; align-items: start; }
    .status-rail { grid-template-columns: repeat(3, minmax(0, 1fr)) auto; }
    .control-panel { grid-template-columns: 1fr; }
    .platform-tabs { grid-template-columns: repeat(4, minmax(0, 1fr)); }
    .summary-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .chart-host { height: 320px; }
    .chart-card--donut .chart-host { height: 320px; }
}

/* Phone */
@media (max-width: 768px) {
    :root { --radius: 16px; --radius-sm: 12px; }
    .container {
        width: min(100% - 24px, 520px);
        padding: 14px 0 64px;
    }
    .app-header {
        padding: 10px 12px;
        gap: 8px;
        flex-wrap: nowrap;
    }
    .app-title { font-size: 13px; }
    .app-title .seg { display: none; }
    .app-title .seg.brand { display: inline; }
    .app-title .dot { display: none; }
    .app-nav {
        min-width: 0;
        margin-left: auto;
        overflow-x: auto;
        flex-wrap: nowrap;
        scrollbar-width: none;
        -webkit-overflow-scrolling: touch;
    }
    .app-nav::-webkit-scrollbar { display: none; }
    .app-nav a,
    .app-nav .nav-link {
        flex: 0 0 auto;
        min-height: 42px;
        padding: 8px 11px;
        font-size: 12px;
    }
    .user-pill { display: none; }

    .ops-hero {
        grid-template-columns: 1fr;
        gap: 18px;
        padding: 22px 18px;
        border-radius: 24px;
    }
    .page-title { font-size: 38px; }
    .page-sub { font-size: 13px; }
    .status-rail {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        width: 100%;
    }
    .status-rail .btn {
        grid-column: 1 / -1;
        width: 100%;
        min-height: 46px;
    }
    .status-chip { padding: 11px; }

    .control-panel {
        grid-template-columns: 1fr;
        gap: 12px;
    }
    .control-block {
        padding: 15px;
        border-radius: 20px;
    }
    .section-title {
        align-items: flex-start;
        flex-direction: column;
        gap: 9px;
    }
    .inline-actions { width: 100%; }
    .inline-actions .btn { flex: 1; }
    .platform-tabs {
        display: flex;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    .platform-tab {
        flex: 0 0 auto;
        min-width: 130px;
        text-align: center;
    }
    .market-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 7px;
    }
    .market-chip {
        min-height: 44px;
        padding: 8px 9px;
        font-size: 12px;
    }

    .summary-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 10px;
    }
    .summary-tile {
        min-height: 104px;
        padding: 15px;
    }
    .summary-tile .num { font-size: 36px; }
    .summary-tile .lbl { font-size: 10.5px; }

    .charts-grid {
        grid-template-columns: 1fr;
        gap: 14px;
        margin-bottom: 18px;
    }
    .chart-card {
        min-height: 0;
        padding: 16px;
    }
    .chart-card h2,
    .card h2 {
        font-size: 17px;
    }
    .card .card-meta,
    .chart-card h2 .card-meta {
        width: 100%;
        margin-left: 0;
        font-size: 10px;
    }
    .chart-host { height: 284px; }
    .chart-card--donut .chart-host { height: 300px; }
    .chart-host[style*="380px"] { height: 390px !important; }
    .chart-center .big { font-size: 42px; }

    .card {
        padding: 16px;
        margin-bottom: 14px;
        border-radius: 18px;
    }
    .table-wrap {
        margin-inline: -4px;
        border-radius: 13px;
    }
    table.data { font-size: 12px; }
    table.data th,
    table.data td {
        padding: 9px 10px;
        font-size: 11.5px;
    }
    table.data th {
        font-size: 10px;
        letter-spacing: .09em;
    }
    table.data td.num { font-size: 11.5px; }
    .sku-link { max-width: 190px; }
    .sku-link {
        min-height: 36px;
        padding: 7px 8px;
        margin: -7px -8px;
    }

    .toolbar {
        flex-direction: column;
        align-items: stretch;
        gap: 9px;
    }
    .toolbar .field,
    .toolbar > label.field,
    .toolbar > .btn {
        width: 100%;
        min-width: 0 !important;
    }
    .toolbar .grow { display: none; }

    .subnav {
        top: 62px;
        margin-bottom: 14px;
        padding: 8px;
        border-radius: 17px;
        scrollbar-width: none;
    }
    .subnav::-webkit-scrollbar { display: none; }
    .subnav .sub-tab {
        min-height: 42px;
        padding: 9px 12px;
        font-size: 12px;
    }

    .setting-row {
        grid-template-columns: 1fr;
        gap: 7px;
        padding: 12px 0;
    }
    .setting-row > button {
        justify-self: stretch;
        width: 100%;
    }

    .sku-drawer {
        top: auto;
        left: 0;
        right: 0;
        bottom: 0;
        width: 100%;
        max-height: 88vh;
        border-radius: 24px 24px 0 0;
        border-left: 1px solid rgba(255, 250, 240, .70);
        transform: translateY(105%);
    }
    .sku-drawer.open { transform: translateY(0); }
    .drawer-head { padding: 18px 18px 13px; }
    .drawer-head h2 { font-size: 23px; }
    .drawer-body { padding: 14px 14px 26px; }
    .drawer-grid,
    .drawer-columns { grid-template-columns: 1fr; }
    .drawer-metric {
        grid-template-columns: 1fr;
        gap: 7px;
    }
    .drawer-offset { width: 100%; }

    .input,
    select.input,
    textarea.input,
    input.input,
    table.data input.input,
    table.data select.input {
        min-height: 44px;
        font-size: 16px;
    }
    .btn {
        min-height: 44px;
        padding: 10px 15px;
        font-size: 13px;
    }
    .btn.tiny {
        min-height: 44px;
        padding: 7px 11px;
        font-size: 11.5px;
    }
    .footnote {
        width: 100%;
        border-radius: 18px;
        font-size: 11px;
        line-height: 1.65;
    }
}

@media (max-width: 430px) {
    .container { width: min(100% - 20px, 520px); }
    .page-title { font-size: 34px; }
    .summary-grid { gap: 8px; }
    .summary-tile { padding: 13px; }
    .market-chip .code { display: none; }
    .app-nav a,
    .app-nav .nav-link {
        padding: 8px 9px;
    }
}

@media (pointer: coarse) {
    .btn,
    .btn.tiny,
    .market-chip,
    .platform-tab,
    .subnav .sub-tab {
        min-height: var(--tap);
    }
    .input,
    input.input,
    select.input,
    textarea.input {
        font-size: 16px;
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        transition: none !important;
        animation: none !important;
        scroll-behavior: auto !important;
    }
}
