/**
 * Montana Real Estate — Design System
 * Clean light theme · Professional real estate aesthetic
 * Sage/Mountain/Earth palette · Inter + JetBrains Mono
 */

/* ═══════════════════════════════════════════════════════════
   DESIGN TOKENS
═══════════════════════════════════════════════════════════ */
:root {
  /* Brand */
  --mre-sage: #5B7B5E;
  --mre-sage-light: #7FA882;
  --mre-sage-dark: #3D5640;
  --mre-mountain: #3B6B8A;
  --mre-mountain-light: #5A8FB0;
  --mre-earth: #8B6914;
  --mre-cream: #FAF8F5;

  /* Surfaces */
  --bg-0: #FFFFFF;
  --bg-1: #FAF8F5;
  --bg-2: #F3F0EB;
  --bg-3: #EBE7E0;
  --bg-4: #E0DCD5;

  /* Text */
  --text-primary: #1A1A1A;
  --text-secondary: #4A4A4A;
  --text-tertiary: #7A7A7A;
  --text-muted: #9A9A9A;
  --text-inverse: #FFFFFF;

  /* Borders */
  --border-subtle: rgba(0,0,0,0.06);
  --border-default: rgba(0,0,0,0.10);
  --border-strong: rgba(0,0,0,0.18);

  /* Shadows */
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.08), 0 2px 4px rgba(0,0,0,0.04);
  --shadow-lg: 0 12px 32px rgba(0,0,0,0.10), 0 4px 8px rgba(0,0,0,0.06);

  /* Risk */
  --risk-high: #DC2626;
  --risk-high-bg: rgba(220,38,38,0.08);
  --risk-medium: #F59E0B;
  --risk-medium-bg: rgba(245,158,11,0.08);
  --risk-low: #3B82F6;
  --risk-low-bg: rgba(59,130,246,0.08);
  --risk-clear: #22C55E;
  --risk-clear-bg: rgba(34,197,94,0.08);

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

  /* Sizing */
  --topbar-h: 56px;
  --panel-w: 420px;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-full: 999px;

  /* Transitions */
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
  --dur-fast: 150ms;
  --dur-normal: 250ms;
}

/* ═══════════════════════════════════════════════════════════
   RESET & BASE
═══════════════════════════════════════════════════════════ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; -webkit-font-smoothing: antialiased; }
body {
  font-family: var(--font-sans);
  background: var(--bg-1);
  color: var(--text-primary);
  min-height: 100vh;
  overflow: hidden;
}
a { color: var(--mre-mountain); text-decoration: none; }
a:hover { text-decoration: underline; }
button { font-family: inherit; cursor: pointer; border: none; background: none; }
input { font-family: inherit; }

/* ═══════════════════════════════════════════════════════════
   TOP BAR
═══════════════════════════════════════════════════════════ */
.topbar {
  height: var(--topbar-h);
  background: var(--bg-0);
  border-bottom: 1px solid var(--border-default);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  position: relative;
  z-index: 100;
}

.topbar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
}
.brand-icon { flex-shrink: 0; }
.brand-text { display: flex; flex-direction: column; }
.brand-name {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.01em;
  line-height: 1.1;
}
.brand-sub {
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--mre-sage);
  line-height: 1;
  margin-top: 2px;
}

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

/* ═══════════════════════════════════════════════════════════
   BUTTONS
═══════════════════════════════════════════════════════════ */
.btn-ghost {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  transition: all var(--dur-fast) var(--ease);
}
.btn-ghost:hover { background: var(--bg-2); color: var(--text-primary); }

.btn-primary {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 18px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 600;
  color: var(--text-inverse);
  background: var(--mre-sage);
  transition: all var(--dur-fast) var(--ease);
  box-shadow: var(--shadow-sm);
}
.btn-primary:hover { background: var(--mre-sage-dark); box-shadow: var(--shadow-md); }

.btn-outline {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 18px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 600;
  color: var(--mre-sage);
  border: 1.5px solid var(--mre-sage);
  transition: all var(--dur-fast) var(--ease);
}
.btn-outline:hover { background: var(--mre-sage); color: var(--text-inverse); }

