/* ===================================================================
   ZONINGINTEL — Municipal Intelligence & Quantitative Investment Radar
   =================================================================== */

:root {
  --bg-primary: #0a0e17;
  --bg-secondary: #111827;
  --bg-tertiary: #1f2937;
  --bg-card: rgba(17, 24, 39, 0.85);
  --border-color: #374151;
  --border-focus: #10b981;
  --text-primary: #f9fafb;
  --text-secondary: #9ca3af;
  --text-muted: #6b7280;
  
  --emerald: #10b981;
  --emerald-glow: rgba(16, 185, 129, 0.25);
  --cyan: #06b6d4;
  --cyan-glow: rgba(6, 182, 212, 0.25);
  --amber: #f59e0b;
  --rose: #ef4444;
  --purple: #8b5cf6;

  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', monospace;

  --shadow-card: 0 10px 25px -5px rgba(0, 0, 0, 0.5), 0 8px 10px -6px rgba(0, 0, 0, 0.5);
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
}

* {
  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;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Container */
.app-container {
  max-width: 1440px;
  margin: 0 auto;
  padding: 1.5rem;
  width: 100%;
  flex: 1;
}

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

.brand-wrapper {
  display: flex;
  align-items: center;
  gap: 0.85rem;
}

.brand-icon {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, #10b981, #06b6d4);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #000;
  font-weight: 900;
  font-size: 1.3rem;
  box-shadow: 0 0 20px var(--emerald-glow);
}

.brand-title {
  font-size: 1.4rem;
  font-weight: 800;
  letter-spacing: -0.5px;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.brand-title span.tag {
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  padding: 2px 8px;
  border-radius: 9999px;
  background: rgba(16, 185, 129, 0.15);
  color: var(--emerald);
  border: 1px solid rgba(16, 185, 129, 0.3);
  font-family: var(--font-mono);
}

.brand-subtitle {
  font-size: 0.82rem;
  color: var(--text-secondary);
}

.header-actions {
  display: flex;
  gap: 0.75rem;
  align-items: center;
  flex-wrap: wrap;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.55rem 1.1rem;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  border: 1px solid transparent;
  text-decoration: none;
}

.btn-primary {
  background: linear-gradient(135deg, var(--emerald), #059669);
  color: #000;
  font-weight: 700;
  box-shadow: 0 4px 14px var(--emerald-glow);
}

.btn-primary:hover {
  filter: brightness(1.1);
  transform: translateY(-1px);
}

.btn-secondary {
  background: var(--bg-tertiary);
  color: var(--text-primary);
  border-color: var(--border-color);
}

.btn-secondary:hover {
  background: #374151;
  border-color: var(--text-secondary);
}

.btn-cyan {
  background: linear-gradient(135deg, var(--cyan), #0891b2);
  color: #000;
  font-weight: 700;
  box-shadow: 0 4px 14px var(--cyan-glow);
}

.btn-cyan:hover {
  filter: brightness(1.1);
  transform: translateY(-1px);
}

/* Control Hub & Filter Toolbar */
.control-hub {
  background: var(--bg-card);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  margin-bottom: 1.5rem;
  box-shadow: var(--shadow-card);
}

.filter-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 1rem;
  align-items: flex-end;
}

.filter-group {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.filter-group label {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-secondary);
}

.filter-control {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  padding: 0.55rem 0.8rem;
  border-radius: var(--radius-sm);
  font-size: 0.88rem;
  outline: none;
  transition: border-color 0.2s;
  font-family: inherit;
  width: 100%;
}

.filter-control:focus {
  border-color: var(--emerald);
  box-shadow: 0 0 0 2px var(--emerald-glow);
}

/* Live Ingestion Ticker */
.telemetry-ticker {
  background: #06090e;
  border: 1px solid rgba(6, 182, 212, 0.3);
  border-radius: var(--radius-md);
  padding: 0.85rem 1.2rem;
  margin-bottom: 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-family: var(--font-mono);
  font-size: 0.82rem;
  color: var(--cyan);
  gap: 1rem;
  overflow: hidden;
  box-shadow: inset 0 0 15px rgba(6, 182, 212, 0.08);
}

.telemetry-pulse {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

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

@keyframes pulse {
  0% { transform: scale(0.9); opacity: 0.7; }
  50% { transform: scale(1.3); opacity: 1; }
  100% { transform: scale(0.9); opacity: 0.7; }
}

.telemetry-log {
  color: #cbd5e1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Metrics Ribbon */
.metrics-ribbon {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.metric-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1.1rem;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  position: relative;
  overflow: hidden;
}

.metric-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 4px;
  height: 100%;
  background: var(--emerald);
}

.metric-card.cyan::before { background: var(--cyan); }
.metric-card.purple::before { background: var(--purple); }
.metric-card.amber::before { background: var(--amber); }

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

.metric-value {
  font-size: 1.8rem;
  font-weight: 800;
  letter-spacing: -0.5px;
  font-family: var(--font-mono);
}

.metric-sub {
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* Section Header */
.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.section-title {
  font-size: 1.15rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.badge-count {
  font-size: 0.75rem;
  padding: 2px 8px;
  border-radius: 9999px;
  background: var(--bg-tertiary);
  color: var(--text-secondary);
  font-family: var(--font-mono);
}

/* Opportunity Grid */
.opportunity-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(430px, 1fr));
  gap: 1.25rem;
  margin-bottom: 2rem;
}

@media (max-width: 500px) {
  .opportunity-grid {
    grid-template-columns: 1fr;
  }
}

.opp-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  box-shadow: var(--shadow-card);
  display: flex;
  flex-direction: column;
  gap: 1rem;
  transition: all 0.25s ease;
  position: relative;
}

.opp-card:hover {
  border-color: rgba(16, 185, 129, 0.5);
  transform: translateY(-2px);
  box-shadow: 0 15px 30px -8px rgba(0, 0, 0, 0.7);
}

.opp-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 0.75rem;
}

.opp-loc {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.8rem;
  color: var(--cyan);
  font-weight: 600;
  font-family: var(--font-mono);
}

.score-badge {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 0.35rem 0.75rem;
  border-radius: var(--radius-md);
  background: rgba(16, 185, 129, 0.12);
  border: 1px solid rgba(16, 185, 129, 0.4);
  color: var(--emerald);
  min-width: 65px;
}

.score-number {
  font-size: 1.3rem;
  font-weight: 900;
  font-family: var(--font-mono);
  line-height: 1;
}

.score-lbl {
  font-size: 0.58rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-weight: 700;
}

.opp-address {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-top: 0.25rem;
}

.opp-apn {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-family: var(--font-mono);
}

/* Zoning Flow Ribbon */
.zoning-flow {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 0.75rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.zone-box {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  flex: 1;
}

.zone-label {
  font-size: 0.65rem;
  text-transform: uppercase;
  color: var(--text-muted);
  font-weight: 700;
}

.zone-code {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-primary);
  font-family: var(--font-mono);
}

.zone-arrow {
  color: var(--emerald);
  font-weight: 900;
  font-size: 1.2rem;
  padding: 0 0.25rem;
}

/* Variables Grid */
.quant-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.5rem;
  background: rgba(0, 0, 0, 0.2);
  border-radius: var(--radius-sm);
  padding: 0.65rem;
}

.quant-item {
  display: flex;
  flex-direction: column;
}

.quant-name {
  font-size: 0.68rem;
  color: var(--text-muted);
}

.quant-val {
  font-size: 0.85rem;
  font-weight: 700;
  font-family: var(--font-mono);
  color: var(--text-primary);
}

.quant-val.positive {
  color: var(--emerald);
}

/* Meeting Note Snapshot */
.meeting-quote {
  font-size: 0.8rem;
  color: #d1d5db;
  background: rgba(17, 24, 39, 0.6);
  border-left: 3px solid var(--cyan);
  padding: 0.6rem 0.8rem;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  font-style: italic;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.catalyst-pill {
  font-size: 0.72rem;
  color: #fef08a;
  background: rgba(245, 158, 11, 0.12);
  border: 1px solid rgba(245, 158, 11, 0.3);
  padding: 0.35rem 0.6rem;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.opp-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-top: 1px solid rgba(55, 65, 81, 0.6);
  padding-top: 0.85rem;
  margin-top: auto;
}

.vote-status {
  font-size: 0.72rem;
  color: var(--text-secondary);
  font-family: var(--font-mono);
}

/* Native Dialog / Modal */
dialog.opp-modal {
  margin: auto;
  border: 1px solid var(--border-color);
  background: #0d131f;
  color: var(--text-primary);
  border-radius: var(--radius-lg);
  padding: 2rem;
  max-width: 820px;
  width: 92%;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.85);
  outline: none;
}

dialog.opp-modal::backdrop {
  background: rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(6px);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 1.25rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border-color);
}

