/* zeitgeist districts CRM – Stylesheet
   CI von zeitgeist-districts.de: Rot #b90516 (Leitfarbe), Blau #2f4497 (Akzent),
   Text #555555, helle Fläche #edf3f3, Hausschrift Poppins */

/* Hausschrift Poppins – lokal ausgeliefert (CSP erlaubt nur 'self') */
@font-face {
  font-family: 'Poppins';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url(../fonts/poppins-400-latin-ext.woff2) format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: 'Poppins';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url(../fonts/poppins-400-latin.woff2) format('woff2');
  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+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Poppins';
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url(../fonts/poppins-500-latin-ext.woff2) format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: 'Poppins';
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url(../fonts/poppins-500-latin.woff2) format('woff2');
  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+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Poppins';
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url(../fonts/poppins-600-latin-ext.woff2) format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: 'Poppins';
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url(../fonts/poppins-600-latin.woff2) format('woff2');
  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+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Poppins';
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url(../fonts/poppins-700-latin-ext.woff2) format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: 'Poppins';
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url(../fonts/poppins-700-latin.woff2) format('woff2');
  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+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
  color-scheme: light;
  --background: #eef2f3;
  --foreground: #1a1d21;
  --muted: #5d6e80;   /* WCAG AA: 4.65:1 auf --background (ZGD-Ton #6a7c8e lag bei 3.81) */
  --muted-foreground: #555555;
  --card: #ffffff;
  --card-soft: #f6f9f9;
  --border: #dbe2e3;
  --border-strong: #c3cdcf;
  --primary: #b90516;
  --primary-foreground: #ffffff;
  --primary-dark: #92040f;
  --accent: #2f4497;
  --accent-foreground: #ffffff;
  --success: #0f766e;
  --warning: #b7791f;
  --danger: #b91c1c;
  --ring: rgba(185, 5, 22, 0.22);
  --shadow: 0 22px 54px rgba(16, 20, 28, 0.1);
  --radius: 8px;
  /* Akzentfarbe für TEXT (Links, Eyebrows) – im Darkmode heller als das Button-Rot */
  --text-accent: #a20413;
  font-family:
    Poppins, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont,
    "Segoe UI", sans-serif;
}

/* ---- Darkmode (data-theme wird von assets/js/theme.js gesetzt) ---- */

:root[data-theme="dark"] {
  color-scheme: dark;
  --background: #15171b;
  --foreground: #e9ecee;
  --muted: #98a6b4;
  --muted-foreground: #b4bfc8;
  --card: #1e2126;
  --card-soft: #272b31;
  --border: #343941;
  --border-strong: #464d57;
  --accent: #41579f;
  --success: #4fd1c5;
  --warning: #f0b45c;
  --danger: #f87171;
  --ring: rgba(232, 60, 60, 0.35);
  --shadow: 0 22px 54px rgba(0, 0, 0, 0.45);
  --text-accent: #ff938c;
}

* { box-sizing: border-box; }

body {
  min-width: 320px;
  margin: 0;
  color: var(--foreground);
  background:
    linear-gradient(180deg, rgba(16, 20, 28, 0.08), rgba(238, 242, 243, 0) 320px),
    linear-gradient(135deg, rgba(185, 5, 22, 0.08), rgba(255, 255, 255, 0) 420px),
    var(--background);
}

button, input, select, textarea { font: inherit; }
button { cursor: pointer; }

h1, h2, h3, p { margin-top: 0; }
h1 { margin-bottom: 0; font-size: clamp(1.4rem, 2vw, 2rem); line-height: 1.1; }
h2 { margin-bottom: 0; font-size: 1rem; line-height: 1.2; }
h3 { margin-bottom: 10px; font-size: 0.95rem; }

a { color: var(--text-accent); }

.app-shell {
  width: min(1600px, calc(100vw - 32px));
  min-height: 100vh;
  margin: 0 auto;
  padding: 24px 0;
}

/* ---- Topbar ---- */

.topbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 18px;
  padding: 14px 18px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(247, 248, 250, 0.98)), #fff;
  box-shadow: var(--shadow);
}

