/* X-OR SECURE DATA OS — Mission Control: the system map from the kernel out to what it connects to (mission.js,
   mission-ext.js, mission-tour.js). Wide window: the pane is a grid — the strip, the map (as large as the pane's frame lets it be,
   its ratio kept, the legend over its left margin) and one row of three boxes under the frame, reached by scrolling: system, narration, load.
   Narrow window: the map on top, the narration and the panels in a grid under it. The map zooms (mission-zoom.js):
   its viewBox narrows, a zoomed map clips to its box and moves by dragging. Monochrome by design: colour is kept for state (the live dot),
   the map reads through weight, dashes and inversion. */

/* Storage Manager · Tổng quan: the pane is the window body (no side column); cqh in the wide layout needs a size container */
:is(.bk-pane,.win>.page-body):has(>.main>.mc){padding:14px 16px;container:mc-pane/size}
.mc{container:mc/inline-size;--mc-halo:var(--s-lowest);--mc-line:color-mix(in srgb,var(--on-surface) 46%,transparent)}
.mc-in{display:grid;gap:12px;grid-template-columns:repeat(2,minmax(0,1fr));
  grid-template-areas:"top top" "stage stage" "say say" "legend sum" "stat stat";font-size:14px}
.mc-top{grid-area:top}.mc-stage{grid-area:stage}.mc-legend{grid-area:legend}
.mc-sum{grid-area:sum}.mc-stat{grid-area:stat}.mc-say{grid-area:say}
@container mc (max-width:560px){.mc-in{grid-template-columns:minmax(0,1fr);grid-template-areas:"top" "stage" "say" "stat" "legend" "sum"}}

/* ---------------------------------------------------------------- the map */
.mc-stage{position:relative;min-width:0}
/* the ratio is fixed: a zoomed viewBox (rounded) must not change the height and set the ResizeObserver off */
.mc-map{display:block;width:100%;height:auto;aspect-ratio:1300/760;overflow:visible;font-family:var(--font-body);
  user-select:none;-webkit-user-select:none;touch-action:pan-x pan-y}
.mc-map.zoomed{overflow:hidden;cursor:grab;touch-action:none}
.mc-map.grabbing,.mc-map.grabbing [role=button]{cursor:grabbing}
.mc-map pattern path{fill:none;stroke:var(--line-soft);stroke-width:1}
.mc-glow-0{stop-color:var(--on-surface);stop-opacity:.08}
.mc-glow-1{stop-color:var(--on-surface);stop-opacity:0}
.mc-orbit ellipse{fill:none;stroke:var(--line-60);stroke-width:1;stroke-dasharray:2 7}
.mc-orbit .mc-orbit-in{stroke:var(--line);stroke-dasharray:none}

.mc-link{stroke:var(--mc-line);stroke-width:1.8;transition:opacity var(--d-feedback) var(--ease)}
.mc-trunk{stroke:var(--on-surface);stroke-width:2;stroke-dasharray:3 7;animation:mc-flow 1.6s linear infinite}
@keyframes mc-flow{to{stroke-dashoffset:-20}}

.mc-kernel-box{fill:var(--on-surface)}
.mc-kernel-name{fill:var(--s-lowest);font:600 16px var(--font-mono);letter-spacing:.06em}
.mc-kernel-ring{fill:none;stroke:var(--on-surface);stroke-width:1.2;transform-box:fill-box;transform-origin:center;
  animation:mc-pulse 3.2s var(--ease) infinite}
@keyframes mc-pulse{0%{opacity:.45;transform:scale(1)}80%,100%{opacity:0;transform:scale(1.14)}}

[role=button]:is(.mc-hub,.mc-app){cursor:pointer;outline:none;transition:opacity var(--d-feedback) var(--ease)}
.mc-hub-halo{fill:var(--on-surface);opacity:.06}
.mc-hub-dot{fill:var(--s-lowest);stroke:var(--on-surface);stroke-width:1.6;transition:fill var(--d-feedback) var(--ease)}
.mc-hub>svg{color:var(--on-surface);transition:color var(--d-feedback) var(--ease)}
.mc-count circle{fill:var(--on-surface);stroke:var(--mc-halo);stroke-width:2}
.mc-count text{fill:var(--s-lowest);font:600 11px var(--font-mono)}
.mc-hub-lbl{font:600 13.5px var(--font-mono);letter-spacing:.12em;fill:var(--on-surface)}
.mc-hub-lbl,.mc-lbl{paint-order:stroke;stroke:var(--mc-halo);stroke-width:4px;stroke-linejoin:round}
.mc-hub:hover .mc-hub-dot,.mc-hub:focus-visible .mc-hub-dot{fill:var(--on-surface)}
.mc-hub:hover>svg,.mc-hub:focus-visible>svg{color:var(--s-lowest)}
.mc-hub:focus-visible .mc-hub-halo{opacity:.22}

