/* 리파이너리 콘솔 관리 화면 — 리파이너리 웹 디자인 시스템(apps/web/app/refinery.css 의 rail 토큰 · rfn-* 컴포넌트)을
   그대로 옮긴 것. 외부 리소스 없음(CSP default-src 'self') — Pretendard·Roboto·JetBrains Mono 는 설치돼 있으면 쓰고
   없으면 시스템 글꼴.
   테마: 기본은 운영체제 설정(prefers-color-scheme), <html data-theme="light|dark"> 가 있으면 그것을 따른다(사용자 메뉴에서 고름).
   의미 이름(--bg · --surface · --text · --accent · --ok-* …)은 화면 코드(app.js · billing.js)가 기대는 계약이라 이름을 바꾸지 않는다. */

/* ───────── 토큰 — 라이트(기본) ───────── */

:root {
  color-scheme: light;
  --font: "Pretendard", "Pretendard Variable", Roboto, system-ui, -apple-system, "Segoe UI", "Apple SD Gothic Neo",
    "Malgun Gothic", "Noto Sans KR", "Helvetica Neue", Arial, sans-serif;
  --font-head: "Pretendard", "Pretendard Variable", var(--font);
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "D2Coding", "Liberation Mono", monospace;
  --radius-sm: 6px;
  --radius: 8px;
  --radius-lg: 10px;
  --radius-xl: 12px;
  --rail-w: 216px;
  --rail-w-collapsed: 52px;
  --side-w: 240px;
  --page-pad: 20px 24px 40px;

  /* rail 토큰(리파이너리 refinery.css 와 같은 값) */
  --brand: #76a6d7;
  --brand-600: #5a8fc5;
  --brand-700: #3f76ae;
  --brand-50: #eef4fb;
  --brand-100: #dce8f5;
  --ink-900: #16202c;
  --ink-800: #22303f;
  --ink-700: #3a4856;
  --ink-600: #5a6776;
  --ink-500: #7e8a98;
  --ink-400: #a4adb8;
  --ink-300: #c8ced5;
  --ink-200: #e3e7ec;
  --ink-100: #eff2f5;
  --ink-50: #f6f8fa;
  --white: #ffffff;
  --rail-bg: #fafbfc;
  --topbar-bg: #fafbfc;
  --side-bg: #ffffff;
  --page-bg: #f6f8fa;
  --fill-nest: #f6f8fa;
  --fill-soft: #eff2f5;
  --divider: #eff2f5;
  --link: #3f76ae;
  --good: #3fb255;
  --warn: #f0a93a;
  --bad: #e5484d;
  --side-active-bg: var(--ink-100);

  --shadow-sm: 0 1px 2px rgba(20, 30, 45, 0.05);
  --shadow-card: 0 1px 2px rgba(20, 30, 45, 0.04), 0 1px 1px rgba(20, 30, 45, 0.04);
  --shadow-pop: 0 12px 28px rgba(20, 30, 45, 0.12), 0 2px 6px rgba(20, 30, 45, 0.06);
  --shadow-modal: 0 24px 48px rgba(20, 30, 45, 0.18), 0 6px 14px rgba(20, 30, 45, 0.1);
  --backdrop: rgba(20, 30, 45, 0.4);
  --ring: 0 0 0 3px rgba(118, 166, 215, 0.3);

  /* 화면에서 쓰는 의미 이름 */
  --bg: var(--page-bg);
  --surface: var(--white);
  --surface-2: var(--fill-nest);
  --hover: var(--ink-50);
  --border: var(--ink-200);
  --border-strong: var(--ink-300);
  --text: var(--ink-900);
  --text-2: var(--ink-700);
  --muted: var(--ink-500);
  --accent: var(--brand);
  --accent-hover: var(--brand-600);
  --accent-soft: var(--brand-50);
  --accent-ink: #ffffff;
  --danger-bg: var(--bad);
  --danger-hover: #db1f25;

  --ok-ink: #1b7a2c;
  --ok-bg: rgba(63, 178, 85, 0.1);
  --ok-line: rgba(63, 178, 85, 0.25);
  --ok-mark: var(--good);
  --info-ink: var(--brand-700);
  --info-bg: var(--brand-50);
  --info-line: var(--brand-100);
  --info-mark: var(--brand);
  --warn-ink: #a45f00;
  --warn-bg: rgba(240, 169, 58, 0.12);
  --warn-line: rgba(240, 169, 58, 0.3);
  --warn-mark: var(--warn);
  --crit-ink: #a8181d;
  --crit-bg: rgba(229, 72, 77, 0.1);
  --crit-line: rgba(229, 72, 77, 0.25);
  --crit-mark: var(--bad);
  --neutral-ink: var(--ink-700);
  --neutral-bg: var(--ink-100);
  --neutral-line: var(--ink-200);
  --neutral-mark: var(--ink-400);
  --active-bg: var(--brand-50);
}

/* ───────── 토큰 — 다크(운영체제 설정 · 직접 고름 두 경우에 같은 값) ───────── */

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --brand-50: rgba(118, 166, 215, 0.15);
    --brand-100: rgba(118, 166, 215, 0.24);
    --ink-900: #f7f9fc;
    --ink-800: #e4e9ef;
    --ink-700: #b4bbc5;
    --ink-600: #a9b0bb;
    --ink-500: #a0a8b3;
    --ink-400: #7e858f;
    --ink-300: #494f57;
    --ink-200: #353c44;
    --ink-100: #292f37;
    --ink-50: #191f27;
    --white: #212830;
    --rail-bg: #151b23;
    --topbar-bg: #151b23;
    --side-bg: #191f27;
    --page-bg: #151b23;
    --fill-nest: #1c222a;
    --fill-soft: #2f353d;
    --divider: #2d333b;
    --link: var(--brand);
    --side-active-bg: var(--ink-300);
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.45);
    --shadow-card: 0 2px 6px rgba(0, 0, 0, 0.35), 0 1px 2px rgba(0, 0, 0, 0.3);
    --shadow-pop: 0 12px 28px rgba(0, 0, 0, 0.4), 0 2px 6px rgba(0, 0, 0, 0.2);
    --shadow-modal: 0 24px 48px rgba(0, 0, 0, 0.5), 0 6px 14px rgba(0, 0, 0, 0.3);
    --backdrop: rgba(0, 0, 0, 0.6);
    --hover: var(--ink-100);
    --accent-hover: #8db5de;
    --danger-hover: #ec5f63;
    --ok-ink: #79d08c;
    --ok-bg: rgba(63, 178, 85, 0.12);
    --ok-line: rgba(63, 178, 85, 0.35);
    --info-ink: #8fb6dd;
    --info-line: rgba(118, 166, 215, 0.3);
    --warn-ink: #f0a93a;
    --warn-bg: rgba(240, 169, 58, 0.14);
    --warn-line: rgba(240, 169, 58, 0.4);
    --crit-ink: #ff8a8e;
    --crit-bg: rgba(229, 72, 77, 0.12);
    --crit-line: rgba(229, 72, 77, 0.35);
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --brand-50: rgba(118, 166, 215, 0.15);
  --brand-100: rgba(118, 166, 215, 0.24);
  --ink-900: #f7f9fc;
  --ink-800: #e4e9ef;
  --ink-700: #b4bbc5;
  --ink-600: #a9b0bb;
  --ink-500: #a0a8b3;
  --ink-400: #7e858f;
  --ink-300: #494f57;
  --ink-200: #353c44;
  --ink-100: #292f37;
  --ink-50: #191f27;
  --white: #212830;
  --rail-bg: #151b23;
  --topbar-bg: #151b23;
  --side-bg: #191f27;
  --page-bg: #151b23;
  --fill-nest: #1c222a;
  --fill-soft: #2f353d;
  --divider: #2d333b;
  --link: var(--brand);
  --side-active-bg: var(--ink-300);
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.45);
  --shadow-card: 0 2px 6px rgba(0, 0, 0, 0.35), 0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow-pop: 0 12px 28px rgba(0, 0, 0, 0.4), 0 2px 6px rgba(0, 0, 0, 0.2);
  --shadow-modal: 0 24px 48px rgba(0, 0, 0, 0.5), 0 6px 14px rgba(0, 0, 0, 0.3);
  --backdrop: rgba(0, 0, 0, 0.6);
  --hover: var(--ink-100);
  --accent-hover: #8db5de;
  --danger-hover: #ec5f63;
  --ok-ink: #79d08c;
  --ok-bg: rgba(63, 178, 85, 0.12);
  --ok-line: rgba(63, 178, 85, 0.35);
  --info-ink: #8fb6dd;
  --info-line: rgba(118, 166, 215, 0.3);
  --warn-ink: #f0a93a;
  --warn-bg: rgba(240, 169, 58, 0.14);
  --warn-line: rgba(240, 169, 58, 0.4);
  --crit-ink: #ff8a8e;
  --crit-bg: rgba(229, 72, 77, 0.12);
  --crit-line: rgba(229, 72, 77, 0.35);
}

/* ───────── 기본 ───────── */

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; background: var(--bg); }

body {
  margin: 0;
  min-height: 100vh;
  font: 14px/1.5 var(--font);
  color: var(--text);
  background: var(--bg);
  overflow-x: clip;
  -webkit-font-smoothing: antialiased;
}

