/* telos UI 키트 바탕(base) — 색·크기·간격 변수 두 벌(다크 기본 · 라이트) · 바탕 · 틀(base.html) · 단추 · 토스트 · 점 · 줄/격자/글 목록.
   부품 꼴은 static/ui/parts/<부품>/<부품>.css 에 따로 있다. 원장: CATALOG.md. 의존 없음 · CDN 없음 · 이름은 모두 nx- 로 시작한다. */

/* ── 1. 변수 ───────────────────────────────────────────── */
:root, [data-theme="dark"] {
  color-scheme: dark;
  --bg: #111418;        --surface: #1a1e24;   --surface-2: #22272e;
  --line: #2c333c;      --fg: #e6e9ed;        --muted: #9aa3ad;
  --acc: #6b9bff;       --acc-fg: #0d1117;    --acc-bg: #1d2a44;
  --ok: #4cc38a;        --ok-bg: #16301f;
  --warn: #f0a44b;      --warn-bg: #3a2a12;
  --bad: #ff6b6b;       --bad-bg: #3a1a1a;
  --off: #7d8590;       --off-bg: #23282f;
  --stop: #0b0d10;      --stop-ring: #c9d1d9;   /* 중단(검정) — 어두운 바탕에서 보이게 테두리 */
  --info: #6b9bff;      --info-bg: #1d2a44;
  --shadow: 0 8px 28px rgba(0, 0, 0, .45);
  --backdrop: rgba(0, 0, 0, .6);
}
[data-theme="light"] {
  color-scheme: light;
  --bg: #f5f6f8;        --surface: #ffffff;   --surface-2: #eef0f3;
  --line: #dde1e6;      --fg: #1c2127;        --muted: #626b75;
  --acc: #2f6fed;       --acc-fg: #ffffff;    --acc-bg: #e3ecff;
  --ok: #1a7f45;        --ok-bg: #e3f4ea;
  --warn: #a35a00;      --warn-bg: #fff1d9;
  --bad: #c4372d;       --bad-bg: #fbe7e5;
  --off: #737b84;       --off-bg: #eceef1;
  --stop: #1c2127;      --stop-ring: transparent;
  --info: #2f6fed;      --info-bg: #e3ecff;
  --shadow: 0 8px 28px rgba(20, 30, 45, .16);
  --backdrop: rgba(20, 25, 35, .45);
}
:root {
  --sp-1: 4px; --sp-2: 8px; --sp-3: 12px; --sp-4: 16px; --sp-5: 24px; --sp-6: 32px;
  --r-1: 6px;  --r-2: 10px; --r-3: 14px; --r-pill: 999px;
  --fs-xs: 12px; --fs-s: 13px; --fs-m: 15px; --fs-l: 18px; --fs-xl: 22px;
  --font: system-ui, -apple-system, "Noto Sans KR", "Apple SD Gothic Neo", sans-serif;
  --mono: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  --side-w: 220px; --main-max: 1760px; --ctl-h: 36px;
}

/* ── 2. 바탕 ───────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scrollbar-gutter: stable; }   /* 세로 스크롤바 자리를 늘 비워 둔다 — 스크롤이 생기고 없어질 때 화면이 좌우로 흔들리지 않게 */
/* 스크롤바 꼴 — 얇게, 테마 색으로(모든 스크롤 칸 같게). 표준(scrollbar-width · color) + Safari 용 -webkit- */
* { scrollbar-width: thin; scrollbar-color: var(--line) transparent; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--line); border-radius: 999px; border: 2px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-thumb:hover { background-color: var(--muted); }
body { margin: 0; font: var(--fs-m)/1.55 var(--font); background: var(--bg); color: var(--fg); overflow-wrap: anywhere;
       word-break: keep-all; }   /* 한글 낱말을 글자 중간에서 꺾지 않는다(UI 정책 §1) — 띄어쓰기에서만 줄을 바꾼다 */
