/* =================================================================
   FlatGlass D365 Explorer — "Opus 4.7" theme
   Deep teal · bright aqua · midnight navy · glassmorphism on light
   ================================================================= */

:root {
  /* — Foundation — */
  --bg:           #F8F9FA;
  --bg-tinted:    #F1F5F8;     /* slightly cooler shade for nested */
  --surface:      #FFFFFF;     /* solid white where no glass */
  --ink:          #051C2C;     /* navy text */
  --ink-soft:     #1A3344;     /* lighter navy for body */
  --muted:        #5A6677;     /* slate gray */
  --muted-soft:   #8D96A3;
  --rule:         #E2E8EE;
  --rule-soft:    #EDF1F4;

  /* — Brand palette — */
  --teal:         #00849B;     /* Primary */
  --teal-soft:    #DCF1F5;     /* Tint for hover bg */
  --teal-deep:    #006A7E;
  --aqua:         #00C1DE;     /* Action / highlight */
  --aqua-soft:    #E0F7FB;
  --navy:         #051C2C;     /* Deep contrast (footer / hero bands) */
  --forest:       #4A7729;     /* Natural accent */

  /* Status colors — semantic */
  --warn:         #B8451F;     /* used sparingly */

  /* Disposition palette — used in dashboards, pills, charts */
  --c-MOVE:       var(--forest);
  --c-MODERNIZE:  var(--teal);
  --c-RETIRE:     var(--navy);
  --c-WRAP:       var(--aqua);
  --c-UNDECIDED:  var(--muted);

  /* Glass — reusable surface mix */
  --glass-bg:        rgba(255, 255, 255, 0.62);
  --glass-bg-strong: rgba(255, 255, 255, 0.78);
  --glass-border:    rgba(255, 255, 255, 0.7);
  --glass-blur:      blur(20px) saturate(1.4);
  --glass-shadow:    0 8px 28px rgba(5, 28, 44, 0.08), 0 1px 0 0 rgba(255,255,255,0.6) inset;

  /* Type stacks */
  --font-display: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-body:    "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-mono:    "JetBrains Mono", ui-monospace, "SF Mono", Menlo, monospace;

  /* Layout */
  --gutter: clamp(20px, 4vw, 56px);
  --max-width: 1480px;

  /* Radius */
  --radius-card: 16px;
  --radius-pill: 999px;
  --radius-input: 10px;
  --radius-small: 6px;
}

* { box-sizing: border-box; }
html { background: var(--bg); }

body {
  margin: 0;
  background:
    radial-gradient(at 12% 6%,  rgba(0, 193, 222, 0.10), transparent 45%),
    radial-gradient(at 88% 18%, rgba(0, 132, 155, 0.08), transparent 50%),
    radial-gradient(at 70% 96%, rgba(74, 119, 41, 0.05), transparent 55%),
    var(--bg);
  background-attachment: fixed;
  color: var(--ink-soft);
  font-family: var(--font-body);
  font-size: 14px;
  line-height: 1.5;
  font-weight: 400;
  font-feature-settings: "ss01", "ss03", "cv11";
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  min-height: 100vh;
}

::selection { background: var(--aqua); color: var(--navy); }