h1 { margin: 0; font-family: var(--font-head); font-size: 23px; line-height: 1.2; font-weight: 700; letter-spacing: -0.02em; color: var(--ink-900); }
h2 { margin: 0; font-size: 14px; line-height: 1.35; font-weight: 600; letter-spacing: -0.005em; color: var(--ink-900); }
h3 { margin: 0 0 6px; font-size: 12.5px; font-weight: 600; color: var(--ink-600); }
p { margin: 0; }
ul, ol { margin: 0; }
a { color: var(--link); text-decoration: none; }
a:hover { color: var(--brand-600); text-decoration: underline; text-underline-offset: 2px; }
code, pre, .mono { font-family: var(--mono); font-size: 0.92em; }
strong { font-weight: 600; }

:focus-visible { outline: none; box-shadow: var(--ring); border-radius: var(--radius-sm); }

.muted { color: var(--muted); }
.small { font-size: 12px; }
.nowrap { white-space: nowrap; }
.text-crit { color: var(--crit-ink); }
.sr-only {
  position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* 아이콘 — .ph = Phosphor(채움), .ic = 예전 선 아이콘(16px · currentColor 선) */
.ph { flex: none; display: inline-block; fill: currentColor; vertical-align: middle; }
.ic { flex: none; width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.symbol { flex: none; display: block; fill: currentColor; }

/* ───────── 셸: 레일(level 1) + 서브 메뉴(level 2) + 상단 바 + 본문 — 리파이너리 GlobalSidebar · AppShell ───────── */

.shell { display: flex; min-height: 100vh; }

.rail {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  flex-direction: column;
  flex: none;
  width: var(--rail-w);
  height: 100vh;
  border-right: 1px solid var(--ink-200);
  background: var(--rail-bg);
  transition: width 0.2s ease-out;
}
.rail-logo {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 56px;
  flex: none;
  padding: 0 12px 0 14px;
  border-bottom: 1px solid var(--ink-100);
}
.rail-brand {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  color: var(--ink-900);
  font-family: var(--font-head);
  font-size: 14px;
  font-weight: 700;
  letter-spacing: -0.015em;
  white-space: nowrap;
}
.rail-brand:hover { color: var(--ink-900); text-decoration: none; }
.rail-brand .symbol { width: 28px; height: 28px; color: var(--ink-900); }
.rail-word { overflow: hidden; text-overflow: ellipsis; }
.rail-toggle, .rail-expand {
  display: inline-grid;
  place-items: center;
  width: 22px;
  height: 22px;
  margin-left: auto;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
  color: var(--ink-400);
  cursor: pointer;
  transition: background-color 0.12s, border-color 0.12s, color 0.12s;
}
.rail-toggle:hover { border-color: var(--ink-200); background: var(--ink-100); color: var(--ink-700); }
.rail-expand {
  position: absolute;
  top: 17px;
  right: -11px;
  z-index: 2;
  display: none;
  border-color: var(--ink-200);
  background: var(--white);
  color: var(--ink-500);
  opacity: 0;
  transition: opacity 0.12s;
}
.rail-expand:hover { background: var(--ink-50); color: var(--ink-700); }
.rail:hover .rail-expand, .rail-expand:focus-visible { opacity: 1; }

.rail-nav {
  display: flex;
  flex-direction: column;
  gap: 1px;
  flex: 1 1 auto;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  padding: 4px 8px 6px;
  scrollbar-width: none;
}
.rail-nav::-webkit-scrollbar { display: none; }
.rail-item {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 10px;
  border-radius: var(--radius-sm);
  color: var(--ink-600);
  font-size: 12.5px;
  font-weight: 500;
  white-space: nowrap;
  transition: background-color 0.12s, color 0.12s;
}
.rail-item:hover { background: var(--ink-100); color: var(--ink-900); text-decoration: none; }
.rail-item[aria-current="page"] { background: var(--brand-50); color: var(--link); font-weight: 700; }
.rail-bar { display: none; }
.rail-item[aria-current="page"] .rail-bar {
  position: absolute;
  top: 7px;
  bottom: 7px;
  left: 0;
  display: block;
  width: 2.5px;
  border-radius: 0 2px 2px 0;
  background: var(--brand);
}
.rail-text { overflow: hidden; text-overflow: ellipsis; }
/* 레일 항목의 숫자(열린 경보) — 위험 빨강 · 경고 주황 */
.rail-count {
  margin-left: auto;
  min-width: 18px;
  padding: 0 5px;
  border-radius: 9px;
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  line-height: 18px;
  text-align: center;
}
.rail-count.crit { background: var(--crit-mark); }
.rail-count.warn { background: var(--warn-mark); }
html.rail-collapsed .rail-count { position: absolute; top: 2px; right: 4px; min-width: 14px; padding: 0 3px; font-size: 9.5px; line-height: 14px; }

.rail-bottom { position: relative; flex: none; display: grid; gap: 4px; padding: 8px; border-top: 1px solid var(--ink-100); }
.rail-foot {
  margin: 0;
  padding: 0 4px;
  overflow: hidden;
  color: var(--ink-400);
  font-size: 10.5px;
  letter-spacing: -0.01em;
  line-height: 1.4;
  white-space: normal; /* 「v0.1.87 · 2026-10-14」 가 레일 폭을 넘으면 잘리지 않고 두 줄로 */
}

/* 사용자 단추 + 메뉴(레일 아래) */
.user { position: relative; min-width: 0; }
.user-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--ink-200);
  border-radius: var(--radius-sm);
  background: var(--white);
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
  transition: background-color 0.12s, border-color 0.12s;
}
.user-btn:hover, .user-btn[aria-expanded="true"] { background: var(--ink-50); border-color: var(--ink-300); }
.user-text { display: flex; flex: 1 1 auto; flex-direction: column; min-width: 0; }
.user-name, .user-sub { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-name { color: var(--ink-700); font-size: 13px; font-weight: 500; }
.user-sub { color: var(--ink-500); font-size: 10.5px; letter-spacing: -0.01em; }
.user-caret { color: var(--ink-400); transition: transform 0.12s; }
.user-btn[aria-expanded="true"] .user-caret { color: var(--ink-700); transform: rotate(180deg); }
.avatar {
  display: inline-grid;
  place-items: center;
  flex: none;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--brand-100);
  color: var(--brand-700);
  font-size: 13px;
  font-weight: 700;
}
.avatar.lg { width: 32px; height: 32px; font-size: 14.5px; }
:root[data-theme="dark"] .avatar { color: var(--ink-900); }

/* 떠 있는 메뉴 — 리파이너리 사용자 팝오버 */
.pop {
  border: 1px solid var(--ink-200);
  border-radius: var(--radius-xl);
  background: var(--white);
  box-shadow: var(--shadow-pop);
}
.user-menu {
  position: absolute;
  right: 0;
  bottom: calc(100% + 6px);
  left: 0;
  z-index: 50;
  min-width: 232px;
  padding: 6px;
  animation: pop-in 0.16s cubic-bezier(0.2, 0, 0, 1);
}
.menu-head { display: flex; align-items: center; gap: 10px; margin-bottom: 4px; padding: 10px; border-bottom: 1px solid var(--ink-100); }
.menu-who { display: flex; flex-direction: column; min-width: 0; }
.menu-who strong { overflow: hidden; color: var(--ink-900); font-size: 14px; text-overflow: ellipsis; white-space: nowrap; }
.menu-who .mono { overflow: hidden; color: var(--ink-500); font-size: 10.5px; letter-spacing: -0.01em; text-overflow: ellipsis; white-space: nowrap; }
.menu-group { display: grid; gap: 6px; margin: 2px 0; padding: 6px 10px; border-bottom: 1px solid var(--ink-100); }
.menu-row { display: flex; align-items: center; gap: 10px; color: var(--ink-700); font-size: 14px; font-weight: 500; }
.menu-row .ph { color: var(--ink-500); }
.seg { display: flex; padding: 2px; border: 1px solid var(--ink-200); border-radius: var(--radius-sm); background: var(--ink-50); box-shadow: var(--shadow-sm); }
.seg-opt {
  display: flex;
  flex: 1;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 5px 10px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--ink-600);
  font: inherit;
  font-size: 12.5px;
  cursor: pointer;
}
.seg-opt:hover { color: var(--ink-900); }
.seg-opt[aria-pressed="true"] { background: var(--ink-900); color: var(--ink-50); font-weight: 600; box-shadow: 0 1px 2px rgba(20, 30, 45, 0.18); }
.menu-list { display: grid; gap: 1px; padding: 2px 0; }
.menu-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 8px 10px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--ink-700);
  font: inherit;
  font-size: 14px;
  font-weight: 500;
  text-align: left;
  cursor: pointer;
}
.menu-item .ph { color: var(--ink-500); }
.menu-item:hover { background: var(--ink-50); color: var(--ink-900); }
.menu-version { margin: 4px 0 0; padding: 6px 10px 4px; border-top: 1px solid var(--ink-100); color: var(--ink-400); font-size: 10.5px; letter-spacing: -0.01em; }

