@charset "UTF-8";
/* GEMS 3520 Web — SV300 / confWebApp 공통 디자인 시스템 (2026-09-10)
 *
 * 토큰 이름과 값은 SV300 `src/web.c` INDEX_HTML · confWebApp `app.css` 와 동일하다.
 * 세 제품의 웹 화면을 한 벌로 보이게 하려는 것이므로, 색을 바꿀 일이 생기면
 * 세 곳을 같이 고쳐야 한다.
 *
 * dark 가 기본이고 light 가 옵션이다 (SV300 과 같은 방향).
 * 헤더의 🌙/☀️ 버튼이 <html data-theme="light"> 를 붙였다 뗐다 하며,
 * 저장은 localStorage 'gems_theme', 첫 페인트 전 적용은 index.htm 인라인 스크립트.
 *
 * ── 호환 별칭 ──
 * --txt/--txt2/--bord/--bord2/--bg2/--navy/--blue/--sky/--danger 는 옛 이름이다.
 * app.js 가 인라인 스타일에서 수십 곳 쓰고 있어 SV300 토큰의 별칭으로 남겼다.
 * 새로 쓰는 규칙은 SV300 이름(--fg/--muted/--line/--panel/--panel2/--accent)을 쓸 것.
 */

:root {
  /* ── SV300 토큰 (dark) ── */
  --bg:     #0f1419;
  --panel:  #1a212b;
  --panel2: #222c38;
  --line:   #2c3a4a;
  --fg:     #e6edf3;
  --muted:  #8b9bb0;
  --accent: #3b82f6;
  --accent2:#2563eb;   /* accent hover/press */
  --ok:     #22c55e;
  --warn:   #f59e0b;
  --bad:    #ef4444;
  --purple: #8b5cf6;
  --cyan:   #22d3ee;

  /* 계측 phase 색 (L1/L2/L3) — 제품 관례라 테마와 무관하게 고정 */
  --pa:     #E14B4B;
  --pb:     #F5B71A;
  --pc:     #2E86C1;

  /* ── 호환 별칭 (위 설명 참조) ── */
  --txt:    var(--fg);
  --txt2:   var(--fg);
  --bord:   var(--line);
  --bord2:  var(--line);
  --bg2:    var(--panel2);
  --navy:   var(--fg);       /* 제목·값 글자. 종전의 짙은 배경 용도는 사라졌다 */
  --blue:   var(--accent);
  --blue2:  var(--accent);
  --sky:    var(--accent);
  --sky2:   #60a5fa;
  --ok2:    #4ade80;
  --danger: var(--bad);

  /* SV300 은 평면 디자인 — 그림자를 쓰지 않는다. hover 는 테두리 색으로 알린다 */
  --shadow:    none;
  --shadow-lg: none;

  --mono:   "Consolas", "Segoe UI Mono", "SF Mono", monospace;
  --hdr-h:  53px;
  --sb-w:   216px;
  --ftr-h:  34px;
  color-scheme: dark;
}

html[data-theme="light"] {
  --bg:     #eef2f6;
  --panel:  #ffffff;
  --panel2: #eef2f7;
  --line:   #e2e8f0;
  --fg:     #0f172a;
  --muted:  #64748b;
  color-scheme: light;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font-family: "Segoe UI", -apple-system, Roboto, "Malgun Gothic", sans-serif;
  font-size: 14px;
  color: var(--fg);
  background: var(--bg);
  display: flex; flex-direction: column;
  -webkit-font-smoothing: antialiased;
}
.mono { font-family: var(--mono); }

