/* ═══════════════════════════════════════════════
   Leadb2b Plattform · Design-System
   Direkt abgeleitet aus dem Triptych (index.html):
   gleiche Borders, Shadows, Panel-Gradients, Chips.
═══════════════════════════════════════════════ */
:root {
  --page: #f0f0f0;
  --surface: #ffffff;
  --panel: #f6faff;
  --ink: #282828;
  --ink-strong: #151515;
  --muted: #777;
  --muted2: #9aa1ad;
  --accent: #0b5fff;
  --accent-strong: #0549c8;
  --accent-soft: #d9e6ff;
  --accent-faint: #eef4ff;
  --green: #4d8c35;
  --green-soft: #e6f2e0;
  --amber: #b97a00;
  --amber-soft: #fdf1d8;
  --red: #c0392b;
  --red-soft: #fdeceb;
  --line: rgb(218 232 255 / 96%);
  --card-shadow:
    4px 12px 22px rgb(29 39 56 / 11%),
    0 2px 6px rgb(29 39 56 / 3.5%);
  --card-shadow-soft:
    2px 6px 14px rgb(29 39 56 / 8%),
    0 1px 4px rgb(29 39 56 / 3%);
  --radius: 20px;
  --radius-inner: 14px;
  --font: "Segoe UI Variable", "Segoe UI", -apple-system, "SF Pro Text", Arial, Helvetica, sans-serif;
  --font-display: "Segoe UI Semibold", "Segoe UI Variable Display", "Segoe UI", -apple-system, Arial, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  font-family: var(--font);
  background: var(--page);
  color: var(--ink);
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
  text-rendering: geometricPrecision;
}
button { font: inherit; cursor: pointer; }
input, select, textarea { font: inherit; }

/* ── SIGNATURE ELEMENTS (aus dem Triptych) ── */
.panel-grad {
  background:
    radial-gradient(circle at 50% 78%, rgb(207 225 255 / 30%), transparent 47%),
    linear-gradient(180deg, rgb(255 255 255 / 96%), rgb(243 248 255 / 94%));
}
.panel-grad-strong {
  background:
    radial-gradient(circle at 74% 46%, rgb(204 225 255 / 70%), transparent 48%),
    linear-gradient(180deg, rgb(255 255 255 / 96%), rgb(232 242 255 / 97%));
}
.chip-value {
  display: inline-grid;
  place-items: center;
  padding: 4px 14px;
  border: 2px solid #fff;
  border-radius: 999px;
  background: var(--accent);
  box-shadow: 0 0 0 1px var(--accent), 0 3px 8px rgb(15 30 69 / 24%);
  color: #fff;
  font-size: 11.5px;
  font-weight: 600;
  white-space: nowrap;
}
.chip-value.green { background: var(--green); box-shadow: 0 0 0 1px var(--green), 0 3px 8px rgb(15 40 20 / 22%); }
.icon-dot {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent);
  display: grid;
  place-items: center;
  flex: 0 0 auto;
}
.icon-dot svg { width: 16px; height: 16px; }

/* ── LOGIN ── */
.login-wrap {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  background:
    radial-gradient(circle at 78% 14%, rgb(11 95 255 / 8%), transparent 40%),
    radial-gradient(circle at 10% 88%, rgb(11 95 255 / 6%), transparent 38%),
    var(--page);
}
.login-card {
  width: min(92vw, 384px);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--card-shadow);
  padding: 36px 34px 30px;
}
.login-visual {
  height: 96px;
  border-radius: var(--radius-inner);
  margin-bottom: 24px;
  position: relative;
  overflow: hidden;
}
.login-visual .lv-bars {
  position: absolute;
  left: 10%;
  right: 10%;
  bottom: 14%;
  height: 58%;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
}
.login-visual .lv-bars i {
  width: 3.2%;
  border-radius: 999px;
  background: rgb(196 219 255 / 74%);
}
.login-visual .lv-bars i.hot { background: var(--accent); box-shadow: 0 0 6px rgb(11 95 255 / 30%); }

