:root {
  --bg-primary: #0a0d14;
  --bg-secondary: #111622;
  --bg-card: #161c2d;
  --bg-card-hover: #1c243a;
  --border: #232d42;
  --border-focus: #3b82f6;
  
  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  
  --accent-blue: #3b82f6;
  --accent-cyan: #06b6d4;
  --accent-gold: #f59e0b;
  --accent-green: #10b981;
  --accent-red: #ef4444;
  --accent-purple: #8b5cf6;
  
  --font-sans: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
  
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-xl: 20px;
  
  --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.4);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.5);
  --shadow-lg: 0 10px 30px rgba(0, 0, 0, 0.7);
}

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

body {
  background-color: var(--bg-primary);
  color: var(--text-primary);
  font-family: var(--font-sans);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

.app-container {
  max-width: 1600px;
  margin: 0 auto;
  padding: 20px 30px 60px;
}

/* Header */
.header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 24px;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 16px;
}

.logo {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 22px;
  font-weight: 800;
  letter-spacing: -0.5px;
}

.logo-icon {
  background: linear-gradient(135deg, #f59e0b, #e11d48);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  font-size: 26px;
}

.logo-text span {
  color: var(--accent-blue);
  font-weight: 600;
  font-size: 16px;
  background: rgba(59, 130, 246, 0.15);
  padding: 2px 8px;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(59, 130, 246, 0.3);
  margin-left: 4px;
}

.badge-tag {
  font-size: 12px;
  color: var(--text-secondary);
  background: var(--bg-secondary);
  padding: 4px 10px;
  border-radius: 20px;
  border: 1px solid var(--border);
  font-family: var(--font-mono);
}

.header-right {
  display: flex;
  align-items: center;
  gap: 16px;
}

.status-indicator {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--accent-green);
  background: rgba(16, 185, 129, 0.1);
  border: 1px solid rgba(16, 185, 129, 0.25);
  padding: 6px 14px;
  border-radius: 20px;
}

.pulse-dot {
  width: 8px;
  height: 8px;
  background-color: var(--accent-green);
  border-radius: 50%;
  box-shadow: 0 0 8px var(--accent-green);
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0% { transform: scale(0.95); opacity: 0.8; }
  50% { transform: scale(1.2); opacity: 1; }
  100% { transform: scale(0.95); opacity: 0.8; }
}

/* Preset Banner */
.preset-banner {
  background: linear-gradient(135deg, #162035 0%, #1e1b4b 100%);
  border: 1px solid rgba(99, 102, 241, 0.4);
  border-radius: var(--radius-lg);
  padding: 20px 28px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
  box-shadow: 0 8px 24px rgba(30, 27, 75, 0.4);
}

.preset-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1px;
  color: #a5b4fc;
  margin-bottom: 4px;
}

.preset-title {
  font-size: 16px;
  font-weight: 600;
  color: #ffffff;
  max-width: 950px;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 18px;
  font-size: 14px;
  font-weight: 600;
  border-radius: var(--radius-md);
  cursor: pointer;
  border: none;
  transition: all 0.2s ease;
  font-family: var(--font-sans);
}

.btn-primary {
  background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
  color: #ffffff;
  box-shadow: 0 4px 14px rgba(37, 99, 235, 0.4);
}

.btn-primary:hover {
  background: linear-gradient(135deg, #60a5fa 0%, #3b82f6 100%);
  box-shadow: 0 6px 20px rgba(37, 99, 235, 0.6);
  transform: translateY(-1px);
}

.btn-secondary {
  background: var(--bg-card);
  color: var(--text-primary);
  border: 1px solid var(--border);
}

.btn-secondary:hover {
  background: var(--bg-card-hover);
  border-color: #3b82f6;
}

.btn-sm {
  padding: 6px 12px;
  font-size: 12px;
}

.btn-link {
  background: none;
  border: none;
  color: var(--accent-blue);
  font-size: 13px;
  cursor: pointer;
  text-decoration: underline;
}

/* Metrics Grid */
.metrics-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 16px;
  margin-bottom: 28px;
}

.metric-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 18px 20px;
  box-shadow: var(--shadow-sm);
}

