/*
 * RBP 대시보드 스타일.
 *
 * 토큰은 장치 LCD UI(agent/rbp_agent/ui/index.html)와 **같은 값**이다. 원본은
 * coway_mcu_studio 의 styles.py DARK 딕셔너리다. 엔지니어가 PC 도구 → 장치
 * 화면 → 대시보드를 오갈 때 같은 제품으로 느껴져야 한다.
 *
 * LCD 와 다른 점은 입력 장치뿐이다. 여기는 마우스·키보드라 터치 타겟
 * 44px 규칙을 걷어내고 정보 밀도를 올린다.
 */

:root {
  /* Surface — Fluent 4-Layer */
  --bg-base:    #191919;
  --bg-main:    #202020;
  --bg-panel:   #2B2B2B;
  --bg-control: #383838;
  --bg-hover:   #323232;
  --border:     #383838;
  --gridline:   #2E2E2E;
  /* Text */
  --text:          #E0E0E0;
  --text-strong:   #FFFFFF;
  --text-muted:    #9E9E9E;
  --text-disabled: #5C5C5C;
  /* Accent — Fluent Blue */
  --accent:         #0078D4;
  --accent-hover:   #1A86D8;
  --accent-pressed: #005A9E;
  --on-accent:      #FFFFFF;
  /* Semantic */
  --success: #89D185;  --success-bg: rgba(137,209,133,.14);
  --warning: #CCA700;  --warning-bg: rgba(204,167,0,.14);
  --danger:  #F14C4C;  --danger-bg:  rgba(241,76,76,.14);
  --info:    #4FA3D8;  --info-bg:    rgba(79,163,216,.14);
  /* 에이징(제품이 스스로 물·얼음을 뽑는 장시간 시험) — 개요에서 멀리서도 보여야 한다 */
  --aging:   #FF8C42;  --aging-bg:   rgba(255,140,66,.14);

  --font-ui: "Segoe UI", "Malgun Gothic", "Apple SD Gothic Neo", "Noto Sans KR", system-ui, sans-serif;
  --font-mono: "Cascadia Mono", "Consolas", "D2Coding", ui-monospace, monospace;
  --radius: 8px;
  --nav-w: 208px;
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  background: var(--bg-main); color: var(--text);
  font: 13px/1.55 var(--font-ui);
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
.mono { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
.muted { color: var(--text-muted); }
.dim { color: var(--text-disabled); }
.r { text-align: right; }
.row { display: flex; align-items: center; gap: 8px; }
.wrap { display: flex; flex-wrap: wrap; gap: 8px; }
.grow { flex: 1 1 auto; }

/* ── 로그인 게이트 ─────────────────────────────────── */
#gate {
  position: fixed; inset: 0; z-index: 50;
  display: none; flex-direction: column; align-items: center; justify-content: center;
  gap: 18px; background: var(--bg-main); text-align: center; padding: 24px;
}
#gate.show { display: flex; }
#gate h1 { font-size: 21px; font-weight: 600; color: var(--text-strong); margin: 0; }
#gate .sub { color: var(--text-muted); max-width: 460px; line-height: 1.7; }
/* 역할 없는 계정의 권한 요청 상자(index.html #gate-request, app.js showAccessRequest).
   게이트 본문과 같은 폭. 상태 줄은 "보냄 · 3분 전 · 대기 중" 처럼 한 줄이다. */
#gate-request {
  width: min(460px, 100%); display: flex; flex-direction: column; gap: 10px;
  padding: 14px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--bg-panel);
  text-align: left;
}
#gate-request textarea { width: 100%; resize: vertical; min-height: 64px; }
#gate-request .row { flex-wrap: wrap; }
.gate-req-status { font-size: 12px; color: var(--text-muted); line-height: 1.5; }
.gate-req-status.open { color: var(--warning); }
.gate-req-status.granted { color: var(--success); }

/* ── 셸 ────────────────────────────────────────────── */
#shell { display: none; height: 100%; }
#shell.show { display: flex; }

nav {
  flex: 0 0 var(--nav-w); background: var(--bg-panel);
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column;
}
nav .brand {
  padding: 14px 16px 12px; border-bottom: 1px solid var(--border);
}
nav .brand .name { font-size: 14px; font-weight: 600; color: var(--text-strong); }
nav .brand .env {
  display: inline-block; margin-top: 5px; padding: 1px 7px; border-radius: 999px;
  font-size: 10px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase;
  border: 1px solid var(--warning); color: var(--warning);
}
nav .brand .env.prod { border-color: var(--danger); color: var(--danger); }
nav .links { padding: 8px; display: flex; flex-direction: column; gap: 2px; }
nav a.link {
  display: flex; align-items: center; gap: 9px; padding: 8px 10px;
  border-radius: 6px; color: var(--text-muted); font-size: 13px;
}
nav a.link:hover { background: var(--bg-hover); color: var(--text); text-decoration: none; }
nav a.link.active { background: var(--accent); color: var(--on-accent); font-weight: 600; }
nav a.link .badge {
  margin-left: auto; padding: 0 6px; border-radius: 999px; font-size: 11px; font-weight: 700;
  background: var(--danger); color: #fff; min-width: 18px; text-align: center;
}
nav a.link.active .badge { background: rgba(0,0,0,.3); }
/* 메뉴 그룹 — 공통 / MCU / MPU / 관리 (docs/MPU-Debug-Slot-Plan.md 4.0).
   그룹은 테두리 상자 하나: 머리글(종류 칩 + 이름 + 접기 ▾)과 왼쪽 안내선으로 들여 쓴 하위 메뉴.
   머리글이 메뉴 항목처럼 보이지 않게 — 크기·색·배경을 항목과 다르게 둔다. */
nav .nav-group {
  margin-top: 10px; border: 1px solid var(--border); border-radius: 8px;
  background: var(--bg-base); overflow: hidden;
  --g: var(--text-muted);
}
nav #nav-mcu   { --g: #3B9EFF; }
nav #nav-mpu   { --g: #B07CFF; }
nav #nav-admin { --g: var(--warning); }
nav .group-hd {
  display: flex; align-items: center; gap: 7px; padding: 6px 9px;
  cursor: pointer; user-select: none; font-size: 11.5px; color: var(--text);
  background: color-mix(in srgb, var(--g) 10%, transparent);
  border-bottom: 1px solid var(--border);
}
nav .group-hd:hover { background: color-mix(in srgb, var(--g) 18%, transparent); }
nav .group-hd .gchip {
  font: 700 10px/1 var(--font-mono, monospace); letter-spacing: .04em; padding: 3px 6px;
  border-radius: 4px; background: var(--g); color: #101010;
}
nav .group-hd .gname { font-weight: 600; color: var(--text-muted); }
nav .group-hd::after { content: "▾"; margin-left: auto; font-size: 10px; color: var(--text-muted); }
nav .group-hd.closed { border-bottom: 0; }
nav .group-hd.closed::after { content: "▸"; }
/* 장치 상세에 있을 때 그 장치 종류의 그룹을 켠다(device.js). */
nav .group-hd.active .gname { color: var(--g); }
nav .nav-group:has(.group-hd.active) { border-color: color-mix(in srgb, var(--g) 55%, var(--border)); }
nav .group-bd {
  display: flex; flex-direction: column; gap: 2px; padding: 4px 4px 5px 16px; position: relative;
}
nav .group-bd::before {
  content: ""; position: absolute; left: 10px; top: 6px; bottom: 8px; width: 2px; border-radius: 1px;
  background: color-mix(in srgb, var(--g) 45%, transparent);
}
nav .group-bd a.link { padding: 6px 9px; font-size: 12.5px; }
/* 접힌 그룹 — 위의 display:flex 가 [hidden] 을 이기므로 다시 적는다. */
nav .group-bd[hidden] { display: none; }
nav .foot {
  margin-top: auto; padding: 12px 14px; border-top: 1px solid var(--border);
  font-size: 12px; color: var(--text-muted);
}
nav .foot .who { color: var(--text); overflow: hidden; text-overflow: ellipsis; }
nav .foot .role { font-size: 11px; }
/* 로그아웃 — PC 에선 푸터 폭 가득, 모바일(아래 @media)에선 한 줄 안의 작은 버튼 */
nav .foot button { margin-top: 8px; width: 100%; }

