@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+KR:wght@400;500;700;900&display=swap');

/* =========================================================================
   디자인 토큰 (FR-10 라이트/다크 모드의 기반)
   명세: docs/16_UX_REDESIGN_SPEC.md §12

   규칙: 이 파일과 JS 어디에서도 색상 리터럴(#RRGGBB)을 직접 쓰지 않는다.
   반드시 아래 토큰을 var() 로 참조한다. 리터럴을 쓰면 다크 모드에서 깨진다.

   구조
     1) 중립 램프 --n-0 ~ --n-900 : "표면 -> 텍스트" 방향의 회색 계단 한 줄.
        다크 모드는 이 램프만 뒤집으면 나머지가 전부 따라온다.
     2) 의미 토큰 (--surface, --border, --text ...) : 램프를 가리키는 별칭.
        화면 코드는 되도록 의미 토큰을 쓴다.
     3) 상태 / 강조 / 네이비 : 의미가 고정된 색.
   ========================================================================= */
:root {
  color-scheme: light;

  /* -- 1) 중립 램프 -- */
  --n-0:   #FFFFFF;   /* 카드·입력 표면 */
  --n-25:  #FCFDFE;   /* 패널 헤더 */
  --n-50:  #F9FAFB;   /* 입력 배경 */
  --n-75:  #F8FAFC;   /* 행 hover·인셋 */
  --n-100: #F2F4F7;   /* 중립 칩·헤어라인 */
  --n-125: #F1F5F9;
  --n-150: #EEF1F6;   /* 트랙·미세 배경 */
  --n-175: #EAECF0;
  --n-200: #E4E7EC;   /* 테두리 */
  --n-300: #D0D5DD;   /* 진한 테두리 */
  --n-350: #CBD5E1;
  --n-400: #AEB8C7;
  --n-500: #98A2B3;   /* 아주 흐린 글자 */
  --n-600: #667085;   /* 보조 글자 */
  --n-700: #475467;
  --n-800: #344054;   /* 본문 글자 */
  --n-900: #101828;   /* 제목 글자 */

  /* 페이지 배경은 램프와 별개다. 다크에서는 표면보다 더 어두워야 하므로
     램프의 단조성 안에 넣을 수 없다. */
  --bg: #F3F6FB;

  /* -- 2) 의미 토큰 -- */
  --surface: var(--n-0);
  --surface-head: var(--n-25);
  --surface-sunken: var(--n-75);
  --surface-muted: var(--n-100);
  --input-bg: var(--n-50);
  --border: var(--n-200);
  --border-subtle: var(--n-100);
  --border-strong: var(--n-300);
  --text: var(--n-900);
  --text-body: var(--n-800);
  --text-muted: var(--n-600);
  --text-faint: var(--n-500);
  --on-accent: #FFFFFF;   /* 강조색·네이비 위에 얹는 글자. 두 테마 모두 흰색 */

  /* -- 3) 강조 -- */
  --accent: #2F6FED;
  --accent-ink: #1D4ED8;
  --accent-cyan: #22D3EE;
  --accent-soft: #DBEAFE;
  --accent-softer: #E8EEFA;
  --accent-flash: #E0EAFF;
  --accent-ring: rgba(47,111,237,.12);
  --accent-wash: rgba(47,111,237,.10);
  --accent-shadow: rgba(47,111,237,0.32);

  /* -- 3) 상태 (초록=정상 / 회색=오프라인 / 빨강=오류) -- */
  --ok-bg: #DCFCE7; --ok-text: #15803D; --ok-text-strong: #166534; --ok-dot: #22C55E;
  --ok-border: #BBF7D0; --ok-border-strong: #A7F3D0;
  --warn-bg: #FEF3C7; --warn-bg-soft: #FFFBEB; --warn-text: #B45309; --warn-text-strong: #92400E;
  --warn-dot: #F59E0B; --warn-border: #FDE68A;
  --err-bg: #FEE2E2; --err-text: #B91C1C; --err-text-strong: #991B1B; --err-dot: #EF4444;
  --err-border: #FECACA; --err-wash: rgba(239,68,68,0.15); --err-ring: rgba(239,68,68,0.4);
  --err-text-on-dark: #FCA5A5;
  --off-bg: #F1F5F9; --off-text: #475569; --off-dot: #94A3B8;
  --info-bg: #E0F2FE; --info-text: #0369A1; --info-dot: #60A5FA;

  /* -- 3) 칩 (이벤트 종류 구분용) -- */
  --chip-indigo-bg: #EEF2FF; --chip-indigo-text: #3730A3;
  --chip-purple-bg: #F3E8FF; --chip-purple-text: #7E22CE;

  /* -- 3) 기타 -- */
  --star: #F59E0B;                    /* 즐겨찾기 별 */
  --mark-bg: #FEF08A;                 /* 검색어 하이라이트 */
  --ok-pulse: rgba(34,197,94,.55);    /* 실시간 맥박 링 */
  --ok-pulse-0: rgba(34,197,94,0);
  --shadow-color: rgba(16,24,40,.18);
  --shadow-color-soft: rgba(16,24,40,.03);
  --shadow-color-strong: rgba(16,24,40,0.22);
  --shadow-color-deep: rgba(0,0,0,0.35);

  /* -- 3) 네이비 (인증 화면·상단바) -- */
  --navy-950: #0A1224;
  --navy-900: #0D1830;
  --navy-800: #16233F;
  --navy-700: #1E2C4A;
  --navy-line: #26385C;
  --navy-text: #F8FAFC;
  --navy-text-muted: #7C90B3;
  --navy-grad-top: #10233F;
  --navy-elev: #1B2A47;
  --navy-faint: #3A4E76;
  --navy-avatar-text: #DCE6F7;
  --on-navy-hover: rgba(255,255,255,.07);
  --on-navy-active: rgba(255,255,255,.13);
  --on-navy-dots: rgba(255,255,255,0.055);
  --on-navy-icon: rgba(255,255,255,0.85);
  --on-navy-icon-hover: rgba(255,255,255,0.2);
  --thumb-bg: #0F1B33;
  --map-placeholder: var(--n-175);
  --map-tag-bg: rgba(13,24,48,0.75);
  --map-tag-text: #CBD8EE;

  --radius-lg: 16px;
  --radius-md: 12px;
  --radius-sm: 8px;

  /* 장비 상태 카드 최소 폭 (FR-06). 환경 설정의 카드 크기에 따라 JS 가 덮어쓴다. */
  --card-min: 240px;
}

/* -------------------------------------------------------------------------
   다크 모드 (FR-10)
   - 명시적 선택은 <html data-theme="light|dark"> 로 들어온다.
   - 속성이 없으면 "시스템 따름" 이므로 prefers-color-scheme 을 본다.
   - 두 블록의 값이 같아야 하므로 스크립트에서 같은 문자열을 두 번 심는다.
   ------------------------------------------------------------------------- */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --n-0:   #151E31;
    --n-25:  #18223A;
    --n-50:  #1A2438;
    --n-75:  #1C2740;
    --n-100: #212D48;
    --n-125: #24314E;
    --n-150: #273553;
    --n-175: #2A3959;
    --n-200: #2F3E60;
    --n-300: #3A4A6E;
    --n-350: #47597F;
    --n-400: #5A6C90;
    --n-500: #7488A8;
    --n-600: #94A3B8;
    --n-700: #B4C1D4;
    --n-800: #D2DBE9;
    --n-900: #E8EDF7;
    --bg: #0B1120;

    --accent: #5B8DF5;
    --accent-ink: #93B4FA;
    --accent-soft: rgba(91,141,245,.20);
    --accent-softer: rgba(91,141,245,.13);
    --accent-flash: rgba(91,141,245,.24);
    --accent-ring: rgba(91,141,245,.25);
    --accent-wash: rgba(91,141,245,.14);
    --accent-shadow: rgba(11,17,32,0.6);

    --ok-bg: rgba(52,211,153,.15); --ok-text: #6EE7B7; --ok-text-strong: #A7F3D0; --ok-dot: #34D399;
    --ok-border: rgba(52,211,153,.32); --ok-border-strong: rgba(52,211,153,.45);
    --warn-bg: rgba(251,191,36,.15); --warn-bg-soft: rgba(251,191,36,.08); --warn-text: #FCD34D;
    --warn-text-strong: #FDE68A; --warn-dot: #FBBF24; --warn-border: rgba(251,191,36,.32);
    --err-bg: rgba(248,113,113,.15); --err-text: #FCA5A5; --err-text-strong: #FECACA; --err-dot: #F87171;
    --err-border: rgba(248,113,113,.34); --err-wash: rgba(248,113,113,.16); --err-ring: rgba(248,113,113,.42);
    --err-text-on-dark: #FCA5A5;
    --off-bg: rgba(148,163,184,.14); --off-text: #94A3B8; --off-dot: #64748B;
    --info-bg: rgba(96,165,250,.15); --info-text: #93C5FD; --info-dot: #60A5FA;

    --chip-indigo-bg: rgba(129,140,248,.18); --chip-indigo-text: #A5B4FC;
    --chip-purple-bg: rgba(192,132,252,.18); --chip-purple-text: #D8B4FE;

    --star: #FBBF24;
    --mark-bg: rgba(251,191,36,.35);
    --ok-pulse: rgba(52,211,153,.55);
    --ok-pulse-0: rgba(52,211,153,0);
    --shadow-color: rgba(0,0,0,.55);
    --shadow-color-soft: rgba(0,0,0,.25);
    --shadow-color-strong: rgba(0,0,0,.6);
    --shadow-color-deep: rgba(0,0,0,0.7);

    /* 네이비 표면은 다크에서 한 단계 더 가라앉힌다 (페이지 배경과 붙지 않게) */
    --navy-900: #0B1428;
    --navy-800: #121D33;
    --navy-700: #18253E;
    --navy-line: #26364F;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --n-0:   #151E31;
  --n-25:  #18223A;
  --n-50:  #1A2438;
  --n-75:  #1C2740;
  --n-100: #212D48;
  --n-125: #24314E;
  --n-150: #273553;
  --n-175: #2A3959;
  --n-200: #2F3E60;
  --n-300: #3A4A6E;
  --n-350: #47597F;
  --n-400: #5A6C90;
  --n-500: #7488A8;
  --n-600: #94A3B8;
  --n-700: #B4C1D4;
  --n-800: #D2DBE9;
  --n-900: #E8EDF7;
  --bg: #0B1120;

  --accent: #5B8DF5;
  --accent-ink: #93B4FA;
  --accent-soft: rgba(91,141,245,.20);
  --accent-softer: rgba(91,141,245,.13);
  --accent-flash: rgba(91,141,245,.24);
  --accent-ring: rgba(91,141,245,.25);
  --accent-wash: rgba(91,141,245,.14);
  --accent-shadow: rgba(11,17,32,0.6);

  --ok-bg: rgba(52,211,153,.15); --ok-text: #6EE7B7; --ok-text-strong: #A7F3D0; --ok-dot: #34D399;
  --ok-border: rgba(52,211,153,.32); --ok-border-strong: rgba(52,211,153,.45);
  --warn-bg: rgba(251,191,36,.15); --warn-bg-soft: rgba(251,191,36,.08); --warn-text: #FCD34D;
  --warn-text-strong: #FDE68A; --warn-dot: #FBBF24; --warn-border: rgba(251,191,36,.32);
  --err-bg: rgba(248,113,113,.15); --err-text: #FCA5A5; --err-text-strong: #FECACA; --err-dot: #F87171;
  --err-border: rgba(248,113,113,.34); --err-wash: rgba(248,113,113,.16); --err-ring: rgba(248,113,113,.42);
  --err-text-on-dark: #FCA5A5;
  --off-bg: rgba(148,163,184,.14); --off-text: #94A3B8; --off-dot: #64748B;
  --info-bg: rgba(96,165,250,.15); --info-text: #93C5FD; --info-dot: #60A5FA;

  --chip-indigo-bg: rgba(129,140,248,.18); --chip-indigo-text: #A5B4FC;
  --chip-purple-bg: rgba(192,132,252,.18); --chip-purple-text: #D8B4FE;

  --star: #FBBF24;
  --mark-bg: rgba(251,191,36,.35);
  --ok-pulse: rgba(52,211,153,.55);
  --ok-pulse-0: rgba(52,211,153,0);
  --shadow-color: rgba(0,0,0,.55);
  --shadow-color-soft: rgba(0,0,0,.25);
  --shadow-color-strong: rgba(0,0,0,.6);
  --shadow-color-deep: rgba(0,0,0,0.7);

  /* 네이비 표면은 다크에서 한 단계 더 가라앉힌다 (페이지 배경과 붙지 않게) */
  --navy-900: #0B1428;
  --navy-800: #121D33;
  --navy-700: #18253E;
  --navy-line: #26364F;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; height: 100%; }
body {
  font-family: 'Noto Sans KR', -apple-system, BlinkMacSystemFont, 'Malgun Gothic', sans-serif;
  -webkit-font-smoothing: antialiased;
  background: var(--bg);
  color: var(--text);
}
a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-ink); }
button { font-family: inherit; cursor: pointer; }
input { font-family: inherit; }

[hidden] { display: none !important; }

/* ---------- layout shells ---------- */
.auth-shell {
  min-height: 100vh;
  width: 100%;
  background: radial-gradient(circle at 50% 0%, var(--navy-grad-top) 0%, var(--navy-950) 55%);
  background-image:
    radial-gradient(var(--on-navy-dots) 1px, transparent 1px),
    radial-gradient(circle at 50% 0%, var(--navy-grad-top) 0%, var(--navy-950) 55%);
  background-size: 22px 22px, 100% 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 44px 24px;
  /* 브랜드 스플래시 아트를 배경으로 덮는다. 이미지를 못 받아와도 위의 그라디언트가 남는다. */
  position: relative;
  isolation: isolate;
}
.auth-shell::before {
  content: '';
  position: absolute;
  inset: 0;
  z-index: -1;
  background: url('../images/jwc-auth-bg.svg') center / cover no-repeat;
  opacity: .9;
}
.brand {
  display: flex; flex-direction: column; align-items: center; gap: 8px; margin-bottom: 24px;
}
.brand-mark {
  width: 46px; height: 46px; border-radius: 12px;
  background: linear-gradient(135deg, var(--accent-cyan), var(--accent));
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 8px 20px var(--accent-shadow);
}
/* 브랜드 심볼(Hyb Cloud). 자체 그라디언트를 가진 로고라 배경 박스·그림자를 벗긴다. */
.brand-mark-logo {
  background: none;
  box-shadow: none;
  border-radius: 0;
}
.brand-mark-logo img { display: block; width: 100%; height: 100%; }

.brand-name { font-size: 18px; font-weight: 900; color: var(--navy-text); letter-spacing: .2px; }
.brand-sub { font-size: 12px; color: var(--navy-text-muted); margin-top: 2px; }

.auth-card {
  width: 100%; max-width: 420px;
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: 34px 32px;
  box-shadow: 0 24px 60px var(--shadow-color-deep);
}
.auth-title { font-size: 20px; font-weight: 700; margin-bottom: 4px; }
.auth-desc { font-size: 13px; color: var(--text-muted); margin-bottom: 22px; }
.back-link {
  display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; font-weight: 700;
  color: var(--text-muted); margin-bottom: 16px;
}

/* ---------- form fields ---------- */
.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-size: 12.5px; font-weight: 700; color: var(--text-body); }
.field input, .field select {
  height: 44px; border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  padding: 0 14px; font-size: 14px; color: var(--text); background: var(--input-bg);
}
.field input:focus, .field select:focus { outline: 2px solid var(--accent); outline-offset: -1px; background: var(--surface); }
.field-hint { font-size: 11.5px; color: var(--text-faint); }
.field-row { display: flex; gap: 8px; }
.field-row-2 { display: flex; gap: 12px; }
/* min-width:0 이 없으면 flex 항목이 input 고유폭 아래로 줄지 않아 행이 패널을 넘친다 */
.field-row-2 > .field { flex: 1; min-width: 0; }
/* input/select 는 고유폭(기본 size=20)을 갖는다. 컨테이너를 따라가게 못박는다. */
.field input, .field select, .field textarea { width: 100%; min-width: 0; max-width: 100%; }

.btn {
  height: 46px; width: 100%; border: none; border-radius: var(--radius-sm);
  font-size: 15px; font-weight: 700; display: flex; align-items: center; justify-content: center; gap: 8px;
}
.btn-primary {
  background: linear-gradient(135deg, var(--accent), var(--accent-ink)); color: var(--on-accent);
  box-shadow: 0 8px 18px var(--accent-shadow);
}
.btn-primary:disabled { opacity: 0.6; cursor: not-allowed; }
.btn-secondary { background: var(--surface); border: 1px solid var(--border-strong); color: var(--text-body); }
.btn-sm { height: 38px; width: auto; padding: 0 16px; font-size: 13px; }
.btn-ghost-sm {
  flex-shrink: 0; height: 44px; padding: 0 16px; border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  background: var(--surface); color: var(--text-body); font-size: 13px; font-weight: 700; white-space: nowrap;
}

.divider-text { display: flex; align-items: center; gap: 10px; margin: 22px 0 18px; }
.divider-text::before, .divider-text::after { content: ""; flex: 1; height: 1px; background: var(--n-175); }
.divider-text span { font-size: 11.5px; color: var(--text-faint); }

.center-links { display: flex; align-items: center; justify-content: center; gap: 8px; margin-top: 18px; flex-wrap: wrap; }
.center-links .dot { width: 3px; height: 3px; border-radius: 50%; background: var(--border-strong); }
.center-links a, .center-links span { font-size: 12.5px; }
.center-links span.muted { color: var(--text-muted); }
.center-links a { font-weight: 700; }

.form-msg { font-size: 12.5px; padding: 10px 12px; border-radius: var(--radius-sm); margin-top: 14px; }
.form-msg.error { background: var(--err-bg); color: var(--err-text); }
.form-msg.success { background: var(--ok-bg); color: var(--ok-text); }

.result-box {
  margin-top: 22px; padding: 18px; border-radius: var(--radius-md);
  background: var(--ok-bg); border: 1px solid var(--ok-border); display: flex; gap: 12px; align-items: flex-start;
}
.result-icon {
  flex-shrink: 0; width: 32px; height: 32px; border-radius: 50%; background: var(--ok-bg);
  display: flex; align-items: center; justify-content: center;
}

/* ---------- app shell (dashboard / detail) ---------- */
.app-shell { height: 100vh; display: flex; flex-direction: column; background: var(--bg); }
.topbar {
  height: 64px; flex-shrink: 0; background: var(--navy-900); border-bottom: 1px solid var(--navy-700);
  display: flex; align-items: center; justify-content: space-between; padding: 0 28px;
  gap: 12px;
  /* overflow:hidden 을 두지 않는다 — 가로 넘침은 topbar-left/right 의 min-width:0 과
     각 라벨의 자체 ellipsis 로 이미 처리된다. 여기서 overflow:hidden 을 두면
     아래로 펼쳐지는 스코프 칩 드롭다운(.scope-pop, position:absolute)이 64px 높이에서
     잘려서 안 보이는 버그가 생긴다. */
}
/* min-width:0 이 없으면 두 덩어리가 내용 크기 아래로 줄지 않아 상단바가 창을 넘친다 */
.topbar-left { display: flex; align-items: center; gap: 20px; min-width: 0; }
/* 로고는 "기본 화면으로" 버튼이다. 버튼 기본 스타일은 지우고 모양은 그대로 둔다. */
.topbar-logo {
  display: flex; align-items: center; gap: 10px;
  padding: 2px 6px 2px 2px; margin-left: -2px;
  border: 0; border-radius: 9px; background: transparent;
  color: inherit; font: inherit; cursor: pointer;
  transition: background .15s ease;
}
.topbar-logo:hover { background: var(--on-navy-hover); }
.topbar-logo:focus-visible { outline: 2px solid var(--accent-cyan); outline-offset: 1px; }
.topbar-logo .brand-mark { width: 32px; height: 32px; border-radius: 9px; }
.topbar-logo .brand-mark-logo { width: 28px; height: 28px; }
.topbar-logo-text { font-size: 15px; font-weight: 800; color: var(--navy-text); }
.topbar-divider { width: 1px; height: 22px; background: var(--navy-line); }

/* ---------- 상단바 액션 (테마 토글 · 전역 검색 · 설정) ----------
   FR-10 / FR-11 / FR-01. 상단바는 네이비라 아이콘 버튼도 네이비 위 기준으로 칠한다. */
.topbar-actions { display: flex; align-items: center; gap: 4px; }
.topbar-icon-btn {
  width: 34px; height: 34px; flex-shrink: 0;
  display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid transparent; border-radius: 9px;
  background: transparent; color: var(--navy-text-muted);
  transition: background .15s ease, color .15s ease, border-color .15s ease;
}
.topbar-icon-btn:hover { background: var(--on-navy-hover); color: var(--navy-text); }
.topbar-icon-btn:active { background: var(--on-navy-active); }
.topbar-icon-btn:focus-visible { outline: 2px solid var(--accent-cyan); outline-offset: 1px; }
/* 명시적으로 라이트/다크를 고른 상태는 아이콘을 살짝 강조해 "고정됨"을 알린다 */
.topbar-icon-btn[data-theme-state="light"],
.topbar-icon-btn[data-theme-state="dark"] { color: var(--navy-text); background: var(--on-navy-hover); }

/* ---------- 전역 스코프 칩 (요구사항 2-5) ----------
   화면별 콤보박스 3개를 상단바의 칩 하나로 합쳤다. 팝오버에서 복수 그룹을 고를 수 있다. */
.scope-chip-wrap { position: relative; }
.scope-chip {
  display: inline-flex; align-items: center; gap: 7px;
  height: 34px; padding: 0 11px;
  border: 1px solid var(--navy-line); border-radius: 999px;
  background: var(--on-navy-hover); color: var(--navy-text);
  font-size: 12.5px; font-weight: 700; font-family: inherit;
  max-width: 260px;
  transition: background .15s ease, border-color .15s ease;
}
.scope-chip:hover { background: var(--on-navy-active); border-color: var(--accent); }
.scope-chip:focus-visible { outline: 2px solid var(--accent-cyan); outline-offset: 1px; }
.scope-chip.active { border-color: var(--accent); background: var(--on-navy-active); }
.scope-chip-icon { display: inline-flex; color: var(--accent-cyan); flex-shrink: 0; }
.scope-chip.active .scope-chip-icon { color: var(--star); }
.scope-chip-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.scope-pop {
  position: absolute; top: calc(100% + 8px); right: 0; z-index: 60;
  width: 320px; max-width: calc(100vw - 24px);
  background: var(--surface); color: var(--text);
  border: 1px solid var(--border); border-radius: 14px;
  box-shadow: 0 18px 44px var(--shadow-color);
  overflow: hidden;
  animation: scope-pop-in .14s ease-out;
}
@keyframes scope-pop-in { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }

.scope-pop-search { position: relative; padding: 10px 12px; border-bottom: 1px solid var(--border-subtle); }
.scope-pop-search svg { position: absolute; left: 22px; top: 50%; transform: translateY(-50%); color: var(--text-faint); }
.scope-pop-search input {
  width: 100%; height: 34px; padding: 0 10px 0 30px;
  border: 1px solid var(--border); border-radius: 9px;
  background: var(--input-bg); color: var(--text); font-size: 12.5px;
}
.scope-pop-search input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-ring); }

.scope-pop-section { padding: 6px; }
.scope-row {
  width: 100%; display: flex; align-items: center; gap: 10px;
  padding: 8px 9px; border: none; border-radius: 9px;
  background: transparent; color: var(--text); font: inherit; text-align: left;
}
.scope-row:hover { background: var(--surface-sunken); }
.scope-row.selected { background: var(--accent-softer); }
.scope-row-icon { display: inline-flex; color: var(--text-faint); flex-shrink: 0; }
.scope-row.selected .scope-row-icon { color: var(--accent); }
.scope-star { color: var(--star); display: inline-flex; }
.scope-row-text { display: flex; flex-direction: column; gap: 1px; min-width: 0; flex: 1; }
.scope-row-label { font-size: 13px; font-weight: 700; }
.scope-row-sub { font-size: 11px; color: var(--text-muted); }
.scope-row-check { color: var(--accent); display: inline-flex; width: 13px; flex-shrink: 0; }

.scope-pop-divider { height: 1px; background: var(--border-subtle); }
.scope-pop-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 15px 6px; font-size: 11px; font-weight: 800;
  color: var(--text-faint); letter-spacing: .3px;
}
.scope-pop-clear {
  border: none; background: transparent; color: var(--accent);
  font: inherit; font-size: 11px; font-weight: 700; padding: 0;
}
.scope-pop-clear:hover { text-decoration: underline; }

.scope-pop-list { max-height: 240px; overflow-y: auto; padding: 0 6px 6px; }
.scope-check {
  display: flex; align-items: center; gap: 10px;
  padding: 7px 9px; border-radius: 9px; cursor: pointer;
}
.scope-check:hover { background: var(--surface-sunken); }
.scope-check.on { background: var(--accent-softer); }
.scope-check input { position: absolute; opacity: 0; width: 0; height: 0; }
.scope-check-box {
  width: 17px; height: 17px; flex-shrink: 0; border-radius: 5px;
  border: 1.5px solid var(--border-strong); background: var(--surface);
  display: inline-flex; align-items: center; justify-content: center;
  color: transparent; transition: background .12s ease, border-color .12s ease;
}
.scope-check.on .scope-check-box { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.scope-check input:focus-visible + .scope-check-box { outline: 2px solid var(--accent); outline-offset: 1px; }
.scope-check-name {
  flex: 1; min-width: 0; font-size: 12.5px; font-weight: 600;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.scope-check-meta { font-size: 11px; color: var(--text-faint); flex-shrink: 0; }
.scope-pop-empty { padding: 22px 12px; text-align: center; font-size: 12px; color: var(--text-muted); }
.scope-pop-foot {
  padding: 9px 15px; border-top: 1px solid var(--border-subtle);
  background: var(--surface-sunken); font-size: 11px; color: var(--text-muted); line-height: 1.5;
}

/* 좁은 화면: 칩 라벨을 줄이고 팝오버는 화면 폭에 맞춘다 */
@media (max-width: 900px) {
  .scope-chip { max-width: 140px; }
  .scope-pop { width: min(320px, calc(100vw - 20px)); }
}
/* ---------- app body: tree sidebar + content panel ---------- */
.app-body { flex: 1; min-height: 0; display: flex; }

.icon-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 26px; height: 26px; border-radius: 7px; border: none; background: transparent;
  color: var(--text-faint); flex-shrink: 0;
}
.icon-btn:hover { background: var(--border); color: var(--text); }
.icon-btn.danger:hover { background: var(--err-bg); color: var(--err-text); }

.tree-panel {
  width: 300px; flex-shrink: 0; background: var(--surface); border-right: 1px solid var(--border);
  display: flex; flex-direction: column; overflow: hidden;
}
.tree-panel-head {
  height: 52px; flex-shrink: 0; display: flex; align-items: center; justify-content: space-between;
  padding: 0 14px 0 18px; border-bottom: 1px solid var(--border);
}
.tree-panel-title { font-size: 12px; font-weight: 800; color: var(--text-faint); letter-spacing: 0.04em; text-transform: uppercase; }
.tree-root { flex: 1; overflow-y: auto; padding: 8px; }

.tree-row {
  display: flex; align-items: center; gap: 6px; height: 36px; padding: 0 6px; border-radius: 8px;
  cursor: pointer; user-select: none;
}
/* 장비가 많은 그룹을 펼치면 트리 한 곳에 수천 행이 쌓인다(장비 1대당 DOM 약 18개, SVG 3개).
   화면 밖 행까지 매번 레이아웃·페인트하면 스크롤이 끊기므로, 보이지 않는 행은 브라우저가
   통째로 건너뛰게 한다. 행 높이가 36px 로 고정이라 자리(스크롤바 길이)는 정확히 유지된다.
   지원하지 않는 브라우저는 이 두 줄을 무시하고 예전처럼 동작한다. */
.tree-leaf-list > .tree-row-leaf {
  content-visibility: auto;
  contain-intrinsic-size: auto 36px;
}
.tree-row:hover { background: var(--bg); }
.tree-row.selected {
  background: rgba(59, 130, 246, .12);
  box-shadow: inset 3px 0 0 var(--accent);
  font-weight: 700;
}
.tree-row.selected .tree-label { color: var(--text); }
.tree-row.selected .tree-count { color: var(--text-muted); }
.tree-row.selected:hover { background: rgba(59, 130, 246, .18); }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .tree-row.selected { background: rgba(96, 165, 250, .17); }
  :root:not([data-theme="light"]) .tree-row.selected:hover { background: rgba(96, 165, 250, .24); }
}
:root[data-theme="dark"] .tree-row.selected { background: rgba(96, 165, 250, .17); }
:root[data-theme="dark"] .tree-row.selected:hover { background: rgba(96, 165, 250, .24); }

/* 펼침·접힘 화살표. 행의 맨 왼쪽에서 "여기를 누르면 열린다"만 말하면 되는 자리라
   얇은 획보다 채운 삼각형이 맞다. 열리면 90도 돌아 아래를 가리킨다. */
