/* Heliora CRM – Look wie Admin-Panel und Kundenportal. Alle Werte stehen hier in :root; Komponenten nutzen nur Variablen.
   Inter wird selbst ausgeliefert (fonts/, SIL Open Font License) – keine externen Schriftdienste. */
@font-face { font-family: "Inter"; font-style: normal; font-display: swap; font-weight: 100 900;
  src: url("fonts/inter-latin-wght-normal.woff2") format("woff2-variations");
  unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+2074,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD; }
@font-face { font-family: "Inter"; font-style: normal; font-display: swap; font-weight: 100 900;
  src: url("fonts/inter-latin-ext-wght-normal.woff2") format("woff2-variations");
  unicode-range: U+0100-02AF,U+0304,U+0308,U+0329,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF; }

:root {
  color-scheme: light;
  /* Grundfarben */
  --ink: #0B0B0D; --ink-2: #1C1C1F; --ink-hover: #27272A; --ink-active: #232326;
  --text: #3F3F46; --muted: #5F5F67; --faint: #A1A1AA;
  --line: #E4E4E7; --line-soft: #ECECF0; --line-strong: #D4D4D8;
  --canvas: #E8E8EB; --card: #FFFFFF; --sunken: #F1F1F3; --hover: #F7F7F9;
  --accent: #39D98A; --mint: #8FF7BB; --green-text: #0E6640;
  /* Seitenleiste */
  --side-bg: var(--ink); --side-text: #D4D4D8; --side-label: #8B8B94; --side-hover: var(--ink-2); --side-active: var(--ink-active);
  /* Status: Text / Fläche / Rand */
  --good-text: #0E6640;     --good-bg: #D3F0DF;     --good-line: #A9DFC0;
  --warning-text: #8A4A06;  --warning-bg: #F7EBC2;  --warning-line: #E3CB7C;
  --critical-text: #B42318; --critical-bg: #F7D9D5; --critical-line: #EBB0A8;
  --info-text: #1F4FA8;     --info-bg: #D9E5F7;     --info-line: #B3C9EC;
  --purple-text: #5B3CB0;   --purple-bg: #E4DAF7;   --purple-line: #C8B6EE;
  --teal-text: #0B6170;     --teal-bg: #D2EBEF;     --teal-line: #A6D3DB;
  --neutral-text: #45454D;  --neutral-bg: #E6E6EA;  --neutral-line: #D4D4D8;
  /* Formen und Abstände (4-px-Raster) */
  --r-control: 10px; --r-tile: 16px; --r-card: 18px; --r-dialog: 20px; --r-pill: 999px;
  --s1: 4px; --s2: 8px; --s3: 12px; --s4: 16px; --s5: 20px; --s6: 24px; --s8: 32px; --s10: 40px;
  --shadow: 0 1px 2px rgba(11, 11, 13, .04); --backdrop: rgba(11, 11, 13, .55);
  --focus: 0 0 0 3px var(--accent);
  --touch: 44px;
  /* Diagramme */
  --series-1: #1F4FA8; --series-2: #B4580E; --series-3: #0E6640; --series-4: #5B3CB0;
  --seq-1: #D9E5F7; --seq-2: #B3C9EC; --seq-3: #7FA3DE; --seq-4: #4D7DCB; --seq-5: #2F5FB3; --seq-6: #1F4FA8;
  --grid: var(--line-soft);
  /* Namen, die ältere Seiten-Styles (kb.css, Seiten-<style>) noch verwenden */
  --bg: var(--canvas); --surface: var(--card); --surface-2: var(--sunken); --border: var(--line); --border-strong: var(--line-strong);
  --text-2: var(--text); --text-3: var(--muted); --radius: var(--r-tile);
  --accent-soft: var(--good-bg); --accent-strong: var(--ink-hover); --on-accent: var(--ink);
  --good: var(--accent); --warning: #D9A21B; --critical: var(--critical-text);
  --good-soft: var(--good-bg); --warning-soft: var(--warning-bg); --critical-soft: var(--critical-bg); --info-soft: var(--info-bg);
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--canvas); color: var(--text); font: 14px/1.5 "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
       font-feature-settings: "cv11", "ss01"; -webkit-font-smoothing: antialiased; }
h1, h2, h3, h4, strong, b { color: var(--ink); }
a { color: var(--ink); }
code { font: 12px ui-monospace, monospace; background: var(--sunken); padding: 1px 5px; border-radius: 6px; }

/* Aufbau */
.app { display: grid; grid-template-columns: 248px minmax(0, 1fr); min-height: 100vh;
        background: linear-gradient(to right, var(--side-bg) 248px, var(--canvas) 248px); }
.sidebar { background: var(--side-bg); color: var(--side-text); padding: var(--s5) var(--s3); position: sticky; top: 0; height: 100vh;
           display: flex; flex-direction: column; gap: var(--s1); overflow-y: auto; }
.brand { display: flex; align-items: center; gap: var(--s3); padding: var(--s1) var(--s3) var(--s5); font-weight: 800; color: #fff; font-size: 16px;
         letter-spacing: -.01em; line-height: 1.15; }
.brand img { width: 30px; height: 32px; display: block; flex: none; }
.brand small { display: block; font-weight: 600; color: var(--faint); font-size: 12px; letter-spacing: 0; }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav a { display: flex; align-items: center; gap: var(--s3); padding: var(--s2) var(--s3); border-radius: var(--r-control); text-decoration: none;
         color: var(--side-text); font-weight: 500; min-height: 38px; position: relative; }
