/* ================================================================
   Decoding Gray Urban Spaces — UI
   Design system: dark cartographic theme
   ================================================================ */

:root {
  /* surfaces */
  --bg: #0e1116;
  --surface-1: #151a21;
  --surface-2: #1b212b;
  --surface-3: #222a36;
  --overlay: rgba(21, 26, 33, .92);

  /* strokes */
  --line: #2c3542;
  --line-soft: #232b36;
  --line-strong: #3a4655;

  /* text */
  --text: #eceff4;
  --text-2: #9aa5b4;
  --text-3: #6c7787;

  /* brand */
  --accent: #e4572e;
  --accent-hi: #f0703f;
  --accent-soft: rgba(228, 87, 46, .13);
  --accent-line: rgba(228, 87, 46, .5);
  --amber: #f0a202;
  --amber-soft: rgba(240, 162, 2, .1);
  --ok: #46b380;
  --ok-soft: rgba(70, 179, 128, .12);
  --blue: #5b9bef;
  --danger: #e0564d;

  /* shape + depth */
  --r-sm: 7px;
  --r-md: 10px;
  --r-lg: 14px;
  --shadow-1: 0 1px 2px rgba(0, 0, 0, .3);
  --shadow-2: 0 6px 20px rgba(0, 0, 0, .35);
  --shadow-3: 0 18px 48px rgba(0, 0, 0, .5);

  /* type */
  --font-ui: "Inter", "Segoe UI Variable", "Segoe UI", system-ui, -apple-system, sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, "Cascadia Mono", Consolas, monospace;

  font-size: 15px;
  color-scheme: dark;
}

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

body {
  font-family: var(--font-ui);
  font-weight: 450;
  background: var(--bg);
  color: var(--text);
  height: 100vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

::selection { background: rgba(228, 87, 46, .35); }

/* scrollbars */
* { scrollbar-width: thin; scrollbar-color: var(--line-strong) transparent; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--line-strong); border-radius: 6px; border: 3px solid transparent; background-clip: content-box; }
::-webkit-scrollbar-track { background: transparent; }

/* icons */
.ic { width: 15px; height: 15px; flex: 0 0 auto; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.ic-lg { width: 20px; height: 20px; }

.hidden { display: none !important; }
.dim { color: var(--text-3); }

/* focus */
:focus-visible { outline: 2px solid var(--accent-hi); outline-offset: 2px; border-radius: 4px; }
input:focus-visible, select:focus-visible { outline: none; }

/* ================================================================
   TOP BAR
   ================================================================ */
#topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 0 20px;
  height: 58px;
  background: var(--surface-1);
  border-bottom: 1px solid var(--line);
  flex: 0 0 auto;
  z-index: 10;
}
.brand { display: flex; align-items: center; gap: 13px; min-width: 0; }
.brand-mark {
  color: var(--accent-hi);
  background: linear-gradient(145deg, var(--accent-soft), rgba(228, 87, 46, .05));
  border: 1px solid var(--accent-line);
  border-radius: var(--r-md);
  width: 38px; height: 38px;
  display: inline-flex; align-items: center; justify-content: center;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .06), var(--shadow-1);
  flex: 0 0 auto;
}
.brand-text h1 { font-size: 15.5px; font-weight: 650; letter-spacing: -.01em; line-height: 1.25; white-space: nowrap; }
.brand-text p { font-size: 12px; color: var(--text-2); letter-spacing: .01em; white-space: nowrap; }
nav { display: flex; gap: 8px; flex: 0 0 auto; }
.link-btn {
  display: inline-flex; align-items: center; gap: 7px;
  background: none; border: 1px solid var(--line); color: var(--text-2);
  padding: 7px 13px; border-radius: var(--r-sm); cursor: pointer; font-size: 12.5px;
  font-family: inherit; font-weight: 500; text-decoration: none;
  transition: color .15s, border-color .15s, background .15s;
}
.link-btn:hover { color: var(--text); border-color: var(--line-strong); background: rgba(255, 255, 255, .03); }
.link-btn .ic { width: 14px; height: 14px; opacity: .8; }

