/* Inventar — one stylesheet, no build step. Phone-first. */

:root {
  --bg: #f4f7f7;
  --surface: #ffffff;
  --surface-2: #eef3f3;
  --text: #132022;
  --muted: #566769;
  --border: #d6e0e0;
  --border-strong: #b5c4c5;
  --accent: #0f6e6e;
  --accent-hover: #0b5959;
  --accent-ink: #ffffff;
  --accent-soft: #e1f0ef;
  --btn-bg: #0f6e6e;
  --ok: #17703f;
  --ok-soft: #e3f3e8;
  --warn: #8a5300;
  --warn-soft: #fcf0d9;
  --danger: #b42318;
  --danger-soft: #fdeae7;
  --info: #1d5aa0;
  --info-soft: #e5eef9;
  --focus: #1b7fd6;
  --shadow: 0 1px 2px rgb(16 40 40 / 6%), 0 4px 16px rgb(16 40 40 / 6%);
  --radius: 14px;
  --radius-sm: 10px;
  --tap: 48px;
  --font:
    system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, 'Noto Sans', sans-serif;
  --mono: ui-monospace, 'SF Mono', Menlo, Consolas, monospace;
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0c1516;
    --surface: #132123;
    --surface-2: #1a2c2e;
    --text: #e4eeee;
    --muted: #9db0b1;
    --border: #283c3e;
    --border-strong: #3a5254;
    --accent: #5cc6be;
    --accent-hover: #7ad6cf;
    --accent-ink: #ffffff;
    --accent-soft: #163a3a;
    --btn-bg: #137470;
    --ok: #6fd39a;
    --ok-soft: #143222;
    --warn: #f0b85a;
    --warn-soft: #3a2c12;
    --danger: #ff8a7d;
    --danger-soft: #3d1a17;
    --info: #8cbcf5;
    --info-soft: #172a42;
    --focus: #79b8ff;
    --shadow: 0 1px 2px rgb(0 0 0 / 30%), 0 4px 16px rgb(0 0 0 / 25%);
  }
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 1rem;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}

h1,
h2,
h3 {
  line-height: 1.2;
  margin: 0;
}
h1 {
  font-size: 1.6rem;
  letter-spacing: -0.01em;
}
.h3,
h2 {
  font-size: 1.1rem;
}
p {
  margin: 0;
}
a {
  color: var(--accent);
}
img {
  max-width: 100%;
}
button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}

:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}
h1:focus,
main:focus {
  outline: none;
}

[hidden] {
  display: none !important;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: absolute;
  left: 8px;
  top: -60px;
  z-index: 100;
  background: var(--surface);
  padding: 10px 14px;
  border-radius: var(--radius-sm);
}
.skip-link:focus {
  top: 8px;
}

.muted {
  color: var(--muted);
}
.small {
  font-size: 0.85rem;
}
.mono {
  font-family: var(--mono);
  font-size: 0.82em;
}
.center-text {
  text-align: center;
}
.lead {
  font-size: 1.1rem;
}

/* ── layout ─────────────────────────────────────────────────────────────── */

