:root {
  --ink: #071827;
  --muted: #5b6b80;
  --line: #d8e1ec;
  --panel: #ffffff;
  --page: #f5f7fb;
  --nav: #051827;
  --blue: #0878b9;
  --teal: #0f766e;
  --green: #15803d;
  --red: #b91c1c;
  --amber: #b45309;
  --yellow: #ca8a04;
  --soft-blue: #e8f3fb;
  --soft-green: #e7f7ed;
  --soft-red: #fee2e2;
  --soft-amber: #fef3c7;
  font-family: "Segoe UI", Inter, Arial, sans-serif;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background: var(--page);
}

body[data-page="situation"] {
  background: #020a15;
}

body[data-page="situation"] .workspace {
  background: #020a15;
}

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

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  min-height: 0;
  padding: 22px 20px 18px;
  background: var(--nav);
  color: #e0f2fe;
  display: flex;
  flex-direction: column;
  gap: 16px;
  overflow: hidden;
}

.mark {
  width: 70px;
  height: 70px;
}

.brand-copy {
  display: grid;
  gap: 5px;
}

.brand-copy strong {
  font-size: 22px;
  letter-spacing: 0.12em;
}

.brand-copy span {
  color: #9dc7ea;
  font-size: 12px;
  line-height: 1.45;
}

nav {
  display: grid;
  gap: 6px;
  align-content: start;
  flex: 1 1 auto;
  min-height: 0;
  margin-top: 12px;
  overflow-y: auto;
  padding-right: 2px;
  scrollbar-color: rgba(125, 211, 252, 0.42) transparent;
  scrollbar-width: thin;
}

nav a {
  color: #c8def3;
  text-decoration: none;
  padding: 10px 12px;
  border: 1px solid transparent;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 700;
}

nav a.active,
nav a:hover {
  color: #fff;
  border-color: rgba(125, 211, 252, 0.26);
  background: rgba(8, 120, 185, 0.24);
}

.workspace {
  min-width: 0;
  padding: 20px;
  display: grid;
  gap: 18px;
  align-content: start;
}

.app-page {
  display: none;
}

.app-page.active {
  display: grid;
  gap: 18px;
  align-content: start;
}

.situation-page.active {
  display: block;
}

.workspace > *,
.overview-grid,
.dash-grid,
.two-column,
.stats-grid,
.topbar,
.panel,
.posture-panel,
.stat-card {
  min-width: 0;
  max-width: 100%;
}

.topbar,
.panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: 0 10px 28px rgba(15, 23, 42, 0.05);
}

.topbar {
  min-height: 78px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 8px 16px;
  border-color: rgba(56, 189, 248, 0.2);
  background: #020a15;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.28), inset 0 0 70px rgba(14, 165, 233, 0.03);
}

.topbar-brand {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 16px;
}

.topbar-mark {
  width: 86px;
  height: 86px;
  flex: 0 0 86px;
  display: block;
}

.topbar-wordmark {
  min-width: 0;
  display: grid;
  gap: 6px;
}

.topbar-wordmark strong {
  color: #f8fafc;
  font-size: 42px;
  font-weight: 950;
  line-height: 0.95;
  letter-spacing: 0;
}

.topbar-wordmark span {
  width: fit-content;
  max-width: 100%;
  padding-top: 7px;
  border-top: 2px solid #38bdf8;
  color: #e2e8f0;
  font-size: 13px;
  font-weight: 900;
  line-height: 1;
  text-transform: uppercase;
  white-space: nowrap;
}

.topbar-status {
  display: grid;
  grid-template-columns: auto auto;
  align-items: center;
  justify-content: end;
  gap: 4px 8px;
  text-align: right;
}

.status-dot {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: var(--green);
}

.topbar-status small,
.topbar-status strong {
  display: block;
}

