/* Devlix Admin Panel - modern admin theme. No external assets. */

:root {
  --bg: #f1f5f9;
  --card-bg: #ffffff;
  --border: #e2e8f0;
  --text: #0f172a;
  --text-soft: #475569;
  --muted: #94a3b8;
  --primary: #4f46e5;
  --primary-hover: #4338ca;
  --primary-soft: #eef2ff;
  --sidebar-bg: #0f172a;
  --sidebar-bg-2: #111c33;
  --sidebar-text: #cbd5e1;
  --sidebar-muted: #64748b;
  --green: #16a34a;
  --green-bg: #dcfce7;
  --amber: #b45309;
  --amber-bg: #fef3c7;
  --grey-bg: #f1f5f9;
  --red: #b91c1c;
  --red-bg: #fee2e2;
  --ok-bg: #dcfce7;
  --ok-text: #166534;
  --radius: 12px;
  --shadow: 0 1px 3px rgba(15, 23, 42, 0.06), 0 1px 2px rgba(15, 23, 42, 0.04);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }

html, body { margin: 0; padding: 0; }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

.muted { color: var(--muted); }
.nowrap { white-space: nowrap; }
h2 { font-size: 16px; margin: 0; }

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

.sidebar {
  width: 248px;
  flex: 0 0 248px;
  background: linear-gradient(180deg, var(--sidebar-bg) 0%, var(--sidebar-bg-2) 100%);
  color: var(--sidebar-text);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
}

.brand-block {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 20px 20px 18px;
  color: #fff;
  border-bottom: 1px solid rgba(148, 163, 184, 0.14);
}
.brand-block:hover { text-decoration: none; }

.brand-mark {
  width: 38px;
  height: 38px;
  flex: 0 0 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--primary);
  border-radius: 10px;
  color: #fff;
}
.brand-mark svg { width: 22px; height: 22px; }
.brand-mark-lg { width: 46px; height: 46px; flex-basis: 46px; border-radius: 12px; }
.brand-mark-lg svg { width: 26px; height: 26px; }

.brand-text { display: flex; flex-direction: column; line-height: 1.2; }
.brand-name { font-size: 17px; font-weight: 700; letter-spacing: 0.2px; }
.brand-sub { font-size: 11px; color: var(--sidebar-muted); text-transform: uppercase; letter-spacing: 1.2px; }