.page {
  max-width: 760px;
  margin: 0 auto;
  padding: 20px 16px 48px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.page.wide {
  max-width: 1180px;
}
.page.narrow {
  max-width: 560px;
}
.page-head {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding-top: 4px;
}
.row-between {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.page-head.row-between {
  flex-direction: row;
}
.stack {
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.stack-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}
.stack-row.center {
  justify-content: center;
}
.grid-2,
.grid-3 {
  display: grid;
  gap: 12px;
  grid-template-columns: 1fr;
}
@media (min-width: 420px) {
  .grid-2 {
    grid-template-columns: 1fr 1fr;
  }
  .grid-3 {
    grid-template-columns: 1fr 1fr 1fr;
  }
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.card.flush {
  padding: 0;
  overflow: hidden;
}

/* ── header ─────────────────────────────────────────────────────────────── */

.site-header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}
.header-inner {
  max-width: 1180px;
  margin: 0 auto;
  padding: 6px 12px;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  color: var(--text);
  font-weight: 650;
  min-height: var(--tap);
  padding-right: 6px;
}
.brand-week {
  font-weight: 500;
  font-size: 0.85rem;
  color: var(--muted);
  background: var(--surface-2);
  border-radius: 999px;
  padding: 2px 8px;
}
.nav {
  display: flex;
  gap: 2px;
  overflow-x: auto;
  scrollbar-width: none;
  order: 3;
  width: 100%;
}
.nav-link {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0 12px;
  border-radius: 999px;
  text-decoration: none;
  color: var(--muted);
  font-weight: 550;
  white-space: nowrap;
}
.nav-link:hover {
  color: var(--text);
  background: var(--surface-2);
}
.nav-link[aria-current='page'] {
  color: var(--accent);
  background: var(--accent-soft);
}
.header-user {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 4px;
}
.user-name {
  color: var(--muted);
  font-size: 0.9rem;
  max-width: 10em;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
@media (min-width: 760px) {
  .nav {
    order: 0;
    width: auto;
    margin-left: 12px;
  }
}
/* On the count screen the header is just a thin brand strip. */
body.is-count .nav {
  display: none;
}

/* ── buttons ────────────────────────────────────────────────────────────── */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: var(--tap);
  padding: 0 18px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--text);
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  text-align: center;
  line-height: 1.2;
  transition:
    background 0.12s,
    border-color 0.12s;
}
.btn:hover {
  background: var(--surface-2);
}
.btn:disabled {
  opacity: 0.55;
  cursor: progress;
}
.btn-primary {
  background: var(--btn-bg);
  border-color: var(--btn-bg);
  color: var(--accent-ink);
}
.btn-primary:hover {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
}
@media (prefers-color-scheme: dark) {
  .btn-primary:hover {
    background: #0f625f;
    border-color: #0f625f;
  }
}
.btn-danger {
  background: var(--danger);
  border-color: var(--danger);
  color: #fff;
}
@media (prefers-color-scheme: dark) {
  .btn-danger {
    color: #1b0705;
  }
}
.btn-ghost {
  background: transparent;
  border-color: transparent;
  color: var(--accent);
}
.btn-ghost:hover {
  background: var(--accent-soft);
}
.btn-sm {
  min-height: 40px;
  padding: 0 12px;
  font-size: 0.9rem;
  gap: 6px;
}
.btn-lg {
  min-height: 56px;
  font-size: 1.05rem;
}
.btn-block {
  width: 100%;
}
.btn-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: var(--tap);
  height: var(--tap);
  border-radius: 50%;
  border: 0;
  background: transparent;
  color: var(--text);
  cursor: pointer;
  flex: none;
}
.btn-icon:hover {
  background: var(--surface-2);
}
.link-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: none;
  border: 0;
  color: var(--accent);
  font-weight: 600;
  cursor: pointer;
  min-height: 44px;
  padding: 0 4px;
  text-decoration: underline;
  text-underline-offset: 3px;
}
.icon {
  flex: none;
}

/* ── forms ──────────────────────────────────────────────────────────────── */

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}
.field label {
  font-weight: 600;
  font-size: 0.92rem;
}
.field-hint {
  font-size: 0.85rem;
  color: var(--muted);
}
input[type='text'],
input[type='email'],
input[type='password'],
input[type='number'],
input[type='search'],
select {
  width: 100%;
  min-height: var(--tap);
  padding: 10px 12px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  font-size: 1rem;
}
input:focus-visible,
select:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 0;
  border-color: var(--focus);
}
input.invalid {
  border-color: var(--danger);
  background: var(--danger-soft);
}
.in-num {
  font-variant-numeric: tabular-nums;
}
.check {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  cursor: pointer;
  font-weight: 500;
}
.check input {
  width: 22px;
  height: 22px;
  accent-color: var(--accent);
}
.form-msg:empty {
  display: none;
}

/* ── banners, pills, chips ──────────────────────────────────────────────── */

.banner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 10px;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  font-size: 0.95rem;
}
.banner .link-btn {
  min-height: 32px;
}
.banner-error {
  background: var(--danger-soft);
  color: var(--danger);
  border-color: color-mix(in srgb, var(--danger) 30%, transparent);
}
.banner-ok {
  background: var(--ok-soft);
  color: var(--ok);
  border-color: color-mix(in srgb, var(--ok) 30%, transparent);
}
.banner-info {
  background: var(--info-soft);
  color: var(--info);
  border-color: color-mix(in srgb, var(--info) 25%, transparent);
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 0.85rem;
  font-weight: 600;
  white-space: nowrap;
}
.pill-ok {
  background: var(--ok-soft);
  color: var(--ok);
}
.pill-open {
  background: var(--surface-2);
  color: var(--muted);
  border: 1px dashed var(--border-strong);
}
.pill-warn {
  background: var(--warn-soft);
  color: var(--warn);
  white-space: normal;
}

