/* ============================================================
   HICrew 사무실 · 공통 스타일시트 (common.css)
   기준 문서: 디자인/design-guide.md (시안A "레퍼런스 충실형")
   전 화면(0~7)이 이 파일을 공통으로 불러 씁니다.
   어드민(관리자용) 성격이라 데스크탑(1280px) 기준으로 작성했습니다.
   ============================================================ */

/* ---- 0. 리셋 ---- */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; height: 100%; }
ul, ol { margin: 0; }
h1, h2, h3, h4, h5 { margin: 0; }
button { font-family: inherit; }
a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
/* 배너류(.info-banner/.warn-banner/.danger-banner 등)가 display를 직접 지정하고 있어서,
   같은 우선순위의 브라우저 기본 [hidden] 규칙을 항상 덮어씀 — hidden 속성이 무력화되는 것을 여기서 강제로 막음 */
[hidden] { display: none !important; }

/* ---- 1. 디자인 토큰 (design-guide.md 1~4장 수치 그대로) ---- */
:root {
  /* 1-1. 메인(Primary) 파랑 */
  --primary-700: #244fa5;
  --primary-600: #2c62cc;
  --primary-500: #3577f1;
  --primary-400: #5290f5;
  --primary-300: #7ba9f8;
  --primary-200: #a9c8fb;
  --primary-subtle: #eef4fe;

  /* 1-2. 시맨틱 4색 */
  --success: #0ab39c;
  --success-text: #0a8a78;
  --success-subtle: #e7f6f4;
  --success-chip: #daf4f0;

  --warning: #f7b84b;
  --warning-text: #c98a1e;
  --warning-subtle: #fef4e4;
  --warning-chip: #fdeecf;

  --danger: #f06548;
  --danger-text: #e0533f;
  --danger-subtle: #fde5e2;

  --info: #299cdb;
  --info-text: #1d6fa5;
  --info-subtle: #e6f4fb;

  /* 1-3. 뉴트럴 */
  --text-strong: #2b3243;
  --text-body: #495057;
  --text-secondary: #5b6270;
  --text-muted: #878a99;
  --text-faint: #9aa1b2;
  --border: #e9ebf0;
  --border-soft: #eef0f5;
  --bg: #f3f3f9;
  --surface: #ffffff;
  --surface-soft: #f7f8fb;

  /* 1-4. 그림자 */
  --shadow-card: 0 1px 2px rgba(56, 65, 74, .08);
  --shadow-card-hover: 0 6px 18px rgba(56, 65, 74, .12);
  --shadow-drawer: -14px 0 40px rgba(20, 26, 44, .20);
  --shadow-modal: 0 24px 60px rgba(0, 0, 0, .30);
  --shadow-toast: 0 10px 28px rgba(56, 65, 74, .14);
  --shadow-dropdown: 0 10px 30px rgba(43, 50, 67, .16);

  /* 4장. 라운드 */
  --radius-card: 11px;
  --radius-btn: 8px;
  --radius-pill: 20px;
  --radius-modal: 14px;
  --radius-kpi: 12px;
  --radius-hero: 18px;
  --radius-tooltip: 6px;

  /* 5장. 레이아웃 치수 */
  --sidebar-w: 236px;
  --topbar-h: 64px;
  --content-pad: 26px 28px 40px;

  --font-kr: "Noto Sans KR", "Poppins", system-ui, sans-serif;
  --font-num: "Poppins", "Noto Sans KR", system-ui, sans-serif;
}

body {
  font-family: var(--font-kr);
  background: var(--bg);
  color: var(--text-body);
  -webkit-font-smoothing: antialiased;
}

.num { font-family: var(--font-num); }

/* ---- 스킵 링크(접근성: 키보드 사용자가 사이드바를 건너뛸 수 있게) ---- */
.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--primary-500);
  color: #fff;
  padding: 10px 16px;
  border-radius: 0 0 8px 0;
  z-index: 500;
  font: 600 13px var(--font-kr);
}
.skip-link:focus { left: 0; }

/* ---- 포커스 링(공통, design-guide 6-2) ---- */
a:focus-visible,
button:focus-visible,
input:focus-visible,
summary:focus-visible,
[tabindex]:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(53, 119, 241, .25);
  border-radius: 6px;
}

/* ============================================================
   2. 앱 레이아웃 (사이드바 + 상단바 + 콘텐츠)
   ============================================================ */
.app { display: flex; min-height: 100vh; width: 100%; background: var(--bg); }

/* ---- 사이드바 ---- */
.sidebar {
  width: var(--sidebar-w);
  flex: none;
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
}
.sb-logo {
  height: var(--topbar-h);
  flex: none;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 20px;
  border-bottom: 1px solid var(--border);
}
.sb-logo .mark {
  width: 30px; height: 30px;
  border-radius: var(--radius-btn);
  background: var(--primary-500);
  display: flex; align-items: center; justify-content: center;
  flex: none;
  font: 700 14px var(--font-num);
  color: #fff;
}
.sb-logo .name { font: 600 15px var(--font-num); color: var(--text-strong); line-height: 1.2; }
.sb-logo .name small { display: block; font: 400 10.5px var(--font-kr); color: var(--text-muted); margin-top: 1px; }