a { color: var(--acc); }
h1, h2, h3 { line-height: 1.3; }
h1 { font-size: var(--fs-xl); margin: 0 0 var(--sp-4); }
h2 { font-size: var(--fs-l); margin: 0 0 var(--sp-3); }
h3 { font-size: var(--fs-m); margin: 0 0 var(--sp-2); }
code, pre, .nx-mono { font-family: var(--mono); font-size: .92em; }
pre { background: var(--surface-2); padding: var(--sp-3); border-radius: var(--r-1); overflow-x: auto; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--acc); outline-offset: 2px; }
.nx-muted { color: var(--muted); font-size: var(--fs-s); }
.nx-center { text-align: center; }
p.nx-center { margin: var(--sp-3) 0 0; }
.nx-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.nx-row { display: flex; gap: var(--sp-2); flex-wrap: wrap; align-items: center; }
.nx-row.nx-between { justify-content: space-between; }
.nx-pre { white-space: pre-line; }   /* 여러 줄 글(설명 · 메모)을 줄 그대로 보인다 */
.nx-stack > * + * { margin-top: var(--sp-3); }
.nx-grid { display: grid; gap: var(--sp-3); grid-template-columns: repeat(auto-fill, minmax(min(100%, 220px), 1fr)); }

/* ── 3. 틀(base.html) ──────────────────────────────────── */
.nx-app { display: grid; grid-template-columns: var(--side-w) minmax(0, 1fr); min-height: 100vh; }
.nx-side { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; gap: var(--sp-1);
           padding: var(--sp-4) var(--sp-3); background: var(--surface); border-right: 1px solid var(--line); overflow-y: auto; }
.nx-brand { display: flex; align-items: center; justify-content: center; gap: var(--sp-2); padding: var(--sp-1) var(--sp-2) var(--sp-3);
            font-weight: 700; color: var(--fg); text-decoration: none; white-space: nowrap; }
.nx-nav { display: flex; flex-direction: column; gap: 2px; margin: 0; padding: 0; list-style: none; }
.nx-nav a { display: flex; align-items: center; gap: var(--sp-2); padding: var(--sp-2) var(--sp-3); border-radius: var(--r-1);
            color: var(--fg); text-decoration: none; white-space: nowrap; }
.nx-nav a:hover { background: var(--surface-2); }
.nx-nav a[aria-current="page"] { background: var(--acc-bg); color: var(--acc); font-weight: 600; }
.nx-nav .nx-nav-icon { width: 1.4em; text-align: center; flex: none; }
.nx-nav .nx-nav-title { flex: 1; overflow: hidden; text-overflow: ellipsis; }
.nx-side-foot { margin-top: auto; display: flex; flex-wrap: nowrap; gap: var(--sp-1); padding-top: var(--sp-3); border-top: 1px solid var(--line); }   /* 한 줄: 테마 · 설정 */
.nx-side-foot form { margin: 0; }
.nx-side-foot .nx-btn { flex: 1 1 0; min-width: 0; justify-content: center; white-space: nowrap; padding-inline: var(--sp-2); }
.nx-side-foot .nx-theme-btn { flex: none; }   /* 테마는 아이콘만 — 남은 폭은 설정 단추가 쓴다 */
.nx-side-foot .nx-btn[aria-current="page"] { background: var(--acc-bg); color: var(--acc); }
.nx-version { margin-left: var(--sp-2); font-size: var(--fs-xs); font-weight: 400; color: var(--muted); }
.nx-main { min-width: 0; display: flex; flex-direction: column; }
.nx-solo { grid-template-columns: minmax(0, 1fr); }   /* menu="hidden" 모듈 화면 — 왼쪽 메뉴 없이 온 폭 */
.nx-solo .nx-topbar { gap: var(--sp-3); justify-content: flex-start; }
.nx-solo .nx-topbar > .nx-row { margin-left: auto; }
.nx-page { width: 100%; max-width: var(--main-max); margin: 0 auto; padding: var(--sp-5) var(--sp-4) var(--sp-6); }
.nx-topbar { display: flex; flex-wrap: wrap; gap: var(--sp-2) var(--sp-3); align-items: center; justify-content: space-between; margin-bottom: var(--sp-4); }
.nx-topbar h1 { margin: 0; }
/* 쪽 안 덩어리 사이 간격 하나 */
.nx-page > * + *, .nx-stack > * + * { margin-top: var(--sp-4); }   /* nx-stack: 쪽 안 감싸개(부분 갱신 칸 등) 안 덩어리도 같은 간격 */
.nx-card > * + *:not(.nx-actions) { margin-top: var(--sp-3); }
.nx-topbar > .nx-row:only-child { margin-left: auto; }
/* 맨 화면(로그인 등) */
.nx-bare { min-height: 100vh; display: flex; flex-direction: column; }
.nx-bare .nx-page { max-width: 420px; margin: auto; padding-top: var(--sp-6); }
.nx-bare h1 { margin: 0; font-size: var(--fs-l); }

