@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');

:root {
  --bg-base: #0f172a;
  --bg-surface: #111827;
  --bg-card: #1e293b;
  --bg-card-hover: #1f2a40;
  --border: #334155;
  --border-active: rgba(99,179,237,0.4);
  --text-primary: #f8fafc;
  --text-secondary: #cbd5e1;
  --text-muted: #94a3b8;
  --cyan: #38bdf8;
  --cyan-dim: rgba(56,189,248,0.12);
  --violet: #a78bfa;
  --violet-dim: rgba(167,139,250,0.12);
  --emerald: #34d399;
  --emerald-dim: rgba(52,211,153,0.12);
  --amber: #fbbf24;
  --amber-dim: rgba(251,191,36,0.12);
  --rose: #fb7185;
  --rose-dim: rgba(251,113,133,0.12);
  --radius: 12px;
  --radius-lg: 18px;
  --shadow: 0 4px 24px rgba(0,0,0,0.4);
  --shadow-glow: 0 0 40px rgba(56,189,248,0.08);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
  font-family: 'Inter', system-ui, sans-serif;
  background: var(--bg-base);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
}

/* ── Layout ── */
.app-shell { display: flex; min-height: 100vh; }

.sidebar {
  width: 240px;
  background: var(--bg-surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0;
  height: 100vh;
  z-index: 100;
  padding: 24px 0;
}

.sidebar-logo {
  padding: 0 20px 24px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 16px;
}

.logo-mark {
  font-size: 20px;
  font-weight: 800;
  background: linear-gradient(135deg, var(--cyan), var(--violet));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  letter-spacing: -0.5px;
}

.logo-sub { font-size: 11px; color: var(--text-muted); margin-top: 2px; text-transform: uppercase; letter-spacing: 1px; }

.nav-section { padding: 0 12px; margin-bottom: 8px; }
.nav-label { font-size: 10px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 1.5px; padding: 0 8px; margin-bottom: 6px; }

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius);
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  transition: all 0.2s;
  cursor: pointer;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
}

.nav-item:hover { background: rgba(255,255,255,0.05); color: var(--text-primary); }
.nav-item.active { background: var(--cyan-dim); color: var(--cyan); }
.nav-icon { width: 18px; text-align: center; font-size: 16px; }

.main-content { margin-left: 240px; flex: 1; min-height: 100vh; }

.topbar {
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border);
  padding: 0 32px;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 50;
}

.topbar-title { font-size: 16px; font-weight: 600; color: var(--text-primary); }
.topbar-right { display: flex; align-items: center; gap: 12px; }

.page-body { padding: 32px; }

/* ── Cards ── */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  transition: all 0.2s;
}

.card:hover { border-color: var(--border-active); box-shadow: var(--shadow-glow); }
.card-sm { padding: 16px; border-radius: var(--radius); }

.glass {
  background: rgba(26,34,53,0.8);
  backdrop-filter: blur(16px);
  border: 1px solid rgba(255,255,255,0.08);
}

/* ── Stats ── */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; margin-bottom: 32px; }

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px 24px;
  position: relative;
  overflow: hidden;
}

.stat-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 2px;
}

.stat-card.cyan::before { background: linear-gradient(90deg, var(--cyan), transparent); }
.stat-card.violet::before { background: linear-gradient(90deg, var(--violet), transparent); }
.stat-card.emerald::before { background: linear-gradient(90deg, var(--emerald), transparent); }
.stat-card.amber::before { background: linear-gradient(90deg, var(--amber), transparent); }

.stat-label { font-size: 12px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 1px; margin-bottom: 8px; }
.stat-value { font-size: 32px; font-weight: 800; line-height: 1; }
.stat-value.cyan { color: var(--cyan); }
.stat-value.violet { color: var(--violet); }
.stat-value.emerald { color: var(--emerald); }
.stat-value.amber { color: var(--amber); }
.stat-sub { font-size: 12px; color: var(--text-muted); margin-top: 6px; }