.sb-scroll { flex: 1; overflow-y: auto; padding: 10px 12px 18px; }
.sb-group { list-style: none; padding: 0; margin: 0; }
.sb-group-label {
  font: 700 10.5px var(--font-num);
  letter-spacing: 1.1px;
  color: var(--text-muted);
  text-transform: uppercase;
  padding: 14px 10px 6px;
  margin: 0;
}
.sb-menu { list-style: none; margin: 0; padding: 0; }
.sb-item {
  display: flex; align-items: center; gap: 11px;
  padding: 9px 10px;
  border-radius: var(--radius-btn);
  color: var(--text-body);
  font-size: 13.5px;
  font-weight: 500;
  margin-bottom: 2px;
  transition: .13s;
  position: relative;
}
.sb-item i { font-size: 17px; color: #8890a0; flex: none; }
.sb-item .sb-badge {
  margin-left: auto;
  font: 700 10px var(--font-num);
  padding: 2px 7px;
  border-radius: var(--radius-pill);
  background: var(--warning-chip);
  color: var(--warning-text);
}
.sb-item:hover { background: var(--surface-soft); }
.sb-item.active { background: var(--primary-subtle); color: var(--primary-500); font-weight: 700; }
.sb-item.active i { color: var(--primary-500); }

/* ---- 메인(상단바 + 콘텐츠) ---- */
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  height: var(--topbar-h); flex: none;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 14px;
  padding: 0 26px;
}
.topbar .site { font: 700 14.5px var(--font-num); color: var(--text-strong); }
.crumb { font-size: 12.5px; color: var(--text-muted); display: flex; align-items: center; gap: 5px; list-style: none; padding: 0; margin: 0; }
.crumb li { display: flex; align-items: center; gap: 5px; }
.crumb .current { color: var(--primary-500); font-weight: 700; }
.topbar .right { margin-left: auto; display: flex; align-items: center; gap: 12px; }
.refresh-note { font-size: 12px; color: var(--text-muted); display: flex; align-items: center; gap: 6px; }
.refresh-btn {
  width: 34px; height: 34px;
  border-radius: var(--radius-btn);
  border: 1px solid var(--border);
  background: var(--surface);
  display: flex; align-items: center; justify-content: center;
  color: var(--text-body);
  font-size: 16px;
  cursor: pointer;
}
.refresh-btn:hover { background: var(--primary-subtle); color: var(--primary-500); border-color: var(--primary-subtle); }
.refresh-btn.is-loading i { animation: hc-spin .8s linear infinite; }
@keyframes hc-spin { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }
.avatar {
  width: 32px; height: 32px; border-radius: 50%;
  background: var(--primary-500); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font: 700 12.5px var(--font-num);
  flex: none;
}
/* 상단바 계정 메뉴 자리(placeholder→구현 단계에서 js/auth.js가 .acct-menu 마크업으로 채웁니다) */
.topbar-acct-slot { display: flex; align-items: center; }

.content { flex: 1; padding: var(--content-pad); overflow-x: hidden; }

.page-head { display: flex; align-items: flex-end; justify-content: space-between; margin-bottom: 20px; flex-wrap: wrap; gap: 10px; }
.page-head h1 { font: 700 21px var(--font-num); color: var(--text-strong); }
.page-head p { margin: 4px 0 0; font-size: 12.5px; color: var(--text-muted); }

/* ============================================================
   3. 공통 컴포넌트
   ============================================================ */

/* ---- 지표 카드 ---- */
.stat-grid { display: grid; gap: 16px; margin-bottom: 20px; }
.stat-card { background: var(--surface); border-radius: var(--radius-card); box-shadow: var(--shadow-card); padding: 20px; }
.stat-card.clickable { cursor: pointer; transition: .15s; }
.stat-card.clickable:hover { box-shadow: var(--shadow-card-hover); }
.stat-label {
  font-size: 11.5px; font-weight: 700; letter-spacing: .4px;
  color: var(--text-muted); text-transform: uppercase; margin-bottom: 14px;
  display: flex; align-items: center; gap: 6px;
}
.stat-body { display: flex; align-items: center; gap: 14px; }
.stat-icon {
  width: 46px; height: 46px; border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  flex: none; font-size: 21px;
}
.stat-value { font: 700 26px var(--font-num); color: var(--text-strong); }
.stat-value .unit { font-size: 15px; font-weight: 600; }
.stat-foot { font-size: 11.5px; color: var(--text-muted); margin-top: 12px; line-height: 1.6; }
.stat-foot .info-i { cursor: help; }

.ic-primary { background: var(--primary-subtle); color: var(--primary-500); }
.ic-success { background: var(--success-subtle); color: var(--success); }
.ic-warning { background: var(--warning-subtle); color: var(--warning); }
.ic-info { background: var(--info-subtle); color: var(--info); }
.ic-neutral { background: var(--border-soft); color: var(--text-secondary); }

