/* Schriften liegen bei der Seite (kein Abruf bei Google Fonts, funktionieren auch offline). Lizenz: SIL OFL 1.1, siehe fonts/ */
@font-face { font-family: "Archivo Narrow"; src: url("fonts/archivo-narrow-var.woff") format("woff"); font-weight: 400 700; font-style: normal; font-display: swap; }
@font-face { font-family: "Atkinson Hyperlegible"; src: url("fonts/atkinson-hyperlegible-400.woff") format("woff"); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: "Atkinson Hyperlegible"; src: url("fonts/atkinson-hyperlegible-700.woff") format("woff"); font-weight: 700; font-style: normal; font-display: swap; }

html, body { margin: 0; }
[hidden] { display: none !important; }
img { max-width: 100%; }

/* Layout: eine Spalte, Handy zuerst (max. 40rem). Reise-Kopf als Kofferanhänger, Tab-Leiste unten. */
:root {
  --bg: #ECEFF3;
  --surface: #FFFFFF;
  --surface-2: #F4F6F9;
  --ink: #16202B;
  --muted: #586474;
  --line: #D3DAE2;
  --accent: #8C1D3F;
  --accent-ink: #FFFFFF;
  --accent-soft: #F5E4EA;
  --label-bg: #8C1D3F;
  --label-ink: #FFF5F8;
  --label-dim: #F0C9D5;
  --hl: #E9B930;
  --hl-ink: #2A1F00;
  --ok: #1E7A4C;
  --ok-soft: #DCF0E4;
  --danger: #B3261E;
  --shadow: 0 1px 2px rgba(22, 32, 43, .06), 0 4px 14px rgba(22, 32, 43, .06);
  --display: "Archivo Narrow", "Arial Narrow", "Roboto Condensed", system-ui, sans-serif;
  --body: "Atkinson Hyperlegible", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --r: 12px;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0E1217; --surface: #161B22; --surface-2: #1C232C; --ink: #E7ECF2; --muted: #9AA5B3; --line: #2A323D;
    --accent: #E37C99; --accent-ink: #22070F; --accent-soft: #3A1A25;
    --label-bg: #5E1329; --label-ink: #FBE7EE; --label-dim: #D89AAE;
    --hl: #D9AE36; --hl-ink: #1E1600; --ok: #5DCB8E; --ok-soft: #163023; --danger: #F2867E;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 4px 14px rgba(0, 0, 0, .25);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0E1217; --surface: #161B22; --surface-2: #1C232C; --ink: #E7ECF2; --muted: #9AA5B3; --line: #2A323D;
  --accent: #E37C99; --accent-ink: #22070F; --accent-soft: #3A1A25;
  --label-bg: #5E1329; --label-ink: #FBE7EE; --label-dim: #D89AAE;
  --hl: #D9AE36; --hl-ink: #1E1600; --ok: #5DCB8E; --ok-soft: #163023; --danger: #F2867E;
  --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 4px 14px rgba(0, 0, 0, .25);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  background: var(--bg); color: var(--ink);
  font-family: var(--body); font-size: 1rem; line-height: 1.45;
  padding-inline: 16px; padding-block: 0;
}
body.noscroll { overflow: hidden; }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }

#view { display: grid; gap: 16px; min-width: 0; }
.app { max-width: 40rem; margin: 0 auto; padding-block: calc(16px + env(safe-area-inset-top, 0px)) calc(96px + env(safe-area-inset-bottom, 0px)); display: flex; flex-direction: column; gap: 16px; }

h1, h2, h3 { font-family: var(--display); text-wrap: balance; margin: 0; }
h1 { font-size: 1.9rem; font-weight: 700; letter-spacing: -.01em; line-height: 1.1; }
h2 { font-size: 1.25rem; font-weight: 700; }
.eyebrow { font-family: var(--display); font-weight: 600; text-transform: uppercase; letter-spacing: .08em; font-size: .78rem; color: var(--muted); }
.muted { color: var(--muted); }
.num { font-family: var(--display); font-variant-numeric: tabular-nums; }

.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.page-head p { margin: 4px 0 0; color: var(--muted); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 44px; padding: 0 16px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--surface); color: var(--ink); font-weight: 700;
}
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.ghost { background: transparent; }
.btn.danger { color: var(--danger); border-color: transparent; background: transparent; }
.btn.danger.armed { background: var(--danger); color: var(--surface); }
.btn.small { min-height: 36px; padding: 0 12px; font-size: .9rem; }
.btn[disabled] { opacity: .45; cursor: default; }
.link { background: none; border: 0; padding: 8px 0; color: var(--accent); font-weight: 700; min-height: 44px; }