/* ================================================================
   LAYOUT
   ================================================================ */
#layout { display: flex; flex: 1 1 auto; min-height: 0; }
#sidebar {
  width: 356px; flex: 0 0 auto;
  display: flex; flex-direction: column;
  overflow-y: auto;
  background: var(--surface-1);
  border-right: 1px solid var(--line);
  padding: 16px 16px 0;
}
#steps { flex: 0 0 auto; position: relative; }
#map-wrap { flex: 1 1 auto; position: relative; min-width: 0; background: var(--bg); }
#map { position: absolute; inset: 0; }

/* ================================================================
   STEPS
   ================================================================ */
.step {
  position: relative;
  border: 1px solid var(--line-soft);
  border-radius: var(--r-lg);
  padding: 13px 14px;
  margin-bottom: 12px;
  background: var(--surface-2);
  box-shadow: var(--shadow-1);
  transition: opacity .3s, border-color .3s, box-shadow .3s;
}
/* connective rail between step cards */
.step:not(:last-child)::after {
  content: "";
  position: absolute;
  left: 25px; bottom: -13px;
  width: 2px; height: 14px;
  background: var(--line-soft);
}
.step.disabled { opacity: .45; }
.step.disabled .step-body { pointer-events: none; }
.step:not(.disabled):not(.done) {
  border-color: var(--accent-line);
  box-shadow: 0 0 0 3px rgba(228, 87, 46, .08), var(--shadow-1);
}
.step.done { border-color: var(--line-soft); }
.step.done:not(:last-child)::after { background: rgba(70, 179, 128, .45); }

.step h2 {
  font-size: 13px; font-weight: 650; letter-spacing: .01em;
  display: flex; align-items: center; gap: 10px;
}
.step-title { flex: 1 1 auto; }
.step-num {
  display: inline-flex; align-items: center; justify-content: center;
  width: 23px; height: 23px; border-radius: 50%;
  background: var(--accent); color: #fff;
  font-size: 11px; font-weight: 650; font-family: var(--font-mono);
  flex: 0 0 auto;
  box-shadow: 0 0 0 4px var(--accent-soft);
  transition: background .3s, box-shadow .3s;
}
.step-num .ic { width: 12px; height: 12px; stroke-width: 3; }
.step.disabled .step-num { background: var(--surface-3); color: var(--text-3); box-shadow: none; }
.step.done .step-num { background: var(--ok); box-shadow: 0 0 0 4px var(--ok-soft); }

.step-body { margin-top: 10px; }

.hint { font-size: 12px; color: var(--text-2); margin-bottom: 11px; line-height: 1.55; }
.hint em { color: var(--text); font-style: normal; font-weight: 600; }

/* ================================================================
   BUTTONS
   ================================================================ */
.btn-row { display: flex; gap: 8px; margin-bottom: 8px; flex-wrap: wrap; }
.btn-row:last-child { margin-bottom: 0; }

button, .file-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font-family: inherit; font-size: 13px; font-weight: 500;
  border-radius: var(--r-sm); cursor: pointer;
  padding: 8px 14px; border: 1px solid transparent;
  color: var(--text);
  transition: background .15s, border-color .15s, color .15s, box-shadow .15s, transform .06s;
}
button:active:not(:disabled) { transform: translateY(1px); }

