:root {
  --bg: #0b1220;
  --bg-elev: #131c30;
  --bg-elev2: #1b2540;
  --border: #243152;
  --text: #e6ecff;
  --text-dim: #94a3c4;
  --accent: #6366f1;
  --accent-hover: #818cf8;
  --danger: #ef4444;
  --success: #10b981;
  --warning: #f59e0b;
  --today-bg: rgba(99, 102, 241, 0.15);
  --hover: rgba(255,255,255,0.06);
  --shadow: 0 12px 40px rgba(0,0,0,0.4);
  --radius: 14px;
  --radius-sm: 8px;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-top: env(safe-area-inset-top, 0px);
  color-scheme: dark;
}
/* Hell erzwungen (Einstellungen → Darstellung → Hell) */
:root.theme-light {
  --bg: #f7f8fc;
  --bg-elev: #ffffff;
  --bg-elev2: #f0f3fb;
  --border: #d8dee9;
  --text: #1a2233;
  --text-dim: #5b6582;
  --today-bg: rgba(99, 102, 241, 0.12);
  --hover: rgba(0,0,0,0.04);
  --shadow: 0 8px 30px rgba(20,30,60,0.12);
  color-scheme: light;
}
/* System-Modus folgt dem Gerät (native Steuerelemente via color-scheme) */
:root.theme-auto { color-scheme: light dark; }
@media (prefers-color-scheme: light) {
  :root.theme-auto {
    --bg: #f7f8fc;
    --bg-elev: #ffffff;
    --bg-elev2: #f0f3fb;
    --border: #d8dee9;
    --text: #1a2233;
    --text-dim: #5b6582;
    --today-bg: rgba(99, 102, 241, 0.12);
    --hover: rgba(0,0,0,0.04);
    --shadow: 0 8px 30px rgba(20,30,60,0.12);
  }
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body {
  margin: 0; padding: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  overflow: hidden;
  height: 100dvh;
  user-select: none;
}
button { font: inherit; color: inherit; background: transparent; border: 0; cursor: pointer; }
input, textarea, select {
  font: inherit; color: inherit; background: var(--bg-elev2);
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 10px 12px; outline: none;
  width: 100%;
}
input:focus, textarea:focus, select:focus { border-color: var(--accent); }
textarea { resize: none; overflow: hidden; min-height: 60px; }

.app {
  display: grid;
  grid-template-rows: auto 1fr auto;
  /* Single column capped at the viewport width. Without this the implicit
     'auto' column sizes to max-content, so a long nowrap title (e.g.
     "23.–29. November 2026") widens the whole app past the viewport and the
     Sunday column of the week grid gets clipped on the right. */
  grid-template-columns: minmax(0, 1fr);
  height: 100dvh;
  padding-top: var(--safe-top);
  padding-bottom: var(--safe-bottom);
}

/* ===== Top bar ===== */
.topbar {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 14px;
  background: var(--bg-elev);
  border-bottom: 1px solid var(--border);
  position: relative;
  z-index: 5;
}
.topbar .menu, .topbar .icon-btn {
  width: 38px; height: 38px;
  display: grid; place-items: center;
  border-radius: 10px;
}
.topbar .icon-btn:hover { background: var(--hover); }
.topbar .title {
  flex: 1; font-weight: 600; font-size: 18px;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.topbar .title small { color: var(--text-dim); font-weight: 400; }

.view-switch {
  display: flex; gap: 4px; background: var(--bg-elev2); padding: 4px; border-radius: 10px;
}
.view-switch button {
  padding: 6px 12px; border-radius: 7px; font-size: 13px; color: var(--text-dim);
  white-space: nowrap;
}
.view-switch button.active {
  background: var(--accent); color: white;
}
/* Theme-Umschalter in den Einstellungen (gleiche Segment-Optik, gleichmäßige Breite) */
.theme-switch { display: flex; width: 100%; }
.theme-switch button { flex: 1; text-align: center; }
/* Im Drawer (5 Buttons in 280px) als Grid statt Flexbox — sonst überlaufen die Labels. */
.drawer-section .view-switch {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 4px;
  padding: 4px;
}
.drawer-section .view-switch button {
  padding: 8px 4px;
  font-size: 12px;
  text-align: center;
  border-radius: 7px;
  min-width: 0;
}

/* ===== Sidebar / Drawer ===== */
.drawer {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.5);
  opacity: 0; pointer-events: none;
  transition: opacity .2s;
  /* muss über der Bottom-Bar (z-index 60) liegen, sonst verdeckt diese im
     Overlay-Modus die unteren Drawer-Links (Suchen/Wecker/Einstellungen/Export) */
  z-index: 80;
}
.drawer.open { opacity: 1; pointer-events: auto; }
.drawer-inner {
  position: absolute; left: 0; top: 0; bottom: 0;
  width: 86%; max-width: 320px;
  background: var(--bg-elev);
  transform: translateX(-100%); transition: transform .25s;
  display: flex; flex-direction: column;
  padding-top: var(--safe-top);
  /* lange Inhalte (viele Kalender) bleiben erreichbar statt unten abgeschnitten */
  overflow-y: auto;
  overscroll-behavior: contain;
  padding-bottom: var(--safe-bottom);
}
.drawer.open .drawer-inner { transform: translateX(0); }
.drawer-header { padding: 18px 18px 8px; border-bottom: 1px solid var(--border); }
.drawer-header h2 { margin: 0; font-size: 20px; }
.drawer-header small { color: var(--text-dim); }
.drawer-section { padding: 12px 14px; }
.drawer-section h3 { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: 11px; color: var(--text-dim); text-transform: uppercase; letter-spacing: 1px; margin: 0 0 8px; padding: 0 4px; }
.cal-item {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px; border-radius: 8px; cursor: pointer;
}
.cal-item:hover { background: var(--hover); }
.cal-item .dot {
  width: 16px; height: 16px; border-radius: 4px;
  position: relative;
}
.cal-item .dot.off { opacity: .25; }
.cal-item .dot.off::after { content: ""; position: absolute; inset: 0; border: 2px solid var(--text); border-radius: 4px; }
.cal-item .label { flex: 1; font-size: 14px; }
.cal-item .edit {
  color: var(--text-dim);
  width: 30px; height: 30px;
  display: grid; place-items: center;
  border-radius: 6px;
  flex: 0 0 auto;
}
.cal-item .edit:hover { color: var(--text); background: var(--hover); }
.cal-item .edit svg { width: 14px; height: 14px; display: block; }

.drawer-section .link {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 10px; border-radius: 8px; cursor: pointer; font-size: 14px;
}
.drawer-section .link:hover { background: var(--hover); }
.drawer-section .link svg { width: 18px; height: 18px; }

/* ===== Layout ===== */
.layout {
  display: flex;
  flex: 1;
  min-height: 0;
}
.main {
  position: relative;
  overflow: hidden;
  background: var(--bg);
  flex: 1;
  min-width: 0;
  min-height: 0;
}

/* === Month view === */
.month {
  display: grid; grid-template-rows: auto 1fr;
  height: 100%;
}
.month .weekdays {
  display: grid; grid-template-columns: repeat(7, 1fr);
  border-bottom: 1px solid var(--border);
  background: var(--bg-elev);
}
.month .weekdays div {
  text-align: center; padding: 8px 0;
  font-size: 11px; color: var(--text-dim); text-transform: uppercase; font-weight: 600;
}
.month .grid {
  display: grid; grid-template-columns: repeat(7, 1fr);
  grid-auto-rows: 1fr;
  overflow: hidden;
}
.month .cell {
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  padding: 4px 5px;
  min-height: 0;
  overflow: hidden;
  position: relative;
  cursor: pointer;
  display: flex; flex-direction: column;
}
.month .cell:hover { background: var(--hover); }
.month .cell.other { opacity: .35; }
.month .cell .daynum {
  font-size: 13px; font-weight: 500;
  margin-bottom: 2px;
}
.month .cell.today .daynum {
  background: var(--accent); color: white;
  width: 26px; height: 26px; line-height: 26px;
  text-align: center; border-radius: 50%; font-weight: 600;
}
.month .cell .evts { display: flex; flex-direction: column; gap: 2px; min-height: 0; overflow: hidden; }
.month .cell .ev {
  font-size: 11px;
  padding: 1px 5px;
  border-radius: 4px;
  background: var(--accent);
  color: white;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  border-left: 3px solid rgba(0,0,0,.25);
}
.month .cell .more { font-size: 10px; color: var(--text-dim); padding-left: 4px; }

/* === Week / Day / 3-day views === */
.week, .day, .multi {
  display: grid; grid-template-rows: auto auto 1fr;
  height: 100%;
  min-height: 0;
}
.week .head, .day .head, .multi .head {
  display: grid;
  background: var(--bg-elev); border-bottom: 1px solid var(--border);
}
.week .head .col, .day .head .col, .multi .head .col {
  text-align: center;
  padding: 8px 4px;
  cursor: pointer;
}
.week .head .col .wday, .day .head .col .wday, .multi .head .col .wday { font-size: 10px; color: var(--text-dim); text-transform: uppercase; }
.week .head .col .num, .day .head .col .num, .multi .head .col .num { font-size: 20px; font-weight: 600; line-height: 1.2; }
.week .head .col.today .num, .day .head .col.today .num, .multi .head .col.today .num {
  background: var(--accent); color: white; border-radius: 50%;
  width: 32px; height: 32px; line-height: 32px; margin: 0 auto;
  font-size: 14px;
}

.timegrid-scroll {
  overflow-y: auto;
  overflow-x: hidden;
  position: relative;
  min-height: 0;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
}
.timegrid {
  --hour-h: 56px;
  position: relative;
  display: grid;
}
.timegrid .hour-col {
  border-right: 1px solid var(--border);
}
.timegrid .hour-col .hour-label {
  height: var(--hour-h);
  text-align: right;
  padding: 0 6px;
  font-size: 10px;
  color: var(--text-dim);
  position: relative;
  top: -7px;
}
.timegrid .day-col {
  position: relative;
  border-right: 1px solid var(--border);
}
.timegrid .day-col .slot {
  height: var(--hour-h);
  border-bottom: 1px solid var(--border);
}
.timegrid .day-col.today { background: var(--today-bg); }
.timegrid .ev-block {
  position: absolute;
  left: 1px; right: 1px;
  background: var(--accent); color: white;
  border-radius: 6px;
  padding: 2px 5px;
  font-size: 12px;
  overflow: hidden;
  cursor: grab;
  border-left: 2px solid rgba(0,0,0,.3);
  z-index: 2;
  /* none statt manipulation: verhindert dass iOS den Touch klaut, sobald Scrollen erkannt wird.
     Folge: man scrollt das Raster nicht mehr, indem man auf einem Termin startet — sondern nur
     auf freien Slots. Im Gegenzug: Long-Press-Drag funktioniert zuverlässig. */
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  transition: box-shadow .15s ease;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
}
@media (hover: none) and (pointer: coarse) {
  .timegrid .ev-block { cursor: pointer; }
}
.timegrid .ev-block.pressing {
  animation: evPress 400ms ease-out forwards;
}
@keyframes evPress {
  0%   { transform: scale(1); box-shadow: none; }
  100% { transform: scale(1.04); box-shadow: 0 6px 18px rgba(0,0,0,0.3); }
}
.timegrid .ev-block.dragging {
  opacity: 0.94;
  box-shadow: 0 14px 32px rgba(0,0,0,0.45);
  z-index: 20;
  cursor: grabbing;
  transition: none;
  animation: none;
  transform: scale(1.04);
}
.timegrid .ev-block.ghost {
  background: var(--accent);
  opacity: 0.55;
  border: 2px dashed rgba(255,255,255,0.85);
  border-left-width: 3px;
  pointer-events: none;
  z-index: 18;
  cursor: ns-resize;
}
.timegrid .day-col .slot { cursor: cell; }
/* Uhrzeit standardmäßig ausgeblendet — links steht ja schon die Stundenachse.
   Während des Drags wird sie kurz eingeblendet als Feedback wohin man zieht. */
.timegrid .ev-block .t { display: none; opacity: .85; font-size: 10px; }
.timegrid .ev-block.dragging .t,
.timegrid .ev-block.pressing .t { display: block; }
.timegrid .ev-block .title {
  font-weight: 500;
  line-height: 1.15;
  width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  word-break: normal;
  overflow-wrap: break-word;
  -webkit-hyphens: none;
  hyphens: none;
}
.alarm-tag {
  display: inline-block;
  font-size: 11px;
  font-weight: 600;
  color: var(--accent-hover, var(--accent));
  background: color-mix(in srgb, var(--accent) 16%, transparent);
  border-radius: 999px;
  padding: 1px 8px;
  margin-left: 4px;
  vertical-align: middle;
  white-space: nowrap;
}
.timegrid .ev-block .ev-alarm {
  position: absolute;
  top: 1px; right: 3px;
  font-size: 11px;
  line-height: 1;
  pointer-events: none;
  filter: drop-shadow(0 1px 1px rgba(0,0,0,.4));
}
.timegrid .now-line {
  position: absolute; left: 0; right: 0;
  height: 2px; background: var(--danger);
  z-index: 5;
}
.timegrid .now-line::before {
  content: ""; position: absolute; left: -4px; top: -3px;
  width: 8px; height: 8px; border-radius: 50%; background: var(--danger);
}

/* All-day row in week/day */
.allday-row {
  display: grid;
  border-bottom: 1px solid var(--border);
  background: var(--bg-elev2);
  min-height: 24px;
}
.allday-row .label { font-size: 10px; color: var(--text-dim); padding: 4px 6px; text-align: right; }
.allday-row .cell-wrap { padding: 3px; display: flex; flex-direction: column; gap: 2px; }
.allday-row .ev {
  font-size: 11px; background: var(--accent); color: white;
  border-radius: 4px; padding: 2px 6px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  cursor: pointer;
}

/* === Agenda === */
.agenda { overflow-y: auto; padding: 14px 16px; height: 100%; }
.agenda .grp { margin-bottom: 18px; }
.agenda .grp h4 {
  margin: 0 0 8px; font-size: 12px; color: var(--text-dim); text-transform: uppercase; letter-spacing: 1px;
  position: sticky; top: 0; background: var(--bg); padding: 6px 0;
}
.agenda .item {
  display: flex; gap: 10px; padding: 12px;
  border-radius: var(--radius-sm); background: var(--bg-elev); margin-bottom: 8px;
  cursor: pointer; border-left: 4px solid var(--accent);
}
.agenda .item:hover { background: var(--bg-elev2); }
.agenda .item .time { font-size: 12px; color: var(--text-dim); min-width: 90px; }
.agenda .item .body { flex: 1; }
.agenda .item .title { font-weight: 500; }
.agenda .item .loc { font-size: 12px; color: var(--text-dim); margin-top: 2px; }

/* === FAB === */
.fab {
  position: fixed; right: 18px;
  bottom: calc(18px + var(--safe-bottom));
  width: 56px; height: 56px; border-radius: 50%;
  background: var(--accent); color: white;
  display: grid; place-items: center;
  box-shadow: var(--shadow);
  z-index: 30;
  font-size: 28px; line-height: 1;
  transition: transform .15s;
}
.fab:active { transform: scale(.95); }

/* === Modal === */
.modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.55);
  display: none;
  z-index: 100;
}
.modal-backdrop.open { display: flex; align-items: center; justify-content: center; padding: 16px; }
.modal {
  background: var(--bg-elev); border-radius: var(--radius);
  width: 100%; max-width: 480px;
  max-height: 90vh; overflow-y: auto;
  box-shadow: var(--shadow);
  display: flex; flex-direction: column;
}
.modal-header {
  display: flex; align-items: center; gap: 8px; padding: 14px 16px;
  border-bottom: 1px solid var(--border);
}
.modal-header h3 { margin: 0; flex: 1; font-size: 17px; }
.modal-header .x { width: 32px; height: 32px; border-radius: 8px; display: grid; place-items: center; }
.modal-header .x:hover { background: var(--hover); }
.modal-body { padding: 16px; display: flex; flex-direction: column; gap: 12px; }
.modal-body label { font-size: 12px; color: var(--text-dim); display: block; margin-bottom: 4px; }
.modal-body .row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.modal-body .row3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 10px; }
.dt-row { display: grid; grid-template-columns: 2fr 1fr; gap: 8px; }
.time-input { text-align: center; font-variant-numeric: tabular-nums; letter-spacing: 1px; }
input[type="time"].time-input {
  font-size: 16px;
  cursor: pointer;
  padding: 12px 10px;
  background: var(--bg-elev2);
}
input[type="time"].time-input::-webkit-calendar-picker-indicator {
  filter: invert(0.7);
  cursor: pointer;
  opacity: 0.7;
  margin-left: 6px;
}
:root.theme-light input[type="time"].time-input::-webkit-calendar-picker-indicator {
  filter: none;
}
@media (prefers-color-scheme: light) {
  :root.theme-auto input[type="time"].time-input::-webkit-calendar-picker-indicator {
    filter: none;
  }
}
input[type="time"].time-input::-webkit-datetime-edit { padding: 0; }
input[type="time"].time-input::-webkit-inner-spin-button { display: none; }
input[type="time"].time-input::-webkit-clear-button { display: none; }
.date-field { position: relative; }
.date-field .date-display {
  display: block;
  background: var(--bg-elev2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font: inherit;
  min-height: 42px;
  box-sizing: border-box;
  line-height: 1.4;
}
.date-field input[type="date"] {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  opacity: 0;
  border: 0; padding: 0; margin: 0;
  cursor: pointer;
  z-index: 1;
  color: transparent;
}
.date-field input[type="date"]::-webkit-calendar-picker-indicator {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  cursor: pointer;
  opacity: 0;
}
.autocomplete-wrap { position: relative; }
.loc-row { display: flex; gap: 8px; align-items: stretch; }
.loc-row #f-location { flex: 1; }
.loc-nav-btn {
  flex: 0 0 auto;
  display: inline-flex; align-items: center; justify-content: center;
  width: 44px;
  background: var(--accent, #3b82f6);
  color: #fff;
  border: none;
  border-radius: 8px;
  cursor: pointer;
}
.loc-nav-btn svg { width: 20px; height: 20px; }
.loc-nav-btn:disabled { opacity: .4; cursor: default; }
/* Event-Detail-Karte */
.detail-card { max-width: 440px; }
.detail-top { display: flex; justify-content: flex-end; align-items: center; gap: 2px; padding: 8px 8px 0; }
.detail-head { display: flex; align-items: flex-start; gap: 12px; padding: 4px 20px 14px; }
.detail-color { flex: 0 0 auto; width: 16px; height: 16px; border-radius: 4px; margin-top: 5px; background: var(--accent, #3b82f6); }
.detail-title { margin: 0; font-size: 21px; line-height: 1.3; word-break: break-word; }
.detail-rows { padding: 0 20px 8px; display: flex; flex-direction: column; gap: 16px; }
.detail-row { display: flex; gap: 14px; align-items: flex-start; }
.detail-ic { flex: 0 0 auto; width: 20px; height: 20px; color: var(--text-dim); margin-top: 1px; }
.detail-row > div { flex: 1; min-width: 0; word-break: break-word; white-space: pre-wrap; line-height: 1.45; }
.detail-row a { color: var(--accent, #3b82f6); }
.detail-loc { display: flex; align-items: center; gap: 10px; }
.detail-loc #d-loc { flex: 1; user-select: text; -webkit-user-select: text; }
.detail-loc .loc-nav-btn { width: 38px; height: 34px; }
.detail-footer { padding: 10px 20px 18px; display: flex; justify-content: flex-end; }
.autocomplete-list {
  position: absolute;
  top: 100%; left: 0; right: 0;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  margin-top: 4px;
  z-index: 10;
  max-height: 240px;
  overflow-y: auto;
  display: none;
  box-shadow: var(--shadow);
}
.autocomplete-list.open { display: block; }
.autocomplete-item {
  padding: 10px 12px;
  cursor: pointer;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: flex-start; gap: 10px;
}
.autocomplete-item:last-child { border-bottom: none; }
.autocomplete-item:hover, .autocomplete-item.active { background: var(--hover); }
.autocomplete-item .pin {
  width: 18px; height: 18px; flex: 0 0 18px;
  color: var(--accent); margin-top: 1px;
}
.autocomplete-item .text { flex: 1; min-width: 0; }
.autocomplete-item .main { font-size: 14px; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.autocomplete-item .secondary { font-size: 12px; color: var(--text-dim); margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.autocomplete-empty { padding: 12px; font-size: 13px; color: var(--text-dim); text-align: center; }

.modal-body .check { display: flex; align-items: center; gap: 8px; cursor: pointer; }
.modal-body .check input { width: auto; }
.modal-footer { display: flex; gap: 8px; padding: 12px 16px; border-top: 1px solid var(--border); }
.modal-footer button {
  flex: 1; padding: 12px; border-radius: 10px; font-weight: 500;
  background: var(--bg-elev2); color: var(--text);
}
.modal-footer button.primary { background: var(--accent); color: white; }
.modal-footer button.danger { background: var(--danger); color: white; flex: 0 0 auto; padding: 12px 14px; }

/* Icons: klein und ruhig – überall dieselbe Größe */
.ic { width: 14px; height: 14px; flex: 0 0 auto; vertical-align: -2px; }
.ev-alarm .ic, .alarm-tag .ic, .rem-chip .ic { width: 12px; height: 12px; }
.alarm-bell svg { width: 56px; height: 56px; }

/* Erinnerungen: Zeitleiste mit echter Uhrzeit, darunter Regler + Einstellungen */
.lead-editor {
  background: var(--bg-elev); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 6px 12px 12px;
}
.ring-list { display: flex; flex-direction: column; }
.ring-row, .ring-anchor {
  display: flex; align-items: center; gap: 8px; width: 100%;
  padding: 7px 6px; border-radius: 8px; font-size: 13px; text-align: left;
}
.ring-row { cursor: pointer; color: var(--text); transition: background .12s; }
.ring-row:hover { background: var(--hover); }
.ring-row.active {
  background: color-mix(in srgb, var(--accent) 14%, transparent);
  box-shadow: inset 2px 0 0 var(--accent);
}
.ring-ic { display: inline-flex; gap: 4px; flex: 0 0 auto; color: var(--text-dim); }
.ring-row.active .ring-ic { color: var(--accent-hover, var(--accent)); }
.ring-time { flex: 0 0 auto; font-variant-numeric: tabular-nums; }
.ring-rel {
  flex: 1; min-width: 0; text-align: right; font-size: 12px; color: var(--text-dim);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.ring-del {
  flex: 0 0 auto; width: 22px; height: 22px; border-radius: 6px;
  display: grid; place-items: center; color: var(--text-dim);
}
.ring-del:hover { background: var(--hover); color: var(--danger); }
.ring-anchor {
  color: var(--text-dim); border-top: 1px solid var(--border);
  border-radius: 0; margin-top: 2px; padding-top: 9px;
}
.ring-add {
  display: flex; align-items: center; justify-content: center; gap: 6px;
  width: 100%; margin-top: 6px; padding: 10px;
  border: 1px dashed var(--border); border-radius: 10px;
  font-size: 13px; font-weight: 600; color: var(--accent-hover, var(--accent));
  transition: background .12s, border-color .12s;
}
.ring-add:hover { background: var(--hover); border-color: var(--accent); }

/* Ausgewählte Erinnerung: Kopfzeile sagt, worauf sich Regler und Knöpfe beziehen */
.ring-edit {
  margin-top: 6px; padding-top: 8px;
  border-top: 1px solid var(--border);
}
.ring-edit-head {
  font-size: 12px; color: var(--text-dim);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.ring-edit-head b { color: var(--text); font-weight: 600; }
.ring-scale {
  display: flex; justify-content: space-between;
  font-size: 11px; color: var(--text-dim); margin-top: -4px;
}
/* Feste Weckzeit: nichts zu schieben, also kein Regler */
.ring-edit.locked .lead-slider, .ring-edit.locked .ring-scale { display: none; }

/* Regler: kontinuierlich, logarithmisch (0 … 28 Tage) */
.lead-slider {
  -webkit-appearance: none; appearance: none;
  width: 100%; height: 26px; padding: 0; border: 0; background: transparent; margin-top: 2px;
}
.lead-slider::-webkit-slider-runnable-track { height: 4px; border-radius: 2px; background: var(--border); }
.lead-slider::-moz-range-track { height: 4px; border-radius: 2px; background: var(--border); }
.lead-slider::-webkit-slider-thumb {
  -webkit-appearance: none; width: 22px; height: 22px; margin-top: -9px; border-radius: 50%;
  background: var(--accent); border: 3px solid var(--bg-elev);
}
.lead-slider::-moz-range-thumb {
  width: 22px; height: 22px; border-radius: 50%;
  background: var(--accent); border: 3px solid var(--bg-elev);
}
.lead-slider:disabled::-webkit-slider-thumb { background: var(--text-dim); }
.lead-slider:disabled::-moz-range-thumb { background: var(--text-dim); }

/* Art / Ton / Abtipp-Sperre / Taschenlampe der ausgewählten Erinnerung */
.ring-opts { display: flex; flex-direction: column; gap: 6px; margin-top: 2px; }
.seg { display: flex; gap: 4px; background: var(--bg-elev); border-radius: 9px; padding: 3px; }
.seg button {
  flex: 1; min-width: 0; display: flex; align-items: center; justify-content: center; gap: 5px;
  padding: 7px 4px; border-radius: 7px; font-size: 12px; color: var(--text-dim); white-space: nowrap;
}
.seg button.active { background: var(--accent); color: #fff; }
.ring-type, .ring-flash {
  display: flex; align-items: center; gap: 6px; align-self: flex-start;
  padding: 6px 10px; border-radius: 999px; border: 1px solid var(--border);
  font-size: 12px; color: var(--text-dim);
}
.ring-type.active, .ring-flash.active {
  border-color: var(--accent); color: var(--accent-hover, var(--accent));
  background: color-mix(in srgb, var(--accent) 14%, transparent);
}

/* Erinnerungen in Listen (Wecker-Tab, Termin-Detail):
   eine Erinnerung je Zeile – Symbole (Art · Ton · Abtipp-Pflicht · ggf.
   Taschenlampe) und Zeitpunkt.
   Was eingestellt ist, sagen die Symbole; ausgeschrieben steht es nirgends. */
.rem-chip {
  display: flex; align-items: center; gap: 6px;
  min-width: 0; white-space: nowrap; padding: 1px 0;
}
.rem-chip .rem-ic { display: inline-flex; gap: 4px; flex: 0 0 auto; }
.rem-chip .rem-when { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.alarm-leads {
  display: flex; flex-direction: column; gap: 2px;
  font-size: 12px; color: var(--text-dim); margin-top: 4px;
}
#d-rem { display: flex; flex-direction: column; gap: 5px; font-size: 13px; }
.lead-hint { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--text-dim); margin-top: 6px; }

/* Wecker-Diagnose: Rechte-Lage als Liste, Protokoll als Klartext */
.diag-list { display: flex; flex-direction: column; gap: 4px; font-size: 13px; }
.diag-row { display: flex; gap: 8px; align-items: baseline; }
.diag-row .diag-mark { flex: 0 0 auto; width: 14px; font-weight: 700; }
.diag-row.ok .diag-mark { color: var(--success); }
.diag-row.bad .diag-mark { color: var(--warning); }
.diag-row .diag-label { flex: 0 0 auto; min-width: 130px; color: var(--text); }
.diag-row .diag-text { flex: 1; min-width: 0; color: var(--text-dim); }
.diag-row.bad .diag-text { color: var(--text); }
#diag-log {
  background: var(--bg-elev2); border: 1px solid var(--border); border-radius: 8px;
  padding: 10px; color: var(--text-dim); font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}
@media (max-width: 520px) {
  .diag-row { flex-wrap: wrap; }
  .diag-row .diag-label { min-width: 0; font-weight: 500; }
  .diag-row .diag-text { flex-basis: 100%; padding-left: 22px; }
}

/* Legende der drei Symbole (Einstellungen → Wecker ausschalten) */
.icon-legend { font-size: 12px; color: var(--text-dim); margin-top: 8px; }
.icon-legend b { display: block; margin-bottom: 4px; color: var(--text); font-weight: 500; }
.icon-legend > div { display: flex; flex-wrap: wrap; gap: 6px 14px; padding: 2px 0; }
.icon-legend span { display: inline-flex; align-items: center; gap: 5px; }

/* Wecker-Knopf im Termin-Formular */
/* Wochentage einer wöchentlichen Wiederholung */
.weekday-picker { display: grid; grid-template-columns: repeat(7, 1fr); gap: 5px; }
.weekday-picker button {
  padding: 9px 2px; border-radius: 8px; min-width: 0;
  border: 1px solid var(--border); background: var(--bg-elev2);
  color: var(--text-dim); font-size: 12px; text-align: center;
}
.weekday-picker button.active { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; }

/* Wecker-Knöpfe im Termin-Formular */
.modal-body .alarm-cta {
  width: 100%; margin-top: 8px;
  padding: 10px 12px; border-radius: 10px;
  background: var(--bg-elev2); border: 1px solid var(--border);
  color: var(--text); font-size: 14px; font-weight: 500;
}
.modal-body .alarm-cta:hover { border-color: var(--accent); }

.color-picker { display: flex; gap: 8px; flex-wrap: wrap; }
.color-picker .swatch {
  width: 28px; height: 28px; border-radius: 50%; cursor: pointer;
  border: 2px solid transparent;
}
.color-picker .swatch.active { border-color: var(--text); }

/* === Quick add (command) === */
.quickbar {
  display: none;
  position: fixed; top: 0; left: 0; right: 0;
  padding: calc(12px + var(--safe-top)) 14px 12px;
  background: var(--bg-elev);
  border-bottom: 1px solid var(--border);
  z-index: 90;
  align-items: center; gap: 8px;
}
.quickbar.open { display: flex; }
.quickbar input { background: var(--bg-elev2); }
.quickbar .preview {
  position: fixed; top: calc(60px + var(--safe-top)); left: 14px; right: 14px;
  background: var(--bg-elev); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 10px 12px; font-size: 13px; color: var(--text-dim);
  z-index: 90;
  display: none;
}
.quickbar.open + .preview { display: block; }

/* === Settings page === */
.settings { padding: 16px; overflow-y: auto; height: 100%; }
.settings h3 { margin-top: 18px; margin-bottom: 8px; font-size: 14px; color: var(--text-dim); text-transform: uppercase; letter-spacing: 1px; }
.settings .card {
  background: var(--bg-elev); border-radius: var(--radius); padding: 14px; margin-bottom: 10px;
}
.settings code { background: var(--bg-elev2); padding: 2px 6px; border-radius: 4px; font-size: 12px; word-break: break-all; }
.settings pre { background: var(--bg-elev2); padding: 10px; border-radius: 8px; overflow-x: auto; font-size: 12px; }
.settings .key-row { display: flex; align-items: center; gap: 8px; padding: 6px 0; font-size: 13px; }
.settings .key-row code { flex: 1; }
.settings .btn {
  background: var(--accent); color: white; padding: 8px 14px; border-radius: 8px; font-size: 13px; font-weight: 500;
}
.settings .btn.secondary { background: var(--bg-elev2); color: var(--text); }

.toast {
  position: fixed; left: 50%; transform: translateX(-50%);
  bottom: calc(90px + var(--safe-bottom));
  background: var(--bg-elev); border: 1px solid var(--border);
  padding: 10px 16px; border-radius: 24px; font-size: 13px;
  box-shadow: var(--shadow); z-index: 200;
  opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* Mini-month navigator inside drawer */
.mini-month { padding: 0 14px 14px; }
.mini-month .mini-head { display: flex; justify-content: space-between; align-items: center; padding: 6px 4px; }
.mini-month .mini-head .lbl { font-size: 13px; font-weight: 600; }
.mini-month .mini-head button { padding: 4px 8px; border-radius: 6px; }
.mini-month .grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; font-size: 12px; }
.mini-month .grid .wd { color: var(--text-dim); text-align: center; padding: 4px 0; font-size: 10px; }
.mini-month .grid .d { text-align: center; padding: 5px 0; border-radius: 50%; cursor: pointer; }
.mini-month .grid .d:hover { background: var(--hover); }
.mini-month .grid .d.other { opacity: .3; }
.mini-month .grid .d.today { background: var(--accent); color: white; font-weight: 600; }
.mini-month .grid .d.has::after {
  content: ""; display: block; width: 4px; height: 4px; border-radius: 50%;
  background: var(--accent); margin: 0 auto;
}

/* ===== Quick-Create Popup (Google-Calendar-Style bottom sheet) ===== */
.qc {
  display: none;
  position: fixed; left: 0; right: 0; bottom: 0;
  z-index: 150;
  pointer-events: none; /* let upper grid receive events; panel re-enables */
}
.qc.open { display: block; }

.qc-panel {
  pointer-events: auto;
  background: var(--bg-elev);
  border-radius: 24px 24px 0 0;
  padding: 8px 20px calc(16px + var(--safe-bottom));
  box-shadow: 0 -10px 30px rgba(0,0,0,0.4);
  display: flex; flex-direction: column; gap: 10px;
  animation: qcSlideUp .2s ease-out;
  max-width: 680px;
  margin: 0 auto;
}
@keyframes qcSlideUp {
  from { transform: translateY(20px); opacity: 0; }
  to   { transform: translateY(0);    opacity: 1; }
}
.qc-handle {
  width: 80px; height: 4px;
  background: var(--border);
  background-clip: content-box;
  border-radius: 2px;
  margin: 0 auto;
  padding: 14px 30px;
  box-sizing: content-box;
  cursor: ns-resize;
  touch-action: none;
}
.qc-bar {
  display: flex; justify-content: space-between; align-items: center;
}
.qc-x {
  width: 40px; height: 40px;
  display: grid; place-items: center;
  border-radius: 50%;
  color: var(--text);
}
.qc-x:hover { background: var(--hover); }
.qc-x svg { width: 22px; height: 22px; }
.qc-save-btn {
  background: var(--accent); color: white;
  padding: 10px 22px;
  border-radius: 24px;
  font-weight: 600;
  font-size: 15px;
}
.qc-save-btn:active { transform: scale(0.97); }
#qc-title {
  background: transparent;
  border: 0;
  padding: 6px 0;
  font-size: 22px;
  font-weight: 400;
  width: 100%;
  outline: none;
}
#qc-title::placeholder { color: var(--text-dim); }
.qc-when-line {
  font-size: 15px;
  color: var(--text-dim);
  display: flex; gap: 6px; align-items: center; flex-wrap: wrap;
}
.qc-when-line .qc-dot { color: var(--text-dim); }
.qc-when-line .qc-dash { color: var(--text-dim); }
.qc-time-inline {
  background: transparent !important;
  border: 0 !important;
  padding: 2px 4px !important;
  width: auto !important;
  font-size: 15px;
  color: var(--text);
  font-family: inherit;
  cursor: pointer;
  letter-spacing: 0 !important;
  text-align: left !important;
  border-radius: 6px !important;
}
.qc-time-inline:hover { background: var(--hover) !important; }
.qc-time-inline::-webkit-calendar-picker-indicator { display: none; }
.qc-time-inline::-webkit-inner-spin-button { display: none; }
.qc-details-btn {
  align-self: flex-start;
  font-size: 13px;
  color: var(--accent);
  padding: 6px 0;
  margin-top: -2px;
}

/* === Ghost rectangle (drag-create preview on time grid) === */
.qc-ghost {
  position: absolute;
  left: 4px; right: 4px;
  background: rgba(99, 102, 241, 0.15);
  border: 2px solid var(--accent);
  border-radius: 8px;
  z-index: 60;
  touch-action: none;
  cursor: grab;
  box-sizing: border-box;
}
.qc-ghost-handle {
  position: absolute;
  width: 18px; height: 18px;
  border-radius: 50%;
  background: var(--accent);
  border: 3px solid var(--bg);
  z-index: 61;
  touch-action: none;
  box-shadow: 0 2px 6px rgba(0,0,0,0.3);
}
.qc-h-start { top: -10px; left: -10px; cursor: nw-resize; }
.qc-h-end   { bottom: -10px; right: -10px; cursor: se-resize; }

@media (max-width: 919px) {
  /* keep bottom-bar visible underneath (or hide while qc open) */
  .qc.open ~ .bottombar,
  body:has(.qc.open) .bottombar { display: none; }
}

/* ===== Bottom bar (mobile) ===== */
.bottombar {
  display: none;
  position: fixed; left: 0; right: 0; bottom: 0;
  background: var(--bg-elev);
  border-top: 1px solid var(--border);
  padding: 4px 4px calc(4px + var(--safe-bottom));
  z-index: 60;
}
.bottombar button {
  flex: 1;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 2px;
  padding: 6px 4px;
  border-radius: 10px;
  color: var(--text-dim);
  min-height: 48px;
}
.bottombar button svg { width: 22px; height: 22px; stroke-width: 1.8; }
.bottombar button span { font-size: 10px; font-weight: 500; }
.bottombar button.active { color: var(--accent); }
.bottombar button.active svg { color: var(--accent); }

/* ===== Auth overlay ===== */
.auth-overlay {
  position: fixed; inset: 0;
  background: var(--bg);
  display: none;
  align-items: center; justify-content: center;
  z-index: 300;
  padding: 20px;
  padding-top: calc(20px + var(--safe-top));
  padding-bottom: calc(20px + var(--safe-bottom));
}
.auth-overlay.open { display: flex; }
.auth-card {
  width: 100%; max-width: 380px;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow);
  display: flex; flex-direction: column; gap: 10px;
}
.auth-card .auth-logo {
  align-self: center;
  width: 64px; height: 64px;
  background: var(--accent); color: white;
  border-radius: 16px;
  display: grid; place-items: center;
  margin-bottom: 6px;
}
.auth-card .auth-logo svg { width: 32px; height: 32px; }
.auth-card h2 { margin: 0; text-align: center; font-size: 20px; }
.auth-card .auth-sub { margin: 0 0 6px; text-align: center; font-size: 13px; color: var(--text-dim); }
.auth-card label { font-size: 12px; color: var(--text-dim); margin-bottom: 4px; display: block; }
.auth-card .auth-row { display: flex; flex-direction: column; }
.auth-card .auth-err { color: var(--danger); font-size: 13px; min-height: 18px; }
.auth-card .auth-submit {
  background: var(--accent); color: white;
  padding: 12px; border-radius: 10px; font-weight: 600;
  margin-top: 4px;
}
.auth-card .auth-submit:active { background: var(--accent-hover); }
.auth-card .auth-hint { font-size: 12px; color: var(--text-dim); margin: 6px 0 0; }

.form-grid { display: flex; flex-direction: column; gap: 8px; }

@media (max-width: 720px) {
  .topbar .view-switch button { padding: 6px 8px; font-size: 12px; }
  .topbar .title { font-size: 16px; }
  .week .head .col .num, .day .head .col .num { font-size: 16px; }
  .month .cell .ev { font-size: 10px; }

  /* show bottom bar */
  .bottombar { display: flex; }
  .app { padding-bottom: calc(var(--safe-bottom) + 64px); }
  .fab {
    bottom: calc(78px + var(--safe-bottom));
  }
  .toast {
    bottom: calc(110px + var(--safe-bottom));
  }

  /* mobile: ganze "Ansicht"-Sektion ausblenden — Bottom-Bar erfüllt diesen Zweck */
  .drawer-views { display: none; }

  /* full-screen modal on phones */
  .modal-backdrop.open { padding: 0; align-items: stretch; }
  .modal {
    max-width: none;
    max-height: 100dvh;
    height: 100dvh;
    width: 100%;
    border-radius: 0;
    padding-top: var(--safe-top);
    padding-bottom: var(--safe-bottom);
  }
  .modal-body { flex: 1; overflow-y: auto; }
  .modal-footer { padding: 14px 16px calc(14px + var(--safe-bottom)); }
  .modal-footer button { padding: 14px; font-size: 15px; }

  /* time grid: kompakteres Stundenraster, mehr Überblick */
  .timegrid { --hour-h: 32px; }
  .timegrid .ev-block {
    font-size: 10px;
    padding: 1px 3px;
    line-height: 1.1;
    border-left-width: 2px;
  }
  .timegrid .ev-block .t { font-size: 9px; }
  .timegrid .ev-block .title {
    font-size: 9px;
    line-height: 1.1;
    -webkit-line-clamp: 4;
  }
  .timegrid .hour-col .hour-label { font-size: 10px; top: -6px; }

  /* visual feedback for long-press */
  .timegrid .day-col.lp-active { background: var(--today-bg); }

  /* allday row taller on mobile */
  .allday-row { min-height: 30px; }
  .allday-row .ev { font-size: 12px; padding: 4px 6px; }

  /* hide quick search button on mobile topbar - in drawer instead */
  .topbar #btn-quick { display: grid; }
  .topbar #btn-today { display: grid; }
}

/* ===== Tablet / iPad portrait (721–919px) =====
   Vorher eine "tote Zone": die Bottom-Bar (≤720) war weg, die feste Seitenleiste
   (≥920) noch nicht da — Ansichtswechsel ging nur umständlich über den Drawer.
   iPad-Hochformat (768–834px) bekommt jetzt die Bottom-Navigation wie am Handy,
   aber mit den großzügigen, zentrierten Desktop-Modals. Querformat & 12,9" (≥920)
   behalten die feste Seitenleiste. */
@media (min-width: 721px) and (max-width: 919px) {
  .bottombar { display: flex; justify-content: center; }
  .bottombar button { flex: 0 1 132px; }
  .app { padding-bottom: calc(var(--safe-bottom) + 68px); }
  .fab { bottom: calc(82px + var(--safe-bottom)); }
  .toast { bottom: calc(120px + var(--safe-bottom)); }

  /* Ansichtswechsel übernimmt die Bottom-Bar -> doppelte Drawer-Sektion raus */
  .drawer-views { display: none; }

  /* Der Drawer hat hier mehr Platz */
  .drawer-inner { width: 60%; max-width: 360px; }

  /* Etwas größere Tap-Ziele in der Top-Leiste auf dem Tablet */
  .topbar .menu, .topbar .icon-btn { width: 42px; height: 42px; }
}

@media (min-width: 920px) {
  .drawer-inner { transform: none !important; }
  .drawer { position: relative; opacity: 1; pointer-events: auto; background: transparent; width: 280px; flex-shrink: 0; }
  .topbar .menu { display: none; }
  .bottombar { display: none !important; }
}

/* ===== Aufgaben (Tasks) ===== */
.qc-typeswitch { display: flex; gap: 6px; margin-bottom: 10px; }
.qc-typeswitch button {
  flex: 1; padding: 7px 10px; border-radius: 8px;
  border: 1px solid var(--border); background: transparent;
  color: var(--text-dim); font-size: 14px; cursor: pointer;
}
.qc-typeswitch button.active { background: var(--accent); color: #fff; border-color: var(--accent); }
.qc-allday { display: none; align-items: center; gap: 8px; margin: 8px 0 2px; font-size: 14px; color: var(--text); }
.qc.task-mode .qc-allday { display: flex; }
.qc.task-mode #qc-end, .qc.task-mode .qc-dash { display: none; }
.qc.task-mode.allday .qc-dot,
.qc.task-mode.allday #qc-start,
.qc.task-mode.allday .qc-uhr { display: none; }

/* Checkbox auf Aufgaben-Kacheln */
.task-check {
  width: 13px; height: 13px;
  border: 1.5px solid currentColor; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 10px; line-height: 1; cursor: pointer;
  margin-right: 3px; vertical-align: -2px;
  background: rgba(255,255,255,.18);
}
.task-done { opacity: .55; }
.task-done .title { text-decoration: line-through; }
.task-done .task-check { background: rgba(255,255,255,.9); color: var(--accent); }
/* Liste: größere Checkbox als eigene Spalte */
.task-check-lg {
  width: 22px; height: 22px; font-size: 14px;
  margin-right: 0; vertical-align: 0; align-self: center;
  border-color: var(--text-dim);
}
.agenda .item.task-done { opacity: .55; }

/* ---------- Terminwecker (Alarm) ---------- */
.alarm-overlay {
  position: fixed; inset: 0; z-index: 4000;
  display: none; align-items: center; justify-content: center;
  background: rgba(8, 12, 24, 0.92);
  backdrop-filter: blur(6px);
  padding: 24px;
}
.alarm-overlay.open { display: flex; animation: alarm-fade .25s ease; }
@keyframes alarm-fade { from { opacity: 0; } to { opacity: 1; } }
.alarm-card {
  width: 100%; max-width: 420px; text-align: center;
  background: var(--bg-elev); border: 1px solid var(--border);
  border-radius: 22px; padding: 34px 26px 26px;
  box-shadow: 0 24px 80px rgba(0,0,0,.55);
}
.alarm-bell {
  font-size: 64px; line-height: 1;
  animation: alarm-shake .9s ease-in-out infinite;
  transform-origin: 50% 10%;
}
@keyframes alarm-shake {
  0%, 100% { transform: rotate(0); }
  20% { transform: rotate(16deg); }
  40% { transform: rotate(-14deg); }
  60% { transform: rotate(10deg); }
  80% { transform: rotate(-8deg); }
}
.alarm-label {
  margin-top: 10px; font-size: 13px; letter-spacing: .12em;
  text-transform: uppercase; color: var(--accent-hover); font-weight: 700;
}
.alarm-title { margin: 8px 0 4px; font-size: 26px; word-break: break-word; }
.alarm-time { font-size: 18px; color: var(--text-dim); }
.alarm-sound { margin-top: 6px; font-size: 13px; color: var(--text-dim);
  display: flex; align-items: center; justify-content: center; gap: 6px; }
/* Ausschalt-Sperre „Betreff abtippen" — nur sichtbar, wenn der Modus aktiv ist */
.alarm-typing { display: none; margin-top: 20px; text-align: left; }
.alarm-overlay.typing .alarm-typing { display: block; }
.alarm-typing-hint { font-size: 13px; color: var(--text-dim); margin-bottom: 6px; }
.alarm-typing-target {
  padding: 10px 12px; border-radius: 10px;
  background: var(--bg-elev2); border: 1px dashed var(--border);
  font-size: 17px; font-weight: 600; letter-spacing: .02em; word-break: break-word;
  user-select: none; -webkit-user-select: none;
}
.alarm-typing input {
  width: 100%; margin-top: 8px; padding: 12px;
  border-radius: 10px; border: 1px solid var(--border);
  background: var(--bg); color: var(--text); font-size: 17px;
}
.alarm-typing input:focus { outline: none; border-color: var(--accent); }
.alarm-typing input.bad { border-color: var(--danger); }
.alarm-typing input.shake { animation: alarm-typing-shake .45s ease; }
@keyframes alarm-typing-shake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-7px); }
  40% { transform: translateX(6px); }
  60% { transform: translateX(-4px); }
  80% { transform: translateX(3px); }
}
.alarm-typing-status { margin-top: 6px; font-size: 13px; min-height: 18px; color: var(--text-dim); }
.alarm-typing-status.ok { color: var(--success); }
.alarm-typing-status.bad { color: var(--danger); }
.alarm-stop {
  display: block; width: 100%; margin-top: 26px;
  padding: 16px; border: none; border-radius: 14px;
  background: var(--danger); color: #fff; font-size: 18px; font-weight: 700;
  cursor: pointer;
}
.alarm-stop:active { transform: scale(.98); }
/* gesperrt, aber weiterhin klickbar — der Klick erklärt, was noch fehlt */
.alarm-stop.locked { background: var(--bg-elev2); color: var(--text-dim); }
.alarm-stop.locked:active { transform: none; }
/* Schlummerdauer direkt im Klingel-Bildschirm wählen */
.alarm-snooze-pick { display: flex; gap: 6px; margin-top: 18px; }
.alarm-snooze-pick button {
  flex: 1; padding: 9px 4px; border-radius: 10px;
  border: 1px solid var(--border); background: var(--bg-elev2);
  color: var(--text-dim); font-size: 13px; white-space: nowrap; cursor: pointer;
}
.alarm-snooze-pick button.active { background: var(--accent); border-color: var(--accent); color: #fff; }
#alarm-snooze-custom {
  width: 100%; margin-top: 8px; padding: 11px;
  border-radius: 10px; border: 1px solid var(--border);
  background: var(--bg); color: var(--text); font-size: 16px; text-align: center;
}
#alarm-snooze-custom:focus { outline: none; border-color: var(--accent); }
.alarm-snooze {
  display: block; width: 100%; margin-top: 10px;
  padding: 13px; border: 1px solid var(--border); border-radius: 14px;
  background: var(--bg-elev2); color: var(--text); font-size: 15px; cursor: pointer;
}

/* ---------- Wecker-Tab: Toggle-Switch ---------- */
.switch { position: relative; display: inline-block; width: 46px; height: 26px; flex: none; cursor: pointer; }
.switch input { opacity: 0; width: 0; height: 0; position: absolute; }
.switch span {
  position: absolute; inset: 0; border-radius: 26px;
  background: var(--bg-elev2); border: 1px solid var(--border); transition: background .15s;
}
.switch span::before {
  content: ''; position: absolute; left: 3px; top: 50%; transform: translateY(-50%);
  width: 18px; height: 18px; border-radius: 50%; background: var(--text-dim); transition: transform .15s, background .15s;
}
.switch input:checked + span { background: var(--accent); border-color: var(--accent); }
.switch input:checked + span::before { transform: translate(20px, -50%); background: #fff; }

#snooze-card-title { display: flex; align-items: center; gap: 6px; }

/* ---------- Schlummer-Übersicht (Modal + Karte im Wecker-Tab) ---------- */
.snooze-row {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 2px;
  border-bottom: 1px solid var(--border);
}
.snooze-row:last-child { border-bottom: none; }
.snooze-main { flex: 1; min-width: 0; }
.snooze-title {
  display: flex; align-items: center; gap: 6px;
  font-size: 15px; font-weight: 600;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.snooze-title .ic { color: var(--text-dim); }
.snooze-when { font-size: 13px; color: var(--text-dim); margin-top: 2px; font-variant-numeric: tabular-nums; }
.snooze-tag {
  flex: 0 0 auto;
  padding: 1px 7px; border-radius: 999px;
  background: var(--bg-elev2); border: 1px solid var(--border);
  font-size: 11px; font-weight: 600; color: var(--text-dim);
}
.snooze-actions { display: flex; gap: 6px; flex: 0 0 auto; }
.snooze-actions .btn { padding: 7px 11px; font-size: 13px; }
.snooze-empty { font-size: 13px; color: var(--text-dim); padding: 6px 2px; }

/* ---------- Wecker-Tab: ruhige Kacheln statt Inline-Styles ---------- */
.alarm-card {
  display: flex; align-items: flex-start; gap: 12px;
  background: var(--bg-elev); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 14px 16px; margin-bottom: 10px;
}
.alarm-card.off { opacity: .5; }
.alarm-card-main { flex: 1; min-width: 0; }
.alarm-clock {
  display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap;
  font-size: 32px; font-weight: 700; line-height: 1.05;
  font-variant-numeric: tabular-nums; letter-spacing: -0.02em;
}
/* Mitlaufende Countdowns: feste Ziffernbreite, sonst zappelt die Zeile jede Sekunde */
[data-until] { font-variant-numeric: tabular-nums; }
/* Zwei Countdowns nebeneinander: bis zur nächsten Erinnerung (Akzentfarbe, die
   nähere) und bis zur Zielzeit selbst (ruhiger). */
.alarm-countdowns {
  display: flex; align-items: center; gap: 6px; flex-wrap: wrap;
  margin-top: 7px;
}
.alarm-next {
  display: inline-flex; align-items: baseline; gap: 6px;
  padding: 2px 9px; border-radius: 999px;
  background: var(--bg-elev2); border: 1px solid var(--border);
  font-size: 13px; font-weight: 600; letter-spacing: 0;
  color: var(--accent-hover, var(--accent));
}
.alarm-next .cd-label {
  font-size: 10px; font-weight: 700; letter-spacing: .06em;
  text-transform: uppercase; color: var(--text-dim);
}
.alarm-next-target { color: var(--text); }
.alarm-name {
  display: flex; align-items: center; gap: 6px; flex-wrap: wrap;
  font-size: 15px; font-weight: 600; margin-top: 6px;
}
.alarm-meta {
  display: flex; align-items: center; gap: 5px;
  font-size: 12px; color: var(--text-dim); margin-top: 3px;
}
.alarm-card-side { display: flex; flex-direction: column; align-items: center; gap: 10px; flex: 0 0 auto; }
.alarm-card-actions { display: flex; gap: 2px; }
.alarm-card-actions .icon-btn {
  width: 32px; height: 32px; display: grid; place-items: center;
  border-radius: 8px; color: var(--text-dim);
}
.alarm-card-actions .icon-btn:hover { background: var(--hover); color: var(--text); }
.alarm-card-actions .icon-btn:last-child:hover { color: var(--danger); }

/* Standby-Hinweis auf der Wecker-Seite: erscheint nur, wenn etwas fehlt –
   läuft alles, beginnt die Seite direkt mit der Weckerliste. */
.alarm-warn {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 10px 12px; margin-bottom: 12px;
  border: 1px solid color-mix(in srgb, var(--warning) 45%, var(--border));
  background: color-mix(in srgb, var(--warning) 10%, transparent);
  border-radius: var(--radius);
  font-size: 13px; color: var(--text);
}
.alarm-warn[hidden] { display: none; }   /* sonst schlägt display:flex das hidden-Attribut */
.alarm-warn::before { content: "⚠️"; flex: 0 0 auto; }
.alarm-warn-text { flex: 1; min-width: 180px; }
.alarm-warn .btn { flex: 0 0 auto; padding: 7px 12px; font-size: 13px; }

/* Leerzustände: erklären statt nur „nichts da" */
.alarm-empty, .ring-empty {
  display: flex; align-items: center; gap: 10px;
  color: var(--text-dim); font-size: 13px;
}
.alarm-empty {
  background: var(--bg-elev); border: 1px dashed var(--border);
  border-radius: var(--radius); padding: 18px 16px;
}
.alarm-empty .ic { width: 22px; height: 22px; }
.alarm-empty b { display: block; color: var(--text); font-size: 14px; margin-bottom: 2px; }
.ring-empty { padding: 12px 6px; }

/* ---------- Offene Erinnerungen: auffälliges Banner unter der Kopfleiste ---------- */
.notice-bar {
  position: fixed; left: 0; right: 0; z-index: 70;
  background: var(--bg-elev);
  border-bottom: 2px solid var(--accent);
  box-shadow: 0 8px 24px rgba(0,0,0,.28);
  max-height: 48vh; overflow-y: auto;
  animation: notice-in .18s ease;
}
@keyframes notice-in { from { transform: translateY(-8px); opacity: 0; } to { transform: none; opacity: 1; } }
.notice-head {
  display: flex; align-items: center; gap: 8px;
  padding: 9px 14px;
  background: var(--accent); color: #fff;
  font-size: 13px; font-weight: 700; letter-spacing: .01em;
}
.notice-head .ic { width: 16px; height: 16px; }
.notice-all {
  margin-left: auto; padding: 5px 10px; border-radius: 8px;
  background: rgba(255,255,255,.18); color: #fff; font-size: 12px; font-weight: 600;
}
.notice-all:hover { background: rgba(255,255,255,.3); }
.notice-row {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 14px; border-bottom: 1px solid var(--border);
}
.notice-row:last-child { border-bottom: none; }
.notice-text { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.notice-text b { font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.notice-text span { font-size: 12px; color: var(--text-dim); margin-top: 2px; }
.notice-ok {
  flex: 0 0 auto; padding: 9px 14px; border-radius: 10px;
  background: var(--accent); color: #fff; font-size: 13px; font-weight: 600;
}
.notice-ok:active { transform: scale(.97); }

/* Erinnerung erledigen: erst den Titel abtippen */
.notice-row.typing { flex-wrap: wrap; }
.notice-type { flex: 1 0 100%; margin-top: 8px; }
.notice-type-hint { font-size: 12px; color: var(--text-dim); margin-bottom: 4px; }
.notice-type-target {
  padding: 8px 10px; border-radius: 8px;
  background: var(--bg-elev2); border: 1px dashed var(--border);
  font-size: 15px; font-weight: 600; word-break: break-word;
  user-select: none; -webkit-user-select: none;
}
.notice-type-input {
  width: 100%; margin-top: 6px; padding: 10px;
  border-radius: 8px; border: 1px solid var(--border);
  background: var(--bg); color: var(--text); font-size: 16px;
}
.notice-type-input:focus { outline: none; border-color: var(--accent); }
.notice-type-input.bad { border-color: var(--danger); }
.notice-type-input.shake { animation: alarm-typing-shake .45s ease; }
.notice-type-status { margin-top: 4px; font-size: 12px; min-height: 16px; color: var(--text-dim); }
.notice-type-status.ok { color: var(--success); }
.notice-type-status.bad { color: var(--danger); }
.notice-ok.locked { background: var(--bg-elev2); color: var(--text-dim); }

/* ---------- ICS-Import: Vorschau vor dem Übernehmen ---------- */
.ics-summary { font-size: 14px; line-height: 1.45; }
.ics-summary b { font-weight: 600; }
.ics-summary .ics-file {
  display: inline-block; max-width: 100%; overflow: hidden; text-overflow: ellipsis;
  white-space: nowrap; vertical-align: bottom; color: var(--text-dim);
}
.ics-hints { display: flex; flex-direction: column; gap: 4px; }
.ics-hints:empty { display: none; }
.ics-hints div {
  font-size: 12px; color: var(--text-dim);
  padding-left: 14px; position: relative;
}
.ics-hints div::before { content: "·"; position: absolute; left: 4px; }
.ics-list {
  max-height: 46vh; overflow-y: auto;
  border: 1px solid var(--border); border-radius: 10px;
  background: var(--bg);
}
.ics-list:empty { display: none; }
.ics-row {
  display: flex; align-items: baseline; gap: 8px;
  padding: 8px 10px; border-bottom: 1px solid var(--border);
}
.ics-row:last-child { border-bottom: none; }
.ics-when {
  flex: 0 0 auto; font-size: 12px; color: var(--text-dim);
  font-variant-numeric: tabular-nums;
}
.ics-title {
  flex: 1; min-width: 0; font-size: 14px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.ics-badge {
  flex: 0 0 auto; padding: 1px 7px; border-radius: 999px;
  font-size: 10px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase;
  background: var(--bg-elev2); border: 1px solid var(--border); color: var(--text-dim);
}
.ics-badge.neu { color: var(--accent); border-color: var(--accent); }
.ics-more { padding: 8px 10px; font-size: 12px; color: var(--text-dim); }

/* Datei über das Fenster ziehen: nur sichtbar, solange etwas darüber schwebt */
.drop-hint {
  position: fixed; inset: 16px; z-index: 300;
  display: grid; place-items: center;
  border: 2px dashed var(--accent); border-radius: 16px;
  background: rgba(0, 0, 0, .55); backdrop-filter: blur(2px);
  font-size: 18px; font-weight: 600; color: white;
  pointer-events: none;
}
.drop-hint[hidden] { display: none; }

/* =====================================================================
   DESIGN 2026 — moderner, ruhiger Look (PC + Handy)
   Liegt bewusst als eigene Schicht am Dateiende und überschreibt nur
   Optik (Farben, Radien, Abstände, Schatten) — kein Layout-Verhalten,
   auf das app.js sich verlässt. Rückweg: diesen Block löschen.
   ===================================================================== */
:root {
  --bg: #0e0f13;
  --bg-elev: #16181e;
  --bg-elev2: #1e2129;
  --border: rgba(255,255,255,0.075);
  --border-strong: rgba(255,255,255,0.13);
  --grid-line: rgba(255,255,255,0.055);
  --text: #eceef3;
  --text-dim: #8b91a1;
  --accent: #6366f1;
  --accent-hover: #8b8ff8;
  --accent-soft: rgba(99,102,241,0.16);
  --today-bg: rgba(99,102,241,0.07);
  --hover: rgba(255,255,255,0.05);
  --shadow: 0 1px 2px rgba(0,0,0,.3), 0 16px 48px rgba(0,0,0,.45);
  --shadow-sm: 0 1px 2px rgba(0,0,0,.25), 0 4px 14px rgba(0,0,0,.25);
  --glass: rgba(14,15,19,0.78);
  --radius: 18px;
  --radius-sm: 11px;
  --ev-mix: 26%;
  --ev-text-mix: 42%;
}
:root.theme-light {
  --bg: #f4f5f8;
  --bg-elev: #ffffff;
  --bg-elev2: #eef0f4;
  --border: rgba(15,23,42,0.08);
  --border-strong: rgba(15,23,42,0.14);
  --grid-line: rgba(15,23,42,0.07);
  --text: #141824;
  --text-dim: #6a7183;
  --accent-soft: rgba(99,102,241,0.11);
  --today-bg: rgba(99,102,241,0.045);
  --hover: rgba(15,23,42,0.045);
  --shadow: 0 1px 2px rgba(15,23,42,.06), 0 16px 44px rgba(15,23,42,.12);
  --shadow-sm: 0 1px 2px rgba(15,23,42,.06), 0 4px 14px rgba(15,23,42,.07);
  --glass: rgba(255,255,255,0.8);
  --ev-mix: 17%;
  --ev-text-mix: 62%;
}
@media (prefers-color-scheme: light) {
  :root.theme-auto {
    --bg: #f4f5f8;
    --bg-elev: #ffffff;
    --bg-elev2: #eef0f4;
    --border: rgba(15,23,42,0.08);
    --border-strong: rgba(15,23,42,0.14);
    --grid-line: rgba(15,23,42,0.07);
    --text: #141824;
    --text-dim: #6a7183;
    --accent-soft: rgba(99,102,241,0.11);
    --today-bg: rgba(99,102,241,0.045);
    --hover: rgba(15,23,42,0.045);
    --shadow: 0 1px 2px rgba(15,23,42,.06), 0 16px 44px rgba(15,23,42,.12);
    --shadow-sm: 0 1px 2px rgba(15,23,42,.06), 0 4px 14px rgba(15,23,42,.07);
    --glass: rgba(255,255,255,0.8);
    --ev-mix: 17%;
    --ev-text-mix: 62%;
  }
}

html, body {
  font-family: "Inter", "SF Pro Text", -apple-system, BlinkMacSystemFont, "Segoe UI Variable", "Segoe UI", Roboto, system-ui, sans-serif;
  -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale;
  font-feature-settings: "cv11", "ss01";
  letter-spacing: -0.006em;
}
button { transition: background-color .15s, color .15s, border-color .15s, transform .1s; }

/* Eingaben: flächig, ohne harte Kanten, klarer Fokus-Ring */
input, textarea, select {
  background: var(--bg-elev2);
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  padding: 11px 13px;
  transition: border-color .15s, box-shadow .15s, background-color .15s;
}
input:hover, textarea:hover, select:hover { border-color: var(--border-strong); }
input:focus, textarea:focus, select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
  background: var(--bg-elev);
}
.date-field .date-display { background: var(--bg-elev2); border-color: transparent; border-radius: var(--radius-sm); }
input[type="time"].time-input { background: var(--bg-elev2); }

/* ---------- Kopfleiste: Glas, Titel links, Pfeile als Gruppe ---------- */
.topbar {
  background: var(--bg);
  border-bottom: 0;
  padding: 10px 14px 8px;
  gap: 4px;
}
.topbar .menu, .topbar .icon-btn { border-radius: 12px; color: var(--text-dim); }
.topbar .icon-btn:hover, .topbar .menu:hover { color: var(--text); background: var(--hover); }
.topbar #btn-prev, .topbar #btn-next { width: 36px; height: 36px; }
.topbar .title {
  text-align: left;
  font-size: 19px; font-weight: 700; letter-spacing: -0.02em;
  padding-left: 8px;
}
.topbar #btn-today {
  width: auto; padding: 0 14px; height: 36px;
  border: 1px solid var(--border-strong); border-radius: 999px;
  color: var(--text); font-size: 13px; font-weight: 600;
  display: inline-flex; gap: 6px; align-items: center;
}
.topbar #btn-today svg { width: 16px; height: 16px; }
.topbar #btn-today::after { content: "Heute"; }

/* ---------- Seitenleiste ---------- */
.drawer { background: rgba(5,6,10,.45); backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px); }
.drawer-inner { background: var(--bg); box-shadow: var(--shadow); border-radius: 0 22px 22px 0; }
.drawer-header { border-bottom: 0; padding: 20px 20px 10px; }
.drawer-header h2 { font-size: 22px; font-weight: 750; letter-spacing: -0.025em; }
.drawer-header small { font-size: 13px; }
.drawer-section { padding: 10px 14px; }
.drawer-section h3 { font-size: 11px; font-weight: 650; letter-spacing: .08em; }
.drawer-section h3 #btn-add-cal { border-radius: 8px; color: var(--text-dim); }
.drawer-section h3 #btn-add-cal:hover { background: var(--hover); color: var(--text); }
.cal-item { border-radius: 10px; padding: 7px 10px; }
.cal-item .dot { width: 14px; height: 14px; border-radius: 5px; }
.cal-item .label { font-weight: 500; }
.cal-item .edit { opacity: 0; }
.cal-item:hover .edit, .cal-item .edit:focus { opacity: 1; }
@media (hover: none) { .cal-item .edit { opacity: .7; } }
.drawer-section .link { border-radius: 10px; padding: 9px 10px; color: var(--text-dim); font-weight: 500; }
.drawer-section .link:hover { color: var(--text); background: var(--hover); }

/* Segment-Umschalter */
.view-switch { background: var(--bg-elev2); border-radius: 12px; padding: 3px; }
.view-switch button { border-radius: 9px; font-weight: 500; }
.view-switch button:hover:not(.active) { color: var(--text); }
.view-switch button.active { background: var(--bg-elev); color: var(--text); box-shadow: var(--shadow-sm); font-weight: 600; }

/* Mini-Monat */
.mini-month { padding: 0 12px 10px; }
.mini-month .mini-head .lbl { font-size: 14px; font-weight: 650; }
.mini-month .mini-head button { color: var(--text-dim); border-radius: 8px; }
.mini-month .mini-head button:hover { background: var(--hover); color: var(--text); }
.mini-month .grid .d {
  aspect-ratio: 1; display: grid; place-items: center; padding: 0;
  position: relative; font-variant-numeric: tabular-nums; font-size: 12px;
}
.mini-month .grid .d.has::after { position: absolute; bottom: 3px; left: 50%; transform: translateX(-50%); width: 3px; height: 3px; }
.mini-month .grid .d.today { box-shadow: 0 2px 8px rgba(99,102,241,.45); }
.mini-month .grid .d.today::after { background: #fff; }

/* ---------- Hauptfläche ---------- */
.main { background: var(--bg-elev); }

/* Monatsansicht */
.month .weekdays { background: var(--bg-elev); border-bottom: 1px solid var(--border); }
.month .weekdays div { font-size: 11px; font-weight: 600; letter-spacing: .06em; padding: 10px 0; }
.month .cell { border-color: var(--grid-line); padding: 6px; transition: background-color .12s; }
.month .cell .daynum {
  font-size: 12.5px; font-weight: 600; width: 24px; height: 24px; line-height: 24px;
  text-align: center; border-radius: 50%; margin-bottom: 3px; font-variant-numeric: tabular-nums;
}
.month .cell.today .daynum { width: 24px; height: 24px; line-height: 24px; box-shadow: 0 2px 8px rgba(99,102,241,.4); }
.month .cell.other { opacity: 1; }
.month .cell.other .daynum { color: var(--text-dim); opacity: .55; }
.month .cell.other .evts { opacity: .55; }
.month .cell .evts { gap: 3px; }
.month .cell .more { font-weight: 600; padding-left: 6px; }

/* Termine: getönte Fläche + farbiger Balken + farbige Schrift */
.month .cell .ev,
.allday-row .ev,
.timegrid .ev-block:not(.ghost) {
  background: color-mix(in srgb, var(--ev, var(--accent)) var(--ev-mix), var(--bg-elev)) !important;
  color: color-mix(in srgb, var(--ev, var(--accent)) var(--ev-text-mix), var(--text));
  border-left: 3px solid var(--ev, var(--accent));
}
.month .cell .ev { border-radius: 6px; padding: 2px 6px; font-weight: 550; font-size: 11.5px; }
.allday-row .ev { border-radius: 7px; padding: 3px 8px; font-weight: 600; }
.timegrid .ev-block:not(.ghost) {
  border-radius: 8px;
  padding: 4px 6px 4px 7px;
  align-items: flex-start; justify-content: flex-start; text-align: left;
  box-shadow: 0 0 0 1px var(--bg-elev);
}
.timegrid .ev-block .title { font-weight: 600; letter-spacing: -0.01em; }
.timegrid .ev-block:not(.ghost):hover { filter: brightness(1.06) saturate(1.05); }
.timegrid .ev-block .ev-alarm { filter: none; }
.timegrid .ev-block.dragging, .timegrid .ev-block.pressing { box-shadow: var(--shadow) !important; }
.timegrid .ev-block.ghost { border-radius: 8px; border-color: rgba(255,255,255,.9); }
.task-check { background: transparent; }
.task-done .task-check { background: var(--ev, var(--accent)); color: #fff; border-color: transparent; }

/* Woche / Tag / 3 Tage */
.week .head, .day .head, .multi .head { background: var(--bg-elev); border-bottom: 1px solid var(--border); }
.week .head .col, .day .head .col, .multi .head .col { padding: 10px 4px 8px; border-radius: 10px; }
.week .head .col:hover, .day .head .col:hover, .multi .head .col:hover { background: var(--hover); }
.week .head .col .wday, .day .head .col .wday, .multi .head .col .wday { font-size: 11px; font-weight: 600; letter-spacing: .06em; }
.week .head .col .num, .day .head .col .num, .multi .head .col .num { font-size: 22px; font-weight: 650; letter-spacing: -0.02em; margin-top: 2px; }
.week .head .col.today .wday, .day .head .col.today .wday, .multi .head .col.today .wday { color: var(--accent-hover); }
.week .head .col.today .num, .day .head .col.today .num, .multi .head .col.today .num {
  width: 34px; height: 34px; line-height: 34px; font-size: 16px;
  box-shadow: 0 3px 10px rgba(99,102,241,.45);
}
.allday-row { background: var(--bg-elev); border-bottom: 1px solid var(--border); }
.allday-row .label { font-weight: 500; }
.timegrid .hour-col { border-right: 1px solid var(--grid-line); }
.timegrid .hour-col .hour-label { font-size: 10.5px; font-weight: 500; font-variant-numeric: tabular-nums; }
.timegrid .day-col { border-right: 1px solid var(--grid-line); }
.timegrid .day-col .slot {
  border-bottom: 1px solid var(--grid-line);
  background-image: linear-gradient(to bottom, transparent calc(50% - .5px), color-mix(in srgb, var(--grid-line) 45%, transparent) calc(50% - .5px), color-mix(in srgb, var(--grid-line) 45%, transparent) calc(50% + .5px), transparent calc(50% + .5px));
}
.timegrid .day-col.today { background: var(--today-bg); }
.timegrid .now-line { height: 2px; background: #f43f5e; box-shadow: 0 0 8px rgba(244,63,94,.5); }
.timegrid .now-line::before { background: #f43f5e; width: 10px; height: 10px; left: -5px; top: -4px; box-shadow: 0 0 0 3px var(--bg-elev); }
.qc-ghost { background: var(--accent-soft); border-radius: 10px; }

/* Liste */
.agenda { padding: 18px 20px 120px; max-width: 860px; margin: 0 auto; }
.agenda .grp { margin-bottom: 22px; }
.agenda .grp h4 {
  background: var(--bg-elev); font-size: 12px; font-weight: 650; letter-spacing: .06em;
  padding: 10px 2px 8px; z-index: 1;
}
.agenda .item {
  background: var(--bg-elev); border: 1px solid var(--border); border-left-width: 4px;
  border-radius: 14px; padding: 13px 14px; gap: 14px; align-items: center;
  transition: background-color .12s, transform .12s, box-shadow .12s;
}
.agenda .item:hover { background: var(--bg-elev); box-shadow: var(--shadow-sm); transform: translateY(-1px); }
.agenda .item .time { font-size: 12.5px; font-weight: 600; font-variant-numeric: tabular-nums; color: var(--ev, var(--text-dim)); min-width: 96px; }
.agenda .item .title { font-weight: 600; font-size: 15px; }
.agenda .item .loc { margin-top: 3px; }

/* ---------- FAB ---------- */
.fab {
  width: 58px; height: 58px; border-radius: 18px;
  background: linear-gradient(145deg, #7476f5, #5457e8);
  box-shadow: 0 8px 24px rgba(79,70,229,.45), 0 2px 6px rgba(0,0,0,.2);
  font-size: 30px; font-weight: 300;
}
.fab:hover { transform: translateY(-2px); box-shadow: 0 12px 30px rgba(79,70,229,.5), 0 2px 6px rgba(0,0,0,.2); }

/* ---------- Dialoge ---------- */
.modal-backdrop { background: rgba(5,6,10,.5); backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px); }
.modal-backdrop.open .modal { animation: modalIn .22s cubic-bezier(.2,.9,.3,1); }
@keyframes modalIn { from { transform: translateY(14px) scale(.985); opacity: 0; } to { transform: none; opacity: 1; } }
.modal { border-radius: 22px; border: 1px solid var(--border); box-shadow: var(--shadow); }
.modal-header { border-bottom: 0; padding: 18px 20px 6px; }
.modal-header h3 { font-size: 19px; font-weight: 700; letter-spacing: -0.02em; }
.modal-header .x, .modal .detail-top .icon-btn { border-radius: 10px; color: var(--text-dim); }
.modal-header .x:hover, .modal .detail-top .icon-btn:hover { background: var(--hover); color: var(--text); }
.detail-top .icon-btn { width: 38px; height: 38px; display: grid; place-items: center; }
.modal-body { padding: 12px 20px 18px; gap: 16px; }
.modal-body label { font-size: 12.5px; font-weight: 600; color: var(--text-dim); margin-bottom: 6px; }
.modal-body .check { font-size: 14px; font-weight: 500; color: var(--text); }
.modal-body .check input { accent-color: var(--accent); width: 18px; height: 18px; }
.modal-footer { border-top: 1px solid var(--border); padding: 14px 20px; gap: 10px; }
.modal-footer button { border-radius: 12px; font-weight: 600; background: var(--bg-elev2); }
.modal-footer button:hover { background: var(--hover); }
.modal-footer button.primary { background: var(--accent); box-shadow: 0 4px 14px rgba(99,102,241,.35); }
.modal-footer button.primary:hover { background: #5558ea; }
.modal-footer button.danger { background: transparent; color: var(--danger); border: 1px solid color-mix(in srgb, var(--danger) 40%, transparent); }
.modal-footer button.danger:hover { background: color-mix(in srgb, var(--danger) 12%, transparent); }
.detail-title { font-size: 23px; font-weight: 700; letter-spacing: -0.02em; }
.detail-color { border-radius: 6px; width: 18px; height: 18px; }
.detail-footer .primary, #d-edit-btn {
  background: var(--accent); color: #fff; padding: 11px 20px; border-radius: 12px; font-weight: 600;
  box-shadow: 0 4px 14px rgba(99,102,241,.35);
}
.loc-nav-btn { border-radius: 11px; }
.color-picker { gap: 10px; }
.color-picker .swatch { width: 30px; height: 30px; transition: transform .12s, box-shadow .12s; }
.color-picker .swatch:hover { transform: scale(1.1); }
.color-picker .swatch.active { border-color: var(--bg-elev); box-shadow: 0 0 0 2px var(--text); }
.weekday-picker button { border-radius: 10px; border-color: transparent; }
.lead-editor { background: var(--bg-elev2); border: 0; border-radius: 14px; }
.seg { background: var(--bg-elev2); border-radius: 11px; }
.seg button.active { background: var(--bg-elev); color: var(--text); box-shadow: var(--shadow-sm); }
.lead-editor .seg { background: var(--bg-elev); }
.lead-editor .seg button.active { background: var(--accent); color: #fff; }
.autocomplete-list { border-radius: 14px; overflow: hidden; }

/* Schnell-Termin (Bottom Sheet) */
.qc-panel { border: 1px solid var(--border); border-bottom: 0; box-shadow: 0 -12px 40px rgba(0,0,0,.25); border-radius: 26px 26px 0 0; }
.qc-handle { width: 40px; background: var(--border-strong); background-clip: content-box; padding: 12px 30px 6px; }
.qc-save-btn { box-shadow: 0 4px 14px rgba(99,102,241,.35); }
.qc-typeswitch { background: var(--bg-elev2); padding: 3px; border-radius: 12px; gap: 3px; }
.qc-typeswitch button { border: 0; border-radius: 9px; font-weight: 500; }
.qc-typeswitch button.active { background: var(--bg-elev); color: var(--text); box-shadow: var(--shadow-sm); border: 0; }
#qc-title { font-size: 24px; font-weight: 600; letter-spacing: -0.02em; }
#qc-title:focus { box-shadow: none; background: transparent; }
.qc-details-btn { font-weight: 600; }

/* Schnellbefehl-Leiste */
.quickbar { background: var(--glass); backdrop-filter: blur(16px) saturate(1.4); -webkit-backdrop-filter: blur(16px) saturate(1.4); border-bottom: 1px solid var(--border); }

/* ---------- Einstellungen / Wecker-Seite ---------- */
.settings { padding: 20px 20px 120px; max-width: 860px; margin: 0 auto; }
.settings h3 { font-size: 12px; font-weight: 650; letter-spacing: .07em; margin-top: 24px; }
.settings .card { background: var(--bg-elev); border: 1px solid var(--border); border-radius: 18px; padding: 16px 18px; box-shadow: var(--shadow-sm); }
.settings .btn { border-radius: 10px; padding: 9px 15px; font-weight: 600; }
.settings .btn.secondary { background: var(--bg-elev2); }
.settings .btn.secondary:hover { background: var(--hover); }
.settings code, .settings pre { background: var(--bg-elev2); }
.alarm-card { border-radius: 18px; }
/* .alarm-card gibt es zweimal (Klingel-Overlay + Wecker-Liste) — in der Liste
   nicht den riesigen Overlay-Schatten und die 420px-Breite erben */
#main .alarm-card {
  max-width: none; text-align: left; box-shadow: var(--shadow-sm);
  padding: 16px 18px; margin-bottom: 12px;
}
#main .alarm-card:hover { border-color: var(--border-strong); }
.alarm-clock { font-weight: 750; letter-spacing: -0.035em; }
.alarm-next { border: 0; background: var(--accent-soft); }
.switch span { background: var(--bg-elev2); border-color: var(--border-strong); }
.switch span::before { box-shadow: 0 1px 3px rgba(0,0,0,.25); }

/* Klingel-Overlay */
.alarm-overlay { background: rgba(8,9,14,.82); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); }
.alarm-overlay .alarm-card { border-radius: 28px; display: block; }
.alarm-stop { border-radius: 16px; box-shadow: 0 8px 24px rgba(239,68,68,.35); }
.alarm-snooze, .alarm-snooze-pick button { border-radius: 14px; }

/* Login */
.auth-overlay { background: radial-gradient(1200px 600px at 50% -10%, var(--accent-soft), transparent 60%), var(--bg); }
.auth-card { border-radius: 24px; padding: 30px 26px 24px; }
.auth-card .auth-logo { border-radius: 20px; background: linear-gradient(145deg, #7476f5, #5457e8); box-shadow: 0 10px 28px rgba(79,70,229,.45); }
.auth-card h2 { font-size: 22px; font-weight: 700; letter-spacing: -0.02em; }
.auth-card .auth-submit { border-radius: 12px; box-shadow: 0 4px 14px rgba(99,102,241,.35); }

/* Toast + Banner */
.toast { background: var(--text); color: var(--bg); border: 0; font-weight: 500; padding: 11px 18px; }
.notice-bar { border-bottom: 0; box-shadow: var(--shadow); }
.notice-ok, .notice-all { border-radius: 10px; }

/* Scrollbalken dezent */
* { scrollbar-width: thin; scrollbar-color: var(--border-strong) transparent; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 10px; border: 3px solid transparent; background-clip: content-box; }
::-webkit-scrollbar-track { background: transparent; }

/* ---------- Handy ---------- */
@media (max-width: 919px) {
  .main { background: var(--bg-elev); }
  .topbar { background: var(--bg-elev); padding: 8px 8px 6px; border-bottom: 1px solid var(--border); }
  .topbar .title { font-size: 17px; padding-left: 4px; }
  .topbar #btn-prev, .topbar #btn-next { width: 32px; }
  .topbar #btn-today { width: 36px; padding: 0; height: 36px; border: 0; justify-content: center; }
  .topbar #btn-today::after { content: none; }
  .timegrid .ev-block .title { font-weight: 600; }

  /* Navigation: schwebende Glasleiste mit Pillen-Markierung (Material 3) */
  .bottombar {
    background: var(--glass);
    backdrop-filter: blur(18px) saturate(1.5); -webkit-backdrop-filter: blur(18px) saturate(1.5);
    border-top: 1px solid var(--border);
    padding: 6px 6px calc(6px + var(--safe-bottom));
  }
  .bottombar button { gap: 4px; min-height: 52px; padding: 4px 2px; }
  .bottombar button svg {
    width: 56px; height: 30px; padding: 4px 17px; box-sizing: border-box;
    border-radius: 999px; stroke-width: 1.9; transition: background-color .2s;
  }
  .bottombar button span { font-size: 11px; font-weight: 600; }
  .bottombar button.active { color: var(--text); }
  .bottombar button.active svg { background: var(--accent-soft); color: var(--accent-hover); }
  :root.theme-light .bottombar button.active svg { color: var(--accent); }
  .fab { right: 16px; }

  .week .head .col .num, .day .head .col .num, .multi .head .col .num { font-size: 17px; }
  .week .head .col.today .num, .day .head .col.today .num, .multi .head .col.today .num { width: 30px; height: 30px; line-height: 30px; font-size: 14px; }
  .week .head .col, .day .head .col, .multi .head .col { padding: 7px 2px 6px; }
  .timegrid .ev-block:not(.ghost) { border-radius: 6px; padding: 2px 3px 2px 4px; border-left-width: 2.5px; }
  .month .cell { padding: 3px 2px; }
  .month .cell .ev { font-size: 10px; padding: 1px 4px; border-left-width: 2px; border-radius: 4px; }
  .month .cell .ev .ev-time { display: none; }
  .month .cell .daynum { font-size: 12px; width: 22px; height: 22px; line-height: 22px; margin: 0 auto 2px; }
  .agenda { padding: 12px 14px 140px; }
  .settings { padding: 14px 14px 140px; }
}
@media (max-width: 720px) {
  /* Dialoge als Bottom Sheet statt Vollbild */
  .modal-backdrop.open { align-items: flex-end; }
  .modal {
    height: auto;
    max-height: calc(100dvh - var(--safe-top) - 10px);
    border-radius: 24px 24px 0 0;
    border-bottom: 0;
    padding-top: 6px;
  }
  .modal::before {
    content: ""; display: block; flex: 0 0 auto;
    width: 40px; height: 4px; border-radius: 4px; margin: 4px auto 0;
    background: var(--border-strong);
  }
  .modal-backdrop.open .modal { animation: sheetIn .26s cubic-bezier(.2,.9,.3,1); }
  @keyframes sheetIn { from { transform: translateY(40px); opacity: .4; } to { transform: none; opacity: 1; } }
  .modal-header { padding: 10px 18px 4px; }
  .modal-body { padding: 10px 18px 16px; }
  .modal-footer { padding: 12px 18px calc(12px + var(--safe-bottom)); }
}

/* ---------- PC: App-Rahmen mit Seitenleiste + Kalender-Karte ---------- */
@media (min-width: 920px) {
  html, body { background: var(--bg); }
  .topbar { padding: 12px 20px 12px 24px; }
  .topbar .title { font-size: 22px; padding-left: 12px; order: 0; }
  .drawer { width: 272px; background: transparent; backdrop-filter: none; -webkit-backdrop-filter: none; }
  .drawer-inner {
    position: static; width: 100%; max-width: none; height: 100%;
    background: transparent; box-shadow: none; border-radius: 0;
    padding: 0 6px 16px 10px;
  }
  .drawer-header { padding: 4px 14px 14px; }
  .main {
    margin: 0 16px 16px 4px;
    border: 1px solid var(--border);
    border-radius: 20px;
    box-shadow: var(--shadow-sm);
  }
  .month .weekdays, .week .head, .day .head, .multi .head { border-radius: 20px 20px 0 0; }
  .fab { right: 34px; bottom: calc(34px + var(--safe-bottom)); }
  .timegrid .ev-block .title { -webkit-line-clamp: 3; }
  .timegrid .ev-block { font-size: 12.5px; }
}
.settings label { display: block; font-size: 12.5px; font-weight: 600; color: var(--text-dim); margin: 12px 0 6px; }
/* Dialog-Fußzeile (Speichern) bleibt sichtbar, nur der Inhalt scrollt */
.modal:has(> .modal-body) { overflow: hidden; }
.modal:has(> .modal-body) > .modal-body { flex: 1 1 auto; min-height: 0; overflow-y: auto; }
.dt-row .date-field .date-display { height: 100%; display: flex; align-items: center; }
/* Kurze Termine (wenige Minuten): eine Zeile, damit nichts halb abgeschnitten wird */
.timegrid .ev-block.short:not(.ghost) { padding-top: 0; padding-bottom: 0; justify-content: center; }
.timegrid .ev-block.short .title { -webkit-line-clamp: 1; line-height: 1.2; }
.cal-item .edit-spacer { width: 30px; height: 30px; flex: 0 0 auto; }
/* Spracheingabe */
.voice-card { width: min(440px, 100%); }
.voice-body { display: flex; flex-direction: column; align-items: center; gap: 14px; padding: 4px 20px 6px; }
.voice-mic {
  width: 84px; height: 84px; border-radius: 50%; border: 0; cursor: pointer;
  display: grid; place-items: center; color: #fff; background: var(--accent);
  box-shadow: 0 6px 20px rgba(99,102,241,.35); transition: transform .15s ease;
}
.voice-mic svg { width: 36px; height: 36px; }
.voice-mic:active { transform: scale(.95); }
.voice-mic.on { background: #e5484d; animation: voicePulse 1.4s ease-out infinite; }
@keyframes voicePulse {
  0% { box-shadow: 0 0 0 0 rgba(229,72,77,.45); }
  100% { box-shadow: 0 0 0 22px rgba(229,72,77,0); }
}
.voice-status { font-size: 14px; color: var(--text-dim); text-align: center; min-height: 1.3em; }
#v-text {
  width: 100%; box-sizing: border-box; resize: none; font: inherit; font-size: 16px; line-height: 1.4;
  padding: 10px 12px; border-radius: 12px; border: 1px solid var(--border);
  background: var(--bg); color: var(--text);
}
#voice-modal.busy .voice-mic { opacity: .5; pointer-events: none; }
#voice-modal.busy .voice-status::after { content: ''; display: inline-block; width: 12px; height: 12px; margin-left: 8px;
  border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; vertical-align: -2px; animation: voiceSpin .8s linear infinite; }
@keyframes voiceSpin { to { transform: rotate(360deg); } }