a { color: var(--teal); text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { color: var(--teal-deep); }

code, kbd, samp {
  font-family: var(--font-mono);
  font-size: 0.92em;
  background: var(--bg-tinted);
  padding: 1px 6px;
  border-radius: 4px;
  color: var(--ink);
}

/* =================================================================
   MASTHEAD — floating frosted-glass header
   ================================================================= */
.masthead {
  background: var(--glass-bg);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border-bottom: 1px solid var(--glass-border);
  padding: 28px var(--gutter) 22px;
  position: sticky;
  top: 0;
  z-index: 50;
  box-shadow: 0 1px 14px rgba(5, 28, 44, 0.04);
}

.masthead-row {
  max-width: var(--max-width);
  margin: 0 auto;
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: end;
  gap: 32px;
}

.brand { display: flex; align-items: baseline; flex-wrap: wrap; gap: 18px; min-width: 0; }

.brand-mark {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 16px;
  line-height: 1;
  letter-spacing: -0.04em;
  color: white;
  background: linear-gradient(135deg, var(--teal), var(--aqua));
  padding: 9px 12px 8px;
  display: inline-flex;
  align-items: baseline;
  border-radius: var(--radius-small);
  box-shadow: 0 2px 10px rgba(0, 132, 155, 0.30);
}
.brand-amp { color: rgba(255, 255, 255, 0.85); margin: 0 2px; }

.brand h1 {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(24px, 3.4vw, 38px);
  line-height: 1;
  letter-spacing: -0.035em;
  margin: 0;
  color: var(--ink);
}
.brand h1 .h1-accent {
  font-weight: 700;
  background: linear-gradient(135deg, var(--teal), var(--aqua));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: transparent;
}

.dek {
  flex-basis: 100%;
  max-width: 60ch;
  margin: 8px 0 0;
  font-family: var(--font-body);
  font-weight: 400;
  font-size: 14.5px;
  line-height: 1.5;
  color: var(--muted);
}

.meta { text-align: right; font-family: var(--font-mono); font-size: 11px; line-height: 1.6; }
.status {
  margin: 0;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  font-weight: 600;
  color: var(--ink);
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.status::before {
  content: "";
  width: 8px; height: 8px;
  background: var(--forest);
  border-radius: 50%;
  box-shadow: 0 0 0 3px rgba(74, 119, 41, 0.18);
  animation: pulse 1.8s ease-in-out infinite;
}
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50%      { opacity: 0.45; }
}
.edition {
  margin: 6px 0 0;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: var(--muted);
}

/* =================================================================
   MAIN LAYOUT
   ================================================================= */
main {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 48px var(--gutter) 80px;
}

section {
  margin-bottom: 72px;
  position: relative;
}

/* — Section header (kicker / title / standfirst / large numeral) — */
.section-head {
  position: relative;
  border-bottom: 1px solid var(--rule);
  padding: 0 0 18px 0;
  margin: 0 0 28px 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: 24px;
}
.section-head .kicker {
  margin: 0 0 6px 0;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.22em;
  color: var(--teal);
}
.section-head h2 {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(26px, 3vw, 36px);
  letter-spacing: -0.03em;
  line-height: 1;
  color: var(--ink);
}
.section-head .standfirst {
  grid-column: 1 / -1;
  margin: 12px 0 0 0;
  font-family: var(--font-body);
  font-weight: 400;
  font-size: 14.5px;
  line-height: 1.55;
  color: var(--muted);
  max-width: 70ch;
}

/* Big translucent section number — gradient teal→aqua */
section[data-roman]::before {
  content: attr(data-roman);
  position: absolute;
  top: -16px;
  right: 0;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(72px, 10vw, 130px);
  line-height: 0.85;
  letter-spacing: -0.06em;
  background: linear-gradient(135deg, var(--teal), var(--aqua));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: transparent;
  pointer-events: none;
  opacity: 0.18;
  user-select: none;
  font-variant-numeric: tabular-nums;
}

/* Multi-column panel grid */
.panel-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(420px, 1fr));
  gap: 18px;
  margin-top: 18px;
}

/* =================================================================
   EXECUTIVE KPI CARDS — glass with teal-aqua accent rule
   ================================================================= */
.card-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin-bottom: 24px;
}

.card {
  padding: 26px 24px 24px;
  background: var(--glass-bg-strong);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-card);
  box-shadow: var(--glass-shadow);
  position: relative;
  transition: transform 220ms cubic-bezier(.2,.8,.2,1), box-shadow 220ms ease;
}
.card:hover {
  transform: translateY(-2px);
  box-shadow: 0 14px 40px rgba(5, 28, 44, 0.14), 0 1px 0 0 rgba(255,255,255,0.6) inset;
}

.card .label {
  display: block;
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: var(--muted);
  margin-bottom: 18px;
}

.card .value {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(38px, 4vw, 52px);
  line-height: 0.95;
  letter-spacing: -0.04em;
  color: var(--ink);
  font-variant-numeric: tabular-nums lining-nums;
}
.card .value::after {
  content: "";
  display: block;
  width: 36px; height: 3px;
  margin-top: 14px;
  background: linear-gradient(90deg, var(--teal), var(--aqua));
  border-radius: 2px;
}

@media (max-width: 1080px) {
  .card-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 600px) {
  .card-grid { grid-template-columns: 1fr; }
}

/* =================================================================
   PANELS — glass cards with thin white border
   ================================================================= */
.chart, .table {
  background: var(--glass-bg-strong);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-card);
  box-shadow: var(--glass-shadow);
  margin-top: 18px;
  padding: 24px 26px 20px;
  position: relative;
  min-width: 0;
}

.chart h3, .table h3 {
  margin: 0 0 6px 0;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 17px;
  letter-spacing: -0.02em;
  color: var(--ink);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  cursor: pointer;
  user-select: none;
}

