:root {
  --bg: #f5f4f1;
  --surface: #ffffff;
  --ink: #1f1c1a;
  --muted: #77706a;
  --line: #e6e2dc;
  --side: #1d1a18;
  --side-ink: #d9d3cc;
  --accent: #e0662f;
  --accent-ink: #ffffff;
  --accent-soft: #fbe9df;
  --ok: #2f8f5b;
  --ok-soft: #e3f3ea;
  --bad: #c2412d;
  --bad-soft: #fbe5e1;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(0,0,0,.05), 0 2px 8px rgba(0,0,0,.04);
  font-family: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color: var(--ink);
  background: var(--bg);
}
* { box-sizing: border-box; }
body { margin: 0; font-size: 14px; line-height: 1.45; background: var(--bg); }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 22px; margin: 0; letter-spacing: -.01em; }
h2 { font-size: 16px; margin: 0 0 12px; }
small, .muted { color: var(--muted); }

/* layout */
.shell { display: grid; grid-template-columns: 230px 1fr; min-height: 100vh; }
.side { background: var(--side); color: var(--side-ink); padding: 22px 14px; position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; gap: 4px; }
.brand-logo { display: flex; align-items: center; gap: 10px; color: #fff; font-weight: 700; font-size: 17px; padding: 0 10px 18px; }
.brand-logo .dot { width: 30px; height: 30px; border-radius: 8px; background: var(--accent); display: grid; place-items: center; font-size: 16px; }
.side a.nav { color: var(--side-ink); padding: 9px 12px; border-radius: 8px; display: flex; gap: 10px; align-items: center; }
.side a.nav:hover { background: rgba(255,255,255,.06); text-decoration: none; }
.side a.nav.on { background: rgba(224,102,47,.18); color: #fff; }
.side .spacer { flex: 1; }
.side form button { width: 100%; background: transparent; color: var(--side-ink); border: 1px solid rgba(255,255,255,.15); }
.main { padding: 26px 32px 60px; min-width: 0; }
.head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 20px; }

/* cards */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px; }
.grid { display: grid; gap: 16px; }
.stats { grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); margin-bottom: 16px; }
.stat .n { font-size: 26px; font-weight: 700; letter-spacing: -.02em; }
.stat .l { color: var(--muted); font-size: 13px; }
.two { grid-template-columns: 1.4fr 1fr; }

/* forms */
input[type=text], input[type=password], input[type=number], input[type=search], select, textarea {
  font: inherit; color: inherit; background: #fff; border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; width: 100%;
}
textarea { min-height: 90px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent-soft); border-color: var(--accent); }
label.f { display: block; margin-bottom: 14px; }
label.f > span { display: block; font-weight: 600; margin-bottom: 5px; font-size: 13px; }
.row { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; }
.check { display: inline-flex; align-items: center; gap: 7px; cursor: pointer; }
.filters { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.filters > * { width: auto; min-width: 140px; }
.filters input[type=search] { min-width: 220px; flex: 1; }

button, .btn {
  font: inherit; font-weight: 600; border: 1px solid transparent; border-radius: 8px; padding: 8px 14px; cursor: pointer;
  background: var(--accent); color: var(--accent-ink); display: inline-flex; align-items: center; gap: 6px; white-space: nowrap;
}
.btn:hover { text-decoration: none; filter: brightness(1.05); }
.btn.ghost, button.ghost { background: #fff; color: var(--ink); border-color: var(--line); }
.btn.danger, button.danger { background: #fff; color: var(--bad); border-color: #efc9c1; }
.btn.sm, button.sm { padding: 4px 10px; font-size: 12.5px; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* tables */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 9px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 600; background: #faf9f7; position: sticky; top: 0; }
tr.off td { opacity: .55; }
tr.hl td { background: var(--accent-soft); }
td.nw { white-space: nowrap; }

.chip { display: inline-block; font-size: 11.5px; padding: 1px 8px; border-radius: 99px; background: #f0ece6; color: #5b534c; margin: 1px 2px 1px 0; }
.pill { display: inline-block; font-size: 12px; font-weight: 600; padding: 2px 9px; border-radius: 99px; }
.pill.ok { background: var(--ok-soft); color: var(--ok); }
.pill.bad { background: var(--bad-soft); color: var(--bad); }
.pill.mid { background: #f0ece6; color: #5b534c; }

/* stock toggle */
.switch { position: relative; width: 38px; height: 22px; display: inline-block; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch span { position: absolute; inset: 0; background: #d8d2cb; border-radius: 99px; transition: .15s; cursor: pointer; }
.switch span::before { content: ""; position: absolute; width: 16px; height: 16px; left: 3px; top: 3px; background: #fff; border-radius: 50%; transition: .15s; box-shadow: 0 1px 2px rgba(0,0,0,.2); }
.switch input:checked + span { background: var(--ok); }
.switch input:checked + span::before { transform: translateX(16px); }

/* mix */
.mix-list { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); }
.mix-items { list-style: none; padding: 0; margin: 10px 0; }
.mix-items li { display: flex; justify-content: space-between; gap: 10px; padding: 5px 0; border-bottom: 1px dashed var(--line); }
.mix-items li:last-child { border-bottom: 0; }
.mix-items .pct { font-weight: 700; }
.bar { display: flex; height: 8px; border-radius: 99px; overflow: hidden; background: #eee; margin-top: 6px; }
.bar i { display: block; height: 100%; }
.comp-row { display: grid; grid-template-columns: 1fr 110px 36px; gap: 8px; margin-bottom: 8px; align-items: center; }
.sum { font-weight: 700; }
.sum.bad { color: var(--bad); }
.sum.ok { color: var(--ok); }

/* flash */
.flash { padding: 10px 14px; border-radius: 8px; margin-bottom: 14px; background: var(--ok-soft); color: var(--ok); border: 1px solid #c6e6d3; }
.flash.error { background: var(--bad-soft); color: var(--bad); border-color: #efc9c1; }

/* login */
.login { min-height: 100vh; display: grid; place-items: center; padding: 16px; background: var(--side); }
.login .card { width: 100%; max-width: 360px; }
.login h1 { margin-bottom: 4px; }

.tag-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 6px 12px; }
.pager { display: flex; gap: 6px; margin-top: 14px; flex-wrap: wrap; }
.status-dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 6px; background: var(--bad); }
.status-dot.on { background: var(--ok); }

@media (max-width: 900px) {
  .shell { grid-template-columns: 1fr; }
  .side { position: static; height: auto; flex-direction: row; flex-wrap: wrap; padding: 10px 12px; gap: 2px; }
  .brand-logo { padding: 4px 8px; width: 100%; }
  .side .spacer { display: none; }
  .side form { margin-left: auto; }
  .main { padding: 18px 16px 50px; }
  .two { grid-template-columns: 1fr; }
}
