/* ==========================================================================
   Navigator console — shell design tokens (UX overhaul Phase U0 "foundation")
   --------------------------------------------------------------------------
   PURELY ADDITIVE: this file only declares --nv-* custom properties, a
   Pretendard @font-face (new family name, loaded only when used) and new
   .nv-* classes. It must never restyle existing selectors, so it can be
   linked BEFORE styles.css on every console page without visual change.
   Spec + rationale: docs/UX_U0_FOUNDATION.md

   Rules (approved UX plan):
   - Hex/rgb colour literals live ONLY in custom-property definitions here.
     Other shell/*.css files must reference var(--nv-*) (tests enforce it).
   - z-index uses exactly 6 levels: map < map-overlay < panel < popover
     (tooltips share it) < toast < modal.
   - Label badges = colour + icon + text (never colour alone).
     Alarm red (--nv-status-critical) is for real alerts only (guardrail 3).
   - Dark is the default; light via :root[data-theme="light"] or the OS
     preference when no explicit data-theme="dark" is set.
   ========================================================================== */

/* Pretendard (SIL OFL 1.1, fonts/LICENSE-Pretendard-OFL.txt) — self-hosted,
   no CDN (closed-network guardrail). Missing file => font-display:swap fallback. */
@font-face { font-family: "Pretendard"; font-style: normal; font-weight: 400; font-display: swap;
  src: url("/static/shell/fonts/Pretendard-Regular.woff2") format("woff2"); }
@font-face { font-family: "Pretendard"; font-style: normal; font-weight: 500; font-display: swap;
  src: url("/static/shell/fonts/Pretendard-Medium.woff2") format("woff2"); }
@font-face { font-family: "Pretendard"; font-style: normal; font-weight: 600; font-display: swap;
  src: url("/static/shell/fonts/Pretendard-SemiBold.woff2") format("woff2"); }
@font-face { font-family: "Pretendard"; font-style: normal; font-weight: 700; font-display: swap;
  src: url("/static/shell/fonts/Pretendard-Bold.woff2") format("woff2"); }