.brand-lockup { display: flex; min-width: 0; align-items: center; gap: 16px; color: inherit; text-decoration: none; }
a.brand-lockup { transition: opacity 140ms ease; }
a.brand-lockup:hover { opacity: 0.85; }
a.brand-lockup:hover h1 { color: var(--text-accent); }
.brand-logo { width: 110px; height: auto; object-fit: contain; }

.eyebrow {
  margin: 0 0 2px;
  color: var(--text-accent);
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.subtitle { margin: 4px 0 0; color: var(--muted); font-size: 0.9rem; }

.main-nav { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-left: auto; }
.main-nav a {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  border-radius: var(--radius);
  color: var(--foreground);
  font-size: 0.92rem;
  font-weight: 600;
  text-decoration: none;
  transition: background 140ms ease, color 140ms ease;
}
.main-nav a:hover { background: var(--card-soft); }
.main-nav a.active { background: var(--accent); color: var(--accent-foreground); }

.main-nav .nav-icon { padding: 8px 10px; }
.main-nav .nav-icon svg { display: block; }

/* Dezenter Trenner zwischen den Navigationszonen (Primär | Verwaltung | Werkzeuge) */
.main-nav .nav-sep {
  width: 1px;
  height: 22px;
  align-self: center;
  margin: 0 4px;
  background: var(--border-strong);
}
@media (max-width: 640px) { .main-nav .nav-sep { display: none; } }

/* Kennzeichnung für noch nicht fertige Bereiche */
.nav-tag {
  padding: 1px 6px;
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  color: var(--muted);
  font-size: 0.66rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.main-nav a.active .nav-tag { border-color: rgba(255, 255, 255, 0.4); color: inherit; }

/* Benutzername als dezent getönte Pille (führt zum Profil) */
.main-nav .user-chip {
  margin-left: 6px;
  padding: 7px 14px;
  border: 1px solid rgba(185, 5, 22, 0.25);
  border-radius: 999px;
  background: rgba(185, 5, 22, 0.06);
  color: var(--text-accent);
  font-size: 0.88rem;
}
.main-nav .user-chip:hover { background: rgba(185, 5, 22, 0.12); }
.logout-form { margin: 0; display: inline-flex; }

/* ---- Kennzahlen ---- */

.metrics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}

.metric-card {
  position: relative;
  overflow: hidden;
  min-height: 96px;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--card);
  box-shadow: var(--shadow);
  color: inherit;
  text-decoration: none;
}

/* Roter Akzentbalken oben (wie im Original-Dashboard) */
.metric-card::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 3px;
  background: var(--primary);
}

a.metric-card:hover { border-color: var(--primary); }

.metric-card .metric-label {
  display: block;
  margin-bottom: 10px;
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 650;
}
.metric-card strong { display: block; font-size: 2rem; line-height: 1; }
.metric-card.alert strong { color: var(--primary); }
.metric-hint { display: block; margin-top: 6px; color: var(--primary); font-size: 0.78rem; font-weight: 650; }

/* ---- Workspace-Layout ---- */

.workspace {
  display: grid;
  grid-template-columns: 240px minmax(0, 1fr);
  align-items: start;
  gap: 14px;
}
.workspace.single { grid-template-columns: minmax(0, 1fr); }

/* Dreispaltig mit Schnellansicht rechts (wie im Original-Dashboard) */
.workspace.with-detail { grid-template-columns: 240px minmax(0, 1.35fr) minmax(300px, 400px); }

tr.selected td { background: rgba(185, 5, 22, 0.06); }
tr.selected td:first-child { box-shadow: inset 3px 0 0 var(--primary); }

/* Wrapper für den fetch-Austausch: soll das Grid nicht beeinflussen */
#detailZone { display: contents; }

/* Panel läuft beim Scrollen mit und scrollt bei Bedarf in sich selbst */
.detail-quick {
  position: sticky;
  top: 14px;
  max-height: calc(100vh - 28px);
  overflow-y: auto;
  transition: opacity 120ms ease;
}
.detail-quick.loading { opacity: 0.5; }

.detail-quick .empty-state { padding: 48px 0; }
.detail-quick .detail-title { font-size: 1.15rem; }
.detail-quick .detail-badges { margin-top: 8px; }
.detail-quick .quick-actions { display: flex; flex-wrap: wrap; gap: 6px; margin: 12px 0 16px; }
.detail-quick h4 {
  margin: 22px 0 8px;
  color: var(--text-accent);
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

/* Abschnittsüberschrift mit Aktion rechts (z. B. Kontakte + Hinzufügen) */
.detail-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin: 22px 0 8px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}
.detail-section-head h4 { margin: 0; }

