* { box-sizing: border-box; }
body { margin: 0; font-family: system-ui, -apple-system, sans-serif; background: #0b0f14; color: #e7ecf1; min-height: 100vh; }
.hidden { display: none !important; }
.muted { color: #8b98a5; font-size: 13px; }
.error { color: #f87171; font-size: 13px; margin-top: 8px; }
.toolbar { padding: 0 24px 12px; display: flex; gap: 12px; align-items: center; }

.panel { max-width: 420px; margin: 8vh auto; padding: 32px; background: #141b24; border-radius: 14px; border: 1px solid #243044; }
.panel h1 { margin: 0 0 8px; font-size: 24px; }
.panel label { display: block; margin-top: 14px; font-size: 12px; color: #8b98a5; text-transform: uppercase; letter-spacing: .04em; }
.panel input, .panel select { width: 100%; margin-top: 6px; padding: 11px 12px; border: 1px solid #243044; border-radius: 8px; background: #0b0f14; color: #e7ecf1; font-size: 15px; }
.panel button, .btn-primary { padding: 11px 16px; border: none; border-radius: 8px; background: #3b82f6; color: #fff; font-size: 14px; cursor: pointer; font-weight: 600; }
.panel button { width: 100%; margin-top: 18px; }
.btn-primary:hover { background: #2563eb; }
.btn-danger { padding: 8px 14px; background: #450a0a; color: #fca5a5; border: 1px solid #7f1d1d; border-radius: 6px; cursor: pointer; font-size: 13px; }
.btn-ghost { padding: 8px 14px; background: transparent; color: #8b98a5; border: 1px solid #243044; border-radius: 6px; cursor: pointer; font-size: 13px; }
.qr-wrap { text-align: center; margin: 16px 0; }
.qr-wrap img { max-width: 180px; border-radius: 8px; }
.secret { font-family: monospace; font-size: 11px; word-break: break-all; background: #0b0f14; padding: 10px; border-radius: 6px; }

.topbar { display: flex; justify-content: space-between; align-items: center; padding: 14px 24px; border-bottom: 1px solid #243044; background: #141b24; position: sticky; top: 0; z-index: 10; }
.topbar-right { display: flex; gap: 10px; align-items: center; }
.badge { font-size: 11px; padding: 4px 10px; border-radius: 999px; background: #243044; }
.badge.ok { background: #064e3b; color: #6ee7b7; }
.badge.warn { background: #78350f; color: #fcd34d; }

.stats-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 10px; padding: 18px 24px; }
.stat-card { background: linear-gradient(145deg,#141b24,#1a2332); border: 1px solid #243044; border-radius: 12px; padding: 14px; }
.stat-card .val { font-size: 26px; font-weight: 800; color: #60a5fa; line-height: 1; }
.stat-card .lbl { font-size: 11px; color: #8b98a5; margin-top: 6px; text-transform: uppercase; }

.tabs { display: flex; gap: 2px; padding: 0 24px; border-bottom: 1px solid #243044; overflow-x: auto; }
.tab { background: none; border: none; color: #8b98a5; padding: 12px 14px; cursor: pointer; border-bottom: 2px solid transparent; font-size: 13px; white-space: nowrap; }
.tab.active { color: #fff; border-bottom-color: #3b82f6; }
.tab-panel { padding: 16px 24px 40px; }

.card-list { display: flex; flex-direction: column; gap: 10px; }
.lead-card { background: #141b24; border: 1px solid #243044; border-radius: 12px; padding: 16px; }
.lead-card header { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.lead-card h3 { margin: 0; font-size: 16px; }
.lead-meta { font-size: 12px; color: #8b98a5; margin-top: 4px; }
.lead-actions { display: flex; gap: 8px; margin-top: 12px; flex-wrap: wrap; align-items: center; }
.intent-pill { background: #1e3a5f; color: #93c5fd; padding: 2px 8px; border-radius: 999px; font-size: 11px; font-weight: 700; }
.tier-pill { padding: 2px 8px; border-radius: 999px; font-size: 11px; font-weight: 700; margin-left: 4px; }
.tier-hot { background: #dc2626; color: #fff; }
.tier-warm { background: #ea580c; color: #fff; }
.tier-cool { background: #2563eb; color: #fff; }
.tier-cold { background: #64748b; color: #fff; }
.track-badge { font-size: 11px; color: #059669; margin-left: 4px; }
.crm-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 16px; }
.toggle-row { display: flex; align-items: center; gap: 8px; font-size: 14px; margin: 8px 0; }
.crm-card { background: #0f172a; border: 1px solid #334155; border-radius: 8px; padding: 16px; }
.crm-card label { display: block; margin: 8px 0; font-size: 13px; }
.crm-card input[type=text], .crm-card input[type=password] { width: 100%; margin-top: 4px; }
.response-actions { margin-top: 12px; padding-top: 12px; border-top: 1px solid #334155; }
.response-actions button { margin: 4px 4px 0 0; }

.table-wrap { overflow-x: auto; border: 1px solid #243044; border-radius: 12px; }
table { width: 100%; border-collapse: collapse; font-size: 12px; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid #243044; }
th { color: #8b98a5; background: #141b24; position: sticky; top: 0; }
.status { font-size: 10px; padding: 2px 8px; border-radius: 999px; background: #374151; text-transform: uppercase; }
.status.pending, .status.pending_approval { background: #78350f; color: #fcd34d; }
.status.sent, .status.completed { background: #064e3b; color: #6ee7b7; }
.status.failed { background: #450a0a; color: #fca5a5; }
.status.processing, .status.sending { background: #1e3a5f; color: #93c5fd; }

.events { list-style: none; padding: 0; margin: 0; }
.events li { padding: 8px 0; border-bottom: 1px solid #243044; font-size: 12px; }
.events time { color: #64748b; margin-right: 8px; font-family: monospace; }
.empty { color: #64748b; text-align: center; padding: 48px 20px; }

.modal { position: fixed; inset: 0; background: rgba(0,0,0,.75); display: flex; align-items: center; justify-content: center; z-index: 100; padding: 16px; }
.modal-box { background: #141b24; border: 1px solid #243044; border-radius: 14px; padding: 24px; width: 100%; max-width: 540px; max-height: 90vh; overflow-y: auto; }
.modal-box h2 { margin: 0 0 16px; }
.modal-box label { display: block; margin-top: 12px; font-size: 12px; color: #8b98a5; }
.modal-box input, .modal-box textarea, .modal-box select { width: 100%; margin-top: 6px; padding: 10px; border: 1px solid #243044; border-radius: 8px; background: #0b0f14; color: #e7ecf1; font-family: inherit; font-size: 14px; }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 20px; }

.charts-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 12px; }
@media (max-width: 768px) { .charts-row { grid-template-columns: 1fr; } }
.chart-panel { background: #141b24; border: 1px solid #243044; border-radius: 12px; padding: 18px; margin-bottom: 12px; }
.chart-panel.half { margin-bottom: 0; }
.chart-panel h3 { margin: 0 0 14px; font-size: 14px; color: #8b98a5; text-transform: uppercase; letter-spacing: .05em; }
.funnel { display: flex; align-items: flex-end; gap: 8px; height: 140px; }
.funnel-bar { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; min-width: 0; }
.funnel-bar .bar { width: 100%; background: linear-gradient(180deg,#3b82f6,#1d4ed8); border-radius: 6px 6px 0 0; min-height: 4px; transition: height .3s; }
.funnel-bar .lbl { font-size: 10px; color: #64748b; margin-top: 6px; text-align: center; }
.funnel-bar .val { font-size: 14px; font-weight: 700; margin-bottom: 4px; }
.bar-chart { display: flex; align-items: flex-end; gap: 4px; height: 100px; }
.bar-chart .col { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; }
.bar-chart .col .b { width: 100%; background: #059669; border-radius: 4px 4px 0 0; min-height: 2px; }
.bar-chart .col .d { font-size: 9px; color: #64748b; margin-top: 4px; }
.conv-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 12px; }
.conv-item { text-align: center; padding: 10px; background: #0b0f14; border-radius: 8px; }
.conv-item .pct { font-size: 22px; font-weight: 800; color: #6ee7b7; }
.provider-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 10px; }
.provider-card { padding: 14px; background: #0b0f14; border-radius: 8px; border: 1px solid #243044; }
.provider-card.ok { border-color: #064e3b; }
.provider-card.off { opacity: .5; }
.code-block { background: #0b0f14; padding: 12px; border-radius: 8px; font-size: 11px; overflow: auto; max-height: 120px; }
.ai-summary { font-size: 12px; color: #93c5fd; margin-top: 6px; }

.kanban { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; overflow-x: auto; }
@media (max-width: 900px) { .kanban { grid-template-columns: 1fr 1fr; } }
.kanban-col { background: #141b24; border: 1px solid #243044; border-radius: 10px; padding: 10px; min-height: 200px; }
.kanban-col h4 { margin: 0 0 10px; font-size: 12px; color: #8b98a5; text-transform: uppercase; }
.kanban-card { background: #0b0f14; border: 1px solid #243044; border-radius: 8px; padding: 8px; margin-bottom: 6px; font-size: 12px; cursor: pointer; }
.kanban-card:hover { border-color: #3b82f6; }
.modal-box.wide { max-width: 720px; }
.preview-frame { width: 100%; height: 420px; border: 1px solid #243044; border-radius: 8px; background: #fff; }
code { background: #0b0f14; padding: 2px 6px; border-radius: 4px; font-size: 11px; }
.live-dot { width: 8px; height: 8px; border-radius: 50%; background: #6ee7b7; display: inline-block; animation: pulse 2s infinite; }
@keyframes pulse { 0%,100%{opacity:1} 50%{opacity:.4} }

/* ——— v2.15 Pro shell ——— */
:root {
  --bg: #070b10;
  --surface: #111820;
  --surface-2: #161f2b;
  --border: #243044;
  --text: #e7ecf1;
  --muted: #8b98a5;
  --accent: #3b82f6;
  --accent-2: #2563eb;
  --success: #6ee7b7;
  --warn: #fcd34d;
  --danger: #f87171;
  --sidebar-w: 240px;
  --radius: 12px;
}

body { background: var(--bg); color: var(--text); }

.app-shell { display: flex; min-height: 100vh; }
.sidebar {
  width: var(--sidebar-w);
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 20;
  overflow-y: auto;
}
.sidebar-brand {
  padding: 18px 16px;
  border-bottom: 1px solid var(--border);
  font-weight: 800;
  font-size: 15px;
  letter-spacing: -0.02em;
}
.sidebar-brand small { display: block; color: var(--muted); font-weight: 500; font-size: 11px; margin-top: 4px; }
.nav-group { padding: 12px 10px 4px; }
.nav-group-title {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--muted);
  padding: 0 8px 8px;
}
.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  border: none;
  background: transparent;
  color: var(--muted);
  padding: 10px 12px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 13px;
  text-align: left;
  margin-bottom: 2px;
}
.nav-item:hover { background: var(--surface-2); color: var(--text); }
.nav-item.active { background: rgba(59,130,246,.15); color: #fff; border: 1px solid rgba(59,130,246,.35); }
.nav-icon { width: 18px; text-align: center; opacity: .85; }
.main-area { flex: 1; margin-left: var(--sidebar-w); min-width: 0; }
.main-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 24px;
  border-bottom: 1px solid var(--border);
  background: rgba(17,24,32,.9);
  backdrop-filter: blur(8px);
  position: sticky;
  top: 0;
  z-index: 10;
}
.main-content { padding: 0 0 48px; }
.stats-grid { padding: 18px 24px 8px; }
.cockpit-grid {
  display: grid;
  grid-template-columns: 1.2fr .8fr;
  gap: 14px;
  padding: 0 24px 24px;
}
@media (max-width: 1100px) { .cockpit-grid { grid-template-columns: 1fr; } }
.priority-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  display: flex;
  gap: 14px;
  align-items: flex-start;
  transition: border-color .15s;
}
.priority-card:hover { border-color: var(--accent); }
.priority-score {
  min-width: 52px;
  height: 52px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  font-weight: 800;
  background: linear-gradient(145deg,#1e3a5f,#172554);
  color: #93c5fd;
}
.priority-score.critical { background: linear-gradient(145deg,#7f1d1d,#991b1b); color: #fecaca; }
.priority-score.hot { background: linear-gradient(145deg,#9a3412,#c2410c); color: #fed7aa; }
.priority-body { flex: 1; min-width: 0; }
.priority-body h4 { margin: 0 0 4px; font-size: 15px; }
.priority-reasons { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.reason-chip {
  font-size: 10px;
  padding: 3px 8px;
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--muted);
  border: 1px solid var(--border);
}
.priority-actions { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 10px; }
.btn-sm {
  padding: 6px 10px;
  font-size: 12px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  cursor: pointer;
}
.btn-sm.primary { background: var(--accent); border-color: var(--accent-2); color: #fff; }
.compliance-ring {
  width: 120px;
  height: 120px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  font-weight: 800;
  margin: 0 auto 12px;
  border: 6px solid var(--border);
}
.compliance-ring.ok { border-color: #059669; color: var(--success); }
.compliance-ring.warn { border-color: #d97706; color: var(--warn); }
.ab-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; }
.ab-card {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px;
}
.ab-card h4 { margin: 0 0 8px; }
.ab-metric { font-size: 22px; font-weight: 800; color: var(--success); }
.checklist-row { display: flex; justify-content: space-between; padding: 8px 0; border-bottom: 1px solid var(--border); font-size: 13px; }
.checklist-row.ok { color: var(--success); }
.checklist-row.ko { color: var(--warn); }
.export-bar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 14px; }
.export-bar select, .export-bar input {
  padding: 9px 12px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
}
.tabs { display: none; }
@media (max-width: 900px) {
  .sidebar { width: 64px; }
  .sidebar-brand span, .nav-group-title, .nav-item span:last-child { display: none; }
  .main-area { margin-left: 64px; }
  .nav-item { justify-content: center; padding: 12px 8px; }
}