button.primary {
  background: linear-gradient(180deg, var(--accent-hi), var(--accent));
  color: #fff; font-weight: 600;
  border-color: rgba(255, 255, 255, .12);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .14), 0 2px 8px rgba(228, 87, 46, .25);
}
button.primary:hover:not(:disabled) {
  background: linear-gradient(180deg, #f5814f, var(--accent-hi));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .16), 0 3px 14px rgba(228, 87, 46, .38);
}
button.primary:disabled { box-shadow: none; }

button.ghost, .file-btn.ghost {
  background: transparent; border-color: var(--line); color: var(--text);
}
button.ghost:hover:not(:disabled), .file-btn.ghost:hover {
  border-color: var(--line-strong); background: rgba(255, 255, 255, .035);
}

button.small, .file-btn.small { font-size: 12px; padding: 6px 11px; gap: 7px; }
button.small .ic, .file-btn.small .ic { width: 13px; height: 13px; }
button.tiny { font-size: 11.5px; padding: 4px 9px; gap: 6px; border-radius: 6px; }
button.tiny .ic { width: 12px; height: 12px; }
button.block, .file-btn.block { width: 100%; }

button:disabled { opacity: .42; cursor: not-allowed; }
button.active { border-color: var(--accent); color: var(--accent-hi); background: var(--accent-soft); }

.close-btn {
  background: none; border: none; color: var(--text-2);
  width: 30px; height: 30px; padding: 0; border-radius: var(--r-sm);
}
.close-btn .ic { width: 15px; height: 15px; }
.close-btn:hover { color: var(--text); background: rgba(255, 255, 255, .06); }

/* ================================================================
   FORMS
   ================================================================ */
.info-box {
  font-size: 12px; background: var(--bg);
  border: 1px solid var(--line-soft); border-radius: var(--r-sm);
  padding: 9px 11px; color: var(--text-2); line-height: 1.55;
  margin-top: 10px;
}
.info-box b { color: var(--text); font-weight: 600; font-variant-numeric: tabular-nums; }
.info-box.error { border-color: rgba(224, 86, 77, .5); background: rgba(224, 86, 77, .06); color: #f0b6ae; }

.param-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; margin-bottom: 11px; }
.param-grid label {
  font-size: 11px; font-weight: 500; color: var(--text-2);
  display: flex; flex-direction: column; gap: 5px;
  letter-spacing: .02em;
}
.unit-row {
  display: flex; align-items: center;
  background: var(--bg); border: 1px solid var(--line); border-radius: var(--r-sm);
  padding-right: 9px;
  transition: border-color .15s, box-shadow .15s;
}
.unit-row:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.unit-row input {
  background: none; border: none; color: var(--text);
  padding: 7px 0 7px 10px; font-size: 13px; width: 100%; min-width: 0;
  font-family: var(--font-mono); font-weight: 500;
}
.unit-row input:focus { outline: none; }
.unit-row input::-webkit-outer-spin-button, .unit-row input::-webkit-inner-spin-button { -webkit-appearance: none; }
.unit-row input[type="number"] { -moz-appearance: textfield; appearance: textfield; }
.unit { color: var(--text-3); font-size: 11.5px; padding-left: 6px; }

/* slider */
.slider-label {
  display: flex; align-items: baseline; justify-content: space-between; gap: 8px;
  font-size: 12px; font-weight: 500; color: var(--text-2); margin-bottom: 7px;
}
.slider-value { color: var(--text-3); font-weight: 450; }
.slider-value output { color: var(--amber); font-weight: 600; font-family: var(--font-mono); }
input[type="range"] {
  --fill: 37.5%;
  -webkit-appearance: none; appearance: none;
  width: 100%; height: 18px; background: none; cursor: pointer;
  margin-bottom: 10px;
}
input[type="range"]::-webkit-slider-runnable-track {
  height: 5px; border-radius: 3px;
  background: linear-gradient(90deg, var(--accent) var(--fill), var(--surface-3) var(--fill));
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none;
  width: 15px; height: 15px; border-radius: 50%; margin-top: -5px;
  background: #fff; border: 4px solid var(--accent);
  box-shadow: var(--shadow-1);
  transition: transform .12s;
}
input[type="range"]::-webkit-slider-thumb:hover { transform: scale(1.15); }
input[type="range"]::-moz-range-track { height: 5px; border-radius: 3px; background: var(--surface-3); }
input[type="range"]::-moz-range-progress { height: 5px; border-radius: 3px; background: var(--accent); }
input[type="range"]::-moz-range-thumb {
  width: 8px; height: 8px; border-radius: 50%;
  background: #fff; border: 4px solid var(--accent);
  box-shadow: var(--shadow-1);
}

/* checkboxes */
.check {
  display: flex; align-items: center; gap: 9px;
  font-size: 12px; color: var(--text-2);
  margin: 7px 0; cursor: pointer; user-select: none;
  transition: color .15s;
}
.check:hover { color: var(--text); }
.check input { position: absolute; opacity: 0; width: 0; height: 0; }
.check .box {
  width: 16px; height: 16px; flex: 0 0 auto;
  border: 1.5px solid var(--line-strong); border-radius: 5px;
  background: var(--bg);
  display: inline-flex; align-items: center; justify-content: center;
  transition: background .15s, border-color .15s;
}
.check .box .ic { width: 10px; height: 10px; stroke-width: 3.5; stroke: #fff; opacity: 0; transform: scale(.6); transition: opacity .12s, transform .12s; }
.check input:checked + .box { background: var(--accent); border-color: var(--accent); }
.check input:checked + .box .ic { opacity: 1; transform: scale(1); }
.check input:focus-visible + .box { outline: 2px solid var(--accent-hi); outline-offset: 2px; }
.check input:disabled ~ * { opacity: .5; cursor: not-allowed; }

/* progress */
#progress-wrap { margin-top: 11px; }
.progress {
  height: 6px; border-radius: 3px; background: var(--bg);
  overflow: hidden; margin-bottom: 7px;
  border: 1px solid var(--line-soft);
}
#progress-bar {
  height: 100%; width: 0%;
  background: linear-gradient(90deg, var(--accent), var(--amber));
  background-size: 200% 100%;
  animation: progress-sheen 1.6s linear infinite;
  transition: width .25s;
}
@keyframes progress-sheen { from { background-position: 0% 0; } to { background-position: -200% 0; } }
.progress-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
#progress-label { font-size: 11.5px; color: var(--text-2); font-family: var(--font-mono); }

/* footer */
#sidebar-footer {
  font-size: 10.5px; color: var(--text-3); line-height: 1.6;
  padding: 14px 4px 16px; margin-top: auto;
  border-top: 1px solid var(--line-soft);
}
#sidebar-footer p { margin-bottom: 7px; }
#sidebar-footer p:last-child { margin-bottom: 0; }
#sidebar-footer a { color: var(--blue); text-decoration: none; }
#sidebar-footer a:hover { text-decoration: underline; }