.btn-report {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 14px 16px;
  border-radius: var(--radius-md);
  background: var(--bg-0);
  border: 1.5px solid var(--border-default);
  text-align: left;
  transition: all var(--dur-fast) var(--ease);
}
.btn-report:hover { border-color: var(--mre-sage); box-shadow: var(--shadow-md); transform: translateY(-1px); }
.btn-report .report-btn-label { font-size: 14px; font-weight: 600; color: var(--text-primary); }
.btn-report .report-btn-desc { font-size: 11px; color: var(--text-tertiary); margin-top: 2px; }
.btn-report .report-btn-price {
  margin-left: auto;
  font-family: var(--font-mono);
  font-size: 16px;
  font-weight: 600;
  color: var(--mre-sage);
}
.btn-report.brokerage {
  background: linear-gradient(135deg, rgba(91,123,94,0.04), rgba(59,107,138,0.06));
  border-color: var(--mre-sage);
}
.btn-report.brokerage:hover {
  background: linear-gradient(135deg, rgba(91,123,94,0.08), rgba(59,107,138,0.10));
  box-shadow: var(--shadow-lg);
}
.btn-report.brokerage .report-btn-label {
  color: var(--mre-sage-dark);
}
.btn-report.brokerage .report-btn-price { color: var(--mre-earth); }

/* ═══════════════════════════════════════════════════════════
   LAYOUT
═══════════════════════════════════════════════════════════ */
.layout {
  display: flex;
  height: calc(100vh - var(--topbar-h));
}

.panel {
  width: var(--panel-w);
  min-width: var(--panel-w);
  background: var(--bg-0);
  border-right: 1px solid var(--border-default);
  overflow-y: auto;
  overflow-x: hidden;
  display: flex;
  flex-direction: column;
}

.panel-section { padding: 24px 20px; flex: 1; display: flex; flex-direction: column; }

.map-container {
  flex: 1;
  position: relative;
  background: var(--bg-2);
}
#map-view { width: 100%; height: 100%; }

.map-overlay-hint {
  position: absolute;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--bg-0);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-full);
  padding: 8px 18px;
  font-size: 12px;
  color: var(--text-tertiary);
  display: flex;
  align-items: center;
  gap: 6px;
  box-shadow: var(--shadow-md);
  pointer-events: none;
  opacity: 0.9;
  transition: opacity var(--dur-normal);
}

/* ═══════════════════════════════════════════════════════════
   SEARCH
═══════════════════════════════════════════════════════════ */
.search-hero { margin-bottom: 24px; }
.hero-title {
  font-size: 28px;
  font-weight: 800;
  line-height: 1.1;
  letter-spacing: -0.02em;
  color: var(--text-primary);
}
.hero-accent { color: var(--mre-sage); }
.hero-sub {
  font-size: 13px;
  color: var(--text-tertiary);
  line-height: 1.6;
  margin-top: 10px;
  max-width: 340px;
}

.search-bar { margin-bottom: 16px; }

.search-type-toggle {
  display: flex;
  gap: 4px;
  margin-bottom: 8px;
  background: var(--bg-2);
  border-radius: var(--radius-sm);
  padding: 3px;
}
.type-btn {
  flex: 1;
  padding: 6px 0;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-tertiary);
  border-radius: 4px;
  transition: all var(--dur-fast);
}
.type-btn.active {
  background: var(--bg-0);
  color: var(--text-primary);
  font-weight: 600;
  box-shadow: var(--shadow-sm);
}
.type-btn:hover:not(.active) { color: var(--text-secondary); }

.search-input-wrap {
  position: relative;
  display: flex;
  align-items: center;
}
.search-icon {
  position: absolute;
  left: 12px;
  width: 16px;
  height: 16px;
  color: var(--text-muted);
  pointer-events: none;
}
.search-input {
  width: 100%;
  padding: 10px 36px 10px 38px;
  border: 1.5px solid var(--border-default);
  border-radius: var(--radius-sm);
  font-size: 14px;
  color: var(--text-primary);
  background: var(--bg-0);
  outline: none;
  transition: border-color var(--dur-fast);
}
.search-input::placeholder { color: var(--text-muted); }
.search-input:focus { border-color: var(--mre-sage); }
.search-clear {
  position: absolute;
  right: 8px;
  padding: 4px;
  color: var(--text-muted);
  border-radius: 50%;
}
.search-clear:hover { background: var(--bg-2); color: var(--text-secondary); }

.search-status {
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 8px;
  min-height: 18px;
}

.search-results { flex: 1; overflow-y: auto; }

/* Result card */
.result-card {
  padding: 12px 14px;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  margin-bottom: 6px;
  cursor: pointer;
  transition: all var(--dur-fast) var(--ease);
}
.result-card:hover { border-color: var(--mre-sage); background: var(--bg-1); box-shadow: var(--shadow-sm); }

