/* BrewTrace - one stylesheet, no build step. */

:root {
  --bg: #f5f3f0;
  --surface: #ffffff;
  --surface-2: #faf9f7;
  --surface-3: #f1eeea;
  --line: #e7e2dc;
  --line-2: #d8d0c7;
  --ink: #1c1714;
  --ink-2: #4a423c;
  --muted: #7f746a;

  --brand: #8a4a1c;
  --brand-2: #6f3a14;
  --brand-soft: #f6ece3;
  --brand-ink: #6a3510;
  --crema: #d08a45;

  --side: #1b1411;
  --side-2: #2a1f19;
  --side-ink: #efe6dc;
  --side-muted: #a3958a;
  --side-line: #31261f;

  --ok: #17693f;      --ok-bg: #e2f3e9;
  --warn: #8a5300;    --warn-bg: #fdf0d5;
  --bad: #b3261e;     --bad-bg: #fce8e6;
  --info: #1f4fb8;    --info-bg: #e4ecfc;
  --violet: #6236b8;  --violet-bg: #eee8fb;
  --grey: #5d5650;    --grey-bg: #eeebe7;

  --seg-stock: #2f8f5b;
  --seg-prod: #3b6fd8;
  --seg-used: #a0622f;
  --seg-out: #7a52c7;
  --seg-off: #c24a3f;
  --seg-scrap: #a39b94;

  --r: 12px;
  --r-sm: 8px;
  --shadow: 0 1px 2px rgba(28, 23, 20, .05), 0 2px 8px rgba(28, 23, 20, .04);
  --font: "Segoe UI Variable Text", "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: "Cascadia Mono", "SFMono-Regular", ui-monospace, Consolas, "Liberation Mono", monospace;
}