.modal-close-btn {
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  width: 32px;
  height: 32px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
}

.modal-close-btn:hover {
  background: #374151;
}

.modal-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.25rem;
  margin-bottom: 1.5rem;
}

@media (max-width: 680px) {
  .modal-grid {
    grid-template-columns: 1fr;
  }
}

.modal-box {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1rem;
}

.modal-box-title {
  font-size: 0.75rem;
  text-transform: uppercase;
  color: var(--text-secondary);
  font-weight: 700;
  margin-bottom: 0.6rem;
}

.rubric-row {
  display: flex;
  justify-content: space-between;
  padding: 0.35rem 0;
  font-size: 0.82rem;
  border-bottom: 1px solid rgba(55, 65, 81, 0.4);
}

.rubric-row:last-child {
  border-bottom: none;
}

.rubric-val {
  font-weight: 600;
  font-family: var(--font-mono);
}

.full-meeting-quote {
  font-size: 0.86rem;
  line-height: 1.6;
  color: #e5e7eb;
  background: rgba(0, 0, 0, 0.35);
  border-left: 4px solid var(--emerald);
  padding: 1rem;
  border-radius: var(--radius-sm);
  font-style: italic;
  margin-bottom: 1.25rem;
}

.action-box {
  background: rgba(16, 185, 129, 0.1);
  border: 1px solid rgba(16, 185, 129, 0.3);
  border-radius: var(--radius-md);
  padding: 1rem;
  margin-bottom: 1.25rem;
}

