/* Assistora Admin — Farben aus Website V2 „Studio hell" */
:root {
  --bg: #FFFCF5; --card: #FFFFFF; --ink: #27203C; --muted: #6E6680; --faint: #9A93AB;
  --line: #EBE4D8; --line-strong: #D8CEBC;
  --amber: #F59E0B; --amber-deep: #B45309; --amber-soft: #FDEBC8;
  --green: #1FA463; --green-deep: #0B7A45; --green-soft: #D9F3E4;
  --coral: #E85D4A; --coral-deep: #C04432; --coral-soft: #FBDDD6;
  --blue: #3E7CB9; --blue-deep: #2D5F93; --blue-soft: #D9E9F7;
  --violet-deep: #5F41B5; --violet-soft: #E7DFF9;
  --teal: #0E9488; --teal-deep: #0B6F66; --teal-soft: #D2EEEB;
  --night: #262041;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(39,32,60,.05), 0 4px 16px rgba(39,32,60,.04);
  font-family: "Avenir Next", "Segoe UI Variable Text", "Segoe UI", system-ui, -apple-system, sans-serif;
  color: var(--ink);
  color-scheme: light;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--ink); font-size: 15px; line-height: 1.45; -webkit-font-smoothing: antialiased; }
[hidden] { display: none !important; }
a { color: var(--teal-deep); }
h1 { font-size: 26px; letter-spacing: -.01em; margin: 0; }
h2 { font-size: 15px; margin: 0; font-weight: 600; }
h3 { font-size: 17px; margin: 0; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.muted { color: var(--muted); } .small { font-size: 13px; }
.row { display: flex; align-items: center; gap: 12px; }

/* Buttons */
.btn { font: inherit; font-size: 14px; font-weight: 600; border: 1px solid var(--line-strong); background: var(--card); color: var(--ink);
  border-radius: 10px; padding: 9px 16px; cursor: pointer; transition: background .15s, border-color .15s; }
.btn:hover { border-color: var(--ink); }
.btn:disabled { opacity: .5; cursor: default; }
.btn.small { font-size: 13px; padding: 6px 11px; border-radius: 8px; }
.btn.primary { background: var(--night); color: #fff; border-color: var(--night); }
.btn.primary:hover { background: #3a3260; }
.btn.green { background: var(--green-deep); border-color: var(--green-deep); color: #fff; }
.btn.ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn.ghost:hover { color: var(--ink); border-color: var(--line-strong); }
.btn:focus-visible, a:focus-visible, select:focus-visible, input:focus-visible { outline: 2px solid var(--teal); outline-offset: 2px; }

/* Brand */
.brand { display: flex; align-items: center; gap: 10px; font-size: 17px; white-space: nowrap; }
.brand b { font-weight: 600; color: var(--muted); }
.logo { width: 30px; height: 30px; border-radius: 9px; background: var(--night); color: var(--amber); display: grid; place-items: center;
  font-weight: 700; font-size: 19px; line-height: 1; padding-bottom: 3px; }

/* Login */
.login { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.login-card { width: 100%; max-width: 360px; background: var(--card); border: 1px solid var(--line); border-radius: 18px; padding: 28px;
  box-shadow: var(--shadow); display: grid; gap: 16px; }
.login-card .brand { margin-bottom: 6px; }
label { display: grid; gap: 6px; font-size: 13px; font-weight: 600; color: var(--muted); }
input, select { font: inherit; font-size: 15px; color: var(--ink); background: #fff; border: 1px solid var(--line-strong); border-radius: 10px; padding: 10px 12px; }
.form-error { color: var(--coral-deep); font-size: 13px; margin: 0; min-height: 1em; }

/* Layout */
.topbar { position: sticky; top: 0; z-index: 5; background: rgba(255,252,245,.92); backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 24px; padding: 12px 24px; }
.tabs { display: flex; gap: 4px; flex: 1; overflow-x: auto; scrollbar-width: none; }
.tabs a { text-decoration: none; color: var(--muted); font-weight: 600; font-size: 14px; padding: 8px 12px; border-radius: 9px; white-space: nowrap;
  display: inline-flex; align-items: center; gap: 6px; }
.tabs a:hover { color: var(--ink); background: rgba(39,32,60,.04); }
.tabs a.on { color: var(--ink); background: var(--amber-soft); }
.badge { background: var(--amber); color: var(--night); font-size: 11px; font-weight: 700; border-radius: 99px; padding: 1px 7px; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--coral); }
.content { max-width: 1180px; margin: 0 auto; padding: 28px 24px 64px; }
.content > section { display: grid; grid-template-columns: minmax(0, 1fr); gap: 20px; }
.head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.stamp { color: var(--faint); font-size: 13px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; box-shadow: var(--shadow); min-width: 0; }
.card-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 12px; flex-wrap: wrap; }
.grid-2 { display: grid; grid-template-columns: 1.5fr 1fr; gap: 20px; }
.link { font-size: 13px; font-weight: 600; text-decoration: none; }
.empty { color: var(--muted); margin: 8px 0; }

/* KPIs */
.kpis { display: grid; grid-template-columns: repeat(6, 1fr); gap: 12px; }
.kpi { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; display: grid; gap: 2px;
  text-decoration: none; color: inherit; box-shadow: var(--shadow); border-top: 3px solid var(--line); }
a.kpi:hover { border-color: var(--line-strong); }
.kpi.amber { border-top-color: var(--amber); } .kpi.coral { border-top-color: var(--coral); } .kpi.green { border-top-color: var(--green); }
.kpi-label { font-size: 12px; font-weight: 600; color: var(--muted); }
.kpi-value { font-size: 28px; font-weight: 700; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.kpi-sub { font-size: 12px; color: var(--faint); }

/* Charts */
.chart svg { width: 100%; height: auto; display: block; }
.bars .grid { stroke: var(--line); stroke-width: 1; }
.bars .axis { stroke: var(--line-strong); stroke-width: 1; }
.bars .tick { fill: var(--faint); font-size: 11px; font-family: inherit; }
.bars rect.in { fill: var(--teal); } .bars rect.out { fill: var(--amber); }
.bars rect:hover { opacity: .8; }
.legend { font-size: 12px; color: var(--muted); display: inline-flex; align-items: center; gap: 6px; }
.sw { width: 10px; height: 10px; border-radius: 3px; display: inline-block; margin-left: 6px; }
.sw.in { background: var(--teal); } .sw.out { background: var(--amber); }
.hbars { display: grid; gap: 10px; }
.hbar { display: grid; grid-template-columns: 160px 1fr 32px; align-items: center; gap: 10px; font-size: 13px; }
.hbar-label { color: var(--ink); }
.hbar-track { height: 10px; background: var(--bg); border-radius: 99px; overflow: hidden; }
.hbar-fill { display: block; height: 100%; background: var(--teal); border-radius: 99px; }
.hbar-n { text-align: right; font-weight: 700; font-variant-numeric: tabular-nums; }

/* Tags */
.tag { display: inline-block; font-size: 11px; font-weight: 700; letter-spacing: .02em; padding: 2px 8px; border-radius: 99px; text-decoration: none;
  background: var(--line); color: var(--ink); }
.tag.coral { background: var(--coral-soft); color: var(--coral-deep); }
.tag.coral.soft { background: #fff; border: 1px solid var(--coral-soft); }
.tag.amber { background: var(--amber-soft); color: var(--amber-deep); }
.tag.blue { background: var(--blue-soft); color: var(--blue-deep); }
.tag.violet { background: var(--violet-soft); color: var(--violet-deep); }
.tag.teal { background: var(--teal-soft); color: var(--teal-deep); }
.tags { display: flex; gap: 6px; flex-wrap: wrap; }

/* Leads */
.seg { display: flex; gap: 4px; background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 4px; width: max-content; max-width: 100%; overflow-x: auto; }
.seg button { font: inherit; font-size: 13px; font-weight: 600; border: 0; background: transparent; color: var(--muted); padding: 7px 12px; border-radius: 8px; cursor: pointer; white-space: nowrap; }
.seg button.on { background: var(--night); color: #fff; }
.seg button span { opacity: .7; margin-left: 4px; font-variant-numeric: tabular-nums; }
.lead-list > div { display: grid; gap: 12px; }
.lead-list.compact { display: grid; gap: 10px; }
.lead { background: var(--card); border: 1px solid var(--line); border-left: 4px solid var(--amber); border-radius: var(--radius); padding: 14px 18px; display: grid; gap: 8px; box-shadow: var(--shadow); }
.lead.contacted { border-left-color: var(--blue); } .lead.won { border-left-color: var(--green); } .lead.closed { border-left-color: var(--line-strong); }
.lead-list.compact .lead { box-shadow: none; padding: 10px 14px; }
.lead-top { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.lead-who { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.lead-who strong { font-size: 16px; }
.phone { font-size: 14px; font-variant-numeric: tabular-nums; font-weight: 600; text-decoration: none; }
.phone:hover { text-decoration: underline; }
.lead-meta { display: flex; gap: 10px; align-items: baseline; font-size: 13px; color: var(--muted); }
.lead-meta .lead-tenant { font-weight: 600; color: var(--ink); }
.facts { display: grid; grid-template-columns: max-content 1fr; gap: 2px 12px; margin: 0; font-size: 14px; }
.facts dt { color: var(--muted); } .facts dd { margin: 0; }
.note { margin: 0; font-size: 14px; color: var(--ink); background: var(--bg); border-radius: 10px; padding: 8px 12px; white-space: pre-wrap; overflow-wrap: anywhere; }
.lead-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; padding-top: 4px; }
.spacer { flex: 1; }
.status { font-size: 12px; font-weight: 700; color: var(--muted); }
.status.won { color: var(--green-deep); } .status.contacted { color: var(--blue-deep); } .status.new, .status.notified { color: var(--amber-deep); }

/* Kunden */
.tenant-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 16px; }
.tenant { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; display: grid; gap: 14px; box-shadow: var(--shadow); align-content: start; }
.tenant.master { background: linear-gradient(180deg, var(--teal-soft) 0, #fff 70px); }
.tenant.paused { opacity: .75; }
.tenant-head { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; }
.pill { font-size: 12px; font-weight: 700; padding: 3px 10px; border-radius: 99px; background: var(--line); white-space: nowrap; }
.pill.active { background: var(--green-soft); color: var(--green-deep); }
.pill.onboarding { background: var(--amber-soft); color: var(--amber-deep); }
.pill.paused { background: var(--coral-soft); color: var(--coral-deep); }
.tenant-facts { display: grid; grid-template-columns: 110px 1fr; gap: 3px 10px; margin: 0; font-size: 14px; }
.tenant-facts dt { color: var(--muted); } .tenant-facts dd { margin: 0; overflow-wrap: anywhere; }
.tenant-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); padding: 12px 0; }
.stat { display: grid; gap: 1px; align-content: start; }
.stat-value { font-size: 17px; font-weight: 700; font-variant-numeric: tabular-nums; }
.stat-label { font-size: 11px; color: var(--muted); line-height: 1.25; }
.meter { height: 4px; background: var(--line); border-radius: 99px; overflow: hidden; margin-top: 4px; }
.meter > span { display: block; height: 100%; background: var(--teal); }
.meter.warm > span { background: var(--amber); } .meter.hot > span { background: var(--coral); }
.tenant-foot { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

/* Betrieb */
.hl-banner { border-radius: var(--radius); padding: 14px 18px; font-weight: 600; }
.hl-banner.ok { background: var(--green-soft); color: var(--green-deep); }
.hl-banner.bad { background: var(--coral-soft); color: var(--coral-deep); }
#hl-groups { display: grid; grid-template-columns: repeat(auto-fill, minmax(420px, 1fr)); gap: 16px; }
.checks { list-style: none; margin: 10px 0 0; padding: 0; display: grid; }
.checks li { display: grid; grid-template-columns: 14px 1fr auto 64px; gap: 10px; align-items: center; padding: 9px 0; border-top: 1px solid var(--line); font-size: 14px; }
.checks li:first-child { border-top: 0; }
.led { width: 10px; height: 10px; border-radius: 50%; background: var(--green); box-shadow: 0 0 0 3px var(--green-soft); }
.checks li.bad .led { background: var(--coral); box-shadow: 0 0 0 3px var(--coral-soft); }
.check-name { display: grid; min-width: 0; }
.check-name .small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.check-detail { font-size: 12px; color: var(--muted); text-align: right; }
.checks li.bad .check-detail { color: var(--coral-deep); font-weight: 600; }
.check-ms { font-size: 12px; color: var(--faint); text-align: right; font-variant-numeric: tabular-nums; }
.check-ms.slow { color: var(--amber-deep); font-weight: 700; }

/* Toast */
.toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); background: var(--night); color: #fff; padding: 10px 18px; border-radius: 10px; font-size: 14px; font-weight: 600; box-shadow: 0 8px 24px rgba(0,0,0,.18); z-index: 20; }
.toast.bad { background: var(--coral-deep); }

/* Responsive */
@media (max-width: 1050px) { .kpis { grid-template-columns: repeat(3, 1fr); } .grid-2 { grid-template-columns: 1fr; } }
@media (max-width: 640px) {
  .topbar { flex-wrap: wrap; gap: 8px 12px; padding: 10px 16px; }
  .topbar .brand { flex: 1; }
  .tabs { order: 3; flex-basis: 100%; }
  .content { padding: 20px 16px 48px; }
  .kpis { grid-template-columns: repeat(2, 1fr); }
  .kpi-value { font-size: 24px; }
  .tenant-list, #hl-groups { grid-template-columns: 1fr; }
  .tenant-stats { grid-template-columns: repeat(2, 1fr); }
  .hbar { grid-template-columns: 120px 1fr 28px; }
  .checks li { grid-template-columns: 14px 1fr 56px; }
  .check-detail { grid-column: 2 / 4; text-align: left; }
  .lead-actions .spacer { display: none; }
}

/* Grid-Kinder dürfen schrumpfen (sonst drückt die Filterleiste die Seite breiter) */
.content > section > * { min-width: 0; }
.stat-value { white-space: nowrap; }
@media (max-width: 1250px) { .stat-value { font-size: 15px; } }