/* 서브 메뉴(.side) — 지금 영역의 하위 화면 */
.side {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  flex-direction: column;
  flex: none;
  width: var(--side-w);
  height: 100vh;
  border-right: 1px solid var(--ink-200);
  background: var(--side-bg);
  overflow: hidden;
  transition: width 0.2s ease;
}
.side-head { display: flex; align-items: center; height: 56px; flex: none; padding: 0 18px; border-bottom: 1px solid var(--ink-100); }
.side-title { color: var(--ink-500); font-size: 11.5px; font-weight: 600; letter-spacing: 0.08em; white-space: nowrap; }
.side-nav { display: flex; flex: 1 1 auto; flex-direction: column; gap: 1px; min-height: 0; overflow-y: auto; padding: 8px 10px; }
.side-item {
  display: flex;
  align-items: center;
  gap: 10px;
  height: 32px;
  padding: 0 8px;
  border-radius: 7px;
  color: var(--ink-700);
  font-size: 14px;
  font-weight: 500;
  white-space: nowrap;
  transition: background-color 0.12s, color 0.12s;
}
.side-item .ph { color: var(--ink-500); }
.side-item:hover { background: var(--ink-50); color: var(--ink-900); text-decoration: none; }
.side-item.is-active { background: var(--side-active-bg); color: var(--ink-900); font-weight: 600; box-shadow: 0 1px 2px rgba(20, 30, 45, 0.08); }
.side-item.is-active .ph { color: var(--ink-700); }
.side-label { overflow: hidden; text-overflow: ellipsis; }
.side-foot { flex: none; padding: 4px 8px 8px; border-top: 1px solid var(--ink-100); }
.side-close {
  display: flex;
  align-items: center;
  gap: 7px;
  width: 100%;
  padding: 6px 8px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--ink-600);
  font: inherit;
  font-size: 12.5px;
  font-weight: 500;
  cursor: pointer;
}
.side-close:hover { background: var(--ink-50); color: var(--ink-900); }
/* 접힌 서브 메뉴 — 폭 0, 오른쪽 가장자리 가운데에 둥근 펼치기 단추(.rfn-side-expand-btn) */
.side-expand {
  position: absolute;
  top: 50%;
  right: -14px;
  z-index: 40;
  display: none;
  place-items: center;
  width: 28px;
  height: 28px;
  padding: 0;
  border: 1px solid var(--ink-200);
  border-radius: 50%;
  background: var(--white);
  color: var(--ink-500);
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  transform: translateY(-50%);
}
.side-expand:hover { background: var(--ink-50); color: var(--ink-800); }
html.side-collapsed .side { width: 0; overflow: visible; border-right-width: 0; }
html.side-collapsed .side > :not(.side-expand) { display: none; }
html.side-collapsed .side-expand { display: grid; }

.frame { position: relative; display: flex; flex-direction: column; flex: 1 1 auto; min-width: 0; }

.topbar {
  position: sticky;
  top: 0;
  z-index: 15;
  display: flex;
  align-items: center;
  gap: 12px;
  height: 56px;
  flex: none;
  padding: 0 24px;
  border-bottom: 1px solid var(--ink-200);
  background: var(--topbar-bg);
}
.topbar-crumbs {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  color: var(--ink-500);
  font-size: 14px;
  white-space: nowrap;
}
/* 상단 바 오른쪽 — 열린 경보 수 */
.topbar-alerts { display: inline-flex; flex: none; align-items: center; gap: 6px; color: var(--ink-600); }
.topbar-alerts[hidden] { display: none; }
.topbar-alerts:hover { color: var(--ink-900); text-decoration: none; }
.badge-link:hover { text-decoration: none; }
.crumb-icon { display: inline-flex; flex: none; color: var(--ink-700); }
.crumb-trail, .crumb { display: flex; align-items: center; gap: 8px; min-width: 0; }
.crumb-trail .sep { flex: none; width: 14px; height: 14px; color: var(--ink-400); stroke-width: 2.2; }
.crumb-trail a { flex: none; max-width: 14rem; overflow: hidden; color: var(--ink-500); text-overflow: ellipsis; }
.crumb-trail a:hover { color: var(--ink-900); text-decoration: none; }
.crumb-trail .here { min-width: 5rem; overflow: hidden; text-overflow: ellipsis; color: var(--ink-900); font-weight: 600; }

/* 로그인 전(설정 확인·로그인 화면): 레일·서브 메뉴·상단 바 없이 */
body.bare .rail, body.bare .side, body.bare .topbar { display: none !important; }
body.bare .main { max-width: 760px; margin: 0 auto; padding-top: 10vh; }
body.auth-mode .main { max-width: none; margin: 0; padding: 0; }

.banner {
  padding: 9px 24px;
  border-bottom: 1px solid var(--warn-line);
  background: var(--warn-bg);
  color: var(--warn-ink);
  font-size: 13px;
  overflow-wrap: anywhere;
}
.banner strong { font-weight: 700; }

.main {
  flex: 1 0 auto;
  width: 100%;
  max-width: 1440px;
  min-width: 0;
  padding: var(--page-pad);
}
.main:focus, .main:focus-visible { outline: none; box-shadow: none; }

.stack { display: grid; gap: 12px; min-width: 0; align-content: start; }
.stack-lg { display: grid; gap: 16px; min-width: 0; align-content: start; }
.stack-sm { display: grid; gap: 10px; min-width: 0; }
.stack-xs { display: grid; gap: 3px; min-width: 0; justify-items: start; }
/* 고객 포털 계정 — 로그인 테스트 열: 단추(줄바꿈 없이 고정 폭) 바로 옆에 결과 배지 · 시각 */
.login-test { display: flex; align-items: center; gap: 8px; }
.login-test-btn { white-space: nowrap; min-width: 8em; justify-content: center; }
.login-test-result { white-space: normal; min-width: 12em; max-width: 24em; }
.login-test-result:empty { display: none; }
.btn-row.nowrap { flex-wrap: nowrap; }
/* 고객 포털 계정 — 상태 탭(줄 수 포함) */
.state-bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 16px; }
.state-tabs { flex-wrap: wrap; }
.state-tabs .seg-opt { flex: 0 0 auto; }
.seg-count { min-width: 1.6em; padding: 0 5px; border-radius: 999px; background: var(--ink-100); color: var(--ink-600); font-size: 11px; font-variant-numeric: tabular-nums; text-align: center; }
.seg-opt[aria-pressed="true"] .seg-count { background: rgba(255, 255, 255, 0.2); color: inherit; }
/* 고객 포털 계정 — 새 행 입력 표: 칸이 곧 입력란(엑셀처럼 테두리 없이 칸 전체를 쓴다) */
.sheet .table td.sheet-cell { padding: 0; border-right: 1px solid var(--ink-100); }
.sheet .table td.sheet-cell input, .sheet .table td.sheet-cell select {
  min-width: 6.5em;
  height: 36px;
  border: 0;
  border-radius: 0;
  background: transparent;
}
.sheet .table td.sheet-company input { min-width: 9em; }
.sheet .table td.sheet-cell input:focus, .sheet .table td.sheet-cell select:focus { box-shadow: inset 0 0 0 2px var(--brand); }
.sheet .table td.sheet-cell select.bad { box-shadow: inset 0 0 0 2px var(--crit-ink); }
.sheet .table tbody tr:hover td { background: transparent; }
.sheet .table tbody tr:focus-within td { background: var(--accent-soft); }
.sheet .table tr.row-warn td { background: var(--crit-bg); }
.sheet .table td.sheet-result { white-space: normal; min-width: 8em; max-width: 22em; }
.sheet .table td.sheet-result:has(.sheet-status:empty) { min-width: 0; }
.sheet .table td.sheet-del { width: 1%; padding: 0 4px; }
.sheet .table td.sheet-result .badge { white-space: normal; }
.grid-2 {
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 380px), 1fr));
  align-items: start;
}
.grid-3 {
  display: grid;
  gap: 12px 16px;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr));
  align-items: start;
}
.split { display: grid; gap: 16px; align-items: start; }
@media (min-width: 1100px) { .split { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); } }

/* 페이지 머리 — .rfn-page-head (h1 23px · 부제 12.5px · 오른쪽 끝 동작) */
.page-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 8px;
}
.page-head > div { flex: 1 1 320px; min-width: 0; }
.page-head > .btn, .page-head > .btn-row, .page-head > .actions { flex: none; }
.page-head p { margin-top: 6px; color: var(--ink-500); font-size: 12.5px; font-weight: 500; line-height: 1.45; }
.title-row { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; overflow-wrap: anywhere; }
.title-row .mono { color: var(--ink-500); font-size: 0.72em; font-weight: 500; letter-spacing: -0.01em; }
.meta-row { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; margin-top: 8px; font-size: 13px; }
.actions, .btn-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.crumbs { color: var(--muted); font-size: 13px; }

/* 구획 머리 + 개수 — .rfn-section-head / .rfn-count-badge */
.rfn-section-head { display: flex; align-items: center; gap: 8px; min-width: 0; }
.rfn-section-head__title { color: var(--ink-900); font-size: 14px; font-weight: 600; letter-spacing: -0.005em; }
.rfn-count-badge {
  display: inline-flex;
  align-items: center;
  padding: 1px 7px;
  border: 1px solid var(--ink-200);
  border-radius: 5px;
  background: var(--ink-100);
  color: var(--ink-700);
  font: 600 10.5px/1.4 var(--mono);
  font-variant-numeric: tabular-nums;
}

