/* ══════════════════════════════════════════════════════════════════════════
   FCG 고객 보고서 — 발행·수령 확인 창구

   주제: 문서를 발행하고, 고객사가 열람했는지 확인한다.
   그래서 화면의 재료는 잉크와 종이이고, 유일한 강조는 '열람 인장'이다.
   인주색(--seal)은 인장 외 어디에도 쓰지 않는다. 그 규칙이 이 화면의 전부다.
   테마는 흰 종이 하나뿐이다(다크 모드 없음) — 종이 위의 잉크라는 전제를 흐리지 않기 위해.
   ══════════════════════════════════════════════════════════════════════════ */

:root {
  /* 종이 */
  --paper:    #f0efec;
  --sheet:    #fbfaf8;
  --rule:     #dbd9d3;
  --rule-2:   #979183;   /* 입력·버튼 경계는 3:1 이상 (WCAG 1.4.11) */

  /* 먹 — 청람 */
  --ink:      #16202b;
  --ink-2:    #4c5765;
  --ink-3:    #686d75;   /* 표 헤더·라벨·날짜에 쓰이므로 본문 기준 4.5:1 */

  /* 인주 — 인장 전용 */
  --seal:     #b8402c;
  --seal-2:   #8f2f1f;
  --seal-bg:  #b8402c14;

  --ok:       #2f6b4f;

  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
  --sans: -apple-system, BlinkMacSystemFont, "Pretendard", "Apple SD Gothic Neo",
          "Malgun Gothic", "Noto Sans KR", sans-serif;

  /* 한글이 섞인 라벨의 문법.
     mono 는 한글 글리프가 없어 폴백이 섞이므로 숫자·날짜·URL 에만 쓴다.
     라벨의 성격은 자간과 크기로 낸다. */
  --label: 600 11px/1.4 var(--sans);
  --label-track: 0.075em;

  /* 타입 스케일 — 다섯 단만 쓴다 */
  --t-micro: 10.5px;
  --t-meta:  12px;
  --t-ui:    13px;
  --t-body:  14px;
  --t-head:  17px;

  /* 이 화면은 흰 종이 하나로 간다. OS 가 다크 모드여도 날짜 선택기·스크롤바 같은
     네이티브 위젯이 검게 남지 않도록 명시한다. */
  color-scheme: light;
}


* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: var(--t-body);
  line-height: 1.55;
  /* 레터헤드 — 문서의 윗선 */
  border-top: 2px solid var(--seal);
}
a { color: inherit; }

/* ─────────────────────────────────────────────────────────── 상단 발행처 */
.wrap { max-width: 1120px; margin: 0 auto; padding: 0 22px; }

.topbar { background: var(--sheet); border-bottom: 1px solid var(--rule); }
.topbar__in { display: flex; align-items: center; gap: 18px; height: 56px; }

.brand {
  margin-right: auto;
  font-size: 15px; font-weight: 700; letter-spacing: -0.015em;
}
.brand span {
  display: block;
  font-size: 11px; font-weight: 500;
  letter-spacing: 0.1em; color: var(--ink-3); margin-top: 1px;
}

.topbar nav { display: flex; align-items: center; gap: 16px; font-size: var(--t-ui); }
.topbar nav a { color: var(--ink-2); text-decoration: none; padding: 2px 0; }
.topbar nav a:hover { color: var(--ink); }
.topbar nav a[aria-current] { color: var(--ink); box-shadow: inset 0 -2px 0 var(--ink); }

main { padding: 26px 0 72px; }

/* ────────────────────────────────────────────────────────── 제목·구획 */
.pagehead { display: flex; align-items: baseline; gap: 10px; margin-bottom: 18px; }
.pagehead h1 { font-size: var(--t-head); margin: 0; letter-spacing: -0.015em; }
.pagehead .count { font-size: var(--t-meta); color: var(--ink-3); font-variant-numeric: tabular-nums; }