.panel {
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--card);
}

.panel-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 14px;
}
.panel-heading p { margin: 2px 0 0; color: var(--muted); font-size: 0.85rem; }

/* ---- Formulare ---- */

.field { display: block; margin-bottom: 12px; }
.field > span, .field > legend {
  display: block;
  margin-bottom: 4px;
  color: var(--muted-foreground);
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.field input, .field select, .field textarea {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  background: var(--card);
  color: var(--foreground);
}
.field input:focus, .field select:focus, .field textarea:focus {
  outline: 2px solid var(--ring);
  border-color: var(--primary);
}
.field textarea { min-height: 90px; resize: vertical; }
.field textarea.lg { min-height: 118px; }
/* Auto-wachsende Textareas: Höhe steuert JS, kein Scrollbalken/Handle nötig */
.field textarea.autogrow { resize: none; overflow: hidden; }

.interaction-type-field {
  min-width: 0;
  padding: 0;
  border: 0;
}
.multi-choice {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.choice-chip {
  display: inline-flex;
  cursor: pointer;
}
.field .choice-chip input {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}
.choice-chip span {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 6px 10px;
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  background: var(--card);
  color: var(--foreground);
  font-size: 0.9rem;
}
.choice-chip input:checked + span {
  border-color: var(--primary);
  background: var(--primary);
  color: var(--primary-foreground);
}
.choice-chip input:focus-visible + span {
  outline: 2px solid var(--ring);
  outline-offset: 2px;
}
.field-hint {
  display: block;
  margin-top: 6px;
  color: var(--muted);
  font-size: 0.78rem;
}

/* Gesprächspartner: Dropdown + „Neuer Kontakt"-Button nebeneinander */
.partner-picker { display: flex; align-items: center; gap: 8px; }
.partner-picker select { flex: 1 1 auto; min-width: 0; }
.partner-picker .button { flex: 0 0 auto; display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
/* Neu-Kontakt-Block: ohne JS sichtbar (Fallback), mit JS eingeklappt bis zum Toggle */
html.js .new-contact-block { display: none; }
html.js .new-contact-block.is-open { display: block; }

.app-version { margin: 14px 0 0; color: var(--muted); font-size: 0.78rem; text-align: center; }

.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 0 14px;
}
.form-grid .span-all { grid-column: 1 / -1; }

.form-section-title {
  grid-column: 1 / -1;
  margin: 10px 0 12px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
  font-weight: 700;
  font-size: 0.9rem;
}

.check-field { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; font-size: 0.92rem; }

/* Pending-Freigabe: Rolle/Kürzel/Button in einer Zeile */
.inline-approve { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.inline-approve select { width: auto; }

.user-extra-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}

/* ---- Segmented Control (Ansicht-Umschalter wie im Original) ---- */

/* Flexibel statt starrem 3-Spalten-Raster: Segmente behalten ihre natürliche
   Breite und brechen bei Platzmangel um (Overflow-Bug der Vorlage vermieden) */
.segmented-control {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-bottom: 12px;
  padding: 4px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--card-soft);
}

.segment {
  display: flex;
  flex: 1 1 auto;
  align-items: center;
  justify-content: center;
  min-height: 34px;
  padding: 0 10px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  color: var(--muted-foreground);
  font-size: 0.82rem;
  font-weight: 650;
  text-align: center;
  text-decoration: none;
  white-space: nowrap;
}

.segment:hover { border-color: var(--primary); }

.segment.active {
  border-color: rgba(185, 5, 22, 0.28);
  background: rgba(185, 5, 22, 0.08);
  color: var(--text-accent);
  box-shadow: 0 1px 2px rgba(16, 20, 28, 0.06);
}

/* ---- Buttons ---- */

.button {
  display: inline-block;
  padding: 9px 16px;
  border: 1px solid var(--primary-dark);
  border-radius: var(--radius);
  background: var(--primary);
  color: var(--primary-foreground);
  font-weight: 600;
  font-size: 0.92rem;
  text-decoration: none;
  transition: border-color 140ms ease, background 140ms ease, color 140ms ease, transform 140ms ease;
}
.button:hover { background: var(--primary-dark); }
.button:active, .ghost-button:active, .icon-button:active, .segment:active { transform: translateY(1px); }

.icon-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  min-height: 34px;
  padding: 0;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  background: transparent;
  color: var(--muted-foreground);
  font-size: 1.1rem;
  transition: border-color 140ms ease, color 140ms ease, transform 140ms ease;
}
.icon-button:hover { border-color: var(--primary); color: var(--foreground); }

