/* ==========================================================================
   Crew Health Monitor — shared theme (deep-space palette)
   ========================================================================== */
:root {
  --bg: #050b17;
  --bg2: #0a1426;
  --panel: rgba(16, 30, 54, 0.78);
  --panel-solid: #0f1d34;
  --line: rgba(120, 160, 220, 0.18);
  --line-strong: rgba(120, 170, 240, 0.35);
  --text: #e6eefc;
  --muted: #8ea0bf;
  --accent: #4fc3f7;      /* telemetry cyan */
  --accent2: #7c6cff;     /* nebula violet */
  --accent3: #ff9e4f;     /* re-entry orange */
  --ok: #2ecc71;
  --warn: #f5c242;
  --crit: #ff4d4f;
  --none: #5b6b85;
  --radius: 14px;
  --mono: ui-monospace, 'SFMono-Regular', 'Cascadia Mono', Consolas, monospace;
  --sans: 'Segoe UI', system-ui, -apple-system, 'Noto Sans', 'Noto Sans JP', sans-serif;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font-family: var(--sans); color: var(--text); font-size: 14px; line-height: 1.4;
  background:
    radial-gradient(1200px 700px at 85% -10%, rgba(124, 108, 255, 0.18), transparent 60%),
    radial-gradient(900px 600px at -10% 110%, rgba(79, 195, 247, 0.12), transparent 60%),
    var(--bg);
  background-attachment: fixed;
}
body::before { /* starfield */
  content: ''; position: fixed; inset: 0; pointer-events: none; z-index: -1; opacity: 0.55;
  background-image:
    radial-gradient(1px 1px at 10% 20%, #fff, transparent), radial-gradient(1px 1px at 30% 80%, #cfe3ff, transparent),
    radial-gradient(1.5px 1.5px at 70% 30%, #fff, transparent), radial-gradient(1px 1px at 90% 60%, #bcd, transparent),
    radial-gradient(1px 1px at 50% 50%, #fff, transparent), radial-gradient(1px 1px at 80% 90%, #dde, transparent);
  background-size: 420px 420px, 380px 380px, 520px 520px, 300px 300px, 460px 460px, 350px 350px;
}
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--accent); }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.pad { padding: 16px; }

/* ---- top bar ---- */
.topbar {
  position: sticky; top: 0; z-index: 50; display: flex; align-items: center; gap: 16px; padding: 10px 20px;
  background: rgba(5, 11, 23, 0.82); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 10px; }
.brand-mark {
  width: 28px; height: 28px; border-radius: 50%; flex: none;
  background: radial-gradient(circle at 35% 35%, #bfe9ff, var(--accent) 40%, #0b3a66 75%);
  box-shadow: 0 0 0 2px rgba(79, 195, 247, 0.25), 0 0 18px rgba(79, 195, 247, 0.5);
  position: relative;
}
.brand-mark::after { content: ''; position: absolute; inset: -6px -10px; border: 1.5px solid rgba(255, 158, 79, 0.75); border-radius: 50%; transform: rotate(-20deg); }
.brand-name { font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; font-size: 14px; }
.brand-sub { color: var(--muted); font-size: 11px; letter-spacing: 0.12em; text-transform: uppercase; }
.brand.big .brand-mark { width: 44px; height: 44px; }
.brand.big .brand-name { font-size: 18px; }
.topbar .spacer { flex: 1; }
.topbar nav { display: flex; gap: 4px; }
.nav-btn { background: none; border: 1px solid transparent; padding: 6px 12px; border-radius: 999px; cursor: pointer; color: var(--muted); }
.nav-btn.on, .nav-btn:hover { color: var(--text); border-color: var(--line-strong); background: rgba(79, 195, 247, 0.08); }
.clocks { display: flex; gap: 14px; font-family: var(--mono); font-size: 13px; }
.clocks span { display: flex; flex-direction: column; align-items: flex-end; line-height: 1.1; }
.clocks small { font-family: var(--sans); font-size: 9px; letter-spacing: 0.1em; color: var(--muted); text-transform: uppercase; }
.me { display: flex; align-items: center; gap: 8px; }
.lang-select, select { background: var(--panel-solid); border: 1px solid var(--line-strong); border-radius: 8px; padding: 5px 8px; }
select.sm { padding: 2px 6px; font-size: 12px; }
.color-pick { width: 30px; height: 30px; border: none; background: none; padding: 0; cursor: pointer; }
.mode-badge { font-size: 10px; font-weight: 700; letter-spacing: 0.1em; padding: 3px 7px; border-radius: 6px; border: 1px solid; }
.mode-badge.mode-live { color: var(--ok); border-color: var(--ok); }
.mode-badge:not(.mode-live) { color: var(--accent3); border-color: var(--accent3); }

/* ---- buttons ---- */
.btn { display: inline-flex; align-items: center; gap: 6px; padding: 7px 14px; border-radius: 9px; border: 1px solid var(--line-strong); background: rgba(79, 195, 247, 0.08); cursor: pointer; white-space: nowrap; }
.btn:hover { background: rgba(79, 195, 247, 0.18); }
.btn.primary { background: linear-gradient(135deg, #2a8fd0, var(--accent2)); border-color: transparent; color: #fff; }
.btn.primary:hover { filter: brightness(1.1); }
.btn.danger { background: rgba(255, 77, 79, 0.14); border-color: rgba(255, 77, 79, 0.6); color: #ffd0d0; }
.btn.danger:hover { background: rgba(255, 77, 79, 0.28); }
.btn.ghost { background: transparent; }
.btn.sm { padding: 3px 9px; font-size: 12px; border-radius: 7px; }
.icon-btn { background: none; border: none; color: var(--muted); cursor: pointer; padding: 2px 6px; border-radius: 6px; }
.icon-btn:hover { color: var(--text); background: rgba(255, 255, 255, 0.08); }
.add-tile { font-size: 20px; line-height: 1; padding: 4px 14px; }

/* ---- status ---- */
.pill { display: inline-flex; align-items: center; gap: 4px; padding: 2px 9px; border-radius: 999px; font-size: 12px; font-weight: 600; border: 1px solid; white-space: nowrap; }
.pill-ok { color: var(--ok); border-color: rgba(46, 204, 113, 0.5); background: rgba(46, 204, 113, 0.1); }
.pill-warn { color: var(--warn); border-color: rgba(245, 194, 66, 0.5); background: rgba(245, 194, 66, 0.1); }
.pill-crit { color: var(--crit); border-color: rgba(255, 77, 79, 0.6); background: rgba(255, 77, 79, 0.12); }
.pill-none { color: var(--muted); border-color: var(--line-strong); }
.dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; flex: none; }
.dot-ok { background: var(--ok); } .dot-warn { background: var(--warn); } .dot-crit { background: var(--crit); box-shadow: 0 0 8px var(--crit); } .dot-none { background: var(--none); }
.badge { font-size: 12px; font-weight: 700; padding: 3px 8px; border-radius: 8px; }
.badge.crit { background: rgba(255, 77, 79, 0.2); color: #ffb3b3; } .badge.warn { background: rgba(245, 194, 66, 0.18); color: var(--warn); }
.avatar { display: inline-flex; align-items: center; justify-content: center; border-radius: 50%; color: #061024; font-weight: 800; flex: none; box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.15); }

/* ---- layout ---- */
main { padding: 18px 20px 40px; max-width: 1680px; margin: 0 auto; }
.dash-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 14px; flex-wrap: wrap; }
.who { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.who-name { font-size: 20px; font-weight: 700; }
.who-sub { color: var(--muted); font-size: 12px; }
.dash-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

.tiles { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); grid-auto-rows: minmax(250px, auto); grid-auto-flow: dense; gap: 14px; }
.tile { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); display: flex; flex-direction: column; min-width: 0; overflow: hidden; backdrop-filter: blur(6px); box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25); }
.tile.size-m { grid-column: span 2; }
.tile.size-l { grid-column: span 2; grid-row: span 2; }
.tile.size-t { grid-row: span 2; }
.tile-head { display: flex; align-items: center; gap: 8px; padding: 9px 12px; border-bottom: 1px solid var(--line); cursor: grab; }
.tile-head h4 { margin: 0; font-size: 12px; letter-spacing: 0.1em; text-transform: uppercase; color: #b9cbe8; flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tile-extra { display: flex; gap: 6px; }
.tile-body { padding: 12px; flex: 1; min-height: 0; display: flex; flex-direction: column; }
.tile.dragging { opacity: 0.4; } .tile.drop { outline: 2px dashed var(--accent); }
.tile-add { align-items: center; justify-content: center; gap: 6px; cursor: pointer; border-style: dashed; color: var(--muted); background: rgba(16, 30, 54, 0.35); }
.tile-add .plus { font-size: 44px; line-height: 1; color: var(--accent); }
.tile-add:hover { color: var(--text); border-color: var(--accent); }
@media (max-width: 1200px) { .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 700px) { .tiles { grid-template-columns: 1fr; } .tile.size-m, .tile.size-l { grid-column: span 1; } .clocks { display: none; } }
.scroll { overflow: auto; max-height: 100%; }
.loading, .error { padding: 40px; text-align: center; color: var(--muted); }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; }
.panel h3 { margin: 0 0 10px; font-size: 13px; letter-spacing: 0.1em; text-transform: uppercase; color: #b9cbe8; }

/* ---- disk 2D ---- */
.disk-host { flex: 1; display: flex; align-items: center; justify-content: center; min-height: 380px; }
.disk2d { width: 100%; height: 100%; max-height: 560px; }
.disk2d .ring { fill: none; stroke: var(--line-strong); stroke-width: 1; }
.disk2d .ring.outer { stroke: rgba(150, 190, 255, 0.45); stroke-width: 1.5; }
.disk2d .sep { stroke: rgba(79, 195, 247, 0.55); stroke-width: 1.2; }
.disk2d .sec-roman { fill: var(--accent); font-size: 15px; font-weight: 700; font-family: Georgia, serif; }
.disk2d .sec-name { fill: var(--muted); font-size: 11px; }
.disk2d .seg { stroke-width: 9; stroke-linecap: butt; opacity: 0.28; }
.disk2d .seg.cap { stroke: #5b6b85; opacity: 0.6; }
.disk2d .seg.none { opacity: 0.35; }
.disk2d .val { stroke-width: 3; opacity: 0.85; }
.disk2d .marker { stroke: #050b17; stroke-width: 2; }
.disk2d .axis.st-crit .marker { filter: drop-shadow(0 0 4px var(--crit)); }
.disk2d .axis:hover .seg, .disk2d .axis.sel .seg { opacity: 0.6; }
.disk2d .axis:focus { outline: none; }
.disk2d .axis:focus .marker, .disk2d .axis:hover .marker { r: 8.5; }
.disk2d .axis-label { fill: #c5d4ee; font-size: 10px; }
.disk2d .center-c { fill: rgba(5, 11, 23, 0.85); stroke-width: 2.5; stroke: var(--none); }
.disk2d .center-c.st-ok { stroke: var(--ok); } .disk2d .center-c.st-warn { stroke: var(--warn); } .disk2d .center-c.st-crit { stroke: var(--crit); }
.disk2d .center-v { fill: var(--text); font-size: 26px; font-weight: 800; font-family: var(--mono); }
.disk2d .center-l { fill: var(--muted); font-size: 9px; letter-spacing: 0.1em; text-transform: uppercase; }
.legend { display: flex; gap: 14px; justify-content: center; font-size: 11px; color: var(--muted); }
.legend span { display: inline-flex; align-items: center; gap: 5px; }

/* ---- suit ---- */
.suit-host { flex: 1; display: flex; justify-content: center; align-items: center; min-height: 420px; }
.suit { height: 100%; max-height: 500px; width: 100%; }
.suit .visor { fill: rgba(5, 11, 23, 0.85); stroke: rgba(79, 195, 247, 0.6); }
.suit .pt:hover circle:last-of-type { r: 8; }
.suit .pulse { animation: pulse 1.4s ease-out infinite; transform-origin: center; transform-box: fill-box; }
@keyframes pulse { from { opacity: 0.8; transform: scale(0.8); } to { opacity: 0; transform: scale(2.4); } }

/* ---- readiness ---- */
.readiness { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; justify-content: center; }
.gauge-bg { fill: none; stroke: rgba(255, 255, 255, 0.07); stroke-width: 12; }
.gauge-fg { fill: none; stroke-width: 12; stroke-linecap: round; transition: stroke-dasharray 0.6s; filter: drop-shadow(0 0 6px currentColor); }
.gauge-v { fill: var(--text); font-size: 36px; font-weight: 800; font-family: var(--mono); }
.gauge-l { fill: var(--muted); font-size: 9px; letter-spacing: 0.12em; text-transform: uppercase; }
.ready-info { display: flex; flex-direction: column; gap: 6px; min-width: 140px; }
.ready-msg { font-weight: 700; }
.ready-msg.st-ok { color: var(--ok); } .ready-msg.st-warn { color: var(--warn); } .ready-msg.st-crit { color: var(--crit); }
.counts { display: flex; gap: 10px; font-family: var(--mono); }
.c-ok { color: var(--ok); } .c-warn { color: var(--warn); } .c-crit { color: var(--crit); }
.rank { font-size: 12px; color: var(--muted); } .rank b { color: var(--accent3); }
.xp-bar { height: 6px; background: rgba(255, 255, 255, 0.08); border-radius: 4px; overflow: hidden; }
.xp-bar span { display: block; height: 100%; background: linear-gradient(90deg, var(--accent), var(--accent2)); }
.xp small { color: var(--muted); font-size: 11px; }

/* ---- env & param rows ---- */
.env-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.env-cell { text-align: left; background: rgba(255, 255, 255, 0.03); border: 1px solid var(--line); border-left: 3px solid var(--none); border-radius: 9px; padding: 8px 10px; display: flex; flex-direction: column; gap: 3px; cursor: pointer; }
.env-cell.st-ok { border-left-color: var(--ok); } .env-cell.st-warn { border-left-color: var(--warn); } .env-cell.st-crit { border-left-color: var(--crit); }
.env-name { font-size: 11px; color: var(--muted); }
.env-val { font-family: var(--mono); font-size: 18px; font-weight: 700; } .env-val small { font-size: 11px; color: var(--muted); font-weight: 400; }
.meter { display: block; height: 5px; background: rgba(255, 255, 255, 0.07); border-radius: 3px; overflow: hidden; flex: 1; }
.meter i { display: block; height: 100%; border-radius: 3px; }
.plist { display: flex; flex-direction: column; gap: 3px; }
.plist-sec { font-size: 11px; color: var(--accent); letter-spacing: 0.08em; text-transform: uppercase; margin: 8px 0 2px; }
.prow { display: grid; grid-template-columns: 12px minmax(0, 1.4fr) minmax(60px, 1fr) 72px; align-items: center; gap: 8px; padding: 5px 8px; border-radius: 7px; background: rgba(255, 255, 255, 0.02); border: 1px solid transparent; cursor: pointer; text-align: left; }
.prow:hover { border-color: var(--line-strong); }
.prow-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 13px; }
.prow-score { font-family: var(--mono); text-align: right; font-size: 12px; }

/* ---- lists ---- */
.list { display: flex; flex-direction: column; gap: 8px; }
.list-item { background: rgba(255, 255, 255, 0.03); border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; display: flex; flex-direction: column; gap: 4px; }
.li-top { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.li-top .muted { margin-left: auto; }
.li-text { font-size: 13px; color: #d3def2; white-space: pre-wrap; }
.row-between { flex-direction: row; justify-content: space-between; align-items: center; }
.chips { display: flex; flex-wrap: wrap; gap: 4px; }
.chip { font-size: 11px; padding: 1px 7px; border-radius: 999px; background: rgba(124, 108, 255, 0.15); color: #cfc8ff; }
.warn-item.lvl-crit { border-color: rgba(255, 77, 79, 0.6); } .warn-item.lvl-warn { border-color: rgba(245, 194, 66, 0.5); }
.warn-item.acked { opacity: 0.55; }
.kind { font-size: 10px; font-weight: 700; padding: 1px 6px; border-radius: 4px; background: rgba(79, 195, 247, 0.15); color: var(--accent); font-family: var(--mono); }
.kind-dicom { background: rgba(124, 108, 255, 0.2); color: #cfc8ff; } .kind-pdf { background: rgba(255, 158, 79, 0.18); color: var(--accent3); } .kind-camera { background: rgba(255, 77, 79, 0.15); color: #ffb3b3; }
.list.short { max-height: 160px; margin-top: 8px; }

/* ---- charts ---- */
.chart-host { flex: 1; min-height: 140px; }
.trend { width: 100%; height: 170px; }
.trend-line { fill: none; stroke: var(--accent); stroke-width: 2; vector-effect: non-scaling-stroke; }
.trend .tick { fill: var(--muted); font-size: 10px; }
.ecg-host { width: 100%; }
.ecg { display: block; border-radius: 8px; }
.raw-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.raw-table th { text-align: left; color: var(--muted); font-weight: 600; position: sticky; top: 0; background: var(--panel-solid); padding: 5px 6px; }
.raw-table td { padding: 4px 6px; border-top: 1px solid var(--line); }
.raw-table tr { cursor: pointer; } .raw-table tr:hover td { background: rgba(79, 195, 247, 0.06); }
.raw-table tr.st-warn td.num { color: var(--warn); } .raw-table tr.st-crit td.num { color: var(--crit); font-weight: 700; }
.num { font-family: var(--mono); text-align: right; }
.clin { color: var(--accent2); font-size: 9px; margin-left: 2px; }

/* ---- map ---- */
.map-host { flex: 1; display: flex; flex-direction: column; gap: 8px; min-height: 300px; }
.map-view { position: relative; flex: 1; min-height: 260px; border-radius: 10px; overflow: hidden; background: #020611; border: 1px solid var(--line); }
.leaflet-host { width: 100%; height: 100%; min-height: 260px; }
.station-map, .moon-map { width: 100%; height: 100%; display: block; }
.station-map .truss { fill: #6b7c99; } .station-map .truss-line { stroke: #6b7c99; stroke-width: 3; }
.station-map .panel { fill: rgba(79, 140, 230, 0.25); stroke: rgba(120, 170, 240, 0.6); }
.station-map .module { fill: rgba(200, 215, 240, 0.12); stroke: rgba(200, 215, 240, 0.6); }
.module-lbl, .grid-lbl { fill: var(--muted); font-size: 10px; }
.muted-svg { fill: var(--muted); font-size: 10px; }
.moon-surface { fill: #2b2f38; stroke: #555c6b; }
.crater { fill: rgba(0, 0, 0, 0.25); stroke: rgba(255, 255, 255, 0.08); }
.crater.named { stroke: rgba(255, 158, 79, 0.6); }
.moon-map .grid { stroke: rgba(255, 255, 255, 0.12); fill: none; }
.map-lbl { fill: var(--text); font-size: 11px; paint-order: stroke; stroke: #050b17; stroke-width: 3px; }
.map-lbl.dim { fill: var(--muted); }
.site { fill: var(--accent3); }
.seg { display: inline-flex; background: rgba(255, 255, 255, 0.04); border: 1px solid var(--line); border-radius: 9px; padding: 2px; gap: 2px; }
.seg-btn { background: none; border: none; padding: 4px 12px; border-radius: 7px; cursor: pointer; color: var(--muted); }
.seg-btn.on { background: rgba(79, 195, 247, 0.18); color: var(--text); }
.seg-btn .count { margin-left: 5px; font-size: 10px; color: var(--accent); }
.moon-wrap { position: absolute; inset: 0; display: flex; flex-direction: column; }
.moon-stage { flex: 1; min-height: 0; position: relative; overflow: hidden; }
.moon-stage canvas { display: block; }
.moon-stage .moon-map { height: 100%; }
.map-zoom { position: absolute; left: 8px; bottom: 8px; display: flex; gap: 6px; align-items: center; background: rgba(5, 11, 23, 0.7); padding: 4px 8px; border-radius: 9px; border: 1px solid var(--line); z-index: 2; }
.map-zoom .btn[disabled] { opacity: 0.4; cursor: default; }
.globe-lbl { font-size: 11px; color: var(--muted); text-shadow: 0 0 4px #000; }
.globe-lbl.pole { color: var(--accent); font-weight: 700; margin-top: 26px; }
.globe-pt { font-size: 11px; color: var(--text); background: rgba(5, 11, 23, 0.75); border: 1px solid var(--line-strong); border-radius: 6px; padding: 0 5px; margin: -20px 0 0 0; white-space: nowrap; }
.leaflet-container { background: #0a1426; font-family: var(--sans); }

/* ---- 3D ---- */
.d3-host { position: relative; overflow: hidden; width: 100%; height: 500px; border-radius: 10px; background: radial-gradient(circle at 50% 40%, rgba(79, 195, 247, 0.06), transparent 70%); }
.d3-host canvas { display: block; }
.d3-label { display: flex; align-items: center; gap: 6px; font-size: 12px; padding: 2px 8px; border-radius: 999px; background: rgba(5, 11, 23, 0.8); border: 1px solid var(--line-strong); white-space: nowrap; transition: opacity 0.2s; }
.d3-label.dim { opacity: 0.25; }
.d3-label.sel { border-color: var(--accent); box-shadow: 0 0 10px rgba(79, 195, 247, 0.5); }
.d3-dot { width: 10px; height: 10px; border-radius: 50%; }
.d3-badge { font-family: var(--mono); color: var(--accent); }
.d3-roman { font-family: Georgia, serif; font-weight: 700; color: var(--accent); font-size: 12px; text-shadow: 0 0 4px #000; }
.d3-controls { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; font-size: 12px; color: var(--muted); }
.d3-controls input[type=range] { width: 120px; accent-color: var(--accent); }

/* ---- team / overview cards ---- */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 12px; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; cursor: pointer; display: flex; flex-direction: column; gap: 8px; transition: border-color 0.15s, transform 0.15s; text-align: left; }
.card:hover { border-color: var(--accent); transform: translateY(-2px); }
.card.sel { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent) inset; }
.card-top { display: flex; align-items: center; gap: 10px; }
.card-name { font-weight: 700; }
.card-sub { color: var(--muted); font-size: 11px; }
.card-score { margin-left: auto; font-family: var(--mono); font-size: 22px; font-weight: 800; }
.card-score.st-ok { color: var(--ok); } .card-score.st-warn { color: var(--warn); } .card-score.st-crit { color: var(--crit); }
.mini-bars { display: flex; gap: 2px; height: 8px; }
.mini-bars i { flex: 1; border-radius: 2px; }
.layout-2 { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); gap: 14px; }
.layout-2 > * { min-width: 0; }
.stack { display: flex; flex-direction: column; gap: 14px; }
@media (max-width: 1100px) { .layout-2 { grid-template-columns: 1fr; } }
.section-title { display: flex; align-items: center; gap: 10px; margin: 18px 0 10px; }
.section-title h2 { margin: 0; font-size: 15px; letter-spacing: 0.1em; text-transform: uppercase; color: #b9cbe8; }
.alerts-list .list-item { flex-direction: row; align-items: center; gap: 8px; cursor: pointer; }

/* ---- modal / forms ---- */
.modal-back { position: fixed; inset: 0; background: rgba(2, 6, 14, 0.7); backdrop-filter: blur(4px); display: flex; align-items: center; justify-content: center; z-index: 100; padding: 16px; }
.modal { background: var(--panel-solid); border: 1px solid var(--line-strong); border-radius: 16px; width: min(480px, 100%); max-height: 90vh; display: flex; flex-direction: column; box-shadow: 0 30px 80px rgba(0, 0, 0, 0.6); }
.modal.wide { width: min(860px, 100%); }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 16px; border-bottom: 1px solid var(--line); }
.modal-head h3 { margin: 0; font-size: 16px; }
.modal-body { padding: 16px; overflow: auto; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 16px; border-top: 1px solid var(--line); }
.form { display: flex; flex-direction: column; gap: 12px; }
.form.compact { gap: 8px; }
.field { display: flex; flex-direction: column; gap: 4px; }
.field-label { font-size: 12px; color: var(--muted); }
.field-hint { font-size: 11px; color: var(--muted); }
input[type=text], input[type=password], input[type=number], input[type=datetime-local], input[type=time], textarea, .form select { background: #08142a; border: 1px solid var(--line-strong); border-radius: 8px; padding: 7px 9px; width: 100%; }
input:focus, select:focus, textarea:focus, button:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.row { display: flex; gap: 8px; align-items: center; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.check { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; cursor: pointer; }
.scale { display: flex; gap: 6px; }
.scale-opt { display: flex; align-items: center; gap: 4px; padding: 4px 10px; border: 1px solid var(--line-strong); border-radius: 8px; cursor: pointer; }
.scale-opt:has(input:checked) { background: rgba(79, 195, 247, 0.2); border-color: var(--accent); }
.meta-rows { display: flex; flex-direction: column; gap: 6px; margin-bottom: 6px; }
.tile-picker { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 8px; }
.tile-pick { display: flex; align-items: center; gap: 10px; padding: 12px; border-radius: 10px; border: 1px solid var(--line-strong); background: rgba(255, 255, 255, 0.03); cursor: pointer; text-align: left; }
.tile-pick:hover { border-color: var(--accent); background: rgba(79, 195, 247, 0.1); }
.tp-icon { width: 14px; height: 14px; border-radius: 4px; background: linear-gradient(135deg, var(--accent), var(--accent2)); flex: none; }
.param-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 10px; }
.big-score { font-family: var(--mono); font-size: 28px; font-weight: 800; } .big-score small { font-size: 13px; color: var(--muted); }
.raw { font-family: var(--mono); font-size: 18px; color: var(--accent); }
.media-view img, .media-view iframe, .media-view canvas { width: 100%; border-radius: 10px; border: 1px solid var(--line); background: #000; }
.media-view iframe { height: 70vh; }

/* ---- toasts ---- */
.toast-host { position: fixed; right: 18px; bottom: 18px; display: flex; flex-direction: column; gap: 8px; z-index: 200; max-width: 380px; }
.toast { padding: 10px 14px; border-radius: 10px; background: var(--panel-solid); border: 1px solid var(--line-strong); border-left: 4px solid var(--accent); box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5); animation: tin 0.25s ease-out; }
.toast-ok { border-left-color: var(--ok); } .toast-warn { border-left-color: var(--warn); } .toast-crit { border-left-color: var(--crit); }
.toast.out { opacity: 0; transform: translateX(20px); transition: all 0.35s; }
@keyframes tin { from { opacity: 0; transform: translateY(10px); } }

/* ---- login ---- */
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px; }
.login-card { width: min(460px, 100%); background: var(--panel); border: 1px solid var(--line-strong); border-radius: 20px; padding: 28px; display: flex; flex-direction: column; gap: 18px; box-shadow: 0 30px 90px rgba(0, 0, 0, 0.5); backdrop-filter: blur(10px); }
.login-lang { display: flex; justify-content: flex-end; margin-top: -8px; }
.login-form { display: flex; flex-direction: column; gap: 10px; }
.login-err { color: var(--crit); font-size: 12px; min-height: 16px; }
.demo-list { display: flex; flex-direction: column; gap: 6px; margin-top: 6px; max-height: 300px; overflow: auto; }
.demo-btn { display: flex; align-items: center; gap: 10px; padding: 7px 10px; border-radius: 10px; background: rgba(255, 255, 255, 0.03); border: 1px solid var(--line); cursor: pointer; text-align: left; }
.demo-btn:hover { border-color: var(--accent); }
.demo-btn small { display: block; color: var(--muted); font-size: 11px; }

/* ---- profile pictures ---- */
.avatar.photo { object-fit: cover; border: 2px solid; padding: 0; }
.avatar-btn { background: none; border: none; padding: 0; cursor: pointer; border-radius: 50%; display: inline-flex; }
.avatar-btn:hover .avatar { box-shadow: 0 0 0 2px var(--accent); }
.photo-preview { display: flex; justify-content: center; padding: 6px 0; }
.map-ini { fill: #061024; font-weight: 800; font-family: var(--sans); }
.map-pulse { animation: pulse 1.4s ease-out infinite; transform-origin: center; transform-box: fill-box; }
.lf-icon { background: none; border: none; }
.lf-avatar { border-radius: 50%; border: 3px solid; overflow: hidden; box-shadow: 0 2px 8px rgba(0, 0, 0, 0.6); background: #0b1426; }
.lf-avatar img, .lf-avatar span { width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; object-fit: cover; color: #061024; font-weight: 800; font-size: 12px; }
.lf-avatar.crit { animation: critglow 1.4s ease-in-out infinite; }
@keyframes critglow { 50% { box-shadow: 0 0 0 6px rgba(255, 77, 79, 0.35); } }
.globe-pt { display: flex; align-items: center; gap: 6px; }
.globe-pt .faces { display: flex; }
.globe-pt .faces b { font-size: 10px; margin-left: 4px; color: var(--muted); }
.gface { width: 24px; height: 24px; border-radius: 50%; border: 2px solid; object-fit: cover; display: inline-flex; align-items: center; justify-content: center; font-size: 9px; font-weight: 800; color: #061024; margin-left: -6px; background: #0b1426; }
.gface:first-child { margin-left: 0; }
.globe-feat { font-size: 10px; color: #dfe6f3; text-shadow: 0 0 3px #000, 0 0 6px #000; white-space: nowrap; pointer-events: none; }
.globe-feat.mare { font-style: italic; color: #b9c7de; font-size: 11px; letter-spacing: 0.04em; }
.globe-feat.site { color: var(--accent3); }
.globe-feat.crater::before { content: '◦ '; color: var(--accent); }
.d3-face { width: 20px; height: 20px; border-radius: 50%; border: 2px solid; object-fit: cover; margin-left: -4px; }
.map-caption { position: absolute; top: 6px; left: 10px; font-size: 11px; color: var(--muted); background: rgba(5, 11, 23, 0.6); padding: 2px 6px; border-radius: 6px; }
.map-legend { position: absolute; right: 8px; top: 8px; display: flex; flex-direction: column; gap: 4px; max-height: calc(100% - 16px); overflow: auto; background: rgba(5, 11, 23, 0.75); border: 1px solid var(--line); border-radius: 10px; padding: 6px; }
.ml-item { display: flex; align-items: center; gap: 7px; background: none; border: none; color: var(--text); font-size: 12px; cursor: pointer; padding: 2px 6px; border-radius: 6px; text-align: left; }
.ml-item:hover { background: rgba(79, 195, 247, 0.12); }
.ml-item img, .ml-ini { width: 22px; height: 22px; border-radius: 50%; border: 2px solid; object-fit: cover; display: inline-flex; align-items: center; justify-content: center; font-size: 9px; font-weight: 800; color: #061024; }
.ml-item small { color: var(--muted); margin-left: auto; padding-left: 8px; }

/* ---- maximise / restore a dashboard tile ------------------------------------------- */
.tile-backdrop { position: fixed; inset: 0; z-index: 85; background: rgba(2, 6, 14, 0.72); backdrop-filter: blur(3px); animation: fade-in 0.15s ease-out; }
.tile.maximized { position: fixed; inset: 72px 24px 24px; z-index: 90; background: var(--panel-solid); border-color: var(--line-strong); box-shadow: 0 30px 90px rgba(0, 0, 0, 0.65); animation: tile-grow 0.18s ease-out; }
.tile.maximized .tile-head { cursor: default; }
.tile.maximized .tile-head h4 { font-size: 14px; }
.tile.maximized .tile-body { overflow: auto; }
.tile.maximized .scroll, .tile.maximized .cat-list { max-height: none; }
.tile.maximized .disk2d, .tile.maximized .suit { max-height: calc(100vh - 190px); }
.tile.maximized .disk-host, .tile.maximized .suit-host, .tile.maximized .map-host { min-height: calc(100vh - 170px); }
.tile.maximized .chart-host { min-height: calc(100vh - 220px); }
.tile-max { font-size: 15px; line-height: 1; }
.tile.flash { outline: 2px solid var(--accent); transition: outline-color 0.6s; }
body.has-max-tile { overflow: hidden; }
@keyframes tile-grow { from { transform: scale(0.97); opacity: 0.6; } to { transform: none; opacity: 1; } }
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
@media (max-width: 700px) { .tile.maximized { inset: 8px; } }

/* ---- status categories (health · mental · environment · location · communication) ---- */
.cat-breakdown { display: flex; flex-direction: column; gap: 4px; width: 100%; margin-top: 10px; }
.cat-row { display: grid; grid-template-columns: 20px minmax(0, 1.3fr) minmax(50px, 1fr) 30px; align-items: center; gap: 8px; padding: 4px 8px; border-radius: 7px; background: rgba(255, 255, 255, 0.025); border: 1px solid transparent; border-left: 3px solid var(--none); color: inherit; cursor: pointer; text-align: left; font: inherit; }
.cat-row:hover { border-color: var(--line-strong); }
.cat-row.st-ok { border-left-color: var(--ok); } .cat-row.st-warn { border-left-color: var(--warn); } .cat-row.st-crit { border-left-color: var(--crit); }
.cat-ic { text-align: center; }
.cat-name { font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cat-score { font-family: var(--mono); font-size: 12px; text-align: right; }
.cat-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 8px; }
.cat-head .gauge-host { flex: 0 0 auto; }
.cat-list { max-height: 190px; }
.pad-t { padding-top: 6px; }
.cat-chips { display: flex; gap: 4px; flex-wrap: wrap; margin: 6px 0 2px; }
.cat-chip { display: inline-flex; align-items: center; gap: 3px; font-family: var(--mono); font-size: 11px; padding: 1px 6px; border-radius: 9px; border: 1px solid var(--line); color: var(--muted); }
.cat-chip b { font-weight: 400; }
.cat-chip.st-ok { color: var(--ok); border-color: rgba(46, 204, 113, 0.4); }
.cat-chip.st-warn { color: var(--warn); border-color: rgba(245, 194, 66, 0.45); }
.cat-chip.st-crit { color: var(--crit); border-color: rgba(255, 77, 79, 0.5); }