.chips {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 4px;
}
.chip {
  display: inline-block;
  padding: 1px 7px;
  border-radius: 6px;
  font-size: 0.8rem;
  font-weight: 600;
  background: var(--surface-2);
  color: var(--text);
  border: 1px solid var(--border);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.chip-d,
.chip-l,
.chip-gh {
  background: var(--accent-soft);
  border-color: transparent;
  color: var(--accent);
}
.chip-ref {
  font-family: var(--mono);
  font-weight: 500;
}
.chip-spec {
  font-weight: 500;
  color: var(--muted);
}
.badge-review,
.badge-new {
  display: inline-block;
  margin-left: 6px;
  padding: 0 6px;
  border-radius: 6px;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  vertical-align: 2px;
}
.badge-review {
  background: var(--warn-soft);
  color: var(--warn);
}
.badge-new {
  background: var(--info-soft);
  color: var(--info);
}
.brand-name {
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 500;
}

.progress {
  height: 10px;
  border-radius: 999px;
  background: var(--surface-2);
  overflow: hidden;
  border: 1px solid var(--border);
}
.progress-fill {
  display: block;
  height: 100%;
  width: 0;
  background: var(--accent);
  border-radius: 999px;
  transition: width 0.25s ease;
}

.loading {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 48px 16px;
  color: var(--muted);
}
.spinner {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  animation: spin 0.8s linear infinite;
}
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}
.empty {
  padding: 24px 16px;
  text-align: center;
  color: var(--muted);
}

/* ── toasts & dialogs ───────────────────────────────────────────────────── */

.toasts {
  position: fixed;
  left: 50%;
  bottom: calc(96px + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  z-index: 60;
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: min(92vw, 420px);
  pointer-events: none;
}
.toast {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 10px 10px 16px;
  border-radius: 12px;
  background: #142224;
  color: #eef5f5;
  box-shadow: 0 8px 24px rgb(0 0 0 / 25%);
  pointer-events: auto;
  min-height: 48px;
}
@media (prefers-color-scheme: dark) {
  .toast {
    background: #e4eeee;
    color: #132022;
  }
}
.toast-action {
  background: none;
  border: 0;
  color: inherit;
  font-weight: 700;
  text-decoration: underline;
  min-height: 40px;
  padding: 0 8px;
  cursor: pointer;
}

.dialog {
  border: 0;
  padding: 0;
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  width: min(560px, calc(100vw - 24px));
  max-height: calc(100vh - 48px);
  box-shadow: 0 20px 60px rgb(0 0 0 / 30%);
}
.dialog::backdrop {
  background: rgb(8 20 20 / 45%);
}
.dialog-head {
  position: sticky;
  top: 0;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 8px 8px 18px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}
.dialog-head h2 {
  font-size: 1.1rem;
}
.dialog-body {
  padding: 16px 18px 18px;
}
.dialog-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
  padding-top: 4px;
}
.confirm-body {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 16px;
}
.confirm-list {
  margin: 0;
  padding-left: 20px;
  font-size: 0.92rem;
}
/* On phones, sheets and drawers slide up from the bottom. */
@media (max-width: 640px) {
  .dialog.sheet,
  .dialog.drawer,
  .dialog.dialog-confirm {
    width: 100vw;
    max-width: 100vw;
    margin: auto 0 0;
    border-radius: 18px 18px 0 0;
    max-height: 92vh;
    padding-bottom: env(safe-area-inset-bottom);
  }
  .dialog-actions .btn {
    flex: 1 1 auto;
  }
}
@media (min-width: 900px) {
  .dialog.drawer {
    margin: 0 0 0 auto;
    height: 100vh;
    max-height: 100vh;
    width: 480px;
    border-radius: 0;
  }
}
details.more > summary,
details.card > summary {
  cursor: pointer;
  font-weight: 600;
  min-height: 44px;
  display: flex;
  align-items: center;
}
details.more > .stack {
  padding-top: 8px;
}

/* ── login ──────────────────────────────────────────────────────────────── */

.login-page {
  max-width: 400px;
  margin: 0 auto;
  padding: 28px 16px 40px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}