/* 구획 제목은 잉크선 하나로만 구분한다. 상자를 겹치지 않는다. */
.sect { margin-bottom: 26px; }
.sect__head {
  display: flex; align-items: baseline; gap: 10px;
  padding-bottom: 7px; margin-bottom: 0;
  border-bottom: 1.5px solid var(--ink);
}
.sect__head h2 {
  font-size: var(--t-meta); margin: 0; font-weight: 700;
  letter-spacing: 0.02em;
}
.sect__head .count { font-size: 11.5px; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.sect__head .right { margin-left: auto; }
.sect__box { background: var(--sheet); border: 1px solid var(--rule); border-top: 0; }

/* 카드 — 로그인·계정처럼 단독으로 서는 곳에만 */
.card { background: var(--sheet); border: 1px solid var(--rule); }
.card + .card { margin-top: 18px; }
.card__head {
  display: flex; align-items: baseline; gap: 10px;
  padding: 10px 15px; border-bottom: 1px solid var(--rule);
}
.card__head h2 { font-size: var(--t-meta); margin: 0; font-weight: 700; }
.card__head .count { font-size: 11.5px; color: var(--ink-3); margin-left: auto; }
.card__body { padding: 15px; }

/* ───────────────────────────────────────────────────────────────── 표 */
table { width: 100%; border-collapse: collapse; }
thead th {
  font: var(--label); letter-spacing: var(--label-track); color: var(--ink-3);
  text-align: left; padding: 9px 15px;
  border-bottom: 1px solid var(--rule); white-space: nowrap;
}
tbody td { padding: 10px 15px; border-bottom: 1px solid var(--rule); vertical-align: middle; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: var(--paper); }

.mono { font-family: var(--mono); font-variant-numeric: tabular-nums; font-size: 12.5px; }
.num { font-variant-numeric: tabular-nums; text-align: right; }
.muted { color: var(--ink-3); }
.t-title { font-weight: 600; text-decoration: none; letter-spacing: -0.01em; }
.t-title:hover { box-shadow: inset 0 -1px 0 var(--ink); }
.empty { padding: 34px 15px; text-align: center; color: var(--ink-3); font-size: var(--t-ui); }

/* ══════════════════════════ 시그니처 — 열람 인장 ══════════════════════════
   이 제품이 답하는 단 하나의 질문은 "고객이 확인했는가"다.
   그 답만 인주색으로 찍고, 나머지 화면 전체는 먹으로 눌러 둔다.        */
.seal {
  display: inline-flex; align-items: baseline; gap: 5px;
  padding: 3px 7px 2px;
  font-variant-numeric: tabular-nums;
  font-size: 11.5px; white-space: nowrap;
  color: var(--seal-2); background: var(--seal-bg);
  border: 1px solid var(--seal);
  /* 인장의 이중 테두리 */
  box-shadow: inset 0 0 0 1px var(--sheet);
}
.seal b { font-weight: 700; font-size: 11.5px; }
.seal--empty {
  color: var(--ink-3); background: transparent;
  border: 1px dashed var(--rule-2); box-shadow: none;
}

/* ────────────────────────────────────────────────────── 상태 — 도트 칩 */
.chip {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: var(--t-meta); color: var(--ink-2); white-space: nowrap;
}
.chip::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--ink-3); }
.chip--ok::before   { background: var(--ok); }
.chip--warn::before { background: var(--ink-2); }
.chip--bad::before  { background: var(--rule-2); }

/* ───────────────────────────────────────────────────────────────── 폼 */
label {
  display: block; margin-bottom: 5px;
  font: var(--label); letter-spacing: var(--label-track); color: var(--ink-2);
}
input[type=text], input[type=email], input[type=password], input[type=date],
select, textarea {
  width: 100%; height: 34px; padding: 0 10px;
  background: var(--sheet); color: var(--ink);
  border: 1px solid var(--rule-2); border-radius: 0;
  font-family: inherit; font-size: var(--t-body);
}
textarea { height: auto; padding: 8px 10px; resize: vertical; line-height: 1.5; }
input:focus, select:focus, textarea:focus {
  outline: 2px solid var(--ink); outline-offset: -1px; border-color: transparent;
}
input:disabled { color: var(--ink-3); background: var(--paper); }
.field + .field { margin-top: 13px; }
.field__hint { font-size: 11.5px; color: var(--ink-3); margin-top: 4px; line-height: 1.45; }
.row { display: flex; gap: 10px; }
.row > * { flex: 1; }

