/* Narkoseplan — главная страница. Цвета один раз здесь, светлая и тёмная тема. */
:root {
  --bg: #f3f5f9; --surface: #ffffff; --surface-2: #f7f9fc; --ink: #121a26; --muted: #5b6778; --line: #e1e6ee; --line-2: #cfd7e2;
  --dunkel: #121a26; --dunkel-ink: #ffffff; --dunkel-muted: #b9c4d3;
  --ok: #157a3d; --ok-bg: #dff5e6; --warn: #92580a; --warn-bg: #fff0d0; --bad: #b42318; --bad-bg: #fde8e6;
  --grau: #475569; --grau-bg: #e6eaf0;
  --blau: #1d4ed8; --blau-s: #dde8ff; --blau-b: #bfd3ff;
  --teal: #0f766e; --teal-s: #d5f2ee; --teal-b: #a7e3da;
  --violett: #4f46e5; --violett-s: #e5e4fd; --violett-b: #c7c4fb;
  --orange: #c2410c; --orange-s: #ffe8d4; --orange-b: #fdc9a0;
  --gruen: #15803d; --gruen-s: #d9f3e1; --gruen-b: #a8e3bd;
  --rot: #b42318; --rot-s: #fde8e6; --rot-b: #f7b8b1;
  --shadow: 0 1px 2px rgba(18,26,38,.05), 0 8px 24px -8px rgba(18,26,38,.12);
  --shadow-hover: 0 2px 4px rgba(18,26,38,.06), 0 18px 40px -12px rgba(18,26,38,.22);
  --focus: #2563eb;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0d1218; --surface: #151c25; --surface-2: #1a232d; --ink: #e9eef4; --muted: #98a5b5; --line: #263140; --line-2: #344356;
    --dunkel: #e9eef4; --dunkel-ink: #0d1218; --dunkel-muted: #4a5668;
    --ok: #6ee7a0; --ok-bg: #133a24; --warn: #f6c76a; --warn-bg: #3a2d0f; --bad: #ff9d92; --bad-bg: #43201d;
    --grau: #b4c0cf; --grau-bg: #263140;
    --blau: #93b4ff; --blau-s: #1b2b52; --blau-b: #2f4a85;
    --teal: #2dd4bf; --teal-s: #12372f; --teal-b: #1f5f55;
    --violett: #a5a1ff; --violett-s: #25254f; --violett-b: #403f85;
    --orange: #fdba74; --orange-s: #40250f; --orange-b: #6e4220;
    --gruen: #6ee7a0; --gruen-s: #133a24; --gruen-b: #23613d;
    --rot: #ff9d92; --rot-s: #43201d; --rot-b: #6f3430;
    --shadow: 0 1px 2px rgba(0,0,0,.3); --shadow-hover: 0 10px 30px -10px rgba(0,0,0,.6);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink);
  font-family: Inter, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; font-size: 15px; line-height: 1.35; }
