/* ── Stripe Design System — CRM ────────────────────────────────────────────── */

/* ── Reset & base ─────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

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

:root {
  /* Primary */
  --purple:       #533afd;
  --purple-hover: #4434d4;
  --purple-deep:  #2e2b8c;
  --purple-light: #b9b9f9;
  --purple-bg:    rgba(83,58,253,0.05);

  /* Neutrals */
  --heading:      #061b31;
  --label:        #273951;
  --body:         #64748d;
  --bg:           #f6f9fc;
  --surface:      #ffffff;
  --border:       #e5edf5;

  /* Status */
  --success:      #15be53;
  --success-text: #108c3d;
  --danger:       #ea2261;
  --danger-text:  #c41950;
  --warn:         #9b6829;
  --warn-bg:      #fef7e0;

  /* Shadows (Stripe signature blue-tinted) */
  --shadow-sm:    0 1px 3px rgba(50,50,93,0.12), 0 1px 2px rgba(0,0,0,0.06);
  --shadow-md:    0 4px 12px rgba(50,50,93,0.1), 0 2px 4px rgba(0,0,0,0.06);
  --shadow-lg:    0 15px 35px rgba(50,50,93,0.1), 0 5px 15px rgba(0,0,0,0.06);
  --shadow-xl:    0 30px 45px -30px rgba(50,50,93,0.25), 0 18px 36px -18px rgba(0,0,0,0.1);

  /* Brand dark */
  --brand-dark:   #1c1e54;
  --dark-navy:    #0d253d;

  /* Geometry */
  --radius:       6px;
  --radius-sm:    4px;
  --radius-lg:    8px;
  --nav-w:        240px;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-size: 14px;
  font-weight: 400;
  color: var(--heading);
  background: var(--bg);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

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

code {
  font-family: 'SFMono-Regular', 'Consolas', 'Liberation Mono', monospace;
  font-size: 12px;
  background: var(--bg);
  padding: 2px 6px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}

hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 16px 0;
}

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

nav {
  width: var(--nav-w);
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  overflow-y: auto;
  z-index: 100;
}

.nav-logo {
  padding: 20px 20px 16px;
  font-weight: 600;
  font-size: 15px;
  color: var(--heading);
  letter-spacing: -0.3px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 10px;
}
.nav-logo .logo-icon {
  width: 28px;
  height: 28px;
  background: var(--purple);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 14px;
  font-weight: 600;
}

.nav-section {
  padding: 16px 12px 6px;
  font-size: 11px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--body);
}

.nav-links { padding: 8px 12px; flex: 1; }

.nav-links a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  color: var(--label);
  border-radius: var(--radius);
  font-size: 13.5px;
  font-weight: 400;
  transition: all .15s;
  margin-bottom: 2px;
}
.nav-links a .nav-icon {
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  opacity: 0.7;
}
.nav-links a:hover {
  background: var(--bg);
  color: var(--heading);
  text-decoration: none;
}
.nav-links a.active {
  background: var(--purple-bg);
  color: var(--purple);
  font-weight: 500;
}
.nav-links a.active .nav-icon { opacity: 1; }

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

main {
  margin-left: var(--nav-w);
  flex: 1;
  padding: 32px 40px;
  max-width: 1200px;
}

/* ── Page header ──────────────────────────────────────────────────────────── */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
}
.page-title {
  font-size: 22px;
  font-weight: 600;
  color: var(--heading);
  letter-spacing: -0.4px;
}
.page-subtitle {
  font-size: 14px;
  color: var(--body);
  margin-top: 4px;
}

