/* ═══════════════════════════════════════════════════════════
   Mail Light — supplied design styles; provenance in docs/DESIGN-AUDIT.md
   Design-Tokens: warmes Papier, ein Akzent, ruhige Motion
   ═══════════════════════════════════════════════════════════ */

:root {
  /* Oberflächen — nie reinweiß */
  --bg:            oklch(0.985 0.004 90);   /* #fbfbf9 */
  --bg-alt:        oklch(0.968 0.005 90);   /* #f4f4f2 */
  --surface:       oklch(0.998 0.002 90);
  --surface-hover: oklch(0.955 0.006 85);

  /* Text — warmes Near-Black */
  --text:    oklch(0.18 0.01 80);
  --text-2:  oklch(0.48 0.015 80);          /* #737373 */
  --text-3:  oklch(0.62 0.015 80);

  /* Linien */
  --border:        oklch(0.90 0.008 85 / 0.7);
  --border-strong: oklch(0.85 0.008 85 / 0.5);

  /* Ein einziger saturierter Akzent: Terracotta */
  --accent:        oklch(0.58 0.16 32);
  --accent-hover:  oklch(0.52 0.17 32);
  --accent-soft:   oklch(0.94 0.04 38);
  --accent-text:   oklch(0.50 0.15 32);

  /* Semantik, aus der Palette abgeleitet */
  --green-soft:  oklch(0.93 0.04 150);
  --green-text:  oklch(0.45 0.10 150);
  --blue-soft:   oklch(0.93 0.03 240);
  --blue-text:   oklch(0.48 0.09 240);
  --amber-soft:  oklch(0.94 0.05 75);
  --amber-text:  oklch(0.50 0.11 65);
  --red-soft:    oklch(0.93 0.04 25);
  --red-text:    oklch(0.50 0.14 25);

  /* Radii-Skala */
  --r-s: 6px; --r-m: 10px; --r-l: 14px; --r-xl: 20px;

  /* Warme Schatten */
  --shadow-lift: 0 4px 14px -6px oklch(0.2 0.01 80 / 0.16);
  --shadow-modal: 0 24px 60px -20px oklch(0.2 0.01 80 / 0.25);

  --rail-w: 60px;
  --ease: cubic-bezier(.33,1,.33,1);
}

[data-theme="dark"] {
  --bg:            oklch(0.21 0.012 80);
  --bg-alt:        oklch(0.24 0.012 80);
  --surface:       oklch(0.26 0.012 80);
  --surface-hover: oklch(0.30 0.014 80);
  --text:    oklch(0.93 0.01 85);
  --text-2:  oklch(0.70 0.015 80);
  --text-3:  oklch(0.56 0.015 80);
  --border:        oklch(0.38 0.012 80 / 0.6);
  --border-strong: oklch(0.45 0.012 80 / 0.5);
  --accent:        oklch(0.70 0.14 35);
  --accent-hover:  oklch(0.76 0.14 35);
  --accent-soft:   oklch(0.34 0.05 35);
  --accent-text:   oklch(0.76 0.13 35);
  --green-soft: oklch(0.34 0.05 150); --green-text: oklch(0.75 0.10 150);
  --blue-soft:  oklch(0.34 0.05 240); --blue-text:  oklch(0.75 0.09 240);
  --amber-soft: oklch(0.35 0.06 75);  --amber-text: oklch(0.78 0.11 75);
  --red-soft:   oklch(0.35 0.06 25);  --red-text:   oklch(0.75 0.12 25);
  --shadow-lift: 0 4px 14px -6px oklch(0 0 0 / 0.5);
  --shadow-modal: 0 24px 60px -20px oklch(0 0 0 / 0.6);
}

/* ── Basis ─────────────────────────────────────────────── */
* { box-sizing: border-box; margin: 0; padding: 0; }

html, body { height: 100%; }

body {
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
  font-feature-settings: "ss01" 1, "cv11" 1;
  font-size: 14px;
  line-height: 1.55;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}

/* Papier-Textur: zwei kaum sichtbare radiale Verläufe */
body::before {
  content: "";
  position: fixed; inset: 0; z-index: 0; pointer-events: none;
  background:
    radial-gradient(60% 50% at 20% 10%, oklch(0.94 0.03 60 / 0.25), transparent 70%),
    radial-gradient(50% 60% at 80% 70%, oklch(0.94 0.03 40 / 0.18), transparent 70%);
}

.mono {
  font-family: ui-monospace, "SFMono-Regular", Consolas, monospace;
  font-size: 0.86em;
  letter-spacing: 0.01em;
}

::selection { background: var(--accent-soft); color: var(--accent-text); }

button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
input, textarea { font: inherit; color: inherit; }

:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px var(--accent-soft);
  border-radius: var(--r-s);
}

/* ── App-Shell ─────────────────────────────────────────── */
.app {
  position: relative; z-index: 1;
  display: flex;
  height: 100vh;
}

.module {
  display: none;
  flex: 1;
  min-width: 0;
  animation: moduleIn 240ms var(--ease);
}
.module.is-active { display: flex; }

@keyframes moduleIn {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: none; }
}

/* ── Icon Rail ─────────────────────────────────────────── */
.rail {
  width: var(--rail-w);
  flex: 0 0 var(--rail-w);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 10px 0;
  border-right: 1px solid var(--border);
  background: var(--bg-alt);
}

.rail-logo {
  width: 40px; height: 40px;
  display: grid; place-items: center;
  color: var(--accent);
  margin-bottom: 8px;
}
.rail-logo svg { width: 24px; height: 24px; }

