/* ===================================================
   FORGIA OUTREACH — v3.0
   Brand: forgia.es — nero · oro · teal
=================================================== */

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

:root {
  --bg:           #0E0E0E;
  --surface:      #0A0A0A;
  --card:         #171717;
  --card-hover:   #1F1F1F;
  --border:       rgba(201,169,110,0.20);
  --border-light: rgba(201,169,110,0.10);

  --gold:         #C9A96E;
  --gold-hover:   #B8935A;
  --gold-2:       #E8D5A8;
  --gold-dim:     rgba(201,169,110,0.1);
  --gold-glow:    rgba(201,169,110,0.22);

  /* compat aliases for JS */
  --green:        #C9A96E;
  --green-hover:  #B8935A;
  --green-dim:    rgba(201,169,110,0.1);
  --green-glow:   rgba(201,169,110,0.22);

  --teal:         #2A6B7C;
  --teal-light:   #6fc8d8;
  --teal-dim:     rgba(42,107,124,0.15);

  --blue:         #6fc8d8;
  --blue-dim:     rgba(111,200,216,0.12);
  --purple:       #C9A96E;
  --purple-dim:   rgba(201,169,110,0.1);
  --yellow:       #E8D5A8;
  --red:          #ef4444;
  --red-dim:      rgba(239,68,68,0.1);

  --text:         #F7F3ED;
  --text-dim:     #CCC6BE;
  --text-muted:   #7A746E;

  --sidebar-w:    220px;
  --header-h:     58px;
  --radius:       6px;
  --radius-lg:    8px;
  --radius-xl:    12px;
  --shadow:       0 12px 48px rgba(0,0,0,0.7);
  --shadow-sm:    0 2px 14px rgba(0,0,0,0.5);

  --status-new:         #4A4540;
  --status-contacted:   #6fc8d8;
  --status-warm:        #E8D5A8;
  --status-qualified:   #C9A96E;
  --status-appointment: #C9A96E;
  --status-won:         #16a34a;
  --status-lost:        #ef4444;

  --s-new:         #4A4540;
  --s-contacted:   #6fc8d8;
  --s-warm:        #E8D5A8;
  --s-qualified:   #C9A96E;
  --s-appointment: #C9A96E;
  --s-won:         #16a34a;
  --s-lost:        #ef4444;
}

/* ---- Reset ---- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 14px; }
body {
  font-family: 'Plus Jakarta Sans', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  min-height: 100vh;
  overflow-x: hidden;
  position: relative;
}

/* Subtle gold grid overlay — same as homepage */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background-image:
    linear-gradient(rgba(201,169,110,0.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(201,169,110,0.025) 1px, transparent 1px);
  background-size: 48px 48px;
  pointer-events: none;
  z-index: 0;
}

a { color: inherit; text-decoration: none; }
button { cursor: pointer; font-family: inherit; border: none; background: none; }
input, select, textarea { font-family: inherit; }

/* ---- Scrollbar ---- */
::-webkit-scrollbar { width: 4px; height: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(201,169,110,0.2); border-radius: 2px; }
::-webkit-scrollbar-thumb:hover { background: rgba(201,169,110,0.35); }

/* ===================================================
   LAYOUT
=================================================== */

.sidebar {
  position: fixed;
  top: 0; left: 0;
  width: var(--sidebar-w);
  height: 100vh;
  background: #0A0A0A;
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  z-index: 200;
  transition: transform 0.25s ease;
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 18px;
  height: var(--header-h);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.logo-mark { display: none; }

.logo-text {
  font-family: 'Space Mono', monospace;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.16em;
  color: var(--gold);
  text-transform: uppercase;
}

.logo-text span {
  display: block;
  font-size: 9px;
  font-weight: 400;
  color: var(--text-muted);
  letter-spacing: 0.18em;
  text-transform: uppercase;
  font-family: 'Plus Jakarta Sans', sans-serif;
  margin-top: 2px;
}

.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: 16px 10px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.nav-section-label {
  font-family: 'Space Mono', monospace;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: rgba(201,169,110,0.45);
  padding: 10px 8px 4px;
  margin-top: 6px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: var(--radius);
  font-size: 13px;
  font-weight: 500;
  color: var(--text-dim);
  transition: all 0.15s;
  position: relative;
}

.nav-item svg { width: 15px; height: 15px; flex-shrink: 0; opacity: 0.55; transition: opacity 0.15s; }
.nav-item:hover { background: rgba(255,255,255,0.04); color: var(--text); }
.nav-item:hover svg { opacity: 1; }

.nav-item.active {
  background: rgba(201,169,110,0.12);
  color: var(--gold);
  border-left: 2px solid var(--gold);
  padding-left: 8px;
}
.nav-item.active svg { opacity: 1; color: var(--gold); }

.nav-badge {
  margin-left: auto;
  background: rgba(201,169,110,0.08);
  color: var(--text-muted);
  font-size: 10px;
  font-weight: 700;
  padding: 1px 7px;
  border-radius: 20px;
  min-width: 20px;
  text-align: center;
  font-family: 'Space Mono', monospace;
}

.nav-item.active .nav-badge {
  background: rgba(201,169,110,0.18);
  color: var(--gold);
}

.sidebar-footer {
  padding: 14px 18px;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}

.sidebar-footer-brand {
  font-family: 'Space Mono', monospace;
  font-size: 10px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.version-tag {
  background: rgba(201,169,110,0.1);
  color: var(--gold);
  font-size: 9px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 3px;
  font-family: 'Space Mono', monospace;
  letter-spacing: 0.05em;
}

/* ---- Main ---- */
.main {
  margin-left: var(--sidebar-w);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  position: relative;
  z-index: 1;
}

/* ---- Topbar ---- */
.topbar {
  height: var(--header-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  border-bottom: 1px solid var(--border);
  background: rgba(10,10,10,0.97);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  position: sticky;
  top: 0;
  z-index: 100;
  flex-shrink: 0;
}

.topbar-left { display: flex; align-items: center; gap: 12px; }
.topbar-right { display: flex; align-items: center; gap: 8px; }

.topbar-title {
  font-family: 'Space Mono', monospace;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text);
}

.hamburger {
  display: none;
  width: 34px; height: 34px;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius);
  color: var(--text-dim);
  transition: background 0.15s;
}
.hamburger:hover { background: var(--card-hover); }
.hamburger svg { width: 18px; height: 18px; }

/* ---- Content ---- */
.content {
  flex: 1;
  padding: 24px;
}

/* ===================================================
   BUTTONS
=================================================== */

.btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 8px 16px;
  border-radius: var(--radius);
  font-size: 12px;
  font-weight: 600;
  transition: all 0.15s;
  white-space: nowrap;
  border: 1px solid transparent;
  letter-spacing: 0.02em;
}

.btn svg { width: 13px; height: 13px; flex-shrink: 0; }

