:root {
  --gold: #c8a951;
  --gold-dark: #a8893a;
  --gold-soft: #f4ecd6;
  --ink: #1a1a1a;
  --ink-soft: #3a3a3a;
  --bg: #f6f5f2;
  --card: #ffffff;
  --border: #e7e3d9;
  --muted: #717171;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--ink);
}

/* Topbar: weiss mit Gold-Akzentlinie, schwarzes Logo */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  background: #fff; padding: 0 22px; height: 62px;
  border-bottom: 3px solid var(--gold);
  box-shadow: 0 1px 4px rgba(0,0,0,.05);
}
.brand { display: flex; align-items: center; gap: 12px; text-decoration: none; }
.brand img { height: 34px; width: auto; display: block; }
.brand-tag {
  color: var(--gold-dark); font-weight: 700; font-size: 11px; letter-spacing: 1.5px;
  text-transform: uppercase; border-left: 1px solid var(--border); padding-left: 12px;
}
.topnav { display: flex; align-items: center; gap: 20px; }
.topnav a { color: var(--ink-soft); text-decoration: none; font-weight: 600; font-size: 14px; }
.topnav a:hover { color: var(--gold-dark); }
.topnav .user { color: var(--gold-dark); font-weight: 700; }
.topnav .logout { color: var(--muted); font-weight: 500; }

.container { max-width: 1120px; margin: 28px auto; padding: 0 22px; }
h1 { font-size: 24px; margin: 0 0 16px; font-weight: 700; }
h2 { font-size: 18px; margin: 0 0 8px; }
h3 { font-size: 15px; margin: 0 0 8px; }

