/* ============================================================
   Dashboard View — Warm Command Center
   ============================================================ */

:root {
  --bg: #FAF7F2;
  --surface: #FFFFFF;
  --surface-2: #F4F0E8;
  --ink: #1C2B33;
  --ink-2: #3D5159;
  --muted: #6B7F87;
  --line: #E4DDD3;
  --line-strong: #C9C0B4;

  --amber: #F59E0B;
  --amber-bg: #FFFBEB;
  --amber-border: #FDE68A;
  --teal: #0D9488;
  --teal-bg: #F0FDFA;
  --teal-border: #99F6E4;
  --red: #DC2626;
  --red-bg: #FEF2F2;
  --red-border: #FECACA;
  --slate: #475569;

  --urgency-high: #0D9488;
  /* many open slots = good = teal */
  --urgency-mid: #F59E0B;
  /* few slots = amber */
  --urgency-low: #DC2626;
  /* full/removed = red */
  --urgency-none: #CBD5E1;
  /* unknown */

  --shortlist-gold: #D97706;

  --filter-h: 56px;
  --col-queue-w: 420px;
  --radius: 10px;
  --radius-sm: 6px;
  --shadow-card: 0 1px 3px rgba(28, 43, 51, 0.07), 0 4px 12px rgba(28, 43, 51, 0.04);
  --shadow-card-hover: 0 4px 16px rgba(28, 43, 51, 0.12), 0 1px 4px rgba(28, 43, 51, 0.06);
}

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

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

/* ============================================================
   App Shell
   ============================================================ */
.app-shell {
  display: flex;
  flex-direction: column;
  height: 100vh;
}

/* ============================================================
   Filter Bar
   ============================================================ */
.filter-bar {
  height: var(--filter-h);
  min-height: var(--filter-h);
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 0 16px;
  z-index: 50;
  box-shadow: 0 1px 4px rgba(28, 43, 51, 0.06);
}

.filter-bar-left {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.back-link {
  color: var(--muted);
  text-decoration: none;
  font-size: 1.1rem;
  line-height: 1;
  padding: 4px 6px;
  border-radius: var(--radius-sm);
  transition: background 0.15s, color 0.15s;
}

.back-link:hover {
  background: var(--surface-2);
  color: var(--ink);
}

.app-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--ink);
  white-space: nowrap;
}

.view-label {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--teal);
  background: var(--teal-bg);
  border: 1px solid var(--teal-border);
  border-radius: 999px;
  padding: 2px 8px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.filter-bar-center {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  min-width: 0;
  overflow-x: auto;
  scrollbar-width: none;
}

.filter-bar-center::-webkit-scrollbar {
  display: none;
}

.filter-chip-group {
  display: flex;
  align-items: center;
  gap: 5px;
  flex-shrink: 0;
}

.filter-chip-label {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--muted);
  white-space: nowrap;
}

.filter-select {
  font-family: inherit;
  font-size: 0.82rem;
  color: var(--ink);
  background: var(--surface-2);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  padding: 5px 8px;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.filter-select:focus {
  border-color: var(--teal);
  box-shadow: 0 0 0 2px rgba(13, 148, 136, 0.15);
}

.filter-search {
  font-family: inherit;
  font-size: 0.82rem;
  color: var(--ink);
  background: var(--surface-2);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  padding: 5px 10px;
  outline: none;
  width: 200px;
  transition: border-color 0.15s, box-shadow 0.15s, width 0.2s;
}

.filter-search:focus {
  border-color: var(--teal);
  box-shadow: 0 0 0 2px rgba(13, 148, 136, 0.15);
  width: 260px;
}

.util-range {
  accent-color: var(--teal);
  width: 80px;
  cursor: pointer;
}

.filter-bar-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.toggle-pill {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--ink-2);
  cursor: pointer;
  white-space: nowrap;
}

.toggle-pill input[type="checkbox"] {
  accent-color: var(--teal);
  width: 14px;
  height: 14px;
  cursor: pointer;
}

/* ============================================================
   Workspace & Columns
   ============================================================ */
.workspace {
  display: flex;
  flex: 1;
  overflow: hidden;
  gap: 0;
}

.col {
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
  border-right: 1px solid var(--line);
}

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

.col-queue {
  width: var(--col-queue-w);
  min-width: var(--col-queue-w);
  background: var(--bg);
}

.col-detail {
  flex: 1;
  background: var(--surface);
}

.col-map {
  flex: 1;
  background: #1a1a1a;
}

.col-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
  flex-shrink: 0;
}

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

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

.col-title {
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--ink);
}