.metric-label {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.metric-value {
  font-size: 24px;
  font-weight: 800;
  color: var(--text-primary);
  font-feature-settings: "tnum";
}

.metric-value.highlight {
  color: #38bdf8;
}

.metric-value.green {
  color: #34d399;
}

.metric-sub {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 4px;
}

/* Layout */
.main-layout {
  display: grid;
  grid-template-columns: 320px 1fr;
  gap: 24px;
}

/* Sidebar Filters */
.sidebar-filters {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  height: fit-content;
}

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

.filter-header h3 {
  font-size: 16px;
  font-weight: 700;
}

.filter-group {
  margin-bottom: 22px;
}

.filter-group label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 8px;
}

.input-text, .input-select {
  width: 100%;
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  color: var(--text-primary);
  font-size: 14px;
  font-family: var(--font-sans);
  outline: none;
}

.input-text:focus, .input-select:focus {
  border-color: var(--border-focus);
}

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

.checkbox-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text-secondary);
  cursor: pointer;
}

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

.slider-value {
  font-size: 13px;
  font-weight: 700;
  color: #38bdf8;
  font-family: var(--font-mono);
}

.input-range {
  width: 100%;
  accent-color: var(--accent-blue);
  cursor: pointer;
}

.energy-badges-selector {
  display: flex;
  gap: 6px;
  margin-top: 6px;
}

.energy-chip {
  flex: 1;
  text-align: center;
  padding: 6px 0;
  font-weight: 700;
  font-size: 13px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  background: var(--bg-primary);
  border: 1px solid var(--border);
  color: var(--text-muted);
  user-select: none;
  transition: all 0.15s ease;
}

.energy-chip input {
  display: none;
}