/* ───────── 카드 — .rfn-widget ───────── */

.card {
  min-width: 0;
  padding: 14px 16px 16px;
  background: var(--surface);
  border: 1px solid var(--ink-200);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
}
.card-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 6px 12px;
  margin: -14px -16px 14px;
  padding: 13px 16px;
  border-bottom: 1px solid var(--divider);
}
.card-head .muted.small { font-size: 12.5px; font-weight: 500; }
/* 카드 제목 + 사용 방법 툴팁(lib.js card 의 tip) — 제목과 「?」를 한 묶음으로 왼쪽에 둔다(머리는 양끝 정렬) */
.card-title { display: inline-flex; align-items: center; gap: 6px; min-width: 0; }
.subsec { min-width: 0; }
.pre { white-space: pre-wrap; }
.check { display: inline-flex; align-items: center; gap: 8px; font-size: 13.5px; cursor: pointer; }
.check input { width: 16px; height: 16px; margin: 0; padding: 0; accent-color: var(--brand); }
.table tr.detail-row td { background: var(--surface-2); }
.btn[aria-expanded] > .ic.sep { width: 14px; height: 14px; transition: transform 0.12s; }
.btn[aria-expanded="true"] > .ic.sep { transform: rotate(90deg); }

.kv { margin: 0; display: grid; }
.kv-row {
  display: grid;
  grid-template-columns: minmax(7em, 34%) minmax(0, 1fr);
  gap: 8px;
  padding: 9px 0;
  border-bottom: 1px solid var(--divider);
}
.kv-row:first-child { padding-top: 2px; }
.kv-row:last-child { border-bottom: 0; padding-bottom: 0; }
.kv dt { color: var(--ink-500); font-size: 12.5px; padding-top: 1px; }
.kv dd { margin: 0; min-width: 0; color: var(--ink-800); font-size: 13px; overflow-wrap: anywhere; }

.product-grid {
  display: grid;
  gap: 16px 28px;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 400px), 1fr));
}
.product-form { margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--divider); }

details.disclosure { padding-top: 10px; border-top: 1px solid var(--divider); }
details.disclosure > summary { cursor: pointer; color: var(--ink-700); font-size: 13px; font-weight: 600; }
details.disclosure > summary:hover { color: var(--ink-900); }
details.disclosure[open] > summary { margin-bottom: 10px; }

/* ───────── 개요: 지표 타일 · 점검 항목 · 연도 막대 · 확인 필요 ───────── */

.stats { display: grid; gap: 12px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (min-width: 900px) { .stats { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.stat {
  position: relative;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px 14px 14px;
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--ink-200);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  color: var(--text);
}
a.stat { transition: border-color 0.15s, box-shadow 0.15s; }
a.stat:hover { border-color: var(--ink-300); box-shadow: 0 2px 6px rgba(20, 30, 45, 0.06); color: var(--text); text-decoration: none; }
.stat::before { content: ""; position: absolute; top: 0; bottom: 0; left: 0; width: 3px; background: transparent; }
.stat.warn::before { background: var(--warn-mark); }
.stat.crit::before { background: var(--crit-mark); }
.stat.info::before { background: var(--info-mark); }
.stat-head { display: flex; align-items: center; gap: 8px; color: var(--ink-500); }
.stat-label { overflow: hidden; color: var(--ink-900); font-size: 14px; font-weight: 600; letter-spacing: -0.005em; text-overflow: ellipsis; white-space: nowrap; }
.stat-value { color: var(--ink-900); font: 600 28px/1 var(--mono); letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.stat-sub { color: var(--ink-500); font-size: 12px; }

.checks { list-style: none; padding: 0; display: grid; }
.checks li + li { border-top: 1px solid var(--divider); }
.check-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 9px 8px;
  border-radius: var(--radius-sm);
  color: var(--text);
}
a.check-row:hover { background: var(--hover); color: var(--text); text-decoration: none; }
.check-label { display: flex; flex-direction: column; min-width: 0; font-size: 13px; }
.check-zero { color: var(--ink-400); font: 600 12px var(--mono); }

.years { display: grid; gap: 2px; }
.year-row {
  display: grid;
  grid-template-columns: 3.4em minmax(0, 1fr) 3.6em;
  align-items: center;
  gap: 10px;
  padding: 5px 8px;
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 13px;
}
.year-row:hover { background: var(--hover); color: var(--text); text-decoration: none; }
.year-row .n { text-align: right; font-variant-numeric: tabular-nums; color: var(--ink-700); }
.bar { display: block; height: 8px; overflow: hidden; background: var(--fill-soft); border-radius: 4px; }
.bar > span { display: block; height: 100%; background: var(--brand); border-radius: 4px; }

.issues { list-style: none; padding: 0; display: grid; }
.issues li + li { border-top: 1px solid var(--divider); }
.issue-link {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 12px;
  padding: 10px 8px;
  border-radius: var(--radius-sm);
  color: var(--text);
}
.issue-link:hover { background: var(--hover); color: var(--text); text-decoration: none; }
.issue-link .code { min-width: 7.5em; color: var(--link); font-weight: 600; }
.issue-name { flex: 0 1 14em; min-width: 6em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chips { display: flex; flex-wrap: wrap; gap: 4px; }

/* ───────── 표 — DefaultTable(.rfn-table): 헤더 11.5px ink-500(대문자 변환 없음) · 줄 13px ───────── */

.table-wrap {
  position: relative; /* 안쪽 .sr-only(absolute)가 스크롤 영역 밖으로 새어 페이지를 넓히지 않게 */
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  background: var(--surface);
  border: 1px solid var(--ink-200);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
}
.card .table-wrap { border-radius: var(--radius); box-shadow: none; }
/* 표만 든 카드 — DefaultTable 처럼 카드 테두리 하나로(안쪽 테두리 겹침 없이) */
.card:has(> .table-wrap:only-child) { padding: 0; overflow: hidden; }
.card > .table-wrap:only-child { border: 0; border-radius: 0; }
.card:has(> .card-head + .table-wrap:last-child) { padding-bottom: 0; overflow: hidden; }
.card > .card-head + .table-wrap:last-child { margin: -14px -16px 0; border: 0; border-radius: 0; }
.table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13px; }
.table th, .table td {
  padding: 10px 12px;
  text-align: left;
  vertical-align: middle;
  white-space: nowrap;
  border-bottom: 1px solid var(--ink-100);
  line-height: 1.4;
}
.table th {
  padding-top: 8px;
  padding-bottom: 8px;
  background: var(--ink-50);
  border-bottom-color: var(--ink-200);
  color: var(--ink-500);
  font-size: 11.5px;
  font-weight: 600;
  user-select: none;
}
:root[data-theme="dark"] .table th { background: var(--ink-100); color: var(--ink-600); border-bottom-color: var(--divider); }
:root[data-theme="dark"] .table td { border-bottom-color: var(--divider); }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .table th { background: var(--ink-100); color: var(--ink-600); border-bottom-color: var(--divider); }
  :root:not([data-theme="light"]) .table td { border-bottom-color: var(--divider); }
}
.table td { color: var(--ink-800); }
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr:hover td { background: var(--ink-50); }
.table.clickable tbody tr { cursor: pointer; }
.table.clickable tbody tr:hover td { background: var(--hover); }
.table .num { text-align: right; font-variant-numeric: tabular-nums; }
.table tr.dim td { color: var(--muted); }
.table tr.row-warn td { background: var(--crit-bg); }
.table td.wrap { white-space: normal; min-width: 18em; }
/* 데이터 API 제공자 표 — 칸이 많아 이름 · 하루 한도 · 출처는 줄을 바꿔 좁힌다(1440 화면에서 가로 스크롤 없이) */
.table td.wrap-name { white-space: normal; min-width: 11em; max-width: 20em; }
.table td.wrap-daily { white-space: normal; min-width: 10em; }
.table td.wrap-sm { white-space: normal; min-width: 7em; }
.table td.clip { max-width: 13em; overflow: hidden; text-overflow: ellipsis; }
.table td a strong { font-weight: 600; }
.table .code-link { font-weight: 600; }
.table .mono { font-size: 12px; letter-spacing: -0.01em; }
/* 「더 보기」 — .table-wrap 이 가로 스크롤 컨테이너라, 넓은 표를 밀어도 단추는 왼쪽에 붙어 보이게 sticky */
.table-more { position: sticky; left: 0; padding: 8px 12px 12px; text-align: left; }

.more {
  margin-left: 6px;
  padding: 0 5px;
  border: 1px solid var(--ink-200);
  border-radius: 5px;
  background: var(--ink-100);
  color: var(--ink-600);
  font: 600 11px var(--mono);
  cursor: help;
}

/* 사용 방법 툴팁(lib.js helpTip) — 「?」 단추에 올리거나 초점을 주면 뜨고 Esc 로 닫는다. CSP 가 style 속성을 막아 CSS 만으로 띄운다 */
.help-tip { position: relative; display: inline-flex; align-items: center; vertical-align: middle; }
.help-tip-btn {
  display: inline-grid;
  place-items: center;
  width: 18px;
  height: 18px;
  padding: 0;
  border: 1px solid var(--ink-200);
  border-radius: 50%;
  background: var(--surface);
  color: var(--ink-600);
  font: 600 11px/1 var(--font);
  cursor: help;
}
.help-tip-btn:hover, .help-tip:focus-within .help-tip-btn { border-color: var(--accent); color: var(--accent); }
/* 전역 :focus-visible 은 모서리를 --radius-sm 으로 바꾼다 — 둥근 단추는 둥근 링으로 */
.help-tip-btn:focus-visible { outline: none; border-radius: 50%; box-shadow: var(--ring); }
.help-tip-body {
  position: absolute;
  top: calc(100% + 8px);
  left: -8px;
  z-index: 60;
  display: none;
  width: max-content;
  max-width: min(420px, calc(100vw - 48px));
  padding: 10px 12px;
  border: 1px solid var(--ink-200);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-pop);
  color: var(--text);
  font: 400 12.5px/1.55 var(--font);
  letter-spacing: normal;
  text-align: left;
  white-space: normal;
  word-break: keep-all; /* 한글 낱말 중간에서 끊지 않는다 — 경로처럼 긴 낱말만 아래 규칙으로 끊는다 */
  overflow-wrap: anywhere;
  cursor: auto;
}
/* 단추와 본문 사이 틈을 지나도 닫히지 않게 */
.help-tip-body::before { content: ""; position: absolute; right: 0; left: 0; top: -9px; height: 9px; }
.help-tip.up .help-tip-body { top: auto; bottom: calc(100% + 8px); }
.help-tip.up .help-tip-body::before { top: auto; bottom: -9px; }
.help-tip:hover .help-tip-body, .help-tip:focus-within .help-tip-body { display: block; }
.help-tip.closed .help-tip-body { display: none; }
.help-tip-title { display: block; margin-bottom: 4px; color: var(--ink-900); font-weight: 600; }
.help-tip-steps { margin: 0; padding-left: 18px; }
.help-tip-steps li + li { margin-top: 3px; }
.help-tip-note { display: block; }
.help-tip-note + .help-tip-note, .help-tip-steps + .help-tip-note { margin-top: 6px; }
.help-tip-steps + .help-tip-note { color: var(--ink-600); }
/* 좁은 화면 — 단추 옆에 띄우면 화면 밖으로 잘린다. 화면 아래쪽에 가득 차게 띄운다(손가락으로 「?」를 누르면 초점으로 뜨고 다른 곳을 누르면 닫힌다) */
@media (max-width: 600px) {
  .help-tip-body, .help-tip.up .help-tip-body {
    position: fixed;
    top: auto;
    right: 12px;
    bottom: 12px;
    left: 12px;
    z-index: 80;
    width: auto;
    max-width: none;
    max-height: 60vh;
    overflow-y: auto;
  }
  .help-tip-body::before, .help-tip.up .help-tip-body::before { display: none; }
}

