/* ================================================================
   Zafar Rahkar — Leads
   Aesthetic: warm editorial minimalism
   Palette:  cream paper · ink · burnt saffron accent
   Type:     Fraunces (display) · Albert Sans (body) · JetBrains Mono (data)
================================================================ */

:root {
  --paper:      #F4EFE6;
  --paper-2:    #EFE9DE;
  --surface:    #FFFDF8;
  --ink:        #1A1714;
  --ink-2:      #3B3530;
  --muted:      #776E65;
  --muted-2:    #A89E92;
  --rule:       #E2DACA;
  --rule-2:     #D4CBB8;

  --accent:     #B8421C;   /* burnt saffron */
  --accent-2:   #8E2F12;
  --accent-soft:#F5DDD1;

  --done:       #2E6B3E;
  --done-soft:  #D9EBDD;
  --warn:       #9A5A12;
  --warn-soft:  #F4E4CB;
  --danger:     #8B2020;
  --danger-soft:#F1D7D7;

  --hot:        #B8421C;
  --warm:       #C4872A;
  --cold:       #5A7A8E;

  --shadow-sm: 0 1px 0 rgba(26,23,20,0.04);
  --shadow-md: 0 12px 40px -18px rgba(26,23,20,0.25), 0 2px 6px -2px rgba(26,23,20,0.08);
  --shadow-lg: 0 40px 100px -40px rgba(26,23,20,0.45), 0 10px 30px -10px rgba(26,23,20,0.15);

  --radius:    14px;
  --radius-sm: 8px;

  --font-display: 'Fraunces', Georgia, serif;
  --font-body:    'Albert Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono:    'JetBrains Mono', ui-monospace, monospace;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  font-feature-settings: "ss01", "cv11";
}

a { color: inherit; }

.eyebrow {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0 0 14px;
  font-weight: 500;
}

.mono-tiny {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}

