/* ============================================================
   ORGA · bornschlegl.media
   Farben tragen Zustand, nicht Personen:
   terracotta = prio, sage = erledigt, amber = heute
   ============================================================ */

:root {
  --bg: #f5f1ea;
  --bg-elev: #fbf8f2;
  --ink: #1a1814;
  --ink-soft: #4a463e;
  --ink-mute: #8a8478;
  --line: #e0d9cb;
  --line-soft: #ebe5d8;

  --prio: #c75b3b;
  --prio-soft: #f4e0d8;
  --done: #6b8e6f;
  --done-soft: #dde8de;
  --today: #e8a93c;
  --termin: #4f7089;
  --termin-soft: #dde5eb;
  --zeitraum: #6c5f9e;
  --zeitraum-soft: #e3e0f0;
  --gebtag: #a9758a;
  --gebtag-soft: #eddfe4;
  --danger: #b04a3b;

  --radius: 4px;
  --radius-lg: 10px;
  --shadow-lg: 0 8px 32px rgba(26,24,20,0.12);

  --font-display: 'Fraunces', Georgia, serif;
  --font-body: 'Inter Tight', -apple-system, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, monospace;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #14120f;
    --bg-elev: #1d1a16;
    --ink: #f0ebe0;
    --ink-soft: #c4bcab;
    --ink-mute: #807a6e;
    --line: #2a2620;
    --line-soft: #221f1a;
    --prio-soft: #3a2520;
    --done-soft: #1f2c21;
    --termin: #7ea3bd;
    --termin-soft: #1d2a33;
    --zeitraum: #a599d8;
    --zeitraum-soft: #262238;
    --gebtag: #c99cad;
    --gebtag-soft: #2e2229;
    --shadow-lg: 0 8px 32px rgba(0,0,0,0.5);
  }
}

* { box-sizing: border-box; margin: 0; padding: 0; }
[x-cloak] { display: none !important; }

html, body {
  /* verhindert das Zoomen per Doppeltipp; das Meta-Tag allein reicht nicht */
  touch-action: manipulation;
  -webkit-text-size-adjust: 100%;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  min-height: 100dvh;
}

button { font-family: inherit; cursor: pointer; border: none; background: none; color: inherit; }
button:disabled { cursor: default; opacity: 0.25; }
input, select, textarea { font-family: inherit; font-size: inherit; color: inherit; }
.mono { font-family: var(--font-mono); font-size: 0.9em; }

:focus-visible { outline: 2px solid var(--prio); outline-offset: 2px; border-radius: 2px; }

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}

/* ============ LOGIN ============ */
.login-shell {
  min-height: 100vh; min-height: 100dvh;
  display: flex; align-items: center; justify-content: center;
  padding: 1.5rem;
  background:
    radial-gradient(circle at 20% 10%, var(--prio-soft) 0%, transparent 55%),
    var(--bg);
}
.login-card {
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 2.5rem 2rem;
  width: 100%; max-width: 360px;
  box-shadow: var(--shadow-lg);
}
.brand {
  font-family: var(--font-display);
  font-weight: 600; font-size: 2.1rem;
  letter-spacing: 0.06em;      /* Versalien brauchen Luft */
  font-variation-settings: "opsz" 144;
}
.brand-sub {
  font-family: var(--font-mono);
  font-size: 0.75rem; color: var(--ink-mute);
  letter-spacing: 0.05em; margin-bottom: 2rem;
}
.login-form { display: flex; flex-direction: column; gap: 1rem; }
.login-form label { display: flex; flex-direction: column; gap: 0.35rem; }
.login-form span {
  font-family: var(--font-mono); font-size: 0.7rem;
  text-transform: uppercase; letter-spacing: 0.08em; color: var(--ink-mute);
}
.login-form input {
  background: var(--bg); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 0.7rem 0.85rem;
  outline: none; transition: border-color 0.15s;
}
.login-form input:focus { border-color: var(--ink); }
.login-form button {
  background: var(--ink); color: var(--bg);
  padding: 0.85rem; border-radius: var(--radius);
  font-weight: 500; margin-top: 0.5rem; transition: opacity 0.15s;
}
.error { color: var(--danger); font-size: 0.85rem; }

/* ============ APP SHELL ============ */
.app {
  max-width: 1000px; margin: 0 auto;
  padding: 1rem;
  padding-top: max(1rem, env(safe-area-inset-top, 1rem));
  padding-bottom: max(1rem, env(safe-area-inset-bottom, 1rem));
  padding-left: max(1rem, env(safe-area-inset-left, 1rem));
  padding-right: max(1rem, env(safe-area-inset-right, 1rem));
}

/* ============ HEADER ============ */
.header {
  display: flex; align-items: center; justify-content: space-between;
  gap: 0.5rem; padding: 0.75rem 0 1.25rem; flex-wrap: wrap;
}
.header-left, .header-right { display: flex; align-items: center; gap: 0.5rem; }
.month-title {
  font-family: var(--font-display); font-weight: 600; font-size: 1.6rem;
  letter-spacing: -0.02em; font-variation-settings: "opsz" 144;
  min-width: 8rem; text-align: center;
}
.month-title .year {
  font-family: var(--font-mono); font-size: 0.85rem; font-weight: 400;
  color: var(--ink-mute); margin-left: 0.5rem;
}
.nav-btn {
  width: 2rem; height: 2rem; display: grid; place-items: center;
  border-radius: var(--radius); font-size: 1.25rem; color: var(--ink-soft);
  transition: background 0.15s;
}
.nav-btn:hover { background: var(--line-soft); }
.today-btn {
  font-family: var(--font-mono); font-size: 0.7rem;
  text-transform: uppercase; letter-spacing: 0.08em;
  padding: 0.4rem 0.7rem; border: 1px solid var(--line);
  border-radius: var(--radius); color: var(--ink-soft); transition: all 0.15s;
}
.today-btn:hover { border-color: var(--ink); color: var(--ink); }
.logout {
  width: 2rem; height: 2rem; display: grid; place-items: center;
  font-size: 1.1rem; color: var(--ink-mute); border-radius: var(--radius);
}
.logout:hover { color: var(--ink); }