.banner { border-radius: var(--r); padding: 10px 14px; background: var(--surface-2); border: 1px solid var(--line); color: var(--muted); font-size: .92rem; }
.banner strong { color: var(--ink); }

/* Reiseübersicht */
.trip-list { display: grid; gap: 12px; list-style: none; margin: 0; padding: 0; }
.trip-card {
  width: 100%; text-align: left; display: grid; gap: 6px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r);
  padding: 14px 16px; box-shadow: var(--shadow);
}
.trip-card .trip-name { font-family: var(--display); font-weight: 700; font-size: 1.35rem; line-height: 1.15; }
.trip-card .trip-when { font-size: .9rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.trip-card .trip-foot { display: flex; justify-content: space-between; gap: 8px; flex-wrap: wrap; font-size: .9rem; color: var(--muted); }
.app-list { display: grid; gap: 16px; }
.bar { display: block; height: 6px; border-radius: 99px; background: var(--surface-2); overflow: hidden; border: 1px solid var(--line); }
.bar > span { display: block; height: 100%; background: var(--ok); border-radius: inherit; transition: width .3s ease; }
.section-label { margin-top: 8px; }

/* Kofferanhänger */
.lugtag {
  position: relative; color: var(--label-ink); background: var(--label-bg);
  clip-path: polygon(22px 0, 100% 0, 100% 100%, 22px 100%, 0 calc(100% - 22px), 0 22px);
  padding: 18px 16px 16px 52px; display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 4px 18px; align-items: start;
}
.lugtag::before {
  content: ""; position: absolute; left: 16px; top: 50%; width: 16px; height: 16px; margin-top: -8px;
  border-radius: 50%; background: var(--bg); box-shadow: 0 0 0 3px var(--label-dim);
}
.lugtag::after {
  content: ""; position: absolute; left: 42px; top: 14px; bottom: 14px; border-left: 2px dashed var(--label-dim); opacity: .55;
}
.lug-days { display: flex; flex-direction: column; align-items: center; padding-left: 4px; }
.lug-n { font-family: var(--display); font-weight: 700; font-size: 3.6rem; line-height: .9; font-variant-numeric: tabular-nums; }
.lug-l { font-family: var(--display); text-transform: uppercase; letter-spacing: .14em; font-size: .78rem; color: var(--label-dim); margin-top: 4px; }
.lug-main { min-width: 0; display: grid; gap: 4px; }
.lug-name { font-size: 1.7rem; text-transform: uppercase; letter-spacing: .02em; line-height: 1.05; overflow-wrap: anywhere; }
.lug-meta { margin: 0; color: var(--label-dim); font-size: .92rem; font-variant-numeric: tabular-nums; }
.lug-prog { display: flex; align-items: center; gap: 10px; margin-top: 6px; }
.lug-prog .bar { flex: 1; background: rgba(255, 255, 255, .16); border-color: transparent; }
.lug-prog .bar > span { background: var(--label-ink); }
.lug-count { font-family: var(--display); font-weight: 600; font-size: .95rem; white-space: nowrap; font-variant-numeric: tabular-nums; }
.lug-edit { grid-column: 1 / -1; justify-self: start; margin-top: 6px; background: transparent; color: var(--label-ink); border: 1px solid var(--label-dim); border-radius: 999px; min-height: 36px; padding: 0 14px; font-weight: 700; font-size: .9rem; }

/* Werkzeugleiste */
.toolbar { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.seg { display: inline-flex; background: var(--surface); border: 1px solid var(--line); border-radius: 999px; padding: 3px; }
.seg button, .seg label { border: 0; background: transparent; border-radius: 999px; min-height: 36px; padding: 0 12px; font-weight: 700; font-size: .9rem; color: var(--muted); display: inline-flex; align-items: center; cursor: pointer; }
.seg button[aria-pressed="true"], .seg label:has(input:checked) { background: var(--ink); color: var(--surface); }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.chip-btn { border: 1px solid var(--line); background: var(--surface); border-radius: 999px; min-height: 36px; padding: 0 12px; font-weight: 700; font-size: .9rem; color: var(--muted); }
.chip-btn[aria-pressed="true"] { border-color: var(--ink); color: var(--ink); }
.toolbar .spacer { flex: 1; }

/* Listen */
.group { display: grid; gap: 6px; }
.group-h { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; padding: 0 4px; }
.group-h h2 { font-size: 1.05rem; text-transform: uppercase; letter-spacing: .06em; }
.group-h span { font-size: .85rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.rows { list-style: none; margin: 0; padding: 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; }
.rows > li + li { border-top: 1px solid var(--line); }
.row { display: grid; grid-template-columns: 44px minmax(0, 1fr) auto; align-items: center; gap: 6px; padding: 4px 6px 4px 4px; min-height: 56px; }
.check { width: 44px; height: 44px; border: 0; background: transparent; display: grid; place-items: center; padding: 0; }
.check .box { width: 26px; height: 26px; border-radius: 50%; border: 2px solid var(--line); display: grid; place-items: center; transition: background .15s, border-color .15s; }
.check svg { width: 16px; height: 16px; stroke: var(--surface); opacity: 0; }
.row.is-packed .check .box { background: var(--ok); border-color: var(--ok); }
.row.is-packed .check svg { opacity: 1; }
.row-main { min-width: 0; display: grid; gap: 1px; }
.row-name { font-weight: 700; overflow-wrap: anywhere; }
.row-sub { font-size: .85rem; color: var(--muted); overflow-wrap: anywhere; }
.row.is-packed .row-name { color: var(--muted); text-decoration: line-through; text-decoration-thickness: 1px; }
.qty { border: 1px solid transparent; background: var(--surface-2); border-radius: 10px; min-width: 64px; min-height: 44px; padding: 2px 10px; display: grid; justify-items: end; align-content: center; line-height: 1.05; }
.qty-n { font-family: var(--display); font-weight: 700; font-size: 1.35rem; font-variant-numeric: tabular-nums; }
.qty-u { font-size: .72rem; color: var(--muted); }
.qty.is-override { border-color: var(--hl); background: transparent; }
.row.is-packed .qty-n { color: var(--muted); }

.pick-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px; align-items: center; padding: 8px 12px; min-height: 56px; width: 100%; background: transparent; border: 0; text-align: left; }
.switch { width: 46px; height: 28px; border-radius: 99px; background: var(--line); position: relative; flex: none; transition: background .15s; }
.switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: var(--surface); box-shadow: 0 1px 2px rgba(0, 0, 0, .2); transition: transform .15s; }
.pick-row[aria-pressed="true"] .switch { background: var(--ok); }
.pick-row[aria-pressed="true"] .switch::after { transform: translateX(18px); }
.sugg { display: inline-block; font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; background: var(--hl); color: var(--hl-ink); border-radius: 4px; padding: 1px 6px; margin-left: 6px; vertical-align: 2px; }
.pick-head { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; justify-content: space-between; background: var(--accent-soft); border-radius: var(--r); padding: 12px 14px; }
.pick-head p { margin: 0; font-weight: 700; }

.item-row { width: 100%; display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px; align-items: center; background: transparent; border: 0; text-align: left; padding: 10px 14px; min-height: 56px; }
.rule { font-family: var(--display); font-weight: 700; font-size: 1.15rem; font-variant-numeric: tabular-nums; white-space: nowrap; }
.rule small { font-size: .78rem; color: var(--muted); font-weight: 600; }

.search { width: 100%; min-height: 44px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); padding: 0 16px; }