.mc-app rect{fill:var(--s-low);stroke:var(--outline-var);stroke-width:1;transition:fill var(--d-feedback) var(--ease),stroke var(--d-feedback) var(--ease)}
.mc-app svg{color:var(--on-surface);transition:color var(--d-feedback) var(--ease)}
/* 14 map units (MC_LBL in mission-zoom.js); hidden on a small map until zooming makes them readable (.legible) */
.mc-lbl{font:500 14px var(--font-body);fill:var(--on-surface-var);display:none}
.mc-lbl.tight{font-size:12px}
.mc-map.legible :is(.mc-lbl,.mc-hub-lbl){display:inline}
.mc-app.hot rect{stroke:var(--on-surface);stroke-width:1.4}
.mc-app.hot .mc-lbl{fill:var(--on-surface)}
.mc-app:hover rect,.mc-app:focus-visible rect{fill:var(--on-surface);stroke:var(--on-surface)}
.mc-app:hover svg,.mc-app:focus-visible svg{color:var(--s-lowest)}
.mc-app:focus-visible rect{stroke-width:3;stroke:var(--outline)}
.mc-app:is(:hover,:focus-visible) .mc-lbl{fill:var(--on-surface);font-weight:600}

/* the third ring: what a service reaches outside X-OR, one circle per connection joined by a dashed line; the
   circle is dashed until X-OR uses that connection, solid once it does */
[role=button].mc-ext-node{cursor:pointer;outline:none;transition:opacity var(--d-feedback) var(--ease)}
.mc-ext-node>g>circle{fill:var(--s-lowest);stroke:var(--on-surface-var);stroke-width:1;stroke-dasharray:2.5 2;transition:fill var(--d-feedback) var(--ease)}
.mc-ext-node>g>svg{color:var(--on-surface-var)}
.mc-ext-node.on>g>circle{stroke:var(--on-surface);stroke-width:1.4;stroke-dasharray:none}
.mc-ext-node.on>g>svg{color:var(--on-surface)}
.mc-ext-node .mc-count circle{stroke-width:1.5}.mc-ext-node .mc-count text{font-size:10px}
.mc-ext-lbl{font-size:13.5px}
.mc-ext-node:is(:hover,:focus-visible)>g>circle{fill:var(--on-surface);stroke:var(--on-surface);stroke-dasharray:none}
.mc-ext-node:is(:hover,:focus-visible)>g>svg{color:var(--s-lowest)}
.mc-ext-node:focus-visible>g>circle{stroke:var(--outline);stroke-width:3}
.mc-ext-node:is(:hover,:focus-visible,.hot) .mc-lbl{fill:var(--on-surface)}
.mc-ext-link{fill:none;stroke:var(--mc-line);stroke-width:1.6;stroke-dasharray:4 3;pointer-events:none;transition:opacity var(--d-feedback) var(--ease)}
.mc-ext-ring{fill:none;stroke:var(--mc-line);stroke-width:1.2;stroke-dasharray:1 6;pointer-events:none}
.mc-ext-dot{fill:var(--on-surface-var);transition:opacity var(--d-feedback) var(--ease)}
.mc-map .mc-ext-link.hot{stroke:var(--on-surface);stroke-width:2;animation:mc-flow-ext 1.2s linear infinite}
.mc-map .mc-ext-dot.hot{fill:var(--on-surface)}
@keyframes mc-flow-ext{to{stroke-dashoffset:-12}}

/* the route from the kernel to what is lit: a thicker line, a dot running out along it and a ring round the end */
.mc-route-path{fill:none;stroke:var(--on-surface);stroke-width:2;stroke-linecap:round;stroke-linejoin:round;opacity:.8}
.mc-route-dot{fill:var(--on-surface)}
.mc-ring{fill:none;stroke:var(--on-surface);stroke-width:1.2;stroke-dasharray:4 4;transform-box:fill-box;transform-origin:center;
  animation:mc-spin 9s linear infinite}
@keyframes mc-spin{to{transform:rotate(360deg)}}