/* 탭 위 도구 줄(배포 현황의 「사용 방법 투어」) — 오른쪽 끝 */
.tab-tools { display: flex; justify-content: flex-end; gap: 8px; }
.tab-tools .btn .ph { flex: none; }

/* 투어(lib.js startTour) — 짚은 요소는 외곽선, 설명 패널은 화면 오른쪽 아래에 고정(모달 아님). CSP 가 style 속성을 막아 좌표로 붙이지 않는다 */
/* 짚는 요소 하나만 밝게(spotlight) — 요소를 위로 올리고(z-index 85 · 패널 90 아래), 큰 그림자로 나머지 화면을 어둡게 한다.
   본문(.frame)은 쌓임 맥락을 만들지 않아 상단 바 · 메뉴까지 덮인다. 그림자는 누르기를 막지 않는다(투어는 모달이 아니다) */
:root { --tour-dim: rgba(12, 17, 24, 0.46); }
:root[data-theme="dark"] { --tour-dim: rgba(0, 0, 0, 0.58); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --tour-dim: rgba(0, 0, 0, 0.58); } }
.tour-target {
  position: relative;
  z-index: 85;
  outline: 3px solid var(--accent);
  outline-offset: 4px;
  border-radius: var(--radius);
  box-shadow: 0 0 0 9px color-mix(in srgb, var(--accent) 22%, transparent), 0 0 0 200vmax var(--tour-dim);
  scroll-margin-top: 72px; /* 상단 바(sticky 56px) 아래 */
}
/* 단추 줄은 카드 폭 전체가 아니라 단추만 감싼다(줄 안 항목은 왼쪽 정렬이라 자리가 바뀌지 않는다) */
.btn-row.tour-target { width: fit-content; }
.tour-panel {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 90;
  display: grid;
  gap: 8px;
  width: min(400px, calc(100vw - 32px));
  max-height: min(70vh, 560px);
  overflow-y: auto;
  padding: 14px 16px;
  border: 1px solid var(--ink-200);
  border-radius: var(--radius-xl);
  background: var(--surface);
  box-shadow: var(--shadow-modal);
  color: var(--text);
  font-size: 13px;
  line-height: 1.6;
  word-break: keep-all; /* 한글 낱말 중간에서 끊지 않는다 — 경로처럼 긴 낱말만 아래 규칙으로 끊는다 */
  overflow-wrap: anywhere;
  animation: pop-in 0.16s cubic-bezier(0.2, 0, 0, 1);
}
.tour-head { display: flex; align-items: center; gap: 8px; color: var(--ink-600); font-size: 12px; font-weight: 600; }
.tour-name { flex: 1; min-width: 0; }
.tour-count { font-variant-numeric: tabular-nums; }
.tour-where { justify-self: start; }
.tour-section { color: var(--accent); font-size: 12px; font-weight: 600; }
.tour-list { display: grid; gap: 3px; margin: 0; padding-left: 18px; }
.tour-steps { display: grid; gap: 6px; margin: 0; padding-left: 20px; }
.tour-status { margin: 0; color: var(--ink-600); font-size: 12.5px; }
.tour-acts { display: flex; }
.tour-acts:has(> [hidden]) { display: none; }
.tour-panel h3 { margin: 0; color: var(--ink-900); font-size: 15px; font-weight: 600; }
/* 단계마다 제목에 초점을 준다(화면 읽기 프로그램이 새 단계를 읽게) — 사람에게는 링이 필요 없다(전역 :focus-visible 링을 끈다) */
.tour-panel h3:focus, .tour-panel h3:focus-visible { outline: none; box-shadow: none; }
.tour-body { display: grid; gap: 6px; }
.tour-body p { margin: 0; }
.tour-missing { margin: 0; padding: 6px 8px; border-radius: var(--radius); background: var(--ink-100); color: var(--ink-700); font-size: 12.5px; }
.tour-foot { display: flex; align-items: center; gap: 8px; margin-top: 4px; }
.tour-gap { flex: 1; }
@media (max-width: 600px) {
  .tour-panel { right: 12px; bottom: 12px; left: 12px; width: auto; }
}
@media (forced-colors: active) {
  .tour-target { outline-color: Highlight; }
}

.trunc {
  display: inline-block;
  max-width: 32ch;
  margin: 0;
  padding: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  vertical-align: bottom;
  background: none;
  border: 0;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}
.trunc.open { max-width: 60ch; white-space: normal; overflow: visible; }
.kv .trunc { max-width: 100%; }

.kv-item { display: inline-block; margin: 0 14px 2px 0; }
.kv-item .k { color: var(--muted); font-size: 12px; }

/* ───────── 배지(상태 칩) — Badge / .rfn-tcell-badge 톤 ───────── */

.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 0 7px;
  border: 1px solid var(--neutral-line);
  border-radius: 5px;
  background: var(--neutral-bg);
  color: var(--neutral-ink);
  font-size: 11.5px;
  font-weight: 600;
  line-height: 19px;
  white-space: nowrap;
  vertical-align: middle;
}
.badge.ok, .badge.success { background: var(--ok-bg); border-color: var(--ok-line); color: var(--ok-ink); }
.badge.info { background: var(--info-bg); border-color: var(--info-line); color: var(--info-ink); }
.badge.warn, .badge.warning { background: var(--warn-bg); border-color: var(--warn-line); color: var(--warn-ink); }
.badge.crit, .badge.danger { background: var(--crit-bg); border-color: var(--crit-line); color: var(--crit-ink); }
.badge.muted { background: transparent; border: 1px dashed var(--ink-300); color: var(--muted); font-weight: 500; }

.cell-row { display: inline-flex; flex-wrap: nowrap; align-items: center; gap: 6px; }

.online { display: inline-flex; align-items: center; gap: 7px; }
.dot { flex: none; width: 8px; height: 8px; border-radius: 50%; background: var(--neutral-mark); }
.dot.on { background: var(--ok-mark); box-shadow: 0 0 0 3px var(--ok-bg); }
.dot.never { background: transparent; border: 1.5px solid var(--neutral-mark); }

.pct { font-variant-numeric: tabular-nums; }
.pct.warn { color: var(--warn-ink); font-weight: 600; }
.pct.crit { color: var(--crit-ink); font-weight: 700; }