.result-badge {
  font-size: 0.72rem;
  font-weight: 700;
  background: var(--surface-2);
  border: 1px solid var(--line-strong);
  color: var(--muted);
  border-radius: 999px;
  padding: 2px 8px;
}

.shortlist-badge {
  background: var(--amber-bg);
  border-color: var(--amber-border);
  color: var(--shortlist-gold);
}

.sort-select {
  font-family: inherit;
  font-size: 0.75rem;
  color: var(--ink-2);
  background: var(--surface-2);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  padding: 4px 6px;
  outline: none;
  cursor: pointer;
}

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

.col-body:focus {
  outline: none;
}

/* ============================================================
   Triage Card — Premium Redesign
   ============================================================ */
.triage-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0;
  cursor: pointer;
  transition: box-shadow 0.22s ease, transform 0.22s ease, border-color 0.22s ease;
  box-shadow: var(--shadow-card);
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
}


.triage-card:hover {
  box-shadow: 0 6px 24px rgba(28, 43, 51, 0.13), 0 2px 6px rgba(28, 43, 51, 0.06);
  transform: translateY(-2px);
  border-color: var(--line-strong);
}

.triage-card.focused {
  border-color: var(--teal);
  box-shadow: 0 0 0 2.5px rgba(13, 148, 136, 0.22), 0 6px 24px rgba(13, 148, 136, 0.08);
}

.triage-card.removed-card {
  opacity: 0.45;
  filter: grayscale(0.3);
}

/* Urgency ribbon — left border accent */
.urgency-ribbon {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 4px;
  border-radius: var(--radius) 0 0 var(--radius);
  background: var(--urgency-none);
}

.urgency-high .urgency-ribbon {
  background: var(--urgency-high);
}

.urgency-mid .urgency-ribbon {
  background: var(--urgency-mid);
}

.urgency-low .urgency-ribbon {
  background: var(--urgency-low);
}

.card-inner {
  padding: 14px 14px 12px 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 100%;
}

/* ---- Card Header ---- */
.card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
}

.card-name-block {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.card-name {
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--ink);
  line-height: 1.25;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  letter-spacing: -0.01em;
}

.card-subtitle {
  font-size: 0.68rem;
  font-weight: 500;
  color: var(--muted);
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: flex;
  align-items: center;
  gap: 5px;
}

.card-subtitle .cap-tag {
  font-weight: 700;
  color: var(--ink-2);
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 0 4px;
  font-size: 0.62rem;
  letter-spacing: 0.02em;
  line-height: 1.5;
}

.card-actions {
  display: flex;
  align-items: center;
  gap: 2px;
  flex-shrink: 0;
  opacity: 0;
  transition: opacity 0.18s ease;
}

.triage-card:hover .card-actions,
.triage-card.focused .card-actions {
  opacity: 1;
}

.icon-btn {
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  color: var(--muted);
  cursor: pointer;
  font-size: 0.92rem;
  width: 26px;
  height: 26px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s, color 0.15s, border-color 0.15s, transform 0.15s;
  line-height: 1;
}

.icon-btn:hover {
  background: var(--surface-2);
  border-color: var(--line-strong);
  color: var(--ink);
  transform: scale(1.1);
}

.icon-btn.star-on {
  color: var(--shortlist-gold);
  opacity: 1 !important;
}

/* Always show star if it's active */
.triage-card .card-actions:has(.star-on) {
  opacity: 1;
}

.icon-btn.star-on:hover {
  background: var(--amber-bg);
  border-color: var(--amber-border);
}

.icon-btn.remove-btn:hover {
  background: var(--red-bg);
  border-color: var(--red-border);
  color: var(--red);
}

.icon-btn.restore-btn:hover {
  background: var(--teal-bg);
  border-color: var(--teal-border);
  color: var(--teal);
}

/* ---- Utilization Gauge (hero element) ---- */
.card-gauge {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.card-gauge-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
}