/* pointing at a node lights its group and its links, the rest steps back; the narration steps it back a little */
.mc-map.dim :is(.mc-app,.mc-hub,.mc-ext-node):not(.hot){opacity:.32}
.mc-map.dim :is(.mc-link,.mc-ext-link,.mc-ext-dot):not(.hot){opacity:.18}
.mc-map.soft :is(.mc-app,.mc-hub,.mc-ext-node):not(.hot){opacity:.55}
.mc-map.soft :is(.mc-link,.mc-ext-link,.mc-ext-dot):not(.hot){opacity:.35}
.mc-map :is(.mc-app,.mc-hub,.mc-ext-node,.mc-link,.mc-ext-link,.mc-ext-dot){transition:opacity var(--d-feedback) var(--ease)}
.mc-map .mc-link.hot{stroke:var(--on-surface);stroke-width:2.4}
.mc-map .mc-trunk.hot{stroke:var(--on-surface)}

.mc-call{position:absolute;z-index:3;transform:translate(-50%,calc(-100% - 24px));pointer-events:none;
  padding:6px 10px 7px;border-radius:var(--r-tip);background:var(--on-surface);color:var(--s-lowest);
  box-shadow:var(--pop-shadow);white-space:nowrap;text-align:center;animation:mc-in var(--d-feedback) var(--ease)}
.mc-call.below{transform:translate(-50%,24px)}
.mc-call b{display:block;font:600 14px/1.3 var(--font-body)}
.mc-call small{display:block;margin-top:1px;font:500 11px/1.3 var(--font-mono);letter-spacing:.1em;text-transform:uppercase;opacity:.7}
@keyframes mc-in{from{opacity:0}}