.result-card-addr {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.3;
  margin-bottom: 4px;
}
.result-card-owner {
  font-size: 11px;
  color: var(--text-tertiary);
  margin-bottom: 6px;
}
.result-card-meta {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}
.result-card-tag {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-tertiary);
  background: var(--bg-2);
  padding: 2px 8px;
  border-radius: var(--radius-full);
}

.panel-footer {
  margin-top: auto;
  padding-top: 16px;
  border-top: 1px solid var(--border-subtle);
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.data-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  background: var(--bg-2);
  padding: 3px 8px;
  border-radius: var(--radius-full);
}

/* ═══════════════════════════════════════════════════════════
   PARCEL DETAIL
═══════════════════════════════════════════════════════════ */
.detail-header {
  margin-bottom: 20px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border-subtle);
}
.detail-geocode {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.08em;
  color: var(--mre-sage);
  text-transform: uppercase;
  margin-bottom: 4px;
}
.detail-address {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.2;
  margin-bottom: 6px;
}
.detail-owner {
  font-size: 12px;
  color: var(--text-tertiary);
}

.detail-section {
  margin-bottom: 18px;
}
.detail-section-title {
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.detail-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.detail-field {
  background: var(--bg-1);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
}
.detail-field-label {
  font-size: 10px;
  color: var(--text-muted);
  margin-bottom: 2px;
}
.detail-field-value {
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
}
.detail-field.full { grid-column: 1 / -1; }
.detail-field.accent .detail-field-value { color: var(--mre-sage); }

/* Water rights mini-list */
.wr-mini-list { display: flex; flex-direction: column; gap: 4px; }
.wr-mini-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 10px;
  background: var(--bg-1);
  border-radius: 4px;
  font-size: 11px;
}
.wr-mini-item .wr-id { font-family: var(--font-mono); font-weight: 500; color: var(--mre-mountain); }
.wr-mini-item .wr-purpose { color: var(--text-tertiary); }
.wr-mini-item .wr-flow { font-family: var(--font-mono); font-weight: 600; color: var(--text-primary); }

/* Risk flag pills */
.risk-flags { display: flex; flex-wrap: wrap; gap: 6px; }
.risk-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: var(--radius-full);
  font-size: 11px;
  font-weight: 500;
}
.risk-pill.high { background: var(--risk-high-bg); color: var(--risk-high); border: 1px solid rgba(220,38,38,0.2); }
.risk-pill.medium { background: var(--risk-medium-bg); color: var(--risk-medium); border: 1px solid rgba(245,158,11,0.2); }
.risk-pill.low { background: var(--risk-low-bg); color: var(--risk-low); border: 1px solid rgba(59,130,246,0.2); }
.risk-pill.clear { background: var(--risk-clear-bg); color: var(--risk-clear); border: 1px solid rgba(34,197,94,0.2); }

/* Report buttons in detail panel */
.report-options { display: flex; flex-direction: column; gap: 8px; margin-top: 16px; }

/* Loading spinner */
.spinner {
  display: inline-block;
  width: 18px;
  height: 18px;
  border: 2px solid var(--border-default);
  border-top-color: var(--mre-sage);
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.loading-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 40px 0;
  color: var(--text-muted);
  font-size: 13px;
}

/* ═══════════════════════════════════════════════════════════
   REPORT OVERLAY
═══════════════════════════════════════════════════════════ */
.report-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  z-index: 200;
  background: var(--bg-1);
  display: flex;
  flex-direction: column;
}

.report-toolbar {
  height: var(--topbar-h);
  background: var(--bg-0);
  border-bottom: 1px solid var(--border-default);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  flex-shrink: 0;
}
.report-toolbar-center { flex: 1; text-align: center; }
.report-title-text { font-size: 14px; font-weight: 600; color: var(--text-secondary); }
.report-toolbar-actions { display: flex; gap: 8px; }

.report-scroll {
  flex: 1;
  overflow-y: auto;
  padding: 32px 20px 60px;
}
.report-content {
  max-width: 900px;
  margin: 0 auto;
  background: var(--bg-0);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}