.button.secondary {
  border-color: var(--border-strong);
  background: var(--card);
  color: var(--foreground);
}
.button.secondary:hover { background: var(--card-soft); }

.button.danger {
  border-color: rgba(185, 28, 28, 0.4);
  background: var(--card);
  color: var(--danger);
}
.button.danger:hover { background: rgba(185, 28, 28, 0.1); border-color: var(--danger); }

.button.small { padding: 5px 10px; font-size: 0.84rem; }

/* Icon-only-Umschalter (Theme) */
.theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  padding: 0;
  color: var(--muted-foreground);
}
.theme-toggle:hover { color: var(--foreground); }
.theme-toggle svg { display: block; }

.ghost-button {
  border: 0;
  background: none;
  color: var(--text-accent);
  font-size: 0.86rem;
  font-weight: 600;
}
.ghost-button:hover { text-decoration: underline; }

/* ---- Tabellen ---- */

.table-wrap { overflow-x: auto; }

table { width: 100%; border-collapse: collapse; font-size: 0.92rem; }
th {
  padding: 8px 10px;
  border-bottom: 2px solid var(--border-strong);
  color: var(--muted-foreground);
  font-size: 0.78rem;
  text-align: left;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
td { padding: 9px 10px; border-bottom: 1px solid var(--border); vertical-align: top; }
tbody tr:hover { background: var(--card-soft); }
tbody tr[data-href] { cursor: pointer; }

/* Firmenname in der Liste: normale Textfarbe statt Link-Optik (wie Vorlage) */
.row-link { color: inherit; text-decoration: none; }
.row-link:hover { text-decoration: underline; }

/* Sortierbare Spaltenköpfe */
.sort-link {
  display: inline-block;
  color: inherit;
  text-decoration: none;
  white-space: nowrap;
}
.sort-link:hover { color: var(--text-accent); }
.sort-link.active { color: var(--text-accent); }

td .sub { display: block; color: var(--muted); font-size: 0.82rem; }

/* ---- Badges & Status ---- */

.badge {
  display: inline-block;
  padding: 2px 9px;
  border-radius: 999px;
  background: var(--card-soft);
  border: 1px solid var(--border);
  font-size: 0.78rem;
  font-weight: 600;
  white-space: nowrap;
}
.badge.status-hot    { background: rgba(185, 5, 22, 0.1);  border-color: rgba(185, 5, 22, 0.35);  color: var(--primary-dark); }
.badge.status-active { background: rgba(15, 118, 110, 0.1); border-color: rgba(15, 118, 110, 0.35); color: var(--success); }
.badge.status-cold   { background: var(--card-soft); color: var(--muted-foreground); }
.badge.overdue       { background: rgba(185, 28, 28, 0.12); border-color: rgba(185, 28, 28, 0.4);   color: var(--danger); }

/* ---- Modal-Dialoge (natives <dialog>, Optik wie im Original) ---- */

dialog.modal {
  width: min(820px, calc(100vw - 36px));
  max-height: calc(100vh - 36px);
  padding: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--card);
  color: var(--foreground);
  box-shadow: 0 28px 70px rgba(16, 20, 28, 0.28);
}

dialog.modal::backdrop { background: rgba(16, 20, 28, 0.42); }

.modal-header {
  position: sticky;
  top: 0;
  z-index: 1;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  padding: 18px;
  border-bottom: 1px solid var(--border);
  background: var(--card);
}
.modal-header h2 { font-size: 1.15rem; }
.modal-subtitle { margin: 5px 0 0; color: var(--muted-foreground); font-size: 0.9rem; }

.modal-body { padding: 18px; }

.form-actions { margin-top: 4px; }

