/* ============================================================
   VIOL CRM — 디자인 시스템
   레퍼런스: 상단 네이비 글로벌바 + 흰 헤더(브레드크럼/서브탭) +
   연회색 바탕 위 카드 컨테이너 + 밀도 높은 데이터 그리드
   ============================================================ */

:root {
  --navy: #0e3a66;            /* 글로벌 바 */
  --navy-deep: #0a2c4e;
  --accent: #00a4eb;          /* VIOL 메인 블루 — 링크·강조 숫자 */
  --accent-strong: #0b7fd4;
  --bg: #f4f6f9;              /* 페이지 바탕 */
  --card: #ffffff;
  --line: #e3e8ee;
  --line-strong: #cfd8e3;
  --text: #23303f;
  --text-sub: #6b7a8c;
  --green: #1e9e58;
  --red: #d94141;
  --amber: #e8a13a;
  --yellow-col: #fff7dc;      /* 입력열 하이라이트 */
  --green-col: #edf8f1;       /* 계산열 하이라이트 */
  --hover: #f2f7fd;
  --radius: 10px;
  --shadow: 0 1px 3px rgba(16, 42, 74, .07), 0 1px 2px rgba(16, 42, 74, .05);
  font-size: 14px;
}

/* ---------------- 다크모드 ---------------- */
/* data-theme는 JS(theme-init 인라인 스크립트)가 로드 직전 결정해 <html>에 부여함(라이트/다크 깜빡임 방지) */
:root[data-theme="dark"] {
  --navy: #0a2540; --navy-deep: #071c30;
  --accent: #00a4eb; --accent-strong: #3ab6f0;
  --bg: #0d1720; --card: #16232e;
  --line: #263644; --line-strong: #34495a;
  --text: #e6edf3; --text-sub: #94a6b8;
  --green: #34c777; --red: #f16565; --amber: #f0b054;
  --yellow-col: rgba(232,161,58,.14); --green-col: rgba(52,199,119,.12);
  --hover: #1d2c3a;
  --shadow: 0 1px 3px rgba(0,0,0,.5), 0 1px 2px rgba(0,0,0,.35);
}
:root[data-theme="dark"] table.grid thead th,
:root[data-theme="dark"] .sum-table tr.total td { background: #1a2733; }
:root[data-theme="dark"] table.grid thead th .flt { color: #7c8ea0; }
:root[data-theme="dark"] table.grid thead th .flt:hover { background: rgba(0,164,235,.15); }
:root[data-theme="dark"] table.grid td { border-right-color: #202f3c; }
:root[data-theme="dark"] table.grid tbody tr:hover td.col-yellow { background: rgba(232,161,58,.24); }
:root[data-theme="dark"] table.grid tbody tr:hover td.col-green { background: rgba(52,199,119,.22); }
:root[data-theme="dark"] table.grid td.editable:hover { background: rgba(0,164,235,.1); }
:root[data-theme="dark"] table.grid thead th .sort-ic.dim { fill: #4a5b6c; }
:root[data-theme="dark"] table.grid thead th .th-lbl:hover .sort-ic.dim { fill: #6b7f92; }
:root[data-theme="dark"] table.grid td.rownum { color: #5a6b7c; background: #101b24; }
:root[data-theme="dark"] .grid-empty { color: #5f7284; }
:root[data-theme="dark"] .filter-badge { background: rgba(0,164,235,.15); }
:root[data-theme="dark"] .sel-info { background: rgba(255,255,255,.06); color: #6cc6f5; }
:root[data-theme="dark"] .side-menu a.active { background: rgba(0,164,235,.15); }
:root[data-theme="dark"] .sum-table .zero { color: #4a5b6c; }
:root[data-theme="dark"] .hbar-row .hb-track { background: rgba(255,255,255,.06); }
:root[data-theme="dark"] .sk-bar, :root[data-theme="dark"] .sk-row { background: rgba(255,255,255,.08); }
:root[data-theme="dark"] .mini-track { background: rgba(255,255,255,.08); }
:root[data-theme="dark"] .badge-edit { background: rgba(52,199,119,.14); border-color: rgba(52,199,119,.35); }
:root[data-theme="dark"] .badge-readonly { background: rgba(240,176,84,.14); color: var(--amber); border-color: rgba(240,176,84,.35); }
:root[data-theme="dark"] .chip.blue   { background: rgba(0,164,235,.16); color: #6cc6f5; }
:root[data-theme="dark"] .chip.green  { background: rgba(52,199,119,.16); color: #4ad187; }
:root[data-theme="dark"] .chip.amber  { background: rgba(240,176,84,.18); color: #f0b054; }
:root[data-theme="dark"] .chip.red    { background: rgba(241,101,101,.18); color: #f18a8a; }
:root[data-theme="dark"] .chip.gray   { background: rgba(255,255,255,.08); color: #94a6b8; }
:root[data-theme="dark"] .chip.navy   { background: rgba(58,182,240,.14); color: #8ecdf2; }
:root[data-theme="dark"] .chip.violet { background: rgba(160,120,230,.18); color: #c3a8f5; }
:root[data-theme="dark"] .topbar { box-shadow: 0 1px 0 rgba(255,255,255,.06); }
:root[data-theme="dark"] .theme-toggle { color: rgba(255,255,255,.85); }
:root[data-theme="dark"] input, :root[data-theme="dark"] select, :root[data-theme="dark"] textarea { color-scheme: dark; }

* { margin: 0; padding: 0; box-sizing: border-box; }

/* 흑백 라인 아이콘 (컬러 이모지 대체) — 텍스트색 상속 */
.ic { width: 1.05em; height: 1.05em; display: inline-block; vertical-align: -0.16em; flex-shrink: 0; }
.tbtn .ic, .qf-pill .ic { width: 14px; height: 14px; vertical-align: -2px; }

html, body { height: 100%; }
body {
  font-family: Pretendard, "Pretendard Variable", "Malgun Gothic", "Apple SD Gothic Neo", sans-serif;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent-strong); text-decoration: none; }
button { font-family: inherit; cursor: pointer; }

/* ---------------- 글로벌 네비게이션 바 ---------------- */
.topbar {
  height: 52px;
  background: linear-gradient(180deg, var(--navy) 0%, var(--navy-deep) 100%);
  display: flex; align-items: center;
  padding: 0 18px;
  position: sticky; top: 0; z-index: 100;
  color: #fff;
}
.topbar .brand {
  display: flex; align-items: center; gap: 11px;
  color: #fff;
  margin-right: 28px; white-space: nowrap;
}
.topbar .brand-logo { height: 19px; width: auto; display: block; }
.topbar .brand-sep { width: 1px; height: 18px; background: rgba(255,255,255,.28); }
.topbar .brand-suffix {
  font-size: 14px; font-weight: 800; letter-spacing: .5px; color: var(--accent);
  background: rgba(0,164,235,.14); border: 1px solid rgba(0,164,235,.35);
  padding: 2.5px 9px; border-radius: 6px;
}

.gnb { display: flex; align-items: center; gap: 2px; flex: 1; min-width: 0; }
.gnb a {
  color: rgba(255,255,255,.82);
  padding: 7px 13px; border-radius: 7px;
  font-size: 14px; font-weight: 600; white-space: nowrap;
}
.gnb a:hover { background: rgba(255,255,255,.10); color: #fff; }
.gnb a.active { background: rgba(255,255,255,.16); color: #fff; }

.topbar .right { display: flex; align-items: center; gap: 14px; margin-left: 16px; }
.topbar .bell { position: relative; font-size: 17px; opacity: .9; cursor: pointer; }
.topbar .bell .dot {
  position: absolute; top: -3px; right: -5px;
  min-width: 15px; height: 15px; padding: 0 3px;
  background: var(--red); border-radius: 8px;
  font-size: 10px; font-weight: 700; line-height: 15px; text-align: center;
}
.topbar .theme-toggle {
  background: none; border: 0; color: rgba(255,255,255,.85);
  font-size: 17px; line-height: 1; cursor: pointer; padding: 4px; border-radius: 6px;
  display: flex; align-items: center;
}
.topbar .theme-toggle:hover { background: rgba(255,255,255,.12); }
.topbar .who { text-align: right; line-height: 1.25; }
.topbar .who .nm { font-size: 13px; font-weight: 700; }
.topbar .who .tm { font-size: 10.5px; opacity: .7; }
.topbar .avatar {
  width: 32px; height: 32px; border-radius: 50%;
  background: var(--accent); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 11.5px; font-weight: 800;
}

/* ---------------- 페이지 헤더 (브레드크럼 + 서브탭 + 상태) ---------------- */
.page-head {
  background: var(--card);
  border-bottom: 1px solid var(--line);
  padding: 0 22px;
}
.page-head .crumb-row {
  display: flex; align-items: center; gap: 10px;
  padding: 13px 0 9px;
}
.page-head .crumb { font-size: 13.5px; font-weight: 700; }
.page-head .crumb a { color: var(--text); }
.page-head .crumb a:hover { color: var(--accent-strong); }
.page-head .crumb .sep { color: var(--text-sub); margin: 0 6px; font-weight: 400; }
.page-head .crumb .here { color: var(--text-sub); font-weight: 600; }

.page-head .status { margin-left: auto; display: flex; align-items: center; gap: 10px; font-size: 12px; color: var(--text-sub); white-space: nowrap; }
.badge-edit {
  background: #e7f6ec; color: var(--green);
  border: 1px solid #bfe6cd; border-radius: 5px;
  padding: 2px 8px; font-size: 11.5px; font-weight: 700;
}
.badge-readonly { background: #fdf3e0; color: #b07818; border: 1px solid #f0dcb0; border-radius: 5px; padding: 2px 8px; font-size: 11.5px; font-weight: 700; }
.live { display: inline-flex; align-items: center; gap: 5px; }
.live::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--green); box-shadow: 0 0 0 3px rgba(30,158,88,.15); }

.page-title-row { display: flex; align-items: baseline; gap: 12px; padding: 4px 0 14px; }
.page-title { font-size: 22px; font-weight: 800; }
.page-title-row .desc { font-size: 12.5px; color: var(--text-sub); }

.subtabs { display: flex; gap: 2px; overflow-x: auto; }
.subtabs .tab {
  padding: 9px 14px 10px; font-size: 13.5px; font-weight: 600;
  color: var(--text-sub); border-bottom: 2.5px solid transparent;
  white-space: nowrap; background: none; border-top: 0; border-left: 0; border-right: 0;
}
.subtabs .tab:hover { color: var(--text); }
.subtabs .tab.active { color: var(--accent-strong); border-bottom-color: var(--accent-strong); font-weight: 700; }

/* ---------------- 본문 레이아웃 ---------------- */
.content { padding: 20px 22px 46px; max-width: 1920px; margin: 0 auto; }
.grid-cols { display: grid; gap: 16px; align-items: stretch; }
/* 디자인 규칙: 같은 행(row)에 놓인 카드는 항상 바닥선이 맞도록 동일 높이로 늘린다 */
.grid-cols > .card-box { height: 100%; display: flex; flex-direction: column; }
.kpi-row > .kpi { height: 100%; }

/* ---------------- KPI 카드 ---------------- */
.kpi-row { display: grid; grid-template-columns: repeat(6, 1fr); gap: 14px; margin-bottom: 18px; }
.kpi {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 15px 17px 13px;
  min-width: 0;
}
.kpi .k-title { font-size: 12.5px; color: var(--text-sub); font-weight: 600; margin-bottom: 7px; }
.kpi .k-value { font-size: 27px; font-weight: 800; letter-spacing: -.5px; line-height: 1.1; }
.kpi .k-value small { font-size: 14px; font-weight: 700; color: var(--text-sub); margin-left: 2px; }
.kpi .k-sub { font-size: 11.5px; color: var(--text-sub); margin-top: 7px; }
.kpi.blue .k-value { color: var(--accent-strong); }
.kpi.green .k-value { color: var(--green); }
.kpi.red .k-value { color: var(--red); }
.kpi.navy .k-value { color: var(--navy); }
.kpi .k-sub .up { color: var(--green); font-weight: 700; }
.kpi .k-sub .down { color: var(--red); font-weight: 700; }

/* ---------------- 카드 컨테이너 ---------------- */
.card-box {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); overflow: hidden;
}
.card-box + .card-box { margin-top: 16px; }
/* 위 규칙은 세로로 쌓이는 단일열 카드용 — 그리드 행 안에서 나란히 놓인 카드에는 적용되면 안 됨(2·3번째 칸이 밀려 내려가는 버그 유발) */
.grid-cols > .card-box + .card-box { margin-top: 0; }
.card-head {
  display: flex; align-items: center; gap: 10px;
  padding: 13px 16px 12px; border-bottom: 1px solid var(--line);
}
.card-head h3 { font-size: 15px; font-weight: 800; }
.card-head .hint { font-size: 12px; color: var(--text-sub); margin-left: auto; }

/* ---------------- 가로 스택바 카드 (요약표 치환용) ---------------- */
/* 차트 바디 공통 — 짧은 콘텐츠도 등높이 카드 안에서 세로 중앙에 오도록 */
.chart-body { flex: 1; display: flex; flex-direction: column; justify-content: center; }
.hbar-body { flex: 1; display: flex; flex-direction: column; padding: 16px 18px 14px; }
.hbar-rows { flex: 1; display: flex; flex-direction: column; justify-content: center; gap: 18px; }
.hbar-row { display: flex; align-items: center; gap: 11px; }
.hbar-row .hb-label { width: 68px; font-size: 12.5px; font-weight: 600; flex-shrink: 0; }
.hbar-row .hb-label .lbl-team { font-size: 10.5px; color: var(--text-sub); display: block; }
.hbar-row .hb-track { flex: 1; height: 26px; background: #eef1f5; border-radius: 6px; overflow: hidden; display: flex; }
.hbar-row .hb-seg { height: 100%; }
.hbar-row .hb-seg + .hb-seg { border-left: 1.5px solid var(--card); }
.hbar-row .hb-val { width: 96px; text-align: right; font-size: 12.5px; font-weight: 700; font-variant-numeric: tabular-nums; flex-shrink: 0; }
.hb-pct { display: inline-block; margin-left: 5px; padding: 1px 6px; border-radius: 10px; font-size: 10.5px; font-weight: 700; vertical-align: middle; }
.hb-pct.good { background: rgba(30,158,88,.14); color: var(--green); }
.hb-pct.warn { background: rgba(232,161,58,.16); color: var(--amber); }
.hb-pct.bad { background: rgba(217,65,65,.14); color: var(--red); }
.hbar-legend { display: flex; gap: 14px; flex-wrap: wrap; margin-top: auto; padding-top: 14px; font-size: 11.5px; color: var(--text-sub); }
.hbar-legend .sw { display: inline-block; width: 9px; height: 9px; border-radius: 2px; margin-right: 5px; vertical-align: middle; }

/* 카드 하단 고정 푸터 (더보기·총계 — flex-column 카드 바닥에 앵커) */
.card-foot { margin-top: auto; padding: 10px 16px; border-top: 1px solid var(--line); display: flex; align-items: center; font-size: 12px; color: var(--text-sub); }
.card-foot a { margin-left: auto; font-weight: 700; }
.card-box > .table-scroll { overflow: auto; }

/* ---------------- 요약 집계표 (Overview 3분할) ---------------- */
.sum-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.sum-table th {
  padding: 9px 10px; font-size: 12.5px; color: var(--text-sub); font-weight: 700;
  border-bottom: 1.5px solid var(--line-strong); text-align: right; white-space: nowrap;
}
.sum-table th:first-child { text-align: left; }
.sum-table td { padding: 8px 10px; border-bottom: 1px solid var(--line); text-align: right; white-space: nowrap; }
.sum-table td:first-child { text-align: left; font-weight: 600; }
.sum-table tr.total td { font-weight: 800; background: #f7f9fc; border-bottom: 1.5px solid var(--line-strong); }
.sum-table tbody tr:not(.total):hover { background: var(--hover); }
.sum-table td .lbl-team { font-size: 11px; color: var(--text-sub); margin-right: 5px; }
.sum-table .num { color: var(--accent-strong); font-weight: 700; }
.sum-table .zero { color: #b9c3ce; }

/* ---------------- 담당자별 실적 카드 ---------------- */
.reps-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 16px; margin-top: 16px; }
.rep-card { display: flex; flex-direction: column; }
.rep-head { display: flex; align-items: center; gap: 12px; padding: 16px 18px 14px; border-bottom: 1px solid var(--line); }
.rep-avatar {
  width: 44px; height: 44px; border-radius: 50%; flex-shrink: 0;
  background: var(--accent); color: #fff; display: flex; align-items: center; justify-content: center;
  font-size: 14px; font-weight: 800;
}
.rep-name-row { min-width: 0; }
.rep-name { font-size: 15px; font-weight: 800; display: flex; align-items: center; gap: 6px; }
.rep-name .pos { font-size: 11.5px; font-weight: 600; color: var(--text-sub); }
.rep-meta { font-size: 11.5px; color: var(--text-sub); margin-top: 3px; }
.rep-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.rep-stat { text-align: center; padding: 2px 4px; }
.rep-stat .v { font-size: 17px; font-weight: 800; color: var(--navy); line-height: 1.2; }
.rep-stat .l { font-size: 11px; color: var(--text-sub); margin-top: 3px; }
.rep-products { padding: 12px 18px 16px; flex: 1; display: flex; flex-direction: column; gap: 8px; }
.rep-products .rp-title { font-size: 11.5px; color: var(--text-sub); font-weight: 700; margin-bottom: 2px; }
.rep-prow { display: flex; align-items: center; gap: 8px; font-size: 12px; }
.rep-prow .rp-name { width: 92px; flex-shrink: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rep-prow .rp-bar { flex: 1; height: 8px; background: #eef1f5; border-radius: 4px; overflow: hidden; }
.rep-prow .rp-bar > i { display: block; height: 100%; background: var(--accent-strong); border-radius: 4px; }
.rep-prow .rp-cnt { width: 26px; text-align: right; font-weight: 700; flex-shrink: 0; }
.rep-empty { font-size: 11.5px; color: var(--text-sub); text-align: center; padding: 10px 0; }

/* ---------------- 미니 바 리스트 (상세패널 이력/추이용) ---------------- */
.mbar-list { display: flex; flex-direction: column; gap: 7px; margin: 6px 0 4px; }
.mbar-row { display: flex; align-items: center; gap: 8px; font-size: 12.5px; }
.mbar-row .mb-label { width: 84px; flex-shrink: 0; color: var(--text-sub); }
.mbar-row.now .mb-label { color: var(--text); font-weight: 700; }
.mbar-row .mb-track { flex: 1; height: 9px; background: #eef1f5; border-radius: 4px; overflow: hidden; }
.mbar-row .mb-track > i { display: block; height: 100%; background: #9ec5f4; border-radius: 4px; }
.mbar-row.now .mb-track > i { background: var(--accent-strong); }
.mbar-row .mb-val { width: 66px; text-align: right; font-weight: 700; flex-shrink: 0; }

/* ---------------- 데이터 그리드 ---------------- */
.grid-toolbar {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 14px; border-bottom: 1px solid var(--line);
  flex-wrap: wrap;
}
.tbtn {
  display: inline-flex; align-items: center; gap: 5px;
  border: 1px solid var(--line-strong); background: var(--card); color: var(--text);
  border-radius: 7px; padding: 5px 11px; font-size: 12.5px; font-weight: 600;
}
.tbtn:hover { background: var(--hover); border-color: var(--accent); }
.tbtn.primary { background: var(--accent-strong); border-color: var(--accent-strong); color: #fff; }
.tbtn:disabled { opacity: .45; cursor: default; }
.tbtn:disabled:hover { background: var(--card); border-color: var(--line-strong); }
.grid-search {
  flex: 0 1 300px; min-width: 170px;
  border: 1px solid var(--line-strong); border-radius: 7px;
  padding: 6px 11px; font-size: 13px; font-family: inherit;
}
.grid-search:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(0,164,235,.12); }
.grid-toolbar .spacer { flex: 1; }
.grid-toolbar .rowcount { font-size: 12px; color: var(--text-sub); white-space: nowrap; }

.grid-wrap { overflow: auto; max-height: calc(100vh - 260px); }
.grid-empty { text-align: center; color: #9aa7b5; padding: 38px 0; line-height: 1.7; }
.filter-badge {
  font-size: 12px; font-weight: 600; color: var(--accent-strong);
  background: #e5f4fd; border-radius: 20px; padding: 4px 10px;
  display: inline-flex; align-items: center; gap: 5px; white-space: nowrap;
}
.filter-badge-clear { border: 0; background: none; color: var(--accent-strong); font-weight: 700; text-decoration: underline; padding: 0; font-size: 12px; }
.sel-info { font-size: 12px; font-weight: 700; color: var(--navy); background: #eef1f5; border-radius: 20px; padding: 4px 10px; white-space: nowrap; }

/* 빠른 필터 pill (툴바) */
.qf-wrap { display: inline-flex; }
.qf-pill {
  display: inline-flex; align-items: center; gap: 6px;
  border: 1px solid var(--line-strong); background: var(--card); color: var(--text);
  border-radius: 7px; padding: 5px 10px; font-size: 12.5px; font-weight: 600; white-space: nowrap;
}
.qf-pill:hover { border-color: var(--accent); background: var(--hover); }
.qf-pill svg { color: var(--text-sub); flex-shrink: 0; }
.qf-pill.on { background: rgba(0,164,235,.1); border-color: var(--accent); color: var(--accent-strong); }
.qf-pill.on svg { color: var(--accent-strong); }
.qf-pill .qf-caret { color: var(--text-sub); font-size: 11px; }
.qf-pill .qf-x { display: inline-flex; align-items: center; justify-content: center; width: 15px; height: 15px; border-radius: 50%; font-size: 10px; background: rgba(11,127,212,.16); }
.qf-pill .qf-x:hover { background: var(--accent-strong); color: #fff; }
.qf-pop { min-width: 180px; max-width: 240px; }
.qf-pop .fp-list { padding: 5px; }
.qf-opt {
  display: flex; align-items: center; width: 100%; gap: 8px;
  border: 0; background: none; color: var(--text); text-align: left;
  padding: 7px 9px; font-size: 12.5px; font-weight: 600; border-radius: 6px;
}
.qf-opt:hover { background: var(--hover); }
.qf-opt.sel { color: var(--accent-strong); background: rgba(0,164,235,.08); }
.qf-opt .qf-cnt { margin-left: auto; font-size: 11px; font-weight: 700; color: var(--text-sub); background: var(--bg); border-radius: 10px; padding: 1px 7px; }
.qf-opt.sel .qf-cnt { color: var(--accent-strong); }

.grid-pagination {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 9px 14px; border-top: 1px solid var(--line); font-size: 12.5px; color: var(--text-sub); flex-wrap: wrap;
}
.pg-size-label { display: inline-flex; align-items: center; gap: 6px; }
.pg-size { border: 1px solid var(--line-strong); border-radius: 6px; padding: 3px 6px; font: inherit; font-size: 12.5px; }
.pg-controls { display: inline-flex; align-items: center; gap: 10px; }
.pg-controls .pg-page { font-weight: 600; color: var(--text); white-space: nowrap; }
.pg-prev, .pg-next {
  border: 1px solid var(--line-strong); background: var(--card); border-radius: 6px;
  padding: 4px 10px; font-size: 12.5px; font-weight: 600; color: var(--text); cursor: pointer;
}
.pg-prev:hover:not(:disabled), .pg-next:hover:not(:disabled) { background: var(--hover); border-color: var(--accent); }
.pg-prev:disabled, .pg-next:disabled { opacity: .4; cursor: default; }
table.grid { border-collapse: separate; border-spacing: 0; width: 100%; font-size: 13px; }
table.grid thead th {
  position: sticky; top: 0; z-index: 5;
  background: #f7f9fc; color: var(--text);
  font-size: 12.5px; font-weight: 700;
  border-bottom: 1.5px solid var(--line-strong);
  border-right: 1px solid var(--line);
  padding: 9px 10px; text-align: left; white-space: nowrap;
  user-select: none;
}
table.grid thead th .th-inner { display: flex; align-items: center; gap: 6px; }
table.grid thead th .flt {
  border: 0; background: none; color: #9fb0c1; padding: 3px; border-radius: 4px;
  display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; margin-left: auto;
}
table.grid thead th .flt svg { width: 11px; height: 10px; fill: currentColor; }
table.grid thead th .flt:hover { color: var(--accent-strong); background: #e8f2fb; }
table.grid thead th .flt.on { color: var(--accent-strong); }
table.grid thead th.sorted { color: var(--accent-strong); }
table.grid thead th .sort-ic { width: 9px; height: 9px; fill: var(--accent-strong); flex-shrink: 0; margin-left: 1px; vertical-align: middle; }
table.grid thead th .sort-ic.dim { fill: #c2ccd6; }
table.grid thead th .th-lbl:hover .sort-ic.dim { fill: #8a97a5; }
table.grid td {
  border-bottom: 1px solid var(--line);
  border-right: 1px solid #eef2f6;
  padding: 7px 10px; white-space: nowrap; background: var(--card);
}
table.grid tbody tr:hover td { background: var(--hover); }
table.grid td.num, table.grid th.num .th-inner { justify-content: flex-end; }
table.grid td.num { text-align: right; font-variant-numeric: tabular-nums; }
table.grid td.center { text-align: center; }
table.grid td.col-yellow { background: var(--yellow-col); }
table.grid td.col-green { background: var(--green-col); }
table.grid tbody tr:hover td.col-yellow { background: #fdf0c0; }
table.grid tbody tr:hover td.col-green { background: #ddf1e5; }
table.grid td.editable { cursor: text; }
table.grid td.editable:hover { outline: 1.5px dashed var(--accent-strong); outline-offset: -2px; background: #f0f8fe; }
table.grid thead th .th-lbl {
  user-select: none; border: 0; background: none; padding: 0; margin: 0;
  font: inherit; font-weight: 700; color: inherit; cursor: pointer;
  display: inline-flex; align-items: center; gap: 6px;
}
table.grid thead th .th-lbl:focus-visible,
table.grid thead th .flt:focus-visible,
table.grid tbody tr[role=button]:focus-visible {
  outline: 2px solid var(--accent-strong); outline-offset: 1px;
}
table.grid tbody tr[role=button] { cursor: pointer; }
table.grid td .code { color: var(--text); font-weight: 700; }
table.grid td .track-btn {
  display: inline-flex; align-items: center; gap: 3px;
  border: 1px solid var(--line-strong); border-radius: 6px; padding: 2px 8px;
  font-size: 11.5px; font-weight: 700; color: var(--accent-strong); background: var(--card); white-space: nowrap;
}
table.grid td .track-btn:hover { background: rgba(0,164,235,.1); border-color: var(--accent); }
table.grid td .pos { color: var(--green); font-weight: 700; }
table.grid td .neg { color: var(--red); font-weight: 700; }
table.grid td.rownum { color: #a6b2bf; font-size: 11.5px; text-align: right; background: #fbfcfe; }
table.grid .chk { accent-color: var(--accent-strong); }

/* 상태 칩 */
.chip {
  display: inline-block; padding: 2.5px 9px; border-radius: 20px;
  font-size: 11.5px; font-weight: 700; line-height: 1.4;
}
.chip.blue   { background: #e5f4fd; color: #0b7fd4; }
.chip.green  { background: #e7f6ec; color: #17854a; }
.chip.amber  { background: #fdf3e0; color: #b07818; }
.chip.red    { background: #fdeaea; color: #c33; }
.chip.gray   { background: #eef1f5; color: #66788c; }
.chip.navy   { background: #e8edf5; color: #0e3a66; }
.chip.violet { background: #efeafb; color: #6d4fc4; }

/* 필터 팝업 */
.flt-pop {
  position: absolute; z-index: 50;
  background: var(--card); border: 1px solid var(--line-strong); border-radius: 9px;
  box-shadow: 0 8px 24px rgba(16,42,74,.16);
  min-width: 190px; max-width: 270px; max-height: 320px;
  display: flex; flex-direction: column;
}
.flt-pop .fp-head { padding: 8px 11px; border-bottom: 1px solid var(--line); display: flex; gap: 8px; font-size: 12px; }
.flt-pop .fp-head button { border: 0; background: none; color: var(--accent-strong); font-weight: 700; font-size: 12px; }
.flt-pop .fp-list { overflow: auto; padding: 6px 4px; }
.flt-pop label {
  display: flex; align-items: center; gap: 7px;
  padding: 4.5px 9px; font-size: 12.5px; border-radius: 6px; cursor: pointer;
}
.flt-pop label:hover { background: var(--hover); }

/* ---------------- 카테고리/스테이지 카드 그리드 ---------------- */
.cat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 13px; margin-bottom: 18px; }
.cat-card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 14px 16px 12px; cursor: pointer;
  transition: border-color .12s, transform .12s;
}
.cat-card:hover { border-color: var(--accent); transform: translateY(-1px); }
.cat-card.selected { border-color: var(--accent-strong); box-shadow: 0 0 0 2px rgba(0,164,235,.18); }
.cat-card .c-name { font-size: 14px; font-weight: 800; margin-bottom: 6px; }
.cat-card .c-count { font-size: 15px; font-weight: 800; color: var(--accent-strong); }
.cat-card .c-count small { font-size: 11.5px; color: var(--text-sub); font-weight: 600; margin-left: 4px; }
.cat-card .c-sub { font-size: 11.5px; color: var(--text-sub); margin-top: 3px; }

/* ---------------- 좌측 사이드 + 본문 (게시판형) ---------------- */
.split { display: grid; grid-template-columns: 210px 1fr; gap: 16px; align-items: start; }
.side-menu { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 9px 7px; }
.side-menu .sm-title { font-size: 11.5px; color: var(--text-sub); padding: 6px 10px; }
.side-menu a {
  display: block; padding: 8px 11px; border-radius: 7px;
  font-size: 13.5px; font-weight: 600; color: var(--text);
}
.side-menu a:hover { background: var(--hover); }
.side-menu a.active { background: #e5f4fd; color: var(--accent-strong); font-weight: 700; }

/* ---------------- 상세 슬라이드 패널 ---------------- */
.detail-mask { position: fixed; inset: 0; background: rgba(10,30,55,.35); z-index: 190; }
.detail-panel {
  position: fixed; top: 0; right: 0; bottom: 0; width: 480px; max-width: 92vw;
  background: var(--card); z-index: 200; box-shadow: -12px 0 34px rgba(10,30,55,.25);
  display: flex; flex-direction: column;
}
.detail-panel .dp-head { padding: 16px 20px; border-bottom: 1px solid var(--line); display: flex; align-items: center; }
.detail-panel .dp-head h3 { font-size: 17px; font-weight: 800; }
.detail-panel .dp-head .x { margin-left: auto; border: 0; background: none; font-size: 20px; color: var(--text-sub); }
.detail-panel .dp-body { padding: 16px 20px; overflow: auto; }
.dp-body .dl { display: grid; grid-template-columns: 110px 1fr; gap: 8px 12px; font-size: 13.5px; }
.dp-body .dl dt { color: var(--text-sub); font-weight: 600; }
.dp-body .dl dd { font-weight: 600; }
.dp-body h4 { font-size: 13.5px; font-weight: 800; margin: 20px 0 8px; color: var(--navy); }

/* ---------------- 확인 다이얼로그 ---------------- */
.confirm-mask { position: fixed; inset: 0; background: rgba(10,30,55,.4); z-index: 290; }
.confirm-box {
  position: fixed; top: 50%; left: 50%; transform: translate(-50%,-50%);
  width: 380px; max-width: 92vw; background: var(--card); border-radius: 12px;
  box-shadow: 0 20px 50px rgba(10,30,55,.3); z-index: 300; padding: 20px 22px;
}
.confirm-box h4 { font-size: 16px; font-weight: 800; margin-bottom: 8px; }
.confirm-box p { font-size: 13px; color: var(--text-sub); line-height: 1.6; }
.confirm-box.danger h4 { color: var(--red); }
.confirm-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 18px; }
.cbtn {
  border-radius: 7px; padding: 7px 16px; font-size: 13px; font-weight: 700; cursor: pointer;
  border: 1px solid var(--line-strong); background: var(--card); color: var(--text);
}
.cbtn:hover { background: var(--hover); }
.cbtn.confirm { background: var(--accent-strong); border-color: var(--accent-strong); color: #fff; }
.cbtn.confirm:hover { filter: brightness(1.06); }
.confirm-box.danger .cbtn.confirm { background: var(--red); border-color: var(--red); }
.cbtn:focus-visible { outline: 2px solid var(--accent-strong); outline-offset: 2px; }

/* ---------------- 로딩 스켈레톤 ---------------- */
@keyframes sk-pulse { 0%,100% { opacity: .55; } 50% { opacity: 1; } }
.skel { animation: sk-pulse 1.3s ease-in-out infinite; }
.sk-bar { background: #e4e9ef; border-radius: 6px; height: 12px; }
.sk-w60 { width: 60%; } .sk-w40 { width: 40%; } .sk-w30 { width: 30%; }
.skel-card { padding: 16px 20px; }
.sk-table { margin-top: 16px; display: flex; flex-direction: column; gap: 10px; }
.sk-row { height: 30px; background: #eef1f5; border-radius: 6px; animation: sk-pulse 1.3s ease-in-out infinite; }

/* ---------------- 플로팅 버튼 ---------------- */
.fab {
  position: fixed; right: 26px; bottom: 26px; z-index: 150;
  width: 52px; height: 52px; border-radius: 50%;
  background: var(--accent-strong); color: #fff; border: 0;
  font-size: 21px; box-shadow: 0 6px 18px rgba(11,127,212,.4);
  display: flex; align-items: center; justify-content: center;
}
.fab:hover { background: var(--accent); }

/* ---------------- 진행 미니바 ---------------- */
.mini-track { display: inline-block; width: 84px; height: 7px; background: #e8edf3; border-radius: 4px; overflow: hidden; vertical-align: middle; margin-right: 7px; }
.mini-fill { height: 100%; border-radius: 4px; background: var(--accent-strong); }
.mini-fill.warn { background: var(--amber); }
.mini-fill.bad { background: var(--red); }

/* ---------------- 반응형 ---------------- */
@media (max-width: 1500px) { .kpi-row { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 1100px) {
  .grid-cols.three { grid-template-columns: 1fr !important; }
  .split { grid-template-columns: 1fr; }
}
@media (max-width: 760px) {
  .kpi-row { grid-template-columns: repeat(2, 1fr); }
  .content { padding: 14px 12px 40px; }
  .page-head { padding: 0 12px; }
  .topbar .who { display: none; }
}