.login-brand {
  display: flex;
  align-items: center;
  gap: 14px;
}
.login-brand img {
  border-radius: 14px;
}
.login-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 20px 16px;
  box-shadow: var(--shadow);
}
.pin-wrap {
  position: relative;
}
.pin-input {
  text-align: center;
  letter-spacing: 0.5em;
  color: transparent;
  caret-color: transparent;
  font-size: 1.4rem !important;
  min-height: 56px !important;
}
.pin-input:focus-visible {
  outline: 3px solid var(--focus);
}
.pin-dots {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  pointer-events: none;
}
.dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 2px solid var(--border-strong);
}
.dot.on {
  background: var(--accent);
  border-color: var(--accent);
}
.keypad {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}
.key {
  min-height: 60px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  font-size: 1.5rem;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-variant-numeric: tabular-nums;
  touch-action: manipulation;
}
.key:active {
  background: var(--accent-soft);
  transform: scale(0.97);
}
.key-muted {
  background: transparent;
  color: var(--muted);
  font-size: 1.1rem;
}

/* ── cabinet list ───────────────────────────────────────────────────────── */

.week-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.week-count {
  font-size: 1.1rem;
}
.cab-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.cab-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px;
  min-height: 72px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  text-decoration: none;
  box-shadow: var(--shadow);
  flex-wrap: wrap;
}
.cab-card:hover {
  border-color: var(--accent);
}
.cab-badge {
  flex: none;
  width: 44px;
  height: 44px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  font-weight: 700;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 0.95rem;
  text-align: center;
  line-height: 1;
}
.cab-card.is-done .cab-badge {
  background: var(--ok-soft);
  color: var(--ok);
}
.cab-main {
  flex: 1 1 160px;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.cab-name {
  font-weight: 650;
}
.cab-meta {
  font-size: 0.86rem;
  color: var(--muted);
}
@media (max-width: 420px) {
  .cab-card .pill {
    margin-left: 56px;
  }
}

/* ── count screen ───────────────────────────────────────────────────────── */

body.is-count .site-header .header-inner {
  padding-top: 2px;
  padding-bottom: 2px;
}
.count-page {
  --count-bar-h: 112px;
  max-width: 760px;
  margin: 0 auto;
  padding-bottom: calc(110px + env(safe-area-inset-bottom));
}
.count-bar {
  position: sticky;
  top: 0;
  z-index: 20;
  background: var(--bg);
  padding: 4px 12px 10px;
  border-bottom: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.count-bar-top {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-left: -8px;
}
.count-title {
  font-size: 1.08rem;
  line-height: 1.2;
}
.count-bar-progress {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-height: 36px;
}
.count-progress-text {
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.jump-btn {
  min-height: 40px;
}
.count-notes {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px 12px 0;
}
.count-notes:empty {
  display: none;
}
.groups {
  display: flex;
  flex-direction: column;
}
.group-head {
  position: sticky;
  top: var(--count-bar-h);
  z-index: 10;
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 2px 10px;
  padding: 10px 16px 8px;
  margin-top: 8px;
  background: var(--bg);
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--accent);
  border-bottom: 1px solid var(--border);
}
.group-cat {
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--muted);
}
.rows {
  list-style: none;
  margin: 0;
  padding: 8px 12px 4px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.row {
  position: relative;
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  padding: 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 5px solid var(--border-strong);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  scroll-margin-top: calc(var(--count-bar-h) + 48px);
  scroll-margin-bottom: 110px;
}
.row.is-done {
  border-left-color: var(--accent);
}
.row-check {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--accent);
  color: var(--accent-ink);
  opacity: 0;
  transform: scale(0.6);
  transition:
    opacity 0.15s,
    transform 0.15s;
}
@media (prefers-color-scheme: dark) {
  .row-check {
    color: #0c1516;
  }
}
.row.is-done .row-check {
  opacity: 1;
  transform: none;
}
.row.flash {
  animation: flash 0.6s ease;
}
@keyframes flash {
  from {
    background: var(--accent-soft);
  }
}
.row-info {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
  padding-right: 28px;
}
.row-name {
  font-weight: 650;
  font-size: 1.02rem;
  overflow-wrap: anywhere;
}
.row-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 8px;
}
.row-last {
  font-size: 0.9rem;
  margin-top: 2px;
}
.row-count {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: stretch;
  gap: 8px;
}
.stepper {
  display: flex;
  align-items: stretch;
  border: 1px solid var(--border-strong);
  border-radius: 14px;
  overflow: hidden;
  background: var(--surface);
  flex: none;
}
.step {
  width: 54px;
  min-height: 60px;
  border: 0;
  background: var(--surface-2);
  color: var(--accent);
  cursor: pointer;
  display: grid;
  place-items: center;
  touch-action: manipulation;
}
.step:active {
  background: var(--accent-soft);
}
.step:focus-visible {
  outline-offset: -3px;
}
.qty-cell {
  position: relative;
  display: flex;
  flex-direction: column;
  border-left: 1px solid var(--border);
  border-right: 1px solid var(--border);
}
.stepper .qty-input {
  width: 68px;
  flex: 1;
  border: 0;
  border-radius: 0;
  text-align: center;
  font-size: 1.5rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  min-height: 0;
  padding: 6px 4px 14px;
  background: transparent;
}
.qty-input::placeholder {
  color: var(--border-strong);
}
.stepper .qty-input:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: -3px;
}
.row.is-done .qty-cell {
  background: var(--accent-soft);
}
.row.is-done .qty-input {
  color: var(--accent);
}
.qty-unit {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 4px;
  text-align: center;
  color: var(--muted);
  font-size: 0.7rem;
  line-height: 1;
  pointer-events: none;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.same-btn {
  min-height: 60px;
  padding: 4px 10px;
  border-color: var(--accent);
  color: var(--accent);
  background: transparent;
  white-space: normal;
  font-size: 0.92rem;
}
.same-btn:hover {
  background: var(--accent-soft);
}
@media (max-width: 359px) {
  .step {
    width: 44px;
  }
  .stepper .qty-input {
    width: 64px;
  }
  .qty-unit {
    font-size: 0.64rem;
  }
  .same-btn {
    font-size: 0.82rem;
    padding: 4px 6px;
  }
}
.row-warn {
  font-size: 0.88rem;
  color: var(--warn);
  font-weight: 600;
}
.row-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.review {
  margin: 0;
  border: 1px solid color-mix(in srgb, var(--warn) 35%, transparent);
  background: var(--warn-soft);
  border-radius: var(--radius-sm);
  padding: 8px 12px 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
}
.review legend {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-weight: 700;
  color: var(--warn);
  padding: 0 4px;
  font-size: 0.9rem;
}
.review-hint {
  font-size: 0.88rem;
}
.review-fields {
  display: grid;
  grid-template-columns: 1.6fr 1fr 1fr;
  gap: 8px;
}
.review-fields .field label {
  font-size: 0.82rem;
}
.review-fields input {
  padding: 8px;
}
@media (max-width: 360px) {
  .review-fields {
    grid-template-columns: 1fr 1fr;
  }
  .review-fields .field:first-child {
    grid-column: 1 / -1;
  }
}
@media (min-width: 640px) {
  .row {
    grid-template-columns: 1fr auto;
    align-items: center;
  }
  .row-check {
    top: 12px;
  }
  .row-count {
    padding-right: 30px;
    grid-template-columns: auto 160px;
  }
  .row-warn,
  .review {
    grid-column: 1 / -1;
  }
}
.add-wrap {
  padding: 16px 12px 8px;
}
.add-missing {
  width: 100%;
  min-height: 64px;
  border: 2px dashed var(--border-strong);
  border-radius: var(--radius);
  background: transparent;
  color: var(--muted);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 4px 12px;
  cursor: pointer;
  padding: 10px;
}
.add-missing:hover {
  border-color: var(--accent);
}
.add-missing-cta {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: var(--accent);
  font-weight: 700;
}
.error-slot {
  padding: 0 12px;
}
.error-slot:empty {
  display: none;
}
.count-footer {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 10px 12px calc(10px + env(safe-area-inset-bottom));
  background: color-mix(in srgb, var(--surface) 94%, transparent);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-top: 1px solid var(--border);
}
.count-footer .btn {
  flex: 1 1 auto;
  max-width: 420px;
}
.footer-status {
  font-size: 0.88rem;
  color: var(--muted);
  font-weight: 600;
  white-space: nowrap;
}
.count-footer.all-done .footer-status {
  color: var(--ok);
}

.success {
  text-align: center;
  align-items: center;
  padding-top: 40px;
}
.success .stack {
  width: 100%;
  margin-top: 8px;
}
.success-mark {
  width: 84px;
  height: 84px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--ok-soft);
  color: var(--ok);
}
.success .btn-lg {
  min-height: 60px;
  padding: 8px 18px;
}