.nav a:hover { background: var(--side-hover); color: #fff; }
.nav a.active { background: var(--side-active); color: #fff; font-weight: 600; }
.nav a.active::before { content: ""; position: absolute; left: 0; top: 8px; bottom: 8px; width: 3px; border-radius: 0 3px 3px 0; background: var(--mint); }
.nav a.active svg { color: var(--mint); }
.nav svg { width: 18px; height: 18px; flex: none; }
.nav .badge { margin-left: auto; }
.nav-label { padding: var(--s4) var(--s3) var(--s1); font-weight: 700; text-transform: uppercase; letter-spacing: .06em; font-size: 11px; color: var(--side-label); }
.sidebar-foot { margin-top: auto; padding: var(--s3); border-top: 1px solid var(--ink-2); font-size: 13px; color: var(--faint); }
.sidebar-foot strong { color: #fff; }
.sidebar .btn-ghost, .sidebar button.btn-ghost { color: var(--side-text); }
.sidebar .btn-ghost:hover { background: var(--side-hover); color: #fff; }
.main { min-width: 0; }
.topbar { display: flex; align-items: center; gap: var(--s3); padding: var(--s6) var(--s8) var(--s2); background: var(--canvas); position: sticky; top: 0; z-index: 5; }
.topbar h1 { font-size: 28px; line-height: 1.2; margin: 0; font-weight: 800; letter-spacing: -.02em; color: var(--ink); }
.topbar .spacer { flex: 1; }
.topbar-brand, .menu-btn { display: none; }
.search { position: relative; }
.search input { width: 280px; padding-left: 34px; }
.search svg { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); width: 15px; height: 15px; color: var(--muted); }
.content { padding: var(--s4) var(--s8) 64px; max-width: 1400px; }
.nav-backdrop { display: none; }

/* Bausteine */
.grid { display: grid; gap: var(--s4); }
.cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.span-2 { grid-column: span 2; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--r-card); box-shadow: var(--shadow); padding: var(--s5); min-width: 0; }
a.card:hover, .card.link:hover { border-color: var(--line-strong); }
.card h2 { font-size: 17px; margin: 0 0 2px; font-weight: 700; letter-spacing: -.01em; color: var(--ink); }
.card h3 { font-size: 15px; font-weight: 700; }
.card .sub { color: var(--muted); font-size: 13px; margin-bottom: var(--s4); }
.card-head { display: flex; align-items: flex-start; gap: var(--s3); margin-bottom: var(--s3); flex-wrap: wrap; }
.card-head > div:first-child { flex: 1; min-width: 200px; }
.kpi { padding: var(--s4) var(--s5); border-radius: var(--r-tile); }
.kpi .label { color: var(--muted); font-size: 13px; font-weight: 600; }
.kpi .value { font-size: 28px; font-weight: 800; letter-spacing: -.02em; margin: var(--s1) 0 2px; font-variant-numeric: tabular-nums; color: var(--ink); }
.kpi .meta { font-size: 12px; color: var(--muted); }
.kpi.hero { background: var(--ink); border-color: var(--ink); }
.kpi.hero .label, .kpi.hero .meta { color: var(--side-text); }
.kpi.hero .value, .kpi.hero .value * { color: var(--mint) !important; }
.kpi.hero a { color: #fff; }
.delta { font-weight: 600; font-size: 12px; }
.delta.up { color: var(--good-text); } .delta.down { color: var(--critical-text); }
.muted { color: var(--muted); } .small { font-size: 13px; } .nowrap { white-space: nowrap; }
.stack > * + * { margin-top: var(--s4); }
.row-flex { display: flex; align-items: center; gap: var(--s2); flex-wrap: wrap; }

/* Knöpfe und Formulare */
button, .btn { font: inherit; font-weight: 600; font-size: 13px; border: 1px solid var(--line-strong); background: var(--card); color: var(--ink);
               border-radius: var(--r-control); padding: 7px 14px; min-height: 36px; cursor: pointer; text-decoration: none; display: inline-flex;
               align-items: center; justify-content: center; gap: 6px; line-height: 1.3; }
button:hover, .btn:hover { border-color: var(--ink); }
.btn-primary { background: var(--ink); border-color: var(--ink); color: #fff; }
.btn-primary:hover { background: var(--ink-hover); border-color: var(--ink-hover); }
.btn-success { background: var(--accent); border-color: var(--accent); color: var(--ink); }
.btn-danger { color: var(--critical-text); }
.btn-danger:hover { border-color: var(--critical-text); }
.btn-ghost { border-color: transparent; background: transparent; }
.btn-ghost:hover { border-color: transparent; background: var(--sunken); }
.btn-sm { padding: 4px 10px; font-size: 12px; min-height: 30px; }
button:disabled { opacity: .5; cursor: not-allowed; }
/* Mail-Maske: Vorlagen als Knöpfe oben, Formular, Seitenspalte; unter 1100 px eine Spalte, auf dem Handy volle Breite */
.compose-layout { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: var(--s4); align-items: start; }
.compose-main { min-width: 0; } .compose-side ul { padding-left: 18px; margin: 0 0 8px; line-height: 1.6; } .compose-side p { margin: 8px 0 0; }
.compose-tpls { display: grid; gap: 6px; margin: 12px 0 14px; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--r-control); background: var(--sunken); }
.tpl-group { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.tpl-label { font-size: 12px; color: var(--muted); min-width: 132px; }
.tpl-pill { display: inline-flex; align-items: center; font-size: 13px; font-weight: 600; padding: 4px 11px; border-radius: var(--r-pill);
  border: 1px solid var(--line-strong); background: var(--card); color: var(--ink); text-decoration: none; line-height: 1.4; }
.tpl-pill:hover { border-color: var(--ink); }
.tpl-pill.on { background: var(--ink); border-color: var(--ink); color: var(--card); }
.compose-words { margin: 0 0 14px; padding: 10px 12px; border: 1px solid var(--info-line); border-radius: var(--r-control); background: var(--info-bg); }
.compose-words > summary { cursor: pointer; line-height: 1.5; }
.compose-words form { display: grid; gap: 8px; margin-top: 8px; } .compose-words input[name] { width: 100%; }
.compose-words details summary { cursor: pointer; }
.compose-form textarea { min-height: 300px; line-height: 1.5; }
.compose-files { display: flex; flex-wrap: wrap; gap: 6px 14px; }
.compose-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
@media (max-width: 1100px) { .compose-layout { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 820px) {
  .tpl-label { flex-basis: 100%; min-width: 0; }
  .tpl-pill { min-height: 40px; padding: 6px 12px; }
  .compose-form textarea { min-height: 240px; }
  .compose-actions > .btn-primary, .compose-actions > button { flex: 1 1 100%; }
  .compose-actions > .btn-ghost { flex: 1 1 100%; justify-content: center; }
}
/* Kundenworte zum Anklicken (_crm.html word_chips) */
.word-chips { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; }
button.word-chip { font-size: 12px; font-weight: 500; padding: 2px 9px; min-height: 0; border-radius: var(--r-pill); border: 1px solid var(--line);
  background: var(--sunken); color: var(--text); text-align: left; line-height: 1.5; }
button.word-chip:hover { border-color: var(--ink); color: var(--ink); }
button.word-chip.on { background: var(--good-bg); border-color: var(--good-line); color: var(--good-text); }
input, select, textarea { font: inherit; font-size: 14px; padding: 8px 12px; min-height: 38px; border: 1px solid var(--line-strong);
                          border-radius: var(--r-control); background: var(--card); color: var(--ink); max-width: 100%; }
input[type=checkbox], input[type=radio] { min-height: 0; accent-color: var(--ink); width: 16px; height: 16px; }
input::placeholder, textarea::placeholder { color: var(--muted); }
textarea { width: 100%; resize: vertical; }
:focus-visible { outline: none; box-shadow: var(--focus); }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--ink); box-shadow: var(--focus); }
:where(label:has(> input[type=checkbox]), label:has(> input[type=radio])) { display: inline-flex; gap: var(--s2); align-items: flex-start; }
:where(label:has(> input[type=checkbox]), label:has(> input[type=radio])) > input { flex: none; margin: 2px 0 0; }
.stack > :where(label:has(> input[type=checkbox]), label:has(> input[type=radio])) { display: flex; }
.stack > strong { display: block; }
form.inline { display: inline; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: var(--s3); align-items: end; }
label.field > input:not([type=checkbox]):not([type=radio]), label.field > select, label.field > textarea { width: 100%; }
label.field, .field { display: grid; gap: var(--s1); font-size: 13px; color: var(--text); font-weight: 600; min-width: 0; }
.filters { display: flex; gap: var(--s2); flex-wrap: wrap; align-items: center; margin-bottom: var(--s4); }

/* Tabellen */
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--r-control); }
.card > .table-wrap:first-child, .card > table { margin-top: 0; }
table { width: 100%; border-collapse: collapse; font-size: 13px; background: var(--card); }
th { text-align: left; font-weight: 700; color: var(--ink); font-size: 12px; padding: 10px 12px; background: var(--sunken); border-bottom: 1px solid var(--line);
     white-space: nowrap; }
td { padding: 10px 12px; border-bottom: 1px solid var(--line-soft); vertical-align: top; }
tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: var(--hover); }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
.lead-link { font-weight: 700; text-decoration: none; color: var(--ink); }
.lead-link:hover { text-decoration: underline; }
/* Statuszeilen: Fläche in der Statusfarbe, 3-px-Strich links */
tr.row-good td { background: var(--good-bg); } tr.row-good td:first-child { box-shadow: inset 3px 0 0 var(--good-text); }
tr.row-warning td { background: var(--warning-bg); } tr.row-warning td:first-child { box-shadow: inset 3px 0 0 var(--warning-text); }
tr.row-critical td { background: var(--critical-bg); } tr.row-critical td:first-child { box-shadow: inset 3px 0 0 var(--critical-text); }
tr.row-info td { background: var(--info-bg); } tr.row-info td:first-child { box-shadow: inset 3px 0 0 var(--info-text); }

