/* FamilyOS – ein Stylesheet für alle Geräte.
   Umschaltpunkte: Handy bis 719 px, Tablet 720 bis 1179 px, PC ab 1180 px.
   Farben stehen ausschließlich als Variablen hier oben, damit der helle Modus
   nur diese Werte tauschen muss. */

@font-face {
  font-family: "Nunito";
  src: url("/static/fonts/nunito-latin.woff2") format("woff2");
  font-weight: 200 1000;
  font-display: swap;
}

:root {
  --bg: #0b0c1d;
  --bg-deep: #070814;
  --surface: rgba(30, 33, 66, 0.62);
  --surface-solid: #1a1d3a;
  --surface-raised: rgba(255, 255, 255, 0.06);
  --border: rgba(255, 255, 255, 0.09);
  --text: #f3f3fb;
  --text-muted: #a7a9c9;
  --accent: #7c5cff;
  --accent-strong: #6a48f2;
  --accent-soft: rgba(124, 92, 255, 0.22);
  --ok: #3ecf73;
  --danger: #ff6b76;
  --warn: #f5b942;
  --shadow: 0 18px 40px rgba(3, 4, 18, 0.45);
  --hero-sky: linear-gradient(180deg, #2a2466 0%, #6a3d8f 34%, #e0667a 62%, #f7a35c 78%, #1a1b40 100%);
  --ridge-far: #3b2f6e;
  --ridge-mid: #251f52;
  --ridge-near: #14143a;

  /* Grundfarbe halbtransparenter Flächen und der Schein hinter dem Kopfbereich */
  --ink: 11, 12, 29;
  --glow: #2a1f5c;

  --tile-calendar: linear-gradient(160deg, #8f6bff, #5b3fd4);
  --tile-tasks: linear-gradient(160deg, #4d8ef5, #2a5fc0);
  --tile-meals: linear-gradient(160deg, #f59a4a, #d2601d);
  --tile-shopping: linear-gradient(160deg, #46c46a, #1f8a40);
  --tile-finance: linear-gradient(160deg, #f0b93a, #c58410);
  --tile-documents: linear-gradient(160deg, #4aa6f0, #2874bf);
  --tile-memories: linear-gradient(160deg, #f07ab0, #c8497f);

  --radius: 18px;
  --radius-sm: 12px;
  --sidebar-w: 248px;
  --topbar-h: 68px;
  --gap: 16px;
  --pad: 28px;
  --blur: 18px;
  --tap: 44px;
}

/* Heller Modus. Welcher Modus gilt, setzt early.js vor dem ersten Zeichnen. */
[data-theme="light"] {
  --ink: 255, 255, 255;
  --glow: #d9d2ff;
  --ok: #1f8a40;
  --warn: #a8690a;
  --danger: #c92a3a;
  --bg: #eef0fb;
  --bg-deep: #e3e6f7;
  --surface: rgba(255, 255, 255, 0.78);
  --surface-solid: #ffffff;
  --surface-raised: rgba(20, 22, 60, 0.05);
  --border: rgba(20, 22, 60, 0.1);
  --text: #171936;
  --text-muted: #5b5f84;
  --accent-soft: rgba(124, 92, 255, 0.16);
  --shadow: 0 14px 30px rgba(40, 44, 100, 0.14);
  --hero-sky: linear-gradient(180deg, #8fb7ff 0%, #c9b8ff 45%, #ffd0c2 75%, #eef0fb 100%);
  --ridge-far: #b7b5e6;
  --ridge-mid: #9c9bd6;
  --ridge-near: #8482c4;
}

/* Feste Farben der Personen. */
.pc-violet { --pc: #8f6bff; }
.pc-blue { --pc: #4d8ef5; }
.pc-teal { --pc: #2bb8b0; }
.pc-green { --pc: #46c46a; }
.pc-lime { --pc: #9acb3c; }
.pc-amber { --pc: #f0b93a; }
.pc-orange { --pc: #f58a3c; }
.pc-red { --pc: #ef5a66; }
.pc-pink { --pc: #f07ab0; }
.pc-slate { --pc: #8a90ad; }

*, *::before, *::after { box-sizing: border-box; }

html { color-scheme: dark; -webkit-text-size-adjust: 100%; }
[data-theme="light"] { color-scheme: light; }

body {
  margin: 0;
  min-height: 100dvh;
  font-family: "Nunito", system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: 16px;
  line-height: 1.45;
  color: var(--text);
  background: radial-gradient(1200px 700px at 70% -10%, var(--glow) 0%, transparent 60%), linear-gradient(180deg, var(--bg) 0%, var(--bg-deep) 100%) fixed;
  background-color: var(--bg);
}

h1, h2, p, ul, figure { margin: 0; }
ul { padding: 0; list-style: none; }
a { color: inherit; text-decoration: none; }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }

.visually-hidden, .visually-hidden-unless-focus:not(:focus) {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip-path: inset(50%); white-space: nowrap;
}

.muted { color: var(--text-muted); }
.small { font-size: 0.85rem; }
.clip { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.grow { flex: 1 1 auto; min-width: 0; }

.icon {
  width: 1.35em; height: 1.35em; flex: none;
  fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round;
}
.icon-xl { width: 3rem; height: 3rem; color: var(--accent); }

/* ---------- Glas-Flächen ---------- */

.widget, .panel, .card, .topbar .search, .menu {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  -webkit-backdrop-filter: blur(var(--blur));
  backdrop-filter: blur(var(--blur));
}

/* Abschaltbar je Gerät, falls ein älteres Tablet beim Scrollen ruckelt. */
.no-glass .widget, .no-glass .panel, .no-glass .card, .no-glass .topbar .search,
.no-glass .menu, .no-glass .topbar, .no-glass .bottombar, .no-glass .sidebar {
  -webkit-backdrop-filter: none; backdrop-filter: none;
  background: var(--surface-solid);
}

/* ---------- Grundaufbau ---------- */

.app { display: grid; grid-template-columns: var(--sidebar-w) minmax(0, 1fr); min-height: 100dvh; }

.sidebar {
  position: sticky; top: 0; height: 100dvh; z-index: 30;
  display: flex; flex-direction: column; gap: 6px;
  padding: 18px 12px;
  background: linear-gradient(180deg, rgba(14, 15, 38, 0.92), rgba(14, 15, 38, 0.7));
  border-right: 1px solid var(--border);
  overflow-y: auto;
}
[data-theme="light"] .sidebar { background: rgba(255, 255, 255, 0.7); }

.brand { display: flex; align-items: center; gap: 10px; padding: 6px 10px 18px; font-size: 1.5rem; font-weight: 800; letter-spacing: -0.01em; }
.brand-mark { width: 2rem; height: 2rem; color: #37d6c0; stroke-width: 2.4; }
.brand-mobile { display: none; padding: 0; }

.nav { display: flex; flex-direction: column; gap: 4px; flex: 1; }
.nav-item {
  display: flex; align-items: center; gap: 14px;
  min-height: var(--tap); padding: 8px 14px;
  border-radius: var(--radius-sm); font-weight: 600; color: var(--text-muted);
}
.nav-item:hover { background: var(--surface-raised); color: var(--text); }
.nav-item.is-active { background: linear-gradient(135deg, var(--accent), var(--accent-strong)); color: #fff; box-shadow: 0 8px 20px rgba(106, 72, 242, 0.4); }
.nav-item .icon { width: 1.5em; height: 1.5em; }
.nav-calendar .icon { color: #9d83ff; } .nav-tasks .icon { color: #f5b942; } .nav-meals .icon { color: #f59a4a; }
.nav-shopping .icon { color: #46c46a; } .nav-finance .icon { color: #f0b93a; } .nav-documents .icon { color: #6bb8f5; }
.nav-memories .icon { color: #f07ab0; } .nav-item.is-active .icon { color: #fff; }
.nav-section { margin: 18px 14px 6px; font-size: 0.78rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--text-muted); }

.sidebar-toggle {
  align-self: flex-start; display: grid; place-items: center;
  width: var(--tap); height: var(--tap); margin-left: 4px;
  background: none; border: 0; border-radius: var(--radius-sm); color: var(--text-muted);
}
.sidebar-toggle:hover { background: var(--surface-raised); color: var(--text); }

/* Eingeklappte Seitenleiste: nur Symbole. */
html[data-sidebar="collapsed"] { --sidebar-w: 76px; }
html[data-sidebar="collapsed"] .sidebar .label { display: none; }
html[data-sidebar="collapsed"] .sidebar .nav-item,
html[data-sidebar="collapsed"] .sidebar .brand { justify-content: center; padding-inline: 0; }
html[data-sidebar="collapsed"] .sidebar-toggle { align-self: center; margin-left: 0; }

.main { position: relative; min-width: 0; display: flex; flex-direction: column; }

/* Stimmungsbild hinter dem Kopfbereich. Vorerst ein Farbverlauf mit Bergrücken,
   bis ein eigenes Foto hinterlegt ist. */
.main::before {
  content: ""; position: absolute; inset: 0 0 auto 0; height: 340px; z-index: 0; pointer-events: none;
  background:
    url("/static/img/hero-ridges.svg") bottom center / 100% 62% no-repeat,
    var(--hero-sky);
  -webkit-mask-image: linear-gradient(180deg, #000 55%, transparent 100%);
  mask-image: linear-gradient(180deg, #000 55%, transparent 100%);
  opacity: 0.9;
}
.main > * { position: relative; z-index: 1; }

.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 18px;
  height: var(--topbar-h); padding: 0 var(--pad);
  background: rgba(var(--ink), 0.72);
  -webkit-backdrop-filter: blur(var(--blur)); backdrop-filter: blur(var(--blur));
  border-bottom: 1px solid var(--border);
}
[data-theme="light"] .topbar { background: rgba(255, 255, 255, 0.72); }

.topbar .search {
  display: flex; align-items: center; gap: 10px;
  flex: 0 1 440px; min-width: 0; height: var(--tap); padding: 0 14px;
  border-radius: 14px; box-shadow: none; color: var(--text-muted);
}
.search input { flex: 1; min-width: 0; background: none; border: 0; outline: 0; color: var(--text); }
.search input::placeholder { color: var(--text-muted); }
.search:focus-within { border-color: var(--accent); }
kbd { padding: 2px 8px; border-radius: 6px; background: var(--surface-raised); font: inherit; font-size: 0.8rem; white-space: nowrap; }

.topbar-info { display: flex; align-items: center; gap: 22px; margin-left: auto; font-weight: 700; white-space: nowrap; }
.topbar > .icon-button, .topbar > .profile { flex: none; }
.topbar-date, .topbar-time { display: flex; align-items: center; gap: 8px; }
.weather:empty { display: none; }

.icon-button { display: grid; place-items: center; width: var(--tap); height: var(--tap); border-radius: 50%; }
.icon-button:hover { background: var(--surface-raised); }

.avatar {
  display: inline-grid; place-items: center; flex: none;
  width: 2.4rem; height: 2.4rem; border-radius: 50%;
  background: var(--pc, var(--accent)); color: #fff; font-weight: 800;
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.28);
}
.avatar-lg { width: 3.4rem; height: 3.4rem; font-size: 1.3rem; }
.avatar-xl { width: 5.5rem; height: 5.5rem; font-size: 2.2rem; }

.profile { position: relative; }
.profile summary { display: flex; align-items: center; gap: 10px; min-height: var(--tap); padding: 2px 6px; border-radius: 999px; cursor: pointer; list-style: none; font-weight: 700; }
.profile summary::-webkit-details-marker { display: none; }
.profile summary:hover { background: var(--surface-raised); }
.menu { position: absolute; right: 0; top: calc(100% + 8px); min-width: 220px; padding: 8px; background: var(--surface-solid); }
.menu-item { display: flex; align-items: center; gap: 10px; width: 100%; min-height: var(--tap); padding: 8px 12px; background: none; border: 0; border-radius: var(--radius-sm); text-align: left; }
.menu-item:hover { background: var(--surface-raised); }

.page { flex: 1; padding: 0 var(--pad) var(--pad); }

.bottombar, .drawer-backdrop { display: none; }

/* ---------- Startseite ---------- */

.hero { padding: 30px 4px 22px; text-shadow: 0 2px 14px rgba(8, 8, 30, 0.55); }
.hero h1 { font-size: clamp(1.7rem, 2.6vw, 2.5rem); font-weight: 800; letter-spacing: -0.01em; }
.hero p { margin-top: 2px; font-size: 1.15rem; }

.home { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: var(--gap); align-items: start; }
.home-single { grid-template-columns: minmax(0, 1fr); }
.home-main { display: grid; gap: var(--gap); min-width: 0; }
.home-side { display: grid; gap: var(--gap); }

.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: 14px; }
.tile {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
  min-height: 94px; padding: 12px 8px; border-radius: var(--radius);
  color: #fff; font-weight: 800;
  box-shadow: 0 12px 26px rgba(3, 4, 18, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.35);
  transition: transform 0.15s ease, filter 0.15s ease;
}
.tile:hover { transform: translateY(-2px); filter: brightness(1.08); }
.tile .icon { width: 2.1rem; height: 2.1rem; stroke-width: 2.2; }
.tile-calendar { background: var(--tile-calendar); } .tile-tasks { background: var(--tile-tasks); }
.tile-meals { background: var(--tile-meals); } .tile-shopping { background: var(--tile-shopping); }
.tile-finance { background: var(--tile-finance); } .tile-documents { background: var(--tile-documents); }
.tile-memories { background: var(--tile-memories); }

.widgets { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: var(--gap); grid-auto-flow: dense; }
.widget { grid-column: span 4; min-height: 150px; padding: 18px 20px; min-width: 0; }
.w-today, .w-meal, .w-tasks { grid-column: span 4; }
.w-calendar { grid-column: span 5; grid-row: span 2; }
.w-shopping { grid-column: span 4; } .w-trips { grid-column: span 3; }
.w-savings { grid-column: span 7; }
.home-side .widget { grid-column: auto; }
/* Zwei Klassen, damit die Spaltenregeln der Widgets weiter unten das nicht überstimmen. */
.home > .home-footer { grid-column: 1 / -1; min-height: 0; }

.widget-head { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.widget-head h2 { flex: 1; min-width: 0; font-size: 1.12rem; font-weight: 800; }
.widget-head h2 .muted { font-weight: 600; }
.widget-icon { width: 1.5rem; height: 1.5rem; color: var(--accent); }
.w-meal .widget-icon, .w-tasks .widget-icon, .w-finance .widget-icon { color: var(--warn); }
.w-shopping .widget-icon { color: var(--ok); } .w-trips .widget-icon { color: #6bb8f5; }
.w-savings .widget-icon, .w-family .widget-icon { color: #f07ab0; }
.widget-link { display: grid; place-items: center; width: 36px; height: 36px; margin: -6px -8px -6px 0; background: none; border: 0; border-radius: 50%; color: var(--text-muted); }
.widget-link:hover { background: var(--surface-raised); color: var(--text); }
.widget-empty { color: var(--text-muted); }
.widget-more { display: flex; align-items: center; justify-content: flex-end; gap: 8px; margin-top: 12px; font-weight: 700; }

.widget-skeleton { height: 100%; min-height: 110px; border-radius: var(--radius-sm); background: linear-gradient(100deg, transparent 30%, var(--surface-raised) 50%, transparent 70%) 0 0 / 220% 100%; animation: shimmer 1.4s linear infinite; }
@keyframes shimmer { to { background-position: -220% 0; } }

.month { width: 100%; border-collapse: collapse; table-layout: fixed; text-align: center; }
.month th { padding: 4px 0 8px; font-size: 0.85rem; font-weight: 700; color: var(--text-muted); }
.month td { padding: 3px 0; }
.month td span { display: inline-grid; place-items: center; width: 2.1rem; height: 2.1rem; border-radius: 50%; font-weight: 600; }
.month .is-other { color: var(--text-muted); opacity: 0.55; }
.month .is-today span { background: var(--accent); color: #fff; box-shadow: 0 6px 16px rgba(106, 72, 242, 0.5); }

.finance-figures { display: flex; justify-content: space-between; gap: 12px; }
.finance-figures strong { display: block; font-size: 1.35rem; font-weight: 800; }
.finance-figures span { font-size: 0.85rem; color: var(--text-muted); }
.finance-figures .is-expense { text-align: right; } .finance-figures .is-expense strong { color: var(--danger); }
.finance-balance { width: fit-content; margin: 12px auto; padding: 4px 16px; border: 1px solid var(--ok); border-radius: 10px; font-weight: 800; color: var(--ok); }
.finance-balance.is-negative { border-color: var(--danger); color: var(--danger); }
.finance-bar { display: block; width: 100%; height: 10px; }
.bar-income { fill: var(--ok); } .bar-expense { fill: var(--danger); }

.family { display: flex; flex-wrap: wrap; gap: 14px 18px; }
.family li { display: grid; justify-items: center; gap: 6px; font-weight: 600; font-size: 0.95rem; }

.quick { display: flex; align-items: center; flex-wrap: wrap; gap: 10px 0; }
.quick-title { display: flex; align-items: center; gap: 10px; padding-right: 28px; }
.quick-title h2 { font-size: 1.12rem; font-weight: 800; }
.quick-item { display: flex; align-items: center; gap: 10px; flex: 1 1 200px; min-height: var(--tap); padding: 4px 24px; border-left: 1px solid var(--border); color: var(--text-muted); }
.quick-item strong { font-size: 1.3rem; color: var(--text); }
.quick-item .icon { color: var(--accent); }

/* ---------- Seiten, Formulare, Adminbereich ---------- */

.panel { padding: 22px 24px; }
.panel h2 { margin-bottom: 10px; font-size: 1.15rem; font-weight: 800; }
.panel-center, .panel-narrow { display: grid; justify-items: center; gap: 14px; max-width: 520px; margin: 60px auto 0; text-align: center; }
.panel-narrow form { width: 100%; text-align: left; }
.panel-center h1, .panel-narrow h1 { font-size: 1.5rem; }

.stack { display: grid; gap: 14px; }
.row { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 10px; margin-top: 10px; }
.field { display: grid; gap: 6px; border: 0; padding: 0; margin: 0; font-weight: 700; }
.field > span, .field > legend { font-size: 0.9rem; color: var(--text-muted); padding: 0; }
input[type="text"], input[type="password"], input[type="date"], input[type="number"], select {
  width: 100%; min-height: var(--tap); padding: 8px 14px;
  background: var(--surface-raised); border: 1px solid var(--border); border-radius: var(--radius-sm);
}
.row input[type="text"] { flex: 1 1 200px; width: auto; }
input:focus, select:focus { outline: 2px solid var(--accent); outline-offset: 0; }
.check { display: flex; align-items: center; gap: 10px; min-height: var(--tap); font-weight: 600; }
.check input { width: 20px; height: 20px; accent-color: var(--accent); }

.button {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: var(--tap); padding: 8px 18px;
  background: var(--surface-raised); border: 1px solid var(--border); border-radius: var(--radius-sm);
  font-weight: 700;
}
.button:hover { filter: brightness(1.15); }
.button-primary { background: linear-gradient(135deg, var(--accent), var(--accent-strong)); border-color: transparent; color: #fff; }
.button-danger { border-color: var(--danger); color: var(--danger); }
.button:disabled { opacity: 0.5; cursor: not-allowed; }

.alert { padding: 12px 16px; border: 1px solid var(--danger); border-radius: var(--radius-sm); background: rgba(255, 107, 118, 0.12); font-weight: 600; }
.alert-ok { border-color: var(--ok); background: rgba(62, 207, 115, 0.12); }

.badge { padding: 2px 10px; border-radius: 999px; background: var(--surface-raised); font-size: 0.8rem; font-weight: 700; white-space: nowrap; }
.badge-ok { background: rgba(62, 207, 115, 0.18); color: var(--ok); }
.badge-danger { background: rgba(255, 107, 118, 0.18); color: var(--danger); }

.admin { display: grid; gap: var(--gap); padding-top: 26px; max-width: 1100px; }
.admin-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; }
.admin-head h1 { font-size: 1.8rem; font-weight: 800; text-shadow: 0 2px 14px rgba(8, 8, 30, 0.55); }
.tabs { display: flex; flex-wrap: wrap; gap: 6px; padding: 5px; max-width: 100%; border-radius: 14px; background: rgba(var(--ink), 0.6); border: 1px solid var(--border); }
.tabs a { display: flex; align-items: center; min-height: 38px; padding: 4px 14px; border-radius: 10px; font-weight: 700; color: var(--text-muted); white-space: nowrap; }
.tabs a.is-active { background: var(--accent); color: #fff; }
.back { display: inline-flex; align-items: center; gap: 6px; min-height: var(--tap); font-weight: 700; color: var(--text-muted); }

.cards { display: grid; gap: 12px; }
.columns { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: var(--gap); align-items: start; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: var(--gap); }
.stat { display: grid; gap: 2px; }
.stat strong { font-size: 2rem; font-weight: 800; }
.stat small { color: var(--text-muted); }
.device-head { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-bottom: 6px; }
.device-head h2 { margin: 0; }
.person-row { display: flex; align-items: center; gap: 14px; padding: 12px 18px; }
.person-row .person-name { flex: 1; font-weight: 800; font-size: 1.1rem; }
.person-row.is-inactive { opacity: 0.6; }
.swatches { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 6px; }
.swatch { display: grid; place-items: center; width: var(--tap); height: var(--tap); border-radius: 50%; background: var(--pc); cursor: pointer; }
.swatch input { appearance: none; width: 100%; height: 100%; margin: 0; border-radius: 50%; cursor: pointer; }
.swatch input:checked { box-shadow: 0 0 0 3px var(--bg), 0 0 0 6px var(--pc); }
.widget-settings { display: grid; gap: 4px; margin-bottom: 14px; }
.widget-settings li { display: flex; align-items: center; gap: 10px; }
.position { width: 76px !important; text-align: center; }
.table-wrap { overflow-x: auto; padding: 8px; }
.table { width: 100%; border-collapse: collapse; font-size: 0.92rem; }
.table th, .table td { padding: 8px 12px; text-align: left; border-bottom: 1px solid var(--border); white-space: nowrap; }
.table th { color: var(--text-muted); font-weight: 700; }
.qr { padding: 12px; background: #fff; border-radius: var(--radius-sm); line-height: 0; }
.secret { padding: 8px 14px; border-radius: var(--radius-sm); background: var(--surface-raised); font-size: 1.05rem; letter-spacing: 0.08em; word-break: break-all; }

/* ---------- Anmeldung ---------- */

body.session {
  background:
    url("/static/img/hero-ridges.svg") bottom center / 100% 46% no-repeat fixed,
    var(--hero-sky) fixed;
  background-color: var(--bg);
}
.session-page { display: grid; justify-items: center; align-content: center; gap: 20px; min-height: 100dvh; padding: 32px 20px; text-align: center; }
.session-brand { display: flex; align-items: center; gap: 12px; font-size: 2rem; font-weight: 800; text-shadow: 0 2px 14px rgba(8, 8, 30, 0.55); }
.session-brand .brand-mark { width: 2.6rem; height: 2.6rem; }
.session-title { font-size: 1.6rem; font-weight: 800; text-shadow: 0 2px 14px rgba(8, 8, 30, 0.45); }
.session-link { display: inline-flex; align-items: center; min-height: var(--tap); font-weight: 700; text-decoration: underline; text-underline-offset: 4px; }
.card { display: grid; justify-items: center; gap: 16px; width: min(100%, 400px); padding: 28px; }
.card .field, .card .button { width: 100%; text-align: left; }
.card .button { justify-content: center; }
.session .alert { width: min(100%, 400px); background: rgba(60, 12, 30, 0.75); }

.profiles { display: flex; flex-wrap: wrap; justify-content: center; gap: 18px; max-width: 860px; }
.profile-card { display: grid; justify-items: center; gap: 10px; width: 132px; padding: 18px 8px; border-radius: var(--radius); font-weight: 800; font-size: 1.1rem; transition: transform 0.15s ease, background 0.15s ease; }
.profile-card:hover, .profile-card:focus-visible { background: rgba(var(--ink), 0.45); transform: translateY(-3px); }

.pin-input { width: 100%; text-align: center; font-size: 1.8rem; letter-spacing: 0.5em; }
.pin-pad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; width: 100%; }
.pin-pad button { min-height: 62px; background: var(--surface-raised); border: 1px solid var(--border); border-radius: var(--radius-sm); font-size: 1.5rem; font-weight: 800; }
.pin-pad button:active { background: var(--accent-soft); }
.pin-pad .pin-ok { background: linear-gradient(135deg, var(--accent), var(--accent-strong)); border-color: transparent; color: #fff; }

/* ---------- Wand-Tablet: nur Anzeige, große Schrift ---------- */

.wall { font-size: 20px; }
.wall .sidebar, .wall .search, .wall .bottombar { display: none; }
.wall .app { grid-template-columns: minmax(0, 1fr); }

/* ---------- Tablet ---------- */

@media (max-width: 1179px) {
  :root { --pad: 20px; }
  .home { grid-template-columns: minmax(0, 1fr); }
  .home-side { grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
  .widgets { grid-template-columns: repeat(6, minmax(0, 1fr)); }
  .widget, .w-today, .w-meal, .w-tasks, .w-shopping, .w-trips { grid-column: span 3; }
  .w-calendar { grid-column: span 3; grid-row: span 2; }
  .w-savings { grid-column: span 3; }
  .topbar-info { gap: 14px; }
}

/* Tablet im Hochformat: Seitenleiste auf Symbole reduziert, solange niemand sie aufklappt. */
@media (min-width: 720px) and (max-width: 1179px) and (orientation: portrait) {
  html:not([data-sidebar="expanded"]) { --sidebar-w: 76px; }
  html:not([data-sidebar="expanded"]) .sidebar .label { display: none; }
  html:not([data-sidebar="expanded"]) .sidebar .nav-item,
  html:not([data-sidebar="expanded"]) .sidebar .brand { justify-content: center; padding-inline: 0; }
  html:not([data-sidebar="expanded"]) .sidebar-toggle { align-self: center; margin-left: 0; }
  .topbar .search kbd { display: none; }
}

/* ---------- Handy ---------- */

@media (max-width: 719px) {
  :root { --pad: 14px; --topbar-h: 60px; --gap: 12px; }
  .app { grid-template-columns: minmax(0, 1fr); padding-bottom: calc(64px + env(safe-area-inset-bottom)); }

  /* Die Seitenleiste wird zur Schublade hinter "Mehr". */
  .sidebar { position: fixed; inset: 0 auto 0 0; width: min(82vw, 300px); transform: translateX(-102%); transition: transform 0.2s ease; background: var(--surface-solid); }
  .sidebar .label { display: revert !important; }
  .sidebar .nav-item, .sidebar .brand { justify-content: flex-start !important; padding-inline: 14px !important; }
  .sidebar-toggle { display: none; }
  .drawer-open .sidebar { transform: none; }
  .drawer-open .drawer-backdrop { display: block; position: fixed; inset: 0; z-index: 25; background: rgba(4, 5, 16, 0.6); }

  .brand-mobile { display: flex; }
  .topbar { gap: 10px; }
  .topbar .search { flex: 1 1 0; }
  /* Datum, Uhrzeit und der Strg+K-Hinweis entfallen am Handy. */
  .topbar-date, .topbar-time, .search kbd, .profile-name, .profile summary > .icon { display: none; }
  .topbar-info { margin-left: 0; }

  .main::before { height: 240px; }
  .hero { padding: 20px 2px 16px; }
  .hero p { font-size: 1rem; }

  /* App-Kacheln als waagerechte Wischreihe. */
  .tiles { display: flex; gap: 10px; margin-inline: calc(var(--pad) * -1); padding: 4px var(--pad) 8px; overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none; }
  .tiles::-webkit-scrollbar { display: none; }
  .tile { flex: 0 0 104px; min-height: 88px; scroll-snap-align: start; }

  .widgets, .home-side { grid-template-columns: minmax(0, 1fr); }
  .widget, .w-today, .w-meal, .w-tasks, .w-calendar, .w-shopping, .w-trips, .w-savings { grid-column: auto; grid-row: auto; }
  /* Leere Widgets sollen am Handy nicht den halben Bildschirm füllen. */
  .widget { min-height: 0; }
  .quick-title { flex: 1 1 100%; }
  .quick-item { flex: 1 1 100%; padding-left: 0; border-left: 0; border-top: 1px solid var(--border); }

  .bottombar {
    position: fixed; inset: auto 0 0 0; z-index: 22;
    display: grid; grid-auto-flow: column; grid-auto-columns: 1fr;
    padding: 6px 6px calc(6px + env(safe-area-inset-bottom));
    background: rgba(var(--ink), 0.88);
    -webkit-backdrop-filter: blur(var(--blur)); backdrop-filter: blur(var(--blur));
    border-top: 1px solid var(--border);
  }
  [data-theme="light"] .bottombar { background: rgba(255, 255, 255, 0.9); }
  .bottom-item { display: grid; justify-items: center; gap: 2px; min-height: 52px; padding: 6px 2px; background: none; border: 0; border-radius: var(--radius-sm); font-size: 0.74rem; font-weight: 700; color: var(--text-muted); }
  .bottom-item .icon { width: 1.5rem; height: 1.5rem; }
  .bottom-item.is-active { color: #fff; background: var(--accent-soft); }

  .admin { padding-top: 16px; }
  .panel-center, .panel-narrow { margin-top: 24px; }
}

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

/* ---------- Passkeys ---------- */

.passkey-box { width: 100%; }
.passkey-box .button { width: 100%; }
.divider { display: flex; align-items: center; gap: 12px; width: 100%; font-size: 0.9rem; }
.divider::before, .divider::after { content: ""; flex: 1; height: 1px; background: var(--border); }
[hidden] { display: none !important; }

/* ---------- Bereichsseiten: Kopf, Werkzeugleiste, Formulare ---------- */

.section { display: grid; gap: var(--gap); padding-top: 26px; }
.section-narrow { max-width: 720px; }
.section-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; }
.section-head h1 { font-size: clamp(1.5rem, 2.2vw, 2rem); font-weight: 800; text-shadow: 0 2px 14px rgba(8, 8, 30, 0.55); }
.section-head h1 .muted { font-size: 1rem; font-weight: 600; color: var(--text); opacity: 0.8; }
.toolbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; }
.pager { display: flex; align-items: center; gap: 6px; }
.pager .icon-button { background: rgba(var(--ink), 0.6); border: 1px solid var(--border); }
.actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 10px; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
textarea { width: 100%; padding: 10px 14px; background: var(--surface-raised); border: 1px solid var(--border); border-radius: var(--radius-sm); font: inherit; color: inherit; resize: vertical; }
input[type="time"] { width: 100%; min-height: var(--tap); padding: 8px 14px; background: var(--surface-raised); border: 1px solid var(--border); border-radius: var(--radius-sm); }
.pre { white-space: pre-wrap; }
.plain { display: grid; gap: 6px; margin-top: 10px; }
.alert ul { margin-top: 6px; padding-left: 18px; list-style: disc; font-weight: 500; }
.alert a { text-decoration: underline; }
.alert-warn { border-color: var(--warn); background: rgba(245, 185, 66, 0.12); }
details.panel > summary { min-height: var(--tap); display: flex; align-items: center; font-weight: 700; cursor: pointer; }
details.panel[open] > summary { margin-bottom: 8px; }
.danger-zone > summary { color: var(--danger); }
.danger-zone form { margin-top: 12px; }

.dot { display: inline-block; flex: none; width: 10px; height: 10px; border-radius: 50%; background: var(--pc, var(--accent)); }
.pc-family { --pc: #b79cff; }
.pc-holiday { --pc: #37d6c0; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { display: inline-flex; align-items: center; gap: 8px; min-height: 38px; padding: 4px 14px; border-radius: 999px; background: rgba(var(--ink), 0.6); border: 1px solid var(--border); font-weight: 700; font-size: 0.92rem; }
.chip.is-active { background: var(--accent); border-color: transparent; color: #fff; }
.chip-check { min-height: var(--tap); cursor: pointer; }
.chip-check input { width: 18px; height: 18px; accent-color: var(--accent); }
.chip-check:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }

.facts { display: grid; gap: 14px; }
.fact { display: grid; grid-template-columns: 1.6rem minmax(0, 1fr); gap: 12px; align-items: start; }
.fact > .icon { margin-top: 2px; color: var(--text-muted); }

/* ---------- Kalender ---------- */

.cal-item { display: flex; align-items: center; gap: 6px; min-width: 0; padding: 3px 6px; border-radius: 8px; font-size: 0.86rem; line-height: 1.3; }
.cal-item:hover { background: var(--surface-raised); }
.cal-item .dots { display: inline-flex; gap: 2px; flex: none; }
.cal-time { flex: none; font-weight: 700; font-variant-numeric: tabular-nums; }
.cal-title { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cal-place { margin-left: auto; padding-left: 10px; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cal-item.kind-holiday .cal-title { color: #7fe6d6; }
.cal-item.kind-birthday .cal-title::before { content: "🎂 "; }

.cal-month { padding: 10px; }
.cal-weekdays, .cal-week { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); }
.cal-weekdays span { padding: 6px 8px; font-size: 0.85rem; font-weight: 700; color: var(--text-muted); }
.cal-cell { min-height: 112px; padding: 4px; border-top: 1px solid var(--border); border-left: 1px solid var(--border); min-width: 0; }
.cal-cell:first-child { border-left: 0; }
.cal-cell.is-other { opacity: 0.45; }
.cal-daynum { display: inline-grid; place-items: center; min-width: 1.9rem; height: 1.9rem; margin-bottom: 2px; border-radius: 50%; font-weight: 700; }
.cal-daynum:hover { background: var(--surface-raised); }
.is-today > .cal-daynum { background: var(--accent); color: #fff; }
.cal-more { display: block; padding: 2px 6px; font-size: 0.8rem; color: var(--text-muted); }

.cal-weekview { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 10px; align-items: start; }
.cal-daycol { padding: 12px 8px; min-height: 220px; }
.cal-daycol h2, .cal-list h2 { margin-bottom: 8px; font-size: 1rem; font-weight: 700; }
.cal-daycol.is-today, .cal-list .is-today { border-color: var(--accent); }
.cal-daycol .cal-item { flex-wrap: wrap; }
.cal-daycol .cal-place { flex-basis: 100%; margin: 0; padding-left: 16px; }
.cal-list { display: grid; gap: 10px; }
.cal-list .cal-item { min-height: var(--tap); font-size: 1rem; padding: 6px 8px; }

@media (max-width: 1179px) {
  .cal-weekview { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
@media (max-width: 719px) {
  .section { padding-top: 16px; }
  .grid-2 { grid-template-columns: minmax(0, 1fr); }
  .cal-weekview { grid-template-columns: minmax(0, 1fr); }
  .cal-daycol { min-height: 0; }
  /* Im Monat bleiben am Handy nur die Punkte, der Tag öffnet die Liste. */
  .cal-month { padding: 4px; }
  .cal-cell { min-height: 58px; padding: 2px; display: flex; flex-wrap: wrap; align-content: flex-start; gap: 2px; }
  .cal-cell .cal-daynum { flex-basis: 100%; }
  .cal-cell .cal-item { padding: 0; }
  .cal-cell .cal-time, .cal-cell .cal-title, .cal-more { display: none; }
  .chips { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
  .chips .chip { flex: none; }
  fieldset .chips { flex-wrap: wrap; }
}

.today-list { display: grid; gap: 2px; }
.today-list .cal-item { font-size: 0.98rem; padding: 6px 8px; }
.month td a { display: inline-block; border-radius: 50%; }
.month td a:hover span { background: var(--surface-raised); }
.month .is-today a:hover span { background: var(--accent); }
.month-dots { display: flex; justify-content: center; gap: 2px; height: 6px; }
.month-dots .dot { width: 5px; height: 5px; }
.sub { padding: 14px 0; border-top: 1px solid var(--border); }
.sub h3 { margin: 0; font-size: 1.05rem; }
.sub-new { margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--border); }
.inline-confirm > summary { list-style: none; cursor: pointer; }
.inline-confirm > summary::-webkit-details-marker { display: none; }
.inline-confirm[open] > summary { display: none; }
input[type="file"] { width: 100%; min-height: var(--tap); padding: 8px; background: var(--surface-raised); border: 1px solid var(--border); border-radius: var(--radius-sm); }
@media (max-width: 719px) {
  .cal-cell .cal-daynum { flex: 0 0 1.9rem; margin-right: calc(100% - 1.9rem); }
}

/* Schmale PC-Fenster: neben der rechten Spalte passen nur zwei Widgets nebeneinander. */
@media (min-width: 1180px) and (max-width: 1519px) {
  .home { grid-template-columns: minmax(0, 1fr) 320px; }
  .widgets { grid-template-columns: repeat(6, minmax(0, 1fr)); }
  .widget, .w-today, .w-meal, .w-tasks, .w-shopping, .w-trips, .w-savings { grid-column: span 3; }
  .w-calendar { grid-column: span 3; grid-row: span 2; }
}

/* ---------- Aufgaben ---------- */

.panel-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
.panel-head h2 { margin: 0; }
.panel h3 { margin: 16px 0 8px; font-size: 1rem; font-weight: 800; }
.panel.is-today { border-color: var(--accent); }
.tasks { display: grid; }
.task { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; padding: 10px 0; border-top: 1px solid var(--border); }
.task:first-child { border-top: 0; }
.task-main { display: grid; gap: 2px; flex: 1 1 220px; min-width: 0; }
.task-actions { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 8px; }
.task.status-confirmed .task-main strong { text-decoration: line-through; opacity: 0.6; }
.task-reason { color: var(--warn); font-size: 0.9rem; }
.task-return { flex-basis: 100%; }
.task-return > summary { width: fit-content; min-height: 36px; display: flex; align-items: center; color: var(--text-muted); font-weight: 700; cursor: pointer; }
.count { padding: 1px 10px; border-radius: 999px; background: var(--accent); color: #fff; font-weight: 800; font-size: 0.9rem; }
.widget-note { margin-bottom: 8px; font-weight: 700; color: var(--warn); }
.widget-note a { text-decoration: underline; }
.task-mini { display: grid; gap: 6px; }
.task-mini li { display: flex; align-items: center; gap: 8px; min-width: 0; }
.task-mini .is-overdue { color: var(--danger); }
.points-total { margin-top: 0; max-width: none; gap: 4px; }
.points-number { font-size: 3rem; font-weight: 800; line-height: 1.1; }
.journal { display: grid; }
.journal li { display: grid; grid-template-columns: 6.2rem minmax(0, 1fr) auto; gap: 12px; align-items: baseline; padding: 8px 0; border-top: 1px solid var(--border); }
.journal li:first-child { border-top: 0; }
.is-plus { color: var(--ok); }
.is-minus { color: var(--danger); }
.stats-rows { display: grid; gap: 14px; }
.stats-rows li { display: flex; align-items: center; gap: 12px; }
.stats-line { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 6px; margin-bottom: 4px; }
meter { width: 100%; height: 12px; }
details.sub > summary { min-height: var(--tap); display: flex; align-items: center; gap: 8px; cursor: pointer; }
details.sub[open] > summary { margin-bottom: 10px; }
form.sub { align-items: flex-end; }
.points-total { margin: 0; }
.day-head { margin: 14px 0 0; padding-top: 12px; border-top: 1px solid var(--border); color: var(--text-muted); font-size: 0.9rem; }
.day-head:first-of-type { border-top: 0; padding-top: 0; margin-top: 4px; }
.day-head + .tasks .task { padding: 6px 0; }

/* ---------- Einkaufsliste ---------- */

.sync-status { padding: 10px 14px; border-radius: var(--radius-sm); background: var(--surface-solid); border: 1px solid var(--border); font-weight: 700; }
.sync-status.is-offline { border-color: var(--warn); color: var(--warn); }
.sync-status.is-login { border-color: var(--danger); color: var(--danger); }
.shop-add { display: flex; align-items: flex-end; gap: 10px; padding: 12px; }
.shop-add .field:nth-child(2) { flex: 0 1 130px; }
.shop-head { margin: 14px 0 2px; font-size: 0.82rem; font-weight: 800; letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-muted); }
.shop-head:first-child { margin-top: 0; }
.shop-list { display: grid; }
.shop-item { display: flex; align-items: center; border-top: 1px solid var(--border); }
.shop-list .shop-item:first-child { border-top: 0; }
.shop-toggle { display: flex; align-items: center; gap: 14px; flex: 1; min-width: 0; min-height: 52px; padding: 6px 2px; background: none; border: 0; text-align: left; font-size: 1.05rem; }
.shop-box { flex: none; width: 26px; height: 26px; border: 2px solid var(--text-muted); border-radius: 8px; }
.shop-name { flex: 1; min-width: 0; font-weight: 600; overflow-wrap: anywhere; }
.shop-amount { flex: none; color: var(--text-muted); }
.is-checked .shop-box { background: var(--ok); border-color: var(--ok); box-shadow: inset 0 0 0 4px var(--surface-solid); }
.is-checked .shop-name { text-decoration: line-through; opacity: 0.55; }
.shop-remove { flex: none; width: var(--tap); height: var(--tap); background: none; border: 0; border-radius: 50%; color: var(--text-muted); font-size: 1.4rem; }
.shop-remove:hover { background: var(--surface-raised); color: var(--danger); }
button.chip { cursor: pointer; }

/* ---------- Essen ---------- */

.badge-warn { background: rgba(245, 185, 66, 0.18); color: var(--warn); }
.meal-hints { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: var(--gap); }
.estimate strong { font-size: 1.5rem; font-weight: 800; }
.estimate.is-over strong { color: var(--danger); }
.meal-week { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: var(--gap); align-items: start; }
.meal-day { padding: 16px 18px; display: grid; gap: 6px; }
.meal-day-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 6px; }
.meal-day-head h2 { margin: 0; font-size: 1rem; }
.meal-title { font-size: 1.15rem; font-weight: 800; }
.meal-title a:hover { text-decoration: underline; }
.meal-edit > summary { min-height: 36px; display: flex; align-items: center; color: var(--text-muted); font-weight: 700; cursor: pointer; }
.meal-edit[open] > summary { margin-bottom: 8px; }
.meal-edit form + form { margin-top: 10px; }
.recipe-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: var(--gap); }
.recipe-card { display: grid; gap: 6px; padding: 14px; transition: transform 0.15s ease; }
.recipe-card:hover { transform: translateY(-2px); }
.recipe-thumb { display: grid; place-items: center; flex: none; width: 64px; height: 64px; border-radius: var(--radius-sm); background: var(--tile-meals); color: #fff; }
.recipe-card .recipe-thumb { width: 100%; height: 86px; }
.recipe-thumb .icon { width: 2rem; height: 2rem; }
.tags { display: flex; flex-wrap: wrap; gap: 4px; }
.ingredients { display: grid; }
.ingredients li { display: grid; grid-template-columns: 6.5rem minmax(0, 1fr); gap: 12px; padding: 8px 0; border-top: 1px solid var(--border); }
.ingredients li:first-child { border-top: 0; }
.ing-amount { font-weight: 700; text-align: right; font-variant-numeric: tabular-nums; }
.ing-rows { display: grid; gap: 8px; }
.ing-row { display: grid; grid-template-columns: 5rem 6.5rem minmax(0, 2fr) minmax(0, 1fr); gap: 8px; }
.row-inline { display: flex; align-items: center; gap: 8px; }
.price-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.price-row input { width: 6rem; }
.price-row select { width: auto; }
.meal-widget { display: flex; align-items: center; gap: 14px; }
.widget-big { font-size: 1.3rem; font-weight: 800; }
@media (max-width: 719px) {
  .ing-row { grid-template-columns: 4.5rem minmax(0, 1fr); }
  .ing-row input[name="ing_name"], .ing-row input[name="ing_note"] { grid-column: 1 / -1; }
  .ing-row { padding-bottom: 8px; border-bottom: 1px solid var(--border); }
  .shop-add { flex-wrap: wrap; }
  .shop-add .field:first-of-type { flex-basis: 100%; }
}

/* ---------- Mitteilungen ---------- */

.bell { position: relative; }
.bell-count { position: absolute; top: 2px; right: 0; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 999px; background: var(--accent); color: #fff; font-size: 0.72rem; font-weight: 800; line-height: 18px; text-align: center; }
.notes { display: grid; }
.note { border-top: 1px solid var(--border); }
.note:first-child { border-top: 0; }
.note a { display: grid; gap: 2px; padding: 10px 0 10px 14px; border-left: 3px solid transparent; }
.note.is-unread a { border-left-color: var(--accent); }
.note:not(.is-unread) strong { font-weight: 600; opacity: 0.75; }
.note a:hover strong { text-decoration: underline; }
.notes-mini .note a { padding: 6px 0; border-left: 0; }

/* ---------- Dokumente ---------- */

.doc-row { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; padding: 12px 18px; }
.doc-row > .icon { color: var(--text-muted); }
.doc-row:hover { border-color: var(--accent); }
.doc-row.is-inactive { opacity: 0.6; }
.link { text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }
.ocr-text { margin-top: 10px; max-height: 320px; overflow: auto; padding: 12px; border-radius: var(--radius-sm); background: var(--surface-raised); font-size: 0.9rem; }
.alert .secret { display: block; margin-top: 8px; font-size: 0.9rem; letter-spacing: 0; user-select: all; }
.pc-deadline { --pc: #f5b942; }
.cal-item.kind-deadline .cal-title { color: var(--warn); }
.cal-item.kind-deadline .cal-title::before { content: "⚑ "; }
input[type="search"] { width: 100%; min-height: var(--tap); padding: 8px 14px; background: var(--surface-raised); border: 1px solid var(--border); border-radius: var(--radius-sm); }
.field > .row-inline input { flex: 1 1 5rem; min-width: 0; }
.field > .row-inline select { flex: 2 1 7rem; }

/* ---------- Finanzen ---------- */

.ledger { display: grid; }
.ledger a { display: grid; grid-template-columns: 3.4rem minmax(0, 1fr) auto; gap: 12px; align-items: baseline; min-height: var(--tap); padding: 10px 6px; border-top: 1px solid var(--border); border-radius: 8px; }
.ledger li:first-child a { border-top: 0; }
.ledger a:hover { background: var(--surface-raised); }
.ledger-text { display: grid; min-width: 0; }
.ledger-text > * { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.amount { font-variant-numeric: tabular-nums; font-weight: 800; white-space: nowrap; }
.quick-entry { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; align-items: end; }
/* In der Vorschau des Imports muss die Auswahl lesbar bleiben, die Tabelle rollt notfalls quer. */
.table select { min-width: 10.5rem; }
.num { text-align: right; font-variant-numeric: tabular-nums; }
.table .num { text-align: right; }
.price-row > form.price-row { flex: 1 1 260px; }
.panel > form.price-row { margin-top: 10px; }
.price-row input.grow { flex: 1 1 140px; width: auto; }

/* ---------- Reiseplaner ---------- */

.trip-route { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: var(--gap); align-items: start; }
.trip-map { height: 380px; border-radius: var(--radius-sm); border: 1px solid var(--border); background: var(--surface-raised); z-index: 0; }
.map-route { stroke: #7b5cff; stroke-width: 4; fill: none; }
.map-point { stroke: #fff; stroke-width: 2; fill: #7b5cff; fill-opacity: 1; }
.map-start { fill: #2fbf71; } .map-end { fill: #f0567a; } .map-overnight { fill: #f5a623; } .map-charge, .map-suggestion { fill: #37d6c0; }
.map-dot-stop { --pc: #7b5cff; } .map-dot-overnight { --pc: #f5a623; } .map-dot-charge { --pc: #37d6c0; }
.leaflet-container { font: inherit; }
.leaflet-container a { color: #2a5db0; }
@media (max-width: 719px) { .trip-map { height: 280px; } }

/* ---------- Farbschema-Umschalter und Wand-Tablet ---------- */

.menu-label { padding: 8px 14px 2px; font-size: 0.78rem; font-weight: 800; letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-muted); }
.theme-switch { display: flex; gap: 6px; padding: 6px 10px 10px; }
.theme-switch button { flex: 1; min-height: var(--tap); padding: 4px 8px; border-radius: var(--radius-sm); border: 1px solid var(--border); background: var(--surface-raised); font-weight: 700; font-size: 0.86rem; }
.theme-switch button[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: #fff; }
[data-theme="light"] .leaflet-container { background: #e9ecf8; }
[data-theme="light"] .sync-status { background: #fff; }

/* Das Wand-Tablet ist eine Anzeige: große Schrift, nichts zum Tippen außer dem Profilwechsel. */
.wall .hero h1 { font-size: 2.6rem; }
.wall .topbar-info { font-size: 1.15rem; }
.wall .profile-name, .wall .widget-link, .wall .widget-more, .wall .tiles { display: none; }
.wall .widget { padding: 22px 26px; }
.wall .widget-head h2 { font-size: 1.35rem; }

/* ---------- KI-Bilder ---------- */

.cover { display: block; width: 100%; max-width: 420px; height: auto; aspect-ratio: 1 / 1; object-fit: cover; border-radius: var(--radius); border: 1px solid var(--border); }
.cover-small { max-width: 120px; float: right; margin: 0 0 8px 12px; border-radius: var(--radius-sm); }
.hero-picture { position: relative; overflow: hidden; border-radius: var(--radius); padding: 30px 22px 22px; }
.hero-img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; z-index: -1; opacity: 0.55; }