.action-title {
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--emerald);
  margin-bottom: 0.35rem;
}

.action-body {
  font-size: 0.88rem;
  color: #f3f4f6;
}

/* Footer */
.app-footer {
  margin-top: auto;
  border-top: 1px solid var(--border-color);
  padding: 1.5rem;
  text-align: center;
  font-size: 0.8rem;
  color: var(--text-muted);
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
}

/* ===================================================================
   PRINT STYLESHEET (@media print)
   Ultra-Crisp, Multi-Page Executive Investment Memorandum Format
   =================================================================== */

@media print {
  body {
    background: #fff !important;
    color: #111827 !important;
    font-size: 10.5pt;
    line-height: 1.4;
  }

  .app-container {
    max-width: 100% !important;
    padding: 0 !important;
  }

  /* Hide interactive controls */
  .app-header,
  .control-hub,
  .telemetry-ticker,
  .btn,
  .modal-close-btn,
  .app-footer {
    display: none !important;
  }

  /* Show Print Only Header */
  .print-only-header {
    display: block !important;
    border-bottom: 2pt solid #111827;
    padding-bottom: 12pt;
    margin-bottom: 18pt;
  }

  .print-logo-row {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
  }

  .print-title {
    font-size: 18pt;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: -0.5px;
    color: #111827;
  }

  .print-subtitle {
    font-size: 9pt;
    color: #4b5563;
    font-weight: 600;
    margin-top: 2pt;
  }

  .print-meta-box {
    text-align: right;
    font-size: 8pt;
    color: #4b5563;
    font-family: monospace;
  }

  /* Metrics ribbon on paper */
  .metrics-ribbon {
    display: grid !important;
    grid-template-columns: repeat(4, 1fr) !important;
    gap: 8pt !important;
    margin-bottom: 16pt !important;
  }

  .metric-card {
    background: #f9fafb !important;
    border: 1pt solid #d1d5db !important;
    color: #111827 !important;
    padding: 8pt !important;
    box-shadow: none !important;
  }

  .metric-card::before { display: none !important; }

  .metric-value {
    color: #111827 !important;
    font-size: 14pt !important;
  }

  /* Printable Table Format */
  .opportunity-grid {
    display: block !important;
  }

  .opp-card {
    background: #fff !important;
    border: 1pt solid #9ca3af !important;
    box-shadow: none !important;
    color: #111827 !important;
    padding: 12pt !important;
    margin-bottom: 16pt !important;
    page-break-inside: avoid;
    break-inside: avoid;
    border-radius: 4pt !important;
  }

  .score-badge {
    background: #f3f4f6 !important;
    border: 1.5pt solid #111827 !important;
    color: #111827 !important;
  }

  .score-number {
    color: #111827 !important;
  }

  .opp-address {
    font-size: 12pt !important;
    color: #000 !important;
  }

  .zoning-flow {
    background: #f9fafb !important;
    border: 1pt solid #e5e7eb !important;
    padding: 6pt !important;
  }

  .zone-code {
    color: #000 !important;
  }

  .quant-grid {
    background: #f9fafb !important;
    border: 1pt solid #e5e7eb !important;
  }

  .quant-val {
    color: #000 !important;
  }

  .meeting-quote {
    background: #f3f4f6 !important;
    border-left: 3pt solid #111827 !important;
    color: #1f2937 !important;
    display: block !important;
  }

  .catalyst-pill {
    background: #fef3c7 !important;
    border: 1pt solid #f59e0b !important;
    color: #92400e !important;
  }

  /* Print Sign-off Footer */
  .print-signoff {
    display: block !important;
    margin-top: 24pt;
    padding-top: 12pt;
    border-top: 1pt solid #d1d5db;
    page-break-inside: avoid;
  }
}

