/* ═══════════════════════════════════════════
   PropLeads CRM — Style
   Aesthetic: Refined luxury real estate
   Font: Playfair Display + DM Sans
════════════════════════════════════════════ */

:root {
  --bg: #0f0f0f;
  --surface: #161616;
  --surface-2: #1e1e1e;
  --surface-3: #252525;
  --border: #2a2a2a;
  --border-light: #333;
  --text: #f0ece4;
  --text-muted: #888;
  --text-dim: #555;
  --accent: #c9a96e;
  --accent-dark: #a8813e;
  --accent-light: #e8c98a;
  --gold: #d4a843;
  --green: #4caf7d;
  --red: #e05c5c;
  --blue: #5c9fe0;
  --sidebar-w: 240px;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 4px 24px rgba(0,0,0,0.4);
  --shadow-lg: 0 8px 48px rgba(0,0,0,0.6);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
  font-family: 'DM Sans', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  overflow-x: hidden;
}

/* ═══ UTILITIES ═══ */
.hidden { display: none !important; }

/* ═══ LOGIN SCREEN ═══ */
.login-screen {
  position: fixed; inset: 0;
  display: flex; align-items: center; justify-content: center;
  z-index: 1000;
}

.login-bg {
  position: absolute; inset: 0;
}

.login-bg-img {
  position: absolute; inset: 0;
  background:
    radial-gradient(ellipse at 20% 50%, rgba(201,169,110,0.12) 0%, transparent 60%),
    radial-gradient(ellipse at 80% 20%, rgba(92,159,224,0.08) 0%, transparent 50%),
    #0a0a0a;
}

.login-bg-img::before {
  content: '';
  position: absolute; inset: 0;
  background-image:
    repeating-linear-gradient(0deg, transparent, transparent 60px, rgba(255,255,255,0.015) 60px, rgba(255,255,255,0.015) 61px),
    repeating-linear-gradient(90deg, transparent, transparent 60px, rgba(255,255,255,0.015) 60px, rgba(255,255,255,0.015) 61px);
}

.login-overlay {
  position: absolute; inset: 0;
  background: rgba(0,0,0,0.3);
  backdrop-filter: blur(1px);
}

.login-card {
  position: relative; z-index: 2;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 48px 44px;
  width: 440px;
  max-width: calc(100vw - 32px);
  box-shadow: var(--shadow-lg), 0 0 0 1px rgba(201,169,110,0.1);
  animation: slideUp 0.5s cubic-bezier(0.16,1,0.3,1);
}

@keyframes slideUp {
  from { opacity: 0; transform: translateY(24px); }
  to { opacity: 1; transform: translateY(0); }
}

.login-brand {
  display: flex; align-items: center; gap: 10px;
  margin-bottom: 32px;
}

.brand-icon {
  font-size: 22px; color: var(--accent);
  line-height: 1;
}

.brand-name {
  font-family: 'Playfair Display', serif;
  font-size: 22px; font-weight: 700;
  color: var(--text);
  letter-spacing: 0.02em;
}

.login-title {
  font-family: 'Playfair Display', serif;
  font-size: 32px; font-weight: 600;
  color: var(--text);
  margin-bottom: 8px;
}

.login-sub {
  color: var(--text-muted);
  font-size: 14px;
  margin-bottom: 28px;
}

.login-error {
  background: rgba(224,92,92,0.15);
  border: 1px solid rgba(224,92,92,0.3);
  color: #e07070;
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  margin-bottom: 20px;
}

.form-group {
  margin-bottom: 18px;
}

.form-group label {
  display: block;
  font-size: 12px; font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase; letter-spacing: 0.08em;
  margin-bottom: 8px;
}

.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-family: 'DM Sans', sans-serif;
  font-size: 14px;
  padding: 12px 14px;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(201,169,110,0.12);
}

.form-group select option { background: var(--surface-2); }

.pw-wrap { position: relative; }
.pw-wrap input { padding-right: 44px; }
.pw-toggle {
  position: absolute; right: 12px; top: 50%; transform: translateY(-50%);
  background: none; border: none; cursor: pointer;
  font-size: 16px; opacity: 0.5;
  transition: opacity 0.2s;
}
.pw-toggle:hover { opacity: 1; }

.login-meta {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 24px;
}

.remember-me {
  display: flex; align-items: center; gap: 8px;
  font-size: 13px; color: var(--text-muted); cursor: pointer;
}
.remember-me input { accent-color: var(--accent); }

