:root {
  --bg: #eef2fa;
  --surface: #ffffff;
  --text: #111827;
  --muted: #556376;
  --primary: #a84343;
  --primary-hover: #8f3535;
  --primary-container: #c2daf7;
  --focus: #c41e3a;
  --border: #c5cedd;
  --topbar: #e4eaf6;
  --shadow: rgba(30, 41, 59, 0.1);
  --highlight: rgba(255, 255, 255, 0.85);
  --ok: #059669;
  --err: #b3261e;
  --burgundy: #8b2942;
  --teal-a: #0d9488;
  --teal-b: #5eead4;
  --accent-a: #4f46e5;
  --accent-b: #93c5fd;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --font: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

html[data-theme="dark"] {
  --bg: #0c0d14;
  --surface: #181b28;
  --text: #f0f2fa;
  --muted: #9aa6c4;
  --primary: #d96868;
  --primary-hover: #e88484;
  --primary-container: #2a3352;
  --focus: #5ecfff;
  --border: #343a52;
  --topbar: #141722;
  --shadow: rgba(0, 0, 0, 0.35);
  --highlight: rgba(255, 255, 255, 0.06);
}

* { box-sizing: border-box; }
html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
}
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  -webkit-tap-highlight-color: transparent;
}

button, input, select, textarea { font-family: inherit; font-size: 16px; }
button { cursor: pointer; }
[hidden] { display: none !important; }

#app {
  height: 100%;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.topbar {
  position: relative;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 6px;
  min-height: 56px;
  padding: calc(10px + var(--safe-top)) 8px 10px 8px;
  background: var(--topbar);
  color: var(--text);
  flex: 0 0 auto;
}
.topbar .titles { flex: 1; min-width: 0; }
.topbar h1 {
  flex: 1;
  min-width: 0;
  margin: 0;
  font-size: 15.5px;
  font-weight: 800;
  letter-spacing: 0.3px;
  line-height: 1.2;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.topbar .titles h1 { font-size: 18px; }
.topbar .titles .sub {
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
  margin-top: 1px;
}
.icon-btn, .text-btn {
  border: 0;
  background: transparent;
  color: var(--text);
  min-width: 40px;
  min-height: 40px;
  border-radius: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  font-weight: 700;
  flex: 0 0 auto;
}
.text-btn { font-size: 12px; padding: 0 6px; }
.pdf-btn {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  min-width: 64px;
  padding: 4px 6px;
  border: 0;
  background: transparent;
  color: var(--text);
  text-decoration: none;
  font-weight: 800;
  font-size: 9px;
  line-height: 1.05;
  text-align: center;
  flex: 0 0 auto;
}
.pdf-btn svg { width: 20px; height: 20px; display: block; pointer-events: none; }
.icon-btn svg, .text-btn svg, .tile svg, .drawer svg, .choice svg, .tool-row svg {
  width: 22px;
  height: 22px;
  display: block;
  pointer-events: none;
  flex-shrink: 0;
}

.page {
  flex: 1 1 auto;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 18px 16px calc(36px + var(--safe-bottom));
}
.page.home { padding: 18px 16px 32px; }
.page.reports { padding-top: 8px; }

/* Login */
.login-wrap {
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: calc(20px + var(--safe-top)) 20px calc(20px + var(--safe-bottom));
  background: linear-gradient(135deg, color-mix(in srgb, var(--primary) 12%, transparent), var(--bg));
}
.card {
  background: var(--surface);
  border-radius: 7px;
  border: 1px solid var(--border);
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.08);
  padding: 24px;
  width: 100%;
  max-width: 420px;
}
.card h2 { margin: 0 0 6px; font-size: 1.4rem; font-weight: 800; }
.sub { color: var(--muted); margin: 0 0 18px; line-height: 1.35; }
label { display: block; font-size: 13px; font-weight: 600; margin: 0 0 6px; }
input[type="text"], input[type="password"], input[type="number"], input[type="search"], input[type="date"], select, textarea {
  width: 100%;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: var(--surface);
  color: var(--text);
  margin-bottom: 12px;
}
.row-check { display: flex; align-items: center; gap: 8px; margin: 4px 0 12px; font-size: 14px; }
.err { color: var(--err); margin: 0 0 10px; font-size: 14px; }
.ok { color: var(--ok); }