.rail-btn {
  position: relative;
  width: 40px; height: 40px;
  display: grid; place-items: center;
  border-radius: var(--r-m);
  color: var(--text-2);
  transition: background 160ms var(--ease), color 160ms var(--ease);
}
.rail-btn svg { width: 20px; height: 20px; }
.rail-btn:hover { background: var(--surface-hover); color: var(--text); }
.rail-btn.is-active { background: var(--accent-soft); color: var(--accent-text); }

.rail-dot {
  position: absolute; top: 7px; right: 7px;
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--accent);
  display: none;
}
.rail-dot.on { display: block; }

.rail-spacer { flex: 1; }

.rail-avatar {
  width: 32px; height: 32px;
  border-radius: 50%;
  display: grid; place-items: center;
  font-size: 11px; font-weight: 600; letter-spacing: 0.03em;
  color: var(--accent-text);
  background: var(--accent-soft);
  margin-top: 4px;
  cursor: pointer;
}

[data-theme="dark"] .icon-sun { display: none; }
.icon-moon { display: none; }
[data-theme="dark"] .icon-moon { display: block; }

/* ── Panes ─────────────────────────────────────────────── */
.pane { min-width: 0; display: flex; flex-direction: column; height: 100%; }

.pane-folders {
  flex: 0 0 220px;
  border-right: 1px solid var(--border);
  background: var(--bg);
}
.pane-list {
  flex: 0 0 360px;
  border-right: 1px solid var(--border);
  background: var(--bg);
}
.pane-reading { flex: 1; background: var(--surface); }
.pane-side {
  flex: 0 0 260px;
  border-right: 1px solid var(--border);
  background: var(--bg);
}
.pane-cal, .pane-detail, .pane-notes, .pane-tasks, .pane-settings {
  flex: 1; background: var(--surface);
}

.pane-head { padding: 14px 14px 10px; }
.pane-foot {
  margin-top: auto;
  padding: 12px 14px;
  border-top: 1px solid var(--border);
}

/* ── Buttons ───────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 7px 13px;
  border-radius: 8px;
  border: 1px solid var(--border-strong);
  background: var(--surface);
  font-weight: 500;
  font-size: 13px;
  transition: background 160ms var(--ease), border-color 160ms var(--ease), transform 160ms var(--ease);
}
.btn svg { width: 15px; height: 15px; }
.btn:hover { background: var(--surface-hover); }

.btn-primary {
  background: var(--accent);
  border-color: transparent;
  color: oklch(0.99 0.01 60);
}
.btn-primary:hover { background: var(--accent-hover); }
.btn-primary .arrow { transition: transform 160ms var(--ease); }
.btn-primary:hover .arrow { transform: translateX(2px); }

.btn-block { width: 100%; justify-content: center; }

.btn-ghost { border-color: transparent; background: transparent; }
.btn-ghost:hover { background: var(--surface-hover); }

.icon-btn {
  width: 30px; height: 30px;
  display: inline-grid; place-items: center;
  border-radius: 8px;
  color: var(--text-2);
  transition: background 160ms var(--ease), color 160ms var(--ease);
}
.icon-btn svg { width: 16px; height: 16px; }
.icon-btn:hover { background: var(--surface-hover); color: var(--text); }

/* ── Suche ─────────────────────────────────────────────── */
.list-toolbar {
  padding: 12px;
  border-bottom: 1px solid var(--border);
}
.search {
  display: flex; align-items: center; gap: 8px;
  padding: 7px 11px;
  border: 1px solid var(--border);
  border-radius: var(--r-m);
  background: var(--surface);
  color: var(--text-3);
  transition: box-shadow 160ms var(--ease), border-color 160ms var(--ease);
}
.search:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.search svg { width: 14px; height: 14px; flex: none; }
.search input {
  flex: 1; min-width: 0;
  border: 0; outline: 0; background: none;
  font-size: 13px;
}
.search input::placeholder { color: var(--text-3); }

/* ═══════════════ E-MAIL ═══════════════ */

/* Ordner */
.folder-list { padding: 4px 8px; }
.folder {
  display: flex; align-items: center; gap: 9px;
  width: 100%;
  padding: 6px 9px;
  border-radius: 8px;
  font-size: 13px;
  color: var(--text-2);
  transition: background 140ms var(--ease), color 140ms var(--ease);
}
.folder svg { width: 15px; height: 15px; flex: none; }
.folder:hover { background: var(--surface-hover); color: var(--text); }
.folder.is-active { background: var(--accent-soft); color: var(--accent-text); font-weight: 500; }
.folder .count {
  margin-left: auto;
  font-family: ui-monospace, "SFMono-Regular", Consolas, monospace;
  font-size: 11px;
  color: var(--text-3);
}
.folder.is-active .count { color: var(--accent-text); }

.folder-sep {
  margin: 8px 10px 4px;
  font-size: 10px; font-weight: 600;
  letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--text-3);
}

/* Quota */
.quota-label {
  display: flex; justify-content: space-between;
  font-size: 11px; color: var(--text-3);
  margin-bottom: 6px;
}
.quota-bar {
  height: 4px; border-radius: 2px;
  background: var(--surface-hover);
  overflow: hidden;
}
.quota-bar i {
  display: block; height: 100%;
  background: var(--accent);
  border-radius: 2px;
}

/* Mailliste */
.mail-list { flex: 1; overflow-y: auto; }

.mail-day {
  padding: 10px 14px 4px;
  font-size: 10px; font-weight: 600;
  letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--text-3);
}

.mail-item {
  position: relative;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background 140ms var(--ease);
}
.mail-item:hover { background: var(--surface-hover); }
.mail-item.is-selected { background: var(--accent-soft); }
.mail-item.is-selected:hover { background: var(--accent-soft); }

