/* ═══════════════════════════════════════════════════════
   Argos Admin — Shared Design System
   모든 페이지에서 공유하는 디자인 토큰 + 컴포넌트
   ═══════════════════════════════════════════════════════ */

/* ── PRETENDARD + AFACAD FONT ──
   폐쇄망(에어갭) 전제: 외부 CDN/구글폰트 @import 제거 (이그레스 차단 위반 + 관리자 IP 유출).
   TODO: Pretendard/Afacad 폰트 파일을 패키지에 동봉하고 same-origin @font-face로 서빙할 것.
   그 전까지는 시스템 폰트 폴백 스택 사용. */

/* ── DESIGN TOKENS ── */
:root {
  --bg:           #f5f7f9;
  --surface:      #ffffff;
  --border:       #e5e9f0;
  --accent:       #2e5bff;
  --accent-light: #eef1ff;
  --accent-tint:  rgba(46,91,255,.06);
  --warn:         #ff8528;
  --warn-light:   #fff4ed;
  --danger:       #ff1111;
  --danger-light: #fff0f0;
  --positive:     #22c55e;
  --positive-light:#f0fdf4;
  --purple:       #8b5cf6;
  --purple-light: #ede9fe;
  --text:         #000000;
  --text-dim:     #777777;
  --text-muted:   #a7a7a7;
  --sans: 'Pretendard', -apple-system, BlinkMacSystemFont, 'Apple SD Gothic Neo', 'Segoe UI', 'Malgun Gothic', 'Noto Sans KR', sans-serif;
  --radius-card:  16px;
  --radius-btn:   8px;

  /* Card 그림자 (rest / hover) — 슬레이트 톤으로 보다 절제 */
  --shadow-card:       0 1px 2px rgba(15,23,42,.03);
  --shadow-card-hover: 0 1px 3px rgba(15,23,42,.04), 0 6px 14px rgba(15,23,42,.05);

  /* AI 헤더용 그라데이션 (월간 리포트 섹션 4) */
  --gradient-ai: linear-gradient(100deg, #1f6bff 0%, #3b8aff 60%, #5aa4ff 100%); /* Figma 시안 — AI 자문 배너 블루 */

  /* ── 차트 토큰 ──────────────────────────────────────────────────────────────
     모든 차트(도넛·점수 링·막대·라인·실드)의 색/크기/타이밍 단일 출처.
     하드코딩 hex 대신 이 토큰을 사용해 페이지 간 통일을 유지합니다. */

  /* 차트 기본 블루 (공식 --accent #2e5bff 계열로 수렴) */
  --chart-primary:        var(--accent);          /* #2e5bff */
  --chart-primary-strong: #1d4ed8;                /* 진한 끝점 / 도트 / hover */
  --chart-primary-soft:   #7d9bff;                /* 밝은 그라데이션 시작점 */
  --chart-track:          #edf2ff;                /* 링 배경 트랙(블루 틴트) */
  --chart-track-neutral:  #eef1f6;                /* 점수 링 중립 트랙 */
  --chart-area-fill:      rgba(46,91,255,.14);    /* 라인 차트 영역 채움 */

  /* 값 기반 팔레트 — 브랜드 블루(좋음) → 레드(위험). 임계값 90/75/60 (backend score.py 잠금).
     argos-charts.js valuePalette()가 이 토큰을 JS로도 노출합니다. 둘을 함께 수정하세요. */
  --status-a-base:#2e5bff; --status-a-soft:#7d9bff; --status-a-glow:rgba(46,91,255,.40); /* 90+ 우수 */
  --status-b-base:#3aa0ff; --status-b-soft:#9ccbff; --status-b-glow:rgba(58,160,255,.38); /* 75+ 양호 */
  --status-c-base:#ff8528; --status-c-soft:#ffb878; --status-c-glow:rgba(255,133,40,.40); /* 60+ 주의 */
  --status-d-base:#ff1111; --status-d-soft:#ff7070; --status-d-glow:rgba(255,17,17,.35);  /* <60 위험 */

  /* 카테고리(고정색) 막대 — 의미상 분류 구분이므로 고정색 유지하되 토큰화 */
  --bar-red:    linear-gradient(90deg, #ff9195 0%, #ff575d 48%, #ff1111 100%);  --bar-red-accent:    #ff1111;
  --bar-orange: linear-gradient(90deg, #ffd2ae 0%, #ffa45f 48%, #ff8528 100%);  --bar-orange-accent: #ff8528;
  --bar-blue:   linear-gradient(90deg, #bac9ff 0%, #6688ff 48%, #2e5bff 100%);  --bar-blue-accent:   #2e5bff;
  --bar-teal:   linear-gradient(90deg, #99f6e4 0%, #2dd4bf 48%, #0f9f8f 100%);  --bar-teal-accent:   #0f9f8f;

  /* 차트 애니메이션 (1종 표준화) */
  --ease-chart: cubic-bezier(.22,1,.36,1);
  --dur-chart:  1.4s;
  --anim-chart: var(--dur-chart) var(--ease-chart);

  /* 링 기하 규약 (stroke = 지름 × 비율) */
  --ring-stroke-ratio: .085;

  /* ── 글자 크기 스케일 ────────────────────────────────────────────────────────
     기존 사용값에 스냅 — 같은 종류 요소는 모든 페이지에서 동일 토큰을 사용합니다.
     인접 중복값(14/13→body, 11→meta, 9.5→nano)은 최근접 토큰으로 흡수.
     rem 단위(÷16) — 기본 설정에서 픽셀 동일, 사용자 글꼴 크기 설정(WCAG 1.4.4) 반영. */
  --fs-display:  2.875rem;   /* 46px — 종합 점수 대형 숫자 */
  --fs-kpi:      2rem;       /* 32px — KPI 값 */
  --fs-h1:       1.75rem;    /* 28px — 페이지 타이틀 / 서브 KPI */
  --fs-h2:       1.5rem;     /* 24px — 오버뷰 값 */
  --fs-h3:       1.375rem;   /* 22px — 준수 카드 값 / 등급 뱃지 */
  --fs-lead:     1.25rem;    /* 20px — 브랜드 로고 / D-day 카운트 */
  --fs-title:    1rem;       /* 16px — 섹션 타이틀 */
  --fs-subtitle: 0.9375rem;  /* 15px — 카드 타이틀 */
  --fs-body:     0.84375rem; /* 13.5px — 본문 / 폼 / 내비 */
  --fs-body-sm:  0.78125rem; /* 12.5px — 표 / 막대 라벨 / mono */
  --fs-caption:  0.75rem;    /* 12px — 캡션 / 푸터 / 칩 */
  --fs-meta:     0.71875rem; /* 11.5px — 메타 / 상태 칩 / 로그 시간 */
  --fs-micro:    0.65625rem; /* 10.5px — 표 헤더 / 사이드바 라벨 / 데이터 뱃지 */
  --fs-nano:     0.625rem;   /* 10px — 심각도 뱃지 / 소형 뱃지 */
}

/* ── 페이지 전환 깜빡임(FOUC) 방지 ──────────────────────────────────────────
   argos-shell.js가 nav·sidebar 삽입을 마친 뒤 body에 .argos-ready를 추가합니다.
   삽입 완료 전(.argos-ready 없는 상태)에는 .layout을 숨겨 1프레임 플래시를 차단합니다. */
body:not(.argos-ready) .layout {
  visibility: hidden;
}

/* ── RESET ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }

/* 키보드 포커스 가시화 — 마우스 클릭에는 표시되지 않음 (WCAG 2.4.7) */
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  min-height: 100vh;
  overflow-x: hidden;
}

/* ══ SHELL-CRITICAL ══════════════════════════════════════════════════════════
   아래 섹션(NAVBAR, LAYOUT, SIDEBAR, FOOTER)은 argos-shell.js가 삽입하는 구조입니다.
   이 스타일을 제거하거나 클래스명을 변경하면 모든 페이지의 레이아웃이 깨집니다.
   수정이 필요한 경우 반드시 argos-shell.js의 buildNav() / buildSidebar() 와 함께 수정하세요.
   ══════════════════════════════════════════════════════════════════════════ */

/* ── NAVBAR ── */
nav {
  position: fixed; top: 0; left: 0; right: 0; height: 60px;
  background: var(--surface); border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 28px; z-index: 100;
}
.nav-brand {
  font-size: var(--fs-lead); font-weight: 800; color: #000;
  font-family: 'Afacad', sans-serif;
  letter-spacing: 0; flex-shrink: 0; text-decoration: none;
}
.nav-left  { display: flex; align-items: center; gap: 6px; flex-shrink: 0; }
.nav-right { display: flex; align-items: center; gap: 4px; flex-shrink: 0; }
/* 햄버거(드로어 토글)는 모바일에서만 표시 — @media (max-width: 768px) 참조
   (.nav-icon-btn의 display:grid보다 특이도를 높여 데스크톱에서 확실히 숨김) */
.nav-icon-btn.nav-menu-btn { display: none; }
.nav-icon-btn {
  width: 36px; height: 36px; border-radius: 8px; background: transparent;
  border: none; cursor: pointer; display: grid; place-items: center;
  color: var(--text-dim); transition: background .15s, color .15s; font-size: var(--fs-title);
}
.nav-icon-btn:hover { background: var(--bg); color: var(--text); }
.nav-avatar {
  width: 34px; height: 34px; border-radius: 50%;
  background: var(--accent); display: grid; place-items: center;
  font-size: var(--fs-meta); font-weight: 700; color: #fff; margin-left: 6px;
  border: none; flex-shrink: 0;
}

/* ── 전역 검색 / 알림 패널 (argos-shell.js buildNav) ── */
.nav-search { position: relative; margin-right: 4px; }
.nav-search input { width: 240px; height: 34px; font-size: var(--fs-meta); }
.nav-panel {
  position: absolute; top: 44px; right: 0; width: 340px; max-height: 60vh; overflow-y: auto;
  background: var(--surface); border: 1px solid var(--border); border-radius: 10px;
  box-shadow: 0 8px 24px rgba(0,0,0,.12); z-index: 200; padding: 6px 0;
}
#argos-alerts { top: 52px; }
.nav-panel-head {
  padding: 6px 14px; font-size: var(--fs-micro); font-weight: 700;
  color: var(--text-dim); text-transform: uppercase; letter-spacing: .04em;
}
.nav-panel-row {
  display: block; padding: 8px 14px; text-decoration: none; color: var(--text);
  border-left: 2px solid transparent;
}
a.nav-panel-row:hover { background: var(--bg); border-left-color: var(--accent); }
.nav-panel-row strong { display: block; font-size: var(--fs-meta); font-weight: 700; }
.nav-panel-row span {
  display: block; font-size: var(--fs-micro); color: var(--text-dim);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.nav-panel-empty { padding: 14px; font-size: var(--fs-meta); color: var(--text-dim); text-align: center; }
/* 운영 경보가 있을 때만 종에 점을 찍는다(배너와 같은 신호) */
#argos-bell-btn { position: relative; }
#argos-bell-btn.has-alert::after {
  content: ''; position: absolute; top: 6px; right: 7px;
  width: 7px; height: 7px; border-radius: 50%; background: var(--danger, #b91c1c);
}

/* ── LAYOUT ── */
.layout { display: grid; grid-template-columns: 220px 1fr; min-height: 100vh; padding-top: 60px; }
/* 운영 헬스 배너가 떠 있으면 배너의 margin-top:60px 이 고정 nav 여백을 이미 확보한다 */
body.has-ops-banner .layout { padding-top: 0; }
/* grid item의 min-width:auto가 좁은 화면에서 main을 콘텐츠 최소폭으로 밀어내는 것 방지 */
.layout > main { min-width: 0; }

/* ── SIDEBAR ── */
aside {
  background: var(--surface); border-right: 1px solid var(--border);
  padding: 16px 0; position: sticky; top: 60px;
  height: calc(100vh - 60px); overflow-y: auto;
}
.sidebar-section { margin-bottom: 8px; }
.sidebar-label {
  display: flex; justify-content: space-between; align-items: center;
  font-size: var(--fs-micro); font-weight: 700; color: var(--text-muted);
  padding: 10px 20px 5px; letter-spacing: .07em; text-transform: uppercase;
  cursor: pointer; user-select: none; list-style: none;
}
.sidebar-label::-webkit-details-marker { display: none; }
.sidebar-label::after {
  content: '⌄'; color: var(--text-muted); font-size: var(--fs-body);
  line-height: 1; transform: rotate(-90deg); transition: transform .15s;
}
details[open] .sidebar-label::after { transform: rotate(0); }
.sidebar-label:hover { background: var(--bg); }
.sidebar-label:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.sidebar-item {
  display: flex; align-items: center; gap: 9px;
  padding: 10px 20px 10px 17px;
  font-size: var(--fs-body); font-weight: 500; color: var(--text-dim);
  cursor: pointer; border-left: 3px solid transparent;
  text-decoration: none;
  transition: background .15s, color .15s, border-color .15s;
}
.sidebar-item:hover { color: var(--text); background: var(--bg); }
.sidebar-item.active {
  color: var(--accent); background: var(--accent-tint);
  border-left-color: var(--accent); font-weight: 600;
}
.sidebar-item .s-icon {
  width: 18px; height: 18px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center; opacity: .75;
}
.sidebar-item .s-icon svg { display: block; flex-shrink: 0; }
.sidebar-item.active .s-icon { opacity: 1; }

/* ── MAIN ── */
main { padding: 28px 36px; }

/* ── PAGE HEADER ── */
.page-header { margin-bottom: 28px; }
.breadcrumb { font-size: var(--fs-meta); color: var(--text-muted); margin-bottom: 6px; }
.breadcrumb span { margin: 0 5px; }
.page-title-row { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; margin-bottom: 4px; }
.page-title { font-size: var(--fs-h1); font-weight: 800; color: var(--text); letter-spacing: -.01em; line-height: 1.2; }
h1.page-title { margin: 0; }
.page-subtitle { font-size: var(--fs-body); color: var(--text-dim); margin-top: 4px; line-height: 1.6; }
.page-meta  { font-size: var(--fs-caption); color: var(--text-muted); margin-top: 10px; }

/* ── SECTION TITLE + BADGE (월간 리포트 / 준수 현황 공통) ── */
.section-title {
  display: flex; align-items: center; gap: 12px;
  font-size: var(--fs-title); font-weight: 700; color: var(--text);
  margin-bottom: 16px; padding-bottom: 12px;
  border-bottom: 2px solid var(--border);
}
.section-title-sub {
  font-size: var(--fs-caption); font-weight: 400; color: var(--text-dim); margin-top: 2px;
}
.section-badge {
  width: 36px; height: 36px; border-radius: 50%;
  display: grid; place-items: center; flex-shrink: 0;
  background: var(--accent-light); color: var(--accent);
}
.section-badge svg { width: 20px; height: 20px; display: block; }
.section-badge.blue   { background: var(--accent-light);   color: var(--accent); }
.section-badge.red    { background: var(--danger-light);   color: var(--danger); }
.section-badge.green  { background: var(--positive-light); color: var(--positive); }
.section-badge.purple { background: var(--purple-light);   color: var(--purple); }

/* ── META CHIPS (페이지 헤더 보조 정보) ── */
.meta-chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.meta-chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 5px 11px; border-radius: 99px;
  border: 1px solid var(--border); background: var(--surface);
  font-size: var(--fs-meta); font-weight: 500; color: var(--text);
  white-space: nowrap;
}
.meta-chip .label { color: var(--text-muted); font-weight: 500; }
.meta-chip .value { font-weight: 700; }
.meta-chip .value.fresh { color: var(--positive); }
.meta-chip .value.admin { color: var(--accent); }
.data-badge {
  font-size: var(--fs-micro); font-weight: 600; padding: 2px 9px; border-radius: 99px;
  background: rgba(37,99,235,.08); color: var(--accent);
}
.data-badge.live { background: rgba(34,197,94,.1);   color: var(--positive); }
.data-badge.err  { background: rgba(239,68,68,.1);    color: var(--danger); }
.data-badge.warn { background: rgba(249,115,22,.1);   color: var(--warn); }

/* ══ PAGE UTILITIES ══════════════════════════════════════════════════════════
   아래 섹션은 각 페이지에서 자유롭게 확장/오버라이드할 수 있는 유틸리티 스타일입니다.
   새 컴포넌트를 추가할 때 이 구분선 아래에 작성하세요.
   ══════════════════════════════════════════════════════════════════════════ */

/* ── CARD ── */
.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-card); overflow: hidden;
  box-shadow: var(--shadow-card);
  transition: box-shadow .2s;
}
.card:hover { box-shadow: var(--shadow-card-hover); }
.card-header {
  display: flex; align-items: center; justify-content: space-between;
  gap: 10px; flex-wrap: wrap;
  padding: 17px 22px; border-bottom: 1px solid var(--border);
}
.card-title { font-size: var(--fs-subtitle); font-weight: 700; color: var(--text); }
.card-action {
  font-size: var(--fs-caption); font-weight: 500; color: #42a7ff;
  text-decoration: none; cursor: pointer; opacity: .85; transition: opacity .15s;
  border: 0; background: transparent; padding: 0; font-family: var(--sans);
}
.card-action:hover { opacity: 1; }
.card-body { padding: 20px 22px; }

/* ── BUTTONS ── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 10px 20px; border-radius: var(--radius-btn); font-size: var(--fs-body);
  font-weight: 600; cursor: pointer; border: none; transition: opacity .15s, background .15s;
  font-family: var(--sans); min-width: 0; line-height: 1.35; text-align: center; white-space: normal;
}
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn-primary  { background: var(--accent);   color: #fff; }
.btn-primary:hover:not(:disabled) { background: #1d4ed8; }
.btn-success  { background: var(--positive); color: #fff; }
.btn-success:hover:not(:disabled) { background: #16a34a; }
.btn-danger   { background: var(--danger);   color: #fff; }
.btn-danger:hover:not(:disabled)  { background: #dc2626; }
.btn-outline  { background: transparent; color: var(--accent); border: 1.5px solid var(--accent); }
.btn-outline:hover:not(:disabled) { background: var(--accent-light); }
.btn-ghost    { background: var(--bg); color: var(--text-dim); border: 1px solid var(--border); }
.btn-ghost:hover:not(:disabled)   { background: var(--border); color: var(--text); }
.btn-full     { width: 100%; }
.btn-sm       { padding: 6px 14px; font-size: var(--fs-caption); }
.btn-lg       { padding: 13px 28px; font-size: var(--fs-subtitle); }

/* 그라데이션 필 버튼 (Figma 시안 — 보안 규정 생성기) */
.btn-grad-blue {
  background: linear-gradient(90deg, #4da3ff 0%, #1e6fff 100%);
  color: #fff; border-radius: 999px;
  box-shadow: 0 4px 14px rgba(30, 111, 255, .28);
}
.btn-grad-blue:hover:not(:disabled) { background: linear-gradient(90deg, #3d92f2 0%, #1257e6 100%); }
.btn-grad-green {
  background: linear-gradient(90deg, #6fdd8b 0%, #2fbf5d 100%);
  color: #fff; border-radius: 999px;
  box-shadow: 0 4px 14px rgba(47, 191, 93, .25);
}
.btn-grad-green:hover:not(:disabled) { background: linear-gradient(90deg, #5fcf7d 0%, #25ab50 100%); }
.btn-grad-sky {
  background: linear-gradient(90deg, #a7c9fb 0%, #6f9ff5 100%);
  color: #fff; border-radius: 999px;
  box-shadow: 0 4px 14px rgba(111, 159, 245, .25);
}
.btn-grad-sky:hover:not(:disabled) { background: linear-gradient(90deg, #93bbf7 0%, #5a8df0 100%); }
.btn-grad-blue:disabled, .btn-grad-green:disabled, .btn-grad-sky:disabled { box-shadow: none; }

/* ── FORM INPUTS ── */
.form-input, .form-textarea, .form-select {
  width: 100%; padding: 10px 14px; border: 1.5px solid var(--border);
  border-radius: 8px; font-size: var(--fs-body); font-family: var(--sans);
  color: var(--text); background: var(--surface); outline: none;
  transition: border-color .2s, box-shadow .2s;
}
.form-input:focus, .form-textarea:focus, .form-select:focus {
  border-color: var(--accent); box-shadow: 0 0 0 3px rgba(37,99,235,.08);
}
.form-textarea { resize: vertical; min-height: 120px; line-height: 1.6; }
.form-label {
  display: block; font-size: var(--fs-body-sm); font-weight: 600;
  color: var(--text-dim); margin-bottom: 5px;
}
/* 입력 칸 아래 보조 설명(주의문구 등). .form-group 이 gap 을 주므로 margin 은 0. */
.form-hint {
  margin: 0; font-size: var(--fs-body-sm); color: var(--text-muted); line-height: 1.5;
}
.form-switch {
  width: 44px; height: 24px; appearance: none; background: var(--border);
  border-radius: 99px; position: relative; cursor: pointer; outline: none;
  transition: background .2s; flex-shrink: 0;
  box-shadow: inset 0 1px 2px rgba(15,23,42,.06);
}
.form-switch::after {
  content: ''; position: absolute; top: 2px; left: 2px;
  width: 20px; height: 20px; background: var(--surface); border-radius: 50%;
  transition: transform .2s;
  box-shadow: 0 1px 3px rgba(15,23,42,.18);
}
.form-switch:checked { background: var(--accent); }
.form-switch:checked::after { transform: translateX(20px); }
.form-switch:focus-visible { box-shadow: 0 0 0 3px var(--accent-light); }
.form-group { display: flex; flex-direction: column; gap: 5px; }
.form-row { display: grid; gap: 14px; }
.form-row.cols-2 { grid-template-columns: 1fr 1fr; }
.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;
}

/* ── TABLE ── */
.tbl-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: var(--fs-body-sm); }
thead tr { background: #f8fafc; }
th {
  font-size: var(--fs-micro); font-weight: 700; color: var(--text-dim);
  padding: 11px 16px; text-align: left; letter-spacing: .04em;
  border-bottom: 1px solid var(--border);
}
td { padding: 12px 16px; border-bottom: 1px solid var(--border); color: var(--text); vertical-align: middle; }
tr:last-child td { border-bottom: none; }
tbody tr { transition: background .12s; }
tbody tr:hover { background: #f8fafc; }

/* ── SEVERITY BADGES ── */
.sev {
  display: inline-flex; align-items: center; font-size: var(--fs-nano);
  padding: 3px 8px; font-weight: 700; border-radius: 4px; letter-spacing: .04em; white-space: nowrap;
}
.sev.CRITICAL { background: #fee2e2; color: #dc2626; }
.sev.HIGH     { background: #fef3c7; color: #b45309; }
.sev.MEDIUM   { background: #dbeafe; color: #1d4ed8; }
.sev.LOW      { background: #dcfce7; color: #15803d; }

/* ── STATUS DOTS / PILLS ── */
.status-pill {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: var(--fs-meta); font-weight: 600; padding: 4px 10px; border-radius: 99px;
}
.status-pill.online  { background: rgba(34,197,94,.1);  color: var(--positive); }
.status-pill.warn    { background: rgba(249,115,22,.1); color: var(--warn); }
.status-pill.offline { background: rgba(239,68,68,.1);  color: var(--danger); }
.status-dot { width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0; animation: blink 1.8s ease-in-out infinite; }
.status-dot.green  { background: var(--positive); }
.status-dot.orange { background: var(--warn); }
.status-dot.red    { background: var(--danger); }

/* ── DATA STATE PILLS ── */
.state-flags { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 6px; }
.state-pill {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 24px; padding: 3px 9px; border-radius: 999px;
  font-size: var(--fs-meta); font-weight: 700; line-height: 1.3;
  background: #f1f5f9; color: var(--text-dim); white-space: nowrap;
}
.state-pill.real,
.state-pill.available,
.state-pill.complete { background: #dcfce7; color: #15803d; }
.state-pill.demo,
.state-pill.sample,
.state-pill.sample_included { background: #dbeafe; color: #1d4ed8; }
.state-pill.missing,
.state-pill.insufficient { background: #fee2e2; color: #b91c1c; }
.state-pill.partial,
.state-pill.stale { background: #ffedd5; color: #c2410c; }
.state-pill.risk { background: #fee2e2; color: #991b1b; }

/* ── COMPLIANCE / RISK CARDS ── */
.compliance-overview {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-card); margin-bottom: 16px; overflow: hidden;
}
.compliance-overview-head {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 14px;
  padding: 18px 22px; border-bottom: 1px solid var(--border);
}
.compliance-overview-title { font-size: var(--fs-subtitle); font-weight: 800; color: var(--text); }
.compliance-overview-sub { font-size: var(--fs-caption); color: var(--text-dim); margin-top: 4px; line-height: 1.5; }
.compliance-card-grid { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 0; }
.compliance-card {
  min-height: 112px; padding: 16px 18px; border-right: 1px solid var(--border);
  display: flex; flex-direction: column; justify-content: space-between; gap: 12px;
}
.compliance-card:last-child { border-right: none; }
.compliance-card-label { font-size: var(--fs-meta); color: var(--text-dim); font-weight: 700; line-height: 1.4; }
.compliance-card-value {
  font-size: var(--fs-h3); font-weight: 800; color: var(--text); line-height: 1.15;
  overflow-wrap: anywhere;
}
.risk-scenario-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.risk-scenario-item {
  border: 1px solid var(--border); border-radius: 8px; padding: 12px 14px;
  background: #fff; min-height: 132px;
}
.risk-scenario-top {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; margin-bottom: 7px;
}
.risk-scenario-name { font-size: var(--fs-body-sm); font-weight: 800; color: var(--text); line-height: 1.4; }
.risk-scenario-text { font-size: var(--fs-caption); color: var(--text-dim); line-height: 1.55; }
.risk-scenario-text.strong { color: var(--text); margin-top: 5px; }
.risk-scenario-text.muted { color: var(--text-muted); margin-top: 5px; }

/* ── SECTION SPACING ── */
.section-stack { display: flex; flex-direction: column; gap: 16px; }
.section-spaced { margin-bottom: 32px; }
.section-compact { margin-bottom: 16px; }

/* ── BAR CHART (공유 표준 — 모든 막대 차트가 이 기하/타이밍/색을 상속) ── */
.bar-list { display: flex; flex-direction: column; gap: 16px; }
.bar-meta { display: flex; justify-content: space-between; align-items: center; margin-bottom: 5px; }
.bar-name  { font-size: var(--fs-body-sm); font-weight: 500; color: var(--text); }
.bar-count { font-size: var(--fs-body-sm); font-weight: 700; color: var(--text); }
.bar-track { height: 14px; background: #f1f5f9; border-radius: 999px; overflow: hidden; }
.bar-fill  { height: 100%; border-radius: 999px; transition: width var(--anim-chart); }
.bar-fill.red    { background: var(--bar-red); }
.bar-fill.orange { background: var(--bar-orange); }
.bar-fill.blue   { background: var(--bar-blue); }
.bar-fill.teal   { background: var(--bar-teal); }
.bar-fill.green  { background: linear-gradient(90deg, #22c55e, #4ade80); }
.bar-fill.purple { background: linear-gradient(90deg, #8b5cf6, #a78bfa); }

/* ── LOG LIST ── */
.log-list { display: flex; flex-direction: column; }
.log-item {
  display: grid; grid-template-columns: 42px 9px 1fr;
  gap: 10px; padding: 12px 0; border-bottom: 1px solid var(--border); align-items: start;
}
.log-item:last-child { border-bottom: none; }
.log-time { font-size: var(--fs-meta); color: var(--text-muted); padding-top: 2px; }
.log-dot  { width: 9px; height: 9px; border-radius: 50%; margin-top: 3px; flex-shrink: 0; }
.log-dot.red    { background: var(--danger); }
.log-dot.orange { background: var(--warn); }
.log-dot.blue   { background: var(--accent); }
.log-dot.green  { background: var(--positive); }
.log-msg { font-size: var(--fs-body-sm); color: var(--text); font-weight: 500; line-height: 1.4; margin-bottom: 2px; }
.log-src { font-size: var(--fs-meta); color: var(--text-muted); }

/* ── ALERT / NOTICE BOX ── */
.alert {
  padding: 12px 16px; border-radius: 10px; font-size: var(--fs-body);
  display: flex; align-items: flex-start; gap: 10px; line-height: 1.5;
}
.alert.info    { background: var(--accent-light); border: 1px solid #bfdbfe; color: #1e40af; }
.alert.success { background: var(--positive-light); border: 1px solid #bbf7d0; color: #15803d; }
.alert.warn    { background: var(--warn-light); border: 1px solid #fed7aa; color: #9a3412; }
.alert.danger  { background: var(--danger-light); border: 1px solid #fecaca; color: #991b1b; }

/* ── GRID HELPERS ── */
.grid-2    { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.grid-3    { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 16px; }
.grid-1-2  { display: grid; grid-template-columns: 1fr 2fr; gap: 16px; }
.grid-2-1  { display: grid; grid-template-columns: 2fr 1fr; gap: 16px; }
.grid-3-2  { display: grid; grid-template-columns: 3fr 2fr; gap: 16px; }

/* ── FOOTER ── */
footer {
  margin-top: 32px; border-top: 1px solid var(--border); padding: 16px 0;
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; flex-wrap: wrap;
  font-size: var(--fs-caption); color: var(--text-muted);
}
footer a { color: var(--text-muted); text-decoration: none; transition: color .15s; }
footer a:hover { color: var(--accent); }
.footer-links { display: flex; gap: 20px; }
.footer-status { display: flex; align-items: center; gap: 5px; }
.footer-dot { width: 6px; height: 6px; background: var(--positive); border-radius: 50%; animation: blink 2s infinite; }

/* ── ANIMATIONS ── */
@keyframes fadeUp  { from{transform:translateY(14px);opacity:0} to{transform:translateY(0);opacity:1} }
@keyframes blink   { 0%,100%{opacity:1} 50%{opacity:.2} }
@keyframes shimmer { 0%{background-position:200% 0} 100%{background-position:-200% 0} }
@keyframes spin    { to { transform: rotate(360deg); } }

.skeleton {
  background: linear-gradient(90deg, #f0f4f8 25%, #e2e8f0 50%, #f0f4f8 75%);
  background-size: 200% 100%; animation: shimmer 1.5s infinite; border-radius: 6px;
}

/* ── LOADING / STATE (공용 — 페이지 인라인 중복 제거) ── */
.state-box {
  text-align: center; padding: 60px 20px;
  color: var(--text-dim); font-size: var(--fs-body);
}
.spinner {
  width: 36px; height: 36px; border-radius: 50%;
  border: 3px solid var(--border); border-top-color: var(--accent);
  animation: spin .8s linear infinite; margin: 0 auto 16px;
}

/* ── UPLOAD DROP ZONE ── */
.drop-zone {
  border: 2px dashed var(--border); border-radius: 12px;
  padding: 52px 20px; text-align: center; background: var(--bg);
  transition: border-color .2s, background .2s; cursor: pointer;
}
.drop-zone:hover, .drop-zone.dragover {
  border-color: var(--accent); background: var(--accent-light);
}
.drop-zone-icon { font-size: 44px; margin-bottom: 14px; }
.drop-zone-title { font-size: var(--fs-subtitle); font-weight: 600; color: var(--text); margin-bottom: 6px; }
.drop-zone-desc  { font-size: var(--fs-body); color: var(--text-dim); margin-bottom: 20px; }

/* ── RESPONSIVE ── */
@media (max-width: 1024px) {
  .grid-2, .grid-1-2, .grid-2-1, .grid-3-2 { grid-template-columns: 1fr; }
  .grid-3 { grid-template-columns: 1fr 1fr; }
  .compliance-card-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .risk-scenario-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 768px) {
  .layout { grid-template-columns: 1fr; }
  /* 닫힘 기본값은 display:none 유지 (오프캔버스 transform 금지 — 시각 테스트의 hidden 단언과 일치) */
  aside { display: none; }
  main { padding: 16px; }
  .grid-3 { grid-template-columns: 1fr; }
  .form-row.cols-2 { grid-template-columns: 1fr; }
  .compliance-overview-head { flex-direction: column; }
  .state-flags { justify-content: flex-start; }

  /* ── 모바일 사이드바 드로어 (argos-shell.js toggleSidebar와 연동) ── */
  .nav-icon-btn.nav-menu-btn { display: grid; }
  body.sidebar-open aside {
    display: block;
    position: fixed; top: 60px; left: 0; bottom: 0;
    width: 240px; z-index: 200;
    box-shadow: 0 12px 32px rgba(15, 23, 42, .18);
    animation: sidebar-slide-in .22s ease-out;
  }
  .sidebar-backdrop {
    position: fixed; inset: 60px 0 0 0;
    background: rgba(15, 23, 42, .4);
    z-index: 150;
    animation: backdrop-fade-in .22s ease-out;
  }
}
@keyframes sidebar-slide-in { from { transform: translateX(-100%); } to { transform: translateX(0); } }
@keyframes backdrop-fade-in { from { opacity: 0; } to { opacity: 1; } }
/* 데스크톱 폭으로 복귀 시 잔존 백드롭 숨김 */
@media (min-width: 769px) {
  .sidebar-backdrop { display: none; }
}
@media (max-width: 900px) {
  /* 좁은 화면에서는 검색창이 브랜드/아이콘을 밀어낸다 — 숨긴다(각 등록부 화면에 자체 검색이 있다) */
  .nav-search { display: none; }
  .nav-panel { width: min(340px, calc(100vw - 32px)); }
}
@media (max-width: 560px) {
  .compliance-card-grid,
  .risk-scenario-grid { grid-template-columns: 1fr; }
  .compliance-card { border-right: none; border-bottom: 1px solid var(--border); }
  .compliance-card:last-child { border-bottom: none; }
  footer { flex-direction: column; align-items: flex-start; }
  .footer-links { flex-wrap: wrap; gap: 12px; }
}
@media (max-width: 420px) {
  nav { padding: 0 14px; }
  .nav-right { gap: 2px; }
  .nav-icon-btn { width: 34px; height: 34px; }
  .nav-avatar { width: 32px; height: 32px; margin-left: 2px; }
  .card-header, .card-body { padding-left: 16px; padding-right: 16px; }
}

/* ── SHARED COMPONENTS ──────────────────────────────────────────────────── */

/* .stat-bar — 점수/진행률 막대 */
.stat-bar {
  width: 100%;
  height: 8px;
  background: var(--border);
  border-radius: 99px;
  overflow: hidden;
}
.stat-bar-fill {
  height: 100%;
  border-radius: 99px;
  background: var(--accent);
  transition: width 0.4s ease;
}
.stat-bar-fill.positive { background: var(--positive); }
.stat-bar-fill.warn     { background: var(--warn); }
.stat-bar-fill.danger   { background: var(--danger); }

/* .field-error — 폼 입력 오류 메시지 */
.field-error {
  display: none;
  font-size: var(--fs-caption);
  color: var(--danger);
  margin-top: 4px;
  padding-left: 2px;
  line-height: 1.4;
}
.field-error.visible { display: block; }
input.has-error,
select.has-error,
textarea.has-error {
  border-color: var(--danger) !important;
  box-shadow: 0 0 0 2px rgba(239,68,68,.15);
}

/* .dday-banner — D-day 마감 알림 배너 */
.dday-banner {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 18px;
  border-radius: 10px;
  font-size: var(--fs-body);
  font-weight: 500;
  margin-bottom: 16px;
  background: var(--warn-light);
  border: 1px solid #fed7aa;
  color: #92400e;
}
.dday-banner.urgent {
  background: var(--danger-light);
  border-color: #fca5a5;
  color: #991b1b;
}
.dday-banner.safe {
  background: var(--positive-light);
  border-color: #bbf7d0;
  color: #14532d;
}
.dday-banner-icon { flex-shrink: 0; }
.dday-banner-count {
  font-size: var(--fs-lead);
  font-weight: 800;
  line-height: 1;
  margin-right: 4px;
}

/* ── LOADING SKELETON ── */
.skeleton-text  { height: 14px; width: 60%; margin-bottom: 8px; }
.skeleton-text.wide { width: 90%; }

/* ── EMPTY STATE ── */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px 20px;
  text-align: center;
  gap: 10px;
}
.empty-state-icon {
  width: 48px; height: 48px;
  display: flex; align-items: center; justify-content: center;
  background: var(--bg); border-radius: 12px;
  color: var(--text-muted); margin-bottom: 4px;
}
.empty-state-title {
  font-size: var(--fs-body); font-weight: 700; color: var(--text);
}
.empty-state-desc {
  font-size: var(--fs-body); color: var(--text-dim); line-height: 1.6; max-width: 280px;
}

/* ── SETUP BANNER (첫 방문 체크리스트) ── */
.setup-banner {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  background: var(--accent-light);
  border: 1px solid #bfdbfe;
  border-radius: var(--radius-card);
  padding: 16px 20px;
  margin-bottom: 24px;
}
.setup-banner-body { flex: 1; }
.setup-banner-title {
  font-size: var(--fs-body); font-weight: 700; color: var(--accent); margin-bottom: 8px;
}
.setup-banner-steps {
  display: flex; flex-direction: column; gap: 6px;
  list-style: none; padding: 0; margin: 0;
}
.setup-banner-step {
  display: flex; align-items: center; gap: 8px;
  font-size: var(--fs-body); color: var(--text-dim);
}
.setup-banner-step.done { color: var(--positive); }
.setup-banner-step.done .step-icon { color: var(--positive); }
.step-num {
  width: 20px; height: 20px; border-radius: 50%;
  background: var(--accent); color: #fff;
  font-size: var(--fs-nano); font-weight: 700;
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.setup-banner-step.done .step-num { background: var(--positive); }
.setup-banner-dismiss {
  background: transparent; border: none; cursor: pointer;
  color: var(--text-muted); font-size: 18px; line-height: 1;
  padding: 0; flex-shrink: 0; transition: color .15s;
}
.setup-banner-dismiss:hover { color: var(--text); }
