/* ===== 스마트공장 정산 도우미 · 디자인 시스템 ===== */
/* 번들 폰트 — Pretendard(가변, OFL). 미로딩 시 --font 폴백 체인의 맑은 고딕으로 자연 대체. */
@font-face {
  font-family: 'Pretendard';
  src: url('fonts/PretendardVariable.woff2') format('woff2');
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}
:root {
  --navy-900: #0f172a;
  --navy-800: #1e293b;
  --navy-700: #334155;
  --slate-500: #64748b;
  --slate-400: #94a3b8;
  --slate-300: #cbd5e1;
  --slate-200: #e2e8f0;
  --slate-100: #f1f5f9;
  --slate-50: #f8fafc;
  /* 강조색 = 단일 '잉크블루' 위계(채도 절제). 하드코딩 rgba 방지용 --blue-rgb 동반. */
  --blue: #1f57d6;
  --blue-dark: #1a49b8;
  --blue-light: #dbeafe;
  --blue-rgb: 31, 87, 214;
  --green: #16a34a;
  --green-light: #dcfce7;
  --amber: #d97706;
  --amber-light: #fef3c7;
  --red: #dc2626;
  --red-light: #fee2e2;
  --purple: #7c3aed;
  --purple-light: #ede9fe;
  --teal: #0d9488;
  --teal-light: #ccfbf1;
  --white: #fff;
  /* 그림자 2겹(ambient+key, 음수 spread로 윤곽) — 카드는 은은하게, .raised만 들어올림 */
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, .04), 0 1px 1px rgba(15, 23, 42, .05);
  --shadow: 0 1px 2px rgba(15, 23, 42, .04), 0 6px 16px -4px rgba(15, 23, 42, .10);
  --shadow-lg: 0 12px 32px rgba(15, 23, 42, .16);
  /* 곡률 패밀리 — 기존 --radius/--radius-sm은 별칭으로 유지(하위호환) */
  --r-xs: 6px; --r-sm: 8px; --r-md: 10px; --r-lg: 14px; --r-full: 999px;
  --radius: var(--r-md);
  --radius-sm: var(--r-sm);
  /* 행간 3단 */
  --lh-tight: 1.35; --lh-base: 1.55; --lh-relaxed: 1.8;
  /* 타입 스케일 7단(흩어진 글자크기를 한 사다리로) */
  --fs-display: 28px; --fs-h1: 22px; --fs-h2: 17px; --fs-h3: 15px; --fs-body: 13px; --fs-label: 12px; --fs-micro: 11px;
  /* 8pt 간격 스케일 */
  --sp-1: 4px; --sp-2: 8px; --sp-3: 12px; --sp-4: 16px; --sp-5: 20px; --sp-6: 24px; --sp-8: 32px;
  /* 숫자: 등폭 + 슬래시제로(금액 자릿수 출렁임 제거) */
  --font-num: tabular-nums slashed-zero;
  /* 포커스 링(단일 토큰) — 하드코딩 rgba 통일 */
  --ring: 0 0 0 3px rgba(var(--blue-rgb), .15);
  --font: "Pretendard", "Malgun Gothic", "맑은 고딕", "Segoe UI", -apple-system, system-ui, sans-serif;
  /* 시맨틱 표면/상태 토큰 — 다크모드는 이 값들과 중립 램프만 오버라이드 */
  --surface: #fff;          /* 카드·입력·모달 등 흰 배경 */
  --surface-hover: #f8faff; /* 리스트·행 hover */
  --tr-hover: #eff6ff;      /* 표 행 hover */
  --page-bg: var(--slate-100);
  --chart-axis: var(--slate-500); /* SVG 차트 축·라벨 텍스트(다크에서 더 밝게) */
  --chart-grid: var(--slate-200); /* SVG 차트 격자선·빈 도넛(다크에서 더 밝게) */
  /* 시맨틱 별칭(향후 색 교체는 토큰 한 줄로) */
  --muted: var(--slate-500);
  --accent: var(--blue);
  --text: var(--navy-900);
  --border: var(--slate-200);
  /* 표시 밀도(편안/표준/조밀) — data-density로 오버라이드. 기본=표준(현행값 그대로) */
  --d-page-pad: 26px 32px 60px;
  --d-card-pad: 18px 20px;
  --d-card-head-pad: 16px 20px;
  --d-cell-pad: 11px 14px;
  --d-grid-gap: 16px;
}