/* ---- 버튼 (design-guide 6-2) ---- */
.btn {
  appearance: none; border-radius: var(--radius-btn);
  font: 600 13px var(--font-kr);
  cursor: pointer; display: inline-flex; align-items: center; gap: 6px;
  transition: .13s; border: none;
  padding: 9px 17px;
}
.btn-primary { background: var(--primary-500); color: #fff; }
.btn-primary:hover { background: var(--primary-600); }
.btn-primary:disabled { background: #c9d3e6; color: #fff; cursor: not-allowed; }
.btn-secondary { border: 1px solid var(--primary-500); background: #fff; color: var(--primary-500); }
.btn-secondary:hover { background: var(--primary-subtle); }
.btn-ghost { border: 1px solid var(--border-soft); background: #fff; color: var(--text-secondary); }
.btn-ghost:hover { background: var(--surface-soft); }
.btn-ghost:disabled { color: var(--text-faint); cursor: not-allowed; background: #fbfbfd; }
.btn-danger-soft { background: var(--danger-subtle); color: var(--danger-text); }
.btn-danger-soft:hover { background: #fbd5d0; }
.btn-sm { padding: 5px 11px; font-size: 11.5px; }

/* ---- 배지 / 알약 / 칩 ---- */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  font: 700 10.5px var(--font-kr);
  padding: 3px 10px; border-radius: var(--radius-pill);
  white-space: nowrap;
}
.badge-success { background: var(--success-chip); color: var(--success-text); }
.badge-warning { background: var(--warning-chip); color: var(--warning-text); }
.badge-danger { background: var(--danger-subtle); color: var(--danger-text); }
.badge-info { background: var(--info-subtle); color: var(--info); }
.badge-primary { background: var(--primary-subtle); color: var(--primary-500); }
.badge-neutral { background: var(--surface); color: var(--text-muted); border: 1px solid var(--border-soft); }
.badge-unknown { background: none; color: var(--text-faint); border: 1px dashed var(--border-soft); }

.grade-cell { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.grade-title { font-size: 13px; color: var(--text-body); }
.grade-badge {
  font: 700 11px var(--font-kr); color: #6b7280; background: var(--border-soft);
  padding: 2px 8px; border-radius: var(--radius-pill);
}

.chip {
  border: 1px solid var(--border-soft); background: #fff; color: var(--text-secondary);
  font: 600 12px var(--font-kr); border-radius: var(--radius-pill);
  padding: 6px 13px; cursor: pointer; transition: .13s; white-space: nowrap;
}
.chip:hover { border-color: var(--primary-400); }
.chip.active, .chip[aria-current="true"] { background: var(--primary-subtle); color: var(--primary-500); border-color: var(--primary-subtle); }
.chip.disabled { cursor: not-allowed; color: var(--text-faint); background: #f7f7fa; border-color: var(--border-soft); }

/* ---- 검색 입력창 ---- */
.search-wrap { position: relative; max-width: 420px; margin-bottom: 18px; }
.search-wrap i.ri-search-line { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--text-muted); font-size: 15px; }
.search-input {
  width: 100%; border: 1px solid #dfe2ea; background: var(--surface);
  border-radius: var(--radius-btn); padding: 10px 13px 10px 36px;
  font: 13px var(--font-kr); color: var(--text-body);
}
.search-input::placeholder { color: var(--text-muted); }
.search-input:focus {
  outline: none; border-width: 1.5px; border-color: var(--primary-500);
  box-shadow: 0 0 0 3px rgba(53, 119, 241, .12);
}

/* ---- 입력창(공통 폼) ---- */
.field label { display: block; font: 600 11.5px var(--font-kr); color: var(--text-secondary); margin-bottom: 6px; }
.field input {
  width: 100%; border: 1px solid #dfe2ea; background: #fff;
  border-radius: var(--radius-btn); padding: 9px 11px;
  font: 13px var(--font-kr); color: var(--text-body);
}
.field input:focus { outline: none; border-width: 1.5px; border-color: var(--primary-500); box-shadow: 0 0 0 3px rgba(53, 119, 241, .12); }
.field .help { font-size: 11px; margin-top: 5px; line-height: 1.5; color: var(--text-muted); }

/* ---- 표 ---- */
.table-wrap { border: 1px solid var(--border-soft); border-radius: var(--radius-card); overflow: hidden; background: var(--surface); }
table { width: 100%; border-collapse: collapse; }
table caption { caption-side: top; text-align: left; padding: 12px 16px 0; font-size: 11px; color: var(--text-faint); }
table thead th {
  background: var(--surface-soft); font: 600 11.5px var(--font-kr); color: var(--text-muted);
  padding: 11px 16px; text-align: left; white-space: nowrap;
}
table tbody td { padding: 12px 16px; font-size: 13px; color: var(--text-body); border-top: 1px solid var(--border-soft); vertical-align: middle; }
table tbody td.strong, table tbody th.name-cell { font: 600 13px var(--font-kr); color: var(--text-strong); }
table tbody tr.row-click { cursor: pointer; transition: .12s; }
table tbody tr.row-click:hover, table tbody tr.row-click:focus-within { background: #fbfbfd; }
table tbody tr.row-highlight td { background: var(--primary-subtle); }
table tbody tr.row-divider td { background: var(--surface-soft); color: var(--text-muted); font: 600 11px var(--font-kr); text-align: center; letter-spacing: .3px; }

/* ---- 안내 배너 ---- */
.info-banner {
  display: flex; gap: 10px; align-items: flex-start;
  background: var(--surface-soft); border: 1px solid var(--border-soft);
  border-radius: var(--radius-btn); padding: 11px 14px;
  font-size: 12px; color: var(--text-secondary); line-height: 1.6; margin-bottom: 12px;
}
.info-banner i { color: var(--primary-500); font-size: 16px; margin-top: 1px; flex: none; }
.info-banner b { color: var(--primary-600); }
.info-banner code { background: #fff; border: 1px solid var(--border-soft); border-radius: 4px; padding: 1px 5px; font: 11px "JetBrains Mono", Consolas, monospace; color: var(--text-secondary); }
.info-banner.on-surface { background: #fff; }

.warn-banner {
  display: flex; gap: 10px; align-items: flex-start;
  background: var(--warning-subtle); border-left: 4px solid var(--warning);
  border-radius: var(--radius-btn); padding: 11px 14px 11px 16px;
  font-size: 12px; color: var(--warning-text); line-height: 1.6; margin-bottom: 16px;
}
.warn-banner i { font-size: 16px; margin-top: 1px; flex: none; }
.warn-banner b { color: var(--warning-text); }

.danger-banner {
  display: flex; gap: 10px; align-items: flex-start;
  background: var(--danger-subtle); border-radius: var(--radius-btn);
  padding: 11px 14px; font-size: 12px; color: var(--danger-text); line-height: 1.6; margin-bottom: 14px;
}
.danger-banner i { font-size: 16px; margin-top: 1px; flex: none; }

/* ---- 빈 상태 ---- */
.empty-state {
  background: var(--surface); border: 1px solid var(--border-soft); border-radius: var(--radius-card);
  padding: 56px 20px; text-align: center;
}
.empty-state .ic {
  width: 44px; height: 44px; border-radius: 12px; background: var(--bg);
  display: flex; align-items: center; justify-content: center; margin: 0 auto 12px;
}
.empty-state.warn .ic { background: var(--warning-subtle); }
.empty-state .ic i { font-size: 22px; color: var(--text-faint); }
.empty-state.warn .ic i { color: var(--warning-text); }
.empty-state .t { font: 600 13px var(--font-kr); color: var(--text-secondary); margin-bottom: 4px; }
.empty-state .d { font-size: 11.5px; color: var(--text-muted); max-width: 380px; margin: 0 auto 12px; line-height: 1.6; }

/* ---- 카드 형 그룹 접기(details/summary — 네이티브, JS 불필요) ---- */
.group-details { margin-bottom: 4px; }
.group-summary {
  list-style: none; display: flex; align-items: center; gap: 8px;
  margin: 22px 0 12px; cursor: pointer; user-select: none;
}
.group-summary::-webkit-details-marker { display: none; }
.group-summary i.chev { font-size: 16px; color: var(--text-muted); transition: .15s; }
.group-details[open] > .group-summary i.chev { transform: rotate(0deg); }
.group-details:not([open]) > .group-summary i.chev { transform: rotate(-90deg); }
.group-summary h2 { font: 700 14.5px var(--font-num); color: var(--text-strong); }
.group-summary .cnt { font-size: 12.5px; color: var(--text-muted); font-weight: 500; }

/* ---- 사이드패널(드로어) / 모달 — 정적 참고용(열기 동작은 구현 단계에서 연결) ---- */
.side-panel-ref {
  margin-top: 32px; padding-top: 24px; border-top: 2px dashed var(--border);
}
.side-panel-ref > .ref-label {
  display: inline-flex; align-items: center; gap: 6px;
  font: 700 11px var(--font-kr); color: var(--text-faint);
  text-transform: uppercase; letter-spacing: .4px; margin-bottom: 12px;
}
.side-panel {
  width: 380px; max-width: 100%; background: var(--surface);
  box-shadow: var(--shadow-drawer); border-radius: var(--radius-card);
  border: 1px solid var(--border);
}
.sp-head { padding: 20px 22px; border-bottom: 1px solid var(--border); display: flex; align-items: flex-start; justify-content: space-between; }
.sp-head h3 { font: 700 16px var(--font-kr); color: var(--text-strong); margin-bottom: 4px; }
.sp-head p { margin: 0; font-size: 12px; color: var(--text-muted); }
.sp-close {
  width: 28px; height: 28px; border-radius: var(--radius-btn); background: var(--bg);
  display: flex; align-items: center; justify-content: center; color: var(--text-muted); flex: none; border: none;
}
.sp-body { padding: 18px 22px; }
.sp-section { margin-bottom: 22px; }
.sp-section:last-child { margin-bottom: 0; }
.sp-section h4 { font: 700 12px var(--font-num); letter-spacing: .4px; color: var(--text-muted); text-transform: uppercase; margin-bottom: 10px; }
.sp-section p { margin: 0; font-size: 13px; color: var(--text-body); line-height: 1.7; }

/* ---- 사이드패널 실제 동작(드로어 오버레이) — 구현 단계 추가: PRJ-10 등에서 실제로 열고 닫습니다 ---- */
.drawer-backdrop {
  position: fixed; inset: 0; background: rgba(15, 17, 21, .35);
  z-index: 400; opacity: 0; pointer-events: none; transition: opacity .18s;
}
.drawer-backdrop.open { opacity: 1; pointer-events: auto; }
.drawer-host {
  position: fixed; top: 0; right: 0; height: 100vh; z-index: 401;
  transform: translateX(100%); transition: transform .22s ease; display: flex;
}
.drawer-host.open { transform: translateX(0); }
.drawer-host .side-panel { height: 100%; border-radius: 0; display: flex; flex-direction: column; width: 400px; }
.drawer-host .sp-body { flex: 1; overflow-y: auto; }

/* ---- 마크다운 렌더링(구현 단계 추가 — marked.js 출력 스타일, KNW-06) ---- */
.md-render { font-size: 13px; line-height: 1.75; color: var(--text-body); }
.md-render h1, .md-render h2, .md-render h3, .md-render h4, .md-render h5, .md-render h6 {
  color: var(--text-strong); margin: 18px 0 8px; font-family: var(--font-kr);
}
.md-render > h1:first-child, .md-render > h2:first-child, .md-render > h3:first-child { margin-top: 0; }
.md-render h1 { font-size: 18px; font-weight: 700; }
.md-render h2 { font-size: 16px; font-weight: 700; padding-bottom: 6px; border-bottom: 1px solid var(--border-soft); }
.md-render h3 { font-size: 14px; font-weight: 700; }
.md-render h4, .md-render h5, .md-render h6 { font-size: 13px; font-weight: 700; }
.md-render p { margin: 0 0 10px; }
.md-render ul, .md-render ol { margin: 0 0 12px; padding-left: 20px; }
.md-render li { margin-bottom: 4px; }
.md-render code { background: var(--surface-soft); border: 1px solid var(--border-soft); border-radius: 4px; padding: 1px 5px; font: 11.5px "JetBrains Mono", Consolas, monospace; color: var(--text-secondary); }
.md-render pre { background: var(--surface-soft); border: 1px solid var(--border-soft); border-radius: 8px; padding: 12px 14px; overflow-x: auto; margin: 0 0 12px; }
.md-render pre code { background: none; border: none; padding: 0; }
.md-render table { width: 100%; border-collapse: collapse; margin: 0 0 14px; font-size: 12.5px; border: 1px solid var(--border-soft); border-radius: 8px; overflow: hidden; }
.md-render th { background: var(--surface-soft); font-weight: 600; padding: 9px 12px; text-align: left; }
.md-render td { padding: 9px 12px; border-top: 1px solid var(--border-soft); }
.md-render blockquote { margin: 0 0 12px; padding: 8px 12px; border-left: 3px solid var(--primary-300); background: var(--surface-soft); color: var(--text-secondary); }
.md-render hr { border: none; border-top: 1px solid var(--border-soft); margin: 16px 0; }
.md-render a { color: var(--primary-500); text-decoration: underline; }
.md-render strong { color: var(--text-strong); }
.md-render img { max-width: 100%; }

/* ---- 원문 전체 보기 모달(구현 단계 추가 — KNW-06·07·09) ---- */
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(15, 17, 21, .45);
  z-index: 410; opacity: 0; pointer-events: none; transition: opacity .15s;
  display: flex; align-items: center; justify-content: center; padding: 30px;
}
.modal-backdrop.open { opacity: 1; pointer-events: auto; }
.modal-box {
  background: var(--surface); border-radius: var(--radius-modal); box-shadow: var(--shadow-modal);
  width: 800px; max-width: 100%; max-height: 100%; display: flex; flex-direction: column; overflow: hidden;
}
.modal-head { padding: 18px 22px; border-bottom: 1px solid var(--border); display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.modal-head h3 { font: 700 15px var(--font-kr); color: var(--text-strong); }
.modal-path { font: 11px var(--font-num); color: var(--text-muted); margin-top: 4px; word-break: break-all; }
.modal-body-wrap { flex: 1; overflow: hidden; display: flex; }
.modal-toc { width: 200px; flex: none; border-right: 1px solid var(--border-soft); overflow-y: auto; padding: 12px 8px; }
.modal-toc a { display: block; padding: 6px 8px; font-size: 12px; color: var(--text-secondary); border-radius: 6px; }
.modal-toc a:hover { background: var(--surface-soft); }
.modal-body { flex: 1; overflow-y: auto; padding: 18px 22px; font-size: 13px; line-height: 1.8; color: var(--text-body); white-space: pre-wrap; }
.modal-body .md-render { white-space: normal; }

/* ---- HR-02 두 기록 불일치 안내(구현 단계 추가) ---- */
.log-mismatch-note {
  display: inline-flex; align-items: center; gap: 3px; font-size: 10.5px; font-weight: 600;
  color: var(--warning-text, #b8860b); cursor: help; white-space: nowrap;
}

/* ---- 딥링크 대상 카드/행 강조(구현 단계 추가 — PRJ-11·HR-04) ---- */
.card-deeplink-highlight, .row-deeplink-highlight {
  outline: 2px solid var(--primary-400, #6d84ff);
  outline-offset: 2px;
  background: var(--primary-050, #eef1ff);
}

/* ---- 항목표-원문 불일치 경고(구현 단계 추가 — KNW-16①) ---- */
.mismatch-badge { display: inline-flex; align-items: center; gap: 2px; margin-left: 6px; font-size: 13px; color: var(--warning-text, #b8860b); vertical-align: middle; }
.mismatch-banner { margin-bottom: 12px; }

/* ---- 지식 갱신 이력(구현 단계 추가 — HIST-05·06·09·10 공용, js/hist.js) ---- */
.history-empty { display: flex; flex-direction: column; align-items: center; text-align: center; padding: 22px 10px 6px; color: var(--text-muted); }
.history-empty i { font-size: 22px; color: var(--text-faint); margin-bottom: 8px; }
.history-empty .t { font-size: 12.5px; line-height: 1.6; }
.hist-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.hist-item { border: 1px solid var(--border-soft); border-radius: 8px; padding: 10px 12px; background: var(--surface-soft); }
.hist-item-clickable { cursor: pointer; }
.hist-item-clickable:hover, .hist-item-clickable:focus-visible { border-color: var(--primary-300); outline: none; }
.hist-item-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.hist-badge { font: 700 10.5px var(--font-num); padding: 2px 7px; border-radius: 999px; letter-spacing: .2px; }
.hist-badge-new { background: var(--success-bg, #e4f6ec); color: var(--success-text, #1c8a4a); }
.hist-badge-mod { background: var(--primary-100, #e8edff); color: var(--primary-600, #3350c8); }
.hist-label { font: 600 12.5px var(--font-kr); color: var(--text-strong); }
.hist-time { margin-left: auto; font: 500 11px var(--font-num); color: var(--text-faint); }
.hist-message { margin: 5px 0 0; font-size: 12px; color: var(--text-secondary); line-height: 1.6; }
.hist-expand-hint { color: var(--text-faint); font-size: 11px; }
.hist-diff-wrap { margin-top: 8px; }
.hist-diff { border: 1px solid var(--border-soft); border-radius: 6px; overflow: hidden; font: 11.5px "JetBrains Mono", Consolas, monospace; max-height: 260px; overflow-y: auto; }
.hist-diff-line { padding: 2px 8px; white-space: pre-wrap; word-break: break-all; }
.hist-diff-line .sign { display: inline-block; width: 12px; color: var(--text-faint); }
.hist-diff-line.add { background: var(--success-bg, #e4f6ec); color: var(--success-text, #1c8a4a); }
.hist-diff-line.del { background: var(--danger-bg, #fdeaea); color: var(--danger-text, #c0392b); }
.hist-diff-empty { margin: 6px 0 0; font-size: 11.5px; color: var(--text-faint); }
.hist-count { margin: 8px 0 0; font: 500 11px var(--font-num); color: var(--text-faint); text-align: center; }
.hist-more-btn {
  display: block; width: 100%; margin-top: 8px; padding: 8px; border-radius: 8px;
  border: 1px solid var(--border-soft); background: var(--surface); color: var(--text-secondary);
  font: 600 12px var(--font-kr); cursor: pointer;
}
.hist-more-btn:hover { background: var(--surface-soft); }

/* ---- 카드/영역 로딩·오류 상태(구현 단계 추가) ---- */
.skeleton-line {
  height: 14px; border-radius: 5px; background: linear-gradient(90deg, var(--border-soft) 25%, var(--surface-soft) 37%, var(--border-soft) 63%);
  background-size: 400% 100%; animation: hc-shimmer 1.4s ease infinite;
}
@keyframes hc-shimmer { 0% { background-position: 100% 50%; } 100% { background-position: 0 50%; } }
.card-error-note { color: var(--danger-text); }
.card-error-note button { margin-left: 4px; }
.retry-inline {
  border: none; background: none; color: var(--primary-500); font: 700 11.5px var(--font-kr);
  cursor: pointer; text-decoration: underline; padding: 0;
}
.folder-issue-line {
  display: flex; gap: 6px; align-items: flex-start; font-size: 11px; color: var(--warning-text);
  background: var(--warning-subtle); border-radius: 6px; padding: 6px 9px; margin-top: 8px; line-height: 1.5;
}
.folder-issue-line i { font-size: 13px; margin-top: 1px; flex: none; }

/* ---- 타임라인(진행 경과) ---- */
.tl-list { list-style: none; margin: 0; padding: 0; }
.tl-item { display: flex; gap: 12px; padding-bottom: 16px; position: relative; }
.tl-item:not(:last-child)::before { content: ""; position: absolute; left: 5px; top: 16px; bottom: -2px; width: 2px; background: var(--border-soft); }
.tl-dot { width: 12px; height: 12px; border-radius: 50%; background: var(--primary-500); flex: none; margin-top: 3px; box-shadow: 0 0 0 3px var(--primary-subtle); }
.tl-date { font: 700 11.5px var(--font-num); color: var(--text-muted); margin-bottom: 2px; }
.tl-text { font-size: 13px; color: var(--text-strong); line-height: 1.6; }

/* ---- 툴팁 ---- */
.tooltip-host { position: relative; }
.tooltip-host .tooltip {
  position: absolute; bottom: calc(100% + 8px); left: 50%; transform: translateX(-50%);
  width: 230px; background: #2b3243; color: #fff; font: 500 11px/1.6 var(--font-kr);
  padding: 9px 11px; border-radius: var(--radius-tooltip); opacity: 0; pointer-events: none;
  transition: .15s; z-index: 30; box-shadow: 0 10px 24px rgba(0, 0, 0, .22);
}
.tooltip-host:hover .tooltip,
.tooltip-host:focus-within .tooltip { opacity: 1; }

/* ---- 유틸 ---- */
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}

/* ---- COM-06 갱신 중단 고지 / COM-11 자동 갱신 실패 고지 (구현 단계 추가) ---- */
.refresh-note.is-paused { color: var(--text-muted); }
.refresh-note.is-failed { color: var(--danger-text); }
.refresh-note .retry-btn {
  margin-left: 6px; border: none; background: none; color: var(--primary-500);
  font: 700 11.5px var(--font-kr); cursor: pointer; text-decoration: underline; padding: 0;
}

/* ============================================================
   4. 로그인 화면 · 상단바 계정 메뉴 · 비밀번호 변경 모달 (구현 단계 추가, 2026-08-07)
   기준: 퍼블 component-spec.md · design-guide.md 6-17~6-20절
   ============================================================ */

/* ---- 입력창 BEM 계열(.field__input 등) — 위 레거시 .field input 규칙과 함께 적용됩니다 ---- */
.field { margin-bottom: 14px; }
.field__label { display: block; font: 600 11.5px var(--font-kr); color: var(--text-secondary); margin-bottom: 6px; }
.field__input {
  width: 100%; border: 1px solid #dfe2ea; background: #fff;
  border-radius: var(--radius-btn); padding: 9px 11px;
  font: 13px var(--font-kr); color: var(--text-body);
}
.field__input::placeholder { color: var(--text-faint); }
.field__input:focus {
  outline: none; border-width: 1.5px; border-color: var(--primary-500);
  box-shadow: 0 0 0 3px rgba(53, 119, 241, .12);
}
.field__input:disabled {
  background: var(--bg); border-color: var(--border-soft); color: var(--text-faint); cursor: not-allowed;
}
.field--error .field__input, .field--error input { border-width: 1.5px; border-color: var(--danger-text); color: var(--danger-text); }
.field__error-msg { display: flex; align-items: center; gap: 5px; font-size: 11.5px; color: var(--danger-text); margin-top: 5px; }
.field__error-msg i { font-size: 13px; }

/* ---- 체크박스(design-guide 6-17, 로그인 화면에서 최초 등장) ---- */
.form-checkbox { display: flex; align-items: center; min-height: 44px; padding: 4px 0; cursor: pointer; user-select: none; position: relative; }
.form-checkbox__input { position: absolute; width: 18px; height: 18px; margin: 0; opacity: 0; cursor: pointer; }
.form-checkbox__box {
  width: 18px; height: 18px; border-radius: 5px; border: 1.5px solid #c7cbd6;
  background: #fff; flex: none; display: flex; align-items: center; justify-content: center; transition: .13s;
}
.form-checkbox__box i { display: none; color: #fff; font-size: 13px; }
.form-checkbox:hover .form-checkbox__box { border-color: var(--primary-400); }
.form-checkbox__input:checked + .form-checkbox__box { background: var(--primary-500); border-color: var(--primary-500); }
.form-checkbox__input:checked + .form-checkbox__box i { display: block; }
.form-checkbox__input:focus-visible + .form-checkbox__box { box-shadow: 0 0 0 3px rgba(53, 119, 241, .25); }
.form-checkbox__input:disabled + .form-checkbox__box { background: var(--border-soft); border-color: var(--border-soft); cursor: not-allowed; }
.form-checkbox__input:disabled ~ .form-checkbox__label { color: var(--text-faint); cursor: not-allowed; }
.form-checkbox__label { margin-left: 8px; font-size: 13px; color: var(--text-body); }

/* ---- 알림 배너(카드형, design-guide 6-19 — 로그인 카드 상단 등에서 재사용) ---- */
.notice-banner {
  display: flex; gap: 9px; align-items: flex-start;
  border-radius: var(--radius-btn); padding: 11px 13px;
  font-size: 12px; line-height: 1.6; margin-bottom: 16px;
}
.notice-banner i { font-size: 15px; margin-top: 1px; flex: none; }
.notice-banner--danger { background: var(--danger-subtle); color: var(--danger-text); }
.notice-banner--info { background: var(--info-subtle); color: var(--info-text); }
.notice-banner__retry {
  margin-top: 6px; appearance: none; border-radius: var(--radius-btn);
  font: 600 11.5px var(--font-kr); cursor: pointer; padding: 6px 12px; background: #fff;
}
.notice-banner--danger .notice-banner__retry { border: 1px solid rgba(224, 83, 63, .3); color: var(--danger-text); }
.notice-banner--danger .notice-banner__retry:hover { background: var(--danger-subtle); }

/* 세션 만료 유예 배너(비밀번호 변경 모달 상단)는 기존 .warn-banner를, 저장 실패는 .danger-banner를 재사용 */
.warn-banner__action { color: var(--primary-600); font-weight: 700; text-decoration: none; cursor: pointer; }
.warn-banner__action:hover { text-decoration: underline; }
.warn-banner small { display: block; margin-top: 3px; font-size: 11px; font-weight: 400; color: var(--warning-text); }
.danger-banner__retry {
  margin-top: 6px; appearance: none; border: 1px solid rgba(224, 83, 63, .3); background: #fff;
  color: var(--danger-text); padding: 6px 12px; border-radius: var(--radius-btn);
  font: 600 11.5px var(--font-kr); cursor: pointer;
}
.danger-banner__retry:hover { background: var(--danger-subtle); }

/* ---- 스피너(design-guide 6-14 + 인라인 축소판) ---- */
.spinner {
  display: inline-block; width: 22px; height: 22px; border-radius: 50%;
  border: 2.5px solid var(--border-soft); border-top-color: var(--primary-500);
  animation: spin .7s linear infinite; flex: none;
}
.spinner--sm { width: 14px; height: 14px; border-width: 2px; }
.spinner--on-primary { border-color: rgba(255, 255, 255, .45); border-top-color: #fff; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---- 버튼 로딩 상태(모디파이어, design-guide 6-19/6-16 "확인 중..."/"저장 중...") ---- */
.btn .spinner { display: none; }
.btn--loading { pointer-events: none; }
.btn-primary.btn--loading { background: var(--primary-600); }
.btn__label--loading { display: none; }
.btn--loading .btn__label--default { display: none; }
.btn--loading .btn__label--loading { display: inline; }
.btn--loading .spinner { display: inline-block; }

/* ---- 계정 메뉴(앵커 드롭다운, design-guide 6-18 — 상단바 아바타를 트리거로 재사용) ---- */
.acct-menu { position: relative; }
.acct-menu__trigger {
  appearance: none; border: none; background: none; padding: 6px; margin: -6px;
  border-radius: 50%; cursor: pointer; display: flex; align-items: center; justify-content: center;
}
.acct-menu__avatar {
  width: 32px; height: 32px; border-radius: 50%;
  background: var(--primary-500); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font: 700 12.5px var(--font-num); flex: none; transition: .13s;
}
.acct-menu__trigger:hover .acct-menu__avatar { box-shadow: 0 0 0 3px var(--primary-subtle); }
.acct-menu__trigger:focus-visible { outline: none; }
.acct-menu__trigger:focus-visible .acct-menu__avatar { box-shadow: 0 0 0 3px rgba(53, 119, 241, .25); }
.acct-menu.is-open .acct-menu__avatar { background: var(--primary-600); box-shadow: 0 0 0 3px var(--primary-subtle); }

.acct-menu__panel {
  position: absolute; top: calc(100% + 8px); right: 0; width: 208px;
  background: #fff; border: 1px solid var(--border); border-radius: 10px;
  box-shadow: var(--shadow-dropdown); padding: 6px; z-index: 60;
}
.acct-menu__panel::before {
  content: ""; position: absolute; top: -6px; right: 10px; width: 11px; height: 11px;
  background: #fff; border-left: 1px solid var(--border); border-top: 1px solid var(--border);
  transform: rotate(45deg);
}
.acct-menu__item {
  appearance: none; width: 100%; border: none; background: none; text-align: left;
  display: flex; align-items: center; gap: 9px; padding: 10px 12px; border-radius: 7px;
  font: 500 13px var(--font-kr); color: var(--text-body); cursor: pointer; transition: .12s;
}
.acct-menu__item-icon, .acct-menu__item i { font-size: 16px; color: var(--text-secondary); flex: none; }
.acct-menu__item:hover, .acct-menu__item:focus-visible { background: var(--surface-soft); outline: none; }
.acct-menu__item--logout { margin-top: 6px; padding-top: 10px; border-top: 1px solid var(--border-soft); }
.acct-menu__item .spinner { display: none; }
.acct-menu__item--loading { pointer-events: none; color: var(--text-muted); }
.acct-menu__item--loading .acct-menu__item-icon { display: none; }
.acct-menu__item--loading .spinner { display: inline-block; }
.acct-menu__error { display: flex; align-items: center; gap: 6px; margin: 4px 0 0; padding: 8px 12px 4px; font-size: 11px; color: var(--danger-text); }
.acct-menu__error i { font-size: 13px; }

/* ---- 모달 오버레이(design-guide 6-12 — 비밀번호 변경 모달 등 입력형 모달, 위 .modal-backdrop/.modal-box와는 별도 컴포넌트) ---- */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(20, 26, 44, .48);
  display: flex; align-items: center; justify-content: center; z-index: 120;
}
.modal-overlay .modal {
  width: 440px; max-width: 92%; background: #fff; border-radius: var(--radius-modal);
  box-shadow: var(--shadow-modal); max-height: 88vh; overflow-y: auto;
}
.modal__header {
  padding: 20px 22px 14px; display: flex; align-items: flex-start; justify-content: space-between;
  border-bottom: 1px solid var(--border-soft);
}
.modal__title { margin: 0; font: 600 16px var(--font-kr); color: var(--text-strong); }
.modal__close {
  width: 30px; height: 30px; border-radius: var(--radius-btn); background: var(--bg); border: none;
  display: flex; align-items: center; justify-content: center; color: var(--text-muted); cursor: pointer; flex: none;
}
.modal__close:hover { background: var(--border-soft); }
.modal__body { padding: 16px 22px 8px; }
.modal__footer {
  padding: 16px 22px; border-top: 1px solid var(--border-soft); background: var(--surface-soft);
  display: flex; justify-content: flex-end; gap: 8px; border-radius: 0 0 var(--radius-modal) var(--radius-modal);
}

/* ---- 토스트(design-guide 6-9/6-20 — 이 사이트 첫 실사용, 3variant) ---- */
.toast {
  position: fixed; right: 24px; bottom: 24px; width: 320px; background: #fff;
  border-radius: 12px; box-shadow: var(--shadow-toast); padding: 14px 16px;
  display: flex; align-items: flex-start; gap: 11px; z-index: 200;
}
.toast__icon { width: 34px; height: 34px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 17px; flex: none; }
.toast--success .toast__icon { background: var(--success-subtle); color: var(--success); }
.toast--danger .toast__icon { background: var(--danger-subtle); color: var(--danger); }
.toast--info .toast__icon { background: var(--info-subtle); color: var(--info); }
.toast__body { flex: 1; }
.toast__title { font: 600 12.5px var(--font-kr); color: var(--text-strong); }
.toast__desc { font: 400 11px var(--font-kr); color: var(--text-muted); margin-top: 2px; }
.toast__close { color: var(--text-faint); font-size: 16px; cursor: pointer; flex: none; background: none; border: none; padding: 0; }
.toast__close:hover { color: var(--text-secondary); }
.toast--enter { animation: toast-in .25s ease-out; }
.toast--leave { animation: toast-out .2s ease-in; }
@keyframes toast-in { from { opacity: 0; transform: translateX(12px); } to { opacity: 1; transform: translateX(0); } }
@keyframes toast-out { from { opacity: 1; transform: translateY(0); } to { opacity: 0; transform: translateY(-6px); } }
.toast-stack { position: fixed; right: 24px; bottom: 24px; z-index: 200; display: flex; flex-direction: column; gap: 10px; }
.toast-stack .toast { position: static; }

@media (max-width: 640px) {
  .toast { left: 16px; right: 16px; bottom: 16px; width: auto; }
  .toast-stack { left: 16px; right: 16px; bottom: 16px; }
}

@media (max-width: 1024px) {
  .stat-grid { grid-template-columns: repeat(2, 1fr) !important; }
}
