:root {
  /* Nordlys: dunkle Flächen (wie das Dashboard), Aurora-Mint als Akzent, Gold für Hervorhebungen */
  color-scheme: dark;
  --bg: #121216; --card: #1e1e22; --ink: #ececed; --muted: #a0a0a6; --line: #2f2f36;
  --brand: #63f0c3; --brand-ink: #0f2c23; --accent: #fdd835; --today: rgba(253, 216, 53, .12); --hover: rgba(255, 255, 255, .06);
  --ok: #63f0c3; --warn: #fdd835; --bad: #ef5350; --info: #4dd0e1;
  --aurora: linear-gradient(135deg, rgba(143, 255, 219, .92), rgba(99, 240, 195, .88)); --aurora-glow: 0 6px 18px rgba(99, 240, 195, .22);
  --radius: 16px; --shadow: 0 8px 22px rgba(0, 0, 0, .18);
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--ink);
  font: 16px/1.4 system-ui, -apple-system, "Segoe UI", sans-serif; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--brand); }
h1, h2, h3 { margin: 0; line-height: 1.2; }
.hidden { display: none !important; }

/* Layout */
.shell { display: grid; grid-template-columns: 220px minmax(0, 1fr); min-height: 100vh; }
.side { background: var(--card); border-right: 1px solid var(--line); padding: 20px 14px; position: sticky; top: 0;
  height: 100vh; display: flex; flex-direction: column; gap: 4px; }
.brand { font-size: 20px; font-weight: 700; padding: 4px 10px 16px; display: flex; gap: 8px; align-items: center; }
.nav-btn { display: flex; gap: 10px; align-items: center; padding: 10px 12px; border: 0; background: none;
  border-radius: 10px; text-align: left; font-weight: 500; width: 100%; }
.nav-btn:hover { background: var(--hover); }
.nav-btn.active { background: var(--brand); color: var(--brand-ink); }
.nav-btn .ico { width: 22px; text-align: center; }
.side .grow { flex: 1; }
.side { overflow-y: auto; }
.brand { justify-content: space-between; }
.search-btn { border: 0; background: var(--hover); border-radius: 8px; padding: 4px 8px; font-size: 14px; }
.nav-group { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 600; padding: 12px 12px 3px; }
.more-btn { display: none; }
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 10px; margin-bottom: 8px; }
.tile { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 10px; text-align: center; font-weight: 600; box-shadow: var(--shadow); }
.tile:hover { background: var(--hover); }
.tile-ico { font-size: 28px; margin-bottom: 4px; }
.search-input { font-size: 18px; padding: 12px 14px; }
.hit { display: flex; gap: 10px; align-items: center; padding: 9px 6px; border-radius: 10px; cursor: pointer; }
.hit:hover, .hit.sel { background: var(--hover); }
.hit .t { font-weight: 600; } .hit .s { font-size: 13px; color: var(--muted); } .hit .k { font-size: 11px; color: var(--muted); margin-left: auto; text-transform: uppercase; }
.main { min-width: 0; padding: 24px clamp(14px, 3vw, 36px) 40px; max-width: 1200px; width: 100%; }
.page-head { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-bottom: 18px; }
.page-head h1 { font-size: 26px; margin-right: auto; }

/* Controls */
.btn { border: 1px solid var(--line); background: var(--card); border-radius: 10px; padding: 8px 14px; font-weight: 500; }
.btn:hover { background: var(--hover); }
.btn.primary { background: var(--brand); color: var(--brand-ink); border-color: transparent; }
.btn.primary:hover { filter: brightness(1.08); }
.btn.danger { color: #c0392b; }
.btn.small { padding: 4px 10px; font-size: 14px; }
.btn.icon { padding: 6px 10px; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; background: var(--card); }
.seg button { border: 0; background: none; padding: 7px 14px; }
.seg button.on { background: var(--brand); color: var(--brand-ink); }
input[type=text], input[type=date], input[type=time], input[type=password], input[type=number], input[type=search], input[type=email], input[type=tel], input[type=url], select, textarea {
  width: 100%; padding: 9px 11px; border: 1px solid var(--line); border-radius: 10px; background: var(--card); }
input:focus, select:focus, textarea:focus, button:focus-visible { outline: 2px solid var(--brand); outline-offset: 1px; }
label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 4px; font-weight: 500; }
.field { margin-bottom: 12px; }
.row { display: flex; gap: 10px; } .row > * { flex: 1; min-width: 0; }
.card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px; border: 1px solid var(--line); }
.muted { color: var(--muted); } .small { font-size: 14px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 4px 11px; border-radius: 99px; border: 1.5px solid var(--c, var(--line));
  background: var(--card); font-size: 14px; }