/* Plaketten (Farbe nie allein: immer mit Text) */
.badge { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 700; padding: 2px 10px; border-radius: var(--r-pill);
         background: var(--neutral-bg); color: var(--neutral-text); white-space: nowrap; line-height: 1.5; }
.badge[hidden] { display: none; }
.badge.good { background: var(--good-bg); color: var(--good-text); }
.badge.warning { background: var(--warning-bg); color: var(--warning-text); }
.badge.critical { background: var(--critical-bg); color: var(--critical-text); }
.badge.info { background: var(--info-bg); color: var(--info-text); }
.badge.accent { background: var(--purple-bg); color: var(--purple-text); }
.badge.teal { background: var(--teal-bg); color: var(--teal-text); }
.pill { display: inline-flex; align-items: center; gap: var(--s2); padding: 5px 12px; border-radius: var(--r-pill); font-weight: 700; font-size: 13px;
        background: var(--neutral-bg); color: var(--neutral-text); }
.pill .dot { width: 8px; height: 8px; border-radius: 50%; }
.pill.on { background: var(--good-bg); color: var(--good-text); } .pill.on .dot { background: var(--good-text); }
.pill.off { background: var(--critical-bg); color: var(--critical-text); } .pill.off .dot { background: var(--critical-text); }

/* Hinweise */
.alert { display: flex; gap: var(--s3); align-items: flex-start; padding: var(--s3) var(--s4); border-radius: var(--r-control); font-size: 14px;
         border: 1px solid var(--neutral-line); background: var(--neutral-bg); color: var(--neutral-text); }