.forgot-link {
  font-size: 13px; color: var(--accent);
  text-decoration: none;
}
.forgot-link:hover { text-decoration: underline; }

.login-btn {
  width: 100%;
  background: linear-gradient(135deg, var(--accent), var(--accent-dark));
  color: #0a0a0a;
  font-family: 'DM Sans', sans-serif;
  font-size: 15px; font-weight: 600;
  border: none; border-radius: var(--radius-sm);
  padding: 14px;
  cursor: pointer;
  transition: opacity 0.2s, transform 0.15s;
  letter-spacing: 0.02em;
}

.login-btn:hover { opacity: 0.9; transform: translateY(-1px); }
.login-btn:active { transform: translateY(0); }

.login-hint {
  text-align: center;
  font-size: 12px;
  color: var(--text-dim);
  margin-top: 16px;
}

/* ═══ APP SHELL ═══ */
.app-shell {
  display: flex;
  min-height: 100vh;
}

/* ═══ SIDEBAR ═══ */
.sidebar {
  width: var(--sidebar-w);
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column;
  position: fixed; top: 0; left: 0; bottom: 0;
  z-index: 100;
  transition: transform 0.3s cubic-bezier(0.16,1,0.3,1);
}

.sidebar-brand {
  display: flex; align-items: center; gap: 10px;
  padding: 24px 20px 20px;
  border-bottom: 1px solid var(--border);
}

.sidebar-nav {
  padding: 16px 12px;
  flex: 1;
  overflow-y: auto;
}

.nav-item {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 14px;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-size: 14px; font-weight: 500;
  cursor: pointer; text-decoration: none;
  transition: background 0.15s, color 0.15s;
  position: relative;
  margin-bottom: 2px;
}

.nav-item:hover { background: var(--surface-2); color: var(--text); }
.nav-item.active {
  background: rgba(201,169,110,0.12);
  color: var(--accent);
}
.nav-item.active .nav-icon { color: var(--accent); }

.nav-icon { font-size: 16px; width: 18px; text-align: center; }

.nav-badge {
  margin-left: auto;
  background: var(--accent);
  color: #0a0a0a;
  font-size: 10px; font-weight: 700;
  padding: 2px 7px;
  border-radius: 20px;
}

.sidebar-bottom {
  padding: 12px;
  border-top: 1px solid var(--border);
}

.sidebar-user {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 10px;
  margin-top: 4px;
}

.user-avatar {
  width: 34px; height: 34px;
  background: linear-gradient(135deg, var(--accent), var(--accent-dark));
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 700; color: #0a0a0a;
  flex-shrink: 0;
}

.user-info { flex: 1; overflow: hidden; }
.user-name { display: block; font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-role { display: block; font-size: 11px; color: var(--text-dim); }

.logout-btn {
  background: none; border: none; cursor: pointer;
  color: var(--text-dim); font-size: 18px;
  transition: color 0.2s;
}
.logout-btn:hover { color: var(--red); }

/* ═══ MAIN CONTENT ═══ */
.main-content {
  margin-left: var(--sidebar-w);
  flex: 1;
  min-height: 100vh;
  display: flex; flex-direction: column;
}

/* ═══ TOP BAR ═══ */
.topbar {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 0 28px;
  height: 64px;
  display: flex; align-items: center; gap: 16px;
  position: sticky; top: 0; z-index: 50;
}

.menu-toggle {
  display: none;
  background: none; border: none; cursor: pointer;
  color: var(--text); font-size: 20px;
}

.topbar-title {
  font-family: 'Playfair Display', serif;
  font-size: 18px; font-weight: 600;
  flex: 1;
}

.topbar-actions { display: flex; align-items: center; gap: 14px; }

.action-btn {
  background: linear-gradient(135deg, var(--accent), var(--accent-dark));
  color: #0a0a0a;
  font-family: 'DM Sans', sans-serif;
  font-size: 13px; font-weight: 600;
  border: none; border-radius: 8px;
  padding: 9px 18px;
  cursor: pointer;
  transition: opacity 0.2s, transform 0.15s;
  white-space: nowrap;
}
.action-btn:hover { opacity: 0.88; transform: translateY(-1px); }

.notif-btn {
  position: relative;
  font-size: 20px; cursor: pointer; user-select: none;
}
.notif-dot {
  position: absolute; top: 0; right: -2px;
  width: 8px; height: 8px;
  background: var(--red);
  border-radius: 50%;
  border: 2px solid var(--surface);
}

.notif-panel {
  position: absolute; right: 0; top: 48px;
  width: 300px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  z-index: 200;
}
.notif-header {
  padding: 14px 16px 10px;
  font-size: 12px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.1em;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
}
.notif-item {
  padding: 12px 16px;
  font-size: 13px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
}
.notif-item:hover { background: var(--surface-2); }
.notif-item:last-child { border-bottom: none; }

/* ═══ PAGES ═══ */
.page { display: none; padding: 28px 32px; }
.page.active { display: block; }

.page-heading {
  margin-bottom: 28px;
}
.page-heading h2 {
  font-family: 'Playfair Display', serif;
  font-size: 26px; font-weight: 600;
  margin-bottom: 4px;
}
.page-heading p { color: var(--text-muted); font-size: 14px; }

.page-heading.between {
  display: flex; align-items: center; justify-content: space-between;
}

/* ═══ KPI CARDS ═══ */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}

