@font-face {
  font-family: "Pretendard";
  src: url("assets/fonts/PretendardVariable.woff2") format("woff2-variations");
  font-weight: 100 900;
  font-display: swap;
}

:root {
  --bg: #060f1a;
  --bg-2: #0a1726;
  --panel: rgba(11, 25, 40, 0.94);
  --panel-solid: #0b1928;
  --card: #0f2236;
  --card-2: #13293f;
  --line: rgba(140, 186, 228, 0.14);
  --line-2: rgba(140, 186, 228, 0.26);
  --text: #e7f0f8;
  --text-2: #b9cadb;
  --muted: #7f98ad;
  --accent: #2fd6c3;
  --accent-dim: rgba(47, 214, 195, 0.16);
  --blue: #4da8ff;
  --warn: #ffb547;
  --warn-dim: rgba(255, 181, 71, 0.15);
  --crit: #ff6b5e;
  --crit-dim: rgba(255, 107, 94, 0.16);
  --ok: #49d68a;
  --violet: #b097ff;
  --pink: #ff7ac8;
  --radius: 10px;
  --header-h: 54px;
  --rail-w: 76px;
  --panel-w: 432px;
  --tl-h: 96px;
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); overflow: hidden; }
body { font-family: "Pretendard", "Malgun Gothic", system-ui, sans-serif; font-size: 13px; line-height: 1.45; -webkit-font-smoothing: antialiased; }
button, select, input { font: inherit; color: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }
.num { font-variant-numeric: tabular-nums; }

