:root {
  --ink: #15202b;
  --muted: #657282;
  --line: #dce2e8;
  --panel: #ffffff;
  --canvas: #f3f5f7;
  --red: #df123b;
  --red-dark: #b80c2d;
  --blue: #1f68d5;
  --cyan: #007f91;
  --green: #16825d;
  --amber: #ae6800;
  --critical: #b51232;
  --shadow: 0 12px 34px rgba(21, 32, 43, .08);
}

* { box-sizing: border-box; }

html, body { min-height: 100%; }

body {
  margin: 0;
  background: var(--canvas);
  color: var(--ink);
  font-family: "Segoe UI", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}

button, input, select { font: inherit; }

.app-shell {
  display: grid;
  grid-template-columns: 254px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  padding: 24px 18px;
  background: #111820;
  color: #f7f9fb;
  overflow-y: auto;
}

.brand { display: flex; flex-direction: column; align-items: flex-start; gap: 16px; padding: 2px 6px 24px; }

.brand-logo { width: 172px; height: auto; display: block; }

.brand-meta { border-top: 1px solid rgba(255,255,255,.12); padding-top: 14px; width: 100%; }
.brand-meta strong { display: block; margin-top: 3px; font-size: 22px; letter-spacing: .5px; }
.eyebrow { color: #97a7b8; font-size: 10px; font-weight: 800; letter-spacing: 1.3px; }

.project-card {
  display: flex;
  align-items: center;
  gap: 11px;
  margin-bottom: 18px;
  padding: 13px;
  border: 1px solid rgba(255,255,255,.1);
  border-radius: 10px;
  background: rgba(255,255,255,.045);
}

.project-card small { display: block; color: #9fafbd; margin-bottom: 3px; }
.project-card b { font-size: 13px; }
.status-dot { width: 9px; height: 9px; border-radius: 99px; background: #35c887; box-shadow: 0 0 0 5px rgba(53,200,135,.12); }

#mainNav { display: grid; gap: 4px; }

.nav-button {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 11px 12px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: #c8d0d8;
  text-align: left;
  cursor: pointer;
}

.nav-button:hover { background: rgba(255,255,255,.055); color: #fff; }
.nav-button.active { background: var(--red); color: #fff; font-weight: 700; }
.nav-icon { width: 22px; text-align: center; font-size: 16px; }

.language-panel { margin-top: auto; padding: 24px 5px 0; }
.language-panel > span { display: block; color: #94a3b1; font-size: 11px; margin-bottom: 8px; text-transform: uppercase; letter-spacing: .8px; }
.language-switch { display: grid; grid-template-columns: repeat(3, 1fr); gap: 5px; }
.language-switch button { border: 1px solid rgba(255,255,255,.15); border-radius: 6px; background: transparent; color: #b8c3cd; padding: 7px 0; cursor: pointer; font-size: 12px; font-weight: 700; }
.language-switch button.active { border-color: #fff; background: #fff; color: #111820; }
.sidebar-note { margin: 16px 5px 0; color: #7f8d9a; font-size: 11px; line-height: 1.45; }

.workspace { min-width: 0; }

.topbar {
  min-height: 132px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 28px;
  padding: 25px 34px 23px;
  border-bottom: 1px solid var(--line);
  background: rgba(255,255,255,.88);
  backdrop-filter: blur(12px);
}

.breadcrumb { color: var(--red); font-size: 11px; font-weight: 800; letter-spacing: .45px; text-transform: uppercase; }
.topbar h1 { margin: 8px 0 4px; font-size: clamp(26px, 3vw, 38px); line-height: 1.08; letter-spacing: -.8px; }
.topbar p { margin: 0; color: var(--muted); font-size: 14px; }
.topbar-actions { display: flex; align-items: center; gap: 12px; flex-shrink: 0; }
.updated { color: var(--muted); font-size: 12px; }
.updated b { color: var(--ink); }
.mvp-badge { padding: 8px 10px; border-radius: 6px; background: #111820; color: #fff; font-size: 11px; font-weight: 800; }

.content { padding: 26px 34px 46px; }

.kpi-grid { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 14px; margin-bottom: 18px; }
.kpi { position: relative; min-height: 128px; padding: 18px; overflow: hidden; border: 1px solid var(--line); border-radius: 12px; background: var(--panel); box-shadow: var(--shadow); }
.kpi:after { content: ""; position: absolute; right: -22px; bottom: -32px; width: 86px; height: 86px; border-radius: 50%; background: rgba(223,18,59,.065); }
.kpi small { color: var(--muted); font-size: 12px; }
.kpi strong { display: block; margin: 9px 0 5px; font-size: 32px; line-height: 1; letter-spacing: -1px; }
.kpi span { color: var(--muted); font-size: 11px; }
.kpi.critical strong { color: var(--critical); }

.grid-2 { display: grid; grid-template-columns: minmax(0, 1.45fr) minmax(300px, .75fr); gap: 18px; }
.card { border: 1px solid var(--line); border-radius: 12px; background: var(--panel); box-shadow: var(--shadow); overflow: hidden; }
.card + .card { margin-top: 18px; }
.card-header { display: flex; justify-content: space-between; align-items: flex-start; gap: 18px; padding: 18px 20px 14px; border-bottom: 1px solid #e8edf1; }
.card-header h2, .card-header h3 { margin: 0; font-size: 17px; }
.card-header p { margin: 5px 0 0; color: var(--muted); font-size: 12px; line-height: 1.4; }
.card-body { padding: 18px 20px; }
.card-body.flush { padding: 0; }

.priority-list { display: grid; gap: 10px; }
.priority-item { display: grid; grid-template-columns: 34px minmax(0,1fr) auto; align-items: start; gap: 12px; padding: 12px; border: 1px solid #e5eaee; border-radius: 9px; }
.priority-rank { display: grid; place-items: center; width: 31px; height: 31px; border-radius: 7px; background: #111820; color: #fff; font-weight: 800; }
.priority-item h3 { margin: 0 0 4px; font-size: 13px; }
.priority-item p { margin: 0; color: var(--muted); font-size: 12px; line-height: 1.45; }

.badge { display: inline-flex; align-items: center; min-height: 23px; padding: 3px 8px; border-radius: 99px; font-size: 10px; font-weight: 800; letter-spacing: .2px; text-transform: uppercase; white-space: nowrap; }
.badge.critical, .badge.conflict { background: #fde8ed; color: #a90b2b; }
.badge.high, .badge.open { background: #fff0d9; color: #8e5300; }
.badge.medium, .badge.inferred { background: #e9f1ff; color: #285ba6; }
.badge.low, .badge.extracted { background: #e9f6f1; color: #176b4d; }
.badge.verified, .badge.resolved, .badge.accepted { background: #def5e9; color: #11623f; }

.term-callout { border-left: 4px solid var(--red); padding: 2px 0 2px 15px; }
.term-callout strong { font-size: 22px; }
.term-callout p { margin: 7px 0 0; color: var(--muted); line-height: 1.55; font-size: 13px; }

.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 14px; }
.panel-toolbar { align-items: end; }
.toolbar-label, .toolbar-hint { color: var(--muted); font-size: 11px; }
.toolbar-hint { margin-left: auto; }
.stats-inline { color: var(--muted); font-size: 11px; font-weight: 700; }
.filter-select { display: inline-grid; gap: 4px; color: var(--muted); font-size: 10px; font-weight: 700; }
.filter-select select { min-width: 130px; border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; background: #fff; color: var(--ink); font-size: 12px; }
.panel-title-select { font: inherit; font-weight: 800; font-size: 17px; color: inherit; background: #eef3f8; border: 1px solid #cfd7df; border-radius: 8px; padding: 2px 8px; cursor: pointer; }
.panel-title-select:hover { background: #e3ebf2; border-color: #9fb2c4; }
.panel-title-select:focus { outline: 2px solid #9fb2c4; outline-offset: 1px; }
.segmented { display: inline-flex; padding: 3px; border: 1px solid var(--line); border-radius: 9px; background: #fff; }
.segmented button { border: 0; border-radius: 6px; padding: 7px 11px; background: transparent; color: var(--muted); cursor: pointer; font-size: 12px; }
.segmented button.active { background: #111820; color: #fff; }
.search { min-width: 220px; flex: 1; max-width: 420px; border: 1px solid var(--line); border-radius: 8px; padding: 9px 11px; background: #fff; color: var(--ink); }

.coverage-card { margin-bottom: 18px; }
.coverage-strip { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; padding: 18px 20px 20px; }
.coverage-item { padding: 14px; border: 1px solid #e3e8ed; border-radius: 9px; background: #fafbfc; }
.coverage-item b, .coverage-item strong, .coverage-item span { display: block; }
.coverage-item strong { margin: 6px 0 3px; font-size: 25px; letter-spacing: -.7px; }
.coverage-item span { color: var(--muted); font-size: 11px; }
.coverage-bar { height: 5px; margin-top: 12px; border-radius: 99px; background: #dfe9e4; overflow: hidden; }
.coverage-bar i { display: block; height: 100%; background: var(--green); }
.coverage-bar.neutral { background: #e6ebef; }
.coverage-bar.neutral i { background: var(--blue); }
.method-note { margin: 0 0 16px; padding: 14px 17px; border: 1px solid #dbe6ef; border-left: 4px solid var(--blue); border-radius: 9px; background: #f5f9fd; }
.method-note b { font-size: 13px; }
.method-note p { margin: 5px 0 0; color: var(--muted); font-size: 12px; line-height: 1.5; }

.map-wrap { position: relative; min-height: 580px; border: 1px solid var(--line); border-radius: 12px; background: #fff; box-shadow: var(--shadow); overflow: hidden; }
.map-wrap:before { content: ""; position: absolute; inset: 0; background-image: linear-gradient(#eef1f4 1px, transparent 1px), linear-gradient(90deg, #eef1f4 1px, transparent 1px); background-size: 28px 28px; opacity: .65; }
.map-wrap svg { position: relative; display: block; width: 100%; min-width: 800px; height: 580px; }
.map-line { fill: none; stroke-width: 2; opacity: .8; }
.map-line.power { stroke: #6b7783; }
.map-line.signal { stroke: var(--red); stroke-dasharray: 7 5; }
.map-line.data { stroke: var(--blue); stroke-dasharray: 4 5; }
.map-line.control { stroke: var(--amber); stroke-dasharray: 9 4 2 4; }
.map-line.conflict { stroke: var(--red); stroke-width: 4; }
.map-node { cursor: pointer; }
.map-node rect { fill: #fff; stroke: #aeb9c4; stroke-width: 1.5; rx: 7; filter: drop-shadow(0 5px 8px rgba(21,32,43,.12)); }
.map-node text { fill: var(--ink); font-size: 12px; font-weight: 800; pointer-events: none; }
.map-node.focus rect { fill: #111820; stroke: #111820; }
.map-node.focus text { fill: #fff; font-size: 15px; }
.map-node.main rect { fill: var(--red); stroke: var(--red); }
.map-node.main text { fill: #fff; font-size: 15px; }
.map-node.external rect { fill: #eef4ff; stroke: #75a2e8; }
.map-node.safety rect { fill: #fff0d8; stroke: #d49635; }
.map-legend { position: absolute; left: 16px; bottom: 14px; display: flex; flex-wrap: wrap; gap: 12px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; background: rgba(255,255,255,.92); color: var(--muted); font-size: 10px; }
.legend-line { display: inline-block; width: 22px; height: 2px; margin-right: 5px; vertical-align: middle; background: #6b7783; }
.legend-line.signal { background: var(--red); }
.legend-line.data { background: var(--blue); }

.panel-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 18px; }
.panel-hero { padding: 20px; color: #fff; background: linear-gradient(135deg, #151d26, #253646); }
.panel-hero .eyebrow { color: #acbac8; }
.panel-hero h2 { margin: 5px 0 3px; font-size: 28px; }
.panel-hero p { margin: 0; color: #cbd5df; font-size: 13px; }
.spec-grid { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 8px; padding: 15px; }
.spec { padding: 11px; border: 1px solid #e4e9ed; border-radius: 8px; background: #fafbfc; }
.spec span { display: block; color: var(--muted); font-size: 10px; text-transform: uppercase; letter-spacing: .4px; }
.spec b { display: block; margin-top: 4px; font-size: 14px; }
.spec-value { display: flex; align-items: center; gap: 6px; margin-top: 4px; }
.spec-value b { margin-top: 0; }
.icon-copy { display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; width: 22px; height: 22px; border: 0; border-radius: 6px; padding: 0; background: #e9f1ff; color: #285ba6; cursor: pointer; }
.icon-copy:hover { background: #d8e7ff; }
h3 .spec-value { margin-top: 0; }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 12px; }
th { padding: 11px 12px; background: #f5f7f9; color: #51606f; text-align: left; font-size: 10px; text-transform: uppercase; letter-spacing: .45px; white-space: nowrap; }
td { padding: 11px 12px; border-top: 1px solid #e6ebef; vertical-align: top; line-height: 1.4; }
tr:hover td { background: #fafbfc; }
.mono { font-family: Consolas, "Courier New", monospace; font-size: 11px; }
.source-ref { color: var(--blue); font-weight: 600; white-space: nowrap; }

.function-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 14px; }
.function-card { border: 1px solid var(--line); border-radius: 11px; background: #fff; padding: 17px; box-shadow: var(--shadow); }
.function-card .function-top { display: flex; justify-content: space-between; gap: 14px; }
.function-card h3 { margin: 0; font-size: 15px; }
.function-card p { color: var(--muted); font-size: 12px; line-height: 1.5; }
.automation-links { margin-top: 18px; }
.gap-list { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 12px; }
.gap-chip { padding: 4px 7px; border-radius: 5px; background: #f0f3f6; color: #536170; font-size: 10px; }

.badge.automation-blocked { background: #fde8ed; color: #a90b2b; }
.badge.automation-partial { background: #fff0d9; color: #8e5300; }
.badge.automation-confirmed { background: #def5e9; color: #11623f; }
.badge.automation-open { background: #fff0d9; color: #8e5300; }
.badge.confidence-high { background: #e6eefb; color: #244f8d; }
.badge.confidence-medium { background: #f0f3f6; color: #536170; }
.badge.confidence-low { background: #f4f0ea; color: #735b3a; }

.automation-boundary {
  display: flex;
  align-items: center;
  gap: 14px;
  margin: -2px 0 16px;
  padding: 12px 15px;
  border: 1px solid #f0c7d0;
  border-left: 5px solid var(--red);
  border-radius: 9px;
  background: #fff8fa;
  color: #5a3740;
  font-size: 12px;
  line-height: 1.45;
}
.automation-boundary b { flex: 0 0 auto; color: var(--red); font-size: 17px; }

.automation-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-bottom: 11px; }
.automation-view-switch { max-width: 100%; overflow-x: auto; }
.automation-view-switch button { white-space: nowrap; }
.automation-system-filter { display: flex; flex-wrap: wrap; gap: 7px; margin-bottom: 15px; }
.automation-system-filter button {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 7px 10px;
  border: 1px solid var(--line);
  border-radius: 99px;
  background: #fff;
  color: #526171;
  cursor: pointer;
  font-size: 11px;
  font-weight: 700;
}
.automation-system-filter button i { width: 8px; height: 8px; border-radius: 50%; background: var(--system-color, #596675); }
.automation-system-filter button.active { border-color: #111820; background: #111820; color: #fff; }

.automation-route-list { display: grid; gap: 14px; }
.automation-route {
  position: relative;
  padding: 18px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-left: 5px solid var(--system-color, #596675);
  border-radius: 12px;
  background: #fff;
  box-shadow: var(--shadow);
}
.automation-route:after { content: ""; position: absolute; top: -46px; right: -46px; width: 126px; height: 126px; border-radius: 50%; background: color-mix(in srgb, var(--system-color, #596675) 7%, transparent); pointer-events: none; }
.automation-route-head { position: relative; z-index: 1; display: flex; justify-content: space-between; align-items: flex-start; gap: 18px; }
.automation-route-head h2 { margin: 4px 0 0; font-size: 18px; letter-spacing: -.2px; }
.automation-badges { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 5px; }
.automation-summary { max-width: 1080px; margin: 9px 0 11px; color: var(--muted); font-size: 12px; line-height: 1.55; }
.automation-panels { display: flex; flex-wrap: wrap; align-items: center; gap: 5px; color: #556575; font-size: 10px; }
.automation-panels span { padding: 3px 6px; border: 1px solid #e2e7eb; border-radius: 5px; background: #f8fafb; font-family: Consolas, monospace; }

.automation-chain {
  display: flex;
  align-items: stretch;
  gap: 0;
  margin: 15px -3px 13px;
  padding: 8px 3px 5px;
  overflow-x: auto;
  scrollbar-width: thin;
}
.automation-chain-item { display: flex; flex: 0 0 auto; align-items: center; }
.automation-step {
  width: 168px;
  min-height: 110px;
  display: flex;
  flex-direction: column;
  padding: 11px;
  border: 1px solid #dfe5e9;
  border-top: 3px solid var(--system-color, #596675);
  border-radius: 9px;
  background: #fbfcfd;
}
.automation-step.is-gap { border-color: #e6a2b1; border-top-color: var(--red); background: #fff5f7; }
.automation-role { margin-bottom: 7px; color: #7a8793; font-size: 9px; font-weight: 800; letter-spacing: .7px; text-transform: uppercase; }
.automation-step b { color: #1f2f3d; font-size: 12px; line-height: 1.32; }
.automation-step small { display: block; margin-top: auto; padding-top: 9px; color: #687786; font-size: 10px; line-height: 1.38; }
.automation-arrow { width: 30px; color: var(--system-color, #596675); text-align: center; font-size: 21px; font-weight: 500; }
.automation-evidence-row { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; padding-top: 10px; border-top: 1px dashed #dce3e8; color: #5c6a78; font-size: 10px; }
.automation-evidence { padding: 4px 7px; border-radius: 5px; background: #edf3fb; color: #345f93; font-family: Consolas, monospace; }

.system-chip { display: inline-flex; align-items: center; margin: 2px 4px 2px 0; padding: 4px 7px; border-left: 3px solid var(--chip-color, #596675); border-radius: 4px; background: #f2f5f7; color: #465666; font-size: 10px; white-space: nowrap; }
.automation-matrix td:nth-child(2) { min-width: 250px; }
.automation-matrix td:nth-child(3) { min-width: 270px; }

.automation-method-list { display: grid; gap: 8px; margin-top: 18px; }
.automation-method-list > div { display: grid; grid-template-columns: 28px 1fr; align-items: center; gap: 9px; padding: 9px; border: 1px solid #e4e9ed; border-radius: 8px; }
.automation-method-list span { display: grid; place-items: center; width: 28px; height: 28px; border-radius: 7px; background: #111820; color: #fff; font-size: 11px; font-weight: 800; }
.automation-method-list p { margin: 0; color: #495969; font-size: 11px; line-height: 1.4; }
.automation-note { margin-top: 16px; padding: 12px; border-radius: 8px; background: #f5f7f9; color: #526171; font-size: 12px; line-height: 1.5; }

.spatial-intro { display: flex; justify-content: space-between; align-items: flex-start; gap: 24px; margin-bottom: 12px; padding: 18px 20px; border: 1px solid var(--line); border-radius: 12px; background: #fff; box-shadow: var(--shadow); }
.spatial-intro h2 { margin: 4px 0 7px; font-size: 20px; }
.spatial-intro p { max-width: 820px; margin: 0; color: var(--muted); font-size: 12px; line-height: 1.5; }
.spatial-trust { display: grid; gap: 5px; min-width: 240px; padding: 10px 12px; border-left: 3px solid var(--blue); background: #f4f8ff; color: #36516c; font-size: 10px; line-height: 1.4; }
.spatial-trust b { color: #1e3c5d; font-size: 11px; }
.spatial-boundary { margin-bottom: 12px; padding: 10px 12px; border: 1px solid #f0d59b; border-radius: 8px; background: #fff9eb; color: #7a5508; font-size: 11px; line-height: 1.45; }
.spatial-controls { display: grid; gap: 8px; margin-bottom: 12px; }
.spatial-pages, .spatial-categories { display: flex; gap: 5px; overflow-x: auto; padding-bottom: 3px; scrollbar-width: thin; }
.spatial-pages button, .spatial-categories button { flex: 0 0 auto; padding: 7px 10px; border: 1px solid var(--line); border-radius: 7px; background: #fff; color: #526171; cursor: pointer; font-size: 10px; font-weight: 750; }
.spatial-pages button.active, .spatial-categories button.active { border-color: #111820; background: #111820; color: #fff; }
.spatial-layout { display: grid; grid-template-columns: minmax(0, 1.75fr) minmax(280px, .55fr); gap: 14px; align-items: start; }
.spatial-canvas { min-width: 0; overflow: hidden; border: 1px solid var(--line); border-radius: 11px; background: #fff; box-shadow: var(--shadow); }
.spatial-image-wrap { position: relative; overflow: auto; max-height: min(72vh, 900px); background: #eef1f3; }
.spatial-image-wrap img { display: block; width: 100%; height: auto; }
.spatial-marker { position: absolute; transform: translate(-50%, -50%); width: 29px; height: 29px; padding: 0; border: 2px solid #fff; border-radius: 50%; background: #168c67; color: #fff; box-shadow: 0 3px 10px rgba(12,74,54,.42); cursor: pointer; }
.spatial-marker span { display: grid; place-items: center; width: 100%; height: 100%; font-size: 10px; font-weight: 900; }
.spatial-marker:hover, .spatial-marker:focus-visible, .spatial-marker.active { z-index: 2; background: var(--red); transform: translate(-50%, -50%) scale(1.16); outline: none; }
.spatial-caption { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 7px 14px; padding: 9px 12px; border-top: 1px solid var(--line); color: #657381; font-family: Consolas, monospace; font-size: 9px; }
.spatial-detail { position: sticky; top: 18px; min-width: 0; padding: 17px; border: 1px solid var(--line); border-radius: 11px; background: #fff; box-shadow: var(--shadow); }
.spatial-detail h3 { margin: 5px 0 8px; font-size: 17px; line-height: 1.3; }
.spatial-detail > p { color: var(--muted); font-size: 11px; line-height: 1.5; }
.spatial-detail-badges { display: flex; flex-wrap: wrap; gap: 5px; }
.spatial-detail dl { display: grid; gap: 6px; margin: 14px 0; }
.spatial-detail dl div { padding: 8px 9px; border: 1px solid #e4e9ed; border-radius: 7px; background: #fafbfc; }
.spatial-detail dt { color: var(--muted); font-size: 9px; text-transform: uppercase; letter-spacing: .45px; }
.spatial-detail dd { margin: 3px 0 0; overflow-wrap: anywhere; color: #253646; font-size: 11px; font-weight: 700; line-height: 1.4; }
.spatial-source-text { margin: 12px 0; padding: 10px; border-left: 3px solid var(--green); background: #f1faf6; }
.spatial-source-text b, .spatial-links > b { display: block; margin-bottom: 5px; color: #3d4e5e; font-size: 9px; letter-spacing: .35px; text-transform: uppercase; }
.spatial-source-text p { margin: 0; color: #315846; font-family: Consolas, monospace; font-size: 10px; line-height: 1.45; }
.spatial-links { display: grid; gap: 6px; margin-top: 14px; padding-top: 12px; border-top: 1px dashed var(--line); }
.spatial-link { display: grid; grid-template-columns: 1fr auto auto; align-items: center; gap: 7px; padding: 8px 9px; border: 1px solid #dce5ed; border-radius: 7px; background: #f7faff; color: #27588e; cursor: pointer; text-align: left; }
.spatial-link span { color: #718090; font-size: 9px; text-transform: uppercase; }
.spatial-link b { font-family: Consolas, monospace; font-size: 10px; }
.spatial-empty-detail { color: var(--muted); font-size: 11px; line-height: 1.5; }

.issue-list { display: grid; gap: 10px; }
.issue { display: grid; grid-template-columns: 6px minmax(0,1fr) auto; gap: 14px; border: 1px solid var(--line); border-radius: 10px; background: #fff; padding: 15px 15px 15px 0; box-shadow: 0 7px 20px rgba(21,32,43,.05); }
.issue-bar { border-radius: 0 4px 4px 0; background: #7b8792; }
.issue[data-severity="critical"] .issue-bar { background: var(--critical); }
.issue[data-severity="high"] .issue-bar { background: #d27800; }
.issue[data-severity="medium"] .issue-bar { background: var(--blue); }
.issue-main { min-width: 0; }
.issue h3 { margin: 0 0 5px; font-size: 14px; }
.issue p { margin: 0 0 7px; color: var(--muted); font-size: 12px; line-height: 1.45; }
.issue-facts { display: flex; flex-wrap: wrap; gap: 7px; margin: 9px 0 11px; }
.issue-fact { padding: 6px 8px; border: 1px solid #e1e7ec; border-radius: 6px; background: #f7f9fb; color: #4b5c6c; font-size: 11px; line-height: 1.4; }
.issue-fact b { color: #233342; }
.issue-section { margin-top: 8px; }
.issue-section > b { color: #233342; font-size: 11px; }
.issue-source { padding-top: 8px; border-top: 1px dashed #dce2e8; }
.issue-source a { overflow-wrap: anywhere; }
.next-action { display: block; padding-top: 7px; border-top: 1px dashed #dce2e8; color: #374656; font-size: 11px; }
.badge-spacer { display: block; margin-top: 6px; }
.decision-bar { background: var(--green); }
.muted { color: var(--muted); }

.component-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.component-card { padding: 16px; border: 1px solid var(--line); border-radius: 11px; background: #fff; box-shadow: var(--shadow); }
.component-top, .source-card-title { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.component-card h3 { margin: 5px 0 0; font-size: 15px; }
.component-fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin-top: 14px; }
.component-fields > div { padding: 9px; border: 1px solid #e5eaee; border-radius: 7px; background: #fafbfc; }
.component-fields span { display: block; color: var(--muted); font-size: 10px; }
.component-fields b { display: block; margin-top: 4px; font-size: 12px; line-height: 1.35; }
.component-note { min-height: 40px; margin: 13px 0 0; color: var(--muted); font-size: 11px; line-height: 1.5; }
.component-source { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 12px; padding-top: 10px; border-top: 1px dashed var(--line); font-size: 10px; }

.bom-intro { margin-bottom: 12px; }
.bom-intro p { margin-bottom: 9px; }
.bom-rule { display: inline-block; padding: 7px 9px; border-radius: 7px; background: #fff; color: #34516d; font-size: 11px; font-weight: 700; }
.design-options { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 12px; margin: 0 0 18px; }
.design-option { display: grid; gap: 5px; padding: 13px 15px; border: 1px solid var(--line); border-radius: 10px; background: #fff; }
.design-option.selected { border-color: #86aee8; box-shadow: 0 0 0 2px rgba(31,104,213,.08); }
.design-option b { font-size: 12px; }
.design-option span { color: var(--muted); font-size: 11px; line-height: 1.4; }
.mode-switch { margin-left: auto; }
.bom-panel-card { margin-bottom: 18px; }
.bom-panel-card .card-header { align-items: center; }
.protection-metrics { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); gap: 9px; padding: 14px 20px; border-bottom: 1px solid #e8edf1; background: #fbfcfd; }
.protection-metrics > div { padding: 10px 11px; border: 1px solid #e1e7ec; border-radius: 8px; background: #fff; }
.protection-metrics span { display: block; color: var(--muted); font-size: 10px; }
.protection-metrics strong { display: block; margin-top: 4px; font-size: 22px; }
.bom-body { padding-top: 14px; }
.bom-context { display: flex; flex-wrap: wrap; gap: 8px 17px; margin-bottom: 13px; color: var(--muted); font-size: 11px; }
.bom-context span:last-child { color: var(--amber); font-weight: 700; }
.interpretation-switch { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-bottom: 13px; color: var(--muted); font-size: 11px; }
.interpretation-switch > b { color: var(--ink); }
.bom-table-wrap { border: 1px solid #e2e7eb; border-radius: 9px; }
.bom-table { min-width: 1120px; }
.bom-table td { font-size: 11px; }
.bom-table th { font-size: 9px; }
.bom-table .qty-cell { text-align: center; }
.group-list { display: flex; flex-wrap: wrap; gap: 4px; max-width: 270px; }
.group-chip { display: inline-block; padding: 3px 5px; border-radius: 5px; background: #f0f3f6; color: #4c5d6e; font-family: Consolas, "Courier New", monospace; font-size: 10px; }
.group-chip.has-actuator { background: #fdf1e0; color: #8a5a12; border: 1px solid #f0d4a3; cursor: help; }
.directo-code { display: inline-block; padding: 4px 6px; border-radius: 5px; background: #f1f6ff; color: #1f5cae; font-family: Consolas, "Courier New", monospace; font-size: 11px; white-space: nowrap; }
.code-confidence { margin-top: 6px; }
.confidence { display: inline-block; padding: 3px 6px; border-radius: 99px; font-size: 9px; font-weight: 800; white-space: nowrap; }
.confidence-confirmed { background: #def5e9; color: #11623f; }
.confidence-family { background: #e9f1ff; color: #285ba6; }
.confidence-hypothesis { background: #fff0d9; color: #8e5300; }
.confidence-unresolved { background: #fde8ed; color: #a90b2b; }
.copy-code, .link-button, .scan-controls button { border: 0; border-radius: 6px; padding: 6px 8px; background: #e9f1ff; color: #285ba6; cursor: pointer; font-size: 10px; font-weight: 700; }
.copy-code:hover, .link-button:hover, .scan-controls button:hover { background: #d8e7ff; }
.source-anchor { margin-top: 7px; }
.bom-note { margin: 12px 0 0; color: var(--muted); font-size: 11px; line-height: 1.45; }
.element-card { margin-bottom: 18px; }
.elements-table { min-width: 900px; }
.elements-table td { font-size: 11px; }
.element-kind { display: inline-block; padding: 4px 6px; border-radius: 5px; font-size: 10px; font-weight: 800; }
.element-mcb { background: #e9f1ff; color: #285ba6; }
.element-rcd { background: #fff0d9; color: #8e5300; }
.element-mccb { background: #f0f3f6; color: #536170; }
.element-other { background: #f4eaff; color: #7042a8; }
.scan-card { margin-bottom: 18px; }
.scan-controls { display: flex; flex-wrap: wrap; gap: 8px; padding: 12px 20px; border-bottom: 1px solid #e8edf1; }
.scan-controls .segmented { gap: 3px; }
.scan-controls button.active { background: #111820; color: #fff; }
.scan-layout { padding: 18px 20px 14px; }
.scan-stage { position: relative; overflow: hidden; border: 1px solid #cfd7df; border-radius: 8px; background: #f7f9fb; box-shadow: inset 0 0 0 1px rgba(255,255,255,.7); }
.scan-stage img { display: block; width: 100%; height: auto; }
.scan-marker { position: absolute; transform: translate(-50%,-50%); display: grid; place-items: center; min-width: 27px; height: 27px; padding: 0 5px; border: 2px solid #fff; border-radius: 99px; background: #1aa675; color: #fff; box-shadow: 0 2px 7px rgba(14,89,61,.42); cursor: pointer; font-size: 9px; font-weight: 900; }
.scan-marker:hover, .scan-marker.active { z-index: 2; background: var(--red); transform: translate(-50%,-50%) scale(1.12); }
.scan-marker.table-anchor { min-width: 34px; height: 24px; border-radius: 6px; font-size: 9px; }
.anchor-status { color: var(--green); font-weight: 800; }
.scan-popover { position: fixed; z-index: 30; width: min(320px, 92vw); max-height: calc(100vh - 20px); overflow-y: auto; padding: 15px; border: 1px solid #dce5ed; border-radius: 10px; background: #fff; box-shadow: 0 20px 44px rgba(21,32,43,.24); }
.scan-detail h3 { margin: 6px 0 8px; font-size: 15px; }
.scan-detail p { color: var(--muted); font-size: 11px; line-height: 1.5; }
.scan-detail .spec-grid { grid-template-columns: 1fr; padding: 0; margin: 10px 0; }
.spec-value.copyable { cursor: pointer; border-radius: 6px; margin: -4px -6px; padding: 4px 6px; }
.spec-value.copyable:hover { background: #eef3f8; }
.scan-footnote { padding: 0 20px 17px; color: var(--muted); font-size: 10px; line-height: 1.45; }

.source-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 12px; }
.source-card { padding: 15px; border: 1px solid var(--line); border-radius: 10px; background: #fff; }
.source-card h3 { margin: 0 0 6px; font-size: 13px; }
.source-card p { margin: 0; color: var(--muted); font-size: 11px; line-height: 1.45; }
.source-meta { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 11px; color: #637180; font-size: 10px; }
.source-card a { color: var(--blue); overflow-wrap: anywhere; }
.source-card-title h3 { margin-bottom: 0; }
.source-link { margin-top: 10px !important; }
.decision { margin-bottom: 14px; }
.decision:last-child { margin-bottom: 0; }
.decision p { margin: 4px 0 0; color: var(--muted); font-size: 12px; line-height: 1.45; }

.empty { padding: 46px 20px; text-align: center; color: var(--muted); }

.drawer-backdrop { position: fixed; inset: 0; z-index: 19; background: rgba(15,22,29,.26); }
.drawer { position: fixed; top: 0; right: 0; z-index: 20; width: min(440px, 94vw); height: 100vh; padding: 28px; background: #fff; box-shadow: -24px 0 54px rgba(21,32,43,.2); overflow-y: auto; transform: translateX(105%); transition: transform .22s ease; }
.drawer.open { transform: translateX(0); }
.drawer-close { position: absolute; top: 14px; right: 15px; width: 34px; height: 34px; border: 0; border-radius: 8px; background: #eef1f4; cursor: pointer; font-size: 22px; }
.drawer h2 { margin: 20px 0 6px; font-size: 28px; }
.drawer p { color: var(--muted); line-height: 1.55; }
.drawer-section { margin-top: 22px; padding-top: 18px; border-top: 1px solid var(--line); }
.drawer-section h3 { margin: 0 0 10px; font-size: 13px; text-transform: uppercase; letter-spacing: .6px; }
.drawer-specs { padding: 0; }
.drawer-row { display: grid; grid-template-columns: 42px minmax(0, 1fr); gap: 9px; padding: 8px 0; border-bottom: 1px solid #edf0f2; font-size: 11px; }
.drawer-row span { color: var(--muted); }
.drawer-link { padding: 9px 0; border-bottom: 1px solid #edf0f2; }
.drawer-link p { margin: 3px 0 5px; }

@media (max-width: 1080px) {
  .kpi-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .grid-2, .panel-grid, .component-grid { grid-template-columns: 1fr; }
  .coverage-strip { grid-template-columns: 1fr; }
  .spatial-layout { grid-template-columns: 1fr; }
  .spatial-detail { position: static; }
}

@media (max-width: 760px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar { position: relative; width: 100%; height: auto; padding: 15px; }
  .brand { padding-bottom: 13px; }
  .project-card, .sidebar-note { display: none; }
  #mainNav { display: flex; overflow-x: auto; padding-bottom: 7px; }
  .nav-button { width: auto; flex: 0 0 auto; }
  .language-panel { margin-top: 8px; padding: 6px 4px 0; width: 210px; }
  .topbar { min-height: auto; align-items: flex-start; padding: 20px; }
  .topbar-actions { display: none; }
  .content { padding: 18px 15px 36px; }
  .kpi-grid, .function-grid, .source-grid { grid-template-columns: 1fr; }
  .spec-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .issue { grid-template-columns: 4px minmax(0,1fr); }
  .issue > div:last-child { grid-column: 2; margin-top: 8px; }
  .toolbar-hint { width: 100%; margin-left: 0; }
  .component-fields { grid-template-columns: 1fr; }
  .spatial-intro { display: grid; }
  .spatial-trust { min-width: 0; }
  .spatial-image-wrap { max-height: 70vh; }
}
