/* ============================================================================
   agenturkunden.io — App shell, auth, pipeline & view-specific components.
   Builds on app.css tokens.
   ========================================================================== */

/* ================================================================== AUTH == */
.auth-screen {
  min-height: 100vh; display: grid; grid-template-columns: 1.05fr 0.95fr;
}
.auth-aside {
  position: relative; padding: 54px 56px; display: flex; flex-direction: column;
  justify-content: space-between; overflow: hidden;
  border-right: 1px solid var(--line);
  background:
    radial-gradient(700px 500px at 12% 8%, rgba(198,242,78,0.10), transparent 55%),
    radial-gradient(600px 600px at 90% 100%, rgba(95,208,230,0.08), transparent 55%),
    linear-gradient(160deg, var(--ink-100), var(--ink-050));
}
.auth-aside::after {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background-image: linear-gradient(var(--line-soft) 1px, transparent 1px), linear-gradient(90deg, var(--line-soft) 1px, transparent 1px);
  background-size: 48px 48px;
  -webkit-mask-image: radial-gradient(90% 80% at 30% 40%, #000, transparent 80%);
  mask-image: radial-gradient(90% 80% at 30% 40%, #000, transparent 80%);
  opacity: 0.6;
}
.auth-aside > * { position: relative; z-index: 1; }
.auth-tagline { font-family: var(--font-display); font-size: clamp(28px, 3.4vw, 44px); line-height: 1.08; letter-spacing: -0.02em; max-width: 14ch; }
.auth-tagline em { font-style: normal; color: var(--accent-bright); }
.auth-sub { color: var(--text-muted); max-width: 42ch; margin-top: 18px; font-size: 15.5px; }
.auth-stages { display: flex; flex-direction: column; gap: 14px; margin-top: 30px; }
.auth-stage { display: flex; align-items: center; gap: 14px; }
.auth-stage .num {
  width: 30px; height: 30px; border-radius: var(--r-sm); display: grid; place-items: center;
  font-family: var(--font-mono); font-size: 13px; font-weight: 500;
  background: var(--ink-200); border: 1px solid var(--line-bright); color: var(--text-muted); flex: none;
}
.auth-stage .lbl { color: var(--text); font-weight: 500; }
.auth-stage .lbl small { display: block; color: var(--text-faint); font-weight: 400; font-size: 12.5px; }

.auth-main { display: grid; place-items: center; padding: 40px 28px; background: var(--ink-050); }
.auth-card { width: min(420px, 100%); }
.auth-card h1 { font-size: 26px; margin-bottom: 6px; }
.auth-tabs { display: flex; gap: 4px; padding: 4px; background: var(--ink-100); border: 1px solid var(--line); border-radius: var(--r-md); margin: 22px 0; }
.auth-tab {
  flex: 1; padding: 9px; border-radius: var(--r-sm); font-weight: 500; font-size: 14px;
  color: var(--text-muted); transition: all var(--dur-1);
}
.auth-tab[aria-selected="true"] { background: var(--ink-200); color: var(--text-strong); box-shadow: var(--shadow-sm); }
.auth-foot { margin-top: 22px; text-align: center; color: var(--text-faint); font-size: 13px; }

@media (max-width: 860px) {
  .auth-screen { grid-template-columns: 1fr; }
  .auth-aside { display: none; }
}

/* ================================================================= SHELL == */
.app-shell { display: grid; grid-template-columns: 256px 1fr; min-height: 100vh; }

.sidebar {
  position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column;
  padding: 18px 14px; gap: 6px; border-right: 1px solid var(--line);
  background: linear-gradient(180deg, var(--ink-100), var(--ink-050));
  overflow-y: auto;
}
.brand { display: flex; align-items: center; gap: 11px; padding: 6px 8px 16px; }
.brand-mark {
  width: 34px; height: 34px; border-radius: 10px; flex: none; position: relative;
  background: linear-gradient(150deg, var(--accent-bright), var(--accent-dim));
  display: grid; place-items: center; box-shadow: 0 6px 18px -6px var(--accent-glow);
}
.brand-mark svg { width: 19px; height: 19px; color: var(--accent-ink); }
.brand-name { font-family: var(--font-display); font-weight: 700; font-size: 17px; letter-spacing: -0.01em; color: var(--text-strong); }
.brand-name span { color: var(--accent-bright); }

.nav-group-label { padding: 14px 10px 6px; }
.nav-item {
  display: flex; align-items: center; gap: 11px; padding: 9px 11px; border-radius: var(--r-sm);
  color: var(--text-muted); font-weight: 500; font-size: 14px; width: 100%; text-align: left;
  transition: background var(--dur-1), color var(--dur-1); position: relative;
}
.nav-item:hover { background: var(--ink-150); color: var(--text); }
.nav-item.is-active { background: var(--ink-200); color: var(--text-strong); }
.nav-item.is-active::before {
  content: ""; position: absolute; left: -14px; top: 50%; transform: translateY(-50%);
  width: 3px; height: 18px; border-radius: 0 3px 3px 0; background: var(--accent);
}
.nav-item svg { width: 18px; height: 18px; flex: none; opacity: 0.85; }
.nav-item .stage-no {
  margin-left: auto; font-family: var(--font-mono); font-size: 10.5px; color: var(--text-ondark-min);
  border: 1px solid var(--line); border-radius: 5px; padding: 1px 5px;
}
.nav-item .nav-badge {
  margin-left: auto; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 99px;
  background: var(--accent-glow); color: var(--accent-bright); border: 1px solid var(--accent-line);
  font-size: 11px; font-weight: 600; display: grid; place-items: center; font-family: var(--font-mono);
}

.sidebar-foot { margin-top: auto; padding-top: 14px; }

/* quota mini-widget in sidebar */
.quota-mini { padding: 12px; border: 1px solid var(--line); border-radius: var(--r-md); background: var(--ink-100); display: flex; flex-direction: column; gap: 9px; }
.quota-mini-row { display: flex; flex-direction: column; gap: 4px; }
.quota-mini-row .qm-top { display: flex; justify-content: space-between; font-size: 11.5px; }
.quota-mini-row .qm-top .qm-lbl { color: var(--text-faint); }
.quota-mini-row .qm-top .qm-val { color: var(--text-muted); font-family: var(--font-mono); }

/* user chip */
.user-chip { display: flex; align-items: center; gap: 10px; padding: 9px 8px; border-radius: var(--r-sm); }
.avatar {
  width: 30px; height: 30px; border-radius: 50%; flex: none; display: grid; place-items: center;
  font-size: 12.5px; font-weight: 600; color: var(--accent-ink);
  background: linear-gradient(150deg, var(--accent-bright), var(--cyan)); font-family: var(--font-mono);
}
.user-chip .u-meta { min-width: 0; }
.user-chip .u-email { font-size: 13px; color: var(--text); }
.user-chip .u-role { font-size: 11px; color: var(--text-faint); text-transform: capitalize; }

/* ---- main column ---- */
.main { display: flex; flex-direction: column; min-width: 0; }
.topbar {
  position: sticky; top: 0; z-index: 40; display: flex; align-items: center; gap: 16px;
  padding: 14px 26px; border-bottom: 1px solid var(--line);
  background: rgba(10, 13, 20, 0.72); backdrop-filter: blur(12px) saturate(140%);
}
.topbar h1 { font-size: 18px; }
.topbar .crumb { color: var(--text-faint); font-size: 13px; }
.view-wrap { padding: 26px; max-width: 1320px; width: 100%; margin: 0 auto; }
.view-head { margin-bottom: 22px; }
.view-head h2 { font-size: 23px; letter-spacing: -0.015em; }
.view-head p { color: var(--text-muted); margin-top: 5px; max-width: 64ch; }

/* lang switch */
.langswitch { display: inline-flex; padding: 3px; border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--ink-100); }
.langswitch button { padding: 5px 11px; border-radius: 6px; font-size: 12.5px; font-weight: 600; color: var(--text-faint); font-family: var(--font-mono); }
.langswitch button.is-active { background: var(--ink-200); color: var(--text-strong); }

/* mobile nav toggle (hidden on desktop) */
.nav-toggle { display: none; }
.scrim { display: none; }

@media (max-width: 940px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed; left: 0; top: 0; z-index: 120; width: 280px;
    transform: translateX(-100%); transition: transform var(--dur-2) var(--ease);
  }
  .app-shell.nav-open .sidebar { transform: none; box-shadow: var(--shadow-lg); }
  .app-shell.nav-open .scrim { display: block; position: fixed; inset: 0; z-index: 110; background: rgba(4,6,10,0.6); }
  .nav-toggle { display: inline-grid; }
  .view-wrap { padding: 18px; }
}

