/* ============================================================
   Certiflyy CRM — Design System
   ============================================================ */

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

:root {
  --navy: #0a1b2e;
  --navy-mid: #0f2540;
  --navy-light: #162d47;
  --navy-card: rgba(255,255,255,0.04);
  --navy-hover: rgba(255,255,255,0.06);
  --gold: #C9A667;
  --gold-dim: rgba(201,166,103,0.15);
  --gold-bright: #d9b878;
  --text: #F4F6F8;
  --text-muted: #8ba3be;
  --text-dim: #5d7591;
  --border: rgba(201,166,103,0.15);
  --border-strong: rgba(201,166,103,0.3);
  --red: #e05c5c;
  --red-dim: rgba(224,92,92,0.12);
  --green: #4caf82;
  --green-dim: rgba(76,175,130,0.12);
  --amber: #d4a843;
  --amber-dim: rgba(212,168,67,0.12);
  --blue: #5b8fd4;
  --blue-dim: rgba(91,143,212,0.12);
  --purple: #9b6fd4;
  --transition: 0.18s ease;
  --shadow: 0 4px 12px rgba(0,0,0,0.25);
  --shadow-lg: 0 8px 24px rgba(0,0,0,0.4);
}

* { box-sizing: border-box; }
*::-webkit-scrollbar { width: 8px; height: 8px; }
*::-webkit-scrollbar-track { background: rgba(0,0,0,0.2); }
*::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }
*::-webkit-scrollbar-thumb:hover { background: var(--gold-dim); }

html, body { margin: 0; padding: 0; }
body {
  background: var(--navy);
  color: var(--text);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  min-height: 100vh;
}

h1, h2, h3, h4 { margin: 0 0 0.5em; font-weight: 600; line-height: 1.2; color: var(--text); }
h1 { font-size: 24px; }
h2 { font-size: 20px; }
h3 { font-size: 16px; }
h4 { font-size: 14px; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-muted); }
p { margin: 0 0 1em; }
small { font-size: 12px; color: var(--text-muted); }
a { color: var(--gold); text-decoration: none; transition: var(--transition); }
a:hover { color: var(--gold-bright); }

/* ============================================================
   LAYOUT
   ============================================================ */
.crm-layout {
  display: flex;
  min-height: 100vh;
}
.crm-sidebar {
  width: 240px;
  background: var(--navy-mid);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  bottom: 0;
  left: 0;
  z-index: 100;
  transition: transform var(--transition);
}
.crm-main {
  flex: 1;
  margin-left: 240px;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}
.crm-topbar {
  height: 60px;
  background: rgba(15,37,64,0.95);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  position: sticky;
  top: 0;
  z-index: 50;
}
.crm-content {
  padding: 24px;
  flex: 1;
}

/* ============================================================
   SIDEBAR
   ============================================================ */