/* ---------- Theme-independent tokens + DARK (default) palette ---------- */
:root {
  /* typography */
  --nv-font-ui: "Pretendard", "NanumSquare Neo", -apple-system, "Segoe UI", "Malgun Gothic", "Apple SD Gothic Neo", sans-serif;
  --nv-font-num: "Pretendard", ui-monospace, "SFMono-Regular", "Consolas", monospace;
  --nv-fs-2xs: 10px;
  --nv-fs-xs: 11px;
  --nv-fs-sm: 12px;
  --nv-fs-base: 13px;
  --nv-fs-md: 15px;
  --nv-fs-lg: 18px;
  --nv-fs-xl: 22px;
  --nv-lh-tight: 1.25;
  --nv-lh-base: 1.45;
  --nv-fw-regular: 400;
  --nv-fw-medium: 500;
  --nv-fw-semibold: 600;
  --nv-fw-bold: 700;

  /* spacing scale (4px grid) */
  --nv-sp-0: 0;
  --nv-sp-1: 4px;
  --nv-sp-2: 8px;
  --nv-sp-3: 12px;
  --nv-sp-4: 16px;
  --nv-sp-5: 24px;
  --nv-sp-6: 32px;
  --nv-sp-7: 48px;

  /* radius */
  --nv-radius-sm: 2px;
  --nv-radius-md: 3px;
  --nv-radius-lg: 4px;
  --nv-radius-pill: 999px;

  /* z-index — EXACTLY 6 levels, ascending (tests/test_layout_tokens.py) */
  --nv-z-map: 0;
  --nv-z-map-overlay: 10;
  --nv-z-panel: 20;
  --nv-z-popover: 30;
  --nv-z-toast: 40;
  --nv-z-modal: 50;
  --nv-z-nav: 100;          /* 근거 보기·편제 상세 등 펼침 내비게이션 서랍 — 화면 요소 중 최상위(인트로·개발 도구 제외) */

  /* fixed layout regions */
  --nv-topbar-h: 48px;
  --nv-left-w: 320px;
  --nv-left-w-collapsed: 48px;
  --nv-commander-w-min: 360px;
  --nv-commander-w-max: 560px;
  --nv-commander-w: clamp(var(--nv-commander-w-min), 30vw, var(--nv-commander-w-max));
  --nv-statusbar-h: 28px;
  --nv-gutter: 12px;
  --nv-badge-h: 20px;
  --nv-icon-sm: 14px;
  --nv-icon-md: 18px;
  --nv-icon-lg: 24px;

  /* motion */
  --nv-dur-fast: 120ms;
  --nv-dur-base: 160ms;
  --nv-ease: cubic-bezier(.2, .6, .2, 1);

  /* ----- colours: dark (DEFAULT = "DEFENSE AI" look, per NDP designed demo:
     near-black neutral surfaces + mint-teal accent; red = real alerts only; radius 2–4px; no blur) -----
     NOTE: `color-scheme` is intentionally NOT set here (it would restyle native
     scrollbars/controls of existing pages). U1 sets it on the new shell root. */
  --nv-bg-0: #0a0a0a;          /* app canvas / panels base — bundle --semantic-bg-normal (neutral-950) */
  --nv-bg-1: #171717;          /* panel sections / KPI tiles / cards — bg-subtle1 */
  --nv-bg-2: #1e1e1e;          /* inputs / thumbnails / toasts — bg-subtle2 */
  --nv-bg-3: #262626;          /* buttons / inactive tabs — bg-subtle3·hover2 */
  --nv-text-1: #fafafa;        /* titles / emphasized values — fg-intense */
  --nv-text-body: #d4d4d4;     /* body / button labels — fg-neutral (between text-1 and text-2) */
  --nv-text-2: #a1a1a1;        /* meta (source·time) / captions — fg-subtle1 */
  --nv-text-3: #8a8a8a;        /* tertiary/placeholder — neutral-450 (레퍼런스 fg-muted #737373 은
                                  우리 4.5:1 대비 게이트(verify_layout low_contrast) 미달 → 한 단계 밝게) */
  --nv-text-inverse: #0a0a0a;
  --nv-on-accent: #ffffff;      /* U4: text on accent / alarm fills (>= 4.5:1 in every palette) */
  --nv-border: #404040;        /* button/input borders — line-subtle3 (the crisp one) */
  --nv-divider: #333333;       /* card separators / panel edges — line-subtle2 */
  --nv-focus: #43c895;
  --nv-accent: #227e5e;         /* deep brand green as FILL (white text >= 5:1); reference uses tints, not solids */
  --nv-accent-strong: #77daa6;  /* bright variant — hover / emphasis */
  --nv-accent-text: #43c895;    /* brand green AS TEXT (links, active labels, KPI numbers) — exact bundle value */
  --nv-accent-surface: #0b2f21; /* tonal dark-green surface (kmaven accent-tonal-surface) */
  --nv-overlay-scrim: rgba(0, 0, 0, 0.6);
  --nv-shadow-1: 0 2px 4px -2px rgba(0, 0, 0, 0.1), 0 4px 6px -1px rgba(0, 0, 0, 0.1);
  --nv-shadow-2: 0 4px 6px -4px rgba(0, 0, 0, 0.1), 0 10px 15px -3px rgba(0, 0, 0, 0.1);

  /* status — critical is ALARM RED: real alerts only */
  --nv-status-good: #43c895;
  --nv-status-warning: #fe9400;
  --nv-status-caution: #ffcb3b;         /* yellow step before alarm (등급 '중간'·주의) */
  --nv-status-critical: #e04b50;
  --nv-band-red: #e8877e;               /* 평가 밴드 Red(출격 평가 등) — 데이터 표시색, 경보 적색 아님 */
  --nv-status-critical-text: #f96f70;   /* U4: alarm red AS TEXT on tinted alarm backgrounds (fills keep --nv-status-critical) */
  --nv-status-info: #4181ff;

  /* 5-step grade scale (결심 비교표·위협도) — colour = 유불리 방향, 글자 = 등급 (명세 C4).
     grade-5 is the alarm-red family: unfavourable extremes only (guardrail 3). */
  --nv-grade-1: #43c895;
  --nv-grade-2: #4181ff;
  --nv-grade-3: #ffcb3b;
  --nv-grade-4: #fe9400;
  --nv-grade-5: #f96f70;

  /* AI-trigger button gradient border (명세 C1 kmv-btn-gradient: green→olive→gold) */
  --nv-ai-1: #43c895; --nv-ai-2: #8fae6e; --nv-ai-3: #c89653;

  /* status pill pairs — text colour + its dark-shade border (명세 C2) */
  --nv-pill-run: #43c895;  --nv-pill-run-bd: #1b674d;
  --nv-pill-wait: #c084fc; --nv-pill-wait-bd: #6b21a8;
  --nv-pill-warn: #fe9400; --nv-pill-warn-bd: #8a3905;
  --nv-pill-done: #a1a1a1; --nv-pill-done-bd: #525252;

  /* provenance labels (7) — always rendered with icon + text */
  --nv-label-live: #43c895;
  --nv-label-representative: #fe9400;
  --nv-label-simulated: #b9a3e0;
  --nv-label-notional: #ffcb3b;
  --nv-label-stale: #8a8a8a;
  --nv-label-reference: #93c4fe;
  --nv-label-unverified: #ef9a5e;
  --nv-label-external: #c084fc;   /* U3: external system source (Neon) — never styled like Korean-basis badges */
  /* force-side colours (wargame / 6·25 unit markers & legends) — data-viz, not alarms.
     Red side is a force colour, NOT the alarm red (--nv-status-critical). */
  --nv-side-blue: #4a9eff;
  --nv-side-red: #ff6b6b;
  --nv-side-neutral: #c9b98a;
  --nv-side-protected: #e8eef4;
  /* ontology map categories — DEFENSE AI 레퍼런스(온톨로지 맵) 범주색. data-viz 범주색이며 경보색 아님. */
  --nv-onto-obs: #ad46ff;      /* 관측 — purple-500 */
  --nv-onto-ai: #43c895;       /* AI 결과·판정 — green */
  --nv-onto-mil: #f96f70;      /* 군사 기준 — coral (alarm red 아님) */
  --nv-onto-space: #93c4fe;    /* 공간/환경 — light blue */
  --nv-onto-comm: #ffcb3b;     /* 통신/뉴스·근거 자료 — yellow-500 */
  --nv-onto-target: #fe9400;   /* 대상 객체(질의 허브) — orange */
  --nv-onto-concept: #7c86ff;  /* 개념·주제 — indigo-400 */
  --nv-msg-ask: #7fa8ff;      /* 협업 보기 토론 — 질의·지시·요청(글자색 대비 ≥4.5:1 on bg-0~2) */
  --nv-msg-answer: #4fcf9c;   /* 협업 보기 토론 — 응답·보고·종합 */
  --nv-onto-etc: #abab9c;      /* 기타 */
  --nv-onto-canvas: #07070a;
  --nv-onto-glyph: #000000;
  --nv-onto-grid: #2a2f36;
}

