:root {
  color-scheme: light;
  --ink: #111827;
  --muted: #657084;
  --line: #dfe4ec;
  --surface: #ffffff;
  --canvas: #f3f5f8;
  /* --brand kommt aus tokens.css (identisch #e85c1e) - hier nicht mehr doppelt definiert */
  --brand-dark: var(--brand-pressed);
  --navy: #101827;
  --green: #16785c;
  --green-soft: #e7f5ef;
  --orange-soft: #fff0e7;
  --blue-soft: #eaf1fb;
  --red: #b42318;
  --shadow: 0 18px 55px rgba(15, 23, 42, 0.16);
  font-family: var(--font-sans);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html { background: var(--canvas); }

body {
  min-height: 100vh;
  margin: 0;
  background: var(--canvas);
  color: var(--ink);
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}

button, input, textarea { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: wait; opacity: 0.62; }

h1, h2, p { margin: 0; }
h1 { font-size: clamp(28px, 8vw, 42px); line-height: 1.06; letter-spacing: -0.035em; }
h2 { font-size: 22px; line-height: 1.15; letter-spacing: -0.02em; }

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.eyebrow {
  color: var(--brand-strong);
  font-size: 12px;
  font-weight: 850;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

.eyebrow.light { color: #ffc5aa; }

.login-shell {
  display: grid;
  min-height: 100vh;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(circle at 10% 0%, rgba(232, 92, 30, 0.24), transparent 35%),
    var(--navy);
}

.login-card {
  display: grid;
  width: min(430px, 100%);
  gap: 14px;
  border-radius: 28px;
  background: var(--surface);
  padding: 28px;
  box-shadow: var(--shadow);
}

.brand-mark {
  display: block;
  width: 48px;
  height: 48px;
  border-radius: 12px;
}

.intro { color: var(--muted); }

.stack { display: grid; gap: 14px; }
.stack label { display: grid; gap: 7px; font-size: 14px; font-weight: 750; }
.stack label span { color: var(--muted); font-size: 12px; font-weight: 600; }

input {
  width: 100%;
  min-height: 50px;
  border: 1px solid var(--line);
  border-radius: 13px;
  outline: none;
  background: #fff;
  color: var(--ink);
  padding: 0 14px;
  transition: border-color 0.15s, box-shadow 0.15s;
}

input:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 4px rgba(232, 92, 30, 0.12);
}

.primary, .secondary, .text-button, .icon-button, .avatar-button, .close-button {
  border: 0;
}

.primary, .secondary {
  min-height: 48px;
  border-radius: 13px;
  padding: 0 17px;
  font-weight: 820;
}

.primary { background: var(--brand-strong); color: #fff; }
.primary:hover { background: var(--brand-dark); }
.primary.light { background: #fff; color: var(--navy); }
.secondary { border: 1px solid var(--line); background: #fff; color: var(--ink); }
.secondary.compact { min-height: 38px; padding: 0 12px; font-size: 13px; }
.full { width: 100%; }
.text-button { background: transparent; color: var(--muted); font-weight: 760; padding: 12px; }
.btn-icon { display: inline-grid; width: 18px; height: 18px; margin-right: 8px; place-items: center; vertical-align: -4px; }
.btn-icon svg { width: 18px; height: 18px; }

.form-status { min-height: 20px; color: var(--red); font-size: 13px; }
.form-status.ok { color: var(--green); font-weight: 750; }

.reset-card { gap: 16px; }
.password-hint { margin-top: -6px; color: var(--muted); font-size: 12px; }
.reset-success { display: grid; justify-items: center; gap: 14px; text-align: center; }
.reset-success p { color: var(--muted); }
.reset-login-link {
  display: grid;
  width: 100%;
  min-height: 48px;
  place-items: center;
  border-radius: 13px;
  padding: 0 17px;
  font-weight: 820;
  text-decoration: none;
}

.app-shell { min-height: 100vh; padding-bottom: 92px; }

.app-header {
  position: sticky;
  z-index: 20;
  top: 0;
  display: flex;
  min-height: 76px;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid rgba(223, 228, 236, 0.85);
  background: rgba(243, 245, 248, 0.92);
  padding: max(12px, env(safe-area-inset-top)) 18px 12px;
  backdrop-filter: blur(18px);
}

.app-header h1 { font-size: 26px; }
.header-actions { display: flex; gap: 9px; align-items: center; }
.icon-button, .avatar-button, .close-button {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border-radius: 50%;
  background: var(--surface);
  color: var(--ink);
  font-weight: 850;
  box-shadow: 0 3px 14px rgba(15, 23, 42, 0.08);
}
.avatar-button { background: var(--navy); color: #fff; font-size: 12px; }
.close-button { background: var(--canvas); box-shadow: none; font-size: 27px; font-weight: 400; }
.circle-icon { display: grid; width: 20px; height: 20px; place-items: center; }
.circle-icon svg { width: 20px; height: 20px; }

.account-menu {
  position: absolute;
  top: calc(100% - 4px);
  right: 16px;
  display: grid;
  min-width: 220px;
  gap: 5px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #fff;
  padding: 10px;
  box-shadow: var(--shadow);
}
.account-menu span { overflow: hidden; padding: 8px; color: var(--muted); font-size: 12px; text-overflow: ellipsis; }
.account-menu a, .account-menu button { border: 0; border-radius: 10px; background: transparent; color: var(--ink); padding: 10px; text-align: left; text-decoration: none; }
.account-menu a:hover, .account-menu button:hover { background: var(--canvas); }

.content { display: grid; width: min(920px, 100%); gap: 18px; margin: 0 auto; padding: 18px 14px 30px; }

.hero-card {
  display: grid;
  gap: 20px;
  border-radius: 24px;
  background:
    linear-gradient(135deg, rgba(232, 92, 30, 0.92), rgba(232, 92, 30, 0) 60%),
    var(--navy);
  color: #fff;
  padding: 24px;
  box-shadow: 0 16px 35px rgba(16, 24, 39, 0.18);
}
.hero-card div { display: grid; gap: 9px; }
.hero-card h2 { max-width: 470px; font-size: clamp(25px, 6vw, 34px); }
.hero-card p:not(.eyebrow) { max-width: 590px; color: #e6eaf0; }
.hero-card .primary { justify-self: start; }

.metrics { display: grid; grid-template-columns: repeat(3, 1fr); gap: 9px; }
.metrics article { display: grid; gap: 2px; border: 1px solid var(--line); border-radius: 16px; background: #fff; padding: 15px 12px; }
.metrics strong { font-size: 26px; line-height: 1; }
.metrics span { color: var(--muted); font-size: 12px; font-weight: 700; }

.lead-section { display: grid; gap: 13px; }
.section-heading { display: flex; align-items: end; justify-content: space-between; gap: 12px; }
.section-heading > div:first-child { display: grid; gap: 4px; }
.search-field input { background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='18' viewBox='0 0 24 24' fill='none' stroke='%23657084' stroke-width='2'%3E%3Ccircle cx='11' cy='11' r='8'/%3E%3Cpath d='m21 21-4.35-4.35'/%3E%3C/svg%3E") no-repeat 14px center; padding-left: 42px; }

.lead-list { display: grid; gap: 10px; min-width: 0; }
.lead-card { display: grid; gap: 13px; min-width: 0; border: 1px solid var(--line); border-radius: 18px; background: #fff; padding: 16px; }
.lead-top { display: flex; align-items: start; justify-content: space-between; gap: 10px; }
.lead-name { display: grid; gap: 2px; min-width: 0; }
.lead-name strong { overflow: hidden; font-size: 16px; text-overflow: ellipsis; white-space: nowrap; }
.lead-name span { color: var(--muted); font-size: 13px; }
.status-pill { flex: none; border-radius: 999px; background: var(--blue-soft); color: #28568d; font-size: 11px; font-weight: 850; padding: 6px 9px; }
.status-pill.open { background: var(--orange-soft); color: #9b3c10; }
.status-pill.active { background: var(--green-soft); color: var(--green); }
.status-pill.ended { background: #edf0f4; color: #5a6575; }
.lead-progress { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 5px; }
.lead-progress span { height: 5px; border-radius: 999px; background: #e8ebf0; }
.lead-progress span.done { background: var(--green); }
.lead-meta { display: flex; flex-wrap: wrap; gap: 7px 13px; color: var(--muted); font-size: 12px; }
.lead-actions { display: flex; gap: 8px; }
.lead-actions button { min-height: 40px; flex: 1; }
.empty-state { display: grid; gap: 8px; border: 1px dashed #cdd3dd; border-radius: 18px; background: rgba(255, 255, 255, 0.55); padding: 30px 18px; color: var(--muted); text-align: center; }
.empty-state strong { color: var(--ink); }

/* --- Anrufliste (Playbook Modul 0/1) ------------------------------------ */

.view { display: grid; gap: 18px; }
.view-tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; border: 1px solid var(--line); border-radius: 15px; background: #fff; padding: 5px; }
.view-tab { display: inline-flex; align-items: center; justify-content: center; min-height: 42px; border: 0; border-radius: 11px; background: transparent; color: var(--muted); font-size: 14px; font-weight: 800; }
.view-tab.active { background: var(--navy); color: #fff; }
.tab-icon { display: inline-grid; flex: none; width: 16px; height: 16px; margin-right: 7px; place-items: center; }
.tab-icon svg { width: 16px; height: 16px; }

.calls-hero { grid-template-columns: 1fr auto; align-items: center; }
.calls-counter { display: grid; justify-items: center; gap: 2px; align-content: center; border-radius: 18px; background: rgba(255, 255, 255, 0.14); padding: 14px 18px; }
.calls-counter strong { font-size: 30px; line-height: 1; }
.calls-counter span { color: #e6eaf0; font-size: 11px; font-weight: 800; letter-spacing: 0.05em; text-transform: uppercase; }

.import-card { display: grid; gap: 12px; border: 1px solid var(--line); border-radius: 20px; background: #fff; padding: 18px 16px; }
.import-field { display: grid; gap: 7px; font-size: 14px; font-weight: 750; }
.import-field span { color: var(--muted); font-size: 12px; font-weight: 600; }
.import-field textarea {
  width: 100%;
  min-height: 116px;
  resize: vertical;
  border: 1px solid var(--line);
  border-radius: 13px;
  outline: none;
  background: #fff;
  color: var(--ink);
  padding: 12px 14px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 13px;
  line-height: 1.5;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.import-field textarea:focus { border-color: var(--brand); box-shadow: 0 0 0 4px rgba(232, 92, 30, 0.12); }
.field-hint { color: var(--muted); font-size: 12px; }

.playbook-card { border: 1px solid var(--line); border-radius: 20px; background: #fff; padding: 4px 16px; }
.playbook-card > summary { display: flex; align-items: center; justify-content: space-between; gap: 10px; cursor: pointer; padding: 14px 0; font-size: 15px; font-weight: 830; }
.draft-badge { flex: none; border-radius: 999px; background: var(--orange-soft); color: #9b3c10; font-size: 10px; font-weight: 850; letter-spacing: 0.04em; padding: 5px 9px; text-transform: uppercase; }
.playbook-source { padding-bottom: 10px; color: var(--muted); font-size: 12px; }
.playbook-source code { border-radius: 5px; background: var(--canvas); padding: 1px 5px; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 11px; }
.playbook-card blockquote { margin: 0 0 12px; border-left: 3px solid var(--brand); border-radius: 0 12px 12px 0; background: var(--orange-soft); padding: 13px 15px; color: #4a2410; font-size: 14px; }
.objection { border-top: 1px solid var(--line); }
.objection > summary { cursor: pointer; padding: 11px 0; font-size: 14px; font-weight: 780; }
.objection p { padding: 0 0 12px; color: var(--muted); font-size: 14px; }

.filter-chips { display: flex; flex: none; gap: 6px; }
.chip { min-height: 38px; border: 1px solid var(--line); border-radius: 999px; background: #fff; color: var(--muted); font-size: 13px; font-weight: 780; padding: 0 13px; }
.chip.active { border-color: var(--navy); background: var(--navy); color: #fff; }

.call-list { display: grid; gap: 12px; min-width: 0; }
.call-card { display: grid; gap: 12px; min-width: 0; border: 1px solid var(--line); border-radius: 20px; background: #fff; padding: 16px; }
.call-card.is-due { border-color: #f2c3a6; box-shadow: 0 6px 20px rgba(232, 92, 30, 0.08); }
.call-card h3 { margin: 0; overflow-wrap: anywhere; font-size: 18px; line-height: 1.2; letter-spacing: -0.02em; }
.call-meta { display: flex; flex-wrap: wrap; gap: 5px 12px; color: var(--muted); font-size: 13px; }
.call-meta span { overflow-wrap: anywhere; }
.call-button {
  display: grid;
  min-height: 58px;
  place-items: center;
  border-radius: 15px;
  background: var(--green);
  color: #fff;
  font-size: 17px;
  font-weight: 850;
  letter-spacing: -0.01em;
  text-decoration: none;
}
.call-button:hover { background: #0f5f49; }
.outcome-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.outcome-grid button { min-height: 52px; border: 1px solid var(--line); border-radius: 13px; background: #fff; color: var(--ink); font-size: 14px; font-weight: 800; padding: 0 10px; }
.outcome-grid button:hover { background: var(--canvas); }
.outcome-grid button.danger { border-color: #e7b4ae; background: #fdf1f0; color: var(--red); }
.outcome-grid button.danger:hover { background: #fbe3e1; }
.callback-row { display: grid; grid-template-columns: 1fr auto; gap: 8px; align-items: center; border-radius: 13px; background: var(--canvas); padding: 10px; }
.callback-row input { min-height: 46px; }
.callback-row button { min-height: 46px; }

.bottom-bar {
  position: fixed;
  z-index: 18;
  right: 0;
  bottom: 0;
  left: 0;
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  border-top: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.96);
  padding: 8px 12px max(8px, env(safe-area-inset-bottom));
  backdrop-filter: blur(18px);
}
.bottom-bar button { display: grid; gap: 2px; place-items: center; border: 0; background: transparent; color: var(--muted); font-size: 11px; font-weight: 750; }
.bottom-bar button span { font-size: 20px; line-height: 1; }
.bottom-bar button .bar-icon { display: grid; width: 20px; height: 20px; place-items: center; }
.bottom-bar button .bar-icon svg { width: 20px; height: 20px; }
.bottom-bar button.active { color: var(--brand-strong); }

.sheet-backdrop {
  position: fixed;
  z-index: 50;
  inset: 0;
  display: grid;
  align-items: end;
  background: rgba(15, 23, 42, 0.58);
  padding-top: 30px;
}
.sheet {
  display: grid;
  width: min(600px, 100%);
  max-height: calc(100vh - 30px);
  gap: 18px;
  margin: 0 auto;
  overflow-y: auto;
  border-radius: 26px 26px 0 0;
  background: #fff;
  padding: 10px 20px max(24px, env(safe-area-inset-bottom));
  box-shadow: var(--shadow);
}
.sheet-handle { width: 42px; height: 5px; margin: 0 auto; border-radius: 99px; background: #d6dbe4; }
.sheet-heading { display: flex; align-items: start; justify-content: space-between; gap: 15px; }
.sheet-heading > div { display: grid; gap: 5px; }
.privacy-note { border-radius: 12px; background: var(--blue-soft); color: #385676; font-size: 13px; padding: 12px; }

.success-sheet { justify-items: center; text-align: center; }
.success-icon { display: grid; width: 58px; height: 58px; place-items: center; border-radius: 50%; background: var(--green-soft); color: var(--green); font-size: 28px; font-weight: 900; }
.success-icon svg { width: 28px; height: 28px; }
.invite-copy { max-width: 470px; color: var(--muted); }
.invite-url { width: 100%; overflow-wrap: anywhere; border: 1px solid var(--line); border-radius: 13px; background: var(--canvas); padding: 13px; color: #344054; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12px; text-align: left; }
.action-grid { display: grid; width: 100%; grid-template-columns: 1fr 1fr; gap: 9px; }
.expiry { color: var(--muted); font-size: 12px; }

.detail-sheet { gap: 16px; }
.detail-subtitle { margin-top: 4px; color: var(--muted); font-size: 13px; }
.detail-summary { display: grid; justify-items: start; gap: 9px; border-radius: 15px; background: var(--canvas); padding: 14px; }
.detail-summary p { color: #39465a; font-size: 14px; }
.funnel-timeline { display: grid; gap: 0; margin: 0; padding: 0; list-style: none; }
.funnel-timeline li { position: relative; display: grid; grid-template-columns: 32px 1fr; gap: 10px; min-height: 58px; }
.funnel-timeline li:not(:last-child)::after { position: absolute; top: 27px; bottom: 0; left: 13px; width: 2px; background: var(--line); content: ""; }
.funnel-timeline li.done:not(:last-child)::after { background: #82c7ae; }
.timeline-marker { position: relative; z-index: 1; display: grid; width: 28px; height: 28px; place-items: center; border: 2px solid #cbd2dd; border-radius: 50%; background: #fff; color: #fff; font-size: 13px; font-weight: 900; }
.funnel-timeline li.done .timeline-marker { border-color: var(--green); background: var(--green); }
.funnel-timeline li > div { display: grid; align-content: start; gap: 2px; padding: 3px 0 13px; }
.funnel-timeline strong { font-size: 14px; }
.funnel-timeline li.pending strong { color: #788395; }
.funnel-timeline li > div span { color: var(--muted); font-size: 12px; }
.technical-status { display: grid; gap: 3px; border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px; }
.technical-status span { color: var(--muted); font-size: 11px; font-weight: 800; letter-spacing: 0.05em; text-transform: uppercase; }
.technical-status strong { font-size: 14px; }
.detail-actions { display: grid; gap: 9px; }

.toast { position: fixed; z-index: 80; right: 16px; bottom: 88px; left: 16px; max-width: 430px; margin: 0 auto; border-radius: 13px; background: var(--navy); color: #fff; padding: 13px 16px; box-shadow: var(--shadow); text-align: center; }
.toast.error { background: var(--red); }

@media (min-width: 720px) {
  .app-header { padding-right: 30px; padding-left: 30px; }
  .content { padding: 28px 24px 48px; }
  .hero-card { grid-template-columns: 1fr auto; align-items: end; padding: 32px; }
  .lead-list { grid-template-columns: 1fr 1fr; }
  .call-list { grid-template-columns: 1fr 1fr; }
  .view-tabs { justify-self: start; width: min(360px, 100%); }
  .calls-hero { align-items: center; }
  .bottom-bar { display: none; }
  .app-shell { padding-bottom: 0; }
  .sheet-backdrop { align-items: center; padding: 24px; }
  .sheet { border-radius: 26px; padding: 12px 26px 28px; }
}

@media (display-mode: standalone) {
  .app-header { padding-top: max(18px, env(safe-area-inset-top)); }
}