.btn {
  width: 100%;
  border: 0;
  border-radius: 7px;
  padding: 12px 16px;
  background: var(--primary);
  color: #fff;
  font-weight: 700;
}
.btn:disabled { opacity: 0.45; }
.btn-outline {
  background: transparent;
  color: var(--primary);
  border: 1px solid var(--primary);
}
.btn-ghost { background: transparent; color: var(--text); border: 1px solid var(--border); }
.btn-danger { background: #b91c1c; color: #fff; }
.btn-sm { width: auto; padding: 8px 12px; font-size: 14px; }

/* Dashboard */
.hello { font-size: 18px; font-weight: 800; margin: 2px 0 0; }
.role { font-size: 14px; font-weight: 600; color: var(--muted); margin: 4px 0 16px; }
.pills { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 14px; }
.pill {
  background: var(--surface);
  border-radius: 18px;
  padding: 16px 12px;
  text-align: center;
  box-shadow: 4px 4px 10px var(--shadow), -3px -3px 8px var(--highlight);
}
.pill .val { font-size: 16px; font-weight: 800; }
.pill .lbl { font-size: 13px; font-weight: 600; color: var(--muted); margin-top: 6px; }
.grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}
.tile {
  background: var(--surface);
  border-radius: 22px;
  min-height: 148px;
  padding: 14px 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  border: 0;
  color: inherit;
  box-shadow: 5px 5px 12px var(--shadow), -4px -4px 10px var(--highlight);
}
.tile .ico {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  margin-bottom: 12px;
  background: linear-gradient(135deg, var(--teal-a), var(--teal-b));
  box-shadow: 0 4px 10px color-mix(in srgb, var(--teal-a) 28%, transparent);
}
.tile .ico svg { width: 26px; height: 26px; }
.tile.accent .ico {
  background: linear-gradient(135deg, var(--accent-a), var(--accent-b));
  box-shadow: 0 4px 10px color-mix(in srgb, var(--accent-a) 28%, transparent);
}
.tile span { font-size: 13.5px; font-weight: 700; line-height: 1.2; }

.sec-title {
  margin: 22px 0 10px;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}