.kpi-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px 24px;
  transition: transform 0.2s, box-shadow 0.2s;
}
.kpi-card:hover { transform: translateY(-2px); box-shadow: var(--shadow); }

.kpi-card.accent {
  background: linear-gradient(135deg, rgba(201,169,110,0.15), rgba(201,169,110,0.05));
  border-color: rgba(201,169,110,0.25);
}

.kpi-label {
  font-size: 12px; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--text-muted);
  margin-bottom: 10px;
}

.kpi-value {
  font-family: 'Playfair Display', serif;
  font-size: 36px; font-weight: 700;
  color: var(--text);
  line-height: 1;
  margin-bottom: 8px;
}
.kpi-card.accent .kpi-value { color: var(--accent); }

.kpi-change { font-size: 12px; }
.kpi-change.pos { color: var(--green); }
.kpi-change.neg { color: var(--red); }

/* ═══ DASHBOARD GRID ═══ */
.dash-grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr;
  gap: 16px;
}

.dash-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px 24px;
}
.dash-card.wide { grid-column: span 1; }
.dash-card.full-width { grid-column: span 3; }
.dash-card.mt { margin-top: 16px; }

.card-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 18px;
}
.card-header h3 {
  font-family: 'Playfair Display', serif;
  font-size: 16px; font-weight: 600;
}

.view-all-btn {
  background: none; border: none; cursor: pointer;
  color: var(--accent); font-size: 13px;
  font-family: 'DM Sans', sans-serif;
}
.view-all-btn:hover { text-decoration: underline; }

