/* ============================================================
   LOGISENSE — "주·야간 이중 조도 관제 계기판" 디자인 시스템
   야간(암실 발광 계기판) / 주간(종이 관제일지) — 같은 마크업, 토큰만 교체
   수제 스타일시트 (Tailwind 미사용)
   ============================================================ */

/* ---------- 웹폰트: IBM Plex Mono (fontsource 정확 버전 핀 · latin 400/600 · swap) ---------- */
@font-face {
  font-family: 'IBM Plex Mono';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url(https://cdn.jsdelivr.net/npm/@fontsource/ibm-plex-mono@5.1.0/files/ibm-plex-mono-latin-400-normal.woff2) format('woff2');
}
@font-face {
  font-family: 'IBM Plex Mono';
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url(https://cdn.jsdelivr.net/npm/@fontsource/ibm-plex-mono@5.1.0/files/ibm-plex-mono-latin-600-normal.woff2) format('woff2');
}

/* ---------- 토큰: 야간 관제(Night Watch) = 기본값 (noscript 폴백 포함) ---------- */
:root {
  color-scheme: dark;

  --bg-0: #070B12;
  --bg-1: #0D141F;
  --bg-2: #14202F;
  --line: #1C2A3E;
  --line-strong: #2C3E58;
  --ink-hi: #E8EEF7;
  --ink: #9DAFC6;
  --ink-dim: #7186A3;           /* AA 승급: #5C7089 → #7186A3 (≈5.2:1) */

  --live: #2DD4BF;              /* 그래픽 */
  --live-text: #2DD4BF;         /* 텍스트·인터랙티브 (다크는 겸용) */
  --live-glow: rgba(45, 212, 191, .25);
  --live-line: rgba(45, 212, 191, .45);
  --live-tint: rgba(45, 212, 191, .08);
  --live-flash: rgba(45, 212, 191, .12);
  --live-hover: #43E0CD;
  --on-accent: #04211D;
  --on-alert: #2B0A11;

  /* 상태색 — 다크는 그래픽=텍스트 겸용 (#070B12 대비 7:1+) */
  --st-moving: #38BDF8;      --st-moving-text: #38BDF8;
  --st-moving-bg: rgba(56, 189, 248, .12);   --st-moving-line: rgba(56, 189, 248, .3);
  --st-done: #34D399;        --st-done-text: #34D399;
  --st-done-bg: rgba(52, 211, 153, .12);     --st-done-line: rgba(52, 211, 153, .3);
  --st-delay: #FBBF24;       --st-delay-text: #FBBF24;
  --st-delay-bg: rgba(251, 191, 36, .12);    --st-delay-line: rgba(251, 191, 36, .3);
  --st-alert: #FB7185;       --st-alert-text: #FB7185;
  --st-alert-bg: rgba(251, 113, 133, .12);   --st-alert-line: rgba(251, 113, 133, .3);
  --st-plan: #A78BFA;        --st-plan-text: #A78BFA;
  --st-plan-bg: rgba(167, 139, 250, .12);    --st-plan-line: rgba(167, 139, 250, .3);
  --glow-delay: rgba(251, 191, 36, .3);
  --glow-alert: rgba(251, 113, 133, .3);

  /* 지도 */
  --map-land: #0C1420;
  --map-metro: #122032;
  --map-hover: #182940;
  --map-border: #1E2E44;
  --map-halo: rgba(7, 11, 18, .9);
  --hub-fill: #0E2B29;
  --route: #33527C;

  /* 표면 장치 */
  --dot: rgba(157, 175, 198, .045);
  --track: rgba(28, 42, 62, .6);
  --mark-bg: rgba(45, 212, 191, .22);
  --sel: rgba(45, 212, 191, .25);
  --glass: rgba(13, 20, 31, .92);
  --backdrop: rgba(3, 6, 10, .62);
  --scroll-thumb: #223450;
  --scroll-thumb-hover: #2C3E58;
  --shadow-panel: none;
  --shadow-pop: 0 12px 32px rgba(0, 0, 0, .5);

  --mono: 'IBM Plex Mono', ui-monospace, 'SF Mono', 'Cascadia Mono', 'Roboto Mono', monospace;
  --sans: 'Pretendard', -apple-system, BlinkMacSystemFont, 'Apple SD Gothic Neo', 'Malgun Gothic', sans-serif;
  --r-panel: 6px;
  --r-ctl: 4px;
  --r-badge: 3px;
}

/* ---------- 토큰: 주간 관제(Day Watch) — 종이 관제일지 ---------- */
:root[data-theme="light"] {
  color-scheme: light;

  --bg-0: #EEF2F7;
  --bg-1: #FFFFFF;
  --bg-2: #E2E9F2;
  --line: #D3DCE8;
  --line-strong: #AEBDD0;
  --ink-hi: #0F1826;
  --ink: #3A4A61;
  --ink-dim: #5B6C84;

  --live: #0D9488;
  --live-text: #0E7A70;
  --live-glow: rgba(13, 148, 136, .15);
  --live-line: rgba(13, 148, 136, .45);
  --live-tint: rgba(13, 148, 136, .08);
  --live-flash: rgba(13, 148, 136, .1);
  --live-hover: #0FA396;
  --on-accent: #FFFFFF;
  --on-alert: #FFFFFF;

  /* 상태색 3토큰: 그래픽 ≥3:1 / 배지 텍스트 ≥4.5:1 / 틴트 */
  --st-moving: #0284C7;      --st-moving-text: #075985;
  --st-moving-bg: rgba(2, 132, 199, .1);     --st-moving-line: rgba(2, 132, 199, .35);
  --st-done: #059669;        --st-done-text: #065F46;
  --st-done-bg: rgba(5, 150, 105, .1);       --st-done-line: rgba(5, 150, 105, .35);
  --st-delay: #B45309;       --st-delay-text: #92400E;
  --st-delay-bg: rgba(180, 83, 9, .1);       --st-delay-line: rgba(180, 83, 9, .35);
  --st-alert: #E11D48;       --st-alert-text: #9F1239;
  --st-alert-bg: rgba(225, 29, 72, .1);      --st-alert-line: rgba(225, 29, 72, .35);
  --st-plan: #7C3AED;        --st-plan-text: #5B21B6;
  --st-plan-bg: rgba(124, 58, 237, .1);      --st-plan-line: rgba(124, 58, 237, .35);
  --glow-delay: rgba(180, 83, 9, .18);
  --glow-alert: rgba(225, 29, 72, .18);

  --map-land: #DEE7F1;
  --map-metro: #D3DFEC;
  --map-hover: #CBD9E9;
  --map-border: #B9C6D8;
  --map-halo: rgba(238, 242, 247, .9);
  --hub-fill: #D3EDE8;
  --route: #93A9C7;

  --dot: rgba(15, 24, 38, .06);
  --track: rgba(211, 220, 232, .7);
  --mark-bg: rgba(13, 148, 136, .16);
  --sel: rgba(13, 148, 136, .22);
  --glass: rgba(255, 255, 255, .92);
  --backdrop: rgba(15, 24, 38, .38);
  --scroll-thumb: #B9C6D8;
  --scroll-thumb-hover: #AEBDD0;
  --shadow-panel: 0 1px 2px rgba(15, 24, 38, .06), 0 4px 16px rgba(15, 24, 38, .05);
  --shadow-pop: 0 12px 32px rgba(15, 24, 38, .18);
}

/* JS가 꺼진 브라우저: data-theme 미부착 시 OS 선호 추종 */
@media (prefers-color-scheme: light) {
  :root:not([data-theme]) {
    color-scheme: light;
    --bg-0: #EEF2F7; --bg-1: #FFFFFF; --bg-2: #E2E9F2;
    --line: #D3DCE8; --line-strong: #AEBDD0;
    --ink-hi: #0F1826; --ink: #3A4A61; --ink-dim: #5B6C84;
    --live: #0D9488; --live-text: #0E7A70;
    --live-glow: rgba(13, 148, 136, .15); --live-line: rgba(13, 148, 136, .45);
    --live-tint: rgba(13, 148, 136, .08); --live-flash: rgba(13, 148, 136, .1);
    --live-hover: #0FA396; --on-accent: #FFFFFF; --on-alert: #FFFFFF;
    --st-moving: #0284C7; --st-moving-text: #075985; --st-moving-bg: rgba(2, 132, 199, .1); --st-moving-line: rgba(2, 132, 199, .35);
    --st-done: #059669; --st-done-text: #065F46; --st-done-bg: rgba(5, 150, 105, .1); --st-done-line: rgba(5, 150, 105, .35);
    --st-delay: #B45309; --st-delay-text: #92400E; --st-delay-bg: rgba(180, 83, 9, .1); --st-delay-line: rgba(180, 83, 9, .35);
    --st-alert: #E11D48; --st-alert-text: #9F1239; --st-alert-bg: rgba(225, 29, 72, .1); --st-alert-line: rgba(225, 29, 72, .35);
    --st-plan: #7C3AED; --st-plan-text: #5B21B6; --st-plan-bg: rgba(124, 58, 237, .1); --st-plan-line: rgba(124, 58, 237, .35);
    --glow-delay: rgba(180, 83, 9, .18); --glow-alert: rgba(225, 29, 72, .18);
    --map-land: #DEE7F1; --map-metro: #D3DFEC; --map-hover: #CBD9E9; --map-border: #B9C6D8;
    --map-halo: rgba(238, 242, 247, .9); --hub-fill: #D3EDE8; --route: #93A9C7;
    --dot: rgba(15, 24, 38, .06); --track: rgba(211, 220, 232, .7);
    --mark-bg: rgba(13, 148, 136, .16); --sel: rgba(13, 148, 136, .22);
    --glass: rgba(255, 255, 255, .92); --backdrop: rgba(15, 24, 38, .38);
    --scroll-thumb: #B9C6D8; --scroll-thumb-hover: #AEBDD0;
    --shadow-panel: 0 1px 2px rgba(15, 24, 38, .06), 0 4px 16px rgba(15, 24, 38, .05);
    --shadow-pop: 0 12px 32px rgba(15, 24, 38, .18);
  }
}

/* 테마 전환 크로스페이드 — 토글 시 200ms만 부착 (상시 transition 금지) */
html.theme-anim *,
html.theme-anim *::before,
html.theme-anim *::after {
  transition: background-color .2s ease, border-color .2s ease, color .2s ease,
    fill .2s ease, stroke .2s ease, box-shadow .2s ease !important;
}

/* ---------- 리셋·베이스 ---------- */
* { margin: 0; padding: 0; box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--sans);
  font-size: 12.5px;
  line-height: 1.55;
  color: var(--ink);
  background-color: var(--bg-0);
  background-image: radial-gradient(var(--dot) 1px, transparent 1px);
  background-size: 6px 6px;
  word-break: keep-all;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
input, select { font: inherit; }
ul, ol { list-style: none; }
svg { display: block; }
::selection { background: var(--sel); color: var(--ink-hi); }

::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: var(--bg-0); }
::-webkit-scrollbar-thumb { background: var(--scroll-thumb); border: 2px solid var(--bg-0); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--scroll-thumb-hover); }