.mail-row {
  display: flex; align-items: baseline; gap: 8px;
}
.mail-from {
  font-size: 13px; font-weight: 500;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  flex: 1;
}
.mail-item.unread .mail-from { font-weight: 650; }
.mail-time {
  font-family: ui-monospace, "SFMono-Regular", Consolas, monospace;
  font-size: 11px;
  color: var(--text-3);
  flex: none;
}
.mail-subject {
  font-size: 13px;
  margin-top: 1px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  color: var(--text);
}
.mail-item.unread .mail-subject { font-weight: 550; }
.mail-snippet {
  font-size: 12px;
  color: var(--text-2);
  margin-top: 1px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.unread-dot {
  position: absolute; left: 5px; top: 18px;
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--accent);
}
.mail-tag {
  display: inline-block;
  font-size: 10px; font-weight: 600;
  padding: 1px 6px;
  border-radius: 99px;
  margin-left: 6px;
  vertical-align: 1px;
}
.tag-work { background: var(--blue-soft); color: var(--blue-text); }
.tag-priv { background: var(--green-soft); color: var(--green-text); }

/* Lesefenster */
.read-empty {
  flex: 1;
  display: grid; place-items: center;
  color: var(--text-3);
  text-align: center;
}
.read-empty svg { width: 40px; height: 40px; margin-bottom: 12px; opacity: .5; }
.read-empty p { font-size: 13px; }

.read-head {
  display: flex; align-items: center; gap: 4px;
  padding: 10px 16px;
  border-bottom: 1px solid var(--border);
}
.read-head .spacer { flex: 1; }
.read-head .lbl {
  font-size: 11px; color: var(--text-3);
  margin-right: 4px;
}

.read-body-wrap { flex: 1; overflow-y: auto; }
.read-body {
  max-width: 720px;
  margin: 0 auto;
  padding: 32px 40px 60px;
}
.read-subject {
  font-size: 22px; font-weight: 600;
  letter-spacing: -0.015em;
  line-height: 1.3;
}
.read-meta {
  display: flex; align-items: center; gap: 12px;
  margin: 18px 0 24px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--border);
}
.avatar {
  width: 38px; height: 38px; flex: none;
  border-radius: 50%;
  display: grid; place-items: center;
  font-size: 12px; font-weight: 600;
  letter-spacing: 0.02em;
}
.read-from { font-size: 13.5px; font-weight: 550; }
.read-to { font-size: 12px; color: var(--text-2); }
.read-date {
  margin-left: auto;
  font-family: ui-monospace, "SFMono-Regular", Consolas, monospace;
  font-size: 11.5px;
  color: var(--text-3);
  white-space: nowrap;
}
.read-text { font-size: 14.5px; line-height: 1.75; color: var(--text); }
.read-text p + p { margin-top: 1em; }

.attach-row {
  display: flex; flex-wrap: wrap; gap: 8px;
  margin-top: 26px;
}
.attach {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 7px 12px;
  border: 1px solid var(--border);
  border-radius: var(--r-m);
  background: var(--bg);
  font-size: 12.5px;
  transition: background 160ms var(--ease), transform 160ms var(--ease);
  cursor: pointer;
}
.attach:hover { background: var(--surface-hover); transform: translateY(-1px); box-shadow: var(--shadow-lift); }
.attach svg { width: 14px; height: 14px; color: var(--text-2); }
.attach .size { font-family: ui-monospace, "SFMono-Regular", Consolas, monospace; font-size: 10.5px; color: var(--text-3); }

.read-reply {
  max-width: 720px;
  margin: 0 auto;
  padding: 0 40px 40px;
}
.reply-box {
  border: 1px solid var(--border);
  border-radius: var(--r-l);
  padding: 14px 16px;
  color: var(--text-3);
  font-size: 13.5px;
  cursor: text;
  transition: box-shadow 160ms var(--ease), border-color 160ms var(--ease);
  background: var(--bg);
}
.reply-box:hover, .reply-box:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); color: var(--text); outline: none; }

/* ═══════════════ KALENDER ═══════════════ */

.side-heading { font-size: 16px; font-weight: 600; letter-spacing: -0.01em; }

.side-block { padding: 14px; }
.side-title {
  font-size: 10px; font-weight: 600;
  letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--text-3);
  margin-bottom: 10px;
}

/* Mini-Monat */
.mini-cal { padding: 6px 14px 4px; }
.mini-cal-head {
  display: flex; align-items: center; justify-content: space-between;
  font-size: 12.5px; font-weight: 550;
  margin-bottom: 6px;
}
.mini-cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 1px;
  text-align: center;
}
.mini-cal-grid .dow {
  font-size: 9.5px; font-weight: 600;
  letter-spacing: 0.06em;
  color: var(--text-3);
  padding: 3px 0;
}
.mini-cal-grid .day {
  font-family: ui-monospace, "SFMono-Regular", Consolas, monospace;
  font-size: 11px;
  padding: 4px 0;
  border-radius: 6px;
  color: var(--text-2);
  cursor: pointer;
  transition: background 140ms var(--ease);
}
.mini-cal-grid .day:hover { background: var(--surface-hover); }
.mini-cal-grid .day.other { color: var(--text-3); opacity: .45; }
.mini-cal-grid .day.today {
  background: var(--accent);
  color: oklch(0.99 0.01 60);
  font-weight: 600;
}
.mini-cal-grid .day.has-ev { position: relative; }
.mini-cal-grid .day.has-ev::after {
  content: ""; position: absolute;
  left: 50%; bottom: 1px; transform: translateX(-50%);
  width: 3px; height: 3px; border-radius: 50%;
  background: var(--accent);
}
.mini-cal-grid .day.today.has-ev::after { background: oklch(0.99 0.01 60); }

