/* Layout: fixed top bar with tabs; working area is a two-column grid (form | result/cart) that stacks on phones. */
:root {
  --bg: #eef1f4; --surface: #ffffff; --surface-2: #f6f8fa; --fg: #16212b; --muted: #5f6f7c; --line: #d3dbe2; --line-strong: #aeb9c3;
  --accent: #1d5d7a; --accent-fg: #ffffff; --accent-soft: #dcebf2;
  --ok: #1f6b3a; --ok-soft: #dff1e4; --warn: #9a5a00; --warn-soft: #fff0d1; --bad: #a3262c; --bad-soft: #fbe2e2;
  --font: 'PT Sans', 'Helvetica Neue', Arial, sans-serif; --mono: 'PT Mono', 'SF Mono', Menlo, monospace;
  --radius: 6px;
}
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) {
  --bg: #11181f; --surface: #1a232c; --surface-2: #202b35; --fg: #e5ebf0; --muted: #96a6b3; --line: #2d3a46; --line-strong: #445462;
  --accent: #6fb6d6; --accent-fg: #0d1a22; --accent-soft: #1d3542;
  --ok: #7fd49b; --ok-soft: #173424; --warn: #f0b656; --warn-soft: #3a2c10; --bad: #f28a8e; --bad-soft: #3f1d1f; color-scheme: dark; } }
:root[data-theme="dark"] {
  --bg: #11181f; --surface: #1a232c; --surface-2: #202b35; --fg: #e5ebf0; --muted: #96a6b3; --line: #2d3a46; --line-strong: #445462;
  --accent: #6fb6d6; --accent-fg: #0d1a22; --accent-soft: #1d3542;
  --ok: #7fd49b; --ok-soft: #173424; --warn: #f0b656; --warn-soft: #3a2c10; --bad: #f28a8e; --bad-soft: #3f1d1f; color-scheme: dark; }

* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--fg); font-family: var(--font); font-size: 15px; line-height: 1.45;
  padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); padding-block: 0 48px; }
[v-cloak] { display: none; }
a { color: var(--accent); }
h1 { font-size: 18px; margin: 0; font-weight: 700; }
h2 { font-size: 20px; margin: 0 0 10px; }
h3 { font-size: 15px; margin: 18px 0 8px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
p { margin: 6px 0; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.mono { font-family: var(--mono); }
.num { font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; }

.topbar { position: sticky; top: env(safe-area-inset-top, 0px); z-index: 20; background: var(--surface); border-bottom: 1px solid var(--line);
  margin-left: calc(-1 * max(16px, env(safe-area-inset-left, 0px))); margin-right: calc(-1 * max(16px, env(safe-area-inset-right, 0px)));
  padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); }
.topbar-in { max-width: 1280px; margin: 0 auto; display: flex; align-items: center; gap: 18px; flex-wrap: wrap; padding-block: 8px; }
.brand { display: flex; flex-direction: column; }
.brand .sub { font-size: 12px; color: var(--muted); }
.tabs { display: flex; gap: 2px; flex-wrap: wrap; }
.tabs button { background: none; border: 0; border-bottom: 2px solid transparent; padding: 8px 12px; font: inherit; color: var(--muted); cursor: pointer; }
.tabs button.active { color: var(--fg); border-bottom-color: var(--accent); font-weight: 700; }
.tabs button:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.spacer { flex: 1; }

.page { max-width: 1280px; margin: 0 auto; padding-block: 18px; }
.grid-2 { display: grid; grid-template-columns: minmax(0, 7fr) minmax(0, 5fr); gap: 18px; align-items: start; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.grid-2 > *, .grid-3 > * { min-width: 0; }
@media (max-width: 900px) { .grid-2, .grid-3 { grid-template-columns: 1fr; } }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; min-width: 0; }
.card + .card { margin-top: 14px; }
.card.sticky { position: sticky; top: calc(env(safe-area-inset-top, 0px) + 64px); }
@media (max-width: 900px) { .card.sticky { position: static; } }

.field { display: flex; flex-direction: column; gap: 4px; margin-bottom: 10px; min-width: 0; }
.field label, .lbl { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; }
.row > .field { flex: 1 1 140px; margin-bottom: 0; }
.row.tight { gap: 6px; align-items: center; }
input, select, textarea, button { font: inherit; color: inherit; }
input[type=text], input[type=number], input[type=search], select, textarea {
  width: 100%; padding: 7px 9px; border: 1px solid var(--line-strong); border-radius: var(--radius); background: var(--surface); min-width: 0; }
input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 2px solid var(--accent); outline-offset: 0; border-color: var(--accent); }
input.sm, select.sm { padding: 4px 6px; font-size: 14px; }
input.w-num { width: 110px; text-align: right; font-variant-numeric: tabular-nums; }
input.w-qty { width: 64px; text-align: right; }
textarea { min-height: 70px; resize: vertical; }
.check { display: flex; align-items: center; gap: 8px; font-size: 14px; cursor: pointer; }
.check input { width: 16px; height: 16px; accent-color: var(--accent); }
.checks { display: flex; gap: 14px; flex-wrap: wrap; margin: 8px 0; }