:focus-visible { outline: 2px solid var(--live); outline-offset: 2px; border-radius: 2px; }

.mono { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.code-label { font-family: var(--mono); font-size: 11px; text-transform: uppercase; letter-spacing: .08em; }
.vh { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

.skip-link {
  position: absolute; left: 8px; top: -48px; z-index: 200;
  background: var(--live); color: var(--on-accent); font-weight: 700;
  padding: 8px 14px; border-radius: var(--r-ctl); transition: top .15s;
}
.skip-link:focus { top: 8px; }

.lucide { width: 16px; height: 16px; stroke: currentColor; stroke-width: 2; fill: none; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.lucide.sm { width: 13px; height: 13px; }

/* 패널 등장 — CSS 단독 (JS 없이도 콘텐츠 즉시 노출, 모션은 장식) */
@media (prefers-reduced-motion: no-preference) {
  [data-reveal] { animation: reveal .5s cubic-bezier(.2, .7, .3, 1) backwards; }
}
@keyframes reveal { from { opacity: 0; transform: translateY(5px); } }

/* ---------- 데모 고지 배너 ---------- */
.demo-banner {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: center;
  gap: 4px 12px; padding: 8px 16px; text-align: center;
  background: var(--bg-2); border-bottom: 1px solid var(--line-strong);
  color: var(--ink); font-size: 12px;
}
.demo-banner strong { color: var(--ink-hi); font-weight: 700; }
.demo-banner a { color: var(--live-text); font-weight: 600; text-decoration: none; }
.demo-banner a:hover { text-decoration: underline; text-underline-offset: 3px; }

/* ---------- 셸 레이아웃 ---------- */
.shell { display: flex; min-height: 100vh; }
.shell-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

/* ---------- 사이드바 (xl 이상 상시) ---------- */
.sidebar {
  display: none;
  width: 240px; flex: none;
  background: var(--bg-1); border-right: 1px solid var(--line);
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
}
@media (min-width: 1280px) { .sidebar { display: flex; flex-direction: column; } }

.side-brand {
  display: flex; align-items: center; gap: 10px;
  height: 56px; padding: 0 16px; border-bottom: 1px solid var(--line);
  text-decoration: none; flex: none;
}
.brand-mark {
  width: 28px; height: 28px; border-radius: var(--r-ctl); flex: none;
  background: linear-gradient(135deg, #0E7A6E, #14524B);
  border: 1px solid rgba(45, 212, 191, .4);
  display: grid; place-items: center; color: #2DD4BF;
}
.brand-word { font-family: var(--mono); font-size: 13px; font-weight: 700; letter-spacing: .08em; color: var(--ink-hi); }
.brand-sub { font-size: 10px; color: var(--ink-dim); display: block; letter-spacing: 0; font-family: var(--sans); font-weight: 400; }

.side-nav { padding: 12px 0 20px; }
.side-sect { padding: 14px 16px 6px; font-size: 11px; font-weight: 700; color: var(--ink-dim); }
.side-link {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 16px; font-size: 12.5px; font-weight: 500;
  color: var(--ink); text-decoration: none;
  border-left: 3px solid transparent;
  transition: background-color .15s ease, color .15s ease;
}
.side-link:hover { background: var(--bg-2); color: var(--ink-hi); }
.side-link.active {
  border-left-color: var(--live);
  background: linear-gradient(90deg, var(--live-tint), transparent 70%);
  color: var(--ink-hi); font-weight: 700;
}
.side-link .lucide { width: 15px; height: 15px; color: var(--ink-dim); }
.side-link.active .lucide { color: var(--live-text); }

.side-foot {
  margin: auto 12px 16px; padding: 12px;
  border: 1px solid var(--line); border-radius: var(--r-panel);
  background: var(--bg-0); font-size: 11px; color: var(--ink-dim);
}
.side-foot p { display: flex; align-items: center; gap: 6px; margin-top: 6px; }
.side-foot .tit { color: var(--ink); font-weight: 700; margin-top: 0; }

/* ---------- 모바일 드로어 ---------- */
.drawer {
  position: fixed; top: 0; bottom: 0; left: 0; z-index: 90;
  width: min(272px, 84vw);
  background: var(--bg-1); border-right: 1px solid var(--line-strong);
  transform: translateX(-103%); transition: transform .26s cubic-bezier(.2, .7, .3, 1);
  overflow-y: auto; display: flex; flex-direction: column;
}
.drawer.open { transform: none; }
.drawer-head { display: flex; align-items: center; justify-content: space-between; height: 56px; padding: 0 8px 0 16px; border-bottom: 1px solid var(--line); flex: none; }
.backdrop {
  position: fixed; inset: 0; z-index: 85;
  background: var(--backdrop);
  opacity: 0; visibility: hidden; transition: opacity .24s, visibility .24s;
}
.backdrop.show { opacity: 1; visibility: visible; }

/* ---------- 앱바 ---------- */
.appbar {
  position: sticky; top: 0; z-index: 40;
  display: flex; align-items: center; gap: 10px;
  height: 56px; padding: 0 12px 0 16px;
  background: var(--glass); backdrop-filter: blur(6px);
  border-bottom: 1px solid var(--line);
}
.appbar-brand { display: flex; align-items: center; gap: 8px; text-decoration: none; }
.appbar-title { font-size: 13px; font-weight: 700; color: var(--ink-hi); white-space: nowrap; }
.appbar-sep { width: 1px; height: 18px; background: var(--line-strong); flex: none; }

.icon-btn {
  position: relative; display: grid; place-items: center;
  width: 34px; height: 34px; border-radius: var(--r-ctl);
  border: 1px solid var(--line); background: var(--bg-1); color: var(--ink);
  transition: background-color .15s ease, color .15s ease, border-color .15s ease;
}
.icon-btn:hover { background: var(--bg-2); color: var(--ink-hi); border-color: var(--line-strong); }

/* 테마 토글 — 해/달 아이콘 morph (opacity+회전 크로스) */
#theme-toggle { overflow: hidden; }
#theme-toggle .lucide { position: absolute; transition: opacity .18s ease, transform .18s ease; }
#theme-toggle .ic-sun { opacity: 1; transform: rotate(0deg) scale(1); }
#theme-toggle .ic-moon { opacity: 0; transform: rotate(-180deg) scale(.55); }
[data-theme="light"] #theme-toggle .ic-sun { opacity: 0; transform: rotate(180deg) scale(.55); }
[data-theme="light"] #theme-toggle .ic-moon { opacity: 1; transform: rotate(0deg) scale(1); }
@media (prefers-color-scheme: light) {
  :root:not([data-theme]) #theme-toggle .ic-sun { opacity: 0; transform: rotate(180deg) scale(.55); }
  :root:not([data-theme]) #theme-toggle .ic-moon { opacity: 1; transform: rotate(0deg) scale(1); }
}

.live-badge {
  display: inline-flex; align-items: center; gap: 7px;
  height: 24px; padding: 0 10px;
  border: 1px solid var(--live-line); border-radius: var(--r-badge);
  background: var(--live-tint);
  font-family: var(--mono); font-size: 11px; font-weight: 700;
  letter-spacing: .08em; color: var(--live-text); white-space: nowrap;
}
.live-badge.resync { color: var(--st-delay-text); border-color: var(--st-delay-line); background: var(--st-delay-bg); }
.live-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--live); box-shadow: 0 0 12px var(--live-glow); animation: livePulse 1.8s ease-in-out infinite; flex: none; }
.live-badge.resync .live-dot { background: var(--st-delay); box-shadow: none; animation: none; }
@keyframes livePulse { 0%, 100% { opacity: 1; } 50% { opacity: .35; } }

.last-recv { font-size: 11px; color: var(--ink-dim); white-space: nowrap; }
.last-recv b { font-family: var(--mono); font-variant-numeric: tabular-nums; font-weight: 600; color: var(--ink); }
.app-clock { font-family: var(--mono); font-variant-numeric: tabular-nums; font-size: 12px; color: var(--ink-hi); white-space: nowrap; }
.app-clock small { color: var(--ink-dim); font-size: 10px; letter-spacing: .08em; }

.bell-count {
  position: absolute; top: -5px; right: -5px;
  min-width: 16px; height: 16px; padding: 0 4px;
  border-radius: 8px; background: var(--st-alert); color: var(--on-alert);
  font-family: var(--mono); font-size: 10px; font-weight: 700; line-height: 16px; text-align: center;
}
.bell-count.pop { animation: countPop .3s ease-out; }
.bell-count.zero { display: none; }
@keyframes countPop { 0% { transform: scale(.6); } 60% { transform: scale(1.25); } 100% { transform: scale(1); } }

.operator { display: flex; align-items: center; gap: 8px; padding-left: 2px; }
.op-avatar {
  width: 30px; height: 30px; border-radius: var(--r-ctl); flex: none;
  background: var(--bg-2); border: 1px solid var(--line-strong);
  display: grid; place-items: center; font-size: 12px; font-weight: 700; color: var(--ink-hi);
}
.op-meta { line-height: 1.25; }
.op-meta b { display: block; font-size: 11.5px; color: var(--ink-hi); }
.op-meta span { font-size: 10.5px; color: var(--ink-dim); }

/* 알림 드롭다운 */
.notif-wrap { position: relative; }
.notif-dd {
  position: absolute; right: 0; top: calc(100% + 8px); z-index: 60;
  width: 296px; max-width: 84vw;
  background: var(--bg-2); border: 1px solid var(--line-strong); border-radius: var(--r-panel);
  box-shadow: var(--shadow-pop);
  opacity: 0; visibility: hidden; transform: translateY(-4px);
  transition: opacity .18s, transform .18s, visibility .18s;
}
.notif-dd.open { opacity: 1; visibility: visible; transform: none; }
.notif-dd-h { display: flex; align-items: center; justify-content: space-between; padding: 10px 14px; border-bottom: 1px solid var(--line); font-size: 12px; font-weight: 700; color: var(--ink-hi); }
.notif-dd-h span { font-family: var(--mono); font-size: 10.5px; color: var(--ink-dim); font-weight: 400; }
.notif-list { max-height: 320px; overflow-y: auto; }
.notif-item { display: flex; gap: 10px; padding: 10px 14px; border-bottom: 1px solid var(--line); }
.notif-item:last-child { border-bottom: 0; }
.notif-item .nbar { width: 3px; border-radius: 2px; flex: none; background: var(--st-alert); }
.notif-item.warn .nbar { background: var(--st-delay); }
.notif-item.info .nbar { background: var(--st-moving); }
.notif-item p { font-size: 12px; color: var(--ink); }
.notif-item time { font-family: var(--mono); font-size: 10.5px; color: var(--ink-dim); }
.notif-empty { padding: 20px 14px; text-align: center; color: var(--ink-dim); font-size: 12px; }

/* ---------- 이벤트 티커 ---------- */
.ticker {
  display: flex; align-items: center; gap: 10px;
  height: 32px; padding: 0 12px 0 16px;
  background: var(--bg-1); border-bottom: 1px solid var(--line);
  overflow: hidden;
}
.ticker-tag { font-family: var(--mono); font-size: 10px; font-weight: 700; letter-spacing: .08em; color: var(--ink-dim); flex: none; }
.ticker-view { flex: 1; min-width: 0; overflow: hidden; position: relative; height: 100%; }
.ticker-item {
  position: absolute; inset: 0; display: flex; align-items: center; gap: 8px;
  font-size: 12px; color: var(--ink); white-space: nowrap;
}
.ticker-item .sev-dot { width: 6px; height: 6px; border-radius: 50%; flex: none; }
.ticker-item time { font-family: var(--mono); font-variant-numeric: tabular-nums; font-size: 11px; color: var(--ink-dim); flex: none; }
.ticker-item .txt { overflow: hidden; text-overflow: ellipsis; }
.ticker-item.out { animation: tickOut .3s ease-in forwards; }
.ticker-item.in { animation: tickIn .3s ease-out; }
@keyframes tickOut { to { transform: translateX(-24px); opacity: 0; } }
@keyframes tickIn { from { transform: translateX(24px); opacity: 0; } }
.ticker-btn {
  display: grid; place-items: center; width: 24px; height: 24px; flex: none;
  border: 1px solid var(--line); border-radius: var(--r-ctl); color: var(--ink-dim); background: transparent;
  transition: color .15s ease, border-color .15s ease;
}
.ticker-btn:hover { color: var(--ink-hi); border-color: var(--line-strong); }
.ticker-btn[aria-pressed="true"] { color: var(--live-text); border-color: var(--live-line); }

.sev-dot.info { background: var(--st-moving); }
.sev-dot.warn { background: var(--st-delay); }
.sev-dot.alert { background: var(--st-alert); }

/* ---------- 콘텐츠 그리드 ---------- */
.content {
  flex: 1; width: 100%; max-width: 1640px;
  padding: 16px; display: flex; flex-direction: column; gap: 16px;
}

/* ---------- 패널 공통 ---------- */
.panel {
  position: relative;
  background: var(--bg-1);
  border: 1px solid var(--line);
  border-radius: var(--r-panel);
  box-shadow: var(--shadow-panel);
}
/* L자 코너 틱 (계기판 인용) */
.panel::before, .panel::after {
  content: ""; position: absolute; width: 9px; height: 9px; pointer-events: none; z-index: 2;
}
.panel::before { top: -1px; left: -1px; border-top: 1px solid var(--line-strong); border-left: 1px solid var(--line-strong); border-top-left-radius: var(--r-panel); }
.panel::after { bottom: -1px; right: -1px; border-bottom: 1px solid var(--line-strong); border-right: 1px solid var(--line-strong); border-bottom-right-radius: var(--r-panel); }

.panel-h {
  display: flex; align-items: center; gap: 10px;
  min-height: 40px; padding: 0 12px 0 16px;
  background: var(--bg-2); border-bottom: 1px solid var(--line);
  border-radius: var(--r-panel) var(--r-panel) 0 0;
}
.panel-t { font-size: 15px; font-weight: 700; color: var(--ink-hi); white-space: nowrap; }
.panel-meta { font-family: var(--mono); font-variant-numeric: tabular-nums; font-size: 11px; letter-spacing: .06em; color: var(--ink-dim); white-space: nowrap; }
.panel-spacer { flex: 1; }
.panel-b { padding: 16px; }

/* ---------- KPI 스트립 ---------- */
.kpi-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; }
@media (min-width: 768px) { .kpi-grid { grid-template-columns: repeat(3, 1fr); } }
@media (min-width: 1440px) { .kpi-grid { grid-template-columns: repeat(6, 1fr); } }

.kpi { padding: 13px 16px 10px; overflow: hidden; transition: border-color .18s ease; }
.kpi:hover { border-color: var(--live-line); }
.kpi-label { display: flex; align-items: center; gap: 6px; font-size: 11px; font-weight: 600; color: var(--ink-dim); }
.kpi-label .kdot { width: 6px; height: 6px; border-radius: 2px; flex: none; }
.kpi-value {
  margin-top: 4px;
  font-family: var(--mono); font-variant-numeric: tabular-nums;
  font-size: 26px; font-weight: 600; line-height: 1.15; color: var(--ink-hi);
  white-space: nowrap;
}
.kpi-value small { font-family: var(--sans); font-size: 12px; font-weight: 500; color: var(--ink-dim); margin-left: 2px; }
.kpi-delta { margin-top: 2px; font-family: var(--mono); font-variant-numeric: tabular-nums; font-size: 11px; color: var(--ink-dim); }
.kpi-delta b { font-weight: 600; }
.kpi-delta .pos { color: var(--st-done-text); }
.kpi-delta .neg { color: var(--st-alert-text); }
.kpi-spark { margin: 8px -16px -10px; height: 26px; }
.kpi-spark svg { width: 100%; height: 26px; }
.kpi.flash { animation: kpiFlash .4s ease-out; }
@keyframes kpiFlash { 0% { background-color: var(--flash-c, var(--st-moving-bg)); } 100% { background-color: var(--bg-1); } }

/* ---------- 메인 2열 ---------- */
.main-grid { display: grid; grid-template-columns: 1fr; gap: 16px; }
@media (min-width: 1280px) { .main-grid { grid-template-columns: 2fr 1fr; align-items: stretch; } }

/* ---------- 지도 패널 ---------- */
.map-stage { position: relative; background: var(--bg-0); border-radius: 0 0 var(--r-panel) var(--r-panel); overflow: hidden; }
.map-stage > svg { width: 100%; height: auto; max-height: 68vh; margin: 0 auto; }
#map-zoom { transform-box: view-box; transform-origin: 50% 50%; transition: transform .25s ease; }

#krmap path {
  fill: var(--map-land); stroke: var(--map-border); stroke-width: 1;
  vector-effect: non-scaling-stroke; transition: fill .2s;
}
#krmap path.metro { fill: var(--map-metro); }
#krmap path:hover { fill: var(--map-hover); }