/* ---------- LIGHT palette (explicit) ---------- */
:root[data-theme="light"] {
  --nv-bg-0: #eceff3;
  --nv-bg-1: #ffffff;
  --nv-bg-2: #f3f5f8;
  --nv-text-1: #1a1f26;
  --nv-text-2: #46505d;
  --nv-text-3: #626c79;
  --nv-text-inverse: #ffffff;
  --nv-on-accent: #ffffff;
  --nv-border: #c5ccd5;
  --nv-divider: #dfe3e8;
  --nv-focus: #0e9e74;
  --nv-accent: #0f8a66;
  --nv-accent-strong: #0b6f52;
  --nv-accent-text: #0c7a5a;
  --nv-overlay-scrim: rgba(20, 24, 30, 0.35);
  --nv-shadow-1: 0 1px 3px rgba(20, 24, 30, 0.15);
  --nv-shadow-2: 0 4px 16px rgba(20, 24, 30, 0.18);
  --nv-status-good: #1b6a3d;
  --nv-status-warning: #7b5500;
  --nv-status-critical: #b42328;
  --nv-band-red: #a3463f;
  --nv-status-critical-text: #b42328;
  --nv-status-info: #266386;
  --nv-label-live: #1b6a3d;
  --nv-label-representative: #86510e;
  --nv-label-simulated: #6c4fa3;
  --nv-label-notional: #7b5800;
  --nv-label-stale: #58606b;
  --nv-label-reference: #1e5eaf;
  --nv-label-unverified: #98440a;
  --nv-label-external: #7a3fb0;
  --nv-bg-3: #e7ebef;
  --nv-text-body: #2e3740;
  --nv-status-caution: #8a6400;
  --nv-accent-surface: #d9f0e5;
  --nv-grade-1: #1a6148;
  --nv-grade-2: #1e5eaf;
  --nv-grade-3: #7b5800;
  --nv-grade-4: #98440a;
  --nv-grade-5: #b42328;
  --nv-ai-1: #1a6148; --nv-ai-2: #5c7a4a; --nv-ai-3: #8a6433;
  --nv-pill-run: #1a6148;  --nv-pill-run-bd: #8fd4b5;
  --nv-pill-wait: #7a3fb0; --nv-pill-wait-bd: #c9a7ee;
  --nv-pill-warn: #98440a; --nv-pill-warn-bd: #e5b283;
  --nv-pill-done: #58606b; --nv-pill-done-bd: #b9c0c8;
  --nv-side-blue: #1f63b8;
  --nv-side-red: #c43c3c;
  --nv-side-neutral: #8a7a48;
  --nv-side-protected: #4a5360;
  --nv-onto-obs: #8200db;
  --nv-onto-ai: #217d5d;
  --nv-onto-mil: #c22a2c;
  --nv-onto-space: #0f56e6;
  --nv-onto-comm: #896307;
  --nv-onto-target: #b25804;
  --nv-onto-concept: #432dd7;
  --nv-msg-ask: #2453b8;
  --nv-msg-answer: #0c6b4f;
  --nv-onto-etc: #6b6b5e;
  --nv-onto-canvas: #fbfcfd;
  --nv-onto-glyph: #ffffff;
  --nv-onto-grid: #bcc5cf;
}