.card-gauge-label {
  font-size: 0.6rem;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.card-gauge-value {
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.card-gauge-value.tone-green {
  color: var(--teal);
}

.card-gauge-value.tone-amber {
  color: #B45309;
}

.card-gauge-value.tone-red {
  color: var(--red);
}

.card-gauge-value.tone-neutral {
  color: var(--muted);
}

.card-gauge-est {
  font-size: 0.56rem;
  font-weight: 500;
  color: var(--muted);
  margin-left: 2px;
  letter-spacing: 0;
}

.card-gauge-track {
  position: relative;
  width: 100%;
  height: 6px;
  border-radius: 3px;
  background: var(--surface-2);
  overflow: hidden;
}

.card-gauge-fill {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  border-radius: 3px;
  transition: width 0.4s cubic-bezier(0.22, 1, 0.36, 1);
  min-width: 3px;
}

.card-gauge-fill.tone-green {
  background: linear-gradient(90deg, #5EEAD4, var(--teal));
}

.card-gauge-fill.tone-amber {
  background: linear-gradient(90deg, #FDE68A, var(--amber));
}

.card-gauge-fill.tone-red {
  background: linear-gradient(90deg, #FCA5A5, var(--red));
}

.card-gauge-fill.tone-neutral {
  background: var(--line-strong);
}

/* Subtle glow on gauge when card is hovered */
.triage-card:hover .card-gauge-fill.tone-green {
  box-shadow: 0 0 8px rgba(13, 148, 136, 0.35);
}

.triage-card:hover .card-gauge-fill.tone-amber {
  box-shadow: 0 0 8px rgba(245, 158, 11, 0.35);
}

.triage-card:hover .card-gauge-fill.tone-red {
  box-shadow: 0 0 8px rgba(220, 38, 38, 0.3);
}

/* ---- Card Stats Strip ---- */
.card-stats {
  display: flex;
  align-items: center;
  gap: 0;
  padding-top: 6px;
  border-top: 1px solid var(--line);
}

.card-stat {
  display: flex;
  align-items: baseline;
  gap: 3px;
  flex: 1;
  min-width: 0;
}

.card-stat+.card-stat {
  padding-left: 8px;
  border-left: 1px solid var(--line);
}

.card-stat-value {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--ink);
  white-space: nowrap;
  letter-spacing: -0.01em;
}

.card-stat-unit {
  font-size: 0.6rem;
  font-weight: 500;
  color: var(--muted);
  white-space: nowrap;
}

.card-stat-value.na {
  color: var(--muted);
  font-weight: 500;
  font-size: 0.75rem;
}

/* ---- Card Badges Row ---- */
.card-badges {
  display: flex;
  align-items: center;
  gap: 5px;
  flex-wrap: wrap;
}

.card-badge {
  font-size: 0.58rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  border-radius: 4px;
  padding: 2px 6px;
  line-height: 1.3;
}

.card-badge-clean {
  color: #047857;
  background: #ECFDF5;
  border: 1px solid #A7F3D0;
}

.card-badge-citations {
  color: var(--red);
  background: var(--red-bg);
  border: 1px solid var(--red-border);
}

.card-badge-removed {
  color: #7C3AED;
  background: #F5F3FF;
  border: 1px solid #DDD6FE;
}

.card-badge-headroom {
  color: var(--teal);
  background: var(--teal-bg);
  border: 1px solid var(--teal-border);
}

.card-badge-full {
  color: var(--red);
  background: var(--red-bg);
  border: 1px solid var(--red-border);
}

/* ---- Legacy compat (keep for detail panel) ---- */
.card-metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
  width: 100%;
  min-height: 52px;
  align-items: start;
  align-content: start;
}

.card-metric {
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.metric-label {
  font-size: 0.62rem;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.metric-value {
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--ink);
}

.metric-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  padding: 2px 8px;
  border: 1px solid var(--line);
  background: var(--surface-2);
  color: var(--ink);
}

.metric-pill-green {
  background: var(--teal-bg);
  border-color: var(--teal-border);
}

.metric-pill-amber {
  background: var(--amber-bg);
  border-color: var(--amber-border);
}

.metric-pill-red {
  background: var(--red-bg);
  border-color: var(--red-border);
}

.metric-pill-neutral {
  background: var(--surface-2);
  border-color: var(--line);
}

.metric-note {
  font-size: 0.58rem;
  color: var(--muted);
  line-height: 1.05;
}

.metric-value.teal {
  color: var(--teal);
}

.metric-value.amber {
  color: var(--amber);
}

.metric-value.red {
  color: var(--red);
}

.metric-value.muted {
  color: var(--muted);
  font-weight: 500;
}

/* Score chip */
.score-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.7rem;
  font-weight: 700;
  border-radius: 999px;
  padding: 2px 8px;
  border: 1px solid transparent;
}

.score-chip.score-high {
  background: var(--teal-bg);
  color: var(--teal);
  border-color: var(--teal-border);
}

.score-chip.score-mid {
  background: var(--amber-bg);
  color: #92400E;
  border-color: var(--amber-border);
}

.score-chip.score-low {
  background: var(--red-bg);
  color: var(--red);
  border-color: var(--red-border);
}

.score-chip.score-none {
  background: var(--surface-2);
  color: var(--muted);
  border-color: var(--line);
}

/* Donut arc */
.donut-wrap {
  display: flex;
  align-items: center;
  gap: 6px;
}

.donut-svg {
  flex-shrink: 0;
}

/* Card footer — now only used for removed cards */
.card-footer {
  display: none;
}

.card-footer-left {
  display: flex;
  align-items: center;
  gap: 6px;
}

.card-report-date {
  font-size: 0.72rem;
  color: var(--muted);
}

.clean-badge {
  font-size: 0.65rem;
  font-weight: 700;
  color: var(--teal);
  background: var(--teal-bg);
  border: 1px solid var(--teal-border);
  border-radius: 999px;
  padding: 1px 6px;
  letter-spacing: 0.03em;
}

.removed-badge {
  font-size: 0.65rem;
  font-weight: 700;
  color: var(--red);
  background: var(--red-bg);
  border: 1px solid var(--red-border);
  border-radius: 999px;
  padding: 1px 6px;
}

/* ============================================================
   Shortlist Cards
   ============================================================ */
.shortlist-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}

.shortlist-card:hover {
  background: var(--teal-bg);
  border-color: var(--teal-border);
}

.shortlist-card-name {
  flex: 1;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.shortlist-card-slots {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--teal);
  flex-shrink: 0;
}

.shortlist-remove-btn {
  background: transparent;
  border: none;
  color: var(--muted);
  cursor: pointer;
  font-size: 0.85rem;
  padding: 2px 4px;
  border-radius: 4px;
  line-height: 1;
  flex-shrink: 0;
  transition: color 0.15s, background 0.15s;
}

.shortlist-remove-btn:hover {
  color: var(--red);
  background: var(--red-bg);
}

/* ============================================================
   Detail Panel
   ============================================================ */
.detail-empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  gap: 16px;
  color: var(--muted);
  text-align: center;
  padding: 48px 32px;
}