/* ── 개발 담당 부서 표식 ─────────────────────────────
   화면 어디에도 "누가 만들었나"가 없어 문의가 엉뚱한 곳으로 갔다. 눈에 띄면
   안 되고(정보가 아니라 서명이다), 없어지면 안 된다. 장치 LCD 의 상태바·
   셸 레일에도 같은 표식이 있다. */
.credit {
  font-size: 10.5px; font-weight: 600; letter-spacing: .06em;
  color: var(--text-disabled); white-space: nowrap; user-select: none;
}
nav .foot .credit { margin-top: 10px; text-align: center; }
#gate .credit { position: absolute; bottom: 18px; left: 0; right: 0; text-align: center; }

main { flex: 1 1 auto; overflow: auto; padding: 20px 24px 40px; }
h2.page { font-size: 18px; font-weight: 600; color: var(--text-strong); margin: 0 0 4px; }
.page-sub { color: var(--text-muted); margin-bottom: 18px; }

/* ── 장치 상세 탭 ───────────────────────────────────
   RBP장치 화면(rbp_agent/ui/index.html)의 2단 메뉴와 같은 구조다.
   상단은 "무엇을 하는가", 하위는 "어느 시스템인가". 두 화면을 오가는
   사람이 같은 지도를 쓰게 하는 것이 목적이다. */
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--border); margin-bottom: 0; }
.tabs button {
  min-height: 38px; padding: 0 18px; cursor: pointer;
  background: transparent; color: var(--text-muted);
  border: 0; border-bottom: 2px solid transparent;
  font: 13.5px var(--font-ui); font-weight: 500;
}
.tabs button:hover { color: var(--text); background: var(--bg-hover); }
.tabs button[aria-selected="true"] {
  color: var(--text-strong); border-bottom-color: var(--accent); font-weight: 600;
}
.subtabs {
  display: none; gap: 6px; padding: 11px 0 0;
  overflow-x: auto; scrollbar-width: none;
}
.subtabs.show { display: flex; }
.subtabs::-webkit-scrollbar { display: none; }
.subtabs button {
  min-height: 28px; padding: 0 13px; cursor: pointer; white-space: nowrap;
  background: transparent; color: var(--text-muted);
  border: 1px solid var(--border); border-radius: 999px;
  font: 12px var(--font-ui);
}
.subtabs button:hover { background: var(--bg-hover); }
.subtabs button[aria-selected="true"] {
  background: var(--accent); border-color: var(--accent);
  color: var(--on-accent); font-weight: 600;
}
.panel { display: none; padding-top: 16px; }
.panel.active { display: block; }

/* ── 명령 카드 ──────────────────────────────────────
   드롭다운 하나에 12종을 넣지 않고 명령마다 카드를 준다. 읽기와 쓰기가
   한 칸 차이로 붙어 있던 것이 사고의 원인이었다(계획서 2.1). */
.cmd { border-top: 1px solid var(--gridline); padding: 13px 0; }
.cmd:first-child { border-top: 0; padding-top: 2px; }
.cmd .cmd-hd { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; margin-bottom: 3px; }
.cmd .cmd-name { font-weight: 600; color: var(--text-strong); font-size: 13.5px; }
.cmd .cmd-type { font-family: var(--font-mono); font-size: 11px; color: var(--text-disabled); }
.cmd .cmd-desc { color: var(--text-muted); font-size: 12.5px; margin-bottom: 9px; max-width: 78ch; }
/* 명령 카드 밖(튜닝·모니터 화면)에서도 쓴다. `.cmd` 하위로 묶으면 그쪽에
   적용되지 않아 입력 칸이 세로로 늘어진다. */
.cmd-row { display: flex; flex-wrap: wrap; gap: 9px; align-items: flex-end; }
.cmd-row > label.field { flex: 0 0 auto; }
.cmd-out { margin-top: 10px; }

/* 접히는 고급 영역 — 임의 주소·제어 키는 첫 화면의 선택지가 아니다 */
details.adv > summary {
  cursor: pointer; color: var(--text-muted); font-size: 12.5px;
  padding: 6px 0; list-style: none; user-select: none;
}
details.adv > summary::-webkit-details-marker { display: none; }
details.adv > summary::before { content: "▸ "; color: var(--text-disabled); }
details.adv[open] > summary::before { content: "▾ "; }
details.adv > summary:hover { color: var(--text); }

/* ── 제품 MCU ───────────────────────────────────────
   RBP장치가 아니라 붙어 있는 제품의 식별 정보다. UUID 는 32자라
   KPI 타일에 넣으면 넘친다. */
.mcu { display: flex; flex-wrap: wrap; gap: 10px 34px; }
.mcu .f { min-width: 0; }
.mcu .k {
  font-size: 11.5px; color: var(--text-muted);
  text-transform: uppercase; letter-spacing: .04em; margin-bottom: 2px;
}
.mcu .v { font-size: 15px; color: var(--text-strong); word-break: break-all; }

/* ── 카드 ──────────────────────────────────────────── */
.card {
  background: var(--bg-panel); border: 1px solid var(--border);
  border-radius: var(--radius); overflow: hidden; margin-bottom: 16px;
}
.card > .hd {
  display: flex; align-items: center; gap: 8px;
  background: var(--bg-control); border-bottom: 1px solid var(--border);
  padding: 8px 13px; font-size: 12.5px; font-weight: 600; color: var(--text-strong);
}
.card > .bd { padding: 13px; }
.card > .bd.flush { padding: 0; }
/* 카드 머리 오른쪽의 한 줄 설명 — "이 카드가 무엇을 모았나" */
.card > .hd .sub { font-weight: 400; font-size: 11.5px; color: var(--text-muted); }
.tbl-wrap { overflow-x: auto; }

/* ── KPI ───────────────────────────────────────────── */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 18px; }
.kpi {
  background: var(--bg-panel); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 13px 15px;
}
.kpi .label { font-size: 11.5px; color: var(--text-muted); text-transform: uppercase; letter-spacing: .04em; }
.kpi .value { font-size: 26px; font-weight: 600; color: var(--text-strong); line-height: 1.25; font-variant-numeric: tabular-nums; }
.kpi .value.ok { color: var(--success); }
.kpi .value.warn { color: var(--warning); }
.kpi .value.bad { color: var(--danger); }
.kpi .value.aging { color: var(--aging); }
.kpi .note { font-size: 11.5px; color: var(--text-disabled); }