/* ---------- LIGHT palette (OS preference, unless dark forced) ---------- */
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    --nv-bg-0: #eceff3;
    --nv-bg-1: #ffffff;
    --nv-bg-2: #f3f5f8;
    --nv-text-1: #1a1f26;
    --nv-text-2: #46505d;
    --nv-text-3: #626c79;
    --nv-text-inverse: #ffffff;
    --nv-on-accent: #ffffff;
  --nv-on-accent: #ffffff;
    --nv-border: #c5ccd5;
    --nv-divider: #dfe3e8;
    --nv-focus: #0e9e74;
    --nv-accent: #0f8a66;
    --nv-accent-strong: #0b6f52;
    --nv-accent-text: #0c7a5a;
  --nv-accent-text: #0c7a5a;
    --nv-overlay-scrim: rgba(20, 24, 30, 0.35);
    --nv-shadow-1: 0 1px 3px rgba(20, 24, 30, 0.15);
    --nv-shadow-2: 0 4px 16px rgba(20, 24, 30, 0.18);
    --nv-status-good: #1b6a3d;
    --nv-status-warning: #7b5500;
    --nv-status-critical: #b42328;
    --nv-band-red: #a3463f;
    --nv-status-critical-text: #b42328;
  --nv-status-critical-text: #b42328;
    --nv-status-info: #266386;
    --nv-label-live: #1b6a3d;
    --nv-label-representative: #86510e;
    --nv-label-simulated: #6c4fa3;
    --nv-label-notional: #7b5800;
    --nv-label-stale: #58606b;
    --nv-label-reference: #1e5eaf;
    --nv-label-unverified: #98440a;
    --nv-label-external: #7a3fb0;
    --nv-bg-3: #e7ebef;
    --nv-text-body: #2e3740;
    --nv-status-caution: #8a6400;
    --nv-accent-surface: #d9f0e5;
    --nv-grade-1: #1a6148;
    --nv-grade-2: #1e5eaf;
    --nv-grade-3: #7b5800;
    --nv-grade-4: #98440a;
    --nv-grade-5: #b42328;
    --nv-ai-1: #1a6148; --nv-ai-2: #5c7a4a; --nv-ai-3: #8a6433;
  --nv-pill-run: #1a6148;  --nv-pill-run-bd: #8fd4b5;
    --nv-pill-wait: #7a3fb0; --nv-pill-wait-bd: #c9a7ee;
    --nv-pill-warn: #98440a; --nv-pill-warn-bd: #e5b283;
    --nv-pill-done: #58606b; --nv-pill-done-bd: #b9c0c8;
    --nv-side-blue: #1f63b8;
    --nv-side-red: #c43c3c;
    --nv-side-neutral: #8a7a48;
    --nv-side-protected: #4a5360;
    --nv-onto-obs: #8200db;
    --nv-onto-ai: #217d5d;
    --nv-onto-mil: #c22a2c;
    --nv-onto-space: #0f56e6;
    --nv-onto-comm: #896307;
    --nv-onto-target: #b25804;
    --nv-onto-concept: #432dd7;
    --nv-msg-ask: #2453b8;
    --nv-msg-answer: #0c6b4f;
    --nv-onto-etc: #6b6b5e;
    --nv-onto-canvas: #fbfcfd;
    --nv-onto-glyph: #ffffff;
    --nv-onto-grid: #bcc5cf;
  }
}