/* ================================================================
   MAP PANELS
   ================================================================ */
.map-panel {
  position: absolute; top: 14px; right: 14px; z-index: 5;
  background: var(--overlay);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: 13px 14px; width: 246px;
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  box-shadow: var(--shadow-2);
}
.map-panel h3 {
  display: flex; align-items: center; gap: 7px;
  font-size: 10.5px; text-transform: uppercase; letter-spacing: .12em;
  color: var(--text-3); margin-bottom: 10px; font-weight: 600;
}
.map-panel h3 .ic { width: 12px; height: 12px; }

#measure-buttons { display: flex; flex-wrap: wrap; gap: 5px; margin-bottom: 6px; }
#measure-buttons button {
  font-size: 11px; font-weight: 500; padding: 4px 9px;
  background: var(--bg); border: 1px solid var(--line); color: var(--text-2);
  border-radius: 6px;
}
#measure-buttons button:hover { color: var(--text); border-color: var(--line-strong); }
#measure-buttons button.active {
  border-color: var(--amber); color: var(--amber); background: var(--amber-soft);
}

.toggle-list { border-top: 1px solid var(--line-soft); padding-top: 4px; }
.toggle-list .check { margin: 6px 0; font-size: 11.5px; }
.toggle-list .check .box { width: 15px; height: 15px; }