/* ── 장치 그리드 ───────────────────────────────────── */
.devices { display: grid; grid-template-columns: repeat(auto-fill, minmax(268px, 1fr)); gap: 12px; }
.dev {
  display: block; background: var(--bg-panel); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 13px 15px; color: inherit;
}
.dev:hover { background: var(--bg-hover); border-color: var(--accent); text-decoration: none; }
.dev .top { display: flex; align-items: center; gap: 8px; margin-bottom: 3px; }
.dev .name { font-weight: 600; color: var(--text-strong); }
/* 별칭 편집(✎). 카드 전체가 링크라 버튼은 클릭을 삼킨다(overview.js). 평소엔 흐리게,
   카드에 마우스를 올리면 보인다 — 터치 화면은 hover 가 없어 항상 보이게 둔다. */
.dev .alias-btn {
  margin-left: auto; min-height: 22px; padding: 0 6px; font-size: 12px; line-height: 1;
  border: 1px solid transparent; background: transparent; color: var(--text-disabled);
  border-radius: 6px; cursor: pointer;
}
.dev:hover .alias-btn, .dev .alias-btn:focus-visible { color: var(--text-muted); border-color: var(--border); }
.dev .alias-btn:hover { color: var(--accent); border-color: var(--accent); }
.dev .id { font-size: 11.5px; }
.dev .id .orig { color: var(--text-muted); }
/* 지표는 항목 단위로만 줄을 바꾼다 — "20초 / 전" 처럼 단어 안에서 꺾이면
   PC 도구 카드의 긴 포트 경로 옆에서 그 꼴이 났다. */
.dev .meta { display: flex; flex-wrap: wrap; gap: 4px 14px; margin-top: 10px; font-size: 12px; color: var(--text-muted); }
.dev .meta > span { white-space: nowrap; }
.dev .meta b { color: var(--text); font-weight: 600; }
.dev .meta b.ok { color: var(--success); }
.dev .meta b.warn { color: var(--warning); }
.dev .meta b.dim { color: var(--text-disabled); }

/* ── 파이(스튜디오) 그룹 ───────────────────────────── */
/* 파이 1대 = 그룹 1개, 안의 타일이 슬롯(1호기·2호기…). 그룹 최소 폭은 슬롯 타일 두 장
   (190px)이 나란히 들어가는 값이다 — 슬롯이 셋 이상이면 타일이 다음 줄로 넘어간다.
   min() 은 그룹 폭보다 좁은 창에서 가로 스크롤이 생기지 않게 한다. */
/* align-items: start — 슬롯 4개짜리 파이 옆의 2개짜리 파이가 같은 높이로 늘어나 빈칸이 되지 않게 */
.studios { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(430px, 100%), 1fr)); gap: 12px; align-items: start; }
.studio { background: var(--bg-panel); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.studio > .shd {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  padding: 9px 13px; background: var(--bg-control); border-bottom: 1px solid var(--border);
}
.studio > .shd .name { font-weight: 600; color: var(--text-strong); }
.studio > .shd .host { font-size: 11.5px; }
.studio > .shd .count { margin-left: auto; font-size: 12px; color: var(--text-muted); white-space: nowrap; }
.studio > .shd .count b { color: var(--text); font-weight: 600; }
/* 파이 접기(overview.js setFolded) — 머리를 누르면 접히고, 접힌 파이는 격자 위 '접힘' 줄의 알약이 된다.
   알약을 누르면 다시 격자로. 카드 머리글의 [전체 열기]·[전체 닫기] 는 한꺼번에. 어느 파이를 접어 뒀는지는
   브라우저가 기억한다(localStorage rbp.overviewFolded). */
.studio > .shd[data-fold] { cursor: pointer; user-select: none; }
.studio > .shd[data-fold]:hover { background: var(--bg-hover); }
.studio > .shd[data-fold]:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.studio > .shd .chev { font-size: 10px; color: var(--text-muted); }
.card > .hd .fold-all { display: inline-flex; gap: 4px; margin-left: 4px; }
.card > .hd .fold-all[hidden] { display: none; }
.studios-folded { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
.studio-pill {
  min-height: 28px; padding: 0 10px 0 9px; gap: 7px; border-radius: 999px;
  background: var(--bg-main); font-size: 12px; max-width: 100%;
}
.studio-pill:hover:not(:disabled) { border-color: var(--accent); }
.studio-pill .name { font-weight: 600; color: var(--text-strong); white-space: nowrap; }
.studio-pill .host { font-size: 11px; }
.studio-pill .count { color: var(--text-muted); font-variant-numeric: tabular-nums; }
.studio-pill .count b { color: var(--text); font-weight: 600; }
/* 슬롯은 호기 순 점 하나씩 — 접어 두고도 어느 슬롯이 죽었는지는 보인다. 주황 테 = 에이징, 속 빈 점 = 시리얼 끊김 */
.studio-pill .dots { display: inline-flex; align-items: center; gap: 5px; padding: 0 2px; }
.studio-pill .dots .led { width: 7px; height: 7px; box-shadow: none; }
.studio-pill .dots .led.aging { box-shadow: 0 0 0 2px var(--aging); }
.studio-pill .dots .led.cut { background: transparent; box-shadow: inset 0 0 0 2px var(--warning); }
.studio-pill .dots .led.aging.cut { box-shadow: inset 0 0 0 2px var(--warning), 0 0 0 2px var(--aging); }
/* 파이 공통 지표(버전·온도·디스크·IP) — 슬롯마다 같은 값이라 여기 한 번만 */
.studio > .smeta { display: flex; flex-wrap: wrap; gap: 4px 14px; padding: 8px 13px 0; font-size: 12px; color: var(--text-muted); }
.studio > .smeta > span { white-space: nowrap; }
.studio > .smeta b { color: var(--text); font-weight: 600; }
/* 위치(📍) 편집 — AP 별 이름(app.js apKey). 개요 파이 머리·장치 화면 부제에 같이 쓴다.
   전역 button 의 높이(터치 36px)를 여기서만 줄인다. */
button.loc-btn {
  margin-left: 4px; min-height: 20px; padding: 0 6px; font-size: 11.5px; line-height: 18px;
  border: 1px solid var(--border); background: transparent; color: var(--text-muted);
  border-radius: 6px; cursor: pointer; vertical-align: baseline;
}
button.loc-btn:hover { color: var(--accent); border-color: var(--accent); }
.studio > .slots { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 10px; padding: 10px 13px 13px; }
/* 슬롯 타일은 그룹 판보다 한 단계 안으로 들어간다(Fluent 레이어: main < panel) */
.dev.slot { background: var(--bg-main); padding: 11px 13px; }
.dev.slot .name { white-space: nowrap; }
.dev.slot .id { font-size: 11.5px; line-height: 1.45; }
.dev.slot .id .alias { color: var(--text); }
.dev.slot .meta { margin-top: 8px; }
/* 에이징 중인 슬롯: 테두리·배경을 주황으로 — 격자에서 한눈에 골라지게(overview.js agingState) */
.dev.slot.aging { border-color: var(--aging); background: linear-gradient(var(--aging-bg), var(--aging-bg)), var(--bg-main); }
.dev.slot.aging-paused { border-color: var(--warning); border-style: dashed; }
.dev.slot .aging-line { margin-top: 6px; font-size: 12px; color: var(--aging); font-weight: 600; }
.dev.slot .aging-line .dim { color: var(--text-muted); font-weight: 400; }

.led { width: 9px; height: 9px; border-radius: 50%; background: var(--text-disabled); flex: 0 0 auto; }
.led.online { background: var(--success); box-shadow: 0 0 0 3px var(--success-bg); }
.led.degraded { background: var(--warning); box-shadow: 0 0 0 3px var(--warning-bg); }
.led.offline { background: var(--danger); box-shadow: 0 0 0 3px var(--danger-bg); }

/* ── 표 ────────────────────────────────────────────── */
/* 파이 안 MCU / MPU 줄 머리(docs/MPU-Debug-Slot-Plan.md 4.1) */
.slots-hd { margin: 8px 0 4px; font-size: 10.5px; font-weight: 700; letter-spacing: .08em; color: var(--text-muted); }
table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
thead th {
  position: sticky; top: 0; z-index: 1;
  background: var(--bg-control); color: var(--text-strong);
  text-align: left; font-weight: 600; padding: 7px 11px;
  border-bottom: 1px solid var(--border); white-space: nowrap;
}
tbody td { padding: 6px 11px; border-bottom: 1px solid var(--gridline); vertical-align: top; }
tbody tr:hover { background: var(--bg-hover); }
tbody tr:last-child td { border-bottom: none; }
td.nowrap, th.nowrap { white-space: nowrap; }

/* ── 배지 · 상태 ───────────────────────────────────── */
.tag {
  display: inline-block; padding: 1px 7px; border-radius: 999px;
  font-size: 11px; font-weight: 700; letter-spacing: .02em; white-space: nowrap;
  border: 1px solid var(--border); color: var(--text-muted);
}
.tag.ok      { border-color: var(--success); color: var(--success); }
.tag.warn    { border-color: var(--warning); color: var(--warning); }
.tag.bad     { border-color: var(--danger);  color: var(--danger); }
.tag.info    { border-color: var(--info);    color: var(--info); }
.tag.accent  { border-color: var(--accent);  color: var(--accent); }
/* 채운 배지 — 테두리 배지들 사이에서 먼저 눈에 걸린다. 점은 '지금 돌고 있음' 을 깜빡여 보인다 */
.tag.aging   { border-color: var(--aging); background: var(--aging); color: #1A1A1A; }
.tag.aging::before {
  content: ""; display: inline-block; width: 6px; height: 6px; margin: 0 5px 1px 0;
  border-radius: 50%; background: currentColor; vertical-align: middle;
  animation: aging-blink 1.6s ease-in-out infinite;
}
.tag.aging.paused { background: transparent; border-color: var(--warning); color: var(--warning); }
.tag.aging.paused::before, .tag.aging.stale::before { animation: none; }
.tag.aging.stale { background: transparent; border-color: var(--aging); color: var(--aging); border-style: dashed; }
@keyframes aging-blink { 50% { opacity: .25; } }
@media (prefers-reduced-motion: reduce) { .tag.aging::before { animation: none; } }

/* ── 컨트롤 ────────────────────────────────────────── */
button, .btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 30px; padding: 0 13px; cursor: pointer;
  background: var(--bg-control); color: var(--text);
  border: 1px solid var(--border); border-radius: 6px;
  font: 12.5px var(--font-ui);
}
button:hover:not(:disabled) { background: var(--bg-hover); }
button:disabled { opacity: .45; cursor: not-allowed; }
button.primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); font-weight: 600; }
button.primary:hover:not(:disabled) { background: var(--accent-hover); }
button.danger { border-color: var(--danger); color: var(--danger); }
button.danger:hover:not(:disabled) { background: var(--danger-bg); }
button.sm { min-height: 25px; padding: 0 9px; font-size: 11.5px; }

