/* Vertriebs-Dashboard — DUNKLES Theme (Petrol/Anthrazit-Basis).
   Gleiche Dunkel-Palette wie das Pandora-Kommandozentrum, fuer Konsistenz
   der internen Tools. NUR Optik dunkel — Struktur/Funktionen unveraendert. */

:root {
  /* --- Dunkle Petrol/Anthrazit-Palette (vom Kommandozentrum) --- */
  --bg: #0e2433;            /* Seiten-Hintergrund (tiefes Dunkel-Petrol) */
  --card: #16344a;          /* Karten-Hintergrund (abgesetzt) */
  --panel: #16344a;
  --ink: #e8eef3;           /* Fliesstext hell */
  --muted: #93a9bb;         /* gedaempfter Text */
  --line: #244b63;          /* Border/Linien */
  --brand: #16435f;         /* Petrol */
  --brand2: #7fb3d5;        /* helles Teal (Links, Eyebrow) */
  --brand-dk: #7fb3d5;      /* fuer Links/Akzent-Text auf Dunkel: helles Teal */
  --accent: #2e8b57;        /* Gruen (positiv) */
  --accent-dk: #3fae6e;     /* helleres Gruen (auf Dunkel lesbar) */
  --brand-soft: #1d4863;    /* aktive Tabs/Hover-Tint */
  --ink-soft: #c4d2dd;
  --ink-muted: #93a9bb;

  /* Hinweis-Flaechen (dunkel getoent) */
  --warn-bg: #2f2611;
  --warn-line: #5c4a1f;
  --warn-ink: #e7cf94;
  --ok-bg: #173f33;
  --ok-line: #2e6b4e;
  --ok-ink: #6fd0a0;

  --radius: 14px;
  --shadow: 0 1px 2px rgba(0,0,0,.25), 0 6px 18px rgba(0,0,0,.30);
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--ink);
  line-height: 1.5;
}
.wrap { width: 100%; max-width: 760px; margin: 0 auto; padding: 0 18px; }
.wrap.wide { max-width: 1040px; }