.brand-row { display: flex; align-items: center; gap: 11px; }
.brand-mark {
  width: 34px;
  height: 34px;
  border-radius: 11px;
  background: linear-gradient(135deg, #4a90ff, #0549c8);
  box-shadow: 0 4px 10px rgb(11 95 255 / 30%);
  display: grid;
  place-items: center;
  color: #fff;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 16px;
}
.brand-name { font-family: var(--font-display); font-weight: 600; font-size: 15.5px; letter-spacing: -.02em; color: var(--ink-strong); }
.brand-sub { font-size: 11px; color: var(--muted2); margin-top: 1px; letter-spacing: -.01em; }

.login-card h1 {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 21px;
  letter-spacing: -.03em;
  margin: 22px 0 4px;
  color: var(--ink-strong);
}
.login-card .hint { color: var(--muted); font-size: 13px; margin: 0 0 22px; letter-spacing: -.01em; }
.field { margin-bottom: 13px; }
.field label {
  display: block;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--muted2);
  margin-bottom: 6px;
}
.field input {
  width: 100%;
  padding: 11px 14px;
  border: 1.5px solid #e3eaf6;
  border-radius: 11px;
  background: #fbfcff;
  color: var(--ink);
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}
.field input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgb(11 95 255 / 12%); }

.btn-primary {
  width: 100%;
  padding: 12px 26px;
  border: none;
  border-radius: 999px;
  background: linear-gradient(100deg, #5b9bff 0%, #4088ff 38%, #055bff 100%);
  color: #fff;
  font-weight: 700;
  letter-spacing: -.01em;
  box-shadow:
    0 6px 16px rgb(11 95 255 / 40%),
    0 2px 5px rgb(11 95 255 / 26%);
  transition: transform .15s, box-shadow .15s;
}
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 10px 22px rgb(11 95 255 / 48%), 0 3px 7px rgb(11 95 255 / 30%); }
.btn-primary.slim { width: auto; padding: 10px 24px; font-size: 13px; }
.btn-ghost {
  border: 1.5px solid #dfe7f5;
  background: var(--surface);
  border-radius: 999px;
  padding: 8px 18px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--muted);
  transition: all .12s;
}
.btn-ghost:hover { border-color: var(--accent); color: var(--accent); }
.demo-pill { margin-top: 16px; text-align: center; font-size: 11px; color: var(--muted2); }
.demo-pill b { color: var(--accent); }

/* ── APP SHELL ── */
.app { display: none; }
.app.visible { display: block; }

.rail {
  position: fixed;
  top: 16px;
  left: 16px;
  bottom: 16px;
  width: 224px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--card-shadow);
  padding: 20px 14px 14px;
  display: flex;
  flex-direction: column;
  z-index: 50;
}
.rail .brand-row { padding: 0 8px; margin-bottom: 22px; }
.nav { display: flex; flex-direction: column; gap: 3px; flex: 1; }
.nav .sep {
  margin: 14px 10px 7px;
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: .1em;
  color: #b6bfd0;
  text-transform: uppercase;
}
.nav button {
  display: flex;
  align-items: center;
  gap: 11px;
  background: none;
  border: none;
  color: var(--muted);
  padding: 9.5px 11px;
  border-radius: 11px;
  text-align: left;
  font-size: 13.5px;
  font-weight: 600;
  letter-spacing: -.01em;
  transition: background .12s, color .12s;
}
.nav button svg { width: 16.5px; height: 16.5px; flex: 0 0 auto; opacity: .7; }
.nav button:hover { background: var(--accent-faint); color: var(--accent-strong); }
.nav button.active { background: var(--accent); color: #fff; box-shadow: 0 4px 12px rgb(11 95 255 / 32%); }
.nav button.active svg { opacity: 1; }

.tenant {
  margin-top: 12px;
  padding: 11px 12px;
  border-radius: var(--radius-inner);
  border: 1px solid var(--line);
  font-size: 12px;
}
.tenant .t-label { color: var(--muted2); font-size: 9.5px; text-transform: uppercase; letter-spacing: .08em; margin-bottom: 3px; }
.tenant .t-name { color: var(--ink-strong); font-weight: 600; font-size: 12.5px; }

.main { margin-left: 268px; padding: 26px 32px 56px; max-width: 1240px; }
.topbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 22px;
}
.topbar h2 {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 22px;
  letter-spacing: -.035em;
  color: var(--ink-strong);
}
.topbar .crumb { color: var(--muted); font-size: 12.5px; margin-top: 3px; letter-spacing: -.01em; }
.top-actions { display: flex; align-items: center; gap: 10px; }
.chip-live {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 11.5px;
  font-weight: 700;
  color: var(--green);
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: var(--card-shadow-soft);
  padding: 6px 13px;
  border-radius: 999px;
}
.chip-live .dot { width: 7px; height: 7px; border-radius: 50%; background: #10b981; animation: pulse 1.8s infinite; }
@keyframes pulse { 0%,100%{opacity:1} 50%{opacity:.35} }
.avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent-strong);
  display: grid;
  place-items: center;
  font-size: 12px;
  font-weight: 700;
  border: 2px solid #fff;
  box-shadow: var(--card-shadow-soft);
}