.meter-row { display: inline-flex; align-items: center; gap: 8px; }
.meter { display: inline-block; width: 110px; height: 6px; overflow: hidden; background: var(--fill-soft); border-radius: 3px; }
.meter > span { display: block; height: 100%; background: var(--brand); border-radius: 3px; }
.meter.warn { background: var(--warn-bg); }
.meter.warn > span { background: var(--warn-mark); }
.meter.crit { background: var(--crit-bg); }
.meter.crit > span { background: var(--crit-mark); }

/* 막대·계기 너비(5% 단위) — style 속성 없이 클래스로만 */
.w0 { width: 0; } .w5 { width: 5%; } .w10 { width: 10%; } .w15 { width: 15%; } .w20 { width: 20%; }
.w25 { width: 25%; } .w30 { width: 30%; } .w35 { width: 35%; } .w40 { width: 40%; } .w45 { width: 45%; }
.w50 { width: 50%; } .w55 { width: 55%; } .w60 { width: 60%; } .w65 { width: 65%; } .w70 { width: 70%; }
.w75 { width: 75%; } .w80 { width: 80%; } .w85 { width: 85%; } .w90 { width: 90%; } .w95 { width: 95%; }
.w100 { width: 100%; }

/* ───────── 알림 문단 — Callout(.rfn-callout) ───────── */

.note {
  padding: 10px 12px;
  border: 1px solid var(--ink-200);
  border-radius: var(--radius);
  background: var(--ink-50);
  color: var(--ink-800);
  font-size: 13px;
  line-height: 1.5;
  overflow-wrap: anywhere;
}
.note.info { background: var(--info-bg); border-color: var(--info-line); color: var(--info-ink); }
.note.warn { background: var(--warn-bg); border-color: var(--warn-line); color: var(--warn-ink); }
.note.crit { background: var(--crit-bg); border-color: var(--crit-line); color: var(--crit-ink); }
.note.ok { background: var(--ok-bg); border-color: var(--ok-line); color: var(--ok-ink); }
.note a { color: inherit; text-decoration: underline; text-underline-offset: 2px; }
.note.strong { font-weight: 600; }
.notes { display: grid; gap: 8px; margin-bottom: 12px; }

.upload-progress { display: grid; gap: 4px; max-width: 420px; margin: 4px 0 12px; }

/* 빈 상태 — EmptyState */
.empty {
  padding: 32px 16px;
  border: 1px dashed var(--ink-300);
  border-radius: var(--radius-lg);
  color: var(--ink-500);
  font-size: 13px;
  text-align: center;
}
.card .empty { padding: 24px 12px; }
.loading { display: flex; align-items: center; justify-content: center; gap: 10px; padding: 64px 0; color: var(--muted); }
.spinner {
  width: 16px;
  height: 16px;
  border: 2px solid var(--ink-200);
  border-top-color: var(--brand);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes pop-in { from { opacity: 0; transform: translateY(4px) scale(0.98); } }

.checklist { padding-left: 1.4em; display: grid; gap: 6px; }

/* ───────── 버튼 — Button: md 32h·13px·r8 · sm 28h·12px·r7 · lg 40h·14px ───────── */

.btn {
  display: inline-flex;
  flex: none;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 32px;
  padding: 0 14px;
  border: 1px solid var(--ink-300);
  border-radius: var(--radius);
  background: var(--white);
  color: var(--ink-800);
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: -0.005em;
  line-height: 1;
  white-space: nowrap;
  cursor: pointer;
  transition: background-color 0.15s ease-out, border-color 0.15s ease-out, color 0.15s ease-out, box-shadow 0.15s ease-out;
}
.btn:hover { background: var(--ink-50); border-color: var(--ink-400); color: var(--ink-900); text-decoration: none; }
.btn:active { background: var(--ink-100); }
.btn:focus-visible { box-shadow: var(--ring); border-radius: var(--radius); }
.btn.secondary { /* 기본 단추와 같다(이름만) */ }
.btn.primary { background: #76a6d7; border-color: #76a6d7; color: #ffffff; }
.btn.primary:hover { background: #5a8fc5; border-color: #5a8fc5; color: #ffffff; }
.btn.primary:active { background: #3f76ae; border-color: #3f76ae; }
.btn.tertiary, .btn.ghost { background: transparent; border-color: transparent; color: var(--ink-700); }
.btn.tertiary:hover, .btn.ghost:hover { background: var(--ink-100); color: var(--ink-900); }
.btn.danger { background: #e5484d; border-color: #e5484d; color: #ffffff; }
.btn.danger:hover { background: #db1f25; border-color: #db1f25; color: #ffffff; }
.btn.danger-outline { color: var(--crit-ink); }
.btn.danger-outline:hover { background: var(--crit-bg); border-color: var(--crit-line); color: var(--crit-ink); }
.btn.small, .btn.sm { height: 28px; padding: 0 10px; gap: 5px; border-radius: 7px; font-size: 12px; }
.btn.lg { height: 40px; padding: 0 18px; font-size: 14px; }
.btn.block { width: 100%; }
.btn.icon-only { width: 32px; padding: 0; }
.btn:disabled, .btn.primary:disabled, .btn.danger:disabled { background: var(--ink-200); border-color: var(--ink-200); color: var(--ink-400); cursor: not-allowed; }
.btn.tertiary:disabled { background: transparent; border-color: transparent; }
.btn[aria-busy="true"] { cursor: progress; }
.btn[aria-busy="true"]::after {
  content: "";
  width: 11px;
  height: 11px;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

/* ───────── 입력 — Input / Select(32h · r8) · 체크 · 토글 ───────── */

.form { display: grid; gap: 14px; }
fieldset.plain { display: grid; gap: 14px; min-width: 0; margin: 0; padding: 0; border: 0; }
.form-grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 170px), 1fr)); }
.field { display: grid; gap: 6px; min-width: 0; align-content: start; }
.field.full { grid-column: 1 / -1; }
.field > label { color: var(--ink-800); font-size: 13px; font-weight: 600; letter-spacing: -0.005em; }
.inline { display: flex; gap: 8px; }
.inline > * { flex: 1 1 0; min-width: 0; }
.hint { color: var(--muted); font-size: 12px; }
.hint:empty { display: none; }
.hint.center { text-align: center; }
.form-actions { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 8px 12px; }
.form-actions > .hint { margin-right: auto; }
.inline-form { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 10px 12px; }
.inline-form > .field { min-width: 140px; }

input, select, textarea {
  width: 100%;
  min-width: 0;
  height: 32px;
  padding: 0 10px;
  border: 1px solid var(--ink-300);
  border-radius: var(--radius);
  background: var(--white);
  color: var(--ink-900);
  font: inherit;
  font-size: 13px;
  transition: border-color 0.12s, box-shadow 0.12s;
}
select { padding-right: 6px; }
textarea { height: auto; min-height: 68px; padding: 7px 10px; line-height: 1.5; resize: vertical; }
input:hover, select:hover, textarea:hover { border-color: var(--ink-400); }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px rgba(118, 166, 215, 0.25); }
input:disabled, select:disabled, textarea:disabled { opacity: 0.6; cursor: not-allowed; }
input::placeholder, textarea::placeholder { color: var(--ink-400); }
input[type="checkbox"], input[type="radio"] { width: 16px; height: 16px; padding: 0; accent-color: var(--brand); }
input[type="file"] { height: auto; padding: 6px; }

/* 토글 스위치 — <label class="switch"><input type="checkbox"><span class="switch-track"></span> 라벨</label> */
.switch { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; cursor: pointer; }
.switch input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.switch-track {
  position: relative;
  flex: none;
  width: 32px;
  height: 18px;
  border-radius: 999px;
  background: var(--ink-300);
  transition: background-color 0.15s;
}
.switch-track::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #ffffff;
  box-shadow: 0 1px 2px rgba(20, 30, 45, 0.25);
  transition: transform 0.15s;
}
.switch input:checked + .switch-track { background: var(--brand); }
.switch input:checked + .switch-track::after { transform: translateX(14px); }
.switch input:focus-visible + .switch-track { box-shadow: var(--ring); }
.switch input:disabled + .switch-track { opacity: 0.5; }

/* 탭 — .rfn-tabs (40h · 밑줄 brand) */
.tabs { display: flex; align-items: stretch; overflow-x: auto; border-bottom: 1px solid var(--ink-200); scrollbar-width: none; }
.tab {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 40px;
  margin-bottom: -1px;
  padding: 0 16px;
  border: 0;
  border-bottom: 2px solid transparent;
  background: transparent;
  color: var(--ink-600);
  font: inherit;
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
  cursor: pointer;
}
.tab:hover { color: var(--ink-800); text-decoration: none; }
.tab.is-active, .tab[aria-selected="true"] { border-bottom-color: var(--brand); color: var(--link); font-weight: 600; }
/* 탭 묶음(tabbed) — 탭 바 아래 고른 패널 하나만 보인다(나머지는 hidden) */
.tabbed { display: grid; gap: 16px; min-width: 0; align-content: start; }
.tab-panel { min-width: 0; }
.tab-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 18px;
  padding: 0 6px;
  border: 1px solid var(--ink-200);
  border-radius: 9px;
  background: var(--ink-100);
  color: var(--ink-700);
  font: 600 10.5px var(--mono);
}