#legend { margin-top: 8px; font-size: 10.5px; color: var(--text-2); border-top: 1px solid var(--line-soft); padding-top: 9px; }
#legend .legend-title { color: var(--text); font-size: 11.5px; font-weight: 600; margin-bottom: 2px; }
.legend-bar {
  height: 8px; border-radius: 4px; margin: 6px 0 4px;
  background: linear-gradient(90deg, #2c4fd8, #29b6f6, #4caf7d, #ffd54f, #f4511e, #b71c1c);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .08);
}
.legend-ends { display: flex; justify-content: space-between; font-family: var(--font-mono); font-size: 10px; }
.legend-note { color: var(--text-3); margin-top: 4px; }

/* map hint */
#map-hint {
  position: absolute; top: 16px; left: 50%; transform: translateX(-50%); z-index: 6;
  background: var(--overlay);
  border: 1px solid var(--accent-line);
  color: var(--text); font-size: 12.5px; padding: 10px 18px;
  border-radius: 999px;
  box-shadow: var(--shadow-2), 0 0 0 3px rgba(228, 87, 46, .07);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  max-width: 78%; text-align: center; line-height: 1.45;
  animation: hint-in .3s ease;
}
@keyframes hint-in { from { opacity: 0; transform: translate(-50%, -6px); } to { opacity: 1; transform: translate(-50%, 0); } }
#map-hint b { font-weight: 600; }
#map-hint kbd {
  background: var(--bg); border: 1px solid var(--line); border-bottom-width: 2px;
  border-radius: 4px; padding: 1px 6px; font-size: 10.5px; font-family: var(--font-mono);
}

/* segment tooltip */
#seg-tooltip {
  position: absolute; z-index: 6; pointer-events: none;
  background: rgba(14, 17, 22, .96);
  border: 1px solid var(--line); border-radius: var(--r-md);
  padding: 9px 12px; font-size: 11px; line-height: 1.6; color: var(--text-2);
  font-family: var(--font-mono);
  max-width: 300px; box-shadow: var(--shadow-2);
}
#seg-tooltip b { color: var(--amber); font-weight: 600; }

/* gray candidate markers */
.gray-marker {
  background: linear-gradient(180deg, var(--accent-hi), var(--accent));
  color: #fff;
  font: 600 10.5px/1 var(--font-mono);
  padding: 4px 8px; border-radius: 999px; cursor: pointer;
  box-shadow: 0 2px 8px rgba(0, 0, 0, .55), inset 0 1px 0 rgba(255, 255, 255, .2);
  border: 1px solid rgba(255, 255, 255, .3);
  transition: transform .12s, box-shadow .12s;
}
.gray-marker:hover { transform: scale(1.22); box-shadow: 0 4px 14px rgba(0, 0, 0, .6), inset 0 1px 0 rgba(255, 255, 255, .2); }

/* ================================================================
   TOASTS
   ================================================================ */
#toasts {
  position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%);
  z-index: 40; display: flex; flex-direction: column; gap: 8px; align-items: center;
  pointer-events: none;
}
.toast {
  display: flex; align-items: center; gap: 10px;
  background: var(--overlay);
  border: 1px solid var(--line);
  color: var(--text); font-size: 12.5px; padding: 11px 17px;
  border-radius: var(--r-md);
  box-shadow: var(--shadow-3);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  animation: toast-in .25s ease; pointer-events: auto; max-width: 500px;
  line-height: 1.45;
}
.toast::before {
  content: ""; width: 8px; height: 8px; border-radius: 50%; flex: 0 0 auto;
  background: var(--amber); box-shadow: 0 0 8px var(--amber);
}
.toast.ok::before { background: var(--ok); box-shadow: 0 0 8px var(--ok); }
.toast.err::before { background: var(--danger); box-shadow: 0 0 8px var(--danger); }
.toast b { font-weight: 600; font-variant-numeric: tabular-nums; }
.toast.fade { opacity: 0; transition: opacity .4s; }
@keyframes toast-in { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; } }