/* =========================================================== PIPELINE RAIL */
.pipeline-rail {
  display: flex; align-items: stretch; gap: 0; padding: 4px; margin-bottom: 24px;
  border: 1px solid var(--line); border-radius: var(--r-lg);
  background: linear-gradient(180deg, var(--ink-150), var(--ink-100)); overflow-x: auto;
}
.rail-step {
  flex: 1 1 0; min-width: 130px; display: flex; align-items: center; gap: 11px;
  padding: 13px 15px; border-radius: var(--r-md); position: relative;
  transition: background var(--dur-1); cursor: pointer; text-align: left;
}
.rail-step:hover { background: var(--ink-200); }
.rail-step.is-active { background: var(--ink-200); }
.rail-step:not(:last-child)::after {
  content: ""; position: absolute; right: -1px; top: 22%; height: 56%; width: 1px; background: var(--line);
}
.rail-num {
  width: 32px; height: 32px; border-radius: 9px; flex: none; display: grid; place-items: center;
  font-family: var(--font-mono); font-weight: 500; font-size: 14px;
  background: var(--ink-200); border: 1px solid var(--line-bright); color: var(--text-muted);
}
.rail-step.is-active .rail-num { color: var(--stage-c, var(--accent)); border-color: var(--stage-c, var(--accent-line)); box-shadow: 0 0 0 3px color-mix(in srgb, var(--stage-c, var(--accent)) 14%, transparent); }
.rail-step[data-stage="1"] { --stage-c: var(--stage-1); }
.rail-step[data-stage="2"] { --stage-c: var(--stage-2); }
.rail-step[data-stage="3"] { --stage-c: var(--stage-3); }
.rail-step[data-stage="4"] { --stage-c: var(--stage-4); }
.rail-step[data-stage="5"] { --stage-c: var(--stage-5); }
.rail-meta .rail-title { font-size: 13.5px; font-weight: 600; color: var(--text); }
.rail-meta .rail-desc { font-size: 11.5px; color: var(--text-faint); }

