/* ==========================================================================
   산출물 Agent — '결재판 위의 문서'
   바탕은 결재판, 작업 영역은 그 위에 놓인 공문서 한 장.
   과감함은 도장 한 곳에만 쓴다. 나머지는 괘선과 여백으로 정돈한다.
   ========================================================================== */
:root {
  --board: #E7EBF1;          /* 결재판 */
  --board-deep: #DCE2EA;
  --paper: #FFFFFF;          /* 공문서 */
  --paper-2: #F6F8FB;        /* 머리 칸 */
  --ink: #151C2A;            /* 먹 */
  --ink-2: #4B5568;
  --ink-3: #7C8597;
  --rule: #DFE4EB;           /* 괘선 */
  --rule-2: #C5CDD9;
  --rule-strong: #9AA5B6;
  --indigo: #1F3A6B;         /* 결재선 청색 */
  --indigo-hover: #2A4C88;
  --indigo-tint: #EAEFF8;
  --seal: #C8402F;           /* 인주 (승인) */
  --brand-orange: #DD6A3D;   /* 사내 기획 Agent 이름 색(#F0845C)과 같은 계열, 흰 바탕 대비 3:1 이상 */
  --seal-blue: #4766B8;      /* 청인 (반려) */
  --seal-amber: #D29A2C;     /* 보류 */
  --amber-ink: #8A5F10;
  --green: #2E7A5F;
  --human: #C77D3D;          /* 비교 막대: 사람 제출본 */
  --ai: #4A74C9;             /* 비교 막대: AI 초안 */
  --focus: #2F6FED;

  --serif: "Noto Serif KR", "Nanum Myeongjo", "Batang", serif;
  --sans: "IBM Plex Sans KR", "Malgun Gothic", "Apple SD Gothic Neo", sans-serif;
  --r-control: 6px;
  --r-sheet: 12px;
  --shadow-sheet: 0 1px 0 rgba(21, 28, 42, .04), 0 2px 6px rgba(21, 28, 42, .05), 0 22px 48px -22px rgba(21, 28, 42, .28);
  font-size: 15px;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--board);
  color: var(--ink);
  font-family: var(--sans);
  line-height: 1.65;
  font-variant-numeric: tabular-nums;
  word-break: keep-all;
  overflow-wrap: anywhere;
  -webkit-font-smoothing: antialiased;
}
button, input { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: 4px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------------------------------------------------------------- 상단 띠 */
.topbar {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; justify-content: space-between;
  height: 58px; padding: 0 28px;
  background: rgba(255, 255, 255, .92); backdrop-filter: saturate(1.4) blur(8px);
  border-bottom: 1px solid var(--rule);
}
.brand { display: inline-flex; align-items: center; gap: 14px; color: var(--ink); text-decoration: none; }
.brand-logo { height: 26px; width: auto; display: block; }
.brand-rule { width: 1px; height: 20px; background: var(--rule); }
/* 기획 Agent 의 주황(#F0845C)을 흰 바탕에서 읽히게 조금 진하게 */
.brand-name { font-weight: 700; font-size: 1.375rem; letter-spacing: -0.02em; color: var(--brand-orange); }
.brand:focus-visible { outline: 2px solid var(--indigo); outline-offset: 4px; border-radius: 4px; }
.engine { display: inline-flex; align-items: center; gap: 8px; font-size: 0.8rem; color: var(--ink-2); }
.engine b { font-weight: 600; color: var(--ink); }
.top-right { position: relative; display: inline-flex; align-items: center; gap: 18px; }
.nc-pop {
  position: absolute; top: calc(100% + 12px); right: 0; z-index: 30; width: min(320px, calc(100vw - 32px));
  padding: 14px 16px; border: 1px solid var(--rule); border-radius: 12px; background: var(--paper);
  box-shadow: 0 18px 40px -18px rgba(21, 28, 42, .45);
}
.nc-pop p { margin: 0 0 12px; font-size: 0.84rem; line-height: 1.55; color: var(--ink-2); }
.nc-pop p b { display: block; margin-bottom: 2px; color: var(--ink); }
.nc-pop-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.manual-link {
  display: inline-flex; align-items: center; gap: 7px; padding: 6px 12px;
  border: 1px solid var(--rule); border-radius: 8px; background: var(--paper);
  color: var(--indigo); font-size: 0.84rem; font-weight: 600; text-decoration: none; white-space: nowrap;
  transition: border-color .15s, background .15s;
}
.manual-link svg { width: 13px; height: 16px; }
.manual-link:hover { border-color: var(--indigo); background: var(--indigo-tint); }
.manual-link:focus-visible { outline: 2px solid var(--indigo); outline-offset: 2px; }

/* ---------------------------------------------------------------- 사내 Nextcloud */
.nc-chip {
  display: inline-flex; align-items: center; gap: 7px; padding: 6px 12px; cursor: pointer;
  border: 1px dashed var(--border-strong, #C4CBD6); border-radius: 999px; background: var(--paper);
  color: var(--ink-2); font: inherit; font-size: 0.82rem; font-weight: 600; white-space: nowrap;
}
.nc-chip svg { width: 17px; height: 12px; }
.nc-chip:hover { border-color: var(--indigo); color: var(--indigo); }
.nc-chip.on { border-style: solid; border-color: #B9D8CB; background: #EEF7F2; color: var(--green); }
.nc-chip:focus-visible { outline: 2px solid var(--indigo); outline-offset: 2px; }
.nc-pick {
  display: block; margin-top: 6px; padding: 0; border: 0; background: none; cursor: pointer;
  color: var(--indigo); font: inherit; font-size: 0.78rem; font-weight: 600; text-decoration: underline; text-underline-offset: 3px;
}
.history li time { margin-left: auto; }
.history li .link-btn { flex: none; }

.nc-dialog { width: min(620px, calc(100vw - 32px)); padding: 0; border: 0; border-radius: 14px; box-shadow: 0 24px 60px -20px rgba(21, 28, 42, .45); }
.nc-dialog::backdrop { background: rgba(21, 28, 42, .35); }
.nc-box { display: flex; flex-direction: column; max-height: min(640px, calc(100vh - 64px)); }
.nc-box header { display: flex; align-items: center; justify-content: space-between; padding: 18px 20px 6px; }
.nc-box h2 { margin: 0; font-size: 1.02rem; }
.nc-x { border: 0; background: none; font-size: 1.4rem; line-height: 1; color: var(--ink-3); cursor: pointer; }
.nc-crumbs { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; padding: 4px 20px 10px; font-size: 0.84rem; color: var(--ink-3); border-bottom: 1px solid var(--rule); }
.nc-crumbs button { border: 0; background: none; padding: 2px 4px; color: var(--indigo); font: inherit; cursor: pointer; border-radius: 4px; }
.nc-crumbs button:last-child { color: var(--ink); font-weight: 600; }
.nc-list { list-style: none; margin: 0; padding: 6px 8px; overflow: auto; flex: 1; min-height: 220px; }
.nc-row {
  display: grid; grid-template-columns: 22px 1fr auto; align-items: center; gap: 10px; width: 100%;
  padding: 9px 12px; border: 0; border-radius: 8px; background: none; font: inherit; text-align: left; cursor: pointer;
}
.nc-row:hover { background: var(--indigo-tint); }
.nc-row.muted { color: var(--ink-3); cursor: default; }
.nc-row.muted:hover { background: none; }
.nc-ico { color: #D9A23B; display: inline-grid; }
.nc-ico svg { width: 18px; height: 15px; }
.nc-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nc-meta { font-size: 0.75rem; color: var(--ink-3); white-space: nowrap; }
.nc-empty { padding: 40px 12px; text-align: center; color: var(--ink-3); }
.nc-box footer { display: flex; align-items: center; gap: 8px; padding: 12px 20px 16px; border-top: 1px solid var(--rule); }
.nc-hint { margin-right: auto; font-size: 0.8rem; color: var(--ink-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------------------------------------------------------------- 틀 */
.shell { display: grid; grid-template-columns: 268px 1fr; min-height: calc(100vh - 58px); }

.sidebar { padding: 28px 18px 24px 22px; display: flex; flex-direction: column; gap: 6px; }
.side-title { margin: 0 0 6px 10px; font-size: 0.82rem; font-weight: 600; color: var(--ink-2); }
.projects { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.projects a {
  display: block; padding: 10px 12px; border-radius: 8px;
  color: var(--ink); text-decoration: none; position: relative;
}
.projects a:hover { background: rgba(255, 255, 255, .6); }
.projects a[aria-current="page"] { background: var(--paper); box-shadow: 0 1px 2px rgba(21, 28, 42, .08); }
.projects a[aria-current="page"]::before {
  content: ""; position: absolute; left: 0; top: 12px; bottom: 12px; width: 3px; border-radius: 2px; background: var(--indigo);
}
.projects .p-name { display: block; font-weight: 600; font-size: 0.92rem; line-height: 1.45; }
.projects .p-date { display: block; font-size: 0.76rem; color: var(--ink-3); margin-top: 2px; }
.projects .none { color: var(--ink-3); font-size: 0.86rem; padding: 6px 12px; }
.new-project { margin-top: 18px; padding: 16px 12px 0; border-top: 1px solid var(--rule-2); display: grid; gap: 8px; }
.side-label { font-size: 0.8rem; font-weight: 600; color: var(--ink-2); }
.new-project input {
  border: 1px solid var(--rule-2); border-radius: var(--r-control); padding: 8px 11px; background: var(--paper);
}
.new-project input:focus { border-color: var(--indigo); outline: none; box-shadow: 0 0 0 3px var(--indigo-tint); }

.board { padding: 34px 40px 80px 24px; outline: none; min-width: 0; }

/* ---------------------------------------------------------------- 문서 한 장 (뒤에 두 장이 더 겹쳐 있다) */
.sheet {
  position: relative; max-width: 1120px;
  background: var(--paper); border-radius: var(--r-sheet); box-shadow: var(--shadow-sheet);
  isolation: isolate;
}
.sheet::before, .sheet::after {
  content: ""; position: absolute; z-index: -1; left: 14px; right: 14px; height: 30px; border-radius: var(--r-sheet);
  background: #FBFCFD; box-shadow: 0 1px 3px rgba(21, 28, 42, .10);
}
.sheet::before { bottom: -7px; }
.sheet::after { bottom: -13px; left: 30px; right: 30px; background: #F4F6F9; }

.doc-head { padding: 30px 40px 0; }
.doc-meta { display: flex; gap: 22px; font-size: 0.78rem; color: var(--ink-3); }
.doc-meta span b { font-weight: 600; color: var(--ink-2); margin-right: 6px; }
.doc-top { display: flex; justify-content: space-between; align-items: flex-end; gap: 28px; margin-top: 10px; }
.doc-title {
  margin: 0; font-family: var(--serif); font-weight: 700; font-size: 1.95rem; line-height: 1.32; letter-spacing: -0.035em;
  max-width: 22ch;
}
.double-rule { height: 5px; margin: 22px 0 0; border-top: 2px solid var(--ink); border-bottom: 1px solid var(--ink); }

/* 결재란 */
.approval { border-collapse: collapse; flex: none; }
.approval th, .approval td { border: 1px solid var(--rule-strong); padding: 0; text-align: center; }
.approval .labels th { background: var(--paper-2); font-size: 0.74rem; font-weight: 600; color: var(--ink-2); padding: 5px 6px; }
.approval .side { width: 26px; background: var(--paper-2); font-size: 0.72rem; font-weight: 600; color: var(--ink-2); writing-mode: vertical-rl; letter-spacing: 0.35em; }
.approval td { width: 80px; height: 74px; }
.approval button {
  width: 100%; height: 100%; border: 0; background: transparent; cursor: pointer; padding: 0;
  display: grid; place-items: center; position: relative; color: var(--ink-3);
}
.approval button:hover { background: #FAFBFD; }
.approval button[aria-current="step"] { background: #F7F9FD; }
.approval button[aria-current="step"]::after { content: ""; position: absolute; left: 8px; right: 8px; bottom: 0; height: 3px; background: var(--indigo); border-radius: 2px 2px 0 0; }
.approval .step-no { position: absolute; top: 4px; left: 7px; font-size: 0.68rem; color: var(--ink-3); }
.approval .mini { width: 48px; height: 48px; }
.approval .done { color: var(--indigo); transform: rotate(-9deg); }
.approval .run { color: var(--seal-amber); transform: rotate(-6deg); }
.approval .run .seal-svg { animation: breathe 2.4s ease-in-out infinite; }
.approval .wait { color: var(--rule-2); font-size: 0.75rem; }
@keyframes breathe { 50% { opacity: .45; } }

.doc-body { padding: 32px 40px 44px; }

/* 단계 머리 */
.step-head { display: flex; align-items: baseline; gap: 14px; margin-bottom: 6px; }
.step-no-big { font-family: var(--serif); font-weight: 900; font-size: 1.5rem; color: var(--indigo); line-height: 1; }
.step-head h2 { margin: 0; font-size: 1.28rem; font-weight: 700; letter-spacing: -0.02em; }
.lead { margin: 0 0 26px; color: var(--ink-2); max-width: 68ch; }
.subhead { margin: 34px 0 12px; font-size: 0.95rem; font-weight: 700; letter-spacing: -0.01em; }

/* ---------------------------------------------------------------- 버튼 */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; cursor: pointer; white-space: nowrap; flex: none;
  border: 1px solid var(--indigo); background: var(--indigo); color: #fff;
  padding: 10px 20px; border-radius: var(--r-control); font-weight: 600; font-size: 0.93rem; text-decoration: none;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .14), 0 1px 2px rgba(21, 28, 42, .18);
  transition: background .15s, box-shadow .15s;
}
.btn:hover { background: var(--indigo-hover); }
.btn[disabled] { background: var(--paper-2); border-color: var(--rule-2); color: var(--ink-3); cursor: not-allowed; box-shadow: none; }
.btn-line { background: var(--paper); color: var(--indigo); border-color: var(--rule-strong); box-shadow: none; }
.btn-line:hover { background: var(--indigo-tint); border-color: var(--indigo); }
.btn-ghost { background: transparent; color: var(--ink); border-color: var(--rule-2); box-shadow: none; font-weight: 500; }
.btn-ghost:hover { background: var(--paper); }
.btn-small { padding: 5px 12px; font-size: 0.82rem; }
.row-actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-top: 28px; }
.row-actions .push { margin-left: auto; }
.link-btn { background: none; border: 0; color: var(--ink-3); cursor: pointer; padding: 2px 4px; font-size: 0.82rem; }
.link-btn:hover { color: var(--seal); text-decoration: underline; text-underline-offset: 3px; }

/* ---------------------------------------------------------------- 1. 자료 칸 */
.slots { border-top: 1px solid var(--ink); }
.slot {
  display: grid; grid-template-columns: 56px 1fr auto; gap: 18px; align-items: center;
  padding: 18px 8px; border-bottom: 1px solid var(--rule); transition: background .15s;
}
.slot.over { background: var(--indigo-tint); box-shadow: inset 0 0 0 2px var(--indigo); border-radius: 8px; }
.doc-icon { width: 44px; height: 52px; color: var(--ink-3); }
.slot.filled .doc-icon { color: var(--indigo); }
.slot h3 { margin: 0; font-size: 1rem; font-weight: 700; }
.slot h3 .req { font-size: 0.72rem; font-weight: 600; color: var(--seal); margin-left: 8px; vertical-align: 2px; }
.slot h3 .opt { font-size: 0.72rem; font-weight: 500; color: var(--ink-3); margin-left: 8px; vertical-align: 2px; }
.slot p { margin: 2px 0 0; font-size: 0.86rem; color: var(--ink-2); }
/* 2. 요구사항정의서 개정본 */
.revision {
  display: grid; grid-template-columns: 56px 1fr auto; gap: 18px; align-items: center;
  margin-top: 28px; padding: 18px 8px; border-top: 1px solid var(--ink); border-bottom: 1px solid var(--rule);
}
.revision.ready .doc-icon { color: var(--indigo); }
.revision h3 { margin: 0; font-size: 1rem; font-weight: 700; }
.revision p { margin: 2px 0 0; font-size: 0.86rem; color: var(--ink-2); }
.revision .result { margin-top: 8px; color: var(--green); }
.revision .result a { margin-left: 6px; color: var(--indigo); word-break: break-all; }
.file-chip {
  display: inline-flex; align-items: center; gap: 8px; margin-top: 8px; padding: 4px 10px 4px 8px;
  background: var(--paper-2); border: 1px solid var(--rule); border-radius: 999px; font-size: 0.82rem; max-width: 100%;
}
.file-chip .ok { width: 16px; height: 16px; border-radius: 50%; background: var(--green); color: #fff; display: inline-grid; place-items: center; font-size: 0.66rem; flex: none; }
.file-chip .fname { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 46ch; }
.file-chip .fsize { color: var(--ink-3); }
.minutes { list-style: none; margin: 10px 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.minutes li { display: inline-flex; align-items: center; gap: 8px; padding: 4px 6px 4px 10px; border: 1px solid var(--rule); border-radius: 999px; font-size: 0.8rem; background: var(--paper); }
.minutes .mdate { font-weight: 600; }
.minutes .mname { color: var(--ink-3); max-width: 22ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.drop-hint { font-size: 0.8rem; color: var(--ink-3); text-align: right; margin-top: 6px; }

/* 읽은 결과 띠 */
.readout { margin-top: 26px; display: grid; grid-template-columns: repeat(4, 1fr); border: 1px solid var(--rule); border-radius: 10px; overflow: hidden; }
.readout div { padding: 14px 18px; border-left: 1px solid var(--rule); }
.readout div:first-child { border-left: 0; }
.readout dt { font-size: 0.78rem; color: var(--ink-2); }
.readout dd { margin: 2px 0 0; font-size: 1.35rem; font-weight: 700; letter-spacing: -0.02em; }
.readout dd small { font-size: 0.8rem; font-weight: 500; color: var(--ink-3); margin-left: 3px; }
.notice { margin-top: 22px; padding: 12px 16px; border-radius: 8px; background: var(--paper-2); border: 1px solid var(--rule); font-size: 0.9rem; color: var(--ink-2); }
.notice.error { background: #FCF2F0; border-color: #EFC9C3; color: #7E2A1F; }

/* ---------------------------------------------------------------- 진행 (묶음 타일) */
.progress { margin-top: 26px; padding: 18px 20px; border: 1px solid var(--rule); border-radius: 10px; background: var(--paper-2); }
.progress-top { display: flex; justify-content: space-between; gap: 16px; align-items: baseline; flex-wrap: wrap; }
.progress-top strong { font-size: 0.95rem; }
.progress-top span { font-size: 0.84rem; color: var(--ink-2); }
.tiles { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 14px; }
.tiles i { width: 18px; height: 18px; border-radius: 3px; background: var(--paper); border: 1px solid var(--rule-2); }
.tiles i.on { background: var(--indigo); border-color: var(--indigo); }
.tiles i.now { border-color: var(--indigo); animation: breathe 1.6s ease-in-out infinite; }
.progress p { margin: 12px 0 0; font-size: 0.8rem; color: var(--ink-3); }
.error-box { margin-top: 22px; padding: 14px 18px; background: #FCF2F0; border: 1px solid #EFC9C3; border-radius: 10px; color: #7E2A1F; }

/* ---------------------------------------------------------------- 2. 변경안 검토 */
.review-bar { display: grid; gap: 10px; margin: 0 0 22px; padding: 16px 18px; border: 1px solid var(--rule); border-radius: 10px; }
.review-bar .rb-top { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.review-bar .rb-top strong { font-size: 0.95rem; }
.stack { display: flex; height: 12px; gap: 2px; }
.stack span { display: block; height: 100%; min-width: 0; position: relative; }
.stack span:first-child { border-radius: 4px 0 0 4px; }
.stack span:last-child { border-radius: 0 4px 4px 0; }
.stack span:only-child { border-radius: 4px; }
.stack .승인 { background: var(--seal); }
.stack .반려 { background: var(--seal-blue); }
.stack .보류 { background: var(--seal-amber); }
.stack .미검토 { background: var(--board-deep); }
.legend { display: flex; flex-wrap: wrap; gap: 6px 18px; font-size: 0.8rem; color: var(--ink-2); list-style: none; margin: 0; padding: 0; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 6px; vertical-align: -1px; }
.legend b { color: var(--ink); font-weight: 600; margin-left: 4px; }

[data-tip] { position: relative; }
[data-tip]:hover::after, [data-tip]:focus-visible::after {
  content: attr(data-tip); position: absolute; left: 50%; bottom: calc(100% + 8px); transform: translateX(-50%);
  background: var(--ink); color: #fff; font-size: 0.76rem; padding: 5px 9px; border-radius: 6px; white-space: nowrap; z-index: 5; pointer-events: none;
}

.filters { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 4px; }
.filters button {
  border: 1px solid var(--rule-2); background: var(--paper); border-radius: 999px; padding: 5px 13px; cursor: pointer;
  font-size: 0.84rem; color: var(--ink-2); white-space: nowrap;
}
.filters button:hover { border-color: var(--rule-strong); color: var(--ink); }
.filters button[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: #fff; }
.filters button span { opacity: .7; margin-left: 4px; }

.changes { margin-top: 14px; border-top: 1px solid var(--ink); }
.change {
  display: grid; grid-template-columns: 1fr 232px; gap: 24px; align-items: start;
  padding: 22px 8px 22px 20px; border-bottom: 1px solid var(--rule); position: relative;
}
.change::before { content: ""; position: absolute; left: 0; top: 22px; bottom: 22px; width: 3px; border-radius: 2px; background: var(--rule-2); }
.change[data-decision="신규"]::before { background: var(--green); }
.change[data-decision="변경"]::before { background: var(--indigo); }
.change[data-decision="확인필요"]::before { background: var(--seal-amber); }
.change-top { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; font-size: 0.8rem; color: var(--ink-3); }
.kind { font-weight: 700; font-size: 0.8rem; }
.kind.신규 { color: var(--green); }
.kind.변경 { color: var(--indigo); }
.kind.기존충족 { color: var(--ink-2); }
.kind.확인필요 { color: var(--amber-ink); }
.rid { font-weight: 600; color: var(--ink-2); letter-spacing: 0.01em; }
.change h3 { margin: 6px 0 0; font-size: 1.06rem; font-weight: 700; letter-spacing: -0.02em; line-height: 1.45; }
.change .def { margin: 4px 0 0; color: var(--ink); }
.change .detail { margin: 8px 0 0; white-space: pre-line; font-size: 0.88rem; color: var(--ink-2); line-height: 1.7; }
.evidence { margin-top: 12px; }
.evidence summary { cursor: pointer; font-size: 0.84rem; font-weight: 600; color: var(--indigo); width: fit-content; list-style: none; }
.evidence summary::-webkit-details-marker { display: none; }
.evidence summary::before { content: "＋"; display: inline-block; width: 1.2em; font-weight: 400; }
.evidence[open] summary::before { content: "－"; }
.quote {
  margin: 10px 0 0; padding: 14px 18px; background: var(--paper-2); border-radius: 8px; border: 1px solid var(--rule);
  font-size: 0.88rem;
}
.quote .q-label { font-size: 0.74rem; font-weight: 600; color: var(--ink-3); }
.quote blockquote { margin: 4px 0 10px; font-family: var(--serif); font-weight: 600; color: var(--ink); white-space: pre-line; line-height: 1.75; }
.quote p { margin: 4px 0 0; color: var(--ink-2); }

/* ---------------------------------------------------------------- 도장 (이 화면의 주인공) */
.stamps { display: flex; gap: 6px; justify-content: flex-end; margin-top: 4px; }
.stamp-btn {
  width: 72px; height: 72px; padding: 0; border: 0; background: transparent; cursor: pointer; border-radius: 50%;
  display: grid; place-items: center; color: var(--rule-2); transition: color .15s, transform .15s;
}
.stamp-btn .seal-svg { width: 66px; height: 66px; }
.stamp-btn[aria-pressed="false"] .seal-svg g { filter: none; }
.stamp-btn[aria-pressed="false"] circle { stroke-dasharray: 3 3.4; }
.stamp-btn[aria-pressed="false"] .ring-in { display: none; }
.stamp-btn[aria-pressed="false"] text { fill: var(--ink-3); font-family: var(--sans); font-weight: 600; font-size: 13.5px; }
.stamp-btn:hover[aria-pressed="false"] { color: var(--rule-strong); transform: scale(1.04); }
.stamp-btn[aria-pressed="true"] { transform: rotate(-12deg); }
.stamp-btn[aria-pressed="true"].승인 { color: var(--seal); }
.stamp-btn[aria-pressed="true"].반려 { color: var(--seal-blue); }
.stamp-btn[aria-pressed="true"].보류 { color: var(--seal-amber); }
.stamp-btn[aria-pressed="true"] .seal-svg { mix-blend-mode: multiply; opacity: .94; }
.stamp-btn.just .seal-svg { animation: stamp .34s cubic-bezier(.2, .9, .25, 1.15); }
@keyframes stamp {
  0% { transform: scale(1.7); opacity: 0; }
  55% { transform: scale(.92); opacity: 1; }
  100% { transform: scale(1); }
}

/* ---------------------------------------------------------------- 3. 테스트케이스 */
.choices { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; border: 0; padding: 0; margin: 0; }
.choice { position: relative; display: block; padding: 20px 22px 18px 52px; border: 1px solid var(--rule-2); border-radius: 10px; cursor: pointer; background: var(--paper); transition: border-color .15s, box-shadow .15s; }
.choice:hover { border-color: var(--rule-strong); }
.choice:has(input:checked) { border-color: var(--indigo); box-shadow: 0 0 0 3px var(--indigo-tint); }
.choice:has(input:disabled) { opacity: .55; cursor: not-allowed; }
.choice input { position: absolute; left: 20px; top: 23px; accent-color: var(--indigo); width: 17px; height: 17px; margin: 0; }
.choice .c-title { display: block; font-weight: 700; font-size: 1rem; }
.choice .c-count { display: block; margin-top: 6px; font-size: 1.7rem; font-weight: 700; letter-spacing: -0.03em; line-height: 1.1; }
.choice .c-count small { font-size: 0.9rem; font-weight: 500; color: var(--ink-3); margin-left: 3px; }
.choice .c-note { display: block; margin-top: 6px; font-size: 0.84rem; color: var(--ink-2); }
.case-kinds { margin-top: 26px; display: flex; flex-wrap: wrap; gap: 8px 22px; font-size: 0.84rem; color: var(--ink-2); }
.case-kinds b { color: var(--ink); margin-right: 6px; }

/* ---------------------------------------------------------------- 4. 결과 */
.ledger { width: 100%; border-collapse: collapse; border-top: 1px solid var(--ink); }
.ledger th, .ledger td { padding: 13px 10px; border-bottom: 1px solid var(--rule); text-align: left; vertical-align: middle; }
.ledger th { width: 200px; font-weight: 600; font-size: 0.9rem; color: var(--ink-2); }
.ledger td.val { width: 140px; font-size: 1.15rem; font-weight: 700; text-align: right; letter-spacing: -0.02em; }
.ledger td.note { color: var(--ink-3); font-size: 0.85rem; padding-left: 26px; }
.types { display: inline-flex; flex-wrap: wrap; gap: 6px; }
.types span { padding: 2px 9px; border-radius: 999px; background: var(--paper-2); border: 1px solid var(--rule); font-size: 0.78rem; color: var(--ink-2); }
.types span b { color: var(--ink); margin-left: 3px; }

.compare { margin-top: 8px; }
.compare-legend { margin-bottom: 14px; }
.compare-row { display: grid; grid-template-columns: 200px 1fr; gap: 20px; align-items: center; padding: 14px 10px; border-bottom: 1px solid var(--rule); }
.compare-row:first-of-type { border-top: 1px solid var(--ink); }
.compare-row .c-label { font-weight: 600; font-size: 0.9rem; color: var(--ink-2); }
.compare-row .c-label small { display: block; font-weight: 400; font-size: 0.78rem; color: var(--ink-3); }
.bars { display: grid; gap: 6px; }
.bar-line { display: grid; grid-template-columns: 1fr 96px; gap: 12px; align-items: center; }
.bar-track { height: 14px; background: var(--paper-2); border-radius: 4px; }
.bar-fill { display: block; height: 100%; border-radius: 0 4px 4px 0; min-width: 2px; }
.bar-fill.human { background: var(--human); }
.bar-fill.ai { background: var(--ai); }
.bar-val { font-size: 0.86rem; font-weight: 600; text-align: right; color: var(--ink); }
.bar-val small { font-weight: 400; color: var(--ink-3); margin-right: 4px; }

.downloads { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 30px; }
.file-card {
  display: grid; grid-template-columns: 46px 1fr; gap: 14px; align-items: center; padding: 16px 18px;
  border: 1px solid var(--rule-2); border-radius: 10px; text-decoration: none; color: var(--ink); background: var(--paper);
  transition: border-color .15s, box-shadow .15s;
}
.file-card:hover { border-color: var(--indigo); box-shadow: 0 6px 18px -10px rgba(31, 58, 107, .45); }
.file-card.primary { border-color: var(--indigo); background: linear-gradient(0deg, var(--paper), var(--paper)), var(--indigo-tint); }
.file-card .doc-icon { width: 38px; height: 46px; color: var(--indigo); }
.file-card b { display: block; font-size: 0.95rem; }
.file-card span { display: block; font-size: 0.78rem; color: var(--ink-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.history { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--rule); }
.history li { display: flex; justify-content: space-between; gap: 16px; padding: 10px 4px; border-bottom: 1px solid var(--rule); font-size: 0.86rem; }
.history a { color: var(--ink); text-decoration: none; font-weight: 500; }
.history a:hover { color: var(--indigo); text-decoration: underline; text-underline-offset: 3px; }
.history time { color: var(--ink-3); flex: none; }

/* ---------------------------------------------------------------- 처음 화면 */
.welcome { max-width: 1120px; display: grid; grid-template-columns: 1.05fr .95fr; gap: 56px; align-items: center; padding: 40px 8px 20px; }
.welcome h1 { margin: 0; font-family: var(--serif); font-weight: 700; font-size: 2.45rem; line-height: 1.3; letter-spacing: -0.045em; }
.welcome .intro { margin: 18px 0 0; font-size: 1.02rem; color: var(--ink-2); max-width: 44ch; }
.flow { list-style: none; margin: 30px 0 0; padding: 0; display: grid; gap: 14px; counter-reset: flow; }
.flow li { display: grid; grid-template-columns: 34px 1fr; gap: 12px; align-items: baseline; counter-increment: flow; }
.flow li::before { content: counter(flow); font-family: var(--serif); font-weight: 900; font-size: 1.25rem; color: var(--indigo); }
.flow b { display: block; font-size: 0.98rem; }
.flow span { font-size: 0.88rem; color: var(--ink-2); }
.welcome .start { margin-top: 30px; font-size: 0.88rem; color: var(--ink-3); }

.specimen { position: relative; justify-self: center; width: min(420px, 100%); }
.specimen .paper {
  position: relative; background: var(--paper); border-radius: 6px; padding: 26px 26px 30px;
  box-shadow: var(--shadow-sheet); transform: rotate(1.6deg);
}
.specimen .paper.back { position: absolute; inset: 14px -10px -14px 10px; transform: rotate(-2.4deg); background: #F7F8FA; padding: 0; }
.specimen .sp-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.specimen .sp-title { font-family: var(--serif); font-weight: 700; font-size: 1.12rem; line-height: 1.4; }
.specimen .sp-no { font-size: 0.7rem; color: var(--ink-3); margin-bottom: 6px; }
.specimen .sp-approval { border-collapse: collapse; font-size: 0.62rem; color: var(--ink-2); }
.specimen .sp-approval td, .specimen .sp-approval th { border: 1px solid var(--rule-strong); width: 40px; text-align: center; padding: 2px; }
.specimen .sp-approval td { height: 38px; }
.specimen .sp-rule { height: 4px; border-top: 2px solid var(--ink); border-bottom: 1px solid var(--ink); margin: 16px 0 14px; }
.specimen .sp-row { display: grid; grid-template-columns: 70px 1fr; gap: 10px; font-size: 0.74rem; padding: 7px 0; border-bottom: 1px solid var(--rule); }
.specimen .sp-row b { color: var(--ink-2); font-weight: 600; }
.specimen .sp-line { height: 7px; border-radius: 4px; background: var(--paper-2); margin-top: 4px; }
.specimen .sp-seal { position: absolute; right: 22px; bottom: 26px; width: 96px; height: 96px; color: var(--seal); transform: rotate(-14deg); }
.specimen .sp-seal .seal-svg { width: 96px; height: 96px; mix-blend-mode: multiply; opacity: .92; animation: stamp .5s cubic-bezier(.2, .9, .25, 1.15) .55s both; }
.specimen .sp-mini { color: var(--seal); display: grid; place-items: center; }
.specimen .sp-mini .seal-svg { width: 30px; height: 30px; transform: rotate(-10deg); }

/* ---------------------------------------------------------------- 알림 */
.toast {
  position: fixed; left: 50%; bottom: 28px; transform: translate(-50%, 12px);
  background: var(--ink); color: #fff; padding: 11px 20px; border-radius: 8px;
  font-size: 0.9rem; opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; max-width: 90vw;
  box-shadow: 0 12px 30px -12px rgba(21, 28, 42, .6);
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.error { background: #7E2A1F; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ---------------------------------------------------------------- 좁은 화면 */
@media (max-width: 1100px) {
  .welcome { grid-template-columns: 1fr; gap: 40px; }
  .doc-top { flex-direction: column; align-items: flex-start; }
}
@media (max-width: 900px) {
  .brand { gap: 10px; }
  .brand-logo { height: 18px; }
  .brand-name { font-size: 1.05rem; }
  .brand-name { white-space: nowrap; }
  .manual-link { padding: 5px 9px; font-size: 0.78rem; }
  .shell { grid-template-columns: 1fr; }
  .sidebar { padding: 18px 16px 8px; }
  .board { padding: 16px 12px 60px; }
  .doc-head, .doc-body { padding-left: 20px; padding-right: 20px; }
  .doc-title { font-size: 1.5rem; }
  .approval td { width: 21vw; max-width: 80px; height: 66px; }
  .approval .labels th { font-size: 0.66rem; padding: 4px 2px; letter-spacing: -0.03em; }
  .readout { grid-template-columns: 1fr 1fr; }
  .readout div:nth-child(3) { border-left: 0; }
  .readout div:nth-child(n+3) { border-top: 1px solid var(--rule); }
  .slot, .revision { grid-template-columns: 40px 1fr; }
  .slot > :last-child, .revision > :last-child { grid-column: 1 / -1; justify-self: start; }
  .change { grid-template-columns: 1fr; }
  .stamps { justify-content: flex-start; }
  .choices, .downloads { grid-template-columns: 1fr; }
  .compare-row { grid-template-columns: 1fr; gap: 8px; }
  .ledger th { width: auto; }
  .ledger td.note { display: none; }
  .welcome h1 { font-size: 1.9rem; }
  .topbar { padding: 0 16px; }
  .engine { display: none; }
}

.ai-notice { margin: 10px 0 0; font-size: 0.8rem; color: var(--ink-2); }
.ai-notice::before { content: "ⓘ "; color: var(--indigo); }

/* ------------------------------------------------------------ 로그인·사업 폴더 */
body.signed-out .sidebar { display: none; }
body.signed-out .shell { grid-template-columns: 1fr; }
body.signed-out .welcome { margin: 0 auto; }
.nc-chip[hidden] { display: none; }
.welcome > * { min-width: 0; }
.login-box { margin-top: 26px; display: grid; gap: 12px; justify-items: start; }
.login-box .btn { display: inline-flex; align-items: center; gap: 10px; padding: 13px 22px; font-size: 16px; }
.login-box .btn svg { width: 22px; height: 15px; }
.login-box p { margin: 0; color: var(--ink-2); font-size: 14px; line-height: 1.6; max-width: 34em; }
.sp-row.tree b { font-weight: 600; }
.doc-meta .folder { max-width: 100%; overflow-wrap: anywhere; }
.stamps { flex-wrap: wrap; }
.stamp-by { flex-basis: 100%; margin: 2px 0 0; font-size: 12px; color: var(--ink-3); text-align: right; }
.stamp-by time { margin-left: 6px; font-variant-numeric: tabular-nums; }
.nc-saved, .nc-in { display: inline-flex; align-items: center; gap: 7px; color: var(--ink-2); font-size: 14px; }
.nc-saved { margin: 4px 0 14px; }
.nc-saved svg, .nc-in svg { width: 18px; height: 12px; flex: none; color: var(--indigo); }
.nc-in { font-size: 13px; }

/* ------------------------------------------------------------ 사이드바 폴더 탐색 (새 사업) */
.new-project[hidden], .side-browser[hidden] { display: none; }
.side-browser { margin-top: 18px; padding: 16px 0 0; border-top: 1px solid var(--rule-2); display: grid; gap: 8px; min-width: 0; }
.side-browser .side-label { margin: 0 12px; }
.side-label small { margin-left: 6px; font-weight: 500; color: var(--ink-3); }
.sb-here { display: flex; align-items: center; gap: 6px; margin: 0 8px; min-width: 0; }
.sb-here b { font-size: 0.92rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sb-up {
  flex: none; width: 26px; height: 26px; display: inline-grid; place-items: center; cursor: pointer;
  border: 1px solid var(--rule-2); border-radius: 6px; background: var(--paper); color: var(--ink-2); font-size: 1.1rem; line-height: 1;
}
.sb-up:hover { border-color: var(--indigo); color: var(--indigo); }
.sb-path { margin: -4px 12px 0; font-size: 0.72rem; color: var(--ink-3); overflow-wrap: anywhere; }
.sb-list { list-style: none; margin: 0; padding: 0; max-height: 38vh; overflow: auto; }
.sb-row {
  display: grid; grid-template-columns: 18px minmax(0, 1fr) auto; gap: 8px; align-items: center; width: 100%;
  padding: 7px 10px; border: 0; border-radius: 7px; background: none; color: var(--ink);
  font: inherit; font-size: 0.86rem; text-align: left; cursor: pointer;
}
.sb-row:hover { background: rgba(255, 255, 255, .6); }
.sb-row .nc-ico svg { width: 16px; height: 13px; }
.sb-tag { font-size: 0.68rem; font-weight: 600; color: var(--indigo); border: 1px solid currentColor; border-radius: 4px; padding: 0 4px; }
.sb-empty { padding: 8px 12px; font-size: 0.8rem; color: var(--ink-3); }
.sb-action { margin: 2px 8px 0; }
.sb-action .btn { width: 100%; }
.sb-hint { margin: 0 4px; font-size: 0.78rem; color: var(--ink-3); }
@media (max-width: 520px) {
  .engine { display: none; }
  .brand-logo { height: 15px; }
  .nc-chip { padding: 6px 9px; }
  .nc-chip > span:not(.sr-only) {                 /* 좁은 화면: 이름은 화면 읽기용으로만, 아이콘만 보인다 */
    position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap;
  }
}

/* ------------------------------------------------------------ 사이드바와 본문 구분 */
.sidebar { background: var(--paper-2); border-right: 1px solid var(--rule); }
.projects a:hover, .sb-row:hover { background: var(--board); }
.projects a[aria-current="page"] { background: var(--paper); box-shadow: 0 0 0 1px var(--rule), 0 1px 2px rgba(21, 28, 42, .06); }
@media (max-width: 900px) {
  .sidebar { border-right: 0; border-bottom: 1px solid var(--rule); }
}
.doc-meta .state-error { color: var(--seal); }

/* 로그인 여부를 확인하기 전에는 사이드바·본문을 감춘다 (옛 입력 칸이 잠깐 보이지 않게) */
body.booting .sidebar, body.booting .board { visibility: hidden; }