/* ================================================================
   MATRIX PANEL
   ================================================================ */
#matrix-panel {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
  max-height: 52vh; overflow: hidden; display: flex; flex-direction: column;
  background: var(--surface-1);
  border-top: 1px solid var(--accent-line);
  padding: 14px 20px 16px;
  box-shadow: 0 -14px 44px rgba(0, 0, 0, .55);
  animation: panel-up .28s cubic-bezier(.3, .9, .35, 1);
}
@keyframes panel-up { from { transform: translateY(24px); opacity: 0; } to { transform: none; opacity: 1; } }

.panel-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; gap: 12px; }
.panel-title { display: flex; align-items: center; gap: 10px; min-width: 0; }
.panel-head h2 { font-size: 15px; font-weight: 650; letter-spacing: -.01em; white-space: nowrap; }
.panel-actions { display: flex; align-items: center; gap: 6px; }
.count-pill {
  background: var(--accent-soft); color: var(--amber);
  border: 1px solid rgba(240, 162, 2, .25);
  font-size: 11px; font-weight: 600; border-radius: 999px; padding: 3px 11px;
  white-space: nowrap; font-variant-numeric: tabular-nums;
}
#matrix-panel .hint { margin-bottom: 4px; }
#matrix-table-wrap {
  overflow: auto; flex: 1 1 auto; margin-top: 8px;
  border: 1px solid var(--line-soft); border-radius: var(--r-md);
  background: var(--bg);
}

table.matrix { border-collapse: separate; border-spacing: 0; width: 100%; font-size: 12px; }
table.matrix th, table.matrix td {
  border-bottom: 1px solid var(--line-soft);
  padding: 7px 11px; text-align: left; white-space: nowrap;
}
table.matrix th {
  background: var(--surface-2); position: sticky; top: 0; z-index: 1;
  font-weight: 600; color: var(--text-2); font-size: 10.5px;
  letter-spacing: .06em; text-transform: uppercase;
  border-bottom: 1px solid var(--line);
}
table.matrix tbody tr { cursor: pointer; }
table.matrix tbody tr:nth-child(even) td { background: rgba(255, 255, 255, .015); }
table.matrix tr:hover td { background: rgba(228, 87, 46, .07); }
table.matrix tr.selected td { background: rgba(228, 87, 46, .16); }
table.matrix tr.confirmed td:first-child { box-shadow: inset 3px 0 0 var(--ok); }
table.matrix td.num { font-family: var(--font-mono); font-size: 11.5px; text-align: right; }
table.matrix td b { font-family: var(--font-mono); color: var(--amber); }
table.matrix select, table.matrix input[type="text"] {
  font-family: inherit;
  background: var(--surface-2); border: 1px solid var(--line); color: var(--text);
  border-radius: 6px; padding: 4px 7px; font-size: 12px; min-width: 118px;
  transition: border-color .15s;
}
table.matrix select:hover, table.matrix input[type="text"]:hover { border-color: var(--line-strong); }
table.matrix select:focus, table.matrix input[type="text"]:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
table.matrix input[type="checkbox"] { accent-color: var(--ok); width: 15px; height: 15px; cursor: pointer; }

/* ================================================================
   MODAL
   ================================================================ */
