/* ═══════════════════════════════════════════════════════════════
   SurabayaSambat — Government Intelligence Dashboard
   Premium Design System · v2.0
   ═══════════════════════════════════════════════════════════════ */

/* ── Design Tokens ─────────────────────────────────────────── */
:root {
  /* Brand — Primary (Hijau) */
  --green-950: #062e23;
  --green-900: #0a3f30;
  --green-800: #126149;
  --green-700: #18755a;
  --green-600: #1e8c6b;
  --green-100: #e2f1ea;
  --green-50:  #f0f7f4;

  /* Brand — Secondary (Sand / Gold) */
  --sand:      #d2b690;
  --sand-light: #e8dbc8;
  --sand-soft: #f8f3ec;
  --sand-dark: #6d5638;
  --sand-950:  #3d2e1a;

  /* Neutrals */
  --ink:       #1a1f1d;
  --ink-secondary: #3d4a44;
  --muted:     #5d6e66;
  --subtle:    #8a9b93;
  --canvas:    #f5f6f5;
  --surface:   #ffffff;
  --border:    #e2e7e4;
  --border-strong: #c5cec8;

  /* Semantic */
  --red:       #c4291e;
  --red-dark:  #8f1c13;
  --red-soft:  #fef2f0;
  --red-muted: #f5d5d1;
  --orange:    #b54708;
  --orange-soft: #fef6ee;
  --yellow:    #9a6700;
  --yellow-soft: #fffae6;
  --blue:      #1a61d1;
  --blue-soft: #f0f5ff;

  /* Elevation */
  --shadow-xs:  0 1px 2px rgba(15, 40, 30, .04);
  --shadow-sm:  0 1px 3px rgba(15, 40, 30, .06), 0 1px 2px rgba(15, 40, 30, .04);
  --shadow-md:  0 4px 12px rgba(15, 40, 30, .06), 0 1px 3px rgba(15, 40, 30, .04);
  --shadow-lg:  0 8px 28px rgba(15, 40, 30, .08), 0 2px 6px rgba(15, 40, 30, .03);
  --shadow-xl:  0 16px 48px rgba(15, 40, 30, .10), 0 4px 12px rgba(15, 40, 30, .04);

  /* Radius */
  --radius-sm: 6px;
  --radius:    10px;
  --radius-lg: 14px;
  --radius-xl: 18px;

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

  /* Spacing */
  --space-xs:  4px;
  --space-sm:  8px;
  --space-md:  16px;
  --space-lg:  24px;
  --space-xl:  32px;
  --space-2xl: 48px;

  /* Transitions */
  --ease-out: cubic-bezier(0.25, 0.46, 0.45, 0.94);
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  --duration-fast: 120ms;
  --duration-normal: 200ms;

  font-family: var(--font-sans);
  color: var(--ink);
  background: var(--canvas);
  font-synthesis: none;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

/* ── Reset ─────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }
html { min-width: 320px; scroll-behavior: smooth; background: var(--canvas); }
body { min-width: 320px; min-height: 100vh; margin: 0; background: var(--canvas); color: var(--ink); line-height: 1.5; }
button, input, select, textarea { font: inherit; }
button, a, input, select, textarea { outline-offset: 3px; }
:focus-visible { outline: 2px solid var(--green-600); outline-offset: 2px; }
[hidden] { display: none !important; }
a { color: var(--green-700); text-decoration: none; }
a:hover { color: var(--green-800); }

/* ── Skip Link ─────────────────────────────────────────────── */
.skip-link {
  position: fixed; z-index: 10000; top: 10px; left: 12px;
  padding: 10px 16px; transform: translateY(-160%);
  border: 2px solid var(--green-700); border-radius: var(--radius-sm);
  background: var(--surface); font-weight: 700; font-size: .82rem;
  transition: transform var(--duration-normal) var(--ease-spring);
}
.skip-link:focus { transform: translateY(0); }

/* ══════════════════════════════════════════════════════════════
   HEADER — Premium Glassmorphic Design
   ══════════════════════════════════════════════════════════════ */
.site-header {
  position: sticky; z-index: 1000; top: 0;
  background: rgba(6, 46, 35, 0.75); /* --green-950 with opacity */
  backdrop-filter: blur(24px) saturate(150%);
  -webkit-backdrop-filter: blur(24px) saturate(150%);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  color: #fff;
  box-shadow: 0 4px 24px -2px rgba(0, 0, 0, 0.1);
}
.header-inner {
  width: min(1440px, 100%);
  min-height: 72px;
  margin: 0 auto;
  padding: 0 clamp(16px, 3vw, 40px);
  display: flex; align-items: center; justify-content: space-between;
}

/* Brand */
.brand {
  display: flex; align-items: center; gap: 14px;
  color: #fff; text-decoration: none;
  padding: 12px 0;
  transition: opacity var(--duration-normal) var(--ease-out);
}
.brand:hover { opacity: 0.9; }
.brand-mark {
  width: 42px; height: 42px;
  display: grid; flex: 0 0 auto; place-items: center;
  background: linear-gradient(135deg, var(--green-700) 0%, var(--green-900) 100%);
  border-radius: 12px;
  color: var(--sand-light); font-size: 1rem; font-weight: 800;
  letter-spacing: .02em;
  box-shadow: 
    inset 0 1px 0 rgba(255, 255, 255, 0.15),
    inset 0 -1px 0 rgba(0, 0, 0, 0.2),
    0 4px 12px rgba(0, 0, 0, 0.3);
  position: relative;
  overflow: hidden;
}
.brand-mark::before {
  content: ''; position: absolute; inset: 0;
  background: radial-gradient(circle at top left, rgba(255,255,255,0.1) 0%, transparent 60%);
}
.brand-copy { display: grid; gap: 2px; }
.brand-copy strong { font-size: 1rem; font-weight: 700; letter-spacing: -.01em; text-shadow: 0 1px 2px rgba(0,0,0,0.5); }
.brand-copy small { color: rgba(255,255,255,.6); font-size: .7rem; font-weight: 500; letter-spacing: .02em; }

/* Navigation Tabs */
.view-tabs {
  display: flex; align-items: center; gap: 4px;
  background: rgba(0, 0, 0, 0.25);
  padding: 4px;
  border-radius: 10px;
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.3), 0 1px 0 rgba(255, 255, 255, 0.05);
}
.view-tabs a {
  padding: 8px 20px;
  display: flex; align-items: center; justify-content: center;
  color: rgba(255,255,255,.6); text-decoration: none;
  font-size: .8rem; font-weight: 600; letter-spacing: .01em;
  border-radius: 6px;
  transition: all var(--duration-normal) var(--ease-out);
}
.view-tabs a:hover {
  color: rgba(255,255,255,.9);
  background: rgba(255, 255, 255, 0.06);
}
.view-tabs a.active {
  color: #fff;
  background: rgba(255, 255, 255, 0.12);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2), inset 0 1px 0 rgba(255, 255, 255, 0.08);
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.4);
}