/* ============================================================ DASHBOARD == */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: var(--gap); }
.stat {
  padding: 18px; border-radius: var(--r-md); border: 1px solid var(--line);
  background: linear-gradient(180deg, var(--ink-150), var(--ink-100)); position: relative; overflow: hidden;
}
.stat::before { content: ""; position: absolute; inset: 0 auto auto 0; width: 3px; height: 100%; background: var(--accent); opacity: 0.55; }
.stat.s-cyan::before { background: var(--cyan); }
.stat.s-stage5::before { background: var(--stage-5); }
.stat.s-info::before { background: var(--info); }
.stat .stat-label { font-size: 12.5px; color: var(--text-faint); display: flex; align-items: center; gap: 7px; }
.stat .stat-value { font-family: var(--font-display); font-size: 30px; font-weight: 700; margin-top: 8px; letter-spacing: -0.02em; }
.stat .stat-sub { font-size: 12.5px; color: var(--text-muted); margin-top: 4px; }

.quota-card { padding: 18px 20px; }
.quota-line { padding: 12px 0; border-bottom: 1px solid var(--line-soft); }
.quota-line:last-child { border-bottom: none; }
.quota-line .ql-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 7px; }
.quota-line .ql-name { font-weight: 500; font-size: 14px; }
.quota-line .ql-figures { font-family: var(--font-mono); font-size: 13px; color: var(--text-muted); }
.quota-line .ql-figures b { color: var(--text); font-weight: 500; }