.page-grain {
  position: fixed; inset: 0;
  pointer-events: none;
  z-index: 1;
  opacity: 0.35;
  mix-blend-mode: multiply;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 0.2 0 0 0 0 0.18 0 0 0 0 0.15 0 0 0 0.18 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* ================================================================
   LOGIN PAGE
================================================================ */
.login-body {
  min-height: 100vh;
  display: grid;
  place-items: center;
  background:
    radial-gradient(1200px 600px at 15% 10%, #EADDC5 0%, transparent 60%),
    radial-gradient(900px 500px at 85% 90%, #E4D3B5 0%, transparent 55%),
    var(--paper);
}

.login-shell {
  display: grid;
  grid-template-columns: 1.15fr 1fr;
  width: min(1180px, 94vw);
  min-height: 680px;
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  border: 1px solid var(--rule);
}

.brand-panel {
  position: relative;
  padding: 44px 52px;
  background:
    linear-gradient(155deg, #1A1714 0%, #2B231B 55%, #3A2817 100%);
  color: #F4EFE6;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.brand-panel::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 85% 15%, rgba(184, 66, 28, 0.35) 0%, transparent 45%),
    radial-gradient(circle at 15% 85%, rgba(196, 135, 42, 0.2) 0%, transparent 50%);
  pointer-events: none;
}

.brand-grain {
  position: absolute;
  inset: 0;
  opacity: 0.5;
  mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2'/%3E%3CfeColorMatrix values='0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 0.25 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  pointer-events: none;
}

.brand-panel > * { position: relative; z-index: 1; }

.brand-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.mark {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: #E6D9C2;
  display: flex;
  align-items: center;
  gap: 8px;
}
.mark-dot {
  width: 7px; height: 7px;
  background: var(--accent);
  border-radius: 50%;
  box-shadow: 0 0 12px var(--accent);
}

.brand-panel .eyebrow { color: #C9B896; margin-bottom: 18px; }

.brand-center { margin: auto 0; }

.brand-title {
  font-family: var(--font-display);
  font-weight: 300;
  font-size: clamp(48px, 5.5vw, 76px);
  line-height: 0.98;
  margin: 0 0 28px;
  letter-spacing: -0.02em;
  color: #F8F2E4;
  font-variation-settings: "opsz" 144, "SOFT" 50;
}
.brand-title em {
  font-style: italic;
  font-weight: 400;
  color: var(--accent);
  font-variation-settings: "opsz" 144, "SOFT" 100;
}

.brand-sub {
  font-size: 15px;
  line-height: 1.65;
  color: #CEBEA0;
  max-width: 42ch;
  margin: 0;
}

.brand-bottom { margin-top: 40px; }
.rule {
  height: 1px;
  background: rgba(255,255,255,0.12);
  margin-bottom: 18px;
}
.brand-foot {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: #A89178;
}

.login-panel {
  display: grid;
  place-items: center;
  padding: 60px 64px;
  background: var(--surface);
}

.login-card {
  width: 100%;
  max-width: 360px;
}

.login-h2 {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: 42px;
  line-height: 1.05;
  letter-spacing: -0.02em;
  margin: 0 0 10px;
  font-variation-settings: "opsz" 144, "SOFT" 30;
}

.login-lede {
  color: var(--muted);
  margin: 0 0 36px;
  font-size: 14px;
}

.login-form { display: flex; flex-direction: column; gap: 20px; }

.field { display: flex; flex-direction: column; gap: 8px; }

.field-label {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 500;
}

.field input,
.field textarea,
.field select {
  font-family: var(--font-body);
  font-size: 15px;
  color: var(--ink);
  background: transparent;
  border: none;
  border-bottom: 1px solid var(--rule-2);
  padding: 10px 2px;
  outline: none;
  transition: border-color 0.2s ease;
}
.field input:focus,
.field textarea:focus,
.field select:focus {
  border-bottom-color: var(--accent);
}
.field textarea { resize: vertical; line-height: 1.55; }
.field select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%23776E65' stroke-width='1.5' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 4px center;
  padding-right: 22px;
}

.btn-primary {
  margin-top: 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 15px 24px;
  background: var(--ink);
  color: var(--paper);
  border: none;
  border-radius: 999px;
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 500;
  letter-spacing: 0.02em;
  cursor: pointer;
  transition: transform 0.2s ease, background 0.2s ease, box-shadow 0.2s ease;
  box-shadow: 0 1px 0 rgba(255,255,255,0.3) inset, 0 8px 24px -8px rgba(26,23,20,0.4);
}
.btn-primary:hover {
  background: var(--accent);
  transform: translateY(-1px);
  box-shadow: 0 14px 30px -10px rgba(184,66,28,0.5);
}
.btn-primary svg { transition: transform 0.2s ease; }
.btn-primary:hover svg { transform: translateX(3px); }

.alert {
  background: var(--danger-soft);
  color: var(--danger);
  border-left: 3px solid var(--danger);
  padding: 12px 14px;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  font-size: 13px;
  margin-bottom: 20px;
}

.login-hint {
  margin-top: 24px;
  text-align: center;
  color: var(--muted-2);
}

/* ================================================================
   DASHBOARD
================================================================ */
.dash-body {
  padding-bottom: 80px;
  position: relative;
  z-index: 2;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(244, 239, 230, 0.88);
  backdrop-filter: blur(12px) saturate(1.4);
  -webkit-backdrop-filter: blur(12px) saturate(1.4);
  border-bottom: 1px solid var(--rule);
}
.topbar-inner {
  max-width: 1400px;
  margin: 0 auto;
  padding: 14px 40px;
  display: flex;
  align-items: center;
  gap: 36px;
}

.brand-lock {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-display);
  font-size: 18px;
  letter-spacing: -0.01em;
}
.brand-dot {
  width: 9px; height: 9px;
  background: var(--accent);
  border-radius: 50%;
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.brand-sep { color: var(--muted-2); margin: 0 2px; font-weight: 300; }
.brand-section {
  font-style: italic;
  font-weight: 400;
  color: var(--accent);
}

.topnav {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-left: auto;
}
.nav-live {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--ink-2);
}
.live-dot {
  width: 6px; height: 6px;
  background: var(--done);
  border-radius: 50%;
  animation: pulse 2s ease-in-out infinite;
}
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.35; }
}
.nav-sep { color: var(--muted-2); }

.topbar-right {
  display: flex;
  align-items: center;
  gap: 20px;
}
.user-chip {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 6px 12px;
  background: var(--paper-2);
  border: 1px solid var(--rule);
  border-radius: 999px;
  color: var(--ink-2);
}
.link-logout {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  text-decoration: none;
  color: var(--muted);
  transition: color 0.2s ease;
}
.link-logout:hover { color: var(--accent); }

.dash {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 40px;
  position: relative;
  z-index: 2;
}

/* ---------- HERO ---------- */
.hero {
  padding: 64px 0 48px;
  display: grid;
  grid-template-columns: 1.1fr 1fr;
  gap: 60px;
  align-items: end;
}

.hero-title {
  font-family: var(--font-display);
  font-weight: 300;
  font-size: clamp(52px, 7vw, 104px);
  line-height: 0.94;
  letter-spacing: -0.035em;
  margin: 0 0 20px;
  color: var(--ink);
  font-variation-settings: "opsz" 144, "SOFT" 30;
}
.hero-title em {
  font-style: italic;
  font-weight: 400;
  color: var(--accent);
  font-variation-settings: "opsz" 144, "SOFT" 100;
}

.hero-sub {
  font-size: 16px;
  color: var(--muted);
  max-width: 42ch;
  margin: 0;
  line-height: 1.6;
}

.hero-right {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0;
  border-top: 1px solid var(--rule-2);
  border-left: 1px solid var(--rule-2);
}
.stat {
  padding: 22px 24px;
  border-right: 1px solid var(--rule-2);
  border-bottom: 1px solid var(--rule-2);
  display: flex;
  flex-direction: column;
  gap: 6px;
  background: var(--paper-2);
  transition: background 0.3s ease;
}
.stat:hover { background: var(--surface); }
.stat-label {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
}
.stat-num {
  font-family: var(--font-display);
  font-weight: 300;
  font-size: 64px;
  line-height: 1;
  color: var(--ink);
  letter-spacing: -0.03em;
  font-variation-settings: "opsz" 144, "SOFT" 30;
}
.stat-num.stat-done { color: var(--done); }
.stat-unit {
  font-size: 24px;
  color: var(--muted);
  font-style: normal;
  margin-left: 2px;
}

/* ---------- ANALYTICS ---------- */
.analytics { padding: 24px 0 48px; }
.analytics-grid {
  display: grid;
  grid-template-columns: 1.5fr 1fr 1fr 1.3fr;
  gap: 20px;
}

.card {
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  padding: 22px 24px;
  box-shadow: var(--shadow-sm);
  min-height: 180px;
  display: flex;
  flex-direction: column;
}
.card .eyebrow { margin-bottom: 16px; }
.card-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
}