input, select, textarea {
  min-height: 30px; padding: 4px 9px;
  background: var(--bg-control); color: var(--text);
  border: 1px solid var(--border); border-radius: 6px;
  font: 12.5px var(--font-ui);
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); }
input.mono, textarea.mono { font-family: var(--font-mono); }
label.field { display: flex; flex-direction: column; gap: 4px; font-size: 11.5px; color: var(--text-muted); }

/* ── 시뮬레이터 경고 (장치 LCD 의 #simbar 와 같은 역할) ── */
.simbar {
  background: var(--warning-bg); border: 1px solid var(--warning);
  border-radius: var(--radius); color: var(--warning);
  padding: 10px 14px; margin-bottom: 16px; font-size: 12.5px; font-weight: 600;
}
.simbar b { color: var(--warning); }

/* ── 칩 (레벨 토글 등) ─────────────────────────────── */
.chips { display: flex; flex-wrap: wrap; gap: 5px; }
.chip {
  min-height: 26px; padding: 0 10px; cursor: pointer;
  background: transparent; color: var(--text-muted);
  border: 1px solid var(--border); border-radius: 999px;
  font: 11.5px var(--font-ui);
}
.chip:hover { background: var(--bg-hover); }
.chip[aria-pressed="true"] {
  background: var(--accent); border-color: var(--accent);
  color: var(--on-accent); font-weight: 600;
}
.chip.sm { min-height: 24px; padding: 0 9px; }

/* ── 로그 뷰어 ─────────────────────────────────────── */
.logs { font-family: var(--font-mono); font-size: 11.5px; background: var(--bg-base); max-height: 460px; overflow: auto; }
.log { display: flex; gap: 9px; padding: 3px 11px; border-bottom: 1px solid var(--gridline); }
.log .ts  { flex: 0 0 150px; color: var(--text-disabled); }
.log .lv  { flex: 0 0 44px; font-weight: 700; }
/* 장치 칸은 .device 다 — 개요 카드 .dev(배경·테두리·padding 13px) 와 이름이 겹쳐 PC 에서도
   장치 이름이 두꺼운 박스로 그려지고 줄이 세 배로 커졌었다(첫 커밋부터, 2026-10-05 분리). */
.log .device { flex: 0 0 108px; color: var(--accent); overflow: hidden; text-overflow: ellipsis; }
.log .mod { flex: 0 0 132px; color: var(--info); overflow: hidden; text-overflow: ellipsis; }
.log .msg { flex: 1 1 auto; word-break: break-word; }
.lv0 .lv { color: var(--text-disabled); } .lv1 .lv { color: var(--text-muted); }
.lv2 .lv { color: var(--success); } .lv3 .lv { color: var(--warning); } .lv4 .lv { color: var(--danger); }
.log.lv3 { background: var(--warning-bg); } .log.lv4 { background: var(--danger-bg); }

/* ── 차트 ──────────────────────────────────────────── */
canvas.chart { width: 100%; height: 210px; display: block; }
/* 키-값 목록 — MPU 상태 카드(mpu-console.js mpuStatusHtml). */
dl.kv { display: grid; grid-template-columns: max-content 1fr; gap: 5px 18px; margin: 0; }
dl.kv dt { color: var(--text-muted); }
dl.kv dd { margin: 0; min-width: 0; }