.route {
  fill: none; stroke: var(--route); stroke-width: 1.7; opacity: .6;
  stroke-dasharray: 5 7; vector-effect: non-scaling-stroke;
  animation: dashflow 1.7s linear infinite;
  transition: opacity .2s;
}
@keyframes dashflow { to { stroke-dashoffset: -12; } }
.route.is-hidden { opacity: 0; }

/* 거점 마커 */
.hub { cursor: pointer; }
.hub .hub-shape {
  fill: var(--bg-2); stroke: var(--ink-dim); stroke-width: 1.6;
  vector-effect: non-scaling-stroke;
  transform-box: fill-box; transform-origin: center;
  transition: transform .18s, stroke .18s, filter .18s;
}
.hub.tier-hub .hub-shape { stroke: var(--live); fill: var(--hub-fill); }
.hub:hover .hub-shape, .hub:focus-visible .hub-shape {
  transform: scale(1.3); stroke: var(--ink-hi);
  filter: drop-shadow(0 0 6px var(--live-glow));
}
.hub text {
  font-family: var(--sans); font-size: 11.5px; font-weight: 600; fill: var(--ink);
  paint-order: stroke; stroke: var(--map-halo); stroke-width: 3px;
  pointer-events: none;
}
.hub:focus-visible { outline: none; }

