/* Basis v4. Gestaltung nach Apples Prinzipien (Liquid Glass / WWDC):
   - Glas nur auf der Ebene der Navigation und Bedienung (Seitenleiste, Schalter, Felder, Knöpfe), der Inhalt bleibt ruhig und gut lesbar.
   - Systemschrift (auf dem Mac SF Pro), Gewicht 400 und 600, Laufweite je nach Größe: große Titel enger, kleine Schrift minimal weiter.
   - Keine Symbole, keine Icon-Kacheln, keine farbigen Rahmen, keine Etiketten-Pillen. Zustand steht als Text da.
   - Konzentrische Rundungen: Fenster 28, Karten 20, Zeilen 12, Bedienelemente 10.
   Farben: ausschließlich Neutral (Weiß, Grau, Schwarz), dazu Grün und Rot nur für echte Zustände. */

:root {
  --horizon: #1d1d1f;
  --midnight: #1d1d1f;
  --ink: #1d1d1f;
  --muted: #505050;
  --faint: #6b6b6b;
  --link: #1d1d1f;
  --pos: #1b7a4b;
  --neg: #c1272d;
  --warn: #8a5a00;
  --hair: rgba(0, 0, 0, 0.12);

  --bg: linear-gradient(180deg, #d6d6d6 0%, #e0e0e0 22%, #ebebeb 46%, #f3f3f3 70%, #f7f7f7 100%);

  --glass: rgba(255, 255, 255, 0.36);
  --glass-hi: rgba(255, 255, 255, 0.72);
  --glass-edge: rgba(255, 255, 255, 0.7);
  --glass-shadow: 0 10px 34px rgba(0, 0, 0, 0.14), 0 1px 2px rgba(0, 0, 0, 0.08);
  --paper: rgba(255, 255, 255, 0.76);

  --r-win: 28px; --r-card: 20px; --r-row: 12px; --r-ctl: 10px;
  --side-w: 248px;
  --gap: 14px;
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Helvetica Neue", system-ui, sans-serif;
  --ease: cubic-bezier(0.23, 1, 0.32, 1);
  --ease-drawer: cubic-bezier(0.32, 0.72, 0, 1);
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; color: var(--ink); font: 400 0.875rem/1.25rem var(--font); -webkit-font-smoothing: antialiased; font-variant-numeric: tabular-nums;
  letter-spacing: 0; background: #f6f6f6 var(--bg) fixed; min-height: 100svh;
}
h1, h2, h3, p, ul { margin: 0; }
ul { padding: 0; list-style: none; }
button, input, textarea { font: inherit; color: inherit; letter-spacing: inherit; }
a { color: inherit; text-decoration: none; }
button, a, input, label { -webkit-tap-highlight-color: transparent; touch-action: manipulation; }
:focus-visible { outline: 2px solid var(--horizon); outline-offset: 2px; border-radius: 8px; }
[hidden] { display: none !important; }

/* ---------- Gerüst ---------- */
.app { display: grid; grid-template-columns: calc(var(--side-w) + 12px) minmax(0, 1fr); min-height: 100svh; }
.main { min-width: 0; }
.mtop { display: none; }
.page { padding: 20px 24px 44px 12px; display: grid; gap: var(--gap); align-content: start; }

/* Seitenleiste: die Glasebene der Navigation */
.side { position: sticky; top: 12px; width: var(--side-w); height: calc(100svh - 24px); margin: 12px 0 12px 12px; padding: 20px 10px 12px; display: flex; flex-direction: column; overflow: auto;
  border-radius: var(--r-win); background: var(--glass); -webkit-backdrop-filter: blur(40px) saturate(180%); backdrop-filter: blur(40px) saturate(180%);
  box-shadow: var(--glass-shadow), inset 0 1px 0 rgba(255,255,255,0.85), inset 0 0 0 1px var(--glass-edge); }
.brand { display: flex; align-items: center; justify-content: space-between; padding: 0 10px; margin-bottom: 14px; }
.wordmark { font-size: 1.1875rem; line-height: 1.5rem; font-weight: 600; letter-spacing: -0.02em; color: var(--midnight); }
.ws { display: grid; gap: 0; width: 100%; margin: 0 0 22px; padding: 10px 12px; border: 0; border-radius: 14px; background: var(--glass-hi); box-shadow: inset 0 0 0 1px rgba(255,255,255,0.9); text-align: left; cursor: pointer; transition: background-color 160ms ease, transform 160ms var(--ease); }
.ws strong { font-weight: 600; line-height: 1.125rem; }
.ws span { color: var(--muted); font-size: 0.75rem; line-height: 1rem; letter-spacing: 0.01em; }
.nav { display: grid; gap: 2px; }
.group-label { margin: 16px 12px 4px; font-size: 0.75rem; line-height: 1rem; letter-spacing: 0.01em; color: var(--muted); font-weight: 500; }
.group-label:first-child { margin-top: 0; }
.nav-item { display: flex; align-items: center; justify-content: space-between; min-height: 36px; padding: 0 12px; border-radius: 12px; color: var(--ink); font-size: 0.875rem; transition: background-color 160ms ease, transform 160ms var(--ease); }
.nav-item[aria-current="page"] { background: var(--glass-hi); font-weight: 600; box-shadow: 0 1px 3px rgba(0,0,0,0.12), inset 0 0 0 1px rgba(255,255,255,0.95); }
.nav-item .count { color: var(--muted); font-size: 0.7812rem; font-weight: 500; }
.nav-item[aria-current="page"] .count { color: var(--ink); }
.nav-item.quiet { color: var(--muted); }
.side-bottom { margin-top: auto; display: grid; gap: 2px; }
.text-btn { border: 0; background: transparent; color: var(--link); font-size: 0.875rem; cursor: pointer; padding: 6px 8px; border-radius: 8px; transition: background-color 160ms ease, transform 160ms var(--ease); }
.side-close { display: none; }

/* ---------- Titel ---------- */
.titlebar { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; padding: 6px 2px 4px; }
.titlebar h1 { font-size: 2.125rem; line-height: 2.5rem; font-weight: 600; letter-spacing: -0.026em; color: var(--midnight); }
.titlebar .finding { margin-top: 4px; color: #3a3a3a; font-size: 0.875rem; line-height: 1.25rem; max-width: 70ch; }
.tools-r { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

/* ---------- Bedienung (Glas) ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; min-height: 32px; padding: 0 14px; border: 0; border-radius: var(--r-ctl); background: var(--glass-hi); -webkit-backdrop-filter: blur(16px) saturate(160%); backdrop-filter: blur(16px) saturate(160%); box-shadow: 0 1px 2px rgba(0,0,0,0.12), inset 0 0 0 1px rgba(255,255,255,0.9); color: var(--ink); font-size: 0.8125rem; font-weight: 500; cursor: pointer; white-space: nowrap; transition: background-color 160ms ease, transform 120ms var(--ease); }
.btn:active, .seg button:active, .stepper button:active { transform: scale(0.97); transition-duration: 80ms; }
.nav-item:active, .mitem:active, .ws:active, .text-btn:active { transform: scale(0.985); transition-duration: 80ms; }
.btn.primary:active { background: #3a3a3a; }
.nav-item:active, .mitem:active { background: rgba(255,255,255,0.6); }
.btn.primary { background: var(--ink); color: #fff; box-shadow: 0 1px 2px rgba(0,0,0,0.25); -webkit-backdrop-filter: none; backdrop-filter: none; }
.btn.plain { background: transparent; box-shadow: none; -webkit-backdrop-filter: none; backdrop-filter: none; color: var(--link); }
.btn.lg { min-height: 34px; padding: 0 16px; }
.card .btn, .card .seg, .card .stepper { -webkit-backdrop-filter: none; backdrop-filter: none; }
.card .btn:not(.primary):not(.plain) { background: #fff; }
.card .seg, .card .stepper { background: rgba(0,0,0,0.06); box-shadow: none; }
.btn:disabled { opacity: 0.4; cursor: not-allowed; }

.search { display: block; width: 220px; }
.search input { width: 100%; height: 32px; padding: 0 12px; border: 0; border-radius: var(--r-ctl); background: var(--glass-hi); -webkit-backdrop-filter: blur(16px) saturate(160%); backdrop-filter: blur(16px) saturate(160%); box-shadow: inset 0 0 0 1px rgba(255,255,255,0.9), 0 1px 2px rgba(0,0,0,0.10); font-size: 0.8125rem; outline: none; }
.search input::placeholder { color: var(--faint); }
.search input:focus-visible { box-shadow: inset 0 0 0 2px var(--horizon); }

.seg { display: inline-flex; gap: 2px; padding: 3px; border-radius: 12px; background: rgba(255,255,255,0.42); -webkit-backdrop-filter: blur(16px) saturate(160%); backdrop-filter: blur(16px) saturate(160%); box-shadow: inset 0 0 0 1px rgba(255,255,255,0.75); max-width: 100%; overflow-x: auto; }
.seg button { min-height: 28px; padding: 0 12px; border: 0; border-radius: 9px; background: transparent; color: var(--muted); font-size: 0.8125rem; font-weight: 500; white-space: nowrap; cursor: pointer; transition: background-color 160ms ease, color 160ms ease, transform 160ms var(--ease); }
.seg button[aria-pressed="true"] { background: #fff; color: var(--ink); box-shadow: 0 1px 3px rgba(0,0,0,0.16); }
.seg .n { margin-left: 4px; color: var(--faint); font-weight: 400; }

/* ---------- Inhaltsebene: ruhige, helle Flächen ---------- */
.card { background: var(--paper); border-radius: var(--r-card); box-shadow: 0 1px 2px rgba(0,0,0,0.07); padding: 18px 20px 20px; min-width: 0; }
.card-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin-bottom: 8px; flex-wrap: wrap; }
.card h2 { font-size: 1.0625rem; line-height: 1.5rem; font-weight: 600; letter-spacing: -0.014em; }
.meta { color: var(--faint); font-size: 0.7812rem; }
.sub { color: var(--muted); font-size: 0.7812rem; line-height: 1.0625rem; }
.link { color: var(--link); }
.neg { color: var(--neg); } .pos { color: var(--pos); } .warn { color: var(--warn); }
.empty { display: grid; place-items: center; min-height: 80px; padding: 16px; color: var(--muted); text-align: center; }

/* Kennzahlen: nur Schrift, keine Kacheln */
.kpis { display: grid; grid-template-columns: 1.35fr repeat(3, minmax(0, 1fr)); padding: 20px 8px; }
.kpi { padding: 0 20px; min-width: 0; }
.kpi + .kpi { border-left: 1px solid var(--hair); }
.kpi-label { color: var(--muted); font-size: 0.8125rem; }
.kpi-value { margin-top: 2px; font-size: 1.5rem; line-height: 1.875rem; font-weight: 600; letter-spacing: -0.022em; white-space: nowrap; }
.kpi.lead .kpi-value { font-size: 2.125rem; line-height: 2.5rem; letter-spacing: -0.028em; color: var(--midnight); }
.kpi-value small { margin-left: 5px; font-size: 0.8125rem; font-weight: 400; letter-spacing: 0; color: var(--muted); }
.kpi-note { margin-top: 2px; color: var(--muted); font-size: 0.7812rem; line-height: 1.0625rem; }

/* ---------- Raster ---------- */
.row2 { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr); gap: var(--gap); align-items: stretch; }
.row3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: var(--gap); align-items: stretch; }