/* ───────────────────────────────────────────────────────────── 버튼 */
button, .btn {
  height: 32px; padding: 0 13px; border-radius: 0; cursor: pointer;
  font-family: var(--sans); font-size: var(--t-ui); font-weight: 600;
  border: 1px solid var(--rule-2); background: var(--sheet); color: var(--ink);
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  text-decoration: none; white-space: nowrap;
}
button:hover, .btn:hover { border-color: var(--ink); }
.btn--primary { background: var(--ink); border-color: var(--ink); color: var(--sheet); }
.btn--primary:hover { background: #000; border-color: #000; }
.btn--sm { height: 27px; padding: 0 10px; font-size: var(--t-meta); }
.btn--danger { color: var(--ink-2); border-color: var(--rule-2); background: transparent; }
.btn--danger:hover { color: var(--seal-2); border-color: var(--seal); }

/* ───────────────────────────────────────────────────────────── 알림 */
.note {
  padding: 10px 13px; font-size: var(--t-ui);
  border: 1px solid var(--rule-2); background: var(--sheet);
  border-left-width: 3px;
}
.note--bad { border-left-color: var(--seal); }
.note--ok  { border-left-color: var(--ink); }
.note + * { margin-top: 16px; }

/* ─────────────────────────────────────────── 고객이 처음 만나는 화면 */
.auth { min-height: 100dvh; display: grid; place-items: center; padding: 24px; }
.auth__box { width: 100%; max-width: 392px; }
.auth__brand {
  font-size: 21px; font-weight: 700; letter-spacing: -0.02em; margin-bottom: 2px;
}
.auth__sub {
  font-size: 11.5px; letter-spacing: 0.07em;
  color: var(--ink-3); margin-bottom: 22px;
  padding-bottom: 12px; border-bottom: 1.5px solid var(--ink);
}
.auth__sub strong { font-size: var(--t-ui); letter-spacing: 0; color: var(--ink); }
.auth .card__body { padding: 18px; }
.auth button[type=submit] { width: 100%; margin-top: 16px; height: 36px; }

/* ══════════════════ 관리 — 좌 고객사 매트릭스 + 우 포커스 ══════════════════ */
.admin { display: grid; grid-template-columns: 234px minmax(0, 1fr); gap: 22px; align-items: start; }

.tnav { position: sticky; top: 18px; }
.tnav__label {
  font: var(--label); letter-spacing: var(--label-track); color: var(--ink-3);
  padding-bottom: 7px; border-bottom: 1.5px solid var(--ink); margin-bottom: 0;
}
.tnav__list { background: var(--sheet); border: 1px solid var(--rule); border-top: 0; }
.tnav__item {
  display: block; padding: 10px 12px; text-decoration: none; color: inherit;
  border-bottom: 1px solid var(--rule);
}
.tnav__item:last-child { border-bottom: 0; }
.tnav__item:hover { background: var(--paper); }
.tnav__item[aria-current] { background: var(--paper); box-shadow: inset 3px 0 0 var(--ink); }
.tnav__name { font-weight: 600; font-size: var(--t-ui); display: flex; align-items: center; gap: 6px; }
.tnav__name .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--seal); flex: none; }
.tnav__matrix {
  display: flex; gap: 10px; margin-top: 3px;
  font-variant-numeric: tabular-nums;
  font-size: 11.5px; color: var(--ink-3);
}
.tnav__matrix b { font-weight: 700; color: var(--ink-2); }
.tnav__add {
  display: block; text-align: center; padding: 9px; margin-top: 10px;
  border: 1px dashed var(--rule-2);
  font-size: var(--t-meta); color: var(--ink-2); text-decoration: none;
}
.tnav__add:hover { border-color: var(--ink); color: var(--ink); }