.print-only-header,
.print-signoff {
  display: none;
}

/* ===================================================================
   UTAH 29 COUNTIES & MUNICIPAL PUBLIC SOURCE DIRECTORY
   =================================================================== */
.utah-directory-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(460px, 1fr));
  gap: 1.25rem;
}

@media (max-width: 600px) {
  .utah-directory-grid {
    grid-template-columns: 1fr;
  }
}

.utah-county-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1.15rem;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.utah-county-card:hover {
  border-color: rgba(6, 182, 212, 0.4);
}

.utah-county-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  border-bottom: 1px solid rgba(55, 65, 81, 0.5);
  padding-bottom: 0.65rem;
}

.utah-county-name {
  font-size: 1.1rem;
  font-weight: 800;
  color: #fff;
}

.utah-county-seat {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.source-link-group {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.pmn-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  background: rgba(16, 185, 129, 0.12);
  border: 1px solid rgba(16, 185, 129, 0.35);
  color: var(--emerald);
  font-size: 0.72rem;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: var(--radius-sm);
  text-decoration: none;
  font-family: var(--font-mono);
}

.pmn-badge:hover {
  background: rgba(16, 185, 129, 0.25);
}

.portal-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  background: rgba(6, 182, 212, 0.12);
  border: 1px solid rgba(6, 182, 212, 0.35);
  color: var(--cyan);
  font-size: 0.72rem;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: var(--radius-sm);
  text-decoration: none;
  font-family: var(--font-mono);
}

.portal-badge:hover {
  background: rgba(6, 182, 212, 0.25);
}

.utah-cities-list {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  max-height: 220px;
  overflow-y: auto;
  padding-right: 0.35rem;
}

.utah-city-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: rgba(0, 0, 0, 0.25);
  border-radius: var(--radius-sm);
  padding: 0.4rem 0.65rem;
  font-size: 0.8rem;
  gap: 0.5rem;
}

.utah-city-info {
  display: flex;
  flex-direction: column;
}

.utah-city-name {
  font-weight: 700;
  color: #f3f4f6;
}

.utah-city-sched {
  font-size: 0.68rem;
  color: var(--text-muted);
}

