/* nolan design system (PHASE_13B). One file, no build. Tokens first, then components.
   Class names used by the pages before 13B are kept. */

@font-face {
  font-family: "Vazirmatn";
  src: url("/static/fonts/Vazirmatn.woff2") format("woff2");
  font-weight: 100 900;
  font-display: swap;
}

:root {
  --bg: #f4f5f8; --surface: #fff; --surface-2: #f8f9fb; --fg: #1b2130; --muted: #5f6b7d; --line: #e1e5eb;
  --accent: #2563eb; --accent-fg: #fff; --accent-soft: #e8efff;
  --ok: #16803c; --ok-soft: #e6f5ec; --warn: #a15c00; --warn-soft: #fff4e0; --bad: #c8222f; --bad-soft: #fdecee;
  --pending: #7b45d6; --pending-soft: #f1eafd;
  --dk: #ef394e; --woo: #7f54b3;
  --radius: 12px; --radius-sm: 8px; --shadow: 0 1px 2px rgba(16, 24, 40, .06), 0 1px 3px rgba(16, 24, 40, .08);
  --shadow-lg: 0 12px 32px rgba(16, 24, 40, .18);
  --side: 232px; --top: 56px; --bottom: 64px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0e1117; --surface: #161b24; --surface-2: #1b212c; --fg: #e7eaf0; --muted: #9aa4b5; --line: #2a3140;
    --accent: #5b8dff; --accent-fg: #0b1220; --accent-soft: #1b2742;
    --ok: #3fbf6a; --ok-soft: #12291b; --warn: #e3a33a; --warn-soft: #2d2311; --bad: #f2555f; --bad-soft: #321417;
    --pending: #a77df2; --pending-soft: #251a3a;
    --shadow: 0 1px 2px rgba(0, 0, 0, .4); --shadow-lg: 0 12px 32px rgba(0, 0, 0, .5);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
/* No visible scrollbars anywhere (owner's request, 2026-10-09); wheel, touch and keys still scroll. */
* { scrollbar-width: none; -ms-overflow-style: none; }
*::-webkit-scrollbar { display: none; width: 0; height: 0; }
html, body { margin: 0; background: var(--bg); color: var(--fg); }
body { font-family: Vazirmatn, Tahoma, "Segoe UI", system-ui, sans-serif; font-size: 15px; line-height: 1.65;
  -webkit-text-size-adjust: 100%; font-feature-settings: "ss01"; }
h1, h2, h3 { line-height: 1.35; }
h2 { font-size: 19px; } h3 { font-size: 16px; margin: 0 0 10px; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.hidden { display: none !important; }

/* ---------------------------------------------------------------- shell */
.shell { display: flex; min-height: 100vh; }
.side { width: var(--side); flex: none; background: var(--surface); border-inline-end: 1px solid var(--line);
  position: sticky; top: 0; height: 100vh; overflow-y: auto; padding: 14px 10px; display: flex; flex-direction: column; gap: 4px; }
.side .brand { font-weight: 800; font-size: 20px; padding: 4px 10px 12px; letter-spacing: .3px; }
.side .brand small { display: block; font-size: 12px; font-weight: 400; color: var(--muted); }
.side .nav-group { font-size: 12px; color: var(--muted); padding: 12px 10px 4px; }
.side a { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: var(--radius-sm); color: var(--fg); }
.side a:hover { background: var(--surface-2); text-decoration: none; }
.side a.here { background: var(--accent-soft); color: var(--accent); font-weight: 700; }
.side .foot { margin-top: auto; padding: 10px; font-size: 13px; color: var(--muted); border-top: 1px solid var(--line); }
.content { flex: 1; min-width: 0; display: flex; flex-direction: column; }
header.top { position: sticky; top: 0; z-index: 20; height: var(--top); display: flex; gap: 10px; align-items: center;
  padding: 0 18px; background: color-mix(in srgb, var(--surface) 92%, transparent); backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line); }
header.top h1 { font-size: 17px; margin: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
header.top .sp { flex: 1; }
header.top .who { color: var(--muted); font-size: 13px; }
.iconbtn { position: relative; background: transparent; color: var(--fg); border: 1px solid transparent; border-radius: 10px;
  width: 40px; height: 40px; padding: 0; display: inline-flex; align-items: center; justify-content: center; cursor: pointer; }
.iconbtn:hover { background: var(--surface-2); }
.iconbtn .dot { position: absolute; top: 4px; inset-inline-end: 4px; min-width: 18px; height: 18px; border-radius: 99px; padding: 0 5px;
  background: var(--bad); color: #fff; font-size: 11px; line-height: 18px; text-align: center; }
.ico { width: 20px; height: 20px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.offline { background: var(--warn-soft); color: var(--warn); padding: 6px 18px; font-size: 13px; font-weight: 600; }
.alarm { background: var(--bad); color: #fff; padding: 8px 18px; font-weight: 600; }
.alarm div::before { content: "⚠ "; }
main { padding: 18px; max-width: 1240px; width: 100%; margin: 0 auto; }
main.wide { max-width: none; }
nav.bottom { display: none; }
.menu-btn { display: none; }

@media (max-width: 860px) {
  .side { position: fixed; inset-block: 0; inset-inline-start: 0; z-index: 60; transform: translateX(100%); transition: transform .2s;
    box-shadow: var(--shadow-lg); }
  .side.open { transform: none; }
  .scrim { position: fixed; inset: 0; background: rgba(0, 0, 0, .35); z-index: 55; }
  .menu-btn { display: inline-flex; }
  header.top { padding: 0 8px; }
  header.top .who { display: none; }
  main { padding: 12px 12px calc(var(--bottom) + 16px); }
  .content > main { padding-bottom: 4px; }
  footer.credit { padding-bottom: calc(var(--bottom) + 14px); }
  nav.bottom { display: flex; position: fixed; inset-inline: 0; bottom: 0; z-index: 40; height: var(--bottom);
    background: var(--surface); border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom); }
  nav.bottom a, nav.bottom button { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
    font-size: 11px; color: var(--muted); background: none; border: 0; font-family: inherit; cursor: pointer; }
  nav.bottom a.here { color: var(--accent); font-weight: 700; }
  nav.bottom a:hover { text-decoration: none; }
}

/* ---------------------------------------------------------------- layout helpers */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; margin-bottom: 14px; box-shadow: var(--shadow); }
.card > h3:first-child, .card > h2:first-child { margin-top: 0; }
.card.flat { box-shadow: none; }
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.row.tight { gap: 6px; }
.row.end { justify-content: flex-end; }
.grow { flex: 1 1 220px; min-width: 0; }
.grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
@media (max-width: 600px) {
  .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .stat { padding: 12px; }
  .stat .value { font-size: 21px; }
}
.cols { display: grid; gap: 14px; grid-template-columns: minmax(0, 1fr) 360px; align-items: start; }
@media (max-width: 1000px) { .cols { grid-template-columns: minmax(0, 1fr); } }
.sticky { position: sticky; top: calc(var(--top) + 12px); }
.muted { color: var(--muted); font-size: 13px; }
.num { font-variant-numeric: tabular-nums; white-space: nowrap; }
.ltr { direction: ltr; unicode-bidi: isolate; }
.spacer { height: 8px; }

/* ---------------------------------------------------------------- controls */
input, select, textarea, button { font: inherit; color: inherit; }
input, select, textarea { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 9px 11px;
  max-width: 100%; min-height: 40px; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
input.big { font-size: 20px; padding: 12px 14px; width: 100%; min-height: 54px; }
input[type=number] { width: 7em; }
label { color: var(--fg); }
label.field { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--muted); }
button, .btn { background: var(--accent); color: var(--accent-fg); border: 1px solid transparent; border-radius: var(--radius-sm);
  padding: 9px 16px; cursor: pointer; font-weight: 600; min-height: 40px; display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  transition: filter .12s, background .12s; }
button:hover, .btn:hover { filter: brightness(1.06); text-decoration: none; }
button:active { transform: translateY(1px); }
button.secondary, .btn.secondary { background: var(--surface); color: var(--fg); border-color: var(--line); }
button.secondary:hover { background: var(--surface-2); filter: none; }
button.ghost { background: transparent; color: var(--accent); border-color: transparent; }
button.danger, .btn.danger { background: var(--bad); color: #fff; }
button.ok, .btn.ok { background: var(--ok); color: #fff; }
button.lg, .btn.lg { min-height: 54px; font-size: 17px; padding: 12px 20px; border-radius: var(--radius); }
button.block { width: 100%; }
button:disabled { opacity: .5; cursor: default; filter: none; }
kbd { font: 600 11px/1 ui-monospace, monospace; border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 5px; padding: 2px 5px;
  background: var(--surface-2); color: var(--muted); direction: ltr; }

.stepper { display: inline-flex; align-items: stretch; border: 1px solid var(--line); border-radius: var(--radius-sm); overflow: hidden; background: var(--surface); }
.stepper button { min-height: 40px; width: 40px; padding: 0; border-radius: 0; background: var(--surface-2); color: var(--fg); font-size: 20px; border: 0; }
.stepper input { border: 0; border-radius: 0; width: 4em; text-align: center; min-height: 40px; box-shadow: none; }
.stepper.lg button { width: 64px; min-height: 64px; font-size: 28px; }
.stepper.lg input { width: 5em; min-height: 64px; font-size: 26px; font-weight: 700; }

/* ---------------------------------------------------------------- data display */
table { width: 100%; border-collapse: collapse; }
th, td { text-align: start; padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { color: var(--muted); font-weight: 600; font-size: 12px; background: var(--surface-2); }
tbody tr:hover { background: var(--surface-2); }
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius-sm); }
.table-wrap table th:first-child { border-start-start-radius: var(--radius-sm); }
.badge { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; border-radius: 999px; padding: 1px 9px; border: 1px solid currentColor; white-space: nowrap; }
.badge.ok { color: var(--ok); background: var(--ok-soft); border-color: transparent; }
.badge.warn { color: var(--warn); background: var(--warn-soft); border-color: transparent; }
.badge.bad { color: var(--bad); background: var(--bad-soft); border-color: transparent; }
.badge.pending { color: var(--pending); background: var(--pending-soft); border-color: transparent; }
.badge.pack { color: var(--pending); background: var(--pending-soft); border-color: transparent; font-weight: 600; }
button.secondary.hint { border-color: var(--warn); color: var(--warn); }
.roles { display: grid; gap: 4px; margin: 8px 0; }
.roles label { font-weight: 400; }
.packs { display: flex; flex-wrap: wrap; gap: 6px; margin: 6px 0; }
.packs button { min-width: 64px; }
.packs button.on { background: var(--accent); color: var(--accent-fg); border-color: transparent; }
.chip { font-size: 12px; border-radius: 6px; padding: 0 7px; color: #fff; font-weight: 600; }
.chip.digikala { background: var(--dk); } .chip.woocommerce { background: var(--woo); }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; box-shadow: var(--shadow); }
.stat .k { color: var(--muted); font-size: 13px; }
.stat .value { font-size: 26px; font-weight: 800; font-variant-numeric: tabular-nums; margin-top: 2px; }
.stat .sub { color: var(--muted); font-size: 12px; }
.stat.good .value { color: var(--ok); } .stat.bad .value { color: var(--bad); } .stat.warn .value { color: var(--warn); }
a.stat:hover { text-decoration: none; border-color: var(--accent); }
.empty { text-align: center; color: var(--muted); padding: 28px 12px; }
.empty b { display: block; color: var(--fg); font-size: 16px; margin-bottom: 4px; }
.total { font-size: 24px; font-weight: 800; }
.progress { height: 8px; background: var(--line); border-radius: 99px; overflow: hidden; }
.progress > div { height: 100%; background: var(--ok); transition: width .3s; }

/* messages (inline) and toasts */
.msg { padding: 10px 12px; border-radius: var(--radius-sm); margin: 10px 0; display: none; font-weight: 500; }
.msg.show { display: block; }
.msg.ok { background: var(--ok-soft); color: var(--ok); }
.msg.bad { background: var(--bad-soft); color: var(--bad); }
.msg.warn { background: var(--warn-soft); color: var(--warn); }
.toasts { position: fixed; z-index: 90; inset-inline: 0; bottom: 18px; display: flex; flex-direction: column; align-items: center; gap: 8px; pointer-events: none; }
@media (max-width: 860px) { .toasts { bottom: calc(var(--bottom) + 12px); } }
.toast { pointer-events: auto; max-width: min(560px, calc(100vw - 24px)); background: var(--fg); color: var(--bg); padding: 10px 16px; border-radius: 10px;
  box-shadow: var(--shadow-lg); font-weight: 600; animation: pop .18s ease-out; }
.toast.ok { background: var(--ok); color: #fff; } .toast.bad { background: var(--bad); color: #fff; } .toast.warn { background: var(--warn); color: #fff; }
@keyframes pop { from { transform: translateY(8px); opacity: 0; } }

/* modal */
.modal-back { position: fixed; inset: 0; z-index: 80; background: rgba(10, 14, 22, .45); display: flex; align-items: center; justify-content: center; padding: 16px; }
.modal { background: var(--surface); border-radius: 16px; box-shadow: var(--shadow-lg); width: min(520px, 100%); max-height: 90vh; overflow: auto; padding: 20px; animation: pop .15s ease-out; }
.modal h3 { margin: 0 0 8px; font-size: 18px; }
.modal .body { white-space: pre-line; color: var(--fg); }
.modal .acts { display: flex; gap: 8px; justify-content: flex-end; margin-top: 18px; flex-wrap: wrap; }
.modal .presets { display: flex; gap: 6px; flex-wrap: wrap; margin: 10px 0; }
.modal .presets button { min-height: 32px; padding: 4px 10px; font-weight: 500; }
@media (max-width: 600px) {
  .modal-back { align-items: flex-end; padding: 0; }
  .modal { border-radius: 16px 16px 0 0; width: 100%; padding-bottom: calc(20px + env(safe-area-inset-bottom)); }
  .modal .acts button { flex: 1; min-height: 48px; }
}

/* tabs and pick lists */
.tabs { display: flex; gap: 6px; margin-bottom: 12px; flex-wrap: wrap; }
.tabs button { background: var(--surface); color: var(--fg); border: 1px solid var(--line); font-weight: 500; }
.tabs button.on { background: var(--accent); color: var(--accent-fg); border-color: var(--accent); }
.list-pick button { display: block; width: 100%; text-align: start; margin: 4px 0; background: var(--surface); color: var(--fg); border: 1px solid var(--line); font-weight: 500; }
.list-pick button:hover { border-color: var(--accent); }

/* login */
body.plain main { max-width: 420px; }
.login { margin: 10vh auto 0; }
.login input { width: 100%; margin-bottom: 12px; }
.login button { width: 100%; }
.login .brand { font-size: 26px; font-weight: 800; text-align: center; margin-bottom: 4px; }

/* ---------------------------------------------------------------- codes and items (PHASE_13) */
.code { display: flex; gap: 12px; align-items: flex-start; padding: 10px 0; border-bottom: 1px solid var(--line); }
.code:last-child { border-bottom: 0; }
.code.off, .card.off { opacity: .55; }
.code .ct { margin: 2px 0; }
.code .acts { display: flex; flex-direction: column; gap: 6px; align-items: stretch; }
.code .acts button { white-space: nowrap; font-size: 13px; padding: 6px 12px; min-height: 34px; }
.thumb { width: 64px; height: 64px; object-fit: contain; border-radius: 10px; background: #fff; border: 1px solid var(--line); flex: none; }
.thumb.big { width: 120px; height: 120px; }
.thumb.sm { width: 44px; height: 44px; border-radius: 8px; }
.thumb.none { display: inline-flex; align-items: center; justify-content: center; color: var(--muted); }
.item-head { display: flex; gap: 16px; align-items: flex-start; flex-wrap: wrap; }
.stat-inline { display: inline-block; margin-inline-end: 16px; }
.stat-inline b { font-size: 18px; }
.step h2 { font-size: 16px; margin: 0 0 8px; }
.check { display: flex; gap: 12px; align-items: flex-start; padding: 12px 0; border-bottom: 1px solid var(--line); }
.check:last-child { border-bottom: 0; }
.check > a { white-space: nowrap; }
.check .ic { width: 30px; height: 30px; border-radius: 99px; flex: none; display: inline-flex; align-items: center; justify-content: center; font-weight: 800; }
.check.ok .ic { color: var(--ok); background: var(--ok-soft); } .check.todo .ic { color: var(--warn); background: var(--warn-soft); }
.check.block .ic { color: var(--bad); background: var(--bad-soft); } .check.info .ic { color: var(--accent); background: var(--accent-soft); }
.group { border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 10px; margin-bottom: 10px; }
.group .who { display: flex; align-items: center; gap: 10px; margin: 6px 0; font-weight: 600; }
@media (max-width: 600px) {
  .code { flex-wrap: wrap; }
  .code .acts { flex-direction: row; flex-wrap: wrap; width: 100%; }
  .code .acts button { flex: 1; }
}

/* ---------------------------------------------------------------- count (phone first) */
.count-hero { text-align: center; padding: 18px 14px; border-radius: var(--radius); border: 2px solid var(--line); background: var(--surface); transition: border-color .2s, background .2s; }
.count-hero.ok { border-color: var(--ok); background: var(--ok-soft); }
.count-hero.bad { border-color: var(--bad); background: var(--bad-soft); }
.count-hero .n { font-size: 56px; font-weight: 900; line-height: 1.1; font-variant-numeric: tabular-nums; }
.count-hero .t { font-weight: 700; font-size: 17px; }
.count-hero .thumb.big { margin: 0 auto 8px; display: block; }
.camera { position: relative; border-radius: var(--radius); overflow: hidden; background: #000; }
.camera video { width: 100%; display: block; max-height: 50vh; object-fit: cover; }
.camera .frame { position: absolute; inset: 30% 12%; border: 3px solid rgba(255, 255, 255, .85); border-radius: 12px; box-shadow: 0 0 0 9999px rgba(0, 0, 0, .25); }
.camera button { position: absolute; top: 10px; inset-inline-end: 10px; }

/* ---------------------------------------------------------------- till */
.cart-line { display: grid; grid-template-columns: 44px minmax(0, 1fr) auto auto auto; gap: 10px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--line); }
.cart-line:last-child { border-bottom: 0; }
.cart-line .title { font-weight: 600; }
.cart-line .price input { width: 8.5em; text-align: start; }
.cart-line .sum { font-weight: 700; min-width: 7em; text-align: end; }
@media (max-width: 700px) {
  .cart-line { grid-template-columns: 44px minmax(0, 1fr) auto; }
  .cart-line .price, .cart-line .sum { grid-column: 2 / -1; }
}
.pay-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.pay-grid label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--muted); }
.pay-grid input { width: 100%; font-size: 17px; }
.due { display: flex; justify-content: space-between; align-items: baseline; padding: 6px 0; }
.due.big { font-size: 26px; font-weight: 900; border-top: 1px dashed var(--line); margin-top: 6px; padding-top: 10px; }
.success { text-align: center; padding: 18px; }
.success .big { font-size: 22px; font-weight: 800; color: var(--ok); }

/* ---------------------------------------------------------------- money and profit (PHASE_11) */
button.stat { display: block; width: 100%; text-align: start; color: var(--fg); background: var(--surface); border-color: var(--line);
  font-weight: inherit; cursor: pointer; }
button.stat:hover { border-color: var(--accent); filter: none; }
button.stat:active { transform: none; }
.acts-grid { display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); }
.acts-grid button { flex-direction: column; gap: 2px; }
.acts-grid button small { font-weight: 400; font-size: 12px; opacity: .8; }
@media (max-width: 600px) { .acts-grid { grid-template-columns: 1fr 1fr; } .acts-grid button { font-size: 15px; } }
.form { display: flex; flex-direction: column; gap: 10px; white-space: normal; }
.form select, .form input { width: 100%; }
.form input.amount { font-size: 19px; font-weight: 700; font-variant-numeric: tabular-nums; }
.hint { font-size: 12px; color: var(--muted); }
.form > .hint { margin-top: -8px; color: var(--ok); font-weight: 600; }
.rec { display: flex; gap: 12px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--line); }
.rec:last-child { border-bottom: 0; }
.rec .amt { font-weight: 800; font-size: 16px; }
.rec button { min-height: 32px; padding: 4px 10px; }
.rec.void { color: var(--muted); }
.rec.void .amt { text-decoration: line-through; }
@media (max-width: 600px) { table.pl .opt { display: none; } }
.two { display: grid; gap: 18px; grid-template-columns: 1fr 1fr; }
.two h3 { font-size: 14px; color: var(--muted); }
@media (max-width: 600px) { .two { grid-template-columns: 1fr; } }
.due.big { font-size: 18px; }
/* log viewer */
.log-row { display: grid; grid-template-columns: 150px 58px 110px minmax(0, 1fr); gap: 10px; padding: 6px 0; border-bottom: 1px solid var(--line); font-size: 13px; cursor: pointer; }
.log-row:hover { background: var(--surface-2); }
.log-row .lv { font-weight: 700; }
.log-row .lv.ERROR { color: var(--bad); } .log-row .lv.WARN { color: var(--warn); } .log-row .lv.INFO { color: var(--muted); }
.log-row pre { grid-column: 1 / -1; margin: 4px 0 0; white-space: pre-wrap; word-break: break-all; direction: ltr; text-align: left;
  background: var(--surface-2); padding: 8px; border-radius: var(--radius-sm); font-size: 12px; }
@media (max-width: 700px) { .log-row { grid-template-columns: 1fr auto; } .log-row .cmp { display: none; } .log-row .msgc { grid-column: 1 / -1; } }
details.card summary { cursor: pointer; }
/* item list (/list) */
@media (min-width: 701px) { .selbar { position: sticky; top: 0; z-index: 5; } }
.litem { display: flex; gap: 12px; align-items: center; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--surface); margin-bottom: 8px; }
.litem.picked { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.litem .pick { display: flex; flex-direction: column; align-items: center; gap: 4px; min-width: 32px; cursor: pointer; }
.litem .pick input { width: 22px; height: 22px; }
.ord { display: inline-flex; align-items: center; justify-content: center; min-width: 22px; height: 22px; border-radius: 999px;
  background: var(--accent); color: var(--accent-fg); font-size: 12px; font-weight: 700; padding: 0 5px; }
.litem .info { min-width: 0; }
.litem .codes { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 4px; }
.codechip { font-size: 12px; border: 1px solid var(--line); border-radius: 6px; padding: 1px 6px; white-space: nowrap; }
.codechip.primary { border-color: var(--ok); }
.litem .lmeta { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; text-align: end; flex: 0 0 auto; }
.litem .labelcode { font: 600 13px/1 monospace; }
.litem .copies { width: 64px; }
@media (max-width: 700px) {
  .litem { flex-wrap: wrap; }
  .litem .lmeta { flex-direction: row; flex-wrap: wrap; width: 100%; justify-content: space-between; align-items: center; }
}
#settingsBox label:not(.check) { display: flex; flex-direction: column; gap: 4px; font-size: 13px; }
#settingsBox label.check { display: flex; align-items: center; gap: 8px; }
table.pl tr.click { cursor: pointer; }
table.pl tr.click:hover, table.pl tr.click:focus { background: var(--surface-2); outline: none; }
.rec details summary { cursor: pointer; font-size: 12px; }
table.pl td.minus { color: var(--bad); }
table.pl tr.sum td { font-weight: 800; border-top: 2px solid var(--line); background: var(--surface-2); }
table.pl tr.final td { font-size: 18px; }
table.pl td:not(:first-child), table.pl th:not(:first-child) { text-align: end; }

/* ---------------------------------------------------------------- labels and receipts (print) */
.bar { padding: 8px 16px; background: var(--surface); border-bottom: 1px solid var(--line); }
/* Print pages stay light whatever the screen theme: they are previews of paper. */
html:has(body.labels), html:has(body.receipt) { background: #fff; color-scheme: light; }
body.labels, body.receipt { min-height: 100vh; }
body.labels .bar, body.receipt .bar { background: #f4f5f8; color: #1b2130; border-color: #e1e5eb; }
body.labels { background: #fff; color: #000; }
.label { overflow: hidden; padding: 1mm 1.5mm; display: flex; flex-direction: column; align-items: center; justify-content: flex-start;
  page-break-after: always; break-after: page; border: 1px dashed #bbb; margin: 2mm; background: #fff; color: #000; }
.label .bc { width: 100%; height: 45%; }
.label .bc svg { width: 100%; height: 100%; display: block; }
.label .code { font: 600 9pt/1.1 monospace; direction: ltr; border: 0; padding: 0; display: block; }
.label .t { font-size: 7pt; line-height: 1.2; text-align: center; max-height: 2.4em; overflow: hidden;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.label .v { font-size: 7pt; font-weight: 700; }
/* A4 sticker sheet: the grid comes from the label settings. */
.sheet { width: 210mm; height: 297mm; box-sizing: border-box; display: grid; align-content: start; justify-content: start;
  page-break-after: always; break-after: page; background: #fff; outline: 1px solid #ddd; margin: 0 auto 4mm; direction: rtl; }
.sheet .label { page-break-after: auto; break-after: auto; margin: 0; }
body.receipt { background: #fff; color: #000; max-width: 80mm; margin: 0 auto; font-size: 12px; }
body.receipt h2 { text-align: center; font-size: 15px; }
body.receipt .total { font-size: 15px; margin-top: 6px; }
/* ---------------------------------------------------------------- brand: logo, login intro, credit */
/* The logo files are black on transparent; on dark surfaces they are turned white. */
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) img.logo { filter: invert(1); } }
:root[data-theme="dark"] img.logo { filter: invert(1); }
.login-logo { display: block; width: 132px; height: auto; margin: 4px auto 10px; }
.login-logo.small { width: 84px; }
button.small { padding: 4px 10px; font-size: 0.85em; min-height: 0; }
.phone-input { font-size: 20px; letter-spacing: .06em; text-align: center; font-variant-numeric: tabular-nums; }
.phone-input::placeholder { letter-spacing: .06em; }
.phone-text { letter-spacing: .04em; unicode-bidi: isolate; white-space: nowrap; }
.credit { text-align: center; font-size: 12px; color: var(--muted); margin: 18px 0 8px; }
.credit a { color: var(--muted); font-weight: 700; border-bottom: 1px dotted currentColor; }
.credit a:hover { color: var(--accent); text-decoration: none; }
.side .brand { display: flex; align-items: center; gap: 10px; }
.side .brand img { width: 38px; height: auto; flex: none; }
.side .brand b { display: block; font-size: 20px; line-height: 1.2; }
footer.credit { padding: 6px 18px 14px; margin: 0; }

body.intro-on { overflow: hidden; }
.intro { position: fixed; inset: 0; z-index: 100; display: flex; flex-direction: column; align-items: center; justify-content: center;
  background: radial-gradient(circle at 50% 42%, var(--surface) 0%, var(--bg) 70%); cursor: pointer; transition: opacity .6s ease, visibility .6s; }
.intro.out { opacity: 0; visibility: hidden; }
.intro-stage { display: flex; flex-direction: column; align-items: center; gap: 22px; }
.intro-mark { width: min(42vw, 240px); aspect-ratio: 256 / 228; opacity: 0; }
.intro-mark img { width: 100%; height: auto; display: block; }
.intro-word { width: min(46vw, 260px); height: auto; opacity: 0; }
.intro-skip { position: absolute; bottom: max(24px, env(safe-area-inset-bottom)); font-size: 13px; color: var(--muted); opacity: 0; }
.intro.run .intro-mark { animation: intro-aperture 1.25s cubic-bezier(.2, .8, .2, 1) .15s forwards; }
.intro.run .intro-word { animation: intro-rise .7s cubic-bezier(.2, .8, .2, 1) 1.05s forwards; }
.intro.run .intro-skip { animation: intro-fade .5s ease 1.6s forwards; }
@keyframes intro-aperture {
  0% { opacity: 0; transform: scale(.78) rotate(-35deg); filter: blur(10px); clip-path: circle(0% at 62% 50%); }
  35% { opacity: 1; }
  100% { opacity: 1; transform: none; filter: none; clip-path: circle(80% at 62% 50%); }
}
@keyframes intro-rise { from { opacity: 0; transform: translateY(18px); letter-spacing: .2em; } to { opacity: 1; transform: none; } }
@keyframes intro-fade { to { opacity: 1; } }
@media (prefers-reduced-motion: reduce) {
  .intro.run .intro-mark, .intro.run .intro-word, .intro.run .intro-skip { animation: intro-fade .3s ease forwards; }
}

/* ---------------------------------------------------------------- helium (PHASE_20) */
.helium { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; font-size: 14px; grid-column: 2 / -1; }
.helium input { width: 7em; padding: 5px 8px; }
.helium button { padding: 4px 12px; font-size: 13px; }
.helium.ask { background: var(--warn-soft); color: var(--warn); border-radius: var(--radius-sm); padding: 6px 10px; }
.helium.on { background: var(--accent-soft); border-radius: var(--radius-sm); padding: 6px 10px; }
.helium .stepper button { padding: 2px 8px; }
.helium .stepper input { width: 3.2em; padding: 4px 2px; text-align: center; }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 10px; }
.tankbox { margin-top: 12px; padding-top: 10px; border-top: 1px dashed var(--line); font-size: 14px; }
.tank { border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; margin-bottom: 10px; }
.tank.use { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent) inset; }
.tank.off { opacity: .65; }
.tank .figs { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 8px; margin-top: 8px; }
.tank .figs div { background: var(--surface-2); border-radius: var(--radius-sm); padding: 6px 10px; }
.tank .figs b { display: block; font-size: 17px; }
.tank .figs b.ok { color: var(--ok); } .tank .figs b.bad { color: var(--bad); }

@media print {
  .noprint, .side, header.top, nav.bottom, .toasts { display: none !important; }
  .label { border: 0; margin: 0; }
  .sheet { outline: 0; margin: 0; }
  body.receipt { max-width: none; }
  main { padding: 0; }
}