/* ═══════════════════════════════════════════════════════════
   MODALS
═══════════════════════════════════════════════════════════ */
.modal-backdrop {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.4);
  backdrop-filter: blur(4px);
  z-index: 300;
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal {
  background: var(--bg-0);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  width: 90%;
  max-width: 440px;
  max-height: 85vh;
  overflow-y: auto;
}
.modal.modal-lg { max-width: 600px; }

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 20px;
  border-bottom: 1px solid var(--border-subtle);
}
.modal-title { font-size: 16px; font-weight: 700; }
.modal-body { padding: 20px; }
.modal-body p { font-size: 13px; color: var(--text-secondary); line-height: 1.7; margin-bottom: 14px; }
.modal-body h4 { font-size: 13px; font-weight: 700; margin-bottom: 8px; }
.modal-body ul { padding-left: 18px; font-size: 12px; color: var(--text-secondary); line-height: 1.8; }
.modal-body li strong { color: var(--text-primary); }

.about-disclaimer {
  font-size: 11px !important;
  color: var(--text-muted) !important;
  margin-top: 16px;
  padding-top: 12px;
  border-top: 1px solid var(--border-subtle);
}

/* ═══════════════════════════════════════════════════════════
   ICONS
═══════════════════════════════════════════════════════════ */
.icon-xs { width: 12px; height: 12px; }
.icon-sm { width: 16px; height: 16px; }
.icon-md { width: 20px; height: 20px; }

/* ═══════════════════════════════════════════════════════════
   RESPONSIVE
═══════════════════════════════════════════════════════════ */
@media (max-width: 900px) {
  .layout { flex-direction: column; }
  .panel { width: 100%; min-width: 100%; max-height: 50vh; border-right: none; border-bottom: 1px solid var(--border-default); }
  .map-container { min-height: 50vh; }
  :root { --panel-w: 100%; }
}

@media (max-width: 600px) {
  .hero-title { font-size: 22px; }
  .panel-section { padding: 16px 14px; }
  .topbar { padding: 0 12px; }
  .brand-name { font-size: 13px; }
  .report-scroll { padding: 16px 10px; }
  .chat-drawer { bottom: 12px; right: 12px; }
  .chat-panel.open { width: 320px; height: 420px; }
}

/* ═══════════════════════════════════════════════════════════
   CHAT DRAWER
═══════════════════════════════════════════════════════════ */
.chat-drawer {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 2000;
  font-family: var(--font-sans);
}