/* Panel collapse toggle — circular outlined button on the right of each h3.
   Rotates 90° when collapsed, hides everything below the title. */
.panel-toggle {
  background: transparent;
  border: 1px solid var(--rule);
  color: var(--muted);
  width: 26px;
  height: 26px;
  min-width: 26px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  line-height: 1;
  letter-spacing: 0;
  text-transform: none;
  padding: 0;
  cursor: pointer;
  flex-shrink: 0;
  box-shadow: none;
  transition: transform 200ms cubic-bezier(.2,.8,.2,1), color 120ms ease, border-color 120ms ease, background 120ms ease;
}
.panel-toggle:hover {
  color: var(--teal);
  border-color: var(--teal);
  background: var(--teal-soft);
  filter: none;
}
.panel-toggle:focus-visible {
  outline: 2px solid var(--aqua);
  outline-offset: 2px;
}
.chart.collapsed .panel-toggle,
.table.collapsed .panel-toggle {
  transform: rotate(-90deg);
}
.chart.collapsed > *:not(h3),
.table.collapsed > *:not(h3) {
  display: none !important;
}
.chart.collapsed,
.table.collapsed {
  padding-bottom: 18px;
}
.chart.collapsed > h3,
.table.collapsed > h3 {
  margin-bottom: 0;
}
.chart h3 + p, .table h3 + p {
  margin: 0 0 16px 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

/* SVG / Plot text */
.chart svg, .table svg { max-width: 100%; height: auto; overflow: visible; }
.chart svg text, .table svg text {
  font-family: var(--font-mono);
  fill: var(--ink);
  font-size: 12.5px;
}
.chart svg [aria-label="x-axis label"] text,
.chart svg [aria-label="y-axis label"] text {
  font-weight: 600;
  fill: var(--ink);
  font-size: 13px;
}
.chart svg [aria-label*="tick"] text {
  fill: var(--ink-soft);
  font-size: 12.5px;
}
.chart figure { margin: 0; }
.chart figure[class*="-swatches"] {
  font-family: var(--font-mono);
  font-size: 12px !important;
  color: var(--ink) !important;
  margin-bottom: 8px !important;
}
.chart svg [aria-label="tip"] text,
.chart svg g[aria-label="tip"] text {
  font-size: 13px;
  fill: var(--ink);
  font-family: var(--font-mono);
}

/* =================================================================
   TABLES
   ================================================================= */
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  font-variant-numeric: tabular-nums lining-nums;
}

thead th {
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--muted);
  text-align: left;
  padding: 12px 12px;
  border-bottom: 1.5px solid var(--ink);
  background: rgba(255,255,255,0.5);
  white-space: nowrap;
  position: sticky;
  top: 0;
  z-index: 1;
  backdrop-filter: blur(8px);
}

tbody td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--rule-soft);
  vertical-align: top;
  color: var(--ink-soft);
}

tbody tr { transition: background 110ms ease; }
tbody tr:hover td {
  background: var(--teal-soft);
  cursor: pointer;
}
tbody tr:hover td:first-child { box-shadow: inset 3px 0 0 var(--teal); }

tbody td:first-child {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--muted);
}

.table-scroll {
  overflow-x: auto;
  overflow-y: visible;
  margin: 0 -8px;
  padding: 0 8px;
}
.table-scroll table { min-width: max-content; }