/* ---------------- Header (topbar) ---------------- */
header#hdr {
  height: var(--hdr-h);
  background: var(--panel);
  color: var(--fg);
  border-bottom: 1px solid var(--line);
  display: flex; align-items: center; padding: 0 18px;
  flex: 0 0 var(--hdr-h);
  position: relative; z-index: 10;
}
header#hdr .brand {
  display: flex; align-items: center; gap: 10px;
}
header#hdr .brand-logo {
  height: 26px; width: auto; display: block;
}
header#hdr .logo {
  font-size: 17px; font-weight: 800; letter-spacing: 0.3px;
  color: var(--accent);
  display: inline-flex; align-items: center;
}
header#hdr .meta { color: var(--muted); font-size: 14px; flex: 1; margin-left: 20px; font-weight: 600; }
header#hdr .user { color: var(--muted); font-size: 12px; padding: 4px 10px;
                   background: var(--panel2); border-radius: 6px; }
header#hdr .user .name { color: var(--fg); font-weight: 700; }
header#hdr .theme-btn {
  margin-left: 10px; flex: 0 0 auto;
  padding: 3px 8px; height: 26px;
  border: 1px solid var(--line); border-radius: 6px;
  background: var(--panel2); color: var(--fg);
  font-size: 13px; line-height: 1; cursor: pointer;
  transition: border-color 0.15s;
}
header#hdr .theme-btn:hover { border-color: var(--accent); }
/* 글자는 '지금 상태' — CSS 로 두면 app.js(gzip 46KB) 로딩 전에도 맞는 글자가 나온다 */
header#hdr .theme-btn::after { content: "🌙"; }
html[data-theme="light"] header#hdr .theme-btn::after { content: "☀️"; }

/* ---------------- Layout ---------------- */
.layout { display: flex; flex: 1; min-height: 0; }
nav#sidebar {
  width: var(--sb-w);
  background: var(--panel); border-right: 1px solid var(--line);
  overflow-y: auto;
  display: flex; flex-direction: column;
}
#poll-toggle-wrap {
  margin-top: auto;
  padding: 12px 11px 16px;
  border-top: 1px solid var(--line);
  font-size: 12.5px;
}
#poll-toggle-wrap label {
  display: flex; align-items: center; gap: 8px;
  cursor: pointer; user-select: none;
  color: var(--muted);
}
#poll-toggle-wrap input[type=checkbox] {
  width: 15px; height: 15px; accent-color: var(--accent);
  margin: 0;
}
#poll-toggle-wrap .poll-label { flex: 1; }
#poll-toggle-wrap .poll-state {
  font-size: 10px;
  padding: 2px 8px; border-radius: 10px;
  background: var(--ok); color: #06281a; font-weight: 700;
}
#poll-toggle-wrap.off .poll-state { background: var(--muted); color: #10202e; }
#poll-toggle-wrap .poll-hint {
  font-size: 11px; color: var(--muted); margin-top: 6px;
}
nav#sidebar ul { list-style: none; padding: 8px 10px 24px; }
nav#sidebar a {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 11px; margin: 1px 0;
  border-radius: 8px;
  color: var(--fg);
  text-decoration: none; font-size: 13.5px; line-height: 1.3;
  border-left: 3px solid transparent;
  transition: background 0.15s, border-color 0.15s;
}
nav#sidebar a .ico {
  display: inline-block;
  width: 18px;
  font-size: 15px;
  text-align: center;
}
nav#sidebar a,
nav#sidebar a:link,
nav#sidebar a:visited {
  color: var(--fg);
  background: transparent;
  font-weight: normal;
  border-left-color: transparent;
}
nav#sidebar a:focus { outline: none; }
nav#sidebar a:hover,
nav#sidebar a:hover:visited { background: var(--panel2); }
nav#sidebar a.active,
nav#sidebar a.active:visited,
nav#sidebar a.active:hover {
  background: var(--panel2);
  border-left-color: var(--accent);
  font-weight: 600;
}
nav#sidebar .group {
  padding: 16px 10px 6px;
  color: var(--muted); font-size: 10px;
  font-weight: 700; text-transform: uppercase; letter-spacing: 0.7px;
}
nav#sidebar .group:first-child { padding-top: 8px; }