/* Demnächst */
.upcoming {
  display: flex; gap: 10px;
  padding: 8px 10px;
  border-radius: var(--r-m);
  transition: background 140ms var(--ease);
  cursor: pointer;
}
.upcoming:hover { background: var(--surface-hover); }
.upcoming .u-dot {
  width: 7px; height: 7px; border-radius: 50%;
  margin-top: 7px; flex: none;
}
.upcoming .u-title { font-size: 13px; font-weight: 500; }
.upcoming .u-time {
  font-family: ui-monospace, "SFMono-Regular", Consolas, monospace;
  font-size: 11px; color: var(--text-3);
}

/* Toolbar */
.cal-toolbar {
  display: flex; align-items: center; gap: 16px;
  padding: 12px 18px;
  border-bottom: 1px solid var(--border);
}
.cal-nav { display: flex; align-items: center; gap: 4px; }
.cal-title {
  font-size: 16px; font-weight: 600; letter-spacing: -0.01em;
  flex: 1;
}

.segmented {
  display: flex;
  padding: 2px;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: var(--bg);
}
.segmented button {
  padding: 4px 12px;
  font-size: 12px; font-weight: 500;
  border-radius: 7px;
  color: var(--text-2);
  transition: background 160ms var(--ease), color 160ms var(--ease);
}
.segmented button:hover { color: var(--text); }
.segmented button.is-on {
  background: var(--surface);
  color: var(--text);
  box-shadow: 0 1px 3px oklch(0.2 0.01 80 / 0.12);
}

/* Wochenraster */
.cal-week {
  flex: 1;
  overflow-y: auto;
  position: relative;
}
.cal-grid {
  display: grid;
  grid-template-columns: 52px repeat(7, 1fr);
  min-height: 100%;
}
.cal-corner {
  position: sticky; top: 0; z-index: 3;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}
.cal-dayhead {
  position: sticky; top: 0; z-index: 3;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  border-left: 1px solid var(--border);
  text-align: center;
  padding: 8px 0 7px;
}
.cal-dayhead .dow {
  font-size: 10px; font-weight: 600;
  letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--text-3);
}
.cal-dayhead .dnum {
  font-family: ui-monospace, "SFMono-Regular", Consolas, monospace;
  font-size: 15px;
  margin-top: 1px;
}
.cal-dayhead.is-today .dnum {
  color: var(--accent-text);
  font-weight: 600;
}
.cal-time {
  font-family: ui-monospace, "SFMono-Regular", Consolas, monospace;
  font-size: 10px;
  color: var(--text-3);
  text-align: right;
  padding: 0 8px 0 0;
  transform: translateY(-6px);
  height: 48px;
}
.cal-cell {
  border-left: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  height: 48px;
  position: relative;
}
.cal-col-events { position: relative; }

.cal-event {
  position: absolute;
  left: 3px; right: 4px;
  border-radius: var(--r-s);
  padding: 3px 7px;
  font-size: 11.5px;
  line-height: 1.35;
  overflow: hidden;
  cursor: pointer;
  border: 1px solid transparent;
  transition: transform 160ms var(--ease), box-shadow 160ms var(--ease);
  z-index: 2;
}
.cal-event:hover { transform: translateY(-1px); box-shadow: var(--shadow-lift); z-index: 4; }
.cal-event .ev-title { font-weight: 550; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cal-event .ev-time { font-family: ui-monospace, "SFMono-Regular", Consolas, monospace; font-size: 9.5px; opacity: .8; }

.ev-work { background: var(--blue-soft);  color: var(--blue-text);  border-color: color-mix(in oklch, var(--blue-text) 18%, transparent); }
.ev-priv { background: var(--green-soft); color: var(--green-text); border-color: color-mix(in oklch, var(--green-text) 18%, transparent); }
.ev-team { background: var(--accent-soft); color: var(--accent-text); border-color: color-mix(in oklch, var(--accent-text) 18%, transparent); }
.ev-warn { background: var(--amber-soft); color: var(--amber-text); border-color: color-mix(in oklch, var(--amber-text) 18%, transparent); }

/* Jetzt-Linie */
.cal-now {
  position: absolute; left: 0; right: 0;
  height: 1.5px;
  background: var(--accent);
  z-index: 3;
  pointer-events: none;
}
.cal-now::before {
  content: "";
  position: absolute; left: -3px; top: -3px;
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--accent);
}

/* ═══════════════ KONTAKTE ═══════════════ */
.contact-list { flex: 1; overflow-y: auto; }

.contact-alpha {
  padding: 12px 14px 2px;
  font-size: 18px; font-weight: 650;
  letter-spacing: -0.01em;
  color: var(--text-3);
}