/* ── Buttons ──────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all .15s;
  font-family: inherit;
  line-height: 1;
}
.btn-primary {
  background: var(--purple);
  color: #fff;
  border-color: var(--purple);
  box-shadow: 0 1px 2px rgba(50,50,93,0.1), 0 1px 1px rgba(0,0,0,0.06);
}
.btn-primary:hover {
  background: var(--purple-hover);
  border-color: var(--purple-hover);
  text-decoration: none;
  color: #fff;
  box-shadow: 0 2px 4px rgba(50,50,93,0.15), 0 1px 2px rgba(0,0,0,0.08);
}
.btn-secondary {
  background: var(--surface);
  color: var(--heading);
  border-color: var(--border);
  box-shadow: 0 1px 2px rgba(50,50,93,0.08), 0 1px 1px rgba(0,0,0,0.04);
}
.btn-secondary:hover {
  background: var(--bg);
  text-decoration: none;
  box-shadow: 0 2px 4px rgba(50,50,93,0.1), 0 1px 2px rgba(0,0,0,0.06);
}
.btn-danger {
  background: #fff;
  color: var(--danger);
  border-color: rgba(234,34,97,0.3);
}
.btn-danger:hover {
  background: rgba(234,34,97,0.05);
  text-decoration: none;
  color: var(--danger-text);
}
.btn-ghost {
  background: transparent;
  color: var(--purple);
  border-color: var(--purple-light);
}
.btn-ghost:hover {
  background: var(--purple-bg);
  text-decoration: none;
}
.btn-sm { padding: 5px 10px; font-size: 13px; }

/* ── Cards ────────────────────────────────────────────────────────────────── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}
.card-body { padding: 20px; }
.card-header {
  padding: 14px 20px;
  border-bottom: 1px solid var(--border);
  font-weight: 600;
  font-size: 13px;
  color: var(--label);
  letter-spacing: 0.01em;
}

/* ── Tables ───────────────────────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th {
  text-align: left;
  padding: 10px 16px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--body);
  border-bottom: 1px solid var(--border);
  background: var(--bg);
}
td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
  font-size: 14px;
  color: var(--heading);
}
tr:last-child td { border-bottom: none; }
tr:hover td { background: rgba(83,58,253,0.02); }
td.muted, td .muted { color: var(--body); }

/* ── Forms ────────────────────────────────────────────────────────────────── */
.form-group { margin-bottom: 16px; }
label {
  display: block;
  font-weight: 500;
  margin-bottom: 6px;
  font-size: 13px;
  color: var(--label);
}
input[type=text], input[type=email], input[type=password], input[type=number],
input[type=search], select, textarea {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-family: inherit;
  background: var(--surface);
  color: var(--heading);
  transition: border-color .15s, box-shadow .15s;
  box-shadow: 0 1px 2px rgba(50,50,93,0.06);
}
input::placeholder, textarea::placeholder {
  color: var(--body);
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--purple);
  box-shadow: 0 0 0 3px rgba(83,58,253,0.12), 0 1px 2px rgba(50,50,93,0.06);
}
textarea { resize: vertical; min-height: 120px; }
.form-hint { font-size: 12px; color: var(--body); margin-top: 4px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }

input[type=checkbox] {
  accent-color: var(--purple);
  width: 16px;
  height: 16px;
}

/* ── Badges ───────────────────────────────────────────────────────────────── */
.badge {
  display: inline-block;
  padding: 1px 8px;
  border-radius: var(--radius-sm);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.01em;
}
.badge-green {
  background: rgba(21,190,83,0.15);
  color: var(--success-text);
  border: 1px solid rgba(21,190,83,0.3);
}
.badge-red {
  background: rgba(234,34,97,0.1);
  color: var(--danger-text);
  border: 1px solid rgba(234,34,97,0.2);
}
.badge-yellow {
  background: var(--warn-bg);
  color: var(--warn);
  border: 1px solid rgba(155,104,41,0.2);
}
.badge-gray {
  background: var(--bg);
  color: var(--body);
  border: 1px solid var(--border);
}
.badge-blue {
  background: rgba(83,58,253,0.08);
  color: var(--purple);
  border: 1px solid rgba(83,58,253,0.15);
}

/* ── Tag pills ────────────────────────────────────────────────────────────── */
.tag {
  display: inline-block;
  padding: 2px 8px;
  background: rgba(83,58,253,0.06);
  color: var(--purple);
  border-radius: var(--radius-sm);
  font-size: 11.5px;
  font-weight: 500;
  margin: 2px;
  border: 1px solid rgba(83,58,253,0.12);
}