.filters {
  display: grid;
  gap: 10px 12px;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 150px), 1fr));
  align-items: end;
  padding: 12px 14px;
  background: var(--surface);
  border: 1px solid var(--ink-200);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
}
.filters .field > label { color: var(--ink-600); font-size: 12px; }
@media (min-width: 640px) { .filters .grow { grid-column: span 2; } }
.filter-actions { display: flex; gap: 8px; }

.copyable { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.change-list { padding-left: 1.2em; display: grid; gap: 4px; }

/* ───────── 새 설치본 등록 — 운영체제 카드 · 아키텍처 · 명령 블록 ───────── */

.setup { display: grid; gap: 18px; max-width: 960px; min-width: 0; }
.setup-title { padding-bottom: 14px; border-bottom: 1px solid var(--ink-200); }
.setup > p { margin: 0; color: var(--ink-700); font-size: 14px; line-height: 1.65; }
.setup-sec { display: grid; gap: 10px; min-width: 0; }
.setup-sec > h2 { margin: 4px 0 0; }
.setup-sec p { margin: 0; color: var(--ink-700); font-size: 13.5px; line-height: 1.6; }
.os-opts { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 220px), 1fr)); }
.os-opt {
  display: flex; align-items: center; gap: 10px; min-height: 56px; padding: 0 16px;
  border: 1px solid var(--ink-200); border-radius: var(--radius-lg); background: var(--surface);
  box-shadow: var(--shadow-card); color: var(--ink-800); font-size: 14px; font-weight: 600; cursor: pointer;
  transition: border-color 0.12s, background-color 0.12s;
}
.os-opt:hover { border-color: var(--ink-300); }
.os-opt:has(input:checked) { border-color: var(--brand); background: var(--brand-50); box-shadow: 0 0 0 1px var(--brand); color: var(--ink-900); }
.os-opt input[type="radio"] { flex: none; width: 16px; height: 16px; margin: 0; padding: 0; border: 0; box-shadow: none; accent-color: var(--brand); }
.os-opt:focus-within { box-shadow: var(--ring); }
.os-icon { flex: none; }
.fp-flag { display: inline-flex; vertical-align: middle; margin-left: 4px; }
.warn-icon path { fill: currentColor; }
.warn-icon .mark { fill: none; stroke: var(--surface); stroke-width: 1.6; stroke-linecap: round; }
.fp-flag.warn { color: var(--warn-ink); }
.fp-flag.crit { color: var(--crit-ink); }
.os-icon .fg { fill: currentColor; }
.os-icon .hole { fill: var(--surface); }
.os-opt:has(input:checked) .os-icon .hole { fill: var(--brand-50); }
.os-icon .beak { fill: #e8a317; }
.arch-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; }
.arch-select { width: auto; min-width: 220px; max-width: 100%; }
.code-wrap { min-width: 0; overflow: hidden; border: 1px solid var(--ink-200); border-radius: var(--radius-lg); background: var(--fill-nest); }
.code-head {
  display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 6px 8px 6px 14px;
  border-bottom: 1px solid var(--ink-200); background: var(--surface);
}
.code-lang { padding: 0 6px; border-radius: 5px; background: var(--ink-100); color: var(--ink-700); font: 600 11.5px/20px var(--mono); }
/* 마크다운 코드 블록처럼 줄을 접지 않고 가로로 넘긴다 — 보이는 줄 = 붙여 넣을 줄 */
.code-panel { margin: 0; padding: 12px 14px; overflow-x: auto; color: var(--ink-800); white-space: pre; font: 12.5px/1.75 var(--mono); tab-size: 4; }
.code-panel code { font: inherit; }
.code-panel.pending { opacity: 0.55; }
.cl-comment { color: var(--ink-500); }
.use-panel { padding: 12px 16px; border: 1px solid var(--ink-200); border-radius: var(--radius-lg); background: var(--fill-nest); }
.use-status { margin: 0; font-size: 13.5px; }

/* ───────── 로그인 — AuthSplitLayout(왼쪽 어두운 패널 · 오른쪽 양식) ───────── */