.focus__head {
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
  padding-bottom: 12px; margin-bottom: 22px; border-bottom: 1.5px solid var(--ink);
}
.focus__title { font-size: 19px; font-weight: 700; letter-spacing: -0.02em; margin: 0; }
.focus__meta {
  display: flex; gap: 12px; align-items: center;
  font-variant-numeric: tabular-nums;
  font-size: 12.5px; color: var(--ink-3);
}
.focus__meta b { color: var(--ink-2); font-weight: 700; }
.focus__actions { margin-left: auto; display: flex; gap: 7px; }

/* 펼침 폼 — 열려도 헤더 줄이 흔들리지 않게 띄운다 */
.disclose { display: inline-block; position: relative; }
.disclose > summary {
  list-style: none; cursor: pointer;
  height: 32px; padding: 0 13px;
  font-size: var(--t-ui); font-weight: 600;
  border: 1px solid var(--rule-2); background: var(--sheet); color: var(--ink);
  display: inline-flex; align-items: center;
}
.disclose > summary::-webkit-details-marker { display: none; }
.disclose > summary:hover { border-color: var(--ink); }
.disclose--primary > summary { background: var(--ink); border-color: var(--ink); color: var(--sheet); }
.disclose[open] > summary { border-color: var(--ink); }
.disclose__panel {
  position: absolute; right: 0; top: calc(100% + 8px); z-index: 30;
  padding: 16px; width: min(520px, calc(100vw - 40px));
  border: 1px solid var(--ink); background: var(--sheet);
  box-shadow: 6px 6px 0 var(--rule);
}

/* 링크 한 줄 — 복사가 첫 번째 동작 */
.linkrow {
  display: flex; align-items: center; gap: 9px;
  padding: 9px 13px; border-bottom: 1px solid var(--rule);
}
.linkrow:last-child { border-bottom: 0; }
.linkrow input {
  flex: 1; height: 27px; font-family: var(--mono); font-size: 11px;
  background: var(--paper); border-color: var(--rule);
}
.linkrow__meta {
  font-size: 11.5px; font-variant-numeric: tabular-nums;
  color: var(--ink-3); white-space: nowrap;
}

.rowsel { box-shadow: inset 3px 0 0 var(--ink); background: var(--paper); }

.copyfield { display: flex; gap: 6px; }
.copyfield input { font-family: var(--mono); font-size: 11.5px; }

/* ───────────────────────────────────────────────────────────── 아이콘
   선 굵기를 규칙선과 맞춘 인라인 SVG. 색은 currentColor 를 따라갑니다.
   누르는 것에만 붙이고, 제목·표 머리·라벨에는 붙이지 않습니다.        */
.i {
  width: 14px; height: 14px; flex: none;
  fill: none; stroke: currentColor;
  stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round;
}
.btn--sm .i, button.btn--sm .i { width: 13px; height: 13px; }
.tnav__add .i { width: 12px; height: 12px; }

/* 고객사 로고 — 열람 화면의 머리 */
.brand--logo { display: flex; align-items: center; gap: 11px; margin-right: auto; }
.brand__logo { height: 22px; width: auto; max-width: 190px; object-fit: contain; display: block; }
.brand__issuer {
  padding-left: 11px; border-left: 1px solid var(--rule-2);
  font-size: 11.5px; font-weight: 500; letter-spacing: 0.04em; color: var(--ink-3);
}
.focus__logo { height: 24px; width: auto; max-width: 150px; object-fit: contain; }
.logopreview {
  display: flex; align-items: center; gap: 10px; margin-bottom: 13px;
  padding: 10px 12px; background: var(--paper); border: 1px solid var(--rule);
}
.logopreview img { height: 26px; width: auto; max-width: 200px; object-fit: contain; }

/* 위험 구역 — 되돌릴 수 없는 동작은 폼 본체와 시각적으로 분리한다 */
.danger {
  margin-top: 22px; padding: 14px;
  border: 1px solid var(--seal); border-left-width: 3px;
  background: var(--seal-bg);
}
.danger__head {
  font: var(--label); letter-spacing: var(--label-track);
  color: var(--seal-2); margin-bottom: 6px;
}
.danger__body { margin: 0 0 12px; font-size: 12.5px; color: var(--ink-2); line-height: 1.5; }