/* 차량 마커 */
.veh { cursor: pointer; }
.veh .veh-hit { fill: transparent; }
.veh .veh-arrow {
  fill: var(--st-moving); stroke: var(--map-halo); stroke-width: .8;
  filter: drop-shadow(0 0 5px var(--live-glow));
}
.veh.st-delay .veh-arrow { fill: var(--st-delay); filter: drop-shadow(0 0 5px var(--glow-delay)); }
.veh.st-alert .veh-arrow { fill: var(--st-alert); filter: drop-shadow(0 0 5px var(--glow-alert)); }
.veh .veh-ring {
  fill: none; stroke: var(--st-delay); stroke-width: 1.4; opacity: 0;
  transform-box: fill-box; transform-origin: center;
}
.veh.st-delay .veh-ring, .veh.st-alert .veh-ring { opacity: 1; animation: vehPulse 1.6s ease-out infinite; }
.veh.st-alert .veh-ring { stroke: var(--st-alert); }
@keyframes vehPulse { 0% { transform: scale(.55); opacity: .9; } 100% { transform: scale(1.5); opacity: 0; } }
.veh, .hub { transition: opacity .2s; }
.veh.is-hidden, .hub.is-hidden { opacity: 0; pointer-events: none; }
.veh:focus-visible { outline: none; }
.veh:focus-visible .veh-arrow, .hub:focus-visible .hub-shape { stroke: var(--live); stroke-width: 2; }

