/* ============================================================
   SimpleCRM — Stripe-inspired editorial minimalism
   Pure handwritten CSS. No build step. No FOUC.
   ============================================================ */

/* ── Fonts ─────────────────────────────────────────────────── */
@import url("https://api.fontshare.com/v2/css?f[]=switzer@300,400,500,600,700,800&display=swap");
@import url("https://fonts.googleapis.com/css2?family=IBM+Plex+Mono:wght@400;500;600&display=swap");

/* ── Tokens ────────────────────────────────────────────────── */
:root {
  --font-sans: "Switzer", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;

  --brand-50:  #f3f1ff;
  --brand-100: #ebe5ff;
  --brand-200: #d8ccff;
  --brand-300: #bba9ff;
  --brand-400: #9b80ff;
  --brand-500: #7a5fff;
  --brand-600: #635bff;
  --brand-700: #524bd9;
  --brand-800: #3a358f;
  --brand-900: #221f5c;

  --ink-50:  #f6f9fc;
  --ink-100: #eef2f7;
  --ink-200: #e3e8ef;
  --ink-300: #cdd6e0;
  --ink-400: #8898aa;
  --ink-500: #697386;
  --ink-600: #425466;
  --ink-700: #2a3950;
  --ink-800: #14233b;
  --ink-900: #0a2540;

  --emerald-50: #ecfdf5;
  --emerald-500: #10b981;
  --emerald-600: #059669;
  --emerald-700: #047857;
  --amber-50: #fffbeb;
  --amber-500: #f59e0b;
  --amber-600: #d97706;
  --amber-700: #b45309;
  --red-50:  #fef2f2;
  --red-100: #fee2e2;
  --red-200: #fecaca;
  --red-300: #fca5a5;
  --red-500: #ef4444;
  --red-600: #dc2626;
  --red-700: #b91c1c;

  --shadow-card: 0 1px 2px rgba(10,37,64,0.04), 0 8px 24px -12px rgba(10,37,64,0.10);
  --shadow-pop:  0 8px 30px -8px rgba(10,37,64,0.14), 0 2px 6px rgba(10,37,64,0.06);
  --shadow-brand: 0 6px 20px -6px rgba(99,91,255,0.45), 0 2px 4px rgba(99,91,255,0.20);
  --shadow-modal: 0 30px 80px -20px rgba(10,37,64,0.40), 0 8px 20px -8px rgba(10,37,64,0.16);

  --radius-sm: 6px;
  --radius:    10px;
  --radius-lg: 14px;
  --radius-xl: 18px;
}

/* ── Reset & base ──────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--font-sans);
  font-feature-settings: "ss01", "cv11";
  font-size: 14px;
  line-height: 1.5;
  color: var(--ink-900);
  background: #fff;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  min-height: 100vh;
}
button { font: inherit; color: inherit; cursor: pointer; }
input, select, textarea { font: inherit; color: inherit; }
input::placeholder, textarea::placeholder { color: var(--ink-400); }
a { color: inherit; text-decoration: none; }
svg { display: block; }
.hidden { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); }

/* ── Animations ────────────────────────────────────────────── */
@keyframes fadeUp { from { opacity:0; transform: translateY(10px); } to { opacity:1; transform: translateY(0); } }
@keyframes overlayIn { from { opacity:0; } to { opacity:1; } }
@keyframes modalIn {
  from { opacity:0; transform: scale(0.96) translateY(8px); }
  to   { opacity:1; transform: scale(1) translateY(0); }
}
@keyframes meshFlow {
  0%, 100% { transform: translate(0,0) scale(1); }
  33% { transform: translate(40px,-30px) scale(1.08); }
  66% { transform: translate(-25px,30px) scale(0.95); }
}
@keyframes pulseDot {
  0%,100% { box-shadow: 0 0 0 0 rgba(16,185,129,0.55); }
  50%     { box-shadow: 0 0 0 6px rgba(16,185,129,0); }
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ============================================================
   APP SHELL
   ============================================================ */
.app-shell {
  display: flex;
  flex-direction: row;
  height: 100vh;
  width: 100vw;
  overflow: hidden;
  background: var(--ink-50);
}

/* ── Sidebar ───────────────────────────────────────────────── */
.sidebar {
  display: flex;
  flex-direction: column;
  width: 256px;
  flex-shrink: 0;
  background: #fff;
  border-right: 1px solid var(--ink-200);
  overflow-y: auto;
}
.sidebar-logo {
  padding: 20px 20px 18px;
  border-bottom: 1px solid var(--ink-100);
}
.brand, .brand-name {
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -0.012em;
  color: var(--ink-900);
}
.industry, .industry-name {
  display: block;
  margin-top: 12px;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: var(--ink-400);
}
.user-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 12px;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--ink-50);
  border: 1px solid var(--ink-200);
  font-size: 11px;
  font-weight: 500;
  color: var(--ink-600);
}
.user-pill svg { color: var(--ink-500); }