.empty-icon {
  font-size: 2.8rem;
  filter: grayscale(0.3);
}

.detail-empty-state p {
  font-size: 0.88rem;
  line-height: 1.6;
  max-width: 300px;
}

.empty-hint {
  font-size: 0.76rem !important;
  color: var(--muted);
  opacity: 0.7;
}

kbd {
  display: inline-block;
  background: var(--surface-2);
  border: 1px solid var(--line-strong);
  border-radius: 4px;
  padding: 1px 5px;
  font-family: inherit;
  font-size: 0.72rem;
  color: var(--ink-2);
}

.close-detail-btn {
  font-family: inherit;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--muted);
  background: transparent;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  padding: 4px 10px;
  cursor: pointer;
  transition: background 0.18s, border-color 0.18s, color 0.18s;
}

.close-detail-btn:hover {
  background: var(--surface-2);
  border-color: var(--muted);
  color: var(--ink-2);
}

/* ------ Detail content wrapper ------ */
#detailContent {
  display: block;
  gap: 0;
}

.detail-wrap {
  padding: 0 24px 32px;
  display: flex;
  flex-direction: column;
  gap: 0;
}

/* ------ Hero Header ------ */
.detail-hero {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 24px 24px 20px;
  margin: 0 -24px;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, color-mix(in srgb, var(--teal) 4%, var(--surface)) 0%, var(--surface) 100%);
  position: relative;
}

.detail-hero::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--teal) 0%, color-mix(in srgb, var(--teal) 30%, transparent) 100%);
}

.detail-hero h3 {
  font-size: 1.4rem;
  font-weight: 800;
  color: var(--ink);
  line-height: 1.2;
  letter-spacing: -0.02em;
}

.detail-hero-sub {
  font-size: 0.82rem;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 6px;
  font-weight: 500;
}

.detail-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

/* ------ Utilization Gauge (detail) ------ */
.detail-quick-metrics {
  display: flex;
  flex-direction: column;
  gap: 0;
  margin-top: 0;
  padding: 16px 0;
  border-bottom: 1px solid var(--line);
}

.detail-quick-metric {
  border: none;
  background: transparent;
  border-radius: 0;
  padding: 0;
  min-width: 0;
}

.detail-gauge {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.detail-gauge-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
}