/* 지도 오버레이 컨트롤 */
.map-zoomctl {
  position: absolute; top: 12px; left: 12px; z-index: 4;
  display: flex; flex-direction: column;
  border: 1px solid var(--line-strong); border-radius: var(--r-ctl); overflow: hidden;
  background: var(--glass); backdrop-filter: blur(4px);
}
.map-zoomctl button {
  width: 30px; height: 30px; display: grid; place-items: center;
  color: var(--ink); font-family: var(--mono); font-size: 14px;
  border-bottom: 1px solid var(--line);
}
.map-zoomctl button:last-child { border-bottom: 0; }
.map-zoomctl button:hover { background: var(--bg-2); color: var(--ink-hi); }

.weather-chip {
  position: absolute; top: 12px; right: 12px; z-index: 4;
  display: inline-flex; align-items: center; gap: 7px;
  height: 26px; padding: 0 10px;
  background: var(--glass); backdrop-filter: blur(4px);
  border: 1px solid var(--line-strong); border-radius: var(--r-badge);
  font-size: 11px; font-weight: 600; color: var(--ink);
}
.weather-chip .lucide { width: 13px; height: 13px; color: var(--st-moving); }
.weather-chip.wx-warn .lucide { color: var(--st-delay); }

.map-legend {
  position: absolute; left: 12px; bottom: 12px; z-index: 4;
  width: 148px; padding: 10px 12px;
  background: var(--glass); backdrop-filter: blur(4px);
  border: 1px solid var(--line-strong); border-radius: var(--r-panel);
}
.map-legend .lg-tit { font-size: 11px; font-weight: 700; color: var(--ink-hi); padding-bottom: 7px; margin-bottom: 7px; border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; align-items: center; }
.map-legend .lg-tit span { font-family: var(--mono); font-size: 10px; color: var(--ink-dim); font-weight: 400; }
.lg-row { display: flex; align-items: center; gap: 7px; padding: 3px 0; font-size: 11.5px; color: var(--ink); cursor: pointer; }
.lg-row input { accent-color: var(--live); width: 13px; height: 13px; flex: none; cursor: pointer; }
.lg-dot { width: 8px; height: 8px; border-radius: 2px; background: var(--c, var(--ink-dim)); flex: none; }
.lg-count { margin-left: auto; font-family: var(--mono); font-variant-numeric: tabular-nums; font-size: 10.5px; color: var(--ink-dim); }