.btn-primary {
  background: var(--gold);
  color: #080808;
  border-color: var(--gold);
  font-family: 'Space Mono', monospace;
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.btn-primary:hover { background: var(--gold-hover); border-color: var(--gold-hover); transform: translateY(-1px); box-shadow: 0 4px 18px var(--gold-glow); }
.btn-primary:active { transform: translateY(0); }

.btn-secondary {
  background: var(--card);
  color: var(--text-dim);
  border-color: var(--border);
}
.btn-secondary:hover { background: var(--card-hover); color: var(--text); border-color: rgba(201,169,110,0.25); }

.btn-ghost {
  background: none;
  color: var(--text-dim);
}
.btn-ghost:hover { background: var(--card-hover); color: var(--text); }

.btn-danger {
  background: var(--red-dim);
  color: var(--red);
  border-color: rgba(239,68,68,0.2);
}
.btn-danger:hover { background: rgba(239,68,68,0.18); }

.btn-sm { padding: 6px 12px; font-size: 11px; }
.btn-sm svg { width: 12px; height: 12px; }
.btn-xs { padding: 4px 10px; font-size: 10px; }

.w-full { width: 100%; justify-content: center; }

/* ===================================================
   CARDS & STATS
=================================================== */

.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin-bottom: 24px;
}

.stat-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  transition: border-color 0.2s, box-shadow 0.2s, transform 0.2s;
  position: relative;
  overflow: hidden;
}
.stat-card:hover { transform: translateY(-1px); }

/* HUD corner brackets */
.stat-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0;
  width: 10px; height: 10px;
  border-top: 1px solid var(--gold);
  border-left: 1px solid var(--gold);
  opacity: 0.4;
}
.stat-card::after {
  content: '';
  position: absolute;
  bottom: 0; right: 0;
  width: 10px; height: 10px;
  border-bottom: 1px solid var(--gold);
  border-right: 1px solid var(--gold);
  opacity: 0.4;
}

.stat-card:hover { border-color: rgba(201,169,110,0.35); box-shadow: 0 4px 24px rgba(0,0,0,0.4), 0 0 0 1px rgba(201,169,110,0.08); }
.stat-card:hover::before, .stat-card:hover::after { opacity: 0.9; }

.stat-icon {
  width: 34px; height: 34px;
  background: var(--gold-dim);
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 14px;
  color: var(--gold);
}
.stat-icon svg { width: 16px; height: 16px; }

.stat-label {
  font-family: 'Space Mono', monospace;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: rgba(201,169,110,0.5);
  margin-bottom: 6px;
}

.stat-value {
  font-size: 28px;
  font-weight: 700;
  color: var(--text);
  line-height: 1;
  margin-bottom: 6px;
  font-family: 'Space Mono', monospace;
}

.stat-change {
  font-size: 11px;
  font-weight: 500;
}
.stat-change.positive { color: var(--gold); }
.stat-change.neutral { color: var(--text-muted); }

/* ===================================================
   DASHBOARD GRID
=================================================== */

.dashboard-grid {
  display: grid;
  grid-template-columns: 1fr 360px;
  gap: 20px;
}

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}

.section-title {
  font-family: 'Space Mono', monospace;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text);
}

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
}

/* ===================================================
   CAMPAIGNS v2
=================================================== */

.campaigns-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}

.campaigns-grid { display: flex; flex-direction: column; gap: 12px; }

.camp-page { padding: 2px 0; }
.camp-section-label {
  font-family: 'Space Mono', monospace;
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--text-muted);
  margin-bottom: 10px;
}
.camp-list { display: flex; flex-direction: column; gap: 10px; }

.camp-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 80px 24px;
  gap: 12px;
}
.camp-empty-icon {
  width: 64px; height: 64px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  color: var(--text-muted);
  margin-bottom: 4px;
}
.camp-empty h3 { font-size: 16px; font-weight: 700; margin: 0; color: var(--text); font-family: 'Space Mono', monospace; letter-spacing: 0.05em; }
.camp-empty p  { font-size: 13px; color: var(--text-dim); margin: 0; line-height: 1.6; max-width: 380px; }

.camp-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 18px 20px;
  transition: border-color .15s;
}
.camp-card:hover { border-color: rgba(201,169,110,0.28); }
.camp-card-paused { opacity: .6; }

.camp-card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}
.camp-card-name {
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
  font-family: 'Space Mono', monospace;
  letter-spacing: 0.04em;
}
.camp-card-meta {
  font-size: 12px;
  color: var(--text-dim);
  margin-top: 3px;
}
.camp-card-controls {
  display: flex;
  gap: 6px;
  align-items: center;
  flex-shrink: 0;
}

.camp-funnel {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}
.camp-funnel-step { text-align: center; min-width: 72px; }
.camp-funnel-num {
  font-size: 22px;
  font-weight: 700;
  line-height: 1;
  font-family: 'Space Mono', monospace;
  color: var(--text);
}
.camp-funnel-lbl {
  font-size: 10px;
  color: var(--text-muted);
  margin-top: 3px;
  line-height: 1.3;
  letter-spacing: 0.04em;
}
.camp-funnel-arrow {
  color: var(--border);
  font-size: 16px;
  flex-shrink: 0;
  padding: 0 2px;
  padding-bottom: 14px;
}

.camp-card-footer {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 4px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}
.camp-next-btn { font-size: 11px !important; }

/* compat */
.campaign-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  transition: all 0.2s;
}
.campaign-name { font-size: 14px; font-weight: 700; color: var(--text); font-family: 'Space Mono', monospace; }
.campaign-meta { font-size: 12px; color: var(--text-dim); margin-top: 3px; }
.campaign-progress { margin-bottom: 16px; }

.progress-bar-wrap {
  height: 3px;
  background: rgba(201,169,110,0.1);
  border-radius: 2px;
  overflow: hidden;
  margin-bottom: 5px;
}
.progress-bar { height: 100%; border-radius: 2px; transition: width 0.3s; }
.progress-bar.green { background: var(--gold); }
.progress-bar.blue  { background: var(--teal-light); }

.progress-label {
  font-size: 11px;
  color: var(--text-muted);
  display: flex;
  justify-content: space-between;
}

.campaign-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  border-top: 1px solid var(--border);
  padding-top: 14px;
}

