/* ============================================================
   CMSLAB 5층 데이터 흐름 데모 — 공유 디자인 시스템
   라이트 모드 전용 · 외부 CDN/웹폰트 0 · 8px 그리드
   부모 토큰: 프로젝트 작전보드 계열을 계승하고 필요한 것만 확장
   ============================================================ */

:root {
  /* 계승 */
  --bg: #f3f6f2;
  --paper: #ffffff;
  --ink: #17221d;
  --muted: #68736d;
  --line: #d9e1db;
  --green: #155f45;
  --green-soft: #e1f1e9;
  --blue: #1d5f8c;
  --blue-soft: #e5f0f8;
  --amber: #92600b;
  --amber-soft: #fff2cf;
  --red: #9b3d31;
  --red-soft: #fbe9e5;
  --shadow: 0 12px 38px rgba(25, 47, 36, .08);

  /* 확장 */
  --nav: #13251d;
  --nav-2: #1b3329;
  --brand: #AF272F;
  --brand-soft: #FCEEEF;
  --violet: #5b4a9e;
  --violet-soft: #ece9f7;
  --l1: #1d5f8c;
  --l2: #155f45;
  --l3: #0f766e;
  --l4: #5b4a9e;
  --l5: #AF272F;
  --l1-soft: #e5f0f8;
  --l2-soft: #e1f1e9;
  --l3-soft: #ddf1ee;
  --l4-soft: #ece9f7;
  --l5-soft: #FCEEEF;

  --ink-2: #3c4a43;
  --ink-3: #56635c;
  --line-soft: #eaefeb;
  --hairline: rgba(23, 34, 29, .09);
  --shadow-sm: 0 1px 2px rgba(25, 47, 36, .05), 0 4px 12px rgba(25, 47, 36, .04);
  --shadow-md: 0 2px 4px rgba(25, 47, 36, .05), 0 10px 26px rgba(25, 47, 36, .07);
  --r-sm: 6px;
  --r: 10px;
  --r-lg: 14px;
  --nav-h: 52px;
  --bar-h: 46px;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }

html {
  color-scheme: light;
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--nav-h) + var(--bar-h) + 16px);
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", "Segoe UI", "Noto Sans KR", sans-serif;
  font-size: 14px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

body.is-drawer-open { overflow: hidden; }

button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--blue); text-underline-offset: 3px; }
h1, h2, h3, h4 { margin: 0; letter-spacing: -.022em; font-weight: 700; }
h1 { font-size: 27px; letter-spacing: -.034em; line-height: 1.18; }
h2 { font-size: 19px; }
h3 { font-size: 15px; }
h4 { font-size: 13px; }
p { margin: 0; }
.num, td.num, .kpi-v, .tile-v { font-variant-numeric: tabular-nums; font-feature-settings: "tnum" 1; }

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

/* ── 앱 셸 ─────────────────────────────────────────────── */
.app { min-height: 100vh; display: flex; flex-direction: column; }
.wrap { width: min(1440px, calc(100% - 48px)); margin: 0 auto; }
.wrap-narrow { width: min(1180px, calc(100% - 48px)); margin: 0 auto; }
.page { flex: 1; padding: 22px 0 72px; }
.section { margin-top: 30px; }
.section:first-child { margin-top: 0; }

.section-head {
  display: flex; align-items: flex-end; justify-content: space-between;
  gap: 20px; margin-bottom: 12px; padding-bottom: 9px;
  border-bottom: 1px solid var(--line);
}
.section-head .sub { margin-top: 3px; color: var(--muted); font-size: 12.5px; max-width: 74ch; }
.eyebrow {
  display: block; margin-bottom: 5px; color: var(--muted);
  font-size: 10.5px; font-weight: 750; letter-spacing: .13em; text-transform: uppercase;
}