.nav-section {
  padding: 16px 20px 6px;
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: var(--ink-400);
}
.nav-item {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 0 10px;
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 13.5px;
  font-weight: 500;
  color: var(--ink-600);
  cursor: pointer;
  user-select: none;
  transition: background-color .15s ease, color .15s ease;
}
.nav-item:hover { background: var(--ink-50); color: var(--ink-900); }
.nav-item.active { background: var(--brand-50); color: var(--brand-700); }
.nav-item.active::before {
  content: '';
  position: absolute;
  left: -2.5px; top: 50%; transform: translateY(-50%);
  width: 3px; height: 16px;
  background: var(--brand-600);
  border-radius: 0 2px 2px 0;
}
.nav-icon { width: 16px; height: 16px; flex-shrink: 0; opacity: .75; }
.nav-item.active .nav-icon { opacity: 1; color: var(--brand-600); }

.sidebar-footer {
  margin-top: auto;
  padding: 16px;
  border-top: 1px solid var(--ink-100);
}
.logout-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 0;
  font-size: 14px;
  font-weight: 500;
  color: var(--ink-500);
  background: transparent;
  border: 0;
  transition: color .15s ease;
}
.logout-btn:hover { color: var(--red-600); }

/* ── Main column ───────────────────────────────────────────── */
.main {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  overflow: hidden;
  background: var(--ink-50);
}
.topbar {
  display: flex;
  align-items: center;
  gap: 12px;
  height: 64px;
  padding: 0 28px;
  background: #fff;
  border-bottom: 1px solid var(--ink-100);
  flex-shrink: 0;
}
.topbar h1 {
  flex: 1;
  font-size: 17px;
  font-weight: 600;
  letter-spacing: -0.012em;
  color: var(--ink-900);
}
.search-wrap { position: relative; }
.search-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  width: 16px; height: 16px;
  color: var(--ink-400);
  pointer-events: none;
}
.search-input {
  width: 240px;
  padding: 8px 12px 8px 36px;
  border-radius: 8px;
  border: 1px solid var(--ink-200);
  background: var(--ink-50);
  font-size: 14px;
  color: var(--ink-900);
  transition: background-color .15s, border-color .15s, box-shadow .15s;
}
.search-input:focus {
  outline: none;
  background: #fff;
  border-color: var(--brand-400);
  box-shadow: 0 0 0 4px var(--brand-100);
}

.content {
  flex: 1;
  overflow-y: auto;
  padding: 28px;
}

.panel { display: none; }
.panel.active {
  display: block;
  animation: fadeUp .4s ease both;
}

/* ── Cards ─────────────────────────────────────────────────── */
.card {
  border-radius: 16px;
  border: 1px solid var(--ink-100);
  background: #fff;
  padding: 24px;
  margin-bottom: 20px;
  box-shadow: var(--shadow-card);
}
.card-title {
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.005em;
  color: var(--ink-900);
  margin-bottom: 16px;
}
.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--ink-100);
}
.card-header .card-title { margin-bottom: 0; }

/* ── Stat cards ────────────────────────────────────────────── */
.stats-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
  margin-bottom: 20px;
}
@media (min-width: 640px)  { .stats-grid { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1280px) { .stats-grid { grid-template-columns: repeat(4, 1fr); } }

.stat-card {
  position: relative;
  border-radius: 16px;
  border: 1px solid var(--ink-100);
  background: #fff;
  padding: 20px;
  box-shadow: var(--shadow-card);
  transition: box-shadow .2s ease;
}
.stat-card:hover { box-shadow: var(--shadow-pop); }
.stat-card::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  background: radial-gradient(circle at 100% 0%, rgba(99,91,255,0.04), transparent 50%);
}
.stat-label {
  font-size: 10.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--ink-500);
  margin-bottom: 8px;
}
.stat-value {
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1;
  color: var(--ink-900);
  font-variant-numeric: tabular-nums;
}
.stat-value.blue  { color: var(--brand-600); }
.stat-value.green { color: var(--emerald-600); }
.stat-value.amber { color: var(--amber-600); }
.stat-value.red   { color: var(--red-600); }