/* 열람 기한 — 링크로 들어온 분에게 필요한 유일한 상태 표시 */
.until {
  display: inline-flex; align-items: baseline; gap: 6px;
  font-size: var(--t-meta); color: var(--ink-3);
}
.until b { font-weight: 700; color: var(--ink-2); }
.until em {
  font-style: normal; font-size: 11px;
  color: var(--seal-2); border: 1px solid var(--seal);
  padding: 1px 5px;
}

/* ══════════════════════════ 열람 셸 — 읽는 화면 ══════════════════════════
   고객이 하려는 일은 목록을 보는 게 아니라 읽는 것이다.
   그래서 문서가 화면을 차지하고, 목록은 옆으로 물러나 접힌다.          */
body.fill { height: 100dvh; display: flex; flex-direction: column; overflow: hidden; }
body.fill .topbar { flex: none; }
.topbar__in--wide { display: flex; align-items: center; gap: 18px; height: 56px; padding: 0 16px; }
main.fill { flex: 1; min-height: 0; display: flex; }

.reader { display: flex; width: 100%; min-height: 0; }

.rail {
  width: 258px; flex: none; overflow-y: auto;
  background: var(--sheet); border-right: 1px solid var(--rule);
}
.reader--collapsed .rail { display: none; }

.rail__head {
  position: sticky; top: 0; z-index: 1;
  padding: 11px 14px 9px;
  background: var(--sheet); border-bottom: 1.5px solid var(--ink);
  font: var(--label); letter-spacing: var(--label-track); color: var(--ink-3);
}
.rail__group {
  padding: 12px 14px 4px;
  font: var(--label); letter-spacing: var(--label-track); color: var(--ink-3);
}
.rail__item {
  display: block; padding: 10px 14px; text-decoration: none; color: inherit;
  border-bottom: 1px solid var(--rule);
}
.rail__item:hover { background: var(--paper); }
.rail__item[aria-current] { background: var(--paper); box-shadow: inset 3px 0 0 var(--seal); }
.rail__title {
  display: block; font-size: var(--t-ui); font-weight: 600;
  letter-spacing: -0.01em; line-height: 1.4;
}
.rail__meta {
  display: flex; align-items: center; gap: 7px; margin-top: 4px;
  font-size: 11px; color: var(--ink-3);
}
.rail__meta .seal { padding: 1px 5px; font-size: 10.5px; }

.stage { flex: 1; min-width: 0; display: flex; flex-direction: column; background: var(--paper); }
.stage__bar {
  flex: none; display: flex; align-items: center; gap: 12px;
  padding: 0 14px; height: 42px;
  background: var(--sheet); border-bottom: 1px solid var(--rule);
}
.stage__title {
  font-size: var(--t-ui); font-weight: 600; letter-spacing: -0.01em;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.stage__meta { color: var(--ink-3); margin-right: auto; }
.stage__doc { flex: 1; width: 100%; border: 0; display: block; background: #fff; }

@media (max-width: 880px) {
  /* 좁은 화면에서는 문서가 우선이다. 목록은 눌러서 편다. */
  .rail { position: absolute; z-index: 40; height: calc(100dvh - 56px); box-shadow: 8px 0 24px #0000001f; }
  .reader { position: relative; }
}

/* ─────────────────────────────────────────────────────────────── 반응형 */
@media (max-width: 880px) {
  .admin { grid-template-columns: 1fr; }
  .tnav { position: static; }
  .tnav__list { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
  .tnav__item { border-bottom: 0; border-right: 1px solid var(--rule); }
  .disclose { position: static; }
  .disclose__panel { position: static; width: auto; margin-top: 10px; box-shadow: none; }
  .focus__actions { margin-left: 0; width: 100%; }
}

@media (max-width: 640px) {
  .wrap { padding: 0 14px; }
  .row { flex-direction: column; }
  .linkrow { flex-wrap: wrap; }
  thead th:nth-child(n+4), tbody td:nth-child(n+4) { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}