main#content { flex: 1; overflow-y: auto; padding: 22px 24px; }

.crumb { color: var(--muted); font-size: 12px; margin-bottom: 6px; font-weight: 500; }
.h1 {
  font-size: 24px; font-weight: 800; color: var(--fg);
  margin-bottom: 14px;
}

/* ---------------- Footer ---------------- */
footer#ftr {
  height: var(--ftr-h); flex: 0 0 var(--ftr-h);
  background: var(--panel); border-top: 1px solid var(--line);
  color: var(--muted); font-size: 11px; font-family: var(--mono);
  display: flex; align-items: center; padding: 0 24px; gap: 20px;
}

/* ---------------- Card ---------------- */
.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 18px 20px;
  margin-bottom: 16px;
  transition: border-color 0.15s;
}
.card.clickable, a.card { cursor: pointer; }
.card.clickable:hover, a.card:hover { border-color: var(--accent); }
/* SV300 카드 제목 규격 — 제목 앞 4px 세로 accent bar */
.card .title {
  font-size: 13px; font-weight: 700; color: var(--fg);
  margin-bottom: 14px;
  display: flex; align-items: center; gap: 8px;
  text-transform: uppercase; letter-spacing: 0.6px;
}
.card .title::before {
  content: ""; flex: 0 0 auto;
  width: 4px; height: 16px; border-radius: 2px;
  background: var(--accent);
}

/* ---------------- Setup section cards ---------------- */
/* Main Setting 카드 그리드 — 넓은 화면 3열, 좁아지면 2열 → 1열.
   COMMUNICATION 은 2칸을 차지하고 남는 1칸에 WIFI 가 들어간다.
   COMMUNICATION 이 2칸 연속을 못 잡아 다음 줄로 내려가면 앞줄에 한 칸이 남는데,
   dense 로 뒤 카드(CLOUD)가 그 칸을 메운다 (DOM 순서는 그대로). */
.setup-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-auto-flow: row dense;
  gap: 16px;
  max-width: 1952px;
}
.setup-grid .s-comm { grid-column: span 2; }
.setup-grid .s-comm-fields { display: grid; grid-template-columns: repeat(2, 1fr); gap: 0 16px; }
/* Save/Reload 바 — 카드 위. 폼이 길어 맨 밑이면 저장하려고 되돌아 스크롤해야 했다 */
.setup-actions {
  display: flex; gap: 8px; align-items: center;
  margin-bottom: 16px; max-width: 1952px;
}
/* 기존 반응형 기준(1280 / 768)과 동일한 폭에서 단계를 낮춘다 */
@media (max-width: 1280px) {
  .setup-grid { grid-template-columns: repeat(2, 1fr); }   /* s-comm span 2 = 전 열 */
}
@media (max-width: 768px) {
  .setup-grid { grid-template-columns: 1fr; }
  .setup-grid .s-comm { grid-column: auto; }   /* span 2 면 없는 2번째 열이 생긴다 */
  .setup-grid .s-comm-fields { grid-template-columns: 1fr; }
}

.setup-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 18px 20px 16px;
  margin-bottom: 16px;
  transition: border-color 0.15s;
}
.setup-card:hover { border-color: var(--line); }
.setup-card .s-title {
  font-size: 16px; font-weight: 700; color: var(--fg);
  margin-bottom: 14px;
  display: flex; align-items: center; gap: 8px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line);
}
/* 카드 종류 구분 — 종전 상단 가로 띠를 SV300 규격의 세로 bar 로 옮겼다 */
.setup-card .s-title::before {
  content: ""; flex: 0 0 auto;
  width: 4px; height: 16px; border-radius: 2px;
  background: var(--accent);
}
.setup-card.s-config .s-title::before { background: var(--accent); }
.setup-card.s-etc    .s-title::before { background: var(--warn); }
.setup-card.s-comm   .s-title::before { background: var(--ok); }
.setup-card.s-cloud  .s-title::before { background: var(--purple); }
.setup-card.s-wifi   .s-title::before { background: var(--cyan); }
.setup-card .s-title .ico {
  font-size: 18px; line-height: 1;
}
.setup-card .s-subtitle {
  font-size: 12px; font-weight: 700; color: var(--muted);
  letter-spacing: 0.4px;
  margin-top: 14px; margin-bottom: 8px;
  text-transform: uppercase;
}