/* 지도 툴팁 */
.map-tip {
  position: absolute; z-index: 5; width: 230px;
  background: var(--bg-2); border: 1px solid var(--line-strong); border-radius: var(--r-panel);
  box-shadow: var(--shadow-pop);
  padding: 12px; display: none;
}
.map-tip.show { display: block; }
.map-tip .tip-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 6px; }
.map-tip .tip-title { font-family: var(--mono); font-variant-numeric: tabular-nums; font-size: 12.5px; font-weight: 700; color: var(--ink-hi); }
.map-tip .tip-title.kr { font-family: var(--sans); }
.map-tip dl { display: grid; grid-template-columns: auto 1fr; gap: 3px 10px; font-size: 11.5px; }
.map-tip dt { color: var(--ink-dim); }
.map-tip dd { color: var(--ink); text-align: right; }
.map-tip dd.mono { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.map-tip .tip-btn {
  width: 100%; margin-top: 10px; height: 28px;
  border: 1px solid var(--line-strong); border-radius: var(--r-ctl);
  font-size: 11.5px; font-weight: 700; color: var(--ink-hi); background: var(--bg-1);
  transition: color .15s ease, border-color .15s ease;
}
.map-tip .tip-btn:hover { border-color: var(--live); color: var(--live-text); }
.map-tip .tip-close { display: none; }
@media (max-width: 767px) {
  .map-tip { position: fixed; left: 10px; right: 10px; bottom: 10px; width: auto; z-index: 75; }
  .map-tip .tip-close { display: grid; }
}

/* ---------- 이벤트 로그 패널 ---------- */
.log-panel { display: flex; flex-direction: column; min-height: 320px; }
.log-chips { display: flex; gap: 6px; padding: 10px 16px 0; flex-wrap: wrap; }
.log-chip {
  height: 24px; padding: 0 10px;
  border: 1px solid var(--line); border-radius: var(--r-badge);
  font-size: 11px; font-weight: 600; color: var(--ink-dim); background: transparent;
  transition: color .15s ease, border-color .15s ease, background-color .15s ease;
}
.log-chip:hover { color: var(--ink); border-color: var(--line-strong); }
.log-chip[aria-pressed="true"] { color: var(--live-text); border-color: var(--live-line); background: var(--live-tint); }
.log-feed { flex: 1; overflow-y: auto; padding: 10px 8px 12px 16px; max-height: 460px; }
@media (min-width: 1280px) { .log-feed { max-height: 560px; } }
.log-row { display: flex; gap: 10px; padding: 7px 8px 7px 0; border-bottom: 1px solid var(--line); }
.log-row:last-child { border-bottom: 0; }
.log-row .lbar { width: 3px; border-radius: 2px; flex: none; background: var(--st-moving); }
.log-row.warn .lbar { background: var(--st-delay); }
.log-row.alert .lbar { background: var(--st-alert); }
.log-row .lbody { min-width: 0; flex: 1; }
.log-row .ltime { display: flex; gap: 8px; align-items: baseline; }
.log-row .ltime time { font-family: var(--mono); font-variant-numeric: tabular-nums; font-size: 10.5px; color: var(--ink-dim); }
.log-row .ltime .rel { font-size: 10.5px; color: var(--ink-dim); }
.log-row .ltxt { font-size: 12px; color: var(--ink); margin-top: 1px; }
.log-row.alert .ltxt { color: var(--ink-hi); }
.log-row.enter { animation: logIn .18s ease-out; }
.log-row.enter .lbar { animation: barGlow .5s ease-out; }
.log-row.leave { animation: logOut .3s ease-in forwards; }
@keyframes logIn { from { transform: translateY(-8px); opacity: 0; } }
@keyframes logOut { to { opacity: 0; } }
@keyframes barGlow { 0% { box-shadow: 0 0 10px currentColor; } 100% { box-shadow: none; } }
.log-empty { padding: 22px 16px; text-align: center; color: var(--ink-dim); font-size: 12px; border-top: 1px dashed var(--line); }

/* ---------- 테이블 패널 ---------- */
.tbl-toolbar {
  display: flex; flex-wrap: wrap; align-items: center; gap: 10px;
  padding: 12px 16px; border-bottom: 1px solid var(--line);
}
.tbl-search { position: relative; flex: 1 1 200px; max-width: 320px; }
.tbl-search .lucide { position: absolute; left: 9px; top: 50%; transform: translateY(-50%); width: 13px; height: 13px; color: var(--ink-dim); pointer-events: none; }
.tbl-search input {
  width: 100%; height: 30px; padding: 0 10px 0 28px;
  background: var(--bg-0); border: 1px solid var(--line); border-radius: var(--r-ctl);
  color: var(--ink-hi); font-size: 12px;
}
.tbl-search input::placeholder { color: var(--ink-dim); }
.tbl-search input:focus { outline: 2px solid var(--live); outline-offset: 0; border-color: transparent; }

.seg { display: inline-flex; border: 1px solid var(--line); border-radius: var(--r-ctl); overflow: hidden; }
.seg-btn {
  height: 28px; padding: 0 11px; font-size: 11.5px; font-weight: 600;
  color: var(--ink-dim); background: transparent; border-right: 1px solid var(--line); white-space: nowrap;
  transition: color .15s ease, background-color .15s ease;
}
.seg-btn:last-child { border-right: 0; }
.seg-btn:hover { color: var(--ink); background: var(--bg-2); }
.seg-btn[aria-pressed="true"] { color: var(--live-text); background: var(--live-tint); }
.tbl-count { font-size: 11.5px; color: var(--ink-dim); margin-left: auto; }
.tbl-count b { font-family: var(--mono); font-variant-numeric: tabular-nums; color: var(--ink); font-weight: 600; }

.tbl-wrap { overflow-x: auto; }
.ops-table { width: 100%; min-width: 1120px; border-collapse: collapse; font-size: 12.5px; }
.ops-table caption { text-align: left; padding: 8px 16px 0; font-size: 11px; color: var(--ink-dim); caption-side: top; }
.ops-table thead th {
  height: 40px; padding: 0 12px; text-align: left;
  font-family: var(--mono); font-size: 10.5px; font-weight: 600;
  text-transform: uppercase; letter-spacing: .08em; color: var(--ink-dim);
  border-bottom: 1px solid var(--line-strong); white-space: nowrap;
  background: var(--bg-1); user-select: none;
}
.ops-table thead th.sortable { cursor: pointer; }
.ops-table thead th.sortable:hover { color: var(--ink); }
.ops-table thead th .arr { display: inline-block; width: 10px; color: var(--live-text); }
.ops-table thead th.star-h { width: 36px; padding: 0 0 0 12px; }
.ops-table tbody td { height: 44px; padding: 0 12px; border-bottom: 1px solid var(--line); white-space: nowrap; color: var(--ink); }
.ops-table tbody tr { cursor: pointer; }
.ops-table tbody tr:hover td { background: var(--bg-2); transition: background-color .12s ease; }
.ops-table tbody tr:focus-visible { outline: 2px solid var(--live); outline-offset: -2px; }
/* 행 hover 좌측 2px 상태색 인디케이터 */
.ops-table tbody tr:hover td:first-child { box-shadow: inset 2px 0 0 var(--row-c, var(--live)); }
.ops-table tbody tr.rs-moving { --row-c: var(--st-moving); }
.ops-table tbody tr.rs-delay { --row-c: var(--st-delay); }
.ops-table tbody tr.rs-alert { --row-c: var(--st-alert); }
.ops-table tbody tr.rs-done { --row-c: var(--st-done); }
.ops-table tbody tr.rs-plan { --row-c: var(--st-plan); }
.ops-table .trk { font-family: var(--mono); font-variant-numeric: tabular-nums; font-weight: 600; color: var(--ink-hi); font-size: 13px; }
.ops-table .eta { font-family: var(--mono); font-variant-numeric: tabular-nums; color: var(--ink-hi); font-size: 13px; }
.ops-table .sub { color: var(--ink-dim); font-size: 11px; }
.ops-table mark { background: var(--mark-bg); color: var(--ink-hi); border-radius: 2px; padding: 0 1px; }
.ops-table tr.row-flash td { animation: rowFlash 1s ease-out; }
@keyframes rowFlash { 0% { background-color: var(--flash-c, var(--st-delay-bg)); } 100% { background-color: transparent; } }
.ops-table .star-cell { width: 36px; padding: 0 0 0 12px; }

/* 관심 차량 별표 */
.star-btn {
  display: grid; place-items: center;
  width: 28px; height: 28px; border-radius: var(--r-ctl);
  color: var(--ink-dim); background: transparent;
  transition: color .15s ease;
}
.star-btn:hover { color: var(--ink-hi); }
.star-ic {
  width: 15px; height: 15px; fill: none;
  stroke: currentColor; stroke-width: 1.6; stroke-linejoin: round;
  transition: transform .15s ease;
}
.star-btn.on { color: var(--st-delay); }
.star-btn.on .star-ic { fill: currentColor; }
.star-btn.spring .star-ic { animation: starSpring .36s cubic-bezier(.34, 1.56, .64, 1); }
@keyframes starSpring { 0% { transform: scale(.9); } 60% { transform: scale(1.06); } 100% { transform: scale(1); } }
.so-star { border: 1px solid var(--line); width: 34px; height: 34px; }
.so-star:hover { border-color: var(--line-strong); }

.badge {
  display: inline-flex; align-items: center; gap: 6px;
  height: 20px; padding: 0 8px;
  border-radius: var(--r-badge); border: 1px solid;
  font-size: 11px; font-weight: 600; white-space: nowrap;
}
.badge .bdot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; flex: none; }
.badge.st-moving { color: var(--st-moving-text); background: var(--st-moving-bg); border-color: var(--st-moving-line); }
.badge.st-done { color: var(--st-done-text); background: var(--st-done-bg); border-color: var(--st-done-line); }
.badge.st-delay { color: var(--st-delay-text); background: var(--st-delay-bg); border-color: var(--st-delay-line); }
.badge.st-alert { color: var(--st-alert-text); background: var(--st-alert-bg); border-color: var(--st-alert-line); }
.badge.st-plan { color: var(--st-plan-text); background: var(--st-plan-bg); border-color: var(--st-plan-line); }
.badge.cold { color: var(--st-moving-text); background: transparent; border-color: var(--line-strong); height: 18px; font-size: 10px; }

