/* Gemeinsames Design aller Seiten (Cross-Sales-dunkel). Farben aus dem Logo: Tiefschwarz + warmes Cremeweiß.
   Grundsätze: Schrift mind. 16 px, gute Kontraste, Bedienelemente mind. 44 px hoch (Daumen), einheitliche Abstände. */
:root {
  color-scheme: dark;
  --bg: #121316;
  --panel: #1a1c20;
  --panel-2: #22252a;
  --panel-3: #2c3036;
  --text: #eceef1;
  --muted: #a7adb8;          /* heller als zuvor: Kontrast auf --panel ca. 8:1 */
  --border: #2e3238;
  --border-strong: #444a53;
  --accent: #5b6ae0;  /* Hauptfarbe: nur für zentrale Aktionen und Auswahl */
  --accent-ink: #ffffff;
  --focus: #a9b3ff;
  --green: #2f9e5b;
  --green-soft: rgba(47, 158, 91, 0.16);
  --red: #e5534b;
  --red-soft: rgba(229, 83, 75, 0.16);
  --orange: #d9822b;
  --orange-soft: rgba(217, 130, 43, 0.18);
  --purple: #b9a2ff;
  --purple-soft: rgba(167, 139, 250, 0.18);
  --live: #3d1414;
  --live-text: #ff9a94;
  --radius: 10px;
  --radius-lg: 14px;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.35), 0 8px 24px rgba(0, 0, 0, 0.18);
  --side-w: 216px;
  --space-1: 4px; --space-2: 8px; --space-3: 12px; --space-4: 16px; --space-5: 24px;
  --shell-h: 0px; /* am Computer steht die Navigation links; am Handy siehe unten */
  --tabs-h: 64px;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