/* ---------------- Maintenance 카드 그리드 ----------------
   한 줄에 2개 (COMMANDS + FIRMWARE UPDATE / CONFIG + LP EXPORT).
   카드 높이가 제각각이라 stretch 가 아니라 start — 짧은 카드가 늘어나지 않는다.
   max-width 는 한 장이 너무 넓어져 읽기 나빠지는 것 방지. */
.maint-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
  align-items: start;
  max-width: 1300px;
}
.maint-grid .setup-card { margin: 0; }
@media (max-width: 1100px) {
  .maint-grid { grid-template-columns: 1fr; }
}

/* ---------------- KPI grid ---------------- */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 16px;
  margin-bottom: 20px;
}
.kpi {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 18px 20px 16px;
  transition: border-color 0.15s;
}
.kpi:hover { border-color: var(--accent); }
.kpi .lbl {
  font-size: 13px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.6px;
  font-weight: 700;
  display: flex; align-items: center; gap: 8px;
}
/* KPI 종류 구분 — 종전 카드 상단 가로 띠를 세로 bar 로 (SV300 .dct::before 규격) */
.kpi .lbl::before {
  content: ""; flex: 0 0 auto;
  width: 4px; height: 16px; border-radius: 2px;
  background: var(--accent);
}
.kpi.volt  .lbl::before { background: var(--cyan); }
.kpi.kw    .lbl::before { background: var(--purple); }
.kpi.pf    .lbl::before { background: var(--ok); }
.kpi.kwh   .lbl::before { background: var(--accent); }
.kpi.alarm .lbl::before { background: var(--bad); }
.kpi .lbl .ico {
  font-size: 16px; opacity: 0.9;
}
.kpi .val {
  font-size: 30px; font-weight: 800;
  color: var(--fg);
  font-family: var(--mono);
  margin-top: 6px;
  letter-spacing: -0.6px;
  line-height: 1.1;
}
.kpi .val .unit {
  font-size: 13px; color: var(--muted);
  font-weight: 500; margin-left: 4px;
}
.kpi .sub {
  font-size: 11px; color: var(--muted);
  margin-top: 6px; font-family: var(--mono);
}
.kpi canvas.spark {
  display: block; width: 100%; height: 28px;
  margin-top: 6px;
}

/* ---------------- Form fields ---------------- */
input:not([type=checkbox]):not([type=file]), select, textarea {
  background: var(--panel2); color: var(--fg);
  border: 1px solid var(--line); border-radius: 8px;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); }
/* read-only mode 가독성 — 값은 읽히되 편집 불가임이 보이게 */
input:disabled, select:disabled, textarea:disabled {
  color: var(--muted);
  opacity: 1;
  -webkit-text-fill-color: var(--muted);   /* WebKit/Chromium 강제 색상 */
  background: var(--panel2);
  cursor: not-allowed;
}
input[type="checkbox"]:disabled {
  opacity: 0.85;
  accent-color: var(--muted);
}

/* ---------------- Status pill ---------------- */
.pill { display: inline-block; padding: 3px 12px; border-radius: 20px;
        font-size: 11px; font-weight: 800; color: #fff;
        letter-spacing: 0.4px; }