/* ── Buttons ───────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: 8px;
  border: 1px solid var(--ink-200);
  background: #fff;
  font-family: var(--font-sans);
  font-size: 14px;
  font-weight: 600;
  letter-spacing: -0.005em;
  color: var(--ink-900);
  transition: transform .12s ease, background-color .15s, border-color .15s, box-shadow .15s, opacity .15s;
}
.btn:hover { background: var(--ink-50); border-color: var(--ink-300); transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn:focus-visible { outline: none; border-color: var(--brand-400); box-shadow: 0 0 0 4px var(--brand-100); }
.btn:disabled { opacity: .6; cursor: wait; }
.btn-icon-svg { width: 16px; height: 16px; }

.btn-sm  { padding: 6px 12px; font-size: 12.5px; }
.btn-full { width: 100%; }

.btn-primary {
  border-color: transparent;
  color: #fff;
  background-image: linear-gradient(180deg, var(--brand-500) 0%, var(--brand-600) 100%);
  box-shadow: var(--shadow-brand);
}
.btn-primary:hover {
  border-color: transparent;
  background-image: linear-gradient(180deg, var(--brand-500) 0%, var(--brand-700) 100%);
  box-shadow: 0 10px 28px -6px rgba(99,91,255,0.55);
  opacity: .98;
}

.btn-danger {
  border-color: var(--red-200);
  color: var(--red-600);
  background: #fff;
}
.btn-danger:hover { background: var(--red-50); border-color: var(--red-300); color: var(--red-700); }

.btn-spinner {
  display: inline-block;
  width: 12px; height: 12px;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 999px;
  animation: spin .7s linear infinite;
}
.btn-loading-inner { display: inline-flex; align-items: center; gap: 8px; }
.btn.is-loading, .logout-btn.is-loading { pointer-events: none; }

/* ── Tables ────────────────────────────────────────────────── */
.table-wrap, .users-table-wrap {
  border-radius: 16px;
  border: 1px solid var(--ink-100);
  background: #fff;
  overflow: hidden;
  box-shadow: var(--shadow-card);
}
.users-table-wrap {
  border-radius: 12px;
  box-shadow: none;
}
.table-wrap table, .users-table-wrap table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}
.table-wrap th, .users-table-wrap th {
  padding: 12px 20px;
  text-align: left;
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--ink-500);
  background: rgba(246,249,252,0.7);
  border-bottom: 1px solid var(--ink-100);
  white-space: nowrap;
}
.table-wrap td, .users-table-wrap td {
  padding: 14px 20px;
  border-bottom: 1px solid var(--ink-100);
  color: var(--ink-900);
  font-size: 14px;
  vertical-align: middle;
}
.table-wrap tbody tr, .users-table-wrap tbody tr {
  cursor: pointer;
  transition: background-color .12s ease;
}
.table-wrap tbody tr:hover td, .users-table-wrap tbody tr:hover td { background: rgba(246,249,252,0.6); }
.table-wrap tbody tr:last-child td, .users-table-wrap tbody tr:last-child td { border-bottom: 0; }
.table-wrap td:first-child { font-weight: 600; color: var(--ink-900); }

/* ── Badges ────────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 2px 10px;
  border-radius: 999px;
  font-family: var(--font-sans);
  font-size: 11px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.badge::before {
  content: '';
  width: 5px; height: 5px;
  border-radius: 50%;
  background: currentColor;
  opacity: .9;
}
.badge-blue   { background: var(--brand-50);   color: var(--brand-700); }
.badge-green  { background: var(--emerald-50); color: var(--emerald-700); }
.badge-amber  { background: var(--amber-50);   color: var(--amber-700); }
.badge-red    { background: var(--red-50);     color: var(--red-700); }
.badge-gray   { background: var(--ink-100);    color: var(--ink-700); }

/* ── Avatars ───────────────────────────────────────────────── */
.avatar, .avatar-lg {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  font-weight: 700;
  color: #fff;
  background-image: linear-gradient(135deg, var(--brand-500), var(--brand-700));
}
.avatar { width: 32px; height: 32px; font-size: 11px; }
.avatar-lg { width: 64px; height: 64px; font-size: 20px; box-shadow: 0 8px 24px -8px rgba(99,91,255,0.4); }

/* ── Forms ─────────────────────────────────────────────────── */
.form-row { margin-bottom: 16px; }
.form-row label {
  display: block;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--ink-700);
  margin-bottom: 6px;
}
.form-row input,
.form-row select,
.form-row textarea {
  width: 100%;
  padding: 10px 14px;
  border-radius: 8px;
  border: 1px solid var(--ink-200);
  background: #fff;
  font-family: var(--font-sans);
  font-size: 14px;
  color: var(--ink-900);
  transition: border-color .15s, box-shadow .15s;
}
.form-row input:focus,
.form-row select:focus,
.form-row textarea:focus {
  outline: none;
  border-color: var(--brand-400);
  box-shadow: 0 0 0 4px var(--brand-100);
}
.form-row textarea { min-height: 88px; resize: vertical; line-height: 1.55; }
.form-row select {
  appearance: none;
  -webkit-appearance: none;
  padding-right: 36px;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12' fill='none' stroke='%23425466' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'><polyline points='3,4.5 6,7.5 9,4.5'/></svg>");
  background-repeat: no-repeat;
  background-position: right 12px center;
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
}
@media (min-width: 640px) { .form-grid { grid-template-columns: repeat(2, 1fr); } }

