/* ============================================================
   기술지원팀 업무 현황 — 공통 테마 (v4)
   build: v14   ← 템플릿의 theme.css?v=N 과 같아야 함 (deploy_check 가 비교)
   WorkTodo 디자인 시스템 기준: Pretendard · 슬레이트 중립색 · 얇은 테두리 · 좌측 사이드바
   모든 페이지(메인·관리자·로그인)가 이 파일 하나를 공유한다.
   ============================================================ */

@font-face {
  font-family: 'Pretendard';
  src: url('../vendor/pretendard.woff2') format('woff2');
  font-weight: 45 920;
  font-display: swap;
}

/* ---------- 디자인 토큰 ---------- */
:root {
  color-scheme: light;
  --canvas: #f3f4f6;
  --surface: #ffffff;
  --surface-2: #f8f9fb;
  --surface-3: #f1f3f6;
  --hover: rgba(15, 23, 42, .045);
  --active: rgba(15, 23, 42, .075);
  --border: #e6e8ec;
  --border-strong: #d7dbe1;
  --text: #0f172a;
  --text-2: #475569;
  --text-3: #8a94a6;
  --brand: #2563eb;
  --brand-soft: rgba(37, 99, 235, .1);
  --brand-strong: #1d4ed8;
  --ok: #059669;
  --ok-soft: rgba(5, 150, 105, .11);
  --warn: #d97706;
  --warn-soft: rgba(217, 119, 6, .12);
  --danger: #dc2626;
  --danger-soft: rgba(220, 38, 38, .09);
  --violet: #7c3aed;
  --violet-soft: rgba(124, 58, 237, .11);
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, .05);
  --shadow: 0 1px 2px rgba(15, 23, 42, .04), 0 4px 16px rgba(15, 23, 42, .06);
  --shadow-lg: 0 12px 40px rgba(15, 23, 42, .14), 0 2px 6px rgba(15, 23, 42, .06);
  --radius: 12px;
  --radius-sm: 8px;
  --sb-w: 240px;
  --ease: cubic-bezier(.2, .8, .2, 1);
  --font: 'Pretendard', -apple-system, 'Apple SD Gothic Neo', 'Malgun Gothic', system-ui, sans-serif;
}

/* 다크 모드: 메인 화면은 body.dark(토글), 관리자 화면은 html.dark(저장된 설정 적용) */
html.dark, body.dark {
  color-scheme: dark;
  --canvas: #0b0c0f;
  --surface: #131418;
  --surface-2: #181a1f;
  --surface-3: #1e2026;
  --hover: rgba(255, 255, 255, .05);
  --active: rgba(255, 255, 255, .085);
  --border: #24262d;
  --border-strong: #31343c;
  --text: #eceef2;
  --text-2: #a9b0bd;
  --text-3: #6f7685;
  --brand: #4f8cff;
  --brand-soft: rgba(79, 140, 255, .14);
  --brand-strong: #6b9dff;
  --ok: #34d399;
  --ok-soft: rgba(52, 211, 153, .13);
  --warn: #fbbf24;
  --warn-soft: rgba(251, 191, 36, .13);
  --danger: #f2555a;
  --danger-soft: rgba(242, 85, 90, .13);
  --violet: #a78bfa;
  --violet-soft: rgba(167, 139, 250, .14);
  --shadow-sm: none;
  --shadow: 0 1px 0 rgba(255, 255, 255, .03), 0 6px 20px rgba(0, 0, 0, .35);
  --shadow-lg: 0 18px 50px rgba(0, 0, 0, .55);
}

/* ---------- 기본 ---------- */
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }   /* .btn 등 display 지정 요소도 hidden 속성 존중 */
* { margin: 0; padding: 0; }
html { background: var(--canvas); }
body {
  font-family: var(--font);
  font-size: 13.5px;
  line-height: 1.5;
  background: var(--canvas);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  letter-spacing: -0.005em;
}
button, input, select, textarea { font-family: inherit; letter-spacing: inherit; }
button { cursor: pointer; }
a { color: var(--brand); }
h1, h2, h3, h4 { letter-spacing: -0.02em; }
:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; border-radius: 6px; }
::selection { background: var(--brand-soft); }
* { scrollbar-width: thin; scrollbar-color: var(--border-strong) transparent; }
.ic { flex: none; display: block; }
.num, .card-value, .bar-count, .result-count { font-variant-numeric: tabular-nums; }

/* ---------- 버튼 ---------- */
.btn,
.upload-btn, .btn-reset, .btn-csv, .btn-write, .btn-back, .btn-edit, .btn-delete,
.btn-cancel, .btn-submit, .btn-add, .btn-save, .btn-secondary, .btn-primary,
.btn-danger, .btn-warn, .btn-pw, .btn-toggle, .btn-del, .btn-co {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 32px; padding: 0 12px; border-radius: 9px;
  background: var(--surface); border: 1px solid var(--border-strong); color: var(--text);
  font-family: inherit; font-weight: 600; font-size: 13px; white-space: nowrap; text-decoration: none;
  box-shadow: var(--shadow-sm); cursor: pointer;
  transition: background .15s, border-color .15s, color .15s, transform .08s, filter .15s;
}
.btn:hover,
.upload-btn:hover, .btn-reset:hover, .btn-csv:hover, .btn-back:hover, .btn-cancel:hover,
.btn-secondary:hover, .btn-edit:hover, .btn-pw:hover, .btn-toggle:hover, .btn-co:hover { background: var(--surface-2); border-color: var(--border-strong); }
.btn:active, .upload-btn:active, .btn-submit:active, .btn-write:active { transform: translateY(1px); }
.btn:disabled, button:disabled { opacity: .5; cursor: default; transform: none; }

/* 주 버튼 */
.btn.primary, .upload-btn.primary, .btn-write, .btn-submit, .btn-add, .btn-save, .btn-primary {
  background: var(--brand); border-color: transparent; color: #fff;
  box-shadow: 0 1px 2px rgba(37, 99, 235, .3);
}
.btn.primary:hover, .upload-btn.primary:hover, .btn-write:hover, .btn-submit:hover,
.btn-add:hover, .btn-save:hover, .btn-primary:hover { background: var(--brand); filter: brightness(1.07); }

/* 보조 색 버튼 */
.btn-csv { color: var(--ok); }
.btn-edit, .btn-pw { color: var(--brand); }
.btn-toggle, .btn-warn { color: var(--warn); }
.btn-delete, .btn-del, .btn-danger, .btn.danger-ghost { color: var(--danger); }
.btn-delete:hover, .btn-del:hover, .btn-danger:hover, .btn.danger-ghost:hover { background: var(--danger-soft); border-color: color-mix(in srgb, var(--danger) 35%, var(--border-strong)); }
.btn-warn:hover { background: var(--warn-soft); }
.btn-delete { margin-left: auto; }

.btn.ghost { background: transparent; border-color: transparent; box-shadow: none; color: var(--text-2); }
.btn.ghost:hover { background: var(--hover); color: var(--text); }
.btn.sm { height: 28px; padding: 0 10px; font-size: 12.5px; border-radius: 8px; }

.icon-btn {
  display: inline-grid; place-items: center; width: 32px; height: 32px; border-radius: 8px;
  background: transparent; border: 0; color: var(--text-2); cursor: pointer;
  transition: background .15s, color .15s; text-decoration: none;
}
.icon-btn:hover { background: var(--hover); color: var(--text); }