/* ── CARDS & KPI ── */
.kpi-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(184px, 1fr)); gap: 14px; margin-bottom: 20px; }
.kpi {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 9px 9px 12px;
  box-shadow: var(--card-shadow);
}
.kpi .k-panel {
  border-radius: 13px;
  border: 1px solid rgb(226 238 255 / 70%);
  padding: 16px 15px 13px;
  min-height: 94px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
}
.kpi .k-value {
  font-family: var(--font-display);
  font-size: 24px;
  font-weight: 600;
  letter-spacing: -.03em;
  color: var(--ink-strong);
  font-variant-numeric: tabular-nums;
}
.kpi .k-value .unit { font-size: 15px; color: var(--muted); font-weight: 600; margin-left: 2px; }
.kpi .k-label {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 13px;
  letter-spacing: -.02em;
  color: var(--ink-strong);
  padding: 11px 8px 0;
}
.kpi .k-delta { margin-top: 0; }

.panel-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--card-shadow);
  padding: 22px 24px;
  margin-bottom: 18px;
}
.panel-card h3 {
  margin: 0 0 3px;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 15.5px;
  letter-spacing: -.02em;
  color: var(--ink-strong);
}
.panel-card .sub { color: var(--muted); font-size: 12.5px; margin: 0 0 16px; letter-spacing: -.01em; }
.panel-card .head-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.two-col { display: grid; grid-template-columns: 1.55fr 1fr; gap: 18px; align-items: start; }
@media (max-width: 1020px) { .two-col { grid-template-columns: 1fr; } }

.inner-panel {
  border-radius: var(--radius-inner);
  border: 1px solid rgb(226 238 255 / 90%);
  padding: 16px 18px;
}