.chat-toggle {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 10px 16px;
  background: var(--mre-sage);
  color: #fff;
  border: none;
  border-radius: 24px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  box-shadow: 0 4px 12px rgba(0,0,0,.15);
  transition: all .2s;
}
.chat-toggle:hover { background: #4a6a4d; transform: translateY(-1px); }
.chat-toggle.active { background: #4a6a4d; }

.chat-panel {
  display: none;
  flex-direction: column;
  position: absolute;
  bottom: 52px;
  right: 0;
  width: 380px;
  height: 500px;
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 8px 32px rgba(0,0,0,.18);
  overflow: hidden;
}
.chat-panel.open { display: flex; }

.chat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: linear-gradient(135deg, var(--mre-sage), var(--mre-mountain));
  color: #fff;
}
.chat-header-title { font-size: 13px; font-weight: 600; letter-spacing: .02em; }
.chat-close { background: none; border: none; color: #fff; cursor: pointer; opacity: .7; }
.chat-close:hover { opacity: 1; }

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.chat-welcome {
  text-align: center;
  padding: 24px 16px;
}
.chat-welcome-title { font-size: 15px; font-weight: 700; color: var(--text-primary); margin-bottom: 4px; }
.chat-welcome-desc { font-size: 12px; color: var(--text-muted); margin-bottom: 16px; }

.chat-quick-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: center;
}
.chat-quick-btn {
  padding: 6px 12px;
  font-size: 11px;
  background: var(--bg-1);
  border: 1px solid var(--bg-3);
  border-radius: 16px;
  cursor: pointer;
  color: var(--text-secondary);
  transition: all .15s;
}
.chat-quick-btn:hover { background: var(--bg-2); color: var(--text-primary); }

.chat-msg { max-width: 85%; }
.chat-msg-user { align-self: flex-end; }
.chat-msg-ai { align-self: flex-start; }

.chat-msg-user .chat-msg-content {
  background: var(--mre-sage);
  color: #fff;
  padding: 8px 12px;
  border-radius: 12px 12px 2px 12px;
  font-size: 12px;
  line-height: 1.5;
}
.chat-msg-ai .chat-msg-content {
  background: var(--bg-1);
  color: var(--text-primary);
  padding: 8px 12px;
  border-radius: 12px 12px 12px 2px;
  font-size: 12px;
  line-height: 1.6;
  border: 1px solid var(--bg-3);
}

.chat-thinking {
  color: var(--text-muted);
  font-style: italic;
}

.chat-input-area {
  display: flex;
  gap: 8px;
  padding: 10px 12px;
  border-top: 1px solid var(--bg-3);
  background: #fff;
}
.chat-input {
  flex: 1;
  padding: 8px 12px;
  border: 1px solid var(--bg-3);
  border-radius: 20px;
  font-size: 12px;
  font-family: var(--font-sans);
  outline: none;
  transition: border-color .2s;
}
.chat-input:focus { border-color: var(--mre-sage); }
.chat-send {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--mre-sage);
  border: none;
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background .15s;
}
.chat-send:hover { background: #4a6a4d; }

/* ═══════════════════════════════════════════════════════════
   ACCESS GATE
═══════════════════════════════════════════════════════════ */
.access-gate {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: linear-gradient(160deg, #2D3B2E 0%, #1A2B3A 50%, #1A1F2E 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 0.5s var(--ease), visibility 0.5s;
}
.access-gate.hidden { opacity: 0; visibility: hidden; pointer-events: none; }

.gate-card {
  background: rgba(255,255,255,0.03);
  backdrop-filter: blur(20px);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 24px;
  padding: 48px 40px;
  max-width: 420px;
  width: 90%;
  text-align: center;
  box-shadow: 0 24px 64px rgba(0,0,0,0.4);
}

.gate-icon { margin-bottom: 24px; filter: drop-shadow(0 4px 12px rgba(91,123,94,0.3)); }
.gate-title {
  font-size: 24px;
  font-weight: 800;
  color: #fff;
  line-height: 1.2;
  margin-bottom: 8px;
  letter-spacing: -0.02em;
}
.gate-title span { color: var(--mre-sage-light); font-weight: 600; }
.gate-desc {
  font-size: 13px;
  color: rgba(255,255,255,0.5);
  line-height: 1.6;
  margin-bottom: 28px;
}

.gate-input-wrap {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
}
.gate-input {
  flex: 1;
  padding: 12px 16px;
  background: rgba(255,255,255,0.06);
  border: 1.5px solid rgba(255,255,255,0.12);
  border-radius: 12px;
  color: #fff;
  font-size: 14px;
  outline: none;
  transition: border-color 0.2s;
}
.gate-input::placeholder { color: rgba(255,255,255,0.25); }
.gate-input:focus { border-color: var(--mre-sage); }

.gate-submit {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  background: var(--mre-sage);
  border: none;
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  flex-shrink: 0;
}
.gate-submit:hover { background: var(--mre-sage-dark); transform: scale(1.05); }

.gate-error {
  font-size: 12px;
  color: #ef4444;
  min-height: 18px;
  margin-bottom: 8px;
}

.gate-footer {
  font-size: 11px;
  color: rgba(255,255,255,0.25);
  margin-top: 8px;
}

/* ═══════════════════════════════════════════════════════════
   RISK GAUGE
═══════════════════════════════════════════════════════════ */
.risk-gauge-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.risk-gauge-item {
  flex: 1;
  min-width: 90px;
  background: var(--bg-1);
  border-radius: var(--radius-sm);
  padding: 10px;
  text-align: center;
}
.risk-gauge-label {
  font-size: 9px;
  font-family: var(--font-mono);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  margin-top: 6px;
}
.risk-gauge-score {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  margin-top: 2px;
}

/* ═══════════════════════════════════════════════════════════
   GLOSSARY PANEL
═══════════════════════════════════════════════════════════ */
.glossary-section { margin-top: 16px; }
.glossary-toggle {
  display: flex;
  align-items: center;
  gap: 6px;
  width: 100%;
  padding: 10px 14px;
  background: var(--bg-1);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.15s;
}
.glossary-toggle:hover { background: var(--bg-2); }
.glossary-content {
  display: none;
  padding: 12px 14px;
  background: var(--bg-1);
  border: 1px solid var(--border-subtle);
  border-top: none;
  border-radius: 0 0 var(--radius-sm) var(--radius-sm);
}
.glossary-content.open { display: block; }
.glossary-term {
  margin-bottom: 10px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border-subtle);
}
.glossary-term:last-child { margin-bottom: 0; padding-bottom: 0; border-bottom: none; }
.glossary-term-name {
  font-size: 12px;
  font-weight: 600;
  color: var(--mre-sage-dark);
  margin-bottom: 2px;
}
.glossary-term-def {
  font-size: 11px;
  color: var(--text-tertiary);
  line-height: 1.5;
}

/* ═══════════════════════════════════════════════════════════
   CALCULATOR SECTION
═══════════════════════════════════════════════════════════ */
.calc-section {
  background: var(--bg-1);
  border-radius: var(--radius-sm);
  padding: 14px;
  margin-top: 8px;
}
.calc-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 4px 0;
  font-size: 12px;
}
.calc-row-label { color: var(--text-tertiary); }
.calc-row-value { font-family: var(--font-mono); font-weight: 600; color: var(--text-primary); }
.calc-row.total {
  margin-top: 6px;
  padding-top: 8px;
  border-top: 1.5px solid var(--border-default);
  font-size: 13px;
}
.calc-row.total .calc-row-label { font-weight: 600; color: var(--text-primary); }
.calc-row.total .calc-row-value { color: var(--mre-sage); font-size: 15px; }

