/* Internes CRM (/crm). Arbeitsoberfläche: dicht, vertraute Muster (Seitenleiste, Tabelle, Board, Seitenpanel).
   Drei Ebenen trennen Navigation, Arbeitsfläche und Inhalt: dunkle Seitenleiste in Med.One-Navy, graue Fläche,
   weiße Inhalte. Jede Stufe der Pipeline hat eine eigene Farbe und ein eigenes Fortschrittszeichen (wie Linear),
   Zuständige haben eigene Farben, Fälligkeiten sind rot, gelb oder neutral (wie Pipedrive). Farbe steht nie allein:
   immer mit Text daneben. Eine Schrift (DM Sans) mit Tabellenziffern, Manrope nur für die Marke. */
@font-face { font-family: Manrope; src: url('fonts/manrope-latin.woff2') format('woff2'); font-weight: 200 800; font-display: swap; }
@font-face { font-family: 'DM Sans'; src: url('fonts/dm-sans-latin.woff2') format('woff2'); font-weight: 100 1000; font-display: swap; }

:root {
  --paper: #fff;
  --bg: #f3f6f9;              /* Arbeitsfläche hinter den Inhalten */
  --canvas: #f7f9fb;          /* Kopfzeilen, Eingabebereiche */
  --sunk: #e9eef3;            /* Spalten im Board, Segmente */
  --nav: #142b3c;             /* Seitenleiste */
  --nav-2: #1d3a50;
  --nav-ink: #c9d8e4;
  --nav-faint: #7f99ad;
  --ink: #142b3c;
  --ink-2: #2c4558;
  --muted: #566a79;
  --faint: #7d8f9d;
  --line: #dce5ec;
  --line-2: #c9d6e0;
  --line-strong: #7d93a6;
  --accent: #175fcb;
  --accent-deep: #114a9f;
  --accent-wash: #eaf2fa;
  --ok: #1d6b45;
  --ok-wash: #e5f3ea;
  --warn: #8a5200;
  --warn-wash: #fdf1dc;
  --bad: #a4302a;
  --bad-wash: #fbeceb;
  --mark-1: #315b86;
  --mark-2: #527ead;
  --mark-3: #86a9ce;
  --leon: #175fcb;
  --alex: #c2571a;
  --shadow-1: 0 1px 2px rgba(20, 43, 60, .06), 0 1px 1px rgba(20, 43, 60, .04);
  --shadow-2: 0 2px 4px rgba(20, 43, 60, .06), 0 6px 16px -6px rgba(20, 43, 60, .14);
  --radius: 10px;
  --shadow-pop: 0 12px 32px -8px rgba(20, 43, 60, .22), 0 2px 6px rgba(20, 43, 60, .08);
  --ease: cubic-bezier(.16, 1, .3, 1);
  --body: 'DM Sans', system-ui, sans-serif;
  --brand: Manrope, system-ui, sans-serif;
  --side-w: 15rem;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 400 .9375rem/1.45 var(--body); -webkit-font-smoothing: antialiased;
  caret-color: var(--accent); accent-color: var(--accent); font-variant-numeric: tabular-nums; }