/* ==========================================================================
   U4 — palette candidates. DECIDED 2026-10-19 (docs/REDESIGN_DEFENSEAI_PLAN.md D1):
   the DEFAULT (:root/light blocks above) is now "defense-green" — the DEFENSE AI
   reference values measured from the deployed bundle (REDESIGN_DEFENSEAI_COMPONENT_SPEC.md §1).
   data-palette="cool-blue"  = legacy key name kept for localStorage compat; it IS the default blocks above
   data-palette="warm-green" = styles.css "팔레트 B" (사용자 결정 2026-07-27): warm charcoal #16181c/#212327/#2b2e33,
                               border #3a3d42, text #e6e9ed, accent #5a8f6a (light = derived warm paper + deeper green)
   Change the default: DEFAULT_PALETTE in shell/shell.js (one line). Status/label/side colours are shared.
   ========================================================================== */
:root[data-palette="warm-green"] {
  --nv-bg-0: #16181c;
  --nv-bg-1: #212327;
  --nv-bg-2: #2b2e33;
  --nv-text-1: #e6e9ed;
  --nv-text-2: #a6afb9;
  --nv-text-3: #98a1ab;
  --nv-text-inverse: #16181c;
  --nv-border: #3a3d42;
  --nv-divider: #303338;
  --nv-focus: #8fc79f;
  --nv-accent: #4a7d5a;
  --nv-accent-strong: #79ad89;
  --nv-accent-text: #82b592;
}
:root[data-palette="warm-green"][data-theme="light"] {
  --nv-bg-0: #efeeea;
  --nv-bg-1: #fffefb;
  --nv-bg-2: #f4f2ee;
  --nv-text-1: #1e1d1b;
  --nv-text-2: #4a4741;
  --nv-text-3: #66625a;
  --nv-text-inverse: #ffffff;
  --nv-on-accent: #ffffff;
  --nv-border: #cdc9c2;
  --nv-divider: #e3e0da;
  --nv-focus: #2f7a4a;
  --nv-accent: #3a7550;
  --nv-accent-strong: #2c5e3e;
  --nv-accent-text: #2c6a43;
  --nv-overlay-scrim: rgba(20, 24, 30, 0.35);
  --nv-shadow-1: 0 1px 3px rgba(20, 24, 30, 0.15);
  --nv-shadow-2: 0 4px 16px rgba(20, 24, 30, 0.18);
  --nv-status-good: #1b6a3d;
  --nv-status-warning: #7b5500;
  --nv-status-critical: #b42328;
  --nv-band-red: #a3463f;
  --nv-status-critical-text: #b42328;
  --nv-status-info: #266386;
  --nv-label-live: #1b6a3d;
  --nv-label-representative: #86510e;
  --nv-label-simulated: #6c4fa3;
  --nv-label-notional: #7b5800;
  --nv-label-stale: #58606b;
  --nv-label-reference: #1e5eaf;
  --nv-label-unverified: #98440a;
  --nv-label-external: #7a3fb0;
  --nv-bg-3: #e7ebef;
  --nv-text-body: #2e3740;
  --nv-status-caution: #8a6400;
  --nv-accent-surface: #d9f0e5;
  --nv-grade-1: #1a6148;
  --nv-grade-2: #1e5eaf;
  --nv-grade-3: #7b5800;
  --nv-grade-4: #98440a;
  --nv-grade-5: #b42328;
  --nv-ai-1: #1a6148; --nv-ai-2: #5c7a4a; --nv-ai-3: #8a6433;
  --nv-pill-run: #1a6148;  --nv-pill-run-bd: #8fd4b5;
  --nv-pill-wait: #7a3fb0; --nv-pill-wait-bd: #c9a7ee;
  --nv-pill-warn: #98440a; --nv-pill-warn-bd: #e5b283;
  --nv-pill-done: #58606b; --nv-pill-done-bd: #b9c0c8;
  --nv-side-blue: #1f63b8;
  --nv-side-red: #c43c3c;
  --nv-side-neutral: #8a7a48;
  --nv-side-protected: #4a5360;
  --nv-onto-obs: #8200db;
  --nv-onto-ai: #217d5d;
  --nv-onto-mil: #c22a2c;
  --nv-onto-space: #0f56e6;
  --nv-onto-comm: #896307;
  --nv-onto-target: #b25804;
  --nv-onto-concept: #432dd7;
  --nv-msg-ask: #2453b8;
  --nv-msg-answer: #0c6b4f;
  --nv-onto-etc: #6b6b5e;
  --nv-onto-canvas: #fbfcfd;
  --nv-onto-glyph: #ffffff;
  --nv-onto-grid: #bcc5cf;
}
@media (prefers-color-scheme: light) {
  :root[data-palette="warm-green"]:not([data-theme="dark"]) {
    --nv-bg-0: #efeeea;
    --nv-bg-1: #fffefb;
    --nv-bg-2: #f4f2ee;
    --nv-text-1: #1e1d1b;
    --nv-text-2: #4a4741;
    --nv-text-3: #66625a;
    --nv-text-inverse: #ffffff;
    --nv-on-accent: #ffffff;
  --nv-on-accent: #ffffff;
    --nv-border: #cdc9c2;
    --nv-divider: #e3e0da;
    --nv-focus: #2f7a4a;
    --nv-accent: #3a7550;
    --nv-accent-strong: #2c5e3e;
    --nv-accent-text: #2c6a43;
  --nv-accent-text: #2c6a43;
    --nv-overlay-scrim: rgba(20, 24, 30, 0.35);
    --nv-shadow-1: 0 1px 3px rgba(20, 24, 30, 0.15);
    --nv-shadow-2: 0 4px 16px rgba(20, 24, 30, 0.18);
    --nv-status-good: #1b6a3d;
    --nv-status-warning: #7b5500;
    --nv-status-critical: #b42328;
    --nv-band-red: #a3463f;
    --nv-status-critical-text: #b42328;
  --nv-status-critical-text: #b42328;
    --nv-status-info: #266386;
    --nv-label-live: #1b6a3d;
    --nv-label-representative: #86510e;
    --nv-label-simulated: #6c4fa3;
    --nv-label-notional: #7b5800;
    --nv-label-stale: #58606b;
    --nv-label-reference: #1e5eaf;
    --nv-label-unverified: #98440a;
    --nv-label-external: #7a3fb0;
    --nv-bg-3: #e7ebef;
    --nv-text-body: #2e3740;
    --nv-status-caution: #8a6400;
    --nv-accent-surface: #d9f0e5;
    --nv-grade-1: #1a6148;
    --nv-grade-2: #1e5eaf;
    --nv-grade-3: #7b5800;
    --nv-grade-4: #98440a;
    --nv-grade-5: #b42328;
    --nv-ai-1: #1a6148; --nv-ai-2: #5c7a4a; --nv-ai-3: #8a6433;
  --nv-pill-run: #1a6148;  --nv-pill-run-bd: #8fd4b5;
    --nv-pill-wait: #7a3fb0; --nv-pill-wait-bd: #c9a7ee;
    --nv-pill-warn: #98440a; --nv-pill-warn-bd: #e5b283;
    --nv-pill-done: #58606b; --nv-pill-done-bd: #b9c0c8;
    --nv-side-blue: #1f63b8;
    --nv-side-red: #c43c3c;
    --nv-side-neutral: #8a7a48;
    --nv-side-protected: #4a5360;
    --nv-onto-obs: #8200db;
    --nv-onto-ai: #217d5d;
    --nv-onto-mil: #c22a2c;
    --nv-onto-space: #0f56e6;
    --nv-onto-comm: #896307;
    --nv-onto-target: #b25804;
    --nv-onto-concept: #432dd7;
    --nv-msg-ask: #2453b8;
    --nv-msg-answer: #0c6b4f;
    --nv-onto-etc: #6b6b5e;
    --nv-onto-canvas: #fbfcfd;
    --nv-onto-glyph: #ffffff;
    --nv-onto-grid: #bcc5cf;
  }
}