/* ============ QUICK ADD ============ */
.quickadd {
  display: flex; gap: 0.5rem;
  background: var(--bg-elev); border: 1px solid var(--line);
  border-radius: var(--radius-lg); padding: 0.4rem;
  transition: border-color 0.15s;
}
.quickadd:focus-within { border-color: var(--ink); }
.quickadd input {
  flex: 1; background: transparent; border: none; outline: none;
  padding: 0.55rem 0.75rem; font-size: 0.95rem;
}
.quickadd input::placeholder { color: var(--ink-mute); }
.plus-btn {
  width: 2.4rem; height: 2.4rem; border-radius: var(--radius);
  background: var(--ink); color: var(--bg); font-size: 1.35rem; line-height: 1;
  display: grid; place-items: center; transition: transform 0.15s; flex-shrink: 0;
}
.plus-btn:hover { transform: rotate(90deg); }
.quickhint {
  font-size: 0.75rem; color: var(--ink-mute);
  margin: 0.5rem 0.25rem 1rem;
}

/* ============ NOTICE / TOAST ============ */
.notice {
  background: var(--prio-soft); color: var(--prio);
  border-radius: var(--radius); padding: 0.6rem 0.85rem;
  font-size: 0.85rem; margin-bottom: 1rem; cursor: pointer;
}
.toast {
  position: fixed; left: 50%; transform: translateX(-50%);
  bottom: max(1.5rem, env(safe-area-inset-bottom, 1.5rem));
  background: var(--ink); color: var(--bg);
  padding: 0.7rem 1.1rem; border-radius: var(--radius);
  font-size: 0.85rem; z-index: 200; box-shadow: var(--shadow-lg);
  max-width: min(90vw, 26rem);
}

/* ============ WEEKDAYS + GRID ============ */
.weekdays {
  display: grid; grid-template-columns: repeat(7, 1fr);
  gap: 2px; margin-bottom: 2px;
}
.weekdays > div {
  font-family: var(--font-mono); font-size: 0.65rem;
  text-transform: uppercase; letter-spacing: 0.1em;
  color: var(--ink-mute); padding: 0.4rem 0.5rem; text-align: center;
}
.grid {
  display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px;
  background: var(--line); border: 1px solid var(--line);
  border-radius: var(--radius-lg); overflow: hidden;
}
.cell {
  background: var(--bg-elev); min-height: 70px;
  padding: 0.4rem 0.5rem;
  display: flex; flex-direction: column;
  cursor: pointer; transition: background 0.12s; position: relative;
}
.cell:hover { background: var(--line-soft); }
.cell.is-other { background: var(--bg); }
.cell.is-other .cell-date { color: var(--ink-mute); opacity: 0.5; }
.cell.is-today .cell-date {
  background: var(--today); color: #1a1814; border-radius: 999px;
  width: 1.6rem; height: 1.6rem; display: grid; place-items: center; font-weight: 600;
}
.cell.is-selected {
  background: var(--bg); outline: 2px solid var(--ink);
  outline-offset: -2px; z-index: 2;
}
.cell-date {
  font-family: var(--font-mono); font-size: 0.8rem; font-weight: 500;
  width: 1.6rem; height: 1.6rem; display: grid; place-items: center;
  margin-bottom: 0.25rem;
}
.cell-marks {
  display: flex; align-items: center; gap: 3px; margin-top: auto; flex-wrap: wrap;
}
.mark { width: 9px; height: 4px; border-radius: 1px; }
.mark-open { background: var(--prio); }
.mark-done { background: var(--done); }
.mark-rest {
  font-family: var(--font-mono); font-size: 0.6rem;
  color: var(--ink-mute); margin-left: 1px;
}

/* ============ DAY PANEL ============ */
.day-panel {
  margin-top: 1.25rem; background: var(--bg-elev);
  border: 1px solid var(--line); border-radius: var(--radius-lg);
  padding: 1.25rem;
}
.day-header {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: 0.5rem; flex-wrap: wrap; margin-bottom: 1.25rem;
}
.day-header h2 {
  font-family: var(--font-display); font-weight: 600; font-size: 1.15rem;
  font-variation-settings: "opsz" 9; letter-spacing: -0.01em;
}
.day-score {
  font-family: var(--font-mono); font-size: 0.7rem;
  letter-spacing: 0.06em; color: var(--ink-mute);
}

/* ---- the three slots: the signature element ---- */
.prios {
  display: flex; flex-direction: column;
  border-top: 1px solid var(--line);
}
.slot {
  display: flex; align-items: center; gap: 0.85rem;
  padding: 0.7rem 0.25rem;
  border-bottom: 1px solid var(--line-soft);
  min-height: 3.25rem;
}
.slot-num {
  font-family: var(--font-display); font-weight: 400; font-size: 1.5rem;
  font-variation-settings: "opsz" 144;
  color: var(--prio); line-height: 1;
  width: 1.1rem; flex-shrink: 0; text-align: center;
}
.slot-empty .slot-num { color: var(--line); }
.slot-done .slot-num { color: var(--done); }

.slot-empty-line {
  flex: 1; height: 1px; background: var(--line);
}

.slot-body { flex: 1; display: flex; align-items: center; gap: 0.7rem; min-width: 0; }
.slot-text {
  flex: 1; cursor: pointer; min-width: 0;
  display: flex; align-items: baseline; gap: 0.5rem; flex-wrap: wrap;
}
.slot-time {
  font-family: var(--font-mono); font-size: 0.8rem;
  color: var(--ink-soft); font-weight: 500;
}
.slot-title { font-size: 1rem; font-weight: 500; }
.slot-done .slot-title { text-decoration: line-through; color: var(--ink-mute); }
.slot-tag { font-family: var(--font-mono); font-size: 0.7rem; color: var(--ink-mute); }
.slot-actions { display: flex; gap: 0.15rem; flex-shrink: 0; }
.slot-actions button {
  width: 1.7rem; height: 1.7rem; display: grid; place-items: center;
  border-radius: var(--radius); color: var(--ink-mute); font-size: 0.9rem;
  transition: all 0.15s;
}
.slot-actions button:not(:disabled):hover { background: var(--line-soft); color: var(--ink); }

/* ---- rest of the day ---- */
.rest-header {
  display: flex; align-items: center; justify-content: space-between;
  margin: 1.5rem 0 0.5rem; gap: 0.5rem;
}
.rest-header > span {
  font-family: var(--font-mono); font-size: 0.65rem;
  text-transform: uppercase; letter-spacing: 0.1em; color: var(--ink-mute);
}
.add-mini {
  font-family: var(--font-mono); font-size: 0.7rem;
  text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--ink-soft); padding: 0.35rem 0.6rem;
  border: 1px solid var(--line); border-radius: var(--radius); transition: all 0.15s;
}
.add-mini:hover { border-color: var(--ink); color: var(--ink); }

.task-list { display: flex; flex-direction: column; gap: 0.15rem; }
.task {
  display: flex; align-items: flex-start; gap: 0.6rem;
  padding: 0.55rem 0.4rem; border-radius: var(--radius); transition: background 0.12s;
}
.task:hover { background: var(--line-soft); }
.task-done .task-title { text-decoration: line-through; color: var(--ink-mute); }