.contact-item {
  display: flex; align-items: center; gap: 11px;
  padding: 7px 14px;
  cursor: pointer;
  transition: background 140ms var(--ease);
}
.contact-item:hover { background: var(--surface-hover); }
.contact-item.is-selected { background: var(--accent-soft); }
.contact-item .avatar { width: 32px; height: 32px; font-size: 11px; }
.contact-item .c-name { font-size: 13px; font-weight: 500; }
.contact-item .c-mail {
  font-size: 11.5px; color: var(--text-3);
  font-family: ui-monospace, "SFMono-Regular", Consolas, monospace;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.contact-item .c-text { min-width: 0; flex: 1; }
.contact-item .c-name, .contact-item .c-mail { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Detail */
.detail-wrap {
  max-width: 560px;
  margin: 0 auto;
  padding: 48px 40px;
  width: 100%;
}
.detail-head { text-align: center; margin-bottom: 28px; }
.detail-head .avatar {
  width: 84px; height: 84px;
  font-size: 26px;
  margin: 0 auto 14px;
}
.detail-head h2 { font-size: 22px; font-weight: 600; letter-spacing: -0.015em; }
.detail-head .role { font-size: 13px; color: var(--text-2); margin-top: 2px; }
.detail-actions {
  display: flex; justify-content: center; gap: 8px;
  margin-top: 16px;
}

.detail-fields {
  border: 1px solid var(--border);
  border-radius: var(--r-l);
  overflow: hidden;
  background: var(--bg);
}
.dfield {
  display: flex; align-items: center; gap: 14px;
  padding: 12px 16px;
}
.dfield + .dfield { border-top: 1px solid var(--border); }
.dfield .k {
  flex: 0 0 92px;
  font-size: 10px; font-weight: 600;
  letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--text-3);
}
.dfield .v { font-size: 13.5px; }
.dfield .v.mono { font-size: 12.5px; }

/* ═══════════════ NOTIZEN ═══════════════ */
.pane-notes, .pane-tasks { overflow-y: auto; }

.module-bar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 22px 28px 18px;
}
.module-bar h2 { font-size: 20px; font-weight: 600; letter-spacing: -0.015em; }
.module-sub { color: var(--text-3); font-size: 11.5px; margin-top: 2px; }

.notes-grid {
  columns: 3 240px;
  column-gap: 14px;
  padding: 0 28px 40px;
}
.note {
  break-inside: avoid;
  margin-bottom: 14px;
  border-radius: var(--r-l);
  border: 1px solid var(--border);
  padding: 16px 18px;
  cursor: pointer;
  transition: transform 160ms var(--ease), box-shadow 160ms var(--ease);
}
.note:hover { transform: translateY(-2px); box-shadow: var(--shadow-lift); }
.note h3 { font-size: 14px; font-weight: 600; margin-bottom: 5px; }
.note p { font-size: 12.5px; line-height: 1.6; opacity: .85; white-space: pre-line; }
.note .n-date {
  display: block;
  margin-top: 12px;
  font-family: ui-monospace, "SFMono-Regular", Consolas, monospace;
  font-size: 10.5px;
  opacity: .65;
}
.note.tone-a { background: var(--accent-soft); color: var(--text); border-color: color-mix(in oklch, var(--accent-text) 14%, transparent); }
.note.tone-b { background: var(--green-soft); border-color: color-mix(in oklch, var(--green-text) 14%, transparent); }
.note.tone-c { background: var(--blue-soft);  border-color: color-mix(in oklch, var(--blue-text) 14%, transparent); }
.note.tone-d { background: var(--amber-soft); border-color: color-mix(in oklch, var(--amber-text) 14%, transparent); }
.note.tone-e { background: var(--bg-alt); }

.note-new {
  break-inside: avoid;
  margin-bottom: 14px;
  border: 1.5px dashed var(--border-strong);
  border-radius: var(--r-l);
  padding: 22px;
  text-align: center;
  color: var(--text-3);
  font-size: 13px;
  cursor: pointer;
  transition: border-color 160ms var(--ease), color 160ms var(--ease), background 160ms var(--ease);
}
.note-new:hover { border-color: var(--accent); color: var(--accent-text); background: var(--accent-soft); }

/* ═══════════════ AUFGABEN ═══════════════ */
.pane-tasks { max-width: 720px; margin: 0 auto; width: 100%; }

.task-progress {
  display: flex; align-items: center; gap: 10px;
  color: var(--text-2); font-size: 12px;
}
.progress-ring { width: 34px; height: 34px; transform: rotate(-90deg); }
.ring-bg { fill: none; stroke: var(--surface-hover); stroke-width: 3; }
.ring-fg {
  fill: none; stroke: var(--accent); stroke-width: 3;
  stroke-linecap: round;
  stroke-dasharray: 97.4;
  stroke-dashoffset: 97.4;
  transition: stroke-dashoffset 500ms var(--ease);
}

.task-add {
  display: flex; align-items: center; gap: 10px;
  margin: 0 28px 18px;
  padding: 11px 16px;
  border: 1px solid var(--border);
  border-radius: var(--r-l);
  background: var(--bg);
  color: var(--text-3);
  transition: box-shadow 160ms var(--ease), border-color 160ms var(--ease);
}
.task-add:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.task-add svg { width: 15px; height: 15px; flex: none; }
.task-add input { flex: 1; border: 0; outline: 0; background: none; font-size: 13.5px; }

.task-groups { padding: 0 28px 48px; }
.task-group-title {
  display: flex; align-items: baseline; gap: 8px;
  font-size: 11px; font-weight: 600;
  letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--text-3);
  margin: 22px 0 6px;
}
.task-group-title .mono { font-size: 10px; }

.task {
  display: flex; align-items: center; gap: 12px;
  padding: 9px 12px;
  border-radius: var(--r-m);
  transition: background 140ms var(--ease);
}
.task:hover { background: var(--surface-hover); }

.task-check {
  width: 19px; height: 19px; flex: none;
  border: 1.5px solid var(--border-strong);
  border-radius: 50%;
  display: grid; place-items: center;
  transition: background 160ms var(--ease), border-color 160ms var(--ease);
}
.task-check svg {
  width: 11px; height: 11px;
  color: oklch(0.99 0.01 60);
  opacity: 0; transform: scale(.5);
  transition: opacity 160ms var(--ease), transform 160ms var(--ease);
}
.task.done .task-check { background: var(--accent); border-color: var(--accent); }
.task.done .task-check svg { opacity: 1; transform: none; }