.form-hint {
  font-size: 12px;
  color: var(--ink-500);
  margin-top: 6px;
  line-height: 1.55;
}

/* ── Pipeline (Kanban) ─────────────────────────────────────── */
.pipeline-board {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(240px, 1fr);
  gap: 16px;
  overflow-x: auto;
  padding-bottom: 8px;
  scroll-padding-inline: 8px;
}
.pipeline-col {
  border-radius: 16px;
  border: 1px solid var(--ink-100);
  background: rgba(255,255,255,0.7);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  padding: 16px;
  min-height: 200px;
  min-width: 220px;
  transition: background-color .15s, border-color .15s, box-shadow .15s;
}
.pipeline-col.drag-over {
  background: var(--brand-50);
  border-color: var(--brand-300);
  box-shadow: inset 0 0 0 2px var(--brand-500);
}
.pipeline-col-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 12px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--ink-100);
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-900);
}
.pipeline-col-header span {
  border-radius: 999px;
  background: var(--ink-100);
  padding: 1px 8px;
  font-size: 10.5px;
  font-weight: 600;
  color: var(--ink-600);
  font-variant-numeric: tabular-nums;
}
.pipeline-col-total {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--ink-100);
  text-align: right;
  font-size: 11px;
  font-weight: 600;
  color: var(--brand-600);
  font-variant-numeric: tabular-nums;
}

.deal-card {
  border-radius: 12px;
  border: 1px solid var(--ink-100);
  background: #fff;
  padding: 12px;
  margin-bottom: 10px;
  cursor: pointer;
  transition: border-color .15s, transform .15s, box-shadow .15s;
  box-shadow: 0 1px 2px rgba(10,37,64,0.04);
}
.deal-card:hover {
  border-color: var(--brand-300);
  transform: translateY(-2px);
  box-shadow: 0 6px 16px -8px rgba(99,91,255,0.30), 0 2px 4px rgba(10,37,64,0.04);
}
.deal-card.dragging {
  opacity: .5;
  transform: rotate(-2deg);
  box-shadow: 0 18px 36px -10px rgba(10,37,64,0.30);
}
.deal-name {
  font-size: 13px;
  font-weight: 600;
  letter-spacing: -0.005em;
  color: var(--ink-900);
  margin-bottom: 4px;
}
.deal-meta { font-size: 11px; color: var(--ink-500); }
.deal-value {
  margin-top: 8px;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--brand-600);
  font-variant-numeric: tabular-nums;
}

/* ── Tasks ─────────────────────────────────────────────────── */
.task-row {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--ink-100);
}
.task-row:last-child { border-bottom: 0; }
.task-cb {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 20px; height: 20px;
  border-radius: 6px;
  border: 2px solid var(--ink-300);
  background: #fff;
  margin-top: 2px;
  cursor: pointer;
  transition: border-color .15s, background-color .15s;
}
.task-cb:hover { border-color: var(--brand-500); }
.task-cb.done { background: var(--brand-600); border-color: var(--brand-600); }
.task-cb.done::after {
  content: '';
  position: absolute;
  inset: 0;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='white' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'><polyline points='3.5,8 6.5,11 12.5,5'/></svg>");
  background-repeat: no-repeat;
  background-position: center;
  background-size: 76%;
}
.task-text { flex: 1; font-size: 14px; font-weight: 500; color: var(--ink-900); }
.task-text.done { color: var(--ink-400); text-decoration: line-through; text-decoration-color: var(--ink-300); }
.task-contact { margin-top: 2px; font-size: 11px; color: var(--ink-500); }
.task-due {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  color: var(--ink-600);
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.02em;
  white-space: nowrap;
  padding-top: 2px;
}
.task-due.overdue {
  color: var(--red-600);
  background: var(--red-50);
  padding: 2px 8px;
  border-radius: 999px;
}

#task-filter {
  padding: 6px 30px 6px 12px;
  border-radius: 8px;
  border: 1px solid var(--ink-200);
  background: #fff;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12' fill='none' stroke='%23425466' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'><polyline points='3,4.5 6,7.5 9,4.5'/></svg>");
  background-repeat: no-repeat;
  background-position: right 10px center;
  font-family: var(--font-sans);
  font-size: 13.5px;
  color: var(--ink-900);
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  transition: border-color .15s, box-shadow .15s;
}
#task-filter:focus { outline: none; border-color: var(--brand-400); box-shadow: 0 0 0 4px var(--brand-100); }