.check {
  width: 1.15rem; height: 1.15rem; border: 1.5px solid var(--ink-mute);
  border-radius: var(--radius); display: grid; place-items: center;
  font-size: 0.75rem; flex-shrink: 0; margin-top: 2px; transition: all 0.15s;
}
.check:hover { border-color: var(--ink); }
.task-done .check, .slot-done .check {
  background: var(--done); color: var(--bg-elev); border-color: var(--done);
}

.task-body { flex: 1; cursor: pointer; min-width: 0; }
.task-line { display: flex; align-items: baseline; gap: 0.6rem; flex-wrap: wrap; }
.task-time {
  font-family: var(--font-mono); font-size: 0.8rem;
  color: var(--ink-soft); font-weight: 500;
}
.task-title { font-size: 0.95rem; font-weight: 500; }
.task-meta {
  display: flex; gap: 0.5rem; margin-top: 0.2rem;
  font-size: 0.78rem; color: var(--ink-mute); flex-wrap: wrap; align-items: center;
}
.meta-tag { font-family: var(--font-mono); font-size: 0.7rem; color: var(--ink-soft); }
.meta-notes {
  font-style: italic; white-space: nowrap; overflow: hidden;
  text-overflow: ellipsis; max-width: 12rem;
}

.star, .delete {
  width: 1.7rem; height: 1.7rem; border-radius: var(--radius);
  display: grid; place-items: center; flex-shrink: 0;
  color: var(--ink-mute); transition: all 0.15s; opacity: 0;
}
.star { font-size: 0.85rem; }
.delete { font-size: 1.25rem; }
.task:hover .star, .task:hover .delete { opacity: 1; }
.star:hover { color: var(--prio); background: var(--prio-soft); }
.delete:hover { color: var(--danger); background: var(--line-soft); }

.empty {
  padding: 1.25rem 0.25rem; color: var(--ink-mute);
  font-family: var(--font-display); font-variation-settings: "opsz" 9;
  font-style: italic; font-size: 0.9rem;
}

.week-stat {
  margin-top: 1.25rem; padding-top: 0.85rem;
  border-top: 1px solid var(--line);
  font-family: var(--font-mono); font-size: 0.68rem;
  letter-spacing: 0.05em; color: var(--ink-mute);
}

/* ============ MODAL ============ */
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(26,24,20,0.4);
  backdrop-filter: blur(4px); display: grid; place-items: center;
  padding: 1rem; z-index: 100;
}
.modal {
  background: var(--bg-elev); border: 1px solid var(--line);
  border-radius: var(--radius-lg); padding: 1.5rem;
  width: 100%; max-width: 440px; box-shadow: var(--shadow-lg);
  max-height: 90vh; overflow-y: auto;
}
.modal h3 {
  font-family: var(--font-display); font-weight: 600; font-size: 1.3rem;
  margin-bottom: 1.25rem; letter-spacing: -0.01em;
}
.modal form { display: flex; flex-direction: column; gap: 0.85rem; }
.modal label { display: flex; flex-direction: column; gap: 0.3rem; }
.modal label.grow { flex: 1; }
.modal span {
  font-family: var(--font-mono); font-size: 0.65rem;
  text-transform: uppercase; letter-spacing: 0.08em; color: var(--ink-mute);
}
.modal input, .modal textarea {
  background: var(--bg); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 0.55rem 0.7rem;
  outline: none; transition: border-color 0.15s;
}
.modal input:focus, .modal textarea:focus { border-color: var(--ink); }
.modal textarea { resize: vertical; min-height: 3.5rem; }
.modal .row { display: flex; gap: 0.6rem; }
.modal-actions {
  display: flex; justify-content: flex-end; gap: 0.5rem;
  margin-top: 0.75rem; padding-top: 0.85rem; border-top: 1px solid var(--line);
}
.modal button {
  padding: 0.6rem 1.1rem; border-radius: var(--radius);
  font-size: 0.9rem; font-weight: 500; transition: all 0.15s;
}
.modal .ghost { color: var(--ink-soft); }
.modal .ghost:hover { background: var(--line-soft); }
.modal .primary { background: var(--ink); color: var(--bg); }
.modal .primary:hover { opacity: 0.85; }

/* ============ MOBILE ============ */
@media (max-width: 640px) {
  .app {
    padding: 0.6rem;
    padding-top: max(0.6rem, calc(env(safe-area-inset-top, 0px) + 0.6rem));
    padding-bottom: max(0.6rem, calc(env(safe-area-inset-bottom, 0px) + 0.6rem));
  }
  .header { padding: 0.5rem 0 0.85rem; }
  .month-title { font-size: 1.3rem; min-width: 6rem; }
  .month-title .year { display: block; margin: 0; font-size: 0.7rem; }
  .cell { min-height: 54px; padding: 0.3rem 0.35rem; }
  .cell-date, .cell.is-today .cell-date { font-size: 0.7rem; width: 1.3rem; height: 1.3rem; }
  .weekdays > div { font-size: 0.55rem; padding: 0.3rem 0.2rem; }
  .mark { width: 7px; height: 3px; }
  .quickadd input { font-size: 0.85rem; padding: 0.5rem; }
  .quickhint { font-size: 0.7rem; }
  .day-panel { padding: 1rem 0.85rem; }
  .slot { gap: 0.6rem; padding: 0.65rem 0.15rem; }
  .slot-num { font-size: 1.3rem; }
  .slot-title { font-size: 0.95rem; }
  .modal { padding: 1.25rem 1rem; }
  .modal .row { flex-direction: column; gap: 0.85rem; }
  .meta-notes { max-width: 8rem; }
  .star, .delete { opacity: 1; }   /* kein hover auf touch */
}

/* ============================================================
   TABLEISTE + LISTEN
   ============================================================ */

.app { padding-bottom: calc(4.5rem + env(safe-area-inset-bottom, 0px)); }
.pane { position: relative; }

.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 90;
  display: grid; grid-template-columns: 1fr 1fr;
  background: var(--bg-elev);
  border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom, 0px);
  backdrop-filter: blur(8px);
}
.tabbar button {
  display: flex; flex-direction: column; align-items: center; gap: 0.2rem;
  padding: 0.6rem 0 0.55rem;
  color: var(--ink-mute);
  font-size: 0.68rem; letter-spacing: 0.04em;
  font-family: var(--font-mono);
  transition: color 0.15s;
  position: relative;
}
.tabbar button svg { width: 21px; height: 21px; }
.tabbar button.active { color: var(--ink); }
.tabbar button.active::before {
  content: ''; position: absolute; top: 0; left: 50%; transform: translateX(-50%);
  width: 2rem; height: 2px; background: var(--prio); border-radius: 0 0 2px 2px;
}