/* Pipeline bars */
.pipeline-bars { display: flex; flex-direction: column; gap: 12px; }
.pipe-row { display: flex; align-items: center; gap: 12px; }
.pipe-label { width: 80px; font-size: 12px; color: var(--text-muted); flex-shrink: 0; }
.pipe-bar-wrap { flex: 1; background: var(--surface-2); border-radius: 4px; height: 28px; overflow: hidden; }
.pipe-bar {
  background: linear-gradient(90deg, var(--accent), var(--gold));
  height: 100%; border-radius: 4px;
  display: flex; align-items: center; padding-left: 10px;
  font-size: 12px; font-weight: 600; color: #0a0a0a;
  transition: width 1s cubic-bezier(0.16,1,0.3,1);
}
.pipe-bar.closed { background: linear-gradient(90deg, var(--green), #3a9967); }

/* Donut chart */
.donut-wrap { display: flex; align-items: center; gap: 20px; }
.donut-svg { width: 120px; height: 120px; flex-shrink: 0; }
.donut-legend { font-size: 12px; color: var(--text-muted); }
.donut-legend div { display: flex; align-items: center; gap: 6px; margin-bottom: 6px; }
.donut-legend span { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; display: inline-block; }

/* Activity list */
.activity-list { display: flex; flex-direction: column; gap: 14px; }
.act-item { display: flex; gap: 12px; align-items: flex-start; font-size: 13px; }
.act-item strong { font-size: 13px; }
.act-item small { color: var(--text-muted); }
.act-dot {
  width: 10px; height: 10px; border-radius: 50%;
  flex-shrink: 0; margin-top: 4px;
}
.act-dot.new { background: var(--accent); }
.act-dot.call { background: var(--blue); }
.act-dot.closed { background: var(--green); }
.act-dot.show { background: var(--gold); }

/* ═══ TABLE ═══ */
.table-wrap { overflow-x: auto; }

table {
  width: 100%; border-collapse: collapse;
  font-size: 13px;
}
thead th {
  text-align: left;
  padding: 10px 14px;
  font-size: 11px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
tbody tr {
  border-bottom: 1px solid var(--border);
  transition: background 0.15s;
  cursor: pointer;
}
tbody tr:hover { background: var(--surface-2); }
tbody td { padding: 12px 14px; vertical-align: middle; }

.status-pill {
  display: inline-flex; align-items: center;
  padding: 3px 10px; border-radius: 20px;
  font-size: 11px; font-weight: 600;
  white-space: nowrap;
}
.status-New { background: rgba(92,159,224,0.15); color: var(--blue); }
.status-Contacted { background: rgba(201,169,110,0.15); color: var(--accent); }
.status-Showing { background: rgba(212,168,67,0.15); color: var(--gold); }
.status-Offer { background: rgba(76,175,125,0.2); color: var(--green); }
.status-Closed { background: rgba(76,175,125,0.3); color: #5ee0a0; }
.status-Lost { background: rgba(224,92,92,0.15); color: var(--red); }

.type-pill {
  display: inline-flex; align-items: center;
  padding: 2px 8px; border-radius: 4px;
  font-size: 11px; font-weight: 600;
  background: var(--surface-3);
  color: var(--text-muted);
}

.table-actions {
  display: flex; gap: 8px;
}
.tbl-btn {
  background: none; border: 1px solid var(--border);
  border-radius: 6px; padding: 5px 10px;
  font-size: 11px; cursor: pointer; color: var(--text-muted);
  transition: all 0.15s;
}
.tbl-btn:hover { border-color: var(--accent); color: var(--accent); }
.tbl-btn.danger:hover { border-color: var(--red); color: var(--red); }

/* ═══ FILTERS BAR ═══ */
.filters-bar {
  display: flex; gap: 12px; flex-wrap: wrap;
  margin-bottom: 20px;
}
.filters-bar input,
.filters-bar select {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-family: 'DM Sans', sans-serif;
  font-size: 13px;
  padding: 9px 12px;
  outline: none;
  transition: border-color 0.2s;
}
.filters-bar input:focus,
.filters-bar select:focus { border-color: var(--accent); }
.filters-bar input { min-width: 240px; flex: 1; }
.filters-bar select option { background: var(--surface); }

/* ═══ KANBAN ═══ */
.kanban-board {
  display: flex; gap: 16px;
  overflow-x: auto; padding-bottom: 16px;
}
.kanban-col {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  min-width: 230px;
  flex-shrink: 0;
}
.kanban-col-header {
  padding: 14px 16px 10px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
}
.kanban-col-title { font-size: 13px; font-weight: 700; letter-spacing: 0.04em; }
.kanban-col-count {
  background: var(--surface-3);
  border-radius: 20px; padding: 2px 8px;
  font-size: 11px; color: var(--text-muted);
}
.kanban-cards { padding: 12px; display: flex; flex-direction: column; gap: 8px; min-height: 80px; }
.kanban-card {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 13px 14px;
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s, border-color 0.15s;
}
.kanban-card:hover { transform: translateY(-2px); box-shadow: var(--shadow); border-color: var(--border-light); }
.kanban-card-name { font-size: 13px; font-weight: 600; margin-bottom: 4px; }
.kanban-card-meta { font-size: 11px; color: var(--text-muted); }
.kanban-card-budget { font-size: 12px; color: var(--accent); margin-top: 6px; font-weight: 600; }

/* ═══ PROPERTY GRID ═══ */
.property-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 20px;
}
.property-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  transition: transform 0.2s, box-shadow 0.2s;
}
.property-card:hover { transform: translateY(-3px); box-shadow: var(--shadow); }
.property-img {
  height: 160px;
  background: var(--surface-2);
  position: relative;
  overflow: hidden;
  display: flex; align-items: center; justify-content: center;
  font-size: 48px;
}
.property-img-overlay {
  position: absolute; inset: 0;
  background: linear-gradient(to bottom, transparent 40%, rgba(0,0,0,0.6));
}
.property-badge {
  position: absolute; top: 12px; left: 12px;
  background: var(--accent); color: #0a0a0a;
  font-size: 10px; font-weight: 700;
  padding: 3px 8px; border-radius: 20px;
  text-transform: uppercase; letter-spacing: 0.05em;
}
.property-body { padding: 16px; }
.property-price {
  font-family: 'Playfair Display', serif;
  font-size: 20px; font-weight: 700;
  color: var(--accent);
  margin-bottom: 4px;
}
.property-address { font-size: 13px; font-weight: 500; margin-bottom: 4px; }
.property-meta { font-size: 12px; color: var(--text-muted); margin-bottom: 12px; }
.property-tags { display: flex; gap: 6px; flex-wrap: wrap; }
.property-tag {
  background: var(--surface-2);
  border: 1px solid var(--border);
  font-size: 11px; color: var(--text-muted);
  padding: 3px 8px; border-radius: 4px;
}

/* ═══ CALENDAR ═══ */
.calendar-wrap {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
}
.calendar-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 20px;
}
.calendar-header h3 {
  font-family: 'Playfair Display', serif;
  font-size: 20px;
}
.cal-nav {
  background: var(--surface-2); border: 1px solid var(--border);
  color: var(--text); border-radius: 6px; padding: 6px 12px;
  cursor: pointer; font-size: 14px;
}
.calendar-grid { display: grid; grid-template-columns: repeat(7,1fr); gap: 2px; }
.cal-day-header {
  text-align: center;
  font-size: 11px; font-weight: 700;
  color: var(--text-muted); text-transform: uppercase;
  padding: 8px 0; letter-spacing: 0.06em;
}
.cal-day {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 6px; min-height: 72px;
  padding: 6px;
  cursor: pointer;
  transition: background 0.15s;
}
.cal-day:hover { background: var(--surface-3); }
.cal-day.today { border-color: var(--accent); }
.cal-day.other-month { opacity: 0.3; }
.cal-num {
  font-size: 12px; font-weight: 600;
  margin-bottom: 4px;
}
.cal-day.today .cal-num { color: var(--accent); }
.cal-event {
  background: rgba(201,169,110,0.2);
  border-left: 2px solid var(--accent);
  font-size: 10px; padding: 2px 4px;
  border-radius: 2px; margin-bottom: 2px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

/* ═══ REPORTS ═══ */
.reports-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}
.reports-grid .dash-card.wide { grid-column: span 2; }

.bar-chart {
  display: flex; align-items: flex-end; gap: 8px;
  height: 140px;
}
.bar-item {
  flex: 1; display: flex; flex-direction: column; align-items: center; gap: 4px;
}
.bar-fill {
  width: 100%;
  background: linear-gradient(to top, var(--accent), var(--gold));
  border-radius: 4px 4px 0 0;
  min-height: 4px;
}
.bar-label { font-size: 10px; color: var(--text-muted); }

.report-stat { margin-bottom: 16px; }
.big-num {
  display: block;
  font-family: 'Playfair Display', serif;
  font-size: 32px; font-weight: 700;
  color: var(--accent);
}
.big-label { font-size: 12px; color: var(--text-muted); }

.agent-table table { font-size: 13px; }

/* ═══ SETTINGS ═══ */
.settings-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 20px;
}
.settings-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
}
.settings-card h3 {
  font-family: 'Playfair Display', serif;
  font-size: 16px; font-weight: 600;
  margin-bottom: 18px;
}
.settings-hint { font-size: 13px; color: var(--text-muted); margin-bottom: 14px; }

