/* ============ tokens ============ */
:root {
  --bg: #f5f6f8;
  --bg-grad: radial-gradient(1200px 600px at 100% -10%, rgba(76, 110, 245, .08), transparent 60%);
  --surface: #ffffff;
  --surface-2: #f1f3f6;
  --surface-3: #e9ecf1;
  --sidebar: rgba(255, 255, 255, .72);
  --text: #12151a;
  --text-2: #4a5160;
  --muted: #8a919e;
  --line: #e5e8ed;
  --line-strong: #d4d9e1;
  --accent: #3d5afe;
  --accent-hover: #2f49e6;
  --accent-text: #ffffff;
  --accent-soft: rgba(61, 90, 254, .1);
  --accent-ink: #2f49e6;
  --ok: #0f9d58;
  --ok-soft: rgba(15, 157, 88, .1);
  --warn: #c77700;
  --warn-soft: rgba(230, 150, 0, .12);
  --bad: #e5383b;
  --bad-soft: rgba(229, 56, 59, .1);
  --shadow-sm: 0 1px 2px rgba(16, 24, 40, .05);
  --shadow: 0 1px 2px rgba(16, 24, 40, .04), 0 8px 24px -8px rgba(16, 24, 40, .08);
  --shadow-lg: 0 24px 64px -12px rgba(16, 24, 40, .25);
  --r-sm: 8px;
  --r: 14px;
  --r-lg: 20px;
  --font: "Manrope", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, Menlo, monospace;
  color-scheme: light;
}
:root[data-theme="dark"] {
  --bg: #0b0d11;
  --bg-grad: radial-gradient(1200px 600px at 100% -10%, rgba(99, 125, 255, .12), transparent 60%);
  --surface: #13161c;
  --surface-2: #1a1e26;
  --surface-3: #232833;
  --sidebar: rgba(17, 20, 26, .78);
  --text: #eef0f4;
  --text-2: #b4bac6;
  --muted: #7b8291;
  --line: #242934;
  --line-strong: #323846;
  --accent: #6b83ff;
  --accent-hover: #8296ff;
  --accent-text: #0b0d11;
  --accent-soft: rgba(107, 131, 255, .14);
  --accent-ink: #9aabff;
  --ok: #34d399;
  --ok-soft: rgba(52, 211, 153, .12);
  --warn: #fbbf24;
  --warn-soft: rgba(251, 191, 36, .12);
  --bad: #ff6b6e;
  --bad-soft: rgba(255, 107, 110, .12);
  --shadow-sm: none;
  --shadow: 0 1px 0 rgba(255, 255, 255, .03) inset;
  --shadow-lg: 0 24px 64px -12px rgba(0, 0, 0, .7);
  color-scheme: dark;
}

/* ============ base ============ */
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg-grad), var(--bg);
  background-attachment: fixed;
  color: var(--text);
  font: 500 14.5px/1.5 var(--font);
  -webkit-font-smoothing: antialiased;
  letter-spacing: -0.005em;
}
a { color: var(--accent-ink); text-decoration: none; }
h1 { font-size: 26px; font-weight: 800; letter-spacing: -0.025em; margin: 0; line-height: 1.2; }
h2 { font-size: 16px; font-weight: 700; margin: 0; letter-spacing: -0.01em; }
.muted { color: var(--muted); }
.xs { font-size: 12px; }
.sm { font-size: 13px; }
.mono { font-family: var(--mono); font-size: 12.5px; letter-spacing: 0; }
[hidden] { display: none !important; }
svg.i { width: 18px; height: 18px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }

/* ============ shell ============ */
.shell { display: flex; min-height: 100vh; }
.sidebar {
  position: sticky; top: 0; height: 100vh; width: 256px; flex: none;
  display: flex; flex-direction: column; gap: 8px; padding: 18px 14px;
  background: var(--sidebar); backdrop-filter: blur(20px) saturate(1.4); -webkit-backdrop-filter: blur(20px) saturate(1.4);
  border-right: 1px solid var(--line);
  z-index: 40;
}
.sb-brand { display: flex; align-items: center; gap: 12px; padding: 4px 8px 18px; }
.logo {
  width: 44px; height: 44px; border-radius: 12px; overflow: hidden; flex: none;
  box-shadow: 0 6px 16px -6px rgba(0, 0, 0, .35);
}
.logo img { width: 100%; height: 100%; object-fit: cover; transform: scale(1.09); display: block; }
.logo.sm { width: 30px; height: 30px; border-radius: 8px; }
.sb-title { font-weight: 800; font-size: 16px; letter-spacing: -0.02em; }
.sb-sub { font-size: 12px; color: var(--muted); }
.sb-nav { display: flex; flex-direction: column; gap: 2px; flex: 1; overflow-y: auto; }
.store-dd { position: relative; margin-bottom: 4px; }
.store-trigger {
  width: 100%; justify-content: flex-start; gap: 10px; padding: 8px 10px 8px 8px; border-radius: 12px;
  border: 1px solid var(--line); background: var(--surface); box-shadow: var(--shadow-sm); text-align: left;
}
.store-trigger:hover { background: var(--surface); border-color: var(--line-strong); }
.store-trigger:disabled { opacity: 1; cursor: default; }
.store-dd.open .store-trigger { border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
.store-ic {
  --sc: var(--accent);
  width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center; flex: none; overflow: hidden;
  background: color-mix(in srgb, var(--sc) 14%, var(--surface)); color: var(--sc);
  font-size: 12px; font-weight: 800; letter-spacing: -0.02em;
}
:root[data-theme="dark"] .store-ic { background: color-mix(in srgb, var(--sc) 24%, var(--surface)); color: color-mix(in srgb, var(--sc) 55%, #fff); }
.store-ic.has-logo { background: #fff; border: 1px solid var(--line); }
.store-ic img { width: 100%; height: 100%; object-fit: cover; display: block; }
.store-ic.lg { width: 40px; height: 40px; border-radius: 11px; font-size: 14px; }
.store-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 700; color: var(--text); }
.store-trigger .chev { width: 16px; height: 16px; color: var(--muted); transition: transform .2s; }
.store-dd.open .store-trigger .chev { transform: rotate(180deg); }
.store-menu {
  position: absolute; left: 0; right: 0; top: calc(100% + 6px); z-index: 50; padding: 6px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow-lg);
  animation: pop .14s ease;
}
.store-search { margin: 2px 2px 6px; min-width: 0; }
.store-search input { height: 36px; border-radius: 10px; }
.store-options { display: flex; flex-direction: column; gap: 2px; max-height: 300px; overflow-y: auto; }
.store-opt {
  width: 100%; justify-content: flex-start; gap: 10px; padding: 6px 8px; border: 0; border-radius: 10px;
  background: transparent; box-shadow: none; text-align: left; font-weight: 600;
}
.store-opt[hidden] { display: none; }
.store-opt:hover, .store-opt:focus-visible { background: var(--surface-2); outline: none; }
.store-opt.on { background: var(--accent-soft); }
.store-opt.on .store-name { color: var(--accent-ink); }
.store-opt .tick { width: 16px; height: 16px; color: var(--accent-ink); }
.sb-section { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); padding: 14px 12px 6px; }
.sb-nav a {
  display: flex; align-items: center; gap: 12px; padding: 9px 12px; border-radius: 10px;
  color: var(--text-2); font-weight: 600; transition: background .15s, color .15s;
}
.sb-nav a:hover { background: var(--surface-2); color: var(--text); }
.sb-nav a.active { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm), 0 0 0 1px var(--line); }
.sb-nav a.active svg { color: var(--accent); }
.sb-nav .count { margin-left: auto; font-size: 11px; font-weight: 700; background: var(--bad); color: #fff; border-radius: 99px; padding: 1px 7px; }
.sb-bottom { display: flex; flex-direction: column; gap: 12px; }
.theme-switch { display: grid; grid-template-columns: repeat(2, 1fr); background: var(--surface-2); border-radius: 10px; padding: 3px; }
.theme-switch button { border: 0; background: none; color: var(--muted); padding: 6px; border-radius: 8px; display: grid; place-items: center; cursor: pointer; }
.theme-switch button.on { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm), 0 0 0 1px var(--line); }
.sb-user { display: flex; align-items: center; gap: 10px; padding: 10px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); }
.avatar { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; font-weight: 800; font-size: 13px; background: var(--accent-soft); color: var(--accent-ink); flex: none; }
.sb-user-info { flex: 1; min-width: 0; font-weight: 700; font-size: 13px; }
.sb-user-info > div:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.main-col { flex: 1; min-width: 0; }
main { max-width: 1180px; margin: 0 auto; padding: 32px 32px 80px; }
.mobilebar { display: none; }
.sb-backdrop { display: none; }