/* ---- listenübersicht ---- */
.lists {
  display: flex; flex-direction: column;
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  overflow: hidden;
}
.list-row {
  display: flex; align-items: center; justify-content: space-between;
  gap: 0.75rem; width: 100%; text-align: left;
  padding: 0.95rem 1rem;
  border-bottom: 1px solid var(--line-soft);
  transition: background 0.12s;
}
.list-row:last-child { border-bottom: none; }
.list-row:hover { background: var(--line-soft); }
.list-name {
  font-family: var(--font-display); font-weight: 600; font-size: 1.05rem;
  font-variation-settings: "opsz" 9; letter-spacing: -0.01em;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.list-count {
  font-family: var(--font-mono); font-size: 0.75rem; font-weight: 500;
  min-width: 1.6rem; height: 1.6rem; padding: 0 0.4rem;
  display: grid; place-items: center; border-radius: 999px;
  background: var(--prio-soft); color: var(--prio); flex-shrink: 0;
}
.list-count.is-zero { background: transparent; color: var(--ink-mute); }

/* ---- punkte ---- */
.item-list {
  display: flex; flex-direction: column;
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  overflow: hidden;
}
.item {
  display: flex; align-items: center; gap: 0.75rem;
  padding: 0.7rem 0.85rem;
  border-bottom: 1px solid var(--line-soft);
  transition: background 0.12s;
}
.item:last-child { border-bottom: none; }
.item:hover { background: var(--line-soft); }
.item .check { margin-top: 0; }
.item-title { flex: 1; font-size: 0.98rem; min-width: 0; overflow-wrap: anywhere; }
.item-done .item-title { text-decoration: line-through; color: var(--ink-mute); }
.check-on { background: var(--done); color: var(--bg-elev); border-color: var(--done); }

.item-actions { display: flex; gap: 0.1rem; flex-shrink: 0; opacity: 0; transition: opacity 0.15s; }
.item:hover .item-actions { opacity: 1; }
.item-actions button {
  width: 1.7rem; height: 1.7rem; display: grid; place-items: center;
  border-radius: var(--radius); color: var(--ink-mute); font-size: 0.9rem;
  transition: all 0.15s;
}
.item-actions button:not(:disabled):hover { background: var(--line); color: var(--ink); }

/* ---- erledigt-klappbereich ---- */
.done-block { margin-top: 1rem; }
.done-toggle {
  display: flex; align-items: center; gap: 0.5rem;
  padding: 0.5rem 0.25rem; width: 100%;
  font-family: var(--font-mono); font-size: 0.68rem;
  text-transform: uppercase; letter-spacing: 0.1em; color: var(--ink-mute);
}
.done-toggle:hover { color: var(--ink); }
.chev { display: inline-block; transition: transform 0.18s; font-size: 0.85rem; }
.chev.open { transform: rotate(180deg); }
.clear-done {
  margin-top: 0.6rem; padding: 0.45rem 0.7rem;
  font-family: var(--font-mono); font-size: 0.65rem;
  text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--ink-mute); border: 1px solid var(--line); border-radius: var(--radius);
  transition: all 0.15s;
}
.clear-done:hover { color: var(--danger); border-color: var(--danger); }

/* ---- umbenennen ---- */
.rename-input {
  font-family: var(--font-display); font-weight: 600; font-size: 1.4rem;
  font-variation-settings: "opsz" 144; letter-spacing: -0.02em;
  background: transparent; border: none; border-bottom: 2px solid var(--prio);
  outline: none; padding: 0 0 0.15rem; min-width: 0; width: 100%;
}
.danger-btn:hover { color: var(--danger); }

/* ---- datumsdialog ---- */
.modal-narrow { max-width: 340px; }
.modal-lead {
  font-size: 0.88rem; color: var(--ink-soft);
  margin: -0.5rem 0 1rem; line-height: 1.45;
}
.date-quick { display: flex; gap: 0.5rem; margin-bottom: 0.85rem; }
.date-quick button {
  flex: 1; padding: 0.65rem; border: 1px solid var(--line);
  border-radius: var(--radius); font-size: 0.9rem; font-weight: 500;
  transition: all 0.15s;
}
.date-quick button:hover { border-color: var(--prio); color: var(--prio); background: var(--prio-soft); }

@media (max-width: 640px) {
  .app { padding-bottom: calc(4.25rem + env(safe-area-inset-bottom, 0px)); }
  .item-actions { opacity: 1; }       /* kein hover auf touch */
  .item { padding: 0.75rem 0.7rem; gap: 0.6rem; }
  .item-actions button { width: 1.9rem; height: 1.9rem; }
  .list-row { padding: 0.9rem 0.8rem; }
  .tabbar button { font-size: 0.62rem; }
}

/* iOS zoomt Felder unter 16px automatisch — das erzeugt seitliches Scrollen */
@media (max-width: 640px) {
  .quickadd input,
  .login-form input,
  .modal input,
  .modal textarea { font-size: 16px; }
}

/* ============================================================
   ÜBERARBEITUNG: grössere Ziele, Anfasser, Aktionsmenü
   ============================================================ */