.pill.ok    { background: var(--ok); color: #06281a; }
.pill.op    { background: var(--ok); color: #06281a; }
.pill.warn  { background: var(--warn); color: #1a212b; }
.pill.alarm { background: var(--bad); }
.pill.idle  { background: var(--panel2); color: var(--muted); }

/* ---------------- Buttons ---------------- */
.btn {
  display: inline-block;
  padding: 9px 16px;
  border-radius: 8px;
  font-size: 13px; font-weight: 600;
  cursor: pointer;
  border: 1px solid var(--line);
  background: var(--panel2);
  color: var(--fg);
  transition: border-color 0.15s, background 0.15s;
}
.btn:hover { border-color: var(--accent); }
.btn:disabled { opacity: 0.4; cursor: not-allowed; }
.btn.primary {
  background: var(--accent); border-color: var(--accent); color: #fff;
}
.btn.primary:hover { background: var(--accent2); border-color: var(--accent2); }
.btn.danger {
  background: var(--bad); border-color: var(--bad); color: #fff;
}
.btn.danger:hover { background: #dc2626; border-color: #dc2626; }
/* 되돌릴 수 없는 조작(Clear Wh / Clear Event / Reset Demand) — danger 보다는 약하게,
   그래도 일반 버튼과는 구분되도록 테두리·글자만 경고색 */
.btn.warn {
  color: var(--warn); border-color: var(--warn);
  background: var(--panel2);
}
.btn.warn:hover { background: rgba(245,158,11,0.14); border-color: var(--warn); }

/* ---------------- Tables ---------------- */
table.data {
  width: 100%;
  border-collapse: collapse;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  font-size: 13px;
}
/* Channel Status 페이지 테이블은 컨텐츠 폭으로 (페이지 전체로 늘어지지 않게) */
#st-table table.data {
  width: auto;
}
table.data thead {
  background: var(--panel2);
  color: var(--muted);
}
table.data th, table.data td { padding: 8px 12px; text-align: left; }
table.data th { font-weight: 600; letter-spacing: 0.4px; font-size: 11px; text-transform: uppercase; }
table.data th.right, table.data td.right {
  text-align: right; font-family: var(--mono);
}
table.data th.right { text-transform: none; letter-spacing: 0; }
/* 표 헤더는 항상 가운데 정렬 — th.right(우측정렬) 보다 우선하도록 thead 를 포함해 특이도 확보 */
table.data thead th, table.data thead th.right { text-align: center; }
/* Feeder Detail 측정표의 Metric 열 — 가운데 정렬 + 긴 라벨 줄바꿈 허용 */
table.data th.mcol, table.data td.mcol { text-align: center; overflow-wrap: anywhere; }
/* NUM / Wire 처럼 본문도 가운데 정렬할 열 */
table.data td.ccol { text-align: center; }
/* Feeder Detail 측정표는 값도 가운데 정렬 (열폭이 고정이라 우측정렬이 오히려 읽기 나쁨) */
table.data.fd-metric td.right { text-align: center; }
/* Event Log 는 전 열 가운데 정렬 (시각/이름/값이 모두 짧아 좌·우 혼합 정렬이 산만하다) */
table.data.ev-log td, table.data.ev-log td.right { text-align: center; }
table.data th.col-a { color: var(--pa); }
table.data th.col-b { color: var(--pb); }
table.data th.col-c { color: var(--pc); }
table.data tbody tr:nth-child(even) { background: var(--bg); }
table.data tbody tr { border-top: 1px solid var(--line); transition: background 0.1s; }
table.data tbody tr:hover { background: rgba(59,130,246,0.10); }
table.data td { font-family: var(--mono); }
table.data td.pk, table.data td.mcol { font-family: inherit; }

/* ---------------- Enable / DHCP 토글 버튼 (콤보 대체) ---------------- */
button.tog {
  display: flex; align-items: center; gap: 9px;
  width: 100%; padding: 6px 10px;
  border: 1px solid var(--line); border-radius: 8px;
  background: var(--panel2); color: var(--muted);
  font-family: var(--mono); font-size: 12px; font-weight: 700;
  letter-spacing: 0.6px; cursor: pointer; text-align: left;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}
button.tog .knob {
  width: 30px; height: 16px; border-radius: 8px; flex: 0 0 auto;
  background: var(--line); position: relative; transition: background 0.15s;
}
button.tog .knob::after {
  content: ''; position: absolute; top: 2px; left: 2px;
  width: 12px; height: 12px; border-radius: 50%;
  background: var(--muted); transition: transform 0.15s, background 0.15s;
}
button.tog:hover { border-color: var(--accent); }
button.tog.on { background: rgba(34,197,94,0.12); color: var(--ok); border-color: var(--ok); }
button.tog.on .knob { background: var(--ok); }
button.tog.on .knob::after { transform: translateX(14px); background: #06281a; }
/* 상위 토글이 꺼져 잠긴 토글 — 입력란(:disabled) 과 같은 회색으로 보이게 한다.
   이게 없으면 WIFI Enable=OFF 일 때 WIFI DHCP 버튼이 멀쩡해 보이면서 안 눌린다. */
button.tog:disabled,
button.tog.on:disabled {
  background: var(--panel2); color: var(--muted); border-color: var(--line);
  opacity: 0.55; cursor: not-allowed;
}
button.tog:disabled .knob, button.tog.on:disabled .knob { background: var(--line); }
button.tog:disabled:hover { border-color: var(--line); }

/* 상위 토글이 꺼져 비활성화된 종속 입력 */
.setup-card input:disabled, .setup-card select:disabled {
  background: var(--panel2); color: var(--muted); cursor: not-allowed;
}

/* 행/열 구분선 — 다열 표(Energy / Phase 등)에서 가로·세로 경계가 없어
   값이 어느 열에 속하는지 읽기 어렵던 것 보정 */
table.data th, table.data td { border-right: 1px solid var(--line); }
table.data th:last-child, table.data td:last-child { border-right: 0; }
table.data thead tr + tr th { border-top: 1px solid var(--line); }
/* NUM / Wire 처럼 헤더 2줄을 병합(rowspan)한 셀은 가운데 정렬 */
table.data thead th[rowspan] { vertical-align: middle; text-align: center; }

/* ---------------- Empty state ---------------- */
.placeholder {
  background: var(--panel);
  border: 1px dashed var(--line);
  border-radius: 12px;
  padding: 36px;
  text-align: center;
  color: var(--muted);
}
.placeholder .ph-title {
  font-size: 14px; font-weight: 700; color: var(--fg);
  margin-bottom: 6px;
}

/* ---------------- Phasor card ---------------- */
.phasor-card {
  /* 내부 .title 은 세로 위쪽에, canvas+legend 는 자체 inline flex 로 묶임 */
}
.phasor-canvas {
  width: 220px; height: 220px;
  background: var(--panel2);
  border: 1px solid var(--line);
  border-radius: 50%;
  flex-shrink: 0;
}
.phasor-legend { font-size: 12px; }
.phasor-legend .row { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.phasor-legend .swatch { width: 16px; height: 4px; border-radius: 2px; }

/* ---------------- CH selector button + dialog ---------------- */
.ch-btn {
  font-family: var(--mono); font-size: 12px;
  padding: 5px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel2);
  color: var(--fg);
  cursor: pointer;
  min-width: 60px;
  transition: border-color 0.12s;
}
.ch-btn:hover { border-color: var(--accent); }

.ch-dlg-bg {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(0,0,0,0.62);
  display: flex; align-items: center; justify-content: center;
  animation: fadein 0.12s ease-out;
}
@keyframes fadein { from { opacity: 0; } to { opacity: 1; } }

.ch-dlg-box {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 22px 24px 18px;
  min-width: 380px;
  max-width: 90vw;
  animation: zoomin 0.14s ease-out;
}
@keyframes zoomin { from { transform: scale(0.94); opacity: 0; } to { transform: scale(1); opacity: 1; } }

.ch-dlg-title {
  font-size: 15px; font-weight: 700; color: var(--fg);
  margin-bottom: 14px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line);
}

/* 4 chip × 3 phase = 12 cells, plus None at top spanning full width */
.ch-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
  margin-bottom: 14px;
}
.ch-cell {
  font-family: var(--mono); font-size: 13px; font-weight: 700;
  padding: 12px 8px;
  border: 2px solid var(--line);
  border-radius: 8px;
  background: var(--panel2);
  color: var(--fg);
  cursor: pointer;
  transition: border-color 0.12s;
}
.ch-cell:hover { border-color: var(--accent); }
.ch-cell.ch-none { grid-column: span 4; background: var(--bg); }
.ch-cell.ch-current {
  background: var(--accent);
  color: #fff; border-color: var(--accent);
}
.ch-cell.ch-used {
  background: var(--panel2); color: var(--muted);
  border-color: var(--line); border-style: dashed;
  cursor: not-allowed; opacity: 0.65;
}
.ch-cell.ch-used:hover { color: var(--warn); border-color: var(--warn); }
.ch-cell.ch-shake { animation: ch-shake 0.4s; border-color: var(--bad) !important; color: var(--bad) !important; }
@keyframes ch-shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-4px); }
  75% { transform: translateX(4px); }
}
.ch-dlg-warn {
  margin-top: 10px; padding: 10px 12px;
  background: rgba(239,68,68,0.12); border: 1px solid var(--bad);
  border-radius: 8px; color: var(--bad);
  font-size: 12px; font-weight: 600;
}