/* 테마 토글 이름: 지금 테마의 반대를 말한다 */
.nx-theme-to-light, .nx-theme-to-dark { display: none; }
:root:not([data-theme="light"]) .nx-theme-to-light { display: inline; }
[data-theme="light"] .nx-theme-to-dark { display: inline; }

/* 좁은 화면 머리줄 · 서랍 가림막 — 넓은 화면에선 없다 */
.nx-mbar, .nx-scrim { display: none; }

/* 좁은 화면(≤900px): 왼쪽 메뉴 → 왼쪽 서랍(☰). 열림 = <html data-nav-open> (nx.js) */
@media (max-width: 900px) {
  .nx-app { display: block; }
  .nx-mbar { position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: var(--sp-2);
             min-height: 52px; padding: var(--sp-1) var(--sp-3) var(--sp-1) var(--sp-1);
             background: var(--surface); border-bottom: 1px solid var(--line); }
  .nx-menu-btn { font-size: var(--fs-l); min-width: 44px; min-height: 44px; justify-content: center; }
  .nx-mbar-brand { font-weight: 700; color: var(--fg); text-decoration: none; white-space: nowrap; }
  .nx-mbar-title { margin-left: auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
                   font-weight: 600; }
  .nx-side { position: fixed; z-index: 50; top: 0; bottom: 0; left: 0; width: min(80vw, 280px); height: 100dvh;
             transform: translateX(-100%); transition: transform .2s ease; box-shadow: none; visibility: hidden; }
  [data-nav-open] .nx-side { transform: none; box-shadow: var(--shadow); visibility: visible; }
  [data-nav-open] .nx-scrim { display: block; position: fixed; inset: 0; z-index: 40; background: var(--backdrop); }
  [data-nav-open] body { overflow: hidden; }
  .nx-nav a { padding: var(--sp-3); }                       /* 손가락 크기 */
  .nx-page { padding: var(--sp-4) var(--sp-3) var(--sp-6); }
  .nx-topbar h1 { display: none; }                          /* 이름은 머리줄에 있다 */
  .nx-topbar:not(:has(> .nx-row > :not([hidden]))) { display: none; }   /* 보일 단추가 없으면 빈 띠를 두지 않는다 */
  .nx-topbar:not(:has(> .nx-row > :not([hidden]))) + * { margin-top: 0; }   /* 그 뒤 덩어리의 간격도 */
  .nx-topbar > .nx-row { margin-left: 0; }
}
@media (max-width: 900px) and (prefers-reduced-motion: reduce) { .nx-side { transition: none; } }

/* ── 4. 토스트(nx.toast) ─────────────────────────────── */
.nx-toasts { position: fixed; z-index: 60; right: var(--sp-4); bottom: var(--sp-4); display: flex; flex-direction: column;
             gap: var(--sp-2); width: min(360px, calc(100vw - 2 * var(--sp-4))); pointer-events: none; }
.nx-toast { pointer-events: auto; padding: var(--sp-3) var(--sp-4); border-radius: var(--r-2); background: var(--surface);
            border: 1px solid var(--line); border-left: 4px solid var(--info); box-shadow: var(--shadow); font-size: var(--fs-s);
            animation: nx-toast-in .18s ease-out, nx-toast-out .3s ease-in 4s forwards; }