/* ---------------------------------------------------------------- the panels */
.mc-top{display:flex;align-items:center;gap:.8em;min-width:0;font:500 .85em/1.2 var(--font-mono);letter-spacing:.1em;text-transform:uppercase;color:var(--on-surface-var)}
.mc-top>b{color:var(--on-surface);font-weight:600;letter-spacing:.06em;text-transform:none;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.mc-kver{display:inline-flex;gap:.5em;min-width:0;white-space:nowrap;overflow:hidden}
.mc-kver b{color:var(--on-surface);font-weight:600;letter-spacing:.04em;text-transform:none;overflow:hidden;text-overflow:ellipsis}
@container mc (max-width:720px){.mc-kver{display:none}}
.mc-top-r{margin-left:auto;display:flex;align-items:baseline;gap:.35em;white-space:nowrap}
.mc-top-r b{color:var(--on-surface);font-weight:600}
.mc-top-r i{font-style:normal;margin:0 .3em;opacity:.5}
/* zoom: − / the zoom in per cent (back to 100%) / + */
.mc-zoom{display:inline-flex;flex:none;align-items:stretch;margin-left:.4em;border:1px solid var(--line-60);border-radius:var(--r-pill);
  background:var(--s-lowest);overflow:hidden}
.mc-zoom button{width:auto;min-width:2.4em;height:2.2em;padding:0 .55em;border:0;border-radius:0;background:none;
  color:var(--on-surface);font:600 1em/1 var(--font-mono);letter-spacing:.04em}
.mc-zoom button+button{border-left:1px solid var(--line-60)}
.mc-zoom button svg{width:1.15em;height:1.15em}
.mc-zoom [data-z="0"]{min-width:4.2em;font-variant-numeric:tabular-nums}
.mc-zoom button:hover:not([aria-disabled=true]){background:var(--s-high)}
.mc-zoom button:focus-visible{outline:2px solid var(--on-surface);outline-offset:-2px}
.mc-zoom button[aria-disabled=true]{background:none;color:var(--outline);cursor:default;transform:none}
.mc-live{display:inline-flex;align-items:center;gap:.55em;color:var(--on-surface)}
.mc-live i{position:relative;width:.62em;height:.62em;border-radius:50%;background:var(--success)}
.mc-live i::after{content:"";position:absolute;inset:0;border-radius:50%;background:var(--success);animation:mc-ping 2.4s var(--ease) infinite}
@keyframes mc-ping{0%{opacity:.6;transform:scale(1)}70%,100%{opacity:0;transform:scale(2.6)}}

.mc-panel{min-width:0;padding:1.05em 1.15em 1.1em;border:1px solid var(--line-60);border-radius:var(--r-card);
  background:color-mix(in srgb,var(--s-lowest) 88%,transparent);-webkit-backdrop-filter:blur(8px);backdrop-filter:blur(8px)}
.mc-panel h3{margin:0 0 .8em;font:600 .78em/1.2 var(--font-mono);letter-spacing:.16em;text-transform:uppercase;color:var(--on-surface-var)}
.mc-panel dl{display:grid;gap:.5em;margin:0}
.mc-panel dl>div{display:flex;align-items:baseline;gap:1em;min-width:0}
.mc-panel dt{flex:none;font-size:.9em;color:var(--on-surface-var);white-space:nowrap}
.mc-panel dd{flex:1;margin:0;min-width:0;text-align:right;font:500 .9em/1.3 var(--font-mono);color:var(--on-surface);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}

.mc-panel h3 .help-i{width:1.7em;height:1.7em;margin:-.5em 0 -.5em .4em}
.mc-legend ul{display:grid;gap:.1em;margin:0 -.6em;padding:0;list-style:none}
.mc-legend [data-open]{display:grid;grid-template-columns:1.2em minmax(0,1fr) auto;align-items:center;justify-content:stretch;gap:.5em;
  width:100%;height:auto;padding:.38em .55em;border:0;border-radius:var(--r-item);background:none;color:var(--on-surface);
  font:500 .96em/1.25 var(--font-body);letter-spacing:normal;text-transform:none;text-align:left}
.mc-legend [data-open] svg{width:1.2em;height:1.2em}
.mc-legend [data-open] span{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.mc-legend [data-open] b{min-width:1.7em;padding:0 .4em;border-radius:var(--r-pill);background:var(--s-high);font:600 .82em/1.65 var(--font-mono);text-align:center}
.mc-legend [data-open]:is(:hover,.hot){background:var(--s-high);border:0}
.mc-legend [data-open]:is(:hover,.hot) b{background:var(--on-surface);color:var(--s-lowest)}
.mc-legend [data-open]:focus-visible{outline:2px solid var(--on-surface);outline-offset:-2px}
.mc-legend-ext{display:grid;grid-template-columns:1.2em minmax(0,1fr) auto;align-items:center;gap:.5em;margin-top:.25em;
  padding:.5em .55em .2em;border-top:1px dashed var(--line-60);font:500 .96em/1.25 var(--font-body);color:var(--on-surface-var)}
.mc-legend-ext span{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.mc-legend-ext b{min-width:1.7em;padding:0 .4em;border:1px dashed var(--outline-var);border-radius:var(--r-pill);
  font:600 .82em/1.5 var(--font-mono);text-align:center;color:var(--on-surface)}
.mc-ext-sw{width:.95em;height:.95em;margin:auto;border:1px dashed var(--on-surface);border-radius:50%}
.mc-hint{margin:.6em 0 0;font-size:.82em;line-height:1.35;color:var(--on-surface-var)}

/* the narration: which step, which service, and a typed line saying what its connection is for */
.mc-say{display:grid;grid-template-columns:auto minmax(0,1fr);align-items:center;gap:.85em;min-width:0;
  padding:.6em 1em .65em .6em;border:1px solid var(--line-60);border-radius:var(--r-card);
  background:color-mix(in srgb,var(--s-lowest) 90%,transparent);-webkit-backdrop-filter:blur(8px);backdrop-filter:blur(8px)}
.mc-say-btn{width:2.5em;height:2.5em;padding:0;border:1px solid var(--outline-var);border-radius:50%;background:var(--s-lowest);color:var(--on-surface)}
.mc-say-btn svg{width:1.05em;height:1.05em}
.mc-say-btn:hover{background:var(--on-surface);border-color:var(--on-surface);color:var(--s-lowest)}
.mc-say-btn:focus-visible{outline:2px solid var(--on-surface);outline-offset:2px}
.mc-say-btn[aria-pressed=true]{background:var(--on-surface);border-color:var(--on-surface);color:var(--s-lowest)}
.mc-say-body{min-width:0}
.mc-say-meta{display:flex;align-items:baseline;gap:.9em;min-width:0;margin:0 0 .25em;font:500 .74em/1.2 var(--font-mono);letter-spacing:.14em;text-transform:uppercase;color:var(--on-surface-var)}
.mc-say-step{flex:none;font-variant-numeric:tabular-nums}
.mc-say-who{min-width:0;color:var(--on-surface);font-weight:600;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.mc-say-line{margin:0;min-height:1.4em;font:500 1em/1.4 var(--font-body);color:var(--on-surface)}
.mc-say-line>i:first-child{margin-right:.5em;font:600 .9em var(--font-mono);font-style:normal;opacity:.45}
.mc-say-caret{display:none;width:.5em;height:1.05em;margin-left:.12em;vertical-align:-.16em;background:var(--on-surface)}
.mc-say-line.typing .mc-say-caret{display:inline-block;animation:mc-blink .9s steps(1) infinite}
@keyframes mc-blink{50%{opacity:0}}


.mc-stat{transition:opacity var(--d-feedback) var(--ease)}
.mc-stat[data-stale]{opacity:.55}
.mc-stat dl>div{gap:.6em}.mc-stat dd{font-size:.85em}
.mc-bigs{display:grid;grid-template-columns:1fr 1fr;gap:1em}
.mc-big{display:flex;flex-wrap:wrap;align-items:baseline;gap:0 .35em;margin:0;min-width:0}
.mc-big b{font:700 2.3em/1 var(--font-head);font-variant-numeric:tabular-nums;letter-spacing:-.02em}
.mc-big small{font:500 .78em var(--font-mono);letter-spacing:.08em;color:var(--on-surface-var)}
.mc-big span{flex-basis:100%;margin-top:.3em;font:500 .78em var(--font-mono);color:var(--on-surface-var);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.mc-spark{display:block;width:100%;height:2.6em;margin:.55em 0 .8em;border-bottom:1px dashed var(--line-60)}
.mc-spark polyline{fill:none;stroke:var(--on-surface);stroke-width:1.5;stroke-linejoin:round;vector-effect:non-scaling-stroke}

/* ---------------------------------------------------------------- wide: the map fills the window, the panels sit under it */
@container mc (min-width:960px){
  /* the pane is the grid: strip / map / one row of three boxes (system, the narration, load) under the frame */
  .mc-in{--mc-top:34px;--mc-gap:12px;position:relative;min-height:100cqh;gap:var(--mc-gap);
    grid-template-columns:minmax(0,1fr) minmax(0,2.1fr) minmax(0,1fr);grid-template-rows:var(--mc-top) auto auto;
    grid-template-areas:"top top top" "stage stage stage" "sum say stat";font-size:clamp(14px,.5cqw + 8px,19px)}
  
  /* the map's box has an empty margin all round (the ring and its labels stand inside it): the box is drawn 6% larger
     than the frame and pulled up by that margin at the top, so the drawing itself fills the frame */
  .mc-in{--mc-w:min(100cqw,calc((100cqh - var(--mc-top) - var(--mc-gap)) * 1.7105 * 1.058))}
  .mc-stage{justify-self:center;width:var(--mc-w);aspect-ratio:1300/760;margin:calc(var(--mc-w) * -.032) 0 0}
  .mc-map{height:100%}
  .mc-top{position:relative;z-index:3}   /* above the top margin of the map box */
  .mc-lbl{display:inline}
  .mc-in>.mc-legend{position:absolute;z-index:2;left:0;top:calc(var(--mc-top) + var(--mc-gap));width:clamp(190px,17cqw,260px)}
  .mc-sum,.mc-stat,.mc-say{align-self:stretch}
  .mc-sum dd{overflow:visible;white-space:normal;overflow-wrap:anywhere}
  .mc-say{align-content:center}
  .mc-sum,.mc-stat{padding:.75em 1em .8em}.mc-sum h3,.mc-stat h3{margin-bottom:.55em}.mc-sum dl{gap:.35em}
  .mc-stat{display:grid;grid-template-columns:minmax(0,.9fr) minmax(0,1.1fr);grid-template-rows:auto auto 1fr;column-gap:1.4em;align-content:start}
  .mc-stat h3{grid-column:1/-1}.mc-stat .mc-bigs{grid-row:2/4;align-content:center}
  .mc-stat .mc-spark{grid-column:2;grid-row:2;height:2.4em;margin:0 0 .4em}.mc-stat dl{grid-column:2;grid-row:3;grid-template-columns:1fr;align-content:start}
  .mc-say-line{min-height:2.8em}
  /* what is drawn in map units grows with the window's text: bigger type, firmer lines */
  .mc-lbl{font-size:calc(var(--mc-fs,17) * 1px)}.mc-lbl.tight{font-size:calc(var(--mc-fs,17) * .82px)}
  .mc-hub-lbl,.mc-ext-lbl{font-size:calc(var(--mc-fs,17) * .95px)}.mc-count text{font-size:calc(var(--mc-fs,17) * .74px)}
}
@container mc (max-width:959px){.mc-hub-lbl{font-size:17px}.mc-count text{font-size:12px}.mc-ext-node .mc-count text{font-size:10px}
  .mc-top{flex-wrap:wrap;row-gap:.4em}}
@container mc (max-width:480px){.mc-hub-lbl{display:none}}

@media (prefers-reduced-motion:reduce){
  .mc-trunk,.mc-kernel-ring,.mc-live i::after,.mc-call,.mc-ring,.mc-map .mc-ext-link.hot,.mc-say-line.typing .mc-say-caret{animation:none}
  .mc-kernel-ring{opacity:.25}
}