button.btn { background: var(--surface-2); border: 1px solid var(--line-strong); border-radius: var(--radius); padding: 7px 12px; cursor: pointer; white-space: nowrap; }
button.btn:hover { border-color: var(--accent); }
button.btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
button.btn.primary { background: var(--accent); color: var(--accent-fg); border-color: var(--accent); font-weight: 700; }
button.btn.danger { color: var(--bad); }
button.btn.sm { padding: 3px 8px; font-size: 13px; }
button.btn:disabled { opacity: .5; cursor: not-allowed; }
.btns { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.icon-btn { background: none; border: 0; cursor: pointer; color: var(--muted); padding: 2px 6px; font-size: 15px; line-height: 1; }
.icon-btn:hover { color: var(--bad); }

.seg { display: inline-flex; border: 1px solid var(--line-strong); border-radius: var(--radius); overflow: hidden; }
.seg button { background: var(--surface); border: 0; padding: 7px 14px; cursor: pointer; color: var(--muted); }
.seg button + button { border-left: 1px solid var(--line-strong); }
.seg button.active { background: var(--accent); color: var(--accent-fg); font-weight: 700; }

.picker { border: 1px solid var(--line); border-radius: var(--radius); max-height: 260px; overflow: auto; background: var(--surface-2); }
.picker div { padding: 5px 10px; cursor: pointer; display: flex; gap: 8px; align-items: baseline; border-bottom: 1px solid var(--line); font-size: 14px; }
.picker div:hover { background: var(--accent-soft); }
.picker .f { font-family: var(--mono); font-weight: 700; min-width: 70px; }
.picker .n { color: var(--muted); flex: 1; }
.tag { font-size: 11px; font-family: var(--mono); padding: 0 6px; border-radius: 3px; background: var(--accent-soft); color: var(--accent); white-space: nowrap; }
.tag.aggr { background: var(--bad-soft); color: var(--bad); }
.tag.merk { background: var(--warn-soft); color: var(--warn); }
.tag.star { background: var(--surface); border: 1px solid var(--line); color: var(--muted); }

.comp-row { display: grid; grid-template-columns: minmax(0, 1fr) 110px 100px 32px; gap: 6px; align-items: center; padding: 6px 0; border-bottom: 1px solid var(--line); }
.comp-row .f { font-family: var(--mono); font-weight: 700; }
.comp-row .n { color: var(--muted); font-size: 13px; }
@media (max-width: 560px) { .comp-row { grid-template-columns: minmax(0, 1fr) 80px 90px 28px; } }

.result { font-variant-numeric: tabular-nums; }
.result .total { font-size: 30px; font-weight: 700; line-height: 1.1; margin: 6px 0; }
.result .line { display: flex; justify-content: space-between; gap: 12px; padding: 4px 0; border-bottom: 1px dotted var(--line); font-size: 14px; }
.result .line span:last-child { white-space: nowrap; }
.badge { display: inline-block; padding: 2px 8px; border-radius: 3px; font-size: 12px; font-weight: 700; letter-spacing: .03em; }
.badge.type { background: var(--accent-soft); color: var(--accent); }
.badge.ok { background: var(--ok-soft); color: var(--ok); }
.badge.req { background: var(--warn-soft); color: var(--warn); }
.badge.no { background: var(--bad-soft); color: var(--bad); }
.alert { padding: 8px 12px; border-radius: var(--radius); margin: 8px 0; font-size: 14px; border-left: 4px solid; }
.alert.req { background: var(--warn-soft); border-color: var(--warn); }
.alert.no { background: var(--bad-soft); border-color: var(--bad); }
.alert.info { background: var(--accent-soft); border-color: var(--accent); }
.alert.ok { background: var(--ok-soft); border-color: var(--ok); }

.tbl { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; font-size: 14px; }
th, td { padding: 6px 8px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; }
th { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; font-weight: 700; background: var(--surface-2); white-space: nowrap; }
td input, td select { padding: 4px 6px; }
tr.sum td { font-weight: 700; border-top: 2px solid var(--line-strong); }
.cart-name { min-width: 260px; }
.cart-name input { width: 100%; }

.subnav { display: flex; gap: 4px; flex-wrap: wrap; margin-bottom: 14px; }
.subnav button { background: var(--surface); border: 1px solid var(--line); border-radius: 20px; padding: 5px 12px; cursor: pointer; font-size: 14px; color: var(--muted); }
.subnav button.active { background: var(--accent); color: var(--accent-fg); border-color: var(--accent); }
.vol-map { display: flex; gap: 6px; flex-wrap: wrap; }
.vol-map label { display: flex; flex-direction: column; font-size: 11px; color: var(--muted); }
.vol-map input { width: 92px; text-align: right; font-variant-numeric: tabular-nums; }
.toast { position: fixed; left: 50%; bottom: calc(20px + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%); background: var(--fg); color: var(--bg); padding: 10px 16px; border-radius: var(--radius); z-index: 50; max-width: 90vw; }
.help { font-size: 13px; color: var(--muted); margin: -4px 0 10px; }
.kbd { font-family: var(--mono); background: var(--surface-2); border: 1px solid var(--line); padding: 0 4px; border-radius: 3px; font-size: 13px; }
@media (prefers-reduced-motion: no-preference) { html { scroll-behavior: smooth; } }