.rows { display: grid; }
.row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 14px; align-items: center; padding: 12px 0; }
.row + .row { border-top: 1px solid var(--hair); }
.row { transition: opacity 200ms ease, transform 220ms var(--ease), height 220ms var(--ease), padding 220ms var(--ease); }
.row.leaving { opacity: 0; transform: translateX(14px); padding-top: 0; padding-bottom: 0; overflow: hidden; pointer-events: none; }
.rt { font-weight: 600; line-height: 1.25rem; }
.rt .src { font-weight: 400; color: var(--muted); }
.rd { color: var(--muted); font-size: 0.8125rem; line-height: 1.125rem; max-width: 70ch; margin-top: 1px; }
.acts { display: flex; gap: 6px; }
.group-title { margin: 18px 0 2px; font-size: 0.8125rem; font-weight: 600; color: var(--muted); }
.done-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 12px; padding: 9px 0; color: var(--muted); }
.done-row + .done-row { border-top: 1px solid var(--hair); }
.done-row .t { font-size: 0.7812rem; }

/* Zahlungseingang */
.figs { display: flex; gap: 28px; flex-wrap: wrap; margin: 4px 0 14px; }
.fig b { display: block; font-size: 1.25rem; line-height: 1.625rem; font-weight: 600; letter-spacing: -0.02em; }
.fig span { color: var(--muted); font-size: 0.7812rem; }
.chart svg { display: block; width: 100%; height: auto; overflow: visible; }
.chart .bar { fill: #c7c7c7; transition: opacity 160ms ease; }
.chart .bar.now { fill: #1d1d1f; }
.chart .lbl { font: 400 11px var(--font); fill: #505050; text-anchor: middle; }
.chart .val { font: 600 11px var(--font); fill: #1d1d1f; text-anchor: middle; opacity: 0; transition: opacity 160ms ease; }
.chart g.b:focus .val { opacity: 1; }
.chart .ref { stroke: #3a3a3a; stroke-width: 1; stroke-dasharray: 3 5; opacity: 0.5; }
.chart .reflbl { font: 500 11px var(--font); fill: #3a3a3a; }

/* Liste mit Zahl rechts */
.kv { display: grid; }
.kv li { display: flex; align-items: center; justify-content: space-between; min-height: 34px; }
.kv li + li { border-top: 1px solid var(--hair); }
.kv .v { font-weight: 600; }
.big { font-size: 2.5rem; line-height: 2.75rem; font-weight: 600; letter-spacing: -0.03em; color: var(--midnight); margin: 2px 0 8px; }
.big small { font-size: 0.875rem; font-weight: 400; letter-spacing: 0; color: var(--muted); margin-left: 6px; }

.dates { display: grid; }
.date { display: grid; grid-template-columns: 46px minmax(0, 1fr) auto; gap: 10px; align-items: baseline; padding: 10px 0; }
.date + .date { border-top: 1px solid var(--hair); }
.date time { color: var(--muted); }
.date strong { font-weight: 600; display: block; line-height: 1.25rem; }
.date.past { color: var(--faint); }
.date.past strong { font-weight: 400; color: var(--muted); }
.date.next time, .date.next .who { color: var(--link); font-weight: 500; }
.who { color: var(--muted); font-size: 0.7812rem; }
.tools { display: grid; }
.tool { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 12px; align-items: center; min-height: 48px; padding: 6px 0; }
.tool + .tool { border-top: 1px solid var(--hair); }
.tool strong { font-weight: 600; display: block; line-height: 1.125rem; }
.tool .when { font-size: 0.7812rem; color: var(--muted); }
.tool.err .sub, .tool.err .state { color: var(--neg); }
.tool .state { font-size: 0.7812rem; font-weight: 500; }

/* ---------- Werkstatt ---------- */
.datebar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.stepper { display: inline-flex; align-items: center; gap: 2px; padding: 3px; border-radius: 12px; background: rgba(255,255,255,0.42); -webkit-backdrop-filter: blur(16px) saturate(160%); backdrop-filter: blur(16px) saturate(160%); box-shadow: inset 0 0 0 1px rgba(255,255,255,0.75); }
.stepper button { width: 30px; min-height: 28px; border: 0; border-radius: 9px; background: transparent; font-size: 1.0625rem; line-height: 1; color: var(--ink); cursor: pointer; transition: background-color 160ms ease, transform 160ms var(--ease); }
.stepper button:disabled { opacity: 0.35; cursor: not-allowed; }
.datefield { position: relative; display: inline-flex; align-items: center; min-height: 28px; padding: 0 12px; border-radius: 9px; background: #fff; font-weight: 600; font-size: 0.8125rem; cursor: pointer; box-shadow: 0 1px 3px rgba(0,0,0,0.16); }
.datefield input { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; }
.review { color: var(--warn); font-weight: 500; font-size: 0.8125rem; }

.board { display: grid; grid-template-columns: repeat(var(--cols, 6), minmax(160px, 1fr)); gap: var(--gap); align-items: start; overflow-x: auto; padding: 6px; margin: -6px; }
.bcol { display: grid; gap: 8px; align-content: start; min-width: 0; border-radius: 14px; transition: background-color 160ms ease, box-shadow 160ms ease; }
.bcol-head { display: flex; align-items: baseline; justify-content: space-between; padding: 0 4px 6px; border-bottom: 1px solid rgba(0,0,0,0.18); font-weight: 600; font-size: 0.8125rem; }
.bcol-head .num { color: var(--muted); font-weight: 400; }
.jc { display: grid; gap: 3px; padding: 12px; border-radius: 16px; background: rgba(255,255,255,0.82); box-shadow: 0 1px 2px rgba(0,0,0,0.08); }
.jc strong { font-weight: 600; line-height: 1.125rem; }
.jc .car { color: var(--muted); font-size: 0.7812rem; line-height: 1.0625rem; }
.jc .job { line-height: 1.125rem; margin-top: 2px; }
.jc .mv { margin-top: 4px; font-size: 0.7812rem; line-height: 1.0625rem; color: var(--link); }
.jc .foot { display: flex; justify-content: space-between; gap: 6px; margin-top: 6px; color: var(--muted); font-size: 0.7812rem; }
.jc .new { color: var(--link); font-size: 0.75rem; font-weight: 600; }
.jc-top { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.bempty { padding: 8px 4px; color: var(--faint); font-size: 0.8125rem; }

.list { display: grid; }
.lhead, .lrow { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(0, 1.2fr) 130px 130px 90px; gap: 14px; align-items: center; }
.lhead { padding-bottom: 8px; color: var(--muted); font-size: 0.7812rem; border-bottom: 1px solid var(--hair); }
.lrow { min-height: 56px; }
.lrow + .lrow { border-top: 1px solid var(--hair); }
.lrow strong { font-weight: 600; display: block; line-height: 1.25rem; }
.lrow .r { text-align: right; justify-self: end; }
.empty-day { text-align: center; padding: 34px 16px; color: var(--muted); }

/* ---------- E-Mails ---------- */
.mail-layout { display: grid; grid-template-columns: 380px minmax(0, 1fr); gap: var(--gap); align-items: start; }
.mlist { display: grid; }
.mitem { display: grid; gap: 1px; width: 100%; padding: 11px 12px; border: 0; border-radius: var(--r-row); background: transparent; text-align: left; cursor: pointer; transition: background-color 160ms ease, transform 160ms var(--ease); }
.mitem[aria-current="true"] { background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,0.14); }
.mfrom { display: flex; justify-content: space-between; gap: 12px; }
.mfrom strong { font-weight: 600; }
.mtime { color: var(--faint); font-size: 0.7812rem; white-space: nowrap; }
.msubj { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mmeta { color: var(--muted); font-size: 0.7812rem; }
.mfoot { margin: 10px 12px 0; color: var(--muted); font-size: 0.7812rem; }
.reader { display: grid; gap: 20px; align-content: start; padding: 24px; container-type: inline-size; }
.reader-grid { display: grid; gap: 20px; align-content: start; }
.rcol { display: grid; gap: 20px; align-content: start; min-width: 0; }
/* Breiter Lesebereich: links lesen, rechts antworten */
@container (min-width: 860px) {
  .reader-grid.two { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 32px; }
  .reader-grid.two .quote, .reader-grid.two .draft { max-width: none; }
  .reader-grid.two .draft { min-height: 15rem; }
}
.reader-head h2 { font-size: 1.375rem; line-height: 1.75rem; letter-spacing: -0.02em; }
.back-btn { display: none; }
.quote { padding: 16px 18px; border-radius: var(--r-row); background: rgba(255,255,255,0.7); line-height: 1.3125rem; max-width: 74ch; }
.block h3 { font-size: 0.875rem; line-height: 1.25rem; font-weight: 600; margin-bottom: 8px; }
.ctx { display: grid; gap: 6px; }
.ctx li { display: grid; grid-template-columns: 132px minmax(0, 1fr); gap: 12px; }
.ctx .src { color: var(--muted); }
.draft-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.draft { width: 100%; max-width: 74ch; padding: 14px 16px; border: 0; border-radius: var(--r-row); box-shadow: inset 0 0 0 1px rgba(0,0,0,0.18); background: rgba(255,255,255,0.9); line-height: 1.3125rem; resize: vertical; }
.draft:focus-visible { outline: none; box-shadow: inset 0 0 0 2px var(--horizon); }
.draft:disabled { background: rgba(255,255,255,0.5); color: var(--muted); }
.check { display: flex; align-items: center; gap: 10px; margin-top: 12px; cursor: pointer; }
.check input { width: 16px; height: 16px; accent-color: var(--horizon); margin: 0; }
.mactions { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.mactions .note-s { color: var(--muted); font-size: 0.7812rem; margin-left: 4px; }

.placeholder { padding: 48px 24px; text-align: center; color: var(--muted); }
.placeholder h2 { font-size: 1.125rem; color: var(--ink); margin-bottom: 4px; }

#toast { position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 12px); max-width: calc(100vw - 32px); padding: 11px 18px; border-radius: 16px; background: rgba(29,29,31,0.88); -webkit-backdrop-filter: blur(20px); backdrop-filter: blur(20px); color: #fff; font-weight: 500; opacity: 0; visibility: hidden; pointer-events: none; transition: opacity 140ms ease, transform 160ms ease, visibility 0s linear 160ms; z-index: 40; }
#toast.show { opacity: 1; visibility: visible; transform: translate(-50%, 0); transition: opacity 200ms ease, transform 280ms var(--ease); pointer-events: auto; }
.toast-undo { margin: -3px -8px -3px 14px; padding: 3px 10px; border: 0; border-radius: 10px; background: transparent; color: #fff; font-weight: 600; cursor: pointer; transition: background-color 160ms ease, transform 160ms var(--ease); }
.toast-undo:active { transform: scale(0.97); background: rgba(255,255,255,0.22); }
#toast :focus-visible { outline-color: #fff; }

/* ---------- Bewegung ---------- */
@keyframes rise { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.enter > * { animation: rise 240ms var(--ease) both; }
.enter > *:nth-child(2) { animation-delay: 30ms; }
.enter > *:nth-child(3) { animation-delay: 60ms; }
.enter > *:nth-child(4) { animation-delay: 90ms; }

/* Barrierefreiheit: weniger Bewegung, weniger Transparenz, mehr Kontrast */
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
/* Weniger Bewegung heißt sanftes Einblenden statt Verschieben, nicht gar nichts */
@media (prefers-reduced-motion: reduce) {
  .enter > * { animation: fade 160ms ease both; animation-delay: 0ms !important; }
  .btn:active, .seg button:active, .stepper button:active, .nav-item:active, .mitem:active, .ws:active, .text-btn:active, .cal-day:active { transform: none; }
  .row.leaving { transform: none; }
  #toast, #toast.show { transform: translate(-50%, 0); }
}
@media (prefers-reduced-transparency: reduce) {
  .side, .btn, .seg, .stepper, .search input, #toast { -webkit-backdrop-filter: none; backdrop-filter: none; }
  .side { background: #efefef; } .card, .rail { background: #fff; } .jc { background: #fff; } .btn:not(.primary):not(.plain), .seg, .stepper, .search input { background: #fff; }
}
@media (prefers-contrast: more) { :root { --hair: rgba(0,0,0,0.55); } .card, .rail, .jc { background: #fff; box-shadow: inset 0 0 0 1px rgba(0,0,0,0.5); } .btn, .seg, .stepper { box-shadow: inset 0 0 0 1px rgba(0,0,0,0.55); } }

/* ---------- Schmaler ---------- */
/* Das Layout richtet sich nach der Breite des Inhalts (nicht des Fensters), weil der Kalender rechts Platz nimmt */
.main { container: main / inline-size; }
@container main (max-width: 760px) {
  .row2 { grid-template-columns: minmax(0, 1fr); }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); row-gap: 18px; }
  .kpi:nth-child(3) { border-left: 0; }
}
/* Schmal: erst die Liste, ein Tipp öffnet den Lesebereich (E-Mails, Notizen) */
@container main (max-width: 780px) {
  .mail-layout { grid-template-columns: minmax(0, 1fr); }
  .mail-layout .reader { display: none; }
  .mail-layout.reading .reader { display: grid; padding: 16px 14px; }
  .mail-layout.reading .mail-list-card { display: none; }
  .back-btn { display: inline-flex; justify-self: start; margin-bottom: 10px; }
}

@media (max-width: 860px) {
  .app { grid-template-columns: minmax(0, 1fr); }
  .mtop { display: flex; align-items: center; justify-content: space-between; height: 48px; padding: 0 10px 0 6px; }
  .side { position: fixed; inset: 0; z-index: 30; width: 100%; height: 100%; margin: 0; border-radius: 0; transform: translateX(-100%); visibility: hidden; transition: transform 300ms var(--ease-drawer), visibility 0s linear 300ms; background: #f3f3f3 var(--bg); -webkit-backdrop-filter: none; backdrop-filter: none; padding: 14px 16px; }
  .side.open { transform: none; visibility: visible; transition-delay: 0s; }
  .side-close { display: inline-block; }
  .nav-item { min-height: 46px; }
  .page { padding: 4px 12px 32px; }
  .titlebar h1 { font-size: 1.75rem; line-height: 2.125rem; }
  .search { display: none; }
  .kpis { padding: 16px 4px; }
  .kpi { padding: 0 14px; }
  .kpi-value { font-size: 1.25rem; white-space: normal; }
  .kpi.lead .kpi-value { font-size: 1.625rem; }
  .card { padding: 16px 14px 16px; }
  .row { grid-template-columns: minmax(0, 1fr); gap: 8px; }
  .acts .btn { min-height: 40px; }
  .seg button { min-height: 36px; }
  .stepper button { width: 40px; min-height: 36px; }
  .datefield { min-height: 36px; }
  .text-btn { min-height: 40px; }
  .acts .btn.primary { flex: 1; }
  .acts { }
  .board { grid-template-columns: minmax(0, 1fr); overflow: visible; }
  .datebar { gap: 8px; }
  .seg { width: 100%; }
  .seg button { flex: 1; padding: 0 6px; }
  .ctx li { grid-template-columns: minmax(0, 1fr); gap: 0; }
  .mactions .btn { min-height: 44px; }
  .mactions .btn.primary { flex: 1; }
  .lhead { display: none; }
  .lrow { grid-template-columns: minmax(0, 1fr) auto; row-gap: 2px; padding: 8px 0; }
  .lrow > :nth-child(2), .lrow > :nth-child(3) { grid-column: 1 / -1; }
  .lrow > :nth-child(4) { grid-row: 1; grid-column: 2; }
}

.mtop .text-btn { color: var(--midnight); font-weight: 500; }

/* Hover nur mit Maus: auf Touch bleibt sonst nach dem Tippen ein Hover stehen */
@media (hover: hover) and (pointer: fine) {
  .ws:hover { background: rgba(255,255,255,0.88); }
  .nav-item:hover { background: rgba(255,255,255,0.45); }
  .text-btn:hover { background: rgba(255,255,255,0.5); }
  .btn:hover { background: rgba(255,255,255,0.92); }
  .btn.primary:hover { background: #3a3a3a; }
  .btn.plain:hover { background: rgba(255,255,255,0.55); }
  .seg button:hover { color: var(--ink); }
  .chart g.b:hover .bar { opacity: 0.8; }
  .stepper button:hover { background: rgba(255,255,255,0.7); }
  .mitem:hover { background: rgba(255,255,255,0.55); }
  .cal-day:not(.sel):not(.today):hover { background: rgba(0,0,0,0.06); }
  .jc.editable:hover { box-shadow: 0 2px 10px rgba(0,0,0,0.14); }
  .lrow.editable:hover { background: rgba(0,0,0,0.03); }
  .toast-undo:hover { background: rgba(255,255,255,0.16); }
  .chart g.b:hover .val { opacity: 1; }
}

@media (max-width: 860px) and (prefers-reduced-motion: reduce) {
  .side { transform: none; opacity: 0; transition: opacity 180ms ease, visibility 0s linear 180ms; }
  .side.open { opacity: 1; }
}

/* ---------- Kalender am rechten Rand: nur auf breiten Bildschirmen ---------- */
.rail { display: none; }
.cal-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.cal-head h2 { font-size: 1.0625rem; line-height: 1.5rem; font-weight: 600; letter-spacing: -0.014em; }
.rail .stepper { background: rgba(0,0,0,0.06); box-shadow: none; -webkit-backdrop-filter: none; backdrop-filter: none; }
.cal-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 2px; text-align: center; }
.cal-wd { padding: 2px 0 6px; color: var(--muted); font-size: 0.75rem; line-height: 1rem; letter-spacing: 0.01em; }
.cal-day { position: relative; min-height: 40px; border: 0; border-radius: var(--r-ctl); background: transparent; color: var(--muted); font-size: 0.8125rem; cursor: pointer; transition: background-color 160ms ease, transform 160ms var(--ease); }
.cal-day.we { color: var(--faint); }
.cal-day.has { color: var(--ink); }
.cal-day.has::after { content: ""; position: absolute; left: 50%; bottom: 5px; width: 4px; height: 4px; margin-left: -2px; border-radius: 50%; background: currentColor; }
.cal-day.sel { background: #fff; color: var(--ink); box-shadow: 0 1px 3px rgba(0,0,0,0.16); }
.cal-day.today { background: var(--ink); color: #fff; font-weight: 600; box-shadow: none; }
.cal-day:active { transform: scale(0.94); transition-duration: 80ms; }
.cal-today { justify-self: start; margin: -6px 0 0 -8px; }
.agenda { display: grid; align-content: start; gap: 0; padding-top: 16px; border-top: 1px solid var(--hair); min-height: 0; }
.agenda h3 { font-size: 0.875rem; line-height: 1.25rem; font-weight: 600; }
.ag { display: grid; grid-template-columns: 48px minmax(0, 1fr); gap: 8px; padding: 10px 0; }
.ag + .ag { border-top: 1px solid var(--hair); }
.ag time { color: var(--muted); }
.ag strong { display: block; font-weight: 600; line-height: 1.25rem; }
.ag.past time, .ag.past .sub { color: var(--faint); }
.ag.past strong { font-weight: 400; color: var(--muted); }
.ag.next time, .ag.next .sub { color: var(--ink); }
.cal-src { margin-top: auto; padding-top: 14px; }

/* Kalender rechts ab 1280 px. Auf Aufgaben und Unternehmen ist er zuerst aus (breite Tafeln), ein Knopf blendet ihn ein. */
@media (min-width: 1280px) {
  .app { grid-template-columns: calc(var(--side-w) + 12px) minmax(0, 1fr) 352px; }
  body.rail-hidden .app { grid-template-columns: calc(var(--side-w) + 12px) minmax(0, 1fr); }
  .page { padding-right: 12px; }
  body.rail-hidden .page { padding-right: 24px; }
  .rail { display: flex; flex-direction: column; gap: 18px; position: sticky; top: 12px; width: 340px; height: calc(100svh - 24px); margin: 12px 12px 12px 0; padding: 20px 16px 16px; overflow: auto;
    border-radius: var(--r-win); background: var(--paper); box-shadow: 0 1px 2px rgba(0,0,0,0.07); }
  body.rail-hidden .rail { display: none; }
  body:not(.rail-hidden) .card-termine { display: none; }   /* die Termine von heute stehen dann im Kalender */
  .btn.rail-toggle { display: inline-flex; }
}
.rail-toggle { display: none; }

/* ---------- Werkstatt bearbeiten ---------- */
.board-hint { margin: 2px 0 12px; color: var(--muted); font-size: 0.8125rem; line-height: 1.125rem; }
.jc.editable { cursor: grab; user-select: none; -webkit-user-select: none; transition: box-shadow 160ms ease; }
.jc.dragging { background: rgba(0,0,0,0.06); box-shadow: none; }
.jc.dragging > * { opacity: 0; }
.jc.ghost { position: fixed; left: 0; top: 0; z-index: 60; margin: 0; background: #fff; pointer-events: none; will-change: transform; cursor: grabbing;
  box-shadow: 0 14px 34px rgba(0,0,0,0.2), 0 2px 6px rgba(0,0,0,0.1); }
body.is-dragging, body.is-dragging * { cursor: grabbing !important; user-select: none; -webkit-user-select: none; }
.bcol.over { background: rgba(0,0,0,0.045); box-shadow: 0 0 0 6px rgba(0,0,0,0.045); }
.lrow.editable { cursor: pointer; }
.col-name { width: 100%; min-width: 0; margin-right: 8px; padding: 5px 8px; border: 0; border-radius: 8px; background: rgba(0,0,0,0.06); font-weight: 600; font-size: 0.8125rem; line-height: 1.125rem; }
.col-name:focus-visible { outline: none; box-shadow: inset 0 0 0 2px var(--horizon); background: #fff; }
.col-tools { display: flex; align-items: center; gap: 4px; min-height: 30px; }
.col-tools .btn { min-height: 28px; padding: 0 9px; }
.bcol-add { align-content: start; }
.bcol-add .btn { justify-self: start; }
.btn.plain.neg { color: var(--neg); }

/* Fenster */
.sheet { width: min(520px, calc(100vw - 24px)); max-height: calc(100svh - 24px); padding: 24px; border: 0; border-radius: var(--r-win); background: rgba(255,255,255,0.92); color: var(--ink); overflow: auto;
  -webkit-backdrop-filter: blur(40px) saturate(180%); backdrop-filter: blur(40px) saturate(180%); box-shadow: 0 24px 60px rgba(0,0,0,0.28), 0 2px 6px rgba(0,0,0,0.1); }
.sheet::backdrop { background: rgba(0,0,0,0.26); }
.sheet[open] { animation: sheet-in 200ms var(--ease); }
.sheet[open]::backdrop { animation: fade 200ms ease; }
@keyframes sheet-in { from { opacity: 0; transform: scale(0.97) translateY(6px); } to { opacity: 1; transform: none; } }
.sheet h2 { font-size: 1.375rem; line-height: 1.75rem; font-weight: 600; letter-spacing: -0.02em; }
.fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 12px; margin: 18px 0 6px; }
.field { display: grid; gap: 4px; min-width: 0; }
.field.wide { grid-column: 1 / -1; }
.field > span { color: var(--muted); font-size: 0.8125rem; font-weight: 500; }
.field input, .field select { width: 100%; min-height: 38px; padding: 0 12px; border: 0; border-radius: var(--r-ctl); background: #fff; box-shadow: inset 0 0 0 1px rgba(0,0,0,0.18); font-size: 0.875rem; }
.field input:focus-visible, .field select:focus-visible { outline: none; box-shadow: inset 0 0 0 2px var(--horizon); }
.form-err { margin-top: 8px; color: var(--neg); }
.sheet-actions { display: flex; align-items: center; gap: 8px; margin: 20px 0 10px; }
.sheet-actions .grow { flex: 1; }
.sheet-actions .btn { min-height: 36px; }
@media (max-width: 520px) { .fields { grid-template-columns: minmax(0, 1fr); } .sheet { padding: 20px 18px; } .sheet-actions { flex-wrap: wrap; } }
@media (prefers-reduced-motion: reduce) { .sheet[open] { animation: fade 160ms ease; } }
@media (prefers-reduced-transparency: reduce) { .sheet { background: #fff; -webkit-backdrop-filter: none; backdrop-filter: none; } }

/* ======================================================================
   Ergänzungen für das Dashboard (Kunden, Preise, Notizen, Aufgaben)
   ====================================================================== */
.stack { display: grid; gap: var(--gap); align-content: start; min-width: 0; }
.card-head .btn.plain { margin: -4px -8px -4px 0; }
.note-s { color: var(--muted); font-size: 0.7812rem; }

/* Tafeln: Spaltenbreite je nach Tafel. Auf dem Handy gilt weiter die einspaltige Regel von oben. */
@media (min-width: 861px) {
  .board { grid-template-columns: repeat(var(--cols, 6), minmax(var(--colmin, 170px), 1fr)); }
}
.jc .note-prev { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; color: var(--muted); font-size: 0.7812rem; line-height: 1.0625rem; }
.jc.is-done strong { color: var(--faint); font-weight: 400; text-decoration: line-through; text-decoration-color: var(--hair-strong); }
.jc .foot .warn { font-weight: 500; }
.filters { display: flex; flex-wrap: wrap; gap: 8px; margin: 4px 0 12px; }

/* Zeitleiste */
.tl { display: grid; }
.tl-row { display: grid; grid-template-columns: 88px minmax(0, 1fr); gap: 12px; padding: 11px 0; }
.tl-row + .tl-row { border-top: 1px solid var(--hair); }
.tl-row time { color: var(--muted); }
.tl-row strong { font-weight: 600; }
.tl-row p { color: var(--ink); }
.tl-add { display: grid; gap: 8px; margin: 6px 0 12px; }
.tl-add .two { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 8px; }
.tl-add .btn { justify-self: start; min-height: 36px; }
.tl-add input, .tl-add select, .calc input:not([type="checkbox"]), .calc select, .field textarea, .select-sm { width: 100%; min-height: 38px; padding: 0 12px; border: 0; border-radius: var(--r-ctl); background: #fff; box-shadow: inset 0 0 0 1px rgba(0,0,0,0.18); font-size: 0.875rem; }
.field textarea { padding: 10px 12px; line-height: 1.3125rem; resize: vertical; }
.tl-add input:focus-visible, .tl-add select:focus-visible, .calc input:not([type="checkbox"]):focus-visible, .calc select:focus-visible, .field textarea:focus-visible { outline: none; box-shadow: inset 0 0 0 2px var(--horizon); }
.kv .v { text-align: right; overflow-wrap: anywhere; }

/* Preise */
.pkg + .pkg { margin-top: 18px; padding-top: 18px; border-top: 1px solid var(--hair); }
.pkg-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.pkg-head h3 { font-size: 1.0625rem; line-height: 1.5rem; font-weight: 600; letter-spacing: -0.014em; }
.pkg-price { font-size: 1.25rem; line-height: 1.625rem; font-weight: 600; letter-spacing: -0.02em; }
.pkg-price.text { font-size: 0.875rem; font-weight: 400; color: var(--muted); letter-spacing: 0; }
.pkg ul { margin-top: 8px; }
.pkg li { padding: 6px 0; border-top: 1px solid var(--hair); }
.pkg .intern { margin-top: 10px; color: var(--muted); font-size: 0.8125rem; line-height: 1.125rem; max-width: 70ch; }
.pkg .intern b { color: var(--ink); font-weight: 600; }
.pkg .btn { margin-top: 10px; }
.calc { display: grid; gap: 12px; }
.calc .check { margin-top: 0; }
.calc .two { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 12px; }
.calc-result { padding-top: 14px; border-top: 1px solid var(--hair); }
.calc-result .big-sum { font-size: 2.125rem; line-height: 2.5rem; font-weight: 600; letter-spacing: -0.028em; }
.calc-apply { display: grid; gap: 8px; padding-top: 14px; border-top: 1px solid var(--hair); }

/* Notizen */
.note-title { width: 100%; padding: 4px 6px; margin-left: -6px; border: 0; border-radius: 8px; background: transparent; font-size: 1.375rem; line-height: 1.75rem; font-weight: 600; letter-spacing: -0.02em; }
.note-title:focus-visible { outline: none; box-shadow: inset 0 0 0 2px var(--horizon); background: rgba(255,255,255,0.9); }
.note-text { max-width: none; min-height: 24rem; }

/* n8n, sieben Tage: der Zustand steht als Wort unter dem Balken */
.days { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 8px; margin: 6px 0 14px; }
.day { display: grid; gap: 6px; justify-items: center; font-size: 0.7812rem; color: var(--muted); }
.day .bar { width: 100%; height: 28px; border-radius: 8px; background: #c7c7c7; }
.day--today .bar { background: #1d1d1f; }
.day--today .dn { color: var(--ink); font-weight: 600; }
.day .ds { color: var(--faint); }
.day--err .ds { color: var(--neg); font-weight: 600; }
.note-line { color: var(--muted); font-size: 0.8125rem; line-height: 1.125rem; max-width: 70ch; }
.note-line strong { color: var(--neg); font-weight: 600; }
.card-actions { margin-top: 14px; }
.entwurf-note { color: var(--warn); font-weight: 500; }

/* Zeilen mit Aktionen: bei schmalem Inhalt stehen die Knöpfe unter dem Text */
@container main (max-width: 1000px) {
  .row { grid-template-columns: minmax(0, 1fr); gap: 8px; }
  .row .acts { justify-content: flex-start; }
}

/* Notiz-Editor (Quill): Werkzeugleiste als kleine Schalter-Kapseln über dem Textfeld, Wörter und Buchstaben statt Symbole */
.rte-toolbar { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 10px; }
.rte-group { display: flex; gap: 2px; padding: 3px; border-radius: 12px; background: rgba(0,0,0,0.06); }
.rte-toolbar button { min-height: 28px; min-width: 32px; padding: 0 10px; border: 0; border-radius: 9px; background: transparent; color: var(--muted); font-size: 0.8125rem; font-weight: 500; cursor: pointer; transition: background-color 120ms ease, color 120ms ease, transform 100ms var(--ease); }
.rte-toolbar button:active { transform: scale(0.97); }
.rte-toolbar button b, .rte-toolbar button i, .rte-toolbar button u { font-size: 0.875rem; }
.rte-toolbar button.ql-active { background: #fff; color: var(--ink); box-shadow: 0 1px 3px rgba(0,0,0,0.16); }
@media (hover: hover) and (pointer: fine) { .rte-toolbar button:not(.ql-active):hover { background: rgba(255,255,255,0.6); color: var(--ink); } }
.rte .ql-container { height: auto; font: inherit; font-size: 0.9375rem; border-radius: var(--r-row); overflow: hidden; background: #fff; box-shadow: inset 0 0 0 1px rgba(0,0,0,0.18); }
.rte:focus-within .ql-container { box-shadow: inset 0 0 0 2px var(--horizon); }
.rte .ql-editor { min-height: 22rem; padding: 16px 18px; line-height: 1.55; color: var(--ink); overflow-y: visible; }
.rte .ql-editor.ql-blank::before { left: 18px; right: 18px; color: var(--faint); font-style: normal; }
.rte .ql-editor > * + * { margin-top: 6px; }
.rte .ql-editor h1 { font-size: 1.75em; font-weight: 600; letter-spacing: -0.02em; line-height: 1.2; margin-top: 14px; }
.rte .ql-editor h2 { font-size: 1.4em; font-weight: 600; letter-spacing: -0.015em; line-height: 1.25; margin-top: 12px; }
.rte .ql-editor h3 { font-size: 1.15em; font-weight: 600; line-height: 1.3; margin-top: 10px; }
.rte .ql-editor [style*="background-color"] { border-radius: 0.2em; color: #1d1d1f; }
.rte .ql-editor li > .ql-ui { color: var(--muted); }
.rte .ql-editor li[data-list="checked"] { color: var(--faint); text-decoration: line-through; text-decoration-color: var(--hair-strong); }
.rte .ql-editor li[data-list="checked"] > .ql-ui { color: var(--ink); }
.rte .ql-editor li { padding-top: 2px; padding-bottom: 2px; }
@media (max-width: 860px) { .rte-toolbar { overflow-x: auto; flex-wrap: nowrap; padding-bottom: 4px; } .rte-group { flex: none; } .rte-toolbar button { min-height: 40px; flex: none; } }

/* ======================================================================
   Verbindung zur Datenbank, Verbindungen-Seite, Aufgaben-Fenster
   ====================================================================== */
:root { --hair-strong: rgba(0, 0, 0, 0.25); --code-bg: rgba(0, 0, 0, 0.06); }
.sync { margin: 0 12px 8px; color: var(--muted); font-size: 0.75rem; line-height: 1rem; }
.sync[data-state="error"], .sync[data-state="offline"] { color: var(--neg); }
.sync[data-state="saving"], .sync[data-state="pending"] { color: var(--faint); }
.theme-state::after { content: "Aus"; }
#theme-toggle[aria-pressed="true"] .theme-state::after { content: "An"; }
button.nav-item { border: 0; background: transparent; width: 100%; text-align: left; cursor: pointer; font: inherit; }

/* Schnell-Eingabe auf Heute, wie im alten Dashboard */
.task-add { display: flex; gap: 8px; margin: 4px 0 8px; }
.task-add input { flex: 1; min-width: 0; min-height: 36px; padding: 0 12px; border: 0; border-radius: var(--r-ctl); background: #fff; box-shadow: inset 0 0 0 1px rgba(0,0,0,0.18); font-size: 0.875rem; }
.task-add input:focus-visible { outline: none; box-shadow: inset 0 0 0 2px var(--horizon); }
.task-add .btn { min-height: 36px; }
.doc-link { text-decoration: underline; text-underline-offset: 2px; text-decoration-color: var(--hair-strong); }

/* Fenster mit Editor (Aufgaben) */
.sheet.wide { width: min(680px, calc(100vw - 24px)); }
.rte-sheet .ql-container { height: auto; font: inherit; font-size: 0.9375rem; border-radius: var(--r-row); background: #fff; box-shadow: inset 0 0 0 1px rgba(0,0,0,0.18); }
.rte-sheet:focus-within .ql-container { box-shadow: inset 0 0 0 2px var(--horizon); }
.rte-sheet .ql-editor { min-height: 9rem; max-height: 38vh; overflow-y: auto; padding: 12px 14px; line-height: 1.5; color: var(--ink); }
.rte-sheet .ql-editor.ql-blank::before { left: 14px; right: 14px; color: var(--faint); font-style: normal; }
.rte-sheet .ql-editor h1 { font-size: 1.5em; font-weight: 600; line-height: 1.2; } .rte-sheet .ql-editor h2 { font-size: 1.25em; font-weight: 600; line-height: 1.25; } .rte-sheet .ql-editor h3 { font-size: 1.1em; font-weight: 600; }
.rte-sheet .ql-editor li[data-list="checked"] { color: var(--faint); text-decoration: line-through; }

/* Verbindungen */
.seg.tabs { justify-self: start; }
code { font: 0.78125rem/1.2 ui-monospace, SFMono-Regular, Menlo, monospace; padding: 1px 5px; border-radius: 6px; background: var(--code-bg); overflow-wrap: anywhere; }
.code-wrap { display: grid; gap: 6px; justify-items: start; margin: 6px 0 10px; }
.code { margin: 0; width: 100%; padding: 12px 14px; border-radius: var(--r-row); background: var(--code-bg); font: 0.78125rem/1.5 ui-monospace, SFMono-Regular, Menlo, monospace; overflow: auto; white-space: pre; max-height: 22rem; }
.code:focus-visible { outline: 2px solid var(--horizon); }
.tool { grid-template-columns: minmax(0, 1fr) auto; }
.tool .acts { align-items: center; gap: 10px; }
.tool-detail { grid-column: 1 / -1; padding: 6px 0 14px; }
.setup ol { margin: 4px 0 10px; padding-left: 20px; display: grid; gap: 6px; }
.setup p.sub { margin-top: 8px; }
.trows { display: grid; }
.trow { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 12px 0; }
.trow + .trow { border-top: 1px solid var(--hair); }
.trow strong { font-weight: 600; display: block; }
.trow.off { opacity: 0.55; }
.trow-meta { display: grid; gap: 2px; justify-items: start; }
.test-res { overflow-wrap: anywhere; }
@container main (max-width: 900px) { .trow { grid-template-columns: minmax(0, 1fr) auto; } .trow-meta { grid-column: 1 / -1; grid-row: 2; } }
.tk-form { display: grid; gap: 12px; margin-top: 10px; }
.tk-form .two { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.tk-form .btn { justify-self: start; min-height: 36px; }
.scopes { border: 0; margin: 0; padding: 0; display: grid; gap: 2px; }
.scopes legend { padding: 0; margin-bottom: 4px; color: var(--muted); font-size: 0.8125rem; font-weight: 500; }
.scopes .check { margin-top: 0; padding: 4px 0; }
.scopes .check code { margin-left: 4px; }
.card.secret { box-shadow: inset 0 0 0 2px var(--ink); }
.tbl { width: 100%; border-collapse: collapse; font-size: 0.8125rem; margin: 6px 0; }
.tbl th, .tbl td { text-align: left; padding: 7px 10px 7px 0; vertical-align: top; border-top: 1px solid var(--hair); }
.tbl th { color: var(--muted); font-weight: 500; border-top: 0; }
.api-intro { color: var(--muted); max-width: 80ch; }
.api-intro p + p { margin-top: 6px; }
.api-tools { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 12px 0 6px; }
.api-tools .search { width: min(340px, 100%); }
.op { border-top: 1px solid var(--hair); }
.op summary { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; padding: 10px 0; cursor: pointer; list-style: none; }
.op summary::-webkit-details-marker { display: none; }
.op summary:focus-visible { outline: 2px solid var(--horizon); }
.mth { min-width: 54px; font-size: 0.75rem; letter-spacing: 0.03em; }
.op .sum { color: var(--muted); }
.op-body { display: grid; gap: 8px; padding: 0 0 16px; }
.day--none .bar { background: var(--hair); }
.day--none .ds { color: var(--faint); }
@media (max-width: 860px) { .task-add .btn, .tk-form .btn { min-height: 44px; } .tk-form .two { grid-template-columns: minmax(0, 1fr); } }

/* ======================================================================
   Dunkelmodus: dieselben Variablen, dazu die Stellen, an denen oben feste Farben stehen
   ====================================================================== */
:root[data-theme="dark"] {
  color-scheme: dark;
  --ink: #f5f5f5; --midnight: #f5f5f5; --horizon: #f5f5f5; --link: #f5f5f5; --muted: #b5b5b5; --faint: #9a9a9a;
  --pos: #5fcf92; --neg: #ff7b7b; --warn: #e3a94b;
  --hair: rgba(255,255,255,0.12); --hair-strong: rgba(255,255,255,0.22); --code-bg: rgba(255,255,255,0.09);
  --bg: linear-gradient(180deg, #333333 0%, #282828 22%, #1d1d1d 46%, #161616 70%, #111111 100%);
  --glass: rgba(70,70,70,0.4); --glass-hi: rgba(255,255,255,0.14); --glass-edge: rgba(255,255,255,0.16);
  --glass-shadow: 0 10px 34px rgba(0,0,0,0.45), 0 1px 2px rgba(0,0,0,0.4);
  --paper: rgba(255,255,255,0.07);
}
:root[data-theme="dark"] body { background: #121212 var(--bg) fixed; }
:root[data-theme="dark"] .titlebar .finding { color: #d0d0d0; }
:root[data-theme="dark"] .side { box-shadow: var(--glass-shadow), inset 0 1px 0 rgba(255,255,255,0.2), inset 0 0 0 1px var(--glass-edge); }
:root[data-theme="dark"] .ws, :root[data-theme="dark"] .nav-item[aria-current="page"] { box-shadow: inset 0 0 0 1px rgba(255,255,255,0.2); }
:root[data-theme="dark"] .nav-item[aria-current="page"] { box-shadow: 0 1px 3px rgba(0,0,0,0.4), inset 0 0 0 1px rgba(255,255,255,0.2); }
:root[data-theme="dark"] .btn { box-shadow: 0 1px 2px rgba(0,0,0,0.4), inset 0 0 0 1px rgba(255,255,255,0.2); }
:root[data-theme="dark"] .card .btn:not(.primary):not(.plain) { background: rgba(255,255,255,0.12); }
:root[data-theme="dark"] .btn.primary { background: #f5f5f5; color: #1d1d1f; box-shadow: 0 1px 2px rgba(0,0,0,0.4); }
:root[data-theme="dark"] .btn.primary:active { background: #d6d6d6; }
:root[data-theme="dark"] .btn.plain { box-shadow: none; }
:root[data-theme="dark"] .seg, :root[data-theme="dark"] .stepper { background: rgba(255,255,255,0.08); box-shadow: inset 0 0 0 1px rgba(255,255,255,0.14); }
:root[data-theme="dark"] .card .seg, :root[data-theme="dark"] .card .stepper, :root[data-theme="dark"] .rail .stepper { background: rgba(255,255,255,0.08); box-shadow: none; }
:root[data-theme="dark"] .seg button[aria-pressed="true"], :root[data-theme="dark"] .datefield, :root[data-theme="dark"] .cal-day.sel, :root[data-theme="dark"] .mitem[aria-current="true"] { background: #4a4a4a; color: #f5f5f5; box-shadow: 0 1px 3px rgba(0,0,0,0.4); }
:root[data-theme="dark"] .search input { background: rgba(255,255,255,0.1); box-shadow: inset 0 0 0 1px rgba(255,255,255,0.16); }
:root[data-theme="dark"] .kpi.lead .kpi-value, :root[data-theme="dark"] .big, :root[data-theme="dark"] .wordmark { color: #f5f5f5; }
:root[data-theme="dark"] .jc { background: rgba(255,255,255,0.1); box-shadow: 0 1px 2px rgba(0,0,0,0.4); }
:root[data-theme="dark"] .jc.ghost { background: #4a4a4a; box-shadow: 0 14px 34px rgba(0,0,0,0.6), 0 2px 6px rgba(0,0,0,0.4); }
:root[data-theme="dark"] .jc.dragging { background: rgba(255,255,255,0.06); }
:root[data-theme="dark"] .bcol.over { background: rgba(255,255,255,0.06); box-shadow: 0 0 0 6px rgba(255,255,255,0.06); }
:root[data-theme="dark"] .bcol-head { border-bottom-color: rgba(255,255,255,0.22); }
:root[data-theme="dark"] .quote, :root[data-theme="dark"] .draft { background: rgba(255,255,255,0.08); }
:root[data-theme="dark"] .field input, :root[data-theme="dark"] .field select, :root[data-theme="dark"] .field textarea,
:root[data-theme="dark"] .tl-add input, :root[data-theme="dark"] .tl-add select, :root[data-theme="dark"] .calc input:not([type="checkbox"]), :root[data-theme="dark"] .calc select,
:root[data-theme="dark"] .task-add input, :root[data-theme="dark"] .select-sm { background: rgba(255,255,255,0.08); color: #f5f5f5; box-shadow: inset 0 0 0 1px rgba(255,255,255,0.2); }
:root[data-theme="dark"] .field input:focus-visible, :root[data-theme="dark"] .field select:focus-visible, :root[data-theme="dark"] .field textarea:focus-visible,
:root[data-theme="dark"] .tl-add input:focus-visible, :root[data-theme="dark"] .task-add input:focus-visible { box-shadow: inset 0 0 0 2px #f5f5f5; }
:root[data-theme="dark"] .sheet { background: rgba(48,48,48,0.94); }
:root[data-theme="dark"] .sheet::backdrop { background: rgba(0,0,0,0.5); }
:root[data-theme="dark"] .note-title:focus-visible { background: rgba(255,255,255,0.08); }
:root[data-theme="dark"] .rte-group { background: rgba(255,255,255,0.09); }
:root[data-theme="dark"] .rte-toolbar button.ql-active { background: #4a4a4a; color: #f5f5f5; box-shadow: 0 1px 3px rgba(0,0,0,0.4); }
:root[data-theme="dark"] .rte .ql-container, :root[data-theme="dark"] .rte-sheet .ql-container { background: rgba(255,255,255,0.07); box-shadow: inset 0 0 0 1px rgba(255,255,255,0.2); }
:root[data-theme="dark"] .rte .ql-editor [style*="background-color"], :root[data-theme="dark"] .rte-sheet .ql-editor [style*="background-color"] { color: #1d1d1f; }
:root[data-theme="dark"] .cal-day.today { background: #f5f5f5; color: #1d1d1f; }
:root[data-theme="dark"] .day .bar { background: #565656; } :root[data-theme="dark"] .day--today .bar { background: #f5f5f5; } :root[data-theme="dark"] .day--none .bar { background: rgba(255,255,255,0.1); }
:root[data-theme="dark"] .toast-undo:active { background: rgba(255,255,255,0.22); }
:root[data-theme="dark"] .check input { accent-color: #f5f5f5; }
:root[data-theme="dark"] .card.secret { box-shadow: inset 0 0 0 2px #f5f5f5; }
@media (hover: hover) and (pointer: fine) {
  :root[data-theme="dark"] .ws:hover, :root[data-theme="dark"] .nav-item:hover, :root[data-theme="dark"] .text-btn:hover, :root[data-theme="dark"] .btn:hover, :root[data-theme="dark"] .btn.plain:hover, :root[data-theme="dark"] .stepper button:hover, :root[data-theme="dark"] .mitem:hover { background: rgba(255,255,255,0.16); }
  :root[data-theme="dark"] .btn.primary:hover { background: #d6d6d6; }
  :root[data-theme="dark"] .cal-day:not(.sel):not(.today):hover { background: rgba(255,255,255,0.1); }
  :root[data-theme="dark"] .jc.editable:hover { box-shadow: 0 2px 10px rgba(0,0,0,0.5); }
  :root[data-theme="dark"] .rte-toolbar button:not(.ql-active):hover { background: rgba(255,255,255,0.12); }
}
@media (max-width: 860px) { :root[data-theme="dark"] .side { background: #161616 var(--bg); } }
@media (prefers-reduced-transparency: reduce) {
  :root[data-theme="dark"] .side { background: #262626; } :root[data-theme="dark"] .card, :root[data-theme="dark"] .rail { background: #262626; } :root[data-theme="dark"] .jc { background: #333; }
  :root[data-theme="dark"] .sheet { background: #2b2b2b; }
}

/* ======================================================================
   Anmelden und Konto, Kalender-Seite, Einstellungen, kleinere Bedienpunkte
   ====================================================================== */
/* Anmelden, Abmelden, Konto: dieselbe Gestaltung wie das Dashboard, ohne eigenes Stylesheet */
.auth { min-height: 100svh; display: grid; place-items: center; padding: 24px 16px; }
.auth-card { width: min(100%, 400px); padding: 28px 28px 22px; display: grid; gap: 6px; }
.auth-card h1 { font-size: 1.75rem; line-height: 2.125rem; font-weight: 600; letter-spacing: -0.024em; margin-top: 14px; }
.auth-form { display: grid; gap: 14px; margin-top: 16px; max-width: 420px; }
.auth-form .btn { justify-self: start; min-height: 38px; }
.auth-card .auth-form .btn { justify-self: stretch; }
.auth-theme { justify-self: start; margin: 12px 0 0 -8px; color: var(--muted); }
.auth-wide { place-items: start center; padding-top: 40px; }
.account { width: min(100%, 720px); }
.account .card .sub { max-width: 70ch; }
.steps { margin: 4px 0 10px; padding-left: 20px; display: grid; gap: 6px; max-width: 70ch; }
.account pre.code { width: auto; justify-self: start; font-size: 0.9375rem; letter-spacing: 0.04em; white-space: pre-wrap; margin: 8px 0 12px; }
.side-bottom form { margin: 0; display: grid; }

/* Menü: "Weiteres" eingeklappt */
.nav-more { display: grid; gap: 2px; }
.nav-more summary { cursor: pointer; list-style: none; border-radius: 8px; padding: 2px 0; }
.nav-more summary::-webkit-details-marker { display: none; }
.nav-more summary::after { content: " anzeigen"; color: var(--faint); font-weight: 400; }
.nav-more[open] summary::after { content: " ausblenden"; }

/* Kalender-Seite */
.cal-card { display: grid; gap: 18px; align-content: start; }
.cal-card .stepper { background: rgba(0,0,0,0.06); box-shadow: none; -webkit-backdrop-filter: none; backdrop-filter: none; }
.cal-card .cal-day { min-height: 46px; }
.date.wide { grid-template-columns: 132px minmax(0, 1fr) auto; align-items: center; }
.ag-act { justify-self: start; margin: 2px 0 0 -14px; min-height: 28px; }
.ag > div { display: grid; }

/* Tafel: Älteres einklappen, auf Touch-Geräten ein Knopf für die nächste Spalte */
.done-more { justify-self: start; }
.jc-next { display: none; }
@media (pointer: coarse) { .jc-next { display: inline-flex; justify-self: start; margin-top: 8px; min-height: 38px; background: var(--code-bg) !important; box-shadow: none; } }

/* Zeitleiste und Listen in den Einstellungen */
.tl-row { grid-template-columns: 88px minmax(0, 1fr) auto; align-items: start; }
.tl-row .btn { margin: -4px -8px 0 0; }
.trow.two { grid-template-columns: minmax(0, 1fr) auto; }
.mail-assign { max-width: 360px; }
.kv li { gap: 12px; }
#toast { display: flex; align-items: center; gap: 4px; }
@media (max-width: 860px) { .date.wide { grid-template-columns: minmax(0, 1fr) auto; } .date.wide time { grid-column: 1 / -1; } .tl-row { grid-template-columns: 76px minmax(0, 1fr); } .tl-row .btn { grid-column: 2; justify-self: start; margin: 0 0 0 -14px; } }

:root[data-theme="dark"] .cal-card .stepper { background: rgba(255,255,255,0.08); }