.side-nav { padding: 16px 12px; display: flex; flex-direction: column; gap: 4px; }
.nav-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  color: var(--sidebar-muted);
  padding: 4px 10px 8px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 10px 12px;
  border-radius: 8px;
  color: var(--sidebar-text);
  font-weight: 500;
  font-size: 14px;
  border: 0;
  background: none;
  width: 100%;
  text-align: left;
  cursor: pointer;
  font-family: inherit;
}
.nav-item:hover { background: rgba(148, 163, 184, 0.12); color: #fff; text-decoration: none; }
.nav-item.active { background: var(--primary); color: #fff; }
.nav-icon { width: 19px; height: 19px; flex: 0 0 19px; }

.sidebar-foot { margin-top: auto; padding: 12px; border-top: 1px solid rgba(148, 163, 184, 0.14); }
.logout-form { margin: 0; }
.logout-btn { color: var(--sidebar-text); }
.logout-btn:hover { background: rgba(185, 28, 28, 0.18); color: #fff; }

.main-col { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; }

.topbar {
  background: var(--card-bg);
  border-bottom: 1px solid var(--border);
  padding: 16px 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  position: sticky;
  top: 0;
  z-index: 10;
}
.page-title { font-size: 20px; font-weight: 650; margin: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.admin-chip { display: flex; align-items: center; gap: 10px; flex: 0 0 auto; }
.avatar {
  width: 34px; height: 34px; border-radius: 50%;
  background: var(--primary-soft); color: var(--primary);
  display: inline-flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 14px;
}
.admin-email { color: var(--text-soft); font-size: 13px; font-weight: 500; }

.content { padding: 24px 28px 40px; max-width: 1240px; width: 100%; margin: 0 auto; }
.bare-main { padding: 24px; }

/* ------------------------------------------------------------------ cards */
.card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
}

/* ---------------------------------------------------------------- buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: var(--primary);
  color: #fff;
  border: 1px solid var(--primary);
  border-radius: 8px;
  padding: 9px 16px;
  font-size: 14px;
  font-weight: 550;
  font-family: inherit;
  cursor: pointer;
  line-height: 1.2;
}
.btn:hover { background: var(--primary-hover); border-color: var(--primary-hover); text-decoration: none; }
.btn-secondary {
  background: #fff;
  color: var(--text);
  border: 1px solid var(--border);
}
.btn-secondary:hover { background: var(--bg); border-color: #cbd5e1; }
.btn-sm { padding: 6px 12px; font-size: 13px; }
.btn-block { width: 100%; }
.btn.is-disabled { opacity: 0.45; pointer-events: none; }

.page-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 18px; }

/* ----------------------------------------------------------------- alerts */
.alert { border-radius: 10px; padding: 12px 16px; margin: 0 0 18px; font-size: 14px; border: 1px solid transparent; }
.alert-error { background: var(--red-bg); color: var(--red); border-color: #fecaca; }
.alert-ok { background: var(--ok-bg); color: var(--ok-text); border-color: #bbf7d0; }

/* ------------------------------------------------------------------ stats */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
  margin-bottom: 26px;
}
.stat-card { display: flex; align-items: flex-start; gap: 14px; padding: 18px; }
.stat-icon {
  width: 44px; height: 44px; flex: 0 0 44px;
  border-radius: 11px;
  display: inline-flex; align-items: center; justify-content: center;
}
.stat-icon-svg { width: 22px; height: 22px; }
.accent-indigo { background: #e0e7ff; color: #4f46e5; }
.accent-blue   { background: #dbeafe; color: #2563eb; }
.accent-green  { background: #dcfce7; color: #16a34a; }
.accent-amber  { background: #fef3c7; color: #d97706; }
.accent-teal   { background: #ccfbf1; color: #0d9488; }
.accent-violet { background: #ede9fe; color: #7c3aed; }
.stat-body { min-width: 0; }
.stat-value { font-size: 24px; font-weight: 700; line-height: 1.15; }
.stat-label { color: var(--text-soft); font-size: 13px; font-weight: 550; margin-top: 2px; }
.stat-sub { font-size: 12px; margin-top: 1px; }

.section-head { display: flex; align-items: center; justify-content: space-between; margin: 4px 0 14px; }

/* ----------------------------------------------------------------- tables */
.table-card { padding: 0; overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table thead th {
  text-align: left;
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--text-soft);
  font-weight: 650;
  padding: 13px 16px;
  border-bottom: 1px solid var(--border);
  background: #f8fafc;
  white-space: nowrap;
}
.table tbody td { padding: 12px 16px; border-bottom: 1px solid #eef2f7; vertical-align: middle; }
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr:hover { background: #f8fafc; }
.table-link { font-weight: 600; }
.empty-note { padding: 6px 0; margin: 0; }

/* ------------------------------------------------------------------ pills */
.pill {
  display: inline-flex;
  align-items: center;
  min-width: 34px;
  justify-content: center;
  padding: 2px 9px;
  border-radius: 999px;
  font-size: 12.5px;
  font-weight: 650;
  line-height: 1.5;
}
.pill-green { background: var(--green-bg); color: var(--green); }
.pill-amber { background: var(--amber-bg); color: var(--amber); }
.pill-grey  { background: var(--grey-bg); color: var(--text-soft); }

/* ------------------------------------------------------------------ forms */
.field { display: flex; flex-direction: column; gap: 6px; }
.field > label { font-size: 13px; font-weight: 600; color: var(--text-soft); }
.field input[type="text"],
.field input[type="email"],
.field input[type="password"],
.field input[type="number"],
.field select {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 14px;
  font-family: inherit;
  color: var(--text);
  background: #fff;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.field input:focus, .field select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.15);
}

.check { display: inline-flex; align-items: center; gap: 8px; font-size: 14px; font-weight: 500; color: var(--text-soft); cursor: pointer; }
.check input[type="checkbox"] { width: 16px; height: 16px; accent-color: var(--primary); margin: 0; }

/* Leads filter bar */
.filter-card { margin-bottom: 18px; }
.filter-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 14px;
}
.filter-actions { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; margin-top: 16px; padding-top: 16px; border-top: 1px solid #eef2f7; }
.filter-spacer { flex: 1 1 auto; }

/* New campaign form */
.form-card { margin-bottom: 14px; }
.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 16px;
}
.form-check { margin-top: 18px; }
.form-actions { margin-top: 20px; padding-top: 18px; border-top: 1px solid #eef2f7; }
.form-note { margin: 0; font-size: 13px; }

/* ------------------------------------------------------------------ pager */
.pager { display: flex; align-items: center; gap: 14px; margin-top: 18px; }
.pager-info { color: var(--text-soft); font-size: 13.5px; }
.pager-info-solo { margin-top: 14px; }

/* -------------------------------------------------------------- lead detail */
.back-link-row { margin: 0 0 14px; }
.back-link { font-weight: 550; }
.detail-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: 18px; margin-bottom: 18px; }
.def-card { padding: 22px; }
.def-title { font-size: 15px; font-weight: 650; margin: 0 0 14px; padding-bottom: 12px; border-bottom: 1px solid #eef2f7; }
.def-list { margin: 0; }
.def-row { display: flex; gap: 16px; padding: 8px 0; border-bottom: 1px solid #f4f7fb; }
.def-row:last-child { border-bottom: 0; }
.def-row dt { flex: 0 0 150px; color: var(--text-soft); font-size: 13px; font-weight: 600; }
.def-row dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
.reviews-card { margin-bottom: 18px; }
.reviews { margin: 0; padding-left: 18px; }
.reviews li { margin-bottom: 8px; }
.raw-json { padding: 0; }
.raw-json summary { cursor: pointer; padding: 16px 20px; font-weight: 600; color: var(--text-soft); }
.raw-json pre {
  margin: 0;
  padding: 0 20px 20px;
  font-family: var(--mono);
  font-size: 12.5px;
  overflow-x: auto;
  color: var(--text-soft);
}

/* ------------------------------------------------------------------ login */
.login-body {
  min-height: 100vh;
  background: linear-gradient(135deg, #0f172a 0%, #1e1b4b 55%, #312e81 100%);
}
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px; }
.login-card { width: 100%; max-width: 400px; padding: 32px; border: 0; box-shadow: 0 24px 60px rgba(2, 6, 23, 0.5); }
.login-brand { display: flex; align-items: center; gap: 14px; margin-bottom: 8px; }
.login-title { font-size: 22px; font-weight: 750; line-height: 1.1; }
.login-sub { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: 1.4px; }
.login-hint { margin: 6px 0 18px; }
.login-form { display: flex; flex-direction: column; gap: 16px; }
.login-form .alert { margin: 0; }

/* -------------------------------------------------------------- responsive */
@media (max-width: 860px) {
  .app-shell { flex-direction: column; }
  .sidebar { width: 100%; flex-basis: auto; height: auto; position: static; }
  .side-nav { flex-direction: row; flex-wrap: wrap; align-items: center; }
  .nav-label { display: none; }
  .nav-item { width: auto; }
  .sidebar-foot { margin-top: 0; border-top: 0; padding-top: 0; }
  .content { padding: 18px 16px 32px; }
  .topbar { padding: 14px 16px; }
  .admin-email { display: none; }
}