.task-title { font-size: 13.5px; flex: 1; transition: color 160ms var(--ease); }
.task.done .task-title { color: var(--text-3); text-decoration: line-through; text-decoration-color: var(--border-strong); }

.task-due {
  font-family: ui-monospace, "SFMono-Regular", Consolas, monospace;
  font-size: 10.5px;
  padding: 2px 8px;
  border-radius: 99px;
  background: var(--bg-alt);
  color: var(--text-2);
}
.task-due.today { background: var(--accent-soft); color: var(--accent-text); font-weight: 600; }

/* ═══════════════ EINSTELLUNGEN ═══════════════ */
.settings-nav { padding: 4px 8px; }
.settings-nav button {
  display: block; width: 100%;
  text-align: left;
  padding: 7px 10px;
  border-radius: 8px;
  font-size: 13px;
  color: var(--text-2);
  transition: background 140ms var(--ease), color 140ms var(--ease);
}
.settings-nav button:hover { background: var(--surface-hover); color: var(--text); }
.settings-nav button.is-active { background: var(--accent-soft); color: var(--accent-text); font-weight: 500; }

.version { font-size: 10.5px; color: var(--text-3); }

.pane-settings { overflow-y: auto; }
.settings-body {
  max-width: 640px;
  padding: 32px 40px 64px;
}
.settings-body h2 { font-size: 20px; font-weight: 600; letter-spacing: -0.015em; margin-bottom: 4px; }
.settings-body .s-sub { font-size: 13px; color: var(--text-2); margin-bottom: 26px; }

.s-group {
  border: 1px solid var(--border);
  border-radius: var(--r-l);
  background: var(--bg);
  overflow: hidden;
  margin-bottom: 22px;
}
.s-group-title {
  padding: 10px 18px;
  font-size: 10px; font-weight: 600;
  letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--text-3);
  border-bottom: 1px solid var(--border);
  background: var(--bg-alt);
}
.s-row {
  display: flex; align-items: center; gap: 16px;
  padding: 13px 18px;
}
.s-row + .s-row { border-top: 1px solid var(--border); }
.s-row .s-label { flex: 1; min-width: 0; }
.s-row .s-label .t { font-size: 13.5px; font-weight: 500; }
.s-row .s-label .d { font-size: 12px; color: var(--text-2); margin-top: 1px; }
.s-row input[type="text"], .s-row input[type="email"], .s-row input[type="password"], .s-row select {
  flex: 0 0 240px;
  padding: 7px 11px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  font-size: 13px;
  outline: none;
  transition: box-shadow 160ms var(--ease), border-color 160ms var(--ease);
}
.s-row input:focus, .s-row select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }

/* Toggle */
.toggle {
  position: relative;
  width: 38px; height: 22px; flex: none;
  border-radius: 99px;
  background: var(--border-strong);
  transition: background 200ms var(--ease);
}
.toggle::after {
  content: "";
  position: absolute; top: 2.5px; left: 2.5px;
  width: 17px; height: 17px;
  border-radius: 50%;
  background: var(--surface);
  box-shadow: 0 1px 3px oklch(0.2 0.01 80 / 0.25);
  transition: transform 200ms var(--ease);
}
.toggle.on { background: var(--accent); }
.toggle.on::after { transform: translateX(16px); }

/* Signatur-Editor */
.sig-editor {
  border: 1px solid var(--border);
  border-radius: var(--r-l);
  background: var(--surface);
  min-height: 150px;
  padding: 14px 16px;
  font-size: 13.5px; line-height: 1.7;
  outline: none;
  transition: box-shadow 160ms var(--ease), border-color 160ms var(--ease);
}
.sig-editor:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.sig-toolbar {
  display: flex; gap: 2px;
  padding: 6px;
  border: 1px solid var(--border);
  border-bottom: 0;
  border-radius: var(--r-l) var(--r-l) 0 0;
  background: var(--bg-alt);
}
.sig-editor-wrap .sig-editor { border-radius: 0 0 var(--r-l) var(--r-l); }

/* Theme-Vorschau-Karten */
.theme-cards { display: flex; gap: 12px; }
.theme-card {
  flex: 1;
  border: 1.5px solid var(--border);
  border-radius: var(--r-l);
  padding: 10px;
  cursor: pointer;
  transition: border-color 160ms var(--ease), box-shadow 160ms var(--ease);
  background: var(--bg);
}
.theme-card.is-on { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.theme-preview {
  height: 64px;
  border-radius: var(--r-m);
  margin-bottom: 8px;
  border: 1px solid var(--border);
  position: relative;
  overflow: hidden;
}
.tp-light { background: oklch(0.985 0.004 90); }
.tp-light::before { content:""; position:absolute; left:0; top:0; bottom:0; width:26%; background: oklch(0.968 0.005 90); border-right:1px solid var(--border); }
.tp-light::after { content:""; position:absolute; left:34%; top:18%; width:44%; height:8px; border-radius:4px; background: var(--accent); }
.tp-dark { background: oklch(0.21 0.012 80); }
.tp-dark::before { content:""; position:absolute; left:0; top:0; bottom:0; width:26%; background: oklch(0.24 0.012 80); border-right:1px solid oklch(0.38 0.012 80 / 0.6); }
.tp-dark::after { content:""; position:absolute; left:34%; top:18%; width:44%; height:8px; border-radius:4px; background: var(--accent); }
.theme-card .tc-label { font-size: 12.5px; font-weight: 500; text-align: center; }

/* ═══════════════ COMPOSE ═══════════════ */
.overlay[hidden] { display: none; }
.overlay {
  position: fixed; inset: 0; z-index: 50;
  background: oklch(0.2 0.01 80 / 0.3);
  backdrop-filter: blur(6px) saturate(1.2);
  display: grid;
  place-items: end center;
  padding: 0 20px 48px;
  animation: fadeIn 180ms var(--ease);
}
@keyframes fadeIn { from { opacity: 0; } }

.compose {
  width: min(640px, 100%);
  background: var(--surface);
  border-radius: var(--r-xl);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-modal);
  overflow: hidden;
  animation: composeIn 240ms var(--ease);
}
@keyframes composeIn {
  from { opacity: 0; transform: translateY(14px) scale(.985); }
  to   { opacity: 1; transform: none; }
}