/* Fallback-Seiten (ohne JS): gleiche Dialog-Optik, statisch zentriert */
.page-dialog {
  width: min(820px, 100%);
  margin: 0 auto;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--card);
  box-shadow: var(--shadow);
}

/* ---- Flash & Hinweise ---- */

.flash {
  margin-bottom: 16px;
  padding: 12px 16px;
  border-radius: var(--radius);
  border: 1px solid;
  font-size: 0.93rem;
}
.flash.success { background: rgba(15, 118, 110, 0.08); border-color: rgba(15, 118, 110, 0.4); color: var(--success); }
.flash.error   { background: rgba(185, 28, 28, 0.08);  border-color: rgba(185, 28, 28, 0.4);  color: var(--danger); }
.flash.info    { background: rgba(43, 44, 54, 0.06);   border-color: var(--border-strong);    color: var(--accent); }

.empty-state { padding: 24px 0; color: var(--muted); text-align: center; }

/* ---- Seite „in Vorbereitung“ (MS365-Sync) ---- */

.construction-hero {
  margin-bottom: 14px;
  border-left: 3px solid var(--primary);
}
.construction-hero h2 { margin: 10px 0 6px; font-size: 1.4rem; }
.construction-hero .subtitle { max-width: 70ch; }

/* Faktenliste mit Ja/Nein/Hinweis-Markern statt Aufzählungspunkten */
.fact-list { margin: 12px 0; padding: 0; list-style: none; }
.fact-list li {
  position: relative;
  margin-bottom: 8px;
  padding-left: 26px;
  font-size: 0.92rem;
  line-height: 1.45;
}
.fact-list li::before {
  position: absolute;
  left: 0;
  font-weight: 700;
}
.fact-list li.yes::before  { content: "✓"; color: var(--success); }
.fact-list li.no::before   { content: "✕"; color: var(--danger); }
.fact-list li.info::before { content: "→"; color: var(--text-accent); }

.task-list { margin: 10px 0 0; padding-left: 18px; font-size: 0.92rem; line-height: 1.5; }
.task-list li { margin-bottom: 7px; }
.task-list.numbered { padding-left: 20px; }

.link-list { margin: 8px 0 0; padding-left: 18px; font-size: 0.9rem; line-height: 1.5; }
.link-list li { margin-bottom: 6px; }

code {
  padding: 1px 5px;
  border-radius: 4px;
  background: var(--card-soft);
  border: 1px solid var(--border);
  font-size: 0.85em;
  overflow-wrap: anywhere;
}

/* ---- Detailseite ---- */

.detail-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr);
  align-items: start;
  gap: 14px;
}

.kv-list { margin: 0; display: grid; grid-template-columns: 130px minmax(0, 1fr); gap: 5px 12px; font-size: 0.92rem; }
.kv-list dt { color: var(--muted); }
.kv-list dd { margin: 0; overflow-wrap: anywhere; }

/* Kontaktkarte: Name + Aktion in einer Zeile, Funktion und
   Erreichbarkeit darunter – jede Angabe auf eigener Zeile,
   damit nichts umbricht oder an Trennzeichen hängen bleibt */
.contact-card-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
}
.contact-card-head strong { min-width: 0; overflow-wrap: anywhere; }
.contact-card-head .ghost-button { flex-shrink: 0; font-size: 0.8rem; }

.contact-position {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 2px;
  color: var(--muted);
  font-size: 0.86rem;
}

/* Kontaktangaben: beschriftet, damit Durchwahl und Mobil unterscheidbar sind.
   Leere Werte werden gar nicht erst ausgegeben (keine Platzhalter). */
.contact-details {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 2px 10px;
  margin: 8px 0 0;
  font-size: 0.86rem;
}
.contact-details dt { color: var(--muted); white-space: nowrap; }
.contact-details dd { margin: 0; overflow-wrap: anywhere; }

.contact-note {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 0.84rem;
  white-space: pre-line;
}

/* Aufklappbarer Kontakt (natives <details>): eingeklappt Name + Entscheider,
   aufgeklappt die Kontaktdaten. Marker aus, eigener Chevron rotiert. */