.alert svg { width: 18px; height: 18px; flex: none; margin-top: 2px; }
.alert.good { background: var(--good-bg); border-color: var(--good-line); color: var(--good-text); }
.alert.warning { background: var(--warning-bg); border-color: var(--warning-line); color: var(--warning-text); }
.alert.critical { background: var(--critical-bg); border-color: var(--critical-line); color: var(--critical-text); }
.alert.info { background: var(--info-bg); border-color: var(--info-line); color: var(--info-text); }
.alert a, .alert strong { color: inherit; }
.alert a.btn-primary { color: #fff; }  /* Hauptknopf im Hinweis: weiße Schrift wie überall, nicht die Hinweisfarbe */
.flash { margin-bottom: var(--s4); }

/* Trichter / Balken */
.funnel-row { display: grid; grid-template-columns: 140px 1fr 70px 60px; gap: var(--s3); align-items: center; padding: 5px 0; font-size: 13px; }
.funnel-bar { height: 12px; background: var(--sunken); border-radius: var(--r-pill); overflow: hidden; }
.funnel-bar span { display: block; height: 100%; background: var(--ink); border-radius: var(--r-pill); min-width: 2px; }
.funnel-row .num { text-align: right; font-variant-numeric: tabular-nums; font-weight: 700; color: var(--ink); }

/* Raten mit Konfidenzintervall */
.ci { position: relative; height: 10px; background: var(--sunken); border-radius: 5px; min-width: 120px; }
.ci .range { position: absolute; top: 2px; bottom: 2px; background: var(--seq-2); border-radius: 3px; }
.ci .point { position: absolute; top: -2px; width: 3px; height: 14px; background: var(--series-1); border-radius: 2px; }

/* Heatmap */
.heat { display: grid; grid-template-columns: 34px repeat(13, minmax(26px, 1fr)); gap: 3px; font-size: 11px; }
.heat .h { color: var(--muted); text-align: center; }
.heat .d { color: var(--text); font-weight: 700; display: flex; align-items: center; }
.heat .c { height: 28px; border-radius: 6px; background: var(--sunken); display: grid; place-items: center; color: var(--muted);
           font-variant-numeric: tabular-nums; cursor: default; }
.heat .c[data-level="1"] { background: var(--seq-1); color: var(--ink); } .heat .c[data-level="2"] { background: var(--seq-2); color: var(--ink); }
.heat .c[data-level="3"] { background: var(--seq-3); color: var(--ink); } .heat .c[data-level="4"] { background: var(--seq-4); color: #fff; }
.heat .c[data-level="5"] { background: var(--seq-5); color: #fff; } .heat .c[data-level="6"] { background: var(--seq-6); color: #fff; }

/* Zeitachse */
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { position: relative; padding: 0 0 var(--s4) 22px; border-left: 2px solid var(--line); margin-left: 6px; }
.timeline li::before { content: ""; position: absolute; left: -7px; top: 4px; width: 12px; height: 12px; border-radius: 50%;
                       background: var(--card); border: 3px solid var(--ink); }
.timeline .when { font-size: 12px; color: var(--muted); }
.timeline .what { font-weight: 700; color: var(--ink); }
.quote { white-space: pre-wrap; background: var(--sunken); border-radius: var(--r-control); padding: 10px 12px; margin-top: 6px; font-size: 13px; }

/* Content (LinkedIn-Bereich) */
.post-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px; }
.post { border: 1px solid var(--line); border-radius: var(--r-tile); overflow: hidden; background: var(--card); display: flex; flex-direction: column; }
.post img { width: 100%; aspect-ratio: 4/5; object-fit: cover; background: var(--sunken); display: block; }
.post .body { padding: 10px 12px; font-size: 12px; }
.post .title { font-weight: 700; font-size: 13px; color: var(--ink); }

/* Diagramme */
.chart-box { position: relative; height: 260px; }
.chart-box.sm { height: 200px; }
details.table-view { margin-top: 10px; }
details.table-view summary { cursor: pointer; font-size: 12px; color: var(--muted); }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12px; color: var(--text); margin-bottom: 8px; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }

.empty { text-align: center; color: var(--muted); padding: 28px 10px; font-size: 13px; }
.pagination { display: flex; gap: 6px; justify-content: flex-end; margin-top: 12px; align-items: center; }
.tabs { display: flex; gap: var(--s1); border-bottom: 1px solid var(--line); margin-bottom: var(--s4); overflow-x: auto; }
.tabs a { padding: var(--s2) var(--s3); text-decoration: none; color: var(--muted); font-weight: 600; border-bottom: 3px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.tabs a.active { color: var(--ink); border-color: var(--accent); }
details > summary { cursor: pointer; }
dialog { border: 0; border-radius: var(--r-dialog); padding: var(--s6); }
dialog::backdrop { background: var(--backdrop); }

/* Anmeldung */
.login-page { background: var(--ink); display: grid; place-items: center; min-height: 100vh; padding: var(--s4); }
.login-card { width: 100%; max-width: 400px; padding: var(--s8); border-radius: var(--r-dialog); border: 0; }
.login-card .brand { color: var(--ink); padding: 0 0 var(--s6); }
.login-card .brand img { width: 37px; height: 40px; }
.login-card .brand small { color: var(--muted); }
.login-card h2 { font-size: 22px; font-weight: 800; letter-spacing: -.02em; }
.login-card .btn-primary { width: 100%; min-height: var(--touch); font-size: 14px; }

@media (max-width: 1100px) { .cols-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .cols-3 { grid-template-columns: 1fr 1fr; } }
/* Handy: Seitenleiste als ausklappbares Menü, Kacheln zweispaltig, Touch-Ziele 44 px */
@media (max-width: 820px) {
  .app { grid-template-columns: minmax(0, 1fr); background: var(--canvas); }
  .sidebar { position: fixed; inset: 0 auto 0 0; width: min(300px, 86vw); height: 100%; z-index: 30; transform: translateX(-102%);
             transition: transform .2s ease; }
  .app.nav-open .sidebar { transform: none; }
  .app.nav-open .nav-backdrop { display: block; position: fixed; inset: 0; background: var(--backdrop); z-index: 25; }
  .nav a { min-height: var(--touch); }
  .topbar { padding: var(--s3) var(--s4); flex-wrap: wrap; row-gap: var(--s3); }
  .topbar-brand { display: flex; align-items: center; gap: var(--s2); font-weight: 800; color: var(--ink); text-decoration: none; }
  .topbar-brand img { width: 24px; height: 26px; }
  .menu-btn { display: inline-flex; margin-left: auto; min-width: var(--touch); }
  .topbar .spacer { display: none; }
  .topbar h1 { order: 3; flex-basis: 100%; font-size: 26px; }
  .search { order: 4; flex-basis: 100%; } .search input { width: 100%; }
  .content { padding: var(--s2) var(--s4) var(--s10); }
  .cols-3, .cols-2 { grid-template-columns: minmax(0, 1fr); } .span-2 { grid-column: auto; }
  .cols-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--s3); }
  .kpi { padding: var(--s3) var(--s4); } .kpi .value { font-size: 24px; }
  .card { padding: var(--s4); border-radius: var(--r-tile); }
  button, .btn, .btn-sm, input, select { min-height: var(--touch); }
  input[type=checkbox], input[type=radio] { min-height: 0; width: 20px; height: 20px; }
  .funnel-row { grid-template-columns: 92px minmax(0, 1fr) 40px 44px; gap: var(--s2); }
}