.trend-chart {
  flex: 1;
  display: flex;
  align-items: flex-end;
  gap: 6px;
  padding-top: 12px;
  min-height: 110px;
}
.trend-bar {
  flex: 1;
  min-height: 4px;
  background: linear-gradient(180deg, var(--accent) 0%, var(--accent-2) 100%);
  border-radius: 3px 3px 0 0;
  position: relative;
  transition: transform 0.2s ease, filter 0.2s ease;
  cursor: default;
}
.trend-bar:hover { transform: scaleY(1.04); filter: brightness(1.1); }
.trend-bar[data-count="0"] {
  background: var(--rule-2);
  min-height: 2px;
}
.trend-bar::after {
  content: attr(data-count);
  position: absolute;
  top: -18px;
  left: 50%;
  transform: translateX(-50%);
  font-family: var(--font-mono);
  font-size: 9px;
  color: var(--ink);
  opacity: 0;
  transition: opacity 0.2s ease;
  pointer-events: none;
}
.trend-bar:hover::after { opacity: 1; }

.status-bars { display: flex; flex-direction: column; gap: 10px; flex: 1; justify-content: center; }
.sb-row { display: grid; grid-template-columns: 80px 1fr 28px; align-items: center; gap: 10px; }
.sb-label {
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-2);
}
.sb-track { height: 8px; background: var(--paper-2); border-radius: 4px; overflow: hidden; position: relative; }
.sb-fill { height: 100%; border-radius: 4px; transition: width 0.8s cubic-bezier(0.2, 0.9, 0.3, 1); }
.sb-fill.new         { background: var(--ink-2); }
.sb-fill.in_progress { background: var(--warn); }
.sb-fill.done        { background: var(--done); }
.sb-fill.lost        { background: var(--danger); }
.sb-count {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--ink);
  text-align: right;
}

