/* FlintLocal design system — matches landing page tokens */
:root {
  --bg-primary: #0a0a0f;
  --bg-secondary: #12121a;
  --bg-card: #1a1a25;
  --bg-card-hover: #1e1e2e;
  --fg-primary: #f0ece4;
  --fg-secondary: #9a9590;
  --fg-muted: #5a5550;
  --accent: #e8652b;
  --accent-glow: #ff7a3d;
  --accent-dim: #c44d1a;
  --spark: #ffb347;
  --border: rgba(240, 236, 228, 0.08);
  --border-accent: rgba(232, 101, 43, 0.3);
  --font-display: 'Space Grotesk', sans-serif;
  --font-body: 'DM Sans', sans-serif;
  --radius: 6px;
  --radius-lg: 12px;
  --shadow: 0 1px 3px rgba(0,0,0,0.4), 0 4px 16px rgba(0,0,0,0.3);
  --shadow-accent: 0 0 20px rgba(232, 101, 43, 0.15);
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
  background: var(--bg-primary);
  color: var(--fg-primary);
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

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

.sidebar {
  width: 220px;
  min-height: 100vh;
  background: var(--bg-secondary);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 0;
  flex-shrink: 0;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}

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

.sidebar-logo a {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--fg-primary);
}

.logo-mark {
  width: 28px;
  height: 28px;
  background: var(--accent);
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 14px;
  color: white;
  flex-shrink: 0;
}

.logo-text {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 15px;
  letter-spacing: -0.3px;
}

.sidebar-nav {
  padding: 12px 10px;
  flex: 1;
}

.nav-section-label {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--fg-muted);
  padding: 8px 10px 4px;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: var(--radius);
  text-decoration: none;
  color: var(--fg-secondary);
  font-size: 14px;
  font-weight: 450;
  transition: all 0.15s ease;
  margin-bottom: 2px;
}

.nav-link svg { flex-shrink: 0; opacity: 0.7; }
.nav-link:hover { background: var(--bg-card); color: var(--fg-primary); }
.nav-link:hover svg { opacity: 1; }
.nav-link.active { background: rgba(232, 101, 43, 0.12); color: var(--accent); }
.nav-link.active svg { opacity: 1; color: var(--accent); }

.sidebar-footer {
  padding: 16px 20px;
  border-top: 1px solid var(--border);
}

.sidebar-footer a {
  display: block;
  font-size: 13px;
  color: var(--fg-muted);
  text-decoration: none;
  transition: color 0.15s;
}

.sidebar-footer a:hover { color: var(--fg-primary); }

/* ── Main content ── */
.main-content {
  flex: 1;
  min-width: 0;
  padding: 32px 36px;
  overflow-y: auto;
}

.page-header {
  margin-bottom: 32px;
}

.page-title {
  font-family: var(--font-display);
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -0.5px;
  color: var(--fg-primary);
}

.page-subtitle {
  font-size: 14px;
  color: var(--fg-secondary);
  margin-top: 4px;
}

/* ── Stat cards ── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 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;
  transition: border-color 0.2s;
}

.stat-card:hover { border-color: var(--border-accent); }

.stat-label {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.8px;
  text-transform: uppercase;
  color: var(--fg-muted);
  margin-bottom: 8px;
}

.stat-value {
  font-family: var(--font-display);
  font-size: 32px;
  font-weight: 700;
  letter-spacing: -1px;
  color: var(--fg-primary);
  line-height: 1;
}

.stat-value.accent { color: var(--accent); }
.stat-value.spark { color: var(--spark); }

.stat-change {
  font-size: 12px;
  color: var(--fg-muted);
  margin-top: 6px;
}

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

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}

.card-title {
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.2px;
  color: var(--fg-primary);
}

/* ── Table ── */
.table-wrap {
  overflow-x: auto;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

thead { background: var(--bg-secondary); }

th {
  padding: 10px 16px;
  text-align: left;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.8px;
  text-transform: uppercase;
  color: var(--fg-muted);
  border-bottom: 1px solid var(--border);
}

td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  color: var(--fg-secondary);
  vertical-align: middle;
}

tr:last-child td { border-bottom: none; }

tbody tr {
  transition: background 0.12s;
}

tbody tr:hover { background: var(--bg-card-hover); }

.lead-name { color: var(--fg-primary); font-weight: 500; }

/* ── Status badges ── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 9px;
  border-radius: 100px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.3px;
}

.badge::before {
  content: '';
  display: block;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: currentColor;
  flex-shrink: 0;
}

.badge-new { background: rgba(255, 179, 71, 0.12); color: var(--spark); }
.badge-contacted { background: rgba(232, 101, 43, 0.12); color: var(--accent-glow); }
.badge-qualified { background: rgba(52, 211, 153, 0.12); color: #34d399; }
.badge-lost { background: rgba(90, 85, 80, 0.2); color: var(--fg-muted); }

/* ── Buttons ── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 8px 16px;
  border-radius: var(--radius);
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  text-decoration: none;
  border: none;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.btn-primary {
  background: var(--accent);
  color: white;
}

.btn-primary:hover {
  background: var(--accent-glow);
  box-shadow: var(--shadow-accent);
  transform: translateY(-1px);
}

.btn-secondary {
  background: transparent;
  color: var(--fg-secondary);
  border: 1px solid var(--border);
}

.btn-secondary:hover {
  background: var(--bg-card-hover);
  color: var(--fg-primary);
  border-color: rgba(240,236,228,0.15);
}

.btn-ghost {
  background: transparent;
  color: var(--fg-muted);
  padding: 4px 10px;
  font-size: 13px;
}

.btn-ghost:hover { color: var(--fg-primary); }

.btn-sm { padding: 5px 11px; font-size: 13px; }

/* ── Forms ── */
.form-group { margin-bottom: 18px; }