.topbar-status small {
  color: #7dd3fc;
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.topbar-status strong {
  grid-column: 1 / -1;
  color: #cbd5e1;
  font-size: 12px;
}

.overview-grid,
.dash-grid,
.two-column {
  display: grid;
  gap: 16px;
}

.globe-stage {
  position: relative;
  min-height: clamp(620px, calc(100vh - 152px), 820px);
  overflow: hidden;
  border: 1px solid rgba(56, 189, 248, 0.2);
  border-radius: 8px;
  background: #020a15;
  color: #e0f2fe;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.38), inset 0 0 70px rgba(14, 165, 233, 0.03);
}

.globe-stage canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.globe-stage::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(90deg, rgba(3, 21, 37, 0.46), rgba(3, 21, 37, 0.04) 38%, rgba(3, 21, 37, 0.74) 76%, rgba(3, 21, 37, 0.9)),
    linear-gradient(0deg, rgba(3, 21, 37, 0.42), transparent 42%, rgba(3, 21, 37, 0.16));
  pointer-events: none;
}

.globe-command-bar,
.globe-hud,
.globe-node-panel,
.globe-legend {
  position: relative;
  z-index: 2;
}

.globe-command-bar {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  min-height: 68px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 18px;
  border-bottom: 1px solid rgba(125, 211, 252, 0.18);
  background: rgba(3, 21, 37, 0.74);
  backdrop-filter: blur(4px);
}

.globe-command-title {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.globe-command-title strong,
.globe-command-title small {
  display: block;
}

.globe-command-title strong {
  color: #e0f2fe;
  font-size: 14px;
  font-weight: 900;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.globe-command-title small {
  margin-top: 3px;
  color: #7dd3fc;
  font-size: 11px;
  font-weight: 800;
}

.globe-command-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.shield-pill,
#globeFullscreen {
  min-height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(45, 212, 191, 0.42);
  border-radius: 999px;
  padding: 8px 12px;
  background: rgba(13, 148, 136, 0.22);
  color: #99f6e4;
  font-size: 11px;
  font-weight: 900;
  white-space: nowrap;
}

#globeFullscreen {
  order: -1;
  border-color: rgba(125, 211, 252, 0.28);
  background: #075985;
  color: #f8fafc;
  box-shadow: 0 0 0 1px rgba(125, 211, 252, 0.12), 0 10px 26px rgba(2, 8, 23, 0.24);
}

.globe-hud {
  margin-top: 68px;
  width: min(420px, calc(100% - 32px));
  padding: 24px;
}

.globe-hud h2 {
  max-width: 360px;
  color: #fff;
  font-size: 30px;
  line-height: 1.1;
}

.globe-hud p:not(.eyebrow) {
  max-width: 390px;
  margin-top: 10px;
  color: #b9d7ee;
  line-height: 1.5;
}

.globe-legend {
  position: absolute;
  left: 24px;
  bottom: 24px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  max-width: min(520px, calc(100% - 460px));
  padding: 9px 12px;
  border: 1px solid rgba(125, 211, 252, 0.16);
  border-radius: 999px;
  background: rgba(2, 8, 23, 0.68);
  color: #cbd5e1;
  font-size: 10px;
  font-weight: 800;
}

.globe-legend span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.globe-legend i {
  flex: 0 0 auto;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  box-shadow: 0 0 8px currentColor;
}

.globe-legend i.dot {
  background: currentColor;
}