/* ── Buttons ── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  text-decoration: none;
  transition: all 0.2s;
  letter-spacing: 0.2px;
}

.btn-primary {
  background: linear-gradient(135deg, var(--cyan), #0ea5e9);
  color: #0a0d14;
  box-shadow: 0 4px 16px rgba(56,189,248,0.3);
}

.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 6px 20px rgba(56,189,248,0.4); }

.btn-secondary {
  background: rgba(255,255,255,0.06);
  color: var(--text-secondary);
  border: 1px solid var(--border);
}

.btn-secondary:hover { background: rgba(255,255,255,0.1); color: var(--text-primary); }

.btn-ghost { background: transparent; color: var(--text-secondary); padding: 8px 12px; }
.btn-ghost:hover { color: var(--text-primary); }

.btn-sm { padding: 7px 14px; font-size: 13px; }
.btn-danger { background: var(--rose-dim); color: var(--rose); border: 1px solid rgba(251,113,133,0.2); }

/* ── Forms ── */
.form-group { margin-bottom: 20px; }
.form-label { display: block; font-size: 13px; font-weight: 500; color: var(--text-secondary); margin-bottom: 8px; }

.form-control {
  width: 100%;
  background: var(--bg-base);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 11px 16px;
  color: var(--text-primary);
  font-size: 14px;
  font-family: inherit;
  transition: border-color 0.2s, box-shadow 0.2s;
  outline: none;
}

.form-control:focus { border-color: var(--cyan); box-shadow: 0 0 0 3px rgba(56,189,248,0.1); }
.form-control::placeholder { color: var(--text-muted); }

select.form-control { cursor: pointer; appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%238892a4' d='M6 8L1 3h10z'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 14px center; padding-right: 36px; }

textarea.form-control { resize: vertical; min-height: 100px; }

.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-row-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 16px; }

/* ── Slider input ── */
.slider-group { display: flex; align-items: center; gap: 12px; }
.slider { flex: 1; appearance: none; height: 6px; border-radius: 3px; background: var(--bg-base); border: 1px solid var(--border); outline: none; cursor: pointer; }
.slider::-webkit-slider-thumb { appearance: none; width: 18px; height: 18px; border-radius: 50%; background: var(--cyan); cursor: pointer; box-shadow: 0 0 8px rgba(56,189,248,0.5); }
.slider-value { font-size: 16px; font-weight: 700; color: var(--cyan); min-width: 32px; text-align: center; }

/* ── Kanban ── */
.kanban-board { display: flex; gap: 16px; overflow-x: auto; padding-bottom: 24px; min-height: 600px; }
.kanban-col { flex: 0 0 280px; display: flex; flex-direction: column; }

.kanban-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-radius: var(--radius) var(--radius) 0 0;
  border: 1px solid var(--border);
  border-bottom: none;
  background: var(--bg-card);
  font-weight: 600;
  font-size: 13px;
}

.kanban-body {
  flex: 1;
  background: rgba(17,24,39,0.5);
  border: 1px solid var(--border);
  border-radius: 0 0 var(--radius) var(--radius);
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 400px;
}

.kanban-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  cursor: pointer;
  transition: all 0.2s;
  text-decoration: none;
  display: block;
}