.toggle-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
  font-size: 14px;
  cursor: pointer;
}
.toggle-row:last-of-type { border-bottom: none; }
.toggle-cb { accent-color: var(--accent); width: 18px; height: 18px; }

.source-tag {
  display: inline-block;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 5px 14px;
  font-size: 12px;
  margin: 4px 4px 4px 0;
  cursor: pointer;
  transition: all 0.15s;
}
.source-tag.active { border-color: var(--green); color: var(--green); }
.source-tag:not(.active):hover { border-color: var(--accent); color: var(--accent); }

.save-btn {
  background: linear-gradient(135deg, var(--accent), var(--accent-dark));
  color: #0a0a0a;
  font-family: 'DM Sans', sans-serif;
  font-size: 13px; font-weight: 600;
  border: none; border-radius: 8px;
  padding: 10px 22px;
  cursor: pointer;
  margin-top: 16px;
  transition: opacity 0.2s;
}
.save-btn:hover { opacity: 0.88; }

/* ═══ MODAL ═══ */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.7);
  backdrop-filter: blur(4px);
  z-index: 500;
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
}

.modal-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  width: 600px; max-width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
  animation: slideUp 0.3s cubic-bezier(0.16,1,0.3,1);
}

.modal-header {
  padding: 22px 24px 16px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
}
.modal-header h3 {
  font-family: 'Playfair Display', serif;
  font-size: 18px; font-weight: 600;
}
.modal-close {
  background: none; border: none; cursor: pointer;
  color: var(--text-muted); font-size: 16px;
}
.modal-close:hover { color: var(--text); }