/* ---------- layout ---------- */
.app {
  display: grid;
  height: 100vh;
  grid-template-columns: var(--rail-w) 1fr var(--panel-w);
  grid-template-rows: var(--header-h) 1fr var(--tl-h);
  grid-template-areas: "top top top" "rail stage panel" "tl tl tl";
}
.topbar { grid-area: top; display: flex; align-items: center; gap: 18px; padding: 0 16px 0 14px; background: linear-gradient(180deg, #0b1a2b, #08131f); border-bottom: 1px solid var(--line); z-index: 5; }
.rail { grid-area: rail; background: #08131f; border-right: 1px solid var(--line); display: flex; flex-direction: column; padding: 10px 8px; gap: 4px; z-index: 4; }
.stage { grid-area: stage; position: relative; overflow: hidden; background: #06121f; }
.panel { grid-area: panel; background: var(--panel-solid); border-left: 1px solid var(--line); overflow-y: auto; overflow-x: hidden; z-index: 4; scrollbar-width: thin; scrollbar-color: #24405c transparent; }
.timeline { grid-area: tl; display: grid; grid-template-columns: 250px 1fr auto; gap: 18px; align-items: center; padding: 10px 16px; background: linear-gradient(0deg, #08131f, #0b1a2b); border-top: 1px solid var(--line); z-index: 5; }
.map { position: absolute; inset: 0; }

/* ---------- topbar ---------- */
.brand { display: flex; align-items: center; gap: 10px; min-width: 200px; }
.brand-mark { width: 30px; height: 30px; fill: none; stroke: var(--accent); stroke-width: 3; stroke-linecap: round; filter: drop-shadow(0 0 6px rgba(47, 214, 195, .5)); }
.brand-text { display: flex; flex-direction: column; line-height: 1.1; }
.brand-text strong { font-size: 17px; letter-spacing: .2px; }
.brand-text span { font-size: 11px; color: var(--muted); letter-spacing: .3px; }
.workspace { display: flex; flex-direction: column; line-height: 1.15; padding-left: 16px; border-left: 1px solid var(--line); }
.ws-label { font-size: 10.5px; color: var(--muted); }
.workspace strong { font-size: 13.5px; font-weight: 600; }
.incident-chip { display: flex; align-items: center; gap: 8px; padding: 5px 12px 5px 10px; border-radius: 999px; background: var(--crit-dim); border: 1px solid rgba(255, 107, 94, .45); font-size: 12.5px; font-weight: 600; }
.incident-chip .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--crit); box-shadow: 0 0 0 0 rgba(255, 107, 94, .7); animation: pulse 1.6s infinite; }
.incident-chip .tag { font-size: 11px; font-weight: 600; padding: 1px 7px; border-radius: 999px; background: rgba(255, 255, 255, .08); color: var(--text-2); }
.incident-chip.closed { background: rgba(73, 214, 138, .12); border-color: rgba(73, 214, 138, .45); }
.incident-chip.closed .dot { background: var(--ok); animation: none; }
.topbar-spacer { flex: 1; }
.sim-clock { display: flex; align-items: baseline; gap: 8px; padding: 4px 14px; border-radius: 8px; background: rgba(255, 255, 255, .03); border: 1px solid var(--line); }
.sim-date { font-size: 12px; color: var(--text-2); }
.sim-time { font-size: 20px; font-weight: 700; font-variant-numeric: tabular-nums; letter-spacing: .5px; }
.sim-tz { font-size: 10.5px; color: var(--muted); }
.role-select { display: flex; align-items: center; gap: 8px; font-size: 11.5px; color: var(--muted); }
.role-select select { background: var(--card); border: 1px solid var(--line-2); border-radius: 7px; padding: 5px 8px; font-size: 12.5px; color: var(--text); }
.demo-badge { font-size: 11.5px; font-weight: 600; color: var(--warn); padding: 5px 10px; border: 1px dashed rgba(255, 181, 71, .55); border-radius: 7px; background: var(--warn-dim); white-space: nowrap; }

/* ---------- rail ---------- */
.rail-btn { position: relative; display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 10px 2px 8px; border-radius: 10px; border: 0; background: none; color: var(--muted); font-size: 11px; line-height: 1.15; text-align: center; transition: background .15s, color .15s; }
.rail-btn svg { width: 22px; height: 22px; stroke: currentColor; fill: none; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.rail-btn:hover { background: rgba(255, 255, 255, .04); color: var(--text-2); }
.rail-btn.on { background: var(--accent-dim); color: var(--accent); }
.rail-btn.on::before { content: ""; position: absolute; left: -8px; top: 12px; bottom: 12px; width: 3px; border-radius: 0 3px 3px 0; background: var(--accent); }
.rail-btn .n { position: absolute; top: 5px; right: 8px; font-size: 9.5px; font-weight: 700; min-width: 15px; height: 15px; padding: 0 4px; border-radius: 8px; background: var(--crit); color: #fff; display: grid; place-items: center; }
.rail-btn.done .n { background: var(--ok); }
.rail-btn.locked { opacity: .45; }
.rail-sep { flex: 1; }
.rail-note { font-size: 9.5px; color: var(--muted); text-align: center; line-height: 1.3; padding: 4px 0; }

/* ---------- KPI strip ---------- */
.kpis { position: absolute; top: 12px; left: 12px; right: 12px; display: flex; gap: 8px; z-index: 3; pointer-events: none; }
.kpi { pointer-events: auto; min-width: 0; flex: 1 1 0; max-width: 230px; padding: 9px 12px 9px; border-radius: var(--radius); background: rgba(9, 22, 36, .82); border: 1px solid var(--line); backdrop-filter: blur(8px); box-shadow: var(--shadow); }
.kpi.title { flex: 1.6 1 0; max-width: 360px; }
.kpi .k { font-size: 11px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kpi .v { font-size: 22px; font-weight: 700; line-height: 1.15; font-variant-numeric: tabular-nums; white-space: nowrap; }
.kpi .v small { font-size: 12px; font-weight: 500; color: var(--text-2); margin-left: 3px; }
.kpi .s { font-size: 11px; color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kpi.title .v { font-size: 17px; }
.kpi .eyebrow { font-size: 10px; letter-spacing: 1.2px; color: var(--accent); text-transform: uppercase; }
.kpi.crit { border-color: rgba(255, 107, 94, .5); }
.kpi.crit .v { color: var(--crit); }
.kpi.warn .v { color: var(--warn); }
.kpi.good .v { color: var(--ok); }

/* ---------- map tools / layers / legend ---------- */
.map-tools { position: absolute; top: 96px; right: 12px; display: flex; flex-direction: column; gap: 8px; align-items: flex-end; z-index: 3; }
.seg { display: flex; background: rgba(9, 22, 36, .86); border: 1px solid var(--line); border-radius: 8px; padding: 2px; }
.seg button, .tool { border: 0; background: none; color: var(--text-2); padding: 5px 10px; border-radius: 6px; font-size: 12px; font-weight: 600; }
.seg button.on { background: var(--accent-dim); color: var(--accent); }
.tool { background: rgba(9, 22, 36, .86); border: 1px solid var(--line); border-radius: 8px; }
.tool.on { color: var(--accent); border-color: rgba(47, 214, 195, .5); }
.layer-panel { position: absolute; top: 96px; left: 12px; width: 212px; background: rgba(9, 22, 36, .88); border: 1px solid var(--line); border-radius: var(--radius); z-index: 3; backdrop-filter: blur(8px); box-shadow: var(--shadow); }
.layer-panel header { display: flex; justify-content: space-between; align-items: center; padding: 8px 10px 6px 12px; font-size: 12px; font-weight: 700; color: var(--text-2); }
.layer-panel header button { border: 0; background: none; color: var(--muted); font-size: 16px; line-height: 1; padding: 0 4px; }
.layer-panel.collapsed .layer-list { display: none; }
.layer-list { padding: 0 6px 8px; display: flex; flex-direction: column; gap: 1px; }
.layer-row { display: flex; align-items: center; gap: 8px; padding: 5px 6px; border-radius: 6px; font-size: 12px; color: var(--text-2); cursor: pointer; user-select: none; }
.layer-row:hover { background: rgba(255, 255, 255, .04); }
.layer-row .sw { width: 14px; height: 14px; border-radius: 4px; flex: none; }
.layer-row .lbl { flex: 1; }
.layer-row .lbl small { display: block; font-size: 10px; color: var(--muted); }
.layer-row input { accent-color: var(--accent); margin: 0; }
.layer-row.off { opacity: .5; }
.legend { position: absolute; right: 12px; bottom: 50px; display: flex; flex-direction: column; gap: 6px; padding: 9px 12px; background: rgba(9, 22, 36, .86); border: 1px solid var(--line); border-radius: var(--radius); z-index: 3; font-size: 11px; color: var(--text-2); max-width: 270px; }
.legend .row { display: flex; align-items: center; gap: 8px; }
.legend .ramp { height: 8px; width: 120px; border-radius: 4px; }
.legend .sw { width: 18px; height: 3px; border-radius: 2px; flex: none; }
.legend .dot { width: 9px; height: 9px; border-radius: 50%; flex: none; }
.legend .title { font-weight: 700; color: var(--text); font-size: 11.5px; }
.map-foot { position: absolute; left: 0; right: 0; bottom: 0; display: flex; justify-content: space-between; gap: 12px; padding: 4px 12px; font-size: 10.5px; color: rgba(185, 202, 219, .7); background: linear-gradient(0deg, rgba(6, 15, 26, .85), rgba(6, 15, 26, 0)); z-index: 2; pointer-events: none; }
.maplibregl-ctrl-attrib, .maplibregl-ctrl-logo { display: none !important; }
.maplibregl-ctrl-bottom-right { bottom: 22px; }
.maplibregl-ctrl-scale { background: rgba(9, 22, 36, .7); color: var(--text-2); border-color: var(--text-2); font-size: 10px; }

/* caption card over the map */
.caption { position: absolute; left: 12px; bottom: 30px; width: min(600px, calc(100% - 300px)); display: flex; gap: 12px; align-items: flex-start; padding: 12px 14px; background: rgba(10, 24, 39, .93); border: 1px solid var(--line-2); border-radius: 12px; z-index: 3; box-shadow: var(--shadow); animation: rise .35s ease; }
.caption .step-n { flex: none; width: 32px; height: 32px; border-radius: 9px; display: grid; place-items: center; font-weight: 800; background: var(--accent-dim); color: var(--accent); }
.caption.crit .step-n { background: var(--crit-dim); color: var(--crit); }
.caption.warn .step-n { background: var(--warn-dim); color: var(--warn); }
.caption.data { border-color: rgba(47, 214, 195, .45); }
.caption.data .step-n { width: 40px; font-size: 17px; }
.caption .step-n small { font-size: 10px; opacity: .7; margin-left: 1px; }
.caption .cut-count { margin-left: 8px; font-size: 12.5px; font-weight: 600; color: var(--muted); }
.caption .cut-count b { color: var(--warn); font-size: 15px; }
.caption .body { flex: 1; min-width: 0; }
.caption .eyebrow { font-size: 10.5px; letter-spacing: 1px; color: var(--muted); text-transform: uppercase; }
.caption .ttl { font-size: 14.5px; font-weight: 700; margin: 1px 0 2px; }
.caption .txt { font-size: 12.5px; color: var(--text-2); }
.caption .act { flex: none; align-self: center; }

/* rain overlay */
.rain-fx { position: absolute; inset: 0; z-index: 2; pointer-events: none; opacity: .55; background-image: repeating-linear-gradient(105deg, rgba(180, 210, 240, .0) 0 9px, rgba(180, 210, 240, .22) 9px 10px, rgba(180, 210, 240, 0) 10px 23px); background-size: 220px 220px; animation: rain .45s linear infinite; mix-blend-mode: screen; }
@keyframes rain { to { background-position: -60px 220px; } }

/* ---------- map markers ---------- */
.mk { position: relative; width: max-content; pointer-events: auto; }
.mk-card { display: inline-flex; align-items: center; gap: 7px; padding: 5px 9px 5px 7px; border-radius: 8px; background: rgba(8, 20, 33, .92); border: 1px solid var(--line-2); font-size: 11.5px; font-weight: 600; white-space: nowrap; box-shadow: 0 6px 16px rgba(0, 0, 0, .35); cursor: pointer; }
.mk-card .ic { width: 18px; height: 18px; border-radius: 5px; display: grid; place-items: center; font-size: 10px; font-weight: 800; color: #04121c; background: var(--accent); }
.mk-card .sub { font-weight: 500; color: var(--text-2); }
.mk-card.crit { border-color: rgba(255, 107, 94, .7); }
.mk-card.crit .ic { background: var(--crit); color: #fff; }
.mk-card.warn { border-color: rgba(255, 181, 71, .6); }
.mk-card.warn .ic { background: var(--warn); }
.mk-card.violet .ic { background: var(--violet); }
.mk-card.pink .ic { background: var(--pink); }
.mk-card.blue .ic { background: var(--blue); }
.mk-card.dim { opacity: .75; }
.mk-stem { position: absolute; left: 50%; top: 100%; width: 1px; height: 14px; background: linear-gradient(var(--line-2), transparent); }
.mk-site { display: flex; align-items: center; gap: 6px; font-size: 11.5px; font-weight: 600; color: var(--text); text-shadow: 0 1px 4px #000; white-space: nowrap; cursor: pointer; }
.mk-site i { width: 11px; height: 11px; border-radius: 50%; border: 2px solid #06121f; background: var(--ok); box-shadow: 0 0 0 2px rgba(73, 214, 138, .35); }
.mk-site.watch i { background: var(--warn); box-shadow: 0 0 0 2px rgba(255, 181, 71, .35); }
.mk-site.alert i { background: var(--crit); box-shadow: 0 0 0 0 rgba(255, 107, 94, .7); animation: pulse 1.4s infinite; }
.mk-site small { font-weight: 500; color: var(--text-2); }

/* ---------- right panel ---------- */
.pn-head { position: sticky; top: 0; z-index: 2; padding: 14px 18px 10px; background: linear-gradient(180deg, var(--panel-solid) 85%, rgba(11, 25, 40, 0)); }
.pn-eyebrow { font-size: 10.5px; color: var(--accent); letter-spacing: 1.1px; text-transform: uppercase; font-weight: 600; }
.pn-title { font-size: 18px; font-weight: 750; margin: 2px 0 2px; display: flex; align-items: center; gap: 8px; }
.pn-sub { font-size: 12px; color: var(--muted); }
.tabs { display: flex; gap: 4px; margin-top: 10px; border-bottom: 1px solid var(--line); }
.tab { border: 0; background: none; padding: 7px 10px 8px; font-size: 12.5px; font-weight: 600; color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -1px; display: flex; align-items: center; gap: 6px; }
.tab .tn { width: 17px; height: 17px; border-radius: 50%; display: grid; place-items: center; font-size: 10px; background: rgba(255, 255, 255, .07); }
.tab.on { color: var(--text); border-bottom-color: var(--accent); }
.tab.on .tn { background: var(--accent); color: #04121c; }
.tab:disabled { opacity: .35; cursor: default; }
.pn-body { padding: 4px 18px 22px; display: flex; flex-direction: column; gap: 12px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; }
.card.hl { border-color: rgba(47, 214, 195, .4); background: linear-gradient(180deg, rgba(47, 214, 195, .07), var(--card)); }
.card.crit { border-color: rgba(255, 107, 94, .45); background: linear-gradient(180deg, rgba(255, 107, 94, .08), var(--card)); }
.card.warn { border-color: rgba(255, 181, 71, .4); background: linear-gradient(180deg, rgba(255, 181, 71, .07), var(--card)); }
.card-h { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; margin-bottom: 8px; }
.card-h h3 { margin: 0; font-size: 13px; font-weight: 700; }
.card-h .meta { font-size: 11px; color: var(--muted); white-space: nowrap; }
.muted { color: var(--muted); }
.small { font-size: 11.5px; }
.big { font-size: 26px; font-weight: 750; line-height: 1.1; font-variant-numeric: tabular-nums; }
.row { display: flex; align-items: center; gap: 8px; }
.row.between { justify-content: space-between; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.stat { background: var(--card-2); border-radius: 8px; padding: 8px 10px; border: 1px solid var(--line); }
.stat .k { font-size: 10.5px; color: var(--muted); }
.stat .v { font-size: 16px; font-weight: 700; font-variant-numeric: tabular-nums; }
.stat .v small { font-size: 11px; font-weight: 500; color: var(--text-2); }
.pill { display: inline-flex; align-items: center; gap: 4px; font-size: 10.5px; font-weight: 700; padding: 2px 8px; border-radius: 999px; background: rgba(255, 255, 255, .07); color: var(--text-2); white-space: nowrap; }
.pill.crit { background: var(--crit-dim); color: var(--crit); }
.pill.warn { background: var(--warn-dim); color: var(--warn); }
.pill.ok { background: rgba(73, 214, 138, .14); color: var(--ok); }
.pill.acc { background: var(--accent-dim); color: var(--accent); }
.pill.vio { background: rgba(176, 151, 255, .16); color: var(--violet); }
.list { display: flex; flex-direction: column; }
.li { display: flex; align-items: center; gap: 10px; padding: 8px 2px; border-top: 1px solid var(--line); }
.li:first-child { border-top: 0; }
.li .grow { flex: 1; min-width: 0; }
.li .t { font-weight: 600; font-size: 12.5px; }
.li .d { font-size: 11.5px; color: var(--muted); }
.li.click { cursor: pointer; border-radius: 6px; }
.li.click:hover { background: rgba(255, 255, 255, .03); }
.li.sel { background: rgba(47, 214, 195, .07); }
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; flex: none; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 9px 14px; border-radius: 8px; border: 1px solid var(--line-2); background: var(--card-2); font-size: 12.5px; font-weight: 700; color: var(--text); }
.btn:hover { border-color: rgba(47, 214, 195, .5); }
.btn.primary { background: linear-gradient(180deg, #34e0cc, #1fb4a4); color: #03141a; border-color: transparent; }
.btn.primary:hover { filter: brightness(1.06); }
.btn.danger { background: var(--crit); color: #fff; border-color: transparent; }
.btn.block { width: 100%; }
.btn:disabled { opacity: .45; cursor: default; filter: none; }
.btn .cd { font-size: 11px; font-weight: 600; opacity: .8; }
.approved { display: flex; align-items: center; gap: 8px; padding: 9px 12px; border-radius: 8px; background: rgba(73, 214, 138, .1); border: 1px solid rgba(73, 214, 138, .35); color: var(--ok); font-size: 12px; font-weight: 600; }
.approved span { color: var(--text-2); font-weight: 500; margin-left: auto; }
.gate { display: flex; flex-direction: column; gap: 8px; padding: 12px; border-radius: 10px; border: 1px dashed rgba(47, 214, 195, .55); background: rgba(47, 214, 195, .05); }
.gate .q { font-size: 12.5px; font-weight: 700; }
.gate .why { font-size: 11.5px; color: var(--text-2); }
.gate.pulse { animation: glow 1.6s ease-in-out infinite; }
.note { font-size: 11px; color: var(--muted); display: flex; gap: 6px; line-height: 1.45; }
.note::before { content: "ⓘ"; color: var(--warn); }
.empty { padding: 30px 10px; text-align: center; color: var(--muted); font-size: 12.5px; }
.empty .ic { font-size: 28px; margin-bottom: 6px; opacity: .6; }

/* bars and factors */
.bar { position: relative; height: 7px; border-radius: 4px; background: rgba(255, 255, 255, .07); overflow: hidden; }
.bar i { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 4px; background: var(--accent); transition: width .6s ease; }
.bar.crit i { background: var(--crit); }
.bar.warn i { background: var(--warn); }
.bar.vio i { background: var(--violet); }
.bar .ghost { position: absolute; top: -1px; bottom: -1px; width: 2px; background: #fff; opacity: .6; }
.factor { display: grid; grid-template-columns: 1fr 86px 46px; gap: 8px; align-items: center; padding: 5px 0; font-size: 12px; }
.factor .fv { font-size: 11px; color: var(--muted); }
.factor .w { text-align: right; font-weight: 700; font-variant-numeric: tabular-nums; }
.factor .w.pos { color: var(--accent); }
.factor .w.neg { color: var(--crit); }
.typebar { display: grid; grid-template-columns: 112px 1fr 40px; gap: 8px; align-items: center; font-size: 12px; padding: 3px 0; }
.typebar .p { text-align: right; font-weight: 700; font-variant-numeric: tabular-nums; }
.cand { display: grid; grid-template-columns: 26px 1fr auto; gap: 10px; align-items: center; padding: 10px 4px; border-top: 1px solid var(--line); cursor: pointer; border-radius: 6px; }
.cand:first-child { border-top: 0; }
.cand:hover { background: rgba(255, 255, 255, .03); }
.cand.sel { background: rgba(47, 214, 195, .07); }
.cand .rk { width: 24px; height: 24px; border-radius: 7px; display: grid; place-items: center; font-weight: 800; font-size: 12px; background: rgba(255, 255, 255, .07); }
.cand.top .rk { background: var(--crit); color: #fff; }
.cand .nm { font-weight: 700; font-size: 12.5px; }
.cand .cev { font-size: 11px; color: var(--muted); margin-top: 1px; }
.cand .pr { text-align: right; min-width: 70px; }
.cand .pr b { font-size: 16px; font-variant-numeric: tabular-nums; }
.cand .bar { margin-top: 5px; }
.funnel { display: flex; flex-direction: column; gap: 5px; }
.funnel .fs { display: grid; grid-template-columns: 1fr 50px; align-items: center; gap: 8px; font-size: 12px; }
.funnel .fb { height: 22px; border-radius: 5px; background: linear-gradient(90deg, rgba(77, 168, 255, .55), rgba(77, 168, 255, .2)); display: flex; align-items: center; padding-left: 8px; font-size: 11px; color: #dff0ff; white-space: nowrap; transition: width .6s ease; }
.funnel .fs:last-child .fb { background: linear-gradient(90deg, rgba(255, 107, 94, .75), rgba(255, 107, 94, .25)); }
.funnel .fn { text-align: right; font-weight: 800; font-variant-numeric: tabular-nums; }

/* plan & field */
.plan-opt { border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; cursor: pointer; background: var(--card-2); }
.plan-opt.on { border-color: rgba(47, 214, 195, .65); background: linear-gradient(180deg, rgba(47, 214, 195, .08), var(--card-2)); }
.plan-opt .po-h { display: flex; justify-content: space-between; align-items: center; font-weight: 700; font-size: 12.5px; }
.plan-opt .po-m { display: flex; gap: 12px; margin-top: 6px; font-size: 11.5px; color: var(--text-2); }
.plan-opt .po-m b { color: var(--text); font-variant-numeric: tabular-nums; }
.stops { display: flex; flex-direction: column; }
.stop { display: grid; grid-template-columns: 26px 1fr auto; gap: 10px; padding: 8px 0; border-top: 1px solid var(--line); align-items: start; }
.stop:first-child { border-top: 0; }
.stop .sn { width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; font-size: 11px; font-weight: 800; background: rgba(176, 151, 255, .18); color: var(--violet); border: 1px solid rgba(176, 151, 255, .5); }
.stop.done .sn { background: var(--ok); color: #04121c; border-color: transparent; }
.stop.now .sn { background: var(--warn); color: #04121c; border-color: transparent; animation: pulse 1.4s infinite; }
.stop .st { font-weight: 700; font-size: 12.5px; }
.stop .sd { font-size: 11px; color: var(--muted); }
.stop .eta { font-size: 12px; font-weight: 700; font-variant-numeric: tabular-nums; text-align: right; }
.stop .eta small { display: block; font-size: 10.5px; color: var(--muted); font-weight: 500; }
.seal { font-family: ui-monospace, Consolas, monospace; font-size: 10.5px; color: var(--accent); }
.progress { height: 6px; border-radius: 3px; background: rgba(255, 255, 255, .07); overflow: hidden; }
.progress i { display: block; height: 100%; background: linear-gradient(90deg, var(--accent), var(--blue)); transition: width .4s; }

/* results */
.res { display: grid; grid-template-columns: 1fr auto; gap: 4px 10px; padding: 8px 0; border-top: 1px solid var(--line); font-size: 12px; }
.res:first-child { border-top: 0; }
.res .rn { font-weight: 700; }
.res .rv { text-align: right; font-weight: 700; font-variant-numeric: tabular-nums; }
.res .rd { grid-column: 1 / -1; font-size: 11px; color: var(--muted); }
.post { display: grid; grid-template-columns: 96px 1fr 76px; gap: 8px; align-items: center; padding: 5px 0; font-size: 12px; }
.post .pv { text-align: right; font-variant-numeric: tabular-nums; font-size: 11.5px; }
.post .pv b { font-size: 13px; }
.post .up { color: var(--crit); }
.post .dn { color: var(--muted); }
.recip { display: grid; grid-template-columns: 30px 1fr auto; gap: 10px; align-items: center; padding: 9px 0; border-top: 1px solid var(--line); }
.recip:first-child { border-top: 0; }
.recip .av { width: 30px; height: 30px; border-radius: 8px; display: grid; place-items: center; background: rgba(77, 168, 255, .15); color: var(--blue); font-weight: 800; font-size: 12px; }
.pkg { display: flex; flex-direction: column; gap: 0; }
.pkg .pi { display: grid; grid-template-columns: 18px 1fr auto; gap: 8px; padding: 6px 0; border-top: 1px solid var(--line); font-size: 12px; align-items: center; }
.pkg .pi:first-child { border-top: 0; }
.pkg .pi .ck { color: var(--ok); font-weight: 800; }
.pkg .hash { font-family: ui-monospace, Consolas, monospace; font-size: 10px; color: var(--muted); }

/* feed */
.feed { display: flex; flex-direction: column; }
.ev { display: grid; grid-template-columns: 42px 10px 1fr; gap: 8px; padding: 6px 0; font-size: 12px; align-items: start; border-top: 1px solid var(--line); }
.ev:first-child { border-top: 0; }
.ev .tm { color: var(--muted); font-variant-numeric: tabular-nums; font-size: 11.5px; }
.ev .dot { margin-top: 5px; }
.ev.new .et { color: var(--accent); }
.ev .et { font-weight: 600; }
.ev .ed { color: var(--muted); font-size: 11px; }

/* charts */
.chart { width: 100%; height: auto; display: block; }
.chart text { font-family: "Pretendard", sans-serif; fill: var(--muted); font-size: 10px; }
.chart .ax { stroke: rgba(140, 186, 228, .14); }
.chart-legend { display: flex; flex-wrap: wrap; gap: 10px; font-size: 11px; color: var(--text-2); margin-top: 4px; }
.chart-legend span { display: inline-flex; align-items: center; gap: 5px; }
.chart-legend i { width: 12px; height: 3px; border-radius: 2px; display: inline-block; }
.chart-legend i.band { height: 9px; opacity: .45; }

/* region list */
.site { display: grid; grid-template-columns: 12px 1fr auto; gap: 10px; align-items: center; padding: 8px 4px; border-top: 1px solid var(--line); cursor: pointer; border-radius: 6px; }
.site:first-child { border-top: 0; }
.site:hover { background: rgba(255, 255, 255, .03); }
.site .sv { font-size: 11px; color: var(--muted); text-align: right; }

/* ---------- timeline ---------- */
.tl-scn { display: flex; flex-direction: column; gap: 6px; }
.scn-btn { display: flex; align-items: center; gap: 8px; white-space: nowrap; overflow: hidden; padding: 6px 10px; border-radius: 8px; border: 1px solid var(--line); background: rgba(255, 255, 255, .02); text-align: left; color: var(--text-2); font-size: 12px; }
.scn-btn b { font-weight: 700; color: var(--text); }
.scn-btn .sk { font-size: 10px; font-weight: 800; padding: 1px 6px; border-radius: 4px; background: rgba(255, 255, 255, .08); color: var(--muted); }
.scn-btn.on { border-color: rgba(47, 214, 195, .55); background: var(--accent-dim); }
.scn-btn.on .sk { background: var(--accent); color: #04121c; }
.tl-main { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.tl-steps { display: flex; gap: 2px; overflow: hidden; }
.tl-step { flex: 1 1 0; min-width: 0; display: flex; align-items: center; gap: 6px; border: 0; background: none; padding: 3px 4px; border-radius: 6px; color: var(--muted); font-size: 11.5px; font-weight: 600; white-space: nowrap; }
.tl-step .n { flex: none; width: 18px; height: 18px; border-radius: 50%; display: grid; place-items: center; font-size: 10px; border: 1px solid var(--line-2); }
.tl-step span.l { overflow: hidden; text-overflow: ellipsis; }
.tl-step.done { color: var(--text-2); }
.tl-step.done .n { background: rgba(47, 214, 195, .2); border-color: transparent; color: var(--accent); }
.tl-step.on { color: var(--text); background: rgba(255, 255, 255, .05); }
.tl-step.on .n { background: var(--accent); color: #04121c; border-color: transparent; }
.tl-step.gate .n { box-shadow: 0 0 0 2px rgba(255, 181, 71, .35); }
.tl-track { position: relative; height: 26px; cursor: pointer; }
.tl-rail { position: absolute; left: 0; right: 0; top: 11px; height: 4px; border-radius: 2px; background: rgba(255, 255, 255, .08); }
.tl-fill { position: absolute; left: 0; top: 11px; height: 4px; border-radius: 2px; background: linear-gradient(90deg, rgba(47, 214, 195, .4), var(--accent)); }
.tl-ticks { position: absolute; inset: 0; }
.tl-tick { position: absolute; top: 6px; width: 2px; height: 14px; border-radius: 1px; background: rgba(140, 186, 228, .35); transform: translateX(-1px); }
.tl-tick.crit { background: var(--crit); }
.tl-tick.warn { background: var(--warn); }
.tl-tick.gate { background: var(--warn); height: 18px; top: 4px; }
.tl-tick.cut { background: var(--accent); width: 2px; height: 8px; top: 9px; opacity: .8; }
.tl-hour { position: absolute; top: 19px; font-size: 9.5px; color: var(--muted); transform: translateX(-50%); white-space: nowrap; }
.tl-head { position: absolute; top: 3px; width: 14px; height: 20px; margin-left: -7px; border-radius: 4px; background: #fff; box-shadow: 0 0 0 3px rgba(47, 214, 195, .35), 0 2px 8px rgba(0, 0, 0, .5); }
.tl-ctrl { display: flex; align-items: center; gap: 6px; }
.tl-ctrl .ic { width: 34px; height: 34px; border-radius: 8px; border: 1px solid var(--line); background: rgba(255, 255, 255, .03); font-size: 17px; line-height: 1; }
.tl-ctrl .play { height: 38px; padding: 0 16px; border-radius: 9px; border: 0; background: linear-gradient(180deg, #34e0cc, #1fb4a4); color: #03141a; font-weight: 800; font-size: 13px; min-width: 150px; }
.tl-ctrl .play.pause { background: linear-gradient(180deg, #2b4560, #1d3349); color: var(--text); }
.tl-ctrl .speed { height: 34px; padding: 0 10px; border-radius: 8px; border: 1px solid var(--line); background: rgba(255, 255, 255, .03); font-weight: 700; font-size: 12px; }
.tl-ctrl .auto { display: flex; align-items: center; gap: 5px; font-size: 11.5px; color: var(--text-2); margin-left: 4px; white-space: nowrap; }
.tl-ctrl .auto input { accent-color: var(--accent); }

/* ---------- modal / toast / boot ---------- */
.modal { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; background: rgba(2, 8, 15, .62); backdrop-filter: blur(3px); }
.modal-card { width: min(560px, calc(100vw - 40px)); max-height: calc(100vh - 80px); overflow: auto; background: var(--panel-solid); border: 1px solid var(--line-2); border-radius: 14px; box-shadow: var(--shadow); padding: 18px 20px; }
.modal-card h2 { margin: 0 0 4px; font-size: 17px; }
.modal-card.report { width: min(980px, calc(100vw - 60px)); height: calc(100vh - 70px); display: flex; flex-direction: column; gap: 12px; }
.modal-card.report iframe { flex: 1; width: 100%; border: 0; border-radius: 8px; background: #fff; }
.modal-card .actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 14px; }
.toast-stack { position: fixed; right: calc(var(--panel-w) + 16px); top: calc(var(--header-h) + 96px); z-index: 40; display: flex; flex-direction: column; gap: 8px; width: 320px; pointer-events: none; }
.toast { pointer-events: auto; display: flex; gap: 10px; padding: 10px 12px; border-radius: 10px; background: rgba(10, 24, 39, .96); border: 1px solid var(--line-2); box-shadow: var(--shadow); font-size: 12px; animation: slidein .3s ease; }
.toast .ti { flex: none; width: 4px; border-radius: 2px; background: var(--accent); }
.toast.crit .ti { background: var(--crit); }
.toast.warn .ti { background: var(--warn); }
.toast.ok .ti { background: var(--ok); }
.toast.data .ti { background: var(--accent); }
.toast b { display: block; font-size: 12.5px; }
.toast span { color: var(--text-2); }
.toast.out { animation: fadeout .4s ease forwards; }
.boot { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; background: radial-gradient(circle at 50% 45%, #0d2338, #050c15 70%); transition: opacity .6s; }
.boot.done { opacity: 0; pointer-events: none; }
.boot-inner { display: flex; flex-direction: column; align-items: center; gap: 10px; color: var(--text-2); }
.boot-inner strong { font-size: 22px; color: var(--text); }
.boot-mark { width: 54px; height: 54px; border-radius: 50%; border: 3px solid rgba(47, 214, 195, .2); border-top-color: var(--accent); animation: spin 1s linear infinite; }

@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(255, 107, 94, .65); } 70% { box-shadow: 0 0 0 9px rgba(255, 107, 94, 0); } 100% { box-shadow: 0 0 0 0 rgba(255, 107, 94, 0); } }
@keyframes glow { 0%, 100% { box-shadow: 0 0 0 0 rgba(47, 214, 195, 0); } 50% { box-shadow: 0 0 0 4px rgba(47, 214, 195, .15); } }
@keyframes rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@keyframes slidein { from { opacity: 0; transform: translateX(20px); } to { opacity: 1; transform: none; } }
@keyframes fadeout { to { opacity: 0; transform: translateX(20px); } }
@keyframes flash { 0% { background: rgba(47, 214, 195, .18); } 100% { background: transparent; } }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- compact screens (1366×768) ---------- */
@media (max-width: 1500px), (max-height: 820px) {
  :root { --panel-w: 384px; --rail-w: 68px; --tl-h: 88px; --header-h: 50px; }
  body { font-size: 12.5px; }
  .brand { min-width: 170px; }
  .brand-text span { display: none; }
  .workspace .ws-label { display: none; }
  .kpi { padding: 7px 10px; }
  .kpi .v { font-size: 18px; }
  .kpi.title .v { font-size: 15px; }
  .kpi .s { display: none; }
  .kpi:nth-child(n+5) { display: none; }
  .timeline { grid-template-columns: 210px 1fr auto; gap: 12px; padding: 8px 12px; }
  .tl-ctrl .play { min-width: 120px; padding: 0 12px; }
  .tl-step { font-size: 11px; }
  .layer-panel { top: 82px; width: 196px; }
  .map-tools { top: 82px; }
  .caption { width: min(520px, calc(100% - 250px)); }
  .scn-btn .muted { display: none; }
  .pn-body { padding: 4px 14px 18px; }
  .pn-head { padding: 12px 14px 8px; }
  .toast-stack { right: calc(var(--panel-w) + 12px); top: calc(var(--header-h) + 82px); width: 290px; }
}
@media (max-width: 1280px) {
  .role-select span, .sim-date { display: none; }
  .workspace { display: none; }
  .tl-ctrl .auto { display: none; }
}

/* ---------- data feeds & step-by-step tracing ---------- */
.feeds { display: flex; flex-direction: column; }
.feedrow { display: grid; grid-template-columns: 12px 1fr auto; gap: 10px; align-items: center; padding: 6px 4px; border-top: 1px solid var(--line); border-radius: 6px; }
.feedrow:first-child { border-top: 0; }
.feedrow .t { font-weight: 600; font-size: 12px; }
.feedrow .d { font-size: 10.5px; color: var(--muted); }
.feedrow .fc { text-align: right; font-weight: 700; font-size: 12px; font-variant-numeric: tabular-nums; }
.feedrow .fc small { display: block; font-size: 10px; font-weight: 500; color: var(--muted); }
.feedrow.hot { background: rgba(47, 214, 195, .08); }
.live { width: 9px; height: 9px; border-radius: 50%; background: var(--c); box-shadow: 0 0 0 0 var(--c); animation: live 2.4s ease-out infinite; }
.feedrow:nth-child(3n) .live { animation-delay: .8s; }
.feedrow:nth-child(3n+1) .live { animation-delay: 1.6s; }
@keyframes live { 0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--c) 70%, transparent); } 70% { box-shadow: 0 0 0 7px transparent; } 100% { box-shadow: 0 0 0 0 transparent; } }
.trace-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; }
.spark { display: flex; align-items: flex-end; gap: 4px; height: 44px; width: 120px; }
.spark i { flex: 1; border-radius: 3px 3px 0 0; background: rgba(255, 255, 255, .1); }
.spark i.on { background: linear-gradient(180deg, var(--warn), rgba(255, 181, 71, .35)); }
.cuts { display: flex; flex-direction: column; gap: 6px; }
.cut { display: grid; grid-template-columns: 28px 1fr; gap: 10px; padding: 10px 10px 10px 8px; border-radius: 10px; border: 1px solid var(--line); background: var(--card); }
.cut.now { border-color: rgba(47, 214, 195, .6); background: linear-gradient(180deg, rgba(47, 214, 195, .09), var(--card)); animation: glow 1.8s ease-in-out infinite; }
.cut.wait { opacity: .5; }
.cut-n { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; font-size: 12px; font-weight: 800; background: rgba(255, 255, 255, .08); color: var(--muted); }
.cut.done .cut-n { background: rgba(47, 214, 195, .2); color: var(--accent); }
.cut.now .cut-n { background: var(--accent); color: #04121c; }
.cut-t { display: flex; justify-content: space-between; align-items: center; gap: 8px; font-weight: 700; font-size: 12.5px; }
.cut-c { font-size: 11.5px; font-weight: 600; color: var(--muted); white-space: nowrap; font-variant-numeric: tabular-nums; }
.cut-c b { color: var(--warn); font-size: 14px; }
.chips { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 5px; }
.chip { font-size: 10.5px; padding: 1px 7px; border-radius: 999px; background: rgba(77, 168, 255, .12); color: #a9d2ff; border: 1px solid rgba(77, 168, 255, .25); }
.cut-f { font-size: 11.5px; color: var(--text-2); margin-top: 6px; line-height: 1.5; }
.cut-extra { font-size: 11px; color: #9fe6ff; margin-top: 4px; }
.cut-o { font-size: 11px; color: var(--muted); margin-top: 4px; }
.cut-o::before { content: "× "; color: var(--crit); font-weight: 800; }