.nx-toast[data-level="ok"] { border-left-color: var(--ok); }
.nx-toast[data-level="warn"] { border-left-color: var(--warn); }
.nx-toast[data-level="bad"] { border-left-color: var(--bad); animation: nx-toast-in .18s ease-out; }  /* 잘못은 저절로 안 사라진다 */
@keyframes nx-toast-in { from { opacity: 0; transform: translateY(8px); } }
@keyframes nx-toast-out { to { opacity: 0; transform: translateY(8px); visibility: hidden; } }
@media (prefers-reduced-motion: reduce) { .nx-toast { animation: none; } }

/* ── 5. 단추 ───────────────────────────────────────────── */
.nx-btn { display: inline-flex; align-items: center; justify-content: center; gap: var(--sp-1); min-height: var(--ctl-h);
          padding: 0 var(--sp-3); border: 1px solid var(--line); border-radius: var(--r-1); background: var(--surface-2);
          color: var(--fg); font: inherit; font-size: var(--fs-s); line-height: 1.2; text-decoration: none; white-space: nowrap; cursor: pointer; }
.nx-btn:hover { border-color: var(--acc); }
.nx-btn:disabled, .nx-btn[aria-disabled="true"] { opacity: .5; cursor: not-allowed; }
.nx-btn[aria-busy="true"] { cursor: progress; opacity: .75; }
.nx-btn[aria-busy="true"]::after { content: ""; flex: none; width: 12px; height: 12px; margin-left: 6px; border: 2px solid currentColor; border-top-color: transparent;
  border-radius: 50%; display: inline-block; vertical-align: -2px; animation: nx-spin .8s linear infinite; }   /* 일하는 단추 — 도는 동그라미 */