.tree-caret {
  width: 16px; height: 16px; flex-shrink: 0; display: flex; align-items: center; justify-content: center;
  color: var(--text-muted); background: none; border: none; cursor: pointer;
  transition: transform .12s ease, color .12s ease;
}
.tree-caret:hover { color: var(--text); }
.tree-caret.open { transform: rotate(90deg); }
/* 화살표가 없는 행(잎)도 같은 자리를 비워 둬야 이름이 세로로 줄을 맞춘다. */
.tree-leaf-indent { width: 16px; flex-shrink: 0; }
.tree-icon { flex-shrink: 0; display: flex; color: var(--text-faint); }
.tree-label { flex: 1; min-width: 0; font-size: 13px; font-weight: 600; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tree-count { font-size: 11px; color: var(--text-faint); font-weight: 700; }
.tree-role-tag { font-size: 10px; font-weight: 700; color: var(--text-faint); background: var(--bg); padding: 2px 6px; border-radius: 999px; flex-shrink: 0; }
.tree-actions { display: flex; align-items: center; gap: 2px; flex-shrink: 0; }
/* 바탕이 투명해졌으므로 아이콘도 본문 색을 그대로 쓴다. */
.tree-row.selected .icon-btn { color: var(--text-muted); }
.tree-row.selected .icon-btn:hover { background: var(--surface-muted); color: var(--text); }

.tree-group { margin-bottom: 2px; }
.tree-row-group { font-weight: 800; }
.tree-branch { margin-left: 20px; }
.tree-row-branch { color: var(--text-muted); }
.tree-leaf-list { margin-left: 20px; }
.tree-row-leaf .status-dot { flex-shrink: 0; }
/* 다른 장비가 가져온 하위 장비. 목록으로만 보여 주므로 누르는 시늉도 하지 않는다. */
.tree-row-child { cursor: default; padding-left: 16px; }
.tree-row-child:hover { background: none; }
.tree-row-child .tree-label { font-weight: 400; color: var(--text-muted); }

/* inline 요소에는 width/height 가 먹지 않는다. 트리에서는 부모가 flex 라
   우연히 동작했지만, 설정 화면의 표 셀(table-cell)에서는 크기가 0 이 돼 보이지 않았다. */
.status-dot {
  display: inline-block; width: 7px; height: 7px; border-radius: 50%;
  background: var(--off-dot);   /* 상태를 모르는 장비도 최소한 보이게 */
  vertical-align: middle;
}

/* 세로만 스크롤한다. overflow-y 만 주면 x 축이 auto 로 풀려 폼이 조금만 넓어도
   가로 스크롤바가 생긴다. 진짜로 넓은 표는 각자 .st-list-wrap 처럼 자기 래퍼에서
   가로 스크롤을 갖는다. */
.content-panel { flex: 1; min-width: 0; overflow-x: hidden; overflow-y: auto; padding: 32px; }
.content-page, .content-card { max-width: 100%; }
.content-page { max-width: min(640px, 100%); }
.content-page-wide { max-width: 100%; }
.content-page-head { margin-bottom: 22px; }
.content-page-title { font-size: 19px; font-weight: 800; }
.content-page-sub { font-size: 13px; color: var(--text-muted); margin-top: 4px; }
.content-empty {
  height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 10px; text-align: center; color: var(--text-muted);
}
.content-empty svg { color: var(--text-faint); }
.content-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-md); padding: 24px; }
.form-actions { display: flex; gap: 10px; margin-top: 22px; }
.form-actions .btn { width: auto; flex: 1; }
.form-actions .btn-danger { background: var(--err-bg); color: var(--err-text); }
.topbar-right { display: flex; align-items: center; gap: 18px; min-width: 0; flex-shrink: 0; }
.user-chip { display: flex; align-items: center; gap: 9px; }
.user-avatar {
  width: 30px; height: 30px; border-radius: 50%; background: var(--navy-line); color: var(--navy-avatar-text);
  font-size: 12px; font-weight: 800; display: flex; align-items: center; justify-content: center;
}
.user-name { font-size: 12.5px; font-weight: 700; color: var(--navy-text); line-height: 1.2; }
.user-role { font-size: 10.5px; color: var(--navy-text-muted); line-height: 1.2; }
.logout-link { font-size: 12px; color: var(--navy-text-muted); font-weight: 600; }
.logout-link:hover { color: var(--on-accent); }
.btn-inline { display: inline-flex; align-items: center; gap: 6px; height: 38px; padding: 0 16px; border: none; border-radius: var(--radius-sm); font-size: 13px; font-weight: 700; }

.empty-state {
  border: 1px dashed var(--border); border-radius: var(--radius-md); padding: 48px 24px;
  display: flex; flex-direction: column; align-items: center; gap: 12px; text-align: center; background: var(--surface);
}
.empty-state p { margin: 0; font-size: 13px; color: var(--text-muted); max-width: 40ch; }

.badge { position: absolute; top: 10px; left: 10px; display: flex; align-items: center; gap: 5px; padding: 4px 9px; border-radius: 999px; font-size: 11px; font-weight: 800; }
.badge-inline { position: static; display: inline-flex; }
.badge-ONLINE { background: var(--ok-bg); color: var(--ok-text); }
.badge-OFFLINE { background: var(--off-bg); color: var(--off-text); }
.badge-ERROR { background: var(--err-bg); color: var(--err-text); }
.badge-INFO { background: var(--info-bg); color: var(--info-text); }
.badge-WARN { background: var(--warn-bg); color: var(--warn-text); }
.dot-ONLINE { background: var(--ok-dot); }
.dot-OFFLINE { background: var(--off-dot); }
.dot-ERROR { background: var(--err-dot); }
/* 정상이지만 사람이 봐야 하는 것 (예: 정상 (계정 확인 필요)) — state.js statusBadgeHtml */
.badge-ATTN { background: var(--warn-bg); color: var(--warn-text); white-space: nowrap; }
.dot-ATTN { background: var(--warn-dot); }
/* 배지가 길어지면 제목 글을 다음 줄로 보낸다 (좁은 장비 상세 칸) */
.health-hero { flex-wrap: wrap; row-gap: 6px; }

/* ---------- device detail ---------- */
.detail-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 18px; gap: 16px; flex-wrap: wrap; }
.detail-crumb { font-size: 12px; color: var(--text-faint); font-weight: 600; margin-bottom: 6px; }
.detail-title-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.detail-title { font-size: 22px; font-weight: 800; }
.detail-actions { display: flex; gap: 10px; }

.detail-grid { display: grid; grid-template-columns: 1.55fr 1fr; gap: 20px; margin-bottom: 20px; }
@media (max-width: 900px) { .detail-grid { grid-template-columns: 1fr; } }

.map-box { position: relative; height: 420px; border-radius: 14px; overflow: hidden; border: 1px solid var(--border); background: var(--map-placeholder); }
.map-tag { position: absolute; left: 12px; bottom: 12px; background: var(--map-tag-bg); color: var(--map-tag-text); font-size: 10.5px; padding: 5px 10px; border-radius: 6px; }
.map-marker { position: absolute; transform: translate(-50%, -100%); color: var(--accent); }
.map-popup { position: absolute; width: 220px; background: var(--surface); border-radius: 12px; box-shadow: 0 12px 28px var(--shadow-color-strong); padding: 14px; }
.map-popup-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; gap: 8px; }
.map-popup-name { font-size: 13px; font-weight: 800; }
.map-popup-body { font-size: 11px; color: var(--text-muted); line-height: 1.6; }

.preview-box { position: relative; height: 220px; border-radius: 14px; overflow: hidden; background: linear-gradient(135deg, var(--navy-elev), var(--navy-950)); display: flex; align-items: center; justify-content: center; color: var(--navy-faint); }
.preview-box > img { width: 100%; height: 100%; object-fit: cover; }
.preview-live { position: absolute; top: 12px; left: 12px; display: flex; align-items: center; gap: 6px; background: var(--err-wash); border: 1px solid var(--err-ring); padding: 4px 9px; border-radius: 999px; font-size: 10.5px; font-weight: 800; color: var(--err-text-on-dark); }
.preview-caption { position: absolute; bottom: 12px; left: 12px; font-size: 11px; color: var(--navy-text-muted); }

.info-card { background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 18px 20px; flex: 1; }
.info-card-title { font-size: 13px; font-weight: 800; margin-bottom: 14px; }
.info-row { display: flex; justify-content: space-between; gap: 12px; font-size: 12.5px; padding: 5px 0; }
/* 상세의 장비 정보는 줄이 11개라 한 줄만 접혀도 칸을 넘는다. 값은 한 줄로 자른다. */
.detail-panel .info-card .v { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.info-row .k { color: var(--text-muted); }
.info-row .v { font-weight: 700; text-align: right; }

.panel { background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 20px 22px 8px; }
.panel-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; gap: 12px; flex-wrap: wrap; }
.panel-title { font-size: 15px; font-weight: 800; }
.tabs { display: flex; gap: 8px; flex-wrap: wrap; }
.tab { padding: 7px 14px; border-radius: 999px; font-size: 12px; font-weight: 700; border: 1px solid transparent; background: var(--surface-muted); color: var(--n-700); }
.tab.active { background: var(--text); color: var(--surface); }

/* 이벤트 행 스타일은 아래 "XEMS 이벤트 수신" 섹션의 그리드 레이아웃으로 대체되었다. */

.loading-text { font-size: 13px; color: var(--text-muted); padding: 40px 0; text-align: center; }

