/* Meine Erinnerungen – Oberfläche im Stil der iOS-Erinnerungen. Token (Farben, Schrift, Radien) kommen aus /core/tokens.css. */
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; background: var(--bg-grouped); }
body {
  font-family: var(--font); font-size: 17px; line-height: 1.3; color: var(--text);
  overscroll-behavior: none; -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; margin: 0; cursor: pointer; touch-action: manipulation; }
input, textarea, select { font: inherit; color: inherit; }
button:focus-visible, [tabindex]:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }
[hidden] { display: none !important; }
.icon { display: inline-block; vertical-align: middle; flex-shrink: 0; }

.app { position: fixed; inset: 0; container: app / size; background: var(--bg-grouped); }
.view { position: absolute; inset: 0; overflow-y: auto; -webkit-overflow-scrolling: touch; padding: var(--safe-t) 0 calc(var(--safe-b) + 16px); scroll-padding: calc(44px + var(--safe-t)) 0 calc(var(--safe-b) + 16px); outline: none; }
/* Einblenden: Seitenwechsel (Klasse enter aus route()), Datum/Uhrzeit und Wiederholen beim Einschalten */
@keyframes fade-in { from { opacity: 0; } }
.view.enter { animation: fade-in 0.18s ease-out; }

/* ---------- Navigationsleiste ---------- */
.nav {
  position: sticky; top: 0; z-index: 20; min-height: 44px; padding: 4px 8px;
  display: flex; align-items: center; gap: 4px;
  background: var(--bar); -webkit-backdrop-filter: saturate(180%) blur(20px); backdrop-filter: saturate(180%) blur(20px);
  box-shadow: 0 0.5px 0 transparent; transition: box-shadow 0.15s;
}
.nav.scrolled { box-shadow: 0 0.5px 0 var(--bar-border); }
.nav-btn { display: inline-flex; align-items: center; gap: 2px; min-height: 44px; min-width: 44px; padding: 0 8px; color: var(--accent); font-size: 17px; border-radius: 8px; }
.nav-btn.back { padding-left: 2px; margin-left: -4px; }
.nav-btn.icon-only { justify-content: center; }
.nav-btn:active { opacity: 0.5; }
.nav-title { flex: 1; text-align: center; font-weight: 600; font-size: 17px; opacity: 0; transition: opacity 0.15s; }
.nav.scrolled .nav-title { opacity: 1; }
.nav-spacer { flex: 1; }
.nav-sm-title { flex: 1; text-align: center; font-weight: 600; font-size: 17px; }