/* ── Activity feed ─────────────────────────────────────────── */
.activity-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--ink-100);
}
.activity-item:last-child { border-bottom: 0; }
.activity-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--brand-500);
  margin-top: 6px;
  flex-shrink: 0;
  box-shadow: 0 0 0 3px var(--brand-50);
}
.activity-dot.green { background: var(--emerald-500); box-shadow: 0 0 0 3px rgba(16,185,129,0.18); }
.activity-dot.amber { background: var(--amber-500);   box-shadow: 0 0 0 3px rgba(245,158,11,0.16); }
.activity-dot.red   { background: var(--red-500);     box-shadow: 0 0 0 3px rgba(239,68,68,0.18); }
.activity-text { flex: 1; font-size: 14px; color: var(--ink-900); line-height: 1.45; }
.activity-time {
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-weight: 500;
  color: var(--ink-400);
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.04em;
  white-space: nowrap;
}

.empty {
  text-align: center;
  padding: 48px 0;
  color: var(--ink-400);
  font-size: 14px;
  font-style: italic;
}

/* ── Contact detail ────────────────────────────────────────── */
.dashboard-cols {
  display: grid;
  grid-template-columns: 1fr;
  gap: 20px;
}
@media (min-width: 1024px) { .dashboard-cols { grid-template-columns: repeat(2, 1fr); } }

.contact-detail { display: none; }
.contact-detail.open { display: block; animation: fadeUp .35s ease both; }

.back-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 16px;
  padding: 0;
  background: transparent;
  border: 0;
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 600;
  color: var(--brand-600);
  transition: color .15s;
}
.back-btn:hover { color: var(--brand-700); }

.contact-header {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 24px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--ink-100);
}
.contact-header-info { flex: 1; }
.contact-header-info .cn {
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -0.012em;
  color: var(--ink-900);
}
.contact-header-info .cc { margin-top: 4px; font-size: 14px; color: var(--ink-500); }

.detail-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 20px 24px;
  margin-bottom: 24px;
}
@media (min-width: 640px) { .detail-grid { grid-template-columns: repeat(2, 1fr); } }

.detail-field label {
  display: block;
  margin-bottom: 6px;
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--ink-500);
}
.detail-field span { font-size: 14px; font-weight: 500; color: var(--ink-900); }
.notes-box {
  border-radius: 12px;
  background: var(--ink-50);
  border: 1px solid var(--ink-100);
  padding: 16px;
  font-size: 14px;
  color: var(--ink-700);
  min-height: 60px;
  line-height: 1.55;
}

/* ── Admin ─────────────────────────────────────────────────── */
.admin-section {
  margin-bottom: 32px;
  padding-bottom: 32px;
  border-bottom: 1px solid var(--ink-100);
}
.admin-section:last-child { margin-bottom: 0; padding-bottom: 0; border-bottom: 0; }
.admin-section-title {
  font-size: 16px;
  font-weight: 600;
  letter-spacing: -0.005em;
  color: var(--ink-900);
  margin-bottom: 4px;
}
.admin-section > p {
  font-size: 13px;
  color: var(--ink-500);
  margin-bottom: 16px;
  line-height: 1.55;
}

.tag-list { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.tag {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 4px 12px;
  border-radius: 999px;
  background: #fff;
  border: 1px solid var(--ink-200);
  font-size: 12px;
  font-weight: 500;
  color: var(--ink-700);
  transition: border-color .15s;
}
.tag:hover { border-color: var(--ink-300); }
.tag-remove {
  background: transparent;
  border: 0;
  padding: 0;
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1;
  color: var(--ink-400);
  cursor: pointer;
  transition: color .15s;
}
.tag-remove:hover { color: var(--red-500); }
.tag-input-row { display: flex; gap: 8px; margin-top: 12px; }
.tag-input-row input {
  flex: 1;
  padding: 8px 12px;
  border-radius: 8px;
  border: 1px solid var(--ink-200);
  background: #fff;
  font-family: var(--font-sans);
  font-size: 14px;
  color: var(--ink-900);
  transition: border-color .15s, box-shadow .15s;
}
.tag-input-row input:focus { outline: none; border-color: var(--brand-400); box-shadow: 0 0 0 4px var(--brand-100); }

/* ── Modal ─────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(10,37,64,0.55);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}
.modal-overlay.open { display: flex; animation: overlayIn .18s ease-out both; }
.modal {
  position: relative;
  width: 100%;
  max-width: 520px;
  max-height: 90vh;
  overflow-y: auto;
  border-radius: 16px;
  border: 1px solid var(--ink-100);
  background: #fff;
  padding: 28px;
  box-shadow: var(--shadow-modal);
  animation: modalIn .22s cubic-bezier(0.2, 0.8, 0.3, 1) both;
}
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 16px;
  margin-bottom: 20px;
  border-bottom: 1px solid var(--ink-100);
}
.modal-header h2 {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.014em;
  color: var(--ink-900);
}
.modal-close {
  width: 32px; height: 32px;
  border: 0;
  background: transparent;
  border-radius: 6px;
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1;
  color: var(--ink-400);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background-color .15s, color .15s;
}
.modal-close:hover { background: var(--ink-100); color: var(--ink-700); }
.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding-top: 16px;
  margin-top: 8px;
  border-top: 1px solid var(--ink-100);
}

/* ── Toast ─────────────────────────────────────────────────── */
.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 999;
  max-width: 384px;
  padding: 12px 16px;
  border-radius: 12px;
  border: 1px solid var(--ink-700);
  background: var(--ink-900);
  font-size: 14px;
  font-weight: 500;
  color: #fff;
  box-shadow: 0 18px 40px -12px rgba(10,37,64,0.50);
  opacity: 0;
  transform: translateY(8px);
  pointer-events: none;
  transition: opacity .22s ease, transform .22s ease;
}
.toast.show { opacity: 1; transform: translateY(0); }
.toast::before {
  content: '';
  position: absolute;
  left: 0; top: 8px; bottom: 8px;
  width: 3px;
  background: var(--brand-500);
  border-radius: 0 3px 3px 0;
}