/* Persönliches Dashboard: Bausteine in 4 Spalten, Größe s/m/l = ¼/½/ganz */
.dash-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--s4); align-items: start; }
.dash-w { min-width: 0; }
.w-s { grid-column: span 1; } .w-m { grid-column: span 2; } .w-l { grid-column: 1 / -1; }
@media (max-width: 1100px) { .dash-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } .w-m { grid-column: 1 / -1; } }
@media (max-width: 820px) { .dash-grid { grid-template-columns: minmax(0, 1fr); } .w-s, .w-m { grid-column: 1 / -1; } }
.chart-wrap svg.chart { display: block; width: 100%; height: auto; overflow: visible; font-family: inherit; }
.chart .hit { cursor: default; outline: none; }
.chart .hit:hover, .chart .hit:focus-visible { fill: rgba(11, 11, 13, .05); }
.chart .cell { outline: none; }
.chart .cell:hover, .chart .cell:focus-visible { stroke: var(--ink); stroke-width: 2; }
.chart-wrap svg.heat { max-width: 520px; }
.chart-m { display: none; }
@media (max-width: 820px) { .chart-d { display: none; } .chart-m { display: block; } }
.dash-w .bod-progress { height: 8px; background: var(--sunken); border-radius: 99px; overflow: hidden; margin: 4px 0 8px; }
.dash-w .bod-progress > span { display: block; height: 100%; background: var(--accent); border-radius: 99px; }
.chart-empty { padding: var(--s6) var(--s3); }
.chart-table { margin-top: var(--s2); font-size: 13px; }
.chart-table summary { cursor: pointer; color: var(--muted); font-size: 12px; }
.chart-table table { margin-top: var(--s2); }
.kpi-ring { display: flex; align-items: center; justify-content: space-between; gap: var(--s3); }
.kpi-ring .ring { flex: none; width: 76px; height: 76px; }
.delta { font-weight: 700; white-space: nowrap; color: var(--muted); }
.delta.up { color: var(--good-text); } .delta.down { color: var(--critical-text); }
.kpi.hero .delta { color: var(--side-text); }
.week-tiles { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--s3); margin-top: var(--s2); }
.week-tiles > div { background: var(--sunken); border-radius: var(--r-control); padding: var(--s2) var(--s3); }
.dash-list { list-style: none; padding: 0; margin: var(--s2) 0 0; }
.dash-list li { display: flex; gap: var(--s3); align-items: baseline; padding: 8px 0; border-bottom: 1px solid var(--line-soft); font-size: 14px; }
.dash-list li:last-child { border-bottom: 0; }
.dash-edit { display: grid; gap: var(--s2); }
.dash-edit-row { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: var(--s3); align-items: center; padding: var(--s3);
  border: 1px solid var(--line); border-radius: var(--r-control); background: var(--card); scroll-margin-top: 90px; }
.dash-edit-row.off { background: var(--sunken); }
.dash-edit-row.off strong { color: var(--muted); }
.dash-edit-main { display: flex; gap: var(--s3); align-items: flex-start; cursor: pointer; }
.dash-edit-main input { width: 20px; height: 20px; margin-top: 2px; flex: none; }
.dash-edit-move { display: flex; gap: 4px; }
.dash-edit-move button { min-width: var(--touch); min-height: var(--touch); }
@media (max-width: 820px) { .dash-edit-row { grid-template-columns: minmax(0, 1fr) auto; } .dash-edit-row select { grid-column: 1 / -1; } }
.chart-tip { position: fixed; z-index: 50; pointer-events: none; background: var(--ink); color: #fff; font-size: 12px; line-height: 1.4;
  padding: 6px 10px; border-radius: 8px; max-width: 260px; box-shadow: 0 4px 12px rgba(11, 11, 13, .2); }

/* Verdienst */
.earn-head { display: flex; flex-wrap: wrap; gap: var(--s3) var(--s5); align-items: center; justify-content: space-between; margin-bottom: var(--s3); }
.earn-head .tabs { margin-bottom: 0; border-bottom: 0; }
.earn-nav { gap: var(--s3); align-items: center; }
.earn-nav .btn { min-width: var(--touch); justify-content: center; }

/* Lokale KI-Helfer */
.ai-note { background: var(--sunken); border-radius: var(--r-control); padding: var(--s3); display: grid; gap: var(--s2); }
.ai-note textarea { width: 100%; }
.ai-filled { outline: 2px solid var(--accent); outline-offset: 1px; }
button.ai-pick { box-shadow: 0 0 0 3px var(--accent); }
.ai-chips { margin: var(--s2) 0; gap: 6px; flex-wrap: wrap; }
.ai-hit { border-top: 1px solid var(--line-soft); padding: var(--s2) 0; }
.ai-hit:first-child { border-top: 0; }
.ai-hit-title { font-weight: 600; }
.ai-hit p { margin: 4px 0 0; font-size: 13px; color: var(--text); white-space: pre-line; }
.morning-preview { white-space: pre-wrap; font: 14px/1.55 "Inter", system-ui, sans-serif; background: var(--sunken); border-radius: var(--r-control); padding: var(--s4); margin: 0; }
.ai-answer { font-size: 15px; color: var(--ink); background: var(--good-bg); border-radius: var(--r-control); padding: var(--s3); margin: var(--s2) 0 4px; }