/* ---------- 입력 ---------- */
input[type="text"], input[type="password"], input[type="number"], input[type="search"],
input[type="date"], input[type="email"], input[type="month"], select, textarea {
  height: 34px; padding: 0 11px; border-radius: 9px;
  border: 1px solid var(--border-strong); background: var(--surface); color: var(--text);
  font-family: inherit; font-size: 13px; outline: none; min-width: 0;
  transition: border-color .15s, box-shadow .15s;
}
textarea { height: auto; padding: 9px 11px; line-height: 1.6; }
input:focus, select:focus, textarea:focus { border-color: var(--brand) !important; box-shadow: 0 0 0 3px var(--brand-soft); }
input::placeholder, textarea::placeholder { color: var(--text-3); }
input[type="checkbox"], input[type="radio"] { accent-color: var(--brand); }
select { padding-right: 28px; appearance: none; -webkit-appearance: none; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%238a94a6' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 9px center; }

/* ============================================================
   앱 셸 — 좌측 사이드바 + 메인 패널 (index.html)
   ============================================================ */
.app { display: grid; grid-template-columns: var(--sb-w) minmax(0, 1fr); min-height: 100vh; }
.sidebar {
  position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; gap: 4px;
  padding: 12px 10px 10px; min-width: 0;
}
.sb-brand { display: flex; align-items: center; gap: 10px; padding: 6px 8px 12px; min-width: 0; }
.brand-mark {
  width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; flex: none;
  background: linear-gradient(135deg, #3b82f6, #6366f1); color: #fff;
  box-shadow: 0 4px 12px rgba(59, 130, 246, .3);
}
.brand-text { display: flex; flex-direction: column; min-width: 0; line-height: 1.25; flex: 1; }
.brand-text b { font-size: 14.5px; font-weight: 750; letter-spacing: -0.02em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.brand-text small { font-size: 11.5px; color: var(--text-3); }
.sb-label { font-size: 11.5px; font-weight: 650; color: var(--text-3); padding: 10px 10px 4px; letter-spacing: .02em; }
.sb-nav { display: flex; flex-direction: column; gap: 1px; }
.sb-nav .nav-item {
  display: flex; align-items: center; gap: 10px; height: 36px; padding: 0 10px; border-radius: 9px;
  color: var(--text-2); font-weight: 550; font-size: 13.5px; cursor: pointer; user-select: none;
  transition: background .12s, color .12s;
}
.sb-nav .nav-item .ic { color: var(--text-3); transition: color .12s; }
.sb-nav .nav-item:hover { background: var(--hover); color: var(--text); }
.sb-nav .nav-item.active {
  background: var(--surface); color: var(--text); font-weight: 680;
  box-shadow: var(--shadow-sm), 0 0 0 1px var(--border);
}
.sb-nav .nav-item.active .ic { color: var(--brand); }
.sb-spacer { flex: 1; }
.sb-foot { display: flex; flex-direction: column; gap: 4px; padding-top: 8px; border-top: 1px solid var(--border); }
.sb-user { display: flex; align-items: center; gap: 10px; padding: 6px 8px; border-radius: 10px; min-width: 0; }
.avatar {
  width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; flex: none;
  background: var(--brand-soft); color: var(--brand); font-weight: 750; font-size: 13px;
}
.sb-user .who { display: flex; flex-direction: column; min-width: 0; flex: 1; line-height: 1.25; }
.sb-user .who b { font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sb-user .who small { font-size: 11.5px; color: var(--text-3); }
.sb-actions { display: flex; align-items: center; gap: 2px; }
.sb-link {
  display: flex; align-items: center; gap: 10px; height: 34px; padding: 0 10px; border-radius: 9px;
  color: var(--text-2); font-weight: 550; font-size: 13px; text-decoration: none;
}
.sb-link .ic { color: var(--text-3); }
.sb-link:hover { background: var(--hover); color: var(--text); }

.main {
  margin: 8px 8px 8px 0; min-width: 0; min-height: calc(100vh - 16px);
  background: var(--surface); border: 1px solid var(--border); border-radius: 16px;
  box-shadow: var(--shadow-sm);
}
.page-head {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  padding: 18px 28px 14px; border-bottom: 1px solid var(--border);
}
.page-title { display: flex; align-items: baseline; gap: 10px; flex: 1; min-width: 0; }
.page-title h1 { font-size: 21px; font-weight: 750; line-height: 1.25; white-space: nowrap; }
.nav-total { font-size: 12.5px; color: var(--text-3); white-space: nowrap; font-variant-numeric: tabular-nums; }
.page-actions { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.only-mobile { display: none !important; }
#file-input { display: none; }
.upload-status { font-size: 12px; color: var(--text-3); max-width: 260px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.upload-status.ok { color: var(--ok); }
.upload-status.err { color: var(--danger); }
.spinner { display: none; width: 13px; height: 13px; border: 2px solid rgba(255, 255, 255, .45); border-top-color: #fff; border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.scrim { display: none; }

/* 연도·월·담당자 필터 */
#year-month-bar, #person-bar {
  display: flex; align-items: center; gap: 4px; flex-wrap: wrap;
  padding: 10px 28px; border-bottom: 1px solid var(--border); background: transparent;
}
#person-bar { padding-top: 8px; }
.mb-label { font-size: 12px; color: var(--text-3); font-weight: 650; margin-right: 6px; min-width: 34px; white-space: nowrap; }
.bar-divider { width: 1px; height: 18px; background: var(--border-strong); margin: 0 10px; color: transparent; overflow: hidden; }
.year-btn, .month-btn, .person-btn {
  height: 28px; padding: 0 11px; border-radius: 8px; border: 1px solid transparent; background: transparent;
  color: var(--text-2); font-family: inherit; font-size: 12.5px; font-weight: 600; white-space: nowrap; cursor: pointer;
  transition: background .12s, color .12s, border-color .12s;
}
.year-btn:hover, .month-btn:hover, .person-btn:hover { background: var(--hover); color: var(--text); }
.year-btn.active, .month-btn.active, .person-btn.active {
  background: var(--brand-soft); color: var(--brand); border-color: color-mix(in srgb, var(--brand) 22%, transparent);
}
#month-total { margin-left: auto; font-size: 12px; color: var(--text-3); white-space: nowrap; font-variant-numeric: tabular-nums; }

/* ---------- 탭 영역 ---------- */
.tab-content { display: none; padding: 22px 28px 48px; }
.tab-content.active { display: block; animation: tabin .18s var(--ease); }
@keyframes tabin { from { opacity: 0; transform: translateY(3px); } }

/* 통계 카드 */
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; margin-bottom: 18px; }
.card {
  --c: var(--brand);
  position: relative; background: var(--surface); border: 1px solid var(--border); border-radius: 14px;
  padding: 15px 16px 14px; box-shadow: var(--shadow-sm); transition: border-color .15s, box-shadow .15s;
}
.card:hover { border-color: var(--border-strong); box-shadow: var(--shadow); }
.card.green { --c: var(--ok); }
.card.orange { --c: #f59e0b; }
.card.purple { --c: var(--violet); }
.card.red { --c: var(--danger); }
.card-label { display: flex; align-items: center; gap: 7px; font-size: 12.5px; color: var(--text-2); font-weight: 600; margin-bottom: 8px; }
.card-label::before { content: ''; width: 8px; height: 8px; border-radius: 3px; background: var(--c); flex: none; }
.card-value { font-size: 26px; font-weight: 750; letter-spacing: -0.03em; line-height: 1.15; color: var(--text); }
.card-sub { font-size: 12px; color: var(--text-3); margin-top: 4px; }

/* 차트 박스 */
.charts-row { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 14px; margin-bottom: 18px; }
.charts-flex { display: flex !important; flex-wrap: wrap; align-items: stretch; }
.charts-flex > .chart-box { flex: 1 1 calc(33.333% - 10px); min-width: 280px; }
.chart-box {
  background: var(--surface); border: 1px solid var(--border); border-radius: 14px;
  padding: 16px 18px; box-shadow: var(--shadow-sm);
}
.chart-box h3 { font-size: 14px; color: var(--text); margin-bottom: 12px; font-weight: 700; }
.bar-item { display: flex; align-items: center; margin-bottom: 7px; }
.bar-label { width: 90px; font-size: 12px; color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; flex-shrink: 0; }
#chart-company .bar-label, #chart-cp .bar-label { width: 185px !important; }
.bar-track { flex: 1; background: var(--surface-3); border-radius: 6px; height: 14px; margin: 0 8px; overflow: hidden; }
.bar-fill { height: 100%; border-radius: 6px; background: var(--brand); }
.bar-fill.green { background: var(--ok); }
.bar-count { font-size: 12px; font-weight: 650; color: var(--text); width: 40px; text-align: right; }
.donut-wrap { display: flex; align-items: center; justify-content: center; gap: 16px; }
.donut-legend { font-size: 12px; color: var(--text-2); }
.donut-legend-item { display: flex; align-items: center; gap: 6px; margin-bottom: 6px; }
.donut-dot { width: 9px; height: 9px; border-radius: 3px; }

/* 검색·필터 줄 */
.filters {
  display: flex; flex-wrap: wrap; gap: 8px; align-items: center;
  background: var(--surface-2); border: 1px solid var(--border); border-radius: 12px;
  padding: 10px 12px; margin-bottom: 14px;
}
.filters input[type="text"] { width: 240px; }
.filter-label { font-size: 12px; color: var(--text-3); font-weight: 650; margin-left: 4px; }
.cmp-sel { height: 28px; padding: 0 24px 0 8px; font-size: 12px; border-radius: 7px; background-position: right 6px center; }
.result-count { margin-left: auto; font-size: 12.5px; color: var(--text-3); font-weight: 600; }

/* 표 */
.table-wrap { background: var(--surface); border: 1px solid var(--border); border-radius: 14px; overflow: hidden; }
.table-scroll { overflow-x: auto; max-height: 600px; overflow-y: auto; }
.table-scroll table { min-width: 900px; }
table { width: 100%; border-collapse: collapse; }
thead { position: sticky; top: 0; z-index: 10; }
thead th {
  background: var(--surface-2); color: var(--text-3); padding: 9px 12px; text-align: left;
  font-size: 12px; font-weight: 650; white-space: nowrap; border-bottom: 1px solid var(--border);
}
.table-scroll thead th { cursor: pointer; user-select: none; }
.table-scroll thead th:hover { color: var(--text); background: var(--surface-3); }
thead th.sort-asc::after { content: ' ↑'; color: var(--brand); }
thead th.sort-desc::after { content: ' ↓'; color: var(--brand); }
tbody tr { border-bottom: 1px solid var(--border); transition: background .1s; }
tbody tr:last-child { border-bottom: 0; }
tbody tr:hover { background: var(--hover); }
tbody td { padding: 9px 12px; font-size: 13px; vertical-align: middle; color: var(--text); }
.td-long { max-width: 280px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* 배지 */
.badge {
  display: inline-flex; align-items: center; height: 22px; padding: 0 8px; border-radius: 6px;
  background: var(--surface-3); color: var(--text-2); font-size: 11.5px; font-weight: 650; white-space: nowrap;
}
.b-done { background: var(--ok-soft); color: var(--ok); }
.b-FS, .b-FL, .b-FM { background: var(--brand-soft); color: var(--brand); }
.b-PS, .b-PL, .b-PM { background: var(--warn-soft); color: #c2410c; }
.b-FU { background: var(--violet-soft); color: var(--violet); }
.b-PU { background: rgba(219, 39, 119, .1); color: #be185d; }
.b-BS { background: rgba(13, 148, 136, .11); color: #0f766e; }
.b-BL { background: rgba(79, 70, 229, .1); color: #4338ca; }
html.dark .b-PS, body.dark .b-PS, body.dark .b-PL, body.dark .b-PM { color: #fb923c; }
body.dark .b-PU { color: #f472b6; } body.dark .b-BS { color: #2dd4bf; } body.dark .b-BL { color: #a5b4fc; }

/* 페이지네이션 */
.pagination { display: flex; justify-content: center; align-items: center; gap: 4px; padding: 12px; border-top: 1px solid var(--border); flex-wrap: wrap; }
.page-btn, .pag-btn {
  min-width: 30px; height: 30px; padding: 0 8px; border-radius: 8px; border: 1px solid transparent;
  background: transparent; color: var(--text-2); font-family: inherit; font-size: 12.5px; font-weight: 600; cursor: pointer;
}
.page-btn:hover, .pag-btn:hover { background: var(--hover); color: var(--text); }
.page-btn.active, .pag-btn.active { background: var(--brand); color: #fff; }
.page-info, .pag-info { font-size: 12.5px; color: var(--text-3); margin: 0 8px; }

/* 담당자 색 */
.p1 { color: var(--brand); font-weight: 650; } .p2 { color: var(--ok); font-weight: 650; }
.p3 { color: #ea580c; font-weight: 650; } .p4 { color: var(--violet); font-weight: 650; }
.p5 { color: var(--danger); font-weight: 650; }

/* 빈 상태 */
.empty-state { text-align: center; padding: 56px 20px; color: var(--text-3); }
.empty-state .icon { font-size: 40px; margin-bottom: 12px; opacity: .55; }
.empty-state .title { font-size: 14px; color: var(--text-2); margin-bottom: 6px; font-weight: 650; }
.empty-state .desc, .empty-state small { font-size: 12.5px; color: var(--text-3); }
.empty-state p { font-size: 14px; }

/* ---------- 회의내용 ---------- */
.blog-toolbar { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; margin-bottom: 16px; }
.post-list { display: flex; flex-direction: column; gap: 8px; }
.post-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: 14px;
  padding: 16px 20px; cursor: pointer; transition: border-color .15s, box-shadow .15s, transform .15s;
}
.post-card:hover { border-color: var(--border-strong); box-shadow: var(--shadow); transform: translateY(-1px); }
.post-card-title { font-size: 15.5px; font-weight: 700; color: var(--text); margin-bottom: 4px; }
.post-card-meta { font-size: 12px; color: var(--text-3); margin-bottom: 8px; }
.post-card-preview { font-size: 13px; color: var(--text-2); line-height: 1.65; white-space: pre-wrap; word-break: break-word; }
.post-detail, .post-form {
  background: var(--surface); border: 1px solid var(--border); border-radius: 16px; padding: 26px 30px;
}
.post-detail-header { border-bottom: 1px solid var(--border); padding-bottom: 14px; margin-bottom: 20px; }
.post-detail-title { font-size: 21px; font-weight: 750; color: var(--text); margin-bottom: 6px; }
.post-detail-meta { font-size: 12.5px; color: var(--text-3); }
.post-detail-content { font-size: 14px; color: var(--text); line-height: 1.85; word-break: break-word; min-height: 200px; }
.post-detail-content table { border-collapse: collapse; width: 100%; margin: 10px 0; }
.post-detail-content table td, .post-detail-content table th { border: 1px solid var(--border-strong); padding: 7px 12px; }
.post-detail-content table th { background: var(--surface-2); font-weight: 650; }
.post-detail-content img { max-width: 100%; border-radius: 8px; margin: 6px 0; }
.post-detail-content h1 { font-size: 22px; margin: 16px 0 8px; }
.post-detail-content h2 { font-size: 18px; margin: 14px 0 6px; }
.post-detail-content h3 { font-size: 15px; margin: 12px 0 4px; }
.post-detail-content blockquote { border-left: 3px solid var(--border-strong); margin: 8px 0; padding: 4px 16px; color: var(--text-2); }
.post-detail-content pre { background: var(--surface-3); border-radius: 8px; padding: 12px; font-size: 12.5px; overflow-x: auto; }
.post-detail-content ul, .post-detail-content ol { padding-left: 24px; margin: 6px 0; }
.post-detail-content a { color: var(--brand); }
.post-detail-content .ql-table-block { display: block; margin: 8px 0; }
.post-detail-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 24px; padding-top: 16px; border-top: 1px solid var(--border); }
.post-form h3 { font-size: 17px; font-weight: 750; margin-bottom: 18px; color: var(--text); }
.form-group { margin-bottom: 16px; }
.form-group label { display: block; font-size: 12.5px; color: var(--text-2); margin-bottom: 6px; font-weight: 650; }
.form-group input[type="text"], .form-group input[type="password"], .form-group select { width: 100%; height: 38px; }
#quill-editor { min-height: 360px; }
.form-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 8px; }
.blog-empty { text-align: center; padding: 56px 20px; color: var(--text-3); font-size: 14px; }

/* ---------- 알림·로딩 ---------- */
#toast-container {
  position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); z-index: 9999;
  display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none;
}
.toast {
  display: flex; align-items: center; gap: 10px; padding: 10px 16px 10px 14px; border-radius: 12px;
  background: #111827; color: #f9fafb; font-size: 13.5px; font-weight: 500; box-shadow: var(--shadow-lg);
  pointer-events: auto; max-width: min(520px, calc(100vw - 32px)); animation: toastIn .2s var(--ease);
}
.toast::before { content: ''; width: 8px; height: 8px; border-radius: 50%; background: #60a5fa; flex: none; }
.toast.success::before { background: #34d399; }
.toast.error::before { background: #f87171; }
.toast.warn::before { background: #fbbf24; }
body.dark .toast { background: #f3f4f6; color: #111827; }
@keyframes toastIn { from { opacity: 0; transform: translateY(8px); } }
.app-loader { display: inline-block; width: 14px; height: 14px; border: 2px solid var(--border-strong); border-top-color: var(--brand); border-radius: 50%; animation: spin .8s linear infinite; vertical-align: middle; }
#global-loader { position: fixed; top: 0; left: 0; right: 0; height: 2px; background: linear-gradient(90deg, var(--brand), #6366f1); z-index: 9998; transform: scaleX(0); transform-origin: left; transition: transform .3s; }
#global-loader.active { animation: loadbar 1s infinite; }
@keyframes loadbar { 0% { transform: scaleX(0); } 50% { transform: scaleX(.7); } 100% { transform: scaleX(1); } }
.hl-match { background: color-mix(in srgb, #facc15 45%, transparent); color: inherit; font-weight: 700; padding: 0 2px; border-radius: 3px; }

/* 차트 데이터 기간 안내 (전망 탭) */
.chart-note {
  margin: -4px 0 10px; padding: 7px 10px; border-radius: 8px; font-size: 12px; line-height: 1.5;
  background: color-mix(in srgb, var(--warn) 9%, var(--surface)); color: var(--text-2);
  border: 1px solid color-mix(in srgb, var(--warn) 22%, var(--border));
}

/* 차트 드릴다운 힌트 */
.drill-hint {
  display: inline-flex; align-items: center; height: 20px; padding: 0 7px; margin-left: 6px; vertical-align: middle;
  font-size: 11px; font-weight: 650; color: var(--brand); background: var(--brand-soft); border-radius: 6px; white-space: nowrap;
}
rect[data-drill], text[data-drill] { cursor: pointer; transition: opacity .12s; }
rect[data-drill]:hover { opacity: .72 !important; }
text[data-drill]:hover { fill: var(--brand) !important; }
.drill-row { cursor: pointer; border-radius: 6px; transition: background .12s; }
.drill-row:hover { background: var(--hover); }

/* ---------- 모달 (인라인 스타일로 만든 기존 모달을 공통 모양으로) ---------- */
#insight-modal-overlay, #card-settings-overlay, #chart-settings-overlay, #row-detail-overlay, #infographic-overlay,
[id$="-overlay"][style*="position:fixed"] {
  background: rgba(15, 23, 42, .32) !important; backdrop-filter: blur(3px);
}
#insight-modal, #card-settings-modal, #chart-settings-modal, #row-detail-modal {
  background: var(--surface) !important; color: var(--text);
  border: 1px solid var(--border); border-radius: 16px !important; box-shadow: var(--shadow-lg) !important;
}

/* ============================================================
   인라인 스타일 어댑터
   마크업·JS 문자열 곳곳의 인라인 색을 토큰으로 다시 매핑한다.
   (라이트 모드에서는 거의 같은 색, 다크 모드에서 차이가 큼)
   ============================================================ */
.main [style*="background:white"], .main [style*="background: white"], .main [style*="background:#fff;"],
.main [style*="background:#ffffff"], [id$="-modal"] [style*="background:white"] {
  background-color: var(--surface) !important;
}
/* 흰 배경 + 둥근 모서리 = 패널 */
.main div[style*="background:white"][style*="border-radius:12px"],
.main div[style*="background:white"][style*="border-radius:10px"],
.main div[style*="background: white"][style*="border-radius:12px"] {
  border: 1px solid var(--border) !important; border-radius: 14px !important; box-shadow: var(--shadow-sm) !important;
}
.main [style*="box-shadow:0 1px 4px rgba(0,0,0,0.08)"], .main [style*="box-shadow:0 1px 3px rgba(0,0,0,0.08)"] {
  box-shadow: var(--shadow-sm) !important;
}
/* 회색 계열 배경 */
[style*="background:#f5f5f5"], [style*="background:#fafafa"], [style*="background:#f8f9fa"],
[style*="background:#f5f7fa"], [style*="background:#f9f9f9"] { background-color: var(--surface-3) !important; }
[style*="background:#e8f0fe"] { background-color: var(--brand-soft) !important; }
[style*="background:#fafbfc"], [style*="background:#f8fafd"], [style*="background:#f0f4ff"] { background-color: var(--surface-2) !important; }
/* 전망 탭 '올해' 카드의 연한 파랑 그라데이션 */
[style*="linear-gradient(180deg,#f5f9ff"] { background: linear-gradient(180deg, color-mix(in srgb, var(--brand) 6%, var(--surface)) 0%, var(--surface) 100%) !important; }
/* 인사이트 상세 표: JS 가 행마다 흰색·#e8f0fe 를 직접 넣으므로 토큰으로 덮어씀 */
#insight-modal-body tbody tr { background: transparent !important; }
#insight-modal-body tbody tr:nth-child(even) { background: var(--surface-2) !important; }
#insight-modal-body tbody tr:hover { background: var(--hover) !important; }
#insight-modal-body td { border-color: var(--border) !important; color: var(--text); }
/* 진행 막대 트랙 */
[style*="background:#f0f0f0"], [style*="background:#e8eaed"], [style*="background:#f1f3f4"], [style*="background:#eee"] { background-color: var(--surface-3) !important; }
/* 상태 색 연한 배경 — 다크 모드에서만 토큰으로 (라이트는 원래 색 유지) */
body.dark [style*="background:#fce8e6"], html.dark [style*="background:#fce8e6"] { background-color: var(--danger-soft) !important; }
body.dark [style*="background:#e6f4ea"], html.dark [style*="background:#e6f4ea"] { background-color: var(--ok-soft) !important; }
body.dark [style*="background:#fff3cd"], body.dark [style*="background:#fffdf5"], body.dark [style*="background:#fff8e1"] { background-color: var(--warn-soft) !important; }
/* 글자 색 */
[style*="color:#1a1a1a"], [style*="color:#222"], [style*="color:#333"], [style*="color:#1a3a8f"] { color: var(--text) !important; }
[style*="color:#555"], [style*="color:#666"] { color: var(--text-2) !important; }
[style*="color:#888"], [style*="color:#999"], [style*="color:#aaa"], [style*="color:#bbb"], [style*="color:#ccc"] { color: var(--text-3) !important; }
[style*="color:#1a73e8"] { color: var(--brand) !important; }
[style*="font-weight:800"] { font-weight: 750 !important; }
/* 테두리 */
[style*="border:1px solid #ddd"], [style*="border:1px solid #e0e0e0"], [style*="border: 1px solid #ddd"] { border-color: var(--border-strong) !important; }
[style*="solid #eee"], [style*="solid #f0f0f0"], [style*="solid #f5f5f5"], [style*="solid #e8eaed"] { border-color: var(--border) !important; }
[style*="border-radius:6px"]:is(button, input, select) { border-radius: 8px !important; }
/* 인라인 스타일 버튼에 공통 높이·폰트 */
.main button[style*="padding:6px 12px"], .main button[style*="padding:5px 14px"], .main button[style*="padding:6px 14px"] {
  height: 30px; padding-top: 0 !important; padding-bottom: 0 !important; border-radius: 8px !important; font-weight: 600;
}
/* SVG 차트 글자·눈금선 */
svg text[fill="#333"], svg text[fill="#222"] { fill: var(--text); }
svg text[fill="#555"], svg text[fill="#666"] { fill: var(--text-2); }
svg text[fill="#888"], svg text[fill="#999"], svg text[fill="#aaa"], svg text[fill="#bbb"] { fill: var(--text-3); }
svg line[stroke="#eee"], svg line[stroke="#f0f0f0"], svg line[stroke="#e0e0e0"], svg line[stroke="#ddd"],
svg path[stroke="#eee"], svg path[stroke="#f0f0f0"] { stroke: var(--border); }
svg circle[fill="white"], svg rect[fill="white"] { fill: var(--surface); }

/* ============================================================
   관리자 화면 공통 (admin·accounts·aliases·data-ops·audit-log)
   ============================================================ */
body.admin-page header {
  position: sticky; top: 0; z-index: 50;
  display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap;
  padding: 12px 24px; background: color-mix(in srgb, var(--canvas) 85%, transparent);
  backdrop-filter: blur(10px); border-bottom: 1px solid var(--border); color: var(--text);
}
body.admin-page header h1 { display: flex; align-items: center; gap: 10px; font-size: 17px; font-weight: 750; color: var(--text); }
body.admin-page header h1::before {
  content: ''; width: 28px; height: 28px; border-radius: 9px; flex: none;
  background:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M3 3v18h18'/%3E%3Cpath d='M18 17V9M13 17V5M8 17v-3'/%3E%3C/svg%3E") center / 16px no-repeat,
    linear-gradient(135deg, #3b82f6, #6366f1);
  box-shadow: 0 3px 10px rgba(59, 130, 246, .3);
}
body.admin-page .header-right { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--text-2); }
body.admin-page .header-right span { margin-right: 6px; font-weight: 600; }
body.admin-page .header-right a {
  display: inline-flex; align-items: center; height: 32px; padding: 0 12px; border-radius: 9px;
  color: var(--text-2); border: 1px solid var(--border-strong); background: var(--surface);
  font-weight: 600; text-decoration: none; box-shadow: var(--shadow-sm);
}
body.admin-page .header-right a:hover { background: var(--surface-2); color: var(--text); }
body.admin-page .container { max-width: 1040px; margin: 24px auto 60px; padding: 0 20px; }
body.admin-page .section, body.admin-page .filters-box, body.admin-page .result-box {
  background: var(--surface); border: 1px solid var(--border); border-radius: 16px;
  padding: 22px 24px; box-shadow: var(--shadow-sm); margin-bottom: 16px;
}
body.admin-page .section h2 {
  font-size: 15px; font-weight: 750; color: var(--text); margin-bottom: 16px; padding-bottom: 12px; border-bottom: 1px solid var(--border);
}
body.admin-page .section .desc { color: var(--text-2); }
body.admin-page thead th { background: var(--surface-2); color: var(--text-3); }
body.admin-page tbody td { border-bottom: 1px solid var(--border); }
body.admin-page tbody tr:hover { background: var(--hover); }
body.admin-page .log-table th { background: var(--surface-2); color: var(--text-3); border-bottom: 1px solid var(--border); }
body.admin-page .log-table td { border-bottom: 1px solid var(--border); }
body.admin-page .badge-admin, body.admin-page .badge-user, body.admin-page .badge-me, body.admin-page .action-badge {
  display: inline-flex; align-items: center; height: 22px; padding: 0 8px; border-radius: 6px; font-size: 11.5px; font-weight: 650;
}
body.admin-page .badge-admin { background: var(--brand-soft); color: var(--brand); }
body.admin-page .badge-user { background: var(--surface-3); color: var(--text-2); }
body.admin-page .badge-me { background: var(--ok-soft); color: var(--ok); }
body.admin-page .success-msg, body.admin-page .status.success { background: var(--ok-soft); color: var(--ok); border-radius: 10px; }
body.admin-page .status.error { background: var(--danger-soft); color: var(--danger); border-radius: 10px; }
body.admin-page .danger-zone {
  border: 1px solid color-mix(in srgb, var(--danger) 25%, var(--border)) !important;
  background: color-mix(in srgb, var(--danger) 4%, var(--surface)) !important; border-radius: 12px !important;
}
body.admin-page .danger-zone .title { color: var(--danger); font-weight: 700; }
body.admin-page .danger-zone .text { color: var(--text-2); }
body.admin-page .sc-card {
  background: var(--surface); border: 1px solid var(--border) !important; border-radius: 14px; box-shadow: var(--shadow-sm);
}
body.admin-page .sc-label { color: var(--text-2); }
body.admin-page .sc-value { color: var(--text); font-weight: 750; }
body.admin-page .fg label, body.admin-page .add-form .fg label { color: var(--text-2); font-size: 12px; font-weight: 650; }
body.admin-page .fg input, body.admin-page .fg select, body.admin-page .add-form .fg input,
body.admin-page .search-input, body.admin-page .pw-inline input { height: 36px; border-radius: 9px; border: 1px solid var(--border-strong); background: var(--surface); color: var(--text); padding: 0 11px; }
body.admin-page .backup-row { border-color: var(--border) !important; }
body.admin-page .backup-row .meta { color: var(--text-3); }
body.admin-page .alias-group { border-color: var(--border) !important; background: var(--surface-2) !important; border-radius: 12px !important; }
body.admin-page .alias-tag { border-radius: 7px !important; }
body.admin-page .empty { color: var(--text-3); }

/* ---------- 관리자 셸: 좌측 메뉴 (v4.1) ---------- */
body.admin-page { padding-left: var(--sb-w); }
.admin-nav {
  position: fixed; inset: 0 auto 0 0; width: var(--sb-w); z-index: 60;
  display: flex; flex-direction: column; gap: 2px; padding: 12px 10px 10px; overflow-y: auto;
  background: var(--canvas); border-right: 1px solid var(--border);
}
.admin-nav .sb-brand { text-decoration: none; color: var(--text); }
.admin-nav a.nav-item { text-decoration: none; }
body.admin-page header { margin: 0; }
.admin-nav ~ header h1::before { display: none; }   /* 사이드바에 로고가 있으므로 제목 옆 로고 생략 */
body.admin-page .container { max-width: 1080px; }

/* ---------- 관리자 공통 컴포넌트 ---------- */
.muted { color: var(--text-3); font-weight: 500; }
.nowrap { white-space: nowrap; }
.mono { font-family: ui-monospace, Consolas, monospace; font-size: 12px; }
.clip { max-width: 320px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.num { text-align: right; font-variant-numeric: tabular-nums; }
.num.bad { color: var(--danger); font-weight: 700; }
.badge.amber { background: var(--warn-soft); color: var(--warn); }
.badge.green { background: var(--ok-soft); color: var(--ok); }
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 12px; margin-bottom: 16px; }
.card-value small { font-size: 14px; font-weight: 600; color: var(--text-3); margin-left: 3px; }
.card-value.sm { font-size: 18px; }
.admin-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 16px; }
.admin-grid > .section { margin-bottom: 16px; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 8px 16px; margin: 0; font-size: 13px; }
.kv dt { color: var(--text-3); }
.kv dd { margin: 0; color: var(--text); }
.h2-link { float: right; font-size: 12.5px; font-weight: 600; color: var(--brand); text-decoration: none; }
.h2-actions { float: right; display: inline-flex; gap: 6px; align-items: center; }
body.admin-page .section h2 .muted { font-size: 12.5px; margin-left: 6px; }
.notice {
  padding: 11px 14px; border-radius: 12px; margin-bottom: 14px; font-size: 13px; line-height: 1.6;
  background: color-mix(in srgb, var(--warn) 9%, var(--surface)); border: 1px solid color-mix(in srgb, var(--warn) 25%, var(--border)); color: var(--text);
}
.notice.soft { background: color-mix(in srgb, var(--ok) 8%, var(--surface)); border-color: color-mix(in srgb, var(--ok) 22%, var(--border)); }
.check-list { list-style: none; display: flex; flex-direction: column; gap: 8px; margin: 0; }
.check-list li { display: flex; align-items: center; gap: 10px; font-size: 13px; }
.check-list li a { margin-left: auto; font-size: 12.5px; font-weight: 600; color: var(--brand); text-decoration: none; white-space: nowrap; }
.check-list .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--ok); flex: none; }
.check-list li.warn .dot { background: var(--warn); }
.empty-inline { padding: 14px; border: 1px dashed var(--border-strong); border-radius: 10px; color: var(--text-3); text-align: center; font-size: 13px; }
.table-plain { border: 1px solid var(--border); border-radius: 12px; overflow: auto; }
.table-plain table { width: 100%; border-collapse: collapse; font-size: 13px; }
.table-plain th { text-align: left; font-size: 12px; color: var(--text-3); font-weight: 650; padding: 8px 12px; background: var(--surface-2); border-bottom: 1px solid var(--border); white-space: nowrap; }
.table-plain td { padding: 8px 12px; border-bottom: 1px solid var(--border); }
.table-plain tr:last-child td { border-bottom: 0; }
.table-plain th.num, .table-plain td.num { text-align: right; }      /* 숫자 칸: 머리글도 오른쪽 정렬 */
.table-plain th.center, .table-plain td.center { text-align: center; }
.mini-panel { border: 1px solid var(--border); border-radius: 12px; padding: 14px 16px; background: var(--surface-2); }
.mini-panel h3 { font-size: 13.5px; margin-bottom: 8px; }
.kv-table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.kv-table td { padding: 5px 0; border-bottom: 1px solid var(--border); }
.kv-table tr:last-child td { border-bottom: 0; }

/* 폼 */
.check-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 4px 18px; }
.check-grid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.check-row { display: flex; align-items: flex-start; gap: 9px; padding: 6px 4px; border-radius: 8px; cursor: pointer; font-size: 13px; }
.check-row:hover { background: var(--hover); }
.check-row input { width: 16px; height: 16px; margin-top: 2px; flex: none; cursor: pointer; }
.check-row > span { display: flex; flex-direction: column; }
.check-row small { color: var(--text-3); font-size: 12px; }
.check-row.inline { display: inline-flex; align-items: center; padding: 4px 6px; }
.check-row.inline input { margin-top: 0; }
.actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.inline-field { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text-2); font-weight: 600; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; margin-bottom: 4px; }
.form-grid .wide { grid-column: 1 / -1; }
.form-grid textarea, .form-grid input[type="text"], .form-grid select { width: 100%; }
.form-bar {
  position: sticky; bottom: 0; z-index: 5; display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  margin-top: 4px; padding: 12px 16px; border-radius: 14px;
  background: color-mix(in srgb, var(--surface) 92%, transparent); backdrop-filter: blur(8px);
  border: 1px solid var(--border); box-shadow: var(--shadow);
}
.section > .form-bar { position: static; box-shadow: none; background: transparent; border: 0; padding: 12px 0 0; }
.section.danger { border-color: color-mix(in srgb, var(--danger) 25%, var(--border)) !important; }
.section.danger h2 { color: var(--danger); }
body.admin-page .danger-zone { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 14px; margin-top: 10px; }
.mail-preview { width: 100%; height: 640px; border: 1px solid var(--border); border-radius: 12px; background: #f3f4f6; }

/* 세그먼트 버튼 · 별칭 자동 제안 */
.seg { display: inline-flex; gap: 2px; padding: 2px; border-radius: 9px; background: var(--surface-3); }
.seg-btn { height: 26px; padding: 0 10px; border: 0; border-radius: 7px; background: transparent; color: var(--text-2); font-family: inherit; font-size: 12.5px; font-weight: 600; cursor: pointer; }
.seg-btn.on { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm), 0 0 0 1px var(--border); }
.sg-list { display: flex; flex-direction: column; gap: 6px; margin-top: 12px; max-height: 620px; overflow-y: auto; padding-right: 4px; }
.sg-row { display: flex; gap: 10px; padding: 10px 12px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); }
.sg-row:has(.sg-cb:not(:checked)) { opacity: .55; }
.sg-check { padding-top: 6px; }
.sg-check input { width: 16px; height: 16px; cursor: pointer; }
.sg-body { flex: 1; min-width: 0; }
.sg-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 6px; font-size: 12.5px; }
.sg-head select { height: 30px; min-width: 200px; font-weight: 600; }
.sg-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { display: inline-flex; align-items: center; gap: 4px; height: 24px; padding: 0 8px; border-radius: 7px; background: var(--surface-3); color: var(--text-2); font-size: 12px; white-space: pre; }
.chip b { color: var(--text); font-weight: 650; }
.chip.mapped { background: var(--ok-soft); color: var(--ok); }
.ws { font-style: normal; color: var(--danger); font-weight: 700; }

@media (max-width: 860px) {
  body.admin-page { padding-left: 0; }
  .admin-nav { position: sticky; top: 0; inset: auto; width: auto; flex-direction: row; align-items: center; overflow-x: auto; padding: 8px; border-right: 0; border-bottom: 1px solid var(--border); }
  .admin-nav .sb-brand .brand-text, .admin-nav .sb-label, .admin-nav .sb-spacer, .admin-nav .sb-foot .sb-link span { display: none; }
  .admin-nav .sb-brand { padding: 0 6px 0 0; }
  .admin-nav .sb-nav { flex-direction: row; }
  .admin-nav .nav-item { white-space: nowrap; height: 32px; }
  .admin-nav .sb-foot { flex-direction: row; border-top: 0; padding-top: 0; }
  body.admin-page header { position: static; }
  .check-grid, .check-grid.three, .form-grid { grid-template-columns: 1fr; }
}

/* ---------- 등급 배지 · 계정 폼 (v4.2) ---------- */
.badge.role-guest { background: var(--surface-3); color: var(--text-2); }
.badge.role-member { background: var(--ok-soft); color: var(--ok); }
.badge.role-leader { background: var(--warn-soft); color: var(--warn); }
.badge.role-admin { background: var(--violet-soft); color: var(--violet); }
.form-grid.four { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.form-bar-inline { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.row-form { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; margin-top: 8px; }
.row-form input, .row-form select { height: 30px; }
.field small { font-weight: 500; }

/* ---------- 일정 (달력) ---------- */
.k-porting { --k: #f97316; } .k-transfer { --k: #2563eb; } .k-maint { --k: #7c3aed; } .k-support { --k: #059669; } .k-link { --k: #db2777; }
.cal-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.cal-nav { display: flex; align-items: center; gap: 6px; }
.cal-nav h2 { font-size: 19px; font-weight: 750; min-width: 130px; text-align: center; }
.cal-nav .icon-btn { font-size: 22px; line-height: 1; }
.cal-filters { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.cal-filters .seg-btn:not(.on) { opacity: .45; text-decoration: line-through; }
.cal-filters .seg-btn.on::before, .cal-chip i, .cal-line i, .day-group summary i {
  content: ''; display: inline-block; width: 8px; height: 8px; border-radius: 3px; background: var(--k); flex: none;
}
.cal-filters .seg-btn.on::before { margin-right: 5px; vertical-align: 1px; }
.cal-filters .seg-btn.on { background: color-mix(in srgb, var(--k) 14%, var(--surface)); color: color-mix(in srgb, var(--k) 75%, var(--text)); box-shadow: 0 0 0 1px color-mix(in srgb, var(--k) 35%, transparent); }
.cal-summary { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 10px; font-size: 12.5px; }
.cal-chip { display: inline-flex; align-items: center; gap: 6px; height: 26px; padding: 0 10px; border-radius: 8px; background: var(--surface-2); border: 1px solid var(--border); color: var(--text-2); }
.cal-chip b { color: var(--text); font-variant-numeric: tabular-nums; }
.cal-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); border: 1px solid var(--border); border-radius: 14px; overflow: hidden; background: var(--border); gap: 1px; }
.cal-wd { background: var(--surface-2); padding: 8px; font-size: 12px; font-weight: 650; color: var(--text-3); text-align: center; }
.cal-wd.sun, .cal-cell.sun .cal-date span { color: var(--danger); }
.cal-wd.sat, .cal-cell.sat .cal-date span { color: var(--brand); }
.cal-cell { background: var(--surface); min-height: 112px; padding: 7px 7px 8px; display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.cal-cell.empty { background: var(--surface-2); }
.cal-cell.has { cursor: pointer; transition: background .12s; }
.cal-cell.has:hover { background: var(--surface-2); }
.seg-btn:disabled { cursor: default; }
.cal-ro .cal-cell.has { cursor: default; }
.cal-ro .cal-cell.has:hover { background: transparent; }
.cal-cell.today { box-shadow: inset 0 0 0 2px var(--brand); }
.cal-date { display: flex; align-items: center; justify-content: space-between; font-size: 12.5px; font-weight: 700; color: var(--text-2); margin-bottom: 2px; }
.cal-date em { font-style: normal; font-size: 11px; font-weight: 700; padding: 1px 6px; border-radius: 6px; background: var(--brand-soft); color: var(--brand); font-variant-numeric: tabular-nums; }
.cal-line { display: flex; align-items: center; gap: 5px; font-size: 11.5px; line-height: 1.35; color: var(--text); min-width: 0;
  padding: 2px 5px; border-radius: 5px; background: color-mix(in srgb, var(--k) 9%, transparent); }
.cal-line span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cal-line b { font-weight: 700; color: var(--k); font-variant-numeric: tabular-nums; }
.cal-more { font-size: 11px; color: var(--text-3); padding-left: 5px; }
.day-group { border: 1px solid var(--border); border-radius: 10px; margin-bottom: 8px; background: var(--surface); }
.day-group summary { display: flex; align-items: center; gap: 8px; padding: 9px 12px; cursor: pointer; font-size: 13px; list-style: none; }
.day-group summary::-webkit-details-marker { display: none; }
.day-group summary .muted { margin-left: auto; font-size: 12px; }
.day-group ul { list-style: none; margin: 0; padding: 0 12px 10px 28px; display: flex; flex-direction: column; gap: 4px; }
.day-group li { display: flex; flex-direction: column; font-size: 12.5px; padding: 4px 0; border-top: 1px dashed var(--border); }
.day-group li small { color: var(--text-3); font-size: 11.5px; }

/* ---------- 월간보고서 ---------- */
.rp-toolbar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.rp-toolbar select { min-width: 140px; }
.rp-team { margin-bottom: 16px; }
/* 팀 현황표: 칸 너비 고정 (담당자·숫자·특이사항·저장 시각) */
.rp-team table { table-layout: fixed; min-width: 640px; }
.rp-team th:first-child { width: 150px; }          /* 담당자: 이름(+계정 미연결 표시)만큼만 */
.rp-team th.c-note { width: 90px; }                /* 특이사항 */
.rp-team th.c-st { width: 90px; }                  /* 상태 (과거 보고서는 칸 없음) */
.rp-team th.c-saved { width: 120px; }              /* 마지막 저장 / 가져온 때 */
/* 숫자 칸(포팅~합계)은 너비를 지정하지 않아 남는 폭을 똑같이 나눠 가짐 */
.rp-team td:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rp-team tbody tr { cursor: pointer; }
.rp-team tbody tr:hover, .rp-team tbody tr.on { background: var(--brand-soft); }
.rp-doc { border: 1px solid var(--border); border-radius: 16px; padding: 22px 24px; background: var(--surface); }
.rp-title { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.rp-title h2 { font-size: 20px; font-weight: 750; }
.rp-title span { font-size: 15px; font-weight: 700; color: var(--text-2); }
.rp-meta { font-size: 12px; color: var(--text-3); margin: 6px 0 16px; }
.rp-grid { display: grid; grid-template-columns: 1.25fr 1fr 1fr 1fr; gap: 12px; align-items: start; }
.rp-grid.five { grid-template-columns: 1.25fr 1fr 1fr 1fr 1fr; }
.rp-block { border: 1px solid var(--border); border-radius: 12px; overflow: hidden; }
.rp-block table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.rp-block th { background: color-mix(in srgb, var(--k) 10%, var(--surface)); color: var(--text); font-weight: 700; padding: 8px 10px; text-align: left; border-bottom: 1px solid var(--border); white-space: nowrap; }
.rp-block td { padding: 6px 10px; border-bottom: 1px solid var(--border); }
.rp-block tbody tr:last-child td { border-bottom: 0; }
.rp-block tfoot td { font-weight: 750; border-top: 1px solid var(--border-strong); border-bottom: 0; background: var(--surface-2); }
.rp-block .center, .rp-team .center { text-align: center; }
.rp-block .num { text-align: right; }   /* '건수' 머리글도 숫자와 같은 오른쪽 정렬 (.rp-block th 의 left 보다 우선) */
.rp-diff { height: 26px; padding: 0 22px 0 6px; font-size: 12px; background-position: right 5px center; }
.rp-h3 { font-size: 14.5px; margin: 22px 0 8px; padding-bottom: 8px; border-bottom: 2px solid color-mix(in srgb, var(--brand) 40%, var(--border)); }
.rp-notes { display: flex; flex-direction: column; gap: 8px; margin-bottom: 10px; }
.rp-note { display: grid; grid-template-columns: 200px minmax(0, 1fr) 32px; gap: 8px; align-items: start; }
.rp-note textarea { width: 100%; min-height: 34px; resize: vertical; }
.rp-note.ro { display: block; padding: 10px 12px; border-left: 3px solid var(--brand); background: var(--surface-2); border-radius: 0 10px 10px 0; }
.rp-note.ro b { font-size: 13px; }
.rp-note.ro p { margin: 4px 0 0; font-size: 13px; color: var(--text-2); line-height: 1.6; }
.rp-sec { font-size: 12.5px; font-weight: 700; color: var(--text-2); margin-top: 6px; }
.rp-charts { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.25fr); gap: 12px; margin-bottom: 6px; }
.rp-chart { border: 1px solid var(--border); border-radius: 12px; padding: 12px 14px 8px; background: var(--surface); min-width: 0; }
.rp-chart.wide { grid-column: 1 / -1; }
.rp-chart h4 { margin: 0 0 6px; font-size: 13px; font-weight: 700; color: var(--text); }
.rp-chart h4 .muted { font-size: 11.5px; font-weight: 500; margin-left: 4px; }
.rp-ch { width: 100%; }
.cal-me { display: inline-flex; align-items: center; height: 32px; padding: 0 12px; border-radius: 9px; background: var(--surface-2); border: 1px solid var(--border); font-weight: 650; font-size: 13px; color: var(--text); }
.rp-sec:first-child { margin-top: 0; }
@media (max-width: 1100px) { .rp-grid, .rp-grid.five { grid-template-columns: 1fr 1fr; } .rp-charts { grid-template-columns: 1fr; } }
@media (max-width: 860px) {
  .form-grid.four { grid-template-columns: 1fr; }
  .cal-cell { min-height: 64px; padding: 4px; }
  .cal-line, .cal-more { display: none; }
  .cal-cell.has .cal-date em { display: inline-block; }
  .rp-grid, .rp-grid.five { grid-template-columns: 1fr; }
  .rp-note { grid-template-columns: 1fr 32px; }
  .rp-note .rp-sub { grid-column: 1 / -1; }
  .rp-doc { padding: 16px; }
}
@media print {
  .rp-toolbar, .rp-team { display: none !important; }
  .rp-doc { border: 0; padding: 0; }
}

/* ============================================================
   로그인
   ============================================================ */
body.auth-page {
  min-height: 100vh; display: grid; place-items: center; padding: 24px 16px;
  background:
    radial-gradient(900px 500px at 15% -10%, rgba(37, 99, 235, .14), transparent 60%),
    radial-gradient(700px 500px at 110% 110%, rgba(124, 58, 237, .12), transparent 60%),
    var(--canvas);
}
.auth-card {
  width: min(400px, 100%); background: var(--surface); border: 1px solid var(--border); border-radius: 20px;
  padding: 34px 30px 26px; box-shadow: var(--shadow-lg);
}
.auth-card .brand-mark { width: 44px; height: 44px; border-radius: 13px; margin-bottom: 18px; }
.auth-card h1 { font-size: 22px; font-weight: 750; line-height: 1.3; }
.auth-card .sub { margin: 6px 0 22px; color: var(--text-3); font-size: 13.5px; }
.auth-form { display: flex; flex-direction: column; gap: 14px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field > span { font-size: 12.5px; font-weight: 650; color: var(--text-2); }
.auth-form input { height: 42px !important; font-size: 14px !important; }
.auth-form .btn { height: 42px; font-size: 15px; border-radius: 11px; margin-top: 4px; width: 100%; }
/* 비밀번호 보기/숨김 (static/js/pw-toggle.js) */
.pw-wrap { position: relative; display: block; width: 100%; }
.pw-wrap > input { width: 100%; padding-right: 40px !important; }
.pw-eye { position: absolute; right: 4px; top: 50%; transform: translateY(-50%); width: 32px; height: 30px; display: grid; place-items: center;
  border: 0; border-radius: 7px; background: transparent; color: var(--text-3); cursor: pointer; padding: 0; }
.pw-eye:hover { background: var(--surface-2); color: var(--text); }
.pw-eye:focus-visible { outline: 2px solid var(--brand); outline-offset: 1px; }
.pw-eye[aria-pressed="true"] { color: var(--brand); }
.row-form .pw-wrap { display: inline-block; width: auto; }
.row-form .pw-wrap > input { width: 200px; }
.form-error { color: var(--danger); background: var(--danger-soft); padding: 10px 12px; border-radius: 10px; font-size: 13px; margin-bottom: 14px; }
.auth-note {
  display: flex; gap: 8px; align-items: flex-start; margin-top: 20px; padding: 11px 13px; border-radius: 12px;
  background: var(--surface-2); border: 1px solid var(--border); color: var(--text-2); font-size: 12.5px; line-height: 1.6;
}
.auth-note .ic { color: var(--brand); margin-top: 2px; }
.auth-note strong { color: var(--text); }

/* ============================================================
   반응형
   ============================================================ */
@media (max-width: 1280px) { .charts-row { grid-template-columns: 1fr 1fr !important; } }
@media (max-width: 1024px) {
  div[style*="grid-template-columns:1fr 1fr"], div[style*="grid-template-columns: 1fr 1fr"],
  div[style*="grid-template-columns:1fr 1fr 1fr"], div[style*="grid-template-columns: 1fr 1fr 1fr"] { grid-template-columns: 1fr !important; }
  .charts-row { grid-template-columns: 1fr !important; }
  #insights-list { grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)) !important; }
}
@media (max-width: 860px) {
  .app { grid-template-columns: minmax(0, 1fr); }
  .sidebar {
    position: fixed; inset: 0 auto 0 0; width: min(280px, 86vw); z-index: 300; background: var(--canvas);
    transform: translateX(-100%); transition: transform .22s var(--ease); box-shadow: var(--shadow-lg);
  }
  .app.sb-open .sidebar { transform: none; }
  .app.sb-open .scrim { display: block; position: fixed; inset: 0; z-index: 290; background: rgba(15, 23, 42, .35); }
  .only-mobile { display: inline-grid !important; }
  .main { margin: 0; border-radius: 0; border: 0; min-height: 100vh; }
  .page-head { padding: 12px 14px; position: sticky; top: 0; z-index: 100; background: color-mix(in srgb, var(--surface) 92%, transparent); backdrop-filter: blur(10px); }
  .page-title h1 { font-size: 18px; }
  .page-actions .btn-label { display: none; }
  #year-month-bar, #person-bar { padding: 8px 14px; }
  .tab-content { padding: 14px 14px 40px; }
  .cards { grid-template-columns: 1fr 1fr !important; }
  .filters input[type="text"] { width: 100%; }
  #insight-modal { width: 95% !important; }
  #insights-list { grid-template-columns: 1fr !important; }
  #list-table th:nth-child(1), #list-table td:nth-child(1), #list-table th:nth-child(2), #list-table td:nth-child(2),
  #list-table th:nth-child(5), #list-table td:nth-child(5), #list-table th:nth-child(7), #list-table td:nth-child(7),
  #maint-table th:nth-child(1), #maint-table td:nth-child(1), #maint-table th:nth-child(2), #maint-table td:nth-child(2),
  #maint-table th:nth-child(5), #maint-table td:nth-child(5), #maint-table th:nth-child(7), #maint-table td:nth-child(7) { display: none; }
  .table-scroll table { min-width: 0; }
  #list-table td.td-long, #maint-table td.td-long { max-width: 160px; }
  .post-detail, .post-form { padding: 18px; }
  body.admin-page header { padding: 10px 14px; }
  body.admin-page .header-right span { display: none; }
  body.admin-page .container { padding: 0 12px; margin-top: 14px; }
  body.admin-page .section { padding: 16px; }
}
@media (max-width: 480px) {
  .cards { grid-template-columns: 1fr !important; }
  #list-table th:nth-child(8), #list-table td:nth-child(8), #maint-table th:nth-child(8), #maint-table td:nth-child(8) { display: none; }
  #list-table td.td-long, #maint-table td.td-long { max-width: 110px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

/* ============================================================
   인쇄 — 셸을 걷어내고 본문만 A4 가로로
   ============================================================ */
@media print {
  @page { size: A4 landscape; margin: 8mm; }
  html, body, body.dark { background: #fff !important; color: #222 !important; font-size: 10pt; }
  body.dark { --surface: #fff; --surface-2: #fafafa; --surface-3: #f3f4f6; --text: #111; --text-2: #444; --text-3: #777; --border: #ddd; --border-strong: #ccc; }
  .app { display: block; }
  .sidebar, .scrim, .page-head, #year-month-bar, #person-bar, .filters, .pagination,
  .blog-toolbar, .post-detail-actions, .form-actions, #toast-container, #global-loader, #insights-box [onclick],
  button, .upload-btn, #card-settings-modal, #card-settings-overlay, #chart-settings-modal, #chart-settings-overlay,
  select, input[type="text"], input[type="search"] { display: none !important; }
  .main { margin: 0; border: 0; border-radius: 0; box-shadow: none; min-height: 0; }
  .tab-content { display: none !important; padding: 0 !important; animation: none !important; }
  .tab-content.active { display: block !important; }
  .cards { grid-template-columns: repeat(5, 1fr) !important; gap: 6px !important; }
  .charts-row, div[style*="grid-template-columns:1fr 1fr"] { grid-template-columns: 1fr 1fr !important; gap: 6px !important; }
  .chart-box, .post-card, .post-detail, .card { box-shadow: none !important; border: 1px solid #ddd !important; break-inside: avoid !important; page-break-inside: avoid !important; padding: 8px !important; margin-bottom: 6px !important; }
  .cards > div, .card-value, table, thead, tbody, tr { break-inside: avoid !important; page-break-inside: avoid !important; }
  h2, h3, h4 { break-after: avoid !important; page-break-after: avoid !important; }
  .table-scroll { max-height: none !important; overflow: visible !important; }
  .table-scroll table { min-width: 0 !important; }
  svg { max-width: 100% !important; height: auto !important; }
  .post-detail-content, .post-detail-content table { page-break-inside: auto !important; }
  .post-detail-content img { max-width: 100% !important; page-break-inside: avoid !important; }
  .pdf-page-break { page-break-before: always !important; break-before: page !important; }
  body.admin-page header { position: static; }
}

/* ---------- v4.6: 보고서 상태·이어받기·마감 / 일정 주간·공휴일·예정 / 업체 이력 ---------- */
.badge.red { background: var(--danger-soft); color: var(--danger); }
.badge.blue { background: var(--brand-soft); color: var(--brand); }
.badge.orange { background: var(--warn-soft); color: var(--warn); }
.rp-alert { padding: 10px 14px; border-radius: 12px; margin-bottom: 12px; font-size: 13.5px; border: 1px solid var(--border); }
.rp-alert.amber { background: var(--warn-soft); color: var(--text); border-color: color-mix(in srgb, var(--warn) 35%, transparent); }
.rp-alert.red { background: var(--danger-soft); color: var(--text); border-color: color-mix(in srgb, var(--danger) 35%, transparent); }
.rp-review { margin: 0 0 14px; padding: 10px 14px; border-radius: 12px; border-left: 4px solid var(--brand); background: var(--surface-2); }
.rp-review.returned { border-left-color: var(--danger); }
.rp-review.approved { border-left-color: var(--ok); }
.rp-review b { margin-right: 8px; }
.rp-review p { margin: 6px 0 0; line-height: 1.6; }
.rp-note { grid-template-columns: 200px minmax(0, 1fr) 96px 32px; }
.rp-note .rp-st { height: 34px; }
.note-st { display: inline-block; font-size: 11px; font-weight: 700; padding: 1px 7px; border-radius: 6px; margin-right: 6px; vertical-align: 1px; }
.note-st.ongoing { background: var(--brand-soft); color: var(--brand); }
.note-st.done { background: var(--ok-soft); color: var(--ok); }
@media (max-width: 760px) {
  .rp-note { grid-template-columns: 1fr 96px 32px; }
  .rp-note .rp-sub, .rp-note .rp-con { grid-column: 1 / -1; }
}

.k-plan { --k: #d97706; }
.cal-line.k-plan { border: 1px dashed color-mix(in srgb, var(--k) 55%, transparent); }
.cal-line.k-plan b { font-size: 10.5px; }
.cal-date span { display: inline-flex; align-items: baseline; gap: 4px; min-width: 0; }
.cal-date .hol { font-size: 10.5px; font-weight: 600; color: var(--danger); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 90px; }
.cal-cell.holiday { background: color-mix(in srgb, var(--danger) 4%, var(--surface)); }
.cal-grid.week .cal-cell { min-height: 260px; }
.cal-grid.week .cal-cell.other .cal-date span { opacity: .55; }
#cal-view { margin-left: 4px; }

a.co-link { color: inherit; text-decoration: none; border-bottom: 1px dashed color-mix(in srgb, var(--text-3) 60%, transparent); cursor: pointer; }
a.co-link:hover { color: var(--brand); border-bottom-color: var(--brand); }
a.co-link.sm { font-size: 11.5px; color: var(--brand); border: 0; margin-left: 6px; font-weight: 600; }
.co-tiles { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 6px; }
.co-tile { display: inline-flex; align-items: center; gap: 6px; padding: 6px 10px; border-radius: 10px; background: var(--surface-2); border: 1px solid var(--border); font-size: 12.5px; color: var(--text-2); }
.co-tile i { width: 8px; height: 8px; border-radius: 3px; background: var(--k); }
.co-tile b { color: var(--text); font-variant-numeric: tabular-nums; }
.co-cols { display: grid; grid-template-columns: 1fr 1.4fr; gap: 14px; margin-bottom: 10px; }
.co-cols h4, #insight-modal-body h4 { font-size: 13px; margin: 8px 0 6px; }
.co-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; font-size: 12.5px; }
.co-list li { display: flex; justify-content: space-between; gap: 8px; padding: 4px 0; border-bottom: 1px dashed var(--border); }
.co-list li small { color: var(--text-3); white-space: nowrap; }
.co-notes { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; font-size: 12.5px; }
.co-notes li { padding: 8px 10px; border-radius: 10px; background: var(--surface-2); line-height: 1.55; }
.co-notes li small { display: block; color: var(--text-3); margin-bottom: 2px; }
@media (max-width: 760px) { .co-cols { grid-template-columns: 1fr; } }