/* U4 — focus ring + motion (theme-independent; colours from the active palette) */
:root {
  --nv-focus-ring: 0 0 0 2px var(--nv-bg-0), 0 0 0 4px var(--nv-focus);
  --nv-focus-outline: 2px solid var(--nv-focus);
}
@media (prefers-reduced-motion: reduce) {
  :root { --nv-dur-fast: 0ms; --nv-dur-base: 0ms; }
}

/* ==========================================================================
   Provenance label badge — colour + icon + text, fixed height, never wraps,
   ellipsis inside its slot. Markup:
     <span class="nv-badge nv-badge--live">
       <svg class="nv-badge__icon" aria-hidden="true"><use href="/static/shell/icons.svg#nv-live"/></svg>
       <span class="nv-badge__text">LIVE</span>
     </span>
   ========================================================================== */
.nv-badge {
  --nv-badge-c: var(--nv-text-2);
  display: inline-flex; align-items: center; gap: var(--nv-sp-1);
  box-sizing: border-box; height: var(--nv-badge-h); max-width: 100%;
  padding: 0 var(--nv-sp-2); vertical-align: middle;
  border: 1px solid var(--nv-badge-c); border-radius: var(--nv-radius-sm);
  background: color-mix(in srgb, var(--nv-badge-c) 14%, transparent);
  color: var(--nv-badge-c);
  font-family: var(--nv-font-ui); font-size: var(--nv-fs-xs); font-weight: var(--nv-fw-semibold);
  line-height: 1; white-space: nowrap; overflow: hidden; flex: 0 1 auto; min-width: 0;
}
.nv-badge__icon {
  flex: 0 0 auto; width: 12px; height: 12px;
  fill: none; stroke: currentColor; stroke-width: 2;
  stroke-linecap: round; stroke-linejoin: round;
}
.nv-badge__text { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* solid-tinted: measured / produced facts */
.nv-badge--live           { --nv-badge-c: var(--nv-label-live); }
.nv-badge--representative { --nv-badge-c: var(--nv-label-representative); }
.nv-badge--simulated      { --nv-badge-c: var(--nv-label-simulated); }
/* dashed: estimates / no longer current */
.nv-badge--notional       { --nv-badge-c: var(--nv-label-notional); border-style: dashed; }
.nv-badge--stale          { --nv-badge-c: var(--nv-label-stale); border-style: dashed; }
/* outline only (no fill): reference / external */
.nv-badge--reference      { --nv-badge-c: var(--nv-label-reference); background: transparent; }
.nv-badge--unverified     { --nv-badge-c: var(--nv-label-unverified); background: transparent; }
/* U3 external system source (외부 온톨로지 · Neon): dotted outline — visibly not a Korean-basis/policy badge */
.nv-badge--external       { --nv-badge-c: var(--nv-label-external); background: transparent; border-style: dotted; }

/* ---------- utilities ---------- */
.nv-ellipsis { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nv-tabular  { font-variant-numeric: tabular-nums; font-feature-settings: "tnum" 1; }
.nv-icon {
  display: inline-block; flex: 0 0 auto; width: var(--nv-icon-md); height: var(--nv-icon-md);
  fill: none; stroke: currentColor; stroke-width: 1.75;
  stroke-linecap: round; stroke-linejoin: round; vertical-align: -0.2em;
}
.nv-icon--sm { width: var(--nv-icon-sm); height: var(--nv-icon-sm); }
.nv-icon--lg { width: var(--nv-icon-lg); height: var(--nv-icon-lg); }

/* ==========================================================================
   R0 primitives — DEFENSE AI component recipes (docs/REDESIGN_DEFENSEAI_COMPONENT_SPEC.md).
   Additive .nv-* classes only; every colour comes from the tokens above.
   ========================================================================== */

/* ----- C1 button: sharp corners, 12px semibold, tinted (reference has NO solid accent) ----- */
.nv-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--nv-sp-1);
  box-sizing: border-box; padding: var(--nv-sp-2) var(--nv-sp-3); border: 0; border-radius: 0;
  background: var(--nv-bg-3); color: var(--nv-text-body); cursor: pointer;
  font-family: var(--nv-font-ui); font-size: var(--nv-fs-sm); font-weight: var(--nv-fw-semibold);
  line-height: 14px; letter-spacing: -0.1px; white-space: nowrap;
  transition: background-color var(--nv-dur-fast) var(--nv-ease);
}
.nv-btn:hover { background: color-mix(in srgb, var(--nv-text-1) 6%, var(--nv-bg-3)); }
.nv-btn:disabled { background: var(--nv-bg-2); color: var(--nv-text-3); cursor: default; }
.nv-btn.is-selected { background: var(--nv-border); color: var(--nv-text-1); }
.nv-btn--accent { background: color-mix(in srgb, var(--nv-accent-text) 15%, transparent); color: var(--nv-accent-text); }
.nv-btn--accent:hover { background: color-mix(in srgb, var(--nv-accent-text) 20%, transparent); }
.nv-btn--accent:disabled { background: color-mix(in srgb, var(--nv-accent-text) 15%, transparent); color: var(--nv-accent); }
.nv-btn--outline { background: transparent; border: 1px solid var(--nv-border); }
.nv-btn--outline:hover { background: color-mix(in srgb, var(--nv-text-1) 10%, transparent); }
/* AI-trigger (분석·방책 생성 요청): 1px gradient border — the reference's signature for "ask the AI" */
.nv-btn--ai {
  border: 1px solid transparent;
  background-image: linear-gradient(var(--nv-bg-0), var(--nv-bg-0)),
    repeating-linear-gradient(135deg, var(--nv-ai-1), var(--nv-ai-2), var(--nv-ai-3) 88px, var(--nv-ai-2), var(--nv-ai-1) 170px);
  background-origin: border-box; background-clip: padding-box, border-box;
  color: var(--nv-accent-text);
}
.nv-btn--ai:hover { background-image: linear-gradient(var(--nv-bg-2), var(--nv-bg-2)),
    repeating-linear-gradient(135deg, var(--nv-ai-1), var(--nv-ai-2), var(--nv-ai-3) 88px, var(--nv-ai-2), var(--nv-ai-1) 170px); }