html, body { margin: 0; }
body {
  font-family: "Segoe UI", system-ui, -apple-system, Roboto, Arial, sans-serif;
  background: var(--bg); color: var(--text);
  font-size: 1rem; line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
body.has-shell { padding-bottom: env(safe-area-inset-bottom); }
h1 { font-size: 1.6rem; margin: 0 0 var(--space-2); font-weight: 700; line-height: 1.25; }
h2 { font-size: 1.2rem; margin: 0 0 var(--space-3); font-weight: 650; line-height: 1.3; }
h3 { font-size: 0.9rem; margin: var(--space-5) 0 var(--space-2); text-transform: uppercase; letter-spacing: 1.5px; font-weight: 650; color: var(--muted); }
p { margin: 0 0 var(--space-3); }
a { color: var(--focus); }
.icon { display: inline-flex; flex: none; line-height: 0; }
.icon svg { display: block; }
.muted { color: var(--muted); }
.small { font-size: 0.9rem; }
[hidden] { display: none !important; }
::selection { background: rgba(242, 240, 235, 0.25); }
* { scrollbar-width: thin; scrollbar-color: var(--border-strong) transparent; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }

/* ---------- Rahmen & Navigation ---------- */
#shell { display: contents; } /* damit die Kopfzeile beim Scrollen oben „klebt“ (sticky braucht die ganze Seite als Umgebung) */
.shell-top {
  position: sticky; top: 0; z-index: 30; height: var(--shell-h);
  display: flex; align-items: center; gap: var(--space-4); padding: 0 var(--space-4);
  background: #0e0f12; border-bottom: 1px solid var(--border);
}
.shell-brand { display: flex; align-items: center; gap: var(--space-3); text-decoration: none; color: var(--text); white-space: nowrap; }
.shell-logo { height: 34px; width: auto; display: block; }
.shell-title { display: flex; flex-direction: column; line-height: 1.15; border-left: 1px solid var(--border-strong); padding-left: var(--space-3); }
.shell-company { font-size: 0.8rem; letter-spacing: 4px; font-weight: 500; }
.shell-app { font-size: 0.85rem; color: var(--muted); }
.nav-desktop { display: flex; gap: var(--space-1); margin-left: var(--space-4); flex: 1; }
.nav-link {
  display: inline-flex; align-items: center; gap: var(--space-2); padding: 0 var(--space-4); min-height: 44px;
  color: var(--muted); text-decoration: none; border-radius: var(--radius); font-weight: 600;
}
.nav-link:hover { background: var(--panel-2); color: var(--text); }
.nav-link.active { color: var(--accent-ink); background: var(--accent); }
.shell-user { display: flex; align-items: center; gap: var(--space-3); margin-left: auto; }
.shell-name { font-size: 0.95rem; display: inline-flex; align-items: center; gap: var(--space-2); }
.role-badge { font-size: 0.7rem; letter-spacing: 1px; text-transform: uppercase; background: var(--panel-3); border: 1px solid var(--border-strong); padding: 1px 8px; border-radius: 999px; color: var(--muted); }
.nav-tabs { display: none; }

@media (max-width: 860px) {
  .shell-title, .shell-name { display: none; }
  .nav-desktop { display: none; }
  .shell-user { margin-left: auto; }
  body.has-shell { padding-bottom: calc(var(--tabs-h) + env(safe-area-inset-bottom)); }
  .nav-tabs {
    display: grid; grid-template-columns: repeat(6, 1fr); position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
    background: #0e0f12; border-top: 1px solid var(--border); padding-bottom: env(safe-area-inset-bottom);
  }
  .nav-tabs .nav-link { flex-direction: column; justify-content: center; gap: 2px; min-height: var(--tabs-h); padding: 6px 2px; border-radius: 0; font-size: 0.72rem; text-align: center; }
  .nav-tabs .nav-icon { font-size: 1.35rem; line-height: 1; }
  .nav-tabs .nav-link.active { background: var(--panel-3); color: var(--text); box-shadow: inset 0 3px 0 var(--accent); }
}

/* ---------- Handy / iPhone ---------- */
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
a, button, summary, select, input, textarea, label { touch-action: manipulation; }
body { -webkit-tap-highlight-color: transparent; }
@supports (padding: max(0px)) {
  body { padding-left: env(safe-area-inset-left); padding-right: env(safe-area-inset-right); }
}

/* ---------- Seitenfläche ---------- */
.page { max-width: 1100px; margin: 0 auto; padding: var(--space-5) var(--space-4); }
.page-head { display: flex; justify-content: space-between; align-items: flex-start; gap: var(--space-4); flex-wrap: wrap; margin-bottom: var(--space-4); }
.page-head h1 { margin: 0; }
.panel, .card { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: var(--space-4) 18px; margin-bottom: var(--space-4); }
.panel > :last-child, .card > :last-child { margin-bottom: 0; }
.panel .board-block { background: var(--panel-2); border-color: var(--border-strong); }

/* ---------- Knöpfe ---------- */
.btn {
  font: inherit; font-weight: 600; cursor: pointer; border: 1px solid var(--border-strong); border-radius: var(--radius);
  padding: 10px 16px; min-height: 44px; background: var(--panel-2); color: var(--text); text-decoration: none;
  display: inline-flex; align-items: center; justify-content: center; gap: var(--space-2);
  transition: background 0.12s, border-color 0.12s, filter 0.12s;
}
.btn:hover:not(:disabled) { background: var(--panel-3); border-color: #5a616b; }
.btn:disabled { opacity: 0.4; cursor: not-allowed; }
.btn-primary { background: var(--accent); color: var(--accent-ink); border-color: transparent; }
.btn-primary:hover:not(:disabled) { background: var(--accent); filter: brightness(0.92); }
.btn-ghost { background: transparent; }
.btn-small { padding: 6px 12px; min-height: 36px; font-size: 0.9rem; }
.btn-danger { background: var(--red); color: #fff; border-color: transparent; }
.btn-danger:hover:not(:disabled) { background: var(--red); filter: brightness(1.1); }
.btn-row { display: flex; gap: var(--space-2); flex-wrap: wrap; margin-top: var(--space-3); }

/* ---------- Formulare ---------- */
.field { margin-bottom: var(--space-3); }
label, .label { display: block; font-weight: 600; margin-bottom: 6px; font-size: 0.9rem; color: var(--muted); }
.label { text-transform: uppercase; letter-spacing: 1.2px; font-size: 0.8rem; }
textarea, input[type=text], input[type=password], input[type=email], input[type=tel], input[type=search], input[type=number],
input[type=date], input[type=datetime-local], select {
  font: inherit; font-size: 1rem; width: 100%; min-height: 44px; padding: 10px 12px; border: 1px solid var(--border-strong);
  border-radius: var(--radius); background: var(--bg); color: var(--text);
}
textarea { resize: vertical; line-height: 1.45; }
textarea:focus, input:focus, select:focus { outline: none; border-color: var(--focus); box-shadow: 0 0 0 3px rgba(240, 223, 174, 0.2); }
::placeholder { color: #7b828c; }
input[type=file] { font: inherit; width: 100%; color: var(--muted); }
input[type=checkbox], input[type=radio] { accent-color: var(--accent); width: 20px; height: 20px; flex: none; }
.chk { display: flex; gap: var(--space-3); align-items: center; min-height: 40px; color: var(--text); font-weight: 400; font-size: 1rem; cursor: pointer; margin: 0; }
.row { display: flex; gap: var(--space-3); flex-wrap: wrap; align-items: flex-end; }
.row > * { flex: 1 1 200px; }
.msg { margin-top: var(--space-3); min-height: 1.5em; overflow-wrap: anywhere; }
.msg.ok { color: #6fd79a; }
.msg.err { color: #ff8f88; }
code { word-break: break-all; background: var(--bg); padding: 2px 6px; border-radius: 6px; border: 1px solid var(--border); }

/* ---------- Marken und Etiketten ---------- */
.badge { font-size: 0.7rem; padding: 1px 8px; border-radius: 999px; margin-left: 4px; vertical-align: 1px; font-weight: 700; letter-spacing: 1px; }
.badge.live { background: var(--red); color: #fff; }
.tag { font-size: 0.78rem; padding: 2px 8px; border-radius: 6px; background: var(--panel-3); color: var(--muted); white-space: nowrap; }
.tag.overdue { background: var(--red-soft); color: #ff9d97; }
.tag.due { background: var(--orange-soft); color: #f0a65d; }
.tag.nophone { background: var(--red-soft); color: #ff9d97; font-weight: 700; }
.tag.choice { background: var(--purple-soft); color: var(--purple); }

/* ---------- Kennzahlen ---------- */
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: var(--space-3); }
.tile { background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius); padding: var(--space-3) var(--space-4); }
.tile .v { font-size: 1.9rem; font-weight: 700; line-height: 1.1; font-variant-numeric: tabular-nums; }
.tile .l { color: var(--text); font-size: 0.95rem; margin-top: 2px; }
.tile .e { color: var(--muted); font-size: 0.82rem; margin-top: 4px; }
.tile.rate .v { color: var(--focus); }
.scope-note { color: var(--muted); font-size: 0.9rem; margin: calc(-1 * var(--space-2)) 0 var(--space-3); }

/* ---------- Tabellen ---------- */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--border); font-size: 0.95rem; vertical-align: top; }
th { color: var(--muted); font-weight: 600; font-size: 0.82rem; text-transform: uppercase; letter-spacing: 0.8px; white-space: nowrap; }
td.n, th.n { text-align: right; font-variant-numeric: tabular-nums; }

/* ---------- Hinweise ---------- */
.notice { border: 1px solid var(--border-strong); border-left: 4px solid var(--orange); background: var(--orange-soft); border-radius: var(--radius); padding: var(--space-3) var(--space-4); margin-bottom: var(--space-4); }
.notice.err { border-left-color: var(--red); background: var(--red-soft); }
.notice.ok { border-left-color: var(--green); background: var(--green-soft); }
details > summary { cursor: pointer; color: var(--focus); min-height: 44px; display: flex; align-items: center; gap: 6px; }

/* ---------- Anmeldung ---------- */
.auth { max-width: 460px; margin: 0 auto; padding: var(--space-5) var(--space-4); }
.auth-logo { display: block; width: min(260px, 70%); height: auto; margin: var(--space-5) auto var(--space-5); }

/* ---------- Hilfsklassen (kein Inline-Stil wegen Content-Security-Policy) ---------- */
.flush { margin: 0 !important; }
.mt-3 { margin-top: var(--space-3); }
.mt-4 { margin-top: var(--space-4); }
.m-4 { margin: var(--space-4); }

/* To-Dos (Übersicht, Karten, Dialer) und Aufnahmen */
.todo-list { list-style: none; margin: 0 0 var(--space-3); padding: 0; display: grid; gap: var(--space-2); }
.todo-item { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--space-2); padding: var(--space-2) var(--space-3); background: var(--panel-2); border: 1px solid var(--border); border-radius: var(--radius); }
.todo-item.overdue { border-color: var(--red); }
.todo-title { font-weight: 600; }
.todo-meta { display: flex; flex-wrap: wrap; gap: var(--space-2); align-items: center; }
.todo-form { margin-top: var(--space-3); }
.todo-form > summary { min-height: 44px; cursor: pointer; font-weight: 650; }
.todo-form input[type="text"], .todo-form input[type="datetime-local"], .todo-form textarea { width: 100%; }
.rec-box { margin-bottom: var(--space-3); }
.rec-status { margin-top: var(--space-2); font-size: 0.95rem; }
.rec-status.live { color: var(--live-text); background: var(--live); padding: var(--space-2) var(--space-3); border-radius: var(--radius); font-weight: 650; }
.rec-status.ok { color: #7fd6a1; }
.rec-status.err { color: #ff9d97; }
.rec-warn { margin-top: var(--space-2); color: #f0a65d; font-size: 0.9rem; }
.rec-list { display: grid; gap: var(--space-3); }
.rec-item { display: grid; gap: var(--space-2); padding: var(--space-2) var(--space-3); background: var(--panel-2); border: 1px solid var(--border); border-radius: var(--radius); }
.rec-item audio { width: 100%; max-width: 100%; }


/* ---------- Seitenleiste links (Computer) ---------- */
.avatar { display: inline-flex; align-items: center; justify-content: center; flex: none; width: 36px; height: 36px; border-radius: 50%; background: var(--panel-3); color: var(--text); font-weight: 700; font-size: 0.8rem; letter-spacing: 0.5px; border: 1px solid var(--border-strong); }
.avatar.lg { width: 56px; height: 56px; font-size: 1.1rem; }
@media (min-width: 861px) {
  body.has-shell { padding-left: var(--side-w); }
  .shell-top {
    position: fixed; top: 0; left: 0; bottom: 0; width: var(--side-w); height: auto; z-index: 30;
    flex-direction: column; align-items: stretch; gap: var(--space-4); padding: var(--space-4) var(--space-3);
    background: var(--panel); border-right: 1px solid var(--border); border-bottom: 0;
  }
  .shell-brand { padding: var(--space-2) var(--space-3) var(--space-3); border-bottom: 1px solid var(--border); }
  .nav-desktop { flex-direction: column; margin: 0; flex: 1; gap: 2px; overflow-y: auto; }
  .nav-link { min-height: 46px; padding: 0 var(--space-3); gap: var(--space-3); font-weight: 600; }
  .nav-link .nav-icon { font-size: 1.15rem; width: 1.6rem; text-align: center; }
  .nav-link.active { background: var(--panel-3); color: var(--text); box-shadow: inset 3px 0 0 var(--accent); }
  .shell-user { margin: 0; flex-wrap: wrap; padding: var(--space-3); background: var(--panel-2); border-radius: var(--radius); border: 1px solid var(--border); gap: var(--space-2); }
  .shell-name { flex-direction: column; align-items: flex-start; gap: 2px; flex: 1; min-width: 0; overflow-wrap: anywhere; font-weight: 600; }
  .shell-user .btn { width: 100%; }
}
@media (max-width: 860px) {
  :root { --shell-h: 58px; }
  .shell-avatar { display: none; }
}
@media (min-width: 861px) { .nav-link .nav-icon { display: inline; } }
@media (max-width: 860px) { .nav-desktop .nav-icon { display: none; } }

/* ---------- Weichere Karten ---------- */
.panel, .card { box-shadow: var(--shadow); border-color: rgba(255, 255, 255, 0.06); padding: var(--space-5) var(--space-5); }
@media (max-width: 860px) { .panel, .card { padding: var(--space-4); } }
.tile { border-radius: var(--radius-lg); background: var(--panel-2); border-color: transparent; padding: var(--space-4); }
.btn { border-radius: 12px; }
.btn-primary { box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3); }
.tag { border-radius: 999px; padding: 2px 10px; }
h1 { font-size: 1.75rem; letter-spacing: -0.01em; }
.page { max-width: 1180px; }
@media (min-width: 861px) {
  .shell-brand { gap: var(--space-2); }
  .shell-logo { height: 30px; }
  .shell-title { padding-left: var(--space-2); }
  .shell-company { font-size: 0.68rem; letter-spacing: 2px; }
}

/* ================= Einheitliche Bausteine (Design-System) ================= */
.btn-primary { background: var(--accent); color: var(--accent-ink); border-color: transparent; }
.btn-primary:hover:not(:disabled) { background: var(--accent); filter: brightness(1.12); }
.btn-warn { background: var(--orange-soft); color: #f4b97a; border-color: rgba(217, 130, 43, 0.5); }
.btn-icon { padding: 0; width: 40px; min-height: 40px; }
.btn .icon { margin-right: -2px; }
.badge-state { display: inline-flex; align-items: center; gap: 6px; font-size: 0.8rem; font-weight: 700; letter-spacing: 0.3px; padding: 3px 10px; border-radius: 999px; white-space: nowrap; }
.badge-state::before { content: ''; width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.badge-state.idle { background: var(--panel-3); color: var(--muted); }
.badge-state.live { background: var(--green-soft); color: #6fd79a; }
.badge-state.warn { background: var(--orange-soft); color: #f4b97a; }
.badge-state.err { background: var(--red-soft); color: #ff9d97; }
.empty-state { text-align: center; padding: var(--space-5) var(--space-4); color: var(--muted); }
.empty-state p { margin: 0 0 var(--space-1); }
.loading-state { display: flex; gap: var(--space-3); align-items: center; padding: var(--space-4); color: var(--muted); }
.spinner { width: 18px; height: 18px; border-radius: 50%; border: 2px solid var(--border-strong); border-top-color: var(--accent); animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.error-state { display: flex; gap: var(--space-3); align-items: center; flex-wrap: wrap; padding: var(--space-3) var(--space-4); background: var(--red-soft); color: #ffb4ae; border-radius: var(--radius); }
.toasts { position: fixed; right: var(--space-4); top: var(--space-4); z-index: 100; display: grid; gap: var(--space-2); max-width: min(360px, calc(100vw - 32px)); }
.toast { display: flex; gap: var(--space-2); align-items: center; padding: 10px 14px; border-radius: var(--radius); background: var(--panel-3); border: 1px solid var(--border-strong); box-shadow: var(--shadow); font-size: 0.95rem; }
.toast.ok .icon { color: #6fd79a; }
.toast.err { border-color: var(--red); }
.toast.err .icon { color: #ff9d97; }
dialog.panel-dlg { background: var(--panel); color: var(--text); border: 1px solid var(--border-strong); border-radius: var(--radius-lg); padding: 0; width: min(560px, calc(100vw - 24px)); max-height: calc(100vh - 32px); box-shadow: var(--shadow); }
dialog.panel-dlg::backdrop { background: rgba(5, 6, 8, 0.65); }
dialog.panel-dlg.side { margin: 0 0 0 auto; height: 100vh; max-height: 100vh; width: min(520px, 100vw); border-radius: var(--radius-lg) 0 0 var(--radius-lg); }
.pd-head { display: flex; justify-content: space-between; align-items: center; gap: var(--space-3); padding: var(--space-3) var(--space-4); border-bottom: 1px solid var(--border); position: sticky; top: 0; background: var(--panel); z-index: 1; }
.pd-head h2 { margin: 0; font-size: 1.1rem; }
.pd-body { padding: var(--space-4); overflow-y: auto; }
.page-head h1, h1 { font-size: 1.5rem; }
.kpi-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: var(--space-3); margin-bottom: var(--space-4); }
a.kpi, .kpi { display: block; text-decoration: none; color: var(--text); background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); padding: var(--space-3) var(--space-4); }
a.kpi:hover { border-color: var(--accent); }
.kpi .v { font-size: 1.8rem; font-weight: 700; line-height: 1.1; font-variant-numeric: tabular-nums; }
.kpi .l { font-size: 0.9rem; margin-top: 2px; }
.kpi .e { font-size: 0.78rem; color: var(--muted); margin-top: 2px; }
.cols-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-4); }
@media (max-width: 960px) { .cols-2 { grid-template-columns: minmax(0, 1fr); } }
.list-plain { list-style: none; margin: 0; padding: 0; }
.list-plain > li { display: flex; gap: var(--space-3); align-items: center; justify-content: space-between; padding: 10px 0; border-bottom: 1px solid var(--border); min-width: 0; }
.list-plain > li:last-child { border-bottom: 0; }
.list-plain .grow { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.section-title { display: flex; justify-content: space-between; align-items: center; gap: var(--space-3); margin-bottom: var(--space-2); }
.section-title h2 { margin: 0; font-size: 1rem; }
.panel { padding: var(--space-4); }
.seg { display: inline-flex; border: 1px solid var(--border-strong); border-radius: var(--radius); overflow: hidden; }
.seg button { background: var(--panel-2); color: var(--text); border: 0; min-height: 40px; padding: 0 14px; font: inherit; cursor: pointer; }
.seg button[aria-pressed="true"] { background: var(--accent); color: var(--accent-ink); font-weight: 700; }
.nav-link .nav-icon { display: inline-flex; }
@media (min-width: 861px) and (max-width: 1199px) {
  :root { --side-w: 68px; }
  .shell-title, .nav-link .nav-label, .shell-name, .shell-user .btn { display: none; }
  .shell-brand { justify-content: center; padding: var(--space-2) 0 var(--space-3); }
  .nav-link { justify-content: center; padding: 0; }
  .shell-user { padding: var(--space-2); justify-content: center; }
}
.row-actions { display: flex; align-items: center; gap: var(--space-2); flex: none; }
.sync-line { display: flex; gap: var(--space-3); align-items: center; flex-wrap: wrap; }
.tag.due { background: var(--orange-soft); color: #f4b97a; }
.player { display: grid; gap: var(--space-2); }
.speed { display: inline-flex; gap: 4px; flex-wrap: wrap; }
.speed-btn { font: inherit; font-size: 0.85rem; color: var(--muted); background: var(--panel-2); border: 1px solid var(--border-strong); border-radius: 999px; padding: 4px 12px; min-height: 36px; cursor: pointer; }
.speed-btn[aria-pressed="true"] { background: var(--accent); color: var(--accent-ink); border-color: transparent; font-weight: 700; }
.rec-text { margin-top: var(--space-2); }
.rec-text > summary { min-height: 36px; font-size: 0.9rem; color: var(--focus); }
.rec-pre { white-space: pre-wrap; overflow-wrap: anywhere; font: inherit; background: var(--panel-2); border-radius: var(--radius); padding: var(--space-3); margin: var(--space-2) 0; line-height: 1.5; }
.rec-summary h4 { margin: var(--space-2) 0 0; font-size: 0.8rem; color: var(--muted); text-transform: uppercase; letter-spacing: 1px; }

/* Fälligkeit ändern, lange Listen */
.due-edit .quick-times { display: flex; gap: var(--space-2); flex-wrap: wrap; margin: var(--space-2) 0 var(--space-3); }
.due-edit input[type=datetime-local] { width: 100%; }
.due-edit-btn { padding: 2px 6px; min-height: 0; vertical-align: middle; }
.list-plain .row-actions { display: inline-flex; align-items: center; gap: var(--space-2); }
.more-row[hidden] { display: none !important; }
.more-btn { margin-top: var(--space-2); }
.due-line { display: flex; align-items: center; gap: var(--space-3); flex-wrap: wrap; }

/* Beschreibung/Notizen (Markdown-Darstellung, per Klick bearbeitbar) */
.md { line-height: 1.5; overflow-wrap: anywhere; }
.md > :first-child { margin-top: 0; }
.md > :last-child { margin-bottom: 0; }
.md p { margin: 0 0 var(--space-2); }
.md ul, .md ol { margin: 0 0 var(--space-2); padding-left: 1.4em; }
.md li { margin: 2px 0; }
.md blockquote { margin: 0 0 var(--space-2); padding: 2px 12px; border-left: 3px solid var(--border-strong, var(--border)); color: var(--muted); }
.md pre, .md code { background: var(--panel-3, var(--panel-2)); border-radius: 6px; font-family: ui-monospace, Consolas, monospace; font-size: 0.9em; }
.md code { padding: 1px 5px; }
.md pre { padding: 8px 10px; overflow-x: auto; white-space: pre-wrap; margin: 0 0 var(--space-2); }
.md .md-h { margin: var(--space-2) 0 4px; font-size: 1rem; }
.md .md-h1, .md .md-h2 { font-size: 1.1rem; }
.md hr { border: 0; border-top: 1px solid var(--border); margin: var(--space-2) 0; }
.md a { color: var(--accent-text, var(--accent)); }
.desc-view { padding: var(--space-3); background: var(--panel-2); border-radius: var(--radius); }
.desc-view.editable { cursor: text; border: 1px solid transparent; }
.desc-view.editable:hover, .desc-view.editable:focus-visible { border-color: var(--border-strong, var(--border)); }
.desc-input { width: 100%; resize: vertical; font: inherit; line-height: 1.5; }
.desc-block .btn-row { margin-top: var(--space-2); align-items: center; }

/* ================= Apple-Look (dunkel) =================
   Ruhiger, großzügiger, runder – Vorbild: Apple/gitnimble.com im dunklen Modus. Nur Aussehen: Funktionen, IDs und Klassen bleiben.
   Alles läuft über die Variablen oben; dieser Block steht zuletzt und überschreibt gezielt. */
@font-face {
  font-family: 'Inter'; font-style: normal; font-weight: 100 900; font-display: swap;
  src: url('/fonts/inter-latin-wght-normal.woff2') format('woff2-variations'), url('/fonts/inter-latin-wght-normal.woff2') format('woff2');
}
:root {
  --font: 'Inter', -apple-system, 'SF Pro Text', 'Segoe UI Variable', 'Segoe UI', system-ui, sans-serif;
  --bg: #0b0b0d;
  --panel: #141417;
  --panel-2: #1c1c21;
  --panel-3: #26262c;
  --text: #f5f5f7;
  --muted: #a1a1a8;
  --border: rgba(255, 255, 255, 0.08);
  --border-strong: rgba(255, 255, 255, 0.16);
  --radius: 12px;
  --radius-lg: 20px;
  --shadow: 0 0 0 1px rgba(255, 255, 255, 0.04), 0 14px 40px rgba(0, 0, 0, 0.45);
  --glass: rgba(20, 20, 23, 0.72);
}
body { font-family: var(--font); letter-spacing: -0.011em; font-feature-settings: 'cv11', 'ss03'; }
h1 { font-size: 2rem; font-weight: 700; letter-spacing: -0.03em; line-height: 1.15; }
h2 { font-size: 1.2rem; font-weight: 650; letter-spacing: -0.02em; }
.page-head h1, h1 { font-size: 2rem; }
h3 { letter-spacing: 0.08em; font-size: 0.78rem; }
.page { max-width: 1240px; padding: 32px var(--space-5) 48px; }

/* Seitenleiste: Glas statt Fläche, aktiver Eintrag als weiche Pille */
@media (min-width: 861px) {
  .shell-top { background: var(--glass); -webkit-backdrop-filter: saturate(180%) blur(24px); backdrop-filter: saturate(180%) blur(24px); border-right: 1px solid var(--border); }
  .shell-brand { border-bottom: 1px solid var(--border); }
  .nav-link { border-radius: 12px; min-height: 44px; font-weight: 550; }
  .nav-link.active { background: rgba(255, 255, 255, 0.1); color: var(--text); box-shadow: none; }
  .nav-link.active .icon { color: var(--accent); }
  .shell-user { background: rgba(255, 255, 255, 0.05); border: 0; border-radius: 16px; }
}
@media (max-width: 860px) {
  .shell-top { background: var(--glass); -webkit-backdrop-filter: saturate(180%) blur(20px); backdrop-filter: saturate(180%) blur(20px); }
  .nav-tabs { background: var(--glass); -webkit-backdrop-filter: saturate(180%) blur(20px); backdrop-filter: saturate(180%) blur(20px); border-top: 1px solid var(--border); }
  .nav-tabs .nav-link.active { background: transparent; box-shadow: none; color: var(--text); }
  .nav-tabs .nav-link.active .icon { color: var(--accent); }
}

/* Karten und Kacheln: große Rundung, hauchdünner Rand, weicher Schein */
.panel, .card { border-radius: var(--radius-lg); border: 1px solid var(--border); box-shadow: var(--shadow); padding: 28px; }
@media (max-width: 860px) { .panel, .card { padding: 20px; border-radius: 18px; } }
.tile, a.kpi, .kpi { background: var(--panel); border: 1px solid var(--border); border-radius: 18px; padding: 18px 20px; }
.tile { background: var(--panel-2); border-color: transparent; }
a.kpi:hover { border-color: var(--border-strong); background: var(--panel-2); }
.kpi .v, .tile .v { font-size: 2.1rem; font-weight: 700; letter-spacing: -0.035em; }
.kpi .l, .tile .l { font-weight: 600; }
.kpi .e, .tile .e { color: var(--muted); }
.section-title h2 { font-size: 1.05rem; }
.list-plain > li { padding: 12px 0; }

/* Knöpfe: Pillen, ruhige Sekundärknöpfe, eine klare Primäraktion */
.btn { border-radius: 999px; border: 1px solid transparent; background: var(--panel-3); padding: 10px 20px; font-weight: 600; letter-spacing: -0.01em; transition: background 0.15s, transform 0.1s, filter 0.15s, box-shadow 0.15s; }
.btn:hover:not(:disabled) { background: #31313a; border-color: transparent; }
.btn:active:not(:disabled) { transform: scale(0.98); }
.btn-primary { background: var(--accent); color: var(--accent-ink); box-shadow: 0 6px 20px rgba(91, 106, 224, 0.35); }
.btn-primary:hover:not(:disabled) { background: var(--accent); filter: brightness(1.1); }
.btn-ghost { background: transparent; border-color: var(--border-strong); }
.btn-ghost:hover:not(:disabled) { background: rgba(255, 255, 255, 0.07); border-color: var(--border-strong); }
.btn-small { padding: 6px 14px; min-height: 36px; }
.btn-icon { border-radius: 50%; padding: 0; }
.btn-danger { box-shadow: none; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 3px; border-radius: 10px; }

/* Eingaben */
textarea, input[type=text], input[type=password], input[type=email], input[type=tel], input[type=search], input[type=number],
input[type=date], input[type=datetime-local], select { border-radius: 12px; border: 1px solid var(--border-strong); background: var(--bg); padding: 11px 14px; transition: border-color 0.15s, box-shadow 0.15s; }
textarea:focus, input:focus, select:focus { border-color: var(--accent); box-shadow: 0 0 0 4px rgba(91, 106, 224, 0.25); }
label, .label { font-weight: 550; }

/* Etiketten, Umschalter, Tabellen */
.tag { border-radius: 999px; padding: 3px 11px; font-weight: 600; font-size: 0.76rem; background: rgba(255, 255, 255, 0.08); }
.tag.overdue { background: rgba(229, 83, 75, 0.18); }
.seg { background: var(--panel-2); border: 0; border-radius: 999px; padding: 3px; gap: 2px; }
.seg button { background: transparent; color: var(--muted); border-radius: 999px; min-height: 36px; font-weight: 600; }
.seg button[aria-pressed="true"] { background: var(--panel-3); color: var(--text); box-shadow: 0 1px 4px rgba(0, 0, 0, 0.5); }
th { text-transform: none; letter-spacing: 0; font-size: 0.8rem; font-weight: 600; }
th, td { border-bottom: 1px solid var(--border); padding: 12px 10px; }
tbody tr:hover td { background: rgba(255, 255, 255, 0.03); }
.notice { border-radius: 16px; border: 0; border-left: 0; background: var(--orange-soft); }
.notice.err { background: var(--red-soft); }
.notice.ok { background: var(--green-soft); }
details > summary { color: var(--text); font-weight: 550; }

/* Fenster, Meldungen */
dialog.panel-dlg { border-radius: 24px; border: 1px solid var(--border); background: var(--panel); box-shadow: 0 30px 80px rgba(0, 0, 0, 0.6); }
dialog.panel-dlg.side { border-radius: 24px 0 0 24px; }
dialog.panel-dlg::backdrop, dialog::backdrop { background: rgba(0, 0, 0, 0.55); -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); }
.pd-head { background: var(--glass); -webkit-backdrop-filter: blur(20px); backdrop-filter: blur(20px); border-bottom: 1px solid var(--border); padding: 16px 22px; }
.pd-body { padding: 22px; }
.toast { background: var(--glass); -webkit-backdrop-filter: saturate(180%) blur(20px); backdrop-filter: saturate(180%) blur(20px); border: 1px solid var(--border-strong); border-radius: 16px; box-shadow: 0 12px 40px rgba(0, 0, 0, 0.5); }
.avatar { background: var(--panel-3); border: 0; }
.empty-state { padding: 32px 16px; }

/* Links ruhig (Apple): nur beim Darüberfahren unterstrichen, in Listen in Textfarbe */
a { text-decoration: none; }
a:hover { text-decoration: underline; }
.nav-link, a.kpi, .btn, a.tag, .list-plain a { text-decoration: none; }
.list-plain a, .list-plain a strong { color: var(--text); }
.list-plain a:hover { text-decoration: none; color: var(--focus); }
.list-plain .small, .list-plain .muted { color: var(--muted); }
.tiles { grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
@media (max-width: 860px) {
  h1 { font-size: 1.7rem; }
  .kpi-row { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .kpi .v { font-size: 1.7rem; }
  .list-plain > li { flex-wrap: wrap; }
  .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* Umschalter Darstellung */
.theme-btn { width: 36px; min-height: 36px; margin-left: auto; }
@media (min-width: 861px) { .shell-user .theme-btn { width: 100%; border-radius: 999px; } }
@media (max-width: 860px) { .list-plain > li > .grow { flex: 1 1 100%; } }

/* Bestätigungsnachricht (Fenster „Bestätigung senden“, Vorlagen in den Einstellungen) */
.msg-form { display: grid; gap: var(--space-3); }
.msg-form .seg { flex-wrap: wrap; max-width: 100%; }
.msg-form textarea, .tpl-block textarea { width: 100%; resize: vertical; }
.tpl-block { display: grid; gap: var(--space-2); padding-top: var(--space-3); border-top: 1px solid var(--border); }
button.tag-btn { border: 0; cursor: pointer; font: inherit; font-size: 0.78rem; color: var(--muted); }
button.tag-btn:hover { color: var(--text); }