td.path-cell {
  max-width: 32ch;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: var(--muted);
}
td.name-cell {
  max-width: 28ch;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* =================================================================
   HELP TOOLTIPS — circled ? with hover-popup
   ================================================================= */
.help {
  position: relative;
  display: inline-flex;
  align-items: center;
  margin-left: 6px;
  vertical-align: middle;
  font-weight: 400;
}
.help-q {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 15px;
  height: 15px;
  border: 1px solid currentColor;
  border-radius: 50%;
  font-family: var(--font-mono);
  font-size: 9.5px;
  font-weight: 700;
  line-height: 1;
  letter-spacing: 0;
  text-transform: none;
  color: currentColor;
  opacity: 0.5;
  cursor: help;
  transition: opacity 120ms ease, background 120ms ease, color 120ms ease;
  user-select: none;
}
.help:hover .help-q,
.help:focus-within .help-q {
  opacity: 1;
  background: currentColor;
}
.help:hover .help-q { color: var(--surface); }

.help-popup {
  position: absolute;
  top: calc(100% + 12px);
  left: 50%;
  transform: translateX(-50%) translateY(-4px);
  width: 300px;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(20px) saturate(1.4);
  -webkit-backdrop-filter: blur(20px) saturate(1.4);
  border: 1px solid rgba(255, 255, 255, 0.8);
  border-radius: 12px;
  padding: 16px 18px 18px;
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: 400;
  line-height: 1.55;
  letter-spacing: 0;
  text-transform: none;
  color: var(--ink-soft);
  box-shadow: 0 14px 40px rgba(5, 28, 44, 0.18), 0 1px 0 0 rgba(255,255,255,0.5) inset;
  z-index: 100;
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
  transition: opacity 140ms ease, visibility 140ms ease, transform 140ms ease;
  text-align: left;
  white-space: normal;
}
.help-popup::before {
  content: "";
  position: absolute;
  top: -6px;
  left: 50%;
  transform: translateX(-50%) rotate(45deg);
  width: 12px; height: 12px;
  background: rgba(255, 255, 255, 0.92);
  border-left: 1px solid rgba(255, 255, 255, 0.8);
  border-top: 1px solid rgba(255, 255, 255, 0.8);
}
.help-popup strong {
  display: block;
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: var(--help-color, var(--teal));
  margin-bottom: 8px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--rule);
}
.help-popup em {
  display: block;
  margin-top: 8px;
  font-style: normal;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--muted);
  letter-spacing: 0.04em;
}
.help:hover .help-popup,
.help:focus-within .help-popup {
  opacity: 1;
  visibility: visible;
  transform: translateX(-50%) translateY(0);
  pointer-events: auto;
}

.help.help-right .help-popup {
  left: auto; right: -8px;
  transform: translateX(0) translateY(-4px);
}
.help.help-right .help-popup::before { left: auto; right: 16px; transform: rotate(45deg); }
.help.help-right:hover .help-popup,
.help.help-right:focus-within .help-popup {
  transform: translateX(0) translateY(0);
}

.section-link {
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--teal);
  text-decoration: none;
  border-bottom: 1px solid var(--teal);
  padding-bottom: 1px;
  margin-left: 14px;
  transition: color 120ms ease, border-color 120ms ease;
}
.section-link:hover { color: var(--aqua); border-color: var(--aqua); }
.section-link::after { content: " →"; }

/* =================================================================
   FORMS — glass inputs, gradient pill button
   ================================================================= */
input, textarea, select {
  background: rgba(255, 255, 255, 0.7);
  color: var(--ink);
  border: 1px solid var(--rule);
  padding: 10px 14px;
  font-family: var(--font-body);
  font-size: 13.5px;
  border-radius: var(--radius-input);
  transition: border-color 120ms ease, box-shadow 120ms ease, background 120ms ease;
  outline: none;
}
input:hover, textarea:hover, select:hover { border-color: var(--muted-soft); }
input:focus, textarea:focus, select:focus {
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(0, 193, 222, 0.20);
  background: rgba(255, 255, 255, 0.95);
}
input::placeholder { color: var(--muted-soft); }

textarea {
  font-family: var(--font-mono);
  font-size: 13px;
  line-height: 1.6;
  background: rgba(241, 245, 248, 0.8);
  resize: vertical;
}

select {
  appearance: none;
  -webkit-appearance: none;
  background-image:
    linear-gradient(45deg, transparent 50%, var(--teal) 50%),
    linear-gradient(-45deg, transparent 50%, var(--teal) 50%);
  background-position:
    calc(100% - 16px) 50%,
    calc(100% - 11px) 50%;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
  padding-right: 28px;
}

button {
  background: linear-gradient(135deg, var(--teal), var(--aqua));
  color: white;
  border: none;
  padding: 10px 20px;
  font-family: var(--font-display);
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.10em;
  cursor: pointer;
  border-radius: var(--radius-pill);
  transition: filter 120ms ease, transform 80ms ease, box-shadow 200ms ease;
  box-shadow: 0 4px 14px rgba(0, 132, 155, 0.28);
}
button:hover {
  filter: brightness(1.08);
  box-shadow: 0 6px 20px rgba(0, 193, 222, 0.40);
}
button:active { transform: translateY(1px); }
button:focus-visible { outline: 2px solid var(--aqua); outline-offset: 3px; }

/* =================================================================
   ENGINEER PANELS (Tier 3)
   ================================================================= */
#sql-console .chart,
#function-browser .chart {
  padding: 26px;
}

#run-status {
  font-family: var(--font-mono);
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--muted);
}

#result, #browser-rows {
  border: 1px solid var(--rule);
  background: rgba(255, 255, 255, 0.6);
  margin-top: 6px;
  border-radius: var(--radius-input);
  overflow: auto;
}
#result table, #browser-rows table { background: transparent; }