* { 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); }
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { margin: 0; }
p { margin: 0 0 10px; }
hr { border: 0; border-top: 1px solid var(--line); margin: 16px 0; }
.icon { flex: none; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.nowrap { white-space: nowrap; }
.right { text-align: right; }
.mt { margin-top: 16px; }
.mb { margin-bottom: 16px; }
.hidden { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* --- shell ------------------------------------------------------------------ */

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

.sidebar {
  width: 248px; flex: 0 0 248px; background: var(--side); color: var(--side-ink);
  display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; overflow-y: auto;
}
.brand { display: flex; gap: 12px; align-items: center; padding: 20px 18px 12px; color: var(--side-ink); }
.brand:hover { text-decoration: none; }
.brand-mark {
  width: 38px; height: 38px; border-radius: 10px; display: grid; place-items: center; color: #fff;
  background: linear-gradient(140deg, #d4924f, #8a4a1c 70%);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .15);
}
.brand-text strong { display: block; font-size: 15px; letter-spacing: .2px; }
.brand-text small {
  display: block; color: var(--side-muted); font-size: 12px; max-width: 164px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.nav { padding: 0 10px 16px; flex: 1; }
.nav-label {
  font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--side-muted);
  padding: 16px 10px 6px;
}
.nav-item {
  display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 8px;
  color: var(--side-ink); opacity: .82; font-weight: 500;
}
.nav-item:hover { background: var(--side-2); opacity: 1; text-decoration: none; }
.nav-item.is-active { background: var(--side-2); opacity: 1; box-shadow: inset 3px 0 0 var(--crema); }
.nav-item .count {
  margin-left: auto; font-size: 11.5px; background: #5b3a22; color: #ffd9b3; border-radius: 999px; padding: 0 7px;
}
.sidebar-foot { border-top: 1px solid var(--side-line); padding: 12px 14px; display: flex; align-items: center; gap: 10px; }
.avatar {
  width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; flex: none;
  background: #4a3325; color: #ffd9b3; font-weight: 700;
}
.who { min-width: 0; flex: 1; }
.who strong { display: block; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.who small { color: var(--side-muted); font-size: 12px; }
.who a { color: var(--side-muted); }
.icon-btn {
  display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: 8px; border: 0;
  background: transparent; color: inherit; cursor: pointer;
}
.sidebar .icon-btn { color: var(--side-muted); }
.sidebar .icon-btn:hover { background: var(--side-2); color: var(--side-ink); }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: 10px;
  padding: 10px 24px; background: rgba(255, 255, 255, .94); backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
.hamburger { display: none; }
.search { position: relative; flex: 1; max-width: 560px; }
.search input[type=search] {
  width: 100%; padding: 9px 12px 9px 38px; border: 1px solid var(--line-2); border-radius: 10px;
  background: var(--surface-2); font: inherit;
}
.search input:focus { outline: none; background: #fff; border-color: #c08a5b; box-shadow: 0 0 0 3px rgba(192, 122, 60, .16); }
.search > .icon { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.suggest {
  position: absolute; top: calc(100% + 6px); left: 0; right: 0; background: #fff; border: 1px solid var(--line);
  border-radius: 10px; box-shadow: 0 16px 40px rgba(28, 23, 20, .16); overflow: hidden; z-index: 40;
}
.suggest a { display: flex; gap: 10px; align-items: center; padding: 9px 12px; color: var(--ink); border-bottom: 1px solid var(--line); }
.suggest a:last-child { border-bottom: 0; }
.suggest a:hover, .suggest a.is-on { background: var(--brand-soft); text-decoration: none; }
.suggest .s-type { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); width: 64px; flex: none; }
.suggest .s-main { font-family: var(--mono); font-weight: 600; font-size: 13px; }
.suggest .s-sub { color: var(--muted); font-size: 12.5px; margin-left: auto; text-align: right; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 45%; }
.topbar-right { margin-left: auto; display: flex; gap: 8px; align-items: center; }

.content { padding: 24px; max-width: 1320px; width: 100%; }

.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 20px; }
.crumbs { font-size: 12.5px; color: var(--muted); margin-bottom: 4px; display: flex; gap: 6px; flex-wrap: wrap; }
.crumbs a { color: var(--muted); }
.page-head h1 { font-size: 22px; line-height: 1.25; font-weight: 650; letter-spacing: -.01em; }
.page-head .sub { color: var(--ink-2); margin-top: 4px; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* --- buttons ------------------------------------------------------------------ */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px; padding: 8px 14px;
  border-radius: 9px; border: 1px solid var(--line-2); background: #fff; color: var(--ink);
  font: 500 14px/1.2 var(--font); cursor: pointer; white-space: nowrap; text-decoration: none;
}
.btn:hover { background: var(--surface-3); text-decoration: none; }
.btn:focus-visible { outline: 3px solid rgba(192, 122, 60, .35); outline-offset: 1px; }
.btn-primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-2); border-color: var(--brand-2); }
.btn-danger { color: var(--bad); border-color: #efc5c0; }
.btn-danger:hover { background: var(--bad-bg); }
.btn-solid-danger { background: var(--bad); border-color: var(--bad); color: #fff; }
.btn-solid-danger:hover { background: #8f1d17; }
.btn-warn { color: var(--warn); border-color: #ecd3a3; }
.btn-warn:hover { background: var(--warn-bg); }
.btn-ok { color: var(--ok); border-color: #b9dcc8; }
.btn-ok:hover { background: var(--ok-bg); }
.btn-sm { padding: 5px 10px; font-size: 13px; border-radius: 8px; }
.btn-lg { padding: 12px 18px; font-size: 15px; }
.btn[disabled], .btn.is-disabled { opacity: .5; pointer-events: none; }
.btn-link { background: none; border: 0; color: var(--brand); padding: 0; cursor: pointer; font: inherit; }
.btn-link:hover { text-decoration: underline; }

/* --- cards and grids --------------------------------------------------------------- */

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow); min-width: 0; }
.stack > * + * { margin-top: 16px; }
.card-head {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  padding: 13px 18px; border-bottom: 1px solid var(--line);
}
.card-head h2 { font-size: 15px; font-weight: 650; display: flex; align-items: center; gap: 8px; }
.card-head .hint { font-size: 12.5px; color: var(--muted); }
.card-body { padding: 18px; }
.card-foot { padding: 12px 18px; border-top: 1px solid var(--line); background: var(--surface-2); border-radius: 0 0 var(--r) var(--r); }
.card.is-alert { border-color: #f0c9a3; box-shadow: 0 0 0 3px #fdf0d5; }
.card.is-danger { border-color: #efc5c0; box-shadow: 0 0 0 3px #fce8e6; }

.grid { display: grid; gap: 16px; }
.grid > * { min-width: 0; }   /* let wide tables scroll inside their card instead of stretching the page */
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-main { grid-template-columns: minmax(0, 1fr) 380px; align-items: start; }
.grid-side { grid-template-columns: 300px minmax(0, 1fr); align-items: start; }

/* --- KPI tiles ------------------------------------------------------------------------ */

.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(165px, 1fr)); gap: 12px; margin-bottom: 20px; }
.kpi {
  background: #fff; border: 1px solid var(--line); border-radius: var(--r); padding: 14px 16px;
  display: block; color: inherit; box-shadow: var(--shadow);
}
a.kpi:hover { border-color: var(--line-2); text-decoration: none; }
.kpi .k-label { font-size: 12.5px; color: var(--muted); display: flex; gap: 6px; align-items: center; }
.kpi .k-value { font-size: 26px; font-weight: 650; letter-spacing: -.02em; margin-top: 2px; font-variant-numeric: tabular-nums; }
.kpi .k-note { font-size: 12.5px; color: var(--ink-2); }
.kpi.is-warn .k-value { color: var(--warn); }
.kpi.is-bad .k-value { color: var(--bad); }
.kpi.is-info .k-value { color: var(--info); }

.quick { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 12px; margin-bottom: 20px; }
.quick a {
  display: flex; gap: 12px; align-items: center; padding: 14px 16px; border-radius: var(--r); color: var(--ink);
  background: #fff; border: 1px solid var(--line); box-shadow: var(--shadow); font-weight: 600;
}
.quick a:hover { border-color: #d9b28c; background: #fffaf5; text-decoration: none; }
.quick .q-icon { width: 38px; height: 38px; border-radius: 10px; display: grid; place-items: center; background: var(--brand-soft); color: var(--brand); flex: none; }
.quick small { display: block; font-weight: 400; color: var(--muted); font-size: 12.5px; }

/* --- tables ------------------------------------------------------------------------------ */

.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table.table { width: 100%; border-collapse: collapse; }
.table th {
  font-size: 11.5px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 600;
  text-align: left; padding: 9px 14px; border-bottom: 1px solid var(--line); background: var(--surface-2); white-space: nowrap;
}
.table td { padding: 10px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr:hover td { background: #fcfaf8; }
.table .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.table tfoot td { font-weight: 650; background: var(--surface-2); border-top: 1px solid var(--line); border-bottom: 0; }
.table td.act { text-align: right; white-space: nowrap; }
.table tr.is-held td { background: #fffaf0; }
.table tr.is-muted td { color: var(--muted); }
.table input[type=number], .table input[type=text], .table select { padding: 6px 8px; }
.table input.qty { width: 110px; text-align: right; font-variant-numeric: tabular-nums; }
.table .sub { display: block; color: var(--muted); font-size: 12.5px; }
.table-compact td, .table-compact th { padding: 7px 12px; }

.code { font-family: var(--mono); font-size: 13px; font-weight: 600; letter-spacing: .01em; color: var(--ink); white-space: nowrap; }
a.code { color: var(--brand-ink); }
.chip {
  display: inline-flex; align-items: center; gap: 6px; padding: 2px 8px; border-radius: 7px; background: var(--surface-3);
  border: 1px solid var(--line); font-family: var(--mono); font-size: 12.5px; color: var(--ink); white-space: nowrap;
}
a.chip:hover { border-color: #d9b28c; background: #fffaf5; text-decoration: none; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chips .chip { white-space: normal; max-width: 100%; }

/* --- badges ------------------------------------------------------------------------------ */

.badge {
  display: inline-flex; align-items: center; gap: 5px; padding: 1px 9px; border-radius: 999px;
  font-size: 12px; font-weight: 600; line-height: 20px; white-space: nowrap;
}
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge-ok { color: var(--ok); background: var(--ok-bg); }
.badge-warn { color: var(--warn); background: var(--warn-bg); }
.badge-bad { color: var(--bad); background: var(--bad-bg); }
.badge-info { color: var(--info); background: var(--info-bg); }
.badge-violet { color: var(--violet); background: var(--violet-bg); }
.badge-grey { color: var(--grey); background: var(--grey-bg); }
.badge-plain::before { display: none; }

/* --- forms ----------------------------------------------------------------------------------- */

.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 14px 16px; }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field.wide { grid-column: 1 / -1; }
.field > label, .label { font-size: 13px; font-weight: 600; color: var(--ink-2); }
.field .hint, .hint { font-size: 12.5px; color: var(--muted); }
.req { color: var(--bad); }
input[type=text], input[type=number], input[type=date], input[type=password], input[type=email],
input[type=search], input[type=tel], input[type=url], select, textarea {
  width: 100%; padding: 9px 11px; border: 1px solid var(--line-2); border-radius: 9px; background: #fff;
  font: inherit; color: inherit; min-width: 0;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: #c08a5b; box-shadow: 0 0 0 3px rgba(192, 122, 60, .16); }
input[readonly] { background: var(--surface-2); }
textarea { min-height: 88px; resize: vertical; }
.mono, input.mono, textarea.mono { font-family: var(--mono); }
.check { display: flex; gap: 8px; align-items: flex-start; font-weight: 500; }
.check input { margin-top: 3px; }
.form-actions { display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap; margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--line); }
.inline-form { display: flex; gap: 8px; align-items: flex-end; flex-wrap: wrap; }
.inline-form .field { flex: 1 1 160px; }
.filters { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; padding: 14px 18px; border-bottom: 1px solid var(--line); background: var(--surface-2); border-radius: var(--r) var(--r) 0 0; }
.filters .field { flex: 1 1 150px; max-width: 240px; }
.filters .field.grow { max-width: 340px; flex-grow: 2; }
.seg { display: inline-flex; border: 1px solid var(--line-2); border-radius: 9px; overflow: hidden; background: #fff; }
.seg a { padding: 7px 12px; color: var(--ink-2); border-right: 1px solid var(--line); font-size: 13px; }
.seg a:last-child { border-right: 0; }
.seg a.is-on { background: var(--brand-soft); color: var(--brand-ink); font-weight: 600; }
.seg a:hover { text-decoration: none; background: var(--surface-3); }

/* --- flash ------------------------------------------------------------------------------------ */

.flash { display: flex; align-items: flex-start; gap: 10px; padding: 12px 14px; border-radius: 10px; margin-bottom: 16px; border: 1px solid; }
.flash-success { background: var(--ok-bg); border-color: #bfe3cd; color: #0f4a2b; }
.flash-error { background: var(--bad-bg); border-color: #f3c3be; color: #7a1a14; }
.flash-info { background: var(--info-bg); border-color: #c5d5f7; color: #183c88; }
.flash .flash-x { margin-left: auto; border: 0; background: none; font-size: 18px; line-height: 1; cursor: pointer; color: inherit; opacity: .6; }
.flash > div { white-space: pre-line; }
summary { list-style: none; cursor: pointer; }
summary::-webkit-details-marker { display: none; }
details[open] > summary { box-shadow: inset 0 0 0 2px rgba(192, 122, 60, .25); }
.note { padding: 12px 14px; border-radius: 10px; background: var(--surface-2); border: 1px solid var(--line); color: var(--ink-2); }
.note-warn { background: var(--warn-bg); border-color: #f0d6a3; color: #5d3a00; }
.note-bad { background: var(--bad-bg); border-color: #f3c3be; color: #7a1a14; }
.note-info { background: var(--info-bg); border-color: #c5d5f7; color: #183c88; }
.note strong { color: inherit; }

/* --- batch / machine hero ------------------------------------------------------------------ */

.hero { display: flex; gap: 20px; align-items: flex-start; justify-content: space-between; flex-wrap: wrap; padding: 20px; }
.hero-kicker { font-size: 12px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); font-weight: 600; }
.hero-no { font-family: var(--mono); font-size: 27px; font-weight: 700; letter-spacing: -.01em; line-height: 1.2; margin: 2px 0 6px; overflow-wrap: anywhere; }
.hero-no button { vertical-align: middle; color: var(--muted); }
.hero-title { font-size: 16px; font-weight: 600; }
.hero-meta { display: flex; flex-wrap: wrap; gap: 6px 18px; color: var(--ink-2); margin-top: 8px; font-size: 13.5px; }
.hero-meta > span { display: block; }
.hero-meta .icon { vertical-align: -3px; margin-right: 3px; }
.hero-badges { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 10px; }
.hold-banner { display: flex; gap: 12px; align-items: flex-start; padding: 12px 20px; background: var(--warn-bg); border-top: 1px solid #f0d6a3; color: #5d3a00; border-radius: 0 0 var(--r) var(--r); }

.facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 0; }
.facts > div { padding: 12px 18px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.facts dt { font-size: 12px; color: var(--muted); }
.facts dd { margin: 2px 0 0; font-weight: 600; }
dl.kv { display: grid; grid-template-columns: 140px 1fr; gap: 8px 12px; margin: 0; }
dl.kv dt { color: var(--muted); }
dl.kv dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }

/* --- where-is breakdown bar ------------------------------------------------------------------ */

.spread { display: flex; height: 14px; border-radius: 999px; overflow: hidden; background: var(--surface-3); }
.spread > span { display: block; height: 100%; min-width: 3px; }
.spread > span + span { box-shadow: inset 2px 0 0 #fff; }
.seg-stock { background: var(--seg-stock); }
.seg-prod { background: var(--seg-prod); }
.seg-used { background: var(--seg-used); }
.seg-out { background: var(--seg-out); }
.seg-off { background: var(--seg-off); }
.seg-scrap { background: var(--seg-scrap); }
.legend { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; margin-top: 14px; }
.legend div { display: flex; gap: 8px; align-items: baseline; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; flex: none; }
.legend b { font-size: 18px; font-variant-numeric: tabular-nums; }
.legend span { color: var(--muted); font-size: 12.5px; display: block; }

.where { display: grid; gap: 10px; }
.where-row { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface-2); }
.where-row .w-icon { width: 34px; height: 34px; border-radius: 9px; display: grid; place-items: center; flex: none; }
.where-row .w-main { min-width: 0; flex: 1; }
.where-row .w-main strong { display: block; }
.where-row .w-main small { color: var(--muted); }
.where-row .w-qty { font-weight: 700; font-size: 16px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.w-stock { background: var(--ok-bg); color: var(--ok); }
.w-prod { background: var(--info-bg); color: var(--info); }
.w-used { background: var(--brand-soft); color: var(--brand); }
.w-out { background: var(--violet-bg); color: var(--violet); }
.w-off { background: var(--bad-bg); color: var(--bad); }

/* --- trace tree ------------------------------------------------------------------------------- */

.tree, .tree ul { list-style: none; margin: 0; padding: 0; }
.tree ul { padding-left: 20px; margin-left: 10px; border-left: 1px dashed var(--line-2); }
.tree li { padding-top: 8px; }
.tree .node { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; }
.tree .node .qty { color: var(--ink-2); font-variant-numeric: tabular-nums; }
.tree .node .name { color: var(--muted); }

.flow { display: flex; align-items: stretch; gap: 0; flex-wrap: wrap; }
.flow-step { flex: 1 1 180px; padding: 14px 16px; border: 1px solid var(--line); background: #fff; position: relative; }
.flow-step:first-child { border-radius: 10px 0 0 10px; }
.flow-step:last-child { border-radius: 0 10px 10px 0; }
.flow-step + .flow-step { border-left: 0; }
.flow-step .f-num { font-size: 24px; font-weight: 700; font-variant-numeric: tabular-nums; }
.flow-step .f-label { color: var(--muted); font-size: 12.5px; }

/* --- history ------------------------------------------------------------------------------------ */

.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { display: grid; grid-template-columns: 26px 1fr auto; gap: 10px; padding: 11px 18px; border-bottom: 1px solid var(--line); align-items: start; }
.timeline li:last-child { border-bottom: 0; }
.timeline .t-dot { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; background: var(--surface-3); color: var(--ink-2); }
.timeline .t-main strong { font-weight: 600; }
.timeline .t-main small { display: block; color: var(--muted); }
.timeline .t-when { color: var(--muted); font-size: 12.5px; text-align: right; white-space: nowrap; }
.t-in { background: var(--ok-bg) !important; color: var(--ok) !important; }
.t-out { background: var(--violet-bg) !important; color: var(--violet) !important; }
.t-prod { background: var(--info-bg) !important; color: var(--info) !important; }
.t-bad { background: var(--bad-bg) !important; color: var(--bad) !important; }

/* --- misc ------------------------------------------------------------------------------------------ */

.empty { padding: 36px 20px; text-align: center; color: var(--muted); }
.empty .icon { color: var(--line-2); margin-bottom: 8px; }
.empty p { margin: 4px 0 14px; }
.pager { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 12px 18px; border-top: 1px solid var(--line); }
.progress { height: 8px; border-radius: 999px; background: var(--surface-3); overflow: hidden; min-width: 80px; }
.progress > span { display: block; height: 100%; background: var(--seg-prod); border-radius: 999px; }
.progress.is-done > span { background: var(--seg-stock); }
.list { list-style: none; margin: 0; padding: 0; }
.list li { display: flex; align-items: center; gap: 10px; padding: 10px 18px; border-bottom: 1px solid var(--line); }
.list li:last-child { border-bottom: 0; }
.list .grow { flex: 1; min-width: 0; }
.list .grow small { display: block; color: var(--muted); }
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); padding: 0 12px; overflow-x: auto; }
.tabs a { padding: 11px 12px; color: var(--ink-2); border-bottom: 2px solid transparent; white-space: nowrap; font-weight: 500; }
.tabs a.is-on { color: var(--brand-ink); border-bottom-color: var(--brand); }
.tabs a:hover { text-decoration: none; color: var(--ink); }
.qr-box { display: inline-block; padding: 8px; background: #fff; border: 1px solid var(--line); border-radius: 10px; line-height: 0; }
.qr-box svg { width: 112px; height: 112px; }
.bin-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.bin-tile { display: block; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: #fff; color: var(--ink); }
.bin-tile:hover { border-color: #d9b28c; background: #fffaf5; text-decoration: none; }
.bin-tile .code { display: block; }
.bin-tile small { color: var(--muted); display: block; }
.bin-tile.is-empty { background: var(--surface-2); }
.bin-tile.is-off { opacity: .55; }
.rack { margin-bottom: 14px; }
.rack-title { font-size: 12px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; margin: 0 0 8px; }
.steps { counter-reset: step; list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.steps li { counter-increment: step; display: grid; grid-template-columns: 28px 1fr; gap: 10px; align-items: start; }
.steps li::before { content: counter(step); width: 26px; height: 26px; border-radius: 50%; background: var(--brand-soft); color: var(--brand); font-weight: 700; display: grid; place-items: center; font-size: 13px; }

/* --- scan page ------------------------------------------------------------------------------------ */

.scan-box { max-width: 640px; margin: 0 auto; }
.scan-input { font-size: 20px !important; padding: 16px 16px !important; font-family: var(--mono) !important; text-align: center; }
.camera { position: relative; margin-top: 16px; border-radius: 14px; overflow: hidden; background: #000; aspect-ratio: 4 / 3; }
.camera video { width: 100%; height: 100%; object-fit: cover; display: block; }
.camera .frame { position: absolute; inset: 18%; border: 3px solid rgba(255, 255, 255, .85); border-radius: 14px; box-shadow: 0 0 0 100vmax rgba(0, 0, 0, .35); }

/* --- login ------------------------------------------------------------------------------------------ */

.login-page { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: radial-gradient(1200px 600px at 20% -10%, #efe0d0 0, transparent 60%), var(--bg); }
.login-card { width: 100%; max-width: 400px; }
.login-brand { display: flex; gap: 12px; align-items: center; margin-bottom: 18px; }
.login-brand .brand-mark { width: 44px; height: 44px; }
.login-brand strong { font-size: 20px; display: block; }
.login-brand small { color: var(--muted); }

/* --- responsive -------------------------------------------------------------------------------------- */

@media (max-width: 1100px) {
  .grid-main, .grid-side { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 960px) {
  .sidebar { position: fixed; left: 0; top: 0; bottom: 0; transform: translateX(-100%); transition: transform .2s ease; z-index: 60; }
  body.nav-open .sidebar { transform: none; box-shadow: 0 0 0 100vmax rgba(0, 0, 0, .4); }
  .hamburger { display: inline-grid; }
  .content { padding: 16px; }
  .topbar { padding: 8px 12px; }
  .topbar-right .btn span { display: none; }
}
@media (max-width: 760px) {
  .grid-2, .grid-3 { grid-template-columns: minmax(0, 1fr); }
  .form-grid { grid-template-columns: minmax(0, 1fr) !important; }
  .form-grid .field[style*="span"] { grid-column: auto !important; }
  .page-head h1 { font-size: 19px; }
  .hero { padding: 16px; gap: 12px; }
  .hero-no { font-size: 21px; }
  .hero .qr-box { padding: 4px; }
  .hero .qr-box svg { width: 72px; height: 72px; }
  .where-row { flex-wrap: wrap; }
  .where-row .w-qty { font-size: 14px; }
  dl.kv { grid-template-columns: 110px 1fr; }
  .timeline li { grid-template-columns: 26px 1fr; }
  .timeline .t-when { grid-column: 2; text-align: left; }
  .filters .field { max-width: none; }
  .flow-step { flex-basis: 45%; border-radius: 0 !important; border-left: 1px solid var(--line) !important; }
  .table-stack thead { display: none; }
  .table-stack tr { display: block; border-bottom: 1px solid var(--line); padding: 8px 0; }
  .table-stack td { display: flex; justify-content: space-between; gap: 12px; border: 0; padding: 4px 14px; text-align: right; }
  .table-stack td::before { content: attr(data-label); color: var(--muted); font-size: 12.5px; text-align: left; }
  .table-stack td.num { justify-content: space-between; }
}

@media print {
  .sidebar, .topbar, .no-print, .flash, .page-head .actions { display: none !important; }
  body { background: #fff; }
  .content { padding: 0; max-width: none; }
  .card { box-shadow: none; border-color: #bbb; break-inside: avoid; }
  a { color: inherit; }
}