/* Live-Tour */
.tour-spot { position: fixed; z-index: 1000; border-radius: 12px; pointer-events: none; box-shadow: 0 0 0 4px var(--accent), 0 0 0 9999px rgba(11, 11, 13, .55);
  transition: all .18s ease; }
.tour-card { position: fixed; z-index: 1001; background: var(--card); color: var(--text); border-radius: var(--r-tile); padding: var(--s4);
  box-shadow: 0 12px 40px rgba(11, 11, 13, .3); }
.tour-head { display: flex; justify-content: space-between; gap: var(--s3); align-items: baseline; }
.tour-title { color: var(--ink); font-size: 16px; }
.tour-count { font-size: 12px; color: var(--muted); white-space: nowrap; }
.tour-text { margin: var(--s2) 0 var(--s3); font-size: 14px; line-height: 1.5; }
.tour-actions { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.tour-actions .spacer { flex: 1; }
.tour-actions button { min-height: 40px; }
@media (prefers-reduced-motion: reduce) { .tour-spot { transition: none; } }
.tour-menu { position: relative; }
.tour-menu > summary { list-style: none; cursor: pointer; }
.tour-menu > summary::-webkit-details-marker { display: none; }
.tour-pop { position: absolute; right: 0; top: calc(100% + 6px); z-index: 900; width: 260px; max-height: 70vh; overflow-y: auto; background: var(--card);
  border: 1px solid var(--line); border-radius: var(--r-tile); padding: var(--s3); box-shadow: 0 12px 32px rgba(0, 0, 0, .18); display: flex; flex-direction: column; gap: 4px; }
.tour-pop > a:not(.btn) { padding: 6px 8px; border-radius: 8px; text-decoration: none; color: var(--text); font-size: 14px; }
.tour-pop > a:not(.btn):hover, .tour-pop > a:not(.btn):focus-visible { background: var(--sunken); }
@media (max-width: 640px) { .tour-pop { position: fixed; left: 12px; right: 12px; top: 64px; width: auto; } }
.rem-more { border-top: 1px solid var(--line-soft); padding: 8px 0; }
.rem-more summary { cursor: pointer; font-size: 13px; font-weight: 600; }
.rem-more[open] summary { margin-bottom: 8px; }

.demo-banner { background: var(--warning-soft, #fff4d6); color: var(--warning-text, #6b4e00); border: 1px solid currentColor; border-radius: 10px; padding: 8px 12px; margin-bottom: var(--s3); font-size: 13px; }

/* Pop-ups (dialog) und Aufklapp-Menüs – Inhalte nur dann, wenn sie gebraucht werden */
dialog.modal { border: 0; padding: 0; border-radius: var(--r-tile); background: var(--card); color: var(--text); width: min(520px, calc(100vw - 24px));
  max-height: calc(100vh - 48px); box-shadow: 0 24px 64px rgba(0, 0, 0, .28); }
dialog.modal.modal-wide { width: min(760px, calc(100vw - 24px)); }
dialog.modal::backdrop { background: rgba(11, 11, 13, .5); }
.modal-head { display: flex; justify-content: space-between; align-items: center; gap: var(--s3); padding: var(--s4) var(--s4) 0; position: sticky; top: 0; background: var(--card); z-index: 1; }
.modal-head h2 { margin: 0; font-size: 17px; }
.modal-body { padding: var(--s3) var(--s4) var(--s4); overflow-y: auto; }
.modal-body > .sub:first-child { margin-top: -4px; }
@media (max-width: 640px) { dialog.modal, dialog.modal.modal-wide { width: 100vw; max-width: 100vw; max-height: 92vh; margin: auto 0 0; border-radius: 16px 16px 0 0; } }
.menu { position: relative; display: inline-block; }
.menu > summary { list-style: none; cursor: pointer; }
.menu > summary::-webkit-details-marker { display: none; }
.menu-pop { position: absolute; right: 0; top: calc(100% + 6px); z-index: 900; min-width: 230px; background: var(--card); border: 1px solid var(--line);
  border-radius: 12px; padding: 6px; box-shadow: 0 12px 32px rgba(0, 0, 0, .18); display: flex; flex-direction: column; }
.menu-pop > a, .menu-pop > button, .menu-pop > form > button { display: block; width: 100%; text-align: left; padding: 8px 10px; border-radius: 8px; border: 0; background: none;
  color: var(--text); font: inherit; font-size: 14px; text-decoration: none; cursor: pointer; min-height: 0; }
.menu-pop > a:hover, .menu-pop > button:hover, .menu-pop > form > button:hover { background: var(--sunken); }
.menu-pop .danger { color: var(--critical-text); }
.menu-pop hr { border: 0; border-top: 1px solid var(--line); margin: 4px 0; }
.menu.left .menu-pop { left: 0; right: auto; }

/* Firmenseite */
.co-head .co-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.co-head .co-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; align-items: center; }
.co-head .co-actions .spacer { flex: 1; }
.co-head .co-info { margin-top: 10px; font-size: 13px; display: flex; flex-wrap: wrap; gap: 6px 12px; align-items: center; }
.act-form textarea { width: 100%; }
.act-form .act-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 8px; }
.act-form .act-row select { width: auto; flex: 1 1 200px; max-width: 280px; }
.act-form .more-fields > summary { cursor: pointer; font-size: 13px; color: var(--muted); }
.act-form .more-fields[open] > summary { margin-bottom: 8px; }
.people { list-style: none; margin: 0; padding: 0; }
.people > li { display: flex; gap: 8px; align-items: center; padding: 8px 0; border-top: 1px solid var(--line); }
.people > li:first-child { border-top: 0; }
.people .who { flex: 1; min-width: 0; }
.people .who small { display: block; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.icon-btn { min-width: 34px; min-height: 34px; padding: 0 8px; display: inline-flex; align-items: center; justify-content: center; }
.timeline-more > summary { cursor: pointer; font-size: 13px; color: var(--muted); margin-top: 6px; }
.bulk-bar { position: sticky; top: 8px; z-index: 20; box-shadow: 0 6px 20px rgba(0, 0, 0, .12); }
.bulk-bar:not(.show) { display: none; }
.row-menu { margin-left: 6px; vertical-align: middle; }
.row-menu > summary.btn { min-height: 30px; padding: 0 10px; }

/* Aktivität: Status „kurz inaktiv“ (aktiv = .pill.on, offline = .pill.gone) */
.pill.away { background: var(--warning-bg); color: var(--warning-text); } .pill.away .dot { background: var(--warning-text); }
.pill.gone .dot { background: var(--muted); }

/* Auswahl als große Knöpfe (Handy), z. B. „Ich habe angerufen / Kunde hat mich angerufen“ im Ergebnis-Fenster */
.chipradio { display:inline-flex; align-items:center; gap:6px; padding:8px 12px; min-height:40px; border:1px solid var(--border); border-radius:99px;
             font-size:14px; cursor:pointer; background:var(--surface); }
.chipradio input { margin:0; }
.chipradio:has(input:checked) { border-color:var(--good-text); background:var(--good-bg); color:var(--good-text); font-weight:600; }

/* Sl!ck-Unterhaltung am Lead/Deal (crm/templates/_v.html chat_strip) */
.chat-strip { display: flex; justify-content: space-between; align-items: flex-start; gap: var(--s3); flex-wrap: wrap; margin-top: var(--s3);
              padding-top: var(--s3); border-top: 1px solid var(--border); }

/* Vertragsunterlagen am Deal (crm_v_deal.html) */
.vdocs { display: grid; gap: 6px; margin-top: 8px; }
.vdoc { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 6px 0; border-bottom: 1px solid var(--border); }
.vdoc > span:first-child { flex: 1; min-width: 180px; }

/* KI: Antwortvorschlag im Einwand-Helfer, Anruf vorbereiten */
.ai-reply { background: var(--good-bg); border-radius: var(--r-control); padding: 10px 12px; margin-bottom: 10px; }
.ai-reply p { margin: 4px 0; }
.call-prep { margin-top: 6px; }

/* Übung zum Umstieg (crm/uebung.py) */
.uebung-bar { border: 2px solid var(--accent); border-radius: var(--r-tile); background: var(--card); padding: 10px 14px; margin-bottom: 14px; }
.uebung-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.uebung-head a { margin-left: auto; }
.uebung-meter { flex: 0 1 180px; height: 8px; border-radius: 4px; background: var(--border); overflow: hidden; }
.uebung-meter i { display: block; height: 100%; background: var(--accent); }
.uebung-now { margin-top: 6px; display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.uebung-list { list-style: none; padding: 0; margin: 0; }
.uebung-list li { display: flex; gap: 10px; align-items: baseline; padding: 8px 0; border-top: 1px solid var(--border); }
.uebung-list li.done { opacity: .6; }
.uebung-list .nr { flex: 0 0 26px; font-weight: 700; }
/* Übung: geführtes Tutorial (Coach) */
.coach-box { position: fixed; z-index: 1002; border-radius: 10px; pointer-events: none; outline: 3px solid var(--accent);
  box-shadow: 0 0 0 9999px rgba(11, 11, 13, .38); animation: coach-pulse 1.4s ease-in-out infinite; }
@keyframes coach-pulse { 0%, 100% { outline-offset: 0; } 50% { outline-offset: 5px; } }
.coach-label { position: fixed; z-index: 1003; pointer-events: none; background: var(--accent); color: #fff; font-weight: 700; font-size: 13px;
  padding: 4px 10px; border-radius: 999px; white-space: nowrap; box-shadow: 0 4px 14px rgba(11, 11, 13, .25); }
.coach-card { position: fixed; z-index: 1004; right: 16px; bottom: 16px; width: min(400px, calc(100vw - 32px)); background: var(--card); color: var(--text);
  border: 2px solid var(--accent); border-radius: var(--r-tile); padding: 12px 14px; box-shadow: 0 12px 40px rgba(11, 11, 13, .3); }
.coach-head { display: flex; align-items: center; gap: 10px; justify-content: space-between; }
.coach-meter { flex: 0 0 110px; height: 6px; border-radius: 3px; background: var(--border); overflow: hidden; }
.coach-meter i { display: block; height: 100%; background: var(--accent); }
.coach-step { font-size: 12px; color: var(--muted); margin-top: 6px; }
.coach-text { margin: 6px 0 8px; font-size: 14px; line-height: 1.5; }
.coach-act, .coach-nav { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.coach-nav { margin-top: 8px; padding-top: 8px; border-top: 1px solid var(--border); }
.coach-act .spacer, .coach-nav .spacer { flex: 1; }
.coach-pill { position: fixed; z-index: 1004; right: 16px; bottom: 16px; border-radius: 999px; padding: 8px 14px; background: var(--accent); color: #fff;
  font-weight: 700; border: 0; box-shadow: 0 6px 20px rgba(11, 11, 13, .3); cursor: pointer; }
@media (max-width: 640px) { .coach-card { left: 8px; right: 8px; bottom: 8px; width: auto; } .coach-pill { right: 8px; bottom: 8px; } }
@media (prefers-reduced-motion: reduce) { .coach-box { animation: none; } }
.coach-card[hidden], .coach-pill[hidden] { display: none !important; }
.coach-card.coach-top { top: 16px; bottom: auto; }
@media (max-width: 640px) { .coach-card.coach-top { top: 8px; bottom: auto; } }

/* Entwürfe (crm.js): Hinweis „nicht gespeicherte Eingaben – wiederherstellen“ über dem Formular */
.draft-bar { margin-bottom: 12px; }
.draft-bar button { margin-left: 6px; }
.nav-more > summary { list-style:none; cursor:pointer; padding:8px 12px; color:var(--side-text); font-size:13px; border-radius:8px; }  /* lesbar auf der dunklen Leiste (B45) */
.nav-more > summary::-webkit-details-marker { display:none; }
.nav-more > summary:hover { background:var(--surface-2); color:var(--text); }
@media (max-width: 600px) { .vphases { display:none; } }  /* Deal-Kopf am Handy: die aktuelle Phase steht schon am Titel */
.nav-icons { display:flex; gap:6px; padding:0 4px 8px; }
.nav-icon { position:relative; display:inline-flex; align-items:center; justify-content:center; width:38px; height:38px; border-radius:10px; color:inherit; }
.nav-icon:hover, .nav-icon.active { background:rgba(255,255,255,.08); }
.nav-icon svg { width:20px; height:20px; }
.nav-icon .badge { position:absolute; top:-4px; right:-6px; font-size:10px; padding:0 5px; }

/* Ergebnis-Knöpfe (1–6) – in „Heute“ und im Ergebnis-Fenster der Aktionsleiste gleich */
.vres .suggest, .vres details.suggest > summary { outline:3px solid var(--good-text); outline-offset:2px; }
.vres button:focus-visible, .vres summary:focus-visible, .vchips button:focus-visible { outline:3px solid var(--good-text); outline-offset:2px; background:var(--good-bg); }
.vres { display:grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap:8px; margin-top:12px; }
.vres > * { width:100%; }
.vres > button, .vres > form > button, .vres > details > summary { width:100%; min-height:56px; font-size:15px; font-weight:700; border-radius:10px; text-align:left; padding:8px 12px; list-style:none; cursor:pointer;
                              display:flex; flex-direction:column; align-items:flex-start; justify-content:center; gap:2px; }
.vres .sub { font-size:12px; font-weight:400; color:var(--muted); }
.vres summary::-webkit-details-marker { display:none; }
.vres kbd, .vkeys kbd, [data-results] kbd { border:1px solid var(--border-strong); border-radius:4px; padding:0 5px; font-size:11px; margin-right:6px; background:var(--surface); color:var(--text); }
.vpanel { grid-column: 1 / -1; background:var(--surface-2); border-radius:10px; padding:12px; margin-top:4px; }
details.vp[open] { grid-column: 1 / -1; }
.vchips { display:flex; flex-wrap:wrap; gap:6px; margin:6px 0; }
.vchips button { width:auto; min-height:38px; font-size:14px; font-weight:600; }
.vpanel .row-flex { margin-top:6px; }
[data-results]:has(input[value=eingehend]:checked) [data-out-only] { display:none; }  /* Kunde hat angerufen: „Nicht erreicht“, „Falsche Nummer“ passen nicht */
@media (max-width: 900px) { .vres { grid-template-columns: 1fr 1fr; } }
@media (max-width: 600px) { .vres kbd, [data-results] kbd { display:none; } }
@media (max-width: 900px) { [data-results] .res-keys { display:none; } }  /* Tasten nur am PC */

/* Aktionsleiste (crm/templates/_v.html action_bar): oben mitlaufend; am Handy fest unten wie eine App-Leiste */
.abar { position:sticky; top:0; z-index:20; display:flex; flex-wrap:wrap; align-items:center; gap:6px; padding:8px 10px; margin:0 0 14px;
        background:var(--card); border:1px solid var(--line); border-radius:var(--r-tile); box-shadow:0 4px 14px rgba(0, 0, 0, .06); }
.abar > .btn, .abar > button, .abar > .menu > summary { min-height:36px; }
.abar .abar-more { margin-left:auto; }
.abar .menu-pop > .abar-m { display:none; }
@media (max-width: 640px) {
  .abar { position:fixed; left:0; right:0; bottom:0; top:auto; z-index:24; margin:0; border-radius:0; border-width:1px 0 0; flex-wrap:nowrap; gap:4px;
          padding:6px 6px calc(6px + env(safe-area-inset-bottom)); box-shadow:0 -4px 14px rgba(0, 0, 0, .08); }
  .abar > .btn, .abar > button, .abar > .menu, .abar > .menu > summary { flex:1 1 0; min-width:0; }
  .abar > .btn, .abar > button, .abar > .menu > summary { flex-direction:column; gap:0; min-height:52px; padding:4px 2px; font-size:18px; line-height:1.1; }
  .abar > .btn span, .abar > button span, .abar > .menu > summary span { font-size:11px; font-weight:600; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; max-width:100%; }
  .abar .abar-x { display:none; }
  .abar .abar-more { margin-left:0; } .abar .abar-more > summary { width:100%; }
  .abar .menu-pop { top:auto; bottom:calc(100% + 8px); }
  .abar .menu-pop > .abar-m { display:block; }
  body:has(.abar) .content { padding-bottom:96px; }
  body:has(.abar) .coach-card:not(.coach-top), body:has(.abar) .coach-pill { bottom:84px; }
}
/* Kurzknöpfe je Zeile in Leads, Pipeline und Firmen: 📞 · 📅 Termin · ✉️ – dieselben wie in der Aktionsleiste */
.vquick { float:right; display:inline-flex; gap:2px; margin-left:8px; }
.vquick .btn { min-height:28px; padding:2px 8px; }
/* Mail-Formular: „Senden“ oder „Zur Freigabe“ – je nachdem, ob der Suchauftrag angehakt ist (crm.js) */
[data-send-plain][hidden], [data-send-signed][hidden] { display:none !important; }