.sys-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; flex: 1; }
.sys-list li {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 6px 0;
  border-bottom: 1px dashed var(--rule);
  font-size: 13px;
}
.sys-list li:last-child { border-bottom: none; }
.sys-name { color: var(--ink-2); }
.sys-count {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--muted);
}

.card-attention { background: linear-gradient(155deg, var(--paper-2) 0%, var(--surface) 100%); }
.attn-row {
  display: flex;
  align-items: center;
  gap: 18px;
  margin: 8px 0 14px;
}
.attn-num {
  display: block;
  font-family: var(--font-display);
  font-weight: 300;
  font-size: 48px;
  line-height: 1;
  letter-spacing: -0.03em;
  color: var(--ink);
  font-variation-settings: "opsz" 144;
}
.attn-num.attn-warn { color: var(--accent); }
.attn-label {
  display: block;
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  margin-top: 4px;
}
.attn-divider { width: 1px; height: 44px; background: var(--rule-2); }
.attn-hint {
  font-size: 12px;
  color: var(--muted);
  margin: 0;
  line-height: 1.5;
}

/* ---------- TOOLBAR ---------- */
.toolbar {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 8px 0 24px;
  flex-wrap: wrap;
}
.search-wrap {
  position: relative;
  flex: 1;
  min-width: 260px;
  max-width: 440px;
}
.search-wrap svg {
  position: absolute;
  left: 14px; top: 50%;
  transform: translateY(-50%);
  color: var(--muted);
}
.search-wrap input {
  width: 100%;
  padding: 12px 16px 12px 40px;
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: 999px;
  font-family: var(--font-body);
  font-size: 14px;
  color: var(--ink);
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
.search-wrap input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-soft);
}

.chip-group { display: flex; gap: 4px; padding: 3px; background: var(--paper-2); border-radius: 999px; border: 1px solid var(--rule); }
.chip {
  padding: 8px 14px;
  background: transparent;
  border: none;
  border-radius: 999px;
  font-family: var(--font-body);
  font-size: 12px;
  font-weight: 500;
  color: var(--muted);
  cursor: pointer;
  transition: all 0.2s ease;
}
.chip:hover { color: var(--ink); }
.chip.active {
  background: var(--ink);
  color: var(--paper);
}

.btn-new {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 20px;
  background: var(--accent);
  color: var(--paper);
  border: none;
  border-radius: 999px;
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.02em;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
  box-shadow: 0 10px 24px -10px rgba(184,66,28,0.5);
}
.btn-new:hover {
  background: var(--accent-2);
  transform: translateY(-1px);
  box-shadow: 0 14px 28px -10px rgba(184,66,28,0.6);
}

/* ---------- TABLE ---------- */
.table-card {
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}
.leads-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}
.leads-table thead th {
  text-align: left;
  padding: 16px 20px;
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 500;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
  border-bottom: 1px solid var(--rule);
  background: var(--paper-2);
}
.leads-table thead th.col-id { width: 52px; }
.leads-table thead th.col-act { width: 90px; }