.nx-btn-primary { background: var(--acc); border-color: var(--acc); color: var(--acc-fg); font-weight: 600; }
.nx-btn-danger { background: var(--bad); border-color: var(--bad); color: #fff; font-weight: 600; }
.nx-btn-ghost { background: transparent; border-color: transparent; }
.nx-btn-ghost:hover { background: var(--surface-2); border-color: transparent; }
.nx-btn-sm { min-height: 28px; padding: 0 var(--sp-2); font-size: var(--fs-xs); }
.nx-btn-block { width: 100%; }
.nx-actions { display: flex; flex-wrap: wrap; gap: var(--sp-2); justify-content: flex-end; margin-top: var(--sp-4); }
.nx-actions form { margin: 0; }
.nx-form .nx-actions { justify-content: flex-start; }   /* 폼 단추는 칸 바로 밑 왼쪽 — 어느 폼 단추인지 헷갈리지 않게 */
.nx-modal .nx-form .nx-actions { justify-content: flex-end; }   /* 모달 끝 단추는 오른쪽 그대로 */
.nx-form-narrow { max-width: 32rem; }
/* 보기 · 수정 상자 — 처음엔 지금 값만(.nx-view), '수정' 을 누르면 폼(.nx-edit). nx.js 가 .is-editing 을 붙인다 */
[data-editable]:not(.is-editing) .nx-edit, [data-editable].is-editing .nx-view { display: none; }
.nx-view:not(.nx-row) > * + *, .nx-edit > * + * { margin-top: var(--sp-3); }   /* 칸이 한 줄씩인 짧은 폼(비밀번호 등) — 넓은 화면에서 끝없이 늘지 않게 */

/* ── 6. 점(메뉴·상태 점이 같이 쓴다) ─────────────────── */
.nx-dot { display: inline-block; flex: none; width: 9px; height: 9px; border-radius: 50%; background: var(--off); }
.nx-dot[data-state="ok"] { background: var(--ok); }
.nx-dot[data-state="warn"] { background: var(--warn); }
.nx-dot[data-state="bad"] { background: var(--bad); }
.nx-dot[data-state="off"] { background: var(--off); }
.nx-dot[data-state="stop"] { background: var(--stop); box-shadow: 0 0 0 1.5px var(--stop-ring); }   /* 중단 — 사람이 · 자동으로 멈춤(off 는 아직 모름) */
.nx-dot[data-state="run"] { background: var(--info); animation: nx-dot-run 1.2s ease-in-out infinite; }   /* 수행 중 — 깜빡임 */
@keyframes nx-dot-run { 50% { opacity: .25; } }
@media (prefers-reduced-motion: reduce) { .nx-dot[data-state="run"] { animation: none; } }

/* ── 7. 글 목록 ───────────────────────────────────────── */
.nx-list { margin: 0; padding: 0; list-style: none; }
.nx-list > li { display: flex; gap: var(--sp-3); align-items: flex-start; padding: var(--sp-2) 0; border-bottom: 1px solid var(--line); }
.nx-list > li > * { min-width: 0; }
/* 한 줄 = 머리(시간 · 꼬리표 — 줄바꿈 안 함) + 몸(글 — 남은 폭). 좁으면 머리 위 · 몸 아래 */
.nx-list-head { flex: none; display: flex; align-items: center; gap: var(--sp-2); white-space: nowrap; }
.nx-list-body { flex: 1 1 auto; min-width: 0; overflow-wrap: anywhere; }
@media (max-width: 600px) {
  .nx-list > li:has(> .nx-list-head) { flex-direction: column; gap: var(--sp-1); }
}
.nx-list > li:last-child { border-bottom: 0; }

/* ── 아이콘(Tabler · 원장 telos/web/icons.py) — 글 크기를 따라가는 선 아이콘 ── */
.nx-icon { width: 1.15em; height: 1.15em; flex: none; vertical-align: -.2em; stroke-width: 1.9; }
.nx-btn .nx-icon { width: 16px; height: 16px; vertical-align: 0; }
.nx-btn-sm .nx-icon { width: 14px; height: 14px; }
.nx-nav .nx-nav-icon { width: auto; display: inline-flex; color: var(--muted); transition: color .15s; }
.nx-nav .nx-nav-icon .nx-icon { width: 19px; height: 19px; }
.nx-nav a:hover .nx-nav-icon { color: var(--fg); }
.nx-nav a[aria-current="page"] .nx-nav-icon { color: var(--acc); }
.nx-topbar h1 { display: flex; align-items: center; gap: var(--sp-2); }
.nx-topbar h1 .nx-icon, .nx-mbar-title .nx-icon { color: var(--acc); }
.nx-card-title h2 { display: flex; align-items: center; gap: var(--sp-2); }
.nx-card-title h2 .nx-icon { color: var(--muted); }
.nx-bare h1 { display: flex; align-items: center; gap: var(--sp-2); }
.nx-bare h1 .nx-icon { width: 24px; height: 24px; color: var(--acc); }
.nx-theme-btn .nx-icon { width: 18px; height: 18px; }
.nx-theme-to-light .nx-icon { color: var(--warn); }
.nx-theme-to-dark .nx-icon { color: var(--acc); }

/* TELOS 로고(2026-12-02 사람이 준 그림 — static/telos/brand) */
.nx-brand .nx-brand-text { font-size: var(--fs-l); font-weight: 800; letter-spacing: .12em;   /* 옆 메뉴는 그라디언트 글자만 — 로고 그림은 넣지 않는다(2026-12-02 사람) */
                           background: linear-gradient(90deg, #4fd8ff, #7b5cff); -webkit-background-clip: text; background-clip: text; color: transparent; }
.nx-side-ver { margin: var(--sp-2) 0 0; text-align: center; font-size: var(--fs-xs, 11px); color: var(--muted); }   /* 판 번호는 옆 메뉴 맨 아래 */
.nx-brand .nx-version { margin-left: 0; }
.nx-mbar-brand .t-logo { height: 28px; width: auto; display: block; }
.t-login-brand { display: flex; justify-content: center; padding: var(--sp-2) 0 var(--sp-3); }
.t-login-brand img { height: 160px; width: auto; filter: drop-shadow(0 0 12px rgba(80, 200, 255, .3)); }
.t-brand-words { display: flex; flex-direction: column; line-height: 1.15; }
