/* ═══════════════════════════════════════════════════════════════════════
   MITIGATION & MARKET COMMAND CENTER (.mh-*)
   Accent: Amber (#F59E0B) — shared layout from hub-base.css via [data-hub]
   ═══════════════════════════════════════════════════════════════════════ */
.mh-root { --hub-accent: var(--guide-color-action); }

/* ── Mini-Map (embedded interactive Montana map per widget) ── */
.mh-minimap {
  display: block;
  background: var(--guide-color-raised);
  border: 1px solid var(--border-subtle, rgba(0,0,0,0.07));
  border-radius: var(--radius-lg, 12px);
  padding: 12px 14px;
  margin: 8px 0 12px;
  position: relative;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.6), var(--guide-shadow-rest);
}
.mh-minimap-title {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: var(--text-xs);
  font-weight: 700;
  text-transform: var(--guide-label-case, uppercase);
  letter-spacing: 0.6px;
  color: var(--text-tertiary, #8A8A95);
  margin-bottom: 4px;
}
.mh-minimap-title i { width: 11px; height: 11px; opacity: 0.7; }
.guide-mm-host { position: relative; }
.guide-mm-svg { display: block; width: 100%; height: auto; }
.guide-mm-feature { transition: transform 0.12s ease; transform-origin: center; transform-box: fill-box; }
/* Scale-on-hover only for point/hex markers — choropleth cells must not scale or the tessellation tears. */
.guide-mm-feature:not(.guide-mm-cell):hover { transform: scale(1.18); }
.guide-mm-cell .guide-mm-shape { transition: fill-opacity 0.12s ease, stroke-width 0.12s ease, stroke 0.12s ease; }

/* ── DNRC Change Application Tracker (unique to market-hub) ── */
.mh-app-tracker {
  margin-bottom: 12px;
}
.mh-app-tracker-title {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: var(--guide-fs-xs);
  font-weight: 700;
  color: var(--text-secondary, #4A4A52);
  margin-bottom: 8px;
}
.mh-app-tracker-title i { width: 14px; height: 14px; color: var(--guide-color-plum); }
.mh-app-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 9px;
  background: var(--guide-color-plum);
  color: var(--guide-color-text-on-accent, #fff);
  font-size: var(--guide-fs-2xs);
  font-weight: 700;
}
.mh-app-cards {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.mh-app-card {
  background: var(--bg-3);
  border: 1px solid var(--border-subtle, var(--guide-color-border-subtle, rgba(0,0,0,0.06)));
  border-radius: var(--radius-lg);
  padding: 10px 12px;
  cursor: pointer;
  transition: box-shadow 0.15s ease,
    transform 0.15s ease;
}
.mh-app-card:hover {
  transform: translateX(2px);
  box-shadow: var(--guide-shadow-rest);
}
.mh-app-card-head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
}
.mh-app-num {
  font-size: var(--guide-fs-xs);
  font-weight: 700;
  color: var(--text-primary, #1A1A1F);
  font-variant-numeric: tabular-nums;
}
.mh-app-type {
  font-size: var(--guide-fs-2xs);
  font-weight: 600;
  padding: 1px 6px;
  border-radius: 4px;
  background: color-mix(in srgb, var(--guide-color-plum) 10%, transparent);
  color: var(--guide-color-plum);
  text-transform: var(--guide-label-case, uppercase);
  letter-spacing: 0.3px;
}
.mh-app-card--urgent .mh-app-type {
  background: color-mix(in srgb, var(--guide-color-status-crit) 10%, transparent);
  color: var(--guide-color-status-crit);
}
.mh-app-deadline {
  margin-left: auto;
  font-size: var(--guide-fs-2xs);
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 6px;
  background: color-mix(in srgb, var(--guide-color-ochre) 12%, transparent);
  color: var(--guide-color-status-warn, #B45309);
}
.mh-app-deadline--past {
  background: color-mix(in srgb, var(--guide-color-status-crit) 10%, transparent);
  color: var(--guide-color-status-crit);
}
.mh-app-card-body {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.mh-app-applicant {
  font-size: var(--guide-fs-xs);
  font-weight: 600;
  color: var(--text-primary, #1A1A1F);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.mh-app-detail {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: var(--guide-fs-2xs);
  color: var(--text-tertiary, #8A8A95);
}
.mh-app-detail i { width: 10px; height: 10px; }
.mh-app-viewall {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 6px 10px;
  border-radius: 8px;
  border: 1px solid var(--border-subtle, rgba(0,0,0,0.08));
  background: transparent;
  color: var(--guide-color-plum);
  font-size: var(--guide-fs-2xs);
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s ease,
    border-color 0.15s ease;
}
.mh-app-viewall:hover {
  background: color-mix(in srgb, var(--guide-color-plum) 6%, transparent);
  border-color: var(--guide-color-plum);
}
.mh-app-viewall i { width: 12px; height: 12px; }

/* ═══════════════════════════════════════════════════════════════════════
   MARKETPLACE LISTING CARDS (Item 14)
   ═══════════════════════════════════════════════════════════════════════ */
.mh-listing-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 12px;
  margin-top: 12px;
}
.mh-listing-card {
  background: var(--bg-3);
  border: 1px solid var(--border-subtle, var(--guide-color-border-subtle, rgba(0,0,0,0.06)));
  border-radius: var(--radius-lg);
  padding: 14px;
  cursor: pointer;
  transition: box-shadow 0.2s ease,
    transform 0.2s ease;
  position: relative;
}
.mh-listing-card:hover {
  box-shadow: var(--guide-shadow-raised);
}
.mh-listing-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
}
.mh-listing-wr {
  font-size: var(--guide-fs-xs);
  font-weight: 700;
  color: var(--text-primary, #1A1A1F);
  font-variant-numeric: tabular-nums;
}
.mh-seniority-badge {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: var(--guide-fs-2xs);
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 6px;
  text-transform: var(--guide-label-case, uppercase);
  letter-spacing: 0.4px;
}
.mh-seniority-badge--gold {
  background: #FEF3C7;
  color: #92400E;
  border: 1px solid var(--guide-color-ochre);
}
.mh-seniority-badge--silver {
  background: var(--guide-color-paper-2);
  color: var(--guide-color-ink-soft);
  border: 1px solid #9CA3AF;
}
.mh-seniority-badge--bronze {
  background: #FED7AA;
  color: #9A3412;
  border: 1px solid var(--guide-color-clay);
}
.mh-listing-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 8px;
}
.mh-flow-badge, .mh-price-badge, .mh-source-badge {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: var(--guide-fs-2xs);
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 5px;
}
.mh-flow-badge {
  background: color-mix(in srgb, var(--guide-color-lake) 10%, transparent);
  color: var(--guide-color-lake);
}
.mh-price-badge {
  background: color-mix(in srgb, var(--guide-color-moss) 10%, transparent);
  color: var(--guide-color-moss);
}
.mh-source-badge {
  background: color-mix(in srgb, var(--guide-color-plum) 10%, transparent);
  color: var(--guide-color-plum);
}
.mh-listing-purpose {
  font-size: var(--guide-fs-2xs);
  color: var(--text-secondary, #4A4A52);
  margin-bottom: 4px;
}
.mh-listing-status {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: var(--guide-fs-2xs);
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 4px;
  text-transform: var(--guide-label-case, uppercase);
}
.mh-listing-status--active {
  background: color-mix(in srgb, var(--guide-color-moss) 10%, transparent);
  color: var(--guide-color-moss);
}
.mh-listing-status--pending {
  background: color-mix(in srgb, var(--guide-color-ochre) 10%, transparent);
  color: var(--guide-color-status-warn, #B45309);
}
.mh-listing-status--sold {
  background: rgba(107, 114, 128, 0.1);
  color: var(--guide-color-status-mute, #6B7280);
}
.mh-listing-meta {
  display: flex;
  gap: 8px;
  font-size: var(--guide-fs-2xs);
  color: var(--text-tertiary, #8A8A95);
  margin-top: 6px;
}
.mh-listing-meta i { width: 10px; height: 10px; }

/* ═══════════════════════════════════════════════════════════════════════
   MARKET ANALYTICS & MITIGATION ADEQUACY (Item 15)
   ═══════════════════════════════════════════════════════════════════════ */
.mh-chart-container {
  background: var(--bg-3);
  border-radius: var(--radius-lg);
  padding: 16px;
  margin-bottom: 12px;
}
.mh-chart-title {
  font-size: var(--guide-fs-xs);
  font-weight: 700;
  color: var(--text-primary, #1A1A1F);
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.mh-chart-title i { width: 14px; height: 14px; color: var(--hub-accent, #F59E0B); }
.mh-chart-sparkline {
  width: 100%;
  height: 60px;
}
.mh-chart-sparkline svg { width: 100%; height: 100%; }
.mh-chart-bar-group {
  display: flex;
  align-items: flex-end;
  gap: 4px;
  height: 80px;
  padding: 0 4px;
}
.mh-chart-bar {
  flex: 1;
  background: color-mix(in srgb, var(--guide-color-ochre) 30%, transparent);
  border-radius: 3px 3px 0 0;
  transition: height 0.3s ease;
  position: relative;
}
.mh-chart-bar:hover {
  background: color-mix(in srgb, var(--guide-color-ochre) 60%, transparent);
}
.mh-chart-bar-label {
  position: absolute;
  bottom: -16px;
  left: 50%;
  transform: translateX(-50%);
  font-size: var(--guide-fs-2xs);
  color: var(--text-tertiary);
  white-space: nowrap;
}

/* Mitigation Adequacy Gauge */
.mh-adequacy-container {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 16px;
}
.mh-adequacy-gauge {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.mh-adequacy-label {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: var(--guide-fs-2xs);
  font-weight: 600;
}
.mh-adequacy-label-name { color: var(--text-secondary); }
.mh-adequacy-label-score { font-variant-numeric: tabular-nums; }
.mh-adequacy-bar {
  height: 8px;
  background: var(--bg-2, #F3F4F6);
  border-radius: 4px;
  overflow: hidden;
}
.mh-adequacy-fill {
  height: 100%;
  border-radius: 4px;
  transition: width 0.5s ease;
}
.mh-adequacy-composite {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 16px;
  margin-top: 8px;
  background: var(--bg-2, #F3F4F6);
  border-radius: var(--radius-lg);
}
.mh-adequacy-grade {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--guide-fs-2xl);
  font-weight: 800;
  color: var(--guide-color-text-on-accent, #fff);
}
.mh-adequacy-summary {
  font-size: var(--guide-fs-xs);
  color: var(--text-secondary);
  line-height: 1.5;
}
.mh-adequacy-summary strong { color: var(--text-primary); }

/* Supply/Demand Gauge */
.mh-supply-demand-gauge {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 12px;
}
.mh-sd-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: var(--guide-fs-2xs);
}
.mh-sd-label {
  width: 60px;
  font-weight: 600;
  color: var(--text-secondary);
  text-align: right;
}
.mh-sd-bar {
  flex: 1;
  height: 10px;
  background: var(--bg-2);
  border-radius: 5px;
  overflow: hidden;
}
.mh-sd-fill {
  height: 100%;
  border-radius: 5px;
  transition: width 0.5s ease;
}
.mh-sd-val {
  width: 40px;
  font-size: var(--guide-fs-2xs);
  font-variant-numeric: tabular-nums;
  color: var(--text-tertiary);
}

/* ═══════════════════════════════════════════════════════════════════════
   DASHBOARDS, SCORECARDS, BASIN CARDS (Item 16)
   ═══════════════════════════════════════════════════════════════════════ */
.mh-dashboard-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 10px;
  margin-top: 12px;
}
.mh-dashboard-cell {
  background: var(--bg-3);
  border: 1px solid var(--border-subtle, var(--guide-color-border-subtle, rgba(0,0,0,0.06)));
  border-radius: var(--radius-lg);
  padding: 12px;
  text-align: center;
  transition: transform 0.15s ease;
}
.mh-dashboard-cell:hover { transform: scale(1.02); }
.mh-dashboard-val {
  font-size: var(--guide-fs-lg);
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  margin-bottom: 2px;
}
.mh-dashboard-label {
  font-size: var(--guide-fs-2xs);
  font-weight: 600;
  color: var(--text-tertiary, #8A8A95);
  text-transform: var(--guide-label-case, uppercase);
  letter-spacing: 0.4px;
}

.mh-grade-circle {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--guide-fs-2xl);
  font-weight: 800;
  margin: 0 auto 10px;
  /* A flat ring; the letter carries the grade and takes the role colour. */
  background: var(--guide-color-raised);
  border: 2px solid currentColor;
  color: var(--guide-color-ink);
}
.mh-grade-circle--a { color: var(--guide-color-moss); }
.mh-grade-circle--b { color: var(--guide-color-ink); }
.mh-grade-circle--c,
.mh-grade-circle--d { color: var(--guide-color-ochre); }
.mh-grade-circle--f { color: var(--guide-color-brick); }

.mh-scorecard-domain {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 0;
  border-bottom: 1px solid var(--border-subtle, rgba(0,0,0,0.04));
}
.mh-scorecard-domain:last-child { border-bottom: none; }
.mh-scorecard-name {
  flex: 1;
  font-size: var(--guide-fs-2xs);
  font-weight: 600;
  color: var(--text-secondary);
}
.mh-scorecard-weight {
  font-size: var(--guide-fs-2xs);
  color: var(--text-tertiary);
  width: 32px;
  text-align: right;
}
.mh-scorecard-bar {
  width: 80px;
  height: 6px;
  background: var(--bg-2);
  border-radius: 3px;
  overflow: hidden;
}
.mh-scorecard-fill {
  height: 100%;
  border-radius: 3px;
  transition: width 0.5s ease;
}
.mh-scorecard-grade {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--guide-fs-2xs);
  font-weight: 800;
  color: var(--guide-color-text-on-accent, #fff);
}

/* Basin Report Rows */
.mh-basin-table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--guide-fs-2xs);
}
.mh-basin-table th {
  text-align: left;
  font-size: var(--guide-fs-2xs);
  font-weight: 700;
  text-transform: var(--guide-label-case, uppercase);
  letter-spacing: 0.4px;
  color: var(--text-tertiary);
  padding: 6px 8px;
  border-bottom: 2px solid var(--border-subtle);
  cursor: pointer;
  user-select: none;
}
.mh-basin-table th:hover { color: var(--text-primary); }
.mh-basin-table td {
  padding: 8px;
  border-bottom: 1px solid var(--border-subtle, rgba(0,0,0,0.04));
  color: var(--text-secondary);
}
.mh-basin-table tr:hover td {
  background: color-mix(in srgb, var(--guide-color-ochre) 4%, transparent);
}
.mh-basin-row-grade {
  display: inline-flex;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  align-items: center;
  justify-content: center;
  font-size: var(--guide-fs-2xs);
  font-weight: 800;
  color: var(--guide-color-text-on-accent, #fff);
}
.mh-basin-row-demand {
  display: inline-block;
  width: 48px;
  height: 5px;
  background: var(--bg-2);
  border-radius: 3px;
  overflow: hidden;
  vertical-align: middle;
}
.mh-basin-row-demand-fill {
  height: 100%;
  border-radius: 3px;
}

/* Hex Panel */
.mh-hex-panel {
  margin-top: 12px;
}
.mh-hex-controls {
  display: flex;
  gap: 6px;
  margin-bottom: 10px;
  flex-wrap: wrap;
}
.mh-hex-mode-btn {
  padding: 4px 10px;
  border-radius: 6px;
  border: 1px solid var(--guide-color-line-strong);
  background: var(--guide-color-raised);
  font-size: var(--guide-fs-2xs);
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s ease,
    border-color 0.15s ease,
    color 0.15s ease;
  color: var(--guide-color-ink-soft);
}
.mh-hex-mode-btn:hover { border-color: var(--guide-color-ink-soft); color: var(--guide-color-ink); }
.mh-hex-mode-btn.active {
  border-color: var(--guide-color-action); box-shadow: inset 0 0 0 1px var(--guide-color-action); background: var(--guide-color-raised); color: var(--guide-color-ink);
}
.mh-hex-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 6px;
}
.mh-hex-cell {
  aspect-ratio: 1;
  border-radius: 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 6px;
  cursor: pointer;
  transition: border-color 0.15s ease,
    box-shadow 0.15s ease,
    transform 0.15s ease;
  border: 1px solid transparent;
}
.mh-hex-cell:hover {
  transform: scale(1.05);
  border-color: rgba(255,255,255,0.3);
  box-shadow: var(--guide-shadow-raised);
}
.mh-hex-cell-name {
  font-size: var(--guide-fs-2xs);
  font-weight: 700;
  color: inherit;
  text-align: center;
  line-height: 1.1;
  opacity: 0.9;
}
.mh-hex-cell-val {
  font-size: var(--guide-fs-xs);
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

/* ═══════════════════════════════════════════════════════════════════════
   MOBILE RESPONSIVE (Item 17)
   ═══════════════════════════════════════════════════════════════════════ */
@media (max-width: 768px) {
  .mh-listing-grid {
    grid-template-columns: 1fr;
  }
  .mh-dashboard-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .mh-hex-grid {
    grid-template-columns: repeat(4, 1fr);
  }
  .mh-adequacy-container {
    padding: 10px;
  }
  .mh-chart-bar-group {
    height: 60px;
  }
  .mh-basin-table {
    font-size: var(--guide-fs-2xs);
  }
  .mh-basin-table th,
  .mh-basin-table td {
    padding: 5px 4px;
  }
}
@media (max-width: 480px) {
  .mh-listing-card { padding: 10px; }
  .mh-dashboard-grid {
    grid-template-columns: 1fr 1fr;
    gap: 6px;
  }
  .mh-hex-grid {
    grid-template-columns: repeat(3, 1fr);
  }
  .mh-grade-circle {
    width: 48px;
    height: 48px;
    font-size: var(--guide-fs-xl);
  }
  .mh-scorecard-bar { width: 60px; }
  .mh-adequacy-grade {
    width: 44px;
    height: 44px;
    font-size: var(--guide-fs-xl);
  }
}

/* ─── Dark theme overrides ─────────────────────────────────────────── */
[data-theme="dark"] .mh-minimap { background: var(--guide-color-raised); }
[data-theme="dark"] .mh-seniority-badge--silver { background: rgba(203,213,225,0.12); color: #CBD5E1; border-color: rgba(203,213,225,0.25); }
[data-theme="dark"] .mh-seniority-badge--bronze { background: rgba(253,186,116,0.18); color: #FDBA74; border-color: rgba(253,186,116,0.35); }