/* ── TABLES ── */
table.data { width: 100%; border-collapse: collapse; font-size: 13px; letter-spacing: -.005em; }
table.data th {
  text-align: left;
  padding: 9px 12px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .07em;
  color: var(--muted2);
  border-bottom: 1px solid #edf2fb;
  white-space: nowrap;
}
table.data td { padding: 12px; border-bottom: 1px solid #f3f6fc; vertical-align: middle; }
table.data tr:last-child td { border-bottom: none; }
table.data tr.clickable { cursor: pointer; }
table.data tr.clickable:hover td { background: var(--accent-faint); }
.t-strong { font-weight: 600; color: var(--ink-strong); }
.t-muted { color: var(--muted2); font-size: 12px; }
.num { text-align: right; font-variant-numeric: tabular-nums; }

.badge {
  display: inline-block;
  padding: 3.5px 11px;
  border-radius: 999px;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: .01em;
  white-space: nowrap;
}
.badge.blue { background: var(--accent-soft); color: var(--accent-strong); }
.badge.green { background: var(--green-soft); color: var(--green); }
.badge.amber { background: var(--amber-soft); color: var(--amber); }
.badge.grey { background: #eef0f4; color: #7b8494; }
.badge.red { background: var(--red-soft); color: var(--red); }

select.status {
  border: 1.5px solid #e3eaf6;
  border-radius: 9px;
  padding: 6px 9px;
  background: #fbfcff;
  font-size: 12px;
  font-weight: 600;
  color: var(--ink);
}
select.status:focus { outline: none; border-color: var(--accent); }

/* ── FILTER & PIPELINE ── */
.filter-row { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
.filter-chip {
  border: 1.5px solid #dfe7f5;
  background: var(--surface);
  border-radius: 999px;
  padding: 7px 15px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--muted);
  transition: all .12s;
  box-shadow: var(--card-shadow-soft);
}
.filter-chip:hover { border-color: var(--accent); color: var(--accent); }
.filter-chip.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  box-shadow: 0 4px 12px rgb(11 95 255 / 32%);
}
.filter-chip .count { opacity: .6; font-weight: 500; margin-left: 5px; }

.pipeline { display: grid; grid-template-columns: repeat(5, 1fr); gap: 12px; margin-bottom: 18px; }
@media (max-width: 900px) { .pipeline { grid-template-columns: repeat(2, 1fr); } }
.stage {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-inner);
  box-shadow: var(--card-shadow-soft);
  padding: 14px 16px;
  position: relative;
  overflow: hidden;
}
.stage::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--accent-soft);
}
.stage.hot::before { background: linear-gradient(90deg, #4088ff, #0b5fff); }
.stage .s-num {
  font-family: var(--font-display);
  font-size: 21px;
  font-weight: 600;
  letter-spacing: -.02em;
  color: var(--ink-strong);
  font-variant-numeric: tabular-nums;
}
.stage .s-label { font-size: 10.5px; font-weight: 700; color: var(--muted2); margin-top: 3px; text-transform: uppercase; letter-spacing: .05em; }

/* ── AUTOMATIONEN ── */
.toggle {
  position: relative;
  width: 42px;
  height: 23px;
  border-radius: 999px;
  border: none;
  background: #d9dfe9;
  transition: background .15s;
  flex: 0 0 auto;
}
.toggle::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 17px;
  height: 17px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgb(0 0 0 / 25%);
  transition: left .15s;
}
.toggle.on { background: var(--accent); box-shadow: 0 2px 8px rgb(11 95 255 / 30%); }
.toggle.on::after { left: 22px; }
.auto-row { display: flex; align-items: center; gap: 15px; padding: 15px 0; border-bottom: 1px solid #f3f6fc; }
.auto-row:last-child { border-bottom: none; padding-bottom: 4px; }
.auto-row:first-of-type { padding-top: 4px; }
.auto-body { flex: 1; min-width: 0; }
.auto-body .a-name { font-weight: 600; font-size: 13.5px; color: var(--ink-strong); letter-spacing: -.01em; }
.auto-body .a-desc { color: var(--muted); font-size: 12px; margin-top: 2px; }
.auto-meta { font-size: 11.5px; color: var(--muted2); white-space: nowrap; font-variant-numeric: tabular-nums; }

/* ── RECHNER & RESULT ── */
.calc-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-bottom: 14px; }
@media (max-width: 760px) { .calc-grid { grid-template-columns: 1fr; } }
.calc-grid label {
  display: block;
  font-size: 10.5px;
  font-weight: 700;
  color: var(--muted2);
  text-transform: uppercase;
  letter-spacing: .06em;
  margin-bottom: 6px;
}
.calc-grid input, .calc-grid select {
  width: 100%;
  padding: 10px 12px;
  border: 1.5px solid #e3eaf6;
  border-radius: 10px;
  background: #fbfcff;
}
.calc-grid input:focus, .calc-grid select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgb(11 95 255 / 12%); }
.calc-result {
  border-radius: var(--radius-inner);
  border: 1px solid rgb(226 238 255 / 90%);
  padding: 16px 18px;
  font-size: 13px;
}
.calc-result .cr-big {
  font-family: var(--font-display);
  font-size: 24px;
  font-weight: 600;
  letter-spacing: -.03em;
  color: var(--accent-strong);
  font-variant-numeric: tabular-nums;
}
.calc-result .cr-line { color: var(--muted); margin-top: 5px; font-size: 12px; }

.detail-strip {
  border-radius: var(--radius-inner);
  border: 1px dashed #cfdcf5;
  padding: 13px 16px;
  font-size: 12.5px;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.empty { padding: 44px; text-align: center; color: var(--muted2); font-size: 13px; }
canvas.chart { width: 100%; height: 224px; display: block; }

/* ── RESPONSIVE ── */
@media (max-width: 860px) {
  .rail {
    position: sticky;
    top: 0;
    left: 0;
    bottom: auto;
    width: auto;
    margin: 12px;
    flex-direction: row;
    align-items: center;
    overflow-x: auto;
    padding: 10px 12px;
    gap: 8px;
  }
  .rail .brand-row { margin: 0 6px 0 0; }
  .rail .brand-sub, .nav .sep, .tenant { display: none; }
  .nav { flex-direction: row; }
  .nav button { white-space: nowrap; padding: 8px 12px; }
  .main { margin-left: 0; padding: 10px 14px 40px; }
}