.sidebar-logo {
  padding: 18px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 18px;
}
.sidebar-logo-mark {
  width: 28px;
  height: 28px;
  background: var(--gold);
  color: var(--navy);
  border-radius: 6px;
  display: grid;
  place-items: center;
  font-weight: 800;
  font-size: 14px;
}
.sidebar-nav {
  flex: 1;
  padding: 12px 0;
  overflow-y: auto;
}
.nav-section-label {
  padding: 12px 20px 6px;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-dim);
  font-weight: 600;
}
.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 20px;
  color: var(--text-muted);
  font-size: 14px;
  font-weight: 500;
  border-left: 3px solid transparent;
  cursor: pointer;
  transition: var(--transition);
}
.nav-item:hover {
  background: var(--navy-hover);
  color: var(--text);
}
.nav-item.active {
  background: var(--gold-dim);
  color: var(--gold);
  border-left-color: var(--gold);
}
.nav-icon {
  width: 18px;
  height: 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
}
.nav-label { flex: 1; }
.nav-badge {
  background: var(--red);
  color: white;
  font-size: 10px;
  padding: 2px 6px;
  border-radius: 10px;
  font-weight: 600;
}
.sidebar-footer {
  padding: 14px 20px;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 10px;
}
.user-avatar {
  width: 34px;
  height: 34px;
  background: var(--gold);
  color: var(--navy);
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: 13px;
}
.user-meta { flex: 1; min-width: 0; }
.user-name { font-weight: 600; font-size: 13px; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-action { font-size: 11px; color: var(--text-muted); cursor: pointer; }
.user-action:hover { color: var(--gold); }

/* ============================================================
   TOPBAR
   ============================================================ */
.topbar-title { font-size: 18px; font-weight: 600; }
.topbar-right { display: flex; align-items: center; gap: 16px; }
.topbar-bell {
  position: relative;
  width: 36px; height: 36px;
  border-radius: 8px;
  background: var(--navy-card);
  border: 1px solid var(--border);
  display: grid;
  place-items: center;
  cursor: pointer;
  color: var(--text-muted);
  transition: var(--transition);
}
.topbar-bell:hover { color: var(--gold); border-color: var(--gold-dim); }
.topbar-bell-dot {
  position: absolute;
  top: 6px; right: 6px;
  width: 8px; height: 8px;
  background: var(--red);
  border-radius: 50%;
  border: 2px solid var(--navy-mid);
}
.hamburger {
  display: none;
  width: 36px; height: 36px;
  border-radius: 8px;
  background: var(--navy-card);
  border: 1px solid var(--border);
  color: var(--text);
  cursor: pointer;
  align-items: center;
  justify-content: center;
  font-size: 18px;
}

/* ============================================================
   CARDS
   ============================================================ */
.card {
  background: var(--navy-card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 20px;
}
.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}
.card-title { font-size: 15px; font-weight: 600; }
.card-section + .card-section { margin-top: 18px; }

.kpi-card {
  background: var(--navy-card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 18px;
  transition: var(--transition);
}
.kpi-card:hover { border-color: var(--border-strong); }
.kpi-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  margin-bottom: 8px;
  font-weight: 600;
}
.kpi-value {
  font-size: 28px;
  font-weight: 700;
  color: var(--gold);
  line-height: 1;
}
.kpi-value-sub { font-size: 16px; color: var(--text); font-weight: 500; }
.kpi-delta {
  margin-top: 6px;
  font-size: 12px;
  color: var(--text-muted);
}
.kpi-delta.positive { color: var(--green); }
.kpi-delta.negative { color: var(--red); }

.grid {
  display: grid;
  gap: 16px;
}
.grid-cols-2 { grid-template-columns: repeat(2, 1fr); }
.grid-cols-3 { grid-template-columns: repeat(3, 1fr); }
.grid-cols-4 { grid-template-columns: repeat(4, 1fr); }
.grid-dash {
  display: grid;
  grid-template-columns: 1fr 1.4fr 1fr;
  gap: 16px;
}

/* ============================================================
   BUTTONS
   ============================================================ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 9px 16px;
  border-radius: 8px;
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  border: 1px solid transparent;
  cursor: pointer;
  transition: var(--transition);
  text-decoration: none;
  white-space: nowrap;
}
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-primary {
  background: var(--gold);
  color: var(--navy);
  border-color: var(--gold);
}
.btn-primary:hover:not(:disabled) { background: var(--gold-bright); border-color: var(--gold-bright); }
.btn-secondary {
  background: transparent;
  color: var(--gold);
  border-color: var(--gold);
}
.btn-secondary:hover:not(:disabled) { background: var(--gold-dim); }
.btn-ghost {
  background: var(--navy-card);
  color: var(--text);
  border-color: var(--border);
}
.btn-ghost:hover:not(:disabled) { background: var(--navy-hover); border-color: var(--border-strong); }
.btn-danger {
  background: var(--red);
  color: white;
  border-color: var(--red);
}
.btn-danger:hover:not(:disabled) { background: #c44848; }
.btn-sm { padding: 6px 10px; font-size: 12px; }
.btn-lg { padding: 12px 22px; font-size: 14px; }
.btn-icon {
  width: 32px;
  height: 32px;
  padding: 0;
  border-radius: 6px;
}
.btn-block { width: 100%; }

/* ============================================================
   BADGES
   ============================================================ */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 9px;
  font-size: 11px;
  font-weight: 600;
  border-radius: 12px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border: 1px solid transparent;
}
.badge-trades { background: rgba(91,143,212,0.15); color: var(--blue); border-color: rgba(91,143,212,0.3); }
.badge-high-street { background: rgba(201,166,103,0.15); color: var(--gold); border-color: rgba(201,166,103,0.3); }
.badge-won { background: var(--green-dim); color: var(--green); border-color: rgba(76,175,130,0.3); }
.badge-lost { background: var(--red-dim); color: var(--red); border-color: rgba(224,92,92,0.3); }
.badge-active { background: var(--gold-dim); color: var(--gold); border-color: var(--border-strong); }
.badge-neutral { background: var(--navy-hover); color: var(--text-muted); border-color: var(--border); }