::selection { background: var(--accent); color: #fff; }
h1, h2, h3, p, ul, ol, dl, dd, figure { margin: 0; }
ul, ol { padding: 0; list-style: none; }
a { color: var(--accent); text-decoration-thickness: 1px; text-underline-offset: .2em; }
a:hover { color: var(--accent-deep); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
button, input, select, textarea { font: inherit; color: inherit; }
.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
.icon { width: 1.125rem; height: 1.125rem; flex: none; fill: none; stroke: currentColor; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; }
.sr-only { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }
.muted { color: var(--muted); }
.num { font-variant-numeric: tabular-nums; white-space: nowrap; }
body.is-locked { overflow: hidden; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--line-2); border-radius: 999px; border: 2px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-track { background: transparent; }

/* ---------- Marke ---------- */
.brand { display: flex; align-items: center; gap: .5rem; font: 600 1.125rem/1 var(--brand); letter-spacing: -.03em; color: var(--ink); }
.brand-mark { width: 1.5rem; height: 1.5rem; }
#i-mark .m1 { fill: var(--m1, var(--mark-1)); } #i-mark .m2 { fill: var(--m2, var(--mark-2)); } #i-mark .m3 { fill: var(--m3, var(--mark-3)); }
#i-mark path { stroke: var(--m-gap, var(--paper)); stroke-width: 6; stroke-linejoin: round; }
.brand-sub { color: var(--muted); font: 500 .8125rem/1 var(--body); letter-spacing: 0; padding: .1875rem .375rem; border: 1px solid var(--line-2); border-radius: 6px; }

/* ---------- Knöpfe und Felder ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: .375rem; min-height: 2.25rem; padding: 0 .75rem; border: 1px solid var(--line-2);
  border-radius: 8px; background: var(--paper); color: var(--ink); font-weight: 500; font-size: .875rem; line-height: 1; text-decoration: none; white-space: nowrap; cursor: pointer;
  transition: background-color .15s var(--ease), border-color .15s var(--ease), color .15s var(--ease); }
.btn:hover { background: var(--sunk); color: var(--ink); }
.btn:active { transform: translateY(1px); }
.btn:disabled, .btn[aria-disabled="true"] { opacity: .5; cursor: default; transform: none; }
.btn-primary { border-color: var(--accent); background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-deep); border-color: var(--accent-deep); color: #fff; }
.btn-quiet { border-color: transparent; background: transparent; }
.btn-quiet:hover { background: var(--sunk); }
.btn-danger { color: var(--bad); }
.btn-danger:hover { background: var(--bad-wash); color: var(--bad); }
.btn-block { width: 100%; min-height: 2.75rem; font-size: .9375rem; }
.btn.is-on { border-color: var(--accent); background: var(--accent-wash); color: var(--accent-deep); }
.btn .count { min-width: 1.25rem; padding: .125rem .375rem; border-radius: 999px; background: var(--accent); color: #fff; font-size: .75rem; font-weight: 600; }
.icon-btn { display: inline-grid; place-items: center; width: 2.25rem; height: 2.25rem; flex: none; padding: 0; border: 0; border-radius: 8px; background: transparent; color: var(--muted); cursor: pointer; }
.icon-btn:hover { background: var(--sunk); color: var(--ink); }

.field { display: grid; gap: .3125rem; min-width: 0; }
.field > span { color: var(--muted); font-size: .8125rem; font-weight: 500; }
.input, .field input, .field select, .field textarea, .select {
  width: 100%; min-height: 2.25rem; padding: .4375rem .625rem; border: 1px solid var(--line-2); border-radius: 8px; background: var(--paper); font-size: .875rem; line-height: 1.3; }
.field textarea, textarea.input { min-height: 4.5rem; resize: vertical; line-height: 1.45; }
.input:hover, .field input:hover, .field select:hover, .select:hover, .field textarea:hover { border-color: var(--line-strong); }
.input:focus, .field input:focus, .field select:focus, .select:focus, .field textarea:focus, textarea.input:focus { outline: 2px solid var(--accent); outline-offset: -1px; border-color: var(--accent); }
.select { width: auto; padding-right: 1.75rem; }
::placeholder { color: var(--faint); }
.search { position: relative; display: flex; align-items: center; min-width: 0; }
.search .icon { position: absolute; left: .625rem; color: var(--faint); pointer-events: none; }
.search input { padding-left: 2.125rem; }
.search kbd { position: absolute; right: .5rem; padding: .0625rem .375rem; border: 1px solid var(--line-2); border-radius: 4px; color: var(--faint); font: 500 .75rem/1.4 var(--body); }

/* ---------- Anmeldung ---------- */
.login { display: grid; place-items: center; min-height: 100vh; min-height: 100dvh; padding: 1.5rem 1rem; background: var(--canvas); }
.login-box { display: grid; gap: 1rem; width: min(100%, 25rem); padding: 1.75rem; border: 1px solid var(--line); border-radius: 14px; background: var(--paper); box-shadow: 0 1px 2px rgba(20, 43, 60, .05); }
.login-box h1 { margin-top: .5rem; font: 650 1.375rem/1.2 var(--body); letter-spacing: -.02em; }
.login-box .muted { font-size: .875rem; }
.login-box input { min-height: 2.75rem; font-size: 1rem; }
.login-error { min-height: 1.25rem; color: var(--bad); font-size: .875rem; }
.login-error:empty { display: none; }
.login-note { color: var(--faint); font-size: .8125rem; }
/* Anmeldung mit Benutzerkonto (admin-login.js, 25.11.) */
.login-new { display: grid; gap: 1rem; padding: .875rem; border-radius: 10px; background: var(--canvas); }
.login-switch { justify-self: center; border: 0; background: none; padding: .25rem .5rem; color: var(--accent); font: inherit; font-size: .8125rem; cursor: pointer; text-decoration: underline; text-underline-offset: 2px; }
.login-switch:hover { color: var(--ink, inherit); }
/* Angemeldet bleiben (27.11.) */
.login-keep { display: flex; align-items: center; gap: .5rem; font-size: .875rem; cursor: pointer; }
.login-keep input { width: 1.125rem; height: 1.125rem; min-height: 0; margin: 0; accent-color: var(--accent); }
.account-form { display: grid; align-content: start; gap: .75rem; padding: .875rem 1rem; }
.account-form .btn { justify-self: start; }
.account-check { margin: 0; }
.account-check input { accent-color: var(--accent); }
.account-setup { display: grid; gap: .5rem; }
.account-setup:empty { display: none; }
.otp-box { display: grid; gap: .5rem; padding: .875rem 1rem; margin-bottom: .75rem; border-color: var(--accent); }
.otp-show { justify-self: start; padding: .375rem .625rem; border-radius: 8px; background: var(--canvas); font: 600 1.125rem/1.3 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; letter-spacing: .06em; user-select: all; word-break: break-all; }
.cell-actions { display: flex; flex-wrap: wrap; gap: .375rem; justify-content: flex-end; }
.cell-actions .btn { min-height: 1.875rem; padding: 0 .5rem; font-size: .8125rem; }
.users-new { margin-top: .75rem; max-width: 32rem; }
.agent-key { font-size: .8125rem; letter-spacing: 0; }
.avatar.is-agent { border-radius: 6px; }
.avatar.is-other { background: #6a6f86; }

/* ---------- Gerüst ---------- */
.app { display: grid; grid-template-columns: var(--side-w) minmax(0, 1fr); min-height: 100vh; min-height: 100dvh; }
.side { position: sticky; top: 0; display: flex; flex-direction: column; gap: 1.25rem; height: 100vh; height: 100dvh; padding: 1rem .75rem; overflow-y: auto; background: var(--nav); color: var(--nav-ink);
  --m1: #8fb4dc; --m2: #5f8fc4; --m3: #c3d7ec; --m-gap: var(--nav); scrollbar-color: var(--nav-2) transparent; }
.side > .brand { padding: .375rem .5rem; color: #fff; }
.side .brand-sub { color: var(--nav-ink); border-color: var(--nav-2); }
.nav { display: grid; gap: .125rem; }
.nav a, .side-link, .side-views button { display: flex; align-items: center; gap: .625rem; min-height: 2.25rem; padding: 0 .625rem; border: 0; border-radius: 8px; background: none;
  color: var(--nav-ink); font-size: .875rem; font-weight: 500; text-decoration: none; text-align: left; cursor: pointer; width: 100%; }
.nav a .icon, .side-link .icon { color: var(--nav-faint); }
.nav a:hover, .side-link:hover, .side-views button:hover { background: var(--nav-2); color: #fff; }
.nav a:hover .icon, .side-link:hover .icon { color: #fff; }
.nav a[aria-current="page"] { background: #fff; color: var(--ink); font-weight: 600; }
.nav a[aria-current="page"] .icon { color: var(--accent); }
.side :focus-visible { outline-color: #8fb4dc; }
.nav-count { margin-left: auto; min-width: 1.375rem; padding: .125rem .4375rem; border-radius: 999px; background: #f2b04a; color: #3b2400; font-size: .75rem; font-weight: 700; text-align: center; }
.side-label { padding: 0 .625rem .25rem; color: var(--nav-faint); font-size: .75rem; font-weight: 600; }
.side-views { min-width: 0; }
.side-views ul { display: grid; grid-template-columns: minmax(0, 1fr); gap: .125rem; }
.side-views button { font-weight: 400; }
.side-views button span:first-child { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.side-views button.is-current { background: var(--nav-2); color: #fff; font-weight: 600; }
.side-views .view-kind { flex: none; margin-left: auto; color: var(--nav-faint); font-size: .75rem; }
.side-foot { display: grid; gap: .5rem; margin-top: auto; padding-top: .75rem; border-top: 1px solid var(--nav-2); }
.me { display: flex; align-items: center; gap: .5rem; padding: .25rem .25rem .25rem .5rem; }
.me-text { display: grid; min-width: 0; font-size: .8125rem; line-height: 1.3; }
.me-text strong { color: #fff; }
.me-text span { color: var(--nav-faint); font-size: .75rem; }
.side .icon-btn { color: var(--nav-faint); }
.side .icon-btn:hover { background: var(--nav-2); color: #fff; }
.avatar { display: inline-grid; place-items: center; width: 1.75rem; height: 1.75rem; flex: none; border-radius: 999px; background: var(--leon); color: #fff; font-size: .75rem; font-weight: 700; }
.avatar.is-alex { background: var(--alex); }
.avatar.is-team { background: #5d7385; }
.avatar.is-none { background: transparent; color: var(--faint); box-shadow: inset 0 0 0 1.5px var(--line-strong); }
.side .avatar.is-none { box-shadow: inset 0 0 0 1.5px var(--nav-faint); }
.avatar.is-small { width: 1.375rem; height: 1.375rem; font-size: .6875rem; }

.main { display: flex; flex-direction: column; min-width: 0; }
.topbar { position: sticky; top: 0; z-index: 10; display: flex; align-items: center; gap: .75rem; min-height: 3.5rem; padding: .625rem 1.5rem; border-bottom: 1px solid var(--line); background: rgba(255, 255, 255, .94); backdrop-filter: saturate(1.4) blur(8px); }
.topbar h1 { font: 700 1.25rem/1.2 var(--body); letter-spacing: -.02em; }
.fresh { border: 0; background: none; padding: .25rem .5rem; border-radius: 999px; color: var(--muted); font: 500 .8125rem/1.2 var(--body); font-variant-numeric: tabular-nums; cursor: pointer; white-space: nowrap; }
.fresh:hover, .fresh:focus-visible { background: var(--bg); color: var(--ink); }
.fresh.is-old { background: #fdecea; color: #a32a1f; }
.topbar-actions { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: .5rem; margin-left: auto; }
.menu-btn { display: none; margin-left: -.5rem; }
.view { display: grid; grid-template-columns: minmax(0, 1fr); align-content: start; gap: 1.25rem; padding: 1.25rem 1.5rem 4rem; min-width: 0; }
.view:focus { outline: none; }
.view.is-board { padding-right: 0; }
.view.is-board > :not(.board) { margin-right: 1.5rem; }

/* ---------- Bausteine ---------- */
.section { display: grid; grid-template-columns: minmax(0, 1fr); align-content: start; gap: .75rem; min-width: 0; }
.section-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: .5rem 1rem; }
.section-head h2 { font: 650 1rem/1.3 var(--body); letter-spacing: -.01em; }
.section-head .muted { font-size: .8125rem; }
.section-head .btn { margin-left: auto; }
.panel { border: 1px solid var(--line); border-radius: 12px; background: var(--paper); box-shadow: var(--shadow-1); min-width: 0; }
.panel-pad { padding: 1rem; }
.empty { padding: 1.25rem 1rem; color: var(--muted); font-size: .875rem; }
.empty strong { display: block; margin-bottom: .25rem; color: var(--ink); font-weight: 600; }
.note { color: var(--muted); font-size: .8125rem; line-height: 1.45; }
.error-text { color: var(--bad); font-size: .8125rem; }

/* Kennzahlen als Leiste: Geld links, Arbeit rechts, getrennt durch Linien statt Karten */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(10rem, 1fr)); border: 1px solid var(--line); border-radius: 12px; background: var(--paper); box-shadow: var(--shadow-1); overflow: hidden; }
.stat { display: grid; gap: .25rem; padding: .875rem 1.125rem 1rem; border-left: 1px solid var(--line); }
.stat:first-child { border-left: 0; }
.stat dt { display: flex; align-items: center; gap: .4375rem; color: var(--muted); font-size: .8125rem; font-weight: 500; }
.stat dt::before { content: ''; width: .5rem; height: .5rem; border-radius: 2px; background: var(--stat, var(--line-strong)); }
.stat dd { font-size: 1.625rem; font-weight: 700; letter-spacing: -.025em; line-height: 1.15; }
.stat dd small { color: var(--muted); font-size: .8125rem; font-weight: 500; letter-spacing: 0; }
.stat.is-pipe { --stat: #2f7be0; } .stat.is-forecast { --stat: #13a09a; } .stat.is-won { --stat: #2a9d62; } .stat.is-fresh { --stat: #7c5cd6; } .stat.is-calm { --stat: var(--line-strong); }
.stat.is-due { --stat: #e0922b; background: #fffaf0; }
.stat.is-due dd { color: var(--warn); }

/* Stufen: eigene Farbe und Fortschrittszeichen (Kreis füllt sich mit der Wahrscheinlichkeit) */
.tone-neu { --tone: #8597a8; --tone-wash: #eef2f5; --tone-ink: #3e5163; --fill: 0; }
.tone-kontaktiert { --tone: #7c5cd6; --tone-wash: #f1edfc; --tone-ink: #5233a8; --fill: .2; }
.tone-infos_fehlen { --tone: #e0922b; --tone-wash: #fdf2e0; --tone-ink: #8a5200; --fill: .4; }
.tone-zugesagt { --tone: #2f7be0; --tone-wash: #e6f0fd; --tone-ink: #1452a8; --fill: .6; }
.tone-zahlungsart { --tone: #13a09a; --tone-wash: #e0f5f3; --tone-ink: #0b6863; --fill: .85; }
.tone-einrichtung { --tone: #4f5bd5; --tone-wash: #eceefc; --tone-ink: #313caa; --fill: .95; }
.tone-aktiv { --tone: #2a9d62; --tone-wash: #e3f4ea; --tone-ink: #1d6b45; --fill: 1; }
.tone-kein_interesse { --tone: #b5605a; --tone-wash: #f8ecea; --tone-ink: #8a3b36; --fill: 1; }
.tone-feedback { --tone: #c2478b; --tone-wash: #fbebf3; --tone-ink: #962e68; --fill: 1; }
.tone-leon { --tone: var(--leon); --tone-wash: #e8f0fb; --tone-ink: #114a9f; }
.tone-alex { --tone: var(--alex); --tone-wash: #fbeee6; --tone-ink: #8f3d10; }
.tone-niemand { --tone: var(--line-strong); --tone-wash: #eef2f5; --tone-ink: var(--ink-2); }
.pill { display: inline-flex; align-items: center; gap: .375rem; max-width: 100%; padding: .1875rem .5rem .1875rem .375rem; border-radius: 6px; background: var(--tone-wash, var(--sunk)); color: var(--tone-ink, var(--ink-2));
  font-size: .75rem; font-weight: 600; line-height: 1.2; white-space: nowrap; }
.pill::before { content: ''; width: .6875rem; height: .6875rem; flex: none; border-radius: 999px; box-shadow: inset 0 0 0 1.5px var(--tone, var(--line-strong));
  background: conic-gradient(var(--tone, var(--line-strong)) calc(var(--fill, 0) * 1turn), transparent 0); }
.pill.is-neu::before { box-shadow: none; border: 1.5px dashed var(--tone); background: none; }
.pill.is-kein_interesse::before { background: linear-gradient(45deg, transparent 43%, #fff 43% 57%, transparent 57%), var(--tone); }
.pill.is-feedback::before { border-radius: 3px; }
.pill.is-neu { --tone: #8597a8; --tone-wash: #eef2f5; --tone-ink: #3e5163; --fill: 0; }
.pill.is-kontaktiert { --tone: #7c5cd6; --tone-wash: #f1edfc; --tone-ink: #5233a8; --fill: .2; }
.pill.is-infos_fehlen { --tone: #e0922b; --tone-wash: #fdf2e0; --tone-ink: #8a5200; --fill: .4; }
.pill.is-zugesagt { --tone: #2f7be0; --tone-wash: #e6f0fd; --tone-ink: #1452a8; --fill: .6; }
.pill.is-zahlungsart { --tone: #13a09a; --tone-wash: #e0f5f3; --tone-ink: #0b6863; --fill: .85; }
.pill.is-einrichtung { --tone: #4f5bd5; --tone-wash: #eceefc; --tone-ink: #313caa; --fill: .95; }
.pill.is-aktiv { --tone: #2a9d62; --tone-wash: #e3f4ea; --tone-ink: #1d6b45; --fill: 1; }
.pill.is-kein_interesse { --tone: #b5605a; --tone-wash: #f8ecea; --tone-ink: #8a3b36; --fill: 1; }
.pill.is-feedback { --tone: #c2478b; --tone-wash: #fbebf3; --tone-ink: #962e68; --fill: 1; }
.badge { display: inline-flex; align-items: center; gap: .25rem; padding: .125rem .4375rem; border-radius: 6px; background: var(--sunk); color: var(--muted); font-size: .75rem; font-weight: 500; white-space: nowrap; }
.badge.is-rule { background: #efeafc; color: #5233a8; }
.badge.is-late { background: var(--bad); color: #fff; font-weight: 600; }
.badge.is-today { background: #f6c560; color: #3b2400; font-weight: 600; }
.badge.is-warn { background: transparent; color: var(--warn); box-shadow: inset 0 0 0 1px #f0c47a; }
.badge.is-ok { background: var(--ok-wash); color: var(--ok); }
.badge .icon { width: .875rem; height: .875rem; }

/* ---------- Werkzeugleiste der Kontakte ---------- */
.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; }
.toolbar .search { flex: 1 1 16rem; max-width: 26rem; }
.toolbar .spacer { flex: 1; }
.seg { display: inline-flex; padding: .1875rem; border-radius: 9px; background: var(--sunk); box-shadow: inset 0 0 0 1px var(--line); }
.seg button { display: inline-flex; align-items: center; gap: .375rem; min-height: 1.875rem; padding: 0 .625rem; border: 0; border-radius: 7px; background: none; color: var(--muted); font-size: .8125rem; font-weight: 500; cursor: pointer; }
.seg button[aria-pressed="true"] { background: var(--paper); color: var(--ink); font-weight: 600; box-shadow: 0 1px 2px rgba(20, 43, 60, .14), 0 0 0 1px var(--line-2); }
.seg .icon { width: 1rem; height: 1rem; }
.chips { display: flex; flex-wrap: wrap; gap: .375rem; }
.chips:empty { display: none; }
.chip { display: inline-flex; align-items: center; gap: .25rem; min-height: 1.75rem; padding: 0 .25rem 0 .625rem; border: 1px solid var(--line-2); border-radius: 999px; background: var(--paper); font-size: .8125rem; }
.chip b { font-weight: 600; }
.chip button { display: inline-grid; place-items: center; width: 1.375rem; height: 1.375rem; padding: 0; border: 0; border-radius: 999px; background: none; color: var(--muted); cursor: pointer; }
.chip button:hover { background: var(--sunk); color: var(--ink); }
.chip button .icon { width: .875rem; height: .875rem; }
.chips .link-btn { border: 0; background: none; color: var(--accent); font-size: .8125rem; cursor: pointer; padding: 0 .25rem; }

/* Filterbereich */
.filters { display: grid; grid-template-columns: repeat(auto-fill, minmax(13.5rem, 1fr)); gap: 1rem 1.25rem; padding: 1rem; border: 1px solid var(--line); border-radius: 12px; background: var(--paper); box-shadow: var(--shadow-1); }
.filters .wide { grid-column: 1 / -1; }
fieldset.fgroup { margin: 0; padding: 0; border: 0; }
fieldset.fgroup > legend { padding: 0; margin-bottom: .375rem; }
.fgroup { display: grid; gap: .375rem; align-content: start; min-width: 0; }
.fgroup > .flabel { color: var(--muted); font-size: .75rem; font-weight: 600; }
.toggles { display: flex; flex-wrap: wrap; gap: .3125rem; }
.toggle { display: inline-flex; align-items: center; gap: .375rem; min-height: 1.875rem; padding: 0 .625rem; border: 1px solid var(--line-2); border-radius: 999px; background: var(--paper); font-size: .8125rem; cursor: pointer; user-select: none; }
.toggle input { position: absolute; opacity: 0; pointer-events: none; }
.toggle[class*="tone-"]::before { content: ''; width: .5rem; height: .5rem; border-radius: 999px; background: var(--tone); }
.toggle[class*="tone-"]:has(input:checked) { border-color: var(--tone); background: var(--tone-wash); color: var(--tone-ink); }
.toggle:hover { border-color: var(--line-strong); }
.toggle:has(input:checked) { border-color: var(--accent); background: var(--accent-wash); color: var(--accent-deep); font-weight: 500; }
.toggle:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: 2px; }
.range { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); align-items: center; gap: .375rem; }
.range .input { min-width: 0; width: 100%; }
@media (min-width: 640px) { .filters .span-2 { grid-column: span 2; } }
.filters-foot { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; padding-top: .25rem; border-top: 1px solid var(--line); }
.filters-foot .note { margin-right: auto; }

/* ---------- Tabelle ---------- */
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 12px; background: var(--paper); box-shadow: var(--shadow-1); }
.table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: .875rem; }
.table th { position: sticky; top: 0; z-index: 1; padding: .5rem .75rem; border-bottom: 1px solid var(--line); background: var(--canvas); color: var(--ink-2); font-size: .75rem; font-weight: 650; text-align: left; white-space: nowrap; }
.table th button { display: inline-flex; align-items: center; gap: .25rem; padding: 0; border: 0; background: none; color: inherit; font: inherit; cursor: pointer; }
.table th button:hover { color: var(--ink); }
.table th[aria-sort] { color: var(--ink); }
.table td { padding: .5625rem .75rem; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr { cursor: pointer; }
@media (hover: hover) { .table tbody tr:hover td { background: #f8fafc; } }
.table tbody tr.is-open td { background: var(--accent-wash); }
.table .right { text-align: right; }
.table td.right { font-weight: 600; color: var(--ink); }
.table .cell-name { min-width: 12rem; }
.cell-name .row-btn { display: block; padding: 0; border: 0; background: none; color: var(--ink); font: 650 .9375rem/1.3 var(--body); text-align: left; cursor: pointer; }
.cell-name .row-btn:hover { color: var(--accent); }
.cell-name small { display: block; color: var(--muted); font-size: .8125rem; }
.cell-muted { color: var(--muted); white-space: nowrap; }
.owner { display: inline-flex; align-items: center; gap: .375rem; white-space: nowrap; }
/* Direkt in der Liste bearbeiten: die Zelle zeigt beim Darüberfahren einen Rahmen und einen Pfeil */
.table td.is-edit { cursor: default; }
.inline-pick { position: relative; display: inline-flex; align-items: center; gap: .25rem; max-width: 100%; margin: -.25rem -.375rem; padding: .25rem .375rem; border-radius: 7px; }
.inline-pick > .icon { width: .875rem; height: .875rem; color: var(--faint); opacity: 0; transition: opacity .12s var(--ease); }
.inline-pick:hover, .inline-pick:has(select:focus-visible) { background: var(--paper); box-shadow: inset 0 0 0 1px var(--line-2); }
.inline-pick:hover > .icon, .inline-pick:has(select:focus-visible) > .icon { opacity: 1; }
.inline-pick:has(select:focus-visible) { outline: 2px solid var(--accent); outline-offset: 1px; }
.inline-select { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; font-size: 1rem; }
.inline-pick.is-busy, .inline-input:disabled { opacity: .5; pointer-events: none; }
.inline-num { min-width: 3rem; margin: -.25rem -.375rem; padding: .25rem .375rem; border: 0; border-radius: 7px; background: none; color: inherit; font: inherit; text-align: inherit; cursor: text; }
.inline-num:hover { background: var(--paper); box-shadow: inset 0 0 0 1px var(--line-2); }
.table .inline-input { width: 6rem; min-height: 2rem; margin: -.3125rem 0; padding: .25rem .5rem; text-align: right; }
.table .cell-pick { width: 2.5rem; padding-right: 0; }
.table tbody tr.is-picked td { background: #f2f7fd; }
.check { width: 1rem; height: 1rem; margin: 0; cursor: pointer; }

/* Leiste für die Auswahl: klebt unten, solange etwas ausgewählt ist */
.list-box { display: grid; gap: .75rem; }
.bulkbar { position: sticky; bottom: 1rem; z-index: 6; display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; padding: .625rem .75rem; border-radius: 12px; background: var(--nav); color: #fff; box-shadow: var(--shadow-pop); }
.bulkbar .bulk-n { margin-right: .25rem; font-size: .875rem; white-space: nowrap; }
.bulkbar .select, .bulkbar .input { min-height: 2.25rem; border-color: var(--nav-2); color: var(--ink); }
.bulkbar .btn:not(.btn-quiet) { color: var(--ink); }
body:has(.bulkbar:not([hidden])) .toast { bottom: 5.5rem; }
.bulk-task { display: flex; flex: 1 1 14rem; gap: .375rem; min-width: 0; }
.bulk-task .input:first-child { flex: 1 1 auto; min-width: 8rem; }
.bulk-task .input[type="date"] { width: auto; }
.bulkbar .btn-quiet { color: var(--nav-ink); }
.bulkbar .btn-quiet:hover { background: var(--nav-2); color: #fff; }
.bulkbar .btn.btn-bulk-danger { color: var(--bad); }
.bulkbar > .select { width: auto; max-width: 11rem; min-width: 0; }
.bulk-task .btn { flex: none; }
.bulkbar > .bulk-task { min-width: max-content; }
.bulk-actions { display: flex; flex: none; align-items: center; gap: .5rem; margin-left: auto; }
.pop-names { color: var(--ink); }
.pill-archiv { background: var(--sunk); color: var(--muted); }
.archived-note { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem .75rem; margin: 0 0 1rem; padding: .625rem .75rem; border-radius: 8px; background: var(--sunk); color: var(--ink); font-size: .875rem; }
.archived-note > span { flex: 1 1 16rem; }
.archived-note .icon { color: var(--muted); }
.rows .row.is-archived { opacity: .6; }
/* Oben rechts: Aufgaben und Glocke, mit Zähler */
.topbar-icons { display: flex; align-items: center; gap: .25rem; }
.top-icon { position: relative; width: 2.375rem; height: 2.375rem; color: var(--ink-2); text-decoration: none; }
.top-icon .icon { width: 1.25rem; height: 1.25rem; }
.top-icon[aria-expanded="true"] { background: var(--sunk); color: var(--ink); }
.top-count { position: absolute; top: .125rem; right: .0625rem; min-width: 1.125rem; height: 1.125rem; padding: 0 .3125rem; border-radius: 999px; background: #f2b04a; color: #3b2400;
  font-size: .6875rem; font-weight: 700; line-height: 1.125rem; text-align: center; box-shadow: 0 0 0 2px var(--paper); }
.top-count.is-alert { background: var(--bad); color: #fff; }

/* Fenster mit den Benachrichtigungen */
.pop.is-notes { width: min(calc(100vw - 1rem), 25rem); max-height: min(36rem, calc(100vh - 5rem)); padding: 0; gap: 0; overflow: hidden; display: flex; flex-direction: column; }
.notes-head { display: flex; align-items: center; justify-content: space-between; gap: .5rem; padding: .625rem .625rem .625rem 1rem; border-bottom: 1px solid var(--line); }
.notes-head h3 { font-size: .9375rem; font-weight: 650; }
.notes { overflow-y: auto; padding: .25rem; overscroll-behavior: contain; }
.notes .note { padding: 1rem; }
.notice { display: grid; grid-template-columns: 2rem minmax(0, 1fr); gap: .625rem; width: 100%; padding: .625rem .75rem; border: 0; border-radius: 8px; background: none; color: var(--ink); font: inherit; text-align: left; cursor: pointer; }
.notice:hover { background: var(--canvas); }
.notice:disabled { cursor: default; }
.notice.is-unread { background: var(--accent-wash); }
.notice.is-unread:hover { background: #dfeaf8; }
.notice-icon { display: grid; place-items: center; width: 2rem; height: 2rem; border-radius: 999px; background: var(--sunk); color: var(--muted); }
.notice-icon .icon { width: 1rem; height: 1rem; }
.notice.is-new .notice-icon { background: #f1edfc; color: #5233a8; }
.notice.is-good .notice-icon { background: var(--ok-wash); color: var(--ok); }
.notice.is-warn .notice-icon { background: var(--warn-wash); color: var(--warn); }
.notice.is-bad .notice-icon { background: var(--bad-wash); color: var(--bad); }
.notice.is-task .notice-icon { background: var(--accent-wash); color: var(--accent-deep); }
.notice-body { display: grid; gap: .0625rem; min-width: 0; font-size: .8125rem; line-height: 1.35; }
.notice-body strong { font-size: .875rem; font-weight: 600; }
.notice-who { color: var(--ink-2); }
.notice-text { overflow: hidden; color: var(--muted); text-overflow: ellipsis; white-space: nowrap; }
.notice-when { color: var(--faint); font-size: .75rem; }
.table-foot { display: flex; justify-content: space-between; gap: 1rem; padding: .625rem .75rem; border-top: 1px solid var(--line); color: var(--muted); font-size: .8125rem; }

/* ---------- Board ---------- */
.board { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(16.5rem, 18rem); gap: .75rem; overflow-x: auto; padding: 0 1.5rem 1rem 0; scroll-snap-type: x proximity; align-items: start; }
.col { display: flex; flex-direction: column; min-height: 12rem; max-height: calc(100vh - 13rem); border-radius: 12px; background: var(--sunk); scroll-snap-align: start; transition: box-shadow .15s var(--ease); overflow: hidden; }
.col.is-over { box-shadow: inset 0 0 0 2px var(--accent); background: var(--accent-wash); }
.col-head { display: grid; gap: .1875rem; padding: .75rem .875rem .625rem; border-top: 3px solid var(--tone, var(--line-strong)); background: var(--tone-wash, var(--canvas)); }
.col-title { display: flex; align-items: center; gap: .5rem; font-size: .8125rem; font-weight: 600; }
.col-title .n { margin-left: auto; min-width: 1.5rem; padding: .0625rem .4375rem; border-radius: 999px; background: var(--paper); color: var(--tone-ink, var(--ink-2)); font-size: .75rem; font-weight: 700; text-align: center; }
.col-sum { color: var(--tone-ink, var(--muted)); font-size: .75rem; font-weight: 500; opacity: .85; }
.col-cards { display: grid; grid-template-columns: minmax(0, 1fr); gap: .5rem; padding: .625rem .5rem .75rem; overflow-y: auto; }
.card { position: relative; display: grid; min-width: 0; gap: .375rem; padding: .625rem .75rem; border: 1px solid var(--line); border-radius: 10px; background: var(--paper); box-shadow: var(--shadow-1);
  cursor: grab; transition: border-color .15s var(--ease), box-shadow .15s var(--ease), opacity .15s var(--ease); }
.card:hover { border-color: var(--line-2); box-shadow: var(--shadow-2); }
.card.is-dragging { opacity: .45; }
.card.is-busy { opacity: .6; pointer-events: none; }
.card-name { padding: 0; border: 0; background: none; color: var(--ink); font: 650 .9375rem/1.3 var(--body); text-align: left; cursor: pointer; }
.card-name::after { content: ''; position: absolute; inset: 0; }
.card-name:focus-visible { outline: none; }
.card:has(.card-name:focus-visible) { outline: 2px solid var(--accent); outline-offset: 2px; }
.card-sub { color: var(--muted); font-size: .8125rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.card-foot { display: flex; align-items: center; gap: .375rem; min-width: 0; font-size: .75rem; }
.card-foot .value { margin-right: auto; color: var(--ink); font-size: .8125rem; font-weight: 700; }
.card-move-wrap { position: relative; z-index: 1; display: inline-grid; place-items: center; flex: none; width: 1.75rem; height: 1.75rem; border: 1px solid transparent; border-radius: 6px; color: var(--muted); }
.card-move-wrap:hover, .card-move-wrap:has(select:focus-visible) { border-color: var(--line-2); background: var(--paper); color: var(--ink); }
.card-move-wrap:has(select:focus-visible) { outline: 2px solid var(--accent); outline-offset: 1px; }
.card-move-wrap .icon { width: 1rem; height: 1rem; pointer-events: none; }
.card-move { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; font-size: 1rem; }
.col-more { padding: .25rem .875rem .75rem; color: var(--muted); font-size: .75rem; }

/* ---------- Listen (Heute, Aufgaben) ---------- */
.rows { display: grid; }
.row { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: .25rem .75rem; padding: .625rem .875rem; border-bottom: 1px solid var(--line); }
.row:last-child { border-bottom: 0; }
.row-main { display: grid; gap: .125rem; min-width: 0; }
.row-title { font-weight: 500; }
.row-title.is-done { color: var(--faint); text-decoration: line-through; }
.row-meta { display: flex; flex-wrap: wrap; align-items: center; gap: .25rem .625rem; color: var(--muted); font-size: .8125rem; }
.row-meta .link { padding: 0; border: 0; background: none; color: var(--accent); font-size: .8125rem; cursor: pointer; text-align: left; }
.row-meta .link:hover { text-decoration: underline; }
.row-side { display: flex; align-items: center; gap: .375rem; }
.check { width: 1.125rem; height: 1.125rem; margin: 0; cursor: pointer; }
.group-title { display: flex; align-items: center; gap: .5rem; padding: .5rem .875rem; color: var(--ink-2); font-size: .8125rem; font-weight: 650; border-bottom: 1px solid var(--line); background: var(--canvas); }
.group-title::before { content: ''; width: .5rem; height: .5rem; border-radius: 999px; background: var(--g, var(--line-strong)); }
.group-title .n { color: var(--muted); font-weight: 500; }
.group-title.is-late { --g: var(--bad); background: var(--bad-wash); color: var(--bad); }
.group-title.is-today { --g: #e0922b; background: #fdf4e3; color: var(--warn); }
.group-title.is-week { --g: #2f7be0; }
.panel > .group-title:first-child { border-radius: 12px 12px 0 0; }
.grid-2 { display: grid; gap: 1.25rem; grid-template-columns: minmax(0, 1fr); }
@media (min-width: 1100px) { .grid-2 { grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); } }

/* ---------- Seitenpanel (Kontakt, Praxis) ---------- */
.scrim { position: fixed; inset: 0; z-index: 30; background: rgba(20, 43, 60, .28); animation: fade .2s var(--ease); }
.drawer { position: fixed; top: 0; right: 0; bottom: 0; z-index: 31; display: flex; flex-direction: column; width: min(100%, var(--drawer-w, 56rem)); background: var(--paper); box-shadow: var(--shadow-pop);
  animation: slide .22s var(--ease); }
.drawer.is-full { width: 100%; box-shadow: none; }
.drawer.is-full .drawer-head, .drawer.is-full .drawer-body { padding-inline: max(1.25rem, calc((100% - 92rem) / 2)); }
.drawer.is-full .drawer-resize { display: none; }
#d-full[aria-pressed="true"] { color: var(--accent); }

/* Ziehgriffe: Seitenleiste rechts, Panel links. Ein Strich zeigt beim Darüberfahren, dass sich die Breite ziehen lässt. */
.side-resize, .drawer-resize { position: fixed; top: 0; bottom: 0; z-index: 12; width: 9px; cursor: col-resize; touch-action: none; }
.side-resize { left: calc(var(--side-w) - 4px); }
.drawer-resize { position: absolute; left: -4px; z-index: 2; }
.side-resize::after, .drawer-resize::after { content: ''; position: absolute; top: 0; bottom: 0; left: 3px; width: 3px; border-radius: 2px; background: transparent; transition: background-color .15s var(--ease); }
.side-resize:hover::after, .drawer-resize:hover::after, .side-resize:focus-visible::after, .drawer-resize:focus-visible::after, .is-resizing .side-resize::after, .is-resizing .drawer-resize::after { background: var(--accent); }
.side-resize:focus-visible, .drawer-resize:focus-visible { outline: none; }
body.is-resizing { cursor: col-resize; user-select: none; -webkit-user-select: none; }
body.is-resizing .drawer { animation: none; }
@keyframes slide { from { transform: translateX(2rem); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .drawer, .scrim { animation: none; } }
.drawer-head { display: flex; align-items: flex-start; gap: .75rem; padding: 1.125rem 1.25rem 1rem; border-bottom: 1px solid var(--line); background: var(--canvas); }
.drawer-titles { display: grid; gap: .25rem; min-width: 0; flex: 1; }
.drawer-titles h2 { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; font: 700 1.375rem/1.25 var(--body); letter-spacing: -.02em; }
.drawer-titles .muted { font-size: .8125rem; }
.drawer-body { flex: 1; overflow-y: auto; padding: 1rem 1.25rem 3rem; container-type: inline-size; }
.quick { display: flex; flex-wrap: wrap; gap: .375rem; margin-bottom: 1rem; }
.record { display: grid; gap: 1.5rem; grid-template-columns: minmax(0, 1fr); }
@container (min-width: 44rem) { .record { grid-template-columns: minmax(15rem, 19rem) minmax(0, 1fr); align-items: start; } .record-side { position: sticky; top: 0; } }
@container (min-width: 70rem) { .record { grid-template-columns: minmax(18rem, 23rem) minmax(0, 1fr); gap: 2rem; } }

/* Kurzüberblick oben im Kontakt: die fünf Dinge, die man beim Öffnen wissen will */
.keyfacts { display: grid; grid-template-columns: repeat(auto-fit, minmax(9.5rem, 1fr)); margin: 0 0 1.25rem; border: 1px solid var(--line); border-radius: 12px; background: var(--paper); box-shadow: var(--shadow-1); overflow: hidden; }
.keyfact { display: grid; align-content: start; gap: .3125rem; min-width: 0; padding: .6875rem .875rem .75rem; border-left: 1px solid var(--line); margin-left: -1px; }
.keyfact dt { color: var(--muted); font-size: .75rem; font-weight: 500; }
.keyfact dd { display: flex; flex-wrap: wrap; align-items: center; gap: .375rem; min-width: 0; font-size: .9375rem; font-weight: 600; line-height: 1.3; }
.keyfact dd .muted { font-weight: 500; }
.keyfact .clip { min-width: 0; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.keyfact button.link-plain { color: var(--ink); font-weight: 600; }
.keyfact button.link-plain:hover { color: var(--accent); }

/* Reiter im Kontakt: Verlauf, Aufgaben, Dokumente */
.tabs { display: flex; gap: 1.25rem; margin-bottom: .25rem; border-bottom: 1px solid var(--line); overflow-x: auto; scrollbar-width: none; }
.tabs button { display: inline-flex; align-items: center; gap: .375rem; flex: none; margin-bottom: -1px; padding: .5rem 0 .625rem; border: 0; border-bottom: 2px solid transparent; background: none; color: var(--muted); font-size: .875rem; font-weight: 500; cursor: pointer; }
.tabs button:hover { color: var(--ink); }
.tabs button[aria-selected="true"] { border-bottom-color: var(--accent); color: var(--ink); font-weight: 650; }
.tab-n { min-width: 1.25rem; padding: .0625rem .375rem; border-radius: 999px; background: var(--sunk); color: var(--muted); font-size: .75rem; font-weight: 600; text-align: center; }
.tabs button[aria-selected="true"] .tab-n { background: var(--accent-wash); color: var(--accent-deep); }
.tab-n.is-due { background: #f6c560; color: #3b2400; }
.tabpanel > .section > .subhead { display: none; }
.record-side, .record-main { display: grid; gap: 1.25rem; min-width: 0; align-content: start; }
.record-side { padding: 1rem; border-radius: 12px; background: var(--canvas); box-shadow: inset 0 0 0 1px var(--line); }
.props { display: grid; gap: .75rem; }
.props-2 { display: grid; grid-template-columns: 1fr 1fr; gap: .75rem; }
.facts { display: grid; grid-template-columns: 6rem minmax(0, 1fr); gap: .4375rem .75rem; font-size: .875rem; }
.facts dt { color: var(--muted); font-size: .8125rem; padding-top: .0625rem; }
.facts dd { min-width: 0; overflow-wrap: break-word; }
.subhead { display: flex; align-items: center; gap: .5rem; font-size: .9375rem; font-weight: 650; color: var(--ink); }
.subhead .btn { margin-left: auto; }
.link-plain { padding: 0; border: 0; background: none; font: inherit; text-align: left; color: var(--accent); cursor: pointer; }
.link-plain.row-title { color: var(--ink); font-weight: 600; }
.link-plain.row-title:hover { color: var(--accent); }
.hint { color: var(--muted); font-size: .75rem; line-height: 1.4; }

.composer { display: grid; gap: .625rem; padding: .875rem; border: 1px solid var(--line-2); border-radius: 12px; background: var(--paper); box-shadow: var(--shadow-1); }
.composer .seg { justify-self: start; background: var(--paper); box-shadow: inset 0 0 0 1px var(--line); }
.composer .seg button[aria-pressed="true"] { background: var(--accent-wash); color: var(--accent-deep); box-shadow: none; }
.composer-row { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }
.composer-row .select { flex: 0 1 auto; }
.composer-row .btn-primary { margin-left: auto; }

.timeline { position: relative; display: grid; gap: 0; }
.ev { position: relative; display: grid; grid-template-columns: 1.75rem minmax(0, 1fr); gap: .625rem; padding-bottom: .875rem; }
.ev::before { content: ''; position: absolute; left: .8125rem; top: 1.75rem; bottom: 0; width: 1px; background: var(--line); }
.ev:last-child::before { display: none; }
.ev-dot { display: grid; place-items: center; width: 1.75rem; height: 1.75rem; border-radius: 999px; background: var(--sunk); color: var(--muted); }
.ev-dot .icon { width: .9375rem; height: .9375rem; }
.ev.is-i-phone .ev-dot { background: #e3f4ea; color: #1d6b45; }
.ev.is-i-chat .ev-dot, .ev.is-i-mail .ev-dot { background: #e6f0fd; color: #1452a8; }
.ev.is-i-people .ev-dot { background: #f1edfc; color: #5233a8; }
.ev.is-i-file .ev-dot { background: #fdf2e0; color: #8a5200; }
.ev.is-i-check .ev-dot { background: #e0f5f3; color: #0b6863; }
.ev.is-i-board .ev-dot { background: #eef2f5; color: #3e5163; box-shadow: inset 0 0 0 1px var(--line-2); }
.ev.is-team .ev-dot { box-shadow: 0 0 0 2px var(--paper), 0 0 0 3px currentColor; }
.ev-body { display: grid; gap: .1875rem; min-width: 0; padding-top: .25rem; }
.ev-head { display: flex; flex-wrap: wrap; gap: .25rem .5rem; align-items: baseline; font-size: .8125rem; }
.ev-head strong { font-weight: 600; color: var(--ink); }
.ev-head span { color: var(--muted); }
.ev-text { font-size: .875rem; white-space: pre-wrap; overflow-wrap: anywhere; }
.ev.is-team .ev-text { padding: .5rem .625rem; border-radius: 8px; background: var(--canvas); }

.docs { display: grid; gap: .375rem; }
.doc { display: flex; align-items: center; gap: .625rem; padding: .5rem .625rem; border: 1px solid var(--line); border-radius: 8px; font-size: .875rem; }
.doc .icon { color: var(--muted); }
.doc a { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; }
.doc .muted { font-size: .75rem; white-space: nowrap; }
.doc .icon-btn { margin-left: auto; width: 1.875rem; height: 1.875rem; }
.doc.is-deleted { color: var(--faint); }
.drop { display: grid; place-items: center; gap: .25rem; padding: .875rem; border: 1.5px dashed var(--line-2); border-radius: 10px; color: var(--muted); font-size: .8125rem; text-align: center; cursor: pointer; }
.drop:hover, .drop.is-over { border-color: var(--accent); background: var(--accent-wash); color: var(--accent-deep); }
.progress { height: .25rem; border-radius: 999px; background: var(--sunk); overflow: hidden; }
.progress > span { display: block; height: 100%; width: 0; background: var(--accent); transition: width .2s var(--ease); }

.tasklist { display: grid; gap: .25rem; }
.task { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: .5rem; align-items: start; padding: .375rem 0; font-size: .875rem; }
.task .check { margin-top: .125rem; }
.task-meta { display: flex; flex-wrap: wrap; gap: .25rem .5rem; margin-top: .125rem; color: var(--muted); font-size: .75rem; }
.task-form { display: grid; grid-template-columns: minmax(0, 1fr) auto auto auto; gap: .375rem; }
@media (max-width: 640px) { .task-form { grid-template-columns: 1fr 1fr; } .task-form .input:first-child { grid-column: 1 / -1; } }

/* ---------- Popover (Spalten, Ansicht speichern) ---------- */
.pop { position: fixed; z-index: 40; display: grid; gap: .75rem; width: min(calc(100vw - 2rem), 20rem); padding: .875rem; border: 1px solid var(--line); border-radius: 12px; background: var(--paper); box-shadow: var(--shadow-pop); }
.pop h3 { font-size: .875rem; font-weight: 600; }
.pop .checks { display: grid; gap: .25rem; }
.pop .checks label { display: flex; align-items: center; gap: .5rem; padding: .25rem 0; font-size: .875rem; cursor: pointer; }
.pop-actions { display: flex; flex-wrap: wrap; gap: .5rem; justify-content: flex-end; }

/* ---------- Hinweis unten ---------- */
.toast { position: fixed; left: 50%; bottom: 1.25rem; z-index: 50; transform: translateX(-50%); max-width: calc(100vw - 2rem); padding: .625rem 1rem; border-radius: 10px; background: var(--ink); color: #fff; font-size: .875rem; box-shadow: var(--shadow-pop); animation: fade .15s var(--ease); }
.toast.is-error { background: var(--bad); }

/* ---------- Sicherheit, Quellen ---------- */
.kv { display: grid; grid-template-columns: repeat(auto-fill, minmax(15rem, 1fr)); gap: .75rem; }
.kv .panel { display: grid; align-content: start; gap: .375rem; padding: .875rem 1rem; }
.kv strong { font-size: .875rem; }
.link-builder { display: grid; gap: .625rem; grid-template-columns: minmax(0, 13rem) minmax(0, 14rem) minmax(0, 1fr) auto; align-items: end; }
.link-builder + .hint { margin-top: .625rem; }
.link-out { padding: .5rem .625rem; border-radius: 8px; background: var(--canvas); font-size: .8125rem; overflow-wrap: anywhere; }
@media (max-width: 760px) { .link-builder { grid-template-columns: 1fr 1fr; } .link-out, .link-builder .btn { grid-column: 1 / -1; } }

/* ---------- Schmal: Seitenleiste als Schublade, Tabelle als Liste ---------- */
@media (max-width: 960px) {
  .side-resize { display: none; }
  .app { grid-template-columns: minmax(0, 1fr); }
  .side { position: fixed; z-index: 35; left: 0; width: min(80vw, 17rem); transform: translateX(-102%); visibility: hidden; transition: transform .22s var(--ease), visibility 0s .22s; }
  .app.is-menu .side { transform: none; visibility: visible; transition: transform .22s var(--ease); box-shadow: var(--shadow-pop); }
  .menu-btn { display: inline-grid; }
  .topbar { padding: .5rem 1rem; }
  .view { padding: 1rem 1rem 4rem; }
  .board { padding-right: 1rem; }
}
@media (max-width: 720px) {
  .drawer-resize, #d-full { display: none; }
  .topbar-icons { order: 2; }
  .topbar-actions { order: 3; }
  .table .cell-pick, .table th.cell-pick { display: none; }
  .topbar-actions .btn:has(.icon) > span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
  .topbar-actions .btn:has(.icon) { padding-inline: .5rem; }
  .topbar { flex-wrap: wrap; }
  .topbar h1 { flex: 1 1 auto; min-width: 0; }
  .view.is-board > :not(.board) { margin-right: 1rem; }
  .topbar-actions { width: 100%; justify-content: flex-start; margin-left: 0; }
  .table thead { display: none; }
  .table, .table tbody, .table tr, .table td { display: block; }
  .table tr { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: .25rem .75rem; padding: .75rem; border-bottom: 1px solid var(--line); }
  .table td { padding: 0; border: 0; }
  .table td.cell-name { grid-column: 1; min-width: 0; }
  .table td[data-col="status"] { grid-column: 2; grid-row: 1; justify-self: end; }
  .table td:not(.cell-name):not([data-col="status"]) { grid-column: 1 / -1; color: var(--muted); font-size: .8125rem; }
  .table td:not(.cell-name):not([data-col="status"]):empty { display: none; }
  .table td[data-label]:not(:empty)::before { content: attr(data-label) ': '; color: var(--faint); }
  .table .right { text-align: left; }
  .facts { grid-template-columns: 6.5rem minmax(0, 1fr); }
  .drawer-body { padding: 1rem 1rem 3rem; }
  .board { grid-auto-columns: minmax(80vw, 1fr); }
  .col { max-height: none; }
  .stats { gap: .5rem 1.25rem; }
}

/* ---------- Klick auf eine Zahl: gefilterte Liste ---------- */
.stat.is-click { position: relative; transition: background-color .12s ease; }
.stat.is-click:hover { background: var(--accent-wash, #f3f7fd); }
.stat.is-due.is-click:hover { background: #fff3dc; }
.stat-link { color: inherit; text-decoration: none; }
.stat-link::after { content: ''; position: absolute; inset: 0; }
.stat-link:focus-visible { outline: none; }
.stat.is-click:has(.stat-link:focus-visible) { box-shadow: inset 0 0 0 2px var(--accent, #2f7be0); }
.stat-go { margin-left: auto; color: var(--muted); font-size: 1rem; line-height: 1; opacity: 0; transition: opacity .12s ease, transform .12s ease; }
.stat.is-click:hover .stat-go, .stat.is-click:has(.stat-link:focus-visible) .stat-go { opacity: 1; transform: translateX(2px); }
a.drill { color: inherit; text-decoration: none; border-radius: 4px; }
a.drill:hover { color: var(--accent, #2f7be0); text-decoration: underline; text-underline-offset: 2px; }
a.drill:focus-visible { outline: 2px solid var(--accent, #2f7be0); outline-offset: 2px; }
.col-title a.drill { display: flex; flex: 1; align-items: center; gap: .5rem; min-width: 0; }
.col-title a.drill:hover { text-decoration: none; }
.col-title a.drill:hover .pill, .col-title a.drill:hover > span:first-child { box-shadow: 0 0 0 2px var(--paper), 0 0 0 3px currentColor; }
.col-more a.drill { display: block; }
td.num a.drill { display: block; margin: -.25rem -.375rem; padding: .25rem .375rem; }
td.num a.drill:hover { background: var(--accent-wash, #f3f7fd); text-decoration: none; }
@media (hover: none) { .stat-go { opacity: 1; } }

/* ---------- Kontakt löschen ---------- */
.danger-zone { padding-top: .5rem; border-top: 1px dashed var(--line); }
.pop.is-danger { width: min(26rem, calc(100vw - 1rem)); }
.pop.is-danger h3 { color: var(--bad); }
.check-line { display: flex; align-items: flex-start; gap: .5rem; margin: .5rem 0; font-size: .875rem; line-height: 1.4; cursor: pointer; }
.check-line input { margin-top: .2rem; flex: none; width: 1rem; height: 1rem; accent-color: var(--bad); }
.btn-danger-solid { border-color: var(--bad); background: var(--bad); color: #fff; }
.btn-danger-solid:hover { filter: brightness(.92); }
.btn-danger-solid:disabled { opacity: .5; cursor: default; filter: none; }
@media (max-width: 640px) {
  .bulkbar > .bulk-task { flex-basis: 100%; min-width: 0; }
  .bulk-task .input:first-child { min-width: 0; }
  .bulk-task .input[type="date"] { width: 8.5rem; min-width: 0; }
  .bulkbar > .select { max-width: none; flex: 1 1 8rem; }
  .bulk-actions { flex: 1 1 100%; }
}

/* ---------- Tickets (crm-tickets.js) ----------
   Eigene Statusfarben, damit Tickets nie mit den Stufen der Pipeline verwechselt werden: Neu gestrichelt, dann
   Violett (in Kontakt), Blau (geplant), Gelb (in Bearbeitung), Grün (erledigt), Grau durchgestrichen (abgelehnt). */
.tpill { display: inline-flex; align-items: center; gap: .375rem; max-width: 100%; padding: .1875rem .5rem .1875rem .375rem; border-radius: 6px; background: var(--tone-wash, var(--sunk)); color: var(--tone-ink, var(--ink-2));
  font-size: .75rem; font-weight: 600; line-height: 1.2; white-space: nowrap; }
.tpill::before { content: ''; width: .6875rem; height: .6875rem; flex: none; border-radius: 3px; background: var(--tone); }
.tpill.is-neu::before, .tstep.is-neu .tstep-dot { background: none; border: 1.5px dashed var(--tone); }
.tpill.is-abgelehnt::before { background: linear-gradient(45deg, transparent 43%, #fff 43% 57%, transparent 57%), var(--tone); }
.is-neu, .ttone-neu { --tone: #8597a8; --tone-wash: #eef2f5; --tone-ink: #3e5163; }
.is-in_kontakt, .ttone-in_kontakt { --tone: #7c5cd6; --tone-wash: #f1edfc; --tone-ink: #5233a8; }
.is-geplant, .ttone-geplant { --tone: #2f7be0; --tone-wash: #e6f0fd; --tone-ink: #1452a8; }
.is-in_bearbeitung, .ttone-in_bearbeitung { --tone: #e0922b; --tone-wash: #fdf2e0; --tone-ink: #8a5200; }
.is-erledigt, .ttone-erledigt { --tone: #2a9d62; --tone-wash: #e3f4ea; --tone-ink: #1d6b45; }
.is-abgelehnt, .ttone-abgelehnt { --tone: #9aa7b2; --tone-wash: #f0f2f4; --tone-ink: #566a79; }
.tickets-bar { margin-bottom: .75rem; }
.tickets-bar .select { flex: 0 1 auto; width: auto; max-width: 11rem; }
.tickets-bar .search { flex: 1 1 14rem; }
.tickets-bar .btn.is-on { background: var(--accent-wash); color: var(--accent-deep); }
.tickets-sum { margin: 0 0 .75rem; font-size: .8125rem; }
.tboard { grid-auto-columns: minmax(15.5rem, 17rem); }
.tcard-top { display: flex; align-items: center; gap: .375rem; font-size: .75rem; }
.tnum { color: var(--muted); font-size: .75rem; font-weight: 650; letter-spacing: .01em; font-variant-numeric: tabular-nums; white-space: nowrap; }
.tnum.is-big { font-size: .9375rem; color: var(--faint); }
.tsrc { display: inline-grid; place-items: center; color: var(--faint); }
.tsrc .icon { width: .875rem; height: .875rem; }
.tcard .card-name { font-size: .875rem; font-weight: 600; }
.tcard .grow { flex: 1; }
.tcard .card-foot { flex-wrap: wrap; row-gap: .375rem; }
.record-side .rows .row-title { font-size: .875rem; }
.badge.prio.is-hoch { background: var(--bad-wash); color: var(--bad); font-weight: 650; }
.badge.prio.is-niedrig { background: transparent; color: var(--faint); box-shadow: inset 0 0 0 1px var(--line-2); }
.badge.is-merged { background: #efeafc; color: #5233a8; }
#d-title .tnum { margin-right: .25rem; }
.tsteps { display: flex; flex-wrap: wrap; gap: .375rem; margin-bottom: 1rem; }
.tstep { display: inline-flex; align-items: center; gap: .4375rem; min-height: 2.125rem; padding: 0 .75rem; border: 1px solid var(--line-2); border-radius: 999px; background: var(--paper); color: var(--ink-2); font-size: .8125rem; font-weight: 550; cursor: pointer; }
.tstep:hover:not(:disabled) { border-color: var(--tone); background: var(--tone-wash); }
.tstep[aria-pressed="true"] { border-color: var(--tone); background: var(--tone-wash); color: var(--tone-ink); font-weight: 700; box-shadow: inset 0 0 0 1px var(--tone); }
.tstep:disabled { cursor: not-allowed; opacity: .55; }
.tstep-dot { width: .6875rem; height: .6875rem; border-radius: 3px; background: var(--tone); }
.tnote { margin: -.25rem 0 1rem; padding: .5rem .75rem; border-radius: 8px; background: #f5f1fd; color: #3d2a7a; font-size: .875rem; }
.tmerge, .tpick { display: flex; flex-wrap: wrap; align-items: end; gap: .5rem; font-size: .8125rem; }
.tmerge .input { width: 7rem; }
.tpick .field { flex: 1 1 12rem; }
.tform textarea, .tnew textarea { resize: vertical; min-height: 4rem; }
.tnew { display: grid; gap: .875rem; max-width: 44rem; }
.tcall { display: grid; gap: .75rem; }
.tcall .facts { grid-template-columns: 8rem minmax(0, 1fr); }
.tscript summary { cursor: pointer; color: var(--accent); font-size: .875rem; }
.tscript pre { margin: .5rem 0 0; padding: .75rem; max-height: 22rem; overflow: auto; border-radius: 8px; background: var(--canvas); font: .8125rem/1.5 var(--body); white-space: pre-wrap; }
.ev.is-i-ticket .ev-dot { background: #fbebf3; color: #962e68; }