/* ── dashboard ──────────────────────────────────────────────────────────── */

.kpis {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}
@media (min-width: 900px) {
  .kpis {
    grid-template-columns: repeat(4, 1fr);
  }
}
.kpi {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  border-top: 4px solid var(--border-strong);
}
.kpi-label {
  font-size: 0.85rem;
  color: var(--muted);
  font-weight: 600;
}
.kpi-value {
  font-size: 1.8rem;
  font-weight: 750;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
}
.kpi-sub {
  font-size: 0.82rem;
  color: var(--muted);
  overflow-wrap: anywhere;
}
.kpi.tone-ok {
  border-top-color: var(--ok);
}
.kpi.tone-warn {
  border-top-color: var(--warn);
}
.kpi.tone-info {
  border-top-color: var(--info);
}
.mini-cabs {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 6px 16px;
}
.mini-cabs li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  padding: 6px 0;
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}
.mini-cab-name {
  font-weight: 600;
  font-size: 0.92rem;
}
.dash-grid {
  display: grid;
  gap: 16px;
  grid-template-columns: 1fr;
}
@media (min-width: 900px) {
  .dash-grid {
    grid-template-columns: 1fr 1fr;
  }
}
.item-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
}
.item-list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}
.item-list li:last-child {
  border-bottom: 0;
}
.item-cell {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}
.item-name {
  font-weight: 600;
  overflow-wrap: anywhere;
}
.item-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 8px;
  align-items: center;
}
.item-cab {
  font-size: 0.82rem;
  color: var(--muted);
}
.review-note {
  font-size: 0.82rem;
  color: var(--warn);
  text-align: right;
  max-width: 40%;
}
.qty-badge {
  display: inline-flex;
  flex-direction: column;
  align-items: flex-end;
  font-weight: 700;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.qty-badge small {
  font-weight: 500;
  color: var(--muted);
}
.qty-badge.is-low {
  color: var(--warn);
}
.qty-badge.is-zero {
  color: var(--danger);
}
.qty-plain {
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.small-link {
  font-size: 0.9rem;
  font-weight: 600;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
}

/* ── tables ─────────────────────────────────────────────────────────────── */

.table-wrap {
  overflow-x: auto;
}
.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.94rem;
}
.table th,
.table td {
  text-align: left;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.table thead th {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  background: var(--surface-2);
  font-weight: 700;
  position: sticky;
  top: 0;
}
.table .num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}
.table.compact th,
.table.compact td {
  padding: 8px;
}
.td-action {
  text-align: right;
  white-space: nowrap;
}
.td-action .stack-row {
  justify-content: flex-end;
  flex-wrap: nowrap;
}
.art-table tr.is-inactive td {
  opacity: 0.6;
}
.art-table tr.is-editing td {
  background: var(--accent-soft);
}
.edit-row td {
  background: var(--surface-2);
}
.edit-title {
  font-weight: 700;
  margin-bottom: 10px;
}
.edit-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 10px;
}
.edit-grid .field:first-child {
  grid-column: span 2;
}
.edit-foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 12px;
}
.delta {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
}
.delta.neg {
  color: var(--warn);
}
.delta.pos {
  color: var(--ok);
}
.td-spark {
  width: 100px;
}
.spark {
  display: block;
}
.spark-line {
  fill: none;
  stroke: var(--accent);
  stroke-width: 2;
  stroke-linejoin: round;
  stroke-linecap: round;
}
.spark-dot {
  fill: var(--accent);
}