.compose-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 13px 18px;
  border-bottom: 1px solid var(--border);
  font-size: 13.5px; font-weight: 600;
  background: var(--bg-alt);
}

.compose-fields { border-bottom: 1px solid var(--border); }
.cfield {
  display: flex; align-items: center; gap: 12px;
  padding: 0 18px;
}
.cfield + .cfield { border-top: 1px solid var(--border); }
.cfield span {
  flex: 0 0 56px;
  font-size: 11px; font-weight: 500;
  color: var(--text-3);
}
.cfield input {
  flex: 1; border: 0; outline: 0; background: none;
  padding: 9px 0;
  font-size: 13.5px;
}

.compose-body {
  min-height: 190px;
  max-height: 40vh;
  overflow-y: auto;
  padding: 16px 18px;
  font-size: 14px; line-height: 1.7;
  outline: none;
}
.compose-body:empty::before {
  content: attr(data-placeholder);
  color: var(--text-3);
}

.compose-foot {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 18px;
  border-top: 1px solid var(--border);
}
.compose-tools { display: flex; gap: 2px; }

/* ═══════════════ TOAST ═══════════════ */
.toast {
  position: fixed;
  left: 50%; bottom: 28px;
  transform: translate(-50%, 12px);
  z-index: 60;
  background: var(--text);
  color: var(--bg);
  font-size: 13px; font-weight: 500;
  padding: 9px 18px;
  border-radius: 99px;
  box-shadow: var(--shadow-modal);
  opacity: 0;
  pointer-events: none;
  transition: opacity 220ms var(--ease), transform 220ms var(--ease);
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ═══════════════ SCROLLBARS ═══════════════ */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb {
  background: var(--border-strong);
  border-radius: 99px;
  border: 3px solid transparent;
  background-clip: content-box;
}
::-webkit-scrollbar-thumb:hover { background: var(--text-3); border: 2px solid transparent; background-clip: content-box; }
::-webkit-scrollbar-track { background: transparent; }

/* ═══════════════ RESPONSIVE ═══════════════ */
@media (max-width: 1180px) {
  .pane-folders { flex-basis: 190px; }
  .pane-list { flex-basis: 320px; }
}
@media (max-width: 960px) {
  .pane-folders { display: none; }
  .read-body, .read-reply { padding-left: 24px; padding-right: 24px; }
}
@media (max-width: 760px) {
  .pane-list { flex-basis: 100%; border-right: 0; }
  .module.is-active.has-selection .pane-list { display: none; }
  .pane-reading { display: none; }
  .module.is-active.has-selection .pane-reading { display: flex; }
  .pane-side { display: none; }
  .notes-grid { columns: 2 160px; }
  .settings-body { padding: 24px 20px 48px; }
}

/* ═══════════════ GENERISCHER DIALOG ═══════════════ */
.overlay--center { place-items: center; padding: 24px; }

.dialog {
  width: min(500px, 100%);
  background: var(--surface);
  border-radius: var(--r-xl);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-modal);
  overflow: hidden;
  animation: composeIn 240ms var(--ease);
}

.dialog-body {
  max-height: 62vh;
  overflow-y: auto;
  padding: 4px 18px 8px;
}

.f-row {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}
.f-row[hidden] { display: none; }
.f-row:last-child { border-bottom: 0; }
.f-row > label {
  flex: 0 0 84px;
  font-size: 11px; font-weight: 500;
  color: var(--text-3);
}
.f-row input[type="text"],
.f-row input[type="email"],
.f-row input[type="tel"],
.f-row input[type="password"],
.f-row input[type="date"],
.f-row input[type="time"],
.f-row select,
.f-row textarea {
  flex: 1; min-width: 0;
  border: 0; outline: 0; background: none;
  font-size: 13.5px;
  color: var(--text);
  padding: 2px 0;
  font-family: inherit;
}
.f-row input[type="date"],
.f-row input[type="time"] {
  font-family: ui-monospace, "SFMono-Regular", Consolas, monospace;
  font-size: 12.5px;
}
.f-row select { cursor: pointer; }
.f-row textarea {
  resize: vertical;
  min-height: 84px;
  line-height: 1.6;
}
.f-row.error > label { color: var(--red-text); }
.f-row.error input, .f-row.error textarea {
  background: var(--red-soft);
  border-radius: var(--r-s);
  padding-left: 6px; padding-right: 6px;
}

/* Zwei Felder nebeneinander (Datum/Zeit, Vor-/Nachname) */
.f-pair { flex: 1; display: flex; gap: 12px; min-width: 0; }
.f-pair > input { flex: 1; min-width: 0; }
.f-pair .sep { color: var(--text-3); align-self: center; font-size: 12px; }

