:root {
  --bg: #f3f6f5; --surface: #ffffff; --surface-2: #f8faf9; --text: #15201d; --muted: #5d6b67; --line: #dfe6e3;
  --brand: #0f5c4d; --brand-2: #157a66; --brand-soft: #e3f1ed; --ok: #1d8a4e; --ok-soft: #e2f5ea;
  --warn: #b26a00; --warn-soft: #fff1d9; --bad: #c0392b; --bad-soft: #fde8e5; --info: #2a5db0; --info-soft: #e5edfb;
  --radius: 14px; --shadow: 0 1px 2px rgba(16, 32, 28, .06), 0 4px 16px rgba(16, 32, 28, .05);
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1513; --surface: #17201d; --surface-2: #1c2622; --text: #e7efec; --muted: #9db0aa; --line: #2b3834;
    --brand: #3fb497; --brand-2: #54c9ab; --brand-soft: #193a32; --ok: #4cc77f; --ok-soft: #173525;
    --warn: #f0a840; --warn-soft: #3a2c13; --bad: #ff7a6b; --bad-soft: #3d1f1b; --info: #7ea6ef; --info-soft: #1b2a45;
    --shadow: none;
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--text); font: 16px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; -webkit-text-size-adjust: 100%; }
h1 { font-size: 1.6rem; margin: 0 0 .4rem; letter-spacing: -.01em; }
h2 { font-size: 1.1rem; margin: 0; }
a { color: var(--brand); }
small { display: block; color: var(--muted); font-size: .82rem; }
code { background: var(--surface-2); padding: 1px 5px; border-radius: 4px; }
.muted { color: var(--muted); } .small { font-size: .88rem; }
.boot { padding: 40px; text-align: center; color: var(--muted); }
.error { color: var(--bad); min-height: 1.2em; margin: .5rem 0 0; font-weight: 500; }
.notice { background: var(--info-soft); color: var(--text); border-radius: 10px; padding: 12px 14px; margin: 0 0 16px; }
.notice.big { font-size: 1.1rem; }
.empty { color: var(--muted); padding: 18px; text-align: center; }