/* ===== 다크 모드 (V1) — 중립 램프·표면·*-light 필을 반전, 강조색은 유지 ===== */
[data-theme="dark"] {
  --navy-900: #e8edf5;  --navy-800: #d3dae6;  --navy-700: #b9c2d2;
  --slate-500: #95a2b6; --slate-400: #7e8ca2; --slate-300: #46556b;
  --slate-200: #334155; --slate-100: #0e1626; --slate-50: #182238;
  --surface: #1e293b; --surface-hover: #243349; --tr-hover: #243349; --page-bg: #0e1626;
  --blue-light: #1c3a5e; --green-light: #16331e; --amber-light: #3b2c0d;
  --red-light: #3c1b1b; --purple-light: #2a2050; --teal-light: #0d332b;
  --chart-axis: #aab6c9; --chart-grid: #475569; /* 다크에서 축·격자선을 충분히 밝게(대비 확보) */
  --shadow-sm: 0 1px 2px rgba(0,0,0,.3); --shadow: 0 4px 12px rgba(0,0,0,.4); --shadow-lg: 0 12px 32px rgba(0,0,0,.55);
}
/* 다크: *-light 필 위 배지·요소 텍스트를 밝은 동색으로 */
[data-theme="dark"] .badge.green { color: #86efac; }
[data-theme="dark"] .badge.amber { color: #fcd34d; }
[data-theme="dark"] .badge.blue { color: #93c5fd; }
[data-theme="dark"] .badge.red { color: #fca5a5; }
[data-theme="dark"] .badge.purple { color: #c4b5fd; }
[data-theme="dark"] .badge.teal { color: #5eead4; }
[data-theme="dark"] .badge.gray { color: var(--slate-300); }
[data-theme="dark"] .checkline.checked { border-color: #2f5d3a; }
[data-theme="dark"] .pick-card.done { border-color: #2f5d3a; }
[data-theme="dark"] .ckp-miss { color: #fbbf77; }
[data-theme="dark"] .ltbl .lin:focus { background: #3a3413; }
[data-theme="dark"] .ltbl .lr-calc td, [data-theme="dark"] .ltbl .lr-calc th { background: #243349; }
[data-theme="dark"] code.inline { background: var(--slate-50); }
/* 다크: 그림자가 무력하므로 1px 밝은 rim으로 카드 위계 보강 + 포커스 링/칩/선택 톤 보정 */
[data-theme="dark"] { --ring: 0 0 0 3px rgba(120, 150, 230, .30); }
[data-theme="dark"] .card { box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .05); }
[data-theme="dark"] .card.raised { box-shadow: var(--shadow), inset 0 0 0 1px rgba(255, 255, 255, .06); }
[data-theme="dark"] .chip.active { color: #bfdbfe; }
[data-theme="dark"] ::selection { background: rgba(96, 134, 224, .30); }

/* ===== 고대비 (색약·저시력) — 테두리·텍스트 대비 강화(라이트/다크 공통) ===== */
[data-contrast="high"] { --slate-200: #94a3b8; --slate-300: #64748b; }
[data-contrast="high"] .card, [data-contrast="high"] .stat, [data-contrast="high"] .table-wrap { border-width: 1.5px; }
[data-contrast="high"] .badge { outline: 1px solid currentColor; outline-offset: -1px; }
[data-contrast="high"][data-theme="dark"] { --slate-200: #8595ad; --slate-300: #9aa8bd; --chart-grid: #6b7d96; }

/* ===== 표시 밀도 (편안/표준/조밀) — 데이터 밀집 화면의 여백을 사용자가 조절(기본 표준=현행) ===== */
[data-density="compact"] {
  --d-page-pad: 18px 26px 48px;
  --d-card-pad: 12px 16px;
  --d-card-head-pad: 11px 16px;
  --d-cell-pad: 7px 12px;
  --d-grid-gap: 12px;
}
[data-density="comfortable"] {
  --d-page-pad: 32px 40px 64px;
  --d-card-pad: 22px 26px;
  --d-card-head-pad: 20px 26px;
  --d-cell-pad: 14px 18px;
  --d-grid-gap: 20px;
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  font-family: var(--font);
  color: var(--navy-900);
  background: var(--slate-100);
  font-size: 14px;
  line-height: var(--lh-base);
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}
#app { display: flex; height: 100vh; }

/* ===== 사이드바 ===== */
.sidebar {
  width: 232px;
  flex-shrink: 0;
  /* 라이트/다크 공통으로 어둡게 고정(프리미엄 셸) — 다크에서 중립 램프 반전으로 사이드바가 밝아지는 것 방지 */
  background: linear-gradient(180deg, #101a2e, #0b1322);
  color: var(--slate-300);
  display: flex;
  flex-direction: column;
  padding: 18px 14px;
  border-right: 1px solid rgba(255, 255, 255, .04);
  /* 배율↑·낮은 창 높이에서 하단 버튼이 잘리지 않도록 사이드바 전체를 스크롤 가능하게(스크롤바 색은 아래 정의). */
  overflow-y: auto;
  overflow-x: hidden;
}
.brand { display: flex; align-items: center; gap: 11px; padding: 6px 6px 18px; flex-shrink: 0; }
.brand-mark {
  width: 40px; height: 40px; border-radius: var(--r-md);
  background: var(--blue);
  color: #fff; font-weight: 800; font-size: 16px;
  display: grid; place-items: center; letter-spacing: -.5px;
  box-shadow: 0 4px 12px rgba(var(--blue-rgb), .38), inset 0 1px 0 rgba(255, 255, 255, .18);
}
.brand-title { color: #fff; font-weight: 700; font-size: var(--fs-h3); }
.brand-sub { color: var(--slate-400); font-size: var(--fs-label); }
.nav { display: flex; flex-direction: column; gap: 3px; flex: 1 0 auto; } /* 여유 공간은 채우되(푸터 하단 정렬) 압축은 안 함 — 넘치면 사이드바가 스크롤 */
.nav-spacer { flex: 1; }
.nav-item {
  position: relative;
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px; border-radius: var(--radius-sm);
  color: var(--slate-300); cursor: pointer; user-select: none;
  font-size: 13.5px; font-weight: 500; transition: background .12s, color .12s;
}
.nav-item .ni-ico { width: 18px; height: 18px; display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; opacity: .8; }
.nav-item:hover { background: rgba(255, 255, 255, .07); color: #fff; }
/* 활성 = 통blue 알약 → 은은한 틴트 + 좌측 액센트 바(위치는 알리되 소리치지 않음) */
.nav-item.active { background: rgba(var(--blue-rgb), .20); color: #fff; }
.nav-item.active .ni-ico { opacity: 1; }
.nav-item.active::before {
  content: ""; position: absolute; left: -14px; top: 7px; bottom: 7px;
  width: 3px; border-radius: 0 3px 3px 0; background: #5b9bf5;
}
.sidebar-foot { font-size: 11.5px; color: var(--slate-500); padding: 12px 8px 0; border-top: 1px solid rgba(255,255,255,.08); flex-shrink: 0; } /* 버튼이 압축·잘리지 않게(넘치면 스크롤로 노출) */
.sidebar-foot .muted { margin-top: 2px; }
/* 자동 로그아웃 남은시간(초단위 카운트다운) + 연장 버튼 */
.sess-row { display: flex; align-items: center; gap: 8px; margin-top: 8px; }
.sess-time { font-variant-numeric: tabular-nums; font-weight: 700; font-size: 12px; letter-spacing: .2px; color: #cdd6e6; }
.sess-time.warn { color: #ff8585; }
.sess-ext { margin-left: auto; padding: 3px 12px; font-size: 11.5px; line-height: 1.4; flex-shrink: 0; }
/* 사이드바가 항상 어두우므로, 다크 테마에서 중립 램프가 어두워져도 사이드바 텍스트는 밝게 유지 */
[data-theme="dark"] .nav-item { color: #aab4c6; }
[data-theme="dark"] .nav-item:hover, [data-theme="dark"] .nav-item.active { color: #fff; }
[data-theme="dark"] .brand-sub { color: #8893a6; }
[data-theme="dark"] .sidebar-foot { color: #7c889c; }

/* ===== 콘텐츠 ===== */
.content { flex: 1; overflow: auto; }
.page { padding: var(--d-page-pad); max-width: 1280px; margin: 0 auto; }
.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; } /* 좁은 폭에서 액션 버튼바가 제목 아래로 줄바꿈(버튼 잘림 방지) */
.page-title { font-size: var(--fs-h1); font-weight: 800; letter-spacing: -.4px; }
.page-sub { color: var(--slate-500); font-size: var(--fs-body); margin-top: 4px; }
.page-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* 과제 작업화면 상시 탭바(증빙→인건비→대사→보고서→미흡대장 빠른 전환) */
.proj-tabbar { display: flex; align-items: center; justify-content: space-between; gap: 10px 16px; flex-wrap: wrap; padding: 6px 0 8px; margin-bottom: 14px; border-bottom: 1px solid var(--border); }
.proj-tabbar .pt-title { font-size: var(--fs-body); }
.proj-tabbar .pt-tabs { display: flex; gap: 2px; flex-wrap: wrap; }
.ptab { padding: 5px 12px; border-radius: 7px; font-size: 12.5px; font-weight: 600; color: var(--slate-500); text-decoration: none; white-space: nowrap; }
.ptab:hover { background: var(--slate-100); color: var(--navy-800, #1e293b); }
.ptab.active { background: rgba(var(--blue-rgb), .1); color: var(--blue); }
[data-theme="dark"] .ptab:hover { background: var(--slate-800, #1e293b); }

/* 알림 종 미읽음 배지 */
.notif-badge { display: inline-flex; align-items: center; justify-content: center; min-width: 17px; height: 17px; padding: 0 4px; margin-left: 4px; border-radius: 9px; background: var(--red, #dc2626); color: #fff; font-size: 10.5px; font-weight: 800; line-height: 1; vertical-align: middle; }
.notif-item.unread { background: rgba(var(--blue-rgb), .05); }
.notif-item:hover { background: var(--slate-100); }
[data-theme="dark"] .notif-item:hover { background: var(--slate-800, #1e293b); }

/* ===== 버튼 ===== */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 14px; border-radius: var(--radius-sm);
  border: 1px solid var(--slate-300); background: var(--surface); color: var(--navy-800);
  font-family: var(--font); font-size: var(--fs-body); font-weight: 600; cursor: pointer;
  transition: all .12s; white-space: nowrap;
}
.btn:hover { background: var(--slate-50); border-color: var(--slate-400); }
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--blue); border-color: var(--blue); color: #fff; }
.btn.primary:hover { background: var(--blue-dark); }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.ghost:hover { background: var(--slate-100); }
.btn.danger { color: var(--red); border-color: var(--red-light); background: var(--red-light); }
.btn.danger:hover { background: #fecaca; }
.btn.sm { padding: 5px 10px; font-size: var(--fs-label); }
.btn.lg { padding: 11px 20px; font-size: 14px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; }

/* ===== 카드 ===== */
.card { background: var(--surface); border: 1px solid var(--slate-200); border-radius: var(--radius); box-shadow: var(--shadow-sm); }
.card.raised { box-shadow: var(--shadow); } /* 핵심 카드만 들어올려 위계 부여(옵션) */
.card-pad { padding: var(--d-card-pad); }
.card-head { padding: var(--d-card-head-pad); border-bottom: 1px solid var(--slate-200); display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.card-head h3 { margin: 0; font-size: var(--fs-h3); font-weight: 700; }
.card-head .hint { font-size: var(--fs-label); color: var(--slate-500); font-weight: 400; }
.grid { display: grid; gap: var(--d-grid-gap); }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 1100px) { .grid-4 { grid-template-columns: repeat(2, 1fr); } .grid-3 { grid-template-columns: repeat(2,1fr);} }

/* ===== 통계 카드 ===== */
.stat { background: var(--surface); border: 1px solid var(--slate-200); border-radius: var(--radius); padding: 18px; box-shadow: none; }
.stat .label { font-size: 12.5px; color: var(--slate-500); font-weight: 600; }
.stat .value { font-size: var(--fs-display); font-weight: 800; letter-spacing: -1px; margin-top: 6px; line-height: var(--lh-tight); font-variant-numeric: var(--font-num); }
.stat .foot { font-size: var(--fs-label); color: var(--slate-500); margin-top: 4px; }
.stat .value small { font-size: 14px; font-weight: 600; color: var(--slate-500); }
.stat.accent { border-left: 4px solid var(--blue); }
.stat.green { border-left: 4px solid var(--green); }
.stat.amber { border-left: 4px solid var(--amber); }
.stat.red { border-left: 4px solid var(--red); }

/* ===== 배지 ===== */
.badge { display: inline-flex; align-items: center; gap: 5px; padding: 3px 9px; border-radius: var(--r-full); font-size: 11.5px; font-weight: 700; line-height: 1.5; border: 1px solid transparent; font-variant-numeric: var(--font-num); }
.badge.tight { padding: 1px 7px; font-size: var(--fs-micro); } /* 인라인 padding 흡수용 */
.badge.blue { background: var(--blue-light); color: var(--blue-dark); border-color: rgba(var(--blue-rgb), .22); }
.badge.green { background: var(--green-light); color: #15803d; border-color: rgba(22, 163, 74, .22); }
.badge.amber { background: var(--amber-light); color: #b45309; border-color: rgba(217, 119, 6, .22); }
.badge.red { background: var(--red-light); color: var(--red); border-color: rgba(220, 38, 38, .22); }
.badge.purple { background: var(--purple-light); color: var(--purple); border-color: rgba(124, 58, 237, .22); }
.badge.teal { background: var(--teal-light); color: var(--teal); border-color: rgba(13, 148, 136, .22); }
.badge.gray { background: var(--slate-200); color: var(--slate-500); border-color: rgba(100, 116, 139, .18); }
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }

/* ===== 표 ===== */
.table-wrap { overflow: auto; border-radius: var(--radius); border: 1px solid var(--slate-200); background: var(--surface); }
table.tbl { width: 100%; border-collapse: collapse; font-size: var(--fs-body); }
table.tbl th, table.tbl td { padding: var(--d-cell-pad); text-align: left; border-bottom: 1px solid var(--slate-200); white-space: nowrap; line-height: var(--lh-tight); }
table.tbl th { background: var(--slate-50); color: var(--slate-500); font-weight: 700; font-size: var(--fs-label); letter-spacing: .2px; border-bottom: 1px solid var(--slate-300); position: sticky; top: 0; z-index: 1; }
table.tbl tbody tr { cursor: pointer; transition: background .1s, box-shadow .1s; }
table.tbl tbody tr:hover { background: var(--tr-hover); box-shadow: inset 2px 0 0 var(--blue); }
table.tbl td.num { text-align: right; font-variant-numeric: var(--font-num); }
table.tbl th.tc, table.tbl td.tc:not(.num) { text-align: center; } /* 헤더·값 가운데 정렬(과제관리·운영현황 배지 열). .num(금액 우측)과 겹치면 우측 유지 */
/* 표 전체 정렬 프리셋(목록형 표) — 헤더·값 모두 가운데(배지·상태·날짜·작업 정렬 일치). class="tbl tbl-c" 부여 후, 긴 텍스트 열만 .lft(좌측)·금액 열은 .num/.n(우측). */
table.tbl.tbl-c th, table.tbl.tbl-c td { text-align: center; }
table.tbl.tbl-c th.num, table.tbl.tbl-c td.num, table.tbl.tbl-c th.n, table.tbl.tbl-c td.n { text-align: right; }
table.tbl.tbl-c th.lft, table.tbl.tbl-c td.lft { text-align: left; }
table.tbl.zebra tbody tr:nth-child(even) td { background: var(--slate-50); } /* 긴 표 가독성(옵션 — class 부여 시) */
table.tbl .strong { font-weight: 700; }
.strong { font-weight: 700; } /* 전역 유틸 — 카드/요약줄 등 테이블 밖에서도 동작 */
.tbl-empty { padding: 48px; text-align: center; color: var(--slate-400); }

/* ===== 입력 ===== */
.field { margin-bottom: 14px; }
.field label { display: block; font-size: 12.5px; font-weight: 600; color: var(--navy-700); margin-bottom: 5px; }
/* 폼 라벨 안 괄호 보조설명은 본문 라벨 아래 작은 보조 줄로 — 좁은 칸(3열 그리드)에서 본문이 어색하게
   중간 줄바꿈되던 문제 해결. (카드 제목 .card-title 의 보조설명은 넓어서 인라인 유지) */
.field label > .muted,
label.lbl > .muted {
  display: block;
  font-weight: 400;
  font-size: 11px;
  line-height: 1.4;
  margin-top: 2px;
  color: var(--slate-500);
  white-space: nowrap;       /* 한 줄 유지(좁은 칸에서도 줄바꿈 안 함) */
  overflow: hidden;
  text-overflow: ellipsis;   /* 칸보다 길면 …로 줄이고, 전체 문구는 마우스오버 title 툴팁으로 */
}
/* 글자크기 설정의 현재값(%)은 보조설명이 아니라 값 — 라벨 옆 인라인 유지 */
#zoom-val { display: inline; font-size: var(--fs-label); margin-top: 0; }
.field .req { color: var(--red); }
input[type=text], input[type=number], input[type=date], input[type=email], input[type=search], select, textarea {
  width: 100%; padding: 9px 11px; border: 1px solid var(--slate-300); border-radius: var(--radius-sm);
  font-family: var(--font); font-size: var(--fs-body); color: var(--navy-900); background: var(--surface); caret-color: var(--blue); transition: border-color .12s, box-shadow .12s;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--blue); box-shadow: var(--ring); }
textarea { resize: vertical; min-height: 80px; line-height: 1.6; }
.field .help { font-size: 11.5px; color: var(--slate-500); margin-top: 4px; }
.inline-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.inline-fields-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 12px; }

/* 검색바 */
.searchbar { position: relative; }
.searchbar input { width: 100%; box-sizing: border-box; padding-left: 34px; }
.searchbar::before { content: "🔍"; position: absolute; left: 11px; top: 50%; transform: translateY(-50%); font-size: var(--fs-body); opacity: .5; }

/* 칩/필터 */
.chips { display: flex; gap: 7px; flex-wrap: wrap; }
.chip { padding: 6px 12px; border-radius: var(--r-full); background: var(--surface); border: 1px solid var(--slate-300); font-size: 12.5px; font-weight: 600; color: var(--slate-500); cursor: pointer; transition: all .12s; }
.chip:hover { border-color: var(--slate-400); color: var(--navy-800); background: var(--surface-hover); }
.chip.active { background: var(--blue-light); border-color: rgba(var(--blue-rgb), .35); color: var(--blue-dark); }

/* ===== 모달 ===== */
.modal-overlay { position: fixed; inset: 0; background: rgba(15,23,42,.5); display: grid; place-items: center; z-index: 100; animation: fade .15s; padding: 24px; }
.modal { background: var(--surface); border-radius: 14px; box-shadow: var(--shadow-lg); width: 100%; max-width: 640px; max-height: 88vh; display: flex; flex-direction: column; animation: pop .18s; }
.modal.wide { max-width: 940px; }
.modal.xwide { max-width: 1140px; }
.modal-head { padding: 18px 22px; border-bottom: 1px solid var(--slate-200); display: flex; align-items: center; justify-content: space-between; }
.modal-head h3 { margin: 0; font-size: var(--fs-h2); font-weight: 800; }
.modal-body { padding: 20px 22px; overflow: auto; }
.modal-foot { padding: 14px 22px; border-top: 1px solid var(--slate-200); display: flex; justify-content: flex-end; gap: 8px; }
.x-close { cursor: pointer; font-size: var(--fs-h1); color: var(--slate-400); line-height: 1; background: none; border: none; }
.x-close:hover { color: var(--navy-900); }
@keyframes fade { from { opacity: 0; } }
@keyframes pop { from { opacity: 0; transform: translateY(8px) scale(.98); } }

/* ===== 토스트 ===== */
#toast-root { position: fixed; bottom: 24px; right: 24px; display: flex; flex-direction: column; gap: 10px; z-index: 200; }
.toast { background: var(--navy-900); color: #fff; padding: 12px 18px; border-radius: var(--radius); box-shadow: var(--shadow-lg); font-size: var(--fs-body); font-weight: 500; display: flex; align-items: center; gap: 9px; animation: slidein .2s; max-width: 380px; }
.toast.ok { background: #15803d; }
.toast.err { background: var(--red); }
.toast.warn { background: var(--amber); }
@keyframes slidein { from { opacity: 0; transform: translateX(30px); } }

/* ===== 단계 진행 (stepper) ===== */
.stepper { display: flex; gap: 0; flex-wrap: wrap; }
.step { flex: 1; min-width: 90px; text-align: center; position: relative; padding-top: 26px; font-size: 11.5px; color: var(--slate-400); font-weight: 600; }
.step::before { content: ""; position: absolute; top: 8px; left: 0; right: 0; height: 3px; background: var(--slate-200); }
.step:first-child::before { left: 50%; }
.step:last-child::before { right: 50%; }
.step .knob { position: absolute; top: 2px; left: 50%; transform: translateX(-50%); width: 15px; height: 15px; border-radius: 50%; background: var(--surface); border: 3px solid var(--slate-300); z-index: 1; }
.step.done { color: var(--green); }
.step.done::before { background: var(--green); }
.step.done .knob { border-color: var(--green); background: var(--green); }
.step.current { color: var(--blue); }
.step.current .knob { border-color: var(--blue); box-shadow: 0 0 0 4px rgba(var(--blue-rgb), .2); }

/* ===== 잡다 ===== */
.muted { color: var(--slate-500); }
.row { display: flex; align-items: center; gap: 10px; }
.between { justify-content: space-between; }
.wrap { flex-wrap: wrap; }
.mt8 { margin-top: var(--sp-2); } .mt12 { margin-top: var(--sp-3); } .mt16 { margin-top: var(--sp-4); } .mt24 { margin-top: var(--sp-6); }
.mb8 { margin-bottom: var(--sp-2); } .mb16 { margin-bottom: var(--sp-4); }
.kv { display: grid; grid-template-columns: 130px 1fr; gap: 8px 14px; font-size: var(--fs-body); }
.kv dt { color: var(--slate-500); font-weight: 600; }
.kv dd { margin: 0; font-weight: 500; font-variant-numeric: var(--font-num); }
.tag-type { font-size: var(--fs-micro); padding: 2px 8px; border-radius: 6px; background: var(--slate-100); color: var(--slate-500); font-weight: 700; }
/* 표(고정 레이아웃) 안에서는 긴 사업유형이 옆 칸(종료일)을 침범하지 않도록 셀 폭 내로 잘라 표시(전체값은 title 툴팁) */
.tbl .tag-type { display: inline-block; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; vertical-align: middle; }
.divider { height: 1px; background: var(--slate-200); margin: 16px 0; }
.empty-state { text-align: center; padding: 60px 20px; color: var(--slate-400); }
.empty-state .ico { font-size: 44px; margin-bottom: 12px; opacity: .6; }
.empty-state .t { font-size: var(--fs-h3); font-weight: 700; color: var(--slate-500); }
.checkline { display: flex; align-items: flex-start; gap: 10px; padding: 10px 12px; border-radius: var(--radius-sm); border: 1px solid var(--slate-200); margin-bottom: 7px; background: var(--surface); }
.checkline input[type=checkbox] { width: 18px; height: 18px; margin-top: 1px; accent-color: var(--blue); cursor: pointer; flex-shrink: 0; }
.checkline.checked { background: var(--green-light); border-color: #bbf7d0; }
/* 과제 선택 카드: 과제관리에서 완료처리한 과제 — 완료 상태를 한눈에 (체크리스트 완료와 동일 톤) */
.pick-card.done { background: var(--green-light); border-color: #bbf7d0; }
.checkline .ctext { flex: 1; font-size: var(--fs-body); }
.checkline .cnote { font-size: var(--fs-label); color: var(--slate-500); }
.pill-progress { height: 8px; border-radius: 999px; background: var(--slate-200); overflow: hidden; }
.pill-progress > i { display: block; height: 100%; background: var(--green); transition: width .3s; }
code.inline { background: var(--slate-100); padding: 1px 6px; border-radius: 5px; font-size: var(--fs-label); }
.doc-content { font-size: 13.5px; line-height: 1.85; color: var(--navy-800); }
.doc-content h4 { font-size: var(--fs-h3); margin: 20px 0 8px; color: var(--navy-900); }
.doc-content p { margin: 0 0 10px; white-space: pre-wrap; }
.doc-content ul { margin: 0 0 12px; padding-left: 20px; }
.doc-content li { margin-bottom: 4px; }
.scrolly { max-height: 560px; overflow: auto; }
.list-link { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 11px 14px; border: 1px solid var(--slate-200); border-radius: var(--radius-sm); margin-bottom: 7px; cursor: pointer; transition: all .12s; background: var(--surface); }
.list-link:hover { border-color: var(--blue); background: var(--surface-hover); }
.list-link .meta { font-size: var(--fs-label); color: var(--slate-500); }
.spinner { width: 18px; height: 18px; border: 3px solid var(--slate-200); border-top-color: var(--blue); border-radius: 50%; animation: spin .7s linear infinite; display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }
.loading-full { display: grid; place-items: center; height: 70vh; gap: 12px; color: var(--slate-500); }

/* 캘린더 */
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.cal-dow { text-align: center; font-size: var(--fs-label); font-weight: 700; padding: 4px 0; }
.cal-cell { min-height: 96px; border: 1px solid var(--slate-200); border-radius: 8px; padding: 5px 6px; background: var(--surface); display: flex; flex-direction: column; }
.cal-cell.empty { background: var(--slate-50); border-style: dashed; min-height: 96px; }
.cal-cell.today { border-color: var(--blue); box-shadow: 0 0 0 2px rgba(var(--blue-rgb), .18); }
.cal-day { font-size: 12.5px; font-weight: 700; margin-bottom: 4px; font-variant-numeric: var(--font-num); }
.cal-chips { display: flex; flex-direction: column; gap: 3px; overflow: hidden; }
.cal-chip { display: flex; align-items: center; gap: 4px; font-size: 10.5px; font-weight: 600; background: var(--slate-100); padding: 2px 5px; border-radius: 5px; cursor: pointer; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cal-chip:hover { background: var(--blue-light); }
.cal-chip .dot { flex-shrink: 0; }
.wl-bar { height: 7px; border-radius: 999px; background: var(--slate-200); overflow: hidden; display: flex; }
.wl-bar > i { display: block; height: 100%; }

/* 인건비 검증 */
.lcard .lname { border: 1px solid var(--slate-300); border-radius: var(--radius-sm); padding: 7px 10px; }
.lchk { display: inline-flex; align-items: center; gap: 6px; font-size: var(--fs-body); color: var(--navy-800); cursor: pointer; }
.lchk input { width: 16px; height: 16px; accent-color: var(--blue); }
.lin2 { border: 1px solid var(--slate-300); border-radius: var(--radius-sm); padding: 6px 9px; font-size: 12.5px; }
.ltbl-wrap { overflow-x: auto; border: 1px solid var(--slate-200); border-radius: var(--radius-sm); }
.ltbl { border-collapse: collapse; font-size: var(--fs-label); min-width: 100%; }
.ltbl th, .ltbl td { border: 1px solid var(--slate-200); padding: 0; text-align: center; white-space: nowrap; }
.ltbl thead th { background: var(--slate-100); font-weight: 700; color: var(--navy-800); padding: 4px 6px; position: sticky; top: 0; }
.ltbl .lh-row { background: var(--slate-50); text-align: left; padding: 4px 8px; font-weight: 600; position: sticky; left: 0; z-index: 1; min-width: 200px; }
.ltbl thead .lh-row { z-index: 3; }
.ltbl .lh-year { background: var(--slate-200); }
.ltbl .lh-m { min-width: 62px; font-weight: 600; }
.ltbl .lsum-h, .ltbl .lsum { background: var(--blue-light); font-weight: 700; min-width: 92px; padding: 4px 8px; text-align: right; }
.ltbl .lin { width: 64px; border: none; padding: 5px 6px; text-align: right; font-size: var(--fs-label); background: transparent; }
.ltbl .lin:focus { background: #fffbe6; outline: 1px solid var(--blue); }
.ltbl .lin.pct { width: 52px; }
.ltbl .lin.l-over { background: var(--red-light); outline: 1px solid var(--red); }
.ltbl .lr-calc td, .ltbl .lr-calc th { background: #f3f6fb; }
.ltbl .lcalc { padding: 5px 6px; text-align: right; color: var(--navy-700); font-variant-numeric: tabular-nums; }
.lpsum { margin-top: 10px; font-size: var(--fs-body); background: var(--slate-50); border: 1px solid var(--slate-200); border-radius: var(--radius-sm); padding: 8px 12px; }
.l-bad { color: var(--red); }
/* 인건비 검증 입력표(웹 labor-tbl) — 금액칸 폭·등폭숫자(§5-55) + 참여율 100% 초과 경고(.l-over) */
.labor-tbl input.cellinp { width: 84px; text-align: right; font-variant-numeric: tabular-nums; border: 1px solid var(--slate-200); border-radius: 5px; padding: 5px 7px; font-size: var(--fs-label); background: var(--surface); }
.labor-tbl input.cellinp:focus { outline: 1px solid var(--blue); background: #fffbe6; }
.labor-tbl input.cellinp.l-over { background: var(--red-light); outline: 1px solid var(--red); color: var(--red); font-weight: 700; }
.labor-tbl td.calc { font-variant-numeric: tabular-nums; }
/* 집행 없는 세목 체크리스트 카드 — 헤더 흐림(자동 제외 시각화) */
.card.exec-off .card-title, .card.exec-off .ck-group-head { opacity: .55; }
.card.exec-off { background: var(--slate-50); }
.l-ok { color: var(--green); }

/* 과제 상세 — 증빙 진행률 */
.ckp-row { padding: 9px 0; border-bottom: 1px solid var(--slate-100); }
.ckp-row:last-child { border-bottom: none; padding-bottom: 0; }
.ckp-miss { font-size: var(--fs-label); color: var(--amber); margin-top: 5px; line-height: 1.6; }
.ckp-miss.ok { color: var(--green); }

/* ===== 마감 — 선택·스크롤바·모션 절제 ===== */
::selection { background: rgba(var(--blue-rgb), .18); }
* { scrollbar-width: thin; scrollbar-color: var(--slate-300) transparent; }
::-webkit-scrollbar { width: 11px; height: 11px; }
::-webkit-scrollbar-thumb { background: var(--slate-300); border-radius: var(--r-full); border: 3px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-thumb:hover { background: var(--slate-400); }
.sidebar { scrollbar-color: rgba(255, 255, 255, .18) transparent; }
/* 접근성 — 모션 최소화 사용자 존중(장시간 사용 피로 방지) */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
}

/* ===== 인쇄(@media print, V3) — 사이드바·버튼 숨김, 현황표·카드 깔끔히 출력 ===== */
@media print {
  .sidebar, .page-actions, #toast-root, .btn, .x-close { display: none !important; }
  .content { overflow: visible !important; }
  .page { max-width: none; padding: 0 8px; }
  body, .content { background: #fff !important; }
  .card, .stat, .table-wrap { box-shadow: none !important; border: 1px solid #ccc !important; break-inside: avoid; }
  table.tbl th { position: static; }
}

/* ===== 팀 채팅(카카오톡식) ===== */
.nav-badge { margin-left: auto; background: var(--red, #dc2626); color: #fff; font-size: 10.5px; font-weight: 700; border-radius: 10px; padding: 1px 7px; line-height: 1.5; }
.chat-wrap { display: flex; height: calc(100vh - 170px); min-height: 420px; padding: 0; overflow: hidden; }
.chat-rooms { width: 250px; flex-shrink: 0; border-right: 1px solid var(--slate-200); overflow-y: auto; }
.chat-room-item { padding: 11px 13px; cursor: pointer; border-bottom: 1px solid var(--slate-100); }
.chat-room-item:hover { background: var(--slate-50, #f8fafc); }
.chat-room-item.active { background: rgba(var(--blue-rgb), .08); border-right: 2px solid var(--blue); }
.cri-top { display: flex; align-items: center; gap: 6px; }
.cri-name { font-weight: 700; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cri-unread { margin-left: auto; background: var(--red, #dc2626); color: #fff; font-size: 10.5px; font-weight: 700; border-radius: 10px; padding: 1px 7px; flex-shrink: 0; }
.cri-sub { font-size: 11.5px; color: var(--slate-500); margin-top: 3px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-pane { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.chat-head { padding: 12px 16px; border-bottom: 1px solid var(--slate-200); display: flex; align-items: center; font-size: 13.5px; }
.chat-msgs { flex: 1; overflow-y: auto; padding: 14px 16px; display: flex; flex-direction: column; gap: 2px; background: var(--slate-50, #f8fafc); }
.chat-day { text-align: center; margin: 12px 0 8px; }
.chat-day span { background: var(--slate-200); color: var(--slate-600, #475569); font-size: 11px; border-radius: 10px; padding: 2px 12px; }
.chat-row { display: flex; flex-direction: column; align-items: flex-start; margin-top: 6px; }
.chat-row.mine { align-items: flex-end; }
.chat-author { font-size: 11.5px; color: var(--slate-500); margin: 0 4px 2px; }
.chat-line { display: flex; align-items: flex-end; gap: 6px; max-width: 78%; }
.bubble { position: relative; background: #fff; border: 1px solid var(--slate-200); border-radius: 14px 14px 14px 4px; padding: 8px 12px; font-size: 13.5px; line-height: 1.6; word-break: break-word; }
.chat-row.mine .bubble { background: rgba(var(--blue-rgb), .10); border-color: rgba(var(--blue-rgb), .25); border-radius: 14px 14px 4px 14px; }
.bubble.deleted { color: var(--slate-400); font-style: italic; font-size: 12.5px; }
.bubble-text { white-space: pre-wrap; }
.chat-time { font-size: 10.5px; color: var(--slate-400); flex-shrink: 0; }
.bubble-del { display: none; position: absolute; top: -8px; right: -8px; width: 18px; height: 18px; border-radius: 50%; border: 1px solid var(--slate-300); background: #fff; color: var(--slate-500); font-size: 10px; line-height: 1; cursor: pointer; }
.bubble:hover .bubble-del { display: block; }
.chat-att-img { max-width: 240px; max-height: 200px; border-radius: 8px; display: block; margin-top: 4px; }
.chat-att-file { display: inline-block; margin-top: 4px; font-size: 12.5px; text-decoration: none; background: var(--slate-100); border: 1px solid var(--slate-200); border-radius: 8px; padding: 4px 10px; color: var(--navy-800, #1e293b); }
.chat-more { text-align: center; margin-bottom: 8px; }
.chat-composer { border-top: 1px solid var(--slate-200); padding: 10px 12px; }
.chat-att-pending { margin-bottom: 8px; display: flex; flex-wrap: wrap; gap: 6px; }
[data-theme="dark"] .chat-msgs { background: var(--surface-2, #0f172a); }
[data-theme="dark"] .bubble { background: var(--surface, #1e293b); }

/* 팀 채팅 — 첨부 버튼/칩 아이콘 정렬 + 새 채팅 탭·멤버 선택 */
.ch-attach svg, .chat-att-file svg, .chat-att-pending svg { vertical-align: middle; }
.chat-att-file { display: inline-flex; align-items: center; gap: 5px; }
.ch-tabs { display: flex; gap: 6px; margin-bottom: 14px; border-bottom: 1px solid var(--slate-200); }
.ch-tab { background: none; border: none; padding: 8px 12px; cursor: pointer; font-size: 13px; color: var(--slate-500); border-bottom: 2px solid transparent; margin-bottom: -1px; }
.ch-tab:hover { color: var(--navy-800); }
.ch-tab.active { color: var(--blue); border-bottom-color: var(--blue); font-weight: 700; }
.ch-picklist { max-height: 240px; overflow-y: auto; border: 1px solid var(--slate-200); border-radius: var(--r-sm); padding: 6px; }
.ch-pick { display: flex; align-items: center; gap: 8px; padding: 7px 8px; border-radius: 6px; cursor: pointer; font-size: 13.5px; }
.ch-pick:hover { background: var(--slate-50); }
.ch-pick input { width: 16px; height: 16px; }