/* Farbwahl für Notizen */
.color-choices { display: flex; gap: 10px; padding: 4px 0; }
.color-choice {
  width: 26px; height: 26px;
  border-radius: 50%;
  border: 2px solid transparent;
  cursor: pointer;
  transition: transform 160ms var(--ease), box-shadow 160ms var(--ease), border-color 160ms var(--ease);
}
.color-choice:hover { transform: scale(1.12); }
.color-choice.is-on {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

/* Ganztägig-Toggle im Termin-Dialog */
.f-row .toggle { margin-left: auto; }

/* Kontakt-Toolbar: Suchfeld + Plus-Button nebeneinander */
.list-toolbar { display: flex; align-items: center; gap: 8px; }
.list-toolbar .search { flex: 1; }
.list-toolbar > .icon-btn { flex: none; border: 1px solid var(--border); background: var(--surface); width: 34px; height: 34px; }
.list-toolbar > .icon-btn:hover { border-color: var(--accent); color: var(--accent-text); }

/* ═══════════════ LOGIN ═══════════════ */
.login-page { overflow: auto; }

.login-wrap {
  position: relative; z-index: 1;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 32px 20px;
}

.login-card {
  width: min(400px, 100%);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-xl);
  box-shadow: var(--shadow-modal);
  padding: 36px 36px 28px;
  animation: moduleIn 320ms var(--ease);
}

.login-brand { text-align: center; margin-bottom: 26px; }
.login-logo {
  width: 52px; height: 52px;
  margin: 0 auto 14px;
  display: grid; place-items: center;
  border-radius: 16px;
  background: var(--accent-soft);
  color: var(--accent-text);
}
.login-logo svg { width: 26px; height: 26px; }
.login-brand h1 {
  font-size: 24px; font-weight: 600;
  letter-spacing: -0.02em;
}
.login-brand p { font-size: 13px; color: var(--text-2); margin-top: 3px; }

.login-card .f-row { padding: 11px 0; }
.login-card .f-row > label { flex-basis: 76px; }

.f-pair .icon-btn { flex: none; align-self: center; }
.eye-closed { display: none; }
.show-pass .eye-open { display: none; }
.show-pass .eye-closed { display: block; }

.mono-input {
  font-family: ui-monospace, "SFMono-Regular", Consolas, monospace !important;
  font-size: 12.5px !important;
}

.login-opts {
  display: flex; align-items: center; gap: 10px;
  padding: 14px 0 18px;
}
.login-opts-label { font-size: 12.5px; color: var(--text-2); }

.login-link {
  margin-left: auto;
  font-size: 12.5px; font-weight: 500;
  color: var(--accent-text);
  border-bottom: 1px solid transparent;
  transition: border-color 160ms var(--ease);
  padding: 0;
}
.login-link:hover { border-color: var(--accent-text); }

.login-submit { position: relative; padding: 10px 13px; font-size: 14px; }
.login-spinner {
  display: none;
  width: 14px; height: 14px;
  border: 2px solid oklch(0.99 0.01 60 / 0.4);
  border-top-color: oklch(0.99 0.01 60);
  border-radius: 50%;
  animation: spin 700ms linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.login-submit.loading { pointer-events: none; opacity: .92; }
.login-submit.loading .arrow { display: none; }
.login-submit.loading .login-spinner { display: inline-block; }

.login-error {
  margin-top: 14px;
  padding: 9px 13px;
  border-radius: var(--r-m);
  background: var(--red-soft);
  color: var(--red-text);
  font-size: 12.5px; font-weight: 500;
  animation: moduleIn 200ms var(--ease);
}

.login-foot {
  display: flex; align-items: center; gap: 10px;
  margin-top: 22px;
  font-size: 12px; color: var(--text-3);
}
.login-foot .mono { font-size: 10.5px; letter-spacing: 0.04em; }
.login-foot .login-link { margin-left: 0; color: var(--text-2); }
.login-foot .login-link:hover { color: var(--accent-text); border-color: var(--accent-text); }
.sep-dot { width: 3px; height: 3px; border-radius: 50%; background: var(--border-strong); }

/* ═══════════════ USER-POPOVER (Abmelden) ═══════════════ */
.user-pop {
  position: fixed;
  left: calc(var(--rail-w) + 8px);
  bottom: 14px;
  z-index: 40;
  width: 236px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-l);
  box-shadow: var(--shadow-modal);
  overflow: hidden;
  animation: popIn 180ms var(--ease);
}
@keyframes popIn {
  from { opacity: 0; transform: translateY(6px) scale(.98); }
  to   { opacity: 1; transform: none; }
}
.user-pop-head {
  display: flex; align-items: center; gap: 11px;
  padding: 13px 14px;
  border-bottom: 1px solid var(--border);
}
.user-pop-head .avatar { width: 34px; height: 34px; font-size: 11.5px; }
.user-pop-head .n { font-size: 13px; font-weight: 550; }
.user-pop-head .m {
  font-family: ui-monospace, "SFMono-Regular", Consolas, monospace;
  font-size: 10.5px; color: var(--text-3);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  max-width: 160px;
}
.user-pop-item {
  display: flex; align-items: center; gap: 9px;
  width: 100%;
  padding: 10px 14px;
  font-size: 13px;
  color: var(--text-2);
  text-align: left;
  transition: background 140ms var(--ease), color 140ms var(--ease);
}
.user-pop-item svg { width: 15px; height: 15px; }
.user-pop-item:hover { background: var(--surface-hover); color: var(--text); }
.user-pop-item.danger:hover { background: var(--red-soft); color: var(--red-text); }
