:root {
    color-scheme: light;
    --ink: #17263a; --muted: #506078; --line: #dbe3ec; --surface: #fff; --bg: #f3f6fa;
    --primary: #186451; --primary-hover: #104a3c; --rail: #111d2d;
    --good-bg: #e1f3ec; --good: #125745; --warn-bg: #fff2d5; --warn: #794700;
    --bad-bg: #fde8e8; --bad: #982e38; --neutral-bg: #eaf0f8; --neutral: #415573;
    font: 15px/1.5 "Segoe UI", system-ui, sans-serif;
    color: var(--ink); background: var(--bg);
}
* { box-sizing: border-box; }
body { margin: 0; }
[hidden] { display: none !important; }
a { color: var(--primary); }
:focus-visible { outline: 3px solid #088970; outline-offset: 3px; }
.skip { position: fixed; z-index: 5; top: 4px; left: 4px; transform: translateY(-200%); background: white; padding: 10px; }
.skip:focus { transform: none; }
h1,h2,h3,p { margin: 0; }
h1 { font-size: clamp(1.8rem, 4vw, 2.65rem); letter-spacing: -.038em; line-height: 1.12; margin: 7px 0 9px; }
h2 { font-size: 1.3rem; letter-spacing: -.02em; }
h3 { font-size: 1rem; }
p { max-width: 68ch; }
.muted,small,time { color: var(--muted); }
.sidebar {
    position: fixed; inset: 0 auto 0 0; width: 232px; background: var(--rail); color: #f4f7fb;
    display: flex; flex-direction: column; padding: 26px 16px 16px;
}
.brand { display: flex; align-items: center; gap: 11px; font-size: 1.13rem; font-weight: 740; text-decoration: none; color: inherit; padding: 0 8px; }
.brand small { display: block; font-size: .75rem; font-weight: 500; }
.sidebar small { color: #b1bfd1; }
.sidebar nav { margin-top: 44px; display: grid; gap: 4px; }
.nav-label { padding: 0 10px 7px; font-size: .68rem; letter-spacing: .11em; color: #a8b7cc; font-weight: 700; }
.nav-link { display: flex; width: 100%; align-items: center; gap: 12px; border: 1px solid transparent; border-radius: 8px; padding: 9px 10px; text-decoration: none; color: #cbd6e5; background: none; font-weight: 600; text-align: left; }
.nav-link span { width: 18px; text-align: center; color: #8ba9b6; }
.nav-link:hover { color: white; background: #223347; }
.nav-link[aria-current="page"] { color: #effff7; background: #22394a; border-color: #34536a; }
.nav-link[aria-current="page"] span { color: #72dbb8; }
.logout { margin-top: auto; padding-top: 12px; border-top: 1px solid #304055; }
.workspace { margin-left: 232px; padding: 36px clamp(18px, 4vw, 52px); max-width: 1550px; }
.page-header { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; margin-bottom: 24px; }
.eyebrow { color: #426371; font-size: .7rem; font-weight: 750; letter-spacing: .13em; }
.header-actions,.actions { display: flex; align-items: center; flex-wrap: wrap; gap: 12px; }
.update { color: var(--muted); font-size: .82rem; display: inline-flex; gap: 8px; align-items: center; }
.live-dot { width: 7px; height: 7px; border-radius: 50%; background: #1f896c; box-shadow: 0 0 0 3px #d8ede7; }
button,.button { display: inline-flex; align-items: center; justify-content: center; padding: 9px 14px; min-height: 40px; border: 1px solid transparent; border-radius: 8px; background: var(--primary); color: #fff; font: inherit; font-weight: 650; text-decoration: none; cursor: pointer; }
button:hover,.button:hover { background: var(--primary-hover); }
button:disabled { opacity: .6; cursor: wait; }
.secondary { background: white; color: var(--ink); border-color: #cfd9e4; }
.secondary:hover { background: #eef4f9; }
.metrics { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 13px; margin-bottom: 21px; }
.metric,.panel,.login-panel { background: var(--surface); border: 1px solid var(--line); border-radius: 13px; box-shadow: 0 3px 12px #263c5510; }
.metric { position: relative; min-height: 116px; padding: 14px 15px; display: flex; flex-direction: column; align-items: flex-start; }
.metric > span:not(.metric-icon) { padding-right: 25px; color: var(--muted); font-size: .82rem; font-weight: 650; }
.metric strong { font-size: 1.95rem; font-variant-numeric: tabular-nums; line-height: 1.24; }
.metric small { font-size: .75rem; }
.metric-icon { position: absolute; top: 11px; right: 10px; width: 25px; height: 25px; display: grid; place-content: center; border-radius: 7px; font-weight: 750; }
.panel + .panel { margin-top: 15px; }
.panel-head,.source-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.panel-head { padding: 18px 20px; }
.panel-head input { width: min(100%, 290px); }
.panel-head p,.form-panel > p { margin-top: 3px; }
.source-group { border-top: 1px solid var(--line); }
.source-head { padding: 11px 20px; background: #f7f9fc; }
.source-head > div,.source-meta { display: flex; align-items: center; gap: 9px; flex-wrap: wrap; font-size: .81rem; }
.stock-table { width: 100%; table-layout: fixed; border-collapse: collapse; }
.stock-table th,.stock-table td { text-align: left; padding: 10px 20px; overflow-wrap: anywhere; }
.stock-table th { padding-top: 7px; padding-bottom: 7px; color: var(--muted); font-size: .72rem; text-transform: uppercase; letter-spacing: .055em; }
.stock-table th:first-child { width: 56%; }
.stock-table th:nth-child(2) { width: 15%; }
.stock-table td { border-top: 1px solid #edf1f5; }
.stock-table td small { display: block; font-size: .76rem; }
.quantity { font-size: 1.2rem; font-weight: 760; font-variant-numeric: tabular-nums; }
.badge { display: inline-flex; align-items: center; padding: 3px 8px; border-radius: 6px; font-size: .74rem; font-weight: 700; }
.good { color: var(--good); background: var(--good-bg); }
.warn { color: var(--warn); background: var(--warn-bg); }
.bad { color: var(--bad); background: var(--bad-bg); }
.neutral { color: var(--neutral); background: var(--neutral-bg); }
.empty { padding: 35px 20px; text-align: center; }
.empty p { margin: 6px auto 13px; color: var(--muted); }
.group-empty { padding: 14px 20px; }
.form-panel { padding: 18px 20px; }
.inline-form,.stack { margin: 12px 0; }
.inline-form { display: flex; flex-wrap: wrap; align-items: end; gap: 10px; }
.inline-form > div { flex: 0 1 270px; min-width: 0; }
.stack { display: grid; gap: 7px; }
.stack label:not(:first-child),.stack button { margin-top: 6px; }
.narrow { max-width: 460px; }
label { display: block; color: #37495e; font-weight: 650; font-size: .86rem; }
input,select { width: 100%; min-height: 40px; border: 1px solid #aabace; border-radius: 8px; padding: 8px 10px; background: #fff; color: var(--ink); font: inherit; }
.list-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 11px 0; border-top: 1px solid var(--line); overflow-wrap: anywhere; }
.list-row:first-of-type { margin-top: 9px; }
.list-row small { display: block; }
.event-row strong { display: block; margin-top: 4px; }
.delivery { text-align: right; }
.notice { padding: 12px; margin: 10px 0; border-radius: 8px; background: var(--good-bg); color: var(--good); }
.danger { background: var(--bad-bg); color: var(--bad); }
.key-reveal input { width: min(100%, 420px); font-family: monospace; }
.guest { min-height: 100vh; padding: 20px; display: grid; place-items: center; background: radial-gradient(ellipse at 15% 5%, #e3f3ee, transparent 65%), var(--bg); }
.login-panel { width: min(100%, 430px); padding: 30px; }
.login-panel .brand { padding: 0; margin-bottom: 32px; }
@media (max-width: 1100px) {
    .metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 720px) {
    .sidebar { position: static; width: auto; padding: 12px; }
    .sidebar nav { display: flex; flex-wrap: wrap; margin-top: 10px; }
    .sidebar .nav-link { width: auto; padding: 6px 9px; font-size: .85rem; gap: 6px; }
    .nav-label { display: none; }
    .logout { margin: 6px 0 0; padding-top: 4px; }
    .workspace { margin: 0; padding: 20px 13px; }
    .metric { min-height: 98px; }
    .stock-table th,.stock-table td { padding-left: 9px; padding-right: 7px; }
    .stock-table th:first-child { width: 43%; }
    .stock-table th:nth-child(2) { width: 22%; }
}