.contact-accordion > summary { cursor: pointer; list-style: none; }
.contact-accordion > summary::-webkit-details-marker { display: none; }
.contact-accordion > summary::marker { content: ""; }
.contact-summary { display: inline-flex; align-items: baseline; flex-wrap: wrap; gap: 8px; min-width: 0; }
.contact-accordion .chevron { flex-shrink: 0; color: var(--muted); transition: transform 140ms ease; }
.contact-accordion[open] .chevron { transform: rotate(180deg); }
.contact-accordion-body { margin-top: 8px; }
.contact-accordion-actions { margin-top: 10px; }

.contact-card, .activity-row, .todo-row {
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--card-soft);
  margin-bottom: 8px;
}
.activity-row .meta, .contact-card .meta, .todo-row .meta { color: var(--muted); font-size: 0.82rem; }
.activity-row p { margin: 6px 0 0; white-space: pre-line; }
.interaction-actions {
  display: flex;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: 6px 14px;
  margin-top: 6px;
}
.interaction-actions form { margin: 0; }
.interaction-edit > summary {
  display: inline-flex;
  list-style: none;
  cursor: pointer;
  font-size: 0.8rem;
}
.interaction-edit > summary::-webkit-details-marker { display: none; }
.interaction-edit > summary::marker { content: ""; }
.interaction-edit[open] { flex-basis: 100%; }
.interaction-edit-form {
  display: grid;
  gap: 8px;
  margin-top: 8px !important;
  padding-top: 10px;
  border-top: 1px solid var(--border);
}
.interaction-edit-form textarea { min-height: 110px; }
.interaction-edit-form .button { justify-self: start; }
.interaction-delete-form .ghost-button { font-size: 0.8rem; }

.todo-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.todo-row.done { opacity: 0.55; }
.todo-row .todo-actions { display: flex; flex-shrink: 0; gap: 6px; }

pre.notes { margin: 0; font: inherit; white-space: pre-wrap; }

/* Schlichte Aufzählung (z. B. zugeordnete Standorte eines Betreibers) */
.plain-list { list-style: none; margin: 0; padding: 0; }
.plain-list li { padding: 4px 0; border-bottom: 1px solid var(--border); }
.plain-list li:last-child { border-bottom: 0; }
.plain-list .sub { display: block; color: var(--muted); font-size: 0.82rem; }

/* ---- Login ---- */

.login-wrap { display: grid; min-height: 100vh; place-items: center; padding: 20px; }
.login-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.login-card {
  width: min(400px, 100%);
  padding: 28px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--card);
  box-shadow: var(--shadow);
}
.login-card .brand-logo { margin-bottom: 14px; }

/* Microsoft-365-Login-Button (neutrale Fläche mit Microsoft-Logo) */
.ms365-button {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  border-color: var(--border-strong);
  background: var(--card);
  color: var(--foreground);
}
.ms365-button:hover { background: var(--card-soft); }

.login-divider {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 14px 0;
  color: var(--muted);
  font-size: 0.82rem;
}
.login-divider::before,
.login-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--border);
}

/* ---- Darkmode-Feinheiten (Überschreibungen hartkodierter heller Flächen) ---- */

:root[data-theme="dark"] body {
  background:
    linear-gradient(180deg, rgba(0, 0, 0, 0.35), rgba(20, 22, 28, 0) 320px),
    linear-gradient(135deg, rgba(185, 5, 22, 0.14), rgba(20, 22, 28, 0) 420px),
    var(--background);
}

:root[data-theme="dark"] .topbar {
  background: linear-gradient(180deg, rgba(29, 32, 39, 0.98), rgba(38, 42, 51, 0.98)), var(--card);
}

/* Logo hat dunkle Bildanteile – im Darkmode auf hellem Chip zeigen */
:root[data-theme="dark"] .brand-logo {
  padding: 6px 10px;
  border-radius: 6px;
  background: #ffffff;
}

/* ---- Responsive ---- */

@media (max-width: 1200px) {
  .workspace.with-detail { grid-template-columns: 240px minmax(0, 1fr); }
  .workspace.with-detail .detail-quick {
    position: static;
    grid-column: 1 / -1;
    max-height: none;
  }
}

@media (max-width: 900px) {
  .workspace, .workspace.with-detail, .detail-grid { grid-template-columns: minmax(0, 1fr); }
  .main-nav { margin-left: 0; }
}