.leads-table tbody tr {
  border-bottom: 1px solid var(--rule);
  transition: background 0.15s ease;
  cursor: pointer;
}
.leads-table tbody tr:hover { background: var(--paper-2); }
.leads-table tbody tr:last-child { border-bottom: none; }
.leads-table tbody td {
  padding: 18px 20px;
  vertical-align: middle;
  color: var(--ink-2);
}

.cell-id {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--muted);
}
.cell-name {
  font-weight: 500;
  color: var(--ink);
  display: flex;
  align-items: center;
  gap: 10px;
}
.cell-name .dot-pri {
  width: 8px; height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}
.dot-pri.hot  { background: var(--hot);  box-shadow: 0 0 0 3px rgba(184,66,28,0.15); }
.dot-pri.warm { background: var(--warm); box-shadow: 0 0 0 3px rgba(196,135,42,0.15); }
.dot-pri.cold { background: var(--cold); box-shadow: 0 0 0 3px rgba(90,122,142,0.15); }

.cell-wa {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--ink-2);
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.wa-link {
  color: var(--done);
  text-decoration: none;
  transition: transform 0.15s ease;
  display: inline-flex;
}
.wa-link:hover { transform: scale(1.2); }

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px 5px 9px;
  border-radius: 999px;
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  border: 1px solid;
}
.badge::before {
  content: "";
  width: 6px; height: 6px;
  border-radius: 50%;
  background: currentColor;
}
.badge.new         { color: var(--ink-2);  background: var(--paper-2);  border-color: var(--rule-2); }
.badge.in_progress { color: var(--warn);   background: var(--warn-soft); border-color: #E8D1A6; }
.badge.done        { color: var(--done);   background: var(--done-soft); border-color: #B9D6C0; }
.badge.lost        { color: var(--danger); background: var(--danger-soft); border-color: #E8BEBE; }

.prio-label {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
}

.cell-time {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--muted);
}
.cell-time.quiet { color: var(--accent); font-weight: 500; }
.cell-time.quiet::before { content: "● "; }
.cell-time.overdue { color: var(--danger); font-weight: 500; }

.row-actions {
  display: flex;
  gap: 6px;
  justify-content: flex-end;
}
.icon-btn {
  width: 30px; height: 30px;
  border: 1px solid var(--rule);
  background: var(--surface);
  border-radius: 8px;
  display: grid;
  place-items: center;
  cursor: pointer;
  color: var(--muted);
  transition: all 0.15s ease;
}
.icon-btn:hover { border-color: var(--accent); color: var(--accent); }

.loading, .empty {
  text-align: center;
  padding: 60px 20px !important;
  color: var(--muted) !important;
  font-style: italic;
}

.dash-foot {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 48px 0 20px;
  color: var(--muted);
  font-size: 12px;
}

/* ================================================================
   DRAWER
================================================================ */
.drawer-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(26, 23, 20, 0.35);
  backdrop-filter: blur(3px);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
  z-index: 50;
}
.drawer-backdrop.open { opacity: 1; visibility: visible; }

.drawer {
  position: fixed;
  top: 0; right: 0;
  height: 100vh;
  width: min(640px, 94vw);
  background: var(--surface);
  box-shadow: var(--shadow-lg);
  transform: translateX(100%);
  transition: transform 0.4s cubic-bezier(0.22, 0.9, 0.28, 1);
  z-index: 60;
  display: flex;
  flex-direction: column;
  border-left: 1px solid var(--rule);
}
.drawer.open { transform: translateX(0); }

.drawer-head {
  padding: 24px 32px 18px;
  border-bottom: 1px solid var(--rule);
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-shrink: 0;
}
.drawer-head .eyebrow { margin: 0; }
.drawer-close {
  width: 34px; height: 34px;
  border: 1px solid var(--rule);
  background: var(--surface);
  border-radius: 50%;
  cursor: pointer;
  color: var(--muted);
  font-size: 14px;
  transition: all 0.2s ease;
}
.drawer-close:hover {
  background: var(--ink);
  color: var(--paper);
  border-color: var(--ink);
  transform: rotate(90deg);
}

.drawer-body {
  overflow-y: auto;
  padding: 28px 32px 40px;
  flex: 1;
}

.lead-form { display: flex; flex-direction: column; gap: 22px; }
.form-row.two { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }

.form-actions {
  display: flex;
  gap: 10px;
  align-items: center;
  padding-top: 10px;
  border-top: 1px solid var(--rule);
  margin-top: 8px;
}
.form-actions .spacer { flex: 1; }

.btn-ghost {
  padding: 12px 20px;
  background: transparent;
  border: 1px solid var(--rule-2);
  border-radius: 999px;
  font-family: var(--font-body);
  font-size: 13px;
  color: var(--ink-2);
  cursor: pointer;
  transition: all 0.2s ease;
}
.btn-ghost:hover { border-color: var(--ink); background: var(--paper-2); }
#btn-delete:hover { border-color: var(--danger); color: var(--danger); background: var(--danger-soft); }

/* Timeline */
.timeline-section {
  margin-top: 44px;
  padding-top: 28px;
  border-top: 1px solid var(--rule);
}
.section-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 16px;
}
.section-head .eyebrow { margin: 0; }

