/* Nitai Lead Gen — Twenty-inspired design system, Apple-finished.
   Light (Twenty-clean) + Dark (premium navy). Theme via [data-theme] on <html>. */
:root, [data-theme="light"] {
  --bg: #f6f6f4;
  --surface: #ffffff;
  --surface-2: #fafaf9;
  --surface-3: #f1f1ee;
  --border: #e7e7e3;
  --border-strong: #d9d9d4;
  --text: #1c1c1a;
  --text-2: #6f6f6c;
  --text-3: #a8a8a3;
  --accent: #2f6fed;
  --accent-soft: rgba(47, 111, 237, 0.1);
  --accent-text: #ffffff;
  --green: #1a7f4b; --green-bg: #e6f6ec;
  --amber: #b25e09; --amber-bg: #fdf1e0;
  --red: #d92d20; --red-bg: #fdecea;
  --blue: #2f6fed; --blue-bg: #e9effe;
  --purple: #7a4de8; --purple-bg: #f1eafe;
  --shadow: 0 1px 2px rgba(16, 24, 40, 0.05), 0 1px 3px rgba(16, 24, 40, 0.08);
  --shadow-lg: 0 8px 24px rgba(16, 24, 40, 0.1);
  --sidebar-bg: #ffffff;
  --input-bg: #ffffff;
  --radius: 12px;
}
[data-theme="dark"] {
  --bg: #0b1120;
  --surface: #141d33;
  --surface-2: #0e1628;
  --surface-3: #1b2742;
  --border: #233252;
  --border-strong: #2f4070;
  --text: #e9eef8;
  --text-2: #96a2bb;
  --text-3: #5c6b89;
  --accent: #38bdf8;
  --accent-soft: rgba(56, 189, 248, 0.12);
  --accent-text: #06202e;
  --green: #4ade80; --green-bg: rgba(74, 222, 128, 0.12);
  --amber: #fbbf24; --amber-bg: rgba(251, 191, 36, 0.12);
  --red: #f87171; --red-bg: rgba(248, 113, 113, 0.12);
  --blue: #60a5fa; --blue-bg: rgba(96, 165, 250, 0.12);
  --purple: #c084fc; --purple-bg: rgba(192, 132, 252, 0.12);
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 12px 32px rgba(0, 0, 0, 0.45);
  --sidebar-bg: #101830;
  --input-bg: #0b1322;
}
* { margin: 0; padding: 0; box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, sans-serif;
  background: var(--bg); color: var(--text); min-height: 100vh;
  font-size: 14px; line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
/* ---------- App shell : Twenty-style left sidebar ---------- */
.shell { display: flex; min-height: 100vh; }
.sidebar {
  width: 248px; flex-shrink: 0; background: var(--sidebar-bg);
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh; z-index: 20;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 18px 18px 14px; }
.brand-mark {
  width: 32px; height: 32px; border-radius: 9px; flex-shrink: 0;
  background: linear-gradient(135deg, var(--accent), #7a4de8);
  color: #fff; font-weight: 800; font-size: 16px;
  display: flex; align-items: center; justify-content: center;
}
.brand-name { font-weight: 700; font-size: 15px; letter-spacing: -0.01em; }
.brand-sub { font-size: 11px; color: var(--text-3); }
.nav-label { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-3); padding: 12px 18px 6px; }
.nav-items { display: flex; flex-direction: column; gap: 2px; padding: 0 10px; }
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px; border-radius: 8px;
  color: var(--text-2); text-decoration: none; font-size: 13.5px; font-weight: 500;
}
.nav-item svg { width: 17px; height: 17px; flex-shrink: 0; opacity: 0.85; }
.nav-item:hover { background: var(--surface-3); color: var(--text); }
.nav-item.active { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.sidebar-footer { margin-top: auto; padding: 12px; border-top: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.theme-toggle {
  display: flex; align-items: center; gap: 8px; width: 100%;
  background: var(--surface-2); border: 1px solid var(--border); color: var(--text-2);
  border-radius: 8px; padding: 8px 10px; font-size: 12.5px; font-weight: 600; cursor: pointer;
}
.theme-toggle:hover { border-color: var(--border-strong); color: var(--text); }
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 16px 28px; border-bottom: 1px solid var(--border);
  position: sticky; top: 0; background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(10px); z-index: 10;
}
.topbar h1 { font-size: 17px; font-weight: 700; letter-spacing: -0.01em; }
.topbar .hint { font-size: 12.5px; color: var(--text-3); }
.content { padding: 24px 28px 48px; max-width: 1240px; width: 100%; margin: 0 auto; }
/* ---------- Cards / KPI ---------- */
.kpi-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 14px; margin-bottom: 20px; }
.kpi-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px 18px; box-shadow: var(--shadow); }
.kpi-card .k-label { font-size: 11.5px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-2); }
.kpi-card .k-value { font-size: 30px; font-weight: 750; letter-spacing: -0.02em; margin-top: 4px; font-variant-numeric: tabular-nums; }
.kpi-card .k-sub { font-size: 12px; color: var(--text-3); margin-top: 2px; }
.kpi-card.accent-blue .k-value { color: var(--blue); }
.kpi-card.accent-green .k-value { color: var(--green); }
.kpi-card.accent-purple .k-value { color: var(--purple); }
.kpi-card.accent-amber .k-value { color: var(--amber); }
.kpi-card.accent-red .k-value { color: var(--red); }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); margin-bottom: 18px; }
.card-pad { padding: 20px 22px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 22px; border-bottom: 1px solid var(--border); }
.card-head h2 { font-size: 14px; font-weight: 700; }
.card-head .meta { font-size: 12px; color: var(--text-3); }
/* ---------- Funnel ---------- */
.funnel { display: flex; flex-direction: column; gap: 8px; padding: 18px 22px; }
.funnel-row { display: grid; grid-template-columns: 150px 1fr 64px; align-items: center; gap: 12px; font-size: 12.5px; }
.funnel-row .f-label { color: var(--text-2); font-weight: 600; white-space: nowrap; }
.funnel-track { height: 10px; border-radius: 9999px; background: var(--surface-3); overflow: hidden; }
.funnel-fill { height: 100%; border-radius: 9999px; background: linear-gradient(90deg, var(--accent), #7a4de8); transition: width 0.5s ease; }
.funnel-row .f-val { text-align: right; font-variant-numeric: tabular-nums; font-weight: 700; }
/* ---------- Tables (Twenty record-list style) ---------- */
.rtable { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.rtable th { text-align: left; font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-3); padding: 10px 14px; border-bottom: 1px solid var(--border); white-space: nowrap; }
.rtable td { padding: 12px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.rtable tbody tr:last-child td { border-bottom: none; }
.rtable tbody tr:hover { background: var(--surface-2); }
.rtable .strong { font-weight: 650; }
.rtable .muted { color: var(--text-2); font-size: 12.5px; }
/* ---------- Pills / badges ---------- */
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 9999px; font-size: 11.5px; font-weight: 650; white-space: nowrap; }
.pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.pill.completed, .pill.replied { background: var(--green-bg); color: var(--green); }
.pill.running, .pill.pending, .pill.searching, .pill.extracting, .pill.qualifying, .pill.persisting, .pill.validating, .pill.new { background: var(--blue-bg); color: var(--blue); }
.pill.failed { background: var(--red-bg); color: var(--red); }
.pill.partial, .pill.needs_human { background: var(--amber-bg); color: var(--amber); }
.pill.mocked { background: var(--surface-3); color: var(--text-3); border: 1px dashed var(--border-strong); }
.pill.mocked::before { background: var(--text-3); }
.tag { display: inline-block; padding: 2px 8px; border-radius: 6px; font-size: 11.5px; font-weight: 600; background: var(--accent-soft); color: var(--accent); }
/* ---------- Buttons / forms ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 9px 18px; background: var(--accent); color: var(--accent-text); border: none; border-radius: 9px; font-size: 13.5px; font-weight: 650; cursor: pointer; text-decoration: none; transition: transform 0.12s ease, box-shadow 0.12s ease, opacity 0.12s; }
.btn:hover { transform: translateY(-1px); box-shadow: var(--shadow-lg); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; box-shadow: none; }
.btn-ghost { background: transparent; color: var(--text-2); border: 1px solid var(--border); }
.btn-ghost:hover { color: var(--text); border-color: var(--border-strong); box-shadow: none; transform: none; }
.btn-sm { padding: 6px 12px; font-size: 12.5px; border-radius: 7px; }
.link { color: var(--accent); text-decoration: none; font-weight: 600; font-size: 12.5px; }
.link:hover { text-decoration: underline; }
label.f-label { display: block; font-size: 12.5px; font-weight: 600; color: var(--text-2); margin: 16px 0 6px; }
label.f-label:first-of-type { margin-top: 0; }
input.f-input, select.f-input, textarea.f-input {
  width: 100%; padding: 10px 12px; background: var(--input-bg);
  border: 1px solid var(--border); border-radius: 9px; color: var(--text); font-size: 13.5px; font-family: inherit;
}
input.f-input:focus, select.f-input:focus, textarea.f-input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
textarea.f-input { min-height: 84px; resize: vertical; }
.count-row { display: flex; gap: 8px; margin-top: 8px; }
.count-btn { flex: 1; padding: 9px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 8px; color: var(--text-2); cursor: pointer; font-size: 12.5px; font-weight: 650; text-align: center; }
.count-btn.active, .count-btn:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }
.sector-block { margin-top: 14px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 10px; padding: 14px; }
.sector-head { font-size: 13px; font-weight: 700; margin-bottom: 10px; }
.sector-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 8px; }
.sector-check { display: flex; align-items: center; gap: 9px; padding: 8px 10px; background: var(--surface); border: 1px solid var(--border); border-radius: 8px; cursor: pointer; font-size: 13px; }
.sector-check:hover { border-color: var(--accent); }
.sector-check input { accent-color: var(--accent); width: 15px; height: 15px; }
/* ---------- Lead cards ---------- */
.lead-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px 22px; margin-bottom: 14px; box-shadow: var(--shadow); transition: border-color 0.15s, box-shadow 0.15s; }
.lead-card:hover { border-color: var(--border-strong); box-shadow: var(--shadow-lg); }
.lead-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 12px; }
.lead-top h3 { font-size: 16px; font-weight: 700; letter-spacing: -0.01em; }
.score { display: inline-flex; align-items: center; padding: 5px 12px; border-radius: 9px; font-size: 13px; font-weight: 800; font-variant-numeric: tabular-nums; }
.score.high { background: var(--green-bg); color: var(--green); }
.score.medium { background: var(--amber-bg); color: var(--amber); }
.score.low { background: var(--red-bg); color: var(--red); }
.lead-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 12px; font-size: 13px; margin-bottom: 12px; }
.lead-grid .dl { font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-3); margin-bottom: 2px; }
.lead-grid .dv { word-break: break-word; }
.lead-grid .dv.phone { font-weight: 700; color: var(--accent); }
.remarks { background: var(--surface-2); border: 1px solid var(--border); border-radius: 8px; padding: 10px 14px; font-size: 12.5px; color: var(--text-2); margin-bottom: 10px; }
.reasoning { padding: 10px 14px; background: var(--surface-2); border-radius: 8px; font-size: 12.5px; color: var(--text-2); border-left: 3px solid var(--accent); }
/* ---------- Follow-up timeline ---------- */
.timeline { display: flex; flex-direction: column; gap: 0; padding: 6px 22px 18px; }
.tl-item { display: flex; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--border); font-size: 13px; }
.tl-item:last-child { border-bottom: none; }
.tl-dot { width: 10px; height: 10px; border-radius: 50%; margin-top: 5px; flex-shrink: 0; background: var(--text-3); }
.tl-dot.sent { background: var(--green); } .tl-dot.failed { background: var(--red); } .tl-dot.pending { background: var(--blue); }
.tl-body { flex: 1; } .tl-meta { font-size: 11.5px; color: var(--text-3); }
/* ---------- Misc ---------- */
.section-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin: 22px 0 12px; }
.section-head h2 { font-size: 14px; font-weight: 700; }
.empty { text-align: center; padding: 40px 20px; color: var(--text-3); }
.progress { height: 6px; border-radius: 9999px; background: var(--surface-3); overflow: hidden; margin-top: 8px; }
.progress > div { height: 100%; border-radius: 9999px; background: var(--accent); transition: width 0.4s ease; }
.toolbar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.search-input { max-width: 280px; }
pre.dump { background: var(--surface-2); border: 1px solid var(--border); border-radius: 8px; padding: 14px; font-size: 12px; overflow: auto; max-height: 420px; }
/* ---------- Responsive ---------- */
.menu-btn { display: none; background: none; border: 1px solid var(--border); border-radius: 8px; padding: 7px 10px; color: var(--text-2); cursor: pointer; font-size: 15px; }
@media (max-width: 860px) {
  .sidebar { position: fixed; left: 0; top: 0; transform: translateX(-100%); transition: transform 0.22s ease; box-shadow: var(--shadow-lg); }
  body.nav-open .sidebar { transform: none; }
  .menu-btn { display: inline-block; }
  .content { padding: 16px 16px 40px; }
  .topbar { padding: 12px 16px; }
  .funnel-row { grid-template-columns: 110px 1fr 52px; }
}