/* ---------- group detail / member management ---------- */
.group-detail-page { padding-bottom: 24px; }
.group-detail-notice { margin-bottom: 18px; }
.group-summary-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; margin-bottom: 20px; }
.group-summary-card {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  min-height: 72px; padding: 16px 18px; border: 1px solid var(--border); border-radius: 14px; background: var(--surface);
}
.group-summary-card span { font-size: 12.5px; color: var(--text-muted); font-weight: 700; }
.group-summary-card strong { font-size: 24px; color: var(--text); }
.group-member-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; align-items: start; }
.group-member-panel { padding-bottom: 8px; }
.group-list-count { font-size: 11px; font-weight: 800; color: var(--text-muted); background: var(--bg); padding: 4px 9px; border-radius: 999px; }
.group-member-row { display: flex; align-items: center; gap: 11px; min-height: 66px; padding: 10px 0; border-top: 1px solid var(--border-subtle); }
.group-member-avatar {
  width: 34px; height: 34px; flex-shrink: 0; display: flex; align-items: center; justify-content: center;
  border-radius: 50%; background: var(--accent-softer); color: var(--accent-ink); font-size: 11px; font-weight: 800;
}
.group-member-main { flex: 1; min-width: 0; }
.group-member-name { font-size: 13px; font-weight: 800; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.group-member-email { margin-top: 3px; font-size: 11.5px; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.group-member-joined { font-size: 10.5px; color: var(--text-faint); white-space: nowrap; }
.group-member-actions { display: flex; gap: 6px; flex-shrink: 0; }
.group-member-actions .btn-inline { height: 30px; padding: 0 10px; font-size: 11px; }
.btn-member-danger { background: var(--err-bg); color: var(--err-text); }
.group-member-empty { padding: 28px 8px; border-top: 1px solid var(--border-subtle); text-align: center; font-size: 12px; color: var(--text-muted); }

@media (max-width: 1180px) {
  .group-member-grid { grid-template-columns: 1fr; }
}

/* 상단바가 창을 넘기기 시작하는 구간. 정보량이 가장 낮은 것부터 접는다:
   검색 버튼의 최소폭 -> Ctrl K 배지 -> 사용자 이름/권한 -> 구분선.
   아바타와 로그아웃은 남기므로 누가 로그인했는지와 나가는 길은 그대로다. */
@media (max-width: 1080px) {
  .topbar { padding: 0 16px; }
  .topbar-search { min-width: 0; flex-shrink: 1; }
  .topbar-search kbd { display: none; }
  .topbar-right { gap: 10px; }
  .topbar-nav { margin-left: 12px; }
}
@media (max-width: 900px) {
  .topbar-search > span, .topbar-divider { display: none; }
  .topbar-search { min-width: 34px; padding: 0 9px; }
  .user-name, .user-role { display: none; }
  .user-chip { gap: 0; }
}

@media (max-width: 700px) {
  .auth-shell { padding: 28px 16px; }
  .auth-card { padding: 26px 20px; }
  .field-row-2 { flex-direction: column; }
  .topbar { height: auto; min-height: 58px; padding: 10px 12px; }
  .app-shell { height: auto; min-height: 100vh; }
  .app-body { flex-direction: column; }
  .tree-panel { width: 100%; max-height: 38vh; border-right: none; border-bottom: 1px solid var(--border); }
  .content-panel { padding: 20px 14px; min-height: 62vh; }
  .detail-header { align-items: flex-start; }
  .detail-actions { width: 100%; }
  .detail-actions .btn-inline { flex: 1; justify-content: center; padding: 0 8px; }
  .map-box { height: 300px; }
  .map-popup { width: 190px; }
  .form-actions { flex-wrap: wrap; }
  .group-summary-grid { grid-template-columns: 1fr; }
  .group-member-row { align-items: flex-start; flex-wrap: wrap; }
  .group-member-main { min-width: calc(100% - 48px); }
  .group-member-joined { display: none; }
  .group-member-actions { width: 100%; padding-left: 45px; }
}


/* ===== XEMS 이벤트 수신: 실시간 피드 / 이벤트 행 ===== */
.panel-title-group { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.live-pill { display: inline-flex; align-items: center; gap: 6px; padding: 3px 9px; border-radius: 999px; background: var(--ok-bg); color: var(--ok-text); font-size: 11px; font-weight: 800; letter-spacing: .02em; }
.live-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--ok-dot); animation: live-pulse 1.6s ease-out infinite; }
@keyframes live-pulse { 0% { box-shadow: 0 0 0 0 var(--ok-pulse); } 100% { box-shadow: 0 0 0 7px var(--ok-pulse-0); } }
.event-new-count { display: inline-flex; padding: 3px 9px; border-radius: 999px; background: var(--accent); color: var(--on-accent); font-size: 11px; font-weight: 800; animation: pop-in .25s ease-out; }
@keyframes pop-in { from { transform: scale(.85); opacity: 0; } to { transform: scale(1); opacity: 1; } }

/* --- 행 레이아웃 -------------------------------------------------------
   열을 그리드로 고정해 수백 건이 쌓여도 눈이 세로로 따라 읽힌다.
   순서: 심각도 · 시각 · (장비) · 타입/상태 · 채널 · 본문 · 스냅샷 · 화살표     */
/* ===== 이벤트 목록 =====================================================
   요구: xeventportable(XEMS HTTP 이벤트 프로토콜)의 내용을 목록에서 바로 읽게
   표시 규칙은 client/js/eventCatalog.js 에 있다.

   확장성: 색을 event.type 별 선택자(.type-motion 등)로 두지 않고 **톤**으로 받는다.
   (.tone-info / .tone-notice / .tone-warn / .tone-danger / .tone-neutral)
   그래서 새 이벤트 타입이 생겨도 이 파일은 고칠 필요가 없다.
   -------------------------------------------------------------------- */

/* ---- 톤 팔레트 (칩·배지가 공유) ---- */
.tone-info    { --tone-bg: var(--info-bg);        --tone-fg: var(--info-text);        --tone-dot: var(--info-dot); }
.tone-notice  { --tone-bg: var(--chip-indigo-bg); --tone-fg: var(--chip-indigo-text); --tone-dot: var(--accent); }
.tone-warn    { --tone-bg: var(--warn-bg);        --tone-fg: var(--warn-text);        --tone-dot: var(--warn-dot); }
.tone-danger  { --tone-bg: var(--err-bg);         --tone-fg: var(--err-text);         --tone-dot: var(--err-dot); }
.tone-neutral { --tone-bg: var(--off-bg);         --tone-fg: var(--off-text);         --tone-dot: var(--off-dot); }

/* ---- 행 ---- */
.event-row {
  display: block;
  border-top: 1px solid var(--border-subtle);
  border-left: 3px solid transparent;
}
.event-row:first-child { border-top: none; }
/* 왼쪽 띠는 심각도 톤을 따른다 */
.event-row.tone-danger { border-left-color: var(--err-dot); }
.event-row.tone-warn   { border-left-color: var(--warn-dot); }
.event-row.tone-info   { border-left-color: var(--n-350); }

.event-row-main {
  display: grid;
  grid-template-columns: 116px 128px 44px minmax(0, 1fr) 56px 16px;
  align-items: center;
  gap: 12px;
  padding: 9px 10px 9px 12px;
}
.event-list-with-device .event-row-main {
  grid-template-columns: 116px 116px 132px 128px 44px minmax(0, 1fr) 56px 16px;
}
.event-row-expandable .event-row-main { cursor: pointer; }
.event-row-expandable .event-row-main:hover { background: var(--surface-sunken); }
.event-row.open .event-row-main { background: var(--surface-sunken); }
.event-row-new { animation: event-flash 2.4s ease-out; }
@keyframes event-flash { 0% { background: var(--accent-flash); } 100% { background: transparent; } }

/* ---- 심각도 배지 ---- */
.event-badge {
  display: flex; align-items: center; justify-content: center;
  padding: 3px 0; border-radius: 6px;
  font-size: 10px; font-weight: 900; letter-spacing: .04em;
  background: var(--tone-bg); color: var(--tone-fg);
}

/* ---- 시각 ---- */
.event-time { display: flex; flex-direction: column; line-height: 1.35; min-width: 0; }
.event-time-abs { font-size: 11.5px; color: var(--text); font-variant-numeric: tabular-nums; white-space: nowrap; }
.event-time-rel { font-size: 10.5px; color: var(--text-faint); }

/* ---- 장비 ---- */
.event-device-link {
  border: none; background: var(--surface-muted); color: var(--text);
  font: inherit; font-size: 11.5px; font-weight: 700;
  padding: 5px 9px; border-radius: 7px; cursor: pointer;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-align: left;
}
.event-device-link:hover { background: var(--accent-soft); color: var(--accent-ink); }

/* ---- 타입 칩 + 상태 ---- */
.event-type { display: flex; align-items: center; gap: 6px; min-width: 0; }
.event-type-chip {
  display: inline-flex; align-items: center; gap: 5px; min-width: 0;
  padding: 3px 8px; border-radius: 7px;
  font-size: 11.5px; font-weight: 800; white-space: nowrap;
  background: var(--tone-bg); color: var(--tone-fg);
}
.event-type-chip svg { flex-shrink: 0; }
.event-type-chip > span { overflow: hidden; text-overflow: ellipsis; }
/* 카탈로그에 없는 event.type 임을 알린다. 값은 그대로 보이지만 라벨은 자동 생성이다. */
.event-type-new {
  font-style: normal; font-size: 9.5px; font-weight: 800;
  padding: 0 4px; border-radius: 4px;
  background: var(--tone-fg); color: var(--tone-bg); opacity: .85;
}
/* ---- 채널 ---- */
.event-ch {
  font-size: 11px; font-weight: 800; color: var(--text-muted);
  background: var(--off-bg); border-radius: 6px;
  padding: 3px 0; text-align: center; font-variant-numeric: tabular-nums;
}
.event-ch-none { color: var(--n-350); background: transparent; }

/* ---- 제목 ---- */
.event-msg { min-width: 0; }
.event-msg-text {
  display: block; font-size: 13px; color: var(--text);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

/* ---- 썸네일 ---- */
.event-thumb {
  width: 56px; height: 32px; border-radius: 5px;
  background: var(--thumb-bg); overflow: hidden; display: block;
}
.event-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.event-thumb-empty { background: transparent; }

.event-chevron { display: inline-flex; color: var(--text-faint); transition: transform .18s ease; }
.event-row.open .event-chevron { transform: rotate(90deg); }

/* ---- attributes 칩 = 이벤트 내용 ----
   프로토콜 §3 의 "기본 보조값" 이 여기 온다.
   제목 칸(.event-msg) 안에 들어간다 — wire 이벤트는 제목이 없어 그 칸이 비기 때문이다.
   칩이 많으면 칸 안에서 줄바꿈되고 행 높이가 알아서 늘어난다. */
.event-chips {
  display: flex; align-items: center; gap: 5px; flex-wrap: wrap;
  min-width: 0;
}
.event-chip {
  display: inline-flex; align-items: baseline; gap: 5px;
  padding: 2px 8px; border-radius: 999px;
  background: var(--surface-muted); border: 1px solid transparent;
  font-size: 11px; line-height: 1.6; white-space: nowrap; max-width: 100%;
}
.event-chip-k { color: var(--text-faint); font-weight: 600; }
.event-chip-v { color: var(--text); font-weight: 800; font-variant-numeric: tabular-nums; overflow: hidden; text-overflow: ellipsis; }
/* 측정값처럼 사람이 먼저 보는 값 */
.event-chip-strong { background: var(--surface); border-color: var(--border-strong); }
.event-chip-strong .event-chip-v { color: var(--text); }
.event-chip-more { color: var(--text-faint); font-weight: 800; }

/* ---- 펼침 상세 ---- */
.event-detail {
  display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 20px;
  padding: 2px 16px 18px 82px; background: var(--surface-sunken);
}
.event-detail-thumb {
  margin: 0; border-radius: 10px; overflow: hidden;
  background: linear-gradient(135deg, var(--navy-elev), var(--navy-950));
  min-height: 130px; display: flex; align-items: center; justify-content: center; align-self: start;
}
.event-detail-thumb img { display: block; width: 100%; height: auto; }
.event-detail-thumb-loading { font-size: 12px; color: var(--navy-text-muted); padding: 24px; text-align: center; }
.event-detail-thumb-none { background: var(--n-150); border: 1px dashed var(--border-strong); }
.event-detail-thumb-none .event-detail-thumb-loading { color: var(--text-faint); }
.event-detail-body { min-width: 0; }
.event-attr-group-title {
  display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap;
  font-size: 11px; font-weight: 800; color: var(--text-faint);
  letter-spacing: .04em; margin: 2px 0 6px;
}
.event-attr-note { font-size: 10.5px; font-weight: 600; color: var(--text-faint); opacity: .85; }
.event-attr-group-title + .event-attrs { margin-bottom: 14px; }
.event-attrs { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 0 20px; }
.event-attr {
  display: flex; justify-content: space-between; gap: 12px;
  padding: 5px 0; border-bottom: 1px dashed var(--n-175); font-size: 12.5px;
}
.event-attr-k { color: var(--text-muted); white-space: nowrap; }
/* 카탈로그에 없는 속성 키 표시 */
.event-attr-k i { font-style: normal; color: var(--text-faint); font-size: 10px; }
.event-attr-v { font-weight: 700; text-align: right; overflow-wrap: anywhere; }
.event-attr-faint .event-attr-k, .event-attr-faint .event-attr-v { color: var(--text-faint); font-weight: 500; }
.event-attr-v.mono { word-break: break-all; }

/* ---- 좁은 컨테이너용 목록 (대시보드 "최근 이벤트" 카드) ----
   화면은 넓지만 카드가 1칸 폭이라 8열 그리드가 넘친다. 컨테이너 폭은 미디어쿼리로
   알 수 없으므로 JS 가 .event-list-compact 를 붙여 알려준다.
   (컨테이너 쿼리로도 되지만 이미 JS 가 compact 를 알고 있어 클래스가 더 단순하다) */
/* 좁은 칸에서는 세 줄로 나눈다.
     1줄 무슨 일이 (유형)
     2줄 언제 · 어디서 (시각 · 장비명)
     3줄 자세히 (칩)
   예전에는 장비명과 유형을 2줄에 나란히 욱여넣어 양쪽 다 잘렸다. */
.event-list-compact .event-row-main,
.event-list-compact.event-list-with-device .event-row-main {
  /* 유형 · 시각 · 장비명을 한 줄에 나란히 둔다.
     장비명이 아래 줄에 혼자 있을 때보다 "무엇이 / 언제 / 어디서" 가 한 번에 읽힌다. */
  grid-template-columns: auto auto minmax(0, 1fr) 44px 14px;
  grid-template-areas:
    "type time dev  thumb chev"
    "msg  msg  msg  thumb chev";
  row-gap: 2px;
  gap: 8px;
  padding: 8px 8px 8px 10px;
}
.event-list-compact .event-row-main > .event-type { grid-area: type; justify-self: start; min-width: 0; max-width: 100%; }
/* 시각을 유형 칩 바로 옆에 둔다. "무엇이 / 언제" 를 한 눈에 읽는다.
   두 줄로 쌓여 있던 것을 "날짜 시각 · 방금" 한 줄로 눕힌다. */
.event-list-compact .event-row-main > .event-time {
  grid-area: time; flex-direction: row; align-items: baseline; gap: 6px;
  justify-self: start; min-width: 0;
}
.event-list-compact .event-time-abs { font-size: 11px; color: var(--text-muted); }
.event-list-compact .event-time-rel { font-size: 10.5px; }
/* 장비명은 시각 바로 옆. 글자만큼만 차지하고 길면 줄인다. */
.event-list-compact .event-row-main > .event-device-link {
  grid-area: dev; justify-self: start; max-width: 100%;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  background: transparent; padding: 0; font-weight: 700; font-size: 11px;
  color: var(--text-muted);
}
/* MAC·IP 는 이 카드에서 뺀다.
   배치 규칙이 없어 자동 배치로 44px 칸에 끼는 바람에 "1··" 으로만 잘려,
   자리만 먹고 아무것도 알려주지 못했다. 값은 행을 펼치면 '수신 정보' 에 있다. */
.event-list-compact .event-row-main > .event-net { display: none; }
.event-list-compact .event-row-main > .event-device-link:hover {
  background: transparent; color: var(--accent-ink); text-decoration: underline;
}
/* 칩이 한 줄을 통째로 쓰므로 넘치면 줄바꿈 대신 잘라서 높이를 일정하게 둔다. */
.event-list-compact .event-chips { flex-wrap: nowrap; overflow: hidden; }
.event-list-compact .event-chip { flex-shrink: 0; }
.event-list-compact .event-chip:last-child { flex-shrink: 1; }
.event-list-compact .event-row-main > .event-ch { display: none; }
.event-list-compact .event-row-main > .event-msg { grid-area: msg; }
.event-list-compact .event-row-main > .event-thumb { grid-area: thumb; width: 44px; height: 26px; }
.event-list-compact .event-detail {
  grid-template-columns: minmax(0, 1fr);
  padding: 2px 10px 14px 10px;
}
.event-list-compact .event-attrs { grid-template-columns: 1fr; }
/* 제목이 없으면 빈 줄을 남기지 않는다 */
.event-list-compact .event-msg:empty { display: none; }
.v-missing { color: var(--warn-text); font-weight: 700; }
.field-tag { display: inline-block; margin-left: 6px; padding: 1px 7px; border-radius: 999px; background: var(--chip-indigo-bg); color: var(--chip-indigo-text); font-size: 10.5px; font-weight: 800; vertical-align: middle; }

/* --- 미등록 MAC 경고 ---------------------------------------------------- */
.unmapped-box { background: var(--warn-bg-soft); border: 1px solid var(--warn-border); border-radius: 14px; padding: 16px 18px; margin-bottom: 16px; }
.unmapped-head { display: flex; gap: 12px; align-items: flex-start; color: var(--warn-text); }
.unmapped-title { font-size: 13.5px; font-weight: 800; color: var(--warn-text-strong); }
.unmapped-sub { font-size: 12px; color: var(--warn-text); margin-top: 3px; line-height: 1.5; }
/* 미등록 배너의 '이 장비 등록'. MAC 을 손으로 옮겨 적다 틀리는 일을 막는다. */
.unmapped-add {
  margin-left: auto; flex-shrink: 0; padding: 4px 11px;
  border: 1px solid var(--warn-text, #B45309); border-radius: 999px;
  background: none; color: var(--warn-text, #B45309);
  font-size: 11.5px; font-weight: 700; cursor: pointer; white-space: nowrap;
}
.unmapped-add:hover { background: var(--warn-text, #B45309); color: #fff; }
.unmapped-list { margin-top: 12px; display: flex; flex-direction: column; gap: 6px; }
.unmapped-row { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; padding: 8px 12px; background: var(--surface); border-radius: 9px; border: 1px solid var(--warn-bg); }
.unmapped-mac { font-weight: 800; color: var(--text); cursor: pointer; padding: 2px 8px; border-radius: 6px; background: var(--surface-sunken); }
.unmapped-mac:hover { background: var(--chip-indigo-bg); }
.unmapped-mac.copied { background: var(--ok-bg); color: var(--ok-text); }
.unmapped-meta { font-size: 12px; color: var(--text-muted); }
.feed-hint { margin: 14px 4px 0; font-size: 12px; color: var(--text-faint); }

/* ---- 이벤트 종류 필터 스트립 ----
   프로토콜의 event.type 은 자유 문자열이라 목록을 하드코딩하지 않는다.
   실제로 수신된 타입만 버튼으로 만들고, 색은 카탈로그의 톤을 그대로 쓴다. */
.feed-typebar {
  display: flex; align-items: center; gap: 6px; flex-wrap: wrap;
  padding: 10px 12px; margin-bottom: 10px;
  border: 1px solid var(--border); border-radius: 11px; background: var(--surface);
}
.feed-typebar-label {
  font-size: 11px; font-weight: 800; color: var(--text-faint);
  letter-spacing: .3px; margin-right: 2px;
}
.feed-type {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 4px 10px; border-radius: 999px;
  border: 1px solid var(--border); background: var(--surface);
  color: var(--text-body); font: inherit; font-size: 11.5px; font-weight: 700;
  white-space: nowrap;
}
.feed-type svg { flex-shrink: 0; color: var(--tone-dot, var(--text-faint)); }
.feed-type b { font-weight: 800; color: var(--text-faint); font-variant-numeric: tabular-nums; }
.feed-type:hover { border-color: var(--border-strong); background: var(--surface-sunken); }
.feed-type.on {
  border-color: var(--tone-dot, var(--accent));
  background: var(--tone-bg, var(--accent-softer));
  color: var(--tone-fg, var(--accent-ink));
}
.feed-type.on b { color: inherit; }
.feed-type.on svg { color: currentColor; }

@media (max-width: 700px) {
  .feed-typebar { padding: 8px 10px; gap: 5px; }
  .feed-type { padding: 3px 8px; font-size: 11px; }
}

/* --- 좁은 화면: 그리드를 풀고 여러 줄로 접는다 --------------------------- */
@media (max-width: 1100px) {
  .event-row-main,
  .event-list-with-device .event-row-main {
    grid-template-columns: 62px minmax(0, 1fr) 56px 16px;
    grid-template-areas:
      "badge time thumb chev"
      "badge meta thumb chev"
      "msg   msg  msg   msg";
    row-gap: 6px;
  }
  .event-row-main > .event-badge { grid-area: badge; align-self: start; }
  .event-row-main > .event-time { grid-area: time; }
  .event-row-main > .event-device-link { grid-area: meta; justify-self: start; max-width: 46%; }
  .event-row-main > .event-type { grid-area: meta; justify-self: end; }
  .event-row-main > .event-ch { display: none; }
  .event-row-main > .event-msg { grid-area: msg; }
  .event-row-main > .event-thumb { grid-area: thumb; }
  /* 상세의 왼쪽 여백을 줄여 좁은 폭에서도 값이 잘리지 않게 한다 */
  .event-detail { grid-template-columns: minmax(0, 1fr); padding-left: 12px; }
  .event-detail-thumb { max-width: 320px; }
  .event-row-main > .event-chevron { grid-area: chev; }
  .event-detail { grid-template-columns: 1fr; padding-left: 16px; }
}

/* ===== 사이드바: 즐겨찾기 · 검색 ===== */
/* 헤더('내 그룹' + 버튼) 와 입력란이 붙어 보이던 것을 띄운다 (요구자) */
.tree-search { position: relative; display: flex; align-items: center; padding: 8px 10px 10px; }
.tree-search-icon { position: absolute; left: 20px; color: var(--text-faint); pointer-events: none; }
.tree-search input {
  width: 100%; padding: 8px 28px 8px 30px; border: 1px solid var(--border); border-radius: 9px;
  font: inherit; font-size: 12.5px; background: var(--surface); color: var(--text); outline: none;
}
.tree-search input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-ring); }
.tree-search input::-webkit-search-cancel-button { display: none; }
.tree-search-clear {
  position: absolute; right: 18px; display: flex; align-items: center; justify-content: center;
  width: 18px; height: 18px; border: none; border-radius: 50%; background: var(--border);
  color: var(--text-muted); cursor: pointer; padding: 0;
}
.tree-search-clear:hover { background: var(--border-strong); }
.tree-search-section {
  padding: 10px 12px 4px; font-size: 10.5px; font-weight: 800; letter-spacing: .04em;
  color: var(--text-faint); text-transform: uppercase;
}
.tree-root mark { background: var(--mark-bg); color: inherit; border-radius: 3px; padding: 0 1px; }

/* 즐겨찾기 노드 안의 "그룹 N" / "장비 N" 구분 라벨 (FR-07) */
.tree-fav-section {
  padding: 7px 10px 3px 26px; font-size: 10.5px; font-weight: 800;
  color: var(--text-faint); letter-spacing: .3px;
}
/* 즐겨찾기의 그룹 행은 상세로 가는 게 아니라 관제 범위를 바꾼다 */
.tree-row-fav-group { cursor: pointer; }
.tree-row-fav-group .tree-icon { color: var(--accent); }
.tree-hint { padding: 14px 12px; font-size: 12px; color: var(--text-faint); line-height: 1.6; }

.tree-favorites { border-bottom: 1px solid var(--border); margin-bottom: 4px; padding-bottom: 4px; }
.tree-icon-star { color: var(--star); }
.tree-fav-group {
  margin-left: auto; font-size: 10.5px; color: var(--text-faint);
  max-width: 40%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; padding-left: 6px;
}
/* 별은 켜져 있으면 항상, 꺼져 있으면 hover 때만 보인다. */
.tree-actions-always { display: flex !important; opacity: 1 !important; }
.icon-btn.star { color: var(--text-faint); }
.icon-btn.star.on { color: var(--star); }
.icon-btn.star:hover { color: var(--star); }
.icon-btn.active { background: var(--warn-bg); color: var(--warn-text); }

/* ===== 상단 메뉴 ===== */
.topbar-nav { display: flex; align-items: center; gap: 4px; margin-left: 22px; }
.topbar-nav-link {
  display: inline-flex; align-items: center; gap: 7px; padding: 7px 13px; border-radius: 9px;
  font-size: 12.5px; font-weight: 700; color: var(--navy-text-muted); text-decoration: none;
  white-space: nowrap; transition: background .15s ease, color .15s ease;
}
.topbar-nav-link:hover { background: var(--on-navy-hover); color: var(--navy-text); }
.topbar-nav-link.active { background: var(--on-navy-active); color: var(--navy-text); }
@media (max-width: 640px) {
  .topbar-nav { margin-left: 10px; }
  .topbar-nav-link span, .topbar-nav-link { font-size: 0; gap: 0; padding: 7px 9px; }
  .topbar-nav-link svg { width: 16px; height: 16px; }
}

/* ===== 장비 상세: 고정 배치 =====
   옮기지도 크기를 바꾸지도 않는다. 열·행·영역 이름은 JS 가 인라인으로 넣고
   (보이는 패널 조합마다 달라서), 여기서는 "작업 영역을 꽉 채운다" 만 책임진다.

   행을 fr 로 나눠 가지므로 창 높이가 달라져도 비율만 변하고 스크롤은 없다.
   목록이 긴 패널(이벤트 로그·하위 장비)만 자기 안에서 구른다. */
.content-page-fill {
  display: flex; flex-direction: column;
  height: 100%; min-height: 0;
}
.detail-layout {
  display: grid;
  gap: 12px;
  flex: 1;
  min-height: 0;
  /* 너무 납작해지면 어느 패널도 못 읽는다. 이보다 짧은 창에서는 차라리 스크롤한다. */
  min-height: 460px;
}
/* 설정에서 패널을 숨겨 이름 붙은 배치와 어긋날 때. 자동 배치라 grid-area 를 무시한다. */
.detail-layout-auto > .detail-panel { grid-area: auto !important; }

/* 패널 카드 */
.detail-panel {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  overflow: hidden;
}
/* 상세 패널의 제목 줄. 이름을 dp- 로 따로 가져간다 —
   .panel-head 는 설정·폼 화면이 쓰는 다른 규칙이다(위쪽 정의). */
.dp-head {
  display: flex; align-items: center; gap: 8px; padding: 10px 14px;
  border-bottom: 1px solid var(--border); background: var(--surface-head);
  flex-shrink: 0; user-select: none;
}
.dp-head-title { font-size: 12.5px; font-weight: 800; white-space: nowrap; }
.dp-head-actions { margin-left: auto; display: flex; gap: 2px; }
/* 제목 줄 동작 단추. 본문이 아니라 여기 둬야 칸 높이를 먹지 않는다. */
.dp-head-btn {
  margin-left: auto; height: 24px; padding: 0 10px; border-radius: 6px; cursor: pointer;
  border: 1px solid var(--accent); background: var(--accent); color: var(--on-accent);
  font-family: inherit; font-size: 11.5px; font-weight: 700; flex-shrink: 0;
}
.dp-head-btn:hover { background: var(--accent-ink); border-color: var(--accent-ink); }
.dp-head-btn:disabled { opacity: .6; cursor: default; }
/* 동작 단추가 있으면 확대 단추는 그 오른쪽에 붙는다 */
.dp-head-btn + .dp-head-actions { margin-left: 6px; }
.dp-icon-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 24px; height: 24px; border: none; border-radius: 6px;
  background: transparent; color: var(--text-muted); cursor: pointer; padding: 0;
}
.dp-icon-btn:hover { background: var(--n-150); color: var(--text); }

/* 본문은 남는 높이를 채우고, 넘치면 패널 안에서만 스크롤된다 */
.detail-panel-body { padding: 14px; flex: 1; min-height: 0; overflow: auto; }
.detail-panel[data-panel="events"] .detail-panel-body { padding: 10px 14px 4px; }
.detail-panel[data-panel="map"] .detail-panel-body,
.detail-panel[data-panel="thumbnail"] .detail-panel-body { overflow: hidden; }

/* 패널 안에서는 내부 카드의 테두리를 지우고 높이를 100%로 채운다 */
.detail-panel .map-box { height: 100%; min-height: 0; border: none; border-radius: 10px; }
.detail-panel .preview-box { height: 100%; min-height: 0; border-radius: 10px; }
.detail-panel .info-card { border: none; padding: 0; }
.detail-panel .tabs { margin-bottom: 10px; }

/* 확대: 한 패널이 작업 영역을 통째로 쓴다. 배치를 바꾸는 것이 아니라
   잠깐 크게 보는 것이라 클래스만 걸고 뗀다. */
.detail-layout.is-maximized > .detail-panel { display: none; }
.detail-layout.is-maximized > .detail-panel.is-max {
  display: flex;
  grid-area: 1 / 1 / -1 / -1 !important;
}

/* 짧은 화면(노트북). 칸이 줄어든 만큼 내용도 한 단계 줄여 스크롤을 막는다.
   가로가 아니라 세로가 모자란 상황이라 max-height 로 건다. */
@media (min-width: 768px) and (max-height: 880px) {
  .detail-layout { gap: 10px; }
  .dp-head { padding: 7px 12px; }
  .detail-panel-body { padding: 10px 12px; }

  /* 장비 정보: 11줄이라 줄마다 2px 만 줄여도 22px 가 빠진다 */
  .detail-panel .info-row { padding: 2px 0; font-size: 11.5px; }

  /* 헬스체크 */
  .detail-panel .health-panel { gap: 8px; }
  .detail-panel .health-hero { padding: 8px 10px; }
  .detail-panel .health-hero-title { font-size: 13px; }
  .detail-panel .health-hero-sub { font-size: 11px; }
  .detail-panel .health-metrics { gap: 6px; }
  .detail-panel .health-metric { padding: 7px 9px; }
  .detail-panel .health-metric-v { font-size: 15px; }
  .detail-panel .health-metric-v.sm { font-size: 11.5px; }
  .detail-panel .health-target { padding: 2px 10px; }
}

/* 좁은 화면: 한 줄로 쌓는다. 여기서는 전부 보이게 할 수 없으므로 스크롤을 허용하고
   대신 패널마다 읽을 수 있는 최소 높이를 준다. */
@media (max-width: 767px) {
  .content-page-fill { height: auto; }
  .detail-layout {
    grid-template-columns: 1fr !important;
    grid-template-rows: none !important;
    grid-template-areas: none !important;
    min-height: 0;
  }
  .detail-layout > .detail-panel { grid-area: auto !important; min-height: 260px; }
  .detail-panel .map-box { min-height: 220px; }
  .detail-panel .preview-box { min-height: 180px; }
}

/* ===== 장비 상세: 보기 모드 탭 · 단일 보기 · 헬스체크 패널 ===== */
.detail-view-tabs { margin: 0 0 16px; }

/* 단일 보기: 패널 하나가 작업 영역을 채운다 */
.detail-solo { display: block; }
.detail-panel-solo {
  display: flex; flex-direction: column;
  min-height: 560px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 14px; overflow: hidden;
}
.detail-panel-solo > .detail-panel-body { flex: 1; min-height: 0; overflow: auto; padding: 16px; }
.detail-panel-solo[data-panel="map"] > .detail-panel-body,
.detail-panel-solo[data-panel="thumbnail"] > .detail-panel-body { overflow: hidden; }
.detail-panel-solo .map-box,
.detail-panel-solo .preview-box { height: 100%; min-height: 440px; border: none; border-radius: 10px; }
.detail-panel-solo .info-card { border: none; padding: 0; max-width: 720px; }

/* --- 헬스체크 패널 --- */
.health-panel { display: flex; flex-direction: column; gap: 10px; }
.health-hero {
  display: flex; align-items: center; gap: 12px; min-width: 0;
  padding: 10px 12px; border-radius: 12px; background: var(--surface-sunken); border: 1px solid var(--border);
}
.health-hero-text { min-width: 0; }
.health-hero-title { font-size: 14.5px; font-weight: 800; }
.health-hero-sub {
  font-size: 11.5px; color: var(--text-muted); margin-top: 2px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

.health-metrics { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.health-metric {
  padding: 9px 11px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface);
  display: flex; flex-direction: column; gap: 3px; min-width: 0;
}
.health-metric-k { font-size: 11px; color: var(--text-muted); font-weight: 700; }
.health-metric-v {
  font-size: 17px; font-weight: 800; font-variant-numeric: tabular-nums;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
/* 날짜·시각은 숫자 한둘이 아니라 한 줄이라, 같은 크기로 두면 칸을 넘는다 */
.health-metric-v.sm { font-size: 12.5px; font-weight: 700; }
.health-metric-v.bad { color: var(--err-text); }
.health-metric-hint { font-size: 11px; color: var(--text-faint); line-height: 1.45; }
.health-bar { height: 5px; border-radius: 999px; background: var(--n-150); overflow: hidden; margin-top: 4px; }
.health-bar-fill { height: 100%; border-radius: 999px; background: var(--n-350); transition: width .3s ease; }
.health-bar-fill.ok { background: var(--ok-dot); }
.health-bar-fill.warn { background: var(--warn-dot); }
.health-bar-fill.bad { background: var(--err-dot); }

.health-target { border: 1px solid var(--border); border-radius: 10px; padding: 4px 12px; }
/* 검사 대상 URL 은 길다. 접히면 패널 높이를 먹으므로 한 줄로 자르고
   전체 주소는 말풍선에 남긴다. 라벨도 값에 밀려 "검사 대 / 상" 으로 쪼개지지 않게 고정한다. */
.health-target .info-row .k { white-space: nowrap; flex-shrink: 0; }
.health-target .info-row .v { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }

.health-result {
  display: flex; flex-direction: column; gap: 3px;
  padding: 12px 14px; border-radius: 12px; font-size: 12.5px;
  background: var(--off-bg); border: 1px solid var(--border); color: var(--text-muted);
}
.health-result strong { font-size: 13px; color: var(--text); }
.health-result.ok { background: var(--ok-bg); border-color: var(--ok-border-strong); color: var(--ok-text-strong); }
.health-result.ok strong { color: var(--ok-text-strong); }
.health-result.bad { background: var(--err-bg); border-color: var(--err-border); color: var(--err-text-strong); }
.health-result.bad strong { color: var(--err-text-strong); }
.health-result-msg { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 11.5px; }

@media (max-width: 760px) {
  .detail-panel-solo { min-height: 420px; }
  .detail-panel-solo .map-box, .detail-panel-solo .preview-box { min-height: 260px; }
}

/* ===== 보기 탭 가독성 · 장비정보 단일 보기 · 스크롤 최소화 (후순위 재정의) ===== */
/* 탭이 페이지 배경(var(--bg))과 거의 같은 색이라 눈에 띄지 않았다.
   흰 배경 + 옅은 테두리로 "구분감"만 주고, 선택된 것만 진하게 한다. */
.detail-view-tabs .tab {
  background: var(--surface);
  border: 1px solid var(--border-strong);
  color: var(--n-700);
  box-shadow: 0 1px 1px var(--shadow-color-soft);
}
.detail-view-tabs .tab:hover { border-color: var(--n-400); color: var(--text); }
.detail-view-tabs .tab.active {
  background: var(--text); border-color: var(--text); color: var(--surface); box-shadow: none;
}

/* 장비 정보: 단일 보기에서는 영역을 꽉 채우고 글자를 조금 키운다 */
.detail-panel-solo[data-panel="info"] .info-card { max-width: none; width: 100%; }
.detail-panel-solo[data-panel="info"] .info-row {
  font-size: 14.5px;
  padding: 13px 4px;
  border-bottom: 1px solid var(--border-subtle);
}
.detail-panel-solo[data-panel="info"] .info-row:last-child { border-bottom: none; }
.detail-panel-solo[data-panel="info"] .info-row .k { font-size: 13.5px; }
.detail-panel-solo[data-panel="info"] .info-row .v { font-size: 15px; }
.detail-panel-solo[data-panel="info"] .info-row .v.mono { font-size: 14px; }

/* 기본 화면에서 세로 스크롤이 생기지 않도록 상세 화면 여백을 줄인다 */
.content-panel { padding: 22px 24px; }
.detail-header { margin-bottom: 12px; }
.detail-view-tabs { margin: 0 0 12px; }

/* ===== 대시보드 (요약 · 시각화) =====
   FR-03 반응형 정렬. 기능은 v1 그대로 두고 배치만 손봤다.
   명세: docs/16_UX_REDESIGN_SPEC.md §5

   v1 은 auto-fit + minmax(300px) 였다. 열 수가 화면 폭에 따라 마음대로 정해져서
   1440px 이상에서 카드가 과하게 늘어나고 도넛/막대 비율이 깨졌다.
   v2 는 열 수를 브레이크포인트마다 못박고, 카드별로 몇 칸을 쓸지 지정한다.
   기본은 1열(모바일)이고 화면이 넓어질 때마다 열이 늘어난다. */
.ov-kpis {
  display: grid; gap: 14px; margin-bottom: 16px;
  grid-template-columns: 1fr;                 /* 모바일: 1열 */
}
.ov-kpi {
  background: var(--surface); border: 1px solid var(--border); border-radius: 14px;
  padding: 16px 18px; display: flex; flex-direction: column; gap: 2px;
  border-left: 4px solid var(--n-350);
  min-height: 92px; justify-content: center;
}
.ov-kpi.ok { border-left-color: var(--ok-dot); }
.ov-kpi.warn { border-left-color: var(--warn-dot); }
.ov-kpi.bad { border-left-color: var(--err-dot); }
.ov-kpi-label { font-size: 12px; font-weight: 700; color: var(--text-muted); }
/* 화면 폭에 따라 숫자 크기가 자연스럽게 붙는다 (28px ~ 36px) */
.ov-kpi-value {
  font-size: clamp(28px, 2.4vw, 36px);
  font-weight: 900; line-height: 1.15; font-variant-numeric: tabular-nums;
}
.ov-kpi-sub { font-size: 11.5px; color: var(--text-faint); }

.ov-grid {
  display: grid; gap: 14px; align-items: start;
  grid-template-columns: 1fr;                 /* 모바일: 1열 */
}
.ov-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: 14px;
  padding: 16px 18px; min-width: 0;
}

/* 카드마다 내용이 뭉개지지 않는 최소 높이 */
.ov-card-status { min-height: 0; }
.ov-card-map { min-height: 320px; }
.ov-card-events { min-height: 320px; }

/* v1 호환용. 새 코드에서는 역할 클래스(.ov-card-map 등)를 쓴다. */
.ov-card-wide { grid-column: 1 / -1; }

/* --- 태블릿 (768~1023px) ---
   아직 좁아서 셋을 옆으로 세우면 지도가 손바닥만 해진다. 지도만 통으로 올리고
   아래를 둘로 나눈다. */
@media (min-width: 768px) {
  .ov-kpis { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .ov-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    grid-template-areas:
      "map    map"
      "events status";
  }
  .ov-card-map    { grid-area: map; }
  .ov-card-events { grid-area: events; }
  .ov-card-status { grid-area: status; }
}

/* --- 데스크톱 (1024px+) ---
   "어디에(지도) · 무슨 일이(이벤트) · 어떤 상태인가(상태)" 를 한 화면에 둔다.
   지도가 제일 넓고, 이벤트는 흐름이라 세로로 길게 두 줄을 걸치고,
   상태는 숫자 몇 개라 지도 아래 한 줄이면 충분하다. */
@media (min-width: 1024px) {
  /* 작업 영역을 꽉 채운다. 내용만큼만 자라면 아래가 비고(실측 116px),
     관제 화면은 한 화면에 다 들어오는 것이 요점이다. */
  .ov-body { flex: 1; min-height: 0; display: flex; flex-direction: column; }
  .ov-grid {
    flex: 1; min-height: 0;
    /* 기본값 start 를 쓰면 칸이 자기 내용만큼만 커지고 행의 남는 높이가 논다
       (실측: 그리드 752px 중 246px 가 비었다). 넓은 화면에서는 늘려 채운다. */
    align-items: stretch;
    /* 지도는 2fr 이면 과하게 넓고, 이벤트 칸은 장비명이 잘릴 만큼 좁았다. */
    grid-template-columns: minmax(0, 1.7fr) minmax(0, 1fr);
    /* 상태 칸은 도넛 하나라 자기 높이면 충분하다. 남는 세로는 전부 지도가 가져간다.
       min-content 로 못박아 도넛이 칸을 따라 늘어나지 않게 한다. */
    grid-template-rows: minmax(0, 1fr) min-content;
    grid-template-areas:
      "map    events"
      "status events";
  }
  /* 지도는 aspect-ratio 로 높이를 스스로 정하고 있었다. 칸을 채우게 바꾼다. */
  .ov-card-map { display: flex; flex-direction: column; min-height: 0; }
  .ov-card-map .ov-map-box { aspect-ratio: auto; flex: 1; min-height: 240px; }
  /* 두 줄을 걸친 칸은 옆(지도+상태) 높이를 그대로 채운다.
     .ov-grid 가 align-items:start 라 그냥 두면 내용만큼만 자라서 아래가 빈다. */
  .ov-card-events { min-height: 0; align-self: stretch; }
  /* 목록을 띄워서 높이 계산에서 빼낸다.
     그냥 상한만 풀면 반대로 이벤트 30건이 행을 밀어 올려 카드가 3080px 까지
     자랐다(지도+상태는 1965px). 절대 배치는 부모 높이에 기여하지 않으므로
     카드의 자연 높이가 제목 줄뿐이 되고, 행 높이는 지도+상태가 정한다. */
  .ov-card-events .ov-events-wrap { position: relative; }
  .ov-card-events .ov-events-scroll {
    position: absolute; inset: 0; max-height: none;
  }
}

@media (min-width: 1440px) {
  .ov-grid { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }
}
.ov-card-title { display: flex; align-items: center; gap: 10px; font-size: 13px; font-weight: 800; margin-bottom: 14px; }
.ov-card-hint {
  margin-left: auto;
  font-size: 13px; font-weight: 800;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}
.ov-card-link { margin-left: auto; border: none; background: transparent; color: var(--accent); font: inherit; font-size: 12px; font-weight: 700; cursor: pointer; padding: 0; }
.ov-empty { font-size: 12.5px; color: var(--text-faint); padding: 18px 0; text-align: center; }

/* 도넛 */
.ov-donut-row { display: flex; align-items: center; gap: 20px; flex-wrap: wrap; }
/* 도넛은 viewBox 기반이라 폭만 주면 비율이 유지된다.
   v1 은 132px 고정이어서 넓은 카드에서 여백만 커졌다. */
.donut { width: clamp(112px, 34%, 150px); aspect-ratio: 1; height: auto; flex-shrink: 0; }
/* 대시보드의 상태 칸은 지도에 세로를 양보한다. 도넛을 한 단계 작게 못박는다. */
.ov-card-status .donut { width: 118px; }
.ov-card-status .ov-donut-row { gap: 16px; }
.donut-top { text-anchor: middle; font-size: 21px; font-weight: 900; fill: var(--text); }
.donut-sub { text-anchor: middle; font-size: 10px; font-weight: 700; fill: var(--text-faint); }
.ov-legend { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; flex: 1; min-width: 130px; }
.ov-legend li { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--text-muted); }
.ov-legend li b { margin-left: auto; color: var(--text); font-variant-numeric: tabular-nums; }
.ov-legend i { width: 9px; height: 9px; border-radius: 3px; flex-shrink: 0; }
.ov-legend-sep { border-top: 1px dashed var(--border); padding-top: 8px; }

/* 시간대별 막대 */
.ov-bars { display: flex; align-items: flex-end; gap: 3px; height: clamp(120px, 14vh, 170px); }
.ov-bar-col { flex: 1; min-width: 0; height: 100%; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; gap: 4px; }
.ov-bar { width: 100%; background: var(--accent-soft); border-radius: 4px 4px 0 0; display: flex; flex-direction: column; justify-content: flex-start; overflow: hidden; }
.ov-bar-seg.err { width: 100%; background: var(--err-dot); }
.ov-bar-seg.warn { width: 100%; background: var(--warn-dot); }
.ov-bar-label { font-size: 9.5px; color: var(--text-faint); font-variant-numeric: tabular-nums; }
.ov-bars-caption { margin-top: 10px; font-size: 11.5px; color: var(--text-faint); text-align: center; }

/* 가로 막대 (심각도 / 이벤트 종류) */
.ov-sev { display: flex; flex-direction: column; gap: 11px; }
.ov-sev-row { display: grid; grid-template-columns: 74px 1fr 40px; align-items: center; gap: 10px; }
.ov-sev-label { font-size: 11.5px; font-weight: 800; color: var(--text-muted); }
.ov-type-label { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ov-sev-track { height: 9px; border-radius: 999px; background: var(--n-150); overflow: hidden; }
.ov-sev-fill { height: 100%; border-radius: 999px; transition: width .35s ease; }
.ov-sev-value { font-size: 12.5px; font-weight: 800; text-align: right; font-variant-numeric: tabular-nums; }

/* 이벤트 많은 장비 */
.ov-top { display: flex; flex-direction: column; }
.ov-top-row {
  display: flex; align-items: center; gap: 9px; width: 100%; text-align: left;
  padding: 9px 6px; border: none; background: transparent; border-top: 1px solid var(--border-subtle);
  font: inherit; cursor: pointer; border-radius: 8px;
}
.ov-top-row:first-child { border-top: none; }
.ov-top-row:hover { background: var(--surface-sunken); }
.ov-top-name { font-size: 12.5px; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ov-top-group { font-size: 11px; color: var(--text-faint); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ov-top-count { margin-left: auto; font-size: 12.5px; font-weight: 800; font-variant-numeric: tabular-nums; }

/* 대시보드 집계 범위 선택 + 지도 카드 */
/* 현재 관제 범위를 화면 제목 옆에 알려주는 태그.
   범위 자체를 바꾸는 곳은 상단바 스코프 칩 하나뿐이다(요구사항 2-5). */
.scope-tag {
  display: inline-flex; align-items: center;
  padding: 3px 9px; border-radius: 999px;
  background: var(--accent-softer); color: var(--accent-ink);
  border: 1px solid var(--accent-soft);
  font-size: 11.5px; font-weight: 800; white-space: nowrap;
}

/* .ov-scope 는 v1 의 화면별 범위 콤보박스용이었다. 전역 스코프 칩으로 대체돼
   더 이상 쓰이지 않지만, 후속 화면에서 같은 형태의 인라인 셀렉터가 필요할 수 있어 남겨둔다. */
.ov-scope { display: inline-flex; align-items: center; gap: 8px; }
.ov-scope > span { font-size: 12px; font-weight: 700; color: var(--text-muted); white-space: nowrap; }
.ov-scope select {
  height: 34px; min-width: 170px; max-width: 260px; padding: 0 10px;
  border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  background: var(--surface); color: var(--text); font: inherit; font-size: 12.5px; font-weight: 700;
}
.ov-scope select:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
.ov-map-box { height: auto; aspect-ratio: 21 / 9; min-height: 240px; border-radius: 10px; }
/* 이벤트는 끝이 없다. 카드 밖으로 밀어내는 대신 안에서 구른다. */
.ov-card-events { display: flex; flex-direction: column; }
.ov-events-wrap { flex: 1; min-height: 0; }
.ov-events-scroll { max-height: clamp(280px, 52vh, 620px); overflow-y: auto; }
@media (max-width: 1023px) { .ov-map-box { aspect-ratio: 16 / 9; } }

/* 좁은 화면에서 접혀 있는 지도. 탭하면 펼쳐진다 (FR-03) */
.ov-map-collapsed {
  width: 100%; min-height: 150px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
  border: 1px dashed var(--border-strong); border-radius: 10px;
  background: var(--surface-sunken); color: var(--text-muted);
  font: inherit; font-size: 13px; font-weight: 700;
}
.ov-map-collapsed:hover { border-color: var(--accent); color: var(--accent); }
.ov-map-collapsed small { font-size: 11.5px; font-weight: 600; color: var(--text-faint); }

/* 장비 위치 전용 화면: 지도가 남은 높이를 채운다 */
.map-page { display: flex; flex-direction: column; height: 100%; }
.map-page-box { flex: 1; min-height: 320px; border-radius: 14px; }


/* =========================================================================
   장비 상태 카드 그리드 (FR-06)
   명세: docs/16_UX_REDESIGN_SPEC.md §8 · docs/03_DEVICE.md §5

   열 수는 브레이크포인트가 아니라 --card-min 하나로 정해진다.
   auto-fill + minmax 라서 화면 폭이 바뀌면 열이 알아서 늘고 줄어든다.
   ========================================================================= */
.st-group { margin-bottom: 18px; }
.st-group-head {
  width: 100%; display: flex; align-items: center; gap: 10px;
  padding: 9px 12px; margin-bottom: 10px;
  border: 1px solid var(--border); border-radius: 11px;
  background: var(--surface); color: var(--text); font: inherit; text-align: left;
}
.st-group-head:hover { border-color: var(--border-strong); background: var(--surface-sunken); }
.st-caret { display: inline-flex; color: var(--text-faint); transition: transform .15s ease; flex-shrink: 0; }
.st-caret.open { transform: rotate(90deg); }
.st-group-name { font-size: 13.5px; font-weight: 800; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.st-group-total { margin-left: auto; font-size: 12px; font-weight: 700; color: var(--text-faint); flex-shrink: 0; }

.st-counts { display: inline-flex; align-items: center; gap: 10px; flex-shrink: 0; }
.st-count { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; font-weight: 800; font-variant-numeric: tabular-nums; }
.st-count i { width: 7px; height: 7px; border-radius: 50%; }
.st-count.ok { color: var(--ok-text); } .st-count.ok i { background: var(--ok-dot); }
.st-count.off { color: var(--off-text); } .st-count.off i { background: var(--off-dot); }
.st-count.bad { color: var(--err-text); } .st-count.bad i { background: var(--err-dot); }

.st-grid {
  display: grid; gap: 12px;
  grid-template-columns: repeat(auto-fill, minmax(var(--card-min, 240px), 1fr));
}

/* ---- 카드 ---- */
.st-card {
  display: flex; flex-direction: column;
  border: 1px solid var(--border); border-radius: 14px;
  background: var(--surface); overflow: hidden;
  cursor: pointer;
  transition: transform .14s ease, box-shadow .14s ease, border-color .14s ease;
}
.st-card:hover {
  transform: translateY(-2px);
  border-color: var(--border-strong);
  box-shadow: 0 10px 24px var(--shadow-color);
}
.st-card:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
/* 오류 카드는 테두리로도 눈에 걸리게 한다 (색 외 두 번째 신호) */
.st-card-ERROR { border-color: var(--err-border); }

/* 위: 썸네일 (16:9) */
.st-thumb {
  position: relative; aspect-ratio: 16 / 9; width: 100%;
  background: var(--thumb-bg); overflow: hidden;
  display: flex; align-items: center; justify-content: center;
}
.st-thumb-img { width: 100%; height: 100%; object-fit: cover; display: block; }
.st-thumb-placeholder { width: 34px; height: 34px; color: var(--navy-faint); }
.st-thumb-placeholder svg { width: 100%; height: 100%; }
.st-thumb.has-image .st-thumb-placeholder { display: none; }

/* ---- 상태 LED (요구사항 2-4: 초록 / 회색 / 빨강) ----
   썸네일 우하단에 얹는다. 색 + 텍스트 배지 + aria-label 3중으로 알린다. */
.st-led {
  position: absolute; right: 8px; bottom: 8px;
  width: 11px; height: 11px; border-radius: 50%;
  border: 2px solid var(--thumb-bg);
  box-sizing: content-box;
}
.st-led-live  { background: var(--ok-dot);  animation: st-breathe 2.5s ease-in-out infinite; }
.st-led-off   { background: var(--off-dot); }   /* 죽은 것은 움직이지 않는다 */
.st-led-error { background: var(--err-dot); animation: st-alarm 1.2s ease-in-out infinite; }

/* ONLINE: "살아있다"만 알리는 은은한 호흡. 시선을 끌지 않는다. */
@keyframes st-breathe {
  0%, 100% { opacity: .55; }
  50%      { opacity: 1; }
}
/* ERROR: 유일하게 시선을 끌어야 하는 상태. 맥박 + 글로우. */
@keyframes st-alarm {
  0%   { opacity: 1;  box-shadow: 0 0 0 0 var(--err-ring); }
  70%  { opacity: .8; box-shadow: 0 0 0 7px transparent; }
  100% { opacity: 1;  box-shadow: 0 0 0 0 transparent; }
}

/* 아래: 장비 정보 */
.st-info { padding: 10px 12px 12px; display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.st-name-row { display: flex; align-items: center; gap: 6px; min-width: 0; }
.st-name {
  flex: 1; min-width: 0; font-size: 13px; font-weight: 800;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.st-star {
  width: 22px; height: 22px; flex-shrink: 0; padding: 0;
  display: inline-flex; align-items: center; justify-content: center;
  border: none; border-radius: 6px; background: transparent; color: var(--text-faint);
}
.st-star svg { width: 14px; height: 14px; }
.st-star:hover { background: var(--surface-muted); color: var(--star); }
.st-star.on { color: var(--star); }
.st-meta {
  font-size: 11.5px; color: var(--text-muted);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.st-status-row { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; }
.st-metric { font-size: 11.5px; font-weight: 700; color: var(--text-muted); font-variant-numeric: tabular-nums; }
.st-metric.bad { color: var(--err-text); }
.st-metric.off { color: var(--text-faint); }
.st-time { font-size: 11px; color: var(--text-faint); font-variant-numeric: tabular-nums; }
.st-rel { color: var(--text-muted); }

/* ---- 목록 모드 (정보 밀도 최대) ---- */
.st-mode-list .st-grid { display: block; }
.st-list-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); }
.st-list { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.st-list th {
  text-align: left; padding: 9px 12px; font-size: 11px; font-weight: 800;
  color: var(--text-faint); border-bottom: 1px solid var(--border); white-space: nowrap;
}
.st-list td { padding: 9px 12px; border-bottom: 1px solid var(--border-subtle); white-space: nowrap; }
.st-list tbody tr:last-child td { border-bottom: none; }
.st-row { cursor: pointer; }
.st-row:hover { background: var(--surface-sunken); }
.st-row-led { width: 26px; }
.st-row-led .st-led { position: static; right: auto; bottom: auto; display: block; border-color: var(--surface); }
.st-row-name { font-weight: 700; }
.st-row-time { color: var(--text-faint); }

/* ---- 스크롤 성능: 화면 밖 카드는 렌더링을 건너뛴다 ----
   "전체 그룹을 조회할 때 스크롤하면 느려" (요구자)
   장비가 1000대를 넘으면 카드도 그만큼 생기고, 화면 밖 카드까지 레이아웃·페인트하고
   LED 애니메이션(st-breathe / st-alarm)까지 매 프레임 돌리게 된다. 애니메이션이
   1000개면 합성기가 쉴 틈이 없어 스크롤이 끊긴다.

   content-visibility:auto 는 뷰포트 밖 서브트리의 렌더링을 건너뛰고, 그 안의 CSS
   애니메이션도 함께 멈춘다. 스크롤로 들어오는 순간 정상 렌더된다.
   contain-intrinsic-size 는 건너뛰는 동안 대신 쓸 크기다. auto 키워드가 앞에 있으면
   한 번 실제로 잰 크기를 기억해서 그 값을 쓰고, 아직 재지 못했을 때만 뒤의 길이를
   쓴다. 이 값이 없으면 카드 높이가 0 으로 잡혀 스크롤바 길이가 요동친다.
   (썸네일 16:9 + 정보영역 ≈ 268px 를 초기 추정값으로 둔다) */
.st-grid > .st-card {
  content-visibility: auto;
  contain-intrinsic-size: auto 268px;
}

/* ---- 접근성: OS 가 "동작 줄이기"면 맥박을 끈다 (§8) ---- */
@media (prefers-reduced-motion: reduce) {
  .st-led-live, .st-led-error { animation: none; }
  .st-card:hover { transform: none; }
}


/* =========================================================================
   설정 모드 (FR-01)
   명세: docs/16_UX_REDESIGN_SPEC.md §3 · docs/02_GROUP.md §4

   관리(추가·수정·삭제)는 전부 여기에만 있다. 관제 화면은 조회 전용이다.
   ========================================================================= */

/* ---- 설정 사이드바 (요구사항 4) ---- */
.settings-nav .tree-panel-head { justify-content: space-between; }
.settings-nav-back {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 11.5px; font-weight: 700; color: var(--text-muted);
  padding: 4px 8px; border-radius: 7px;
}
.settings-nav-back:hover { background: var(--surface-muted); color: var(--accent); }
.settings-nav-list { padding: 8px 8px 16px; overflow-y: auto; flex: 1; }
.settings-nav-section {
  padding: 12px 10px 5px; font-size: 10.5px; font-weight: 800;
  color: var(--text-faint); letter-spacing: .4px;
}
.settings-nav-item {
  display: flex; align-items: center; gap: 9px;
  padding: 9px 10px; border-radius: 9px;
  color: var(--text-body); font-size: 13px; font-weight: 600;
}
.settings-nav-item:hover { background: var(--surface-sunken); color: var(--text); }
.settings-nav-item.active {
  background: var(--accent-softer); color: var(--accent-ink); font-weight: 800;
}
.settings-nav-item svg { flex-shrink: 0; color: var(--text-faint); }
.settings-nav-item.active svg { color: var(--accent); }
.settings-nav-item span { flex: 1; min-width: 0; }
.settings-nav-item b {
  font-size: 11.5px; font-weight: 800; color: var(--text-faint);
  font-variant-numeric: tabular-nums;
}
.settings-nav-item.active b { color: var(--accent); }
.settings-nav-note {
  padding: 8px 10px; font-size: 11.5px; color: var(--text-faint); line-height: 1.6;
}
/* 상단바 설정 버튼이 켜진 상태 */
.topbar-icon-btn.active { background: var(--on-navy-active); color: var(--navy-text); }

/* ---- 설정 본문 ---- */
.settings-page { position: relative; }
.settings-head {
  display: flex; align-items: flex-end; justify-content: space-between;
  gap: 16px; flex-wrap: wrap; margin-bottom: 12px;
}
.settings-tabs { margin: 0 0 14px; }

.settings-summary {
  display: flex; align-items: center; gap: 22px; flex-wrap: wrap;
  padding: 12px 16px; margin-bottom: 12px;
  border: 1px solid var(--border); border-radius: 12px; background: var(--surface);
}
.settings-stat { display: flex; align-items: baseline; gap: 7px; }
.settings-stat span { font-size: 12px; font-weight: 700; color: var(--text-muted); }
.settings-stat b { font-size: 16px; font-weight: 900; font-variant-numeric: tabular-nums; }
.settings-stat-hint { margin-left: auto; font-size: 11px; color: var(--text-faint); }

.settings-toolbar {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 12px;
}
.settings-toolbar-spacer { flex: 1; }
.settings-search { position: relative; flex: 0 1 300px; min-width: 190px; }
.settings-search svg {
  position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--text-faint);
}
.settings-search input {
  width: 100%; height: 34px; padding: 0 12px 0 32px;
  border: 1px solid var(--border); border-radius: 9px;
  background: var(--surface); color: var(--text); font-size: 12.5px;
}
.settings-search input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-ring); }
.settings-select {
  height: 34px; padding: 0 10px; border: 1px solid var(--border-strong);
  border-radius: 9px; background: var(--surface); color: var(--text); font-size: 12.5px;
}
.settings-filter { margin: 0; }

/* ---- 목록 테이블 ---- */
.set-table-wrap {
  overflow-x: auto; border: 1px solid var(--border); border-radius: 12px; background: var(--surface);
}
.set-table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.set-table th {
  text-align: left; padding: 10px 12px; white-space: nowrap;
  font-size: 11px; font-weight: 800; color: var(--text-faint);
  border-bottom: 1px solid var(--border); background: var(--surface-head);
  position: sticky; top: 0; z-index: 1;
}
.set-table td { padding: 10px 12px; border-bottom: 1px solid var(--border-subtle); vertical-align: middle; }
.set-table tbody tr:last-child td { border-bottom: none; }
.set-table tbody tr:hover { background: var(--surface-sunken); }
.set-cell-name { font-weight: 700; }
.set-cell-muted { color: var(--text-faint); }
.set-col-num { text-align: right; font-variant-numeric: tabular-nums; width: 64px; }
.set-col-check { width: 38px; }
.set-col-led { width: 46px; }
.set-col-act { width: 108px; white-space: nowrap; text-align: right; }

.set-check { display: inline-flex; cursor: pointer; }
.set-check input { position: absolute; opacity: 0; width: 0; height: 0; }
.set-check .scope-check-box { width: 16px; height: 16px; }
.set-check.on .scope-check-box { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.set-check input:focus-visible + .scope-check-box { outline: 2px solid var(--accent); outline-offset: 1px; }

.set-icon {
  border: 1px solid var(--border); border-radius: 7px;
  background: var(--surface); color: var(--text-muted);
  font: inherit; font-size: 11.5px; font-weight: 700;
  padding: 4px 8px; margin-left: 4px;
}
.set-icon:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-softer); }
.set-icon.danger:hover { border-color: var(--err-dot); color: var(--err-text); background: var(--err-bg); }

.set-cell-groups { display: flex; gap: 5px; flex-wrap: wrap; max-width: 320px; }
.set-group-chip {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 2px 8px; border-radius: 999px;
  background: var(--surface-muted); color: var(--text-body);
  font-size: 11px; font-weight: 700;
}
.set-group-chip i {
  font-style: normal; font-size: 10px; font-weight: 800; color: var(--text-faint);
}
.set-group-chip.leader { background: var(--accent-softer); color: var(--accent-ink); }
.set-group-chip.leader i { color: var(--accent); }

/* ---- 페이지네이션 ---- */
.settings-pager {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; padding: 10px 4px; font-size: 12px; color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}
.settings-pager-nums { display: flex; align-items: center; gap: 3px; }
.settings-pager-nums button {
  min-width: 28px; height: 28px; padding: 0 6px;
  border: 1px solid var(--border); border-radius: 7px;
  background: var(--surface); color: var(--text-muted); font: inherit; font-size: 12px; font-weight: 700;
}
.settings-pager-nums button:hover:not(:disabled) { border-color: var(--accent); color: var(--accent); }
.settings-pager-nums button.on { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.settings-pager-nums button:disabled { opacity: .4; cursor: default; }
.settings-pager-gap { color: var(--text-faint); padding: 0 2px; }

/* ---- 일괄 작업 바 ---- */
.settings-bulk {
  position: sticky; bottom: 14px; z-index: 5;
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  margin-top: 12px; padding: 10px 14px;
  border: 1px solid var(--accent); border-radius: 12px;
  background: var(--surface); box-shadow: 0 10px 28px var(--shadow-color);
}
.settings-bulk-count { font-size: 12.5px; font-weight: 800; color: var(--accent-ink); }
.settings-bulk-msg { margin-left: auto; }
.settings-bulk-msg .form-msg { margin: 0; padding: 4px 10px; font-size: 11.5px; }

/* ---- 인스펙터 드로어 ----
   모달이 아니라 우측 드로어다. 목록이 뒤에 그대로 보여
   여러 건을 연속으로 편집할 때 맥락이 끊기지 않는다. */
.inspector-backdrop {
  position: fixed; inset: 0; z-index: 80;
  background: var(--shadow-color-strong);
  animation: fade-in .14s ease-out;
}
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
/* ── 관리 모달 ────────────────────────────────────────────────────────
   그룹 · 장비 · 사용자를 한 자리에서. 전에는 오른쪽 드로어였는데, 폼이
   화면 가장자리에 치우쳐 시선이 한 번 더 움직였고 좁은 화면에서는 어차피
   목록을 덮어 "뒤가 보인다" 는 장점도 없었다. 가운데로 옮긴다. */
.mgmt-modal {
  position: fixed; z-index: 81;
  top: 50%; left: 50%; transform: translate(-50%, -50%);
  width: min(560px, calc(100vw - 32px));
  max-height: min(78vh, 760px);
  display: flex; flex-direction: column;
  background: var(--bg);
  border: 1px solid var(--border); border-radius: 14px;
  box-shadow: 0 24px 64px var(--shadow-color);
  animation: mgmt-in .16s ease-out;
  overflow: hidden;
}
@keyframes mgmt-in {
  from { transform: translate(-50%, -48%) scale(.985); opacity: .5; }
  to   { transform: translate(-50%, -50%) scale(1); opacity: 1; }
}
.mgmt-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 10px; padding: 13px 16px;
  border-bottom: 1px solid var(--border); background: var(--surface);
}
.mgmt-title { font-size: 14px; font-weight: 800; }
.mgmt-tabs {
  flex-shrink: 0; padding: 8px 12px 0;
  background: var(--surface); border-bottom: 1px solid var(--border);
}
.mgmt-body { flex: 1; min-height: 0; overflow-y: auto; padding: 14px 16px 22px; }

.inspector-close {
  width: 28px; height: 28px; flex-shrink: 0;
  display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid var(--border); border-radius: 7px;
  background: var(--surface); color: var(--text-muted);
}
.inspector-close:hover { border-color: var(--err-dot); color: var(--err-text); }

/* 모달 안에서는 폼의 페이지 여백을 없앤다 */
.mgmt-body .content-page { padding: 0; max-width: none; }
.mgmt-body .content-page-head { margin-bottom: 12px; }
.mgmt-body .content-card { padding: 0; border: none; background: transparent; }
.mgmt-body .field-row-2 { grid-template-columns: 1fr; gap: 14px; }

/* 탭 안의 목록 */
.mgmt-bar { display: flex; align-items: center; gap: 10px; margin-bottom: 4px; }
.mgmt-count { margin-left: auto; font-size: 11.5px; font-weight: 700; color: var(--text-faint); }
.mgmt-list { display: flex; flex-direction: column; margin-top: 8px; }
.mgmt-row {
  display: flex; align-items: center; gap: 9px;
  min-height: 46px; padding: 7px 8px;
  border-bottom: 1px solid var(--border-subtle);
}
.mgmt-row:last-child { border-bottom: 0; }
.mgmt-row:hover { background: var(--surface-sunken); }
.mgmt-row-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.mgmt-row-name {
  font-size: 13px; font-weight: 700;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.mgmt-row-sub {
  font-size: 11.5px; color: var(--text-faint);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.mgmt-row-acts { display: flex; align-items: center; gap: 4px; flex-shrink: 0; }
.mgmt-chips { display: flex; align-items: center; gap: 4px; flex-shrink: 0; }
.mgmt-empty { padding: 26px 8px; text-align: center; font-size: 12.5px; color: var(--text-faint); }

/* 폰: 바닥에서 올라오는 시트로. 가운데 띄우면 키보드가 올라올 때 가려진다. */
@media (max-width: 640px) {
  .mgmt-modal {
    top: auto; bottom: 0; left: 0; transform: none;
    width: 100vw; max-height: 88vh;
    border-radius: 14px 14px 0 0; border-bottom: 0;
  }
  @keyframes mgmt-in {
    from { transform: translateY(16px); opacity: .6; }
    to   { transform: none; opacity: 1; }
  }
  .mgmt-row { min-height: 52px; }
  .mgmt-row-acts .set-icon { width: 32px; height: 32px; }
  .set-col-act { width: auto; }
}


/* =========================================================================
   레이아웃 설정 (FR-08)
   명세: docs/16_UX_REDESIGN_SPEC.md §10
   ========================================================================= */
.lay-panels {
  display: grid; gap: 10px; margin-bottom: 4px;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
}
/* 켜짐/꺼짐이 한눈에 갈려야 한다. 꺼진 것은 테두리만 남기고 비운다. */
.lay-panel {
  display: flex; align-items: center; gap: 10px; text-align: left;
  padding: 12px 14px; border-radius: 12px; cursor: pointer;
  border: 1px solid var(--border); background: var(--surface);
  color: var(--text-muted); font-family: inherit;
  transition: border-color .15s ease, background .15s ease, color .15s ease;
}
.lay-panel:hover { border-color: var(--border-strong); }
.lay-panel.on {
  border-color: var(--accent); background: var(--accent-softer); color: var(--accent-ink);
}
.lay-panel-eye { display: inline-flex; flex-shrink: 0; }
.lay-panel-name { font-size: 13px; font-weight: 700; color: var(--text); }
.lay-panel.on .lay-panel-name { color: var(--accent-ink); }
.lay-panel-state { margin-left: auto; font-size: 11px; font-weight: 600; }

.lay-foot { margin: 10px 0 0; font-size: 11.5px; color: var(--text-faint); }

/* =========================================================================
   환경 설정 (FR-09)
   명세: docs/16_UX_REDESIGN_SPEC.md §11
   ========================================================================= */
.settings-prefs { max-width: 760px; }
.pref-card {
  border: 1px solid var(--border); border-radius: 12px;
  background: var(--surface); padding: 6px 16px 10px; margin-bottom: 14px;
}
.pref-card-title {
  font-size: 12.5px; font-weight: 800; color: var(--text-muted);
  padding: 12px 0 4px; letter-spacing: .2px;
}
.pref-card-hint { margin: 0 0 6px; font-size: 11.5px; color: var(--text-faint); line-height: 1.6; }
.pref-row {
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; padding: 11px 0; border-top: 1px solid var(--border-subtle);
}
.pref-card > .pref-row:first-of-type { border-top: none; }
.pref-label { display: flex; flex-direction: column; gap: 2px; min-width: 0; flex: 1; }
.pref-label > span { font-size: 13px; font-weight: 700; }
.pref-label > small { font-size: 11.5px; color: var(--text-faint); line-height: 1.5; }
.pref-select {
  flex-shrink: 0; max-width: 300px; height: 34px; padding: 0 10px;
  border: 1px solid var(--border-strong); border-radius: 9px;
  background: var(--surface); color: var(--text); font-size: 12.5px; font-family: inherit;
}
.pref-select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-ring); }

.pref-switch {
  flex-shrink: 0; width: 46px; height: 26px; padding: 0;
  border: 1px solid var(--border-strong); border-radius: 999px;
  background: var(--surface-muted); position: relative;
  transition: background .15s ease, border-color .15s ease;
}
.pref-switch span {
  position: absolute; top: 2px; left: 2px;
  width: 20px; height: 20px; border-radius: 50%;
  background: var(--surface); box-shadow: 0 1px 3px var(--shadow-color);
  transition: transform .15s ease;
}
.pref-switch.on { background: var(--accent); border-color: var(--accent); }
.pref-switch.on span { transform: translateX(20px); }
.pref-switch:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* 비밀번호 변경 카드 (환경 설정 하단) */
.pw-form .pref-row:first-of-type { border-top: none; }
.pw-form .pref-select { width: 260px; }
.pw-actions {
  display: flex; align-items: center; justify-content: flex-end; gap: 12px;
  padding: 10px 0 4px; border-top: 1px solid var(--border-subtle);
}
.pw-msg { font-size: 12px; font-weight: 700; color: var(--ok-text); }
.pw-msg.is-error { color: var(--err-text); }
@media (max-width: 600px) {
  .pw-form .pref-row { flex-direction: column; align-items: stretch; gap: 6px; }
  .pw-form .pref-select { width: 100%; max-width: none; }
  .pw-actions { flex-direction: column-reverse; align-items: stretch; }
  .pw-actions .btn-inline { justify-content: center; }
}

.pref-saved {
  position: sticky; bottom: 14px;
  display: inline-block; padding: 7px 14px; border-radius: 999px;
  background: var(--ok-bg); color: var(--ok-text-strong);
  border: 1px solid var(--ok-border);
  font-size: 12px; font-weight: 800;
  animation: pop-in .2s ease-out;
}

@media (prefers-reduced-motion: reduce) {
  .pref-switch span { transition: none; }
  .mgmt-modal, .scope-pop, .pref-saved { animation: none; }
}


/* =========================================================================
   엑셀 일괄 등록 마법사 (FR-02)
   명세: docs/16_UX_REDESIGN_SPEC.md §4 · docs/03_DEVICE.md §4.2
   ========================================================================= */
.xl-wizard { display: flex; flex-direction: column; gap: 14px; }

.xl-steps { list-style: none; margin: 0; padding: 0; display: flex; gap: 6px; }
.xl-steps li {
  flex: 1; display: flex; align-items: center; gap: 7px;
  padding: 8px 10px; border-radius: 9px;
  background: var(--surface-muted); color: var(--text-faint);
  font-size: 11.5px; font-weight: 700; white-space: nowrap; overflow: hidden;
}
.xl-steps li span {
  width: 18px; height: 18px; flex-shrink: 0; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--surface); color: var(--text-faint); font-size: 10.5px; font-weight: 800;
}
.xl-steps li.on { background: var(--accent-softer); color: var(--accent-ink); }
.xl-steps li.on span { background: var(--accent); color: var(--on-accent); }
.xl-steps li.done { background: var(--ok-bg); color: var(--ok-text-strong); }
.xl-steps li.done span { background: var(--ok-dot); color: var(--on-accent); }

.xl-drop {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
  padding: 30px 18px; text-align: center;
  border: 2px dashed var(--border-strong); border-radius: 12px;
  background: var(--surface-sunken); color: var(--text-muted);
  transition: border-color .15s ease, background .15s ease;
}
.xl-drop:hover, .xl-drop.over, .xl-drop:focus-visible {
  border-color: var(--accent); background: var(--accent-softer); color: var(--accent-ink); outline: none;
}
.xl-drop strong { font-size: 13px; font-weight: 800; }
.xl-drop small { font-size: 11.5px; color: var(--text-faint); }

.xl-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.xl-actions .btn { flex: 1; min-width: 120px; }

.xl-note {
  padding: 11px 13px; border-radius: 10px;
  background: var(--surface-muted); color: var(--text-muted);
  font-size: 11.5px; line-height: 1.65;
}
.xl-note-warn { background: var(--warn-bg-soft); border: 1px solid var(--warn-border); color: var(--warn-text-strong); }

.xl-file-line {
  display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap;
  font-size: 12.5px; color: var(--text-muted);
}
.xl-file-line strong { font-size: 13px; color: var(--text); }
.xl-warn { color: var(--warn-text); font-weight: 700; }

.xl-progress { height: 5px; border-radius: 999px; background: var(--n-150); overflow: hidden; }
.xl-progress-bar { height: 100%; background: var(--accent); transition: width .2s ease; }

.xl-summary { display: flex; gap: 8px; flex-wrap: wrap; }
.xl-sum {
  padding: 5px 12px; border-radius: 999px;
  font-size: 12px; font-weight: 800; font-variant-numeric: tabular-nums;
}
.xl-sum.ok { background: var(--ok-bg); color: var(--ok-text-strong); }
.xl-sum.warn { background: var(--warn-bg); color: var(--warn-text-strong); }
.xl-sum.bad { background: var(--err-bg); color: var(--err-text-strong); }

.xl-table-wrap {
  max-height: 320px; overflow: auto;
  border: 1px solid var(--border); border-radius: 10px; background: var(--surface);
}
.xl-table { width: 100%; border-collapse: collapse; font-size: 11.5px; }
.xl-table th {
  position: sticky; top: 0; z-index: 1;
  text-align: left; padding: 8px 10px; white-space: nowrap;
  font-size: 10.5px; font-weight: 800; color: var(--text-faint);
  background: var(--surface-head); border-bottom: 1px solid var(--border);
}
.xl-table td { padding: 7px 10px; border-bottom: 1px solid var(--border-subtle); vertical-align: top; }
.xl-table tbody tr:last-child td { border-bottom: none; }
.xl-idx { color: var(--text-faint); font-variant-numeric: tabular-nums; width: 34px; }
.xl-reason { color: var(--text-muted); line-height: 1.55; }
.xl-row-error { background: var(--err-bg); }
.xl-row-update { background: var(--warn-bg-soft); }
.xl-v { font-size: 11px; font-weight: 800; white-space: nowrap; }
.xl-v.ok { color: var(--ok-text); }
.xl-v.warn { color: var(--warn-text); }
.xl-v.bad { color: var(--err-text); }
.xl-warn-chip {
  display: inline-block; margin: 3px 4px 0 0; padding: 1px 7px; border-radius: 999px;
  background: var(--warn-bg); color: var(--warn-text-strong); font-size: 10.5px; font-weight: 700;
}
.xl-hint { margin: 0; font-size: 11px; color: var(--text-faint); }

.xl-check {
  display: flex; align-items: center; gap: 8px;
  font-size: 12.5px; font-weight: 700; color: var(--text-body); cursor: pointer;
}

.xl-result { display: flex; align-items: center; gap: 13px; padding: 4px 0; }
.xl-result-icon {
  width: 46px; height: 46px; flex-shrink: 0; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
}
.xl-result-icon.ok { background: var(--ok-bg); color: var(--ok-text); }
.xl-result-icon.warn { background: var(--warn-bg); color: var(--warn-text); }
.xl-result-text { display: flex; flex-direction: column; gap: 3px; font-size: 12px; }
.xl-result-text strong { font-size: 14px; font-weight: 900; color: var(--text); }


/* =========================================================================
   전역 검색 / 명령 팔레트 (FR-11)
   명세: docs/16_UX_REDESIGN_SPEC.md §13
   ========================================================================= */

/* 상단바 검색 상자 (실제 입력은 팔레트에서 받는다) */
.topbar-search {
  display: inline-flex; align-items: center; gap: 8px;
  height: 34px; padding: 0 10px 0 11px;
  border: 1px solid var(--navy-line); border-radius: 9px;
  background: var(--on-navy-hover); color: var(--navy-text-muted);
  font: inherit; font-size: 12.5px; font-weight: 600;
  min-width: 210px; max-width: 320px;
  transition: border-color .15s ease, background .15s ease;
}
.topbar-search:hover { border-color: var(--accent); background: var(--on-navy-active); color: var(--navy-text); }
.topbar-search:focus-visible { outline: 2px solid var(--accent-cyan); outline-offset: 1px; }
.topbar-search > span { flex: 1; text-align: left; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.topbar-search kbd {
  flex-shrink: 0; padding: 2px 6px; border-radius: 5px;
  border: 1px solid var(--navy-line); background: var(--navy-900);
  color: var(--navy-text-muted); font: inherit; font-size: 10px; font-weight: 700;
}

/* 오버레이 */
.cp-overlay {
  position: fixed; inset: 0; z-index: 100;
  background: var(--shadow-color-strong);
  display: flex; align-items: flex-start; justify-content: center;
  padding: 10vh 16px 16px;
  animation: fade-in .12s ease-out;
}
.cp-panel {
  width: 100%; max-width: 640px; max-height: 74vh;
  display: flex; flex-direction: column; overflow: hidden;
  border: 1px solid var(--border); border-radius: 14px;
  background: var(--surface); box-shadow: 0 24px 64px var(--shadow-color-deep);
  animation: cp-in .16s ease-out;
}
@keyframes cp-in { from { opacity: 0; transform: translateY(-10px) scale(.99); } to { opacity: 1; transform: none; } }

.cp-input-row {
  display: flex; align-items: center; gap: 10px;
  padding: 13px 15px; border-bottom: 1px solid var(--border);
}
.cp-input-icon { display: inline-flex; color: var(--text-faint); flex-shrink: 0; }
.cp-input-icon svg { width: 17px; height: 17px; }
#cp-input {
  flex: 1; min-width: 0; border: none; background: transparent;
  color: var(--text); font: inherit; font-size: 15px; font-weight: 600;
}
#cp-input:focus { outline: none; }
#cp-input::placeholder { color: var(--text-faint); font-weight: 500; }
.cp-esc {
  flex-shrink: 0; padding: 3px 7px; border-radius: 6px;
  border: 1px solid var(--border); background: var(--surface-muted);
  color: var(--text-faint); font: inherit; font-size: 10.5px; font-weight: 700;
}

.cp-list { flex: 1; overflow-y: auto; padding: 6px; }
.cp-section {
  padding: 10px 10px 4px; font-size: 10.5px; font-weight: 800;
  color: var(--text-faint); letter-spacing: .4px;
}
.cp-row {
  width: 100%; display: flex; align-items: center; gap: 11px;
  padding: 9px 10px; border: none; border-radius: 9px;
  background: transparent; color: var(--text); font: inherit; text-align: left;
}
.cp-row.on { background: var(--accent-softer); }
.cp-row-icon { display: inline-flex; flex-shrink: 0; color: var(--text-faint); }
.cp-row-icon svg { width: 16px; height: 16px; }
.cp-row.on .cp-row-icon { color: var(--accent); }
.cp-row-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.cp-row-main {
  font-size: 13px; font-weight: 700;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  display: flex; align-items: center; gap: 6px;
}
.cp-row-main mark { background: var(--mark-bg); color: inherit; border-radius: 3px; padding: 0 1px; }
.cp-row-sub {
  font-size: 11.5px; color: var(--text-muted);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.cp-why {
  display: inline-block; margin-left: 4px; padding: 0 6px; border-radius: 999px;
  background: var(--surface-muted); color: var(--text-faint); font-size: 10.5px; font-weight: 700;
}
.cp-row-right { flex-shrink: 0; font-size: 11px; font-weight: 700; color: var(--text-faint); }
/* 이벤트 행의 오른쪽: 심각도 배지 + 발생시각을 두 줄로 세운다 */
.cp-ev-right { display: flex; flex-direction: column; align-items: flex-end; gap: 3px; }
.cp-sev {
  padding: 1px 6px; border-radius: 999px; font-size: 10px; font-weight: 800; letter-spacing: .02em;
  background: var(--info-bg); color: var(--info-text);
}
.cp-sev.warn { background: var(--warn-bg); color: var(--warn-text); }
.cp-sev.bad { background: var(--err-bg); color: var(--err-text); }
.cp-ev-time { font-size: 10.5px; font-weight: 600; color: var(--text-faint); white-space: nowrap; }
.cp-status { display: inline-flex; align-items: center; gap: 5px; }
.cp-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; background: var(--off-dot); }
.cp-dot.dot-ONLINE { background: var(--ok-dot); }
.cp-dot.dot-OFFLINE { background: var(--off-dot); }
.cp-dot.dot-ERROR { background: var(--err-dot); }

.cp-empty, .cp-loading {
  padding: 26px 14px; text-align: center; font-size: 12.5px; color: var(--text-muted);
}
.cp-loading { padding: 12px; font-size: 11.5px; color: var(--text-faint); }

.cp-foot {
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
  padding: 9px 15px; border-top: 1px solid var(--border);
  background: var(--surface-sunken); font-size: 11px; color: var(--text-faint);
}
.cp-foot kbd {
  display: inline-block; margin-right: 3px; padding: 1px 5px; border-radius: 4px;
  border: 1px solid var(--border); background: var(--surface);
  font: inherit; font-size: 10px; font-weight: 700;
}
.cp-foot-hint { margin-left: auto; }

@media (max-width: 900px) {
  /* 좁은 화면에서는 검색 상자를 아이콘만 남긴다 */
  .topbar-search { min-width: 0; padding: 0 9px; }
  .topbar-search > span, .topbar-search kbd { display: none; }
  .cp-overlay { padding: 6vh 10px 10px; }
  .cp-foot-hint { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  .cp-overlay, .cp-panel { animation: none; }
}


/* =========================================================================
   지도 커스텀 (FR-05)
   명세: docs/16_UX_REDESIGN_SPEC.md §7 · docs/03_DEVICE.md §6
   ========================================================================= */

/* 구글 기본 InfoWindow 껍데기를 지우고 우리 카드가 직접 채우게 한다.
   (gm-style-iw 는 구글이 만드는 클래스라 버전에 따라 바뀔 수 있다. 실패해도
   카드 자체는 정상 표시되므로 치명적이지 않다.) */
.gm-style-iw.gm-style-iw-c { padding: 0 !important; border-radius: 12px !important; overflow: hidden !important; }
/* 넘치면 **스크롤**되게 둔다. 예전에는 hidden 이었는데, 구글이 지도 높이에 맞춰
   정한 최대 높이를 넘는 순간 아래쪽이 소리 없이 사라졌다. 장비 상세의 좁은
   지도 패널에서 구분선 아래(그룹·접속시각·주소·버튼)가 통째로 안 보였다.
   잘라 숨기는 것보다 스크롤이 낫다 — 적어도 있다는 것은 보인다. */
.gm-style-iw-d { overflow: auto !important; }
/* 닫기 버튼과 그 줄.
   구글은 말풍선 맨 위에 닫기 버튼 전용 줄을 하나 깔고, 거기에 40px 가까운
   높이를 내준다. 우리 카드에는 제목 줄이 따로 있어서 그 자리가 통째로 빈
   띠로 남는다 — 좁은 지도 패널에서는 그만큼 카드가 잘려 나간다.
   그래서 줄은 높이를 거두고, 버튼만 카드 위에 겹쳐 띄운다.

   클래스 이름은 구글이 버전마다 바꾼다. 없는 선택자는 아무 일도 하지 않으므로
   여러 세대를 같이 적어 둔다. */
.gm-style-iw-c .gm-style-iw-ch { padding-top: 0 !important; }
.gm-style-iw-c .gm-style-iw-chr {
  position: absolute !important;
  top: 0 !important; right: 0 !important;
  height: 0 !important; min-height: 0 !important;
  z-index: 2;
}
.gm-style-iw-c button.gm-ui-hover-effect {
  position: absolute !important;
  top: 6px !important; right: 6px !important;
  width: 24px !important; height: 24px !important;
  min-width: 24px !important; min-height: 24px !important;
  margin: 0 !important; padding: 0 !important;
  border-radius: 999px !important;
  /* 썸네일 위에 겹치므로 밝은 사진에서도 보이게 바탕을 깐다. */
  background: rgba(0, 0, 0, .5) !important;
  opacity: 1 !important;
}
.gm-style-iw-c button.gm-ui-hover-effect > span {
  width: 14px !important; height: 14px !important;
  margin: 5px !important;
  background-color: #fff !important;
}

.mapcard { width: 288px; font-family: inherit; color: var(--text); background: var(--surface); }
.mapcard-head { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.mapcard-name-row { display: flex; align-items: center; gap: 5px; min-width: 0; }
.mapcard-name {
  flex: 1; min-width: 0; font-size: 13.5px; font-weight: 800;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.mapcard-star {
  width: 22px; height: 22px; flex-shrink: 0; padding: 0; border: none; border-radius: 6px;
  display: inline-flex; align-items: center; justify-content: center;
  background: transparent; color: var(--text-faint);
}
.mapcard-star svg { width: 14px; height: 14px; }
.mapcard-star:hover { background: var(--surface-muted); color: var(--star); }
.mapcard-star.on { color: var(--star); }
.mapcard-meta { font-size: 11.5px; color: var(--text-muted); }

.mapcard-rows { padding: 0 12px 10px; border-top: 1px solid var(--border-subtle); margin-top: 2px; }
.mapcard-row {
  display: flex; align-items: baseline; justify-content: space-between; gap: 12px;
  padding: 5px 0; font-size: 11.5px;
}
.mapcard-row span { color: var(--text-faint); flex-shrink: 0; }
.mapcard-row b { font-weight: 700; text-align: right; }
.mapcard-addr {
  max-width: 170px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  font-weight: 600 !important; color: var(--text-muted);
}
.mapcard-bad { color: var(--err-text); }

.mapcard-actions {
  display: flex; gap: 6px; padding: 10px 12px;
  border-top: 1px solid var(--border-subtle); background: var(--surface-sunken);
}
.mapcard-btn {
  flex: 1; height: 30px; border: 1px solid var(--border-strong); border-radius: 8px;
  background: var(--surface); color: var(--text-body);
  font: inherit; font-size: 12px; font-weight: 700;
}
.mapcard-btn:hover { border-color: var(--accent); color: var(--accent); }
.mapcard-btn.primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.mapcard-btn.primary:hover { background: var(--accent-ink); border-color: var(--accent-ink); color: var(--on-accent); }
.mapcard-btn:disabled { opacity: .6; cursor: default; }

/* ---- 지도 위 오버레이 ---- */
.map-overlay { position: absolute; z-index: 3; }
.map-summary {
  left: 12px; top: 12px;
  display: flex; flex-direction: column; gap: 5px;
  padding: 8px 10px; border-radius: 10px;
  background: var(--surface); border: 1px solid var(--border);
  box-shadow: 0 6px 18px var(--shadow-color);
}
.map-summary-counts { display: flex; align-items: center; gap: 4px; }
.map-count {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 8px; border: 1px solid transparent; border-radius: 999px;
  background: transparent; color: var(--text-body);
  font: inherit; font-size: 12px; font-weight: 800; font-variant-numeric: tabular-nums;
}
.map-count:hover { background: var(--surface-sunken); border-color: var(--border); }
.map-count.on { background: var(--accent-softer); border-color: var(--accent); color: var(--accent-ink); }
.map-count-all { font-size: 11px; font-weight: 700; color: var(--text-faint); }
.map-summary-sub { font-size: 10.5px; color: var(--text-faint); }

/* 지도 갱신 줄 — 자동 갱신은 하루 한 번뿐이라 마지막 갱신 시각과 수동 [갱신] 을 함께 보여준다. */
.map-refresh-row {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  margin-top: 6px; padding-top: 6px; border-top: 1px solid var(--border);
}
.map-refreshed { font-size: 10.5px; color: var(--text-faint); white-space: nowrap; }
.map-refresh-btn {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 8px; border: 1px solid var(--border); border-radius: 7px;
  background: var(--surface); color: var(--text-muted);
  font-size: 10.5px; font-weight: 700; cursor: pointer;
  transition: background .15s ease, color .15s ease;
}
.map-refresh-btn:hover:not(:disabled) { background: var(--surface-2, var(--bg)); color: var(--text); }
.map-refresh-btn:disabled { opacity: .55; cursor: default; }
.map-refresh-btn.spinning svg { animation: map-refresh-spin .9s linear infinite; }
@keyframes map-refresh-spin { to { transform: rotate(360deg); } }

.map-missing {
  left: 12px; bottom: 40px; max-width: calc(100% - 24px);
  display: flex; align-items: center; gap: 7px;
  padding: 7px 11px; border-radius: 9px;
  background: var(--warn-bg); border: 1px solid var(--warn-border); color: var(--warn-text-strong);
  font-size: 11.5px; font-weight: 700;
}
.map-missing svg { flex-shrink: 0; }
.map-missing a { color: var(--warn-text-strong); text-decoration: underline; white-space: nowrap; }

@media (max-width: 640px) {
  .mapcard { width: 240px; }
  .map-summary-sub { display: none; }
  .map-missing { font-size: 10.5px; bottom: 46px; }
}

/* ===================== 모바일 메뉴 서랍 =====================
   상단바에는 로고 · 관제 메뉴 4개 · 검색 · 관제 범위 칩 · 테마 · 설정 · 사용자 · 로그아웃이
   한 줄로 들어간다. 폰 폭에서는 서로 겹쳐 읽히지 않는다. 900px 아래에서는 넘치는 것들을
   서랍으로 옮기고 상단바에는 "로고 · 검색 · 관제 범위 · 메뉴 버튼"만 남긴다.
   (JS 쪽 MobileMenu.BREAKPOINT 와 값이 같아야 한다) */
.topbar-menu-btn {
  display: none;                     /* 넓은 화면에서는 숨는다 */
  width: 36px; height: 34px; flex-shrink: 0;
  align-items: center; justify-content: center;
  border: 1px solid var(--navy-line); border-radius: 9px;
  background: transparent; color: var(--navy-text-muted); cursor: pointer;
  transition: background .15s ease, color .15s ease;
}
.topbar-menu-btn:hover { background: var(--on-navy-hover); color: var(--navy-text); }
.topbar-menu-btn[aria-expanded="true"] { background: var(--on-navy-hover); color: var(--navy-text); }
.topbar-menu-btn:focus-visible { outline: 2px solid var(--accent-cyan); outline-offset: 1px; }

.mobile-menu-backdrop {
  position: fixed; inset: 0; z-index: 70;
  background: rgba(8, 14, 24, .5);
  opacity: 0; transition: opacity .18s ease;
}
.mobile-menu-backdrop.open { opacity: 1; }

.mobile-menu {
  position: fixed; top: 0; right: 0; bottom: 0; z-index: 71;
  width: min(320px, 86vw);
  display: flex; flex-direction: column; gap: 2px;
  padding: 14px 12px calc(18px + env(safe-area-inset-bottom));
  overflow-y: auto; -webkit-overflow-scrolling: touch;
  background: var(--navy-950); color: var(--navy-text);
  border-left: 1px solid var(--navy-line);
  box-shadow: -18px 0 40px rgba(0, 0, 0, .35);
  transform: translateX(100%);
  transition: transform .18s ease;
}
.mobile-menu.open { transform: translateX(0); }
body.mm-locked { overflow: hidden; }

.mm-head {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 4px 6px 14px; margin-bottom: 6px;
  border-bottom: 1px solid var(--navy-line);
}
.mm-user-name { font-size: 13.5px; font-weight: 800; color: var(--navy-text); }
.mm-user-role { font-size: 11px; color: var(--navy-text-muted); margin-top: 1px; }
.mm-close {
  width: 34px; height: 34px; flex-shrink: 0;
  display: inline-flex; align-items: center; justify-content: center;
  border: 0; border-radius: 9px; background: transparent;
  color: var(--navy-text-muted); cursor: pointer;
}
.mm-close:hover { background: var(--on-navy-hover); color: var(--navy-text); }

.mm-section-label {
  padding: 10px 10px 6px;
  font-size: 10.5px; font-weight: 800; letter-spacing: .6px;
  color: var(--navy-text-muted); text-transform: uppercase;
}
.mm-divider { height: 1px; margin: 8px 6px; background: var(--navy-line); }

.mm-item {
  display: flex; align-items: center; gap: 11px;
  width: 100%; padding: 12px 10px;
  border: 0; border-radius: 10px; background: transparent;
  color: var(--navy-text-muted); font: inherit; font-size: 14px; font-weight: 600;
  text-align: left; text-decoration: none; cursor: pointer;
  transition: background .15s ease, color .15s ease;
}
.mm-item:hover { background: var(--on-navy-hover); color: var(--navy-text); }
.mm-item.active { background: var(--on-navy-active); color: var(--navy-text); font-weight: 800; }
.mm-item:focus-visible { outline: 2px solid var(--accent-cyan); outline-offset: -2px; }
.mm-item svg { flex-shrink: 0; }
.mm-icon { display: inline-flex; width: 16px; height: 16px; align-items: center; justify-content: center; }
.mm-icon svg { width: 16px; height: 16px; }
.mm-item-danger { color: var(--err-text-on-dark); }

@media (max-width: 900px) {
  /* 상단바에서 서랍으로 옮겨가는 것들 */
  .topbar-nav,
  .topbar-actions,
  .topbar-left .topbar-logo-text,
  .topbar-right .user-chip,
  .logout-link,
  .topbar-divider { display: none; }
  .topbar-menu-btn { display: inline-flex; }
  /* 남는 것: 로고 · 검색 · 관제 범위 칩 · 메뉴 버튼. 칩과 버튼이 나란히 붙는다. */
  .topbar-right { gap: 8px; }
  #scope-chip-mount { min-width: 0; }
}
@media (min-width: 901px) {
  /* 넓은 화면에서는 서랍이 열려 있어도 보이지 않게 한다(회전·리사이즈 대비). */
  .mobile-menu, .mobile-menu-backdrop { display: none !important; }
}

/* ===================== 표 → 카드 (좁은 화면) =====================
   폰에서 표는 가로 스크롤 없이는 못 읽는다. 행 하나를 카드 한 장으로 세우고 셀을
   "제목 : 값" 줄로 쌓는다. 제목은 js/responsiveTable.js 가 <td data-label> 로 넣어 준다.
   (템플릿을 고치지 않고 thead 의 글자를 그대로 가져오므로 열이 바뀌어도 따라온다) */
@media (max-width: 768px) {
  .set-table-wrap, .st-list-wrap, .xl-table-wrap {
    overflow-x: visible; border: 0; background: transparent; border-radius: 0;
  }
  .set-table, .st-list, .xl-table { display: block; width: 100%; font-size: 13px; }
  .set-table thead, .st-list thead, .xl-table thead { display: none; }
  .set-table tbody, .st-list tbody, .xl-table tbody { display: block; }

  .set-table tbody tr, .st-list tbody tr, .xl-table tbody tr {
    display: flex; flex-wrap: wrap; align-items: center; gap: 2px 8px;
    padding: 12px 14px; margin-bottom: 10px;
    border: 1px solid var(--border); border-radius: 12px;
    background: var(--surface);
  }
  .set-table tbody tr:last-child, .st-list tbody tr:last-child, .xl-table tbody tr:last-child {
    margin-bottom: 0;
  }

  .set-table tbody td, .st-list tbody td, .xl-table tbody td {
    display: flex; align-items: center; justify-content: space-between; gap: 12px;
    flex: 1 1 100%; min-width: 0;
    padding: 4px 0; border: 0;
    white-space: normal; word-break: break-word;
  }
  /* 열 제목. 값이 오른쪽에 붙어 읽는 눈이 한 줄에 머문다. */
  .set-table tbody td::before, .st-list tbody td::before, .xl-table tbody td::before {
    content: attr(data-label);
    flex: 0 0 auto;
    font-size: 11.5px; font-weight: 700; color: var(--text-muted);
  }
  .set-table tbody td:not([data-label])::before,
  .st-list tbody td:not([data-label])::before,
  .xl-table tbody td:not([data-label])::before { content: none; }

  /* 카드 머리줄: 체크박스 · 상태등 · 이름을 한 줄에 나란히 둔다. */
  .set-table tbody td.set-col-check,
  .set-table tbody td.set-col-led { flex: 0 0 auto; padding: 0; }
  .set-table tbody td.set-cell-name,
  .st-list tbody td.st-list-name {
    flex: 1 1 auto;
    justify-content: flex-start;
    font-size: 14.5px; font-weight: 800; color: var(--text);
    padding-bottom: 6px;
  }
  .set-table tbody td.set-cell-name::before,
  .set-table tbody td.set-col-led::before,
  .st-list tbody td.st-list-name::before { content: none; }

  /* 작업 버튼은 카드 맨 아래 오른쪽으로 */
  .set-table tbody td.set-col-act {
    justify-content: flex-end;
    padding-top: 10px; margin-top: 4px;
    border-top: 1px dashed var(--border);
  }
  .set-table tbody td.set-col-act::before { content: none; }

  /* "결과 없음" 처럼 한 칸이 표 전체를 차지하던 행 */
  .set-table tbody td.rt-full, .st-list tbody td.rt-full, .xl-table tbody td.rt-full {
    justify-content: center; text-align: center; color: var(--text-muted);
  }
}


/* 실시간 이벤트 자유 검색. 심각도 탭 왼쪽에 붙는다. */
.feed-search {
  display: inline-flex; align-items: center; gap: 6px;
  height: 32px; padding: 0 8px 0 10px;
  border: 1px solid var(--border); border-radius: 9px;
  background: var(--surface); color: var(--text-faint);
  transition: border-color .15s ease, box-shadow .15s ease;
}
.feed-search:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-ring, rgba(37,99,235,.15)); }
.feed-search input {
  width: 190px; min-width: 0; height: 100%;
  border: 0; background: transparent; outline: none;
  color: var(--text); font-size: 12.5px; font-family: inherit;
}
.feed-search input::-webkit-search-cancel-button { display: none; }
.feed-search-count {
  flex-shrink: 0; padding: 1px 6px; border-radius: 20px;
  background: var(--accent-wash, rgba(37,99,235,.12)); color: var(--accent);
  font-size: 10.5px; font-weight: 800;
}
.feed-search-clear {
  display: inline-flex; align-items: center; justify-content: center;
  width: 18px; height: 18px; flex-shrink: 0;
  border: 0; border-radius: 50%; background: var(--border);
  color: var(--text-muted); cursor: pointer;
}
.feed-search-clear:hover { background: var(--text-faint); color: var(--surface); }

@media (max-width: 768px) {
  /* 좁은 화면에서는 검색창이 한 줄을 차지하고 심각도 탭이 아래로 내려간다. */
  .feed-search { width: 100%; }
  .feed-search input { width: 100%; }
}
/* 장비 그룹 지정 패널 (설정 > 장비 관리 > 그룹 지정)
   디스커버리로 들어온 장비를 현장 그룹에 배치하는 자리다. */
.set-check-list {
  display: flex; flex-direction: column; gap: 2px;
  max-height: 320px; overflow: auto;
  border: 1px solid var(--border-subtle); border-radius: 8px;
  padding: 6px; margin: 10px 0;
}
.set-check-row {
  display: flex; align-items: center; gap: 9px;
  padding: 7px 9px; border-radius: 6px; cursor: pointer; font-size: 13px;
}
.set-check-row:hover { background: var(--surface-sunken); }
.set-check-row input { width: 15px; height: 15px; accent-color: var(--accent); }

/* 아직 그룹에 배정되지 않은 장비. 관제 화면에 안 나오므로 눈에 띄어야 한다. */
.set-cell-unassigned { color: var(--warn-text, #B45309); font-weight: 700; }

/* 「하위 장비」 패널의 고정 푸터 — [장비 목록 가져오기] 와 진행 한 줄.
   목록이 주인공이라 가운데를 다 내주고, 버튼은 바닥에 붙여 둔다.
   스크롤을 내려도 버튼이 따라오고, 위쪽 자리를 뺏지도 않는다.
   포털이 장비에 닿지 않으면 "기다리는 중" 상태가 생기는데,
   그것이 보여야 사용자가 버튼을 다시 누르지 않는다. */
.ct-sync {
  flex-shrink: 0; padding: 3px 9px; white-space: nowrap;
  border: none; border-radius: 6px; cursor: pointer;
  background: var(--accent); color: #fff; font-size: 10.5px; font-weight: 700;
}
.ct-sync:hover { filter: brightness(1.06); }
.ct-sync:disabled { opacity: .55; cursor: default; }

/* 「하위 장비」 패널.
   목록이라 폭보다 높이가 중요해 기본 배치에서 오른쪽 세로 한 줄을 쓴다.
   좁으니 한 행을 두 줄로 쓴다 — 윗줄에 이름·유형, 아랫줄에 IP.
   상태 점은 찍지 않는다. 하위 장비는 따로 헬스체크하지 않으므로 색이 뜻이 없다. */
/* 본문은 스크롤하지 않는다 — 안의 목록만 스크롤하고 푸터는 바닥에 남는다. */
.detail-panel[data-panel="children"] .detail-panel-body {
  display: flex; flex-direction: column; overflow: hidden; padding: 10px 12px;
}
.detail-panel[data-panel="children"] #child-tree {
  flex: 1; min-height: 0; overflow-y: auto; overflow-x: hidden;
}
/* 목록 위 한 줄 — 왼쪽에 "신규 0 · 갱신 7 | 2026-09-28 05:15", 오른쪽 끝에 버튼.
   높이가 고정이어야 목록이 흔들리지 않는다. 글이 넘치면 말줄임으로 자르고
   전문은 title 로 읽는다. 결과는 버튼을 누른 뒤에만 생기고, 평소엔 시각만 남는다. */
.ct-head {
  flex-shrink: 0; display: flex; align-items: center; gap: 8px;
  padding: 0 2px 6px; margin-bottom: 3px;
  border-bottom: 1px solid var(--border-subtle);
}
.ct-status {
  flex: 1; min-width: 0;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  font-size: 11px; line-height: 1.5; color: var(--text-faint);
}
.ct-sep { margin: 0 6px; opacity: .45; }
.ct-at { white-space: nowrap; }
.xvms-wait { color: var(--accent); font-weight: 700; }
.xvms-note { color: var(--accent-ink, var(--accent)); font-weight: 700; }
.ct-empty { padding: 10px 2px; color: var(--text-faint); font-size: 12px; line-height: 1.65; }
.child-tree-gone {
  padding: 1px 8px; border-radius: 99px;
  background: var(--err-bg); color: var(--err-text); font-size: 10.5px; font-weight: 700;
}
.child-tree-list { list-style: none; margin: 0; padding: 0; }
.ct-root {
  display: flex; align-items: center; gap: 8px;
  padding: 7px 2px; font-weight: 800; font-size: 12.5px;
}
/* 하위 행은 들여쓰고 세로줄로 이어 붙인다. 어디에 달린 장비인지 보여야 한다. */
.ct-row { position: relative; padding: 6px 2px 7px 28px; font-size: 12.5px; }
.ct-row::before {
  content: ''; position: absolute; left: 8px; top: 0; bottom: 0;
  border-left: 1px solid var(--border-strong);
}
.ct-row.is-last::before { bottom: 50%; }
.ct-row::after {
  content: ''; position: absolute; left: 8px; top: 50%; width: 12px;
  border-top: 1px solid var(--border-strong);
}
.ct-main { display: flex; align-items: baseline; gap: 8px; }
.ct-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ct-type { flex-shrink: 0; color: var(--text-faint); font-size: 11px; }
.ct-sub {
  display: block; margin-top: 1px;
  color: var(--text-faint); font-size: 11px; font-family: Consolas, monospace;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.ct-row.is-gone .ct-name { text-decoration: line-through; opacity: .6; }

/* 줄 전체가 라이브를 여는 과녁이다. 버튼을 따로 두지 않는 대신
   누를 수 있다는 것이 보여야 한다. */
.ct-row.is-live { cursor: pointer; border-radius: 7px; }
.ct-row.is-live:hover { background: var(--surface-muted); }
.ct-row.is-live:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.ct-live {
  flex-shrink: 0;
  display: inline-flex; align-items: center;
  color: var(--text-faint);
  opacity: 0;
  transition: opacity .12s;
}
.ct-live svg { width: 12px; height: 12px; }
.ct-row.is-live:hover .ct-live,
.ct-row.is-live:focus-visible .ct-live { opacity: 1; color: var(--accent); }
/* 손가락으로 쓰는 화면에는 hover 가 없다. 늘 보여 준다. */
@media (hover: none) {
  .ct-live { opacity: 1; }
}

/* 트리의 "미배정" 노드. 관리자에게만 보인다.
   그룹이 없는 장비는 관제 화면에 안 나오므로, 처리해야 할 것이라는 표시를 준다. */
.tree-ungrouped > .tree-row-branch .tree-label { color: var(--warn-text, #B45309); font-weight: 700; }
.tree-ungrouped > .tree-row-branch .tree-icon { color: var(--warn-text, #B45309); }

/* 설정 화면의 한 줄 알림. 일괄작업 바는 선택이 없으면 숨겨져서 단건 작업 결과를 못 띄운다. */
.settings-notice {
  margin: 10px 0 0; padding: 9px 13px; border-radius: 8px; font-size: 13px;
  background: var(--accent-softer); color: var(--accent-ink, var(--accent));
  border: 1px solid var(--border-subtle);
}
.settings-notice.success { background: var(--ok-bg, #DCFCE7); color: var(--ok-text, #166534); }
.settings-notice.error { background: var(--err-bg); color: var(--err-text); }

/* XVMS 원본 목록에서 사라진 장비.
   지우지 않고 표시만 한다 — 지우면 그 장비의 이벤트·썸네일 기록까지 함께 사라진다. */
.set-gone {
  display: inline-block; margin-left: 7px; padding: 1px 7px; border-radius: 99px;
  background: var(--err-bg); color: var(--err-text);
  font-size: 11px; font-weight: 700; cursor: help;
}

/* 트리의 XVMS 가지 — 그 아래에 그 XVMS 가 가져온 장비가 달린다. */
.tree-row-xvms .tree-label { font-weight: 700; }
.tree-xvms-children { margin-left: 14px; border-left: 1px dashed var(--border-subtle); }
.tree-gone {
  margin-left: 6px; padding: 0 6px; border-radius: 99px;
  background: var(--err-bg); color: var(--err-text); font-size: 10.5px; font-weight: 700;
}
/* 그룹 상세의 장비 목록. XVMS 는 자기 장비를 거느리므로 한 줄 들여쓴다. */
.group-device-panel { margin-bottom: 14px; }
.group-device-list { list-style: none; margin: 0; padding: 0; }
.group-device-row {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 14px; border-bottom: 1px solid var(--border-subtle);
  cursor: pointer; font-size: 13px;
}
.group-device-row:last-child { border-bottom: none; }
.group-device-row:hover { background: var(--surface-sunken); }
.group-device-row.is-child { padding-left: 34px; }
.group-device-row.is-child .group-device-name { font-weight: 400; }
.group-device-name { font-weight: 700; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.group-device-type { color: var(--text-faint); font-size: 12px; width: 62px; flex-shrink: 0; }
.group-device-ip { color: var(--text-faint); font-size: 12px; font-family: Consolas, monospace; }

/* 장비 상태의 보기 전환. 선택지가 둘뿐이라 드롭다운보다 아이콘 두 개가 빠르다
   — 지금 무엇으로 보고 있는지도 펼치지 않고 알 수 있다. */
.st-viewtoggle {
  display: inline-flex; flex-shrink: 0;
  border: 1px solid var(--border); border-radius: 8px; overflow: hidden;
}
.st-view {
  display: inline-flex; align-items: center; justify-content: center;
  width: 32px; height: 30px; padding: 0;
  border: none; background: var(--surface); color: var(--text-faint); cursor: pointer;
}
.st-view + .st-view { border-left: 1px solid var(--border); }
.st-view:hover { color: var(--text); background: var(--surface-sunken); }
.st-view.on { background: var(--accent); color: #fff; }

/* 포털 알림. 장비 이벤트가 아니라 "포털이 사람에게 할 말" 만 담는다. */
.notify-wrap { position: relative; display: inline-flex; }
.notify-dot {
  position: absolute; top: 5px; right: 5px; width: 7px; height: 7px;
  border-radius: 50%; background: var(--err-dot, #F04438);
  box-shadow: 0 0 0 2px var(--surface-head, var(--surface));
}
.notify-pop {
  position: absolute; top: calc(100% + 8px); right: 0; z-index: 70;
  width: min(360px, calc(100vw - 32px));
  background: var(--surface); border: 1px solid var(--border); border-radius: 12px;
  box-shadow: 0 12px 32px rgba(16, 24, 40, .18); overflow: hidden;
}
.notify-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 11px 14px; border-bottom: 1px solid var(--border-subtle);
  font-size: 13px; font-weight: 800; color: var(--text);
}
.notify-clear {
  border: none; background: none; cursor: pointer;
  font-size: 11.5px; font-weight: 700; color: var(--accent);
}
.notify-empty { padding: 26px 14px; text-align: center; color: var(--text-faint); font-size: 12.5px; }
/* 목록이 길어져도 상단바를 덮지 않도록 자체 스크롤. */
.notify-list { max-height: min(60vh, 420px); overflow-y: auto; }
.notify-row {
  display: block; width: 100%; text-align: left; cursor: pointer;
  padding: 11px 14px; border: none; border-bottom: 1px solid var(--border-subtle);
  background: none;
}
.notify-row:last-child { border-bottom: none; }
.notify-row:hover { background: var(--surface-sunken); }
.notify-row-title { display: block; font-size: 12.5px; font-weight: 700; color: var(--text); }
.notify-row-mac { display: block; margin-top: 3px; font-size: 12px; color: var(--text); }
.notify-row-meta { display: block; margin-top: 1px; font-size: 11px; color: var(--text-faint); }
.notify-row-cta { display: block; margin-top: 5px; font-size: 11px; font-weight: 700; color: var(--accent); }

/* 페이지 제목 옆의 관제 범위 칩. 상단바에 있던 것을 각 화면으로 내렸다.
   이 자리에 있어야 "이 화면이 지금 어느 범위를 보는가" 가 분명하다. */
.page-scope { display: inline-flex; vertical-align: middle; position: relative; }
/* 상단바에 있을 때는 오른쪽 끝에 붙어 있어 왼쪽으로 펴는 것이 맞았다.
   페이지 제목 옆으로 내려온 지금은 그대로 두면 사이드바 밑으로 들어간다.
   칩의 왼쪽을 기준으로 편다. */
.page-scope .scope-pop { left: 0; right: auto; }

/* 칩은 원래 네이비 상단바 위에 있어서 --navy-text(거의 흰색)를 썼다.
   밝은 페이지 머리로 내려온 지금은 흰 글자가 흰 바탕에 묻힌다.
   페이지 안에서는 본문 토큰을 쓴다. */
.page-scope .scope-chip {
  background: var(--surface);
  border-color: var(--border-strong);
  color: var(--text-body);
}
.page-scope .scope-chip:hover {
  background: var(--surface-sunken);
  border-color: var(--accent);
}
.page-scope .scope-chip.active {
  background: var(--accent-softer);
  border-color: var(--accent);
  color: var(--accent-ink);
}
.page-scope .scope-chip-icon { color: var(--accent); }
.page-scope .scope-chip { height: 26px; padding: 0 9px; font-size: 11.5px; }

/* 장비 위치: 지도 + 옆 패널.
   지도에 안 찍히는 장비(주소 미등록)는 이 화면에서 없는 것과 같아진다.
   옆에 세워 두어야 빠진 것이 눈에 들어온다. */
.map-layout { display: flex; gap: 14px; align-items: stretch; min-height: 0; }
.map-layout .map-page-box { flex: 1; min-width: 0; }

.app-body { position: relative; }

/* 설정 머리의 '내 역할'. 눌러 보고 거부당해야 아는 상태를 없앤다. */
.settings-head-right { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.set-role { display: inline-flex; align-items: center; gap: 8px; }
.set-role-tag {
  font-size: 11.5px; font-weight: 800; padding: 3px 9px; border-radius: 999px;
  background: var(--surface-muted); color: var(--text-muted); white-space: nowrap;
}
.set-role-admin { background: var(--accent); color: var(--on-accent); }
.set-role-lead { background: var(--accent-softer); color: var(--accent-ink); }
.set-role-line { font-size: 11.5px; color: var(--text-faint); max-width: 44ch; }
.set-role-more {
  width: 20px; height: 20px; border-radius: 50%; flex-shrink: 0; cursor: pointer;
  border: 1px solid var(--border-strong); background: var(--surface);
  color: var(--text-muted); font-family: inherit; font-size: 11px; font-weight: 800;
  line-height: 1; padding: 0;
}
.set-role-more:hover { border-color: var(--accent); color: var(--accent); }
.set-role-list { margin: 6px 0 0; padding-left: 18px; }
.set-role-list li { font-size: 12px; color: var(--text-body); line-height: 1.7; }

/* 계정 삭제 — 단독 그룹장인 그룹마다 처리 방법을 고른다 */
.ud-groups { display: flex; flex-direction: column; gap: 12px; margin-top: 12px; }
.ud-group { border: 1px solid var(--border); border-radius: 10px; padding: 12px 14px; }
.ud-group-name { font-size: 13px; font-weight: 800; color: var(--text); margin-bottom: 4px; }

/* 알림 — 눌러서 이동하지 않는(읽기 전용) 줄 */
.notify-row-plain { display: flex; flex-direction: column; gap: 3px; text-align: left; cursor: default; }
.notify-row-plain.is-unread { background: var(--accent-softer); }

/* 그룹 상세 — 그룹 하나의 장비와 사람을 한 자리에 */
.set-link {
  border: none; background: transparent; padding: 0; cursor: pointer;
  font: inherit; font-weight: 700; color: var(--accent-ink); text-align: left;
}
.set-link:hover { text-decoration: underline; }

.gd-head { display: flex; gap: 16px; flex-wrap: wrap; padding-bottom: 12px; border-bottom: 1px solid var(--border); }
.gd-stat { font-size: 12px; color: var(--text-muted); }
.gd-stat b { font-size: 15px; font-weight: 800; color: var(--text); margin-right: 3px; }
.gd-stat-lead { margin-left: auto; }
.gd-tabs { margin: 12px 0 10px; }
.gd-actions { margin-bottom: 10px; }
.gd-list { max-height: 52vh; overflow-y: auto; }
.gd-row {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 6px; border-bottom: 1px solid var(--border-subtle);
}
.gd-row:last-child { border-bottom: none; }
.gd-main { display: flex; flex-direction: column; gap: 2px; min-width: 0; flex: 1; }
.gd-name { font-size: 12.5px; font-weight: 600; color: var(--text); }
.gd-sub { font-size: 11px; color: var(--text-faint); }
.gd-role {
  height: 26px; padding: 0 6px; border-radius: 6px; flex-shrink: 0;
  border: 1px solid var(--border); background: var(--surface);
  color: var(--text-body); font-family: inherit; font-size: 11.5px;
}
.gd-del {
  height: 26px; padding: 0 9px; border-radius: 6px; cursor: pointer; flex-shrink: 0;
  border: 1px solid var(--border); background: var(--surface);
  color: var(--text-muted); font-family: inherit; font-size: 11.5px; font-weight: 600;
}
.gd-del:hover:not(:disabled) { background: var(--err-bg); border-color: var(--err-bg); color: var(--err-text); }
.gd-del:disabled { opacity: .4; cursor: default; }
.mp-row { align-items: center; gap: 10px; }

/* 미등록 MAC 줄 — 등록하거나, 치우거나 */
.notify-row-wrap { display: flex; align-items: stretch; }
.notify-row-wrap > .notify-row { flex: 1; min-width: 0; }
.notify-dismiss {
  flex-shrink: 0; width: 28px; border: none; cursor: pointer;
  background: transparent; color: var(--text-faint);
  font-size: 16px; line-height: 1; padding: 0;
}
.notify-dismiss:hover { background: var(--err-bg); color: var(--err-text); }
.notify-dismiss:disabled { opacity: .4; cursor: default; }

/* ── 주소 검색 자동완성 목록 ───────────────────────────────────────────
   입력칸 아래에 겹쳐 띄운다. 폼 높이가 글자 칠 때마다 출렁이면 안 되므로
   흐름에서 빼낸다(absolute).

   기준점은 .field 전체가 아니라 입력칸만 감싼 .addr-field 다 — .field 를 쓰면
   아래 힌트 글줄의 높이까지 세어야 하고, 그 문구가 두 줄이 되는 순간 목록이
   엉뚱한 자리에 뜬다. */
.addr-field { position: relative; }
.addr-list {
  position: absolute;
  top: calc(100% + 4px);      /* 입력칸 바로 아래 */
  left: 0; right: 0;
  z-index: 40;
  max-height: 260px;
  overflow-y: auto;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  box-shadow: 0 10px 28px rgba(0, 0, 0, .14);
  padding: 4px;
}
.addr-opt {
  display: block;
  width: 100%;
  text-align: left;
  padding: 8px 10px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--text-body);
  font-size: 13px;
  line-height: 1.45;
  cursor: pointer;
}
.addr-opt:hover,
.addr-opt.on { background: var(--hover-bg, rgba(127, 127, 127, .12)); }

/* ── 이벤트 프로토콜 원본 ──────────────────────────────────────────────
   고른 값만 보여주면 무엇을 뺐는지가 안 보인다. 장비를 붙이는 동안에는
   "보냈는데 안 보인다" 를 가려내야 하므로 손대지 않은 전체를 같이 둔다. */
.event-raw {
  margin: 6px 0 0;
  padding: 10px 12px;
  max-height: 260px;
  overflow: auto;
  background: var(--code-bg, rgba(127, 127, 127, .08));
  border: 1px solid var(--border);
  border-radius: 8px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 11.5px;
  line-height: 1.55;
  color: var(--text-body);
  white-space: pre;
  user-select: text;
}
.event-raw-copy {
  margin-left: 8px;
  padding: 1px 8px;
  border: 1px solid var(--border-strong);
  border-radius: 5px;
  background: var(--surface);
  color: var(--text-muted);
  font-size: 11px;
  cursor: pointer;
}
.event-raw-copy:hover { color: var(--text); }

/* 배지는 이제 격자 칸이 아니라 내용 칸 앞에 붙는다. INFO 는 아예 붙지 않으므로
   대부분의 줄에서 이 여백은 나타나지 않는다. */
.event-msg > .event-badge { margin-right: 6px; vertical-align: middle; }

/* 종료 포함 토글. 끈 상태가 기본이라 꺼져 있을 때 조용하게 보이도록 한다. */
.feed-toggle {
  padding: 5px 11px;
  border: 1px solid var(--border-strong);
  border-radius: 7px;
  background: var(--surface);
  color: var(--text-muted);
  font-size: 12px;
  cursor: pointer;
  white-space: nowrap;
}
.feed-toggle:hover { color: var(--text); }
.feed-toggle.on {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

/* ── 새로고침 · 멈춤 ───────────────────────────────────────────────────
   자동 갱신만 있으면 두 가지가 불편하다. 지금 맞춰 보려면 주기를 기다려야 하고,
   한 줄을 읽는 동안 목록이 갈아끼워진다. 그래서 화면마다 같은 자리에 둔다. */
.poll-controls { display: inline-flex; gap: 6px; }
.poll-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 11px;
  border: 1px solid var(--border-strong);
  border-radius: 7px;
  background: var(--surface);
  color: var(--text-muted);
  font-size: 12px;
  cursor: pointer;
  white-space: nowrap;
}
.poll-btn:hover:not(:disabled) { color: var(--text); }
.poll-btn:disabled { opacity: .55; cursor: default; }
.poll-btn.on {
  background: var(--warn-bg);
  border-color: var(--warn-dot);
  color: var(--warn-text);
}
/* 멈춘 동안 '실시간' 배지를 그대로 두면 거짓말이 된다. */
.live-pill.is-paused { opacity: .45; }
.live-pill.is-paused .live-dot { animation: none; }

/* ── 이벤트 카드 보기 ──────────────────────────────────────────────────
   목록이 '언제 무엇이' 를 훑는 것이라면 카드는 '무엇이 찍혔나' 를 본다.
   그래서 스냅샷이 주인공이고 글자는 아래 보조로 붙는다.

   카드 높이를 고정하는 이유: 새 이벤트가 앞에 끼어들 때마다 아래 전부가
   출렁이면 읽던 자리를 잃는다. 스냅샷이 없는 카드도 같은 크기를 차지한다. */
.ev-card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(212px, 1fr));
  gap: 12px;
  padding: 12px;
}
.ev-card {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid var(--border);
  border-left: 3px solid var(--n-350);
  border-radius: 10px;
  background: var(--surface);
  cursor: pointer;
  transition: border-color .12s, transform .12s, box-shadow .12s;
}
.ev-card:hover, .ev-card:focus-visible {
  border-color: var(--border-strong);
  box-shadow: 0 6px 18px var(--shadow-color);
  transform: translateY(-1px);
  outline: none;
}
.ev-card.tone-danger { border-left-color: var(--err-dot); }
.ev-card.tone-warn   { border-left-color: var(--warn-dot); }

.ev-card-shot {
  position: relative;
  aspect-ratio: 16 / 9;
  background: var(--surface-sunken);
  display: flex; align-items: center; justify-content: center;
  overflow: hidden;
}
.ev-card-shot img { width: 100%; height: 100%; object-fit: cover; display: block; }
.ev-card-noshot { font-size: 11.5px; color: var(--text-faint); }

.ev-card-body { padding: 9px 10px 10px; display: flex; flex-direction: column; gap: 4px; }
.ev-card-top { display: flex; align-items: center; gap: 5px; flex-wrap: wrap; }
.ev-card-ch {
  padding: 1px 6px; border-radius: 5px;
  background: var(--surface-sunken); color: var(--text-muted);
  font-size: 10.5px; font-weight: 700;
}
.ev-card-name {
  font-size: 12.5px; font-weight: 700; color: var(--text);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.ev-card-time {
  display: flex; justify-content: space-between; gap: 6px;
  font-size: 11px; color: var(--text-muted);
}
.ev-card-rel { color: var(--text-faint); }
.ev-card-chips { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 2px; }

/* 새로 들어온 카드. 맨 앞에 끼어드는 것이 눈에 보여야 '실시간' 이 실감난다. */
@keyframes ev-card-in { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: none; } }
.ev-card-new { animation: ev-card-in .22s ease-out; border-color: var(--accent); }

/* ── 카드에서 여는 상세 모달 ──────────────────────────────────────────── */
.ev-modal-overlay { align-items: center; padding: 6vh 16px; }
.ev-modal-panel { max-width: 760px; max-height: 86vh; }
.ev-modal-head {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 12px 14px; border-bottom: 1px solid var(--border);
}
.ev-modal-title { display: flex; align-items: center; gap: 7px; min-width: 0; font-size: 13.5px; color: var(--text); }
.ev-modal-close {
  flex-shrink: 0; width: 28px; height: 28px; line-height: 1;
  border: 1px solid var(--border-strong); border-radius: 7px;
  background: var(--surface); color: var(--text-muted); font-size: 18px; cursor: pointer;
}
.ev-modal-close:hover { color: var(--text); }
.ev-modal-body { overflow: auto; padding: 4px 14px 14px; }
.ev-modal-body .event-detail { border: 0; padding: 0; }

/* ── 이벤트 검색 ───────────────────────────────────────────────────────
   조건이 한 화면에 다 보여야 한다. 접어 두면 지금 뭘로 좁히고 있는지 모르는 채로
   결과만 보게 되고, 그러면 "왜 안 나오지" 가 생긴다. */
.es-filters {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px 14px;
  margin-bottom: 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
}
.es-row { display: flex; align-items: flex-start; gap: 10px; }
.es-row-off { display: none; }
.es-label {
  flex: 0 0 52px;
  padding-top: 5px;
  font-size: 12px;
  font-weight: 700;
  color: var(--text-muted);
}
.es-chips { display: flex; flex-wrap: wrap; gap: 5px; align-items: center; min-width: 0; }
.es-chip {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 4px 10px;
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text-muted);
  font-size: 12px;
  cursor: pointer;
}
.es-chip:hover { color: var(--text); }
.es-chip.on { background: var(--accent); border-color: var(--accent); color: #fff; }
.es-chip b { font-size: 10.5px; opacity: .72; font-weight: 700; }
.es-sep { width: 1px; height: 16px; background: var(--border-strong); margin: 0 3px; }
.es-none { font-size: 12px; color: var(--text-faint); padding-top: 4px; }

.es-range { display: flex; align-items: center; gap: 8px; color: var(--text-muted); font-size: 12px; }
.es-range input {
  padding: 5px 9px;
  border: 1px solid var(--border-strong);
  border-radius: 7px;
  background: var(--surface);
  color: var(--text-body);
  font-size: 12.5px;
}
.es-search { display: flex; gap: 6px; flex: 1; min-width: 0; }
.es-search input {
  flex: 1; min-width: 0;
  padding: 6px 11px;
  border: 1px solid var(--border-strong);
  border-radius: 7px;
  background: var(--surface);
  color: var(--text-body);
  font-size: 13px;
}
.es-search .btn {
  flex: 0 0 auto;
  width: auto;
  padding: 6px 18px;
  font-size: 12.5px;
  white-space: nowrap;
}

.es-pager {
  display: flex; align-items: center; justify-content: center; gap: 12px;
  padding: 12px 0 4px;
}
.es-page {
  padding: 5px 13px;
  border: 1px solid var(--border-strong);
  border-radius: 7px;
  background: var(--surface);
  color: var(--text-body);
  font-size: 12.5px;
  cursor: pointer;
}
.es-page:disabled { opacity: .4; cursor: default; }
.es-pageinfo { font-size: 12px; color: var(--text-muted); }

/* ── 페이지 머리말과 도구 줄 ───────────────────────────────────────────
   좁은 화면에서 제목·범위칩·도구가 한 줄에 들어가지 않는다. 억지로 한 줄에 두면
   오른쪽이 잘려서 버튼이 아예 안 보인다(실제로 검색칸이 잘렸다).
   줄을 나누고, 도구 줄은 가로로 쓸어 넘길 수 있게 둔다. */
@media (max-width: 900px) {
  .detail-header { flex-direction: column; align-items: stretch; gap: 10px; }
  .detail-title-row { flex-wrap: wrap; gap: 8px; }
  .detail-title { font-size: 19px; }
  .content-page-sub { font-size: 12px; }

  /* 버튼은 줄바꿈해서 쌓고, 검색칸은 제 줄을 통째로 쓴다.
     한 줄에 욱여넣고 가로로 쓸어 넘기게 하면 오른쪽 끝이 잘린 것처럼 보여
     사람이 거기 뭐가 더 있는지 모른다. 실제로 검색칸이 그렇게 잘려 있었다. */
  .detail-actions {
    width: 100%;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
  }
  .detail-actions > * { flex: 0 0 auto; order: 1; }
  .detail-actions > .feed-search { order: 2; flex: 1 1 100%; min-width: 0; }

  /* 손가락으로 누를 수 있는 크기로. 44px 는 터치 대상 권장 최소치다. */
  .poll-btn, .feed-toggle, .st-view, .tab {
    min-height: 36px;
    padding-top: 0; padding-bottom: 0;
    display: inline-flex; align-items: center;
  }
  /* 글자를 줄여 버튼 수를 한 화면에 더 담는다. 아이콘만으로도 뜻이 통한다. */
  .poll-btn .poll-btn-text { display: none; }
  .poll-count { border-left: none; padding-left: 0; min-width: 26px; }


}

/* ── 이벤트 카드 ─────────────────────────────────────────────────────── */
@media (max-width: 640px) {
  .ev-card-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; padding: 8px; }
  .ev-card-body { padding: 7px 8px 8px; }
  .ev-card-name { font-size: 12px; }
  .ev-card-time { font-size: 10.5px; }
}

/* ── 이벤트 목록(행) ──────────────────────────────────────────────────
   8열 격자는 좁은 화면에서 들어갈 수가 없다. 세 줄로 쌓는다.
   .event-list-compact 가 쓰는 것과 같은 방식이다. */
@media (max-width: 760px) {
  .event-list-with-device .event-row-main,
  .event-row-main {
    /* 시각과 장비명은 각자 칸을 쓴다. 같은 칸에 두면 글자가 겹쳐 찍힌다. */
    grid-template-columns: minmax(0, 1fr) auto 44px 14px;
    grid-template-areas:
      "type  dev   thumb chev"
      "meta  meta  thumb chev"
      "msg   msg   msg   msg";
    row-gap: 3px;
    gap: 8px;
    padding: 9px 9px 9px 11px;
  }
  .event-row-main > .event-type { grid-area: type; justify-self: start; min-width: 0; }
  .event-row-main > .event-time {
    grid-area: meta; display: flex; gap: 6px; align-items: baseline;
    min-width: 0; overflow: hidden;
  }
  /* 넘치면 잘라 준다. 안 자르면 글자가 박스를 넘어 옆 칸 위로 흐른다. */
  .event-row-main > .event-time > span {
    min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  }
  .event-row-main > .event-device-link {
    grid-area: dev; justify-self: end; max-width: 46vw;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  }
  .event-row-main > .event-ch { display: none; }
  .event-row-main > .event-msg { grid-area: msg; min-width: 0; }
  .event-row-main > .event-thumb { grid-area: thumb; }
  .event-row-main > .event-chevron { grid-area: chev; }
}

/* ── 지도 ─────────────────────────────────────────────────────────────
   "브라우저 화면에 꽉 차게". 지도는 넓을수록 쓸모가 커지는 화면이라
   머리말을 뺀 나머지를 전부 준다. */
.map-page { display: flex; flex-direction: column; height: 100%; min-height: 0; }
.map-page .map-layout { flex: 1; min-height: 0; }
.map-page-box { height: 100%; min-height: 0; }

/* 옆 패널('위치 미등록')을 없앴으므로 지도가 가로를 통째로 쓴다.
   전에는 오른쪽 300px 을 패널이 가져갔다. */
.map-page .map-layout { display: flex; min-height: 0; }
.map-page .map-page-box { flex: 1; min-width: 0; }
@media (max-width: 900px) {
  .map-page .map-page-box { min-height: 62vh; }
}

/* ── 이벤트 상세 모달 ─────────────────────────────────────────────────── */
@media (max-width: 760px) {
  .ev-modal-overlay { padding: 0; align-items: stretch; }
  .ev-modal-panel { max-width: none; max-height: none; height: 100%; border-radius: 0; border: 0; }
}

/* ── 설정·폼 ──────────────────────────────────────────────────────────── */
@media (max-width: 640px) {
  .es-row { flex-direction: column; align-items: stretch; gap: 6px; }
  .es-label { flex: none; padding-top: 0; }
  .es-search { flex-wrap: wrap; }
  .es-search input { flex: 1 1 100%; }
  .es-range { flex-wrap: wrap; }
  .es-range input { flex: 1 1 140px; }
}

/* ── 이벤트 상세(펼침·모달) ─────────────────────────────────────────────
   스냅샷이 먼저고 사실 목록이 그 아래다. 모션 이벤트는 글자보다 그림이 빠르다.
   넓은 화면에서는 둘을 나란히 두되, 스냅샷 쪽을 크게 가져간다. */
.event-detail {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  padding: 12px;
  border-top: 1px solid var(--border);
  background: var(--surface-sunken);
}
.ev-shot {
  margin: 0;
  display: flex; align-items: center; justify-content: center;
  min-height: 160px;
  border-radius: 10px;
  overflow: hidden;
  background: var(--n-150);
}
.ev-shot img { width: 100%; height: auto; display: block; }
.ev-shot-loading { font-size: 12px; color: var(--text-faint); padding: 24px; }

.ev-facts {
  margin: 0;
  display: grid;
  grid-template-columns: 1fr;
  gap: 1px;
  background: var(--border);
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
}
.ev-fact {
  display: grid;
  grid-template-columns: 88px minmax(0, 1fr);
  gap: 10px;
  padding: 8px 12px;
  background: var(--surface);
  font-size: 12.5px;
}
.ev-fact dt { color: var(--text-muted); font-weight: 600; }
.ev-fact dd { margin: 0; color: var(--text-body); word-break: break-all; }

@media (min-width: 760px) {
  /* 스냅샷이 있는 상세만 2단으로 나눈다. 없으면 사실 목록이 폭을 다 쓴다. */
  .event-detail:has(.ev-shot) { grid-template-columns: minmax(0, 1.5fr) minmax(260px, 1fr); }
  .ev-facts { grid-template-columns: 1fr; align-self: start; }
}
@media (max-width: 480px) {
  .ev-fact { grid-template-columns: 72px minmax(0, 1fr); gap: 8px; padding: 7px 10px; font-size: 12px; }
}

/* ── 이벤트 목록의 MAC · IP ─────────────────────────────────────────────
   장비명만으로는 같은 이름이 여럿일 때 구분이 안 된다. 상세를 펼치지 않고도
   "어느 상자가 보냈나" 를 알 수 있게 한 칸을 둔다. */
.event-net {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
  font-size: 10.5px;
  line-height: 1.35;
  color: var(--text-faint);
}
.event-net-mac, .event-net-ip {
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.event-net-ip { color: var(--text-muted); }

/* 트리의 채널 IP. 이름(CH 1)만으로는 어느 카메라인지 알 수 없다. */
.tree-ch-ip {
  margin-left: auto;
  padding-left: 8px;
  font-size: 10.5px;
  color: var(--text-faint);
  flex-shrink: 0;
}

/* ── 알림 아이콘 가리기 ────────────────────────────────────────────────
   기능은 그대로 두고 화면에서만 뺀다(폴링도 그대로 돈다).
   다시 보이려면 이 한 블록만 지우면 된다. */
.notify-wrap { display: none !important; }

/* ── 좁은 화면 도구 줄 ─────────────────────────────────────────────────
   폰에서는 새로고침·멈춤을 쓸 일이 거의 없다. 화면을 열면 알아서 갱신되고,
   멈출 일이 있으면 그냥 화면을 닫는다. 자리만 차지하므로 감춘다. */
@media (max-width: 760px) {
  .poll-controls { display: none; }
}

/* ── 좁은 화면의 종류 필터 ─────────────────────────────────────────────
   칩이 줄바꿈되며 쌓이면 화면 절반을 필터가 먹는다. 한 줄로 눕히고
   가로로 쓸어 넘기게 한다 — 손가락으로 넘기는 것이 폰에서는 더 자연스럽다. */
@media (max-width: 760px) {
  .feed-typebar {
    flex-wrap: nowrap;
    overflow-x: auto;
    overflow-y: hidden;
    gap: 5px;
    padding: 7px 8px;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    /* 오른쪽에 더 있다는 것을 끝을 흐려서 알린다. */
    -webkit-mask-image: linear-gradient(to right, #000 calc(100% - 22px), transparent);
            mask-image: linear-gradient(to right, #000 calc(100% - 22px), transparent);
  }
  .feed-typebar::-webkit-scrollbar { display: none; }
  .feed-typebar > * { flex: 0 0 auto; }
  .feed-typebar-label { display: none; }
  .feed-type { padding: 5px 9px; font-size: 11.5px; }
}

/* 좁은 화면에서는 장비명만으로 충분하다. MAC·IP 는 상세에 있다. */
@media (max-width: 760px) {
  .event-row-main > .event-net { display: none; }

  /* 심각도 배지가 내용 칸 폭을 통째로 먹어 띠처럼 보였다.
     배지는 글자만큼만 차지해야 옆의 칩들과 한 줄로 읽힌다. */
  .event-msg > .event-badge {
    display: inline-flex;
    width: auto;
    align-self: flex-start;
    flex: 0 0 auto;
  }
  .event-msg { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; }

  /* 장비명이 '데모 카메라 …' 로 너무 일찍 잘린다. 시각 칸을 줄여 이름에 준다. */
  .event-row-main > .event-device-link { max-width: 46vw; }
}

/* 상태 배지가 글자보다 길게 늘어나던 문제.
   .mapcard-head 가 세로 flex 라 자식이 기본으로 폭을 꽉 채운다(align-items: stretch).
   배지는 글자만큼만 차지해야 한다. */
.mapcard-head > .badge { align-self: flex-start; }

/* 잘린 주소에 마우스를 올리면 말풍선으로 전체가 보인다(title 속성).
   잘린다는 것 자체가 보이도록 커서도 바꾼다. */
.mapcard-addr { cursor: help; }

/* =====================================================================
   페이지 머리말 (모든 관제 화면 공용)

   세 줄로 끝낸다. 전에는 크럼·제목·범위칩·실시간배지·도구가 뒤섞여
   화면마다 같은 것이 다른 자리에 있었다.

     1줄  제목
     2줄  설명        — 이 화면이 담는 것
     3줄  상태 … 도구 — 왼쪽은 사실(실시간·범위·건수·갱신), 오른쪽 끝은 조작

   조작 순서는 어느 화면에서든 같다: 범위 → 검색 → 보기 → 새로고침.
   ===================================================================== */
.page-head {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding-bottom: 12px;
  margin-bottom: 14px;
  border-bottom: 1px solid var(--border);
}
.page-title {
  margin: 0;
  font-size: 22px;
  font-weight: 800;
  line-height: 1.2;
  color: var(--text);
}
/* 설명은 한 줄. 두 줄이 되면 머리말이 본문을 밀어낸다. */
.page-desc {
  margin: 0;
  font-size: 12.5px;
  line-height: 1.5;
  color: var(--text-muted);
  max-width: 62ch;
}

/* 왼쪽은 사실, 오른쪽 끝은 조작. 가운데 여백이 둘을 가른다. */
.page-status {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 2px;
  font-size: 12px;
  color: var(--text-muted);
  min-height: 32px;
}
.page-status-text { min-width: 0; }
.page-tools {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
  margin-left: auto;          /* 오른쪽 끝으로 민다 */
}
/* 검색칸은 남는 폭을 쓰되 너무 길어지지 않게 한다. */
.page-tools > .feed-search { width: 240px; max-width: 42vw; }

@media (max-width: 900px) {
  .page-head { gap: 5px; padding-bottom: 10px; margin-bottom: 11px; }
  .page-title { font-size: 19px; }
  .page-status { gap: 6px; font-size: 11.5px; }
  /* 좁으면 도구가 제 줄을 쓴다. 억지로 한 줄에 두면 오른쪽이 잘린다. */
  .page-tools { margin-left: 0; flex: 1 1 100%; justify-content: flex-start; }
  .page-tools > .feed-search { width: auto; max-width: none; flex: 1 1 100%; }
}
@media (max-width: 640px) {
  /* 폰에서는 설명이 자리를 많이 먹는다. 제목만으로도 어느 화면인지 알 수 있다. */
  .page-desc { display: none; }
}

/* ── 트리: 펼침 화살표와 채널 IP ─────────────────────────────── */

/* 펼침 화살표. 닫히면 ▶, 열리면 ▼ (90도 회전). 기존 .open 회전을 그대로 쓰되
   눌리는 범위를 넓혀 손가락으로도 집히게 한다. */
.tree-caret { width: 18px; height: 18px; border-radius: 5px; }
.tree-caret:hover { background: var(--surface-muted); }

/* 채널 IP 는 이름 바로 뒤에 괄호로 붙인다 — CH 1 (192.168.0.201) */
.tree-ch-ip { color: var(--text-faint); font-weight: 400; font-size: .92em; }


/* 펼침 화살표를 눈에 띄게.
   전에는 16px 에 흐린 색이라 "화살표가 없다" 고 느껴졌고, 그래서 어디를 눌러야
   열리는지 알 수 없었다. 키우고 진하게 하고, 열리면 90도 돈다(기존 .open 규칙). */
.tree-caret {
  width: 20px;
  height: 20px;
  border-radius: 5px;
  color: var(--text-muted);
}
.tree-caret svg { width: 11px; height: 11px; }
.tree-caret:hover { background: var(--surface-muted); color: var(--text); }
.tree-caret.open { color: var(--text); }
.tree-row.selected .tree-caret { color: var(--text); }
/* 잎 행의 빈 자리도 같은 폭이어야 이름이 세로로 줄을 맞춘다. */
.tree-leaf-indent { width: 20px; }

/* ── 지도 정보 카드: 위는 그림, 아래는 글 ───────────────────────────────
   전에는 96×54 썸네일이 왼쪽에 작게 붙어 무엇이 찍혔는지 알 수 없었다.
   지도에서 핀을 누르는 이유는 "저기 지금 뭐가 보이나" 이므로 그림이 주인공이다. */
.mapcard { width: 320px; }
.mapcard-shot {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  background: var(--thumb-bg);
  color: var(--navy-faint);
  display: flex; align-items: center; justify-content: center;
  overflow: hidden;
}
.mapcard-shot svg { width: 34px; height: 34px; }
.mapcard-shot img { width: 100%; height: 100%; object-fit: cover; display: block; }

.mapcard-head { padding: 10px 12px 8px; display: flex; flex-direction: column; gap: 4px; }
.mapcard-head .mapcard-name-row { display: flex; align-items: center; gap: 7px; min-width: 0; }
.mapcard-head .badge { flex-shrink: 0; align-self: center; }
.mapcard-head .mapcard-name { font-size: 14px; }

@media (max-width: 640px) {
  /* 폰에서는 구글 말풍선이 화면을 거의 다 먹는다. 폭을 화면에 맞춘다. */
  .mapcard { width: min(86vw, 320px); }
}

/* 모달 머리말의 버튼들 */
.ev-modal-actions { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }

/* 기간 입력 옆 안내. 프리셋과 직접 입력 중 무엇이 쓰이는지 말해 준다. */
.es-range-note { font-size: 11.5px; color: var(--text-faint); }
@media (max-width: 640px) { .es-range-note { flex: 1 1 100%; } }

/* ── 모바일 드릴다운 트리 ──────────────────────────────────────────────
   폰에서 3단 트리를 그대로 펼치면 들여쓰기가 깊어져 이름이 설 자리가 없고,
   작은 화살표를 손가락으로 집기도 어렵다. 한 번에 한 단계만 보여 주고
   줄을 크게 만든다. 48px 은 터치 대상 권장치다. */
.dr-list { display: flex; flex-direction: column; padding: 4px; }
.dr-row {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 48px;
  padding: 8px 10px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--text);
  text-align: left;
  font: inherit;
  cursor: pointer;
}
.dr-row:hover { background: var(--hover-bg, rgba(127, 127, 127, .09)); }
.dr-row.selected {
  background: rgba(59, 130, 246, .12);
  box-shadow: inset 3px 0 0 var(--accent);
}
.dr-row[disabled] { cursor: default; }
.dr-row[disabled]:hover { background: transparent; }
.dr-dot-gap { width: 8px; flex-shrink: 0; }

.dr-label { display: flex; flex-direction: column; gap: 1px; min-width: 0; flex: 1; }
.dr-name {
  font-size: 14px; font-weight: 600;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.dr-meta {
  font-size: 11.5px; color: var(--text-faint);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.dr-chev { flex-shrink: 0; color: var(--text-faint); }

/* 뒤로가기는 목록 맨 위에 붙박이로. 지금 어디에 있는지도 같이 말한다. */
.dr-back {
  display: flex; align-items: center; gap: 8px;
  width: 100%; min-height: 44px;
  padding: 8px 10px; margin-bottom: 2px;
  border: 0; border-bottom: 1px solid var(--border);
  border-radius: 0;
  background: transparent; color: var(--text-muted);
  font: inherit; text-align: left; cursor: pointer;
}
.dr-back:hover { color: var(--text); background: var(--hover-bg, rgba(127, 127, 127, .09)); }
.dr-back-main { font-size: 12.5px; font-weight: 700; flex-shrink: 0; }
.dr-back-sub {
  font-size: 12.5px; color: var(--text); font-weight: 700;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.dr-back-sub::before { content: '· '; color: var(--text-faint); }
.dr-empty { padding: 24px 12px; font-size: 12.5px; color: var(--text-faint); text-align: center; }

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .dr-row.selected { background: rgba(96, 165, 250, .17); }
}
:root[data-theme="dark"] .dr-row.selected { background: rgba(96, 165, 250, .17); }

/* ── 상태 필터 탭: 안 고른 것도 바탕과 구분되게 ────────────────────────
   --surface-muted 가 페이지 배경과 거의 같아 "버튼이 거기 있는지" 조차
   보이지 않았다. 테두리를 주고 바탕을 한 톤 올린다. */
.tabs .tab {
  background: var(--surface);
  border-color: var(--border-strong);
  color: var(--text-muted);
}
.tabs .tab:hover { color: var(--text); border-color: var(--n-400); }
.tabs .tab.active {
  background: var(--text);
  border-color: var(--text);
  color: var(--surface);
}

/* ── 채널 들여쓰기 줄이기 ──────────────────────────────────────────────
   채널이 상태 점보다 한참 안쪽에 있어 이름이 설 자리가 좁았다.
   장비 줄의 상태 점 위치까지만 들어가게 한다. */
.tree-row-child { padding-left: 4px; }
.tree-xvms-children { margin-left: 8px; }

/* ── 장비 상태: 전역 검색에서 걸려 들어온 조건 칩 ──────────────────────
   평소에는 없다. "오류 장비 모두 보기" 로 들어왔을 때만 나타나고,
   누르면 조건이 풀린다. 상태 탭 줄을 없앤 뒤 조건을 풀 유일한 길이다. */
.st-filter-chip {
  display: inline-flex; align-items: center; gap: 6px;
  height: 26px; padding: 0 9px;
  border: 1px solid var(--accent); border-radius: 99px;
  background: var(--accent-softer); color: var(--accent-ink);
  font-size: 11.5px; font-weight: 700; cursor: pointer;
}
.st-filter-chip:hover { background: var(--accent-soft); }

/* ── 좁은 자리용 지도 정보 카드 ───────────────────────────────────────
   장비 상세의 '위치' 패널은 높이가 작다. 썸네일이 16:9 로 들어가면 카드가
   패널보다 길어져 **글이 통째로 잘렸다**(= "썸네일만 보인다").
   그림 높이만 줄이고 글은 그대로 둔다. */
/* 좁은 패널(장비 상세의 '위치')용 카드.

   세로로 쌓으면 308px 가 되어 지도 패널보다 길어진다. 말풍선은 핀 위로 자라는데
   핀은 지도 한가운데 있으니 쓸 수 있는 높이가 패널의 절반뿐이다 — 그래서
   구분선 아래가 잘렸다. 썸네일을 **왼쪽으로 돌려** 높이를 절반으로 줄인다.

     ┌──────┬──────────────────┐
     │      │ 이름        [상태]│
     │ 썸네일│ 유형 · IP        │
     │      │ 그룹 / 접속시각…  │
     ├──────┴──────────────────┤
     │ [지금 검사]              │
     └─────────────────────────┘ */
.mapcard-compact {
  /* 폭은 deviceMap.js 가 지도 패널을 재서 인라인으로 넣는다. 여기 값은
     혹시 못 받았을 때의 대비일 뿐이다 — CSS 에 고정 px 로 박아 두면
     패널이 그보다 좁은 화면에서 카드가 지도 밖으로 삐져나가 잘린다. */
  width: 296px;
  max-width: 100%;
  display: grid;
  /* 썸네일 칸을 비율로 준다. 96px 고정일 때는 카드가 넓어져도 썸네일만
     홀쭉해서 object-fit: cover 가 좌우를 크게 잘라 먹었다. */
  grid-template-columns: minmax(104px, 42%) minmax(0, 1fr);
  grid-template-areas:
    "shot head"
    "shot rows"
    "act  act";
  align-items: start;
}
/* 버튼줄이 없는 경우(장비 상세). 남는 높이는 썸네일이 가져간다. */
.mapcard-noact {
  grid-template-areas:
    "shot head"
    "shot rows";
}
.mapcard-noact .mapcard-actions { display: none; }
.mapcard-compact .mapcard-shot {
  grid-area: shot;
  /* **4:3 로 고정한다.** 예전에는 height:100% 로 오른쪽 글 높이에 맞췄는데,
     주소가 두 줄이 되면 세로로 길쭉해지고(240px 폭에서 104x168, 비율 0.62)
     object-fit: cover 가 좌우를 크게 잘라 먹었다. 카메라 영상이 보통 4:3
     (640x480)이라 이 비율이면 잘림이 거의 없다.
     글이 더 길어 남는 자리는 가운데 정렬로 위아래에 나눠 둔다. */
  aspect-ratio: 4 / 3;
  height: auto;
  align-self: center;
  border-radius: 0;
}
.mapcard-compact .mapcard-head { grid-area: head; padding: 8px 10px 4px; gap: 2px; }
/* 닫기 버튼이 말풍선 오른쪽 위에 겹쳐 떠 있다(24px + 여백 6px).
   이름 줄도 거기서 시작하므로 상태 배지가 버튼에 깔렸다.
   **이름 줄만** 비워 둔다 — 아래 IP·표 줄은 버튼 높이 밖이라 폭을 다 쓴다. */
.mapcard-compact .mapcard-name-row { padding-right: 36px; }
.mapcard-compact .mapcard-head .mapcard-name { font-size: 12.5px; }
.mapcard-compact .mapcard-meta { font-size: 11px; line-height: 1.35; }
/* 왼쪽 썸네일과 경계가 이미 있으니 가로줄은 빼고 위 여백만 둔다. */
.mapcard-compact .mapcard-rows {
  grid-area: rows;
  border-top: 0;
  margin-top: 0;
  padding: 0 10px 8px;
}
.mapcard-compact .mapcard-row { padding: 2px 0; font-size: 11px; gap: 8px; }
.mapcard-compact .mapcard-actions {
  grid-area: act;
  padding: 7px 10px 9px;
  border-top: 1px solid var(--border-subtle);
}
.mapcard-compact .mapcard-btn { padding: 5px 9px; font-size: 11.5px; }
/* 주소는 길다. 좁은 칸에서 두 줄까지 보여 주고 그 뒤로는 줄임표. */
.mapcard-compact .mapcard-addr {
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden; white-space: normal; text-align: right;
}

/* 좁은 화면에서도 폭은 deviceMap.js 가 패널을 재서 정한다.
   예전에는 여기서 min(82vw, 290px) 로 잡았는데, 기준이 뷰포트(vw)라
   지도 패널의 실제 폭과 무관했다. 패널이 더 좁으면 그대로 삐져나갔다. */

/* ── 다른 화면에 끼워 넣은 피드 (설정 > 시스템 로그) ────────────────────
   제목줄·갱신 버튼은 바깥 화면이 이미 갖고 있다. 여기서는 검색과 목록만. */
.feed-inline { display: flex; flex-direction: column; gap: 10px; }
.feed-inline-bar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.feed-inline-bar .feed-search { flex: 1 1 240px; min-width: 0; }
.feed-inline-sub { font-size: 11.5px; color: var(--text-faint); white-space: nowrap; }

@media (max-width: 640px) {
  .feed-inline-sub { flex: 1 1 100%; }
}

/* ── 폰: 설정 목록을 '이름 + 작업' 한 장으로 ──────────────────────────
   768px 이하에서 표는 카드로 세워진다. 그런데 열이 많아 장비 한 대가 6줄,
   그룹 하나가 5줄을 먹어 10건만 돼도 스크롤이 끝없이 길어졌다.
   여기는 '고치러 오는 곳' 이지 '값을 읽는 곳' 이 아니다 — 이름으로 찾아
   누르면 되므로, 폰에서는 이름·상태점·작업만 남긴다.
   나머지 값은 [수정] 을 눌러 모달에서 본다. */
@media (max-width: 640px) {
  .set-table tbody td {
    display: none;
  }
  .set-table tbody td.set-col-check,
  .set-table tbody td.set-col-led,
  .set-table tbody td.set-cell-name,
  .set-table tbody td.set-col-act,
  .set-table tbody td.rt-full {
    display: flex;
  }
  /* 한 줄짜리 카드가 되므로 위아래 여백과 구분선을 줄인다. */
  .set-table tbody tr {
    padding: 10px 12px; margin-bottom: 8px; gap: 0 8px;
  }
  .set-table tbody td.set-cell-name { padding-bottom: 0; font-size: 14px; }
  .set-table tbody td.set-col-act {
    flex: 0 0 auto;
    padding-top: 0; margin-top: 0; border-top: 0;
  }
  /* 작업 아이콘은 손가락으로 집을 수 있어야 한다. */
  .set-table tbody td.set-col-act .set-icon { width: 34px; height: 34px; }
}

/* ── 미리보기: 새 그림이 올라온 순간을 알린다 ────────────────────────────
   1초마다 갱신해도 바뀐 줄 모르면 화면이 살아 있는지 알 수 없다.
   새 스냅샷이 들어왔을 때만 한 번 번쩍인다(같은 그림이면 아예 교체하지 않는다). */
@keyframes preview-flash {
  from { opacity: .45; }
  to   { opacity: 1; }
}
.preview-flash { animation: preview-flash .32s ease-out; }

.preview-caption {
  display: flex; align-items: center; gap: 6px; justify-content: space-between;
}
.preview-src {
  flex-shrink: 0;
  padding: 1px 7px; border-radius: 99px;
  background: rgba(255, 255, 255, .14);
  font-size: 10.5px; font-weight: 700;
}

@media (prefers-reduced-motion: reduce) {
  .preview-flash { animation: none; }
}

/* ── 라이브 영상 ──────────────────────────────────────────────────────
   NVR 채널을 포털 안에서 바로 본다. 색은 전부 테마 변수를 쓰므로
   다크/라이트가 따로 손댈 것 없이 따라온다. */
.live-modal {
  position: fixed; z-index: 81;
  top: 50%; left: 50%; transform: translate(-50%, -50%);
  width: min(880px, calc(100vw - 32px));
  /* 세로로도 뷰포트를 넘지 않는다. 넘으면 머리말과 채널 칩이 화면 밖으로
     밀려 닫기 버튼조차 누를 수 없게 된다(가로로 눕힌 폰에서 실제로 그렇다).
     dvh 는 모바일 주소창이 접혔다 펴지는 것까지 따라간다. */
  max-height: 92vh;
  max-height: 92dvh;
  display: flex; flex-direction: column;
  background: var(--bg);
  border: 1px solid var(--border); border-radius: 14px;
  box-shadow: 0 24px 64px var(--shadow-color);
  animation: mgmt-in .16s ease-out;
  overflow: hidden;
}
.live-modal .mgmt-head { gap: 8px; }
.live-modal .mgmt-title { flex: 1; min-width: 0; overflow: hidden;
  text-overflow: ellipsis; white-space: nowrap; }
.live-state {
  flex-shrink: 0; font-size: 11px; font-weight: 700;
  color: var(--text-muted);
  padding: 2px 8px; border: 1px solid var(--border); border-radius: 999px;
}

/* 영상 자리. 16:9 로 고정해 두면 연결 중에도 창 크기가 튀지 않는다.
   다만 창이 뷰포트에 걸리면 이 칸이 먼저 줄어든다(flex: 0 1 auto).
   영상은 object-fit: contain 이라 줄어도 잘리지 않고 레터박스가 생긴다. */
.live-stage {
  position: relative;
  flex: 0 1 auto; min-height: 0;
  aspect-ratio: 16 / 9;
  background: #000;
}
.live-stage video {
  width: 100%; height: 100%; object-fit: contain; display: block;
}
.live-overlay {
  position: absolute; inset: 0;
  display: grid; place-content: center;
  padding: 16px; text-align: center;
  font-size: 13px; color: #e8eaed;
  background: rgba(0, 0, 0, .55);
}
.live-overlay.is-error { color: var(--err-text); }
.live-overlay[hidden] { display: none; }

/* 채널 고르기. 하위 장비가 둘 이상일 때만 나온다. */
.live-chans {
  display: flex; flex-wrap: wrap; gap: 6px;
  padding: 10px 14px;
  background: var(--surface); border-top: 1px solid var(--border);
  /* 채널이 많으면(16채널 녹화기) 칩이 여러 줄이 된다. 그만큼 영상이
     밀려나지 않도록 높이를 묶고 안에서 구르게 한다. */
  flex: 0 0 auto; max-height: 76px; overflow-y: auto;
}
.live-chan {
  font-size: 12px; padding: 4px 10px;
  color: var(--text-muted); background: var(--bg);
  border: 1px solid var(--border); border-radius: 999px;
  cursor: pointer;
}
.live-chan:hover { color: var(--text); }
.live-chan.is-on {
  color: var(--accent-text, #fff); background: var(--accent, #2f6fed);
  border-color: var(--accent, #2f6fed); font-weight: 700;
}
.live-foot {
  display: flex; gap: 14px;
  padding: 8px 14px; font-size: 11px; color: var(--text-muted);
  background: var(--surface); border-top: 1px solid var(--border);
}

/* 라이브를 여는 버튼. 하위 장비 줄과 미리보기 패널에 붙는다. */
.live-btn {
  display: inline-flex; align-items: center; gap: 4px;
  flex-shrink: 0;
  font-size: 11px; font-weight: 700;
  padding: 2px 8px;
  color: var(--text-muted); background: var(--bg);
  border: 1px solid var(--border); border-radius: 999px;
  cursor: pointer;
}
.live-btn:hover { color: var(--text); border-color: var(--text-muted); }
.live-btn svg { width: 11px; height: 11px; }

/* 좁은 화면에서는 아래에서 올라오는 시트로. 모달을 가운데 띄우면
   폰에서는 위아래 여백만 남고 영상이 작아진다. */
@media (max-width: 640px) {
  .live-modal {
    top: auto; bottom: 0; left: 0; transform: none;
    width: 100vw; max-width: 100vw;
    border-radius: 14px 14px 0 0;
    animation: none;
  }
  .live-foot { flex-wrap: wrap; gap: 8px; }
  .live-chans { max-height: 64px; }
}

/* 가로로 누운 폰. 세로 공간이 거의 없으므로 영상에 몰아 준다. */
@media (max-height: 520px) {
  .live-modal .mgmt-head { padding: 7px 12px; }
  .live-chans { max-height: 40px; padding: 5px 12px; }
  .live-foot { padding: 4px 12px; }
}
@media (prefers-reduced-motion: reduce) {
  .live-modal { animation: none; }
}

/* ── 그룹 구성 팝업 ───────────────────────────────────────────────────
   왼쪽에서 그룹을 고르고, 오른쪽 탭에서 체크로 소속을 정한다.
   장비·사용자를 만들거나 지우는 곳이 아니라 '속하냐 아니냐' 만 다룬다. */
.mgmt-modal.gm-wide {
  width: min(1120px, calc(100vw - 32px));
  /* **크기를 고정한다.** 목록이 두 줄이든 쉰 줄이든 창은 그대로다.
     max-height 로 두면 내용에 따라 창이 줄었다 늘었다 해서, 그룹을 바꿀 때마다
     저장 버튼과 탭의 자리가 움직인다. 같은 자리에 있어야 눈이 덜 피로하다. */
  height: min(88vh, 880px);
  max-height: min(88vh, 880px);
}
/* 본문은 스크롤하지 않는다. 안쪽 목록 두 곳이 각자 구른다 —
   바깥까지 구르면 탭과 저장 버튼이 화면 밖으로 밀려난다. */
.mgmt-modal.gm-wide .mgmt-body {
  display: flex; flex-direction: column;
  overflow: hidden; padding: 12px 14px 14px;
}
.mgmt-modal.gm-wide .gm-wrap { flex: 1; min-height: 0; }
/* 그룹 목록은 행 아무 데나 누르면 열린다. 누를 수 있다는 것이 보여야 한다. */
.set-table tr.set-row-click { cursor: pointer; }
.set-table tr.set-row-click:hover { background: var(--surface-muted); }
.set-table tr.set-row-click:hover .set-link { text-decoration: underline; }
.gm-wrap {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  gap: 14px;
  min-height: 0;
}

/* 왼쪽 그룹 목록 */
.gm-side {
  display: flex; flex-direction: column; min-height: 0;
  border: 1px solid var(--border); border-radius: 10px;
  background: var(--surface);
  overflow: hidden;
}
.gm-side-head {
  padding: 9px 12px; font-size: 11.5px; font-weight: 800;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
}
.gm-group-list { flex: 1; min-height: 0; overflow-y: auto; padding: 6px; }
.gm-group {
  display: block; width: 100%; text-align: left;
  padding: 8px 10px; margin-bottom: 4px;
  border: 1px solid transparent; border-radius: 8px;
  background: none; color: var(--text); cursor: pointer;
}
.gm-group:hover { background: var(--surface-muted); }
.gm-group.on {
  background: var(--accent); border-color: var(--accent); color: var(--on-accent);
}
.gm-group-name { display: block; font-size: 13px; font-weight: 700; }
.gm-group-sub { display: block; font-size: 11px; opacity: .75; margin-top: 2px; }

/* 오른쪽 */
.gm-main { display: flex; flex-direction: column; min-height: 0; }
/* 탭은 '같은 자리에서 내용만 갈아끼운다' 는 뜻이다. 알약 모양은 버튼으로
   읽히고 활성 알약은 검게 채워져 더 그렇다. 밑줄이 그 관계를 가장 흔하게 나타낸다. */
.gm-tabs {
  flex-shrink: 0;
  gap: 2px;
  border-bottom: 1px solid var(--border);
}
.gm-tabs .tab {
  position: relative;
  padding: 9px 18px 10px;
  border: 0; border-radius: 8px 8px 0 0;
  background: none; color: var(--text-muted);
  font-size: 13px; font-weight: 700;
  cursor: pointer;
}
.gm-tabs .tab:hover { background: var(--surface-muted); color: var(--text); }
.gm-tabs .tab.active { background: none; color: var(--accent); }
/* 밑줄은 테두리가 아니라 따로 그린다 — 컨테이너의 1px 선을 덮어야 이어져 보인다. */
.gm-tabs .tab.active::after {
  content: ''; position: absolute;
  left: 10px; right: 10px; bottom: -1px; height: 2px;
  background: var(--accent); border-radius: 2px 2px 0 0;
}
.gm-bar {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 0 8px; flex-shrink: 0;
}
.gm-title { font-size: 13px; font-weight: 800; }
.gm-count { font-size: 11.5px; color: var(--text-muted); }
.gm-search {
  margin-left: auto; width: min(260px, 45%);
  padding: 6px 10px; font-size: 12px;
  color: var(--text); background: var(--surface);
  border: 1px solid var(--border); border-radius: 7px;
}
.gm-search:focus { outline: none; border-color: var(--accent); }
.gm-readonly { margin: 0 0 8px; }

.gm-list {
  flex: 1; min-height: 0; overflow-y: auto;
  border: 1px solid var(--border); border-radius: 10px;
  padding: 6px;
  /* 모달 배경(--bg)과 같은 값이면 경계가 사라진다. 목록은 한 장의 종이로 띄운다. */
  background: var(--surface);
}

/* 한 줄 = 한 장비 / 한 사람.
   체크가 꺼진 줄은 흐리게 둔다 — 지금 이 그룹의 것이 아님이 한눈에 보여야 한다.
   체크하면 글자가 제 색으로 돌아온다. */
.gm-row {
  display: flex; align-items: center; gap: 10px;
  padding: 7px 10px; border-radius: 8px;
  cursor: pointer; opacity: .45;
  transition: opacity .1s, background .1s;
}
.gm-row:hover { background: var(--surface-muted); }
.gm-row.on { opacity: 1; }
/* 저장하지 않은 줄은 왼쪽에 표시를 남긴다. 무엇을 건드렸는지 잊지 않게. */
.gm-row.changed { box-shadow: inset 3px 0 0 var(--accent); }
.gm-row input[type="checkbox"] { flex-shrink: 0; width: 15px; height: 15px; cursor: pointer; }
.gm-row input[type="checkbox"]:disabled { cursor: default; }

.gm-cells {
  flex: 1; min-width: 0;
  display: grid; align-items: center; gap: 10px;
  grid-template-columns: minmax(0, 1.4fr) 68px 118px 142px minmax(0, 1fr);
  font-size: 12px;
}
.gm-cell { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gm-cell-name { font-weight: 700; }
.gm-cell-type, .gm-cell-sub { color: var(--text-muted); font-size: 11.5px; }

/* 사용자 탭은 칸이 둘뿐이다. */
.gm-cells-user { grid-template-columns: minmax(0, 1fr) minmax(0, 1.6fr); }

/* 역할 고르기. 선택지가 둘뿐이라 드롭다운보다 토글이 빠르다 —
   펼치지 않고 한 번에 누를 수 있고, 지금 무엇인지도 그대로 보인다. */
/* 역할 자리는 체크 여부와 상관없이 **늘 같은 폭**을 차지한다.
   접어 버리면 그만큼 왼쪽 칸이 넓어져 이메일 열이 줄마다 어긋났다.
   visibility 는 자리를 지키면서 탭 순서와 읽기에서도 빠진다. */
.gm-roles {
  flex: 0 0 132px;
  display: inline-flex; justify-content: flex-end; gap: 0;
}
.gm-roles.off { visibility: hidden; }
.gm-role {
  font-size: 11.5px; padding: 3px 10px;
  color: var(--text-muted); background: var(--bg);
  border: 1px solid var(--border); cursor: pointer;
}
.gm-role:first-child { border-radius: 999px 0 0 999px; }
.gm-role:last-child { border-radius: 0 999px 999px 0; border-left: 0; }
.gm-role.on {
  color: var(--on-accent); background: var(--accent);
  border-color: var(--accent); font-weight: 700;
}
.gm-role:disabled { cursor: default; opacity: .6; }

.gm-foot {
  display: flex; align-items: center; gap: 8px;
  padding-top: 10px; flex-shrink: 0;
}
.gm-dirty { font-size: 11.5px; color: var(--text-muted); }
.gm-dirty.on { color: var(--accent); font-weight: 700; }
/* .btn 이 기본으로 폭을 꽉 채우도록 돼 있어 그대로 두면 푸터 버튼이 거대해진다. */
.gm-foot .btn { flex: 0 0 auto; width: auto; min-width: 88px; padding: 7px 18px; }
.gm-foot .btn:first-of-type { margin-left: auto; }
.gm-dirty { flex: 0 1 auto; }
.gm-ok { color: var(--ok-text, var(--text-muted)); }

.gm-confirm { margin: 10px 0; padding-left: 18px; font-size: 12.5px; line-height: 1.7; }
.gm-blocked { margin-top: 10px; }
.gm-blocked ul { margin: 6px 0 6px 18px; line-height: 1.6; }

/* 좁은 화면 — 그룹 목록을 위로 올려 가로로 흐르게 둔다. */
@media (max-width: 860px) {
  .mgmt-modal.gm-wide { width: calc(100vw - 20px); }
  .gm-wrap { grid-template-columns: minmax(0, 1fr); }
  .gm-side { max-height: 128px; }
  .gm-group-list { display: flex; gap: 6px; overflow-x: auto; }
  .gm-group { width: auto; flex: 0 0 auto; margin-bottom: 0; }
  .gm-cells { grid-template-columns: minmax(0, 1fr) 60px; }
  .gm-cells .gm-cell:nth-child(n + 3) { display: none; }
  .gm-search { width: 100%; margin-left: 0; }
  .gm-bar { flex-wrap: wrap; }
}


/* =====================================================================
   하단 탭바 (좁은 화면 전용) — docs/02_SCREENS_MOBILE.md §2
   모바일의 1차 내비. 넓은 화면(>900px)에서는 상단 메뉴가 있으므로 숨긴다.
   900px 은 mobileMenu.js 의 BREAKPOINT 와 같아야 한다.
   ===================================================================== */
.tabbar { display: none; }

@media (max-width: 900px) {
  .tabbar {
    /* 1차 메뉴 4개: 장비 · 결제 · 게시판 · 설정 (docs/08_MENU_IA.md) */
    display: grid; grid-template-columns: repeat(4, 1fr);
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 60;
    height: calc(56px + env(safe-area-inset-bottom, 0px));
    padding-bottom: env(safe-area-inset-bottom, 0px);
    background: var(--surface); border-top: 1px solid var(--border);
  }
  .tabbar-item {
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
    min-height: 44px; padding: 0; margin: 0;
    font: inherit; font-size: 10.5px; font-weight: 700; letter-spacing: .01em;
    color: var(--text-faint); text-decoration: none; background: transparent; border: 0; cursor: pointer;
    -webkit-tap-highlight-color: transparent;
  }
  .tabbar-item svg { width: 22px; height: 22px; }
  .tabbar-item.active { color: var(--accent); }
  .tabbar-item.active svg { stroke-width: 2.4; }
  .tabbar-item:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; border-radius: 8px; }

  /* 본문 끝이 탭바 뒤에 숨지 않게 그만큼 띄운다 */
  .app-shell { padding-bottom: calc(56px + env(safe-area-inset-bottom, 0px)); }
  /* 서랍(mobile-menu)은 탭바 위에 덮인다. 탭바에 '더보기' 가 없어졌으므로(탭 4개)
     테마·로그아웃이 든 서랍은 상단 햄버거로 연다. */
  .mobile-menu, .mobile-menu-backdrop { z-index: 70; }
}

@media (max-width: 900px) and (prefers-reduced-motion: no-preference) {
  .tabbar-item { transition: color .12s ease; }
}


/* ===== 설정 > 주차 · QR (parkingSettings.js) ===== */
.pk-intro { margin: 0 0 14px; line-height: 1.6; }
.pk-list { display: flex; flex-direction: column; gap: 14px; }
.pk-card { padding: 16px 18px; display: flex; flex-direction: column; gap: 12px; }
.pk-head { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; flex-wrap: wrap; }
.pk-name { font-size: 15px; font-weight: 800; display: flex; align-items: center; gap: 8px; }
.pk-meta { font-size: 12px; color: var(--text-muted); margin-top: 4px; line-height: 1.6; }
.pk-ok { color: var(--ok-text); font-weight: 700; }
.pk-bad { color: var(--err-text); font-weight: 700; }
.pk-muted { color: var(--text-faint); }
.pk-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.pk-form { display: flex; flex-direction: column; gap: 10px; }
.pk-check { display: flex; align-items: center; gap: 8px; font-size: 13.5px; font-weight: 700; }
.pk-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 10px; }
.pk-extra { border-top: 1px solid var(--border-subtle); padding-top: 12px; }
.pk-qr { display: flex; gap: 16px; flex-wrap: wrap; align-items: flex-start; }
.pk-qr-img { width: 200px; height: 200px; flex-shrink: 0; background: #FFFFFF; border-radius: 10px; padding: 6px; }
.pk-qr-img svg { width: 100%; height: 100%; display: block; }
.pk-qr-side { flex: 1; min-width: 200px; display: flex; flex-direction: column; gap: 8px; }
.pk-qr-url code { font-size: 12px; word-break: break-all; }
.pk-qr-btns { display: flex; gap: 6px; flex-wrap: wrap; }
.pk-hist-sum { font-size: 13px; color: var(--text-muted); margin-bottom: 8px; }
.pk-st { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 11.5px; font-weight: 700; background: var(--off-bg); color: var(--off-text); }
.pk-st-PAID { background: var(--ok-bg); color: var(--ok-text); }
.pk-st-FAILED, .pk-st-NOTIFY_PENDING { background: var(--err-bg); color: var(--err-text); }
.pk-st-REFUNDED, .pk-st-EXPIRED { background: var(--warn-bg); color: var(--warn-text); }
/* 주차 · QR 화면 전용. 전역 .status-dot 를 다시 정의하면 트리·목록의 .dot-ONLINE 초록이 회색으로 덮인다. */
.pk-name .status-dot { width: 9px; height: 9px; }
.pk-name .status-dot.ok { background: var(--ok-dot); }
.pk-name .status-dot.err { background: var(--err-dot); }
@media (max-width: 640px) {
  .pk-qr-img { width: 160px; height: 160px; }
}


/* ===== 지도 화면 장소·주소 검색 (placeSearch.js) ===== */
.map-place-field { position: relative; flex: 1 1 260px; min-width: 200px; max-width: 420px; }
.map-place-field .feed-search { width: 100%; }
.map-place-field .addr-list { min-width: 280px; }
.map-search-info { font-size: 12.5px; line-height: 1.5; color: var(--n-800); padding: 2px 4px; }
.map-search-info strong { font-size: 13.5px; }


/* ===== 장비 QR 모달 (qrModal.js) ===== */
.qr-modal {
  position: fixed; z-index: 81; top: 50%; left: 50%; transform: translate(-50%, -50%);
  width: min(560px, calc(100vw - 24px)); max-height: 92dvh; overflow: auto;
  background: var(--surface); border: 1px solid var(--border); border-radius: 14px;
  box-shadow: 0 24px 64px var(--shadow-color); animation: fade-in .14s ease-out;
}
.qr-modal-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 14px 16px; border-bottom: 1px solid var(--border-subtle); }
.qr-modal-title { font-size: 15px; font-weight: 800; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.qr-modal-body { padding: 16px; }
.qr-modal-hint { margin: 0; }
/* 장비 탭 카드의 QR 아이콘 */
.st-qr {
  margin-left: auto; flex-shrink: 0; display: inline-flex; align-items: center; justify-content: center;
  min-width: 30px; height: 22px; padding: 0 6px; border-radius: 6px; border: 1px solid var(--border-strong);
  background: var(--surface); color: var(--text-muted); font: inherit; font-size: 10.5px; font-weight: 800; letter-spacing: .04em; cursor: pointer;
}
.st-qr:hover { color: var(--accent); border-color: var(--accent); }


/* =====================================================================
   2단계 (docs/08_MENU_IA.md) — 모바일 트리 서랍 · 장비 목록 필터 · 차단기
   ===================================================================== */

/* 좁은 화면: 장비 트리는 본문 위에 쌓지 않고 서랍으로 연다 (treeDrawer.js 가 body 에 클래스를 단다).
   그룹 고르기는 장비 화면의 그룹 칩과 그룹 묶음 목록이 맡는다. */
@media (max-width: 900px) {
  #sidebar-monitor { display: none; }
  body.tree-drawer-open #sidebar-monitor {
    display: flex; flex-direction: column;
    position: fixed; top: 0; left: 0; bottom: 0; z-index: 75;
    width: min(320px, 86vw); max-height: none;
    background: var(--surface); border-right: 1px solid var(--border);
    box-shadow: 0 10px 40px rgba(0, 0, 0, .25); overflow-y: auto;
  }
  .tree-drawer-backdrop { position: fixed; inset: 0; z-index: 74; background: rgba(15, 23, 42, .4); }
}

/* 장비 목록: 상태 칩 · 검색 */
.st-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 0 0 14px; }
.st-chips { display: flex; gap: 6px; flex-wrap: wrap; }
.st-chip {
  display: inline-flex; align-items: center; gap: 6px; min-height: 36px; padding: 0 12px;
  border: 1px solid var(--border); border-radius: 999px; background: var(--surface);
  color: var(--text-muted); font-size: 13px; font-weight: 700; cursor: pointer;
}
.st-chip b { font-weight: 800; color: var(--text); }
.st-chip.on { background: var(--accent-soft); border-color: var(--accent); color: var(--text); }
.st-chip i { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.st-chip i.ok { background: var(--ok-dot); }
.st-chip i.off { background: var(--text-faint, #98a2b3); }
.st-chip i.bad { background: var(--err-dot); }
.st-search { flex: 1 1 200px; min-width: 0; height: 36px; padding: 0 12px; border: 1px solid var(--border);
  border-radius: 10px; background: var(--surface); color: var(--text); font-size: 14px; }

/* 카드의 [차단기 열기] — 민원 대응이라 상세에 들어가지 않고 바로 누른다 */
.st-barrier {
  display: inline-flex; align-items: center; justify-content: center; gap: 4px;
  min-height: 36px; padding: 0 12px; border: 0; border-radius: 9px;
  background: var(--accent, #2563eb); color: #fff; font-size: 13px; font-weight: 800; cursor: pointer; white-space: nowrap;
}
.st-barrier:disabled { opacity: .4; cursor: not-allowed; }
.st-actions-row { display: flex; gap: 8px; align-items: center; margin-top: 8px; }
.st-actions-row .st-barrier { flex: 1; }

/* 차단기 빠른 열기 창 */
.br-quick-hint { margin: 0 0 12px; }
.br-quick-list { display: grid; gap: 10px; }
.br-quick-btn {
  display: flex; flex-direction: column; align-items: flex-start; gap: 2px; width: 100%;
  min-height: 64px; padding: 12px 16px; border: 0; border-radius: 12px;
  background: var(--accent, #2563eb); color: #fff; cursor: pointer; text-align: left;
}
.br-quick-btn:disabled { opacity: .5; }
.br-quick-name { font-size: 12px; opacity: .85; }
.br-quick-no { font-size: 18px; font-weight: 900; }
.br-quick-msg, .br-msg { margin-top: 10px; font-size: 13px; font-weight: 700; min-height: 18px; }
.br-quick-msg.ok, .br-msg.ok { color: var(--ok-text, #027a48); }
.br-quick-msg.error, .br-msg.error { color: var(--err-text, #b42318); }

/* 장비 상세 '차단기' 칸 */
.br-host { height: 100%; overflow-y: auto; }
.br-panel { display: flex; flex-direction: column; gap: 14px; padding: 4px 2px; }
.br-section { display: flex; flex-direction: column; gap: 8px; }
.br-section-title { font-size: 12px; font-weight: 800; color: var(--text-faint); display: flex; gap: 8px; align-items: baseline; }
.br-ro { font-weight: 600; color: var(--text-faint); font-size: 11px; }
.br-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.br-row-name { font-weight: 800; }
.br-row-btns { display: flex; gap: 6px; flex-wrap: wrap; }
.br-row-btns .btn-inline { min-height: 36px; }
.br-check { display: flex; align-items: center; gap: 8px; font-size: 14px; min-height: 32px; }
.br-check input { width: 18px; height: 18px; }
.br-sub { color: var(--text-faint); font-size: 12px; }
.br-hours { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; font-size: 14px; }
.br-hours select { height: 34px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); color: var(--text); padding: 0 6px; }
.br-empty { color: var(--text-faint); font-size: 13px; }
.br-log { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; font-size: 12px; }
.br-log li { display: grid; grid-template-columns: auto auto 1fr; gap: 8px; }
.br-log li.fail { color: var(--err-text, #b42318); }
.br-log-time { color: var(--text-faint); white-space: nowrap; }
.br-row-btns .br-btn-open, .br-panel [data-br-save] { background: var(--accent); color: #fff; }
.br-panel .form-hint { font-size: 12px; margin: 0; }

/* ===== 결제 메뉴 (payments.js, docs/08_MENU_IA.md 3단계) ===== */
.pay-tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin: 0 0 16px; overflow-x: auto; scrollbar-width: none; }
.pay-tabs::-webkit-scrollbar { display: none; }
.pay-tab {
  flex: none; padding: 10px 14px; font-size: 14px; font-weight: 700; color: var(--text-muted);
  text-decoration: none; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap;
}
.pay-tab.on { color: var(--text); border-bottom-color: var(--accent); }
.pay-tab:hover { color: var(--text); }

.pay-kpis { display: grid; gap: 10px; margin-bottom: 14px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.pay-kpi { min-height: 84px; padding: 12px 14px; text-align: left; font: inherit; color: inherit; }
.pay-kpi .ov-kpi-value { font-size: clamp(20px, 2vw, 28px); font-weight: 800; color: var(--text); font-variant-numeric: tabular-nums; }
button.pay-kpi { cursor: pointer; }
button.pay-kpi:hover { border-color: var(--accent); }
@media (min-width: 900px) { .pay-kpis { grid-template-columns: repeat(5, minmax(0, 1fr)); } }

.pay-empty-hint { margin-bottom: 14px; }
.pay-grid { display: grid; gap: 14px; grid-template-columns: 1fr; }
@media (min-width: 1100px) {
  .pay-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .pay-grid > :first-child { grid-row: span 2; }
}
.pay-card { padding: 16px; }
.pay-card-title { margin: 0 0 12px; font-size: 14px; font-weight: 800; color: var(--text); }
.pay-card-title span { font-size: 12px; font-weight: 600; color: var(--text-faint); margin-left: 6px; }

/* 주차장별 가로 막대: 한 계열(accent), 값은 글자로 */
.pay-hbars { display: flex; flex-direction: column; gap: 4px; }
.pay-hbar {
  display: grid; grid-template-columns: minmax(80px, 34%) 1fr auto; align-items: center; gap: 10px;
  padding: 6px 4px; border: 0; background: none; border-radius: 8px; cursor: pointer; text-align: left; color: var(--text);
  font: inherit;
}
.pay-hbar:hover { background: var(--surface-sunken); }
.pay-hbar-name { font-size: 13px; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pay-hbar-track { height: 12px; background: var(--surface-sunken); border-radius: 0 4px 4px 0; overflow: hidden; }
.pay-hbar-track i { display: block; height: 100%; background: var(--accent); border-radius: 0 4px 4px 0; }
.pay-hbar-val { font-size: 13px; font-weight: 800; text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.pay-hbar-val small { display: block; font-size: 11px; font-weight: 600; color: var(--text-faint); }

/* 시간대·요일 세로 막대 */
.pay-cols { display: grid; grid-template-columns: repeat(var(--n), minmax(0, 1fr)); gap: 2px; align-items: end; height: 150px; }
.pay-col { display: flex; flex-direction: column; align-items: stretch; height: 100%; }
.pay-col-bar { flex: 1; display: flex; align-items: flex-end; border-bottom: 1px solid var(--border); }
.pay-col-bar i { display: block; width: 100%; background: var(--accent); border-radius: 4px 4px 0 0; }
.pay-col:hover .pay-col-bar i { background: var(--accent-ink); }
.pay-col-label { height: 18px; font-size: 11px; color: var(--text-faint); text-align: center; line-height: 18px; }
.pay-chart-note { margin: 8px 0 0; font-size: 12.5px; color: var(--text-muted); }
.pay-chart-empty { padding: 28px 0; }
.pay-table-toggle { margin-top: 8px; font-size: 12.5px; color: var(--text-muted); }
.pay-table-toggle summary { cursor: pointer; }
.pay-table-toggle table { margin-top: 8px; }
.pay-tip {
  position: fixed; z-index: 90; pointer-events: none; padding: 6px 10px; border-radius: 8px;
  background: var(--n-900, #101828); color: #fff; font-size: 12.5px; font-weight: 700; white-space: nowrap;
  box-shadow: 0 6px 20px rgba(0, 0, 0, .2);
}

/* 내역 */
.pay-filters { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 10px; }
.pay-filters select, .pay-filters input[type="date"] {
  height: 36px; padding: 0 10px; border: 1px solid var(--border); border-radius: 10px;
  background: var(--surface); color: var(--text); font-size: 14px; max-width: 100%;
}
.pay-f-custom { display: inline-flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.pay-f-custom[hidden] { display: none; }
.pay-status-chips { margin-bottom: 10px; }
.pay-sum { font-size: 13px; color: var(--text-muted); margin: 0 0 10px; }
.pay-sum strong { color: var(--text); font-size: 15px; margin-left: 4px; }
.pay-table-card { padding: 0; overflow: hidden; }
.pay-row { cursor: pointer; }
.pay-row:hover td { background: var(--surface-sunken); }
.pay-row:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.pay-amt { font-weight: 800; font-variant-numeric: tabular-nums; white-space: nowrap; }
.pay-muted { color: var(--text-faint); font-weight: 500; }
.pay-small { font-size: 11.5px; word-break: break-all; }
.pay-more { display: flex; justify-content: center; margin: 12px 0; }
.pay-ok { color: var(--ok-text); font-weight: 700; }
.pay-bad { color: var(--err-text); font-weight: 700; }

/* 결제 상세 창 (폰: 아래에서 올라오는 시트) */
.pay-detail-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.pay-detail-amt { font-size: 24px; font-weight: 900; font-variant-numeric: tabular-nums; }
.pay-dl { margin: 0; display: grid; border-top: 1px solid var(--border-subtle); }
.pay-dl-row { display: grid; grid-template-columns: 120px 1fr; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--border-subtle); font-size: 13.5px; }
.pay-dl-row dt { color: var(--text-muted); font-weight: 700; }
.pay-dl-row dd { margin: 0; min-width: 0; }
.pay-cancel { margin-top: 16px; padding: 14px; border: 1px solid var(--err-bg); border-radius: 12px; background: var(--surface-head); display: flex; flex-direction: column; gap: 8px; }
.pay-cancel-title { font-weight: 800; color: var(--err-text); }
.pay-cancel .form-hint { margin: 0; }
.pay-cancel-label { font-size: 12.5px; font-weight: 700; color: var(--text-muted); }
.pay-cancel input { height: 40px; padding: 0 12px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); color: var(--text); font-size: 14px; }
.pay-cancel-btn { min-height: 44px; background: var(--err-dot); color: #fff; border: 0; border-radius: 10px; font-weight: 800; cursor: pointer; }
.pay-cancel-btn:disabled { opacity: .6; cursor: progress; }
.pay-cancel-msg { font-size: 13px; font-weight: 700; }
.pay-cancel-msg:empty { display: none; }
.pay-cancel-msg.error { color: var(--err-text); }
.pay-cancel-msg.ok { color: var(--ok-text); }
@media (max-width: 640px) {
  .qr-modal.pay-detail {
    top: auto; bottom: 0; left: 0; right: 0; transform: none; width: 100%;
    max-height: 88dvh; border-radius: 16px 16px 0 0; padding-bottom: env(safe-area-inset-bottom);
  }
  .pay-dl-row { grid-template-columns: 104px 1fr; }
}

/* QR 탭 */
.pay-qr-bar { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-bottom: 6px; }
.pay-qr-hint { margin: 0 0 10px; }
.pay-qr-list { padding: 0; }
.pay-qr-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 14px; border-bottom: 1px solid var(--border-subtle); }
.pay-qr-row:last-child { border-bottom: 0; }
.pay-qr-pick { display: flex; align-items: flex-start; gap: 10px; min-width: 0; cursor: pointer; }
.pay-qr-pick input { width: 18px; height: 18px; margin-top: 2px; flex: none; }
.pay-qr-pick strong { display: block; font-size: 14px; }
.pay-qr-meta { display: block; font-size: 12.5px; color: var(--text-muted); margin-top: 2px; }
#pay-qr-msg { margin-top: 10px; }
.pay-qr-row .btn-inline { flex: none; white-space: nowrap; }
@media (max-width: 640px) { .pay-tab { padding: 10px 11px; } }

/* 폰: 결제 내역 한 건 = 3줄 카드 (차량·금액 / 주차장·상태 / 시각·등록 시간).
   설정 목록용 '이름만 남기기' 규칙(640px 이하 td 숨김)을 여기서는 되돌린다. */
@media (max-width: 640px) {
  .pay-table tbody tr {
    display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 2px 10px;
    grid-template-areas: "plate amt" "dev st" "time st";
    padding: 12px 14px; margin: 0; border-bottom: 1px solid var(--border-subtle); border-radius: 0;
  }
  .pay-table tbody td { display: block; padding: 0; border: 0; min-width: 0; }
  .pay-table tbody td::before { content: none; }
  .pay-table .pay-c-plate { grid-area: plate; font-size: 15px; font-weight: 800; }
  .pay-table .pay-c-amt { grid-area: amt; font-size: 15px; text-align: right; }
  .pay-table .pay-c-dev { grid-area: dev; font-size: 12.5px; color: var(--text-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .pay-table .pay-c-st { grid-area: st; justify-self: end; align-self: center; }
  .pay-table .pay-c-time { grid-area: time; font-size: 12px; color: var(--text-faint); }
  .pay-table .pay-c-min { display: none; }
  .pay-table-card .set-table-wrap { border: 0; }
}

/* ===== 게시판: 자료실 · 커뮤니티 (board.js, docs/08_MENU_IA.md 4단계) ===== */
.bd-bar { display: flex; flex-direction: column; gap: 8px; margin-bottom: 12px; }
.bd-desc { margin: 0; }
.bd-bar-tools { display: flex; gap: 8px; align-items: center; }
.bd-bar-tools .st-search { flex: 1 1 auto; }
.bd-write { flex: none; white-space: nowrap; }
.bd-list { list-style: none; margin: 0; padding: 0; }
.bd-list li + li { border-top: 1px solid var(--border-subtle); }
.bd-item { display: flex; flex-direction: column; gap: 4px; padding: 14px 16px; color: var(--text); text-decoration: none; }
.bd-item:hover { background: var(--surface-sunken); }
.bd-item:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.bd-item-title { font-size: 15px; font-weight: 700; overflow-wrap: anywhere; }
.bd-cc { color: var(--accent); font-weight: 800; }
.bd-item-meta { font-size: 12.5px; color: var(--text-faint); }
.bd-clip { white-space: nowrap; }
.bd-pages { display: flex; align-items: center; justify-content: center; gap: 12px; margin: 14px 0; font-size: 13px; color: var(--text-muted); }

.bd-back { margin-bottom: 10px; font-size: 13px; }
.bd-back a { color: var(--text-muted); text-decoration: none; font-weight: 700; }
.bd-back a:hover { color: var(--accent); }
.bd-post { padding: 18px; }
.bd-post-title { margin: 0; font-size: 20px; font-weight: 800; line-height: 1.35; overflow-wrap: anywhere; }
.bd-post-meta { margin-top: 6px; font-size: 12.5px; color: var(--text-faint); }
.bd-post-body { margin-top: 16px; font-size: 14.5px; line-height: 1.7; white-space: pre-wrap; overflow-wrap: anywhere; color: var(--text-body); }
.bd-files { margin-top: 18px; border: 1px solid var(--border); border-radius: 12px; overflow: hidden; }
.bd-files-title { font-size: 12.5px; font-weight: 800; color: var(--text-muted); padding: 10px 14px; background: var(--surface-head); border-bottom: 1px solid var(--border-subtle); }
.bd-comments .bd-files-title { margin: -16px -16px 8px; }
.bd-file { display: grid; grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "name btn" "size btn"; gap: 2px 10px; align-items: center; padding: 10px 14px; }
.bd-file + .bd-file { border-top: 1px solid var(--border-subtle); }
.bd-file-name { grid-area: name; font-size: 14px; font-weight: 700; overflow-wrap: anywhere; }
.bd-file-size { grid-area: size; font-size: 12px; color: var(--text-faint); }
.bd-dl { grid-area: btn; min-height: 36px; }
.bd-post-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 16px; }
.bd-msg { font-size: 13px; font-weight: 700; margin-top: 8px; }
.bd-msg:empty { display: none; }
.bd-msg.error { color: var(--err-text); }

.bd-comments { margin-top: 14px; padding: 16px; overflow: hidden; }
.bd-comment { padding: 10px 0; border-bottom: 1px solid var(--border-subtle); }
.bd-comment-head { display: flex; align-items: baseline; gap: 8px; font-size: 13px; }
.bd-comment-head span { color: var(--text-faint); font-size: 12px; }
.bd-cdel { margin-left: auto; border: 0; background: none; color: var(--text-faint); font-size: 12px; cursor: pointer; padding: 4px; }
.bd-cdel:hover { color: var(--err-text); }
.bd-comment-body { margin-top: 4px; font-size: 14px; line-height: 1.6; white-space: pre-wrap; overflow-wrap: anywhere; }
.bd-cform { margin-top: 12px; display: flex; flex-direction: column; gap: 8px; }
.bd-cform textarea, .bd-editor textarea {
  width: 100%; box-sizing: border-box; padding: 10px 12px; border: 1px solid var(--border); border-radius: 10px;
  background: var(--surface); color: var(--text); font: inherit; font-size: 14px; resize: vertical;
}
.bd-cform-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.bd-cmsg { font-size: 12.5px; color: var(--err-text); font-weight: 700; }

.bd-editor { padding: 18px; display: flex; flex-direction: column; gap: 4px; }
.bd-editor-title { margin: 0 0 8px; font-size: 17px; font-weight: 800; }
.bd-limit { font-weight: 600; color: var(--text-faint); font-size: 12px; margin-left: 6px; }
.bd-pick { display: inline-flex; align-items: center; min-height: 40px; margin-top: 8px; cursor: pointer; }
.bd-pick[hidden] { display: none; }
.bd-att { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.bd-att-row { border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; display: flex; flex-direction: column; gap: 6px; }
.bd-att-row.error { border-color: var(--err-dot); }
.bd-att-row.offline, .bd-att-row.retrying { border-color: var(--warn-dot); }
.bd-att-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.bd-att-name { font-size: 13.5px; font-weight: 700; overflow-wrap: anywhere; min-width: 0; }
.bd-att-btns { display: flex; gap: 6px; flex: none; }
.bd-att-x { border: 0; background: none; color: var(--text-faint); font-size: 12.5px; font-weight: 700; cursor: pointer; padding: 6px; }
.bd-att-x:hover { color: var(--err-text); }
.bd-prog { display: block; height: 6px; border-radius: 3px; background: var(--surface-sunken); overflow: hidden; }
.bd-prog i { display: block; height: 100%; background: var(--accent); transition: width .2s; }
.bd-att-state { font-size: 12px; color: var(--text-muted); font-variant-numeric: tabular-nums; }
.bd-att-state.ok { color: var(--ok-text); font-weight: 700; }
.bd-att-state.err { color: var(--err-text); font-weight: 700; }
@media (max-width: 640px) {
  .bd-post, .bd-editor { padding: 14px; }
  .bd-post-title { font-size: 18px; }
}
/* 글은 읽는 폭을 넘기지 않는다 (PC 에서 한 줄이 너무 길어지지 않게) */
#board-root { max-width: 920px; }
.bd-cform .btn, .bd-editor .form-actions .btn { width: auto; min-width: 96px; }
.bd-bar-tools .btn.bd-write { width: auto; padding-left: 16px; padding-right: 16px; }
.bd-bar-tools .st-search { min-width: 0; flex: 1 1 140px; }

/* ===== 2026-11-09 요구 반영 ===== */
/* 장비 목록(폰): 한 줄 = 상태점 · 장비명 · IP · [차단기 열기]. 표처럼 줄이 가지런히 맞는다. */
@media (max-width: 768px) {
  .st-mode-list .st-list-wrap { border: 1px solid var(--border); border-radius: 12px; background: var(--surface); overflow: hidden; }
  .st-mode-list .st-list tbody tr.st-row {
    display: grid; grid-template-columns: 12px minmax(0, 1fr) minmax(0, 32%) 88px; align-items: center; gap: 0 8px;
    margin: 0; padding: 10px 12px; min-height: 48px; box-sizing: border-box;
    border: 0; border-bottom: 1px solid var(--border-subtle); border-radius: 0; background: transparent;
  }
  .st-mode-list .st-list tbody tr.st-row:last-child { border-bottom: 0; }
  .st-mode-list .st-list tbody tr.st-row > td { display: block; padding: 0; border: 0; min-width: 0; flex: none; }
  .st-mode-list .st-list tbody tr.st-row > td::before { content: none; }
  .st-mode-list .st-list .st-c-type,
  .st-mode-list .st-list .st-c-state,
  .st-mode-list .st-list .st-c-metric,
  .st-mode-list .st-list .st-c-time { display: none !important; }
  .st-mode-list .st-list .st-row-name { font-size: 14px; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .st-mode-list .st-list .st-c-ip { font-size: 11.5px; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-align: right; }
  .st-mode-list .st-list .st-c-act .st-barrier { width: 100%; }
  .st-mode-list .st-list .st-c-act:empty { display: none; }
  .st-mode-list .st-list .st-c-act .st-barrier { min-height: 34px; padding: 0 10px; font-size: 12.5px; }
}

/* 장비 상세(폰): 미리보기(라이브) → 차단기 → 정보 → 헬스체크 → 위치 순으로 쌓는다 */
@media (max-width: 767px) {
  .detail-layout > .detail-panel[data-panel="thumbnail"] { order: 1; }
  .detail-layout > .detail-panel[data-panel="barrier"] { order: 2; }
  .detail-layout > .detail-panel[data-panel="info"] { order: 3; }
  .detail-layout > .detail-panel[data-panel="health"] { order: 4; }
  .detail-layout > .detail-panel[data-panel="events"] { order: 5; }
  .detail-layout > .detail-panel[data-panel="children"] { order: 6; }
  .detail-layout > .detail-panel[data-panel="map"] { order: 7; }
}

/* 게시판 보강: 글 칸 크기 고정 · 사진/영상 미리보기 · 댓글 첨부 */
.bd-cform textarea, .bd-editor textarea { resize: none; }
.bd-media { display: block; padding: 10px 14px 0; }
.bd-media img, .bd-media video {
  display: block; max-width: 100%; max-height: 420px; border-radius: 10px;
  background: var(--surface-sunken); border: 1px solid var(--border-subtle);
}
.bd-media video { width: 100%; background: #000; }
.bd-media + .bd-file { border-top: 0; }
.bd-comment .bd-files { margin-top: 8px; }
.bd-cform .bd-pick { margin-top: 0; }
.bd-cform-row { flex-wrap: wrap; }

/* 결제 대시보드 윗줄: 큰 숫자 2개 + '확인할 건' 한 장 (폰: 2칸 + 아래 한 줄, PC: 한 줄) */
.pay-top { display: grid; gap: 10px; margin-bottom: 14px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.pay-main { display: flex; flex-direction: column; gap: 2px; padding: 14px 16px; }
.pay-main-label { font-size: 12.5px; font-weight: 700; color: var(--text-muted); }
.pay-main-value { font-size: clamp(22px, 2.4vw, 30px); font-weight: 800; color: var(--text); font-variant-numeric: tabular-nums; letter-spacing: -0.01em; }
.pay-main-sub { font-size: 12px; color: var(--text-faint); }
.pay-checks { grid-column: 1 / -1; padding: 10px 12px 12px; }
.pay-checks-title { font-size: 12px; font-weight: 800; color: var(--text-faint); margin: 0 4px 6px; }
.pay-checks-row { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
.pay-check {
  display: flex; flex-direction: column; align-items: flex-start; gap: 2px; padding: 8px 10px;
  border: 1px solid var(--border-subtle); border-radius: 10px; background: var(--surface); cursor: pointer; font: inherit; color: inherit; text-align: left;
}
.pay-check:hover { border-color: var(--accent); }
.pay-check-label { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 700; color: var(--text-muted); white-space: nowrap; }
.pay-check-label i { width: 7px; height: 7px; border-radius: 50%; display: inline-block; }
.pay-check.bad .pay-check-label i { background: var(--err-dot); }
.pay-check.warn .pay-check-label i { background: var(--warn-dot); }
.pay-check-value { font-size: 20px; font-weight: 800; color: var(--text); font-variant-numeric: tabular-nums; }
.pay-check-value small { font-size: 12px; font-weight: 600; color: var(--text-faint); margin-left: 2px; }
.pay-check.zero .pay-check-value { color: var(--text-faint); }
.pay-check.bad { border-color: var(--err-bg); background: var(--err-bg); }
.pay-check.bad .pay-check-value { color: var(--err-text); }
@media (min-width: 900px) {
  .pay-top { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) minmax(0, 1.5fr); }
  .pay-checks { grid-column: auto; }
}

/* 요금 설정 목록: 주차장 한 줄씩, 누르면 상세 */
.pk-rows { list-style: none; margin: 0; padding: 0; }
.pk-rows li + li { border-top: 1px solid var(--border-subtle); }
.pk-row {
  display: grid; grid-template-columns: 10px minmax(0, 1.4fr) minmax(0, 1fr) minmax(0, 1fr) 12px; align-items: center; gap: 12px;
  padding: 14px 16px; color: var(--text); text-decoration: none; font-size: 13.5px;
}
.pk-row:hover { background: var(--surface-sunken); }
.pk-row-name { font-weight: 700; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pk-row-name small { display: block; font-size: 11.5px; font-weight: 500; color: var(--text-faint); overflow: hidden; text-overflow: ellipsis; }
.pk-row-price { font-weight: 700; }
.pk-row-qr { font-size: 12.5px; color: var(--text-muted); }
.pk-row-go { font-size: 20px; color: var(--text-faint); line-height: 1; }
.pk-back { margin-bottom: 10px; }
@media (max-width: 640px) {
  .pk-row { grid-template-columns: 10px minmax(0, 1fr) 12px; grid-template-areas: "dot name go" ". price go" ". qr go"; gap: 2px 10px; }
  .pk-row .status-dot { grid-area: dot; }
  .pk-row-name { grid-area: name; }
  .pk-row-price { grid-area: price; font-size: 13px; }
  .pk-row-qr { grid-area: qr; font-size: 12px; }
  .pk-row-go { grid-area: go; }
}

/* QR 탭 버튼 두 개 */
.pay-qr-btns { display: inline-flex; gap: 8px; flex-wrap: wrap; }
.pay-qr-btns .btn { width: auto; }

@media (max-width: 640px) {
  .pay-qr-bar { flex-direction: column; align-items: stretch; }
  .pay-qr-btns { display: grid; grid-template-columns: 1fr 1fr; }
  .pay-qr-btns .btn { width: 100%; padding-left: 8px; padding-right: 8px; }
}
.pay-refund { display: block; font-size: 11.5px; font-weight: 700; color: var(--warn-text); }
.pay-sync { margin-left: 8px; min-height: 30px; }
#pay-sync-msg { margin-top: 8px; }

/* ── 트리 = 범위 · 장비 상세/폼 팝업 (Magic Cloud REV-023·024·038 와 같게, 2026-12-02) ── */
/* 관제 화면에서 여는 폼 팝업(openFormModal) — 설정 모달과 같은 틀, 장비 상세 팝업보다 위 층에 */
.form-modal-host .inspector-backdrop { z-index: 110; }
.form-modal-host .mgmt-modal { z-index: 111; }
/* 팝업 머리에 제목이 이미 있다. 폼 안의 같은 제목은 숨기고 부제(그룹·장비명)만 남긴다. */
.form-modal-host .mgmt-body .content-page-head .content-page-title { display: none; }
/* 장비 상세 팝업. 상세 화면과 같은 고정 배치를 쓰므로 높이를 정해 줘야 1fr 칸이 나뉜다. */
.dev-modal-overlay { align-items: center; padding: 3vh 2vw; }
.dev-modal-panel {
  position: relative; max-width: 1600px; width: 96vw; height: 92vh; max-height: 92vh;
  background: var(--bg);
}
.dev-modal-body { flex: 1; min-height: 0; overflow: auto; padding: 18px 22px; }
.dev-modal-close { position: absolute; top: 10px; right: 12px; z-index: 2; }
.dev-modal-body .detail-header { padding-right: 36px; }
@media (max-width: 760px) {
  .dev-modal-overlay { padding: 0; }
  .dev-modal-panel { width: 100vw; height: 100%; max-height: none; border-radius: 0; border: 0; }
  .dev-modal-body { padding: 14px; }
}
/* 트리의 '전체보기' */
.tree-row-all { cursor: pointer; }
.tree-row-all .tree-label { font-weight: 600; }

/* (2026-12-02) .btn-inline 의 border:none 이 뒤에 있어 .btn-secondary 의 테두리를 지웠다(닫기·장비 수정 등). 되살린다. */
.btn-inline.btn-secondary { border: 1px solid var(--border-strong); }
/* QR 팝업은 장비 상세 팝업(.cp-overlay z 100) 위에 뜬다 */
.qr-backdrop { z-index: 120; }
.qr-modal { z-index: 121; }
.dp-head-btn:disabled { opacity: .45; cursor: not-allowed; }

/* ── 미리보기 칸 안 라이브 (2026-12-02) ── 신버전(DAVINCI) 장비만 [▶ 라이브] 가 있다. */
.preview-play {
  position: absolute; top: 10px; left: 10px; z-index: 2;
  display: inline-flex; align-items: center; gap: 5px;
  padding: 5px 11px; border-radius: 999px;
  border: 1px solid rgba(255,255,255,.35); background: rgba(0,0,0,.55);
  color: #fff; font-size: 11.5px; font-weight: 800; cursor: pointer;
}
.preview-play:hover { background: rgba(0,0,0,.75); border-color: rgba(255,255,255,.6); }
.preview-play svg { width: 11px; height: 11px; }
.preview-box.is-playing .preview-play,
.preview-box.is-playing .preview-caption { display: none; }
.live-inline { position: absolute; inset: 0; z-index: 3; background: #000; }
.live-inline .live-stage { position: absolute; inset: 0; aspect-ratio: auto; }
.live-inline-badge {
  position: absolute; top: 10px; left: 10px; z-index: 2;
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 9px; border-radius: 999px; background: rgba(0,0,0,.55);
  color: #fff; font-size: 11px; font-weight: 800;
}
.live-inline-stop {
  position: absolute; top: 8px; right: 8px; z-index: 2;
  width: 28px; height: 28px; border-radius: 7px;
  border: 1px solid rgba(255,255,255,.35); background: rgba(0,0,0,.55);
  color: #fff; font-size: 18px; line-height: 1; cursor: pointer;
}
.live-inline-stop:hover { background: rgba(0,0,0,.8); }