.toolbar {
  flex-direction: row;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}
.search-wrap {
  position: relative;
  flex: 1 1 260px;
  display: flex;
  align-items: center;
}
.search-wrap .icon {
  position: absolute;
  left: 12px;
  color: var(--muted);
}
.search-input {
  padding-left: 38px !important;
}
.toolbar select {
  flex: 1 1 180px;
  width: auto;
}
.toolbar .checks {
  flex: 1 1 100%;
  gap: 4px 16px;
}
.result-count {
  font-size: 0.9rem;
}

/* Tables become stacked cards on narrow screens. */
@media (max-width: 760px) {
  .table-stack thead {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
  }
  .table-stack,
  .table-stack tbody,
  .table-stack tr,
  .table-stack td {
    display: block;
    width: 100%;
  }
  .table-stack tr {
    padding: 10px 14px;
    border-bottom: 1px solid var(--border);
  }
  .table-stack td {
    border: 0;
    padding: 3px 0;
    text-align: left;
    display: flex;
    justify-content: space-between;
    gap: 12px;
  }
  .table-stack td.num {
    text-align: left;
  }
  .table-stack td[data-label]::before {
    content: attr(data-label);
    font-size: 0.82rem;
    color: var(--muted);
    font-weight: 600;
    flex: none;
  }
  .table-stack td.td-item {
    display: block;
    padding-bottom: 6px;
  }
  .table-stack td.td-item::before {
    content: none;
  }
  .table-stack .td-action {
    padding-top: 8px;
  }
  .table-stack .td-action .stack-row {
    justify-content: flex-start;
  }
  .table-stack td.td-spark {
    width: 100%;
  }
  .table-stack .delta {
    display: inline;
    margin-left: 6px;
  }
  .table-stack .qty-badge {
    flex-direction: row;
    gap: 6px;
  }
  .edit-grid .field:first-child {
    grid-column: 1 / -1;
  }
}