.detail-quick-metric-label {
  font-size: 0.64rem;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.detail-quick-metric-value {
  margin-top: 0;
  font-size: 1rem;
  font-weight: 800;
  color: var(--ink);
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 4px;
  letter-spacing: -0.01em;
}

.detail-quick-metric-paren {
  font-size: 0.76rem;
  font-weight: 600;
  color: var(--muted);
}

.detail-util-est {
  font-size: 0.64rem;
  font-weight: 600;
  color: var(--muted);
  margin-left: 2px;
}

.detail-gauge-track {
  height: 8px;
  background: var(--surface-2);
  border-radius: 99px;
  overflow: hidden;
  box-shadow: inset 0 1px 2px rgba(28, 43, 51, 0.08);
  border: 1px solid var(--line);
}

.detail-gauge-fill {
  height: 100%;
  border-radius: 99px;
  transition: width 0.45s cubic-bezier(0.22, 1, 0.36, 1);
  min-width: 4px;
}

.detail-gauge-fill.tone-green {
  background: linear-gradient(90deg, #10b981, #34d399);
}

.detail-gauge-fill.tone-amber {
  background: linear-gradient(90deg, #f59e0b, #fbbf24);
}

.detail-gauge-fill.tone-red {
  background: linear-gradient(90deg, #ef4444, #f87171);
}

.detail-gauge-stats {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-top: 2px;
}

.detail-gauge-stat {
  font-size: 0.74rem;
  color: var(--ink-2);
  font-weight: 500;
}

.detail-gauge-stat strong {
  font-weight: 700;
  color: var(--ink);
}

/* ------ Tags ------ */
.detail-tag {
  font-size: 0.7rem;
  font-weight: 600;
  border-radius: 999px;
  padding: 3px 10px;
  border: 1px solid var(--line-strong);
  background: var(--surface-2);
  color: var(--ink-2);
  box-shadow: 0 1px 2px rgba(28, 43, 51, 0.04);
}

.detail-tag-cap {
  background: var(--teal-bg);
  border-color: var(--teal-border);
  color: var(--teal);
}

.detail-tag-clean {
  background: #ECFDF5;
  border-color: #A7F3D0;
  color: #047857;
}

.detail-tag-citations {
  background: var(--amber-bg);
  border-color: var(--amber-border);
  color: #92400E;
}

.detail-tag-removed {
  background: var(--red-bg);
  border-color: var(--red-border);
  color: var(--red);
}

.detail-tag-context-review {
  background: var(--amber-bg);
  border-color: var(--amber-border);
  color: #92400E;
}

/* ------ Section System ------ */
.detail-section {
  padding: 22px 0;
  border-bottom: 1px solid var(--line);
}

.detail-section:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.detail-section-title {
  font-size: 0.68rem;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 14px;
  padding-left: 10px;
  border-left: 3px solid var(--teal);
}

/* ------ Enrollment Snapshot (donut + sparkline) ------ */
.census-snapshot-row {
  display: flex;
  align-items: flex-start;
  gap: 20px;
}

.occupancy-latest {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-shrink: 0;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px 16px;
  box-shadow: 0 2px 8px rgba(28, 43, 51, 0.05);
  transition: box-shadow 0.2s ease;
}

.occupancy-latest:hover {
  box-shadow: 0 4px 14px rgba(28, 43, 51, 0.08);
}

.occupancy-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.occupancy-card {
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.occupancy-card-title {
  font-size: 0.68rem;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.occupancy-card-body {
  display: flex;
  align-items: center;
  gap: 16px;
}

.occupancy-donut {
  flex-shrink: 0;
  position: relative;
  width: 72px;
  height: 72px;
}

.occupancy-donut svg {
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
}

.occupancy-donut-label {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--ink);
}

.occupancy-stats {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.occupancy-big {
  font-size: 1.35rem;
  font-weight: 800;
  color: var(--ink);
  line-height: 1.15;
  letter-spacing: -0.02em;
}

.occupancy-big-label {
  font-size: 0.68rem;
  color: var(--muted);
  font-weight: 500;
}

.occupancy-sub {
  font-size: 0.75rem;
  color: var(--ink-2);
  margin-top: 2px;
}

.occupancy-date {
  font-size: 0.68rem;
  color: var(--muted);
  margin-top: 4px;
  font-weight: 500;
  opacity: 0.8;
}

.occupancy-empty {
  font-size: 0.82rem;
  color: var(--muted);
  padding: 12px 0;
  font-style: italic;
}

/* ------ Sparkline Chart ------ */
.sparkline-chart {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.sparkline-chart svg {
  width: 100%;
  height: 100px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  box-shadow: 0 1px 4px rgba(28, 43, 51, 0.04);
}

.sparkline-legend {
  display: flex;
  align-items: center;
  gap: 14px;
  justify-content: flex-end;
}

.sparkline-legend-item {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 0.66rem;
  color: var(--ink-2);
  font-weight: 600;
}

.sparkline-swatch {
  display: inline-block;
  width: 14px;
  height: 3px;
  border-radius: 2px;
}

.sparkline-swatch-dashed {
  background: transparent;
  border-top: 2px dashed var(--line-strong);
  height: 0;
}

/* ------ Facility Info ------ */
.facility-info-list {
  display: flex;
  flex-direction: column;
  gap: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  overflow: hidden;
}

.facility-info-row {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 10px 14px;
  border-bottom: 1px solid color-mix(in srgb, var(--line) 50%, transparent);
  font-size: 0.82rem;
  color: var(--ink-2);
  transition: background 0.15s ease;
}

.facility-info-row:hover {
  background: color-mix(in srgb, var(--surface-2) 60%, transparent);
}

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

.facility-info-icon {
  flex-shrink: 0;
  width: 22px;
  text-align: center;
  font-size: 0.88rem;
  line-height: 1.4;
  opacity: 0.75;
}

.facility-info-content {
  flex: 1;
  min-width: 0;
}

.facility-info-label {
  font-size: 0.64rem;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 2px;
}

.facility-info-value {
  color: var(--ink);
  font-weight: 500;
  word-break: break-word;
}

.facility-info-value a {
  color: var(--teal);
  text-decoration: none;
  font-weight: 600;
  transition: color 0.15s;
}

.facility-info-value a:hover {
  text-decoration: underline;
  color: #0d7377;
}

/* ------ Reviews ------ */
.review-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 12px;
}

.review-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-2);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  box-shadow: 0 2px 8px rgba(28, 43, 51, 0.05);
  transition: box-shadow 0.2s ease, border-color 0.2s ease;
}

.review-card:hover {
  box-shadow: 0 4px 16px rgba(28, 43, 51, 0.08);
  border-color: var(--line-strong);
}

.review-card-disabled {
  opacity: 0.55;
}

.review-card-disabled:hover {
  box-shadow: 0 2px 8px rgba(28, 43, 51, 0.05);
  border-color: var(--line);
}

.review-card-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.review-card-provider {
  font-size: 0.88rem;
  font-weight: 800;
  color: var(--ink);
  letter-spacing: -0.01em;
}

.review-card-status {
  font-size: 0.62rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 600;
}

.review-card-link {
  font-size: 0.68rem;
  color: var(--teal);
  text-decoration: none;
  font-weight: 600;
  transition: color 0.15s;
}

.review-card-link:hover {
  text-decoration: underline;
  color: #0d7377;
}

.review-card-disabled-msg {
  font-size: 0.76rem;
  color: var(--muted);
  font-style: italic;
}

/* --- Hero rating + count --- */
.review-card-hero {
  display: flex;
  align-items: center;
  gap: 20px;
}

.review-card-rating {
  display: flex;
  align-items: center;
  gap: 10px;
}

.review-card-rating-num {
  font-size: 2rem;
  font-weight: 900;
  color: var(--ink);
  line-height: 1;
  letter-spacing: -0.03em;
}

.review-card-stars {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.review-card-star-track {
  width: 60px;
  height: 6px;
  background: var(--surface);
  border-radius: 99px;
  overflow: hidden;
  border: 1px solid var(--line);
  box-shadow: inset 0 1px 2px rgba(28, 43, 51, 0.06);
}

.review-card-star-fill {
  height: 100%;
  border-radius: 99px;
  transition: width 0.4s cubic-bezier(0.22, 1, 0.36, 1);
  min-width: 3px;
}

.review-card-star-fill.tone-green {
  background: linear-gradient(90deg, #10b981, #34d399);
}

.review-card-star-fill.tone-amber {
  background: linear-gradient(90deg, #f59e0b, #fbbf24);
}

.review-card-star-fill.tone-red {
  background: linear-gradient(90deg, #ef4444, #f87171);
}

.review-card-star-label {
  font-size: 0.58rem;
  color: var(--muted);
  font-weight: 600;
  letter-spacing: 0.02em;
}

.review-card-count {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
  padding-left: 20px;
  border-left: 1px solid var(--line);
}

.review-card-count-num {
  font-size: 1.4rem;
  font-weight: 800;
  color: var(--ink);
  line-height: 1;
  letter-spacing: -0.02em;
}

.review-card-count-label {
  font-size: 0.58rem;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* --- Review snippets --- */
.review-snippets {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 0;
  padding: 10px 0 0;
  border-top: 1px solid var(--line);
}

.review-snippet-text {
  font-size: 0.74rem;
  color: var(--ink-2);
  line-height: 1.5;
  font-style: italic;
}

.review-snippet-meta {
  margin-top: 3px;
  font-size: 0.66rem;
  color: var(--muted);
  font-weight: 500;
}

.review-card-error {
  font-size: 0.7rem;
  color: var(--red);
  line-height: 1.3;
  font-weight: 500;
}

/* ------ Contact persons ------ */
.contact-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 2px;
}

.contact-list li {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.82rem;
}

.contact-name {
  font-weight: 600;
  color: var(--ink);
}

.contact-role {
  font-size: 0.7rem;
  color: var(--muted);
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 1px 7px;
}

.entity-chip-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.entity-chip-btn {
  border: 1px solid var(--line);
  background: var(--surface-2);
  color: var(--ink);
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 0.74rem;
  cursor: pointer;
}

.entity-chip-btn:hover {
  border-color: var(--line-strong);
}

.entity-chip-btn.selected {
  border-color: var(--teal);
  background: color-mix(in srgb, var(--teal) 12%, white);
}

.entity-chip-type {
  margin-left: 6px;
  color: var(--muted);
  font-size: 0.68rem;
  text-transform: lowercase;
}

.people-raw-contacts {
  margin-top: 8px;
}

.people-raw-contacts summary {
  color: var(--muted);
  font-size: 0.72rem;
  cursor: pointer;
}

.entity-empty {
  font-size: 0.82rem;
  color: var(--muted);
  border: 1px dashed var(--line);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  font-style: italic;
  background: color-mix(in srgb, var(--surface-2) 50%, transparent);
}

.entity-header-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.entity-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--ink);
}

.entity-muted {
  color: var(--muted);
  font-size: 0.74rem;
}

.entity-admin-link {
  font-size: 0.74rem;
  color: var(--teal);
  text-decoration: none;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 4px 10px;
  white-space: nowrap;
}

.entity-admin-link:hover {
  border-color: var(--line-strong);
}

.entity-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.entity-card {
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  background: var(--surface-2);
}

.entity-card h4 {
  margin: 0 0 8px;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
}

.entity-card ul {
  margin: 0;
  padding-left: 16px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.entity-facility-link {
  border: 0;
  background: transparent;
  color: var(--teal);
  text-decoration: underline;
  cursor: pointer;
  padding: 0;
  font-size: 0.78rem;
}

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

  .entity-header-row {
    flex-direction: column;
  }
}

/* ------ Site Operations ------ */
.site-summary-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  margin-bottom: 12px;
  flex-wrap: wrap;
}

.site-summary-stat {
  font-size: 0.82rem;
  color: var(--ink-2);
}

.site-summary-stat strong {
  color: var(--ink);
  font-weight: 700;
}

.site-summary-sep {
  width: 1px;
  height: 16px;
  background: var(--line-strong);
  flex-shrink: 0;
}

.linked-license-table-wrap {
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  overflow: auto;
  max-height: 220px;
  box-shadow: 0 1px 4px rgba(28, 43, 51, 0.04);
}

.linked-license-table-wrap table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.76rem;
}

.linked-license-table-wrap th {
  background: linear-gradient(180deg, var(--surface-2) 0%, color-mix(in srgb, var(--surface-2) 90%, var(--surface)) 100%);
  text-align: left;
  padding: 8px 10px;
  font-weight: 700;
  color: var(--muted);
  border-bottom: 1px solid var(--line);
  font-size: 0.66rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  position: sticky;
  top: 0;
}

.linked-license-table-wrap td {
  padding: 7px 10px;
  border-bottom: 1px solid color-mix(in srgb, var(--line) 50%, transparent);
  color: var(--ink-2);
  vertical-align: top;
}

.linked-license-table-wrap tbody tr {
  transition: background 0.12s ease;
}

.linked-license-table-wrap tbody tr:hover {
  background: color-mix(in srgb, var(--teal-bg) 40%, transparent);
}

.linked-license-table-wrap tr:last-child td {
  border-bottom: none;
}

.linked-license-selected {
  background: var(--teal-bg);
}

.linked-license-selected td {
  color: var(--ink);
  font-weight: 500;
}

.co-located-list {
  margin: 0;
  padding-left: 18px;
}

.detail-copy-historical {
  border: 1px solid var(--amber-border);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  background: var(--amber-bg);
  margin-top: 12px;
  font-size: 0.78rem;
}

.detail-copy-historical h4 {
  font-size: 0.68rem;
  font-weight: 700;
  color: #92400E;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin: 0 0 8px;
}

.detail-copy-historical li {
  font-size: 0.78rem;
  color: var(--ink-2);
  margin-bottom: 4px;
}

.detail-copy h4 {
  margin: 0 0 8px;
  font-size: 0.68rem;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

/* ------ Reports / Visit History ------ */
.reports-table-wrap {
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  overflow: auto;
  max-height: 280px;
  box-shadow: 0 1px 4px rgba(28, 43, 51, 0.04);
}

.reports-table-wrap table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.76rem;
}

.reports-table-wrap th {
  background: linear-gradient(180deg, var(--surface-2) 0%, color-mix(in srgb, var(--surface-2) 90%, var(--surface)) 100%);
  text-align: left;
  padding: 8px 10px;
  font-weight: 700;
  color: var(--muted);
  border-bottom: 1px solid var(--line);
  font-size: 0.66rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  position: sticky;
  top: 0;
  z-index: 1;
}

.reports-table-wrap td {
  padding: 7px 10px;
  border-bottom: 1px solid color-mix(in srgb, var(--line) 50%, transparent);
  color: var(--ink-2);
  vertical-align: top;
}

.reports-table-wrap tbody tr {
  transition: background 0.12s ease;
}

.reports-table-wrap tbody tr:hover {
  background: color-mix(in srgb, var(--teal-bg) 40%, transparent);
}

.reports-table-wrap tbody tr:nth-child(even) {
  background: color-mix(in srgb, var(--surface-2) 40%, transparent);
}

.reports-table-wrap tbody tr:nth-child(even):hover {
  background: color-mix(in srgb, var(--teal-bg) 40%, transparent);
}

.reports-table-wrap tr:last-child td {
  border-bottom: none;
}

.report-link {
  color: var(--teal);
  font-weight: 600;
  text-decoration: none;
  font-size: 0.72rem;
  transition: color 0.15s;
}

.report-link:hover {
  text-decoration: underline;
  color: #0d7377;
}

.value-flag {
  display: inline-flex;
  margin-left: 6px;
  padding: 1px 6px;
  border-radius: 999px;
  background: var(--amber-bg);
  color: #92400e;
  border: 1px solid var(--amber-border);
  font-size: 0.64rem;
  font-weight: 700;
  vertical-align: middle;
}

/* ============================================================
   Map Column
   ============================================================ */
.map-container {
  width: 100%;
  height: 100%;
}

/* ============================================================
   Empty / Loading States
   ============================================================ */
.queue-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 40px 20px;
  color: var(--muted);
  text-align: center;
  font-size: 0.85rem;
}

.shortlist-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 32px 16px;
  color: var(--muted);
  text-align: center;
  font-size: 0.82rem;
}

.shortlist-empty p {
  line-height: 1.5;
}

/* ============================================================
   Search Suggestions Dropdown
   ============================================================ */
.search-combobox {
  position: relative;
}

.search-suggestions {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  min-width: 240px;
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  list-style: none;
  padding: 4px;
  z-index: 200;
  max-height: 220px;
  overflow-y: auto;
  box-shadow: 0 8px 24px rgba(28, 43, 51, 0.14);
}

.search-suggestions[hidden] {
  display: none;
}

.search-suggestions li {
  padding: 8px 10px;
  font-size: 0.82rem;
  cursor: pointer;
  border-radius: var(--radius-sm);
  color: var(--ink);
  line-height: 1.35;
}

.search-suggestions li:hover,
.search-suggestions li.active {
  background: var(--teal-bg);
  color: var(--teal);
}

.search-suggestion-line {
  font-size: 0.82rem;
}

.search-suggestion-meta {
  font-size: 0.72rem;
  color: var(--muted);
  margin-top: 2px;
}

.search-match {
  font-weight: 700;
  color: var(--teal);
}

/* ============================================================
   Scrollbars
   ============================================================ */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: var(--line-strong);
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--muted);
}

/* ============================================================
   Leaflet overrides
   ============================================================ */
.leaflet-popup-content-wrapper {
  font-family: 'DM Sans', sans-serif;
  font-size: 0.82rem;
  border-radius: var(--radius) !important;
}

.triage-map-marker {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  border: 2px solid #fff;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.4);
}

.triage-map-marker.marker-clean {
  background: var(--teal);
}

.triage-map-marker.marker-warn {
  background: var(--amber);
}

.triage-map-marker.marker-full {
  background: var(--red);
}

.triage-map-marker.marker-selected {
  transform: scale(1.6);
  border-color: var(--ink);
  z-index: 1000 !important;
}