.modal-body { padding: 20px 24px; }

.form-row {
  display: grid; grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--border);
  display: flex; align-items: center; justify-content: flex-end;
  gap: 12px;
}

.cancel-btn {
  background: none;
  border: 1px solid var(--border);
  color: var(--text-muted);
  font-family: 'DM Sans', sans-serif;
  font-size: 13px; font-weight: 500;
  border-radius: 8px;
  padding: 10px 20px;
  cursor: pointer;
  transition: all 0.15s;
}
.cancel-btn:hover { border-color: var(--text-muted); color: var(--text); }

/* ═══ DRAWER ═══ */
.drawer-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.5);
  backdrop-filter: blur(2px);
  z-index: 400;
  display: flex; justify-content: flex-end;
}

.lead-drawer {
  background: var(--surface);
  border-left: 1px solid var(--border);
  width: 400px; max-width: 100%;
  height: 100%;
  overflow-y: auto;
  animation: slideInRight 0.3s cubic-bezier(0.16,1,0.3,1);
}

@keyframes slideInRight {
  from { transform: translateX(100%); }
  to { transform: translateX(0); }
}

.drawer-header {
  padding: 20px 20px 16px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  position: sticky; top: 0;
  background: var(--surface);
}
.drawer-header h3 {
  font-family: 'Playfair Display', serif;
  font-size: 18px;
}
.drawer-header button {
  background: none; border: none; cursor: pointer;
  color: var(--text-muted); font-size: 16px;
}

.drawer-body { padding: 20px; }

.drawer-section { margin-bottom: 22px; }
.drawer-section-title {
  font-size: 11px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--text-muted); margin-bottom: 12px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--border);
}

.drawer-field { margin-bottom: 12px; }
.drawer-field-label { font-size: 11px; color: var(--text-muted); margin-bottom: 3px; }
.drawer-field-value { font-size: 14px; font-weight: 500; }

.drawer-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 20px; }
.drawer-btn {
  flex: 1;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text);
  font-family: 'DM Sans', sans-serif;
  font-size: 13px; font-weight: 500;
  border-radius: 8px; padding: 10px;
  cursor: pointer; text-align: center;
  transition: all 0.15s;
}
.drawer-btn:hover { border-color: var(--accent); color: var(--accent); }
.drawer-btn.primary {
  background: linear-gradient(135deg, var(--accent), var(--accent-dark));
  color: #0a0a0a; border: none;
}
.drawer-btn.primary:hover { opacity: 0.88; }

/* ═══ TOAST ═══ */
.toast {
  position: fixed; bottom: 28px; right: 28px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 3px solid var(--green);
  color: var(--text);
  padding: 14px 20px;
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-lg);
  font-size: 13px;
  z-index: 9999;
  animation: slideUp 0.3s ease;
  max-width: 300px;
}

/* ═══ SCROLLBAR ═══ */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 20px; }
::-webkit-scrollbar-thumb:hover { background: var(--border-light); }

/* ═══ RESPONSIVE ═══ */
@media (max-width: 1100px) {
  .kpi-grid { grid-template-columns: repeat(2,1fr); }
  .dash-grid { grid-template-columns: 1fr 1fr; }
  .dash-card.full-width { grid-column: span 2; }
  .reports-grid { grid-template-columns: 1fr; }
  .reports-grid .dash-card.wide { grid-column: span 1; }
}

@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
  }
  .sidebar.open { transform: translateX(0); }
  .main-content { margin-left: 0; }
  .menu-toggle { display: block; }
  .page { padding: 20px 16px; }
  .kpi-grid { grid-template-columns: repeat(2,1fr); gap: 10px; }
  .dash-grid { grid-template-columns: 1fr; }
  .dash-card.full-width, .dash-card.wide { grid-column: span 1; }
  .form-row { grid-template-columns: 1fr; }
  .settings-grid { grid-template-columns: 1fr; }
  .page-heading.between { flex-direction: column; align-items: flex-start; gap: 12px; }
  .filters-bar { flex-direction: column; }
  .filters-bar input { min-width: unset; }
}