/* ----- C2 status pill: 18px rounded-full, text colour + its dark-shade border, NO fill ----- */
.nv-pill {
  --nv-pill-c: var(--nv-pill-done); --nv-pill-b: var(--nv-pill-done-bd);
  display: inline-flex; align-items: center; justify-content: center; gap: 2px;
  box-sizing: border-box; height: 18px; padding: 2px 7px; flex: 0 0 auto;
  border: 1px solid var(--nv-pill-b); border-radius: var(--nv-radius-pill);
  background: transparent; color: var(--nv-pill-c);
  font-family: var(--nv-font-ui); font-size: var(--nv-fs-2xs); font-weight: var(--nv-fw-semibold);
  line-height: 12px; white-space: nowrap;
}
.nv-pill--run  { --nv-pill-c: var(--nv-pill-run);  --nv-pill-b: var(--nv-pill-run-bd); }
.nv-pill--wait { --nv-pill-c: var(--nv-pill-wait); --nv-pill-b: var(--nv-pill-wait-bd); }
.nv-pill--warn { --nv-pill-c: var(--nv-pill-warn); --nv-pill-b: var(--nv-pill-warn-bd); }
.nv-pill--done { --nv-pill-c: var(--nv-pill-done); --nv-pill-b: var(--nv-pill-done-bd); }