.prog { display: inline-flex; align-items: center; gap: 8px; }
.prog .track { width: 72px; height: 4px; background: var(--line); border-radius: 2px; overflow: hidden; }
.prog .fill { display: block; height: 100%; background: var(--st-moving); border-radius: 2px; transition: width .6s ease; }
.prog.st-delay .fill { background: var(--st-delay); }
.prog.st-done .fill { background: var(--st-done); }
.prog.st-alert .fill { background: var(--st-alert); }
.prog.st-plan .fill { background: var(--st-plan); }
.prog .pval { font-family: var(--mono); font-variant-numeric: tabular-nums; font-size: 11px; color: var(--ink); width: 34px; }

.tbl-empty { padding: 36px 16px; text-align: center; display: none; }
.tbl-empty.show { display: block; }
.tbl-empty p { color: var(--ink-dim); font-size: 12.5px; margin-bottom: 12px; }
.btn-ghost {
  height: 30px; padding: 0 14px;
  border: 1px solid var(--line-strong); border-radius: var(--r-ctl);
  font-size: 12px; font-weight: 700; color: var(--ink-hi); background: var(--bg-2);
  transition: color .15s ease, border-color .15s ease;
}
.btn-ghost:hover { border-color: var(--live); color: var(--live-text); }

.tbl-pag { display: flex; align-items: center; justify-content: flex-end; gap: 4px; padding: 10px 16px; border-top: 1px solid var(--line); }
.pag-btn {
  min-width: 28px; height: 28px; padding: 0 8px;
  display: grid; place-items: center;
  border: 1px solid var(--line); border-radius: var(--r-ctl);
  font-family: var(--mono); font-variant-numeric: tabular-nums; font-size: 11.5px; color: var(--ink-dim);
  transition: color .15s ease, border-color .15s ease;
}
.pag-btn:hover:not(:disabled) { color: var(--ink-hi); border-color: var(--line-strong); }
.pag-btn[aria-current="page"] { color: var(--live-text); border-color: var(--live-line); background: var(--live-tint); }
.pag-btn:disabled { opacity: .35; cursor: default; }
.pag-info { margin-right: auto; font-family: var(--mono); font-variant-numeric: tabular-nums; font-size: 11px; color: var(--ink-dim); }

/* ---------- 분석 로우 (4카드 auto-fit) ---------- */
.charts-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 16px; }
.chart-body { padding: 14px 16px 16px; position: relative; }
.chart-body svg text { font-family: var(--mono); font-variant-numeric: tabular-nums; font-size: 10px; fill: var(--ink-dim); }
.chart-tip {
  position: absolute; z-index: 5; pointer-events: none; display: none;
  background: var(--bg-2); border: 1px solid var(--line-strong); border-radius: var(--r-ctl);
  padding: 5px 9px; font-family: var(--mono); font-variant-numeric: tabular-nums;
  font-size: 11px; color: var(--ink-hi); white-space: nowrap;
  box-shadow: var(--shadow-pop);
}
.chart-tip.show { display: block; }
.chart-tip .t2 { color: var(--ink-dim); }