.card {
  background: var(--card); border: 1px solid var(--border); border-radius: 12px;
  padding: 20px; box-shadow: 0 1px 3px rgba(0,0,0,.05);
}
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 16px; }
.linkcard { text-decoration: none; color: inherit; transition: border-color .15s, transform .15s, box-shadow .15s; }
.linkcard:hover { border-color: var(--gold); transform: translateY(-2px); box-shadow: 0 6px 18px rgba(200,169,81,.18); }
.muted { color: var(--muted); }
.error { color: #8a1020; background: #fbe7ea; padding: 8px 12px; border-radius: 6px; }
.flash { background: var(--gold-soft); border: 1px solid var(--gold); color: #715c1c; padding: 10px 14px; border-radius: 8px; margin-bottom: 16px; }
.card.login { max-width: 380px; margin: 64px auto; }
.card.login h1 { text-align: center; }

form label { display: block; margin: 12px 0; font-weight: 600; font-size: 14px; }
input, select, textarea {
  width: 100%; padding: 10px 12px; margin-top: 6px; font-size: 15px;
  border: 1px solid var(--border); border-radius: 8px; font-weight: 400; font-family: inherit;
  background: #fff;
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--gold); border-color: var(--gold); }
textarea { resize: vertical; }

button, .btn {
  display: inline-block; background: var(--ink); color: #fff; border: 0; border-radius: 8px;
  padding: 10px 18px; font-size: 15px; cursor: pointer; font-weight: 600; text-decoration: none;
  transition: background .15s, color .15s;
}
button:hover, .btn:hover { background: var(--gold); color: var(--ink); }
.btn.ghost, button.ghostbtn { background: #fff; color: var(--ink); border: 1px solid var(--ink); }
.btn.ghost:hover, button.ghostbtn:hover { background: var(--gold-soft); border-color: var(--gold); color: var(--ink); }

table { width: 100%; border-collapse: collapse; background: var(--card); border: 1px solid var(--border); border-radius: 10px; overflow: hidden; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--border); font-size: 14px; vertical-align: top; }
th { background: #faf8f3; font-weight: 700; color: var(--ink); }
tr:last-child td { border-bottom: 0; }
a { color: var(--gold-dark); }
a:hover { color: var(--ink); }

.badge { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 12px; font-weight: 700; background: #efece4; color: var(--ink-soft); }
.badge.ok { background: #e4f4e7; color: #1c7a3a; }
.badge.bad { background: #fbe7ea; color: #8a1020; }
.badge.warn { background: var(--gold-soft); color: #715c1c; }

.inline-form { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.inline-form input, .inline-form select { width: auto; margin-top: 0; }
.dispo { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.dispo select, .dispo button { width: auto; margin-top: 0; font-size: 13px; padding: 7px 11px; }

/* Lead-Score (Analytics-Cockpit) — bewusst ruhig: Gold nur als Akzent bei warmen/heissen Leads.
   Kompakte Zeilen: schmales Padding, engere Zeilenhoehe, kleinere Schrift fuer lange Listen. */
.table-scroll th, .table-scroll td { padding: 6px 12px; line-height: 1.35; font-size: 13px; }
.table-scroll td { vertical-align: middle; }  /* Inhalte (Kontakt etc.) mittig in der Zeilenhoehe */
.table-scroll .muted { font-size: 12px; }
.table-scroll a { font-size: 13px; }
.scorecell { min-width: 130px; }
.scorewrap { display: flex; align-items: center; gap: 8px; }
.scorenum  { font-weight: 800; font-size: 14px; min-width: 22px; color: var(--muted); }
.scorenum.warm { color: var(--ink); }
.scorenum.hot  { color: var(--gold-dark); }
.scorebar  { width: 56px; height: 6px; background: #eeebe2; border-radius: 999px; overflow: hidden; }
.scorefill { height: 100%; background: #cfc9ba; }
.scorefill.warm, .scorefill.hot { background: linear-gradient(90deg, #e3cf8f, var(--gold), var(--gold-dark)); }
/* Detail-Chips als Hover-Panel: Zeile bleibt flach, Details erscheinen beim Drueberfahren ueber den Score */
.scorecell { position: relative; }
.scorecell .scorewrap { cursor: help; }
.chips { display: none; position: absolute; z-index: 20; top: calc(100% - 4px); left: 8px;
         flex-wrap: wrap; gap: 4px; max-width: 260px; width: max-content;
         background: #fff; border: 1px solid var(--border); border-radius: 10px;
         padding: 8px 10px; box-shadow: 0 6px 18px rgba(0,0,0,.12); }
.scorecell:hover .chips { display: flex; }
.chip  { font-size: 10.5px; padding: 1px 7px; border-radius: 999px; background: #f7f5ee;
         border: 1px solid var(--border); color: var(--muted); white-space: nowrap; }
.chip-hot { background: var(--gold-soft); border-color: var(--gold); color: #715c1c; font-weight: 700; }
.dayrow td { background: transparent; color: var(--muted); font-weight: 700; font-size: 11px;
             letter-spacing: 1px; text-transform: uppercase; padding: 14px 12px 4px; border-bottom: 0; }
.table-scroll { overflow-x: auto; }
.table-scroll tbody tr:hover td { background: #fcfbf7; }
.table-scroll tbody tr.dayrow:hover td { background: transparent; }
.nowrap { white-space: nowrap; }
.weblink { display: inline-block; max-width: 190px; overflow: hidden; text-overflow: ellipsis;
           white-space: nowrap; vertical-align: bottom; }
.aktioncell { white-space: nowrap; }
.dispo-slim { flex-wrap: nowrap; }
.dispo-slim button { font-size: 12px; padding: 5px 9px; }

/* Sortierbare Spaltenkoepfe */
.sorth { color: var(--ink); text-decoration: none; }
.sorth:hover { color: var(--gold-dark); text-decoration: underline; }
.sorth.active { color: var(--gold-dark); }
.sortmark { font-size: 9px; }

/* Ergebnis-Dropdown (ersetzt Buttons + Ergebnis-Spalte) */
.dispo-select { width: auto; margin-top: 0; font-size: 12px; padding: 4px 6px; font-weight: 600;
                border-radius: 8px; cursor: pointer; }
.dispo-select.offen { color: var(--muted); font-weight: 400; }
.dispo-select.termin { background: #e4f4e7; color: #1c7a3a; border-color: #bfe3c8; }
.dispo-select.follow_up { background: var(--gold-soft); color: #715c1c; border-color: var(--gold); }
.dispo-select.kein_interesse { background: #fbe7ea; color: #8a1020; border-color: #f0c2ca; }

/* Info-Icon mit Hover-Panel (Score-Erklaerung) */
.infowrap { position: relative; display: inline-block; vertical-align: middle; margin-left: 6px; }
.infoicon { display: inline-flex; align-items: center; justify-content: center; width: 18px; height: 18px;
            border-radius: 50%; border: 1.5px solid var(--border); color: var(--muted);
            font-size: 12px; font-weight: 700; font-style: italic; cursor: help; }
.infowrap:hover .infoicon { border-color: var(--gold); color: var(--gold-dark); }
.infopanel { display: none; position: absolute; z-index: 30; top: 24px; left: -8px; width: 300px;
             background: #fff; border: 1px solid var(--border); border-radius: 10px;
             padding: 12px 14px; box-shadow: 0 8px 24px rgba(0,0,0,.14);
             font-size: 12.5px; font-weight: 400; color: var(--ink-soft); line-height: 1.5; }
.infowrap:hover .infopanel { display: block; }
.infotable { width: 100%; border: 0; margin-top: 6px; }
.infotable td { border: 0; padding: 2px 0; font-size: 12.5px; }
.infotable td:last-child { text-align: right; font-weight: 700; color: var(--gold-dark); white-space: nowrap; }

/* Kennzahlen-Leiste (schlank, eine Zeile) */
.statbar { display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
           background: var(--card); border: 1px solid var(--border); border-radius: 10px;
           padding: 10px 16px; margin-top: 8px; font-size: 13.5px; color: var(--muted); }
.statbar b { font-size: 16px; color: var(--ink); font-weight: 800; margin-right: 3px; }
.stat-gold b { color: var(--gold-dark); }
.statsep { width: 1px; height: 18px; background: var(--border); }
@media (max-width: 900px) { th, td { font-size: 13px; padding: 8px; } .statsep { display: none; } }

.funnel { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 8px; }
.fbox { background: var(--card); border: 1px solid var(--border); border-radius: 12px; padding: 16px 24px; min-width: 116px; text-align: center; }
.fbox.highlight { border-color: var(--gold); background: var(--gold-soft); }
.fbox .fn { font-size: 28px; font-weight: 800; color: var(--ink); }
.fbox.highlight .fn { color: var(--gold-dark); }
.fbox .fl { font-size: 12px; color: var(--muted); margin-top: 2px; font-weight: 600; }

/* ---- Breite Seiten (Analytics + Branchenseite): eine Regel statt Inline-Styles ---- */
.container.wide { max-width: min(1560px, 96vw); }

/* ---- Reiter: ein Bereich zur Zeit, Rest bleibt ruhig ---- */
.tabs { display: flex; gap: 3px; border-bottom: 2px solid var(--border); margin-top: 18px; flex-wrap: wrap; }
.tabs button {
  font: inherit; font-size: 14px; font-weight: 600; cursor: pointer; color: var(--muted);
  background: transparent; border: 0; border-bottom: 2px solid transparent; border-radius: 0;
  padding: 9px 16px; margin-bottom: -2px; width: auto;
  display: flex; align-items: center; gap: 7px;
}
.tabs button:hover { color: var(--ink); background: transparent; }
.tabs button:focus-visible { outline: 2px solid var(--gold); outline-offset: -2px; }
.tabs button[aria-selected="true"] { color: var(--ink); border-bottom-color: var(--gold); }
.tabs .pill {
  font-size: 11px; font-weight: 700; padding: 1px 8px; border-radius: 999px;
  background: #efece4; color: var(--ink-soft);
}
.tabs button[aria-selected="true"] .pill { background: var(--gold-soft); color: var(--gold-dark); }
.tabpane { padding-top: 16px; }
.pane-head { display: flex; align-items: center; justify-content: space-between; gap: 14px;
             flex-wrap: wrap; margin-bottom: 10px; }
.pane-head p { margin: 0; font-size: 13px; color: var(--muted); max-width: 64ch; }
.pane-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

/* Aufklappbare Bereiche fuer Formulare und Hilfetexte */
details.panel { margin-top: 10px; border: 1px solid var(--border); border-radius: 10px;
                background: var(--card); overflow: hidden; }
details.panel > summary { cursor: pointer; padding: 10px 14px; font-size: 13.5px; font-weight: 600;
                          list-style: none; display: flex; align-items: center; gap: 8px; }
details.panel > summary::-webkit-details-marker { display: none; }
details.panel > summary::before { content: "+"; color: var(--gold-dark); font-weight: 800; width: 11px; }
details.panel[open] > summary::before { content: "3"; }
details.panel > summary:hover { background: #faf8f3; }
details.panel > summary:focus-visible { outline: 2px solid var(--gold); outline-offset: -2px; }
.panel-in { padding: 14px; border-top: 1px solid var(--border); }
.panel-in form label:first-child { margin-top: 0; }

/* Kennzahlenleiste: Zahl ueber Wort, klar getrennt */
.statbar.blocks { padding: 0; gap: 0; overflow: hidden; }
.statbar.blocks .s { padding: 11px 20px; border-right: 1px solid var(--border); font-size: 12.5px; }
.statbar.blocks .s:last-child { border-right: 0; }
.statbar.blocks .s b { display: block; font-size: 20px; line-height: 1.15; margin: 0 0 1px; }

/* Wiederholungs-Scan: gehoert in die Zeile, nicht ins Hover-Panel - zu starkes Signal */
td.nowrap .chip { display: inline-block; margin-top: 3px; white-space: nowrap; }


/* ---- A/B-Analyse (07.09.2026) ---- */
.zeilenzusatz { font-size: 12px; color: #8a8578; white-space: nowrap; }
tr.nichtversendet td { color: #8a8578; background: #fbfaf7; }
tr.nichtversendet td b { color: #6f6a5e; }
.vgl-urteil { border-left: 4px solid var(--gold); }
.vgl-chart { margin-top: 10px; padding: 10px 6px; background: #fff; border: 1px solid #e6e2d8; border-radius: 6px; }
.vgl-legend { display: flex; flex-wrap: wrap; gap: 14px; margin-top: 8px; font-size: 13px; }
.vgl-legend i { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 6px; }

/* Erklaerfenster mit Fliesstext (A/B-Analyse). Das schmale .infotable-Muster der
   Anrufliste passt hier nicht: dessen rechte Spalte ist auf EINE Zeile festgelegt
   (white-space: nowrap) und war fuer Zahlen wie "+15" gedacht - ganze Saetze liefen
   damit aus dem Kasten heraus. */
.infopanel.breit { width: 430px; max-width: 78vw; }
.infoliste { margin: 8px 0 0; padding: 0; }
.infoliste dt { font-weight: 700; color: var(--ink); margin-top: 9px; }
.infoliste dt:first-child { margin-top: 0; }
.infoliste dd { margin: 1px 0 0; }

/* --- Aussendungs-Historie in der Anrufliste (09.09.2026) -------------------
   Bauform bewusst wie .infopanel: reines CSS, kein Skript. Zusaetzlich
   :focus-within + tabindex am Abzeichen -> auch per Tastatur erreichbar.
   Grenze: .table-scroll hat overflow-x:auto und wird dadurch auch auf der
   Y-Achse zum Scroll-Container - Panels der letzten Zeilen werden beschnitten.
   Das gilt fuer .chips heute genauso; max-height + eigenes Scrollen daempft es. */
/* Padding statt margin: das ist die Hover-Bruecke. Mit einem Spalt zwischen Abzeichen
   und Panel reisst :hover ab, sobald man langsam hinuebergleitet. */
.histwrap { position: relative; display: inline-block; padding: 4px 0; margin: 0 0 -4px; }
.histbadge { display: inline-block; padding: 1px 8px; border-radius: 999px; cursor: help;
             font-size: 10.5px; font-weight: 700; background: var(--gold-soft);
             border: 1px solid var(--gold); color: #715c1c; white-space: nowrap; }
.histbadge:focus-visible { outline: 2px solid var(--gold-dark); outline-offset: 2px; }
.histpanel { display: none; position: absolute; z-index: 25; top: 100%; right: 0;
             width: 330px; max-width: 70vw; max-height: 220px; overflow: auto;
             background: #fff; border: 1px solid var(--border); border-radius: 10px;
             padding: 10px 12px; box-shadow: 0 8px 24px rgba(0,0,0,.14);
             font-size: 12px; font-weight: 400; color: var(--ink-soft); line-height: 1.45;
             text-align: left; white-space: normal; }
/* Erims Wunsch 09.09.: ueber die Kampagnen-Zelle gleiten genuegt - man muss nicht das
   kleine Abzeichen treffen. Gleiches Muster wie .scorecell:hover .chips weiter oben.
   Das Panel ist Nachfahre der Zelle, deshalb bleibt es beim Lesen offen. */
.kampacell { position: relative; }
.kampacell:hover .histpanel,
.histwrap:hover .histpanel,
.histwrap:focus-within .histpanel { display: block; }
/* Die untersten Zeilen klappen nach OBEN: table{overflow:hidden} (fuer die runden Ecken)
   schneidet absolut positionierte Nachfahren hart ab - da hilft kein Scrollen.
   -n+4 puffert, dass die Tagestrenner (tr.dayrow) mitgezaehlt werden; das :not(...)
   bewahrt kurze Listen davor, nach oben gegen den Tabellenkopf zu laufen. */
.table-scroll tbody tr:nth-last-child(-n+4):not(:nth-child(-n+3)) .histpanel {
  top: auto; bottom: 100%;
}
.histrow { padding: 6px 0; border-top: 1px solid var(--border); }
.histrow:first-of-type { border-top: 0; }
.histrow .muted { font-size: 11.5px; }
.hist-aktuell { background: #fbf9f1; margin: 0 -12px; padding-left: 12px; padding-right: 12px; }
.hist-aus { opacity: .55; }
.histmark { font-size: 10px; font-weight: 700; color: var(--gold-dark); text-transform: uppercase;
            letter-spacing: .04em; }
/* Hinweis auf ein frueheres Ergebnis (anderer Brief derselben Firma) */
.fruehmarke { margin-bottom: 5px; }
.fruehmarke .badge { font-size: 10.5px; padding: 1px 8px; }
.fruehmarke .muted { font-size: 11px; margin-top: 1px; }
/* Angeschrieben-Historie im Leads-Reiter der Branchenseite */
.histpanel.schmal { width: 300px; }
.histrow .badge { font-size: 10.5px; padding: 1px 8px; }
.histnote { font-style: italic; overflow-wrap: anywhere; }
