/* Trace – ein Design für alle Seiten (Karte, Fahrtenbuch, Wochenplan, Login)
   Indigo-Akzent, ruhige Slate-/Navy-Flächen, Inter. Hell & dunkel nach Systemeinstellung. */
@font-face {
  font-family: "Inter"; font-style: normal; font-weight: 100 900; font-display: swap;
  src: url("/app/fonts/inter-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Inter"; font-style: normal; font-weight: 100 900; font-display: swap;
  src: url("/app/fonts/inter-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

:root {
  color-scheme: light;
  --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;

  --bg: #f4f5f8;
  --surface: #ffffff;
  --surface-2: #f1f3f8;
  --surface-3: #e8ebf3;
  --line: #e3e7ef;
  --text: #111827;
  --text-2: #374151;
  --muted: #6b7385;
  --accent: #5b5ef0;
  --accent-2: #4b4fe0;
  --accent-soft: rgba(91, 94, 240, .1);
  --on-accent: #ffffff;
  --danger: #dc2626;
  --warn: #a35a00;
  --warn-soft: #fff5e6;
  --ok: #15803d;
  --glass: rgba(255, 255, 255, .86);
  --shadow-sm: 0 1px 2px rgba(17, 24, 39, .05);
  --shadow: 0 1px 2px rgba(17, 24, 39, .04), 0 4px 16px rgba(17, 24, 39, .06);
  --shadow-float: 0 2px 8px rgba(17, 24, 39, .08), 0 12px 32px rgba(17, 24, 39, .12);
  --radius: 18px;
  --radius-sm: 10px;
  --ring: 0 0 0 3px rgba(91, 94, 240, .25);

  /* Namen, die der Wochenplan (Kalender-Stil) benutzt – gleiche Werte */
  --bg-elev: var(--surface);
  --bg-elev2: var(--surface-2);
  --border: var(--line);
  --text-dim: var(--muted);
  --hover: rgba(17, 24, 39, .045);
  --today-bg: rgba(91, 94, 240, .07);
  --accent-hover: #7477f5;

  /* Kategorie-Grundfarben (der Wochenplan setzt die eigenen per Server) */
  --c-zuhause: #3b82f6; --c-arbeit: #f97316; --c-einkaufen: #10b981; --c-essen: #f59e0b; --c-freizeit: #ec4899;
  --c-erledigung: #16a34a; --c-unterwegs: #8b5cf6; --c-auto: #ef4444; --c-sonst: #94a3b8; --c-gap: #eceff5;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #0e0f13;
    --surface: #16181e;
    --surface-2: #1e2129;
    --surface-3: #262a33;
    --line: #23262e;
    --text: #e9edf7;
    --text-2: #c3cadb;
    --muted: #8a93a8;
    --accent: #8083f7;
    --accent-2: #9497f9;
    --accent-soft: rgba(128, 131, 247, .16);
    --on-accent: #0b1020;
    --danger: #f87171;
    --warn: #fbbf24;
    --warn-soft: rgba(251, 191, 36, .1);
    --ok: #4ade80;
    --glass: rgba(22, 24, 30, .84);
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, .3);
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 6px 20px rgba(0, 0, 0, .25);
    --shadow-float: 0 2px 8px rgba(0, 0, 0, .35), 0 14px 36px rgba(0, 0, 0, .4);
    --ring: 0 0 0 3px rgba(128, 131, 247, .3);
    --hover: rgba(255, 255, 255, .05);
    --today-bg: rgba(128, 131, 247, .08);
    --accent-hover: #9497f9;
    --c-gap: #1b1e25;
  }
}
:root[data-theme="dark"] {
    color-scheme: dark;
    --bg: #0e0f13;
    --surface: #16181e;
    --surface-2: #1e2129;
    --surface-3: #262a33;
    --line: #23262e;
    --text: #e9edf7;
    --text-2: #c3cadb;
    --muted: #8a93a8;
    --accent: #8083f7;
    --accent-2: #9497f9;
    --accent-soft: rgba(128, 131, 247, .16);
    --on-accent: #0b1020;
    --danger: #f87171;
    --warn: #fbbf24;
    --warn-soft: rgba(251, 191, 36, .1);
    --ok: #4ade80;
    --glass: rgba(22, 24, 30, .84);
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, .3);
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 6px 20px rgba(0, 0, 0, .25);
    --shadow-float: 0 2px 8px rgba(0, 0, 0, .35), 0 14px 36px rgba(0, 0, 0, .4);
    --ring: 0 0 0 3px rgba(128, 131, 247, .3);
    --hover: rgba(255, 255, 255, .05);
    --today-bg: rgba(128, 131, 247, .08);
    --accent-hover: #9497f9;
    --c-gap: #1b1e25;
}
:root[data-theme="dark"] { color-scheme: dark; }

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--bg); color: var(--text); font-family: var(--font); font-size: 15px; line-height: 1.45;
  -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; font-feature-settings: "cv11", "ss01"; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
svg.i { width: 20px; height: 20px; fill: currentColor; flex: none; }
::selection { background: var(--accent-soft); }

/* --- Seitenkopf --- */
.page { max-width: 880px; margin: 0 auto; padding: 24px 16px 40px; }
.head { display: flex; align-items: center; gap: 12px; margin: 0 2px 20px; }
.head h1 { font-size: 26px; line-height: 1.15; letter-spacing: -.025em; margin: 0; font-weight: 700; }
.head .sub { color: var(--muted); font-size: 14px; margin-top: 3px; }
.head .grow { flex: 1; min-width: 0; }
h2 { font-size: 15px; margin: 0 0 12px; letter-spacing: -.01em; font-weight: 650; }
.eyebrow { font-size: 11.5px; font-weight: 650; color: var(--muted); text-transform: uppercase; letter-spacing: .07em; }