#browser-detail {
  font-family: var(--font-body);
  font-size: 13.5px;
  line-height: 1.55;
  color: var(--ink-soft);
  background: rgba(255, 255, 255, 0.78);
  backdrop-filter: blur(12px);
  padding: 24px 28px;
  border: 1px solid var(--glass-border);
  border-left: 3px solid var(--teal);
  border-radius: var(--radius-input);
  margin-top: 18px;
  max-height: 480px;
  overflow: auto;
}
#browser-detail:empty { display: none; }
#browser-detail dt, #browser-detail dd { margin: 0; }
@media (max-width: 640px) {
  #browser-detail > div[style*="grid-template-columns"] { grid-template-columns: 1fr !important; }
}

#result pre {
  font-family: var(--font-mono);
  font-size: 12.5px;
  margin: 0;
  padding: 14px 18px;
  background: rgba(184, 69, 31, 0.06);
  border-left: 3px solid var(--warn);
  color: var(--warn);
  white-space: pre-wrap;
  border-radius: var(--radius-small);
}

/* =================================================================
   FUNCTION DETAIL MODAL — glass on navy backdrop
   ================================================================= */
dialog#fn-detail-modal {
  width: min(92vw, 920px);
  max-height: 88vh;
  padding: 0;
  background: var(--glass-bg-strong);
  backdrop-filter: blur(28px) saturate(1.4);
  -webkit-backdrop-filter: blur(28px) saturate(1.4);
  color: var(--ink-soft);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-card);
  box-shadow: 0 24px 80px rgba(5, 28, 44, 0.45), 0 1px 0 0 rgba(255,255,255,0.6) inset;
  overflow: hidden;
  font-family: var(--font-body);
}
dialog#fn-detail-modal::backdrop {
  background: rgba(5, 28, 44, 0.55);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}
dialog#fn-detail-modal[open] {
  animation: modal-in 180ms cubic-bezier(.2, .8, .2, 1);
}
@keyframes modal-in {
  from { opacity: 0; transform: translateY(8px) scale(0.985); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

dialog#fn-detail-modal .modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 24px;
  border-bottom: 1px solid var(--rule);
  background: rgba(255, 255, 255, 0.7);
  position: sticky; top: 0; z-index: 1;
}
dialog#fn-detail-modal .modal-kicker {
  margin: 0;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: var(--teal);
}
dialog#fn-detail-modal .modal-close {
  background: transparent;
  color: var(--ink);
  border: 1px solid var(--ink);
  width: 32px;
  height: 32px;
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 500;
  line-height: 1;
  letter-spacing: 0;
  text-transform: none;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  border-radius: 50%;
  transition: background 120ms ease, color 120ms ease, transform 80ms ease;
  box-shadow: none;
}
dialog#fn-detail-modal .modal-close:hover {
  background: var(--ink);
  color: white;
  filter: none;
}
dialog#fn-detail-modal .modal-body {
  padding: 26px 30px 30px;
  overflow-y: auto;
  max-height: calc(88vh - 70px);
  background: transparent;
}
@media (max-width: 640px) {
  dialog#fn-detail-modal .modal-body > div[style*="grid-template-columns:1fr 1fr"] {
    grid-template-columns: 1fr !important;
  }
}

/* =================================================================
   FOOTER — navy contrast band
   ================================================================= */
footer {
  background: var(--navy);
  color: rgba(255, 255, 255, 0.65);
  padding: 28px var(--gutter) 32px;
  font-family: var(--font-mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  margin-top: 60px;
  border-top: 1px solid rgba(0, 193, 222, 0.18);
}
footer p { margin: 0; max-width: var(--max-width); margin: 0 auto; }
footer code {
  font-family: var(--font-mono);
  background: transparent;
  color: rgba(255, 255, 255, 0.85);
  padding: 0;
}
.footer-mark {
  font-family: var(--font-display);
  font-weight: 800;
  letter-spacing: -0.04em;
  color: white;
  text-transform: none;
  font-size: 13px;
  background: linear-gradient(135deg, var(--teal), var(--aqua));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

/* =================================================================
   UTILITIES
   ================================================================= */
.hidden { display: none; }

@media (max-width: 720px) {
  .masthead-row { grid-template-columns: 1fr; gap: 14px; }
  .meta { text-align: left; }
  .section-head { grid-template-columns: 1fr; }
  section[data-roman]::before { font-size: 70px; opacity: 0.12; }
}