.chip.on { background: var(--c); color: #fff; }
.dot { width: 10px; height: 10px; border-radius: 50%; background: var(--c, var(--muted)); display: inline-block; flex: none; }
.empty { color: var(--muted); padding: 14px 0; font-style: italic; }

/* Kalender */
.cal-nav { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.cal-title { font-size: 20px; font-weight: 650; min-width: 190px; }
.month { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); min-width: 0; border: 1px solid var(--line); border-radius: var(--radius);
  overflow: hidden; background: var(--card); }
.dow { padding: 8px; font-size: 12px; font-weight: 600; color: var(--muted); text-transform: uppercase; text-align: center;
  border-bottom: 1px solid var(--line); background: var(--bg); }
.day { min-width: 0; min-height: 104px; padding: 4px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line);
  cursor: pointer; overflow: hidden; display: flex; flex-direction: column; gap: 2px; background: var(--card); text-align: left; border-radius: 0; }
.day:nth-child(7n) { border-right: 0; }
.day:hover { background: var(--hover); }
.day.other { opacity: .5; }
.day.today { background: var(--today); }
.day.sel { outline: 2px solid var(--brand); outline-offset: -2px; }
.day .num { font-size: 13px; font-weight: 600; align-self: flex-start; padding: 1px 6px; border-radius: 99px; }
.day.today .num { background: var(--accent); color: #fff; }
.day .hol { font-size: 11px; color: var(--accent); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pill { font-size: 12px; padding: 1px 5px; border-radius: 5px; border-left: 3px solid var(--c, var(--muted));
  background: color-mix(in srgb, var(--c, var(--muted)) 16%, var(--card)); white-space: nowrap; overflow: hidden;
  text-overflow: ellipsis; display: block; }
.more { font-size: 11px; color: var(--muted); padding-left: 4px; }
.week { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 8px; }
.week .col { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 8px; min-height: 220px;
  display: flex; flex-direction: column; gap: 6px; }
.week .col.today { background: var(--today); }
.week .col h3 { font-size: 13px; color: var(--muted); font-weight: 600; cursor: pointer; }
.cal-layout { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 16px; align-items: start; }
.daypanel { position: sticky; top: 16px; }
.daypanel h2 { font-size: 18px; margin-bottom: 10px; }
.item { display: flex; gap: 10px; padding: 9px 10px; border-radius: 10px; border-left: 4px solid var(--c, var(--muted));
  background: color-mix(in srgb, var(--c, var(--muted)) 11%, var(--card)); margin-bottom: 8px; cursor: pointer; }
.item:hover { filter: brightness(.97); }
.item .t { font-size: 13px; color: var(--muted); }
.item .title { font-weight: 600; }
.item .who { display: flex; gap: 3px; margin-top: 3px; }
.agenda-day { margin-bottom: 18px; }
.agenda-day h3 { font-size: 14px; color: var(--muted); margin-bottom: 6px; text-transform: uppercase; letter-spacing: .03em; }

/* Home */
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 16px; }
.card h2 { font-size: 17px; margin-bottom: 10px; display: flex; justify-content: space-between; align-items: baseline; }
.big { font-size: 15px; }

/* Aufgaben / Einkauf */
.quick { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 16px; }
.quick input[type=text] { flex: 1 1 220px; }
.quick select, .quick input[type=date] { width: auto; flex: 0 1 auto; }
.li { display: flex; align-items: center; gap: 10px; padding: 9px 4px; border-bottom: 1px solid var(--line); }
.li:last-child { border-bottom: 0; }
.li .body { flex: 1; min-width: 0; cursor: pointer; }
.li.done .body { text-decoration: line-through; color: var(--muted); }
.li input[type=checkbox] { width: 22px; height: 22px; accent-color: var(--brand); flex: none; }
.late { color: #c0392b; font-weight: 600; }
.soon { color: #b7791f; font-weight: 600; }
.pill { display: inline-block; border-radius: 9px; padding: 0 7px; font-size: 11px; font-weight: 650; margin-left: 6px; color: #fff; }
.pill.expired { background: #c0392b; }
.pill.soon { background: #d99a00; color: #fff; }
.sec-title { font-size: 13px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); margin: 18px 0 4px; font-weight: 600; }
.x { border: 0; background: none; color: var(--muted); font-size: 18px; padding: 2px 8px; border-radius: 8px; }
.x:hover { background: var(--hover); color: #c0392b; }

/* Essensplan */
.meals { display: grid; grid-template-columns: 110px repeat(3, 1fr); gap: 6px; align-items: center; }
.meals .h { font-size: 13px; font-weight: 600; color: var(--muted); padding: 4px; }
.meals .d { font-weight: 600; padding: 4px; }
.meals .d.today { color: var(--accent); }
.meals input { padding: 7px 9px; }

.mcell { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.mentry { display: flex; align-items: center; gap: 2px; background: color-mix(in srgb, #e58325 14%, var(--card)); border-radius: 8px; padding: 2px 4px 2px 8px; font-size: 14px; }
.mentry .mt { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.mentry .x { font-size: 15px; padding: 0 5px; }

/* Personen */
.person { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.avatar { width: 38px; height: 38px; border-radius: 50%; background: var(--c); color: #fff; display: grid; place-items: center;
  font-weight: 700; flex: none; }
.person .body { flex: 1; min-width: 0; }
.swatches { display: flex; gap: 8px; flex-wrap: wrap; }
.swatch { width: 28px; height: 28px; border-radius: 50%; border: 3px solid transparent; background: var(--c); padding: 0; }
.swatch.on { border-color: var(--ink); }
code.link { display: block; padding: 8px 10px; background: var(--bg); border-radius: 8px; word-break: break-all; font-size: 13px; margin: 6px 0; }

/* Login */
.login { max-width: 400px; margin: 8vh auto; padding: 0 16px; }
.login .card { padding: 26px; }
.login h1 { font-size: 28px; margin-bottom: 4px; }
.err { color: #c0392b; font-size: 14px; min-height: 20px; margin: 4px 0 8px; }

/* Dialog & Toast */
dialog { border: 0; border-radius: 18px; padding: 22px; width: min(520px, calc(100vw - 24px)); background: var(--card); color: var(--ink);
  box-shadow: 0 20px 60px rgba(0,0,0,.35); max-height: 92vh; overflow-y: auto; }
dialog::backdrop { background: rgba(0,0,0,.45); }
dialog h2 { margin-bottom: 16px; font-size: 20px; }
.actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 18px; flex-wrap: wrap; }
.actions .left { margin-right: auto; }
#toast { position: fixed; left: 50%; bottom: 80px; transform: translateX(-50%) translateY(20px); background: #222; color: #fff;
  padding: 10px 16px; border-radius: 10px; opacity: 0; pointer-events: none; transition: .25s; z-index: 99; }
#toast.show { opacity: 1; transform: translateX(-50%); }

@media (max-width: 1050px) { .week { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
/* Mobil */
@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; }
  .side { position: fixed; bottom: 0; left: 0; right: 0; top: auto; height: auto; flex-direction: row; padding: 6px 6px calc(6px + env(safe-area-inset-bottom));
    border-right: 0; border-top: 1px solid var(--line); z-index: 20; justify-content: space-around; gap: 0; }
  .brand, .side .grow, .side .who-am-i, .nav-group { display: none; }
  .nav-btn:not(.primary):not(.more-btn) { display: none; }
  .more-btn { display: flex; }
  .side { overflow-y: visible; }
  .nav-btn { flex-direction: column; gap: 0; padding: 6px 2px; font-size: 11px; text-align: center; justify-content: center; flex: 1; }
  .nav-btn .ico { font-size: 18px; }
  .main { padding-bottom: 96px; }
  .cal-layout { grid-template-columns: 1fr; }
  .daypanel { position: static; }
  .day { min-height: 64px; }
  .day .pill { font-size: 0; padding: 0; height: 6px; width: 6px; border-radius: 50%; border: 0; display: inline-block; background: var(--c, var(--muted)); }
  .day .evs { display: flex; flex-wrap: wrap; gap: 2px; }
  .day .hol, .day .more { display: none; }
  .week { grid-template-columns: 1fr; }
  .week .col { min-height: 0; }
  .meals { grid-template-columns: 1fr; } .meals .h { display: none; }
  .meals .d { margin-top: 10px; }
  .meals input::placeholder { color: var(--muted); }
}

/* Kanban */
.board { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; align-items: start; }
.col-k { background: var(--hover); border-radius: var(--radius); padding: 10px; min-height: 160px; display: flex; flex-direction: column; gap: 8px; transition: outline .1s; }
.col-k.over { outline: 2px dashed var(--brand); }
.col-k h3 { font-size: 13px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.kcard { background: var(--card); border: 1px solid var(--line); border-left: 4px solid var(--c, var(--line)); border-radius: 10px; padding: 8px 10px; cursor: grab; }
.kcard.dragging { opacity: .5; }
@media (max-width: 860px) { .board { grid-template-columns: 1fr; } }

.mcell.over { outline: 2px dashed var(--brand); border-radius: 8px; }
.mentry { cursor: grab; } .mentry.dragging { opacity: .45; }

/* ---------- Nordlys-Feinschliff ---------- */
.day { border-top: 0; border-left: 0; }
.card { background: linear-gradient(180deg, rgba(35, 35, 40, .94), rgba(26, 26, 31, .96)); }
.side { background: #17171b; }
.nav-btn.active { background: var(--aurora); box-shadow: var(--aurora-glow); font-weight: 700; }
.btn { border-radius: 12px; background: rgba(255, 255, 255, .05); border-color: rgba(255, 255, 255, .12); }
.btn:hover { background: rgba(255, 255, 255, .1); }
.btn.primary { background: var(--aurora); box-shadow: var(--aurora-glow); font-weight: 700; }
.btn.danger { color: var(--bad); }
.seg { border-radius: 12px; background: rgba(255, 255, 255, .05); }
.seg button.on { background: var(--aurora); font-weight: 700; }
.late, .err { color: var(--bad); }
.pill.expired { background: var(--bad); }
.pill.soon { background: var(--warn); color: #2a2400; }
.day.today .num, .meals .d.today { color: #2a2400; }
.meals .d.today { color: var(--accent); }
.chip.on[style*="--c:#63f0c3"], .chip.on[style*="--c:#fdd835"], .chip.on[style*="--c:#4dd0e1"], .avatar[style*="#63f0c3"], .avatar[style*="#fdd835"], .avatar[style*="#4dd0e1"] { color: #0f2c23; }
#toast { background: #2a2a31; border: 1px solid rgba(99, 240, 195, .35); }
dialog { border: 1px solid rgba(255, 255, 255, .08); border-radius: 24px; box-shadow: 0 20px 60px rgba(0, 0, 0, .5); }
dialog::backdrop { background: rgba(0, 0, 0, .6); backdrop-filter: blur(3px); }
.brand img, .brand .logo { filter: drop-shadow(0 4px 15px rgba(0, 255, 204, .2)); }
a { color: var(--brand); }