.tool-row {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 12px;
  text-align: left;
  background: var(--surface);
  border: 0;
  color: inherit;
  border-radius: 14px;
  padding: 14px 12px;
  margin-bottom: 8px;
  box-shadow: 0 3px 8px var(--shadow);
  font-weight: 700;
}
.tool-row .lead {
  width: 40px; height: 40px; border-radius: 10px;
  background: #e8ecf0; color: var(--primary);
  display: flex; align-items: center; justify-content: center; flex: 0 0 40px;
}
html[data-theme="dark"] .tool-row .lead { background: #2a3352; }
.tool-row small { display: block; font-weight: 500; color: var(--muted); margin-top: 2px; }

.hub-date {
  background: var(--surface);
  border-radius: 14px;
  padding: 14px;
  text-align: center;
  margin-bottom: 18px;
}
.hub-date strong { display: block; margin-bottom: 12px; }
.badge {
  display: inline-block;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.6px;
  color: var(--primary);
  background: #e8ecf0;
  border-radius: 8px;
  padding: 5px 10px;
  margin-bottom: 12px;
}
.option-card {
  width: 100%;
  text-align: left;
  background: var(--surface);
  border: 0;
  border-radius: 20px;
  padding: 18px 18px 20px;
  margin-bottom: 14px;
  color: inherit;
  box-shadow: 0 4px 14px rgba(30,41,59,.08);
}
.option-card h3 { margin: 0 0 8px; font-size: 20px; font-weight: 800; }
.option-card p { margin: 0; color: var(--muted); font-size: 13.5px; font-style: italic; }

.sheet-bg {
  position: fixed; inset: 0; background: rgba(15, 23, 42, 0.45); z-index: 40;
  display: flex; align-items: flex-end;
}
.sheet {
  width: 100%;
  background: #eef2fa;
  color: #111827;
  border-radius: 22px 22px 0 0;
  padding: 12px 16px calc(20px + var(--safe-bottom));
}
html[data-theme="dark"] .sheet { background: #181b28; color: #f0f2fa; }
.sheet-row { display: flex; align-items: center; }
.choice {
  width: 100%;
  text-align: left;
  background: #fff;
  border: 0;
  border-radius: 16px;
  padding: 16px;
  margin-top: 12px;
  font-weight: 800;
  display: flex;
  align-items: flex-start;
  gap: 14px;
  color: inherit;
}
.choice .lead {
  width: 52px; height: 52px; border-radius: 12px; flex: 0 0 52px;
  background: #dbe4f5; color: var(--primary);
  display: flex; align-items: center; justify-content: center;
}
.choice .lead svg { width: 28px; height: 28px; }
.choice .txt { flex: 1; }
.choice small { display: block; font-weight: 500; color: var(--muted); margin-top: 4px; }
html[data-theme="dark"] .choice { background: #12141f; color: #f0f2fa; }
.choice small { display: block; font-weight: 500; color: var(--muted); margin-top: 4px; }

.searchbar {
  margin-bottom: 12px;
  border-radius: 14px !important;
  background: #fff !important;
}
.entry-card {
  background: var(--surface);
  border-radius: 14px;
  padding: 12px;
  margin-bottom: 10px;
  box-shadow: 3px 3px 8px var(--shadow);
}
.entry-card .name { font-weight: 800; font-size: 15px; }
.entry-card .meta { color: var(--muted); font-size: 12px; margin: 4px 0 8px; }
.qty-row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.qty-row.one { grid-template-columns: 1fr; }
.qty-row label { margin: 0 0 4px; font-size: 11px; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); }

.drawer-bg { position: fixed; inset: 0; background: rgba(15,23,42,.4); z-index: 30; }
.drawer {
  position: absolute; left: 0; top: 0; bottom: 0; width: min(88vw, 340px);
  background: var(--surface); padding: calc(18px + var(--safe-top)) 0 24px;
  box-shadow: 8px 0 24px rgba(0,0,0,.18);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}
.drawer h3 { margin: 8px 20px 4px; font-size: 22px; }
.drawer .brand { margin: 0 20px 12px; font-size: 12px; letter-spacing: .6px; font-weight: 700; color: var(--muted); }
.drawer button {
  width: 100%; text-align: left; background: transparent; border: 0; color: inherit;
  padding: 14px 20px; font-weight: 600;
  display: flex; align-items: center; gap: 16px;
}
.drawer button small { display: block; font-weight: 500; color: var(--muted); margin-top: 2px; }
.drawer button.danger { color: var(--err); }
.drawer .lead-ico {
  width: 24px; height: 24px; color: var(--primary); flex: 0 0 24px;
}
.drawer button.danger .lead-ico { color: var(--err); }
.hr { height: 1px; background: var(--border); margin: 8px 0; }

.toast {
  position: fixed; left: 12px; right: 12px; bottom: calc(16px + var(--safe-bottom));
  background: #1f2937; color: #fff; border-radius: 12px; padding: 12px; z-index: 50;
  font-weight: 700; font-size: 13px;
}
.syncbar {
  position: fixed; left: 12px; right: 12px; bottom: calc(12px + var(--safe-bottom));
  background: #0f172a; color: #fff; border-radius: 12px; padding: 10px 12px; z-index: 45;
  display: flex; align-items: center; gap: 10px; font-size: 12.5px; font-weight: 800;
}
.syncbar button { color: #fff; background: transparent; border: 0; font-weight: 700; }

.tabs { display: flex; gap: 8px; margin-bottom: 12px; }
.tabs button { flex: 1; border: 0; border-radius: 10px; padding: 10px; background: var(--surface); color: var(--muted); font-weight: 700; }
.tabs button.on { background: var(--primary); color: #fff; }

.table-card { background: var(--surface); border-radius: 12px; padding: 12px; margin-bottom: 8px; }
.muted { color: var(--muted); }
.busy { opacity: 0.6; pointer-events: none; }
.center { text-align: center; padding: 24px; color: var(--muted); }
.actions { display: flex; gap: 8px; flex-wrap: wrap; margin: 8px 0 12px; }

.install-hint {
  margin-top: 14px;
  font-size: 12px;
  color: var(--muted);
  line-height: 1.4;
}
.slot-pills { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 8px; }
.slot-pills button {
  flex: 0 0 auto;
  border: 1.2px solid #8b2942;
  border-radius: 22px;
  padding: 10px 14px;
  background: #8b2942;
  color: #fff;
  font-weight: 700;
  font-size: 12.5px;
}
.slot-pills button.off {
  background: #fff;
  color: #1e293b;
  border: 1.2px solid #d0d7e0;
}
html[data-theme="dark"] .slot-pills button.off { background: #343a52; color: #f0f2fa; }

.tile .ico svg { width: 26px; height: 26px; display: block; }
.modal-bg {
  position: fixed; inset: 0; background: rgba(15, 23, 42, 0.45); z-index: 60;
  display: flex; align-items: center; justify-content: center; padding: 20px;
}
.modal {
  width: 100%; max-width: 420px; background: var(--surface); color: var(--text);
  border-radius: 16px; padding: 20px; box-shadow: 0 16px 40px rgba(0,0,0,.25);
}
.modal h3 { margin: 0 0 12px; font-size: 20px; font-weight: 800; }
.modal .date-display {
  text-align: center;
  font-weight: 800;
  font-size: 16px;
  margin: 0 0 14px;
}
.date-visible {
  width: 100%;
  min-height: 44px;
  margin: 0 0 12px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  color: var(--text);
  font-size: 16px;
  font-weight: 700;
}
.date-pick-wrap {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  overflow: visible;
  cursor: pointer;
}
.date-pick-wrap.btn { width: 100%; margin: 0 0 8px; gap: 8px; }
.topbar .date-pick-wrap {
  min-width: 44px;
  min-height: 40px;
  padding: 0 8px;
  gap: 4px;
  font-size: 12px;
  font-weight: 700;
  border-radius: 10px;
}
.pill.date-pick-wrap { display: block; }
.date-overlay,
.date-pick-wrap input[type="date"] {
  position: absolute;
  inset: 0;
  opacity: 0.02;
  width: 100%;
  height: 100%;
  margin: 0;
  padding: 0;
  border: 0;
  cursor: pointer;
  font-size: 16px;
  background: transparent;
  color: transparent;
  z-index: 2;
}
.modal .modal-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 14px; }

.prod {
  background: var(--surface);
  border-radius: 14px;
  margin-bottom: 12px;
  box-shadow: 0 3px 10px rgba(30,41,59,.08);
  display: flex;
  overflow: hidden;
  border: 1.2px solid transparent;
}
.prod .bar { width: 4px; background: #8b2942; flex: 0 0 4px; }
.prod.is-match {
  background: #eff8f0;
  border-color: #c8e6c9;
}
.prod.is-match .bar { background: #2e7d32; width: 4px; flex-basis: 4px; }
.prod.is-mismatch {
  background: #fff5f5;
  border-color: #ffcdd2;
}
.prod.is-mismatch .bar { background: #b71c1c; width: 5px; flex-basis: 5px; }
.prod .body { flex: 1; min-width: 0; padding: 12px 10px 12px 12px; display: flex; gap: 8px; }
.prod .body.col { flex-direction: column; }
.prod .body.pack-side { flex-direction: row; align-items: flex-start; }
.pack-left { flex: 1; min-width: 0; }
.prod-head {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  width: 100%;
  flex-wrap: wrap;
}
.prod .sr { font-size: 19px; font-weight: 900; margin-right: 0; min-width: 1.4em; flex: 0 0 auto; }
.prod .names { flex: 1; min-width: 0; }
.prod .pname { font-size: 16px; font-weight: 800; line-height: 1.22; }
.prod .pen { font-size: 12px; font-weight: 600; color: var(--muted); margin-top: 2px; line-height: 1.2; }
.prod .sigma {
  font-size: 20px;
  font-weight: 900;
  color: var(--primary);
  line-height: 1;
  flex: 0 0 auto;
  padding-top: 2px;
}
.prod.is-mismatch .sigma { color: #b71c1c; }
.cmp-badge-slot { flex: 0 0 auto; }
.cmp-badge {
  display: inline-block;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.04em;
  padding: 4px 10px;
  border-radius: 20px;
  white-space: nowrap;
}
.cmp-badge.ok { background: #e8f5e9; color: #2e7d32; }
.cmp-badge.bad { background: #ffebbe; color: #b71c1c; background: #ffebee; }
.meta-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 8px;
}
.unit-chip {
  background: #e8ecf0;
  border-radius: 8px;
  padding: 5px 10px;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.35px;
}
html[data-theme="dark"] .unit-chip { background: #2a3352; }
.total-lbl { font-size: 13px; font-weight: 700; }
.total-lbl b { font-size: 14px; font-weight: 900; }
.prod.is-mismatch .total-lbl b { color: #b71c1c; }
.pack-qty-chip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  background: #e8ecf0;
  border-radius: 20px;
  padding: 6px 10px;
  margin-top: 10px;
  font-size: 11px;
  font-weight: 800;
}
.pack-qty-chip input {
  width: 72px;
  margin: 0;
  text-align: center;
  font-weight: 900;
  font-size: 16px;
  padding: 4px 2px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 8px;
}
html[data-theme="dark"] .pack-qty-chip { background: #2a3352; }
.foot-line {
  margin-top: 8px;
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
  display: flex;
  justify-content: space-between;
  gap: 8px;
}
.foot-line.pack { color: var(--primary); }
.prod.is-mismatch .foot-line.pack { color: #b71c1c; }
.foot-line b { font-weight: 900; color: var(--text); }
.prod .line { font-size: 14px; font-weight: 800; margin-top: 4px; letter-spacing: 0.3px; }
.prod .marg { color: #0369a1; }
.pur-name { font-size: 18px !important; font-weight: 800; line-height: 1.22; }
.prod .qty-box {
  width: 78px;
  flex: 0 0 78px;
  min-height: 48px;
  padding: 0 4px;
  border-radius: 10px;
  border: 1px solid color-mix(in srgb, var(--border) 55%, transparent);
  background: #fff;
  display: flex;
  align-items: center;
}
.qty-box.pur-qty {
  width: 78px;
  flex: 0 0 78px;
  min-height: 52px;
  padding: 0;
  align-self: flex-start;
}
.qty-box.pur-qty .qty-in {
  font-size: 24px;
  padding: 14px 4px !important;
  min-height: 52px;
}
.qty-box:focus-within,
.qty-cell:focus-within {
  background: var(--primary-container);
  border-color: var(--primary);
  border-width: 2px;
  box-shadow: 0 2px 8px color-mix(in srgb, var(--primary) 18%, transparent);
}
.qty-in {
  width: 100% !important;
  margin: 0 !important;
  padding: 6px 4px !important;
  border: 0 !important;
  background: transparent !important;
  text-align: center;
  font-weight: 900;
  font-size: 17px;
  color: var(--text);
  caret-color: var(--primary);
  pointer-events: auto;
  -webkit-user-select: text;
  user-select: text;
}
.qty-cell:focus-within .qty-in,
.qty-box:focus-within .qty-in {
  font-size: 22px;
  color: var(--primary);
}
.qty-box.pur-qty:focus-within {
  background: #fff;
  border-color: var(--primary);
  border-width: 1.5px;
  box-shadow: none;
}
.qty-box.pur-qty:focus-within .qty-in {
  font-size: 24px;
  color: var(--text);
}
html[data-theme="dark"] .qty-box.pur-qty:focus-within { background: #181b28; }
.qty-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 10px; }
.qty-grid.one { grid-template-columns: 1fr; }
.qty-cell {
  min-height: 84px;
  padding: 5px 6px 4px;
  border-radius: 10px;
  border: 1px solid color-mix(in srgb, var(--border) 55%, transparent);
  background: #fff;
  display: flex;
  flex-direction: column;
}
.qty-labs {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 4px;
  margin-bottom: 2px;
}
.qty-labs span {
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.15px;
  color: color-mix(in srgb, var(--text) 78%, transparent);
}
.qty-labs small {
  font-size: 9px;
  font-weight: 700;
  color: var(--muted);
}
.qty-cell .qty-in { flex: 1; font-size: 17px; }
html[data-theme="dark"] .qty-cell,
html[data-theme="dark"] .qty-box { background: #181b28; }
.totals-chip {
  background: #f0f4fa; border: 1px solid var(--border); border-radius: 10px;
  padding: 6px 10px; text-align: right; font-weight: 900;
}
html[data-theme="dark"] .totals-chip { background: #12141f; }
.search-row { display: flex; gap: 10px; align-items: center; margin-bottom: 12px; }
.search-row .searchbar { flex: 1; margin: 0; }
.gu-hint {
  font-size: 15px;
  font-weight: 800;
  margin-top: 8px;
  line-height: 1.35;
}
.gu-hint.plus { color: #15803d; }
.gu-hint.minus { color: #b91c1c; }

.search-wrap { position: relative; margin-bottom: 12px; }
.search-wrap .searchbar { padding-left: 42px; margin-bottom: 0; }
.search-wrap .search-ico {
  position: absolute; left: 12px; top: 50%; transform: translateY(-50%);
  color: var(--primary); pointer-events: none;
}
.grand-foot {
  background: #e8ecf0;
  border-radius: 12px;
  padding: 12px 14px;
  margin-top: 12px;
  display: flex;
  align-items: center;
  gap: 16px;
  font-weight: 900;
}
.grand-foot .lbl { flex: 1; letter-spacing: 0.5px; font-size: 13px; }
.grand-foot .num { font-size: 18px; }

.manage-head { font-size: 20px; font-weight: 800; margin: 8px 0 4px; }
.manage-cap { font-size: 13px; color: var(--muted); margin: 0 0 8px; }
.manage-box {
  background: #fff;
  border: 1px solid #d0d7e0;
  border-radius: 16px;
  overflow: hidden;
}
html[data-theme="dark"] .manage-box { background: var(--surface); }
.manage-box .head {
  background: #e8eef5;
  padding: 12px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-weight: 800;
}
html[data-theme="dark"] .manage-box .head { background: #12141f; }
.man-card {
  background: #f8fafc;
  border: 1px solid #d0d7e0;
  border-radius: 12px;
  padding: 12px;
  margin: 0 10px 10px;
}
html[data-theme="dark"] .man-card { background: #12141f; }
.sr-chip {
  display: inline-block;
  background: #e2e8f0;
  border-radius: 8px;
  padding: 5px 10px;
  font-weight: 800;
  font-size: 13px;
}
html[data-theme="dark"] .sr-chip { background: #2a3352; }
.man-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 10px 0; }
.man-actions .btn { width: 100%; background: var(--burgundy); border-radius: 10px; }

.hit-card {
  width: 100%;
  text-align: left;
  background: #fff;
  border: 1px solid color-mix(in srgb, var(--border) 25%, transparent);
  border-radius: 14px;
  padding: 12px 14px;
  margin-bottom: 10px;
  color: inherit;
}
html[data-theme="dark"] .hit-card { background: var(--surface); }
.hit-card .row { display: flex; align-items: center; gap: 8px; }
.hit-card .qty { font-size: 13px; font-weight: 700; margin-top: 8px; }

.rep-tabs {
  display: flex;
  background: var(--surface);
  border-radius: 16px;
  padding: 6px;
  margin-bottom: 12px;
}
.rep-tabs button {
  flex: 1;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-weight: 600;
  font-size: 13px;
  padding: 10px 8px;
  border-radius: 12px;
}
.rep-tabs button.on {
  background: color-mix(in srgb, var(--primary-container) 65%, transparent);
  color: var(--primary);
  font-weight: 800;
}
.legend {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--muted);
  margin: 0 0 8px;
  line-height: 1.35;
}
.rep-head-card {
  border-radius: 16px;
  padding: 12px;
  margin-bottom: 8px;
  box-shadow: 0 2px 8px rgba(15,23,42,0.05);
}
.rep-head-card.ok { background: #ecfdf5; border: 1px solid #86efac; }
.rep-head-card.warn { background: #fffbeb; border: 1px solid #fcd34d; }
.rep-ref-warn {
  background: #fff7ed;
  border: 1px solid #fdba74;
  border-radius: 10px;
  padding: 10px;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.3;
  margin-bottom: 10px;
  color: color-mix(in srgb, var(--text) 88%, transparent);
}
.rep-head-pills { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px; }
.rep-head-pill {
  background: rgba(255,255,255,0.75);
  border: 1px solid color-mix(in srgb, var(--border) 20%, transparent);
  border-radius: 12px;
  padding: 10px 8px;
  text-align: center;
}
.rep-head-pill span {
  display: block;
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.35px;
  color: var(--muted);
}
.rep-head-pill b { display: block; font-size: 17px; font-weight: 900; margin-top: 4px; }
.rep-head-pill b.ok { color: #15803d; }
.rep-head-pill b.bad { color: #b91c1c; font-size: 20px; }
.rep-seg {
  display: flex;
  gap: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  overflow: hidden;
  margin-bottom: 8px;
}
.rep-seg button {
  flex: 1;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-weight: 700;
  font-size: 13px;
  padding: 10px 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}
.rep-seg button svg { width: 18px; height: 18px; }
.rep-seg button.on { background: color-mix(in srgb, var(--primary-container) 70%, transparent); color: var(--primary); }
.rep-legend {
  background: color-mix(in srgb, var(--surface) 65%, #e8ecf0);
  border: 1px solid color-mix(in srgb, var(--border) 25%, transparent);
  border-radius: 12px;
  padding: 10px 12px;
  margin-bottom: 10px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
}
.rep-legend .lg {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  font-weight: 700;
}
.rep-legend .lg.muted { font-size: 11px; font-weight: 600; color: var(--muted); }
.rep-legend i {
  width: 4px;
  height: 18px;
  border-radius: 2px;
  display: inline-block;
  flex: 0 0 4px;
}
.rep-legend i.g { background: #15803d; }
.rep-legend i.r { background: #b91c1c; }
.rep-card {
  background: var(--surface);
  border: 1px solid color-mix(in srgb, var(--border) 28%, transparent);
  border-radius: 14px;
  padding: 12px;
  margin-bottom: 10px;
  box-shadow: 0 2px 10px rgba(15,23,42,0.06);
}
.rep-card .name { font-size: 15px; font-weight: 900; line-height: 1.2; letter-spacing: 0.15px; }
.rep-card-head { display: flex; align-items: center; gap: 12px; margin-bottom: 10px; }
.rep-card-head .name { flex: 1; min-width: 0; }
.sr-dot {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: #e2e8f0;
  border: 1px solid color-mix(in srgb, var(--border) 35%, transparent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 900;
  flex: 0 0 38px;
}
html[data-theme="dark"] .sr-dot { background: #2a3352; }
.rep-stats { display: grid; gap: 4px; margin-top: 12px; }
.rep-stats.five { grid-template-columns: repeat(5, 1fr); margin-top: 0; }
.rep-stats.three { grid-template-columns: 1fr 1fr 1fr; gap: 8px; }
.rep-mini {
  background: #f1f5f9;
  border: 1px solid color-mix(in srgb, var(--border) 22%, transparent);
  border-radius: 8px;
  padding: 5px 3px;
  text-align: center;
}
.rep-mini span {
  display: block;
  font-size: 6.5px;
  font-weight: 800;
  letter-spacing: 0.05px;
  text-transform: uppercase;
  color: var(--muted);
  line-height: 1;
  white-space: pre-line;
}
.rep-mini b { display: block; font-size: 11px; font-weight: 900; margin-top: 3px; line-height: 1; }
.rep-mini.emph b { font-size: 12px; }
.rep-mini.diff-up { background: #dcfce7; border-color: #86efac; }
.rep-mini.diff-up b { color: #15803d; }
.rep-mini.diff-down { background: #fee2e2; border-color: #fecaca; }
.rep-mini.diff-down b { color: #b91c1c; }
.rep-mini.diff-zero { background: #f1f5f9; }
.rep-mini.tint-pack { background: #e0f2fe; border: 0; border-radius: 12px; padding: 10px 8px; }
.rep-mini.tint-pack span { color: #0369a1; font-size: 10px; letter-spacing: 0.4px; }
.rep-mini.tint-pack b { font-size: 15px; }
.rep-mini.tint-loose { background: #d1fae5; border: 0; border-radius: 12px; padding: 10px 8px; }
.rep-mini.tint-loose span { color: #047857; font-size: 10px; letter-spacing: 0.4px; }
.rep-mini.tint-loose b { font-size: 15px; }
.rep-mini.tint-total { background: color-mix(in srgb, var(--primary-container) 45%, transparent); border: 0; border-radius: 12px; padding: 10px 8px; }
.rep-mini.tint-total span { color: var(--primary); font-size: 10px; letter-spacing: 0.4px; }
.rep-mini.tint-total b { font-size: 17px; }
.rep-empty { text-align: center; padding: 36px 24px; }
.rep-empty-ico { color: var(--primary); opacity: 0.85; margin-bottom: 16px; }
.rep-empty-ico svg { width: 48px; height: 48px; margin: 0 auto; }
.rep-empty h3 { margin: 0 0 10px; font-size: 17px; font-weight: 900; }
.rep-empty p { margin: 0; font-size: 14px; line-height: 1.35; color: var(--muted); }

.marg-line {
  background: var(--surface);
  border-radius: 12px;
  padding: 12px;
  margin-bottom: 8px;
  border-left: 4px solid var(--muted);
}
.marg-line.up { border-left-color: #15803d; }
.marg-line.down { border-left-color: #b91c1c; }
.marg-line .name { font-weight: 800; }
.marg-line .meta { font-size: 13px; color: var(--muted); margin-top: 4px; }

.pills.three { grid-template-columns: 1fr 1fr 1fr; gap: 8px; }
.pills.three .pill { padding: 10px 8px; }
.pills.three .lbl { font-size: 10px; text-transform: uppercase; letter-spacing: 0.04em; }

.spin {
  width: 28px; height: 28px; border: 3px solid var(--border); border-top-color: var(--primary);
  border-radius: 50%; animation: spin 0.8s linear infinite; margin: 24px auto;
}
@keyframes spin { to { transform: rotate(360deg); } }

#keypad-bar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 80;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 12px calc(8px + env(safe-area-inset-bottom, 0px));
  background: #e8ecf0;
  border-top: 1px solid var(--border);
  box-shadow: 0 -4px 16px rgba(15, 23, 42, 0.12);
}
#keypad-bar[hidden] { display: none !important; }
html[data-theme="dark"] #keypad-bar { background: #141722; }
#keypad-bar .key-tab {
  min-width: 96px;
  min-height: 44px;
  padding: 10px 18px;
  border: 0;
  border-radius: 10px;
  background: var(--primary);
  color: #fff;
  font-weight: 800;
  font-size: 16px;
  letter-spacing: 0.04em;
}
#keypad-bar .key-hint {
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
}
body.qty-kb .page { padding-bottom: 72px; }

.spotlight {
  padding: 4px 2px 12px;
  border-radius: 16px;
}
.flow-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 4px 2px 8px;
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
}
.flow-bar .flow-badge { margin-left: auto; }
.flow-nav {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 8px;
  margin-top: 10px;
  align-items: stretch;
}
.flow-nav .btn { width: 100%; }
.done-card {
  background: var(--surface);
  border: 1px solid color-mix(in srgb, var(--border) 40%, transparent);
  border-radius: 14px;
  padding: 14px;
  margin-bottom: 10px;
}
.done-card h3 { margin: 0 0 4px; font-size: 17px; font-weight: 800; }
.done-card p { margin: 0 0 10px; font-size: 13px; font-weight: 600; }