.empty { background: var(--surface); border: 1px dashed var(--line); border-radius: var(--r); padding: 20px; display: grid; gap: 10px; justify-items: start; }
.empty p { margin: 0; color: var(--muted); max-width: 60ch; }
.loading { padding: 40px 0; text-align: center; color: var(--muted); }

/* Familie */
.people { list-style: none; margin: 0; padding: 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); }
.people li { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: 8px; align-items: center; padding: 8px 10px 8px 14px; }
.people li + li { border-top: 1px solid var(--line); }
.people input { min-width: 0; width: 100%; border: 0; border-bottom: 1px dashed var(--line); background: transparent; min-height: 40px; font-weight: 700; padding: 0; }
.people .count { font-size: .85rem; color: var(--muted); white-space: nowrap; }
.add-row { display: flex; gap: 8px; }
.add-row input { flex: 1; min-width: 0; min-height: 44px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); padding: 0 16px; }
.note-box { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 14px 16px; display: grid; gap: 6px; }
.note-box p { margin: 0; color: var(--muted); max-width: 62ch; }

/* Bottom-Sheet */
#sheet { position: fixed; inset: 0; z-index: 30; }
.sheet-backdrop { position: absolute; inset: 0; background: rgba(10, 14, 20, .45); }
.sheet-panel {
  position: absolute; left: 0; right: 0; bottom: 0; margin: 0 auto; max-width: 40rem;
  max-height: 92%; overflow-y: auto; overscroll-behavior: contain;
  background: var(--surface); border-radius: 18px 18px 0 0;
  padding: 10px 16px calc(20px + env(safe-area-inset-bottom, 0px));
  box-shadow: 0 -8px 30px rgba(0, 0, 0, .2);
  animation: up .2s ease-out;
}
.sheet-panel::before { content: ""; display: block; width: 40px; height: 4px; border-radius: 4px; background: var(--line); margin: 0 auto 12px; }
@keyframes up { from { transform: translateY(24px); opacity: .6; } to { transform: none; opacity: 1; } }
.form { display: grid; gap: 14px; }
.field { display: grid; gap: 6px; min-width: 0; border: 0; margin: 0; padding: 0; }
.field > span, .field > legend { font-family: var(--display); font-weight: 600; text-transform: uppercase; letter-spacing: .07em; font-size: .78rem; color: var(--muted); padding: 0; }
.field input:not([type="radio"]):not([type="checkbox"]), .field select {
  width: 100%; min-height: 46px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface-2); padding: 0 12px; font-size: 1rem;
}
.field input:focus, .field select:focus { border-color: var(--accent); outline: none; box-shadow: 0 0 0 3px var(--accent-soft); }
.two { display: grid; grid-template-columns: repeat(auto-fit, minmax(9rem, 1fr)); gap: 12px; }
.three { display: grid; grid-template-columns: repeat(auto-fit, minmax(6.5rem, 1fr)); gap: 12px; }
.hint { margin: 0; font-size: .86rem; color: var(--muted); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chips label { position: relative; }
.chips input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.chips span { display: inline-flex; align-items: center; min-height: 38px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--line); font-weight: 700; font-size: .92rem; color: var(--muted); background: var(--surface); }
.chips input:checked + span { background: var(--ink); color: var(--surface); border-color: var(--ink); }
.chips input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }
.preview { background: var(--surface-2); border-radius: 10px; padding: 10px 12px; font-size: .92rem; font-variant-numeric: tabular-nums; }
.preview strong { font-family: var(--display); font-size: 1.1rem; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; align-items: center; padding-top: 4px; }
.actions .grow { flex: 1; }
.sheet-title { display: grid; gap: 4px; }
.stepper { display: flex; align-items: center; justify-content: center; gap: 18px; padding: 8px 0; }
.stepper button { width: 56px; height: 56px; border-radius: 50%; border: 1px solid var(--line); background: var(--surface-2); font-size: 1.6rem; font-weight: 700; }
.stepper output { font-family: var(--display); font-weight: 700; font-size: 3.2rem; min-width: 3ch; text-align: center; font-variant-numeric: tabular-nums; line-height: 1; }
.err { color: var(--danger); font-size: .9rem; margin: 0; }