a { color: inherit; text-decoration: none; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.sprite { display: none; }
.sym { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.versteckt { display: none !important; }

.seite { max-width: 1180px; margin: 0 auto; padding: max(20px, env(safe-area-inset-top)) 16px 40px; display: flex; flex-direction: column; gap: 18px; }

/* Kopf */
.kopf { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; }
.kopf-titel { display: flex; align-items: center; gap: 12px; min-width: 0; }
.kopf h1 { margin: 0; font-size: 24px; font-weight: 800; letter-spacing: -.02em; }
.datum { margin: 0; font-size: 13px; color: var(--muted); font-weight: 500; }
.logo { width: 42px; height: 42px; border-radius: 13px; background: var(--dunkel); color: var(--dunkel-ink); display: flex; align-items: center; justify-content: center; flex: none; }
.logo.gross { width: 56px; height: 56px; border-radius: 16px; }
.logo.gross .sym { width: 28px; height: 28px; }
.kopf-knoepfe { display: flex; gap: 8px; align-items: center; }
.kopf-knoepfe form { margin: 0; }

.knopf { height: 44px; min-width: 44px; padding: 0 14px; border-radius: 14px; border: 1px solid var(--line); background: var(--surface);
  color: var(--ink); font: 600 14px/1 inherit; font-family: inherit; display: inline-flex; align-items: center; justify-content: center; gap: 8px; cursor: pointer; }
.knopf.rund { padding: 0 12px; }
.knopf.dunkel { background: var(--dunkel); color: var(--dunkel-ink); border-color: transparent; }
.knopf.voll { width: 100%; }
.knopf:hover { border-color: var(--line-2); }
#summen-knopf .auf { display: none; }
#summen-knopf[aria-pressed="true"] .auf { display: block; }
#summen-knopf[aria-pressed="true"] .zu { display: none; }

.hinweis { margin: 0; padding: 10px 14px; border-radius: 12px; background: var(--warn-bg); color: var(--warn); font-size: 13px; font-weight: 500; }

/* Сегодня */
.heute { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 10px; }
.heute-karte { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 12px 14px; display: flex; flex-direction: column; gap: 3px; }
.heute-karte.dunkel { background: var(--dunkel); color: var(--dunkel-ink); border-color: transparent; }
.heute-karte.dunkel .klein { color: var(--dunkel-muted); }
.klein { font-size: 12px; color: var(--muted); font-weight: 500; }
.fett { font-size: 15px; font-weight: 700; }

/* Плитки */
.raster { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 480px), 1fr)); gap: 16px; }
.kachel { background: var(--surface); border: 1px solid var(--line); border-radius: 22px; padding: 18px; display: flex; flex-direction: column; gap: 14px;
  box-shadow: var(--shadow); transition: box-shadow .15s, transform .15s; min-height: 220px; }