.globe-legend i.ring {
  width: 11px;
  height: 11px;
  border: 2px solid currentColor;
  background: radial-gradient(circle, #93c5fd 0 1.5px, transparent 2px);
}

.globe-legend i.allowed,
.globe-legend i.asset-up {
  color: #34d399;
}

.globe-legend i.blocked,
.globe-legend i.asset-down {
  color: #fb7185;
}

.globe-legend i.asset-risk {
  color: #fbbf24;
}

.globe-legend i.asset-planned {
  color: #7dd3fc;
}

.globe-controls {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 10px;
}

.globe-controls label {
  color: #bfdbfe;
  font-size: 11px;
  gap: 4px;
}

.globe-controls label:nth-child(3),
.globe-controls button {
  grid-column: 1 / -1;
}

.globe-controls select {
  min-height: 34px;
  border-color: rgba(125, 211, 252, 0.35);
  padding: 6px 8px;
  background: rgba(8, 27, 43, 0.86);
  color: #e0f2fe;
  font-size: 12px;
}

.globe-controls button {
  min-height: 34px;
  padding: 6px 10px;
  background: #0f766e;
}

.globe-node-panel {
  position: absolute;
  top: 92px;
  right: 24px;
  bottom: 24px;
  width: min(380px, calc(100% - 48px));
  display: block;
  gap: 10px;
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior: contain;
  padding-right: 6px;
  pointer-events: auto;
  scrollbar-color: rgba(125, 211, 252, 0.55) transparent;
  scrollbar-gutter: stable;
  scrollbar-width: thin;
}

body.stage-fullscreen-active {
  overflow: hidden;
}

.globe-stage:fullscreen,
.globe-stage.is-stage-fullscreen {
  width: 100vw;
  height: 100vh;
  min-height: 100vh;
  border-radius: 0;
}

.globe-stage.is-stage-fullscreen {
  position: fixed;
  inset: 0;
  z-index: 1000;
}

.globe-stage:fullscreen .globe-command-bar,
.globe-stage.is-stage-fullscreen .globe-command-bar {
  min-height: 70px;
}

.globe-stage:fullscreen .globe-hud,
.globe-stage.is-stage-fullscreen .globe-hud {
  margin-top: 70px;
}

.globe-stage:fullscreen .globe-node-panel,
.globe-stage.is-stage-fullscreen .globe-node-panel {
  top: 94px;
  right: 18px;
  bottom: 18px;
}

.globe-stage:fullscreen .globe-legend,
.globe-stage.is-stage-fullscreen .globe-legend {
  bottom: 18px;
}

.rail-panel {
  overflow: visible;
  border: 1px solid rgba(125, 211, 252, 0.24);
  border-radius: 8px;
  padding: 12px;
  background: rgba(3, 21, 37, 0.78);
  box-shadow: 0 18px 42px rgba(0, 0, 0, 0.18);
}

.rail-panel + .rail-panel {
  margin-top: 10px;
}

.rail-fill {
  display: block;
}

.rail-heading h2 {
  margin: 2px 0 0;
  color: #fff;
  font-size: 17px;
}

.rail-panel details + details {
  margin-top: 8px;
}

.rail-panel summary {
  cursor: pointer;
  color: #e0f2fe;
  font-weight: 900;
}

.rail-panel summary strong,
.rail-panel summary .summary-kicker {
  display: block;
}

.rail-panel summary .summary-kicker {
  margin-bottom: 4px;
  color: var(--blue);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.globe-breadcrumb {
  min-height: 34px;
  display: block;
  border: 1px solid rgba(125, 211, 252, 0.3);
  border-radius: 8px;
  padding: 7px 10px;
  background: rgba(3, 21, 37, 0.75);
  color: #e0f2fe;
  font-size: 12px;
  font-weight: 900;
  line-height: 18px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  text-transform: uppercase;
}

.globe-node-list {
  display: grid;
  align-content: start;
  gap: 8px;
  margin-top: 10px;
  overflow: visible;
}

.globe-node {
  display: grid;
  gap: 3px;
  min-height: 54px;
  border: 1px solid rgba(125, 211, 252, 0.24);
  border-left: 4px solid #38bdf8;
  border-radius: 8px;
  padding: 8px 10px;
  background: rgba(5, 24, 38, 0.78);
  color: #e0f2fe;
  text-align: left;
}

.globe-node.good { border-left-color: var(--green); }
.globe-node.warn { border-left-color: var(--amber); }
.globe-node.bad { border-left-color: var(--red); }

.globe-node span,
.globe-node strong,
.globe-node small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.globe-node span {
  font-size: 12px;
  font-weight: 900;
}

.globe-node strong {
  color: #b9d7ee;
  font-size: 12px;
}

.globe-node small {
  color: #86b7d8;
  font-size: 11px;
}

.overview-grid {
  grid-template-columns: minmax(340px, 0.9fr) minmax(420px, 1.1fr);
}

.dash-grid {
  grid-template-columns: minmax(280px, 1fr) minmax(280px, 1fr) minmax(280px, 1fr);
}

.two-column {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.panel {
  padding: 16px;
}

.posture-panel {
  min-height: 220px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 170px;
  gap: 18px;
  align-items: center;
  border-top: 4px solid var(--green);
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--blue);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin: 0;
  letter-spacing: 0;
}

h1 {
  font-size: 34px;
  line-height: 1.08;
}

h2 {
  font-size: 21px;
}

h3 {
  font-size: 13px;
}

.lede {
  margin-top: 12px;
  color: #46586d;
  font-size: 15px;
  line-height: 1.55;
}

.score-pair {
  display: grid;
  gap: 10px;
}

.score-pair div,
.stat-card {
  min-height: 96px;
  padding: 14px;
  border: 1px solid #cfe1ef;
  border-radius: 8px;
  background: #fff;
}

.score-pair span,
.stat-card small,
.stat-card span,
.report-list small {
  display: block;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
}

.score-pair strong,
.stat-card strong {
  display: block;
  margin-top: 8px;
  color: var(--ink);
  font-size: 32px;
  line-height: 1;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(110px, 1fr));
  gap: 10px;
}

.panel-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 14px;
}