label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  color: var(--fg-muted);
  margin-bottom: 6px;
}

input[type="text"],
input[type="email"],
input[type="tel"],
input[type="url"],
textarea,
select {
  width: 100%;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 14px;
  font-family: var(--font-body);
  font-size: 14px;
  color: var(--fg-primary);
  transition: border-color 0.15s;
  appearance: none;
}

input[type="text"]:focus,
input[type="email"]:focus,
input[type="tel"]:focus,
input[type="url"]:focus,
textarea:focus,
select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(232, 101, 43, 0.12);
}

input::placeholder,
textarea::placeholder { color: var(--fg-muted); }
textarea { min-height: 90px; resize: vertical; }

select {
  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='%235a5550' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
  cursor: pointer;
}

.checkbox-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.checkbox-row input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--accent);
  cursor: pointer;
  flex-shrink: 0;
}

.checkbox-row label {
  margin: 0;
  text-transform: none;
  letter-spacing: 0;
  font-size: 14px;
  color: var(--fg-secondary);
  cursor: pointer;
}

/* ── Code snippet ── */
.code-block {
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  font-family: 'SF Mono', 'Fira Code', 'Fira Mono', monospace;
  font-size: 12px;
  color: var(--fg-secondary);
  overflow-x: auto;
  white-space: pre;
  line-height: 1.7;
}

/* ── Chart container ── */
.chart-container {
  height: 200px;
  position: relative;
}

/* ── Pagination ── */
.pagination {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 24px;
  justify-content: center;
}

.pagination a, .pagination span {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: var(--radius);
  font-size: 13px;
  text-decoration: none;
  color: var(--fg-secondary);
  border: 1px solid var(--border);
  transition: all 0.15s;
}

.pagination a:hover { border-color: var(--accent); color: var(--accent); }
.pagination .current { background: var(--accent); color: white; border-color: var(--accent); }
.pagination .disabled { opacity: 0.35; pointer-events: none; }

/* ── Alert ── */
.alert {
  padding: 12px 16px;
  border-radius: var(--radius);
  font-size: 14px;
  margin-bottom: 20px;
  border: 1px solid;
}

.alert-success { background: rgba(52,211,153,0.08); border-color: rgba(52,211,153,0.25); color: #34d399; }
.alert-error { background: rgba(239,68,68,0.08); border-color: rgba(239,68,68,0.25); color: #f87171; }

/* ── Empty state ── */
.empty-state {
  text-align: center;
  padding: 48px 24px;
  color: var(--fg-muted);
}

.empty-state-icon { font-size: 40px; margin-bottom: 12px; opacity: 0.5; }
.empty-state h3 { font-family: var(--font-display); color: var(--fg-secondary); margin-bottom: 6px; }
.empty-state p { font-size: 14px; }

/* ── Tabs ── */
.tabs { display: flex; gap: 4px; margin-bottom: 24px; border-bottom: 1px solid var(--border); }

.tab {
  padding: 8px 16px;
  font-size: 14px;
  font-weight: 500;
  color: var(--fg-muted);
  text-decoration: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  transition: all 0.15s;
}

.tab:hover { color: var(--fg-secondary); }
.tab.active { color: var(--accent); border-bottom-color: var(--accent); }

/* ── Modal ── */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 100;
  backdrop-filter: blur(4px);
}

.modal-backdrop.open { display: flex; }

.modal {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 28px;
  width: 100%;
  max-width: 520px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 24px 80px rgba(0,0,0,0.6);
}

.modal-title {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 20px;
  letter-spacing: -0.3px;
}

.modal-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  margin-top: 24px;
}

/* ── Filters bar ── */
.filters-bar {
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 20px;
}

.filters-bar select { width: auto; min-width: 140px; }
.filters-bar .btn { margin-left: auto; }

/* ── Two-col grid ── */
.two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
}

@media (max-width: 900px) {
  .two-col { grid-template-columns: 1fr; }
  .sidebar { display: none; }
  .main-content { padding: 20px; }
}

/* ── Utility ── */
.text-muted { color: var(--fg-muted); }
.text-accent { color: var(--accent); }
.text-sm { font-size: 13px; }
.mt-2 { margin-top: 8px; }
.mt-4 { margin-top: 16px; }
.mb-4 { margin-bottom: 16px; }
.flex { display: flex; }
.flex-between { display: flex; align-items: center; justify-content: space-between; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 200px; }

/* ── Landing page nav ── */
.landing-nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 40px;
  background: rgba(10, 10, 15, 0.85);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}

.landing-nav .logo {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--fg-primary);
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 18px;
  letter-spacing: -0.3px;
}

.landing-nav .nav-actions { display: flex; gap: 12px; align-items: center; }