.stage-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 9px;
  font-size: 11px;
  font-weight: 600;
  border-radius: 4px;
  border: 1px solid;
  background: rgba(0,0,0,0.2);
}

/* ============================================================
   FORMS
   ============================================================ */
.form-group { margin-bottom: 16px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-label {
  display: block;
  margin-bottom: 6px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.form-hint {
  margin-top: 4px;
  font-size: 11px;
  color: var(--text-dim);
}
input[type="text"], input[type="email"], input[type="password"], input[type="tel"],
input[type="number"], input[type="date"], input[type="time"], input[type="datetime-local"],
input[type="url"], input[type="search"], select, textarea {
  width: 100%;
  padding: 10px 12px;
  background: var(--navy);
  border: 1px solid var(--border);
  border-radius: 7px;
  color: var(--text);
  font-family: inherit;
  font-size: 13px;
  transition: var(--transition);
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--gold);
  box-shadow: 0 0 0 3px var(--gold-dim);
}
textarea { resize: vertical; min-height: 80px; }
select {
  appearance: none;
  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'><path fill='%238ba3be' d='M6 9L1 4h10z'/></svg>");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 32px;
}
input[type="checkbox"], input[type="radio"] {
  accent-color: var(--gold);
  cursor: pointer;
}

/* ============================================================
   TABLES
   ============================================================ */
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.data-table thead th {
  text-align: left;
  padding: 10px 12px;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  border-bottom: 2px solid var(--gold-dim);
  font-weight: 600;
  background: rgba(0,0,0,0.15);
}
.data-table tbody td {
  padding: 12px;
  border-bottom: 1px solid var(--border);
}
.data-table tbody tr { transition: var(--transition); }
.data-table tbody tr:hover { background: var(--navy-hover); }
.data-table tbody tr:last-child td { border-bottom: none; }
.table-wrap { overflow-x: auto; }

/* ============================================================
   KANBAN
   ============================================================ */
.kanban-board {
  display: flex;
  gap: 14px;
  overflow-x: auto;
  padding-bottom: 16px;
  min-height: 600px;
}
.kanban-col {
  flex: 0 0 280px;
  background: rgba(0,0,0,0.18);
  border: 1px solid var(--border);
  border-radius: 10px;
  display: flex;
  flex-direction: column;
  max-height: calc(100vh - 180px);
}
.kanban-col-header {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 4px;
  position: sticky;
  top: 0;
  background: rgba(0,0,0,0.18);
  border-radius: 10px 10px 0 0;
}
.kanban-col-header-row { display: flex; align-items: center; justify-content: space-between; }
.kanban-col-name { font-size: 13px; font-weight: 600; }
.kanban-col-count {
  background: var(--navy-card);
  border: 1px solid var(--border);
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 11px;
  color: var(--text-muted);
}
.kanban-col-value { font-size: 11px; color: var(--gold); font-weight: 600; }
.kanban-cards {
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  overflow-y: auto;
  flex: 1;
}
.deal-card {
  background: var(--navy-mid);
  border: 1px solid var(--border);
  border-left: 3px solid var(--gold);
  border-radius: 7px;
  padding: 10px 12px;
  cursor: grab;
  transition: var(--transition);
}
.deal-card:hover { transform: translateY(-1px); border-color: var(--border-strong); box-shadow: var(--shadow); }
.deal-card.dragging { opacity: 0.5; }
.deal-card.fresh { border-left-color: var(--gold); }
.deal-card.warming { border-left-color: var(--amber); }
.deal-card.cold { border-left-color: var(--red); }
.deal-card-name { font-weight: 600; font-size: 13px; margin-bottom: 4px; }
.deal-card-meta { font-size: 11px; color: var(--text-muted); margin-bottom: 6px; }
.deal-card-row { display: flex; align-items: center; justify-content: space-between; gap: 6px; }
.deal-card-stage-days { font-size: 10px; color: var(--text-dim); }
.deal-card-actions { display: flex; gap: 4px; margin-top: 8px; padding-top: 8px; border-top: 1px solid var(--border); }
.deal-card-actions .btn { flex: 1; padding: 4px 6px; font-size: 10px; }
.kanban-col-add {
  margin: 6px 10px 10px;
  padding: 8px;
  background: transparent;
  border: 1px dashed var(--border);
  border-radius: 6px;
  color: var(--text-muted);
  font-size: 12px;
  cursor: pointer;
  text-align: center;
  transition: var(--transition);
}
.kanban-col-add:hover { border-color: var(--gold); color: var(--gold); }
.kanban-col.drop-target { background: var(--gold-dim); }

/* ============================================================
   MODALS
   ============================================================ */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  backdrop-filter: blur(4px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.modal {
  background: var(--navy-mid);
  border: 1px solid var(--border);
  border-radius: 12px;
  width: 100%;
  max-width: 540px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-lg);
}
.modal-lg { max-width: 760px; }
.modal-header {
  padding: 18px 22px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.modal-header h3 { margin: 0; }
.modal-close {
  width: 30px; height: 30px;
  border-radius: 6px;
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 18px;
}
.modal-close:hover { color: var(--text); background: var(--navy-hover); }
.modal-body {
  padding: 20px 22px;
  overflow-y: auto;
}
.modal-footer {
  padding: 16px 22px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

/* ============================================================
   TABS
   ============================================================ */
.tabs {
  display: flex;
  gap: 4px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 18px;
}
.tab-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  padding: 10px 14px;
  font-family: inherit;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: var(--transition);
}
.tab-btn:hover { color: var(--text); }
.tab-btn.active { color: var(--gold); border-bottom-color: var(--gold); }
.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* ============================================================
   TIMELINE (COMMS)
   ============================================================ */
.comms-timeline {
  display: flex;
  flex-direction: column;
  gap: 12px;
  position: relative;
}
.comms-entry {
  display: flex;
  gap: 12px;
  padding: 12px;
  background: var(--navy-card);
  border: 1px solid var(--border);
  border-radius: 8px;
}
.comms-icon {
  width: 32px; height: 32px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 14px;
  flex-shrink: 0;
}
.comms-icon.call { background: var(--blue-dim); color: var(--blue); }
.comms-icon.email { background: var(--gold-dim); color: var(--gold); }
.comms-icon.whatsapp { background: var(--green-dim); color: var(--green); }
.comms-icon.note { background: var(--navy-hover); color: var(--text-muted); }
.comms-icon.walk_in { background: var(--amber-dim); color: var(--amber); }
.comms-body { flex: 1; min-width: 0; }
.comms-head { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; font-size: 12px; }
.comms-date { color: var(--text-dim); }
.comms-notes { font-size: 13px; color: var(--text); white-space: pre-wrap; }

/* ============================================================
   CHECKLIST
   ============================================================ */
.checklist {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.check-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  background: var(--navy-card);
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 13px;
  cursor: pointer;
  transition: var(--transition);
}
.check-item:hover { background: var(--navy-hover); }
.check-item.done { opacity: 0.55; }
.check-item.done .check-label { text-decoration: line-through; }
.check-label { flex: 1; }

/* ============================================================
   ALERTS
   ============================================================ */
.alert {
  padding: 12px 14px;
  border-radius: 8px;
  border: 1px solid;
  font-size: 13px;
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
}
.alert-warning { background: var(--amber-dim); border-color: rgba(212,168,67,0.3); color: var(--amber); }
.alert-danger { background: var(--red-dim); border-color: rgba(224,92,92,0.3); color: var(--red); }
.alert-success { background: var(--green-dim); border-color: rgba(76,175,130,0.3); color: var(--green); }
.alert-info { background: var(--gold-dim); border-color: var(--border-strong); color: var(--gold); }

/* ============================================================
   TOASTS
   ============================================================ */
.toast-container {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.toast {
  min-width: 280px;
  max-width: 380px;
  background: var(--navy-mid);
  border: 1px solid var(--border);
  border-left: 4px solid var(--gold);
  border-radius: 8px;
  padding: 12px 16px;
  font-size: 13px;
  box-shadow: var(--shadow-lg);
  animation: toast-slide 0.25s ease-out;
}
.toast.success { border-left-color: var(--green); }
.toast.error { border-left-color: var(--red); }
.toast.info { border-left-color: var(--blue); }
@keyframes toast-slide {
  from { transform: translateX(110%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}
.toast.removing { animation: toast-out 0.2s ease-in forwards; }
@keyframes toast-out {
  to { transform: translateX(110%); opacity: 0; }
}

/* ============================================================
   CALENDAR
   ============================================================ */
.cal-mini { display: flex; flex-direction: column; }
.cal-mini-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 2px;
}
.cal-day-name { font-size: 10px; color: var(--text-dim); text-align: center; padding: 4px; text-transform: uppercase; }
.cal-day {
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  position: relative;
  border-radius: 6px;
  cursor: pointer;
  font-size: 12px;
  color: var(--text-muted);
  transition: var(--transition);
}
.cal-day:hover { background: var(--navy-hover); color: var(--text); }
.cal-day.today { background: var(--gold-dim); color: var(--gold); font-weight: 700; }
.cal-day.selected { background: var(--gold); color: var(--navy); font-weight: 700; }
.cal-day.other-month { opacity: 0.3; }
.cal-day-dot {
  position: absolute;
  bottom: 4px;
  width: 4px; height: 4px;
  border-radius: 50%;
  background: var(--gold);
}
.cal-week-grid {
  display: grid;
  grid-template-columns: 60px repeat(7, 1fr);
  gap: 1px;
  background: var(--border);
  border-radius: 8px;
  overflow: hidden;
}
.cal-week-head { background: var(--navy-mid); padding: 8px 4px; text-align: center; font-size: 11px; font-weight: 600; }
.cal-week-time { background: var(--navy-card); padding: 4px 6px; font-size: 10px; color: var(--text-dim); text-align: right; }
.cal-week-cell {
  background: var(--navy-mid);
  min-height: 36px;
  position: relative;
  padding: 2px;
}
.cal-event-block {
  background: var(--gold-dim);
  border-left: 3px solid var(--gold);
  padding: 4px 6px;
  border-radius: 4px;
  font-size: 11px;
  color: var(--gold);
  margin-bottom: 2px;
  cursor: pointer;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.cal-event-block.task { background: var(--blue-dim); border-left-color: var(--blue); color: var(--blue); }
.cal-event-block.follow-up { background: var(--gold-dim); border-left-color: var(--gold); color: var(--gold); }
.cal-event-block.outlook { background: var(--green-dim); border-left-color: var(--green); color: var(--green); }
.cal-event-block.calendly { background: rgba(155,111,212,0.15); border-left-color: var(--purple); color: var(--purple); }

/* ============================================================
   LOGIN PAGE
   ============================================================ */
.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: radial-gradient(circle at 30% 20%, rgba(201,166,103,0.08), transparent 50%), var(--navy);
}
.login-card {
  width: 100%;
  max-width: 400px;
  background: var(--navy-card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 36px 32px;
  box-shadow: var(--shadow-lg);
}
.login-logo {
  text-align: center;
  margin-bottom: 26px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}
.login-logo-mark {
  width: 56px; height: 56px;
  background: var(--gold);
  color: var(--navy);
  border-radius: 12px;
  display: grid;
  place-items: center;
  font-weight: 800;
  font-size: 24px;
}
.login-title { font-size: 20px; font-weight: 700; margin-bottom: 4px; }
.login-sub { font-size: 13px; color: var(--text-muted); }

/* ============================================================
   LOADER
   ============================================================ */
.page-loader {
  position: fixed;
  inset: 0;
  background: var(--navy);
  z-index: 9999;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
}
.spinner {
  width: 36px; height: 36px;
  border: 3px solid var(--border);
  border-top-color: var(--gold);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
.spinner-sm { width: 16px; height: 16px; border-width: 2px; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ============================================================
   PROGRESS BAR
   ============================================================ */
.progress {
  width: 100%;
  height: 6px;
  background: var(--navy);
  border-radius: 3px;
  overflow: hidden;
}
.progress-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--gold), var(--gold-bright));
  transition: width 0.4s ease;
}

/* ============================================================
   PIPELINE PILLS (dashboard glance)
   ============================================================ */
.stage-pills { display: flex; flex-wrap: wrap; gap: 6px; }
.stage-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  background: var(--navy-card);
  border: 1px solid var(--border);
  border-radius: 16px;
  font-size: 11px;
  cursor: pointer;
  transition: var(--transition);
  color: var(--text);
}
.stage-pill:hover { border-color: var(--gold); }
.stage-pill-count {
  background: var(--gold-dim);
  color: var(--gold);
  padding: 1px 6px;
  border-radius: 8px;
  font-weight: 600;
  font-size: 10px;
}

/* ============================================================
   TASK ROW
   ============================================================ */
.task-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  background: var(--navy-card);
  border: 1px solid var(--border);
  border-left: 3px solid var(--blue);
  border-radius: 6px;
  transition: var(--transition);
}
.task-row:hover { background: var(--navy-hover); }
.task-row.urgent { border-left-color: var(--red); }
.task-row.high { border-left-color: var(--amber); }
.task-row.normal { border-left-color: var(--blue); }
.task-row.low { border-left-color: var(--text-dim); }
.task-row.done { opacity: 0.5; }
.task-row.done .task-title { text-decoration: line-through; }
.task-checkbox { width: 18px; height: 18px; cursor: pointer; flex-shrink: 0; }
.task-title { flex: 1; font-size: 13px; }
.task-meta { font-size: 11px; color: var(--text-muted); }
.task-overdue { color: var(--red); font-weight: 600; }

/* ============================================================
   TEMPLATE CARDS
   ============================================================ */
.template-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 14px;
}
.template-card {
  background: var(--navy-card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.template-card-head { display: flex; align-items: start; justify-content: space-between; gap: 8px; }
.template-name { font-weight: 600; font-size: 14px; }
.template-subject { font-style: italic; font-size: 12px; color: var(--text-muted); }
.template-preview {
  font-size: 12px;
  color: var(--text-muted);
  background: rgba(0,0,0,0.2);
  padding: 8px 10px;
  border-radius: 6px;
  white-space: pre-wrap;
  display: -webkit-box;
  -webkit-line-clamp: 4;
  -webkit-box-orient: vertical;
  overflow: hidden;
  flex: 1;
}
.var-chip {
  display: inline-block;
  padding: 2px 6px;
  background: var(--gold-dim);
  color: var(--gold);
  border-radius: 4px;
  font-size: 10px;
  font-weight: 600;
  margin: 2px;
}

/* ============================================================
   EMAIL UI
   ============================================================ */
.email-shell { display: grid; grid-template-columns: 360px 1fr; gap: 0; height: calc(100vh - 60px - 48px); border: 1px solid var(--border); border-radius: 10px; overflow: hidden; }
.email-list { background: rgba(0,0,0,0.15); border-right: 1px solid var(--border); display: flex; flex-direction: column; }
.email-list-head { padding: 14px; border-bottom: 1px solid var(--border); }
.email-search { width: 100%; }
.email-items { flex: 1; overflow-y: auto; }
.email-item { padding: 12px 14px; border-bottom: 1px solid var(--border); cursor: pointer; transition: var(--transition); }
.email-item:hover { background: var(--navy-hover); }
.email-item.active { background: var(--gold-dim); border-left: 3px solid var(--gold); }
.email-item.unread .email-subject { font-weight: 700; color: var(--text); }
.email-from { font-size: 12px; color: var(--text-muted); display: flex; justify-content: space-between; gap: 8px; }
.email-subject { font-size: 13px; margin: 3px 0; color: var(--text-muted); }
.email-preview { font-size: 11px; color: var(--text-dim); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.email-viewer { padding: 22px; overflow-y: auto; }
.email-viewer-empty { display: grid; place-items: center; height: 100%; color: var(--text-dim); }
.email-actions { display: flex; gap: 8px; margin-bottom: 16px; padding-bottom: 16px; border-bottom: 1px solid var(--border); }
.email-body { white-space: pre-wrap; line-height: 1.6; font-size: 14px; }

/* ============================================================
   INTEGRATION CARD (settings)
   ============================================================ */
.integration-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 16px;
}
.integration-card {
  background: var(--navy-card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.integration-head { display: flex; align-items: center; gap: 12px; }
.integration-icon {
  width: 40px; height: 40px;
  border-radius: 8px;
  background: var(--gold-dim);
  display: grid;
  place-items: center;
  font-size: 20px;
}
.integration-name { font-weight: 600; font-size: 15px; }
.integration-desc { font-size: 12px; color: var(--text-muted); }

/* ============================================================
   ACCORDION
   ============================================================ */
.accordion-item { background: var(--navy-card); border: 1px solid var(--border); border-radius: 8px; margin-bottom: 6px; }
.accordion-head {
  padding: 12px 14px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-weight: 600;
  font-size: 13px;
}
.accordion-body {
  padding: 0 14px 14px;
  font-size: 13px;
  color: var(--text-muted);
  display: none;
  white-space: pre-wrap;
}
.accordion-item.open .accordion-body { display: block; }
.accordion-chev { transition: transform 0.2s; }
.accordion-item.open .accordion-chev { transform: rotate(180deg); }

/* ============================================================
   FAB
   ============================================================ */
.fab {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: var(--gold);
  color: var(--navy);
  border: none;
  font-size: 22px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: var(--shadow-lg);
  z-index: 100;
}

/* ============================================================
   UTILITIES
   ============================================================ */
.flex { display: flex; }
.flex-col { display: flex; flex-direction: column; }
.flex-between { display: flex; align-items: center; justify-content: space-between; }
.flex-center { display: flex; align-items: center; justify-content: center; }
.items-center { align-items: center; }
.items-start { align-items: flex-start; }
.gap-xs { gap: 4px; }
.gap-sm { gap: 8px; }
.gap-md { gap: 14px; }
.gap-lg { gap: 20px; }
.mt-xs { margin-top: 4px; }
.mt-sm { margin-top: 8px; }
.mt-md { margin-top: 14px; }
.mt-lg { margin-top: 24px; }
.mb-sm { margin-bottom: 8px; }
.mb-md { margin-bottom: 14px; }
.mb-lg { margin-bottom: 24px; }
.text-muted { color: var(--text-muted); }
.text-dim { color: var(--text-dim); }
.text-gold { color: var(--gold); }
.text-red { color: var(--red); }
.text-green { color: var(--green); }
.text-amber { color: var(--amber); }
.text-blue { color: var(--blue); }
.text-sm { font-size: 12px; }
.text-xs { font-size: 11px; }
.text-lg { font-size: 16px; }
.text-xl { font-size: 20px; }
.font-bold { font-weight: 700; }
.font-medium { font-weight: 500; }
.w-full { width: 100%; }
.h-full { height: 100%; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pointer { cursor: pointer; }
.text-center { text-align: center; }
.text-right { text-align: right; }
.uppercase { text-transform: uppercase; letter-spacing: 0.05em; }
.hidden { display: none !important; }
.page-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; gap: 16px; flex-wrap: wrap; }

/* ============================================================
   STAGE COLOURS (kanban col header tints)
   ============================================================ */
.stage-not_contacted { border-top: 3px solid #e05c5c; }
.stage-contacted { border-top: 3px solid #d4a843; }
.stage-following_up { border-top: 3px solid #d4843a; }
.stage-in_conversation { border-top: 3px solid #4caf82; }
.stage-qualified { border-top: 3px solid #4caf82; }
.stage-proposal_sent { border-top: 3px solid #C9A667; }
.stage-contract_out { border-top: 3px solid #C9A667; }
.stage-deposit_paid { border-top: 3px solid #4caf82; }
.stage-brief_received { border-top: 3px solid #4caf82; }
.stage-in_build { border-top: 3px solid #8ba3be; }
.stage-review { border-top: 3px solid #8ba3be; }
.stage-launch_ready { border-top: 3px solid #C9A667; }
.stage-live { border-top: 3px solid #4caf82; }
.stage-complete { border-top: 3px solid #4caf82; }
.stage-lost { border-top: 3px solid #555; }

/* ============================================================
   STARS
   ============================================================ */
.stars { color: var(--gold); letter-spacing: 2px; font-size: 14px; }

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 1024px) {
  .grid-cols-4 { grid-template-columns: repeat(2, 1fr); }
  .grid-cols-3 { grid-template-columns: 1fr; }
  .grid-dash { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
  .crm-sidebar { transform: translateX(-100%); }
  .crm-sidebar.open { transform: translateX(0); box-shadow: var(--shadow-lg); }
  .crm-main { margin-left: 0; }
  .hamburger { display: flex; }
  .crm-content { padding: 16px; }
  .grid-cols-2 { grid-template-columns: 1fr; }
  .form-row { grid-template-columns: 1fr; }
  .email-shell { grid-template-columns: 1fr; }
  .modal { max-width: 100%; }
}

/* Sidebar mobile overlay */
.sidebar-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 99;
  display: none;
}
.sidebar-overlay.open { display: block; }