/* History chart */
.trend-fig {
  margin: 0;
}
.trend {
  width: 100%;
  height: auto;
  display: block;
}
.trend .grid {
  stroke: var(--border);
  stroke-width: 1;
}
.trend .axis {
  fill: var(--muted);
  font-size: 11px;
  font-family: var(--font);
}
.trend .line {
  fill: none;
  stroke: var(--accent);
  stroke-width: 2;
  stroke-linejoin: round;
  stroke-linecap: round;
}
.trend .dot {
  fill: var(--accent);
  stroke: var(--surface);
  stroke-width: 2;
}
.trend .hit {
  fill: transparent;
}
.trend .pt:hover .dot {
  r: 6;
}
.trend .min-line {
  stroke: var(--warn);
  stroke-width: 1.5;
  stroke-dasharray: 4 4;
}
.trend .min-label {
  fill: var(--warn);
}

/* ── QR sheet ───────────────────────────────────────────────────────────── */

.qr-controls {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 8px 16px;
}
.qr-controls li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}
.qr-controls input {
  width: 80px;
  flex: none;
}
.qr-sheet {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 12px;
}
.sticker {
  background: #fff;
  color: #111;
  border: 1px dashed #9aa;
  border-radius: 8px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  text-align: center;
  break-inside: avoid;
  page-break-inside: avoid;
}
.sticker-qr {
  width: 200px;
  height: 200px;
  max-width: 100%;
  image-rendering: pixelated;
}
.sticker-name {
  font-weight: 750;
  font-size: 1.1rem;
  line-height: 1.2;
}
.sticker-cta {
  margin-top: 4px;
  font-weight: 700;
  color: #0f6e6e;
}
.sticker-url {
  margin-top: 2px;
  font-size: 0.75rem;
  color: #555;
  font-family: var(--mono);
  overflow-wrap: anywhere;
}

@page {
  size: A4;
  margin: 12mm;
}

@media print {
  :root {
    color-scheme: light;
  }
  body {
    background: #fff;
    color: #000;
  }
  .site-header,
  .no-print,
  .skip-link,
  .toasts {
    display: none !important;
  }
  .page,
  .page.wide {
    max-width: none;
    padding: 0;
    margin: 0;
  }
  .qr-sheet {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6mm;
  }
  .sticker {
    border: 0.3mm dashed #888;
    border-radius: 3mm;
    padding: 6mm 4mm;
    height: 84mm;
    justify-content: center;
    gap: 3mm;
  }
  .sticker-qr {
    width: 52mm;
    height: 52mm;
  }
  .sticker-name {
    font-size: 13pt;
  }
  .sticker-cta {
    font-size: 11pt;
  }
  .sticker-url {
    font-size: 7pt;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
    scroll-behavior: auto !important;
  }
}

/* ── additions: unassigned items, new cabinet ───────────────────────────── */

.assign-row select {
  width: 240px;
  flex: none;
}
@media (max-width: 640px) {
  .item-list li.assign-row {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
  }
  .assign-row select {
    width: 100%;
  }
}
.qr-tools {
  display: grid;
  gap: 12px;
}
.mono-input {
  font-family: var(--mono) !important;
}
@media (min-width: 900px) {
  .new-cab-grid {
    grid-template-columns: 2fr 1fr 1.4fr;
  }
}
.capped {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.more-btn {
  align-self: flex-start;
}