@media (max-width: 900px) {
  .sidebar { position: fixed; left: 0; transform: translateX(-105%); transition: transform .25s ease; background: var(--surface); box-shadow: var(--shadow-lg); }
  .shell.menu-open .sidebar { transform: none; }
  .shell.menu-open .sb-backdrop { display: block; position: fixed; inset: 0; background: rgba(0,0,0,.35); z-index: 30; }
  .mobilebar {
    display: flex; align-items: center; gap: 10px; position: sticky; top: 0; z-index: 20;
    padding: 10px 16px; background: var(--sidebar); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
    border-bottom: 1px solid var(--line);
  }
  main { padding: 20px 16px 80px; }
  h1 { font-size: 22px; }
}

/* ============ controls ============ */
button, .btn {
  font: inherit; font-weight: 600; cursor: pointer; border: 1px solid var(--line-strong); background: var(--surface); color: var(--text);
  padding: 8px 14px; border-radius: 10px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; white-space: nowrap;
  transition: background .15s, border-color .15s, transform .05s; box-shadow: var(--shadow-sm);
}
button:hover, .btn:hover { background: var(--surface-2); }
button:active, .btn:active { transform: translateY(1px); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-text); box-shadow: 0 4px 14px -4px rgba(61, 90, 254, .5); }
.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn-ghost { background: transparent; border-color: transparent; box-shadow: none; color: var(--text-2); }
.btn-ghost:hover { background: var(--surface-2); color: var(--text); }
.btn-danger { color: var(--bad); }
.btn-danger:hover { background: var(--bad-soft); border-color: transparent; }
.btn-lg { padding: 12px 20px; font-size: 15px; border-radius: 12px; }
.btn-sm { padding: 5px 10px; font-size: 13px; border-radius: 8px; }
button:disabled { opacity: .5; cursor: default; }
.icon-btn { width: 36px; height: 36px; padding: 0; border: 0; background: transparent; box-shadow: none; color: var(--text-2); border-radius: 10px; }
.icon-btn:hover { background: var(--surface-2); color: var(--text); }

input, select, textarea {
  font: inherit; font-weight: 500; padding: 9px 12px; border: 1px solid var(--line-strong); border-radius: 10px;
  background: var(--surface); color: var(--text); min-width: 0; transition: border-color .15s, box-shadow .15s;
}
input::placeholder, textarea::placeholder { color: var(--muted); }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
input[type=number] { font-variant-numeric: tabular-nums; }
input.num { width: 96px; text-align: right; }
input[readonly] { background: var(--surface-2); }
textarea { width: 100%; min-height: 72px; resize: vertical; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field > span { font-size: 13px; font-weight: 600; color: var(--text-2); }
.field input, .field select { width: 100%; }

.search { position: relative; flex: 1; min-width: 220px; }
.search svg { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--muted); }
.search input { width: 100%; padding-left: 38px; height: 42px; border-radius: 12px; }

.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { padding: 7px 12px; border-radius: 99px; font-size: 13px; box-shadow: none; }
.chip.on { background: var(--text); color: var(--bg); border-color: var(--text); }
.chip .n { opacity: .6; font-weight: 700; }

