/* --------------------------------------------------------------------------
   Stock & Inventory — design tokens
   Ink sidebar, paper workspace, teal for actions, amber reserved exclusively
   for bonus/free units so the eye learns one colour = one meaning.
   Numerals are always mono + tabular: quantities and money line up in columns.
--------------------------------------------------------------------------- */
:root {
    --ink:        #12151c;
    --ink-soft:   #1c212c;
    --paper:      #f4f5f7;
    --card:       #ffffff;
    --line:       #e2e5ea;
    --text:       #1b2029;
    --muted:      #6a7382;
    --accent:     #0f5f58;
    --accent-2:   #0b8b7f;
    --bonus:      #9a5209;
    --bonus-bg:   #fdf3e3;
    --danger:     #a11c1c;
    --danger-bg:  #fdeceb;
    --ok:         #1f6a3d;
    --ok-bg:      #eaf5ee;
    --radius:     10px;
}

body {
    background: var(--paper);
    color: var(--text);
    font-family: Inter, -apple-system, "Segoe UI", Roboto, sans-serif;
    font-size: 14px;
    -webkit-font-smoothing: antialiased;
}

.num, .mono {
    font-family: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
    font-variant-numeric: tabular-nums;
    letter-spacing: -0.01em;
}
td.num, th.num { text-align: right; }

/* ---------- shell ---------- */
.shell { display: flex; min-height: 100vh; }

.sidebar {
    width: 236px;
    flex: 0 0 236px;
    background: var(--ink);
    color: #aeb6c2;
    padding: 20px 14px 32px;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
}
.sidebar .brand {
    color: #fff;
    font-weight: 650;
    font-size: 15px;
    letter-spacing: -0.01em;
    display: block;
    padding: 0 10px 4px;
    text-decoration: none;
}
.sidebar .brand small {
    display: block;
    color: #6d7788;
    font-weight: 400;
    font-size: 11px;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    margin-top: 3px;
}
.sidebar .group {
    color: #5c6675;
    font-size: 10px;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    padding: 20px 10px 6px;
}
.sidebar a.nav-item {
    display: flex;
    align-items: center;
    gap: 9px;
    color: #aeb6c2;
    text-decoration: none;
    padding: 8px 10px;
    border-radius: 8px;
    font-size: 13.5px;
    border-left: 2px solid transparent;
}
.sidebar a.nav-item:hover { background: var(--ink-soft); color: #fff; }
.sidebar a.nav-item.active {
    background: var(--ink-soft);
    color: #fff;
    border-left-color: var(--accent-2);
}

.workspace { flex: 1 1 auto; min-width: 0; }
.topbar {
    background: var(--card);
    border-bottom: 1px solid var(--line);
    padding: 14px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    position: sticky;
    top: 0;
    z-index: 20;
}
.topbar h1 { font-size: 17px; font-weight: 620; margin: 0; letter-spacing: -0.01em; }
.topbar .crumb { color: var(--muted); font-size: 12px; margin: 0; }
.content { padding: 22px 24px 56px; }

/* ---------- surfaces ---------- */
.card-flat {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: var(--radius);
}
.card-flat > .card-head {
    padding: 13px 16px;
    border-bottom: 1px solid var(--line);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}
.card-flat > .card-head h2 { font-size: 13px; font-weight: 620; margin: 0; }
.card-flat > .card-body { padding: 16px; }

.metric { padding: 15px 16px; }
.metric .label {
    font-size: 10.5px;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--muted);
}
.metric .value {
    font-size: 24px;
    font-weight: 600;
    margin-top: 4px;
    font-family: "IBM Plex Mono", monospace;
    font-variant-numeric: tabular-nums;
}
.metric .hint { font-size: 12px; color: var(--muted); margin-top: 2px; }

/* ---------- tables ---------- */
.table-tight { margin: 0; }
.table-tight thead th {
    font-size: 10.5px;
    letter-spacing: 0.09em;
    text-transform: uppercase;
    color: var(--muted);
    font-weight: 600;
    background: #fafbfc;
    border-bottom: 1px solid var(--line);
    padding: 9px 12px;
    white-space: nowrap;
}
.table-tight tbody td {
    padding: 10px 12px;
    border-bottom: 1px solid #eef0f3;
    vertical-align: middle;
}
.table-tight tbody tr:last-child td { border-bottom: 0; }
.table-tight tbody tr:hover { background: #fbfcfd; }

/* ---------- chips ---------- */
.chip {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 11px;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 999px;
    border: 1px solid transparent;
    white-space: nowrap;
}
.chip-bonus { background: var(--bonus-bg); color: var(--bonus); border-color: #f0dcbe; }
.chip-low   { background: var(--danger-bg); color: var(--danger); border-color: #f3d3d1; }
.chip-out   { background: #f2f3f5; color: #55606f; border-color: #e0e3e8; }
.chip-ok    { background: var(--ok-bg); color: var(--ok); border-color: #cfe6d8; }
.chip-muted { background: #f2f3f5; color: #55606f; border-color: #e0e3e8; }

/* ---------- controls ---------- */
.form-label { font-size: 12px; font-weight: 600; color: #414a58; margin-bottom: 4px; }
.form-control, .form-select {
    border-color: #d5d9e0;
    border-radius: 8px;
    font-size: 13.5px;
    padding: 7px 10px;
}
.form-control:focus, .form-select:focus {
    border-color: var(--accent-2);
    box-shadow: 0 0 0 3px rgba(11, 139, 127, 0.13);
}
.btn { border-radius: 8px; font-size: 13.5px; font-weight: 550; padding: 7px 14px; }
.btn-accent { background: var(--accent); color: #fff; border: 1px solid var(--accent); }
.btn-accent:hover { background: #0c4d47; color: #fff; }
.btn-quiet { background: #fff; border: 1px solid #d5d9e0; color: #374151; }
.btn-quiet:hover { background: #f6f7f9; }
.form-hint { font-size: 11.5px; color: var(--muted); }
a { color: var(--accent); }

.empty {
    padding: 44px 20px;
    text-align: center;
    color: var(--muted);
}
.empty strong { display: block; color: var(--text); margin-bottom: 4px; }

/* the bonus rail: one hairline in amber marks any row carrying free units */
tr.has-bonus td:first-child { box-shadow: inset 3px 0 0 var(--bonus); }

@media (max-width: 991.98px) {
    .shell { flex-direction: column; }
    .sidebar { width: 100%; flex: none; height: auto; position: static; padding-bottom: 14px; }
    .sidebar .group { padding-top: 12px; }
    .sidebar nav { display: flex; flex-wrap: wrap; gap: 4px; }
    .content { padding: 16px 14px 48px; }
}

@media (prefers-reduced-motion: reduce) {
    * { transition: none !important; animation: none !important; }
}