.energy-chip.active[data-char="A"] { background: #15803d; color: white; border-color: #22c55e; }
.energy-chip.active[data-char="B"] { background: #16a34a; color: white; border-color: #4ade80; }
.energy-chip.active[data-char="C"] { background: #65a30d; color: white; border-color: #a3e635; }
.energy-chip.active[data-char="D"] { background: #ca8a04; color: white; border-color: #facc15; }
.energy-chip.active[data-char="E"] { background: #d97706; color: white; border-color: #fbbf24; }
.energy-chip.active[data-char="F"] { background: #ea580c; color: white; border-color: #fb923c; }
.energy-chip.active[data-char="G"] { background: #dc2626; color: white; border-color: #f87171; }

.badge-mini {
  font-size: 10px;
  padding: 2px 6px;
  border-radius: 4px;
  font-weight: 700;
  text-transform: uppercase;
}

.badge-mini.orange {
  background: rgba(245, 158, 11, 0.2);
  color: #fbbf24;
  border: 1px solid rgba(245, 158, 11, 0.4);
}

.filter-helper-text {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 6px;
  line-height: 1.4;
}

/* Results Section */
.results-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}

.results-count-title {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 16px;
  font-weight: 700;
}

.badge-pill {
  background: #1e293b;
  color: #38bdf8;
  border: 1px solid #334155;
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 700;
}

.view-toggles {
  display: flex;
  gap: 4px;
  background: var(--bg-secondary);
  padding: 4px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
}

.view-btn {
  background: none;
  border: none;
  color: var(--text-secondary);
  padding: 6px 14px;
  font-size: 13px;
  font-weight: 600;
  border-radius: var(--radius-sm);
  cursor: pointer;
}

.view-btn.active {
  background: var(--bg-card);
  color: var(--text-primary);
  border: 1px solid var(--border);
}

/* Leads Grid Cards */
.leads-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 18px;
}

.lead-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
  box-shadow: var(--shadow-sm);
}

.lead-card:hover {
  border-color: #3b82f6;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
  transform: translateY(-2px);
}

.card-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 16px;
}

.lead-title-area {
  display: flex;
  gap: 14px;
  align-items: center;
}

.lead-score-badge {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 58px;
  height: 58px;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, #1e293b, #0f172a);
  border: 2px solid #3b82f6;
  box-shadow: 0 0 12px rgba(59, 130, 246, 0.3);
}

.score-num {
  font-size: 20px;
  font-weight: 800;
  color: #38bdf8;
  font-family: var(--font-mono);
}

.score-tag {
  font-size: 9px;
  text-transform: uppercase;
  font-weight: 700;
  color: var(--text-muted);
}

.building-main h4 {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-primary);
}

.building-meta {
  display: flex;
  gap: 10px;
  align-items: center;
  font-size: 13px;
  color: var(--text-secondary);
  margin-top: 4px;
}

.type-pill {
  background: rgba(255, 255, 255, 0.06);
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 12px;
  color: var(--text-secondary);
}

.card-energy-badge {
  display: flex;
  align-items: center;
  gap: 10px;
}

.energy-box {
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-md);
  font-size: 22px;
  font-weight: 900;
  color: white;
}

.energy-box.A { background: #16a34a; }
.energy-box.B { background: #22c55e; }
.energy-box.C { background: #84cc16; }
.energy-box.D { background: #eab308; }
.energy-box.E { background: #f97316; }
.energy-box.F { background: #ea580c; }
.energy-box.G { background: #ef4444; }

.energy-desc {
  display: flex;
  flex-direction: column;
}

.energy-title {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-primary);
}

.energy-sub {
  font-size: 11px;
  color: #fb923c;
}

/* Card Metrics 3-Col */
.card-details-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1.3fr;
  gap: 16px;
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 16px 20px;
  margin-bottom: 16px;
}

.detail-col {
  border-right: 1px solid var(--border);
  padding-right: 16px;
}

.detail-col:last-child {
  border-right: none;
  padding-right: 0;
}

.col-heading {
  font-size: 11px;
  text-transform: uppercase;
  font-weight: 700;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.data-row {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  margin-bottom: 4px;
}

.data-label {
  color: var(--text-secondary);
}

.data-val {
  font-weight: 600;
  color: var(--text-primary);
  font-family: var(--font-mono);
}

.data-val.profit-high {
  color: #34d399;
}

/* Decision Makers Section */
.card-decision-makers {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}

.makers-list {
  display: flex;
  gap: 20px;
}

.maker-pill {
  display: flex;
  align-items: center;
  gap: 8px;
}

.maker-role-badge {
  font-size: 10px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 4px;
  text-transform: uppercase;
}

.role-dagl {
  background: rgba(59, 130, 246, 0.2);
  color: #60a5fa;
  border: 1px solid rgba(59, 130, 246, 0.4);
}

.role-lede {
  background: rgba(139, 92, 246, 0.2);
  color: #c084fc;
  border: 1px solid rgba(139, 92, 246, 0.4);
}

.maker-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
}

.maker-contact {
  display: flex;
  gap: 8px;
  margin-left: 6px;
}

.icon-btn {
  color: var(--text-muted);
  text-decoration: none;
  font-size: 12px;
}

.icon-btn:hover {
  color: var(--accent-blue);
}

/* Card Actions */
.card-actions {
  display: flex;
  gap: 10px;
}

/* Table View */
.leads-table-wrapper {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow-x: auto;
}

.leads-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  text-align: left;
}

.leads-table th {
  background: var(--bg-primary);
  padding: 14px 16px;
  color: var(--text-secondary);
  font-weight: 600;
  border-bottom: 1px solid var(--border);
}

.leads-table td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  color: var(--text-primary);
}

.leads-table tr:hover td {
  background: rgba(255, 255, 255, 0.02);
}

/* Modal */
.modal-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.modal-box {
  background: var(--bg-secondary);
  border: 1px solid rgba(99, 102, 241, 0.4);
  border-radius: var(--radius-xl);
  width: 90%;
  max-width: 780px;
  box-shadow: var(--shadow-lg);
  padding: 28px;
}

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

.modal-title-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
}

.modal-title-wrap h3 {
  font-size: 18px;
  font-weight: 700;
}

.modal-sparkle {
  font-size: 22px;
}

.btn-close {
  background: none;
  border: none;
  font-size: 26px;
  color: var(--text-muted);
  cursor: pointer;
}

.btn-close:hover {
  color: var(--text-primary);
}

.modal-meta {
  font-size: 13px;
  color: var(--text-secondary);
  background: var(--bg-primary);
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  margin-bottom: 16px;
  border: 1px solid var(--border);
}

.pitch-textarea {
  width: 100%;
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 16px;
  color: var(--text-primary);
  font-family: var(--font-mono);
  font-size: 13px;
  line-height: 1.6;
  resize: vertical;
  outline: none;
}

.pitch-textarea:focus {
  border-color: var(--accent-blue);
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  margin-top: 18px;
}
