:root {
  --bg: #f5f1e8;
  --surface: #fffdf8;
  --surface-2: #efe9dc;
  --ink: #1d1b16;
  --ink-2: #4a463c;
  --muted: #7a7466;
  --line: #e2dbcb;
  --accent: #6b5a2e;
  --accent-ink: #fffdf8;
  --accent-soft: #ebe2c9;
  --good: #2f6b46;
  --good-soft: #dcebdf;
  --warn: #9a5b12;
  --warn-soft: #f4e5cc;
  --bad: #a33a35;
  --radius: 14px;
  --shadow: 0 1px 2px rgb(29 27 22 / 6%), 0 10px 30px -18px rgb(29 27 22 / 30%);
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --nav-h: 64px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #16140f;
    --surface: #1f1d17;
    --surface-2: #29261e;
    --ink: #eee8da;
    --ink-2: #cfc7b5;
    --muted: #9d9584;
    --line: #353127;
    --accent: #d8c08a;
    --accent-ink: #16140f;
    --accent-soft: #3a3324;
    --good: #7fc29a;
    --good-soft: #1f3327;
    --warn: #e0ad62;
    --warn-soft: #3a2e1b;
    --bad: #e7857f;
    --shadow: 0 1px 2px rgb(0 0 0 / 40%), 0 10px 30px -18px rgb(0 0 0 / 70%);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 16px/1.5 var(--sans); -webkit-font-smoothing: antialiased; }
a { color: inherit; }
img { max-width: 100%; display: block; }
h1, h2, h3 { font-family: var(--serif); font-weight: 600; line-height: 1.15; margin: 0; letter-spacing: -0.01em; }
h1 { font-size: clamp(1.9rem, 6vw, 2.6rem); }
h2 { font-size: 1.35rem; }
h3 { font-size: 1.05rem; }
p { margin: 0 0 0.8em; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---- Rahmen ---- */
.app { min-height: 100dvh; }
.view { padding: 24px 16px calc(var(--nav-h) + 32px + env(safe-area-inset-bottom)); max-width: 980px; margin: 0 auto; }
.nav {
  position: fixed; inset: auto 0 0 0; z-index: 10; height: calc(var(--nav-h) + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom); display: flex; justify-content: space-around; align-items: stretch;
  background: color-mix(in srgb, var(--surface) 92%, transparent); backdrop-filter: blur(12px);
  border-top: 1px solid var(--line);
}
.nav a { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; text-decoration: none; color: var(--muted); font-size: 0.72rem; font-weight: 500; }
.nav a svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.nav a[aria-current="page"] { color: var(--ink); }
.nav .brand { display: none; }
@media (min-width: 900px) {
  .nav { inset: 0 auto 0 0; width: 220px; height: 100dvh; flex-direction: column; justify-content: flex-start; gap: 4px; padding: 28px 14px; border-top: 0; border-right: 1px solid var(--line); }
  .nav a { flex: 0; flex-direction: row; justify-content: flex-start; gap: 12px; padding: 10px 12px; border-radius: 10px; font-size: 0.95rem; }
  .nav a[aria-current="page"] { background: var(--surface-2); }
  .nav .brand { display: block; font-family: var(--serif); font-size: 1.6rem; color: var(--ink); padding: 0 12px 18px; }
  .view { margin-left: 220px; padding: 40px 40px 60px; max-width: 1040px; }
  .app.auth .view { margin: 0 auto; }
}

/* ---- Bausteine ---- */
.head { margin-bottom: 22px; }
.head p { color: var(--muted); margin: 6px 0 0; max-width: 60ch; }
.section { margin-top: 30px; }
.section > h2 { margin-bottom: 12px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); }
.card + .card { margin-top: 12px; }
.muted { color: var(--muted); }
.small { font-size: 0.86rem; }
.row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.spread { justify-content: space-between; }
.grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); }
.stack > * + * { margin-top: 12px; }
.hidden { display: none !important; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; border: 1px solid var(--ink); background: var(--ink); color: var(--bg); border-radius: 999px; padding: 9px 18px; font-weight: 600; font-size: 0.92rem; cursor: pointer; text-decoration: none; white-space: nowrap; }
.btn.ghost { background: transparent; color: var(--ink); border-color: var(--line); }
.btn.small { padding: 5px 12px; font-size: 0.82rem; }
.btn.danger { background: transparent; color: var(--bad); border-color: transparent; }
.btn:disabled { opacity: 0.5; cursor: progress; }

label.field { display: flex; flex-direction: column; gap: 5px; font-size: 0.82rem; color: var(--ink-2); font-weight: 500; min-width: 0; }
input, select, textarea { width: 100%; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); }
input[type="checkbox"] { width: auto; accent-color: var(--accent); }
.form { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 180px), 1fr)); align-items: end; }
.form .wide { grid-column: 1 / -1; }
label.field.check { flex-direction: row; align-items: center; gap: 8px; font-size: 0.9rem; }