/* Header status */
.header-status {
  padding: 8px 16px;
  display: flex; align-items: center; gap: 8px;
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 10px;
  color: rgba(255,255,255,.7);
  font-size: .75rem; font-weight: 500;
  letter-spacing: .01em;
  box-shadow: inset 0 1px 2px rgba(0,0,0,0.2);
}
.header-status::before {
  content: '';
  display: block;
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--sand);
  box-shadow: 0 0 8px var(--sand);
  animation: pulse-glow 2s infinite;
}

@keyframes pulse-glow {
  0% { box-shadow: 0 0 0 0 rgba(210, 182, 144, 0.4); }
  70% { box-shadow: 0 0 0 6px rgba(210, 182, 144, 0); }
  100% { box-shadow: 0 0 0 0 rgba(210, 182, 144, 0); }
}

/* ══════════════════════════════════════════════════════════════
   PAGE LAYOUT
   ══════════════════════════════════════════════════════════════ */
.page-container {
  width: min(1440px, 100%); margin: 0 auto;
  padding: var(--space-xl) clamp(16px, 3vw, 40px) 72px;
}

/* Page Heading */
.page-heading {
  margin-bottom: var(--space-xl);
  display: flex; align-items: flex-start; justify-content: space-between; gap: 24px;
}
.page-heading h1 {
  margin: 6px 0 8px;
  font-size: clamp(1.6rem, 3vw, 2.15rem);
  font-weight: 800; line-height: 1.15;
  letter-spacing: -.035em;
  color: var(--ink);
}
.page-heading p {
  max-width: 680px; margin: 0;
  color: var(--muted); font-size: .86rem; line-height: 1.6;
}
.eyebrow {
  display: inline-block;
  color: var(--green-700); font-size: .68rem; font-weight: 800;
  letter-spacing: .12em; text-transform: uppercase;
}

/* Section headings */
.section-heading { margin: 0; font-size: .96rem; font-weight: 700; color: var(--ink); }
.section-subtitle { margin: 5px 0 0; color: var(--muted); font-size: .78rem; line-height: 1.5; }

/* ══════════════════════════════════════════════════════════════
   SURFACE / CARD SYSTEM — Crafted containers
   ══════════════════════════════════════════════════════════════ */
.surface {
  min-width: 0;
  border: 1px solid rgba(0,0,0,.06);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: 0 1px 2px rgba(0,0,0,.03);
}
.surface-header {
  min-height: 52px;
  padding: 16px 22px;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  border-bottom: 1px solid rgba(0,0,0,.05);
}
.surface-body { padding: 20px; }

/* Layout helpers */
.route-view, .section-stack, .section-stack > * { min-width: 0; }
.section-stack { display: grid; grid-template-columns: minmax(0, 1fr); gap: 22px; }
.section-gap { margin-top: 22px; }
.button-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.muted { color: var(--muted); }
.small { font-size: .78rem; }
.nowrap { white-space: nowrap; }
.text-right { text-align: right; }

/* ══════════════════════════════════════════════════════════════
   BUTTONS — Clean, functional
   ══════════════════════════════════════════════════════════════ */
.button {
  min-height: 40px; padding: 8px 16px;
  border: 1px solid transparent; border-radius: var(--radius);
  background: var(--surface); color: var(--ink);
  font-size: .82rem; font-weight: 650;
  cursor: pointer; user-select: none;
  transition: background var(--duration-fast) var(--ease-out), border-color var(--duration-fast) var(--ease-out), color var(--duration-fast) var(--ease-out);
}
.button:hover { background: #f3f5f4; }
.button:active { background: #eaedeb; }
.button:disabled { opacity: .45; cursor: not-allowed; }

.button-primary {
  border-color: var(--green-800);
  background: var(--green-800);
  color: #fff;
}
.button-primary:hover { background: var(--green-700); border-color: var(--green-700); }
.button-primary:active { background: var(--green-900); }

.button-secondary {
  border-color: var(--border-strong);
  background: var(--surface);
  color: var(--ink-secondary);
}
.button-secondary:hover { background: var(--green-50); border-color: var(--green-700); color: var(--green-800); }

.button-danger { border-color: var(--red-muted); color: var(--red); }
.button-danger:hover { background: var(--red-soft); border-color: var(--red); }

.button-quiet {
  min-height: 34px; padding: 5px 12px;
  border-color: var(--border); font-size: .76rem;
}
.button.active, .preset-button.active {
  border-color: var(--green-700); background: var(--green-50); color: var(--green-800);
}

.icon-button {
  min-width: 40px; min-height: 40px; padding: 8px;
  border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--surface); cursor: pointer;
  transition: background var(--duration-fast) var(--ease-out), border-color var(--duration-fast) var(--ease-out);
}
.icon-button:hover { background: var(--green-50); border-color: var(--green-700); }

/* ══════════════════════════════════════════════════════════════
   FILTER BAR — Clean, integrated
   ══════════════════════════════════════════════════════════════ */
.filter-bar {
  margin-bottom: 24px; padding: 18px 22px;
  display: grid; gap: 14px;
}
.filter-row { display: flex; flex-wrap: wrap; align-items: end; gap: 8px; }
.filter-row + .filter-row { padding-top: 14px; border-top: 1px solid var(--border); }
.filter-label {
  align-self: center; margin-right: 4px;
  color: var(--ink-secondary); font-size: .72rem; font-weight: 800;
  letter-spacing: .04em; text-transform: uppercase;
}
.custom-dates { display: flex; align-items: end; gap: 8px; }

/* Fields */
.field { min-width: 0; display: grid; gap: 5px; }
.field-grow { flex: 1 1 260px; }
.field label, .field-label {
  color: var(--ink-secondary); font-size: .72rem; font-weight: 700;
  letter-spacing: .02em;
}
.field input, .field select, .field textarea {
  width: 100%; min-height: 40px;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface); color: var(--ink);
  transition: border-color var(--duration-fast) var(--ease-out), box-shadow var(--duration-fast) var(--ease-out);
}
.field input:focus, .field select:focus, .field textarea:focus {
  border-color: var(--green-600);
  box-shadow: 0 0 0 3px rgba(24, 117, 90, .1);
  outline: none;
}
.field textarea { min-height: 94px; resize: vertical; line-height: 1.5; }
.field-help { color: var(--subtle); font-size: .7rem; line-height: 1.4; }
.compact-field { min-width: 160px; }
.compact-field input, .compact-field select { min-height: 38px; }

/* ══════════════════════════════════════════════════════════════
   SUMMARY CARDS — Crafted stat display
   ══════════════════════════════════════════════════════════════ */