.modal {
  position: fixed; inset: 0; z-index: 30;
  background: rgba(5, 7, 10, .68);
  backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px);
  display: flex; align-items: center; justify-content: center; padding: 24px;
  animation: modal-fade .2s ease;
}
@keyframes modal-fade { from { opacity: 0; } to { opacity: 1; } }
.modal-card {
  background: var(--surface-1);
  border: 1px solid var(--line); border-radius: 16px;
  max-width: 730px; max-height: 86vh; display: flex; flex-direction: column;
  padding: 20px 24px 22px;
  box-shadow: var(--shadow-3);
  animation: modal-up .25s cubic-bezier(.3, .9, .35, 1);
}
@keyframes modal-up { from { transform: translateY(14px) scale(.985); opacity: 0; } to { transform: none; opacity: 1; } }
.modal-card .panel-head { margin-bottom: 10px; }
.modal-card h2 { font-size: 16px; font-weight: 650; letter-spacing: -.01em; }
.modal-body { overflow-y: auto; font-size: 13.5px; line-height: 1.65; color: var(--text); padding-right: 6px; }
.modal-body p, .modal-body ol, .modal-body ul { margin-bottom: 10px; }
.modal-body ol, .modal-body ul { padding-left: 22px; }
.modal-body li { margin-bottom: 4px; }
.modal-body h3 {
  font-size: 11px; margin: 18px 0 8px; color: var(--amber);
  text-transform: uppercase; letter-spacing: .1em; font-weight: 650;
}
.modal-body .cite {
  font-size: 12.5px; color: var(--text-2);
  border-left: 3px solid var(--line); padding-left: 12px;
}
.modal-body a { color: var(--blue); }
.modal-body code {
  background: var(--bg); border: 1px solid var(--line-soft);
  border-radius: 4px; padding: 1px 5px; font-size: 12px; font-family: var(--font-mono);
}

/* ================================================================
   MAPLIBRE CHROME
   ================================================================ */
.maplibregl-ctrl-group {
  background: var(--overlay) !important;
  border: 1px solid var(--line);
  border-radius: var(--r-sm) !important;
  box-shadow: var(--shadow-2) !important;
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  overflow: hidden;
}
.maplibregl-ctrl-group button + button { border-top: 1px solid var(--line-soft) !important; }
.maplibregl-ctrl button .maplibregl-ctrl-icon { filter: invert(.85); }
.maplibregl-ctrl-scale {
  background: var(--overlay) !important; color: var(--text-2) !important;
  border-color: var(--text-3) !important; font-size: 10px !important;
  font-family: var(--font-mono);
}
.maplibregl-ctrl-attrib { background: rgba(14, 17, 22, .75) !important; }
.maplibregl-ctrl-attrib, .maplibregl-ctrl-attrib a { color: var(--text-3) !important; font-size: 10px; }

/* ================================================================
   REPORT (PRINT)
   ================================================================ */
#report { display: none; }
@media print {
  body > *:not(#report) { display: none !important; }
  body { overflow: visible; height: auto; background: #fff; color: #000; }
  #report { display: block !important; padding: 20px; font-size: 12px; color: #000; font-family: Georgia, "Times New Roman", serif; }
  #report h1 { font-size: 20px; margin-bottom: 4px; }
  #report h2 { font-size: 15px; margin: 16px 0 6px; }
  #report table { border-collapse: collapse; width: 100%; font-size: 10.5px; }
  #report th, #report td { border: 1px solid #999; padding: 4px 6px; text-align: left; }
  #report .cite { font-size: 10px; color: #444; margin-top: 14px; }
  #report .guidance { margin: 6px 0 10px; padding-left: 16px; }
}

/* ================================================================
   MOTION + RESPONSIVE
   ================================================================ */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

@media (max-width: 860px) {
  #layout { flex-direction: column; }
  #sidebar {
    width: 100%; max-height: 46vh;
    border-right: none; border-bottom: 1px solid var(--line);
  }
  #topbar { padding: 0 14px; }
  .brand-text p { display: none; }
  nav .link-btn span { display: none; }
  nav .link-btn { padding: 7px 9px; }
  .map-panel { width: 204px; top: 10px; right: 10px; }
  #matrix-panel { max-height: 62vh; padding: 12px 14px 14px; }
}