/* Buttons & forms */
button, .btn { font: inherit; border-radius: 10px; border: 1px solid transparent; padding: 10px 16px; cursor: pointer; text-decoration: none; display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 44px; touch-action: manipulation; }
button:disabled { opacity: .5; cursor: not-allowed; }
.primary { background: var(--brand); color: #fff; font-weight: 600; }
.primary:hover:not(:disabled) { background: var(--brand-2); }
.secondary { background: var(--surface); color: var(--text); border-color: var(--line); }
.secondary:hover:not(:disabled) { background: var(--surface-2); }
.danger { background: var(--bad); color: #fff; font-weight: 600; }
.text-button { background: none; color: var(--brand); padding: 6px 8px; min-height: 36px; font-weight: 500; }
.danger-text { color: var(--bad); }
.block { width: 100%; }
.huge { font-size: 1.2rem; min-height: 64px; padding: 14px 24px; width: 100%; }
label { display: block; font-weight: 500; font-size: .92rem; margin: 0 0 14px; }
label.check { display: flex; gap: 8px; align-items: center; }
input, select, textarea { display: block; width: 100%; margin-top: 6px; font: inherit; color: var(--text); background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 11px 12px; min-height: 46px; }
input[type=checkbox] { width: auto; min-height: 0; margin: 0; }
input:focus, select:focus, button:focus-visible, a:focus-visible { outline: 3px solid color-mix(in srgb, var(--brand) 45%, transparent); outline-offset: 1px; }

/* Center cards (login / setup) */
.center-card { max-width: 440px; margin: 6vh auto; background: var(--surface); padding: 28px; border-radius: 18px; box-shadow: var(--shadow); border: 1px solid var(--line); }
.brand-lg { display: flex; gap: 12px; align-items: center; margin-bottom: 22px; }
.brand-lg img { width: 44px; height: 44px; }
.brand-lg strong { display: block; font-size: 1.15rem; }
.brand-lg span { color: var(--muted); font-size: .9rem; }

/* Station */
.station-shell { min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; }
.station-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 18px; background: var(--surface); border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 600; }
.brand img { width: 32px; height: 32px; }
.brand span { color: var(--muted); font-size: .8rem; font-weight: 400; display: block; }
.station-head .brand span { font-size: .95rem; color: var(--text); font-weight: 600; }
.who { font-size: 1.05rem; }
.unlock { padding: 28px 18px; max-width: 900px; width: 100%; margin: 0 auto; text-align: center; }
.name-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 12px; margin-top: 22px; }
.name-btn { background: var(--surface); border: 1px solid var(--line); min-height: 90px; font-size: 1.2rem; font-weight: 600; flex-direction: column; color: var(--text); box-shadow: var(--shadow); }
.name-btn small { font-weight: 400; color: var(--warn); }
.name-btn:active { background: var(--brand-soft); }
.pin-screen { max-width: 380px; margin: 0 auto; padding: 36px 18px; text-align: center; width: 100%; }
.pin-dots { display: flex; justify-content: center; gap: 14px; margin: 22px 0 6px; }
.pin-dots span { width: 18px; height: 18px; border-radius: 50%; border: 2px solid var(--brand); }
.pin-dots span.on { background: var(--brand); }
.pin-pad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin: 14px 0; }
.pin-pad button { min-height: 72px; font-size: 1.6rem; font-weight: 600; background: var(--surface); border: 1px solid var(--line); color: var(--text); border-radius: 16px; }
.pin-pad button:active { background: var(--brand-soft); }
.pin-pad [data-act] { font-size: 1rem; }
.station { max-width: 760px; width: 100%; margin: 0 auto; padding: 16px; }
.station.narrow { margin: 0; padding: 0; }
.mode-toggle { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 8px; margin-bottom: 12px; }
.mode-toggle button { min-height: 60px; font-size: 1.15rem; font-weight: 600; background: var(--surface); border: 2px solid var(--line); color: var(--text); }
.mode-toggle button.on.mode-take { border-color: var(--brand); background: var(--brand); color: #fff; }
.mode-toggle button.on.mode-return { border-color: var(--info); background: var(--info); color: #fff; }
.scan-box { background: var(--surface); border: 2px dashed var(--line); border-radius: var(--radius); padding: 18px; text-align: center; transition: background .25s, border-color .25s; }
.scan-box.ok { border-color: var(--ok); border-style: solid; }
.scan-box.bad { border-color: var(--bad); border-style: solid; background: var(--bad-soft); }
.scan-box.flash { animation: flash .6s ease-out; }
@keyframes flash { from { background: var(--ok-soft); } to { background: var(--surface); } }
.scan-icon { font-size: 1.6rem; letter-spacing: -2px; color: var(--muted); }
#scan-input { text-align: center; font-size: 1.15rem; max-width: 420px; margin: 8px auto; caret-color: transparent; }
.scan-msg { font-size: 1.15rem; font-weight: 600; margin: 8px 0 4px; min-height: 1.5em; }
.scan-box.bad .scan-msg { color: var(--bad); }
.scan-box.ok .scan-msg { color: var(--ok); }
.idle-warning { background: var(--warn-soft); color: var(--warn); padding: 10px; border-radius: 10px; text-align: center; font-weight: 600; margin: 10px 0 0; }
.basket { margin-top: 16px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; }
.basket h2 { display: flex; justify-content: space-between; align-items: center; }
.count { font-size: .9rem; color: var(--muted); font-weight: 500; }
.lines { list-style: none; margin: 12px 0 0; padding: 0; }
.line { display: grid; grid-template-columns: 1fr auto auto; gap: 10px; align-items: center; padding: 10px 0; border-top: 1px solid var(--line); }
.line-main strong { display: block; }
.stepper { display: flex; align-items: center; gap: 4px; }
.stepper button { width: 48px; min-height: 48px; padding: 0; font-size: 1.4rem; background: var(--surface-2); border: 1px solid var(--line); color: var(--text); }
.stepper input { width: 64px; text-align: center; margin: 0; padding: 8px 4px; -moz-appearance: textfield; }
.stepper input::-webkit-inner-spin-button { -webkit-appearance: none; }
.remove { background: none; color: var(--muted); width: 44px; padding: 0; font-size: 1.1rem; }
.basket-actions { display: grid; gap: 10px; margin-top: 16px; }
.tag { display: inline-block; font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .03em; padding: 2px 7px; border-radius: 6px; background: var(--surface-2); color: var(--muted); margin-right: 6px; vertical-align: middle; }
.tag-take { background: var(--brand-soft); color: var(--brand); }
.tag-return, .tag-receive { background: var(--info-soft); color: var(--info); }
.tag-adjust, .tag-restore { background: var(--warn-soft); color: var(--warn); }
.saved-screen { min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; align-items: center; justify-content: center; background: var(--ok-soft); text-align: center; padding: 20px; }
.saved-screen .check { width: 120px; height: 120px; border-radius: 50%; background: var(--ok); color: #fff; font-size: 4rem; display: flex; align-items: center; justify-content: center; margin-bottom: 18px; }

/* Manager shell */
.shell { display: grid; grid-template-columns: 240px 1fr; min-height: 100vh; }
.sidebar { background: var(--surface); border-right: 1px solid var(--line); padding: 18px 12px; display: flex; flex-direction: column; gap: 18px; position: sticky; top: 0; height: 100vh; }
.sidebar nav { display: flex; flex-direction: column; gap: 2px; }
.sidebar nav a { display: flex; gap: 10px; align-items: center; padding: 10px 12px; border-radius: 10px; color: var(--text); text-decoration: none; font-weight: 500; }
.sidebar nav a span { width: 20px; text-align: center; color: var(--muted); }
.sidebar nav a.active { background: var(--brand-soft); color: var(--brand); }
.sidebar nav a.active span { color: var(--brand); }
.sidebar-foot { margin-top: auto; display: grid; gap: 8px; }
.me { font-weight: 600; padding: 0 8px; }
.content { padding: 24px 28px; min-width: 0; max-width: 1200px; }
.page-head { display: flex; justify-content: space-between; gap: 16px; align-items: flex-start; margin-bottom: 18px; flex-wrap: wrap; }
.page-head p { color: var(--muted); margin: 0; }
.actions, .filters { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.filters { margin-bottom: 14px; }
.filters input, .filters select { width: auto; flex: 1 1 200px; margin: 0; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; margin-bottom: 16px; box-shadow: var(--shadow); min-width: 0; }
.panel-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 10px; }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: 16px; align-items: start; }
.grid2 .panel { margin: 0; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; margin-bottom: 16px; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; color: var(--text); text-decoration: none; }
.stat span { color: var(--muted); font-size: .88rem; }
.stat strong { display: block; font-size: 1.7rem; font-variant-numeric: tabular-nums; }
.stat.warn strong { color: var(--warn); } .stat.bad strong { color: var(--bad); }
.simple-list { list-style: none; margin: 0; padding: 0; }
.simple-list li { display: flex; justify-content: space-between; gap: 12px; align-items: center; padding: 10px 0; border-top: 1px solid var(--line); }
.simple-list li:first-child { border-top: 0; }
.simple-list .right { text-align: right; display: flex; gap: 4px; align-items: center; flex-wrap: wrap; justify-content: flex-end; }
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table { width: 100%; border-collapse: collapse; font-size: .93rem; }
th { text-align: left; color: var(--muted); font-weight: 600; font-size: .8rem; text-transform: uppercase; letter-spacing: .03em; padding: 8px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
td { padding: 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
.num { text-align: right; font-variant-numeric: tabular-nums; }
.neg { color: var(--bad); font-weight: 600; } .pos { color: var(--ok); font-weight: 600; }
.row-actions { white-space: nowrap; text-align: right; }
.badge { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: .78rem; font-weight: 700; }
.badge.okb { background: var(--ok-soft); color: var(--ok); }
.badge.low { background: var(--warn-soft); color: var(--warn); }
.badge.out { background: var(--bad-soft); color: var(--bad); }
.exp-list li.expired strong { color: var(--bad); }
.exp-qty { font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }
.exp-line { font-weight: 600; }
.exp-line.soon { color: var(--warn); }
.exp-line.expired { color: var(--bad); }
.settings-form { max-width: 560px; }
.settings-form .actions { margin: 4px 0 16px; }
.form-section { margin: 22px 0 4px; padding-top: 18px; border-top: 1px solid var(--line); }
.report-preview { white-space: pre-wrap; font: .9rem/1.5 ui-monospace, SFMono-Regular, Menlo, monospace; background: var(--surface-2); padding: 14px; border-radius: 10px; margin: 0; }
.import-errors { margin: 6px 0 0; padding-left: 20px; color: var(--bad); font-size: .9rem; max-height: 30vh; overflow: auto; }
/* Tabs + invoice audit */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin: -4px 0 16px; overflow-x: auto; }
.tabs a { padding: 10px 14px; text-decoration: none; color: var(--muted); font-weight: 600; border-bottom: 3px solid transparent; white-space: nowrap; }
.tabs a.on { color: var(--brand); border-bottom-color: var(--brand); }
.stat small { margin-top: 2px; }
.inv-grid { display: grid; grid-template-columns: 1fr; gap: 16px; align-items: start; }
@media (min-width: 1440px) { .inv-grid { grid-template-columns: minmax(240px, 26%) 1fr; } .inv-pages { position: sticky; top: 12px; max-height: calc(100vh - 24px); } }
.inv-pages { display: grid; gap: 10px; overflow: auto; grid-template-columns: repeat(auto-fill, minmax(160px, 260px)); }
@media (min-width: 1440px) { .inv-pages { grid-template-columns: 1fr; } }
.inv-pages img { width: 100%; border: 1px solid var(--line); border-radius: 10px; background: #fff; display: block; }
.inv-form .row > label { flex: 1 1 160px; }
.inv-lines td { padding: 6px 4px; vertical-align: top; }
.inv-lines input, .inv-lines select { margin: 0; min-height: 40px; padding: 8px; font-size: .92rem; }
.inv-lines td:first-child { min-width: 200px; }
.inv-lines select { min-width: 170px; max-width: 240px; }
.inv-lines .small-in { margin-top: 4px; font-size: .82rem; min-height: 34px; }
.inv-lines .num-in { width: 76px; text-align: right; }
.inv-lines tr.low-conf td:first-child { box-shadow: inset 3px 0 0 var(--warn); }
.inv-totals > label { flex: 1 1 110px; }
.history-toggle { background: var(--info-soft); border-radius: 10px; padding: 10px 12px; }
.inv-lines label.pack, td label.pack { display: flex; align-items: center; gap: 4px; margin: 4px 0 0; font-size: .8rem; font-weight: 500; color: var(--muted); white-space: nowrap; }
label.pack input { width: 64px; min-height: 30px; padding: 4px 6px; margin: 0; text-align: right; font-size: .85rem; }
.chip { display: inline-flex; align-items: center; gap: 4px; background: var(--brand-soft); color: var(--brand); border-radius: 999px; padding: 2px 4px 2px 10px; font-size: .78rem; margin: 4px 4px 0 0; }
.chip button { min-height: 0; padding: 0 6px; background: none; color: inherit; font-size: .75rem; }
small.desc { color: var(--text); opacity: .8; }
.flag-dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 8px; vertical-align: middle; }
.flag-dot.flag-bad { background: var(--bad); } .flag-dot.flag-warn { background: var(--warn); } .flag-dot.flag-info { background: var(--info); }
tr.done td { opacity: .6; }
.price-chip { display: inline-flex; gap: 6px; align-items: baseline; border: 1px solid var(--line); border-radius: 999px; padding: 3px 10px; margin: 2px 4px 2px 0; font-size: .85rem; white-space: nowrap; }
.price-chip.best { border-color: var(--ok); background: var(--ok-soft); }
.price-chip em { font-style: normal; font-size: .78rem; font-weight: 700; }
.log-details { margin-top: 16px; }
.log-details summary { cursor: pointer; font-weight: 600; padding: 4px 0; }
.log-details[open] summary { margin-bottom: 8px; }
.log-list li { padding: 8px 0; }
.flag-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.flag-list li { border-radius: 10px; padding: 10px 12px; display: grid; gap: 2px; }
.flag-list li strong { font-size: .85rem; text-transform: uppercase; letter-spacing: .03em; }
.flag-bad { background: var(--bad-soft); } .flag-bad strong { color: var(--bad); }
.flag-warn { background: var(--warn-soft); } .flag-warn strong { color: var(--warn); }
.flag-info { background: var(--info-soft); } .flag-info strong { color: var(--info); }
.flag-ok { color: var(--ok); font-weight: 600; margin: 0; }
.inv-sum { display: grid; grid-template-columns: auto auto; justify-content: end; gap: 4px 18px; margin: 14px 0; font-variant-numeric: tabular-nums; }
.inv-sum dt { color: var(--muted); } .inv-sum dd { margin: 0; text-align: right; }
@media (max-width: 860px) { .inv-pages { grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); } }
.empty-state ol { margin: 8px 0 0; padding-left: 20px; } .empty-state li { margin: 6px 0; }
.code-big { font-size: 2rem; font-weight: 700; letter-spacing: .12em; text-align: center; background: var(--surface-2); border-radius: 10px; padding: 14px; font-variant-numeric: tabular-nums; user-select: all; }

/* Modal */
dialog { border: 0; border-radius: 18px; padding: 0; width: min(520px, calc(100vw - 24px)); background: var(--surface); color: var(--text); box-shadow: 0 20px 60px rgba(0, 0, 0, .3); }
dialog.wide { width: min(860px, calc(100vw - 24px)); }
dialog::backdrop { background: rgba(10, 20, 18, .45); }
.modal-form { padding: 22px; max-height: 90vh; overflow: auto; }
.modal-form h2 { margin-bottom: 14px; font-size: 1.25rem; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 12px; }
.row { display: flex; gap: 12px; align-items: flex-end; flex-wrap: wrap; }
.row > label { flex: 1 1 200px; }
.row > button { margin-bottom: 14px; }
.label-pick { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 8px; max-height: 50vh; overflow: auto; }
.pick { display: flex; gap: 10px; align-items: center; margin: 0; font-weight: 400; }
.pick input { width: 72px; margin: 0; }

/* Toast */
#toast { position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 30px); opacity: 0; transition: .25s; background: var(--text); color: var(--bg); padding: 12px 18px; border-radius: 12px; font-weight: 600; pointer-events: none; z-index: 50; max-width: calc(100vw - 32px); }
#toast.show { opacity: 1; transform: translate(-50%, 0); }
#toast.bad { background: var(--bad); color: #fff; }

/* Print */
.print-area { position: fixed; inset: 0; background: #fff; color: #000; overflow: auto; z-index: 40; padding: 20px; }
.print-bar { display: flex; gap: 8px; margin-bottom: 16px; }
.labels { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.label { border: 1px dashed #bbb; padding: 8px; text-align: center; break-inside: avoid; font-size: 11px; }
.label strong { display: block; font-size: 12px; margin-bottom: 4px; }
.label svg { max-width: 100%; height: 50px; }
@media print {
  body.printing > :not(.print-area) { display: none !important; }
  .print-area { position: static; padding: 0; }
  .no-print { display: none !important; }
  .label { border-color: #ddd; }
}

/* Responsive */
.menu-toggle { display: none; }
@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; }
  /* Compact top bar; the menu opens on demand. */
  .sidebar { position: sticky; top: 0; z-index: 20; height: auto; flex-direction: column; padding: 8px 12px; gap: 8px; border-right: 0; border-bottom: 1px solid var(--line); }
  .sidebar .brand { justify-content: space-between; }
  .sidebar .brand > div { flex: 1; min-width: 0; }
  .sidebar .brand span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .menu-toggle { display: inline-flex; min-height: 40px; padding: 6px 12px; }
  .sidebar nav, .sidebar-foot { display: none; }
  .sidebar.open nav { display: flex; flex-direction: column; max-height: 70vh; overflow-y: auto; }
  .sidebar.open .sidebar-foot { display: grid; margin: 0; grid-template-columns: 1fr; padding-bottom: 6px; }
  .sidebar nav a { padding: 12px; }
  .content { padding: 14px; }
  .grid2 { grid-template-columns: 1fr; }
  .page-head h1 { font-size: 1.35rem; }
  .page-head .actions { width: 100%; }
}
@media (max-width: 700px) {
  /* Tables become cards: one card per row, "label : value" lines. */
  .content table, dialog table { display: block; }
  .content thead, dialog thead { display: none; }
  .content tbody, dialog tbody { display: block; }
  .content tbody tr, dialog tbody tr { display: block; border: 1px solid var(--line); border-radius: 12px; padding: 8px 12px; margin-bottom: 10px; background: var(--surface); }
  .content td, dialog td { display: grid; grid-template-columns: minmax(90px, 36%) minmax(0, 1fr); gap: 10px; align-items: start; border: 0; padding: 5px 0; text-align: left; }
  .content td::before, dialog td::before { content: attr(data-label); color: var(--muted); font-size: .76rem; font-weight: 600; text-transform: uppercase; letter-spacing: .03em; padding-top: 2px; }
  .content td[data-label=""], dialog td[data-label=""] { grid-template-columns: minmax(0, 1fr); }
  .content td[data-label=""]::before, dialog td[data-label=""]::before { display: none; }
  .content td.num, dialog td.num { text-align: left; }
  .content td.empty { display: block; }
  .content td.row-actions, dialog td.row-actions { white-space: normal; text-align: left; }
  .table-wrap { overflow: visible; }
  .panel { padding: 12px; }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .stat { padding: 10px 12px; } .stat strong { font-size: 1.35rem; }
  .filters input, .filters select { flex: 1 1 100%; }
  .filters .btn, .filters button { flex: 1 1 calc(50% - 8px); font-size: .9rem; padding: 8px 10px; }
  .filters input[type=checkbox], label.check input[type=checkbox] { flex: none; width: auto; }
  .filters label.check { flex: 1 1 100%; margin: 0; }
  /* Keep every piece of a cell next to its label, not under it. */
  .content td > *, dialog td > * { grid-column: 2; min-width: 0; }
  .content td[data-label=""] > *, dialog td[data-label=""] > * { grid-column: 1; }
  .simple-list li { flex-wrap: wrap; }
  .simple-list .right { justify-content: flex-start; text-align: left; }
  /* Invoice check: each line is a card with full-width fields. */
  .inv-lines input, .inv-lines select, .inv-lines .num-in { width: 100%; max-width: none; min-width: 0; text-align: left; }
  .inv-lines td:first-child { min-width: 0; }
  label.pack input { width: 80px; }
  .price-chip { white-space: normal; }
  dialog, dialog.wide { width: 100vw; max-width: 100vw; max-height: 100dvh; border-radius: 0; margin: 0; }
  .modal-form { max-height: 100dvh; padding: 18px 16px; }
  .modal-actions { position: sticky; bottom: 0; background: var(--surface); padding-top: 8px; }
}
@media (max-width: 520px) {
  .center-card { margin: 0; border-radius: 0; min-height: 100vh; border: 0; padding: 22px 16px; }
  .line { grid-template-columns: 1fr auto; }
  .line .remove { grid-column: 2; grid-row: 1; }
  .line .stepper { grid-column: 1 / -1; }
  .labels { grid-template-columns: repeat(2, 1fr); }
  .who { display: none; }
}
.lang-toggle { font-size: .9rem; }
.center-card > .lang-toggle { display: block; margin: -12px 0 12px auto; }