/* ── 층 내비 (상단 고정) ───────────────────────────────── */
.nav {
  position: sticky; top: 0; z-index: 60;
  height: var(--nav-h);
  background: var(--nav);
  color: #dfe9e3;
  box-shadow: 0 1px 0 rgba(0, 0, 0, .3);
}
.nav-in { display: flex; align-items: center; gap: 16px; height: 100%; }
.nav-brand {
  display: flex; align-items: baseline; gap: 8px; flex: 0 0 auto;
  font-size: 13px; font-weight: 750; letter-spacing: -.01em; color: #fff; text-decoration: none;
}
.nav-brand .mark {
  width: 9px; height: 9px; border-radius: 2px; background: var(--brand);
  transform: translateY(-1px);
}
.nav-brand .sub { color: #8ba193; font-weight: 600; font-size: 11px; letter-spacing: .04em; }

.nav-layers { display: flex; align-items: center; gap: 2px; flex: 1 1 auto; overflow-x: auto; scrollbar-width: none; }
.nav-layers::-webkit-scrollbar { display: none; }
.nav-link {
  position: relative; display: flex; align-items: center; gap: 6px;
  padding: 7px 11px; border-radius: var(--r-sm);
  color: #a9bcb2; font-size: 12.5px; font-weight: 650; white-space: nowrap;
  text-decoration: none; transition: background .14s ease, color .14s ease;
}
.nav-link .no { font-size: 11px; opacity: .75; }
.nav-link:hover { background: rgba(255, 255, 255, .07); color: #e8f1eb; }
.nav-link[aria-current="page"] { background: rgba(255, 255, 255, .11); color: #fff; }
.nav-link[aria-current="page"]::after {
  content: ""; position: absolute; left: 11px; right: 11px; bottom: -11px;
  height: 2px; border-radius: 2px 2px 0 0; background: var(--lc, var(--brand));
}
.nav-link[data-layer="l1"] { --lc: #6fb3e0; }
.nav-link[data-layer="l2"] { --lc: #63c39b; }
.nav-link[data-layer="l3"] { --lc: #4fc0b5; }
.nav-link[data-layer="l4"] { --lc: #9e8fe0; }
.nav-link[data-layer="l5"] { --lc: #e8737c; }

.nav-right { display: flex; align-items: center; gap: 8px; flex: 0 0 auto; }
.nav-synth {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 8px; border: 1px solid rgba(255, 255, 255, .18); border-radius: 999px;
  color: #a9bcb2; font-size: 10.5px; font-weight: 700; letter-spacing: .04em;
}
.nav-synth::before { content: ""; width: 5px; height: 5px; border-radius: 50%; background: #9e8fe0; }

.sel {
  appearance: none; padding: 6px 26px 6px 10px; border-radius: var(--r-sm);
  border: 1px solid rgba(255, 255, 255, .16); background: rgba(255, 255, 255, .07);
  color: #fff; font-size: 12px; font-weight: 650; cursor: pointer;
  background-image: linear-gradient(45deg, transparent 50%, #9fb3a8 50%), linear-gradient(135deg, #9fb3a8 50%, transparent 50%);
  background-position: calc(100% - 13px) 50%, calc(100% - 9px) 50%;
  background-size: 4px 4px, 4px 4px;
  background-repeat: no-repeat;
}
.sel:hover { background-color: rgba(255, 255, 255, .12); }
.sel option { color: var(--ink); }

.kbd {
  display: inline-block; min-width: 17px; padding: 1px 5px;
  border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 4px;
  background: var(--paper); color: var(--ink-3);
  font-family: var(--mono); font-size: 10.5px; line-height: 1.5; text-align: center;
}
.nav .kbd { border-color: rgba(255, 255, 255, .22); background: rgba(255, 255, 255, .06); color: #cfdcd5; }

/* ── 시나리오 추적 바 ──────────────────────────────────── */
.track {
  position: sticky; top: var(--nav-h); z-index: 55;
  min-height: var(--bar-h);
  background: rgba(255, 255, 255, .93);
  backdrop-filter: saturate(160%) blur(10px);
  border-bottom: 1px solid var(--line);
}
.track-in { display: flex; align-items: center; gap: 12px; min-height: var(--bar-h); padding: 7px 0; }
.track-tag {
  flex: 0 0 auto; display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 9px; border-radius: 999px;
  background: var(--l5-soft); color: var(--l5);
  font-size: 11px; font-weight: 750; letter-spacing: -.005em;
}
.track-tag::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.track-text { flex: 1 1 auto; min-width: 0; color: var(--ink-2); font-size: 12.5px; line-height: 1.45; }
.track-text b { color: var(--ink); font-weight: 700; }
.track-go { flex: 0 0 auto; }

/* ── 버튼 ──────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 11px; border: 1px solid var(--line); border-radius: var(--r-sm);
  background: var(--paper); color: var(--ink-2);
  font-size: 12px; font-weight: 650; cursor: pointer;
  transition: border-color .14s ease, background .14s ease, color .14s ease;
}
.btn:hover { border-color: #bccbc3; background: #fbfdfb; color: var(--ink); }
.btn:active { transform: translateY(.5px); }
.btn-primary { border-color: var(--green); background: var(--green); color: #fff; }
.btn-primary:hover { background: #12523c; border-color: #12523c; color: #fff; }
.btn-ghost { border-color: transparent; background: transparent; }
.btn-ghost:hover { border-color: var(--line); background: var(--paper); }
.btn-sm { padding: 3px 8px; font-size: 11px; }
.btn[aria-pressed="true"] { border-color: var(--green); background: var(--green-soft); color: var(--green); }

/* ── 3배지 ─────────────────────────────────────────────── */
.badges { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 4px; vertical-align: middle; }
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  max-width: 34ch; padding: 1.5px 7px;
  border: 1px solid var(--line); border-radius: 999px;
  background: var(--paper); color: var(--ink-3);
  font-size: 10.5px; font-weight: 650; line-height: 1.6; white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis;
}
.badge .bk { color: var(--muted); font-weight: 750; letter-spacing: .03em; }
.badge-src { border-color: #cddcea; background: var(--blue-soft); color: #144b70; }
.badge-time { border-color: #cfe0d8; background: #eef6f1; color: #17503a; }
.badge-st { font-weight: 750; }
.badge-st[data-st="확정"] { border-color: #b7d9c8; background: var(--green-soft); color: var(--green); }
.badge-st[data-st="가마감"] { border-color: #e6cf98; background: var(--amber-soft); color: var(--amber); }
.badge-st[data-st="추정"] { border-style: dashed; border-color: #d9b76e; background: var(--amber-soft); color: var(--amber); }
.badge-st[data-st="미수령"] { border-style: dashed; border-color: #dfa79b; background: var(--red-soft); color: var(--red); }
.badge-st[data-st="모의"] { border-color: #c4bbe4; background: var(--violet-soft); color: var(--violet); }
.badge-st[data-st="미확정"] { border-style: dashed; border-color: #c4bbe4; background: var(--violet-soft); color: var(--violet); }

.tag {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 1px 7px; border-radius: 4px;
  font-size: 10.5px; font-weight: 700; letter-spacing: .01em; white-space: nowrap;
  background: var(--line-soft); color: var(--ink-3);
}
.tag-ok { background: var(--green-soft); color: var(--green); }
.tag-warn { background: var(--amber-soft); color: var(--amber); }
.tag-bad { background: var(--red-soft); color: var(--red); }
.tag-info { background: var(--blue-soft); color: var(--blue); }
.tag-sim { background: var(--violet-soft); color: var(--violet); }
.tag-l1 { background: var(--l1-soft); color: var(--l1); }
.tag-l2 { background: var(--l2-soft); color: var(--l2); }
.tag-l3 { background: var(--l3-soft); color: var(--l3); }
.tag-l4 { background: var(--l4-soft); color: var(--l4); }
.tag-l5 { background: var(--l5-soft); color: var(--l5); }

/* ── 카드 ──────────────────────────────────────────────── */
.card {
  position: relative; padding: 16px;
  border: 1px solid var(--line); border-radius: var(--r-lg);
  background: var(--paper); box-shadow: var(--shadow-sm);
}
.card-pad-0 { padding: 0; overflow: hidden; }
.card-head {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 12px; margin-bottom: 11px;
}
.card-head.tight { margin-bottom: 7px; }
.card-note { margin-top: 7px; color: var(--muted); font-size: 12px; line-height: 1.5; }
.card-ft {
  margin: 12px -16px -16px; padding: 9px 16px;
  border-top: 1px solid var(--line-soft); background: #fbfcfb;
  border-radius: 0 0 var(--r-lg) var(--r-lg);
  color: var(--muted); font-size: 11.5px;
}
.card-accent { border-top: 2px solid var(--ac, var(--green)); }
.clickable { cursor: pointer; transition: border-color .14s ease, box-shadow .14s ease, transform .14s ease; }
.clickable:hover { border-color: #b9cbc1; box-shadow: var(--shadow-md); }
.is-flash { animation: flash 1.1s ease-out; }
@keyframes flash {
  0% { box-shadow: 0 0 0 0 rgba(175, 39, 47, .34); }
  100% { box-shadow: 0 0 0 14px rgba(175, 39, 47, 0); }
}
/* SVG 요소에는 box-shadow 가 먹지 않는다 — stroke 기반으로 같은 신호를 준다 */
@keyframes flash-stroke {
  0% { stroke: var(--brand); stroke-width: 3.2; }
  70% { stroke: var(--brand); stroke-width: 2; }
  100% { stroke: var(--line); stroke-width: 1.5; }
}
svg .is-flash, .svgbox .is-flash { animation: none; }
svg .is-flash > rect, svg .is-flash > circle, svg .is-flash > path, svg .is-flash > ellipse,
svg rect.is-flash, svg circle.is-flash, svg path.is-flash, svg ellipse.is-flash {
  animation: flash-stroke 1.1s ease-out;
}

/* ── 그리드 ────────────────────────────────────────────── */
.grid { display: grid; grid-template-columns: repeat(12, 1fr); gap: 14px; }
.g2 { grid-column: span 2; } .g3 { grid-column: span 3; } .g4 { grid-column: span 4; }
.g5 { grid-column: span 5; } .g6 { grid-column: span 6; } .g7 { grid-column: span 7; }
.g8 { grid-column: span 8; } .g9 { grid-column: span 9; } .g12 { grid-column: 1 / -1; }
.row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.stack { display: flex; flex-direction: column; gap: 10px; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.xsmall { font-size: 11px; }
.mono { font-family: var(--mono); font-size: 11.5px; letter-spacing: -.01em; }

/* ── KPI 타일 ──────────────────────────────────────────── */
.tiles { display: grid; grid-template-columns: repeat(6, 1fr); gap: 10px; }
.tile {
  padding: 13px 14px 12px; border: 1px solid var(--line); border-radius: var(--r);
  background: var(--paper); box-shadow: var(--shadow-sm);
}
.tile-k { color: var(--muted); font-size: 11px; font-weight: 700; letter-spacing: .02em; }
.tile-v {
  margin-top: 3px; font-size: 28px; font-weight: 720; letter-spacing: -.04em; line-height: 1.05;
  display: flex; align-items: baseline; gap: 3px;
}
.tile-v .u { font-size: 13px; font-weight: 650; color: var(--ink-3); letter-spacing: -.01em; }
.tile-n { margin-top: 5px; color: var(--muted); font-size: 11px; line-height: 1.42; }
.tile-accent { --ac: var(--green); box-shadow: inset 3px 0 0 var(--ac), var(--shadow-sm); }

.kpi { display: flex; flex-direction: column; gap: 2px; }
.kpi-k { color: var(--muted); font-size: 11.5px; font-weight: 700; }
.kpi-v { font-size: 22px; font-weight: 720; letter-spacing: -.035em; line-height: 1.1; }
.kpi-v .u { font-size: 12px; font-weight: 650; color: var(--ink-3); margin-left: 2px; }
.kpi-d { font-size: 11.5px; font-weight: 700; }
.kpi-d.up { color: var(--green); }
.kpi-d.down { color: var(--red); }

/* ── 표 (밀도 높은) ────────────────────────────────────── */
.tw { overflow: auto; max-width: 100%; }
table.t { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 12.5px; }
table.t th, table.t td {
  padding: 6px 10px; text-align: left; vertical-align: top;
  border-bottom: 1px solid var(--line-soft); white-space: nowrap;
}
table.t thead th {
  position: sticky; top: 0; z-index: 2;
  background: #f7faf8; color: var(--muted);
  font-size: 10.5px; font-weight: 750; letter-spacing: .05em; text-transform: uppercase;
  border-bottom: 1px solid var(--line);
}
table.t tbody tr:hover td { background: #f9fcfa; }
table.t tbody tr:last-child td { border-bottom: 0; }
table.t td.num, table.t th.num { text-align: right; font-variant-numeric: tabular-nums; }
table.t td.wrap { white-space: normal; min-width: 22ch; }
table.t td.k { font-family: var(--mono); font-size: 11.5px; color: var(--ink-2); }
table.t tr.is-hl td { background: var(--amber-soft) !important; }
table.t.zebra tbody tr:nth-child(2n) td { background: #fbfcfb; }
table.t.compact th, table.t.compact td { padding: 4px 8px; font-size: 12px; }
.t-cap { padding: 8px 10px; border-bottom: 1px solid var(--line); background: #fbfcfb; color: var(--muted); font-size: 11.5px; }

/* ── 칩 · 필터 ─────────────────────────────────────────── */
.filters {
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px;
  padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--r);
  background: var(--paper); box-shadow: var(--shadow-sm);
}
.filter-g { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.filter-lab { color: var(--muted); font-size: 10.5px; font-weight: 750; letter-spacing: .06em; text-transform: uppercase; margin-right: 2px; }
.chip {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 9px; border: 1px solid var(--line); border-radius: 999px;
  background: var(--paper); color: var(--ink-3);
  font-size: 11.5px; font-weight: 650; cursor: pointer;
  transition: border-color .13s ease, background .13s ease, color .13s ease;
}
.chip:hover { border-color: #bccbc3; background: #fafcfa; }
.chip .ct { color: var(--muted); font-size: 10.5px; font-variant-numeric: tabular-nums; }
.chip[aria-pressed="true"] { border-color: var(--green); background: var(--green-soft); color: var(--green); }
.chip[aria-pressed="true"] .ct { color: var(--green); }
.chip .dot { width: 7px; height: 7px; border-radius: 2px; background: var(--dc, var(--muted)); }
.search {
  flex: 1 1 180px; min-width: 150px; max-width: 280px;
  padding: 5px 10px; border: 1px solid var(--line); border-radius: var(--r-sm);
  background: var(--paper); font-size: 12.5px;
}
.search::placeholder { color: #9aa8a1; }

/* ── 탭 ────────────────────────────────────────────────── */
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); }
.tab {
  position: relative; padding: 8px 13px 9px; border: 0; background: transparent;
  color: var(--muted); font-size: 12.5px; font-weight: 700; cursor: pointer;
}
.tab:hover { color: var(--ink-2); }
.tab[aria-selected="true"] { color: var(--ink); }
.tab[aria-selected="true"]::after {
  content: ""; position: absolute; left: 6px; right: 6px; bottom: -1px; height: 2px;
  border-radius: 2px 2px 0 0; background: var(--green);
}
.tabpanel[hidden] { display: none; }

/* ── 드로어 (근거) ─────────────────────────────────────── */
.drawer-scrim {
  position: fixed; inset: 0; z-index: 90;
  background: rgba(19, 37, 29, .34);
  opacity: 0; pointer-events: none; transition: opacity .2s ease;
}
.drawer-scrim.open { opacity: 1; pointer-events: auto; }
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; z-index: 91;
  width: min(460px, 94vw); display: flex; flex-direction: column;
  background: var(--paper); border-left: 1px solid var(--line);
  box-shadow: -18px 0 50px rgba(25, 47, 36, .16);
  transform: translateX(102%); transition: transform .24s cubic-bezier(.22, .68, .3, 1);
}
.drawer.open { transform: translateX(0); }
.drawer-head {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 12px;
  padding: 15px 16px 13px; border-bottom: 1px solid var(--line); background: #fbfcfb;
}
.drawer-head h3 { font-size: 16px; letter-spacing: -.028em; }
.drawer-head .k { color: var(--muted); font-size: 11px; font-weight: 750; letter-spacing: .08em; text-transform: uppercase; }
.drawer-x {
  flex: 0 0 auto; width: 26px; height: 26px; padding: 0;
  border: 1px solid var(--line); border-radius: var(--r-sm);
  background: var(--paper); color: var(--muted); font-size: 15px; line-height: 1; cursor: pointer;
}
.drawer-x:hover { color: var(--ink); border-color: #bccbc3; }
.drawer-body { flex: 1; overflow-y: auto; padding: 14px 16px 26px; }
.dsec { margin-bottom: 16px; }
.dsec:last-child { margin-bottom: 0; }
.dsec-k {
  display: block; margin-bottom: 5px; color: var(--muted);
  font-size: 10.5px; font-weight: 750; letter-spacing: .1em; text-transform: uppercase;
}
.dsec-b { color: var(--ink-2); font-size: 13px; line-height: 1.62; }
.dsec-b ul { margin: 0; padding-left: 17px; }
.dsec-b li + li { margin-top: 4px; }
.dsec-b code { font-family: var(--mono); font-size: 11.5px; padding: 1px 4px; border-radius: 3px; background: var(--line-soft); }
.dsec.accent { padding: 11px 12px; border-radius: var(--r); background: var(--l3-soft); }
.dsec.accent .dsec-k { color: var(--l3); }

/* ── 트리 ──────────────────────────────────────────────── */
.tree { font-size: 12.5px; }
.tree-g { margin-bottom: 9px; }
.tree-gk {
  display: block; padding: 3px 8px; margin-bottom: 2px; border-radius: 4px;
  background: var(--line-soft); color: var(--ink-3);
  font-size: 10.5px; font-weight: 750; letter-spacing: .07em; text-transform: uppercase;
}
.tree-i {
  display: flex; align-items: center; gap: 7px; width: 100%;
  padding: 5px 8px; border: 0; border-radius: var(--r-sm);
  background: transparent; color: var(--ink-2); text-align: left; cursor: pointer;
  font-size: 12.5px; font-family: var(--mono); letter-spacing: -.01em;
}
.tree-i:hover { background: #f5f8f6; color: var(--ink); }
.tree-i[aria-current="true"] { background: var(--green-soft); color: var(--green); font-weight: 650; }
.tree-i .bar { width: 3px; height: 13px; border-radius: 2px; background: var(--dc, var(--line)); flex: 0 0 auto; }

/* ── 타임라인 ──────────────────────────────────────────── */
.tl { position: relative; padding-left: 18px; }
.tl::before { content: ""; position: absolute; left: 4px; top: 5px; bottom: 5px; width: 1px; background: var(--line); }
.tl-i { position: relative; padding: 0 0 13px; }
.tl-i:last-child { padding-bottom: 0; }
.tl-i::before {
  content: ""; position: absolute; left: -18px; top: 5px;
  width: 9px; height: 9px; border-radius: 50%;
  background: var(--paper); border: 2px solid var(--dc, var(--green));
}
.tl-t { color: var(--muted); font-size: 11px; font-weight: 700; font-variant-numeric: tabular-nums; }
.tl-h { font-size: 13px; font-weight: 700; letter-spacing: -.015em; }
.tl-b { margin-top: 2px; color: var(--ink-3); font-size: 12px; line-height: 1.5; }

/* ── 스윔레인 ──────────────────────────────────────────── */
.lanes { border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--paper); overflow: hidden; box-shadow: var(--shadow-sm); }
.lane-head { display: grid; grid-template-columns: var(--lane-label, 148px) repeat(5, 1fr); background: #f7faf8; border-bottom: 1px solid var(--line); }
.lane-head > div {
  padding: 7px 10px; color: var(--muted);
  font-size: 10.5px; font-weight: 750; letter-spacing: .07em; text-transform: uppercase;
}
.lane-head > div + div { border-left: 1px solid var(--line-soft); }
.lane { display: grid; grid-template-columns: var(--lane-label, 148px) repeat(5, 1fr); border-bottom: 1px solid var(--line-soft); }
.lane:last-child { border-bottom: 0; }
.lane:hover { background: #fcfdfc; }
.lane-k {
  padding: 9px 10px; border-right: 1px solid var(--line-soft);
  font-size: 12px; font-weight: 700; letter-spacing: -.012em; color: var(--ink-2);
  display: flex; align-items: center; gap: 6px;
}
.lane-k .bar { width: 3px; align-self: stretch; border-radius: 2px; background: var(--dc, var(--l1)); }
.lane-c { padding: 6px; border-left: 1px solid var(--line-soft); display: flex; flex-direction: column; gap: 4px; min-height: 46px; }
.ev {
  display: block; width: 100%; text-align: left; cursor: pointer;
  padding: 5px 8px; border: 1px solid var(--line); border-left: 3px solid var(--dc, var(--l1));
  border-radius: var(--r-sm); background: var(--paper);
  transition: border-color .13s ease, box-shadow .13s ease, transform .13s ease;
}
.ev:hover { box-shadow: var(--shadow-sm); transform: translateY(-1px); border-color: #c3d2ca; }
.ev-t { display: block; color: var(--muted); font-size: 10px; font-weight: 750; font-variant-numeric: tabular-nums; letter-spacing: .03em; }
.ev-h { display: block; margin-top: 1px; font-size: 11.5px; font-weight: 650; line-height: 1.34; letter-spacing: -.012em; color: var(--ink); }
.ev.is-scen { border-color: var(--brand); background: var(--brand-soft); }
.ev.is-scen .ev-h { color: #8a1f26; }
.ev.is-dim { opacity: .46; }

/* ── SVG 다이어그램 · 차트 ─────────────────────────────── */
.svgbox { display: block; width: 100%; height: auto; overflow: visible; }
.n-box { fill: var(--paper); stroke: var(--line); stroke-width: 1; rx: 8; }
.n-box.proc { fill: #fbfdfc; stroke: #c6d8ce; }
.n-box.io { fill: var(--l1-soft); stroke: #b6d0e5; }
.n-box.ref { fill: var(--l2-soft); stroke: #b4d8c6; }
.n-box.warn { fill: var(--amber-soft); stroke: #e4cd9a; }
.n-box.is-on { stroke: var(--brand); stroke-width: 2; }
.n-t { fill: var(--ink); font-size: 12px; font-weight: 700; letter-spacing: -.015em; }
.n-s { fill: var(--muted); font-size: 10px; }
.n-c { fill: var(--brand); font-size: 10.5px; font-weight: 750; font-variant-numeric: tabular-nums; }
.e-line { stroke: #b9c8c0; stroke-width: 1.4; fill: none; marker-end: url(#ar); }
.e-line.dashed { stroke-dasharray: 4 3; }
/* 활성 엣지는 화살촉도 강조색으로 — `#ar-on` 마커를 정의한 SVG 에서만 적용된다 */
.e-line.is-on { stroke: var(--brand); stroke-width: 2; marker-end: url(#ar-on); }
.e-lab { fill: var(--muted); font-size: 9.5px; }
.ax { stroke: var(--line); stroke-width: 1; }
.ax-t { fill: var(--muted); font-size: 9.5px; font-variant-numeric: tabular-nums; }
.gl { stroke: var(--line-soft); stroke-width: 1; }
.bar-r { fill: var(--l2); }
.bar-r.alt { fill: #8fbfa8; }
.bar-r.neg { fill: var(--red); }
.bar-r.pos { fill: var(--green); }
.bar-r.tot { fill: var(--ink-2); }
.ln { fill: none; stroke: var(--l2); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.ln.b2 { stroke: var(--l1); }
.ln.b3 { stroke: var(--l4); }
.ln-area { fill: var(--l2); opacity: .08; }
.dot-p { fill: var(--l2); }
.spark { fill: none; stroke: var(--l2); stroke-width: 1.6; stroke-linejoin: round; stroke-linecap: round; }
.spark-a { fill: var(--l2); opacity: .1; }

/* 흐름 입자 */
.flow-p { fill: var(--brand); }
.flow-line { stroke: #cbd8d1; stroke-width: 2; fill: none; }
.flow-line.is-on { stroke: var(--brand); }
@keyframes dash-run { to { stroke-dashoffset: -160; } }
.flow-run { stroke-dasharray: 6 10; animation: dash-run 2.6s linear infinite; }

/* ── 토글 (기준 전환) ──────────────────────────────────── */
.seg {
  display: inline-flex; padding: 2px; border: 1px solid var(--line);
  border-radius: 8px; background: #f2f5f3;
}
.seg button {
  padding: 5px 13px; border: 0; border-radius: 6px; background: transparent;
  color: var(--ink-3); font-size: 12px; font-weight: 700; cursor: pointer;
  transition: background .14s ease, color .14s ease, box-shadow .14s ease;
}
.seg button:hover { color: var(--ink); }
.seg button[aria-pressed="true"] { background: var(--paper); color: var(--ink); box-shadow: var(--shadow-sm); }

.switch { display: inline-flex; align-items: center; gap: 7px; cursor: pointer; font-size: 12px; font-weight: 650; color: var(--ink-2); }
.switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.switch .track-s { width: 30px; height: 17px; border-radius: 999px; background: #cdd8d2; position: relative; transition: background .16s ease; }
.switch .track-s::after {
  content: ""; position: absolute; top: 2px; left: 2px; width: 13px; height: 13px;
  border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0, 0, 0, .2);
  transition: transform .16s ease;
}
.switch input:checked + .track-s { background: var(--green); }
.switch input:checked + .track-s::after { transform: translateX(13px); }

/* ── 슬라이더 ──────────────────────────────────────────── */
.slider { width: 100%; appearance: none; height: 22px; background: transparent; cursor: pointer; }
.slider::-webkit-slider-runnable-track { height: 4px; border-radius: 999px; background: linear-gradient(90deg, var(--green) var(--pct, 50%), var(--line) var(--pct, 50%)); }
.slider::-webkit-slider-thumb {
  appearance: none; margin-top: -6px; width: 16px; height: 16px; border-radius: 50%;
  background: var(--paper); border: 2px solid var(--green); box-shadow: var(--shadow-sm);
}
.slider::-moz-range-track { height: 4px; border-radius: 999px; background: var(--line); }
.slider::-moz-range-progress { height: 4px; border-radius: 999px; background: var(--green); }
.slider::-moz-range-thumb { width: 14px; height: 14px; border-radius: 50%; background: var(--paper); border: 2px solid var(--green); }

/* ── 코드 / SQL ────────────────────────────────────────── */
.code {
  margin: 0; padding: 11px 13px; border: 1px solid var(--line); border-radius: var(--r);
  background: #f8faf9; color: var(--ink-2);
  font-family: var(--mono); font-size: 11.5px; line-height: 1.68;
  white-space: pre; overflow-x: auto; tab-size: 2;
}
.code .kw { color: var(--blue); font-weight: 650; }
.code .st { color: var(--green); }
.code .cm { color: #9aa8a1; font-style: italic; }
.code-lab {
  display: flex; align-items: center; justify-content: space-between;
  padding: 6px 12px; border: 1px solid var(--line); border-bottom: 0;
  border-radius: var(--r) var(--r) 0 0; background: #f2f5f3;
  color: var(--muted); font-size: 10.5px; font-weight: 750; letter-spacing: .07em; text-transform: uppercase;
}
.code-lab + .code { border-radius: 0 0 var(--r) var(--r); }

/* ── 빈 상태 ───────────────────────────────────────────── */
.empty[hidden] { display: none; }
.empty {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
  padding: 30px 20px; border: 1px dashed var(--line); border-radius: var(--r);
  background: #fbfcfb; color: var(--muted); text-align: center;
}
.empty .h { color: var(--ink-3); font-size: 13px; font-weight: 700; }
.empty .b { font-size: 12px; max-width: 46ch; line-height: 1.5; }

/* ── 툴팁 ──────────────────────────────────────────────── */
.tip { position: relative; border-bottom: 1px dotted #a9b6af; cursor: help; }
.tip::after {
  content: attr(data-tip);
  position: absolute; left: 50%; bottom: calc(100% + 7px); z-index: 70;
  transform: translateX(-50%) translateY(3px);
  width: max-content; max-width: 280px; padding: 7px 10px;
  border-radius: var(--r-sm); background: var(--nav); color: #e6efea;
  font-size: 11.5px; font-weight: 500; line-height: 1.45; white-space: normal; text-align: left;
  opacity: 0; pointer-events: none; transition: opacity .14s ease, transform .14s ease;
  box-shadow: var(--shadow-md);
}
.tip:hover::after, .tip:focus-visible::after { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ── 노트 · 경계 상자 ──────────────────────────────────── */
.note {
  padding: 11px 13px; border-left: 3px solid var(--nc, var(--l3));
  border-radius: 0 var(--r) var(--r) 0; background: var(--nbg, #f4faf8);
  color: var(--ink-2); font-size: 12.5px; line-height: 1.6;
}
.note b { color: var(--ink); }
.note.warn { --nc: var(--amber); --nbg: var(--amber-soft); }
.note.bad { --nc: var(--red); --nbg: var(--red-soft); }
.note.sim { --nc: var(--violet); --nbg: var(--violet-soft); }
.note.brand { --nc: var(--brand); --nbg: var(--brand-soft); }

.callout {
  padding: 15px 17px; border: 1px solid var(--line); border-radius: var(--r-lg);
  background: linear-gradient(180deg, #fff, #fbfdfb);
  box-shadow: var(--shadow-sm);
}
.callout .lead { font-size: 15.5px; font-weight: 650; line-height: 1.55; letter-spacing: -.018em; color: var(--ink); }
.callout .lead em { font-style: normal; color: var(--brand); }

/* ── 히어로 (허브) ─────────────────────────────────────── */
.hero {
  position: relative; overflow: hidden;
  padding: 22px 26px 24px; border-radius: 18px;
  background: linear-gradient(118deg, #10241c 0%, #16382a 52%, #1c4433 100%);
  color: #e8f2ec; box-shadow: var(--shadow);
}
.hero::after {
  content: ""; position: absolute; right: -90px; top: -130px;
  width: 300px; height: 300px; border-radius: 50%;
  border: 52px solid rgba(255, 255, 255, .045);
}
.hero .eyebrow { color: #8fc0a8; }
.hero h1 { color: #fff; max-width: 30ch; }
.hero .lead { position: relative; margin-top: 12px; max-width: 86ch; color: #cfe2d8; font-size: 14.5px; line-height: 1.65; }
.hero .lead b { color: #fff; font-weight: 650; }
.hero-meta { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 16px; }
.hero-meta span {
  padding: 4px 10px; border: 1px solid rgba(255, 255, 255, .18); border-radius: 999px;
  background: rgba(255, 255, 255, .07); font-size: 11.5px; color: #cfe2d8;
}

/* ── 흐름 레일 (허브 5층) ──────────────────────────────── */
.rail { display: grid; grid-template-columns: repeat(5, 1fr); gap: 12px; }
.lay {
  position: relative; display: block; padding: 14px 15px 15px; text-align: left;
  border: 1px solid var(--line); border-top: 3px solid var(--lc, var(--l1));
  border-radius: var(--r-lg); background: var(--paper); box-shadow: var(--shadow-sm);
  color: inherit; text-decoration: none; cursor: pointer;
  transition: box-shadow .16s ease, transform .16s ease, border-color .16s ease;
}
.lay:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); }
.lay-no { display: block; color: var(--lc); font-size: 15px; font-weight: 750; line-height: 1; }
.lay-h { display: block; margin-top: 5px; font-size: 15px; font-weight: 720; letter-spacing: -.026em; }
.lay-s { display: block; margin-top: 5px; color: var(--muted); font-size: 11.5px; line-height: 1.45; }
.lay-scen {
  display: block; margin-top: 10px; padding-top: 9px; border-top: 1px dashed var(--line);
  color: var(--ink-2); font-size: 12px; line-height: 1.5;
  opacity: 0; transform: translateY(4px);
  transition: opacity .3s ease, transform .3s ease;
}
.lay.lit { border-color: var(--lc); box-shadow: 0 0 0 1px var(--lc), var(--shadow-md); }
.lay.lit .lay-scen { opacity: 1; transform: translateY(0); }
.lay[data-layer="l1"] { --lc: var(--l1); }
.lay[data-layer="l2"] { --lc: var(--l2); }
.lay[data-layer="l3"] { --lc: var(--l3); }
.lay[data-layer="l4"] { --lc: var(--l4); }
.lay[data-layer="l5"] { --lc: var(--l5); }

/* ── 원천 지도 ─────────────────────────────────────────── */
.map { display: grid; grid-template-columns: repeat(auto-fill, minmax(216px, 1fr)); gap: 9px; }
.mgroup { margin-bottom: 16px; }
.mgroup-h {
  display: flex; align-items: baseline; gap: 8px; margin-bottom: 7px;
  padding-bottom: 5px; border-bottom: 1px solid var(--line-soft);
}
.mgroup-h .n { font-size: 13px; font-weight: 720; letter-spacing: -.02em; }
.mgroup-h .c { color: var(--muted); font-size: 11px; font-variant-numeric: tabular-nums; }
.mgroup-h .bar { width: 3px; height: 13px; border-radius: 2px; background: var(--dc, var(--l1)); }
.src {
  position: relative; display: block; width: 100%; text-align: left; cursor: pointer;
  padding: 9px 10px 9px 12px; border: 1px solid var(--line); border-radius: var(--r);
  background: var(--paper); box-shadow: var(--shadow-sm);
  transition: border-color .13s ease, box-shadow .13s ease, transform .13s ease;
}
.src::before {
  content: ""; position: absolute; left: 0; top: 8px; bottom: 8px; width: 3px;
  border-radius: 0 2px 2px 0; background: var(--dc, var(--l1));
}
.src:hover { border-color: #bccbc3; box-shadow: var(--shadow-md); transform: translateY(-1px); }
.src-n { display: block; font-size: 12.5px; font-weight: 650; letter-spacing: -.016em; line-height: 1.32; }
.src-m { margin-top: 4px; display: flex; flex-wrap: wrap; gap: 4px; align-items: center; }
.src-m .m { color: var(--muted); font-size: 10.5px; }
/* span 으로 써도 줄이 붙지 않도록 — 레이아웃이 flex 인 것은 제외 */
.tile-k, .tile-n, .kpi-k, .kpi-v, .cmp-k, .cmp-v, .cmp-n, .tl-t, .tl-h, .tl-b { display: block; }
.src-m .m + .m::before { content: "·"; margin-right: 4px; color: #b9c5bf; }
.src.is-off { display: none; }
.src[data-status="미수령"] { border-style: dashed; }
.src[data-status="미수령"] .src-n { color: var(--ink-3); }

/* ── 워터폴 · 비교 ─────────────────────────────────────── */
.cmp { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.cmp-i { padding: 12px 13px; border: 1px solid var(--line); border-radius: var(--r); background: var(--paper); }
.cmp-i.is-on { border-color: var(--green); box-shadow: 0 0 0 1px var(--green); }
.cmp-k { color: var(--muted); font-size: 11px; font-weight: 700; }
.cmp-v { margin-top: 2px; font-size: 21px; font-weight: 720; letter-spacing: -.035em; font-variant-numeric: tabular-nums; }
.cmp-n { margin-top: 4px; color: var(--muted); font-size: 11px; line-height: 1.42; }

/* ── 푸터 ──────────────────────────────────────────────── */
.foot {
  margin-top: auto; padding: 18px 0 24px;
  border-top: 1px solid var(--line); background: #f0f4f1;
}
.foot-in { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; }
.foot-t { color: var(--muted); font-size: 11.5px; }
.foot-k { display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: 11.5px; }

/* ── 접근성 ────────────────────────────────────────────── */
.sr {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}
.skip {
  position: absolute; left: 8px; top: -44px; z-index: 100;
  padding: 8px 12px; border-radius: var(--r-sm); background: var(--nav); color: #fff;
  font-size: 12px; font-weight: 650; text-decoration: none; transition: top .16s ease;
}
.skip:focus { top: 8px; }

/* ── 반응형 ────────────────────────────────────────────── */
@media (max-width: 1360px) {
  .wrap, .wrap-narrow { width: calc(100% - 32px); }
  .tiles { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 1180px) {
  .rail { grid-template-columns: repeat(2, 1fr); }
  .g3, .g4 { grid-column: span 6; }
  .g5, .g7, .g8, .g9 { grid-column: 1 / -1; }
  .nav-brand .sub { display: none; }
}
@media (max-width: 820px) {
  .tiles { grid-template-columns: repeat(2, 1fr); }
  .rail { grid-template-columns: 1fr; }
  .grid > * { grid-column: 1 / -1 !important; }
  .cmp { grid-template-columns: 1fr; }
  .lane, .lane-head { grid-template-columns: 110px repeat(5, minmax(120px, 1fr)); }
  .lanes { overflow-x: auto; }
  .track-in { align-items: flex-start; flex-wrap: wrap; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .001ms !important; animation-iteration-count: 1 !important;
    transition-duration: .001ms !important; scroll-behavior: auto !important;
  }
}

/* ── 인쇄 ──────────────────────────────────────────────── */
@media print {
  :root { --shadow: none; --shadow-sm: none; --shadow-md: none; }
  body { background: #fff; font-size: 11px; }
  .nav, .track, .drawer, .drawer-scrim, .filters, .foot-k, .skip { display: none !important; }
  .page { padding: 0; }
  .wrap, .wrap-narrow { width: 100%; }
  .card, .tile, .lanes, .src { break-inside: avoid; box-shadow: none; }
  .hero { background: #fff; color: var(--ink); border: 1px solid var(--line); }
  .hero h1, .hero .lead, .hero .lead b { color: var(--ink); }
  .hero .eyebrow { color: var(--muted); }
  .hero-meta span { border-color: var(--line); color: var(--muted); background: none; }
  .lay-scen { opacity: 1 !important; transform: none !important; }
  a[href]::after { content: ""; }
}