/* ============================================================ GEO PICKER == */
.geo-picker { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 620px) { .geo-picker { grid-template-columns: 1fr; } }
.region-search { position: relative; }
.region-menu {
  position: absolute; z-index: 30; top: calc(100% + 5px); left: 0; right: 0; max-height: 260px; overflow-y: auto;
  background: var(--ink-200); border: 1px solid var(--line-bright); border-radius: var(--r-sm); box-shadow: var(--shadow-lg); padding: 5px;
}
.region-opt { padding: 8px 11px; border-radius: var(--r-xs); font-size: 14px; cursor: pointer; display: flex; justify-content: space-between; gap: 10px; }
.region-opt:hover, .region-opt.is-active { background: var(--ink-250); }
.region-opt .ro-code { font-family: var(--font-mono); font-size: 11.5px; color: var(--text-faint); }
.region-opt mark { background: var(--accent-glow); color: var(--accent-bright); border-radius: 3px; }

/* engine mode segmented */
.segmented { display: inline-flex; padding: 3px; border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--ink-100); }
.segmented button { padding: 7px 13px; border-radius: 6px; font-size: 13px; font-weight: 500; color: var(--text-muted); white-space: nowrap; }
.segmented button.is-active { background: var(--ink-200); color: var(--text-strong); box-shadow: var(--shadow-sm); }

/* ============================================================ RESULTS ===== */
.result-list { display: flex; flex-direction: column; gap: 10px; }
.result-card { display: flex; align-items: flex-start; gap: 14px; padding: 15px 17px; }
.result-fav { flex: none; }
.result-main { min-width: 0; flex: 1; }
.result-title { font-size: 15.5px; font-weight: 600; color: var(--text-strong); }
.result-url { font-size: 13px; color: var(--cyan); display: inline-flex; align-items: center; gap: 5px; margin-top: 2px; }
.result-snippet { font-size: 13.5px; color: var(--text-muted); margin-top: 7px; line-height: 1.5; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.result-aside { display: flex; flex-direction: column; align-items: flex-end; gap: 8px; flex: none; }

/* score ring */
.score {
  --v: 0; --c: var(--cyan); width: 46px; height: 46px; border-radius: 50%; flex: none; position: relative;
  display: grid; place-items: center;
  background: conic-gradient(var(--c) calc(var(--v) * 1%), var(--ink-250) 0);
}
.score::before { content: ""; position: absolute; inset: 4px; border-radius: 50%; background: var(--ink-150); }
.score b { position: relative; font-family: var(--font-mono); font-weight: 500; font-size: 14px; color: var(--text); }
.score.good { --c: var(--ok); } .score.mid { --c: var(--warn); } .score.bad { --c: var(--danger); }
.score.lg { width: 84px; height: 84px; } .score.lg b { font-size: 24px; }

/* ============================================================ JOB PANEL === */
.job-card { padding: 14px 16px; border-left: 3px solid var(--stage-1); }
.job-card.running { border-left-color: var(--cyan); }
.job-card.done { border-left-color: var(--ok); }
.job-card.failed, .job-card.error { border-left-color: var(--danger); }
.job-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 9px; }
.job-type { font-family: var(--font-mono); font-size: 12.5px; color: var(--text-muted); }