.rank-list { display: flex; flex-direction: column; }
.rank-row { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.rank-row:last-child { border-bottom: 0; }
.rank-no { font-family: var(--mono); font-variant-numeric: tabular-nums; font-size: 11px; color: var(--ink-dim); width: 18px; flex: none; }
.rank-row:first-child .rank-no { color: var(--live-text); }
.rank-name { font-size: 12px; font-weight: 600; color: var(--ink-hi); flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rank-name small { display: block; font-weight: 400; font-size: 10.5px; color: var(--ink-dim); }
.rank-spark { width: 72px; height: 20px; flex: none; }
.rank-spark svg { width: 72px; height: 20px; }
.rank-val { font-family: var(--mono); font-variant-numeric: tabular-nums; font-size: 12px; color: var(--ink); width: 62px; text-align: right; flex: none; }

/* ---------- 지연 사유 구성 카드 ---------- */
.dr-body { display: flex; flex-direction: column; gap: 12px; }
.dr-bar {
  display: flex; height: 14px;
  border: 1px solid var(--line); border-radius: 3px; overflow: hidden;
}
.dr-seg { display: block; height: 100%; min-width: 2px; transition: opacity .18s ease; }
.dr-seg.dim { opacity: .3; }
.dr-legend { display: flex; flex-direction: column; gap: 2px; }
.dr-item {
  display: flex; align-items: center; gap: 8px;
  padding: 4px 6px; border-radius: var(--r-ctl);
  font-size: 12px; color: var(--ink);
  transition: background-color .15s ease, color .15s ease;
}
.dr-item.hot { background: var(--bg-2); color: var(--ink-hi); }
.dr-dot { width: 8px; height: 8px; border-radius: 2px; flex: none; }
.dr-name { flex: 1; }
.dr-val { font-family: var(--mono); font-variant-numeric: tabular-nums; font-weight: 600; color: var(--ink-hi); }
.dr-note { font-size: 10.5px; color: var(--ink-dim); }

/* ---------- 슬라이드오버 ---------- */
.so {
  position: fixed; top: 0; right: 0; bottom: 0; z-index: 95;
  width: min(420px, 100vw);
  background: var(--bg-1); border-left: 1px solid var(--line-strong);
  transform: translateX(103%); transition: transform .28s cubic-bezier(.2, .7, .3, 1);
  display: flex; flex-direction: column;
  visibility: hidden;
}
.so.open { transform: none; visibility: visible; }
.so-h {
  display: flex; align-items: center; gap: 10px; flex: none;
  height: 56px; padding: 0 10px 0 16px;
  background: var(--bg-2); border-bottom: 1px solid var(--line);
}
.so-trk { font-family: var(--mono); font-variant-numeric: tabular-nums; font-size: 20px; font-weight: 700; color: var(--ink-hi); }
.so-body { flex: 1; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 14px; }
.so-sect { border: 1px solid var(--line); border-radius: var(--r-panel); padding: 12px 14px; background: var(--bg-0); }
.so-sect-t { font-family: var(--mono); font-size: 10px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-dim); margin-bottom: 8px; }
.so-kv { display: grid; grid-template-columns: auto 1fr; gap: 5px 14px; font-size: 12px; }
.so-kv dt { color: var(--ink-dim); }
.so-kv dd { color: var(--ink-hi); text-align: right; }
.so-kv dd.mono { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.so-kv dd .temp-ok { color: var(--st-moving-text); }
.so-kv dd .temp-bad { color: var(--st-alert-text); }

.so-timeline { position: relative; padding-left: 18px; }
.so-timeline::before { content: ""; position: absolute; left: 5px; top: 8px; bottom: 8px; width: 1px; background: var(--line-strong); }
.tl-node { position: relative; padding: 6px 0; }
.tl-node .tdot {
  position: absolute; left: -18px; top: 11px;
  width: 11px; height: 11px; border-radius: 50%;
  background: var(--bg-1); border: 2px solid var(--ink-dim);
}
.tl-node.done .tdot { border-color: var(--st-done); background: var(--st-done); }
.tl-node.now .tdot { border-color: var(--live); background: var(--live); box-shadow: 0 0 12px var(--live-glow); animation: livePulse 1.8s infinite; }
.tl-node .tname { font-size: 12.5px; font-weight: 600; color: var(--ink-hi); }
.tl-node.pend .tname { color: var(--ink-dim); font-weight: 500; }
.tl-node .tmeta { font-family: var(--mono); font-variant-numeric: tabular-nums; font-size: 10.5px; color: var(--ink-dim); }
.tl-node.now .tname { color: var(--live-text); }

.so-logs { display: flex; flex-direction: column; gap: 6px; }
.so-logs li { display: flex; gap: 10px; font-size: 11.5px; color: var(--ink); }
.so-logs time { font-family: var(--mono); font-variant-numeric: tabular-nums; color: var(--ink-dim); flex: none; }
#so-speed svg { width: 100%; height: 46px; }
.so-actions { display: flex; gap: 8px; flex: none; padding: 12px 16px; border-top: 1px solid var(--line); background: var(--bg-1); }
.so-actions button { flex: 1; height: 34px; border-radius: var(--r-ctl); font-size: 12.5px; font-weight: 700; transition: background-color .15s ease, color .15s ease, border-color .15s ease; }
.btn-primary { background: var(--live); color: var(--on-accent); border: 1px solid transparent; }
.btn-primary:hover { background: var(--live-hover); }
.btn-line { background: transparent; color: var(--ink-hi); border: 1px solid var(--line-strong); }
.btn-line:hover { border-color: var(--live); color: var(--live-text); }

/* ---------- 푸터 ---------- */
.ops-footer {
  padding: 20px 16px 26px; text-align: center;
  font-size: 11.5px; color: var(--ink-dim);
  border-top: 1px solid var(--line); margin-top: 4px;
}
.ops-footer a { color: var(--live-text); font-weight: 600; text-decoration: none; }
.ops-footer a:hover { text-decoration: underline; text-underline-offset: 3px; }

/* ---------- 토스트 ---------- */
#toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%) translateY(6px);
  z-index: 120; max-width: min(92vw, 480px);
  background: var(--bg-2); color: var(--ink-hi);
  border: 1px solid var(--line-strong); border-left: 3px solid var(--live);
  border-radius: var(--r-ctl); padding: 10px 16px;
  font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  box-shadow: var(--shadow-pop);
  opacity: 0; pointer-events: none;
  transition: opacity .3s, transform .3s;
}
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
#toast.t-warn { border-left-color: var(--st-delay); }
#toast.t-alert { border-left-color: var(--st-alert); }
#toast.t-success { border-left-color: var(--st-done); }

/* ---------- 반응형 ---------- */
@media (min-width: 1280px) {
  #btn-menu { display: none; }
}
@media (max-width: 1279px) {
  .appbar .op-meta { display: none; }
}
@media (max-width: 1023px) {
  .appbar-screen { display: none; }
}
@media (max-width: 767px) {
  .content { padding: 12px; gap: 12px; }
  .kpi-grid, .main-grid, .charts-grid { gap: 12px; }
  .appbar .last-recv { display: none; }
  .app-clock small { display: none; }
  .appbar .operator { display: none; }
  .kpi-value { font-size: 24px; }
  .map-legend { position: static; width: auto; margin: 0 12px 12px; }
  .map-zoomctl { flex-direction: row; }
  .map-zoomctl button { border-bottom: 0; border-right: 1px solid var(--line); }
  .map-zoomctl button:last-child { border-right: 0; }
  .tbl-count { flex-basis: 100%; margin-left: 0; }
}

/* ---------- reduced motion (과한 모션만 가드 — 데이터 반영은 즉시) ---------- */
@media (prefers-reduced-motion: reduce) {
  .route { animation: none; }
  .live-dot { animation: none; }
  .veh .veh-ring { animation: none; transform: scale(1); }
  .veh.st-delay .veh-ring, .veh.st-alert .veh-ring { opacity: .5; }
  .tl-node.now .tdot { animation: none; }
  .ticker-item.out, .ticker-item.in { animation: none; }
  .ticker-item.in { opacity: 1; }
  .log-row.enter { animation: logFade .3s ease-out; }
  .bell-count.pop { animation: none; }
  .star-btn.spring .star-ic { animation: none; }
  .kpi.flash { animation: none; }
  .ops-table tr.row-flash td { animation: none; }
  #map-zoom { transition: none; }
  .so, .drawer { transition: none; }
}
@keyframes logFade { from { opacity: 0; } }