.seg { display: inline-flex; background: var(--surface-2); border-radius: 12px; padding: 4px; gap: 2px; }
.seg button { border: 0; box-shadow: none; background: transparent; color: var(--text-2); border-radius: 9px; padding: 8px 16px; }
.seg button.on { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm), 0 0 0 1px var(--line); }

.badge { display: inline-flex; align-items: center; gap: 4px; padding: 3px 9px; border-radius: 99px; font-size: 12px; font-weight: 700; background: var(--surface-2); color: var(--text-2); white-space: nowrap; }
.badge.ok { background: var(--ok-soft); color: var(--ok); }
.badge.warn { background: var(--warn-soft); color: var(--warn); }
.badge.bad { background: var(--bad-soft); color: var(--bad); }
.badge.blue { background: var(--accent-soft); color: var(--accent-ink); }
.dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }

/* ============ layout bits ============ */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 24px; }
.page-head .sub { color: var(--muted); margin-top: 4px; font-size: 14px; }
.back { display: inline-flex; align-items: center; gap: 4px; font-size: 13px; font-weight: 600; color: var(--muted); margin-bottom: 8px; }
.back:hover { color: var(--text); }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 20px; box-shadow: var(--shadow); }
.stack { display: flex; flex-direction: column; gap: 16px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.spacer { flex: 1; }
.toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 16px; }
.empty { text-align: center; padding: 48px 20px; color: var(--muted); }
.empty svg { width: 40px; height: 40px; stroke-width: 1.4; margin-bottom: 8px; }

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 16px 18px; box-shadow: var(--shadow); }
.stat .v { font-size: 30px; font-weight: 800; letter-spacing: -0.03em; line-height: 1.1; font-variant-numeric: tabular-nums; }
.stat .l { font-size: 13px; color: var(--muted); font-weight: 600; margin-top: 2px; }
.stat.accent { background: linear-gradient(135deg, var(--accent), #7c5cff); border-color: transparent; color: #fff; }
.stat.accent .l { color: rgba(255,255,255,.8); }

.thumb { width: 48px; height: 48px; border-radius: 10px; object-fit: contain; background: #fff; border: 1px solid var(--line); flex: none; }
.thumb.lg { width: 88px; height: 88px; border-radius: 14px; }

/* ============ list (products etc) ============ */
.list { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow); overflow: hidden; }
.list-head, .lrow {
  display: grid; align-items: center; gap: 16px; padding: 12px 20px;
  grid-template-columns: 48px minmax(0, 2.6fr) minmax(0, 1.3fr) 84px 96px 84px 176px;
}
.list-head { font-size: 12px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; background: var(--surface-2); border-bottom: 1px solid var(--line); padding-top: 10px; padding-bottom: 10px; }
.lrow { border-bottom: 1px solid var(--line); transition: background .12s; }
.lrow:last-child { border-bottom: 0; }
.lrow:hover { background: var(--surface-2); }
.lrow .title { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lrow .desc { font-size: 13px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.num-cell { text-align: right; font-variant-numeric: tabular-nums; font-weight: 700; }
.num-cell.big { font-size: 17px; }
.list-head .num-cell { font-weight: 700; }
.actions { display: flex; gap: 6px; justify-content: flex-end; }
.list.no-actions .list-head, .list.no-actions .lrow { grid-template-columns: 48px minmax(0, 2.6fr) minmax(0, 1.3fr) 84px 84px 84px; }
mark { background: rgba(255, 200, 0, .35); color: inherit; border-radius: 3px; padding: 0 1px; }

@media (max-width: 900px) {
  .list-head { display: none; }
  .lrow, .list.no-actions .lrow { grid-template-columns: 48px 1fr; gap: 6px 12px; padding: 14px 16px; }
  .lrow > :nth-child(1) { grid-row: span 2; }
  .lrow .num-cell, .lrow .bc-cell { grid-column: 2; text-align: left; }
  .lrow .stock-mobile { display: flex !important; grid-column: 1 / -1; }
  .lrow .num-cell { display: none; }
  .lrow .actions { grid-column: 1 / -1; justify-content: flex-start; }
}
.stock-mobile { display: none !important; gap: 6px; margin-top: 6px; }
.stock-mobile > span { flex: 1; background: var(--surface-2); border-radius: 10px; padding: 6px 10px; font-size: 12px; color: var(--muted); font-weight: 600; }
.stock-mobile b { display: block; font-size: 16px; color: var(--text); font-weight: 800; }

/* ============ tables ============ */
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--surface); box-shadow: var(--shadow); }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 10px 14px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; }
th { font-size: 12px; color: var(--muted); font-weight: 700; text-transform: uppercase; letter-spacing: .05em; background: var(--surface-2); white-space: nowrap; }
td.r, th.r { text-align: right; font-variant-numeric: tabular-nums; }
tr:last-child td { border-bottom: 0; }
tr.dim td { opacity: .5; }
tr.over td { background: var(--warn-soft); }
input[type=checkbox] { width: 18px; height: 18px; accent-color: var(--accent); cursor: pointer; }

/* ============ tasks ============ */
.tlist { display: flex; flex-direction: column; gap: 10px; }
.tcard {
  display: grid; grid-template-columns: 1fr auto; gap: 16px; align-items: center; color: var(--text);
  padding: 18px 20px; transition: border-color .15s, transform .15s;
}
.tcard:hover { border-color: var(--line-strong); transform: translateY(-1px); }
.tcard .ttl { font-weight: 800; font-size: 16px; letter-spacing: -0.01em; }
.tcard .meta { display: flex; gap: 14px; flex-wrap: wrap; color: var(--muted); font-size: 13px; margin-top: 6px; }
.tcard .meta span { display: inline-flex; align-items: center; gap: 6px; }
.tcard .meta svg { width: 15px; height: 15px; }
.progress { height: 8px; background: var(--surface-3); border-radius: 99px; overflow: hidden; width: 180px; }
.progress i { display: block; height: 100%; background: linear-gradient(90deg, var(--ok), #4ade80); border-radius: 99px; }
.tprog { text-align: right; display: flex; flex-direction: column; gap: 8px; align-items: flex-end; font-size: 13px; }
@media (max-width: 640px) { .tcard { grid-template-columns: 1fr; } .tprog { align-items: flex-start; } .progress { width: 100%; } }

.packtypes { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 10px; }
.ptype {
  display: flex; flex-direction: column; align-items: flex-start; gap: 10px; padding: 16px; text-align: left; white-space: normal;
  border-radius: var(--r); border: 1.5px solid var(--line); box-shadow: none; height: auto;
}
.ptype .ic { width: 40px; height: 40px; border-radius: 10px; background: var(--surface-2); display: grid; place-items: center; color: var(--text-2); }
.ptype .pt-name { font-weight: 700; }
.ptype .pt-desc { font-size: 12.5px; color: var(--muted); font-weight: 500; }
.ptype.on { border-color: var(--accent); background: var(--accent-soft); }
.ptype.on .ic { background: var(--accent); color: var(--accent-text); }

.sticky-bottom {
  position: sticky; bottom: 16px; z-index: 5; display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
  padding: 14px 16px 14px 22px; border-radius: var(--r-lg); border: 1px solid var(--line);
  background: color-mix(in srgb, var(--surface) 85%, transparent); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
  box-shadow: var(--shadow-lg);
}
.sb-tot { display: flex; gap: 28px; flex-wrap: wrap; flex: 1; }
.sb-tot div b { display: block; font-size: 22px; font-weight: 800; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.sb-tot div span { font-size: 12px; color: var(--muted); font-weight: 600; }
@media (max-width: 900px) {
  .sticky-bottom { padding: 10px 12px; gap: 10px; bottom: 8px; }
  .sb-tot { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; flex-basis: 100%; }
  .sb-tot div b { font-size: 17px; }
  .sb-tot div span { font-size: 10.5px; line-height: 1.2; display: block; }
  .sticky-bottom .btn-lg { width: 100%; padding: 10px; }
}

.banner { display: flex; gap: 14px; align-items: center; padding: 16px 20px; border-radius: var(--r-lg); background: var(--accent-soft); color: var(--accent-ink); }
.banner .ic { width: 44px; height: 44px; border-radius: 12px; background: var(--accent); color: var(--accent-text); display: grid; place-items: center; flex: none; }
.banner b { font-size: 17px; display: block; color: var(--text); }
.banner span { font-size: 13px; color: var(--text-2); }

.rules { border-radius: var(--r-lg); border: 1px solid var(--line); background: var(--surface); box-shadow: var(--shadow); }
.rules summary { list-style: none; cursor: pointer; padding: 16px 20px; display: flex; align-items: center; gap: 10px; font-weight: 700; }
.rules summary::-webkit-details-marker { display: none; }
.rules summary .chev { margin-left: auto; transition: transform .2s; color: var(--muted); }
.rules[open] summary .chev { transform: rotate(180deg); }
.rules summary .ic { color: var(--warn); }
.rules ol { margin: 0; padding: 0 20px 18px 44px; color: var(--text-2); display: flex; flex-direction: column; gap: 6px; }
.rules li::marker { font-weight: 800; color: var(--muted); }

.item { display: grid; grid-template-columns: auto 1fr; gap: 18px; padding: 20px; }
.item.done { border-color: color-mix(in srgb, var(--ok) 40%, var(--line)); background: color-mix(in srgb, var(--ok) 5%, var(--surface)); }
.item.issue { border-color: var(--bad); }
.item-top { display: flex; justify-content: space-between; gap: 10px; align-items: flex-start; flex-wrap: wrap; }
.item .art { font-size: 19px; font-weight: 800; letter-spacing: -0.02em; word-break: break-all; }
.idx { display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: 8px; background: var(--surface-2); font-size: 13px; font-weight: 800; color: var(--text-2); margin-right: 8px; vertical-align: 2px; }
.calc { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin: 14px 0; }
.calc div { background: var(--surface-2); border-radius: 12px; padding: 10px 14px; }
.calc b { display: block; font-size: 22px; font-weight: 800; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.calc span { font-size: 12px; color: var(--muted); font-weight: 600; }
.codes { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; font-size: 13px; color: var(--muted); align-items: center; }
.boxcode { font-family: var(--mono); font-weight: 700; font-size: 13.5px; background: var(--text); color: var(--bg); padding: 4px 10px; border-radius: 8px; }
.boxcode.rem { background: var(--warn); color: #111; }
.issue-box { display: flex; gap: 8px; background: var(--bad-soft); color: var(--bad); padding: 10px 14px; border-radius: 12px; margin-top: 12px; font-weight: 600; }
.item-foot { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-top: 14px; padding-top: 14px; border-top: 1px dashed var(--line); }
.check {
  display: inline-flex; align-items: center; gap: 10px; font-weight: 700; cursor: pointer; padding: 8px 14px 8px 10px;
  border: 1px solid var(--line-strong); border-radius: 10px; background: var(--surface); user-select: none;
}
.check input { width: 20px; height: 20px; }
.item.done .check { border-color: var(--ok); color: var(--ok); }
@media (max-width: 640px) {
  .item { grid-template-columns: 1fr; }
  .calc { grid-template-columns: repeat(2, 1fr); }
}

/* ============ auth ============ */
.auth-wrap { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; }
.auth-card { width: 100%; max-width: 420px; padding: 32px; }
.auth-card .logo { width: 88px; height: 88px; border-radius: 22px; margin-bottom: 18px; }
.auth-card h1 { font-size: 24px; margin-bottom: 6px; }
.auth-card form { display: flex; flex-direction: column; gap: 14px; margin-top: 22px; }
.auth-card .seg { width: 100%; margin-top: 20px; }
.auth-card .seg button { flex: 1; }
.auth-theme { position: fixed; top: 16px; right: 16px; }
.note { padding: 12px 14px; border-radius: 12px; background: var(--surface-2); font-size: 13px; color: var(--text-2); }
.note.ok { background: var(--ok-soft); color: var(--ok); font-weight: 600; }

/* ============ modal & toast ============ */
.modal-bg {
  position: fixed; inset: 0; z-index: 90; background: rgba(8, 10, 14, .45); backdrop-filter: blur(4px);
  display: grid; place-items: center; padding: 16px; animation: fade .15s ease;
}
.modal { width: 100%; max-width: 440px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow-lg); padding: 24px; animation: pop .18s ease; }
.modal h2 { font-size: 18px; margin-bottom: 4px; }
.modal .mbody { display: flex; flex-direction: column; gap: 14px; margin-top: 18px; }
.modal .mfoot { display: flex; justify-content: flex-end; gap: 8px; margin-top: 22px; }
.modal .prod { display: flex; gap: 12px; align-items: center; padding: 10px; border-radius: 12px; background: var(--surface-2); }
@keyframes fade { from { opacity: 0; } }
@keyframes pop { from { opacity: 0; transform: translateY(8px) scale(.98); } }

.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 100; max-width: 90vw;
  background: var(--text); color: var(--bg); padding: 11px 18px; border-radius: 12px; font-weight: 600; box-shadow: var(--shadow-lg);
  animation: pop .2s ease;
}
.toast.error { background: var(--bad); color: #fff; }

/* ============ photo zoom on hover ============ */
.img-zoom {
  position: fixed; left: 0; top: 0; z-index: 120; width: 340px; height: 340px; pointer-events: none;
  background: #fff; border-radius: 16px; padding: 10px; box-shadow: var(--shadow-lg); border: 1px solid var(--line);
}
.img-zoom img { width: 100%; height: 100%; object-fit: contain; display: block; }
img.thumb { cursor: zoom-in; }

/* ============ product label modal ============ */
.label-preview { background: var(--surface-2); border-radius: 12px; padding: 14px; display: grid; place-items: center; }
.label-preview canvas { width: 100%; max-width: 290px; height: auto; background: #fff; box-shadow: 0 2px 8px rgba(0,0,0,.15); border-radius: 4px; }
.label-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }

/* ============ printing labels 58×40 ============ */
#printArea { display: none; }
@media print {
  @page { size: 58mm 40mm; margin: 0; }
  html, body { background: #fff !important; }
  body > *:not(#printArea) { display: none !important; }
  #printArea { display: block; }
}
.label {
  width: 58mm; height: 40mm; padding: 1.5mm 2mm; overflow: hidden;
  page-break-after: always; break-after: page;
  display: flex; flex-direction: column; color: #000; background: #fff;
  font-family: Arial, Helvetica, sans-serif; letter-spacing: 0;
}
.label:last-child { page-break-after: auto; break-after: auto; }
.label svg { width: 100%; height: 17mm; display: block; }
.label .bc-num { text-align: center; font-size: 9pt; font-weight: 700; letter-spacing: .5px; }
.label .lname { font-size: 6.5pt; line-height: 1.15; max-height: 7.5mm; overflow: hidden; margin-top: .5mm; font-weight: 400; }
.label .lart { font-size: 8pt; font-weight: 700; margin-top: auto; }
.label.box { justify-content: center; text-align: center; }
.label.box .bhead { font-size: 7pt; text-transform: uppercase; letter-spacing: 1px; }
.label.box .bart { font-size: 15pt; font-weight: 800; line-height: 1.1; word-break: break-all; margin: 1mm 0; }
.label.box .bqty { font-size: 22pt; font-weight: 800; line-height: 1; }
.label.box .bfoot { font-size: 7pt; margin-top: 1.5mm; }
.label.box.rem .bhead { background: #000; color: #fff; padding: .5mm 0; font-weight: 800; }
