/* Conta 공통 스타일 - 워크벤치 셸
 *
 * 방향 C (사용자 확정 2026-09-08): 왼쪽에 도구 목록이 상주한다.
 * 랜딩으로 나갔다 오지 않고 도구 사이를 옮겨다니고, 사이드바가 이번 파일의
 * 진행 상태를 들고 있다. Conta가 '도구 모음'이라는 것이 화면에 계속 남는다.
 *
 * 폰트와 크기, 이모지는 기존 그대로 (사용자 확정). 바꾸는 건 배치와 표시방식뿐.
 */

:root {
  --ink: #0f172a;
  --ink-2: #334155;
  --muted: #64748b;
  --faint: #94a3b8;
  --line: #e2e8f0;
  --line-2: #f1f5f9;
  --bg: #f8fafc;
  --panel: #ffffff;
  --side: #0f172a;
  --side-2: #1e293b;
  --side-mark: #60a5fa;
  --navy: #1F3864;
  --navy-soft: #E8EEF8;
  --navy-soft-2: #F3F7FC;
  --ok: #047857;
  --warn: #b45309;
  --err: #b91c1c;
  --r: 6px;
  --side-w: 208px;
}

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

body {
  font-family: "Segoe UI", "Malgun Gothic", "맑은 고딕", sans-serif;
  font-size: 13px;
  line-height: 1.6;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

.wb { display: flex; min-height: 100vh; align-items: stretch; }

/* ─────────────────────────────── 사이드바 */
.side {
  width: var(--side-w); flex-shrink: 0;
  background: var(--side); color: #fff;
  padding: 20px 0 28px;
  display: flex; flex-direction: column;
}
.side .brand {
  padding: 0 18px 18px; font-size: 17px; font-weight: 700;
  letter-spacing: -0.3px; color: #fff; text-decoration: none; display: block;
}
.side .brand:hover { color: #cbd5e1; }
.side .cap {
  padding: 0 18px 7px; color: var(--muted);
  font-size: 11px; font-weight: 700; letter-spacing: .4px;
}
.side nav { display: flex; flex-direction: column; }
.side nav a {
  padding: 9px 18px 9px 21px; color: var(--faint); text-decoration: none;
  display: flex; gap: 9px; align-items: center; border-left: 3px solid transparent;
}
.side nav a:hover { color: #e2e8f0; background: #172033; }
.side nav a.on {
  background: var(--side-2); border-left-color: var(--side-mark);
  color: #fff; font-weight: 700; padding-left: 18px;
}
.side .panel {
  margin: 22px 18px 0; padding-top: 16px; border-top: 1px solid var(--side-2);
}
.side .panel .cap { padding: 0 0 8px; }
.side .doc { color: #e2e8f0; font-size: 12px; line-height: 1.7; word-break: keep-all; }
.side .doc span { color: var(--muted); }
.side .steps { margin-top: 12px; display: flex; flex-direction: column; gap: 5px; }
.side .steps div {
  color: var(--faint); font-size: 12px; display: flex; justify-content: space-between; gap: 8px;
}
.side .steps b { font-weight: 400; color: var(--muted); }
.side .steps b.done { color: #4ade80; }
.side .steps b.bad { color: #f87171; }
.side .foot { margin-top: auto; padding: 18px 18px 0; color: #475569; font-size: 11px; }

/* ─────────────────────────────── 작업 영역 */
.work { flex: 1; min-width: 0; padding: 24px 28px 80px; }

.head { display: flex; align-items: flex-end; gap: 14px; margin-bottom: 18px; }
.head .h { flex: 1; min-width: 0; }
.head h1 { font-size: 20px; font-weight: 700; letter-spacing: -0.4px; }
.head .sub { color: var(--muted); margin-top: 3px; }

/* 카드 */
.card {
  background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--r); padding: 16px 20px; margin-bottom: 12px;
}
/* 섹션 제목. 자손 선택자로 두면 .row 안에 들어간 h2가 규칙을 비켜가
   브라우저 기본크기로 커졌다 (합계불일치만 크게 보이던 이유) */
.card h2 { font-size: 19px; font-weight: 700; letter-spacing: -0.3px; margin-bottom: 6px; }

/* 결과 섹션: 제목을 색 띄로 뽑는다. 흰 바탕에 글자만 있으면 눈에 안 들어온다 */
.card.sec { padding: 0; overflow: hidden; }
.sec-h {
  display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap;
  padding: 11px 20px; border-bottom: 1px solid var(--line);
}
.sec-h h2 { margin: 0; }
.sec-h .note { margin-left: auto; font-size: 12px; opacity: .72; }
.sec-b { padding: 2px 20px 16px; }
.s-err  .sec-h { background: #FBEEEC; border-bottom-color: #EFD4D0; }
.s-err  .sec-h h2, .s-err  .sec-h .note { color: var(--err); }
.s-round .sec-h { background: #EDF5EF; border-bottom-color: #D4E7D9; }
.s-round .sec-h h2, .s-round .sec-h .note { color: var(--ok); }
.s-ref  .sec-h { background: #E8EEF8; border-bottom-color: #D2DFF1; }
.s-ref  .sec-h h2, .s-ref  .sec-h .note { color: var(--navy); }
.s-ai   .sec-h { background: #DDE6F5; border-bottom-color: #C6D6EE; }
.s-ai   .sec-h h2, .s-ai   .sec-h .note { color: #16294a; }

/* 버튼 */
.btn {
  border: 0; border-radius: 5px; padding: 9px 18px;
  font-size: 13px; font-weight: 700; font-family: inherit; cursor: pointer;
  background: var(--ink); color: #fff; white-space: nowrap;
}
.btn:hover { background: #1e293b; }
.btn.ghost { background: var(--panel); color: var(--ink-2); border: 1px solid #cbd5e1; font-weight: 400; }
.btn.ghost:hover { background: var(--bg); border-color: var(--faint); }
.btn.light { background: #fff; color: var(--navy); }
.btn.light:hover { background: #e8eef8; }
.btn:disabled { opacity: .5; cursor: default; }
/* 엑셀 내려받기 - 리스 도구의 xlbtn과 같은 언어 (흰 바탕 + 엑셀 녹색 아이콘) */
.btn.xl {
  background: #fff; color: var(--ink); border: 1px solid #cbd5e1;
  display: inline-flex; align-items: center; gap: 7px;
  box-shadow: 0 1px 2px rgba(15, 23, 42, .05);
}
.btn.xl:hover { background: #F1F8F4; border-color: #107C41; color: #0B5C31; }
.btn.xl svg { flex-shrink: 0; }
.row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* 업로드 */
.drop {
  border: 1.5px dashed #cbd5e1; border-radius: var(--r);
  padding: 54px 24px; text-align: center; cursor: pointer;
  background: var(--panel); transition: border-color .15s, background .15s;
}
.drop:hover, .drop.on { border-color: var(--ink); background: #fff; }
.drop .t { font-size: 14px; font-weight: 700; margin-bottom: 5px; }
.drop .s { color: var(--faint); }

/* 접히는 설명 */
details.info { margin-top: 16px; }
details.info summary {
  cursor: pointer; color: var(--muted); list-style: none; padding: 4px 0;
}
details.info summary::-webkit-details-marker { display: none; }
details.info summary::before { content: "＋ "; }
details.info[open] summary::before { content: "－ "; }
details.info summary:hover { color: var(--ink); }
details.info .body { padding: 8px 0 4px; color: var(--muted); line-height: 1.85; }
details.info .body b { color: var(--ink-2); font-weight: 700; }

/* 파일 정보 - 결과 화면 맨 위 */
.meta {
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1px; background: var(--line); border: 1px solid var(--line);
  border-radius: var(--r); overflow: hidden; margin-bottom: 12px;
}
.meta > div { background: var(--panel); padding: 9px 14px; min-width: 0; }
.meta .k { color: var(--muted); font-size: 11px; }
.meta .v { color: var(--ink); margin-top: 1px; word-break: keep-all; }

/* 결과 배너 */
.banner { display: flex; align-items: center; gap: 20px; }
.banner .dot {
  width: 52px; height: 52px; border-radius: 26px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 21px; font-weight: 700;
}
.banner .dot.bad { background: #fef2f2; color: var(--err); }
.banner .dot.good { background: #ecfdf5; color: var(--ok); font-size: 24px; }
.banner .m { flex: 1; min-width: 0; }
.banner .m .t { font-weight: 700; font-size: 15px; }
.banner .m .s { color: var(--muted); margin-top: 2px; }

/* 영역별 요약 카드 */
.tiles { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; margin-bottom: 12px; }
.tile { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); padding: 13px 15px; }
.tile .k { color: var(--muted); font-size: 12px; }
.tile .v { font-size: 17px; font-weight: 700; margin-top: 3px; }
.tile .n { color: var(--faint); font-size: 12px; margin-top: 2px; }
.tile .v.good { color: var(--ok); }
.tile .v.bad { color: var(--err); }
.tile .v.warn { color: var(--warn); }
.tile .v.off { color: var(--faint); }

/* 결과 표 */
.filt { display: flex; gap: 6px; }
.filt button {
  background: var(--panel); border: 1px solid var(--line); border-radius: 3px;
  padding: 3px 11px; font-family: inherit; font-size: 12px; color: var(--muted); cursor: pointer;
}
.filt button.on { background: var(--ink); border-color: var(--ink); color: #fff; font-weight: 700; }

.grp h3 {
  color: var(--navy); font-size: 12px; font-weight: 700;
  background: var(--navy-soft); border-radius: 3px;
  padding: 5px 10px; margin: 16px 0 2px;
}
.grp:first-child h3 { margin-top: 8px; }
table.rows { width: 100%; border-collapse: collapse; }
table.rows td { padding: 8px 10px 8px 0; border-top: 1px solid var(--line-2); vertical-align: top; }
table.rows td.ic { width: 22px; padding-right: 0; }
table.rows td.n {
  text-align: right; white-space: nowrap; width: 112px;
  font-variant-numeric: tabular-nums; color: var(--muted);
}
table.rows td.n.d { color: var(--err); font-weight: 700; }
table.rows .why { color: var(--faint); font-size: 12px; margin-top: 2px; }
/* 주석 7, 주석 13 처럼 표 안의 소제목 행 */
table.rows td.sub {
  color: var(--navy); font-size: 12px; font-weight: 700;
  background: var(--navy-soft-2); padding: 5px 10px; border-radius: 3px;
}

/* AI 띠 */
.ai {
  background: var(--navy); color: #fff; border-radius: var(--r);
  padding: 16px 20px; display: flex; align-items: center; gap: 18px; margin-top: 12px;
}
.ai .m { flex: 1; min-width: 0; }
.ai .m .t { font-weight: 700; }
.ai .m .s { color: #b6c4dd; font-size: 12px; margin-top: 3px; }
.ai .bar { height: 4px; background: #33507f; border-radius: 2px; overflow: hidden; margin: 9px 0 6px; }
.ai .bar > i { display: block; height: 100%; width: 0; background: #93b4e8; border-radius: 2px; transition: width .4s ease-out; }
.ai.bad { background: #7f1d1d; }
.ai.bad .m .s { color: #fecaca; }
.ai .retry {
  background: none; border: 1px solid #6b7f9f; color: #fff; border-radius: 4px;
  padding: 2px 10px; font-family: inherit; font-size: 12px; cursor: pointer; margin-left: 8px;
}

.err-msg { color: var(--err); font-weight: 700; margin-top: 14px; white-space: pre-wrap; }
.hidden { display: none !important; }

/* ─────────────────────────────── 좁은 화면: 사이드바를 상단 띠로 */
@media (max-width: 860px) {
  .wb { flex-direction: column; }
  .side { width: auto; padding: 12px 0; flex-direction: row; align-items: center; flex-wrap: wrap; }
  .side .brand { padding: 0 16px; font-size: 15px; }
  .side .cap, .side .panel, .side .foot { display: none; }
  .side nav { flex-direction: row; }
  .side nav a { padding: 5px 12px; border-left: 0; border-bottom: 2px solid transparent; }
  .side nav a.on { padding-left: 12px; border-left: 0; border-bottom-color: var(--side-mark); background: none; }
  .work { padding: 18px 16px 60px; }
  .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .meta { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media print {
  .side, .drop, details.info, .row, .filt, .ai, #stage-drop { display: none !important; }
  body { background: #fff; }
  .work { padding: 0; }
  .card { border-color: #999; break-inside: avoid; }
}