/* ============================================================ LEAD TABLE == */
.toolbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 16px; }
.toolbar .grow { min-width: 180px; }
.filter-bar { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.lead-name { font-weight: 600; color: var(--text-strong); }
.lead-sub { font-size: 12.5px; color: var(--text-faint); }

/* deal-phase pill colours */
.phase { display: inline-flex; align-items: center; gap: 6px; padding: 3px 9px; border-radius: var(--r-full); font-size: 11.5px; font-weight: 600; border: 1px solid var(--line-bright); background: var(--ink-200); color: var(--text-muted); white-space: nowrap; }
.phase::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.phase.p-leadfinder_eingegangen { color: var(--info); }
.phase.p-bewerbung_eingegangen { color: var(--cyan); }
.phase.p-telefonat_vereinbart { color: #b69bff; }
.phase.p-nicht_erreicht { color: var(--text-faint); }
.phase.p-follow_up { color: var(--warn); }
.phase.p-qualifiziert { color: var(--accent-bright); }
.phase.p-angebot_gesendet { color: var(--stage-5); }
.phase.p-gewonnen { color: var(--ok); }
.phase.p-verloren { color: var(--danger); }
.phase.p-nicht_qualifiziert { color: var(--text-ondark-min); }

/* pagination */
.pager { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--line); }
.pager .pager-info { font-size: 13px; color: var(--text-faint); font-family: var(--font-mono); }

/* ============================================================ DETAIL ====== */
.detail-grid { display: grid; grid-template-columns: 1.6fr 1fr; gap: 18px; align-items: start; }
@media (max-width: 900px) { .detail-grid { grid-template-columns: 1fr; } }
.detail-hero { display: flex; align-items: flex-start; gap: 16px; }
.detail-hero h2 { font-size: 22px; }
.detail-section { padding: 18px 20px; }
.detail-section h3 { font-size: 14px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.06em; font-family: var(--font-display); margin-bottom: 14px; font-weight: 600; }
.timeline { display: flex; flex-direction: column; gap: 0; }
.timeline-item { display: flex; gap: 12px; padding-bottom: 16px; position: relative; }
.timeline-item:not(:last-child)::before { content: ""; position: absolute; left: 5px; top: 16px; bottom: 0; width: 1px; background: var(--line); }
.timeline-dot { width: 11px; height: 11px; border-radius: 50%; background: var(--ink-250); border: 2px solid var(--line-bright); flex: none; margin-top: 4px; z-index: 1; }
.timeline-item.accent .timeline-dot { background: var(--accent); border-color: var(--accent); }
.timeline-body { min-width: 0; }
.timeline-action { font-size: 13.5px; font-weight: 500; }
.timeline-time { font-size: 11.5px; color: var(--text-faint); font-family: var(--font-mono); }

/* ============================================================ ONBOARDING == */
.onb-wrap { max-width: 720px; margin: 0 auto; }
.onb-step { padding: 26px; }
.onb-progress { display: flex; gap: 8px; margin-bottom: 26px; }
.onb-progress .dot { flex: 1; height: 4px; border-radius: 99px; background: var(--ink-250); }
.onb-progress .dot.done { background: var(--accent); }
.onb-progress .dot.cur { background: var(--cyan); }

/* key-status badge */
.key-status { display: inline-flex; align-items: center; gap: 8px; padding: 8px 13px; border-radius: var(--r-sm); border: 1px solid var(--line-bright); background: var(--ink-200); font-size: 13.5px; }
.key-status.set { border-color: rgba(87,217,154,0.35); background: var(--ok-bg); color: var(--ok); }
.key-status .key-hint { font-family: var(--font-mono); color: var(--text-muted); font-size: 12.5px; }

/* page-load fade for whole app */
@keyframes app-in { from { opacity: 0; } }
.app-fade { animation: app-in var(--dur-2) var(--ease); }