/* ═══════════════════════════════════════════════════════════
   FUTURE FEATURES / ROADMAP
═══════════════════════════════════════════════════════════ */
.roadmap-section {
  margin-top: 16px;
  padding: 14px;
  background: linear-gradient(135deg, rgba(91,123,94,0.04), rgba(59,107,138,0.04));
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
}
.roadmap-title {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--mre-sage);
  margin-bottom: 10px;
}
.roadmap-item {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 5px 0;
  font-size: 11px;
  color: var(--text-tertiary);
  line-height: 1.4;
}
.roadmap-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  margin-top: 4px;
  flex-shrink: 0;
}
.roadmap-dot.available { background: var(--risk-clear); }
.roadmap-dot.coming { background: var(--risk-medium); }
.roadmap-dot.planned { background: var(--bg-4); }

/* ═══════════════════════════════════════════════════════════
   WATER RIGHTS DETAIL CARDS
═══════════════════════════════════════════════════════════ */
.wr-detail-list { display: flex; flex-direction: column; gap: 10px; }

.wr-card {
  background: var(--bg-1);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  overflow: hidden;
  transition: border-color var(--dur-fast);
}
.wr-card:hover { border-color: var(--mre-mountain); }

.wr-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 14px;
  background: var(--bg-2);
  border-bottom: 1px solid var(--border-subtle);
}
.wr-card-id {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 700;
  color: var(--mre-mountain);
}
.wr-card-status {
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 2px 8px;
  border-radius: var(--radius-full);
}
.wr-card-status.actv { background: var(--risk-clear-bg); color: var(--risk-clear); }
.wr-card-status.clsd,
.wr-card-status.revk { background: var(--risk-high-bg); color: var(--risk-high); }

.wr-card-body {
  padding: 10px 14px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.wr-card-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-size: 11px;
  color: var(--text-secondary);
  gap: 8px;
}
.wr-card-label {
  font-size: 10px;
  color: var(--text-muted);
  flex-shrink: 0;
  min-width: 65px;
}

.wr-card-pdf {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  background: rgba(59,107,138,0.06);
  border-top: 1px solid var(--border-subtle);
  font-size: 11px;
  font-weight: 600;
  color: var(--mre-mountain);
  text-decoration: none;
  transition: background var(--dur-fast);
}
.wr-card-pdf:hover { background: rgba(59,107,138,0.12); text-decoration: none; }

/* ═══════════════════════════════════════════════════════════
   NHD WATER FEATURES
═══════════════════════════════════════════════════════════ */
.nhd-subsection-title {
  font-size: 10px;
  font-weight: 600;
  color: var(--mre-mountain);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 4px;
}

/* ═══════════════════════════════════════════════════════════
   RESOURCE LINKS
═══════════════════════════════════════════════════════════ */
.resource-links {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.resource-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 5px 10px;
  font-size: 11px;
  font-weight: 500;
  color: var(--mre-mountain);
  background: rgba(59,107,138,0.06);
  border-radius: var(--radius-full);
  border: 1px solid rgba(59,107,138,0.12);
  text-decoration: none;
  transition: all var(--dur-fast);
}
.resource-link:hover {
  background: rgba(59,107,138,0.12);
  border-color: var(--mre-mountain);
  text-decoration: none;
}