/* ----- C3 status dot: 6px, takes the parent's (or an inline) colour ----- */
.nv-dot { display: inline-block; flex: 0 0 auto; width: 6px; height: 6px;
  border-radius: var(--nv-radius-pill); background: currentColor; vertical-align: middle; }

/* ----- C7 filter chip: ACTIVE = outline, inactive = filled (reference inverts the usual) ----- */
.nv-chip-filter {
  display: inline-flex; align-items: center; gap: var(--nv-sp-1); flex: 0 0 auto;
  box-sizing: border-box; height: 30px; padding: 0 10px; cursor: pointer;
  background: var(--nv-bg-3); border: 1px solid transparent; border-radius: 0;
  color: var(--nv-text-body); font-family: var(--nv-font-ui);
  font-size: var(--nv-fs-xs); font-weight: var(--nv-fw-medium); letter-spacing: -0.1px; white-space: nowrap;
  transition: background-color var(--nv-dur-fast) var(--nv-ease);
}
.nv-chip-filter:hover { background: var(--nv-divider); }
.nv-chip-filter.is-active { background: transparent; border-color: var(--nv-text-3); color: var(--nv-text-1); }
.nv-chip-filter .nv-chip-filter__n { color: var(--nv-text-2); }

/* ----- C4 grade: coloured grade word + 2px 5-segment bar. Direction-aware colour is set
   by the renderer via the --nv-grade-c custom property (value from --nv-grade-1..5). ----- */
.nv-grade { --nv-grade-c: var(--nv-grade-3); color: var(--nv-grade-c);
  font-weight: var(--nv-fw-bold); font-size: var(--nv-fs-sm); letter-spacing: -0.1px; }
.nv-grade-bar { --nv-grade-c: var(--nv-grade-3); display: flex; gap: 1px; height: 2px; width: 70px; max-width: 100%; }
.nv-grade-bar i { flex: 1 1 auto; min-width: 1px; background: var(--nv-divider); }
.nv-grade-bar i.on { background: var(--nv-grade-c); }