.summary-grid {
  margin-bottom: 24px;
  display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px;
}
.summary-card {
  position: relative;
  min-height: 128px;
  padding: 22px 22px 18px;
  border: 1px solid rgba(0,0,0,.06);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: 0 1px 2px rgba(0,0,0,.04);
  overflow: hidden;
  isolation: isolate;
}
/* Decorative corner accent — atmospheric glow */
.summary-card::before {
  content: '';
  position: absolute; top: 0; left: 0;
  width: 100%; height: 100%;
  background:
    radial-gradient(ellipse 180px 140px at 0% 0%, rgba(24,117,90,.08) 0%, transparent 70%),
    radial-gradient(ellipse 100px 80px at 100% 100%, rgba(24,117,90,.03) 0%, transparent 70%);
  pointer-events: none; z-index: 0;
}
/* Bottom-right soft glow */
.summary-card::after {
  content: '';
  position: absolute; bottom: -24px; right: -24px;
  width: 96px; height: 96px;
  border-radius: 50%;
  background: rgba(24,117,90,.03);
  filter: blur(8px);
  pointer-events: none; z-index: 0;
}
.summary-card > * { position: relative; z-index: 1; }

.summary-card span {
  display: block;
  color: var(--muted); font-size: .7rem; font-weight: 650;
  letter-spacing: .06em; text-transform: uppercase;
  line-height: 1.3;
}
.summary-card strong {
  display: block; margin-top: 14px;
  font-size: 2.35rem; font-weight: 800; line-height: 1;
  letter-spacing: -.04em; color: var(--ink);
  font-feature-settings: 'tnum' 1;
}
.summary-card small {
  display: block; margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid rgba(0,0,0,.05);
  color: var(--subtle); font-size: .67rem; line-height: 1.4;
}

/* Tone: urgent — strong red atmospheric glow */
.summary-card[data-tone="urgent"]::before {
  background:
    radial-gradient(ellipse 200px 160px at 0% 0%, rgba(196,41,30,.12) 0%, transparent 65%),
    radial-gradient(ellipse 140px 100px at 100% 100%, rgba(196,41,30,.06) 0%, transparent 70%);
}
.summary-card[data-tone="urgent"]::after {
  background: rgba(196,41,30,.08);
  filter: blur(12px);
  width: 110px; height: 110px;
}
.summary-card[data-tone="urgent"] strong { color: var(--red); }
.summary-card[data-tone="urgent"] { border-color: rgba(196,41,30,.12); }

/* Tone: located — blue glow */
.summary-card[data-tone="located"]::before {
  background:
    radial-gradient(ellipse 180px 140px at 0% 0%, rgba(26,97,209,.1) 0%, transparent 65%),
    radial-gradient(ellipse 100px 80px at 100% 100%, rgba(26,97,209,.04) 0%, transparent 70%);
}
.summary-card[data-tone="located"]::after {
  background: rgba(26,97,209,.05);
  filter: blur(10px);
}

/* Tone: analyzed — sand/gold warm glow */
.summary-card[data-tone="analyzed"]::before {
  background:
    radial-gradient(ellipse 180px 140px at 0% 0%, rgba(210,182,144,.14) 0%, transparent 65%),
    radial-gradient(ellipse 100px 80px at 100% 100%, rgba(210,182,144,.06) 0%, transparent 70%);
}
.summary-card[data-tone="analyzed"]::after {
  background: rgba(210,182,144,.06);
  filter: blur(10px);
}

/* Tone: waiting — sand warm glow */
.summary-card[data-tone="waiting"]::before {
  background:
    radial-gradient(ellipse 180px 140px at 0% 0%, rgba(210,182,144,.14) 0%, transparent 65%),
    radial-gradient(ellipse 100px 80px at 100% 100%, rgba(210,182,144,.06) 0%, transparent 70%);
}
.summary-card[data-tone="waiting"]::after {
  background: rgba(210,182,144,.06);
  filter: blur(10px);
}

/* Tone: review — orange warm glow */
.summary-card[data-tone="review"]::before {
  background:
    radial-gradient(ellipse 180px 140px at 0% 0%, rgba(181,71,8,.1) 0%, transparent 65%),
    radial-gradient(ellipse 100px 80px at 100% 100%, rgba(181,71,8,.04) 0%, transparent 70%);
}
.summary-card[data-tone="review"]::after {
  background: rgba(181,71,8,.05);
  filter: blur(10px);
}

/* ══════════════════════════════════════════════════════════════
   CATEGORY STRIP — Crafted clickable cards
   ══════════════════════════════════════════════════════════════ */
.category-strip {
  margin-bottom: 24px;
  display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px;
}
.category-card {
  position: relative;
  min-height: 100px; padding: 18px;
  display: flex; align-items: center; gap: 16px;
  border: 1px solid rgba(0,0,0,.06);
  border-radius: var(--radius-lg);
  background: var(--surface); text-align: left; cursor: pointer;
  box-shadow: 0 1px 2px rgba(0,0,0,.03);
  overflow: hidden;
  transition: border-color var(--duration-normal) var(--ease-out), box-shadow var(--duration-normal) var(--ease-out);
}
.category-card::before {
  content: '';
  position: absolute; top: 0; right: 0;
  width: 50%; height: 100%;
  background: linear-gradient(270deg, rgba(24,117,90,.015) 0%, transparent 100%);
  pointer-events: none;
  transition: opacity var(--duration-normal) var(--ease-out);
  opacity: 0;
}
.category-card:hover {
  border-color: rgba(24,117,90,.2);
  box-shadow: 0 4px 16px rgba(15, 40, 30, .06);
}
.category-card:hover::before { opacity: 1; }
.category-card.active {
  border-color: var(--green-700);
  border-top-color: var(--sand-dark);
  background: linear-gradient(135deg, var(--green-50) 0%, var(--surface) 100%);
  box-shadow: inset 0 0 0 2px rgba(24,117,90,.13), 0 4px 16px rgba(15,40,30,.06);
}
.category-card.active .category-symbol {
  box-shadow: 0 2px 8px rgba(6,46,35,.18), 0 0 0 3px var(--sand-light);
}
.category-symbol {
  width: 52px; height: 52px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  border-radius: 12px;
  background: var(--green-950);
  color: var(--sand);
  box-shadow: 0 2px 8px rgba(6,46,35,.18);
}
.category-symbol svg {
  width: 28px; height: 28px;
  stroke: var(--sand);
  flex-shrink: 0;
}
.category-card-content {
  display: flex; flex-direction: column; justify-content: center;
  flex: 1; min-width: 0;
}
.category-card-content span { display: block; color: var(--muted); font-size: .72rem; font-weight: 600; line-height: 1.2; }
.category-card-content strong {
  display: block; margin-top: 6px;
  font-size: 1.45rem; font-weight: 800; letter-spacing: -.02em;
  line-height: 1;
  font-feature-settings: 'tnum' 1;
}
.category-card-content small {
  display: block; margin-top: 7px;
  color: var(--subtle); font-size: .65rem; font-weight: 650; line-height: 1.35;
}
.category-card.active .category-card-content small { color: var(--green-800); font-weight: 800; }