.auth { display: flex; align-items: stretch; min-height: 100vh; background: var(--ink-50); color: var(--ink-800); }
.auth-side {
  position: relative;
  display: flex;
  flex: 1 1 50%;
  flex-direction: column;
  min-width: 0;
  padding: 40px;
  overflow: hidden;
  background: #191f27;
  color: #ffffff;
}
.auth-bg-wrap { position: absolute; inset: 0; z-index: 0; overflow: hidden; }
.auth-bg {
  position: absolute;
  top: 0;
  left: 0;
  display: block;
  width: auto;
  max-width: none;
  height: 100%;
  pointer-events: none;
  user-select: none;
  will-change: transform;
}
.auth-symbol { position: relative; z-index: 1; color: #ffffff; opacity: 0.45; }
.auth-spacer { position: relative; z-index: 1; flex: 1; }
.auth-hero {
  position: relative;
  z-index: 1;
  min-height: 2.16em;
  margin: 0;
  color: #ffffff;
  font-family: Roboto, var(--font);
  font-size: clamp(40px, 5.4vw, 80px);
  font-weight: 400;
  line-height: 1.08;
  letter-spacing: -0.035em;
}
.auth-hero .dim { opacity: 0.4; }
.auth-caret { display: inline-block; margin-left: 0.04em; color: #76a6d7; font-weight: 300; transform: translateY(-0.04em); animation: caret-blink 1s steps(1) infinite; }
.auth-caret.done { animation: none; opacity: 0; transition: opacity 0.3s; }
@keyframes caret-blink { 50% { opacity: 0; } }

.auth-main {
  position: relative;
  display: flex;
  flex: 1 1 50%;
  align-items: center;
  justify-content: center;
  min-width: 0;
  padding: 56px 24px 112px;
  background: var(--white);
}
.auth-theme { position: absolute; top: 20px; right: 24px; }
.auth-box { display: grid; gap: 16px; width: 100%; max-width: 380px; }
.auth-head { display: grid; justify-items: center; gap: 6px; margin-bottom: 12px; text-align: center; }
.auth-mark { display: none; margin-bottom: 10px; color: var(--ink-900); }
.auth-title { margin: 0; color: var(--ink-900); font: 600 23px/1.25 var(--mono); letter-spacing: -0.02em; }
.auth-sub { margin: 0; color: var(--ink-600); font-size: 12.5px; line-height: 1.5; }
.auth-body { display: grid; gap: 12px; }
.auth-body .btn { gap: 10px; }
.auth-divider { display: flex; align-items: center; gap: 12px; margin: 10px 0 2px; color: var(--ink-500); font-size: 12.5px; }
.auth-divider::before, .auth-divider::after { content: ""; flex: 1; height: 1px; background: var(--ink-200); }
.auth-legal {
  position: absolute;
  right: 24px;
  bottom: 20px;
  left: 24px;
  display: grid;
  gap: 6px;
  color: var(--ink-500);
  font-size: 12px;
  line-height: 1.6;
  text-align: center;
}
.auth-version { color: var(--ink-400); font-size: 10.5px; letter-spacing: -0.01em; }
.btn.google { background: var(--white); border-color: var(--ink-300); color: var(--ink-900); }
.btn.google:hover { background: var(--ink-50); color: var(--ink-900); }
.gmark { flex: none; }
.error-panel { display: grid; gap: 10px; }

@media (max-width: 1023px) {
  .auth-side { display: none; }
  .auth-mark { display: block; }
}

/* ───────── 알림 토스트 — Toast ───────── */

.alerts {
  position: fixed;
  z-index: 60;
  right: 16px;
  bottom: 16px;
  left: 16px;
  display: grid;
  gap: 8px;
  justify-items: end;
  pointer-events: none;
}
.alert {
  position: relative;
  width: min(420px, 100%);
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 12px 12px 16px;
  overflow: hidden;
  border: 1px solid var(--ink-200);
  border-radius: var(--radius-lg);
  background: var(--white);
  color: var(--ink-800);
  box-shadow: var(--shadow-pop);
  font-size: 13px;
  pointer-events: auto;
  animation: pop-in 0.18s cubic-bezier(0.2, 0, 0, 1);
}
.alert::before { content: ""; position: absolute; top: 0; bottom: 0; left: 0; width: 3px; background: var(--neutral-mark); }
.alert.error::before { background: var(--crit-mark); }
.alert.success::before { background: var(--ok-mark); }
.alert.info::before { background: var(--info-mark); }
.alert.warn::before { background: var(--warn-mark); }
.alert-body { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.alert-body strong { color: var(--ink-900); }
.alert-code { display: block; margin-top: 2px; color: var(--muted); font-size: 11.5px; }
.alert-close {
  display: inline-grid;
  place-items: center;
  width: 22px;
  height: 22px;
  padding: 0;
  border: 0;
  border-radius: 6px;
  background: none;
  color: var(--muted);
  font: inherit;
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
}
.alert-close:hover { background: var(--ink-100); color: var(--text); }

/* ───────── 대화상자 — Modal(머리 · 본문 · 발 · 너비 480/640/800) ───────── */

.modal {
  width: min(560px, calc(100% - 32px));
  max-height: calc(100% - 64px);
  overflow: auto;
  padding: 0;
  border: 1px solid var(--ink-200);
  border-radius: var(--radius-xl);
  background: var(--white);
  color: var(--ink-800);
  box-shadow: var(--shadow-modal);
}
.modal[open] { animation: pop-in 0.18s cubic-bezier(0.2, 0, 0, 1); }
.modal::backdrop { background: var(--backdrop); }
.modal.sm { width: min(360px, calc(100% - 32px)); }
.modal.wide, .modal.lg { width: min(800px, calc(100% - 32px)); }
.modal.secret { width: min(640px, calc(100% - 32px)); }
.plain-list { display: grid; gap: 4px; padding-left: 18px; font-size: 13px; }
.modal-title {
  position: sticky;
  top: 0;
  z-index: 1;
  padding: 18px 18px 14px;
  border-bottom: 1px solid var(--ink-100);
  background: var(--white);
  color: var(--ink-900);
  font-size: 15px;
  font-weight: 700;
  letter-spacing: -0.01em;
}
.modal-body { display: grid; gap: 12px; padding: 18px; font-size: 13px; line-height: 1.55; overflow-wrap: anywhere; }
.modal-body h3 { margin: 6px 0 0; }
.modal-actions {
  position: sticky;
  bottom: 0;
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
  padding: 10px 18px;
  border-top: 1px solid var(--ink-100);
  background: var(--white);
}
.modal-actions > .push-left { margin-right: auto; } /* 지우기처럼 성격이 다른 단추는 왼쪽 끝으로 */

.secret-row { display: flex; align-items: stretch; gap: 8px; }
.secret-box {
  flex: 1;
  min-width: 0;
  display: block;
  padding: 10px 12px;
  background: var(--fill-nest);
  border: 1px solid var(--ink-300);
  border-radius: var(--radius);
  font-size: 13px;
  word-break: break-all;
  user-select: all;
  -webkit-user-select: all;
}
.cmd-block { overflow: hidden; border: 1px solid var(--ink-200); border-radius: var(--radius); }
.cmd-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 4px 8px; background: var(--fill-nest); }
.cmd { margin: 0; padding: 8px 10px; font-size: 12px; white-space: pre-wrap; word-break: break-all; }
.clip-helper { position: fixed; top: 0; left: 0; width: 1px; height: 1px; opacity: 0; pointer-events: none; }

/* ───────── 레일 접힘 — 사용자가 접었거나(저장) 화면이 1024 미만이면 아이콘만(52px) ───────── */

html.rail-collapsed .rail { width: var(--rail-w-collapsed); }
html.rail-collapsed .rail-logo { justify-content: center; padding: 0; }
html.rail-collapsed .rail-word, html.rail-collapsed .rail-toggle, html.rail-collapsed .rail-text,
html.rail-collapsed .user-text, html.rail-collapsed .user-caret, html.rail-collapsed .rail-foot { display: none; }
html.rail-collapsed .rail-expand { display: grid; }
html.rail-collapsed .rail-nav { padding: 4px 6px 6px; }
html.rail-collapsed .rail-item { justify-content: center; padding: 8px 0; }
html.rail-collapsed .rail-bottom { padding: 8px 6px; }
html.rail-collapsed .user-btn { justify-content: center; padding: 6px 0; border-color: transparent; background: transparent; }
html.rail-collapsed .user-menu { right: auto; bottom: 0; left: calc(100% + 8px); width: 240px; }

@media (max-width: 1023px) {
  .rail { width: var(--rail-w-collapsed); }
  .rail-logo { justify-content: center; padding: 0; }
  .rail-word, .rail-toggle, .rail-text, .user-text, .user-caret, .rail-foot { display: none; }
  html.rail-collapsed .rail-expand { display: none; }
  .rail-count { position: absolute; top: 2px; right: 4px; min-width: 14px; padding: 0 3px; font-size: 9.5px; line-height: 14px; }
  .rail-nav { padding: 4px 6px 6px; }
  .rail-item { justify-content: center; padding: 8px 0; }
  .rail-bottom { padding: 8px 6px; }
  .user-btn { justify-content: center; padding: 6px 0; border-color: transparent; background: transparent; }
  .user-menu { right: auto; bottom: 0; left: calc(100% + 8px); width: 240px; }
  /* 좁은 화면 — 펼친 서브 메뉴는 본문 위에 떠 있다(본문 폭을 빼앗지 않게) */
  .side { position: fixed; top: 0; bottom: 0; left: var(--rail-w-collapsed); z-index: 40; box-shadow: var(--shadow-pop); }
  html.side-collapsed .side { box-shadow: none; }
}

@media (max-width: 767px) {
  :root { --page-pad: 16px 16px 40px; }
  .topbar { gap: 8px; padding: 0 16px; }
  .crumb:not(:last-child), .crumb > .sep { display: none; }
  .banner { padding: 8px 16px; }
}

@media (max-width: 600px) {
  input, select, textarea { font-size: 16px; }
  h1 { font-size: 20px; }
  .stat-value { font-size: 22px; }
  .kv-row { grid-template-columns: minmax(0, 1fr); gap: 2px; }
  .page-head { align-items: flex-start; }
  /* 머리 단추 묶음이 한 줄 폭(flex: none)을 고집하면 페이지가 화면보다 넓어진다(설치본 상세 6개) — 좁은 화면에서는 줄을 차지하고 줄바꿈한다 */
  .page-head > .actions, .page-head > .btn-row { flex: 1 1 100%; }
  .card { padding: 12px 14px 14px; }
  .card-head { margin: -12px -14px 12px; padding: 12px 14px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition: none !important; }
}

@media (forced-colors: active) {
  .badge, .note, .dot { border: 1px solid CanvasText; }
  .bar > span, .meter > span { background: Highlight; }
  .rail-item[aria-current="page"], .side-item.is-active { outline: 1px solid Highlight; }
}

/* ───────── 명령 진행(보냄 → 현장 수신 → 적용 중 → 결과) · 원문 펼치기 ───────── */

.cell-row.wrap { flex-wrap: wrap; }
.steps { display: flex; gap: 2px; margin: 0; padding: 0; list-style: none; min-width: 26em; }
.steps .step {
  flex: 1 1 0; display: grid; gap: 1px; padding: 4px 6px 3px; min-width: 0;
  border-top: 3px solid var(--ink-200); font-size: 12px; color: var(--muted);
}
.steps .step-label { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.steps .step time { font-family: var(--mono); font-size: 11px; }
.steps .step.done { border-top-color: var(--good); color: var(--text); }
.steps .step.now { border-top-color: var(--brand-600); color: var(--text); font-weight: 600; }
.steps .step.warn { border-top-color: var(--warn); color: var(--warn-ink); font-weight: 600; }
.steps .step.bad { border-top-color: var(--bad); color: var(--crit-ink); font-weight: 600; }
.steps .step.skip { border-top-style: dashed; }
.table td.result-cell { white-space: normal; min-width: 16em; max-width: 40em; }
details.raw > summary { cursor: pointer; color: var(--muted); font-size: 12px; }
details.raw > summary:hover { color: var(--ink-900); }
details.raw[open] { padding-top: 2px; }
details.raw p { margin: 4px 0 0; white-space: pre-wrap; word-break: break-word; }
.event-log { margin: 4px 0 0; padding: 0; list-style: none; display: grid; gap: 3px; font-size: 12px; }
.event-log li { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 6px; }
.event-log time { font-family: var(--mono); color: var(--muted); }
.checkin-meta { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; min-width: 0; }
.checkin-meta .nowrap { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.table td.result-cell .trunc { max-width: 100%; }

/* 조사 보고서(마크다운 — markdown.js 가 고정 태그만 만든다) */
.md-report { border: 1px solid var(--border); border-radius: 8px; padding: 12px 16px; max-height: 55vh; overflow: auto; font-size: 13px; line-height: 1.6; }
.md-report h1, .md-report h2, .md-report h3, .md-report h4 { margin: 14px 0 6px; font-size: 14px; }
.md-report h1:first-child, .md-report h2:first-child { margin-top: 0; }
.md-report p, .md-report ul, .md-report ol, .md-report blockquote, .md-report pre, .md-report table { margin: 6px 0; }
.md-report ul, .md-report ol { padding-left: 20px; }
.md-report code { font-family: var(--mono, ui-monospace, monospace); font-size: 12px; background: var(--surface-2, rgba(127,127,127,.12)); padding: 0 3px; border-radius: 3px; }
.md-report pre { padding: 8px 10px; overflow: auto; background: var(--surface-2, rgba(127,127,127,.12)); border-radius: 6px; }
.md-report pre code { background: none; padding: 0; white-space: pre; }
.md-report blockquote { border-left: 3px solid var(--border); padding-left: 10px; color: var(--muted, inherit); }
.md-report table { border-collapse: collapse; }
.md-report th, .md-report td { border: 1px solid var(--border); padding: 3px 8px; text-align: left; vertical-align: top; }
.md-report hr { border: 0; border-top: 1px solid var(--border); }

/* 공지 — 설치본 · 조직 고르기 목록, 본문 미리보기 */
.notice-picks { display: flex; flex-direction: column; gap: 4px; max-height: 240px; overflow: auto; border: 1px solid var(--border); border-radius: 8px; padding: 8px 10px; }
.notice-preview { min-height: 68px; max-height: 320px; }