.filters {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) 150px 150px;
  gap: 8px;
  min-width: min(560px, 100%);
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.wide {
  grid-column: 1 / -1;
}

label {
  display: grid;
  gap: 5px;
  color: #334155;
  font-size: 12px;
  font-weight: 800;
}

input,
select,
textarea {
  width: 100%;
  min-height: 38px;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  padding: 8px 10px;
  background: #fff;
  color: var(--ink);
  font: inherit;
  font-size: 13px;
}

textarea {
  min-height: 76px;
  resize: vertical;
}

button,
.small-btn,
.button-link {
  min-height: 38px;
  border: 0;
  border-radius: 8px;
  padding: 8px 12px;
  background: #075985;
  color: white;
  font: inherit;
  font-size: 13px;
  font-weight: 800;
  text-decoration: none;
  cursor: pointer;
}

.small-btn {
  min-height: 30px;
  font-size: 12px;
  background: var(--teal);
}

.small-btn.ghost {
  background: #e2e8f0;
  color: #0f172a;
}

.table-wrap {
  width: 100%;
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th,
td {
  padding: 11px 10px;
  border-bottom: 1px solid #e2e8f0;
  text-align: left;
  vertical-align: top;
  font-size: 13px;
}

th {
  color: #475569;
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

td strong,
td small {
  display: block;
}

td small {
  margin-top: 4px;
  color: var(--muted);
}

.detail-row td {
  padding-top: 0;
  background: #fbfdff;
}

.asset-detail {
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 10px;
  background: #fff;
}

.asset-detail summary {
  cursor: pointer;
  font-weight: 800;
}

.detail-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-top: 10px;
}

.detail-grid div {
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 10px;
  background: #f8fafc;
}

.detail-grid small {
  display: block;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
}

.detail-grid strong {
  margin-top: 5px;
}

.split-detail {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-top: 12px;
}

.split-detail ul,
.report-list ul {
  margin: 8px 0 0;
  padding-left: 18px;
}

.split-detail li + li,
.report-list li + li {
  margin-top: 8px;
}

.chip {
  display: inline-flex;
  align-items: center;
  min-height: 23px;
  border-radius: 999px;
  padding: 3px 8px;
  background: #e2e8f0;
  color: #334155;
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
}

.chip.good { background: var(--soft-green); color: var(--green); }
.chip.warn { background: var(--soft-amber); color: var(--amber); }
.chip.bad { background: var(--soft-red); color: var(--red); }

.scope-list,
.event-list,
.collector-list,
.incident-list,
.report-list,
.source-list,
.accordion {
  display: grid;
  gap: 10px;
}

.scope-item,
.accordion details,
.tree details {
  border: 1px solid #dbeafe;
  border-radius: 8px;
  background: #fff;
  padding: 9px 10px;
}

.scope-item summary,
.accordion summary,
.tree summary {
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  font-weight: 800;
}

.scope-item summary span,
.tree summary span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.scope-context {
  display: grid;
  gap: 3px;
  border: 1px solid rgba(45, 212, 191, 0.28);
  border-radius: 8px;
  padding: 9px 10px;
  background: rgba(13, 148, 136, 0.16);
}

.scope-context strong {
  color: #e0f2fe;
  font-size: 12px;
}

.scope-context span {
  color: #9dc7ea;
  font-size: 11px;
  font-weight: 800;
}

.tree-globe-btn {
  min-height: 28px;
  flex: 0 0 auto;
  padding: 5px 8px;
  background: #e0f2fe;
  color: #075985;
  font-size: 11px;
}

.scope-bars {
  display: grid;
  gap: 6px;
  margin-top: 10px;
}

.scope-bars span {
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 7px 9px;
  background: linear-gradient(90deg, #dcfce7 calc(var(--value) * 1%), #f8fafc 0);
  color: #334155;
  font-size: 12px;
  font-weight: 800;
}

.event,
.collector-list article,
.incident,
.report-block,
.source-list article {
  border: 1px solid #dbeafe;
  border-left: 4px solid var(--blue);
  border-radius: 8px;
  padding: 12px;
  background: #fff;
}

.event.good,
.incident.good { border-left-color: var(--green); }
.event.warn,
.incident.warn { border-left-color: var(--amber); }
.event.bad,
.incident.bad { border-left-color: var(--red); }

.event time,
.event span,
.collector-list small,
.incident span,
.report-block small,
.report-block li small,
.source-list p {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.event strong,
.collector-list strong,
.incident strong,
.source-list strong {
  display: block;
  margin-top: 4px;
}

.collector-list p,
.incident p,
.report-block p {
  margin-top: 8px;
  color: #334155;
  font-size: 13px;
  line-height: 1.5;
}

.globe-node-panel .scope-list,
.globe-node-panel .event-list,
.globe-node-panel .collector-list {
  margin-top: 10px;
}

.globe-node-panel .scope-item,
.globe-node-panel .event,
.globe-node-panel .collector-list article {
  border-color: rgba(125, 211, 252, 0.24);
  background: rgba(5, 24, 38, 0.78);
  color: #e0f2fe;
}

.globe-node-panel .scope-item summary span,
.globe-node-panel .event time,
.globe-node-panel .event span,
.globe-node-panel .collector-list small,
.globe-node-panel .collector-list p {
  color: #9dc7ea;
}

.globe-node-panel .scope-bars span {
  border-color: rgba(125, 211, 252, 0.18);
  background: linear-gradient(90deg, rgba(34, 197, 94, 0.24) calc(var(--value) * 1%), rgba(8, 27, 43, 0.86) 0);
  color: #dbeafe;
}

.api-strip {
  display: grid;
  gap: 4px;
  margin-top: 12px;
  padding: 10px;
  border: 1px dashed #b6c7d8;
  border-radius: 8px;
  background: #f8fafc;
}

.api-strip code {
  color: #075985;
  font-weight: 900;
}

.api-strip span {
  color: var(--muted);
  font-size: 12px;
}

.tree {
  display: grid;
  gap: 8px;
  max-height: 760px;
  overflow: auto;
}

.tree details details {
  margin-top: 8px;
  background: #f8fbff;
}

.tree ul {
  margin: 8px 0 0;
  padding-left: 18px;
  color: #334155;
}

.tree li + li {
  margin-top: 7px;
}

.report-block strong {
  display: block;
  margin-top: 5px;
  font-size: 24px;
}

.report-block li span,
.source-list a {
  display: block;
  margin-top: 4px;
  color: #334155;
  font-size: 13px;
  line-height: 1.45;
}

.source-list {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.source-list a {
  color: var(--blue);
  overflow-wrap: anywhere;
}

.empty {
  color: var(--muted);
  font-size: 13px;
}

.fatal {
  padding: 40px;
}

@media (max-width: 1240px) {
  .overview-grid,
  .dash-grid,
  .two-column {
    grid-template-columns: 1fr;
  }

  .stats-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .globe-stage {
    min-height: 720px;
  }

  .globe-legend {
    bottom: 310px;
    max-width: calc(100% - 48px);
  }

  .globe-node-panel {
    top: auto;
    left: 24px;
    right: 24px;
    bottom: 24px;
    width: auto;
    max-height: 270px;
    overflow-y: auto;
  }
}

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

  .sidebar {
    position: relative;
    height: auto;
  }

  nav {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .workspace {
    padding: 14px;
  }

  .topbar,
  .posture-panel {
    align-items: flex-start;
    grid-template-columns: 1fr;
    flex-direction: column;
  }

  .topbar-status {
    justify-content: start;
    text-align: left;
  }

  .panel-head {
    align-items: stretch;
    flex-direction: column;
  }

  .topbar-brand {
    gap: 12px;
  }

  .topbar-mark {
    width: 72px;
    height: 72px;
    flex-basis: 72px;
  }

  .topbar-wordmark strong {
    font-size: 34px;
  }

  .topbar-wordmark span {
    font-size: 11px;
    white-space: normal;
  }

  .stats-grid,
  .filters,
  .form-grid,
  .detail-grid,
  .split-detail,
  .source-list {
    grid-template-columns: 1fr;
  }

  .globe-stage {
    min-height: 860px;
  }

  .globe-command-bar {
    align-items: flex-start;
    flex-direction: column;
    min-height: 128px;
  }

  .globe-command-actions {
    width: 100%;
    justify-content: space-between;
  }

  .globe-hud {
    margin-top: 128px;
    width: 100%;
    padding: 18px;
  }

  .globe-hud h2 {
    font-size: 24px;
  }

  .globe-label {
    max-width: 100px;
  }

  .globe-node-panel {
    max-height: 480px;
  }

  .globe-legend {
    left: 18px;
    right: 18px;
    bottom: 520px;
    max-width: none;
    border-radius: 8px;
  }

  .tree summary {
    align-items: flex-start;
    flex-direction: column;
  }
}

@media (max-width: 560px) {
  nav {
    grid-template-columns: 1fr;
  }

  h1 {
    font-size: 28px;
  }
}

#appNotice {
  position: fixed;
  left: 50%;
  bottom: 28px;
  z-index: 40;
  transform: translate(-50%, 16px);
  max-width: min(520px, calc(100vw - 32px));
  padding: 11px 18px;
  border: 1px solid rgba(251, 113, 133, 0.5);
  border-radius: 10px;
  background: rgba(30, 8, 16, 0.94);
  color: #fecdd3;
  font-size: 13px;
  font-weight: 600;
  opacity: 0;
  pointer-events: none;
  transition: opacity 160ms linear, transform 160ms ease-out;
}

#appNotice.visible {
  opacity: 1;
  transform: translate(-50%, 0);
}

#appNotice.good {
  border-color: rgba(52, 211, 153, 0.5);
  background: rgba(4, 26, 18, 0.94);
  color: #a7f3d0;
}

body.auth-pending .shell,
body.auth-anon .shell {
  display: none;
}

.login-screen {
  display: none;
}

body.auth-anon .login-screen {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(circle at 50% 38%, rgba(8, 47, 73, 0.9), rgba(2, 10, 21, 0.99) 70%),
    #020a15;
}

.login-card {
  width: min(380px, 100%);
  display: grid;
  gap: 12px;
  justify-items: center;
  padding: 34px 30px;
  border: 1px solid rgba(56, 189, 248, 0.24);
  border-radius: 12px;
  background: rgba(3, 21, 37, 0.88);
  box-shadow: 0 30px 90px rgba(0, 0, 0, 0.5), inset 0 0 60px rgba(14, 165, 233, 0.04);
  color: #e0f2fe;
}

.login-mark {
  width: 84px;
  height: 84px;
}

.login-card > strong {
  font-size: 30px;
  font-weight: 950;
  letter-spacing: 0.08em;
  color: #f8fafc;
}

.login-card > span {
  padding-bottom: 8px;
  color: #7dd3fc;
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  text-align: center;
}

.login-card label {
  width: 100%;
  display: grid;
  gap: 6px;
  color: #9dc7ea;
  font-size: 12px;
  font-weight: 700;
}

.login-card input {
  width: 100%;
  padding: 11px 12px;
  border: 1px solid rgba(125, 211, 252, 0.26);
  border-radius: 8px;
  background: rgba(2, 10, 21, 0.8);
  color: #f8fafc;
  font-size: 14px;
}

.login-card input:focus {
  outline: 2px solid rgba(56, 189, 248, 0.55);
  outline-offset: 1px;
}

.login-card button {
  width: 100%;
  margin-top: 6px;
  padding: 11px 12px;
  border: 0;
  border-radius: 8px;
  background: #0878b9;
  color: #fff;
  font-size: 14px;
  font-weight: 800;
  cursor: pointer;
}

.login-card button:hover {
  background: #0a8fd8;
}

.login-error {
  min-height: 18px;
  margin: 0;
  color: #fda4af;
  font-size: 12px;
  font-weight: 700;
  text-align: center;
}

.sidebar-user {
  flex: 0 0 auto;
  display: grid;
  gap: 4px;
  padding: 12px;
  border: 1px solid rgba(125, 211, 252, 0.2);
  border-radius: 10px;
  background: rgba(8, 120, 185, 0.12);
}

.sidebar-user strong {
  color: #f8fafc;
  font-size: 13px;
}

.sidebar-user span {
  color: #7dd3fc;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.sidebar-user-actions {
  display: flex;
  gap: 8px;
  margin-top: 8px;
}

.sidebar-user-actions button {
  flex: 1;
  min-width: 0;
  padding: 7px 8px;
  border: 1px solid rgba(125, 211, 252, 0.28);
  border-radius: 7px;
  background: transparent;
  color: #c8def3;
  font-size: 11px;
  font-weight: 800;
  cursor: pointer;
}

.sidebar-user-actions button:hover {
  background: rgba(8, 120, 185, 0.3);
  color: #fff;
}

#logoutBtn {
  background: rgba(8, 120, 185, 0.28);
  color: #f8fafc;
}

.form-hint {
  margin: -6px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.role-guide {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 10px;
  margin: 14px 0;
}

.role-guide article {
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--soft-blue);
}

.role-guide strong {
  display: block;
  font-size: 13px;
}

.role-guide p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

#userRows select {
  padding: 6px 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  font-size: 12px;
}

#userRows .small-btn {
  margin: 2px 3px 2px 0;
}

body:not(.can-registry-write) [data-asset-status] {
  display: none;
}

body:not(.can-incidents-write) #incidentForm,
body:not(.can-incidents-write) [data-incident-id] {
  display: none;
}

body:not(.can-export) .button-link[href="/api/export/registry.json"] {
  display: none;
}