/* Status badges */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 3px;
  font-size: 10px;
  font-weight: 700;
  white-space: nowrap;
  font-family: 'Space Mono', monospace;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.badge-new           { background: rgba(74,69,64,0.35);      color: #9A9490; border: 1px solid rgba(120,115,110,0.3); }
.badge-contacted     { background: rgba(111,200,216,0.1);     color: #6fc8d8; border: 1px solid rgba(111,200,216,0.2); }
.badge-warm          { background: rgba(232,213,168,0.1);     color: #E8D5A8; border: 1px solid rgba(232,213,168,0.2); }
.badge-qualified     { background: var(--gold-dim);            color: var(--gold); border: 1px solid rgba(201,169,110,0.25); }
.badge-appointment_set { background: var(--gold-dim);         color: var(--gold-2); border: 1px solid rgba(201,169,110,0.3); }
.badge-won           { background: rgba(22,163,74,0.1);       color: #16a34a; border: 1px solid rgba(22,163,74,0.2); }
.badge-lost          { background: var(--red-dim);             color: var(--red); border: 1px solid rgba(239,68,68,0.2); }
.badge-unsubscribed  { background: rgba(74,69,64,0.3);        color: var(--text-muted); border: 1px solid var(--border); }

.badge-active   { background: var(--gold-dim);                 color: var(--gold); border: 1px solid rgba(201,169,110,0.25); }
.badge-paused   { background: rgba(232,213,168,0.1);           color: #E8D5A8; border: 1px solid rgba(232,213,168,0.2); }
.badge-finished { background: rgba(74,69,64,0.3);              color: var(--text-muted); border: 1px solid var(--border); }

/* ===================================================
   LEADS TABLE
=================================================== */

.filters-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.filter-select, .filter-input {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  padding: 7px 12px;
  font-size: 12.5px;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.filter-select:focus, .filter-input:focus { border-color: rgba(201,169,110,0.5); box-shadow: 0 0 0 3px rgba(201,169,110,0.07); }
.filter-input::placeholder { color: var(--text-muted); }
.filter-select { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%234A4540' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 10px center; padding-right: 28px; }
.filter-select option { background: #1A1A1A; color: #F7F3ED; }
.filters-spacer { flex: 1; }
.filter-input-sm { width: 110px; }

.search-wrap { position: relative; max-width: 220px; }
.search-wrap svg { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); width: 13px; height: 13px; color: var(--text-muted); pointer-events: none; }
.search-wrap .filter-input { padding-left: 32px; width: 100%; }

.table-wrap {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

table { width: 100%; border-collapse: collapse; }

thead th {
  padding: 10px 14px;
  text-align: left;
  font-family: 'Space Mono', monospace;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: rgba(201,169,110,0.55);
  border-bottom: 1px solid var(--border);
  background: rgba(8,8,8,0.8);
  white-space: nowrap;
}

tbody tr {
  border-bottom: 1px solid var(--border-light);
  cursor: pointer;
  transition: background 0.1s;
}
tbody tr:last-child { border-bottom: none; }
tbody tr:hover { background: rgba(255,255,255,0.03); }

tbody td {
  padding: 11px 14px;
  font-size: 13px;
  vertical-align: middle;
}

.td-name { font-weight: 600; color: var(--text); }
.td-phone { color: var(--text-dim); font-size: 12px; font-family: 'Space Mono', monospace; }
.td-muted { color: var(--text-muted); }
.td-actions { white-space: nowrap; opacity: 0; transition: opacity 0.15s; }
tbody tr:hover .td-actions { opacity: 1; }

/* ---- Lead Cards (mobile table replacement) ---- */
.leads-cards {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.lead-card {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 13px 16px;
  border-bottom: 1px solid var(--border-light);
  cursor: pointer;
  transition: background 0.1s;
  -webkit-tap-highlight-color: transparent;
}
.lead-card:last-child { border-bottom: none; }
.lead-card:hover, .lead-card:active { background: rgba(255,255,255,0.04); }

.lead-card-top {
  display: flex;
  align-items: center;
  gap: 7px;
}

.lead-card-name {
  flex: 1;
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}

.lead-card-phone {
  font-size: 12px;
  color: var(--text-dim);
  font-family: 'Space Mono', monospace;
}

.lead-card-meta {
  font-size: 11px;
  color: var(--text-muted);
}

.lead-card-seq-btn {
  flex-shrink: 0;
  width: 28px; height: 28px;
  display: flex; align-items: center; justify-content: center;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--gold);
  transition: background 0.15s, border-color 0.15s;
  -webkit-tap-highlight-color: transparent;
}
.lead-card-seq-btn:hover, .lead-card-seq-btn:active {
  background: var(--gold-dim);
  border-color: rgba(201,169,110,0.35);
}

/* Pagination */
.pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  font-size: 11.5px;
  color: var(--text-muted);
  border-top: 1px solid var(--border);
}

.pagination-controls { display: flex; gap: 4px; }

.page-btn {
  width: 28px; height: 28px;
  display: flex; align-items: center; justify-content: center;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--text-muted);
  font-size: 11.5px;
  transition: all 0.15s;
  font-family: 'Space Mono', monospace;
}
.page-btn:hover { background: var(--card-hover); color: var(--text); border-color: rgba(201,169,110,0.25); }
.page-btn.active { background: var(--gold); border-color: var(--gold); color: #080808; font-weight: 700; }

/* ===================================================
   FUNNEL
=================================================== */

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

.funnel-item { display: flex; align-items: center; gap: 10px; font-size: 12px; }
.funnel-label { width: 90px; flex-shrink: 0; color: var(--text-dim); }

.funnel-bar-wrap {
  flex: 1;
  height: 4px;
  background: rgba(201,169,110,0.08);
  border-radius: 2px;
  overflow: hidden;
}

.funnel-bar { height: 100%; border-radius: 2px; transition: width 0.4s; }
.funnel-count { width: 28px; text-align: right; color: var(--text-muted); font-size: 11px; font-family: 'Space Mono', monospace; }

/* ===================================================
   LEAD DRAWER
=================================================== */

.overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.7);
  z-index: 300;
  opacity: 0; pointer-events: none;
  transition: opacity 0.2s;
  backdrop-filter: blur(4px);
}
.overlay.open { opacity: 1; pointer-events: all; }

.drawer {
  position: fixed;
  top: 0; right: 0;
  width: 420px;
  height: 100vh;
  background: #0C0C0C;
  border-left: 1px solid var(--border);
  z-index: 400;
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform 0.25s ease;
  box-shadow: -12px 0 48px rgba(0,0,0,0.6);
}
.drawer.open { transform: translateX(0); }

.drawer-header {
  padding: 18px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  flex-shrink: 0;
}

.drawer-title { font-size: 15px; font-weight: 700; margin-bottom: 3px; color: var(--text); font-family: 'Space Mono', monospace; letter-spacing: 0.04em; }
.drawer-subtitle { font-size: 12px; color: var(--text-muted); }

.drawer-close {
  width: 32px; height: 32px;
  display: flex; align-items: center; justify-content: center;
  border-radius: var(--radius);
  color: var(--text-muted);
  transition: all 0.15s;
}
.drawer-close:hover { background: var(--card-hover); color: var(--text); }

.tabs {
  display: flex;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  padding: 0 20px;
}

.tab-btn {
  padding: 11px 14px;
  font-family: 'Space Mono', monospace;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-muted);
  border-bottom: 2px solid transparent;
  transition: all 0.15s;
  margin-bottom: -1px;
}
.tab-btn:hover { color: var(--text-dim); }
.tab-btn.active { color: var(--gold); border-bottom-color: var(--gold); }

.tab-content { flex: 1; overflow: hidden; display: flex; flex-direction: column; }
.tab-pane { display: none; flex: 1; flex-direction: column; overflow-y: auto; }
.tab-pane.active { display: flex; }

/* Chat tab */
.chat-messages {
  flex: 1; overflow-y: auto;
  padding: 16px;
  display: flex; flex-direction: column; gap: 8px;
}

.chat-empty {
  flex: 1;
  display: flex; align-items: center; justify-content: center;
  color: var(--text-muted); font-size: 13px;
}

.bubble-wrap { display: flex; flex-direction: column; max-width: 85%; }
.bubble-wrap.outbound { align-self: flex-end; align-items: flex-end; }
.bubble-wrap.inbound { align-self: flex-start; align-items: flex-start; }

.bubble {
  padding: 9px 13px;
  border-radius: 10px;
  font-size: 13px;
  line-height: 1.5;
  white-space: pre-wrap;
  word-break: break-word;
}

.bubble-wrap.outbound .bubble {
  background: rgba(201,169,110,0.12);
  border: 1px solid rgba(201,169,110,0.2);
  color: var(--text);
  border-bottom-right-radius: 3px;
}

.bubble-wrap.inbound .bubble {
  background: var(--card);
  border: 1px solid var(--border);
  color: var(--text);
  border-bottom-left-radius: 3px;
}

.bubble-time {
  font-size: 10px;
  color: var(--text-muted);
  margin-top: 3px;
  padding: 0 3px;
  font-family: 'Space Mono', monospace;
}

.chat-input-area {
  padding: 14px 16px;
  border-top: 1px solid var(--border);
  display: flex; gap: 8px; align-items: flex-end;
  flex-shrink: 0;
  position: relative;
}

.chat-input {
  flex: 1;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  padding: 9px 12px;
  font-size: 13px;
  resize: none;
  outline: none;
  transition: border-color 0.15s;
}
.chat-input::placeholder { color: var(--text-muted); }
.chat-input:focus { border-color: rgba(201,169,110,0.35); }

/* Info tab */
.info-form {
  padding: 16px 20px; flex: 1;
  display: flex; flex-direction: column; gap: 12px;
  overflow-y: auto;
}

.form-group { display: flex; flex-direction: column; gap: 5px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.form-label {
  font-family: 'Space Mono', monospace;
  font-size: 9px; font-weight: 700;
  color: var(--text-muted);
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.form-input, .form-select, .form-textarea {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  padding: 8px 12px;
  font-size: 13px;
  outline: none;
  transition: border-color 0.15s;
  width: 100%;
}
.form-input::placeholder, .form-textarea::placeholder { color: var(--text-muted); }
.form-input:focus, .form-select:focus, .form-textarea:focus {
  border-color: rgba(201,169,110,0.35);
  background: var(--card);
}
.form-textarea { resize: vertical; min-height: 80px; line-height: 1.4; }
.form-select { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%234A4540' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 10px center; padding-right: 28px; }
.form-select option { background: #1A1A1A; color: #F7F3ED; }

.form-footer {
  padding: 0 20px 20px;
  display: flex; gap: 8px;
  flex-shrink: 0;
}

/* Appointments */
.appts-list { padding: 16px; display: flex; flex-direction: column; gap: 10px; }
.appt-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px; }
.appt-date { font-size: 13px; font-weight: 700; margin-bottom: 6px; font-family: 'Space Mono', monospace; }
.appt-meta { font-size: 12px; color: var(--text-muted); line-height: 1.6; }
.appt-actions { padding: 12px 16px; border-bottom: 1px solid var(--border); flex-shrink: 0; }
.appt-form { padding: 14px 16px; border-bottom: 1px solid var(--border); flex-shrink: 0; }
.appt-form-title { font-size: 12px; font-weight: 700; margin-bottom: 12px; font-family: 'Space Mono', monospace; text-transform: uppercase; letter-spacing: 0.08em; color: var(--gold); }

/* ===================================================
   SETTINGS PAGE
=================================================== */

.settings-layout {
  display: grid;
  grid-template-columns: 200px 1fr;
  gap: 24px;
  max-width: 860px;
}

.settings-nav { display: flex; flex-direction: column; gap: 2px; }

.settings-nav-item {
  padding: 9px 12px;
  border-radius: var(--radius);
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-dim);
  cursor: pointer;
  transition: all 0.15s;
}
.settings-nav-item:hover { background: var(--card); color: var(--text); }
.settings-nav-item.active { background: var(--gold-dim); color: var(--gold); border-left: 2px solid var(--gold); padding-left: 10px; }

.settings-panel { display: flex; flex-direction: column; gap: 20px; }

.settings-section {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.settings-section-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
}

.settings-section-title {
  font-family: 'Space Mono', monospace;
  font-size: 11px; font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text);
}

.settings-section-desc {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
}

.settings-body { padding: 20px; display: flex; flex-direction: column; gap: 14px; }

.reflection-preview {
  font-size: 12px;
  color: var(--text-dim);
  background: rgba(201,169,110,0.06);
  border: 1px solid rgba(201,169,110,0.2);
  border-radius: var(--radius);
  padding: 12px 14px;
  white-space: pre-wrap;
  line-height: 1.6;
  max-height: 180px;
  overflow-y: auto;
}
.reflection-meta { font-size: 11px; color: var(--text-muted); }

.integration-item {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 16px;
  background: var(--surface);
  border-radius: var(--radius);
  border: 1px solid var(--border);
}

.integration-info { display: flex; align-items: center; gap: 12px; }
.integration-icon {
  width: 36px; height: 36px;
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px;
}

.integration-name { font-size: 13px; font-weight: 600; color: var(--text); }
.integration-desc { font-size: 12px; color: var(--text-muted); margin-top: 2px; }

.status-dot {
  display: flex; align-items: center; gap: 6px;
  font-size: 12px; font-weight: 600;
  font-family: 'Space Mono', monospace;
}

.status-dot::before {
  content: '';
  width: 7px; height: 7px;
  border-radius: 50%;
}

.status-dot.connected { color: #16a34a; }
.status-dot.connected::before { background: #16a34a; box-shadow: 0 0 8px rgba(22,163,74,0.6); animation: pulse 2s infinite; }
.status-dot.disconnected { color: var(--text-muted); }
.status-dot.disconnected::before { background: var(--text-muted); }

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

/* ===================================================
   MODAL
=================================================== */

.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.75);
  z-index: 500;
  display: flex; align-items: center; justify-content: center;
  padding: 24px;
  opacity: 0; pointer-events: none;
  transition: opacity 0.2s;
  backdrop-filter: blur(6px);
}
.modal-overlay.open { opacity: 1; pointer-events: all; }

.modal {
  background: #0C0C0C;
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  width: 100%;
  max-width: 500px;
  box-shadow: var(--shadow);
  transform: scale(0.96) translateY(8px);
  transition: transform 0.2s;
}
.modal-overlay.open .modal { transform: scale(1) translateY(0); }

.modal-header {
  padding: 18px 20px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
}
.modal-title {
  font-family: 'Space Mono', monospace;
  font-size: 12px; font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text);
}
.modal-body { padding: 20px; display: flex; flex-direction: column; gap: 14px; }
.modal-footer { padding: 16px 20px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 8px; }

.import-textarea {
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  padding: 12px;
  font-size: 12px;
  font-family: 'Space Mono', monospace;
  resize: vertical;
  min-height: 140px;
  outline: none;
}
.import-textarea:focus { border-color: rgba(201,169,110,0.35); }

/* ===================================================
   AGENT VIEW
=================================================== */

.agent-view {
  display: flex; flex-direction: column;
  flex: 1; min-height: 0;
  max-width: 740px; width: 100%;
  margin: 0 auto;
}

.agent-messages {
  flex: 1; overflow-y: auto;
  padding: 20px 20px 12px;
  display: flex; flex-direction: column; gap: 14px;
}

.agent-msg { display: flex; flex-direction: column; max-width: 80%; }
.agent-msg.user { align-self: flex-end; align-items: flex-end; }
.agent-msg.assistant { align-self: flex-start; align-items: flex-start; }

.agent-bubble {
  padding: 11px 15px;
  border-radius: 12px;
  font-size: 13px;
  line-height: 1.6;
  white-space: pre-wrap;
  word-break: break-word;
}
.agent-msg.user .agent-bubble {
  background: var(--gold);
  color: #080808;
  font-weight: 600;
  border-bottom-right-radius: 3px;
}
.agent-msg.assistant .agent-bubble {
  background: var(--card);
  border: 1px solid var(--border);
  color: var(--text);
  border-bottom-left-radius: 3px;
}
.agent-time {
  font-size: 10px;
  color: var(--text-muted);
  margin-top: 4px;
  padding: 0 4px;
  font-family: 'Space Mono', monospace;
}

.agent-scrape-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-left: 2px solid var(--teal-light);
  border-radius: var(--radius);
  padding: 13px 16px;
  display: flex; align-items: center; gap: 12px;
  max-width: 340px; font-size: 13px;
}
.agent-scrape-card.done { border-left-color: var(--gold); }
.agent-scrape-card.error { border-left-color: var(--red); }
.agent-scrape-icon { flex-shrink: 0; width: 28px; height: 28px; display: flex; align-items: center; justify-content: center; }
.agent-scrape-label { font-weight: 600; font-size: 12px; }
.agent-scrape-sub { font-size: 11px; color: var(--text-muted); margin-top: 2px; }

.agent-thinking {
  display: flex; align-items: center; gap: 8px;
  color: var(--text-muted); font-size: 12px; padding: 4px 0;
  font-family: 'Space Mono', monospace;
}
.agent-thinking-dots { display: flex; gap: 4px; }
.agent-thinking-dots span {
  width: 5px; height: 5px;
  background: var(--gold);
  border-radius: 50%;
  animation: agentDot 1.2s infinite;
  opacity: 0.4;
}
.agent-thinking-dots span:nth-child(2) { animation-delay: 0.2s; }
.agent-thinking-dots span:nth-child(3) { animation-delay: 0.4s; }
@keyframes agentDot {
  0%,60%,100% { opacity: 0.2; transform: scale(0.8); }
  30% { opacity: 1; transform: scale(1.15); }
}

.agent-input-area {
  padding: 14px 20px;
  border-top: 1px solid var(--border);
  display: flex; gap: 10px; align-items: flex-end;
}

.agent-input {
  flex: 1;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  padding: 10px 14px;
  font-size: 13px;
  resize: none; outline: none;
  line-height: 1.5; max-height: 120px;
  transition: border-color 0.15s;
}
.agent-input::placeholder { color: var(--text-muted); }
.agent-input:focus { border-color: rgba(201,169,110,0.35); }

.agent-send {
  width: 40px; height: 40px;
  border-radius: var(--radius);
  background: var(--gold);
  color: #080808;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  transition: all 0.15s;
}
.agent-send:hover { background: var(--gold-hover); box-shadow: 0 4px 18px var(--gold-glow); }
.agent-send:active { transform: scale(0.95); }
.agent-send:disabled { background: var(--border); color: var(--text-muted); cursor: not-allowed; box-shadow: none; }

.agent-welcome {
  flex: 1; display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 14px; color: var(--text-muted); padding: 32px;
}

.agent-welcome-icon {
  width: 54px; height: 54px;
  background: var(--teal-dim);
  border: 1px solid rgba(42,107,124,0.3);
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  color: var(--teal-light);
  position: relative;
}
/* HUD corners on welcome icon */
.agent-welcome-icon::before {
  content: '';
  position: absolute;
  top: -3px; left: -3px;
  width: 8px; height: 8px;
  border-top: 1px solid var(--teal-light);
  border-left: 1px solid var(--teal-light);
  opacity: 0.7;
}
.agent-welcome-icon svg { width: 24px; height: 24px; }
.agent-welcome h3 {
  font-family: 'Space Mono', monospace;
  font-size: 14px; font-weight: 700;
  color: var(--text); margin: 0;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.agent-welcome p { font-size: 13px; text-align: center; max-width: 320px; line-height: 1.6; }

.agent-suggestions {
  display: flex; flex-wrap: wrap; gap: 8px;
  justify-content: center; margin-top: 6px;
}

.agent-suggestion {
  padding: 7px 14px;
  border: 1px solid var(--border);
  border-radius: 4px;
  font-size: 12px;
  color: var(--text-dim);
  background: var(--card);
  cursor: pointer;
  transition: all 0.15s;
  font-family: 'Space Mono', monospace;
  letter-spacing: 0.04em;
}
.agent-suggestion:hover {
  border-color: rgba(201,169,110,0.3);
  color: var(--gold);
  background: var(--gold-dim);
}

/* ===================================================
   EMPTY / LOADING
=================================================== */

.empty-state {
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  padding: 60px 20px; gap: 12px;
  color: var(--text-muted); text-align: center;
}
.empty-state svg { width: 40px; height: 40px; opacity: 0.15; }
.empty-state p { font-size: 14px; color: var(--text-dim); }
.empty-state small { font-size: 12.5px; }

.spinner {
  width: 28px; height: 28px;
  border: 2px solid rgba(201,169,110,0.1);
  border-top-color: var(--gold);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ===================================================
   TOAST
=================================================== */

.toast-container {
  position: fixed; bottom: 24px; right: 24px;
  z-index: 600;
  display: flex; flex-direction: column; gap: 8px;
  pointer-events: none;
}

.toast {
  background: #111111;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 16px;
  font-size: 13px;
  color: var(--text);
  box-shadow: var(--shadow);
  display: flex; align-items: center; gap: 10px;
  min-width: 240px; max-width: 360px;
  pointer-events: all;
  animation: slideInRight 0.25s ease, fadeOut 0.25s ease 2.8s forwards;
}

.toast-success { border-left: 2px solid var(--gold); }
.toast-error   { border-left: 2px solid var(--red); }
.toast-info    { border-left: 2px solid var(--teal-light); }

.toast-dot { width: 6px; height: 6px; border-radius: 50%; flex-shrink: 0; }
.toast-success .toast-dot { background: var(--gold); }
.toast-error   .toast-dot { background: var(--red); }
.toast-info    .toast-dot { background: var(--teal-light); }

@keyframes slideInRight { from { transform: translateX(20px); opacity: 0; } to { transform: translateX(0); opacity: 1; } }
@keyframes fadeOut      { to { opacity: 0; transform: translateX(8px); } }

/* ===================================================
   RESPONSIVE
=================================================== */

@media (max-width: 1200px) {
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .dashboard-grid { grid-template-columns: 1fr; }
}

@media (max-width: 900px) {
  .drawer { width: 100vw; }
  .settings-layout { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); z-index: 300; }
  .sidebar.open { transform: translateX(0); box-shadow: 4px 0 40px rgba(0,0,0,0.7); }
  .main { margin-left: 0; }
  .hamburger { display: flex; }
  .campaigns-grid { grid-template-columns: 1fr; }

  /* Filters: search full-width, city/sector adaptive */
  .filter-input-sm { width: auto; min-width: 80px; flex: 1; }
  .search-wrap { max-width: 100%; width: 100%; }
  .filters-spacer { display: none; }
}

@media (max-width: 640px) {
  /* Drawer: more compact header on small phones */
  .drawer-header { padding: 13px 14px; }
  .drawer-title { font-size: 13px; }
  .tabs { padding: 0 14px; }
  .tab-btn { padding: 10px 10px; font-size: 11.5px; }
  .chat-input-area { padding: 10px 12px; }

  /* Topbar actions: icon-only on small screens */
  .topbar-right .btn-label { display: none; }
  .topbar-right .btn-secondary { padding: 6px 8px; }
  .topbar-right .btn-primary { padding: 6px 10px; }
}

@media (max-width: 480px) {
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .topbar { padding: 0 12px; gap: 8px; }
  .content { padding: 12px; }
  .filters-bar { gap: 6px; }
  .filter-select { font-size: 12px; }

  /* Modals: scrollable on short phones */
  .modal-overlay { padding: 12px; align-items: flex-start; padding-top: 40px; }
  .modal { max-height: calc(100vh - 80px); display: flex; flex-direction: column; }
  .modal-body { overflow-y: auto; }

  /* Calendar single column */
  .cal-cell { min-height: 48px; font-size: 11px; }
}

/* ===================================================
   CALENDAR
=================================================== */

.calendar-layout {
  display: grid;
  grid-template-columns: 1fr 280px;
  gap: 20px;
  align-items: start;
}

.calendar-main {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.cal-header {
  display: flex; align-items: center; gap: 10px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}

.cal-title {
  font-family: 'Space Mono', monospace;
  font-size: 13px; font-weight: 700;
  letter-spacing: 0.06em;
  color: var(--text); flex: 1; text-align: center;
  text-transform: uppercase;
}

.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); }

.cal-dow {
  padding: 10px 6px;
  text-align: center;
  font-family: 'Space Mono', monospace;
  font-size: 9px; font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  border-bottom: 1px solid var(--border);
  background: #0C0C0C;
}

.cal-cell {
  min-height: 90px; padding: 6px;
  border-right: 1px solid var(--border-light);
  border-bottom: 1px solid var(--border-light);
  display: flex; flex-direction: column; gap: 3px;
  transition: background 0.1s;
}
.cal-cell:nth-child(7n) { border-right: none; }
.cal-cell:hover { background: rgba(201,169,110,0.03); }
.cal-cell.cal-empty { opacity: 0.4; }
.cal-cell.cal-today { background: rgba(201,169,110,0.05); }
.cal-cell.cal-today .cal-day-num {
  background: var(--gold);
  color: #080808;
  width: 22px; height: 22px;
  border-radius: 3px;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700;
}

.cal-day-num {
  font-family: 'Space Mono', monospace;
  font-size: 11px; font-weight: 700;
  color: var(--text-muted);
  margin-bottom: 2px;
  width: 22px; height: 22px;
  display: flex; align-items: center; justify-content: center;
}

.cal-appt {
  background: rgba(201,169,110,0.08);
  border-left: 2px solid var(--gold);
  border-radius: 3px;
  padding: 2px 5px;
  font-size: 11px;
  cursor: pointer;
  display: flex; gap: 4px; align-items: center;
  overflow: hidden;
  transition: background 0.1s;
}
.cal-appt:hover { background: rgba(201,169,110,0.14); }
.cal-appt-confirmed { border-left-color: #16a34a; background: rgba(22,163,74,0.07); }
.cal-appt-done { border-left-color: var(--text-muted); background: rgba(74,69,64,0.2); opacity: 0.5; }
.cal-appt-cancelled { border-left-color: var(--red); background: var(--red-dim); opacity: 0.5; }

.cal-appt-time { color: var(--text-muted); flex-shrink: 0; font-family: 'Space Mono', monospace; font-size: 10px; }
.cal-appt-name { color: var(--text); font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cal-more { font-size: 10px; color: var(--text-muted); padding-left: 4px; }

.calendar-sidebar {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px;
  display: flex; flex-direction: column; gap: 10px;
}

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

.appt-row {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 12px;
  background: var(--surface);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  cursor: pointer;
  transition: border-color 0.15s;
}
.appt-row:hover { border-color: rgba(201,169,110,0.28); }

.appt-row-date { text-align: center; flex-shrink: 0; width: 34px; }
.appt-row-day { font-family: 'Space Mono', monospace; font-size: 18px; font-weight: 700; color: var(--text); line-height: 1; }
.appt-row-mon { font-size: 9px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.08em; font-family: 'Space Mono', monospace; }

.appt-row-info { flex: 1; min-width: 0; }
.appt-row-name { font-size: 13px; font-weight: 700; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.appt-row-meta { font-size: 11px; color: var(--text-muted); margin-top: 2px; }
.appt-row-link { font-size: 11px; color: var(--gold); font-weight: 600; display: block; margin-top: 2px; }

.appt-row-actions { display: flex; gap: 4px; margin-top: 5px; }
.btn-appt-action {
  padding: 2px 7px; font-size: 11px; border-radius: 3px; border: 1px solid; cursor: pointer;
  font-family: inherit; font-weight: 700; line-height: 1.4; transition: background .15s;
}
.btn-confirm { border-color: #16a34a; color: #16a34a; background: transparent; }
.btn-confirm:hover { background: rgba(22,163,74,.14); }
.btn-complete { border-color: #8b5cf6; color: #8b5cf6; background: transparent; }
.btn-complete:hover { background: rgba(139,92,246,.14); }
.btn-cancel { border-color: var(--red); color: var(--red); background: transparent; }
.btn-cancel:hover { background: var(--red-dim); }

@media (max-width: 900px) {
  .calendar-layout { grid-template-columns: 1fr; }
  .cal-cell { min-height: 60px; }
}

/* ===================================================
   PRODUCT CATALOG
=================================================== */

.product-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  display: flex; flex-direction: column; gap: 6px;
}

.product-card-header {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 10px;
}

.product-name { font-size: 13px; font-weight: 700; color: var(--text); font-family: 'Space Mono', monospace; letter-spacing: 0.04em; }
.product-price { font-size: 12px; color: var(--gold); font-weight: 700; margin-top: 2px; font-family: 'Space Mono', monospace; }
.product-desc { font-size: 12px; color: var(--text-dim); line-height: 1.5; }
.product-sectors { font-size: 11px; color: var(--text-muted); }
.product-sectors span { color: var(--text-dim); }
.product-args { font-size: 11px; color: var(--text-muted); }

.product-form {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  display: flex; flex-direction: column; gap: 10px;
  margin-bottom: 4px;
}

/* Toggle switch */
.toggle-wrap { display: flex; align-items: center; cursor: pointer; flex-shrink: 0; }
.toggle-wrap input { display: none; }
.toggle {
  width: 32px; height: 18px;
  background: rgba(201,169,110,0.1);
  border-radius: 9px;
  position: relative;
  transition: background 0.2s;
  border: 1px solid var(--border);
}
.toggle::after {
  content: '';
  position: absolute;
  top: 2px; left: 2px;
  width: 12px; height: 12px;
  border-radius: 50%;
  background: var(--text-muted);
  transition: transform 0.2s;
}
.toggle-wrap input:checked + .toggle { background: rgba(201,169,110,0.2); border-color: rgba(201,169,110,0.4); }
.toggle-wrap input:checked + .toggle::after { transform: translateX(14px); background: var(--gold); }

/* ===================================================
   UTILITY
=================================================== */

.hidden { display: none !important; }
.d-flex { display: flex; }
.align-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-8 { gap: 8px; }
.mt-16 { margin-top: 16px; }
.text-muted { color: var(--text-muted); }
.text-green { color: var(--gold); }

/* ===================================================
   SEGMENTS
=================================================== */

.segment-tabs {
  display: flex; gap: 6px;
  padding-bottom: 14px; margin-bottom: 14px;
  border-bottom: 1px solid var(--border);
  overflow-x: auto; flex-shrink: 0;
  scrollbar-width: none;
}
.segment-tabs::-webkit-scrollbar { display: none; }

.segment-tab {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 5px 14px;
  border-radius: 3px;
  font-family: 'Space Mono', monospace;
  font-size: 10px; font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  cursor: pointer;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-dim);
  white-space: nowrap;
  transition: border-color 0.15s, background 0.15s, color 0.15s;
}
.segment-tab:hover {
  border-color: var(--seg-color, var(--gold));
  color: var(--seg-color, var(--gold));
}
.segment-tab.active {
  background: var(--seg-color, var(--gold));
  border-color: var(--seg-color, var(--gold));
  color: #080808;
}
.segment-count {
  font-size: 10px; font-weight: 700;
  padding: 1px 6px; border-radius: 3px;
  background: rgba(0,0,0,0.2);
}
.segment-tab.active .segment-count { background: rgba(0,0,0,0.25); }
.segment-tab-add {
  color: var(--text-muted); border-style: dashed;
  font-size: 10px; font-weight: 500;
}
.segment-tab-add:hover { border-color: var(--gold); color: var(--gold); }

.segment-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 14px;
  transition: border-color 0.15s;
}
.segment-card:hover { border-color: rgba(201,169,110,0.25); }
.segment-card-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.segment-card-name { font-size: 13px; font-weight: 700; color: var(--text); font-family: 'Space Mono', monospace; }
.segment-card-meta { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--text-dim); margin-top: 2px; }

/* ===================================================
   AUTH — Login screen
=================================================== */

.login-overlay {
  position: fixed; inset: 0;
  background: #0E0E0E;
  display: flex; align-items: center; justify-content: center;
  z-index: 9999;
  /* grid overlay */
  background-image:
    linear-gradient(rgba(201,169,110,0.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(201,169,110,0.025) 1px, transparent 1px);
  background-size: 48px 48px;
}

.login-card {
  background: #111111;
  border: 1px solid rgba(201,169,110,0.22);
  border-radius: var(--radius-xl);
  padding: 40px 36px 36px;
  width: 100%;
  max-width: 380px;
  box-shadow: 0 24px 80px rgba(0,0,0,0.85), 0 0 80px rgba(201,169,110,0.06);
  position: relative;
}

/* HUD corners on login card */
.login-card::before {
  content: '';
  position: absolute; top: 0; left: 0;
  width: 16px; height: 16px;
  border-top: 1px solid var(--gold);
  border-left: 1px solid var(--gold);
  opacity: 0.5;
}
.login-card::after {
  content: '';
  position: absolute; bottom: 0; right: 0;
  width: 16px; height: 16px;
  border-bottom: 1px solid var(--gold);
  border-right: 1px solid var(--gold);
  opacity: 0.5;
}

.login-logo {
  display: flex; align-items: center;
  margin-bottom: 32px;
}
.login-logo span {
  font-family: 'Space Mono', monospace;
  font-size: 20px; font-weight: 700;
  color: var(--gold);
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.login-card h2 {
  font-family: 'Space Mono', monospace;
  font-size: 14px; font-weight: 700;
  color: var(--text); margin: 0 0 4px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.login-subtitle {
  font-size: 12px;
  color: var(--text-muted);
  margin: 0 0 28px;
}

.login-error {
  background: rgba(239,68,68,0.08);
  border: 1px solid rgba(239,68,68,0.25);
  color: #ef4444;
  font-size: 12px;
  border-radius: var(--radius);
  padding: 10px 12px;
  margin-bottom: 16px;
}

.login-field { margin-bottom: 16px; }
.login-field label {
  display: block;
  font-family: 'Space Mono', monospace;
  font-size: 9px; font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.14em;
  margin-bottom: 8px;
}
.login-field input {
  width: 100%;
  padding: 10px 12px;
  background: #0A0A0A;
  border: 1px solid rgba(201,169,110,0.15);
  border-radius: var(--radius);
  color: var(--text);
  font-size: 13px;
  outline: none;
  box-sizing: border-box;
  transition: border-color .15s;
}
.login-field input:focus { border-color: rgba(201,169,110,0.4); }

.login-btn {
  width: 100%; padding: 12px;
  background: var(--gold);
  color: #080808;
  font-family: 'Space Mono', monospace;
  font-size: 11px; font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  border: none; border-radius: var(--radius);
  cursor: pointer; margin-top: 8px;
  transition: background .15s, box-shadow .15s;
}
.login-btn:hover { background: var(--gold-hover); box-shadow: 0 4px 20px var(--gold-glow); }
.login-btn:disabled { opacity: .4; cursor: not-allowed; }

.logout-btn {
  color: var(--text-muted) !important;
  padding: 6px 8px !important;
  margin-left: 4px;
}
.logout-btn:hover { color: var(--red) !important; background: rgba(239,68,68,0.08) !important; }

/* ===================================================
   BOT TOGGLE
=================================================== */

.bot-toggle-btn {
  display: flex; align-items: center; gap: 5px;
  padding: 4px 10px;
  border-radius: 3px;
  border: 1px solid var(--border);
  background: var(--card);
  cursor: pointer;
  font-family: 'Space Mono', monospace;
  font-size: 9px; font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
  transition: all .15s;
  white-space: nowrap;
}
.bot-toggle-btn:hover { border-color: rgba(201,169,110,0.25); color: var(--text-dim); }
.bot-toggle-btn.bot-on  { border-color: rgba(22,163,74,0.3); color: #16a34a; }
.bot-toggle-btn.bot-off { border-color: rgba(232,213,168,0.25); color: #E8D5A8; }

.bot-toggle-dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  display: inline-block; flex-shrink: 0;
}

.bot-paused-banner {
  display: flex; align-items: center; gap: 7px;
  padding: 8px 14px;
  background: rgba(232,213,168,0.06);
  border-bottom: 1px solid rgba(232,213,168,0.15);
  font-size: 11px; color: #E8D5A8; font-weight: 500;
  font-family: 'Space Mono', monospace;
  letter-spacing: 0.04em;
}
.bot-paused-banner.hidden { display: none; }
.bot-paused-resume {
  margin-left: auto;
  background: none;
  border: 1px solid rgba(232,213,168,0.3);
  color: #E8D5A8;
  border-radius: var(--radius);
  padding: 2px 10px;
  font-size: 9px; cursor: pointer; font-weight: 700;
  font-family: 'Space Mono', monospace;
  text-transform: uppercase; letter-spacing: 0.08em;
}
.bot-paused-resume:hover { background: rgba(232,213,168,0.08); }

.lead-bot-dot {
  display: inline-block;
  width: 6px; height: 6px;
  border-radius: 50%;
  margin-right: 6px; flex-shrink: 0;
  vertical-align: middle; margin-bottom: 1px;
}

/* ===================================================
   IMAGE PICKER
=================================================== */

.img-attach-btn { flex-shrink: 0; }

.img-picker {
  position: absolute;
  bottom: calc(100% + 8px);
  left: 16px; right: 16px;
  background: #0C0C0C;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  z-index: 50;
  overflow: hidden;
}

.img-picker-tabs { display: flex; border-bottom: 1px solid var(--border); }

.img-tab {
  flex: 1; padding: 9px 14px;
  font-family: 'Space Mono', monospace;
  font-size: 10px; font-weight: 700;
  letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--text-muted);
  background: none; border: none; cursor: pointer;
  transition: color 0.15s, background 0.15s;
}
.img-tab:hover { color: var(--text); background: var(--card-hover); }
.img-tab.active { color: var(--gold); border-bottom: 2px solid var(--gold); margin-bottom: -1px; }

.img-drop-zone {
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 6px; padding: 20px; margin: 12px;
  border: 1px dashed rgba(201,169,110,0.2);
  border-radius: var(--radius);
  cursor: pointer; color: var(--text-muted); font-size: 12px;
  transition: border-color 0.15s, background 0.15s;
}
.img-drop-zone:hover { border-color: rgba(201,169,110,0.4); background: var(--gold-dim); color: var(--gold); }
.img-drop-zone svg { width: 22px; height: 22px; opacity: 0.4; }

.img-url-body { padding: 12px; }
#img-tab-url-body { padding: 12px; }

.img-preview-section { padding: 0 12px 12px; display: flex; flex-direction: column; gap: 8px; }

.chat-img-thumb {
  max-width: 200px; max-height: 180px;
  border-radius: 6px; display: block;
  cursor: zoom-in; object-fit: cover;
  border: 1px solid var(--border);
}

.chat-img-caption { font-size: 12px; color: var(--text-dim); margin-top: 4px; line-height: 1.4; }
.bubble-img { padding: 6px !important; }

#img-preview-wrap { padding: 0 12px 12px; display: flex; flex-direction: column; gap: 8px; }

.img-preview-thumb {
  width: 100%; max-height: 140px;
  object-fit: cover; border-radius: var(--radius);
  border: 1px solid var(--border); display: block;
}

.img-picker-actions { display: flex; gap: 8px; margin-top: 4px; }

/* ─── Queue Panel ─────────────────────────────────── */
.queue-toggle-btn {
  display: flex; align-items: center; gap: 6px;
  padding: 6px 12px; border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--card); color: var(--text);
  font-size: 12px; font-weight: 600; cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
  position: relative; white-space: nowrap;
}
.queue-toggle-btn:hover { background: var(--surface); border-color: var(--green); }
.queue-toggle-btn.active { border-color: var(--green); color: var(--green); }
.queue-toggle-badge {
  background: var(--green); color: #fff;
  border-radius: 10px; padding: 1px 6px;
  font-size: 10px; font-weight: 700; line-height: 1.5;
  min-width: 18px; text-align: center;
}
.queue-toggle-badge.has-failed { background: #ef4444; }

.queue-panel {
  position: fixed; top: 0; right: -380px; width: 370px;
  height: 100vh; background: var(--card);
  border-left: 1px solid var(--border);
  z-index: 400; display: flex; flex-direction: column;
  transition: right 0.25s cubic-bezier(.4,0,.2,1);
  box-shadow: -4px 0 24px rgba(0,0,0,0.18);
}
.queue-panel.open { right: 0; }

.queue-panel-overlay {
  display: none; position: fixed; inset: 0; z-index: 399;
  background: rgba(0,0,0,0.25);
}
.queue-panel.open ~ .queue-panel-overlay { display: block; }

.queue-panel-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 16px; border-bottom: 1px solid var(--border);
  background: var(--surface); flex-shrink: 0;
}
.queue-panel-badge {
  background: var(--green); color: #fff;
  border-radius: 10px; padding: 1px 7px;
  font-size: 10px; font-weight: 700;
  min-width: 20px; text-align: center;
}
.queue-panel-badge.empty { background: var(--border); color: var(--text-muted); }
.queue-panel-badge.has-failed { background: #ef4444; }

.queue-panel-body {
  flex: 1; overflow-y: auto; padding: 0;
}

.queue-item {
  padding: 11px 16px; border-bottom: 1px solid var(--border);
  cursor: default; transition: background 0.1s;
  display: flex; flex-direction: column; gap: 4px;
}
.queue-item:hover { background: var(--surface); }
.queue-item-top { display: flex; align-items: center; gap: 8px; }
.queue-item-name {
  font-size: 13px; font-weight: 600; color: var(--text);
  flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.queue-item-status {
  font-size: 10px; font-weight: 700; padding: 2px 7px;
  border-radius: 8px; white-space: nowrap; flex-shrink: 0;
}
.qs-pending  { background: #f59e0b22; color: #f59e0b; border: 1px solid #f59e0b44; }
.qs-sent     { background: #22c55e22; color: #22c55e; border: 1px solid #22c55e44; }
.qs-failed   { background: #ef444422; color: #ef4444; border: 1px solid #ef444444; }
.qs-cancelled{ background: var(--border); color: var(--text-muted); border: 1px solid transparent; }

.queue-item-campaign {
  font-size: 10px; color: var(--text-muted);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.queue-item-preview {
  font-size: 11px; color: var(--text-dim); line-height: 1.4;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.queue-item-time { font-size: 10px; color: var(--text-muted); }
.queue-item-cancel {
  background: none; border: none; color: var(--text-muted);
  cursor: pointer; padding: 2px 4px; border-radius: 4px;
  font-size: 14px; line-height: 1; flex-shrink: 0;
}
.queue-item-cancel:hover { color: #ef4444; background: #ef444415; }

.queue-section-divider {
  padding: 6px 16px; font-size: 10px; font-weight: 700;
  color: var(--text-muted); background: var(--bg);
  text-transform: uppercase; letter-spacing: 0.08em;
  border-bottom: 1px solid var(--border);
}