.legend { display: flex; flex-wrap: wrap; gap: 12px; padding: 9px 13px 0; font-size: 11.5px; }
/* 기간 직접 지정 줄 — 카드 머리의 select 가 "직접 지정" 일 때만 보인다 */
.chart-tools { flex-wrap: wrap; padding: 9px 13px 0; font-size: 11.5px; color: var(--text-muted); }
/* 목록 아래 '더 보기' 줄 — 표와 같은 카드 안에서 페이지를 이어 받는다 */
.more-row { display: flex; align-items: center; justify-content: center; gap: 10px; padding: 10px 13px; border-top: 1px solid var(--border); font-size: 11.5px; }
.chart-tools label { display: flex; align-items: center; gap: 6px; }
.chart-tools input[type="datetime-local"] { min-height: 26px; padding: 2px 7px; font-size: 12px; }
.legend .item { display: flex; align-items: center; gap: 5px; cursor: pointer; color: var(--text-muted); }
.legend .item.off { opacity: .35; }
/* 그래프와 같은 색·선 모양(chart.js swatchSvg). 값 없음 항목은 흐리게, 누를 수 없다 */
.legend .swatch-line { flex: none; }
.legend .item.nodata { cursor: default; color: var(--text-disabled); }

/* ── 빈 상태 · 토스트 ──────────────────────────────── */
.empty { padding: 30px 16px; text-align: center; color: var(--text-disabled); }
#toasts { position: fixed; right: 16px; bottom: 16px; z-index: 60; display: flex; flex-direction: column; gap: 8px; }
.toast {
  background: var(--bg-panel); border: 1px solid var(--border); border-left-width: 3px;
  border-radius: 6px; padding: 9px 14px; font-size: 12.5px; max-width: 400px;
  box-shadow: 0 6px 20px rgba(0,0,0,.45);
}
.toast.ok  { border-left-color: var(--success); }
.toast.err { border-left-color: var(--danger); }
.toast.info{ border-left-color: var(--accent); }
/* 누르면 어딘가로 가는 토스트(app.js toast href) — 권한 요청 알림은 사용자 화면으로. */
.toast.link { cursor: pointer; }
.toast.link:hover { background: var(--bg-hover); }

/* ── 사용자 화면 — 권한 요청 줄(views/users.js requestLine) ────
   계정 칸 아래 한 줄: 태그 · 시각 · 사유 · [닫기]. 미처리는 왼쪽 주황 줄로 눈에 띈다. */
.u-req {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  margin-top: 5px; padding: 4px 8px; border-left: 2px solid var(--border);
  font-size: 11.5px; color: var(--text-muted);
}
.u-req.open { border-left-color: var(--warning); }
.u-req-msg { white-space: pre-wrap; word-break: break-word; color: var(--text); }

/* ── 모달 ──────────────────────────────────────────── */
#modal { position: fixed; inset: 0; z-index: 70; display: none; align-items: center; justify-content: center; background: rgba(0,0,0,.6); }
#modal.show { display: flex; }
#modal .box { background: var(--bg-panel); border: 1px solid var(--border); border-radius: var(--radius); width: min(520px, 92vw); }
#modal .box .hd { background: var(--bg-control); border-bottom: 1px solid var(--border); padding: 11px 15px; font-weight: 600; color: var(--text-strong); }
#modal .box .bd { padding: 15px; display: flex; flex-direction: column; gap: 12px; }
#modal .box .ft { padding: 11px 15px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 8px; }
.warnbox {
  background: var(--danger-bg); border: 1px solid var(--danger); border-radius: 6px;
  padding: 9px 12px; color: var(--danger); font-size: 12px; line-height: 1.6;
}

/* ── AI 분석 카드 (views/ai-chat.js) ─────────────────
   대시보드의 다른 카드와 같은 판 위에 있지만 한 가지가 다르다 — 위 가장자리의
   2px 선(파랑→청록)과 청록 하나. 청록은 이 카드와 번들 선택에만 쓴다. 다른
   의미색(성공·경고·위험·정보)과 겹치지 않는 자리다.
   중심은 선택 구간 타임라인이다: 모델이 보는 30분 창들이 시간축 위에 놓이고,
   빈 곳이 곧 "이 시간의 번들은 없다" 다. */
:root { --ai: #3FD0E0; --ai-bg: rgba(63,208,224,.12); --ai-dim: rgba(63,208,224,.38); }

.ai-card { position: relative; border-color: var(--ai-dim); }
.ai-card::before {
  content: ""; position: absolute; left: 0; right: 0; top: 0; height: 2px;
  background: linear-gradient(90deg, var(--accent), var(--ai));
}
.ai-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding: 13px 14px 10px; }
.ai-title { display: inline-flex; align-items: center; gap: 8px; font-size: 14px; font-weight: 600; color: var(--text-strong); }
.ai-mark {
  display: inline-flex; width: 24px; height: 24px; border-radius: 7px;
  align-items: center; justify-content: center; background: var(--ai-bg); color: var(--ai);
}
.ai-context { font-size: 12.5px; color: var(--text-muted); }
.ai-context b { color: var(--text); font-weight: 600; }
.ai-head select.sm { min-height: 25px; padding: 0 8px; font-size: 11.5px; max-width: 280px; }