/* Tab-Leiste */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
  background: var(--surface); border-top: 1px solid var(--line);
  padding: 6px 16px calc(6px + env(safe-area-inset-bottom, 0px));
}
.tabbar nav { max-width: 40rem; margin: 0 auto; display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; }
.tab { border: 0; background: transparent; display: grid; justify-items: center; gap: 2px; padding: 6px 0; min-height: 52px; color: var(--muted); font-weight: 700; font-size: .78rem; border-radius: 10px; }
.tab svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.tab[aria-current="page"] { color: var(--accent); }

#toast {
  position: fixed; left: 50%; bottom: calc(84px + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%);
  z-index: 40; max-width: calc(100% - 32px); background: var(--ink); color: var(--surface);
  padding: 10px 16px; border-radius: 999px; font-weight: 700; font-size: .92rem; box-shadow: var(--shadow);
}

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

/* Ohne Tab-Leiste (Anmeldung, Hinweise) */
body.no-tabs .tabbar { display: none; }
body.no-tabs .app { padding-bottom: calc(32px + env(safe-area-inset-bottom, 0px)); }

/* Anmeldung */
.login { display: grid; gap: 16px; margin-top: 3vh; }
.login-tag .lug-days { justify-content: center; }
.lug-icon { width: 46px; height: 46px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.login-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 18px 16px; box-shadow: var(--shadow); }
.login-card .btn.primary { width: 100%; }
.login-card .link { justify-self: center; }
.login-foot { text-align: center; }
.ok-msg { margin: 0; color: var(--ok); font-size: .9rem; }

/* Hinweise, Konto, Sicherung */
.empty.stop h1 { font-size: 1.5rem; }
.empty.stop .actions { justify-content: flex-start; }
.empty .uid { justify-self: stretch; }
#view > .link { justify-self: start; }
.note-box .actions { justify-content: flex-start; }
.note-box p.fine, .version { font-size: .82rem; color: var(--muted); }
.version { text-align: center; margin: 4px 0 0; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; overflow-wrap: anywhere; }
.uid { display: block; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .9rem; background: var(--surface-2); border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; overflow-wrap: anywhere; user-select: all; -webkit-user-select: all; }
.btn.armed { background: var(--danger); border-color: var(--danger); color: var(--surface); }