.ch-dlg-hint {
  font-size: 11px; color: var(--muted);
  display: flex; align-items: center; gap: 4px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}
.ch-dlg-hint .sw {
  display: inline-block;
  width: 14px; height: 14px;
  border-radius: 3px;
  border: 1px solid var(--line);
  vertical-align: middle;
}
.ch-dlg-hint .sw-current { background: var(--accent); border-color: var(--accent); }
.ch-dlg-hint .sw-used    { background: var(--panel2); border-style: dashed; }
.ch-dlg-hint .sw-free    { background: var(--panel); }

.ch-dlg-actions { display: flex; justify-content: flex-end; }

@media (max-width: 1280px) {
  .kpi-grid { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 768px) {
  nav#sidebar { display: none; }
  .kpi-grid { grid-template-columns: repeat(2, 1fr); }
  main#content { padding: 18px; }
}

/* ── Feeder 카드 그리드 (confWebApp Feeders 화면 참조) ─────────────────────
   9열 표를 카드 안에 넣어야 해서 table.data 의 8x12 패딩을 4x5 로 줄인다.
   이 축소가 없으면 Phase∠·THD 열이 카드 밖으로 잘린다. */
.fdgrid{display:grid;gap:12px;grid-template-columns:repeat(auto-fill,minmax(340px,1fr))}
.fdcard{padding:0;overflow:hidden}
.fdcard.off{opacity:.5}
.fdcard .fdbar{height:3px}
.fdcard .fdhead{display:flex;align-items:center;gap:8px;padding:12px 14px 9px}
.fdcard .fddot{width:8px;height:8px;border-radius:50%;flex:0 0 auto}
.fdcard .fdname{font-size:15px;font-weight:700;color:var(--fg)}
.fdcard .fdtype{margin-left:auto;font-size:11px;color:var(--muted);font-family:var(--mono)}
.fdcard .fdwrap{padding:0 12px}
.fdcard table.data{border:0;border-radius:0;font-size:11px;background:transparent}
.fdcard table.data th,.fdcard table.data td{padding:4px 5px}
.fdcard table.data th{font-size:10px;letter-spacing:0}
.fdcard tr.fdtot{background:var(--panel2);font-weight:700}
.fdcard tr.fdtot td{border-top:1px solid var(--line)}
.fdcard .fdfoot{padding:7px 12px 10px;font-size:11px;color:var(--muted);font-family:var(--mono)}