.kanban-card:hover { border-color: var(--border-active); transform: translateY(-2px); box-shadow: var(--shadow); }
.kanban-card-name { font-size: 14px; font-weight: 600; color: var(--text-primary); margin-bottom: 6px; }
.kanban-card-meta { font-size: 12px; color: var(--text-muted); display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.kanban-count { background: rgba(255,255,255,0.08); border-radius: 20px; padding: 2px 8px; font-size: 12px; }

/* ── Badge / Tag ── */
.badge {
  display: inline-block;
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.badge-emerald { background: var(--emerald-dim); color: #34d399; border: 1px solid rgba(52,211,153,0.3); }
.badge-violet { background: var(--violet-dim); color: #a78bfa; border: 1px solid rgba(167,139,250,0.3); }
.badge-cyan { background: var(--cyan-dim); color: #38bdf8; border: 1px solid rgba(56,189,248,0.3); }
.badge-amber { background: rgba(245, 158, 11, 0.15); color: #fbbf24; border: 1px solid rgba(245,158,11,0.3); }
.badge-rose { background: rgba(244, 63, 94, 0.15); color: #fb7185; border: 1px solid rgba(244,63,94,0.3); }
.badge-muted { background: var(--bg-base); color: var(--text-muted); border: 1px solid var(--border); }

/* ── DMU Map ── */
.dmu-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.dmu-section-label { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 1.5px; margin-bottom: 12px; }
.dmu-section-label.visionary { color: var(--violet); }
.dmu-section-label.evaluator { color: var(--cyan); }

.contact-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  transition: all 0.2s;
}

.contact-card:hover { border-color: var(--border-active); }
.contact-name { font-size: 14px; font-weight: 600; margin-bottom: 2px; }
.contact-title { font-size: 12px; color: var(--text-muted); margin-bottom: 10px; }

.score-bar { height: 4px; background: var(--bg-base); border-radius: 2px; overflow: hidden; margin-top: 8px; }
.score-fill { height: 100%; border-radius: 2px; transition: width 0.6s ease; }
.score-fill.high { background: linear-gradient(90deg, var(--emerald), var(--cyan)); }
.score-fill.medium { background: linear-gradient(90deg, var(--amber), var(--cyan)); }
.score-fill.low { background: var(--rose); }

/* ── Engagement Timeline ── */
.timeline { display: flex; flex-direction: column; gap: 0; }
.timeline-item { display: flex; gap: 16px; padding-bottom: 24px; position: relative; }
.timeline-item::before { content: ''; position: absolute; left: 15px; top: 32px; bottom: 0; width: 1px; background: var(--border); }
.timeline-item:last-child::before { display: none; }
.timeline-dot { width: 32px; height: 32px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 14px; flex-shrink: 0; border: 1px solid var(--border); }
.timeline-dot.positive { background: var(--emerald-dim); border-color: var(--emerald); }
.timeline-dot.neutral { background: var(--cyan-dim); border-color: var(--cyan); }
.timeline-dot.negative { background: var(--rose-dim); border-color: var(--rose); }
.timeline-body { flex: 1; padding-top: 4px; }
.timeline-title { font-size: 14px; font-weight: 600; margin-bottom: 4px; }
.timeline-text { font-size: 13px; color: var(--text-secondary); }
.timeline-meta { font-size: 11px; color: var(--text-muted); margin-top: 6px; }

/* ── Path Recommendation ── */
.path-card {
  border-radius: var(--radius-lg);
  padding: 24px;
  border: 1px solid;
}

.path-card.cyan { background: var(--bg-card); border-color: rgba(56,189,248,0.2); }
.path-card.violet { background: var(--bg-card); border-color: rgba(167,139,250,0.2); }
.path-card.emerald { background: var(--bg-card); border-color: rgba(52,211,153,0.2); }
.path-card.amber { background: var(--bg-card); border-color: rgba(251,191,36,0.2); }

.path-icon { font-size: 36px; margin-bottom: 12px; }
.path-label { font-size: 13px; font-weight: 700; text-transform: uppercase; letter-spacing: 1px; margin-bottom: 8px; }
.path-rationale { font-size: 14px; color: var(--text-secondary); margin-bottom: 16px; }

.step-list { list-style: none; display: flex; flex-direction: column; gap: 8px; }
.step-item { display: flex; gap: 10px; font-size: 13px; }
.step-num { width: 22px; height: 22px; border-radius: 50%; background: rgba(255,255,255,0.08); display: flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 700; flex-shrink: 0; }

/* ── Playbook ── */
.playbook-header { text-align: center; padding: 48px 24px; }
.playbook-persona-icon { font-size: 64px; margin-bottom: 16px; }
.playbook-arc { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; justify-content: center; margin: 24px 0; }
.arc-step { padding: 8px 16px; border-radius: 20px; background: rgba(255,255,255,0.05); border: 1px solid var(--border); font-size: 13px; font-weight: 600; }
.arc-arrow { color: var(--text-muted); font-size: 16px; }

/* ── Auth pages ── */
.auth-page { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px; background: radial-gradient(ellipse at 20% 50%, rgba(56,189,248,0.04) 0%, transparent 60%), radial-gradient(ellipse at 80% 20%, rgba(167,139,250,0.04) 0%, transparent 60%), var(--bg-base); }
.auth-card { width: 100%; max-width: 440px; }
.auth-logo { text-align: center; margin-bottom: 32px; }
.auth-title { font-size: 28px; font-weight: 800; margin-bottom: 8px; }
.auth-sub { color: var(--text-muted); font-size: 14px; }

/* ── Section headers ── */
.section-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; }
.section-title { font-size: 18px; font-weight: 700; }
.section-subtitle { font-size: 13px; color: var(--text-muted); margin-top: 2px; }

/* ── Alerts / Flashes ── */
.alert { padding: 12px 16px; border-radius: var(--radius); font-size: 14px; margin-bottom: 16px; display: flex; align-items: center; gap: 10px; }
.alert-success { background: var(--emerald-dim); border: 1px solid rgba(52,211,153,0.2); color: var(--emerald); }
.alert-error { background: var(--rose-dim); border: 1px solid rgba(251,113,133,0.2); color: var(--rose); }
.alert-info { background: var(--cyan-dim); border: 1px solid rgba(56,189,248,0.2); color: var(--cyan); }

/* ── Status progress bar ── */
.status-track { display: flex; gap: 0; margin: 24px 0; }
.status-step { flex: 1; padding: 8px 4px; text-align: center; font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.5px; border-bottom: 2px solid var(--border); color: var(--text-muted); transition: all 0.3s; }
.status-step.done { border-color: var(--emerald); color: var(--emerald); }
.status-step.active { border-color: var(--cyan); color: var(--cyan); }

/* ── Tabs ── */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 24px; }
.tab-btn { padding: 10px 16px; font-size: 14px; font-weight: 500; color: var(--text-muted); background: none; border: none; cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px; transition: all 0.2s; }
.tab-btn:hover { color: var(--text-primary); }
.tab-btn.active { color: var(--cyan); border-bottom-color: var(--cyan); }
.tab-pane { display: none; }
.tab-pane.active { display: block; }

/* ── Modal ── */
.modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.7); backdrop-filter: blur(4px); z-index: 200; display: flex; align-items: center; justify-content: center; padding: 24px; opacity: 0; pointer-events: none; transition: opacity 0.2s; }
.modal-overlay.open { opacity: 1; pointer-events: all; }
.modal { background: var(--bg-surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 32px; width: 100%; max-width: 560px; box-shadow: 0 24px 64px rgba(0,0,0,0.6); transform: translateY(16px); transition: transform 0.2s; }
.modal-overlay.open .modal { transform: translateY(0); }
.modal-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 24px; }
.modal-title { font-size: 18px; font-weight: 700; }
.modal-close { background: none; border: none; color: var(--text-muted); cursor: pointer; font-size: 20px; padding: 4px; transition: color 0.2s; }
.modal-close:hover { color: var(--text-primary); }

/* ── Divider ── */
.divider { border: none; border-top: 1px solid var(--border); margin: 24px 0; }

/* ── Utilities ── */
.flex { display: flex; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.gap-4 { gap: 16px; }
.mt-1 { margin-top: 4px; }
.mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 12px; }
.mt-4 { margin-top: 16px; }
.mb-2 { margin-bottom: 8px; }
.mb-4 { margin-bottom: 16px; }
.mb-6 { margin-bottom: 24px; }
.text-sm { font-size: 13px; }
.text-xs { font-size: 11px; }
.text-muted { color: var(--text-muted); }
.text-secondary { color: var(--text-secondary); }
.text-cyan { color: var(--cyan); }
.text-violet { color: var(--violet); }
.text-emerald { color: var(--emerald); }
.text-amber { color: var(--amber); }
.text-rose { color: var(--rose); }
.font-bold { font-weight: 700; }
.font-semibold { font-weight: 600; }
.w-full { width: 100%; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 16px; }

/* ── Scrollbar ── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.2); }

/* ── Animations ── */
@keyframes fadeIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.5; } }
@keyframes glow { 0%, 100% { box-shadow: 0 0 20px rgba(56,189,248,0.1); } 50% { box-shadow: 0 0 40px rgba(56,189,248,0.25); } }

.fade-in { animation: fadeIn 0.4s ease forwards; }
.card-animate { animation: fadeIn 0.4s ease forwards; }

/* ── Responsive ── */
@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); }
  .main-content { margin-left: 0; }
  .form-row, .form-row-3, .dmu-grid, .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .kanban-board { flex-direction: column; }
  .kanban-col { flex: none; }
}

dialog::backdrop {
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
}
dialog {
    margin: auto;
}