.site-header {
  background: linear-gradient(100deg, #0e2433 0%, #16435f 100%);
  color: #fff;
  padding: 22px 0;
  border-bottom: 3px solid var(--accent);
  box-shadow: var(--shadow);
}
.brand { display: flex; align-items: center; gap: 14px; }
.logo {
  display: inline-grid; place-items: center;
  width: 48px; height: 48px; border-radius: 12px;
  background: rgba(127,179,213,.18);
  color: #fff;
  font-weight: 800; letter-spacing: 1px; font-size: 18px;
}
.site-header h1 { margin: 0; font-size: 22px; }
.tagline { margin: 2px 0 0; font-size: 13px; opacity: .9; }

/* Censavo-Logo (waagerechte Wortmarke, SVG) */
.brand-logo { display: block; height: 56px; width: auto; }
.header-logo { height: 48px; }
.brand-subtitle { /* dezenter Untertitel unter/neben dem Logo */ }

main.wrap { padding-top: 22px; padding-bottom: 60px; }

.banner {
  border-radius: 12px; padding: 12px 14px; font-size: 14px;
  margin-bottom: 18px; border: 1px solid var(--line); background: var(--card);
  color: var(--ink);
}
.banner-info { background: var(--warn-bg); border-color: var(--warn-line); color: var(--warn-ink); }
.banner-ok { background: var(--ok-bg); border-color: var(--ok-line); color: var(--ok-ink); }
code { background: rgba(127,179,213,.14); color: var(--ink); padding: 1px 6px; border-radius: 6px; font-size: 12.5px; }

.card {
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 20px; margin-bottom: 18px;
  box-shadow: var(--shadow);
}
.card h2 { margin: 0 0 14px; font-size: 17px; color: var(--ink); }
.hint { color: var(--muted); font-size: 13.5px; }
a { color: var(--brand2); }

.field { display: flex; flex-direction: column; gap: 6px; font-size: 14px; }
.field > span { font-weight: 600; color: var(--ink-soft); }
input[type="text"], input[type="password"], select, textarea {
  width: 100%; padding: 10px 12px; border: 1px solid var(--line);
  border-radius: 10px; font-size: 15px; background: #0e2433; color: var(--ink);
  font-family: inherit; resize: vertical;
}
input::placeholder, textarea::placeholder { color: #6f8597; }
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--brand2); background: #102b3d;
  box-shadow: 0 0 0 3px rgba(127,179,213,.20);
}
select option { background: #16344a; color: var(--ink); }

.btn {
  border: none; border-radius: 10px; padding: 12px 18px; font-size: 15px;
  font-weight: 600; cursor: pointer; transition: filter .15s, transform .05s;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--accent); color: #fff; width: 100%; padding: 15px; font-size: 16px; }
.btn-primary:hover { background: var(--accent-dk); }
.btn-ghost { background: #1d4863; color: var(--ink); border: 1px solid var(--line); }
.btn-ghost:hover { filter: brightness(1.12); background: #234f6b; }
.btn-sm { padding: 7px 12px; font-size: 13px; }

.badge {
  display: inline-block; background: #1f3447; border: 1px solid var(--line);
  border-radius: 20px; padding: 2px 10px; font-size: 12px; color: var(--ink-soft);
}
.badge-retry { background: var(--warn-bg); border-color: var(--warn-line); color: #e0a05a; }

.site-footer { color: var(--ink-muted); font-size: 12.5px; padding: 24px 18px; text-align: center; }

/* ===== Topbar + Navigation ===== */
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap; }
.topbar-user { display: flex; align-items: center; gap: 10px; }
.who { font-size: 13.5px; opacity: .92; }
.topbar-user .btn-ghost { background: rgba(255,255,255,.14); color: #fff; border: 1px solid rgba(255,255,255,.30); font-size: 13.5px; padding: 8px 14px; }
.topbar-user .btn-ghost:hover { filter: brightness(1.18); background: rgba(255,255,255,.22); }
.mainnav { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 14px; }
.mainnav a {
  color: rgba(255,255,255,.9); text-decoration: none; font-size: 14px;
  font-weight: 600; padding: 7px 13px; border-radius: 8px;
}
.mainnav a:hover { background: rgba(255,255,255,.12); }
.mainnav a.on { background: rgba(127,179,213,.28); color: #fff; }

/* ===== Login ===== */
.login-body { display: grid; place-items: center; min-height: 100vh;
  background: linear-gradient(155deg, #0b1d2a 0%, #0e2433 55%, #16435f 100%); }
.login-wrap { width: 100%; max-width: 400px; padding: 20px; }
.login-card {
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 28px;
  border-top: 4px solid var(--accent);
  box-shadow: 0 18px 50px rgba(0,0,0,.55);
}
.brand-center { flex-direction: column; justify-content: center; gap: 8px; margin-bottom: 6px; }
.brand-center .logo { background: var(--accent); color: #fff; }
.brand-center .brand-logo { height: 68px; max-width: 100%; }
.brand-center h1 { color: var(--ink); font-size: 20px; }
.brand-center .brand-subtitle { font-size: 14px; font-weight: 600; color: var(--muted); letter-spacing: .04em; text-transform: uppercase; }
.login-sub { text-align: center; color: var(--muted); font-size: 14px; margin: 0 0 18px; }
.login-card .field { margin-bottom: 14px; }
.login-card .field > span { color: var(--brand2); font-weight: 700; letter-spacing: .03em; text-transform: uppercase; font-size: 12.5px; }
.login-card .btn-primary { margin-top: 6px; }
.login-hint { text-align: center; margin-top: 14px; }

/* ===== Sachgebiet-Umschalter (Immobilien / Alle) ===== */
.sg-switch {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  margin-bottom: 16px;
}
.sg-toggle {
  display: inline-flex; background: #102b3d; border: 1px solid var(--line);
  border-radius: 12px; padding: 4px; gap: 4px;
}
.sg-opt {
  display: inline-flex; align-items: center; gap: 8px;
  text-decoration: none; color: var(--muted);
  font-size: 14px; font-weight: 600; padding: 8px 14px; border-radius: 9px;
  transition: background .12s, color .12s;
}
.sg-opt:hover { color: var(--ink); }
.sg-opt.on { background: var(--accent); color: #fff; box-shadow: var(--shadow); }
.sg-num {
  display: inline-block; min-width: 20px; text-align: center;
  background: rgba(127,179,213,.18); color: var(--ink-soft); border-radius: 20px; padding: 1px 8px;
  font-size: 12px; font-weight: 700;
}
.sg-opt.on .sg-num { background: rgba(255,255,255,.25); color: #fff; }
.sg-info { white-space: nowrap; }
@media (max-width: 480px) { .sg-info { display: none; } }

/* ===== Anruf-Warteschlange ===== */
.queue-head { margin-bottom: 12px; }
.lead-card { padding: 22px; }
.lead-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.lead-name { margin: 0; font-size: 22px; color: var(--ink); }
.lead-firma { margin: 2px 0 0; color: var(--muted); font-size: 14.5px; }

.lead-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 18px; margin-bottom: 18px; }
.lead-field { font-size: 14.5px; color: var(--ink); }
.lead-field > span { display: block; font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .03em; color: var(--muted); margin-bottom: 3px; }
.lead-field-wide { grid-column: 1 / -1; }
@media (max-width: 560px) { .lead-grid { grid-template-columns: 1fr; } }

.tel-link {
  display: inline-block; background: var(--accent); color: #fff;
  text-decoration: none; padding: 8px 16px; border-radius: 10px;
  font-weight: 700; font-size: 16px;
}
.tel-link:hover { background: var(--accent-dk); }

.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { background: #1f3447; border: 1px solid var(--line); border-radius: 8px; padding: 3px 10px; font-size: 13px; color: var(--ink-soft); }

.result-note { margin: 6px 0 16px; }

.result-actions { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
@media (max-width: 560px) { .result-actions { grid-template-columns: 1fr 1fr; } }
.rbtn {
  border: 1px solid rgba(0,0,0,.25); border-radius: 10px; padding: 14px 10px;
  font-size: 14.5px; font-weight: 700; cursor: pointer; color: #fff;
  transition: filter .15s, transform .05s;
}
.rbtn:active { transform: translateY(1px); }
.rbtn:hover { filter: brightness(1.12); }
.rbtn:disabled { opacity: .5; cursor: default; }
.rbtn.loading { opacity: .8; }
/* 6 Outcome-Buttons: Signalfarben, auf Dunkel abgestimmt + lesbar (weisser Text) */
.r-interesse { background: #2e8b57; }   /* Gruen — Interesse */
.r-termin    { background: #2f7fb8; }   /* Blau — Termin */
.r-angebot   { background: #6f5fd6; }   /* Violett — Angebot */
.r-kein      { background: #c06a3e; }   /* Braun-Orange — kein Interesse */
.r-eigene    { background: #5a6470; }   /* Grau-Blau — eigene Loesung */
.r-nicht     { background: #c0392b; }   /* Rot — nicht erreicht */

/* Pandora-Vorbereitung */
.prep-box {
  background: var(--warn-bg); border: 1px solid var(--warn-line);
  border-radius: 12px; padding: 12px 14px; margin-bottom: 16px;
}
.prep-box.prep-empty { background: #122b3d; border-color: var(--line); }
.prep-label { font-size: 11.5px; font-weight: 800; text-transform: uppercase; letter-spacing: .04em; color: #e0a05a; margin-bottom: 4px; }
.prep-empty .prep-label { color: var(--muted); }
.prep-text { font-size: 14.5px; white-space: pre-wrap; color: var(--ink); }
.prep-edit { margin-top: 16px; border-top: 1px solid var(--line); padding-top: 12px; }
.prep-edit summary { cursor: pointer; font-weight: 600; font-size: 14px; color: var(--brand2); }
.prep-edit .field { margin: 12px 0; }
.prep-saved { margin-left: 10px; }
.prep-inline { margin: 8px 0; }

/* Leere Warteschlange */
.empty-card { text-align: center; padding: 40px 22px; }
.empty-icon { font-size: 44px; color: var(--accent-dk); }
.empty-card h2 { margin: 8px 0; }

.sync-flash { background: var(--ok-bg); border: 1px solid var(--ok-line); border-radius: 12px; padding: 11px 14px; font-size: 13.5px; color: var(--ok-ink); font-weight: 600; margin-bottom: 18px; }
.sync-flash[hidden] { display: none; }

/* ===== Pipeline-Uebersicht ===== */
.card-head-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.card-head-row h2 { margin: 0; }

.counter-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 10px; }
.counter {
  display: flex; flex-direction: column; align-items: flex-start;
  text-decoration: none; color: var(--ink);
  background: #122b3d; border: 1px solid var(--line); border-radius: 12px;
  padding: 12px 14px;
}
.counter:hover { border-color: var(--brand2); }
.counter.on { background: var(--brand-soft); border-color: var(--brand2); }
.cval { font-size: 24px; font-weight: 800; line-height: 1.1; color: var(--ink); }
.clabel { font-size: 12.5px; color: var(--muted); margin-top: 2px; }

.lead-row { border-bottom: 1px solid var(--line); padding: 14px 0; display: grid; grid-template-columns: 1fr auto; gap: 8px 14px; align-items: start; }
.lead-row:last-child { border-bottom: none; }
.lr-name { font-weight: 700; font-size: 15.5px; color: var(--ink); display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.lr-sub { margin-top: 3px; }
.lr-side { justify-self: end; }
.assign-sel { font-size: 13px; padding: 7px 9px; min-width: 150px; }
.lr-details { grid-column: 1 / -1; margin-top: 6px; }
.lr-details summary { cursor: pointer; font-size: 13.5px; font-weight: 600; color: var(--brand2); }
.histlist { list-style: none; margin: 10px 0 0; padding: 0; }
.histlist li { font-size: 13.5px; padding: 8px 10px; margin-top: 6px; background: #122b3d; border: 1px solid var(--line); border-radius: 8px; color: var(--ink); }
.htime { color: var(--muted); font-size: 12.5px; }
.hby { color: var(--muted); }
.hnote { margin-top: 4px; color: var(--ink-soft); }

/* Status-Badge-Farben (dunkel + lesbar) */
.st-offen { background: #1f3447; color: var(--ink-soft); }
.st-kontaktiert { background: #173247; border-color: #2f6286; color: var(--brand2); }
.st-termin { background: var(--ok-bg); border-color: var(--ok-line); color: var(--ok-ink); }
.st-angebot { background: #2a2452; border-color: #44417d; color: #b3aef0; }
.st-abschluss { background: #143a2b; border-color: #2e6b4e; color: #5fd99a; font-weight: 700; }
.st-kein_interesse { background: #3a1c1c; border-color: #6b2c2c; color: #e89090; }
.st-eigene_loesung { background: #232b33; border-color: #3a4753; color: #b3bcc6; }
.st-nicht_erreichbar { background: #3a2c12; border-color: #5c4620; color: #e0a05a; }

/* Statistik */
.counter.c-abschluss { background: #143a2b; border-color: #2e6b4e; }
.counter.c-abschluss .cval { color: #5fd99a; }
.stat-table { width: 100%; border-collapse: collapse; margin-top: 6px; }
.stat-table th, .stat-table td {
  text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line);
}
.stat-table th { color: var(--muted); font-weight: 600; font-size: 0.92em; }
.stat-table td.num, .stat-table th.num { text-align: right; }
.stat-table tbody tr:hover { background: var(--brand-soft); }

@media (max-width: 560px) {
  .lead-row { grid-template-columns: 1fr; }
  .lr-side { justify-self: start; }
}
