/* Meine Kalender – Oberfläche im Stil des iOS-Kalenders. Token (Farben, Schrift, Radien) kommen aus /core/tokens.css. */
:root { --app-accent: #ff3b30; --app-accent-soft: rgba(255, 59, 48, 0.12); --app-accent-dark: #ff453a; --app-accent-soft-dark: rgba(255, 69, 58, 0.2); --hour-h: 48px; --tl-gutter: 46px; }
* { 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; overflow-x: hidden; -webkit-overflow-scrolling: touch; overscroll-behavior-y: contain; padding: 0 0 calc(var(--tab-h) + var(--safe-b) + 16px); scroll-padding: calc(44px + var(--safe-t)) 0 calc(var(--tab-h) + var(--safe-b) + 16px); outline: none; }
.view.loading { opacity: 0.6; transition: opacity 0.15s; }
.page { padding: 0 var(--gutter); }

/* ---------- Navigationsleiste ---------- */
.navbar {
  position: sticky; top: 0; z-index: 20;
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: center;
  height: calc(44px + var(--safe-t)); padding: var(--safe-t) 6px 0;
  background: transparent; transition: background 0.2s;
}
.navbar.scrolled, .navbar:not(.has-large) {
  background: var(--bar);
  -webkit-backdrop-filter: saturate(180%) blur(20px); backdrop-filter: saturate(180%) blur(20px);
  box-shadow: 0 0.5px 0 var(--bar-border);
}
.nav-title { font-size: 17px; font-weight: 600; text-align: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 56cqw; opacity: 0; transition: opacity 0.2s; }
.navbar.scrolled .nav-title, .navbar:not(.has-large) .nav-title { opacity: 1; }
.nav-left { justify-self: start; display: flex; align-items: center; gap: 0; }
.nav-right { justify-self: end; display: flex; align-items: center; gap: 0; }
.nav-back { display: inline-flex; align-items: center; color: var(--accent); font-size: 17px; height: 44px; padding-right: 8px; border-radius: 8px; }
.nav-back span { margin-left: -4px; }
.nav-btn { color: var(--accent); width: 40px; height: 44px; display: inline-flex; align-items: center; justify-content: center; border-radius: 8px; }
.nav-text { color: var(--accent); font-size: 17px; height: 44px; padding: 0 8px; display: inline-flex; align-items: center; border-radius: 8px; white-space: nowrap; }
.nav-text.bold { font-weight: 600; }
.nav-btn:active, .nav-text:active, .nav-back:active { opacity: 0.5; }
.large-title { font-size: 34px; font-weight: 700; letter-spacing: 0.37px; line-height: 1.2; margin: 2px var(--gutter) 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.large-title.accent { color: var(--accent); }
.subtitle { margin: 0 var(--gutter) 10px; color: var(--text-2); font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ---------- Listen und Zeilen ---------- */
.settings-label { font-size: 13px; color: var(--text-2); text-transform: uppercase; letter-spacing: 0.4px; margin: 16px 0 6px 16px; }
.settings-label:first-child { margin-top: 6px; }
.settings-note { font-size: 13px; color: var(--text-2); margin: -8px 16px 16px; line-height: 1.35; }
.list { display: flex; flex-direction: column; }
.list.inset { background: var(--card); border-radius: 12px; overflow: hidden; box-shadow: 0 0 0 0.5px var(--sep); margin-bottom: 16px; }
.settings .list.inset + .list.inset { margin-top: -6px; }
.row { display: flex; align-items: center; gap: 12px; min-height: 46px; padding: 6px 12px; position: relative; cursor: pointer; width: 100%; text-align: left; }
.row::after { content: ""; position: absolute; left: 12px; right: 0; bottom: 0; height: 0.5px; background: var(--sep); }
.row:last-child::after { display: none; }
.row:active { background: var(--fill); }
.row-text { flex: 1; min-width: 0; }
.row-title { font-size: 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row-title.danger { color: var(--accent); }
.row-sub { font-size: 13px; color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 1px; }
.row-value { color: var(--text-2); font-size: 15px; flex-shrink: 0; max-width: 55%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-chevron { color: var(--text-3); display: inline-flex; }
.row.setting { min-height: 46px; padding-top: 8px; padding-bottom: 8px; }
.row.setting.static { cursor: default; }
.row.setting.static:active { background: transparent; }
.row.setting .row-sub { white-space: normal; line-height: 1.35; }
.lib-icon { width: 28px; display: inline-flex; justify-content: center; color: var(--text-2); }
.info-btn { color: var(--text-3); width: 30px; height: 30px; display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; margin-right: -6px; }
.info-btn:active { color: var(--accent); }
.status-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--c-green); margin-right: 8px; vertical-align: 1px; }
.status-dot.off { background: var(--c-gray); }
.cbadge { width: 12px; height: 12px; border-radius: 50%; background: var(--lc); flex-shrink: 0; }
.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 { text-align: center; color: var(--text-2); padding: 28px 16px; font-size: 16px; }
.empty .icon { color: var(--text-3); margin-bottom: 8px; }
.empty.compact { padding: 14px 16px; }
.empty-title { font-size: 20px; font-weight: 700; color: var(--text); }
.empty-text { font-size: 15px; margin-top: 6px; }
.card { display: block; min-width: 0; background: var(--card); border-radius: 12px; padding: 12px; box-shadow: 0 0 0 0.5px var(--sep); }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 12px; }
.hscroll { display: flex; gap: 12px; overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none; margin: 0 calc(-1 * var(--gutter)); padding: 0 var(--gutter); }
.hscroll::-webkit-scrollbar { display: none; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; background: var(--fill); color: var(--accent); font-size: 15px; font-weight: 600; border-radius: 10px; border: 1px solid var(--btn-border); height: 44px; padding: 0 12px; }
.btn.accent { background: var(--accent); color: #fff; border-color: transparent; }
.play-buttons { display: flex; gap: 10px; margin-top: 12px; }
.linkbtn { color: var(--accent); font-size: 13px; font-weight: 500; }

/* Termin-Zeile (Tag ganztägig, Monat, Suche) */
.row.ev .ev-bar { width: 4px; align-self: stretch; border-radius: 2px; background: var(--ec); flex-shrink: 0; margin: 3px 0; }
.row.ev .ev-time { width: 64px; flex-shrink: 0; font-size: 13px; color: var(--text-2); line-height: 1.2; }
.row.ev .ev-time b { display: block; color: var(--text); font-weight: 500; font-size: 15px; }
.row.ev.past .row-title, .row.ev.past .ev-time { opacity: 0.6; }
.row.ev .row-sub .icon { width: 12px; height: 12px; margin-right: 3px; }
/* Erinnerung im Tag */
.row.rem .rem-check { width: 20px; height: 20px; border-radius: 50%; border: 1.5px solid var(--lc); flex-shrink: 0; }
.row.rem .row-sub.overdue { color: var(--c-red); }

/* ---------- Suche ---------- */
.searchbar { display: flex; align-items: center; gap: 6px; margin: 6px var(--gutter) 12px; 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); }

/* ---------- Monat ---------- */
.mgrid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); margin: 2px 0 10px; }
.mgrid.weeknums { grid-template-columns: 22px repeat(7, minmax(0, 1fr)); }
.mhead { text-align: center; font-size: 12px; font-weight: 600; color: var(--text-2); padding: 2px 0 6px; }
.mhead.we { color: var(--text-3); }
.mwk { font-size: 10px; color: var(--text-3); display: flex; justify-content: center; padding-top: 8px; border-top: 0.5px solid var(--sep); }
.mday { position: relative; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 3px 0 4px; min-height: 50px; border-top: 0.5px solid var(--sep); border-radius: 8px; color: var(--text); }
.mday .n { width: 30px; height: 30px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; font-size: 16px; font-weight: 500; }
.mday.other { color: var(--text-3); }
.mday.we:not(.other) .n { color: var(--text-2); }
.mday.today .n { color: var(--accent); font-weight: 700; }
.mday.sel .n { background: var(--text); color: var(--bg); }
.mday.today.sel .n { background: var(--accent); color: #fff; }
.mday .dots { display: flex; gap: 3px; height: 6px; }
.mday .dots i { width: 6px; height: 6px; border-radius: 50%; background: var(--dc); }
.mday.other .dots { opacity: 0.4; }
.mday:active { background: var(--fill); }

/* ---------- Tag: Zeitleiste ---------- */
.timeline { position: relative; margin: 4px 0 12px; height: calc(24 * var(--hour-h)); }
.hour { position: absolute; left: 0; right: 0; height: var(--hour-h); }
.hour::before { content: ""; position: absolute; left: var(--tl-gutter); right: 0; top: 0; height: 0.5px; background: var(--sep); }
.hour span { position: absolute; left: 0; top: -7px; width: calc(var(--tl-gutter) - 8px); text-align: right; font-size: 11px; color: var(--text-2); font-variant-numeric: tabular-nums; }
.tl-events { position: absolute; left: var(--tl-gutter); right: 0; top: 0; bottom: 0; }
.tl-event {
  position: absolute; display: flex; flex-direction: column; justify-content: flex-start; gap: 0; padding: 3px 6px; border-radius: 6px;
  background: var(--fill); background: color-mix(in srgb, var(--ec) 22%, var(--card)); border-left: 3px solid var(--ec);
  color: var(--text); font-size: 13px; line-height: 1.25; overflow: hidden; text-align: left; min-height: 16px; box-shadow: 0 0 0 0.5px var(--bg-grouped);
}
.tl-event b { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tl-event small { color: var(--text-2); font-size: 11px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tl-event.short { flex-direction: row; gap: 6px; align-items: center; padding-top: 0; padding-bottom: 0; }
.tl-event.short b { flex: 0 1 auto; }
.tl-event.short small { flex: 1 1 0; min-width: 0; }
.tl-event.past { opacity: 0.65; }
.tl-event:active { filter: brightness(0.95); }
.now-line { position: absolute; left: calc(var(--tl-gutter) - 5px); right: 0; height: 2px; background: var(--accent); z-index: 2; pointer-events: none; }
.now-line::before { content: ""; position: absolute; left: -4px; top: -4px; width: 10px; height: 10px; border-radius: 50%; background: var(--accent); }
.now-line span { position: absolute; right: calc(100% + 9px); top: -8px; font-size: 11px; color: var(--accent); font-weight: 600; font-variant-numeric: tabular-nums; }

/* ---------- Tab-Leiste ---------- */
.tabbar {
  position: absolute; left: 0; right: 0; bottom: 0; z-index: 30;
  height: calc(var(--tab-h) + var(--safe-b)); padding-bottom: var(--safe-b);
  display: flex; justify-content: space-around; align-items: stretch;
  background: var(--bar); box-shadow: 0 -0.5px 0 var(--bar-border);
  -webkit-backdrop-filter: saturate(180%) blur(20px); backdrop-filter: saturate(180%) blur(20px);
}
.tabbar a { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px; color: var(--text-2); font-size: 10px; font-weight: 500; }
.tabbar a.active { color: var(--accent); }
.tabbar a:active { opacity: 0.6; }
.tab-icon { display: inline-flex; height: 28px; align-items: center; }

/* ---------- Overlay: Sheet, Auswahl, Menü, Dialog ---------- */
.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.show { background: rgba(0, 0, 0, 0.4); }
.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.show .sheet { transform: none; }
.sheet-nav { display: flex; align-items: center; justify-content: space-between; min-height: 50px; padding: 4px 8px; flex-shrink: 0; }
.sheet-nav .nav-title { opacity: 1; flex: 1; }
.sheet-body { overflow-y: auto; padding: 4px 0 calc(var(--safe-b) + 16px); }
.form-group { margin: 0 var(--gutter) 16px; background: var(--card); border-radius: 12px; overflow: hidden; box-shadow: 0 0 0 0.5px var(--sep); }
.frow { display: flex; align-items: center; gap: 12px; min-height: 44px; padding: 6px 16px; position: relative; }
.frow + .frow::before { content: ""; position: absolute; left: 16px; right: 0; top: 0; height: 0.5px; background: var(--sep); }
.frow.col { flex-direction: column; align-items: stretch; gap: 0; }
.frow-icon { width: 28px; height: 28px; border-radius: 7px; background: var(--fc); color: #fff; display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; }
.frow-icon .icon { width: 17px; height: 17px; 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; }
.frow-inputs { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.frow.when { flex-direction: column; align-items: stretch; gap: 4px; padding-top: 8px; padding-bottom: 8px; }
.frow.when .frow-label { font-size: 13px; color: var(--text-2); flex: none; }
.frow.when .frow-inputs { justify-content: flex-start; }
.frow.when .fdate { flex: 1 1 auto; min-width: 0; }
.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: 56px; 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; }
.fselect { border: 0; background: var(--fill); border-radius: 8px; padding: 7px 28px 7px 10px; font-size: 15px; color: var(--text); -webkit-appearance: none; appearance: none; max-width: 60%; text-overflow: ellipsis;
  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: -8px var(--gutter) 16px; color: var(--text-2); font-size: 13px; line-height: 1.35; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; padding: 0 0 8px; }
.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; }
/* Kalender-Sheet: Vorschau, Farben */
.list-preview { display: flex; flex-direction: column; align-items: center; gap: 14px; padding: 18px 16px 8px; }
.list-preview .lbadge { width: 84px; height: 84px; box-shadow: 0 8px 20px rgba(0, 0, 0, 0.2); }
.list-preview .lbadge .icon { width: 44px; height: 44px; }
.list-name-input { width: 100%; text-align: center; font-size: 22px; font-weight: 700; background: var(--fill); border: 0; border-radius: 12px; padding: 10px; outline: none; }
.swatches { display: grid; grid-template-columns: repeat(6, 1fr); gap: 14px; padding: 14px 16px; justify-items: center; }
.swatch { width: 34px; height: 34px; 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); }
/* Auswahl-Sheet (Listen) */
.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: 52px; display: flex; align-items: center; gap: 12px; padding: 0 20px; font-size: 18px; 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 small { display: block; font-size: 12px; color: var(--text-2); }
.as-item.danger { color: var(--c-red); }
.as-item.on { color: var(--text); }
.as-item.as-cancel { justify-content: center; font-weight: 600; }
.as-item.as-cancel span { text-align: center; }
.as-item:active { background: var(--fill); }
/* Dropdown-Menü am „…“ oder am fokussierten Eintrag */
.overlay.menu-mode { display: block; }
.overlay.menu-mode.show { background: rgba(0, 0, 0, 0.12); }
.menu {
  position: absolute; z-index: 1; overflow-y: auto;
  background: var(--bar); border-radius: 13px;
  -webkit-backdrop-filter: saturate(180%) blur(24px); backdrop-filter: saturate(180%) blur(24px);
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3), 0 0 0 0.5px var(--bar-border);
  transform: scale(0.6); opacity: 0; transition: transform 0.18s cubic-bezier(0.2, 0.9, 0.3, 1.2), opacity 0.12s;
  -webkit-user-select: none; user-select: none;
}
.overlay.show .menu { transform: scale(1); opacity: 1; }
.menu-header { padding: 10px 14px; font-size: 13px; color: var(--text-2); box-shadow: 0 0.5px 0 var(--sep); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.menu-item { width: 100%; display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 44px; padding: 0 14px; font-size: 16px; color: var(--text); text-align: left; box-shadow: 0 0.5px 0 var(--sep) inset; }
.menu-item:first-child, .menu-header + .menu-item, .menu-sep + .menu-item { box-shadow: none; }
.menu-item span { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.menu-item small { display: block; font-size: 11px; color: var(--text-2); }
.menu-item .icon { color: var(--text); flex-shrink: 0; }
.menu-item.danger, .menu-item.danger .icon { color: var(--c-red); }
.menu-item:active { background: var(--fill); }
.menu-sep { height: 6px; background: rgba(120, 120, 128, 0.18); box-shadow: 0 0.5px 0 var(--sep), 0 -0.5px 0 var(--sep); }
/* Dialog */
.overlay.dialog-mode { align-items: center; }
.alert { width: 270px; max-width: calc(100% - 40px); background: var(--card); border-radius: 14px; overflow: hidden; transform: scale(1.1); opacity: 0; transition: transform 0.15s, opacity 0.15s; }
.overlay.show .alert { transform: scale(1); opacity: 1; }
.alert-body { padding: 18px 16px 14px; text-align: center; }
.alert-title { font-size: 17px; font-weight: 600; }
.alert-msg { font-size: 13px; color: var(--text-2); margin-top: 4px; line-height: 1.4; word-break: break-word; }
.alert-title:empty { display: none; }
.alert-input { width: 100%; margin-top: 12px; font: inherit; font-size: 14px; padding: 7px 8px; border-radius: 6px; border: 0.5px solid var(--sep); background: var(--bg); color: var(--text); outline: none; }
.alert-actions { display: flex; box-shadow: 0 0.5px 0 var(--sep) inset; }
.alert-actions button { flex: 1; min-height: 44px; color: var(--accent); font-size: 17px; }
.alert-actions button + button { box-shadow: 0.5px 0 0 var(--sep) inset; }
.alert-actions .bold { font-weight: 600; }
.alert-actions .danger { color: var(--c-red); font-weight: 600; }
.alert-actions button:active { background: var(--fill); }

/* ---------- Toast, Login ---------- */
.toast { position: absolute; left: 50%; bottom: calc(var(--tab-h) + 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; background: var(--card); border-radius: 16px; padding: 22px 20px; text-align: center; box-shadow: var(--shadow); }
.login-icon { width: 56px; height: 56px; border-radius: 14px; background: var(--accent); color: #fff; display: inline-flex; align-items: center; justify-content: center; margin-bottom: 10px; }
.login-card h1 { font-size: 22px; margin: 0; }
.login-card p { color: var(--text-2); margin: 4px 0 14px; font-size: 14px; }
.login-card input { width: 100%; font: inherit; font-size: 17px; padding: 10px 12px; border-radius: 10px; border: 0; background: var(--fill); color: var(--text); margin-bottom: 12px; outline: none; }
.btn-primary { width: 100%; padding: 12px; border-radius: 10px; background: var(--accent); color: #fff; font-weight: 600; font-size: 16px; }
.login-error { color: var(--c-red); font-size: 14px; margin-top: 10px; min-height: 18px; }
.login-back { margin-top: 6px; }

/* ---------- Einstellungen ---------- */
.seg-row { gap: 10px; }
.seg-row .row-text { flex: 1 1 auto; }
.seg { display: flex; background: var(--fill); border-radius: 9px; padding: 2px; flex: 0 0 auto; }
.seg button { padding: 5px 10px; border-radius: 7px; font-size: 13px; font-weight: 600; color: var(--text-2); transition: background 0.15s, color 0.15s; }
.seg button.on { background: var(--card); color: var(--text); box-shadow: 0 1px 3px rgba(0, 0, 0, 0.18), 0 0 0 0.5px var(--sep); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .seg button.on { background: rgba(120, 120, 128, 0.5); } }
:root[data-theme="dark"] .seg button.on { background: rgba(120, 120, 128, 0.5); }
.toggle { width: 51px; height: 31px; border-radius: 16px; background: var(--fill-2); position: relative; flex-shrink: 0; transition: background 0.2s; }
.toggle i { 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; }
.toggle.on { background: var(--c-green); }
.toggle.on i { transform: translateX(20px); }
.code { font-family: "SF Mono", Menlo, Consolas, monospace; font-size: 13px; word-break: break-all; color: var(--text-2); }

/* ---------- 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; }
.row.kfocus { outline: none !important; background: var(--fill); box-shadow: inset 3px 0 0 var(--accent); }
.tl-event.kfocus { outline-offset: 0; z-index: 3; }
.mday.kfocus { outline-offset: -2px; }
#tabbar a.kfocus { outline-offset: -6px; }
.frow:has(.kfocus) { background: var(--fill); }
.frow .switch input.kfocus { outline: none !important; }
.frow .fselect.kfocus, .frow .fdate.kfocus { outline-offset: 0; }


/* ---------- Titelzeile mit Ansichtswechsel, Wochenliste ---------- */
.title-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: 2px var(--gutter) 0; }
.title-row .large-title { margin: 0; min-width: 0; flex: 1; }
.view-seg { flex-shrink: 0; }
.view-seg button { padding: 5px 9px; }
.settings-label.accent { color: var(--accent); }
.settings-label.sub { text-transform: none; letter-spacing: 0; font-weight: 600; color: var(--text); font-size: 15px; margin-top: 12px; }
.settings-label[data-date] { cursor: pointer; }
.agenda-empty { color: var(--text-3); font-size: 14px; margin: 0 16px 12px; }
.off-hours { position: absolute; left: 0; right: 0; background: var(--fill); opacity: 0.35; pointer-events: none; border-radius: 4px; }
.chip .cbadge { width: 9px; height: 9px; }

/* ---------- Übersicht › Woche ---------- */
.wk { margin: 4px 0 12px; --wcols: var(--cols, 7); }
.wk-head, .wk-allday { display: grid; grid-template-columns: var(--tl-gutter) repeat(var(--wcols), minmax(0, 1fr)); }
.wk-head { position: sticky; top: calc(44px + var(--safe-t)); z-index: 5; background: var(--bg-grouped); padding-bottom: 4px; }
.wk-day { display: flex; flex-direction: column; align-items: center; gap: 1px; padding: 4px 0 2px; border-radius: 8px; font-size: 11px; color: var(--text-2); min-width: 0; }
.wk-day b { width: 26px; height: 26px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; font-size: 15px; color: var(--text); font-weight: 500; }
.wk-day.we { color: var(--text-3); }
.wk-day.today { color: var(--accent); }
.wk-day.today b { background: var(--accent); color: #fff; font-weight: 700; }
.wk-day:active { background: var(--fill); }
.wk-allday { margin-bottom: 4px; }
.wk-adcell { display: flex; flex-direction: column; gap: 2px; padding: 0 1px; min-width: 0; }
.wk-chip { font-size: 10px; line-height: 1.3; padding: 2px 4px; border-radius: 4px; background: var(--fill); background: color-mix(in srgb, var(--ec) 28%, var(--card)); border-left: 2px solid var(--ec); color: var(--text); text-align: left; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.wk-chip.past { opacity: 0.6; }
.wk-grid { display: grid; grid-template-columns: var(--tl-gutter) repeat(var(--wcols), minmax(0, 1fr)); height: calc(24 * var(--hour-h)); position: relative; }
.wk-hours { position: relative; }
.wk-hours span { position: absolute; left: 0; width: calc(var(--tl-gutter) - 6px); text-align: right; font-size: 10px; color: var(--text-2); transform: translateY(-50%); font-variant-numeric: tabular-nums; }
.wk-col { position: relative; border-left: 0.5px solid var(--sep); background-image: repeating-linear-gradient(to bottom, var(--sep) 0, var(--sep) 0.5px, transparent 0.5px, transparent var(--hour-h)); }
.wk-col.today { background-color: color-mix(in srgb, var(--accent) 7%, transparent); }
.wk .tl-event { padding: 1px 3px; font-size: 11px; line-height: 1.2; border-left-width: 2px; border-radius: 4px; box-shadow: none; min-height: 12px; }
.wk .tl-event.short { padding: 0 3px; }
.wk .tl-event b { font-weight: 600; }
.wk .now-line { left: 0; }
.wk .now-line::before { left: -4px; }
.wk .now-line span { display: none; }

/* ---------- Übersicht › Jahr ---------- */
.ygrid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px 8px; margin-top: 4px; }
.ymonth { min-width: 0; }
.ymonth-title { font-size: 13px; font-weight: 700; color: var(--accent); padding: 2px 4px; border-radius: 6px; text-align: left; width: 100%; }
.ymonth.current .ymonth-title { background: var(--accent-soft); }
.ymini { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 1px 0; font-size: 9px; text-align: center; }
.ymini .h { color: var(--text-3); font-weight: 600; }
.yday { height: 14px; line-height: 14px; border-radius: 50%; color: var(--text); }
.yday.other { visibility: hidden; }
.yday.we { color: var(--text-2); }
.yday.has { background: var(--fill-2); }
.yday.today { background: var(--accent); color: #fff; font-weight: 700; }

/* ---------- Monat auf breiten Fenstern: Titel statt Punkte ---------- */
.mday-events { display: none; flex-direction: column; gap: 2px; width: 100%; padding: 0 3px; min-width: 0; }
.mday-ev { font-size: 11px; line-height: 1.3; padding: 1px 4px; border-radius: 4px; background: var(--fill); background: color-mix(in srgb, var(--ec) 28%, var(--card)); border-left: 2px solid var(--ec); text-align: left; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--text); width: 100%; }
.mday-ev i { font-style: normal; color: var(--text-2); font-variant-numeric: tabular-nums; }
.mday-more { font-size: 10px; color: var(--text-2); padding-left: 4px; text-align: left; }
@container app (min-width: 600px) {
  .ygrid { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
  .mday { min-height: 92px; align-items: stretch; padding: 2px 2px 4px; border-radius: 0; }
  .mday .n { align-self: flex-end; width: 24px; height: 24px; font-size: 13px; margin-right: 2px; }
  .mday .dots { display: none; }
  .mday-events { display: flex; }
  .wk .tl-event { font-size: 12px; }
}

/* ---------- Kalender-Sheet: ein-/ausblenden ---------- */
.cal-row { gap: 10px; padding-right: 8px; }
.cal-check { width: 24px; height: 24px; border-radius: 50%; border: 2px solid var(--lc); color: #fff; display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; }
.cal-check.on { background: var(--lc); }
.cal-check:not(.on) .icon { visibility: hidden; }
.cal-name { flex: 1; min-width: 0; text-align: left; display: flex; min-height: 40px; align-items: center; }
.cal-edit { color: var(--accent); width: 40px; height: 40px; display: inline-flex; align-items: center; justify-content: center; margin-right: -8px; flex-shrink: 0; }

/* ---------- Textgröße (Einstellungen › Darstellung) ---------- */
.view, .sheet, .menu, .alert { zoom: var(--ts, 1); }

/* ---------- Kompakt: kleine, fast quadratische Displays (Titan 2 Elite: 360×400) ---------- */
@container app (max-height: 600px) {
  :root { --tab-h: 42px; --hour-h: 40px; }
  .navbar { height: calc(38px + var(--safe-t)); }
  .nav-btn, .nav-text, .nav-back { height: 38px; }
  .large-title { font-size: 24px; line-height: 28px; }
  .subtitle { font-size: 13px; margin-bottom: 6px; }
  .settings-label { margin: 10px 0 4px 12px; font-size: 12px; }
  .list.inset { margin-bottom: 10px; }
  .row { min-height: 38px; padding: 4px 10px; gap: 10px; }
  .row-title { font-size: 15px; }
  .row-sub, .row-value { font-size: 12px; }
  .row.ev .ev-time { width: 56px; font-size: 12px; }
  .row.ev .ev-time b { font-size: 13px; }
  .mday { min-height: 40px; padding: 2px 0 3px; gap: 1px; }
  .mday .n { width: 26px; height: 26px; font-size: 14px; }
  .mhead { font-size: 11px; padding-bottom: 3px; }
  .tabbar a { font-size: 9px; }
  .tab-icon { height: 24px; }
  .tab-icon .icon { width: 22px; height: 22px; }
  .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; }
  .form-group { margin-bottom: 10px; }
  .form-note { margin-bottom: 10px; }
  .empty { padding: 14px 12px; font-size: 15px; }
  .searchbar { height: 32px; margin: 2px var(--gutter) 8px; }
  .as-item { min-height: 44px; font-size: 16px; }
  .login-card { padding: 16px; }
  .title-row { margin-top: 0; }
  .view-seg button { padding: 4px 7px; font-size: 12px; }
  .wk-day { font-size: 10px; padding: 2px 0; }
  .wk-day b { width: 22px; height: 22px; font-size: 13px; }
  .wk-head { top: calc(38px + var(--safe-t)); }
  .wk .tl-event { font-size: 9px; padding: 0 2px; border-left-width: 2px; }
  .wk .tl-event b { font-weight: 500; }
  .ymini { font-size: 8px; }
  .yday { height: 12px; line-height: 12px; }
}
/* Breite Fenster (Tablet, Desktop): Inhalt mittig begrenzen */
@container app (min-width: 700px) {
  .page, .title-row, .subtitle, .searchbar { max-width: 720px; margin-left: auto; margin-right: auto; }
  .title-row, .subtitle { padding: 0 var(--gutter); }
  .navbar { padding-left: max(6px, calc((100cqw - 720px) / 2 + 6px)); padding-right: max(6px, calc((100cqw - 720px) / 2 + 6px)); }
  .searchbar { margin-left: max(var(--gutter), calc((100cqw - 720px) / 2 + var(--gutter))); margin-right: max(var(--gutter), calc((100cqw - 720px) / 2 + var(--gutter))); }
}
@media (hover: hover) {
  .row:hover, .as-item:hover, .fbtn:hover, .menu-item:hover { background: var(--fill); }
  .row.setting.static:hover { background: transparent; }
  .mday:hover { background: var(--fill); }
}
@media (prefers-reduced-motion: reduce) {
  .sheet, .overlay, .toast, .switch span, .switch span::after, .menu, .alert, .toggle, .toggle i { transition: none; }
}