.large-title { margin: 2px var(--gutter) 8px; font-size: 34px; line-height: 41px; font-weight: 700; letter-spacing: 0.37px; display: flex; align-items: baseline; gap: 10px; min-width: 0; }
.large-title .t { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.large-title .n { font-size: 34px; font-weight: 700; color: var(--text-2); margin-left: auto; flex-shrink: 0; }

/* ---------- Suche ---------- */
.searchbar {
  display: flex; align-items: center; gap: 6px; margin: 6px var(--gutter) 14px;
  background: var(--fill); border-radius: 10px; padding: 0 8px; height: 36px; color: var(--text-2);
}
.search-input { flex: 1; border: 0; background: transparent; font-size: 17px; color: var(--text); outline: none; min-width: 0; -webkit-appearance: none; }
.search-input::placeholder { color: var(--text-2); }
.search-input::-webkit-search-cancel-button { display: none; }
.search-clear { display: inline-flex; color: var(--text-3); }

/* ---------- Start: Intelligente Listen ---------- */
.smart-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin: 0 var(--gutter) 22px; }
.smart {
  display: flex; flex-direction: column; gap: 6px; padding: 10px 12px 10px; min-height: 84px;
  background: var(--card); border-radius: 12px; color: var(--text-2); text-align: left; box-shadow: 0 0 0 0.5px var(--sep);
}
.smart-top { display: flex; align-items: center; justify-content: space-between; }
.smart-icon { width: 30px; height: 30px; border-radius: 50%; background: var(--sc); color: #fff; display: inline-flex; align-items: center; justify-content: center; }
.smart-icon .icon { stroke-width: 2.2; }
.smart-count { font-size: 24px; font-weight: 700; color: var(--text); line-height: 1; }
.smart-name { font-size: 15px; font-weight: 600; }
.smart:active { opacity: 0.7; }
.smart.wide { grid-column: 1 / -1; flex-direction: row; align-items: center; min-height: 0; }
.smart.wide .smart-top { gap: 10px; }
.smart.wide .smart-count { margin-left: auto; font-size: 18px; }

.section-title { margin: 0 var(--gutter) 8px; font-size: 22px; font-weight: 700; letter-spacing: 0.35px; }
.section-sub { margin: 0 var(--gutter) 6px; font-size: 20px; font-weight: 700; }

.group { margin: 0 var(--gutter) 22px; background: var(--card); border-radius: 12px; overflow: hidden; box-shadow: 0 0 0 0.5px var(--sep); }
.row { display: flex; align-items: center; gap: 12px; min-height: 44px; padding: 8px 12px 8px 16px; width: 100%; text-align: left; position: relative; }
.row + .row::before, .rem + .rem::before, .rem + .rem-new::before, .row + .rem-new::before, .frow + .frow::before {
  content: ""; position: absolute; left: 60px; right: 0; top: 0; height: 0.5px; background: var(--sep);
}
.row.no-icon + .row.no-icon::before { left: 16px; }
.row-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-count { color: var(--text-2); }
.row-chev { color: var(--text-3); display: inline-flex; }
.row:active { background: var(--fill); }
.lbadge { border-radius: 50%; background: var(--lc); color: #fff; display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; }
.lbadge .icon { stroke-width: 2.2; }
.empty { margin: 30px var(--gutter); text-align: center; color: var(--text-2); font-size: 17px; }
.empty .icon { color: var(--text-3); margin-bottom: 8px; }

/* ---------- Erinnerungen ---------- */
.rem-group { margin: 0 var(--gutter) 18px; background: var(--card); border-radius: 12px; overflow: hidden; box-shadow: 0 0 0 0.5px var(--sep); }
.rem-head { display: flex; align-items: center; gap: 10px; margin: 0 var(--gutter) 8px; font-size: 20px; font-weight: 700; }
.rem-head.overdue { color: var(--c-red); }
.rem-head .lbadge { width: 26px; height: 26px; }
.rem-head .lbadge .icon { width: 15px; height: 15px; }
.rem { display: flex; align-items: flex-start; gap: 12px; padding: 10px 12px 10px 16px; position: relative; }
/* Tastatur-Fokus (W/A/S/D), Klasse kfocus aus core/web/keynav.js */
.kfocus { outline: 2px solid var(--accent) !important; outline-offset: -2px; border-radius: 8px; }
.rem.kfocus { outline: none !important; box-shadow: inset 3px 0 0 var(--accent); background: var(--accent-soft); }
.row.kfocus { outline: none !important; background: var(--fill); }
.smart.kfocus { outline-offset: 2px; }
.frow:has(.kfocus) { background: var(--fill); }
.frow .switch input.kfocus { outline: none !important; }
.rem-check {
  width: 22px; height: 22px; margin-top: 1px; border-radius: 50%; border: 1.5px solid var(--text-3); flex-shrink: 0;
  display: inline-flex; align-items: center; justify-content: center; position: relative;
}
.rem-check:active { transform: scale(0.9); }
.rem.done .rem-check { border-color: var(--lc); }
.rem.done .rem-check::after { content: ""; width: 14px; height: 14px; border-radius: 50%; background: var(--lc); }
.rem-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; cursor: text; }
.rem-title { font-size: 17px; line-height: 22px; word-break: break-word; display: flex; gap: 4px; align-items: baseline; }
.rem.done .rem-title, .rem.done .rem-notes, .rem.done .rem-meta { color: var(--text-2); }
.prio { color: var(--lc); font-weight: 600; flex-shrink: 0; }
.rem-notes { font-size: 15px; color: var(--text-2); white-space: pre-wrap; word-break: break-word; }
.rem-meta { font-size: 15px; color: var(--text-2); display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.rem-meta .due.overdue { color: var(--c-red); }
.rem-meta .icon { width: 14px; height: 14px; }
.rem-listname { display: inline-flex; align-items: center; gap: 5px; }
.rem-listname i { width: 8px; height: 8px; border-radius: 50%; background: var(--lc); display: inline-block; }
.rem-flag { color: var(--c-orange); display: inline-flex; margin-top: 1px; }
.rem-flag .icon { fill: currentColor; }
.rem-info { color: var(--accent); display: none; width: 44px; height: 44px; margin: -11px -12px -11px -8px; align-items: center; justify-content: center; }
.rem.editing .rem-info, .rem.kfocus .rem-info, .rem:hover .rem-info { display: inline-flex; }
.rem-input, .rem-notes-input { width: 100%; border: 0; background: transparent; padding: 0; outline: none; font-size: 17px; line-height: 22px; -webkit-appearance: none; }
.rem-notes-input { font-size: 15px; color: var(--text-2); }
.rem-notes-input::placeholder { color: var(--text-3); }
.rem-hint { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 4px; }
.chip { display: inline-flex; align-items: center; gap: 4px; padding: 3px 9px; border-radius: 999px; background: var(--fill); font-size: 13px; font-weight: 500; color: var(--text); }
.chip.accent { background: var(--accent); color: #fff; }
.chip .icon { width: 13px; height: 13px; }
.rem-new { display: flex; align-items: flex-start; gap: 12px; padding: 10px 12px 10px 16px; position: relative; }
.rem-new .rem-check { border-color: var(--text-3); }
.completed-head { display: flex; align-items: center; gap: 6px; margin: 4px var(--gutter) 10px; color: var(--text-2); font-size: 15px; }
.completed-head b { font-weight: 600; }
.completed-head button { color: var(--accent); font-size: 15px; }
.completed-head .sep { width: 3px; height: 3px; border-radius: 50%; background: var(--text-3); }

/* ---------- Sheets ---------- */
.overlay { position: absolute; inset: 0; z-index: 50; background: rgba(0, 0, 0, 0); display: flex; align-items: flex-end; justify-content: center; transition: background 0.2s; }
.overlay.open { background: rgba(0, 0, 0, 0.4); }
.overlay:not(.open) { pointer-events: none; } /* beim Hinuntergleiten nichts mehr abfangen */
.sheet {
  width: 100%; max-width: 560px; max-height: calc(100% - 20px - var(--safe-t));
  background: var(--bg-grouped); border-radius: 12px 12px 0 0; display: flex; flex-direction: column;
  transform: translateY(100%); transition: transform 0.25s cubic-bezier(0.2, 0.8, 0.2, 1); overflow: hidden;
}
.overlay.open .sheet { transform: none; }
.sheet-nav { display: flex; align-items: center; min-height: 52px; padding: 4px 8px; flex-shrink: 0; }
.sheet-nav .nav-title { opacity: 1; }
.sheet-body { overflow-y: auto; padding: 4px 0 calc(var(--safe-b) + 16px); }
.form-group { margin: 0 var(--gutter) 22px; background: var(--card); border-radius: 12px; overflow: hidden; box-shadow: 0 0 0 0.5px var(--sep); }
/* Gruppe aus nur einem Knopf (z. B. „Erinnerung löschen“) ist ein Knopf: grauer Rand wie .btn in Kalender und Musik */
.form-group:has(> .fbtn:only-child) { box-shadow: 0 0 0 1px var(--btn-border); }
.frow { display: flex; align-items: center; gap: 12px; min-height: 44px; padding: 6px 16px; position: relative; }
.frow.col { flex-direction: column; align-items: stretch; gap: 0; }
.frow-icon { width: 30px; height: 30px; border-radius: 7px; background: var(--fc); color: #fff; display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; }
.frow-icon .icon { width: 18px; height: 18px; stroke-width: 2.2; }
.frow-label { flex: 1; min-width: 0; }
.frow-label small { display: block; color: var(--text-2); font-size: 13px; }
.frow-value { color: var(--text-2); max-width: 55%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.finput { width: 100%; border: 0; background: transparent; padding: 10px 0; font-size: 17px; outline: none; -webkit-appearance: none; }
.finput::placeholder { color: var(--text-3); }
textarea.finput { resize: none; min-height: 60px; line-height: 1.35; }
.fdate { border: 0; background: var(--fill); border-radius: 8px; padding: 6px 8px; font-size: 15px; color: var(--text); color-scheme: inherit; -webkit-appearance: none; font-variant-numeric: tabular-nums; } /* Werte wie im Kalender */
.frow .fdate, #repeat-row { animation: fade-in 0.2s ease-out; }
.fselect { border: 0; background: var(--fill); border-radius: 8px; padding: 7px 28px 7px 10px; font-size: 16px; color: var(--text); -webkit-appearance: none; appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%238e8e93' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 10px center; background-color: var(--fill); }
.switch { position: relative; width: 51px; height: 31px; flex-shrink: 0; }
.switch input { position: absolute; opacity: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.switch span { position: absolute; inset: 0; border-radius: 999px; background: var(--fill-2); transition: background 0.2s; pointer-events: none; }
.switch span::after { content: ""; position: absolute; top: 2px; left: 2px; width: 27px; height: 27px; border-radius: 50%; background: #fff; box-shadow: 0 3px 8px rgba(0, 0, 0, 0.15), 0 1px 1px rgba(0, 0, 0, 0.16); transition: transform 0.2s; }
.switch input:checked + span { background: var(--c-green); }
.switch input:checked + span::after { transform: translateX(20px); }
.switch input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }
.fbtn { width: 100%; min-height: 44px; padding: 0 16px; text-align: center; color: var(--accent); font-size: 17px; }
.fbtn.danger { color: var(--c-red); }
.fbtn:active { background: var(--fill); }
.form-note { margin: -14px var(--gutter) 22px; color: var(--text-2); font-size: 13px; line-height: 1.35; }

/* Listen-Sheet: Vorschau, Farben, Symbole */
.list-preview { display: flex; flex-direction: column; align-items: center; gap: 14px; padding: 18px 16px 8px; }
.list-preview .lbadge { width: 96px; height: 96px; box-shadow: 0 8px 20px rgba(0, 0, 0, 0.2); }
.list-preview .lbadge .icon { width: 50px; height: 50px; }
.list-name-input { width: 100%; text-align: center; font-size: 24px; font-weight: 700; background: var(--fill); border: 0; border-radius: 12px; padding: 12px; outline: none; }
.swatches { display: grid; grid-template-columns: repeat(6, 1fr); gap: 14px; padding: 14px 16px; justify-items: center; }
.swatch { width: 36px; height: 36px; border-radius: 50%; background: var(--sc); position: relative; }
.swatch.on::after { content: ""; position: absolute; inset: -5px; border-radius: 50%; border: 3px solid var(--text-3); }
.iconpick { display: grid; grid-template-columns: repeat(6, 1fr); gap: 14px; padding: 14px 16px; justify-items: center; }
.iconpick button { width: 36px; height: 36px; border-radius: 50%; background: var(--fill); display: inline-flex; align-items: center; justify-content: center; color: var(--text-2); }
.iconpick button.on { background: var(--text-2); color: var(--card); }

/* ---------- Action-Sheet ---------- */
.overlay .sheet.as { background: transparent; padding: 0 8px calc(var(--safe-b) + 8px); gap: 8px; max-width: 480px; }
.as-group { background: var(--card); border-radius: 14px; overflow: hidden; }
.as-title { padding: 12px 16px 10px; text-align: center; font-size: 13px; color: var(--text-2); border-bottom: 0.5px solid var(--sep); }
.as-item { width: 100%; min-height: 56px; display: flex; align-items: center; gap: 12px; padding: 0 20px; font-size: 20px; color: var(--accent); border-bottom: 0.5px solid var(--sep); }
.as-item:last-child { border-bottom: 0; }
.as-item span { flex: 1; text-align: left; }
.as-item.danger { color: var(--c-red); }
.as-item.as-cancel { justify-content: center; font-weight: 600; }
.as-item.as-cancel span { text-align: center; }
.as-item:active { background: var(--fill); }

/* ---------- Toast, Login ---------- */
.toast { position: absolute; left: 50%; bottom: calc(var(--safe-b) + 16px); transform: translateX(-50%) translateY(8px); z-index: 60; padding: 10px 16px; border-radius: 999px; background: rgba(30, 30, 32, 0.92); color: #fff; font-size: 15px; opacity: 0; transition: opacity 0.2s, transform 0.2s; max-width: calc(100% - 32px); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; pointer-events: none; }
.toast.show { opacity: 1; transform: translateX(-50%); }
.login { position: absolute; inset: 0; z-index: 70; background: var(--bg-grouped); display: flex; align-items: center; justify-content: center; padding: 24px; }
.login-card { width: 100%; max-width: 320px; display: flex; flex-direction: column; gap: 12px; align-items: stretch; text-align: center; }
.login-icon { width: 72px; height: 72px; border-radius: 18px; margin: 0 auto 4px; background: var(--accent); position: relative; }
.login-icon::after { content: ""; position: absolute; left: 20px; top: 22px; width: 24px; height: 14px; border-left: 5px solid #fff; border-bottom: 5px solid #fff; transform: rotate(-45deg); }
.login h1 { margin: 0; font-size: 24px; }
.login p { margin: 0; color: var(--text-2); }
.login input { padding: 12px; border: 0; border-radius: 10px; background: var(--card); font-size: 17px; outline: none; text-align: center; }
.btn-primary { padding: 12px; border-radius: 10px; background: var(--accent); color: #fff; font-weight: 600; }
.login-error { color: var(--c-red); font-size: 14px; min-height: 18px; }

/* ---------- Einstellungen ---------- */
.settings-note { color: var(--text-2); font-size: 13px; line-height: 1.35; }
.code { font-family: "SF Mono", Menlo, Consolas, monospace; font-size: 13px; word-break: break-all; color: var(--text-2); }

/* ---------- Kompakt: kleine, fast quadratische Displays (Titan 2: 360×400) ---------- */
@container app (max-height: 560px) {
  .large-title { font-size: 26px; line-height: 30px; margin: 0 var(--gutter) 6px; }
  .large-title .n { font-size: 26px; }
  .nav { min-height: 38px; padding: 2px 6px; }
  .nav-btn { min-height: 38px; }
  .searchbar { height: 32px; margin: 2px var(--gutter) 10px; }
  .smart-grid { gap: 8px; margin-bottom: 12px; grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .smart { min-height: 0; padding: 8px 10px; gap: 2px; }
  .smart-icon { width: 24px; height: 24px; }
  .smart-icon .icon { width: 14px; height: 14px; }
  .smart-count { font-size: 18px; }
  .smart-name { font-size: 12px; }
  .smart.wide { grid-column: span 4; padding: 6px 10px; }
  .section-title { font-size: 17px; margin-bottom: 6px; }
  .group, .rem-group, .form-group { margin-bottom: 12px; }
  .row { min-height: 38px; padding: 4px 12px 4px 12px; font-size: 15px; }
  .row + .row::before, .rem + .rem::before, .rem + .rem-new::before, .frow + .frow::before { left: 48px; }
  .lbadge { width: 26px !important; height: 26px !important; }
  .lbadge .icon { width: 15px; height: 15px; }
  .rem, .rem-new { padding: 6px 10px 6px 12px; gap: 10px; }
  .rem-title, .rem-input { font-size: 15px; line-height: 20px; }
  .rem-notes, .rem-meta, .rem-notes-input { font-size: 13px; }
  .rem-check { width: 18px; height: 18px; }
  .rem.done .rem-check::after { width: 11px; height: 11px; }
  .rem-head { font-size: 16px; margin-bottom: 4px; }
  .empty { margin: 16px var(--gutter); font-size: 15px; }
  .sheet { max-height: 100%; border-radius: 0; }
  .sheet-nav { min-height: 40px; }
  .frow { min-height: 38px; padding: 4px 12px; font-size: 15px; }
  .finput { padding: 6px 0; font-size: 15px; }
  .fdate, .fselect { font-size: 14px; padding-top: 5px; padding-bottom: 5px; }
}
@container app (min-width: 700px) {
  .view { padding-left: max(0px, calc((100cqw - 700px) / 2)); padding-right: max(0px, calc((100cqw - 700px) / 2)); }
}
@media (hover: hover) {
  .row:hover, .as-item:hover, .fbtn:hover { background: var(--fill); }
  .smart:hover { filter: brightness(0.98); }
}
@media (prefers-reduced-motion: reduce) {
  .sheet, .overlay, .toast, .switch span, .switch span::after { transition: none; }
  .view.enter, .frow .fdate, #repeat-row { animation: none; }
}