/* ── Alerts ───────────────────────────────────────────────────────────────── */
.alert {
  padding: 10px 16px;
  border-radius: var(--radius-sm);
  margin-bottom: 16px;
  font-size: 13.5px;
  font-weight: 400;
}
.alert-error {
  background: rgba(234,34,97,0.06);
  color: var(--danger-text);
  border: 1px solid rgba(234,34,97,0.15);
}
.alert-success {
  background: rgba(21,190,83,0.08);
  color: var(--success-text);
  border: 1px solid rgba(21,190,83,0.2);
}
.alert-warn {
  background: var(--warn-bg);
  color: var(--warn);
  border: 1px solid rgba(155,104,41,0.2);
}

/* ── Search bar ───────────────────────────────────────────────────────────── */
.search-bar {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
}
.search-bar input { max-width: 320px; }

/* ── Pagination ───────────────────────────────────────────────────────────── */
.pagination {
  display: flex;
  gap: 4px;
  align-items: center;
  justify-content: center;
  margin-top: 24px;
}
.pagination a, .pagination span {
  padding: 6px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 400;
  color: var(--label);
  transition: all .15s;
}
.pagination a:hover {
  border-color: var(--purple-light);
  background: var(--purple-bg);
  text-decoration: none;
  color: var(--purple);
}
.pagination .current {
  background: var(--purple);
  color: #fff;
  border-color: var(--purple);
  font-weight: 500;
}

/* ── Stats grid ───────────────────────────────────────────────────────────── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}
.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow-sm);
}
.stat-value {
  font-size: 28px;
  font-weight: 600;
  color: var(--heading);
  letter-spacing: -0.5px;
  font-feature-settings: "tnum";
}
.stat-label {
  font-size: 12px;
  color: var(--body);
  margin-top: 4px;
  font-weight: 400;
}

/* ── Quill editor overrides ───────────────────────────────────────────────── */
.ql-container { font-family: inherit; font-size: 14px; }
.ql-editor { min-height: 320px; line-height: 1.6; color: var(--heading); }
.ql-toolbar {
  border-radius: var(--radius) var(--radius) 0 0 !important;
  border-color: var(--border) !important;
  background: var(--bg);
}
.ql-container {
  border-radius: 0 0 var(--radius) var(--radius) !important;
  border-color: var(--border) !important;
}

/* ── Misc utilities ───────────────────────────────────────────────────────── */
.mt-16 { margin-top: 16px; }
.mt-8  { margin-top: 8px; }
.mb-16 { margin-bottom: 16px; }
.mb-24 { margin-bottom: 24px; }
.flex  { display: flex; }
.gap-8 { gap: 8px; }
.gap-16 { gap: 16px; }
.items-center { align-items: center; }
.text-muted { color: var(--body); }
.text-sm { font-size: 12.5px; }
.text-xs { font-size: 11px; }
.truncate { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 280px; }
.font-mono { font-family: 'SFMono-Regular', 'Consolas', monospace; font-size: 12px; }

/* ── Login page ───────────────────────────────────────────────────────────── */
.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
}
.login-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 40px;
  width: 380px;
  box-shadow: var(--shadow-lg);
}
.login-title {
  font-size: 20px;
  font-weight: 600;
  margin-bottom: 8px;
  text-align: center;
  color: var(--heading);
  letter-spacing: -0.3px;
}
.login-subtitle {
  font-size: 14px;
  color: var(--body);
  text-align: center;
  margin-bottom: 24px;
}
.login-logo {
  width: 48px;
  height: 48px;
  background: var(--purple);
  border-radius: var(--radius-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 22px;
  font-weight: 600;
  margin: 0 auto 20px;
  box-shadow: 0 4px 12px rgba(83,58,253,0.25);
}

/* ── Empty state ──────────────────────────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 48px 24px;
  color: var(--body);
}
.empty-state h3 {
  font-size: 16px;
  font-weight: 500;
  color: var(--heading);
  margin-bottom: 8px;
}
.empty-state p {
  font-size: 14px;
  margin-bottom: 20px;
}

/* ── Responsive ───────────────────────────────────────────────────────────── */
@media (max-width: 768px) {
  nav { display: none; }
  main { margin-left: 0; padding: 20px 16px; }
  .page-title { font-size: 18px; }
  .form-row { grid-template-columns: 1fr; }
}