.note-form {
  display: flex;
  gap: 8px;
  margin-bottom: 24px;
}
.note-form input {
  flex: 1;
  padding: 11px 14px;
  background: var(--paper-2);
  border: 1px solid var(--rule);
  border-radius: var(--radius-sm);
  font-family: var(--font-body);
  font-size: 13px;
  color: var(--ink);
  outline: none;
}
.note-form input:focus { border-color: var(--accent); background: var(--surface); }
.btn-note {
  padding: 11px 18px;
  background: var(--ink);
  color: var(--paper);
  border: none;
  border-radius: var(--radius-sm);
  font-family: var(--font-body);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.2s ease;
}
.btn-note:hover { background: var(--accent); }

.timeline {
  list-style: none;
  margin: 0;
  padding: 0;
  position: relative;
}
.timeline::before {
  content: "";
  position: absolute;
  left: 6px; top: 8px; bottom: 8px;
  width: 1px;
  background: var(--rule-2);
}
.tl-item {
  position: relative;
  padding: 0 0 20px 28px;
}
.tl-item::before {
  content: "";
  position: absolute;
  left: 2px; top: 6px;
  width: 9px; height: 9px;
  border-radius: 50%;
  background: var(--surface);
  border: 2px solid var(--accent);
}
.tl-item[data-type="status"]::before  { border-color: var(--warn); }
.tl-item[data-type="created"]::before { border-color: var(--done); }
.tl-item[data-type="update"]::before  { border-color: var(--muted-2); }

.tl-content {
  font-size: 13px;
  color: var(--ink-2);
  line-height: 1.55;
}
.tl-meta {
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  margin-top: 4px;
  display: block;
}

/* ================================================================
   RESPONSIVE
================================================================ */
@media (max-width: 1100px) {
  .analytics-grid { grid-template-columns: 1fr 1fr; }
  .hero { grid-template-columns: 1fr; gap: 36px; }
  .hero-right { max-width: 520px; }
}
@media (max-width: 780px) {
  .topbar-inner { padding: 12px 20px; gap: 16px; flex-wrap: wrap; }
  .topnav { order: 3; margin-left: 0; width: 100%; }
  .dash { padding: 0 20px; }
  .hero { padding: 40px 0 32px; }
  .analytics-grid { grid-template-columns: 1fr; }
  .login-shell { grid-template-columns: 1fr; min-height: auto; }
  .brand-panel { padding: 36px 32px; }
  .login-panel { padding: 40px 32px; }
  .form-row.two { grid-template-columns: 1fr; }
  .leads-table { font-size: 12px; }
  .leads-table thead th, .leads-table tbody td { padding: 12px 10px; }
}