.category-filter-status,
.dataset-range-notice {
  padding: 13px 16px;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  border: 1px solid var(--sand-light); border-left: 4px solid var(--sand);
  border-radius: var(--radius);
  background: var(--sand-soft); color: var(--sand-950);
}
.category-filter-status div { min-width: 0; display: grid; gap: 3px; }
.category-filter-status strong,
.dataset-range-notice strong { font-size: .78rem; font-weight: 800; }
.category-filter-status span,
.dataset-range-notice span { color: var(--sand-dark); font-size: .72rem; line-height: 1.5; }
.dataset-range-notice { justify-content: flex-start; flex-wrap: wrap; }

/* ══════════════════════════════════════════════════════════════
   MAP SECTION
   ══════════════════════════════════════════════════════════════ */
.map-grid {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(300px, .78fr);
  gap: 18px;
}
.map-toolbar { display: flex; flex-wrap: wrap; gap: 7px; }
.map-canvas {
  width: 100%; min-height: 540px;
  background: #e8efeb;
  border-radius: 0;
}
.map-coverage-note {
  padding: 10px 20px;
  display: flex; flex-wrap: wrap; gap: 5px 12px;
  border-top: 1px solid var(--border); border-bottom: 1px solid var(--border);
  background: var(--sand-soft);
}
.map-coverage-note strong { color: var(--sand-950); font-size: .72rem; }
.map-coverage-note span { color: var(--muted); font-size: .7rem; line-height: 1.45; }
.map-legend {
  padding: 12px 20px;
  display: flex; flex-wrap: wrap; gap: 16px;
  border-top: 1px solid var(--border);
  color: var(--muted); font-size: .72rem; font-weight: 600;
}
.legend-item { display: inline-flex; align-items: center; gap: 6px; }
.legend-dot {
  width: 10px; height: 10px;
  border: 2px solid #fff; border-radius: 50%;
  box-shadow: 0 0 0 1px rgba(0,0,0,.15);
}
.legend-dot.critical { background: var(--red); }
.legend-dot.high { background: #e86516; }
.legend-dot.medium { background: #d29b00; }
.legend-dot.low { background: var(--green-700); }
.legend-dot.unverified { background: #fff; border-color: #7a8781; box-shadow: 0 0 0 1px #7a8781; }

.map-empty-overlay {
  min-height: 540px; padding: 32px;
  display: grid; place-items: center;
  background: linear-gradient(180deg, #edf3ef 0%, #e5ece8 100%);
  text-align: center;
}
.map-empty-overlay strong { display: block; margin-bottom: 8px; font-size: .92rem; }
.map-empty-overlay span { max-width: 440px; color: var(--muted); font-size: .82rem; line-height: 1.55; }

/* Map markers */
.issue-marker-container { border: 0; background: transparent; }
.issue-marker {
  width: 27px; height: 27px; position: relative; display: block;
  border: 3px solid #fff; border-radius: 50% 50% 50% 0;
  box-shadow: 0 2px 8px rgba(0,0,0,.32);
  transform: rotate(-45deg);
}
.issue-marker::after {
  content: ""; width: 7px; height: 7px;
  position: absolute; top: 7px; left: 7px;
  border-radius: 50%; background: rgba(255,255,255,.9);
}
.issue-marker-critical { background: var(--red); }
.issue-marker-high { background: #e86516; }
.issue-marker-medium { background: #d29b00; }
.issue-marker-low { background: var(--green-700); }
.issue-marker-unverified {
  border-color: #68756f;
  background: #fff;
  box-shadow: 0 2px 8px rgba(31,42,37,.28);
}
.issue-marker-unverified::after { background: #68756f; }

/* Urgency cluster */
.urgency-cluster-container { border: 0; background: transparent; }
.urgency-cluster {
  width: 44px; height: 44px;
  display: grid; place-items: center;
  border: 3px solid rgba(255,255,255,.9);
  border-radius: 50%;
  color: #fff; font-weight: 800;
  box-shadow: 0 3px 12px rgba(0,0,0,.3);
}
.urgency-cluster strong { font-size: .82rem; line-height: 1; }
.urgency-cluster-critical { background: var(--red); }
.urgency-cluster-high { background: #e86516; }
.urgency-cluster-medium { background: #d29b00; }
.urgency-cluster-low { background: var(--green-700); }
.urgency-cluster-unverified {
  border-color: #fff;
  background: #68756f;
  box-shadow: 0 0 0 2px #68756f, 0 3px 12px rgba(0,0,0,.25);
}
.urgency-cluster-mixed {
  border-color: var(--sand-light);
  background-image: repeating-linear-gradient(135deg, rgba(255,255,255,.02) 0 7px, rgba(38,48,43,.42) 7px 14px);
  box-shadow: 0 0 0 2px var(--sand-dark), 0 3px 12px rgba(0,0,0,.28);
}

.visually-hidden {
  width: 1px !important; height: 1px !important;
  position: absolute !important; overflow: hidden !important;
  clip: rect(0 0 0 0) !important; clip-path: inset(50%) !important;
  white-space: nowrap !important;
}

/* Map popup */
.leaflet-popup-content { margin: 14px 16px; min-width: 220px; }
.map-popup { display: grid; gap: 8px; }
.map-popup strong { line-height: 1.35; font-weight: 700; }
.map-popup p { margin: 0; color: var(--ink-secondary); font-size: .78rem; line-height: 1.5; }
.map-popup .button { margin-top: 6px; width: 100%; }

/* ══════════════════════════════════════════════════════════════
   URGENT PANEL — Sidebar
   ══════════════════════════════════════════════════════════════ */
.urgent-panel { max-height: 678px; display: flex; flex-direction: column; }
.urgent-panel .surface-header h2 { color: var(--red-dark); }
.urgent-list { margin: 0; padding: 0; list-style: none; overflow: auto; }
.urgent-list li + li { border-top: 1px solid var(--border); }
.urgent-item {
  width: 100%; padding: 14px 18px;
  display: block; border: 0; background: var(--surface);
  color: inherit; text-align: left; cursor: pointer;
  transition: background var(--duration-fast) var(--ease-out);
}
.urgent-item:hover { background: var(--red-soft); }
.urgent-item-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; }
.urgent-item strong { font-size: .82rem; font-weight: 700; line-height: 1.4; }
.urgent-item p { margin: 6px 0 0; color: var(--muted); font-size: .76rem; line-height: 1.5; }
.urgent-meta { margin-top: 8px; display: flex; flex-wrap: wrap; gap: 4px 10px; color: var(--subtle); font-size: .68rem; }

/* ══════════════════════════════════════════════════════════════
   BADGES — Sophisticated pills
   ══════════════════════════════════════════════════════════════ */
.badge {
  min-height: 24px; padding: 3px 10px;
  display: inline-flex; align-items: center; width: fit-content;
  border-radius: 999px;
  background: #eef2f0; color: var(--ink-secondary);
  font-size: .66rem; font-weight: 750; line-height: 1.2;
  white-space: nowrap; letter-spacing: .02em;
  border: 1px solid transparent;
}
.badge-critical { background: #fee4e2; color: #912018; border-color: var(--red-muted); }
.badge-high { background: var(--orange-soft); color: #8f3900; border-color: #f5cfad; }
.badge-medium { background: var(--yellow-soft); color: #765200; border-color: #f0dfa0; }
.badge-low { background: var(--green-100); color: var(--green-800); border-color: #c4ddd2; }
.badge-running { background: var(--blue-soft); color: #1849a9; border-color: #c7d9f5; }
.badge-failed { background: var(--red-soft); color: var(--red-dark); border-color: var(--red-muted); }
.badge-done { background: var(--green-100); color: var(--green-800); border-color: #c4ddd2; }
.badge-review { background: var(--sand-soft); color: var(--sand-dark); border-color: var(--sand-light); }

/* ══════════════════════════════════════════════════════════════
   CHARTS — Premium containers
   ══════════════════════════════════════════════════════════════ */
.chart-wide { min-height: 390px; }
.chart-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.chart-grid > .chart-card:last-child:nth-child(odd) { grid-column: 1 / -1; }
.chart-card { min-height: 340px; }
.chart-wrap { position: relative; height: 280px; padding: 16px 18px; }
.chart-wide .chart-wrap { height: 325px; }
.chart-fallback {
  height: 100%; display: grid; place-items: center;
  color: var(--subtle); font-size: .82rem; text-align: center;
}

/* ══════════════════════════════════════════════════════════════
   DATA TABLE — Refined, not spreadsheet-like
   ══════════════════════════════════════════════════════════════ */
.table-filters {
  padding: 14px 22px;
  display: grid; grid-template-columns: minmax(220px, 1.6fr) repeat(2, minmax(150px, .7fr));
  gap: 10px; border-bottom: 1px solid rgba(0,0,0,.05);
}
.table-wrap { overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; }
.data-table th, .data-table td {
  padding: 13px 18px; border-bottom: 1px solid rgba(0,0,0,.05);
  text-align: left; vertical-align: top; font-size: .79rem;
}
.data-table th {
  color: var(--muted);
  font-size: .64rem; font-weight: 700;
  letter-spacing: .08em; text-transform: uppercase;
}
.data-table tbody tr {
  transition: background var(--duration-fast) var(--ease-out);
}
.data-table tbody tr:hover { background: rgba(24,117,90,.02); }
.table-primary { display: block; max-width: 460px; margin-bottom: 4px; line-height: 1.45; font-weight: 600; }
.table-secondary { display: block; color: var(--subtle); font-size: .71rem; line-height: 1.4; }
.table-actions { white-space: nowrap; text-align: right !important; }

/* Pagination */
.pagination {
  min-height: 52px; padding: 12px 22px;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  border-top: 1px solid rgba(0,0,0,.05);
}
.pagination span { color: var(--muted); font-size: .74rem; font-weight: 600; font-feature-settings: 'tnum' 1; }

/* ══════════════════════════════════════════════════════════════
   MONITORING VIEW
   ══════════════════════════════════════════════════════════════ */
.monitor-toolbar {
  padding: 20px;
  display: grid; grid-template-columns: minmax(0, 1fr) auto;
  align-items: center; gap: 20px;
}
.monitor-toolbar h2 { margin: 0 0 6px; font-size: 1.02rem; font-weight: 700; }
.monitor-toolbar p { margin: 0; color: var(--muted); font-size: .8rem; line-height: 1.55; }
.monitor-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; }
.monitor-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(330px, .85fr);
  gap: 18px;
}

/* Settings form */
.settings-form {
  padding: 20px;
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px;
}
.settings-form .wide { grid-column: 1 / -1; }
.setting-toggle {
  min-height: 46px; padding: 10px 12px;
  display: flex; align-items: center; gap: 10px;
  border: 1px solid var(--border); border-radius: var(--radius);
  transition: background var(--duration-fast) var(--ease-out);
}
.setting-toggle:hover { background: var(--green-50); }
.setting-toggle input { width: 18px; height: 18px; accent-color: var(--green-700); }

/* Sources */
.source-form {
  padding: 18px 22px;
  display: grid; grid-template-columns: minmax(230px, 1fr) 150px auto;
  gap: 10px; align-items: end;
  border-bottom: 1px solid rgba(0,0,0,.05);
}
.source-list { margin: 0; padding: 0; list-style: none; }
.source-list li + li { border-top: 1px solid var(--border); }
.source-row {
  padding: 14px 20px;
  display: grid; grid-template-columns: minmax(0, 1fr) auto;
  align-items: center; gap: 12px;
  transition: background var(--duration-fast) var(--ease-out);
}
.source-row:hover { background: var(--green-50); }
.source-row strong { display: block; overflow-wrap: anywhere; font-size: .82rem; font-weight: 700; }
.source-row span { display: block; margin-top: 3px; color: var(--subtle); font-size: .7rem; }

/* Usage stats */
.usage-grid {
  display: grid; grid-template-columns: repeat(4, minmax(0, 1fr));
}
.usage-stat {
  position: relative;
  min-height: 96px; padding: 18px 20px;
  border-right: 1px solid rgba(0,0,0,.05);
}
.usage-stat:last-child { border-right: 0; }
.usage-stat span {
  display: block;
  color: var(--muted); font-size: .65rem; font-weight: 650;
  letter-spacing: .05em; text-transform: uppercase;
}
.usage-stat strong {
  display: block; margin-top: 10px;
  font-size: 1.2rem; font-weight: 800; letter-spacing: -.01em;
  font-feature-settings: 'tnum' 1;
}
.usage-detail {
  padding: 12px 20px;
  border-top: 1px solid rgba(0,0,0,.05);
  color: var(--subtle); font-size: .72rem; line-height: 1.5;
}

/* ══════════════════════════════════════════════════════════════
   AI ANALYSIS VIEW
   ══════════════════════════════════════════════════════════════ */

/* Toggle switch */
.ai-control { display: flex; align-items: center; gap: 12px; }
.switch { position: relative; width: 50px; height: 28px; display: inline-block; flex: 0 0 auto; }
.switch input { width: 1px; height: 1px; position: absolute; opacity: 0; }
.switch-track {
  position: absolute; inset: 0;
  border-radius: 999px; background: #9aa9a2;
  cursor: pointer;
  transition: background var(--duration-normal) var(--ease-out);
}
.switch-track::after {
  content: ""; width: 22px; height: 22px;
  position: absolute; top: 3px; left: 3px;
  border-radius: 50%; background: #fff;
  box-shadow: 0 1px 4px rgba(0,0,0,.2);
  transition: transform var(--duration-normal) var(--ease-spring);
}
.switch input:checked + .switch-track { background: var(--green-700); }
.switch input:checked + .switch-track::after { transform: translateX(22px); }
.switch input:focus-visible + .switch-track { outline: 2px solid var(--green-600); outline-offset: 3px; }
.switch input:disabled + .switch-track { opacity: .6; cursor: not-allowed; }
.ai-message { display: grid; gap: 2px; }
.ai-message strong { font-size: .84rem; font-weight: 700; }
.ai-message span { color: var(--muted); font-size: .73rem; }

/* AI Workbench — Sand-accented section */
.ai-workbench {
  border-top: 3px solid var(--sand);
}
.ai-control-layout {
  padding: 20px;
  display: grid; grid-template-columns: minmax(280px, .85fr) minmax(380px, 1.15fr);
  gap: 18px;
}
.ai-switch-panel, .ai-run-panel {
  min-width: 0; padding: 18px;
  border: 1px solid rgba(0,0,0,.06); border-radius: var(--radius-lg);
  background: var(--surface);
}
.ai-switch-panel { display: grid; align-content: start; gap: 14px; }
.ai-run-panel {
  display: grid; align-content: start; gap: 12px;
  border-color: var(--sand-light);
  background: var(--sand-soft);
}
.ai-run-options { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(170px, .75fr); gap: 10px; }
.ai-start-button { width: fit-content; min-width: 230px; }
.ai-availability {
  width: fit-content; padding: 5px 10px;
  display: inline-flex; align-items: center; gap: 6px;
  border-radius: 999px; font-size: .7rem; font-weight: 800;
}
.ai-availability::before { content: ""; width: 8px; height: 8px; border-radius: 50%; }
.ai-availability.ready { background: var(--green-100); color: var(--green-800); border: 1px solid #c4ddd2; }
.ai-availability.ready::before { background: var(--green-700); }
.ai-availability.unavailable { background: var(--red-soft); color: var(--red-dark); border: 1px solid var(--red-muted); }
.ai-availability.unavailable::before { background: var(--red); }
.ai-provider-note { margin: 0; color: var(--subtle); font-size: .72rem; line-height: 1.5; overflow-wrap: anywhere; }
.ai-scope-notice { margin-top: 2px; background: #fffbf2; }

/* Analysis quality notice */
.analysis-quality-notice {
  padding: 16px 22px;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  border-left: 3px solid var(--sand); border-radius: var(--radius-lg);
  background: var(--sand-soft);
}
.analysis-quality-notice div { min-width: 0; }
.analysis-quality-notice strong { font-size: .84rem; font-weight: 700; }
.analysis-quality-notice p { margin: 4px 0 0; color: var(--muted); font-size: .74rem; line-height: 1.55; }

/* ══════════════════════════════════════════════════════════════
   PROGRESS CARD
   ══════════════════════════════════════════════════════════════ */
.progress-card { overflow: hidden; }
.progress-main { padding: 22px; display: grid; gap: 12px; }
.progress-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.progress-heading strong { font-size: .86rem; font-weight: 700; }
.progress-heading span { color: var(--subtle); font-size: .74rem; font-weight: 600; font-feature-settings: 'tnum' 1; }
.progress-bar {
  width: 100%; height: 8px; overflow: hidden;
  border: 0; border-radius: 999px;
  background: rgba(0,0,0,.04); color: var(--green-700);
}
.progress-bar::-webkit-progress-bar { background: rgba(0,0,0,.04); border-radius: 999px; }
.progress-bar::-webkit-progress-value {
  background: var(--green-700);
  border-radius: 999px;
  transition: width var(--duration-normal) var(--ease-out);
}
.progress-bar::-moz-progress-bar {
  background: var(--green-700);
  border-radius: 999px;
}
.progress-stats {
  display: grid; grid-template-columns: repeat(6, minmax(0, 1fr));
  border-top: 1px solid rgba(0,0,0,.05);
}
.progress-stat { padding: 14px 16px; border-right: 1px solid rgba(0,0,0,.05); }
.progress-stat:last-child { border-right: 0; }
.progress-stat span {
  display: block;
  color: var(--muted); font-size: .62rem; font-weight: 650; line-height: 1.3;
  letter-spacing: .04em; text-transform: uppercase;
}
.progress-stat strong {
  display: block; margin-top: 6px;
  font-size: .98rem; font-weight: 800;
  font-feature-settings: 'tnum' 1;
}
.ai-progress-stats { grid-template-columns: repeat(5, minmax(0, 1fr)); }

/* AI Summary grid variants */
.ai-summary-grid .summary-card[data-tone="waiting"] { border-top-color: var(--sand); }
.ai-summary-grid .summary-card[data-tone="review"] { border-top-color: var(--orange); }

/* Grounding summary */
.grounding-summary {
  margin-top: -8px; padding: 0;
  display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1px;
  border: 1px solid rgba(0,0,0,.06); border-radius: var(--radius-lg);
  background: rgba(0,0,0,.04); overflow: hidden;
}
.grounding-summary-item {
  min-height: 68px; padding: 16px 18px;
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  background: var(--surface);
}
.grounding-summary-item span { color: var(--muted); font-size: .7rem; line-height: 1.35; font-weight: 600; }
.grounding-summary-item strong { font-size: 1.1rem; font-weight: 800; font-feature-settings: 'tnum' 1; }
.grounding-strong strong { color: var(--green-800); }
.grounding-review strong { color: var(--sand-dark); }
.grounding-weak strong, .grounding-failed strong { color: var(--red); }

/* ══════════════════════════════════════════════════════════════
   AUDIT SECTION
   ══════════════════════════════════════════════════════════════ */
.audit-filter-bar {
  padding: 16px 22px;
  display: grid;
  grid-template-columns: minmax(250px, 1.4fr) minmax(180px, .7fr) minmax(190px, .8fr) auto;
  align-items: end; gap: 10px;
  border-bottom: 1px solid rgba(0,0,0,.05);
}
.audit-filter-actions { flex-wrap: nowrap; }
.audit-list {
  display: grid; gap: 16px;
  padding: 20px;
  background: var(--canvas);
}
.audit-card {
  min-width: 0; overflow: hidden;
  border: 1px solid rgba(0,0,0,.06); border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: 0 1px 2px rgba(0,0,0,.03);
}
.audit-card-header {
  min-height: 52px; padding: 14px 20px;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  border-bottom: 1px solid rgba(0,0,0,.05);
}
.audit-card-header > div:first-child { min-width: 0; display: grid; gap: 3px; }
.audit-card-header strong { font-size: .82rem; font-weight: 700; overflow-wrap: anywhere; }
.audit-card-header span:not(.badge) { color: var(--subtle); font-size: .7rem; }

/* Audit compare columns */
.audit-compare { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
.audit-original, .audit-result { min-width: 0; padding: 18px 20px; }
.audit-original { border-right: 1px solid var(--border); background: var(--surface); }
.audit-result { background: #fbfcfb; }
.audit-column-label {
  display: block; margin-bottom: 12px;
  color: var(--muted); font-size: .64rem; font-weight: 850;
  letter-spacing: .08em; text-transform: uppercase;
}
.audit-comment-text {
  margin: 0 0 14px;
  color: var(--ink); font-size: .86rem; line-height: 1.7;
  white-space: pre-wrap; overflow-wrap: anywhere;
}

/* Pending result */
.audit-pending {
  min-height: 130px; padding: 20px;
  display: grid; place-items: center;
  border: 1px dashed var(--border-strong); border-radius: var(--radius);
  background: var(--surface); text-align: center;
}
.audit-pending p { max-width: 430px; margin: 0; color: var(--muted); font-size: .8rem; line-height: 1.55; }
.audit-pending-failed { border-color: var(--red-muted); background: var(--red-soft); }

/* Prediction result */
.prediction-result { display: grid; gap: 14px; }
.prediction-verdict { display: flex; flex-wrap: wrap; gap: 6px; }
.prediction-summary span, .prediction-evidence > span {
  display: block; margin-bottom: 6px;
  color: var(--muted); font-size: .66rem; font-weight: 800;
  letter-spacing: .04em; text-transform: uppercase;
}
.prediction-summary p { margin: 0; font-size: .84rem; font-weight: 700; line-height: 1.55; }
.prediction-evidence { display: grid; gap: 8px; }
.prediction-evidence blockquote {
  margin: 0; padding: 12px 14px;
  border-left: 3px solid var(--sand);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  background: var(--sand-soft);
  color: var(--sand-950); font-size: .8rem; line-height: 1.6;
  white-space: pre-wrap; overflow-wrap: anywhere;
}
.prediction-location { margin: 0; font-size: .75rem; line-height: 1.5; }
.audit-warning {
  margin: 0; padding: 10px 14px;
  border-radius: var(--radius-sm);
  background: var(--yellow-soft); color: #654a08;
  font-size: .75rem; line-height: 1.55;
  border: 1px solid #f0dfa0;
}

/* Grounding panel */
.grounding-panel {
  padding: 12px 14px;
  display: grid; gap: 8px;
  border: 1px solid var(--border); border-radius: var(--radius);
}
.grounding-panel > div { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.grounding-panel p { flex: 1 1 220px; margin: 0; color: var(--muted); font-size: .72rem; line-height: 1.5; }
.grounding-panel ul { margin: 0; padding-left: 19px; color: var(--muted); font-size: .72rem; line-height: 1.55; }
.grounding-panel.grounding-strong { border-color: #b6d8c8; background: var(--green-50); }
.grounding-panel.grounding-review { border-color: var(--sand-light); background: var(--sand-soft); }
.grounding-panel.grounding-weak { border-color: var(--red-muted); background: var(--red-soft); }

/* Provider details */
.provider-details { padding-top: 2px; color: var(--muted); font-size: .7rem; }
.provider-details summary { width: fit-content; cursor: pointer; font-weight: 750; }
.provider-details p { margin: 7px 0 0; line-height: 1.5; }

/* Feedback panel */
.feedback-panel {
  padding-top: 12px;
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px;
  border-top: 1px solid var(--border);
}
.feedback-panel > div:first-child { flex: 1 1 230px; display: grid; gap: 3px; }
.feedback-panel strong { font-size: .75rem; font-weight: 700; }
.feedback-panel span { color: var(--muted); font-size: .68rem; line-height: 1.4; }
.feedback-button.active {
  border-color: var(--green-700); background: var(--green-100); color: var(--green-800);
}
.feedback-button.active.questionable {
  border-color: var(--sand-dark); background: var(--sand-soft); color: var(--sand-950);
}

/* ══════════════════════════════════════════════════════════════
   NOTICES
   ══════════════════════════════════════════════════════════════ */
.notice {
  padding: 14px 16px;
  border: 1px solid #e7d090; border-radius: var(--radius);
  background: var(--yellow-soft); color: #654a08;
  font-size: .79rem; line-height: 1.55;
}
.notice.error { border-color: var(--red-muted); background: var(--red-soft); color: var(--red-dark); }
.notice.success { border-color: #b6d8c8; background: var(--green-50); color: var(--green-950); }

/* Empty / Loading / Error states */
.empty-state, .loading-state, .error-state {
  min-height: 150px; padding: 36px 24px;
  display: grid; place-items: center; text-align: center;
}
.empty-state h2, .error-state h2 { margin: 0 0 8px; font-size: .96rem; font-weight: 700; }
.empty-state p, .loading-state p, .error-state p {
  max-width: 560px; margin: 0;
  color: var(--muted); font-size: .84rem; line-height: 1.55;
}
.table-empty { padding: 28px 16px !important; color: var(--muted); text-align: center !important; }

/* Busy dot animation */
.busy-dot {
  width: 8px; height: 8px;
  display: inline-block; margin-right: 7px;
  border-radius: 50%; background: var(--blue);
  animation: pulse 1.3s var(--ease-out) infinite;
}
@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: .3; transform: scale(.75); }
}

/* ══════════════════════════════════════════════════════════════
   DIALOG — Premium modal
   ══════════════════════════════════════════════════════════════ */
dialog {
  width: min(720px, calc(100% - 24px));
  max-height: calc(100dvh - 30px);
  padding: 0; overflow: auto;
  border: 1px solid rgba(0,0,0,.08);
  border-radius: var(--radius-xl);
  background: var(--surface); color: var(--ink);
  box-shadow: 0 24px 64px rgba(0,0,0,.12), 0 4px 16px rgba(0,0,0,.06);
}
dialog::backdrop { background: rgba(4, 27, 20, .5); backdrop-filter: blur(4px); }
.dialog-header {
  padding: 24px 26px 20px;
  display: flex; align-items: flex-start; justify-content: space-between; gap: 16px;
  border-bottom: 1px solid rgba(0,0,0,.06);
}
.dialog-header h2 { margin: 0; font-size: 1.12rem; font-weight: 800; }
.dialog-header p { margin: 6px 0 0; color: var(--muted); font-size: .78rem; line-height: 1.5; }
.dialog-body { padding: 24px 26px; display: grid; gap: 18px; }
.dialog-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.detail-value { padding-bottom: 12px; border-bottom: 1px solid var(--border); }
.detail-value span {
  display: block; margin-bottom: 5px;
  color: var(--muted); font-size: .66rem; font-weight: 800;
  text-transform: uppercase; letter-spacing: .05em;
}
.detail-value strong { display: block; font-size: .82rem; font-weight: 700; line-height: 1.5; overflow-wrap: anywhere; }
.detail-block h3 {
  margin: 0 0 10px;
  color: var(--muted); font-size: .66rem; font-weight: 800;
  letter-spacing: .05em; text-transform: uppercase;
}
.detail-summary {
  margin: 0; padding: 16px;
  border-left: 3px solid var(--blue);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  background: var(--blue-soft);
  line-height: 1.65; font-size: .86rem;
}
.evidence-quote {
  margin: 0; padding: 16px;
  border-left: 3px solid var(--sand);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  background: var(--sand-soft);
  line-height: 1.7; font-size: .84rem;
  white-space: pre-wrap; overflow-wrap: anywhere;
  color: var(--sand-950);
}
.dialog-actions {
  position: sticky; bottom: 0;
  padding: 16px 26px;
  display: flex; justify-content: flex-end; gap: 8px;
  border-top: 1px solid rgba(0,0,0,.06);
  background: var(--surface);
}
.safe-link { overflow-wrap: anywhere; }

/* ══════════════════════════════════════════════════════════════
   TOAST & BANNER
   ══════════════════════════════════════════════════════════════ */
.toast-region {
  position: fixed; z-index: 3000; right: 18px; bottom: 18px;
  width: min(370px, calc(100% - 30px));
  display: grid; gap: 8px;
}
.toast {
  padding: 13px 16px;
  border: 1px solid #aad3bf; border-radius: var(--radius);
  background: #f0faf5; color: var(--green-950);
  box-shadow: 0 8px 24px rgba(0,0,0,.1);
  font-size: .8rem; line-height: 1.5; font-weight: 600;
}
.toast.error { border-color: var(--red-muted); background: var(--red-soft); color: var(--red-dark); }

.connection-banner {
  position: fixed; z-index: 5000; top: 0; left: 50%;
  width: min(620px, calc(100% - 24px));
  padding: 10px 14px;
  transform: translateX(-50%);
  border-radius: 0 0 var(--radius) var(--radius);
  background: #7a271a; color: #fff;
  text-align: center; font-size: .76rem; font-weight: 600;
  box-shadow: var(--shadow-lg);
}
main:focus { outline: none; }

/* ══════════════════════════════════════════════════════════════
   RESPONSIVE — 1120px
   ══════════════════════════════════════════════════════════════ */
@media (max-width: 1120px) {
  .header-status { display: none; }
  .summary-grid, .category-strip { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .map-grid, .monitor-grid { grid-template-columns: minmax(0, 1fr); }
  .ai-control-layout { grid-template-columns: minmax(0, 1fr); }
  .audit-filter-bar { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .audit-filter-actions { align-self: end; }
  .urgent-panel { max-height: 460px; }
  .progress-stats { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .progress-stat:nth-child(3) { border-right: 0; }
  .progress-stat:nth-child(-n+3) { border-bottom: 1px solid var(--border); }
}

/* ══════════════════════════════════════════════════════════════
   RESPONSIVE — 780px
   ══════════════════════════════════════════════════════════════ */
@media (max-width: 780px) {
  .site-header { position: static; }
  .header-inner {
    padding: 12px 14px;
    display: grid; grid-template-columns: 1fr; gap: 8px;
  }
  .brand { margin-right: 0; }
  .brand-copy small { display: none; }
  .view-tabs { width: 100%; }
  .view-tabs a {
    min-width: 0; flex: 1 1 0;
    min-height: 44px; padding: 8px 10px; font-size: .76rem;
  }
  .view-tabs a::after { left: 8px; right: 8px; }
  .page-container { padding: 20px 14px 48px; }
  .page-heading { display: block; }
  .page-heading h1 { margin-bottom: 10px; }
  .filter-row { align-items: stretch; }
  .preset-button { flex: 1 1 105px; }
  .custom-dates { width: 100%; display: grid; grid-template-columns: 1fr 1fr; }
  .filter-row > .button-primary { width: 100%; }
  .summary-grid, .category-strip { gap: 10px; }
  .summary-card { min-height: 100px; padding: 16px; }
  .summary-card strong { font-size: 1.6rem; }
  .category-card { grid-template-columns: 46px 1fr; min-height: 88px; padding: 14px; }
  .category-symbol { width: 46px; height: 46px; }
  .map-canvas, .map-empty-overlay { min-height: 430px; }
  .chart-grid { grid-template-columns: 1fr; }
  .table-filters { grid-template-columns: 1fr; }
  .monitor-toolbar { grid-template-columns: 1fr; }
  .monitor-actions { justify-content: flex-start; }
  .analysis-quality-notice { align-items: stretch; flex-direction: column; }
  .analysis-quality-notice .button { width: 100%; text-align: center; }
  .category-filter-status { align-items: stretch; flex-direction: column; }
  .category-filter-status .button { width: 100%; text-align: center; }
  .ai-run-options, .audit-filter-bar, .audit-compare { grid-template-columns: 1fr; }
  .audit-original { border-right: 0; border-bottom: 1px solid var(--border); }
  .audit-filter-actions .button { flex: 1 1 0; }
  .grounding-summary { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ai-progress-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ai-progress-stats .progress-stat { border-bottom: 1px solid var(--border); }
  .ai-progress-stats .progress-stat:nth-child(2n) { border-right: 0; }
  .ai-progress-stats .progress-stat:last-child { grid-column: 1 / -1; border-bottom: 0; }
  .ai-start-button { width: 100%; }
  .settings-form, .source-form { grid-template-columns: 1fr; }
  .settings-form .wide { grid-column: auto; }
  .usage-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .usage-stat:nth-child(2) { border-right: 0; }
  .usage-stat:nth-child(-n+2) { border-bottom: 1px solid var(--border); }
  .pagination { align-items: stretch; flex-direction: column; }
  .pagination .button-row { display: grid; grid-template-columns: 1fr 1fr; }
  .dialog-grid { grid-template-columns: 1fr; }
  .dialog-actions { flex-direction: column-reverse; }
  .dialog-actions .button, .dialog-actions a { width: 100%; text-align: center; }
}

/* ══════════════════════════════════════════════════════════════
   RESPONSIVE — 420px
   ══════════════════════════════════════════════════════════════ */
@media (max-width: 420px) {
  .summary-grid, .category-strip { grid-template-columns: 1fr; }
  .grounding-summary { grid-template-columns: 1fr; }
  .ai-control-layout, .audit-list { padding: 12px; }
  .ai-switch-panel, .ai-run-panel, .audit-original, .audit-result { padding: 14px; }
  .audit-card-header { align-items: flex-start; flex-direction: column; }
  .progress-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .progress-stat { border-bottom: 1px solid var(--border); }
  .progress-stat:nth-child(2n) { border-right: 0; }
  .progress-stat:nth-last-child(-n+2) { border-bottom: 0; }
}

/* ══════════════════════════════════════════════════════════════
   REDUCED MOTION & PRINT
   ══════════════════════════════════════════════════════════════ */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    scroll-behavior: auto !important;
    transition: none !important;
    animation: none !important;
  }
}

@media print {
  .site-header, .filter-bar, .button, .pagination, .monitor-actions { display: none !important; }
  .page-container { width: 100%; padding: 0; }
  .surface, .summary-card, .category-card, .audit-card { box-shadow: none; border-color: #ccc; }
}