.kachel:hover { transform: translateY(-2px); box-shadow: var(--shadow-hover); }
.kachel:active { transform: scale(.99); }
.kachel.bald { opacity: .85; }
.kachel-kopf { display: flex; align-items: center; gap: 12px; }
.kachel-symbol { width: 44px; height: 44px; border-radius: 13px; display: flex; align-items: center; justify-content: center; flex: none; }
.kachel-symbol .sym { width: 22px; height: 22px; }
.kachel-name { display: flex; flex-direction: column; flex: 1; min-width: 0; }
.kachel-name .name { font-size: 18px; font-weight: 700; }
.kachel-name .untertitel { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.plakette { font-size: 12px; font-weight: 600; padding: 4px 10px; border-radius: 99px; display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; flex: none; }
.plakette .punkt { width: 6px; height: 6px; border-radius: 3px; background: currentColor; }
.plakette.s-ok { color: var(--ok); background: var(--ok-bg); }
.plakette.s-warn { color: var(--warn); background: var(--warn-bg); }
.plakette.s-aus { color: var(--bad); background: var(--bad-bg); }
.plakette.grau, .plakette.s-info { color: var(--grau); background: var(--grau-bg); }

.zahlen { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.zahl { background: var(--surface-2); border-radius: 14px; padding: 12px; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.zahl .wert { font-size: 28px; font-weight: 800; letter-spacing: -.03em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.zahl .text { font-size: 12px; color: var(--muted); }
.leer { margin: 0; font-size: 13px; color: var(--muted); }

.chips { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.chips .klein { margin-right: 4px; }
.chip { font-size: 12px; font-weight: 600; padding: 4px 9px; border-radius: 8px; }
.verlauf { display: flex; flex-direction: column; gap: 6px; margin-top: auto; }
.verlauf svg { width: 100%; height: 44px; display: block; }

.kachel-neu { border: 1.5px dashed var(--line-2); border-radius: 22px; min-height: 64px; display: flex; align-items: center; justify-content: center;
  font-size: 13px; color: var(--muted); padding: 12px; text-align: center; }

/* Цвет плитки */
.f-blau .kachel-symbol, .f-blau .chip { background: var(--blau-s); color: var(--blau); } .f-blau .haupt .wert { color: var(--blau); }
.f-blau rect { fill: var(--blau-b); } .f-blau rect.letzt { fill: var(--blau); }
.f-teal .kachel-symbol, .f-teal .chip { background: var(--teal-s); color: var(--teal); } .f-teal .haupt .wert { color: var(--teal); }
.f-teal rect { fill: var(--teal-b); } .f-teal rect.letzt { fill: var(--teal); }
.f-violett .kachel-symbol, .f-violett .chip { background: var(--violett-s); color: var(--violett); } .f-violett .haupt .wert { color: var(--violett); }
.f-violett rect { fill: var(--violett-b); } .f-violett rect.letzt { fill: var(--violett); }
.f-orange .kachel-symbol, .f-orange .chip { background: var(--orange-s); color: var(--orange); } .f-orange .haupt .wert { color: var(--orange); }
.f-orange rect { fill: var(--orange-b); } .f-orange rect.letzt { fill: var(--orange); }
.f-gruen .kachel-symbol, .f-gruen .chip { background: var(--gruen-s); color: var(--gruen); } .f-gruen .haupt .wert { color: var(--gruen); }
.f-gruen rect { fill: var(--gruen-b); } .f-gruen rect.letzt { fill: var(--gruen); }
.f-rot .kachel-symbol, .f-rot .chip { background: var(--rot-s); color: var(--rot); } .f-rot .haupt .wert { color: var(--rot); }
.f-rot rect { fill: var(--rot-b); } .f-rot rect.letzt { fill: var(--rot); }
.f-grau .kachel-symbol, .f-grau .chip { background: var(--grau-bg); color: var(--grau); }
.f-grau rect { fill: var(--line-2); } .f-grau rect.letzt { fill: var(--grau); }

/* Суммы скрыты по умолчанию */
.geld-punkte { display: none; }
.summen-verborgen .geld-wert { display: none; }
.summen-verborgen .geld-punkte { display: inline; }

/* Вход */
.login { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 16px; }
.login-karte { width: 100%; max-width: 360px; background: var(--surface); border: 1px solid var(--line); border-radius: 22px; padding: 28px 22px;
  display: flex; flex-direction: column; gap: 12px; box-shadow: var(--shadow); }
.login-karte h1 { margin: 4px 0 6px; font-size: 22px; font-weight: 800; }
.login-karte p { margin: 0; color: var(--muted); }
.login-karte label { font-size: 13px; font-weight: 600; color: var(--muted); }
.login-karte input { height: 46px; border-radius: 12px; border: 1px solid var(--line-2); background: var(--surface-2); color: var(--ink); padding: 0 12px; font: inherit; font-size: 16px; }
.fehler { color: var(--bad) !important; font-size: 13px; font-weight: 600; }

/* Телефон: плитки 2×2, компактно */
.breit-nur { display: none; }
@media (min-width: 720px) {
  .breit-nur { display: inline; }
  .knopf.rund { padding: 0 14px; }
}
@media (max-width: 719px) {
  .seite { gap: 14px; }
  .kopf h1 { font-size: 21px; }
  .kopf .logo { display: none; }
  .raster { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
  .kachel { padding: 14px; border-radius: 20px; gap: 10px; min-height: 200px; }
  .kachel-kopf { flex-wrap: wrap; gap: 8px; }
  .kachel-symbol { width: 36px; height: 36px; border-radius: 11px; }
  .kachel-symbol .sym { width: 19px; height: 19px; }
  .kachel-name { order: 3; flex-basis: 100%; }
  .kachel-name .name { font-size: 15px; }
  .kachel-name .untertitel { display: none; }
  .plakette { margin-left: auto; font-size: 11px; padding: 3px 8px; }
  .zahlen { grid-template-columns: 1fr; gap: 2px; }
  .zahl { background: none; padding: 0; flex-direction: row; align-items: baseline; gap: 6px; }
  .zahl .wert { font-size: 14px; font-weight: 700; letter-spacing: 0; }
  .zahl.haupt { flex-direction: column; gap: 0; margin-bottom: 4px; }
  .zahl.haupt .wert { font-size: 32px; font-weight: 800; letter-spacing: -.03em; }
  .breit-nur-block { display: none; }
  .chips, .verlauf { display: none; }
  .kachel-neu { grid-column: 1 / -1; }
  .heute-karte:not(:first-child) { display: none; }
}
@media (max-width: 340px) {
  .raster { grid-template-columns: 1fr; }
}

/* Задачи (макет): три группы по важности */
.aufgaben { background: var(--surface); border: 1px solid var(--line); border-radius: 22px; padding: 16px 18px; display: flex; flex-direction: column; gap: 12px; box-shadow: var(--shadow); }
.aufgaben-kopf { display: flex; align-items: center; gap: 10px; }
.aufgaben-kopf h2 { margin: 0; font-size: 18px; font-weight: 800; }
.aufgaben-kopf .klein-knopf { margin-left: auto; }
.klein-knopf { height: 34px; padding: 0 10px; border-radius: 10px; font-size: 13px; gap: 4px; display: inline-flex; align-items: center; }
.klein-knopf .sym { width: 16px; height: 16px; }
.knopf:disabled { opacity: .5; cursor: not-allowed; }
.aufgaben-spalten { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.prio { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.prio-kopf { display: flex; align-items: center; gap: 8px; padding-bottom: 4px; border-bottom: 1px solid var(--line); }
.prio-kopf .klein { margin-left: auto; }
.prio-punkt { width: 9px; height: 9px; border-radius: 5px; background: var(--grau); }
.prio-hoch .prio-punkt { background: var(--rot); }
.prio-mittel .prio-punkt { background: var(--orange); }
.aufgabe { display: flex; gap: 10px; align-items: flex-start; padding: 8px 10px; border-radius: 12px; background: var(--surface-2); }
.aufgabe-haken { width: 18px; height: 18px; border-radius: 6px; border: 1.5px solid var(--line-2); flex: none; margin-top: 1px; }
.aufgabe-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.aufgabe-titel { font-size: 14px; font-weight: 600; }
.quelle { display: inline-flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.sym.mini { width: 13px; height: 13px; }
.ueberfaellig .faellig { color: var(--bad); font-weight: 700; }
.aufgaben-fuss { margin: 0; }

/* Настройки */
.hinweis.ok { background: var(--ok-bg); color: var(--ok); }
.einst { display: flex; flex-direction: column; gap: 14px; }
.einst-karte { background: var(--surface); border: 1px solid var(--line); border-radius: 22px; padding: 16px 18px; display: flex; flex-direction: column; gap: 12px; }
.einst-reihe { display: flex; flex-wrap: wrap; gap: 10px 18px; align-items: center; }
.einst-zahlen { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.einst-feld { display: flex; flex-direction: column; gap: 4px; font-size: 12px; font-weight: 600; color: var(--muted); min-width: 0; }
.einst-feld.kurz { flex-direction: row; align-items: center; gap: 8px; }
.einst-feld select, .einst-feld input { height: 42px; border-radius: 10px; border: 1px solid var(--line-2); background: var(--surface-2); color: var(--ink); padding: 0 10px; font: inherit; font-size: 15px; min-width: 0; }
.einst-feld.kurz input { width: 80px; }
.schalter { display: inline-flex; align-items: center; gap: 8px; font-size: 14px; font-weight: 600; cursor: pointer; }
.schalter input { width: 20px; height: 20px; accent-color: var(--focus); }
.schalter.still { color: var(--muted); font-weight: 500; }
.einst-fuss { display: flex; gap: 10px; }
.kachel-neu a { text-decoration: underline; }

@media (max-width: 719px) {
  .aufgaben { padding: 14px; border-radius: 20px; }
  .aufgaben-spalten { grid-template-columns: 1fr; gap: 10px; }
  .prio-niedrig .aufgabe { display: none; }
  .aufgaben-fuss { display: none; }
  .einst-zahlen { grid-template-columns: 1fr; }
}

/* Passkeys */
.pk-bereich { display: flex; flex-direction: column; gap: 8px; }
.pw-form { display: flex; flex-direction: column; gap: 12px; }
.knopf .sym { margin-right: 6px; }
.link-knopf { background: none; border: 0; color: var(--muted); font: inherit; font-size: 14px; text-decoration: underline; cursor: pointer; padding: 6px; }
.einst-titel { margin: 0; font-size: 16px; font-weight: 800; display: flex; align-items: center; gap: 8px; }
.pk-zeile { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 12px; background: var(--surface-2); }
.pk-zeile form { margin: 0 0 0 auto; }
.pk-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.pk-hinweis { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; padding: 10px 14px; border-radius: 14px;
  background: var(--surface); border: 1px dashed var(--line-2); }
.pk-hinweis-text { display: inline-flex; align-items: center; gap: 8px; font-weight: 600; font-size: 14px; }
.pk-hinweis-knoepfe { display: inline-flex; gap: 8px; margin-left: auto; }