/* ── Login error ───────────────────────────────────────────── */
.login-error {
  display: none;
  padding: 12px 16px;
  border-radius: 8px;
  border: 1px solid var(--red-200);
  background: var(--red-50);
  font-size: 14px;
  font-weight: 500;
  color: var(--red-700);
  margin-bottom: 16px;
}

/* ============================================================
   LOGIN / REGISTER PAGES
   ============================================================ */
.login-page {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  overflow: hidden;
  background: #fff;
}
.login-page.scrollable { overflow-y: auto; padding: 40px 0; }
.login-bg {
  position: absolute;
  inset: 0;
  z-index: -1;
  overflow: hidden;
  background: #fff;
}
.mesh-blob {
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  opacity: .5;
  pointer-events: none;
  animation: meshFlow 22s ease-in-out infinite;
  will-change: transform;
}
.mesh-blob.b1 { width: 520px; height: 520px; background: var(--brand-300); top: -128px; right: -96px; }
.mesh-blob.b2 { width: 420px; height: 420px; background: #a5f3fc; top: 33%; left: -128px; animation-delay: -7s; }
.mesh-blob.b3 { width: 460px; height: 460px; background: #fbcfe8; bottom: -96px; right: 25%; animation-delay: -14s; }
.mesh-blob.b4 { width: 300px; height: 300px; background: #fde68a; top: 40px; left: 33%; opacity: .3; animation-delay: -3s; }
.login-dotgrid {
  position: absolute;
  inset: 0;
  opacity: 0.35;
  background-image: radial-gradient(rgba(10,37,64,0.10) 1px, transparent 1px);
  background-size: 24px 24px;
}
.login-veil {
  position: absolute;
  inset: 0;
  background: linear-gradient(to bottom, rgba(255,255,255,0.4), rgba(255,255,255,0.1) 50%, rgba(255,255,255,0.8));
}

.login-shell {
  position: relative;
  z-index: 10;
  width: 100%;
  max-width: 448px;
  padding: 0 24px;
  animation: fadeUp .6s ease both;
}
.login-brand {
  text-align: center;
  margin-bottom: 28px;
}
.login-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 48px; height: 48px;
  border-radius: 14px;
  margin-bottom: 20px;
  background-image: linear-gradient(135deg, #7a5fff 0%, #635bff 100%);
  box-shadow: var(--shadow-brand);
}
.login-mark svg { width: 24px; height: 24px; color: #fff; }
.login-logo {
  display: block;
  width: 100%;
  max-width: 280px;
  height: auto;
  margin: 0 auto 14px;
}
.sidebar-icon {
  width: 32px; height: 32px;
  flex-shrink: 0;
  border-radius: 6px;
}
.login-name {
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--ink-900);
}
.login-tag { margin-top: 6px; font-size: 14px; color: var(--ink-500); }

.login-card {
  position: relative;
  border-radius: 16px;
  border: 1px solid var(--ink-100);
  background: rgba(255,255,255,0.82);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  padding: 28px;
  box-shadow: 0 30px 80px -20px rgba(10,37,64,0.18), 0 8px 20px -8px rgba(10,37,64,0.08);
}
.login-title {
  font-size: 20px;
  font-weight: 600;
  letter-spacing: -0.012em;
  color: var(--ink-900);
  margin-bottom: 6px;
}
.login-sub { font-size: 14px; color: var(--ink-500); margin-bottom: 24px; }
.login-divider {
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid var(--ink-100);
  text-align: center;
  font-size: 14px;
  color: var(--ink-500);
}
.login-divider a {
  font-weight: 600;
  color: var(--brand-600);
  transition: color .15s;
}
.login-divider a:hover { color: var(--brand-700); }

.login-trust {
  margin-top: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: 11px;
  font-weight: 500;
  color: var(--ink-400);
}
.login-trust .dot {
  display: inline-flex;
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--emerald-500);
  animation: pulseDot 2.4s ease-in-out infinite;
}

/* Slug preview on register */
.slug-preview {
  margin-top: 6px;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--ink-500);
  letter-spacing: 0.02em;
  min-height: 16px;
}
.slug-preview:not(:empty)::before { content: '→ '; color: var(--brand-600); }

/* ============================================================
   UTILITY CLASSES
   ── Used inline in markup. Small surface area, no Tailwind.
   ============================================================ */
.flex     { display: flex; }
.inline-flex { display: inline-flex; }
.grid     { display: grid; }
.block    { display: block; }
.relative { position: relative; }
.absolute { position: absolute; }
.fixed    { position: fixed; }

.flex-col   { flex-direction: column; }
.flex-wrap  { flex-wrap: wrap; }
.flex-1     { flex: 1; }
.flex-shrink-0 { flex-shrink: 0; }

.items-center  { align-items: center; }
.items-start   { align-items: flex-start; }
.items-end     { align-items: flex-end; }
.items-baseline{ align-items: baseline; }
.justify-center  { justify-content: center; }
.justify-between { justify-content: space-between; }

.gap-1   { gap: 4px; }
.gap-1\.5{ gap: 6px; }
.gap-2   { gap: 8px; }
.gap-2\.5{ gap: 10px; }
.gap-3   { gap: 12px; }
.gap-4   { gap: 16px; }
.gap-5   { gap: 20px; }

.w-full { width: 100%; }
.min-w-0 { min-width: 0; }
.max-w-md { max-width: 448px; }
.max-w-sm { max-width: 384px; }

.size-3\.5 { width: 14px; height: 14px; }
.size-4 { width: 16px; height: 16px; }
.size-5 { width: 20px; height: 20px; }
.size-6 { width: 24px; height: 24px; }
.size-7 { width: 28px; height: 28px; }
.size-8 { width: 32px; height: 32px; }
.size-12 { width: 48px; height: 48px; }
.size-16 { width: 64px; height: 64px; }
.size-40 { width: 160px; height: 160px; }

.text-white   { color: #fff; }
.text-ink-400 { color: var(--ink-400); }
.text-ink-500 { color: var(--ink-500); }
.text-ink-600 { color: var(--ink-600); }
.text-ink-700 { color: var(--ink-700); }
.text-ink-900 { color: var(--ink-900); }
.text-brand-600 { color: var(--brand-600); }
.text-amber-600 { color: var(--amber-600); }
.text-red-600   { color: var(--red-600); }

.bg-white { background-color: #fff; }
.bg-brand-50  { background-color: var(--brand-50); }
.bg-ink-50    { background-color: var(--ink-50); }
.bg-ink-100   { background-color: var(--ink-100); }
.bg-amber-50  { background-color: var(--amber-50); }
.bg-red-50    { background-color: var(--red-50); }

.text-xs   { font-size: 12px; }
.text-sm   { font-size: 14px; }
.text-base { font-size: 16px; }
.text-xl   { font-size: 20px; }
.text-2xl  { font-size: 24px; }
.text-\[10px\]   { font-size: 10px; }
.text-\[10\.5px\]{ font-size: 10.5px; }
.text-\[11px\]   { font-size: 11px; }
.text-\[12px\]   { font-size: 12px; }
.text-\[12\.5px\]{ font-size: 12.5px; }
.text-\[13\.5px\]{ font-size: 13.5px; }
.text-\[15px\]   { font-size: 15px; }
.text-\[17px\]   { font-size: 17px; }
.text-\[28px\]   { font-size: 28px; }

.text-center { text-align: center; }
.text-left   { text-align: left; }
.text-right  { text-align: right; }

.font-medium   { font-weight: 500; }
.font-semibold { font-weight: 600; }
.font-bold     { font-weight: 700; }
.tracking-tight { letter-spacing: -0.012em; }
.tracking-wide  { letter-spacing: 0.04em; }
.whitespace-nowrap { white-space: nowrap; }
.font-sans { font-family: var(--font-sans); }
.font-mono { font-family: var(--font-mono); }
.antialiased { -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; }

.rounded-md  { border-radius: 6px; }
.rounded-lg  { border-radius: 8px; }
.rounded-xl  { border-radius: 12px; }
.rounded-2xl { border-radius: 16px; }
.rounded-full{ border-radius: 999px; }

.border         { border: 1px solid var(--ink-200); }
.border-ink-100 { border-color: var(--ink-100); }
.border-ink-200 { border-color: var(--ink-200); }

.cursor-pointer { cursor: pointer; }
.select-none    { user-select: none; }
.pointer-events-none { pointer-events: none; }
.overflow-hidden    { overflow: hidden; }
.overflow-y-auto    { overflow-y: auto; }
.overflow-x-auto    { overflow-x: auto; }

.opacity-30  { opacity: .3; }
.opacity-100 { opacity: 1; }

.transition  { transition: all .15s ease; }
.transition-colors { transition: background-color .15s, color .15s, border-color .15s; }

.shadow-lg { box-shadow: 0 10px 30px -8px rgba(10,37,64,0.18); }

.backdrop-blur-xl { backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px); }

/* margins */
.m-0  { margin: 0; }
.mt-0\.5{ margin-top: 2px; }
.mt-1   { margin-top: 4px; }
.mt-1\.5{ margin-top: 6px; }
.mt-2   { margin-top: 8px; }
.mt-3   { margin-top: 12px; }
.mt-4   { margin-top: 16px; }
.mt-5   { margin-top: 20px; }
.mt-6   { margin-top: 24px; }
.mt-auto{ margin-top: auto; }
.mb-0   { margin-bottom: 0; }
.mb-1   { margin-bottom: 4px; }
.mb-1\.5{ margin-bottom: 6px; }
.mb-2   { margin-bottom: 8px; }
.mb-3   { margin-bottom: 12px; }
.mb-4   { margin-bottom: 16px; }
.mb-5   { margin-bottom: 20px; }
.mb-6   { margin-bottom: 24px; }
.mb-7   { margin-bottom: 28px; }
.mb-8   { margin-bottom: 32px; }
.ml-auto{ margin-left: auto; }
.\!mb-0 { margin-bottom: 0 !important; }
.\!mt-5 { margin-top: 20px !important; }

/* paddings */
.p-1   { padding: 4px; }
.p-3   { padding: 12px; }
.p-4   { padding: 16px; }
.p-5   { padding: 20px; }
.p-6   { padding: 24px; }
.p-7   { padding: 28px; }
.px-4  { padding-left: 16px; padding-right: 16px; }
.px-6  { padding-left: 24px; padding-right: 24px; }
.py-12 { padding-top: 48px; padding-bottom: 48px; }
.pt-3  { padding-top: 12px; }
.pt-4  { padding-top: 16px; }
.pt-5  { padding-top: 20px; }
.pb-3  { padding-bottom: 12px; }
.pb-4  { padding-bottom: 16px; }
.pb-5  { padding-bottom: 20px; }

/* misc positional shortcuts used in markup */
.inset-0 { inset: 0; }
.-z-10 { z-index: -10; }
.z-10  { z-index: 10; }
.-right-10 { right: -40px; }
.-top-10  { top: -40px; }

.space-y-3\.5 > * + * { margin-top: 14px; }

/* fade-up animation utility */
.anim-fade-up { animation: fadeUp .6s ease both; }

/* ============================================================
   RESPONSIVE — mobile sidebar becomes bottom tab bar
   ============================================================ */
@media (max-width: 767px) {
  .app-shell { flex-direction: column; }
  .sidebar {
    position: fixed;
    inset: auto 0 0 0;
    top: auto;
    width: 100%;
    height: 64px;
    flex-direction: row;
    align-items: stretch;
    justify-content: space-around;
    padding: 4px;
    border-right: 0;
    border-top: 1px solid var(--ink-100);
    box-shadow: 0 -8px 24px -8px rgba(10,37,64,0.10);
    z-index: 30;
    overflow: hidden;
  }
  .sidebar-logo, .sidebar-footer, .nav-section { display: none; }
  .nav-item {
    flex: 1;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    margin: 0 2px;
    padding: 4px;
    border-radius: 8px;
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
  }
  .nav-item.active::before { display: none; }
  .nav-item.active { background: var(--brand-50); color: var(--brand-700); }
  .nav-icon { width: 20px; height: 20px; opacity: 1; }
  .main { padding-bottom: 64px; }

  .topbar {
    display: grid;
    grid-template-columns: 1fr auto;
    align-items: center;
    column-gap: 8px;
    row-gap: 8px;
    height: auto;
    padding: 12px 16px;
  }
  .topbar h1 { grid-column: 1 / -1; min-width: 0; font-size: 16px; }
  .search-wrap { grid-column: 1 / 2; min-width: 0; }
  .search-input { width: 100%; }
  #add-contact-btn { grid-column: 2 / 3; white-space: nowrap; }

  .content { padding: 16px 16px 20px; }

  .pipeline-board { margin-inline: -16px; padding-inline: 16px; }

  .modal-overlay { align-items: flex-end; }
  .modal {
    max-width: 100%;
    border-radius: 16px 16px 0 0;
    padding: 20px;
    max-height: 92dvh;
  }
  .modal-footer { position: sticky; bottom: 0; background: #fff; flex-wrap: wrap; }
}