/* 타임라인 */
.ai-timeline { padding: 0 14px 10px; }
.ai-timeline .track {
  position: relative; height: 22px; border-radius: 4px;
  background: var(--bg-base); border: 1px solid var(--gridline);
}
.ai-timeline .seg {
  position: absolute; top: 3px; bottom: 3px; min-width: 3px; padding: 0; border: 0;
  border-radius: 3px; background: var(--ai); opacity: .85; cursor: pointer; min-height: 0;
}
.ai-timeline .seg:hover, .ai-timeline .seg:focus-visible { opacity: 1; outline: 2px solid var(--text-strong); outline-offset: 1px; }
.ai-timeline .seg.swap { background: repeating-linear-gradient(135deg, var(--ai) 0 6px, var(--warning) 6px 9px); }
.ai-timeline .tick { position: absolute; top: 0; bottom: 0; width: 0; }
.ai-timeline .tick i { position: absolute; top: 0; bottom: 0; border-left: 1px dashed var(--border); }
.ai-timeline .tick em {
  position: absolute; top: 24px; transform: translateX(-50%);
  font-style: normal; font-size: 10.5px; color: var(--text-disabled); white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.ai-timeline .axis {
  display: flex; justify-content: space-between; gap: 8px; margin-top: 18px;
  font-size: 11px; color: var(--text-muted); font-variant-numeric: tabular-nums;
}

/* 대화 */
.ai-transcript {
  display: flex; flex-direction: column; gap: 10px; max-height: 540px; overflow: auto;
  padding: 12px 14px; border-top: 1px solid var(--border); background: var(--bg-main);
}
.ai-empty { padding: 26px 12px; text-align: center; color: var(--text-disabled); }
.ai-q {
  align-self: flex-end; max-width: 78%; padding: 7px 11px; border-radius: 8px 8px 2px 8px;
  background: var(--accent-pressed); color: var(--on-accent); font-size: 12.5px;
  white-space: pre-wrap; word-break: break-word;
}
.ai-a {
  align-self: stretch; padding: 9px 13px 9px 14px; border-left: 3px solid var(--ai);
  background: var(--bg-panel); border-radius: 0 8px 8px 0; font-size: 13px; line-height: 1.6;
  word-break: break-word;
}
.ai-a.pending { color: var(--text-muted); }
.ai-a.error { border-left-color: var(--danger); }
.ai-a.error .ai-note { color: var(--danger); }
.ai-meta { margin-top: 8px; font-size: 11px; color: var(--text-muted); font-variant-numeric: tabular-nums; }
.ai-meta .ok { color: var(--success); }
.ai-note { margin-top: 6px; font-size: 12px; color: var(--text-muted); }
.ai-cite {
  font-family: var(--font-mono); font-size: 11.5px; padding: 0 4px; border-radius: 4px;
  background: var(--ai-bg); color: var(--ai); cursor: pointer; text-decoration: none;
}
.ai-cite:hover { background: var(--ai); color: var(--bg-base); text-decoration: none; }
.ai-cite.bad { background: var(--danger-bg); color: var(--danger); text-decoration: line-through; cursor: help; }

/* 답 안의 마크다운 — 카드 안 표는 페이지 표와 달리 헤더를 고정하지 않는다 */
.md p, .md li { max-width: 88ch; }
.md p { margin: 0 0 8px; }
.md p:last-child { margin-bottom: 0; }
.md h4 { margin: 10px 0 5px; font-size: 13px; font-weight: 600; color: var(--text-strong); }
.md h4:first-child { margin-top: 0; }
.md ul, .md ol { margin: 4px 0 8px; padding-left: 20px; }
.md li { margin: 2px 0; }
.md code { font-family: var(--font-mono); font-size: 11.5px; padding: 0 4px; border-radius: 4px; background: var(--bg-control); }
.md hr { border: 0; border-top: 1px solid var(--border); margin: 10px 0; }
.md table { display: block; width: auto; max-width: 100%; overflow-x: auto; margin: 6px 0 10px; font-size: 12px; }
.md th { position: static; background: var(--bg-control); padding: 5px 9px; font-weight: 600; white-space: nowrap; }
.md td { padding: 4px 9px; vertical-align: top; border-bottom: 1px solid var(--gridline); }
.md tbody tr:hover { background: transparent; }

/* 생각 중 · 입력 커서 — 움직이는 것은 이 둘뿐이다 */
.ai-dots { display: inline-flex; gap: 4px; padding: 4px 0; }
.ai-dots i { width: 6px; height: 6px; border-radius: 50%; background: var(--ai); animation: ai-pulse 1.2s infinite ease-in-out; }
.ai-dots i:nth-child(2) { animation-delay: .2s; }
.ai-dots i:nth-child(3) { animation-delay: .4s; }
@keyframes ai-pulse { 0%, 80%, 100% { opacity: .25; transform: scale(.8); } 40% { opacity: 1; transform: scale(1); } }
.ai-caret { display: inline-block; width: 2px; height: 13px; margin-left: 2px; vertical-align: -2px; background: var(--ai); animation: ai-blink 1s steps(2) infinite; }
@keyframes ai-blink { to { visibility: hidden; } }
@media (prefers-reduced-motion: reduce) { .ai-dots i, .ai-caret { animation: none; } }

/* 추천 질문 · 입력 */
.ai-suggest { padding: 10px 14px 0; }
.ai-compose { display: flex; gap: 10px; align-items: stretch; padding: 10px 14px 6px; }
.ai-compose textarea { flex: 1; min-height: 52px; resize: vertical; }
.ai-actions { display: flex; flex-direction: column; gap: 6px; }
.ai-fast { display: flex; align-items: center; gap: 5px; font-size: 11.5px; color: var(--text-muted); cursor: pointer; }
.ai-fast input { min-height: 0; margin: 0; accent-color: var(--ai); }
.ai-foot { padding: 4px 14px 10px; font-size: 11px; color: var(--text-muted); min-height: 14px; }

/* 번들 선택 — 표의 체크 칸과 카드 아래 선택 바 */
table.selectable th.sel, table.selectable td.sel { width: 30px; padding-right: 0; }
table.selectable input[type=checkbox] {
  min-height: 0; margin: 0; width: 15px; height: 15px; vertical-align: middle;
  accent-color: var(--ai); cursor: pointer;
}
table.selectable input[type=checkbox]:disabled { opacity: .3; cursor: not-allowed; }
table.selectable tr.picked td { background: var(--ai-bg); }
.selbar {
  /* 표 위에서 스크롤을 따라온다. 카드는 overflow:hidden 이라 sticky 가 죽으므로
     이 카드(.has-selbar)만 overflow 를 풀고 모서리는 머리에서 직접 깎는다. */
  position: sticky; top: 0; z-index: 3;
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 8px 13px;
  border-bottom: 1px solid var(--ai-dim); font-size: 12.5px;
  /* 스크롤하는 표 위에 떠 있으므로 불투명해야 한다 — 반투명이면 밑의 줄이 비쳐 글자와 겹친다 */
  background: color-mix(in srgb, var(--ai) 14%, var(--bg-panel));
}
.selbar.idle { background: var(--bg-panel); border-bottom-color: var(--border); }
.selbar .sum b { color: var(--text-strong); }
.card.has-selbar { overflow: visible; }
.card.has-selbar > .hd { border-radius: var(--radius) var(--radius) 0 0; }
.card.has-selbar > .tbl-wrap { border-radius: 0 0 var(--radius) var(--radius); }
/* 표 머리는 선택 바 아래에 붙는다 — 두 sticky 가 겹치지 않게 z 를 낮춘다 */
.card.has-selbar thead th { z-index: 1; }
button.ai-go { background: var(--ai); border-color: var(--ai); color: #06262B; font-weight: 600; }
button.ai-go:hover:not(:disabled) { background: var(--ai); filter: brightness(1.08); }

.log.hit { background: var(--info-bg); }

/* ── 모바일(≤ 760px) ────────────────────────────────
   폰에서 PC 화면이 그대로 나왔다 — 208px 사이드바가 폭의 절반을 먹고, 탭 글자는
   세로로 꺾이고, KPI·표·토스트는 오른쪽이 잘렸다(2026-10-04). 별도 모바일 페이지
   대신 **같은 마크업을 좁은 폭에서 다시 배치**한다. 뷰 JS 는 손대지 않는다.
   760 은 아이패드 세로(768)를 PC 배치에 남기는 값이다.
   - 사이드바 → 상단 바. 1줄: 브랜드 + 계정·로그아웃, 2줄: 가로 스크롤 메뉴 띠.
     sticky 로 두지 않는다 — 표 머리글·선택 바(sticky top:0)가 그 뒤에 숨고,
     844px 화면의 1/9 을 늘 차지한다. 메뉴는 위로 스크롤하면 나온다.
   - 스크롤은 main 이 아니라 문서가 한다(iOS 주소창 접힘·관성 스크롤·sticky 기준).
   - 뷰 JS 안의 인라인 width(220px 류)는 !important 로만 덮인다.
   - 표는 손대지 않는다 — .tbl-wrap 이 카드 안에서 가로 스크롤한다. 6열 표를
     카드형으로 다시 그리는 것은 2단계(뷰 JS). */
@media (max-width: 760px) {
  html, body { height: auto; min-height: 100vh; min-height: 100dvh; }
  #shell.show { flex-direction: column; height: auto; min-height: 100vh; min-height: 100dvh; }

  nav {
    flex: none; flex-direction: row; flex-wrap: wrap; align-items: center;
    border-right: 0; border-bottom: 1px solid var(--border);
  }
  nav .brand {
    order: 1; flex: 1 1 auto; min-width: 0;
    display: flex; align-items: center; gap: 8px; padding: 9px 12px; border-bottom: 0;
  }
  nav .brand .env { margin-top: 0; }
  /* 계정 줄: 이메일은 줄임표, 역할·개발 부서 표식은 접는다(표식은 로그인 화면에 남는다) */
  nav .foot {
    order: 2; display: flex; align-items: center; gap: 8px; min-width: 0;
    margin-top: 0; padding: 6px 12px 6px 0; border-top: 0;
  }
  nav .foot .who { max-width: 26vw; white-space: nowrap; }
  nav .foot .role, nav .foot .credit { display: none; }
  nav .foot button { margin-top: 0; width: auto; }
  nav .links {
    order: 3; flex: 1 1 100%; flex-direction: row; gap: 4px; padding: 0 8px 8px;
    overflow-x: auto; scrollbar-width: none;
  }
  nav .links::-webkit-scrollbar { display: none; }
  nav a.link { flex: none; padding: 6px 11px; }
  /* 가로 줄에서는 그룹을 테두리 알약 하나로 — 종류 칩이 앞에 붙고 안쪽에 메뉴가 늘어선다. 접기는 쓰지 않는다. */
  nav .nav-group { display: flex; flex-direction: row; align-items: center; flex: none;
    margin: 0 0 0 4px; border-radius: 8px; }
  nav .group-bd { display: flex; flex-direction: row; align-items: center; gap: 2px; flex: none; padding: 2px 3px; }
  nav .group-bd::before { content: none; }
  nav .group-bd[hidden] { display: flex; }
  nav .group-hd { padding: 0 4px 0 6px; align-self: stretch; border-bottom: 0;
    border-right: 1px solid var(--border); cursor: default; }
  nav .group-hd .gname { display: none; }
  nav .group-hd::after, nav .group-hd.closed::after { content: none; }
  nav .group-bd a.link { padding: 5px 9px; }
  nav a.link .badge { margin-left: 6px; }

  main { flex: 1 1 auto; overflow: visible; padding: 12px 12px 32px; }
  h2.page { font-size: 16px; }
  .page-sub { margin-bottom: 12px; }

  .tabs { overflow-x: auto; scrollbar-width: none; }
  .tabs::-webkit-scrollbar { display: none; }
  .tabs button { flex: none; white-space: nowrap; padding: 0 12px; }

  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin-bottom: 12px; }
  .kpi { padding: 10px 12px; }
  .kpi .value { font-size: 22px; }
  .studio > .slots { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; padding: 8px 10px 10px; }
  .card > .hd { flex-wrap: wrap; row-gap: 6px; }

  /* 로그 한 줄: 고정 열 폭 합(434px)이 폰 폭을 넘는다 → 머리(시각·레벨·장치·모듈) 한 줄, 본문 다음 줄 */
  .log { flex-wrap: wrap; gap: 2px 9px; }
  .log .device, .log .mod { flex: 0 1 auto; min-width: 0; }
  .log .msg { flex: 1 1 100%; }

  main input[style], main select[style], main textarea[style] { max-width: 100% !important; min-width: 0 !important; }
  .ai-head select.sm { max-width: 100%; }
  /* iOS 는 16px 미만 입력칸에 포커스하면 화면을 확대한다 */
  input, select, textarea, .ai-head select.sm, .chart-tools input[type="datetime-local"] { font-size: 16px; }
  /* 터치 타깃 — LCD 의 44px 까지는 아니어도 손가락이 닿는 높이 */
  button, .btn { min-height: 36px; }
  button.sm, .chip, .subtabs button, button.loc-btn { min-height: 30px; }
  .studio-pill { min-height: 32px; }

  #toasts { left: 12px; right: 12px; bottom: 12px; }
  .toast { max-width: none; }
  #modal .box { width: min(520px, calc(100vw - 24px)); max-height: 90vh; max-height: 90dvh; overflow: auto; }
}

/* hover 가 없는 입력 장치(폰·태블릿)에서는 별칭 ✎ 를 늘 또렷하게 — 올려야 보이는 버튼은 없는 버튼이다 */
@media (hover: none) {
  .dev .alias-btn { color: var(--text-muted); border-color: var(--border); }
}

/* ── 모니터 › 시스템별 (views/monitor-system.js) ─────────────
   PC 툴·키오스크와 같은 그룹별 배치(docs/Monitor-Visualization-Plan.md 10절).
   종류는 정의 번들/결과의 group.layout: strip·kv2·kv2-write·kv3-optional·bits·table. */
.msys-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(440px, 1fr)); gap: 0 18px; padding: 2px 10px 6px; }
.msys-grid.cols3 { grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); }
.msys-kv {
  display: grid; grid-template-columns: minmax(120px, 44%) 1fr; align-items: center; gap: 0 10px;
  min-height: 30px; padding: 1px 4px; border-bottom: 1px solid var(--gridline);
}
/* 이름은 우측 정렬, 값은 바로 오른쪽 — 원본처럼 눈이 행을 가로지르지 않는다 */
.msys-kv .k { display: flex; align-items: center; justify-content: flex-end; gap: 6px; min-width: 0; color: var(--text-muted); font-size: 12px; text-align: right; }
.msys-kv .k .nm { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.msys-kv .vv { display: flex; align-items: baseline; min-width: 0; }
.msys .v { color: var(--text-strong); font: 700 13px var(--font-mono); white-space: nowrap; }
.msys .u { color: var(--text-muted); font: 11.5px var(--font-ui); margin-left: 3px; }
.msys-kv .meta { display: none; margin-left: 10px; color: var(--text-disabled); font: 11px var(--font-mono); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.msys.detail .msys-kv .meta { display: inline; }
/* 쓰기 행: 이름 │ 현재값 │ 조작(옵션 버튼 또는 숫자 입력 + 쓰기) */
.msys-kv.w { grid-template-columns: minmax(110px, 30%) 86px 1fr; min-height: 38px; }
.msys-kv.w .vv { justify-content: center; }
.msys-kv .ctl { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; padding: 3px 0; }
.msys-kv .ctl input { width: 84px; text-align: right; min-height: 27px; }
.msys .chips { display: flex; gap: 4px; flex-wrap: wrap; }
.msys button.chip { border-radius: 999px; }
.msys button.chip[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: var(--on-accent); font-weight: 600; }
/* 값 색 — 원본 _get_value_style: flag ON=accent · enum=info · hex/step=warning */
.msys .v.v-on { color: var(--accent); }
.msys .v.v-off, .msys .v.v-none { color: var(--text-disabled); font-weight: 400; }
.msys .v.v-none .u { display: none; }
.msys .v.v-enum { color: var(--info); }
.msys .v.v-hex { color: var(--warning); }
.msys .v.v-err { color: var(--danger); }
.msys .v.v-warn { color: var(--warning); }
.msys .v.v-ok { color: var(--text-muted); font-weight: 400; }
/* 장치가 그 그룹을 읽지 못함 — 이전 값을 흐리게 두고 `!` */
.msys .stale-mark { display: none; margin-left: 4px; color: var(--warning); font-weight: 700; }
.msys .stale .stale-mark { display: inline; }
.msys .stale .v { color: var(--text-muted); }
/* 기본으로 읽지 않는 그룹(드레인 펌프) — 켜기 전엔 본문을 접고 안내 한 줄 */
.msys-off-note { display: none; padding: 10px 13px; color: var(--text-disabled); font-size: 12px; }
.msys-off .msys-off-note { display: block; }
.msys-off .msys-grid { display: none; }
/* 공통 띠 — 머리글 없이 한 줄, 스크롤해도 위에 남는다 */
.msys-sticky { position: sticky; top: 0; z-index: 3; box-shadow: 0 6px 14px rgba(0,0,0,.4); }
.msys-strip { display: flex; flex-wrap: wrap; align-items: center; gap: 2px 24px; padding: 6px 13px; }
.msys-strip .lbl { font-size: 11px; font-weight: 600; letter-spacing: .06em; color: var(--text-muted); margin-right: 4px; }
.msys-strip .msys-kv { grid-template-columns: auto auto; min-height: 26px; border-bottom: 0; padding: 0; }
/* 비트 서브카드 — ● set(성공색) / ○ clear(경고색) */
.msys-bits { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 10px; padding: 10px 13px; }
.msys-bit { background: var(--bg-main); border: 1px solid var(--border); border-radius: var(--radius); padding: 6px 10px; }
.msys-bit .ttl { display: flex; align-items: center; gap: 6px; margin-bottom: 4px; font-size: 11.5px; font-weight: 600; color: var(--text); }
.msys-bit .ttl .v { margin-left: auto; font: 700 12px var(--font-mono); color: var(--warning); }
.msys-bit .row-b { display: flex; align-items: center; gap: 8px; min-height: 22px; font-size: 11.5px; }
.msys-bit .row-b .n { color: var(--text-muted); min-width: 90px; }
.msys-bit .row-b .s { font-weight: 700; color: var(--warning); }
.msys-bit .row-b.on .s { color: var(--success); }
/* 머리 카드의 세그먼트(자동 갱신)·토글 */
.msys-seg { display: inline-flex; gap: 4px; }
#mon-system button[data-mon-period][aria-pressed="true"],
#mon-system button[data-mon-detail][aria-pressed="true"],
#mon-system button[data-optional][aria-pressed="true"] { border-color: var(--accent); color: var(--accent); font-weight: 600; }
@media (max-width: 760px) {
  .msys-grid, .msys-grid.cols3 { grid-template-columns: 1fr; }
  .msys-kv.w { grid-template-columns: minmax(96px, 34%) 70px 1fr; }
}

/* ── 문의/제안 (views/inquiries.js) ───────────────────
   버튼은 어느 화면에서든 보여야 하므로 라우트 밖(nav .foot)에 두고 PC 에서는 본문 오른쪽 위에
   띄운다. 모달(70)·토스트(60) 아래 — 창이 열리면 가려진다. 로그인 전에는 셸 자체가 없다. */
#inquiry-btn {
  position: fixed; top: 14px; right: 22px; z-index: 40;
  width: auto; margin: 0; padding: 0 12px 0 10px; min-height: 29px; border-radius: 999px;
  background: var(--bg-panel); border: 1px solid var(--border); color: var(--text-muted);
  box-shadow: 0 2px 10px rgba(0,0,0,.35); font-size: 12px; font-weight: 600;
}
#inquiry-btn:hover:not(:disabled) { color: var(--accent); border-color: var(--accent); background: var(--bg-panel); }
#inquiry-btn svg { width: 15px; height: 15px; flex: none; }
/* 보내기 창·관리자 처리 창 — confirmDialog 와 같은 상자에 입력칸이 더 있다 */
#modal .box .hd .sub { font-weight: 400; font-size: 11.5px; color: var(--text-muted); margin-left: 6px; }
#modal .box.inq.wide { width: min(680px, 92vw); }
#modal .box.inq .bd { max-height: min(78vh, 760px); overflow: auto; }
#modal .box.inq textarea { resize: vertical; min-height: 96px; }
.inq-ctx { font-size: 11.5px; }
.inq-mine { border-top: 1px solid var(--border); padding-top: 10px; }
.inq-mine-hd { font-weight: 600; color: var(--text-strong); margin-bottom: 6px; font-size: 12.5px; }
.inq-item { border: 1px solid var(--border); border-radius: 6px; padding: 6px 10px; margin-bottom: 6px; background: var(--bg-main); }
.inq-item summary { cursor: pointer; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; list-style: none; }
.inq-item summary::-webkit-details-marker { display: none; }
.inq-item .inq-title { flex: 1 1 auto; min-width: 0; color: var(--text); }
.inq-body { white-space: pre-wrap; word-break: break-word; padding: 8px 0 2px; line-height: 1.6; }
/* 줄바꿈 보존(pre-wrap)은 본문 칸에만 — 상자 자체에 주면 템플릿 들여쓰기가 빈 줄로 그려진다 */
.inq-reply {
  margin-top: 8px; padding: 8px 10px; border-left: 3px solid var(--accent); background: var(--bg-control);
  border-radius: 0 6px 6px 0;
}
.inq-reply-text { white-space: pre-wrap; word-break: break-word; }
.inq-preview { font-size: 11px; max-width: 420px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
@media (max-width: 760px) {
  /* 상단 바의 계정 줄 안으로 — 아이콘만. 글자까지 두면 브랜드·계정·로그아웃과 함께 한 줄을 넘긴다 */
  #inquiry-btn { position: static; box-shadow: none; padding: 0 8px; min-height: 30px; }
  #inquiry-btn .lbl { display: none; }
  .inq-preview { max-width: 48vw; }
}

/* ── 구성 자가점검(views/self-check.js) — 장치 카드·플릿 점검표 #/checks ───────────────── */
i.ck { display: inline-block; width: 10px; height: 10px; border-radius: 50%; vertical-align: middle; background: var(--success); }
i.ck.warn { background: var(--warning); }
i.ck.fail { background: var(--danger); }
i.ck.unknown { background: transparent; box-shadow: inset 0 0 0 1.5px var(--text-disabled); }
i.ck.none { background: transparent; }
.ck-head { gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 4px; }
.ck-sub { margin: 12px 0 6px; font-size: 12.5px; font-weight: 600; color: var(--text-strong); }
.ck-sub .dim { font-weight: 400; margin-left: 6px; }
table.ck-list td { vertical-align: top; }
table.ck-list td.ck-cell { width: 18px; padding-right: 0; }
.ck-fix { font-size: 11.5px; margin-top: 2px; }
table.ck-grid th.ck-col { cursor: pointer; text-align: center; font-size: 11px; white-space: nowrap; padding: 6px 4px; }
table.ck-grid th.ck-col.host { color: var(--text-muted); }
table.ck-grid th.ck-col.on { color: var(--accent); text-decoration: underline; }
table.ck-grid td.ck-cell { text-align: center; padding: 5px 4px; }
table.ck-grid td.ck-cell.na { background: var(--bg-main); }
table.ck-grid th.ck-name, table.ck-grid td.ck-name { white-space: nowrap; text-align: left; }
table.ck-grid tr.ck-host td { border-top: 2px solid var(--border); }
table.ck-grid tr.ck-slot td.ck-name { padding-left: 22px; }
table.ck-grid tr.stale td { opacity: .5; }
table.ck-grid tr.silent td.ck-name { color: var(--text-muted); }
table.ck-grid td.ck-when { white-space: nowrap; font-size: 11.5px; color: var(--text-muted); }
/* 좁은 화면에서 표가 가로로 밀려도 어느 파이·슬롯 줄인지 보이게 이름 칸을 붙여 둔다 */
table.ck-grid th.ck-name, table.ck-grid td.ck-name { position: sticky; left: 0; z-index: 1; background: var(--bg-panel); }