.chip { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line); border-radius: 999px; padding: 4px 11px; font-size: 0.8rem; background: var(--surface); text-decoration: none; color: var(--ink-2); }
a.chip:hover { border-color: var(--accent); color: var(--ink); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.toggle { cursor: pointer; }
.toggle input { display: none; }
.toggle:has(input:checked) { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.swatch { width: 10px; height: 10px; border-radius: 50%; border: 1px solid var(--line); display: inline-block; }
.badge { display: inline-block; font-size: 0.72rem; font-weight: 600; padding: 2px 8px; border-radius: 999px; background: var(--surface-2); color: var(--ink-2); }
.badge.good { background: var(--good-soft); color: var(--good); }
.badge.warn { background: var(--warn-soft); color: var(--warn); }

details.card > summary { cursor: pointer; font-weight: 600; list-style: none; display: flex; justify-content: space-between; align-items: center; }
details.card > summary::after { content: "+"; font-size: 1.3rem; color: var(--muted); }
details.card[open] > summary::after { content: "–"; }
details.card[open] > summary { margin-bottom: 14px; }

/* ---- Garderobe ---- */
.item { display: flex; gap: 12px; align-items: center; justify-content: space-between; padding: 12px 0; border-top: 1px solid var(--line); }
.item:first-child { border-top: 0; padding-top: 0; }
.item .t { font-weight: 600; }
.cat-title { font-family: var(--serif); font-size: 1.1rem; margin-bottom: 6px; text-transform: capitalize; }
.empty { text-align: center; padding: 34px 18px; color: var(--muted); }
.empty h3 { color: var(--ink); margin-bottom: 6px; }

/* ---- Budget ---- */
.big { font-family: var(--serif); font-size: clamp(2.4rem, 10vw, 3.4rem); line-height: 1; }
.meter { height: 8px; border-radius: 999px; background: var(--surface-2); overflow: hidden; margin: 14px 0 10px; }
.meter > i { display: block; height: 100%; background: var(--accent); border-radius: inherit; }
.meter.over > i { background: var(--bad); }
.kv { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: 10px; }
.kv div { font-size: 0.82rem; color: var(--muted); }
.kv b { display: block; color: var(--ink); font-size: 1.05rem; font-variant-numeric: tabular-nums; }

/* ---- Produkte & Uhren ---- */
.product { display: flex; flex-direction: column; overflow: hidden; padding: 0; }
.product .img { aspect-ratio: 1; background: #fff; border-bottom: 1px solid var(--line); display: grid; place-items: center; overflow: hidden; }
.product .img img { width: 100%; height: 100%; object-fit: contain; }
.product .img .ph { font-family: var(--serif); font-size: 2rem; color: #c9c0aa; }
.product .body { padding: 12px 14px 14px; display: flex; flex-direction: column; gap: 6px; flex: 1; }
.product .brand-l { font-size: 0.72rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
.product .name { font-weight: 600; line-height: 1.3; }
.product .price { font-variant-numeric: tabular-nums; font-weight: 600; }
.product .actions { margin-top: auto; padding-top: 6px; display: flex; gap: 6px; flex-wrap: wrap; }
.stars { color: var(--accent); letter-spacing: 1px; font-size: 0.85rem; }
dialog { border: 0; border-radius: var(--radius); padding: 0; max-width: min(620px, calc(100vw - 32px)); width: 100%; background: var(--surface); color: var(--ink); box-shadow: var(--shadow); }
dialog::backdrop { background: rgb(0 0 0 / 45%); }
dialog .inner { padding: 22px; max-height: 80dvh; overflow: auto; }
dl.specs { display: grid; grid-template-columns: auto 1fr; gap: 6px 16px; font-size: 0.9rem; margin: 14px 0; }
dl.specs dt { color: var(--muted); }
dl.specs dd { margin: 0; }

/* ---- Login ---- */
.auth-wrap { min-height: 80dvh; display: grid; place-items: center; }
.auth-card { max-width: 400px; width: 100%; }
.auth-card h1 { font-size: 2.6rem; }
.tabs { display: grid; grid-template-columns: 1fr 1fr; background: var(--surface-2); border-radius: 999px; padding: 4px; margin-bottom: 18px; }
.tab { border: 0; background: transparent; padding: 8px; border-radius: 999px; font-weight: 600; font-size: 0.9rem; color: var(--muted); cursor: pointer; }
.tab.on { background: var(--surface); color: var(--ink); box-shadow: 0 1px 3px rgb(0 0 0 / 12%); }
.tagline { color: var(--muted); margin: 6px 0 22px; }
.error { color: var(--bad); font-size: 0.9rem; min-height: 1.3em; margin: 8px 0 0; }
code.url { display: block; padding: 10px 12px; background: var(--surface-2); border-radius: 10px; font-size: 0.85rem; overflow-wrap: anywhere; }
ol.steps { padding-left: 1.2em; margin: 10px 0 0; }
ol.steps li { margin-bottom: 6px; }

.toast { position: fixed; left: 50%; bottom: calc(var(--nav-h) + 18px + env(safe-area-inset-bottom)); transform: translateX(-50%); background: var(--ink); color: var(--bg); padding: 10px 18px; border-radius: 999px; font-size: 0.9rem; z-index: 50; box-shadow: var(--shadow); max-width: calc(100vw - 32px); }
.spinner { width: 18px; height: 18px; border: 2px solid var(--line); border-top-color: var(--ink); border-radius: 50%; animation: spin 0.8s linear infinite; display: inline-block; vertical-align: middle; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spinner { animation-duration: 2s; } }