/* ---- vorschau der schnelleingabe ---- */
.preview {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.02em;
  color: var(--prio);
  margin: 0.5rem 0.25rem 1rem;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.quickadd + .notice, .quickadd + .weekdays { margin-top: 1rem; }

/* ---- listenzeile: häkchen, text, anfasser ---- */
.item { gap: 0.5rem; }
.item-title {
  cursor: pointer;
  padding: 0.35rem 0;
  -webkit-user-select: none; user-select: none;
}
.item-done .item-title { cursor: default; }
.drag-handle {
  display: grid; place-items: center;
  width: 44px; height: 44px; flex-shrink: 0;
  color: var(--ink-mute);
  cursor: grab;
  touch-action: none;          /* sonst scrollt iOS beim ziehen mit */
}
.drag-handle:active { cursor: grabbing; color: var(--ink); }
.drag-handle svg { width: 20px; height: 20px; }
.item-ghost { opacity: 0.35; background: var(--prio-soft); }
.item-pending { opacity: 0.5; }
.item-pending .drag-handle { visibility: hidden; }
.item-del {
  width: 44px; height: 44px; flex-shrink: 0;
  display: grid; place-items: center;
  border-radius: var(--radius); font-size: 1.3rem; color: var(--ink-mute);
}
.item-del:hover { color: var(--danger); background: var(--line-soft); }

/* ---- aktionsmenü ---- */
.sheet-backdrop {
  position: fixed; inset: 0; z-index: 120;
  background: rgba(26,24,20,0.4);
  backdrop-filter: blur(4px);
  display: flex; align-items: flex-end; justify-content: center;
  padding: 1rem;
  padding-bottom: max(1rem, env(safe-area-inset-bottom, 1rem));
}
.sheet {
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  width: 100%; max-width: 420px;
  padding: 0.5rem;
  display: flex; flex-direction: column; gap: 2px;
}
.sheet-title {
  font-family: var(--font-display);
  font-variation-settings: "opsz" 9;
  font-weight: 600; font-size: 1rem;
  padding: 0.85rem 1rem 0.9rem;
  border-bottom: 1px solid var(--line);
  margin-bottom: 0.35rem;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.sheet-btn {
  text-align: left;
  padding: 0.95rem 1rem;
  min-height: 48px;
  border-radius: var(--radius);
  font-size: 1rem; font-weight: 500;
  transition: background 0.12s;
}
.sheet-btn:hover { background: var(--line-soft); }
.sheet-danger { color: var(--danger); }
.sheet-cancel {
  color: var(--ink-mute);
  border-top: 1px solid var(--line);
  margin-top: 0.35rem;
  text-align: center;
}

/* ---- grössere ziele auf dem handy ---- */
@media (max-width: 640px) {
  .star, .delete {
    width: 44px; height: 44px;
    margin-top: -2px;
  }
  .star { font-size: 1.05rem; }
  .delete { font-size: 1.5rem; }
  .task { gap: 0.35rem; padding: 0.5rem 0.15rem 0.5rem 0.4rem; }

  .slot-actions { gap: 0; }
  .slot-actions button { width: 40px; height: 44px; font-size: 1.05rem; }
  .slot { gap: 0.45rem; }
  .slot-num { width: 0.9rem; }

  .nav-btn { width: 44px; height: 44px; font-size: 1.5rem; }
  .today-btn { min-height: 40px; padding: 0.5rem 0.8rem; }
  .add-mini { min-height: 40px; padding: 0.55rem 0.85rem; font-size: 0.72rem; }
  .logout { width: 44px; height: 44px; font-size: 1.25rem; }
  .check { width: 1.4rem; height: 1.4rem; }
  .list-row { min-height: 56px; }
  .done-toggle { min-height: 44px; }
  .clear-done { min-height: 44px; }
  .preview { font-size: 0.68rem; }
}

/* Der Text ist tippbar. Der Hinweis darf nur dort erscheinen, wo es einen
   echten Zeiger gibt: auf Touch bleibt :hover nach dem Ziehen haengen. */
.item-title { padding: 0.35rem 0.4rem; margin-left: -0.4rem; border-radius: var(--radius); }
@media (hover: hover) and (pointer: fine) {
  .item-title:hover { background: var(--line); }
  .item-done .item-title:hover { background: none; }
}


/* ============================================================
   BELEGE
   ============================================================ */

.tabbar { grid-template-columns: repeat(3, 1fr); }

.jahr-wahl {
  font-family: var(--font-mono); font-size: 0.8rem;
  background: transparent; border: 1px solid var(--line);
  border-radius: var(--radius); padding: 0.35rem 0.5rem;
  outline: none; cursor: pointer; color: var(--ink-soft);
}
.jahr-wahl:focus { border-color: var(--ink); }

/* ---- kopfzahlen ---- */
.bilanz {
  display: grid; grid-template-columns: repeat(3, 1fr);
  gap: 1px; background: var(--line);
  border: 1px solid var(--line); border-radius: var(--radius-lg);
  overflow: hidden; margin-bottom: 0.75rem;
}
.bilanz-teil {
  background: var(--bg-elev);
  padding: 0.75rem 0.85rem;
  display: flex; flex-direction: column; gap: 0.15rem;
}
.bilanz-label {
  font-family: var(--font-mono); font-size: 0.6rem;
  text-transform: uppercase; letter-spacing: 0.08em; color: var(--ink-mute);
}
.bilanz-wert {
  font-family: var(--font-display); font-variation-settings: "opsz" 9;
  font-weight: 600; font-size: 1.05rem; letter-spacing: -0.01em;
}
.bilanz-gewinn .bilanz-wert { color: var(--prio); }

.unterreiter { display: flex; gap: 0.5rem; margin-bottom: 1rem; }
.unterreiter button {
  flex: 1; padding: 0.6rem; min-height: 44px;
  border: 1px solid var(--line); border-radius: var(--radius);
  font-family: var(--font-mono); font-size: 0.68rem;
  text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--ink-soft); transition: all 0.15s;
}
.unterreiter button:hover { border-color: var(--ink); color: var(--ink); }

/* ---- belegliste ---- */
.beleg-liste {
  display: flex; flex-direction: column;
  background: var(--bg-elev); border: 1px solid var(--line);
  border-radius: var(--radius-lg); overflow: hidden;
}
.beleg-row {
  display: flex; align-items: center; gap: 0.75rem;
  width: 100%; text-align: left;
  padding: 0.8rem 0.85rem; min-height: 56px;
  border-bottom: 1px solid var(--line-soft);
  transition: background 0.12s;
}
.beleg-row:last-child { border-bottom: none; }
.beleg-datum {
  font-family: var(--font-mono); font-size: 0.72rem;
  color: var(--ink-mute); flex-shrink: 0; width: 3.1rem;
}
.beleg-mitte { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 0.1rem; }
.beleg-haendler {
  font-size: 0.95rem; font-weight: 500;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.beleg-sub {
  font-family: var(--font-mono); font-size: 0.62rem;
  color: var(--ink-mute); display: flex; gap: 0.3rem; flex-wrap: wrap;
}
.beleg-betrag {
  font-family: var(--font-mono); font-size: 0.85rem; font-weight: 500;
  flex-shrink: 0; white-space: nowrap;
}
.beleg-betrag.ist-ein { color: var(--done); }
.fahrt-row { cursor: default; }

/* ---- foto ---- */
.foto-block { margin-bottom: 1rem; }
.foto-leer {
  width: 100%; min-height: 8rem;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 0.6rem;
  background: var(--bg-elev);
  border: 1px dashed var(--line); border-radius: var(--radius-lg);
  color: var(--ink-mute); font-size: 0.9rem;
  transition: all 0.15s;
}
.foto-leer:hover { border-color: var(--ink-mute); color: var(--ink-soft); }
.foto-icon svg { width: 30px; height: 30px; }
.foto-wrap { position: relative; }
.foto-wrap img {
  width: 100%; max-height: 14rem; object-fit: cover;
  border-radius: var(--radius-lg); border: 1px solid var(--line);
  display: block; cursor: zoom-in;
}
.foto-neu {
  position: absolute; right: 0.5rem; bottom: 0.5rem;
  background: var(--ink); color: var(--bg);
  padding: 0.45rem 0.7rem; border-radius: var(--radius);
  font-family: var(--font-mono); font-size: 0.62rem;
  text-transform: uppercase; letter-spacing: 0.06em;
}
.bild-gross {
  position: fixed; inset: 0; z-index: 200;
  background: rgba(26,24,20,0.88);
  display: grid; place-items: center; padding: 1rem;
  cursor: zoom-out;
}
.bild-gross img { max-width: 100%; max-height: 100%; object-fit: contain; border-radius: var(--radius); }


/* ---- art-umschalter ---- */
.art-wahl {
  display: grid; grid-template-columns: 1fr 1fr; gap: 1px;
  background: var(--line); border: 1px solid var(--line);
  border-radius: var(--radius); overflow: hidden; margin-bottom: 1rem;
}
.art-wahl button {
  background: var(--bg-elev); padding: 0.7rem; min-height: 44px;
  font-size: 0.9rem; font-weight: 500; color: var(--ink-mute);
  transition: all 0.15s;
}
.art-wahl button.active { background: var(--ink); color: var(--bg); }

/* ---- felder ---- */
.feld-block { display: flex; flex-direction: column; gap: 0.85rem; margin-bottom: 1.25rem; }
.feld-block label { display: flex; flex-direction: column; gap: 0.3rem; }
.feld-block label.grow { flex: 1; min-width: 0; }
.feld-block span {
  font-family: var(--font-mono); font-size: 0.62rem;
  text-transform: uppercase; letter-spacing: 0.08em; color: var(--ink-mute);
}
.feld-block input {
  background: var(--bg-elev); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 0.6rem 0.7rem;
  outline: none; transition: border-color 0.15s;
  width: 100%; max-width: 100%; min-width: 0;
}
/* Kein appearance:none auf Datums- und Zeitfeldern — iOS zeichnet den Wert dann
   nicht mehr, bis man das Feld antippt. Die Mindestbreite ist ohnehin kein Thema
   mehr, seit die Felder auf dem Handy untereinander stehen. */
.feld-block input[type="date"],
.feld-block input[type="time"],
.modal input[type="date"],
.modal input[type="time"] { min-width: 0; }
.feld-block input:focus { border-color: var(--ink); }
.feld-block .row { display: flex; gap: 0.6rem; }

/* ---- positionen ---- */
.pos-summe { font-family: var(--font-mono); font-size: 0.7rem; color: var(--ink-mute); }

.pos-liste { display: flex; flex-direction: column; gap: 0.4rem; }
.pos {
  display: grid;
  grid-template-columns: 1fr 5.5rem 8rem 44px;
  gap: 0.35rem; align-items: center;
}
.pos input, .pos select {
  background: var(--bg-elev); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 0.55rem 0.6rem;
  outline: none; min-width: 0; transition: border-color 0.15s;
}
.pos input:focus, .pos select:focus { border-color: var(--ink); }
.pos-betrag { text-align: right; font-family: var(--font-mono); font-size: 0.85rem; }
.pos-kat { font-size: 0.8rem; cursor: pointer; }
.pos-del {
  width: 44px; height: 44px; display: grid; place-items: center;
  border-radius: var(--radius); font-size: 1.3rem; color: var(--ink-mute);
  transition: all 0.15s;
}
.pos-del:hover { color: var(--danger); background: var(--line-soft); }

.pos-add {
  margin-top: 0.6rem; padding: 0.6rem 0.85rem; min-height: 44px;
  width: 100%;
  border: 1px dashed var(--line); border-radius: var(--radius);
  font-family: var(--font-mono); font-size: 0.68rem;
  text-transform: uppercase; letter-spacing: 0.08em; color: var(--ink-mute);
  transition: all 0.15s;
}
.pos-add:hover { border-color: var(--ink-mute); color: var(--ink-soft); }

.speichern-leiste { margin-top: 1.5rem; }
.breit {
  width: 100%; padding: 0.85rem; min-height: 48px;
  border-radius: var(--radius); font-size: 0.95rem; font-weight: 500;
}
.primary.breit { background: var(--ink); color: var(--bg); }
.primary.breit:hover { opacity: 0.88; }

/* ---- auswertung ---- */
.aus-block {
  background: var(--bg-elev); border: 1px solid var(--line);
  border-radius: var(--radius-lg); padding: 1rem 1.1rem;
  margin-bottom: 1rem;
}
.aus-titel {
  font-family: var(--font-mono); font-size: 0.62rem;
  text-transform: uppercase; letter-spacing: 0.1em; color: var(--ink-mute);
  font-weight: 400; margin-bottom: 0.75rem;
}
.aus-zeile {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: 1rem; padding: 0.4rem 0; font-size: 0.92rem;
  width: 100%; text-align: left;
}
.aus-wert { font-family: var(--font-mono); font-size: 0.85rem; white-space: nowrap; }
.aus-summe {
  border-top: 1px solid var(--line); margin-top: 0.5rem; padding-top: 0.7rem;
  font-weight: 600;
}
.aus-ergebnis .aus-summe { border-top: none; margin: 0; padding: 0; font-size: 1.05rem; }
.aus-ergebnis .aus-wert { color: var(--prio); font-size: 1rem; font-weight: 600; }
.aus-hinweis { font-size: 0.78rem; color: var(--ink-mute); margin: -0.4rem 0.25rem 1rem; }
.aus-klick { transition: opacity 0.15s; }
.aus-klick:hover { opacity: 0.65; }

@media (max-width: 640px) {
  .bilanz-teil { padding: 0.6rem 0.6rem; }
  .bilanz-wert { font-size: 0.92rem; }
  .bilanz-label { font-size: 0.55rem; }
  .pos { grid-template-columns: 1fr 4.8rem 44px; row-gap: 0.3rem; }
  .pos-text { grid-column: 1 / 3; }
  .pos-betrag { grid-column: 1; }
  .pos-kat { grid-column: 2; }
  .pos-del { grid-row: 1 / 3; grid-column: 3; height: 100%; }
  .feld-block input, .pos input, .pos select { font-size: 16px; }

  /* Nebeneinander wird auf dem Handy zu eng — ein iOS-Datumsfeld laesst sich
     nicht beliebig schmal machen und schiebt sich sonst ueber den Nachbarn. */
  .feld-block .row { flex-direction: column; gap: 0.85rem; }
  .feld-block .row > label { width: 100%; }
  .beleg-row { padding: 0.75rem 0.7rem; gap: 0.5rem; }
  .tabbar button { font-size: 0.58rem; }
}


/* ---- pdf-beleg und aufbereitungsschalter ---- */
.pdf-kachel {
  position: relative;
  display: flex; align-items: center; gap: 0.85rem;
  background: var(--bg-elev); border: 1px solid var(--line);
  border-radius: var(--radius-lg); padding: 1.1rem 1rem;
}
.pdf-icon { color: var(--prio); flex-shrink: 0; }
.pdf-icon svg { width: 30px; height: 30px; }
.pdf-text { display: flex; flex-direction: column; gap: 0.15rem; min-width: 0; }
.pdf-name {
  font-size: 0.9rem; font-weight: 500;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.pdf-link {
  font-family: var(--font-mono); font-size: 0.65rem;
  text-transform: uppercase; letter-spacing: 0.06em;
  color: var(--prio); text-decoration: none;
}
.pdf-hinweis { font-family: var(--font-mono); font-size: 0.62rem; color: var(--ink-mute); }
.pdf-neu { position: static; margin-left: auto; flex-shrink: 0; }

.aufbereiten-schalter {
  display: flex; align-items: center; gap: 0.55rem;
  margin-top: 0.6rem; padding: 0.5rem 0.25rem; min-height: 44px;
  font-size: 0.85rem; color: var(--ink-soft); cursor: pointer;
}
.aufbereiten-schalter input { width: 1.1rem; height: 1.1rem; accent-color: var(--prio); }

.unterreiter button { padding: 0.6rem 0.4rem; }


/* ---- zeitraum: jahr oder monat ---- */
.zeitraum {
  display: flex; align-items: center; gap: 0.4rem;
  margin-bottom: 0.6rem; flex-wrap: wrap;
}
.zeitraum > button {
  padding: 0.4rem 0.8rem; min-height: 36px;
  border: 1px solid var(--line); border-radius: var(--radius);
  font-family: var(--font-mono); font-size: 0.65rem;
  text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--ink-mute); transition: all 0.15s;
}
.zeitraum > button.active {
  background: var(--ink); color: var(--bg); border-color: var(--ink);
}
.monat-wahl {
  display: flex; align-items: center; gap: 0.15rem;
  margin-left: auto;
}
.monat-wahl span {
  font-family: var(--font-display); font-variation-settings: "opsz" 9;
  font-weight: 600; font-size: 0.92rem;
  min-width: 5.5rem; text-align: center;
}
.monat-wahl button {
  width: 36px; height: 36px; display: grid; place-items: center;
  border-radius: var(--radius); font-size: 1.15rem; color: var(--ink-soft);
}
.monat-wahl button:hover { background: var(--line-soft); }

@media (max-width: 640px) {
  .monat-wahl button { width: 40px; height: 40px; }
  .monat-wahl span { min-width: 5rem; font-size: 0.88rem; }
}

/* ============================================================
   TOUCH: keine haengenden Hover-Zustaende
   Ein Finger hat kein "Zeiger weg". Jeder :hover-Zustand bleibt
   deshalb nach dem Antippen oder Ziehen stehen, bis man woanders
   hintippt. Auf Touch-Geraeten also alle zurueckdrehen.
   ============================================================ */
@media (hover: none) {
  .nav-btn:hover,
  .task:hover,
  .item:hover,
  .list-row:hover,
  .sheet-btn:hover,
  .modal .ghost:hover { background: none; }

  .cell:hover { background: var(--bg-elev); }
  .cell.is-other:hover { background: var(--bg); }
  .cell.is-selected:hover { background: var(--bg); }

  .star:hover,
  .delete:hover,
  .item-del:hover,
  .pos-del:hover,
  .slot-actions button:not(:disabled):hover,
  .item-actions button:not(:disabled):hover {
    background: none;
    color: var(--ink-mute);
  }

  .today-btn:hover,
  .add-mini:hover,
  .unterreiter button:hover { border-color: var(--line); color: var(--ink-soft); }

  .pos-add:hover,
  .foto-leer:hover { border-color: var(--line); color: var(--ink-mute); }

  .clear-done:hover { border-color: var(--line); color: var(--ink-mute); }

  .date-quick button:hover {
    border-color: var(--line);
    color: var(--ink);
    background: none;
  }

  .logout:hover,
  .danger-btn:hover,
  .done-toggle:hover { color: var(--ink-mute); }

  .monat-wahl button:hover { background: none; }
  .termin:hover { background: none; }
  .ueber-zeile:hover { background: none; }
  .prio-offen-liste .task:hover { background: none; }
  .loeschen:hover { background: none; }
  .steuer-mehr:hover { color: var(--ink-mute); }

  .check:hover { border-color: var(--ink-mute); }
  .task-done .check, .slot-done .check,
  .check-on { border-color: var(--done); }

  .plus-btn:hover { transform: none; }
  .modal .primary:hover,
  .primary.breit:hover { opacity: 1; }
  .aus-klick:hover { opacity: 1; }
}

/* ---- steuerschaetzung ---- */
.steuer-box {
  background: var(--bg-elev); border: 1px solid var(--line);
  border-radius: var(--radius-lg); padding: 0.9rem 1rem;
  margin-bottom: 0.75rem;
}
.steuer-kopf {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: 0.75rem;
}
.steuer-label {
  font-family: var(--font-mono); font-size: 0.6rem;
  text-transform: uppercase; letter-spacing: 0.08em; color: var(--ink-mute);
}
.steuer-wert {
  font-family: var(--font-display); font-variation-settings: "opsz" 9;
  font-weight: 600; font-size: 1.15rem; color: var(--prio);
}
.steuer-zeile {
  display: flex; justify-content: space-between; gap: 0.75rem;
  font-family: var(--font-mono); font-size: 0.68rem;
  color: var(--ink-mute); margin-top: 0.3rem;
}
.steuer-frei { color: var(--done); }
.steuer-mehr {
  display: flex; align-items: center; gap: 0.45rem;
  margin-top: 0.6rem; padding: 0.35rem 0; min-height: 40px;
  font-family: var(--font-mono); font-size: 0.62rem;
  text-transform: uppercase; letter-spacing: 0.09em; color: var(--ink-mute);
}
.steuer-mehr:hover { color: var(--ink); }
.steuer-felder {
  display: flex; flex-direction: column; gap: 0.7rem;
  padding-top: 0.6rem; border-top: 1px solid var(--line);
}
.steuer-felder label { display: flex; flex-direction: column; gap: 0.25rem; }
.steuer-felder span {
  font-family: var(--font-mono); font-size: 0.58rem;
  text-transform: uppercase; letter-spacing: 0.07em; color: var(--ink-mute);
}
.steuer-felder input {
  background: var(--bg); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 0.55rem 0.65rem;
  outline: none; transition: border-color 0.15s;
}
.steuer-felder input:focus { border-color: var(--ink); }
.steuer-hinweis {
  font-size: 0.73rem; line-height: 1.45; color: var(--ink-mute);
}
.steuer-kein-tarif { font-size: 0.82rem; color: var(--ink-mute); }

@media (max-width: 640px) {
  .steuer-felder input { font-size: 16px; }
  .steuer-wert { font-size: 1.05rem; }
}

/* ============================================================
   TERMINE, ZEITRAEUME, GEBURTSTAGE
   Farbe steht fuer die Art des Eintrags, nicht fuer eine Person.
   ============================================================ */

/* ---- marker im raster ---- */
.punkt { width: 6px; height: 6px; border-radius: 999px; }
.punkt-termin { background: var(--termin); }
.punkt-geburtstag { background: var(--gebtag); }

.spann {
  position: absolute; left: 0; right: 0; bottom: 3px;
  height: 4px; background: var(--zeitraum);
}
.spann-start { left: 4px; border-radius: 2px 0 0 2px; }
.spann-ende { right: 4px; border-radius: 0 2px 2px 0; }
.spann-start.spann-ende { border-radius: 2px; }

/* Der Balken ist ein absolut positioniertes Kind und wuerde sonst ueber dem
   Auswahl-Rahmen liegen. In der gewaehlten Zelle also einruecken. */
.cell.is-selected .spann {
  left: 5px; right: 5px; bottom: 6px; border-radius: 2px;
}
.cell-marks { position: relative; z-index: 1; margin-bottom: 9px; }

/* ---- termine in der tagesansicht ---- */
.termin-liste {
  display: flex; flex-direction: column; gap: 2px;
  margin-bottom: 1rem;
}
.termin {
  display: flex; align-items: center; gap: 0.6rem;
  padding: 0.55rem 0.6rem; min-height: 44px;
  border-radius: var(--radius);
  cursor: pointer; transition: background 0.12s;
  position: relative;
}
.termin:hover { background: var(--line-soft); }
.termin-strich {
  width: 3px; align-self: stretch; border-radius: 2px; flex-shrink: 0;
}
.termin-termin .termin-strich { background: var(--termin); }
.termin-zeitraum .termin-strich { background: var(--zeitraum); }
.termin-geburtstag .termin-strich { background: var(--gebtag); }

.termin-zeit {
  font-family: var(--font-mono); font-size: 0.78rem;
  color: var(--ink-soft); font-weight: 500; flex-shrink: 0;
}
.termin-titel {
  font-size: 0.95rem; font-weight: 500;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.termin-span {
  font-family: var(--font-mono); font-size: 0.68rem; color: var(--ink-mute);
  white-space: nowrap;
}
.termin-typ {
  margin-left: auto; flex-shrink: 0;
  font-family: var(--font-mono); font-size: 0.58rem;
  text-transform: uppercase; letter-spacing: 0.07em;
  padding: 0.18rem 0.45rem; border-radius: 999px;
}
.termin-termin .termin-typ { background: var(--termin-soft); color: var(--termin); }
.termin-zeitraum .termin-typ { background: var(--zeitraum-soft); color: var(--zeitraum); }
.termin-geburtstag .termin-typ { background: var(--gebtag-soft); color: var(--gebtag); }

.modal select {
  background: var(--bg); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 0.55rem 0.7rem;
  outline: none; cursor: pointer;
}
.modal select:focus { border-color: var(--ink); }

@media (max-width: 640px) {
  .termin { padding: 0.6rem 0.4rem; gap: 0.45rem; }
  .termin-typ { display: none; }   /* farbe reicht auf dem handy */
  .punkt { width: 5px; height: 5px; }
  .modal select { font-size: 16px; }
}

/* loeschen im bearbeiten-fenster — gilt fuer alle arten */
.modal-actions { align-items: center; }
.loeschen {
  margin-right: auto;
  color: var(--danger);
  padding: 0.6rem 0.9rem; border-radius: var(--radius);
  font-size: 0.9rem; font-weight: 500;
  transition: background 0.15s;
}
.loeschen:hover { background: var(--line-soft); }
@media (max-width: 640px) {
  .loeschen { min-height: 44px; padding: 0.6rem 0.7rem; }
}

/* Der Belege-Kopf traegt auf dem Handy drei Knoepfe — etwas schmaler,
   damit er auch auf engen Geraeten in einer Zeile bleibt. */
@media (max-width: 640px) {
  .pane .header-right .today-btn { padding: 0.5rem 0.55rem; letter-spacing: 0.05em; }
  .pane .header-right { gap: 0.35rem; }
}

/* erledigte und offene Restaufgaben getrennt zaehlen, gleiche Groesse */
.mark-rest-done { color: var(--done); margin-left: 1px; }
.mark-rest-done + .mark-rest { margin-left: 2px; }

/* die Fahrten-Leiste hat nur zwei Kacheln — sonst bliebe rechts eine leere */
.bilanz-zwei { grid-template-columns: repeat(2, 1fr); }

/* ---- ueberfaellige Aufgaben ---- */
.ueberfaellig {
  margin-bottom: 1rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
}
.ueberfaellig-kopf {
  display: flex; align-items: center; gap: 0.5rem;
  width: 100%; padding: 0.6rem 0.7rem; min-height: 44px;
  font-family: var(--font-mono); font-size: 0.68rem;
  text-transform: uppercase; letter-spacing: 0.09em;
  color: var(--prio); background: var(--prio-soft);
}
.ueberfaellig-liste { padding: 0.25rem 0.35rem 0.4rem; }
.ueber-alter {
  font-family: var(--font-mono); font-size: 0.68rem; color: var(--prio);
}

/* Versionsnummer neben der Domain unter dem Login */
.version { opacity: 0.55; margin-left: 0.35rem; }

/* ---- ueberfaellige Prios: bleiben auf ihrem Tag, werden bei heute gezeigt ---- */
.prio-offen {
  margin-bottom: 0.6rem;
  border: 1px solid var(--prio);
  border-radius: var(--radius);
  overflow: hidden;
}
.prio-offen-kopf {
  display: flex; align-items: center; gap: 0.5rem;
  width: 100%; padding: 0.65rem 0.7rem; min-height: 44px;
  font-family: var(--font-mono); font-size: 0.7rem; font-weight: 500;
  text-transform: uppercase; letter-spacing: 0.09em;
  color: var(--bg); background: var(--prio);
}
.prio-offen-liste { padding: 0.25rem 0.35rem 0.4rem; }