/* --- Flächen --- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-sm); padding: 18px; margin-bottom: 14px; }
.tiles { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0; margin-bottom: 14px; background: var(--surface);
  border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-sm); overflow: hidden; }
.tile { padding: 14px 16px; min-width: 0; border-left: 1px solid var(--line); }
.tile:first-child { border-left: 0; }
.tile .k { font-size: 12.5px; color: var(--muted); display: flex; align-items: center; gap: 6px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tile .v { font-size: 21px; font-weight: 650; letter-spacing: -.02em; margin-top: 2px; font-variant-numeric: tabular-nums;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tile .v small { font-size: 13px; font-weight: 500; color: var(--muted); margin-left: 3px; letter-spacing: 0; }
.tile .s { font-size: 12px; color: var(--muted); margin-top: 2px; }
@media (max-width: 600px) {
  .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .tile:nth-child(3) { border-left: 0; }
  .tile:nth-child(n+3) { border-top: 1px solid var(--line); }
}

/* --- Bedienelemente --- */
.seg { display: inline-flex; background: var(--surface-2); border-radius: 12px; padding: 3px; gap: 2px; max-width: 100%; overflow-x: auto; scrollbar-width: none; }
.seg::-webkit-scrollbar { display: none; }
.seg button { border: 0; background: transparent; border-radius: 9px; height: 32px; padding: 0 13px; font-size: 13.5px;
  color: var(--muted); font-weight: 550; white-space: nowrap; transition: background .15s, color .15s; }
.seg button:hover { color: var(--text); }
.seg button.on { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm), 0 0 0 1px var(--line); }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; height: 40px; padding: 0 16px;
  border-radius: 12px; border: 0; background: var(--accent); color: var(--on-accent); font-weight: 600;
  text-decoration: none; font-size: 14px; white-space: nowrap; transition: background .15s, transform .1s; }
.btn:hover { background: var(--accent-2); }
.btn:active { transform: scale(.98); }
.btn svg { width: 18px; height: 18px; fill: currentColor; }
.btn.ghost { background: var(--accent-soft); color: var(--accent); }
.btn.quiet { background: var(--surface-2); color: var(--text-2); }
.btn.small { height: 32px; padding: 0 12px; font-size: 13px; border-radius: 10px; }
.btn[aria-disabled=true] { opacity: .6; pointer-events: none; }
.icon-btn { width: 40px; height: 40px; border-radius: 12px; border: 0; background: transparent; color: var(--text-2);
  display: inline-flex; align-items: center; justify-content: center; flex: none; transition: background .15s; }
.icon-btn:hover { background: var(--hover); }
.icon-btn:disabled { opacity: .3; cursor: default; }
.field { display: flex; flex-direction: column; gap: 6px; font-size: 12.5px; color: var(--muted); font-weight: 500; }
.field input, input.in, select.in { height: 40px; padding: 0 12px; border-radius: var(--radius-sm); border: 1px solid var(--line);
  background: var(--surface); color: var(--text); font-size: 14.5px; min-width: 0; width: 100%; transition: border-color .15s, box-shadow .15s; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent) !important; box-shadow: var(--ring); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 12px; border-radius: 10px;
  border: 1px solid var(--line); background: var(--surface); font-size: 13px; color: var(--text-2); white-space: nowrap; font-weight: 500; }
.chip.on { background: var(--accent); color: var(--on-accent); border-color: var(--accent); }
.dot { width: 8px; height: 8px; border-radius: 50%; flex: none; display: inline-block; }
.badge { display: inline-flex; align-items: center; gap: 5px; font-size: 11.5px; font-weight: 600; padding: 2px 8px;
  border-radius: 999px; background: var(--surface-2); color: var(--muted); white-space: nowrap; }
.badge.warn { background: var(--warn-soft); color: var(--warn); }
.badge.accent { background: var(--accent-soft); color: var(--accent); }
.hint { font-size: 12.5px; color: var(--muted); line-height: 1.55; }
.empty { text-align: center; color: var(--muted); padding: 40px 16px; line-height: 1.5; }
.saved { box-shadow: 0 0 0 2px var(--ok) !important; }
details > summary { cursor: pointer; list-style: none; display: flex; align-items: center; gap: 8px; font-weight: 600; }
details > summary::-webkit-details-marker { display: none; }
details > summary::after { content: ""; margin-left: auto; width: 7px; height: 7px; border-right: 2px solid var(--muted);
  border-bottom: 2px solid var(--muted); transform: rotate(45deg); transition: transform .2s; }
details[open] > summary::after { transform: rotate(-135deg); }

/* --- Blatt von unten --- */
.scrim { position: fixed; inset: 0; background: rgba(8, 12, 24, .45); z-index: 3000; opacity: 0; pointer-events: none; transition: opacity .2s; }
.scrim.open { opacity: 1; pointer-events: auto; }
.sheet { position: fixed; left: 0; right: 0; bottom: 0; z-index: 3001; background: var(--surface);
  border-radius: 22px 22px 0 0; box-shadow: var(--shadow-float); padding: 10px 20px calc(24px + env(safe-area-inset-bottom));
  transform: translateY(105%); transition: transform .25s cubic-bezier(.2, .8, .2, 1); max-height: 88vh; overflow: auto; }
.sheet.open { transform: none; }
.sheet .grab { width: 36px; height: 4px; border-radius: 2px; background: var(--line); margin: 0 auto 14px; }
@media (min-width: 760px) {
  .sheet { left: 50%; width: 520px; bottom: 24px; border-radius: 22px; transform: translate(-50%, 120%); }
  .sheet.open { transform: translate(-50%, 0); }
}
