/* GPTO — 병원 앱. 보고서가 주인공이고 나머지는 배경으로 스며든다(SPEC §9). 밝은 종이 톤, Gothic A1, ink #111318. 이번 단계는 컴퓨터 화면 우선. */
:root {
  --ink: #111318;
  --ink-2: #3a3f4b;
  --ink-3: #7a8190; /* 선 · 아이콘 */
  --muted: #646b78; /* 작은 흐린 글자(대비 4.5:1 이상) */
  --line: #e6e8ee;
  --line-2: #cfd3dc;
  --panel: #f3f4f7;
  --paper: #ffffff;
  --dark: #1a1b1e;
  --blue: #2f6bff;
  --blue-ink: #1f4fd1;
  --blue-soft: #eaf0ff;
  --rainbow: linear-gradient(90deg, #ff5a3c, #ffb400, #22c55e, #2f6bff);
  /* 보고서 보기: 문서가 주인공, 껍데기는 배경으로 스며들게 */
  --viewer-mat: #dcdfe6; /* 문서 뒤 바탕(매트) · 막대도 같은 색 */
  --viewer-line: #c8ccd4; /* 쪽 테두리 · 막대 아래 선 (report-doc.js PAGE_LINE 과 같은 값) */
  --page-shadow: 0 1px 3px rgba(17, 19, 24, 0.1); /* 쪽 그림자(얕게) — report-doc.js PAGE_SHADOW 와 같은 값 */
  --viewer-bar-h: 48px;
  --viewer-w: 880px; /* 문서 기둥 폭(원본 794px + 좌우 여유) */
  --page-w: 794px; /* A4 한 쪽 폭 — report-doc.js PAGE_W 과 같은 값 */
  --page-h: 1123px; /* A4 한 쪽 높이 — report-doc.js PAGE_H 과 같은 값 */
  --pill-dim: 0.35; /* 읽는 동안 쪽 번호가 흐려지는 정도(넓은 화면) */
  --pill-fade: 0.2s; /* 좁은 화면 칩이 나타나고 사라지는 시간 — 멈춘 뒤 SCROLL_IDLE(550ms) + 이 시간 안에 완전히 사라집니다 */
  --pill-w: 62px; /* 쪽 번호 최소 폭 — 문서 옆에 놓을 자리가 있는지 재는 기준 */
  --pill-gap: 20px; /* 쪽 번호와 문서 사이 · 화면 끝과의 간격 */
  --font: "Gothic A1", -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", "Noto Sans KR", "Malgun Gothic", "Segoe UI", sans-serif;
  --radius: 12px;
  --top-h: 56px;
  --tab-h: 60px;
  --safe-t: env(safe-area-inset-top, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --focus-ring: 0 0 0 3px rgba(47, 107, 255, 0.3);
  color-scheme: light;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}
html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}
body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  background: var(--panel);
  color: var(--ink);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  word-break: keep-all;
  overflow-wrap: anywhere;
}
img {
  max-width: 100%;
}
[hidden] {
  display: none !important;
}
a {
  color: inherit;
}
button,
input {
  font: inherit;
  color: inherit;
}
button {
  -webkit-tap-highlight-color: transparent;
}
.sr-only {
  position: absolute !important;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* 키보드 초점은 항상 보이게 */
:focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: 2px;
}
h1[tabindex="-1"]:focus,
main:focus {
  outline: none;
}
.skip {
  position: absolute;
  left: 12px;
  top: -80px;
  z-index: 100;
  background: var(--ink);
  color: #fff;
  padding: 10px 14px;
  border-radius: 8px;
  text-decoration: none;
  font-weight: 600;
}
.skip:focus {
  top: calc(12px + var(--safe-t));
}

.ic {
  width: 20px;
  height: 20px;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.ic.sm {
  width: 16px;
  height: 16px;
}

/* 첫 화면(스크립트 전) */
.boot {
  min-height: 100dvh;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 14px;
}
.boot p {
  margin: 0;
}
.boot-mark {
  width: 40px;
  height: 40px;
}

/* ───── 위 막대 ───── */
.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  padding-top: var(--safe-t);
  background: rgba(255, 255, 255, 0.96);
  -webkit-backdrop-filter: saturate(1.4) blur(8px);
  backdrop-filter: saturate(1.4) blur(8px);
  border-bottom: 1px solid var(--line);
}
.topbar::before {
  content: "";
  display: block;
  height: 2px;
  background: var(--rainbow);
}
.topbar-in {
  height: var(--top-h);
  max-width: 1080px;
  margin: 0 auto;
  padding: 0 16px;
  display: flex;
  align-items: center;
  gap: 12px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: none;
  min-height: 44px;
  text-decoration: none;
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -0.01em;
}
.brand-mark {
  width: 24px;
  height: 24px;
}
.top-hospital {
  flex: 1;
  min-width: 0;
  text-align: right;
  font-size: 14px;
  font-weight: 500;
  color: var(--ink-2);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.top-nav {
  display: none;
}
.top-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: none;
}
.top-actions:empty {
  display: none;
}
.top-signout {
  display: none;
}

/* ───── 아래 탭(휴대폰) ───── */
.tabbar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 30;
  display: grid;
  grid-template-columns: 1fr 1fr;
  padding-bottom: var(--safe-b);
  background: rgba(255, 255, 255, 0.97);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  border-top: 1px solid var(--line);
}
.tab {
  height: var(--tab-h);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  text-decoration: none;
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
  -webkit-tap-highlight-color: transparent;
}
.tab .ic {
  width: 24px;
  height: 24px;
}
.tab[aria-current="page"] {
  color: var(--ink);
  font-weight: 700;
}
.tab[aria-current="page"] .ic {
  stroke-width: 2;
}
.tab:focus-visible {
  outline-offset: -4px;
  border-radius: 10px;
}

/* ───── 본문 ───── */
.main {
  display: block;
}
body[data-mode="app"] .main {
  padding-bottom: calc(var(--tab-h) + var(--safe-b));
}
.page {
  margin: 0 auto;
  padding: 20px 12px 32px;
}
.page.narrow {
  max-width: 720px;
}
.page-head {
  padding: 4px 4px 14px;
}
.page-head .muted {
  margin: 2px 0 0;
  font-size: 14px;
}
@media (max-width: 419px) {
  .pdf-save {
    display: none;
  }
}
.eyebrow {
  margin: 0 0 2px;
  font-size: 13px;
  font-weight: 500;
  color: var(--muted);
}
.page-title {
  margin: 0;
  font-size: 24px;
  line-height: 1.3;
  font-weight: 700;
  letter-spacing: -0.02em;
}
.title-row {
  display: flex;
  align-items: baseline;
  gap: 8px;
}
.count {
  font-size: 15px;
  font-weight: 500;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.muted {
  color: var(--muted);
}
.footnote {
  margin: 14px 4px 0;
  font-size: 13px;
  color: var(--muted);
}
.back-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-height: 44px;
  margin: -8px 0 4px -4px;
  padding: 0 4px;
  border-radius: 8px;
  color: var(--ink-2);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
}
.page > .page-title {
  margin: 0 4px 14px;
}

.card {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  margin: 0 0 12px;
}
.card.pad {
  padding: 20px 16px;
}
.card-h {
  margin: 0;
  padding: 16px 16px 6px;
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
}

/* ───── 배지 ───── */
.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 24px;
  min-width: 40px;
  padding: 0 8px;
  border-radius: 6px;
  font-size: 12.5px;
  font-weight: 700;
  letter-spacing: 0.02em;
  white-space: nowrap;
}
/* 종류 배지는 조용하게 — 시작 · 주간 · 월간 · 종료는 급함이 아니라 분류라 칠 · 강조색을 쓰지 않는다(SPEC §9). */
.badge-start,
.badge-weekly,
.badge-monthly,
.badge-closing {
  background: transparent;
  color: var(--ink-2);
  box-shadow: inset 0 0 0 1px var(--line-2);
}

/* ───── 보고서 목록 ───── */
/* 다음 보고서 안내: 카드 · 테두리 · 강조색 없이 바탕 위에서 글자 크기 · 굵기로만 위계를 줍니다. */
.next-report {
  margin: 0 4px 16px;
}
.next-report p {
  margin: 0;
}
.next-label {
  font-size: 13px;
  font-weight: 500;
  color: var(--muted);
}
.next-when {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  column-gap: 8px;
  margin-top: 1px;
}
.next-date {
  font-size: 18px;
  font-weight: 600;
  line-height: 1.4;
  letter-spacing: -0.01em;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}
.next-rel {
  font-size: 14px;
  font-weight: 500;
  color: var(--muted);
}
.next-report .next-what {
  margin-top: 1px;
  font-size: 14px;
  color: var(--ink-2);
}
.next-report .next-after {
  margin-top: 2px;
  font-size: 13px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.report-list {
  list-style: none;
  margin: 0;
  padding: 0;
  overflow: hidden;
}
.report-list li + li {
  border-top: 1px solid var(--line);
}
.report-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 12px;
  align-items: start;
  min-height: 76px;
  padding: 16px 12px 16px 14px;
  color: inherit;
  text-decoration: none;
  -webkit-tap-highlight-color: transparent;
}
.report-row .badge {
  margin-top: 1px;
}
@media (hover: hover) {
  .report-row:hover {
    background: #fafbfc;
  }
}
.report-row:active {
  background: var(--panel);
}
.report-row:focus-visible {
  outline-offset: -3px;
  border-radius: var(--radius);
}
.row-main {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.row-title {
  font-size: 16px;
  font-weight: 600;
  line-height: 1.45;
  letter-spacing: -0.01em;
}
.is-unread .row-title {
  font-weight: 700;
}
.row-meta {
  display: block;
  overflow: hidden;
  font-size: 13.5px;
  color: var(--ink-2);
  font-variant-numeric: tabular-nums;
}
.row-meta-in {
  display: flex;
  flex-wrap: wrap;
  margin-left: -15px;
}
.row-meta-in > span {
  position: relative;
  padding-left: 15px;
  white-space: nowrap;
}
.row-meta-in > span::before {
  content: "·";
  position: absolute;
  left: 5px;
  color: var(--ink-3);
}
.row-note {
  margin-top: 2px;
  font-size: 13px;
  color: var(--muted);
}
.row-end {
  display: flex;
  align-items: center;
  gap: 8px;
  align-self: center;
  color: var(--ink-3);
}
.unread-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--blue);
}
.empty {
  padding: 36px 20px;
  text-align: center;
}
.empty-title {
  margin: 0 0 4px;
  font-weight: 600;
}
.empty .muted {
  margin: 0;
  font-size: 14px;
}

/* ───── 배너 · 상태 화면 ───── */
.banner {
  position: relative;
  overflow: hidden;
  margin: 0 0 12px;
  padding: 16px 16px 14px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
.banner::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  height: 2px;
  background: var(--rainbow);
}
.banner-title {
  margin: 0;
  font-size: 15px;
  font-weight: 700;
}
.banner-text {
  margin: 4px 0 0;
  font-size: 14px;
  color: var(--ink-2);
}
.state {
  position: relative;
  overflow: hidden;
  padding: 28px 20px 24px;
}
.rainbow-line {
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  height: 2px;
  background: var(--rainbow);
}
.state .eyebrow {
  margin-bottom: 6px;
}
.state-title {
  margin: 0 0 10px;
  font-size: 21px;
  line-height: 1.35;
  font-weight: 700;
  letter-spacing: -0.02em;
}
.state-text {
  margin: 0 0 4px;
  font-size: 15px;
  color: var(--ink-2);
}
.state-contact {
  margin-top: 20px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}
.mini-h {
  margin: 0 0 4px;
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
}
.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 20px;
}

.contact {
  list-style: none;
  margin: 0;
  padding: 0;
}
.contact li {
  display: grid;
  grid-template-columns: 52px minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  min-height: 44px;
  font-size: 15px;
}
.contact .k {
  font-size: 13px;
  color: var(--muted);
}
.contact .link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 44px;
  color: var(--blue-ink);
  font-weight: 600;
  text-decoration: none;
  font-variant-numeric: tabular-nums;
}
.contact .link:hover {
  text-decoration: underline;
  text-underline-offset: 3px;
}
.card > .contact {
  padding: 0 16px 8px;
}

.loading {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 48px 16px;
  font-size: 14px;
  color: var(--muted);
}
.spinner {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 2px solid var(--line-2);
  border-top-color: var(--ink);
  animation: spin 0.8s linear infinite;
}
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* ───── 버튼 · 입력 ───── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 48px;
  padding: 0 18px;
  border: 1px solid transparent;
  border-radius: 10px;
  background: var(--paper);
  color: var(--ink);
  font-size: 16px;
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  transition: background-color 0.15s, border-color 0.15s;
}
.btn:disabled {
  opacity: 0.55;
  cursor: default;
}
.btn-primary,
.btn-dark {
  background: var(--ink);
  color: #fff;
}
.btn-primary:hover:not(:disabled),
.btn-dark:hover {
  background: #262a33;
}
.btn-line {
  border-color: var(--line-2);
}
.btn-line:hover:not(:disabled) {
  border-color: var(--ink-3);
}
.btn-quiet {
  background: transparent;
  color: var(--ink-2);
}
.btn-quiet:hover {
  background: rgba(17, 19, 24, 0.05);
}
.btn-block {
  width: 100%;
}
.btn-sm {
  min-height: 40px;
  padding: 0 14px;
  font-size: 14px;
  border-radius: 9px;
}
.link-btn {
  min-height: 44px;
  padding: 8px 6px;
  border: 0;
  background: none;
  color: var(--ink-2);
  font-size: 14px;
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}

.form {
  display: grid;
  gap: 16px;
}
.field label {
  display: block;
  margin: 0 0 6px;
  font-size: 14px;
  font-weight: 600;
  color: var(--ink-2);
}
.control {
  position: relative;
}
.field input {
  width: 100%;
  height: 50px;
  padding: 0 14px;
  border: 1px solid var(--line-2);
  border-radius: 10px;
  background: var(--paper);
  font-size: 16px; /* iOS 입력 확대 방지 */
  -webkit-appearance: none;
  appearance: none;
}
.field input:focus {
  outline: none;
  border-color: var(--ink);
  box-shadow: var(--focus-ring);
}
.control.has-reveal input {
  padding-right: 52px;
}
.reveal {
  position: absolute;
  right: 3px;
  top: 3px;
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 8px;
  background: none;
  color: var(--ink-3);
  cursor: pointer;
}
.reveal:hover {
  color: var(--ink);
}
.hint {
  margin: 6px 0 0;
  font-size: 13px;
  color: var(--muted);
}
.hint.center {
  text-align: center;
}
.form-error {
  margin: -4px 0 0;
  padding: 10px 12px;
  border-radius: 8px;
  background: #fff1ef;
  color: #b42318;
  font-size: 14px;
  font-weight: 500;
}

/* ───── 로그인 · 비밀번호 설정 ───── */
.auth {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: calc(24px + var(--safe-t)) 12px calc(24px + var(--safe-b));
}
.auth-card {
  position: relative;
  overflow: hidden;
  width: 100%;
  max-width: 400px;
  margin: 0 auto;
  padding: 32px 20px 16px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 16px;
}
.auth-card .rainbow-line {
  height: 3px;
}
.auth-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 0 0 12px;
}
.auth-mark {
  width: 44px;
  height: auto;
}
.auth-company {
  margin: 0;
  font-size: 13px;
  font-weight: 500;
  color: var(--muted);
}
.auth-title {
  margin: 0;
  font-size: 24px;
  line-height: 1.25;
  font-weight: 700;
  letter-spacing: -0.02em;
}
.auth-lead {
  margin: 0 0 20px;
  font-size: 15px;
  color: var(--ink-2);
}
.auth-account {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin: -8px 0 16px;
  font-size: 14px;
}
.auth-account .k {
  color: var(--muted);
}
.auth .banner {
  margin-bottom: 16px;
}
.auth-foot {
  display: flex;
  justify-content: center;
  margin-top: 8px;
}
.auth-legal {
  margin: 16px 0 0;
  text-align: center;
  font-size: 12px;
  color: var(--muted);
}
.mock-hint {
  margin: 8px 0 0;
  padding: 8px 10px;
  border-radius: 8px;
  background: var(--panel);
  font-size: 12px;
  color: var(--muted);
  text-align: center;
}

/* ───── 시트(비밀번호 찾기) ───── */
.sheet {
  width: 100%;
  max-width: min(480px, 100%);
  max-height: 100%;
  margin: auto auto 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
}
.sheet::backdrop {
  background: rgba(17, 19, 24, 0.42);
}
.sheet-inner {
  padding: 10px 20px calc(16px + var(--safe-b));
  background: var(--paper);
  border-radius: 16px 16px 0 0;
}
.sheet[open] .sheet-inner {
  animation: sheet-up 0.2s ease-out;
}
@keyframes sheet-up {
  from {
    transform: translateY(24px);
    opacity: 0.6;
  }
}
.sheet-grip {
  width: 36px;
  height: 4px;
  margin: 0 auto 14px;
  border-radius: 2px;
  background: var(--line-2);
}
.sheet-title {
  margin: 0 0 8px;
  font-size: 19px;
  font-weight: 700;
}
.sheet-text {
  margin: 0 0 8px;
  font-size: 15px;
  color: var(--ink-2);
}
.sheet .contact {
  margin-bottom: 12px;
}

/* ───── 내 병원 ───── */
.dl {
  margin: 0;
  padding: 0 16px 6px;
}
.dl-row {
  display: grid;
  grid-template-columns: 104px minmax(0, 1fr);
  gap: 12px;
  padding: 11px 0;
  border-top: 1px solid var(--line);
  font-size: 15px;
}
.dl-row:first-child {
  border-top: 0;
}
.dl dt {
  font-size: 14px;
  color: var(--muted);
}
.dl dd {
  margin: 0;
  font-variant-numeric: tabular-nums;
}
.rules {
  margin: 0;
  padding: 12px 16px 14px 32px;
  border-top: 1px solid var(--line);
  font-size: 13px;
  color: var(--muted);
}
.rules li + li {
  margin-top: 2px;
}
.nav-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 52px;
  padding: 0 16px;
  border-top: 1px solid var(--line);
  text-decoration: none;
  font-weight: 500;
  color: var(--ink);
}
.nav-row .ic {
  color: var(--ink-3);
}
.nav-row:focus-visible {
  outline-offset: -3px;
}
.signout {
  display: grid;
  gap: 8px;
  margin: 20px 0 0;
}
.version {
  margin: 20px 0 0;
  text-align: center;
  font-size: 12px;
  color: var(--muted);
}

/* ───── 보고서 보기 ───── */
/* 이 화면의 일은 하나 — 보고서를 끝까지 읽는 것. 문서가 주인공, 껍데기는 배경으로 스며들게. */
body[data-mode="viewer"],
body[data-mode="link"] {
  background: var(--viewer-mat);
}
/* 브랜드 막대 · 무지개 선 · 로고는 넣지 않습니다(문서 안에 이미 있습니다). */
body[data-mode="viewer"] .topbar {
  display: none;
}
.viewer-bar {
  position: sticky;
  top: 0;
  z-index: 20;
  padding-top: var(--safe-t);
  background: var(--viewer-mat);
  border-bottom: 1px solid var(--viewer-line);
  transition: transform 0.22s ease;
}
/* 스크롤을 내리면 숨고 올리면 다시 나옵니다(동작 줄이기 설정이면 즉시). */
.viewer-bar.is-away {
  transform: translateY(-100%);
}
body[data-mode="link"] .viewer-bar {
  position: static;
  transform: none;
}
.viewer-bar-in {
  display: flex;
  align-items: center;
  gap: 10px;
  max-width: var(--viewer-w);
  min-height: var(--viewer-bar-h);
  margin: 0 auto;
  padding: 4px 12px;
}
.viewer-back {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 2px;
  flex: none;
  min-width: 40px;
  height: 40px;
  margin-left: -6px;
  padding: 0 4px;
  border-radius: 10px;
  color: var(--ink-2);
  text-decoration: none;
  font-weight: 500;
}
.viewer-back .ic {
  width: 22px;
  height: 22px;
}
.viewer-back:hover {
  color: var(--ink);
  background: rgba(17, 19, 24, 0.05);
}
.viewer-back-label {
  display: none;
  font-size: 14px;
  padding-right: 6px;
}
.viewer-heading {
  flex: 1;
  min-width: 0;
}
.viewer-title {
  margin: 0;
  font-size: 15px;
  line-height: 1.3;
  font-weight: 600;
  letter-spacing: -0.01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.viewer-meta {
  margin: 0;
  font-size: 12px;
  line-height: 1.35;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-variant-numeric: tabular-nums;
}
.viewer-tools {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: none;
}
/* 막대 버튼: 테두리만 있는 조용한 버튼. 누를 때만 색이 들어옵니다. */
.viewer-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  min-height: 38px;
  padding: 0 11px;
  border: 1px solid var(--viewer-line);
  border-radius: 9px;
  background: transparent;
  color: var(--ink-2);
  font-size: 13.5px;
  font-weight: 600;
  white-space: nowrap;
  text-decoration: none;
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s, background-color 0.15s;
}
.viewer-btn:hover:not(:disabled) {
  border-color: var(--ink-3);
  color: var(--ink);
}
.viewer-btn:active:not(:disabled) {
  border-color: var(--blue);
  background: var(--blue-soft);
  color: var(--blue-ink);
}
.viewer-btn:disabled {
  opacity: 0.5;
  cursor: default;
}
/* 크기 조절은 원본 ↔ 쪽 맞춤 2단계. 좁은 화면은 폭에 맞춰 열리므로 버튼을 두지 않습니다. */
.viewer-zoom {
  display: none;
}
.viewer-body {
  max-width: var(--viewer-w);
  margin: 0 auto;
  padding: 12px 12px 56px;
}
.link-note {
  margin: 0 0 10px;
  padding: 10px 12px;
  border: 1px solid var(--viewer-line);
  border-radius: 10px;
  background: var(--paper);
  font-size: 13.5px;
  color: var(--ink-2);
}
/* 조직 탭: 선택된 탭은 글자만 진하게 + 아래 2px 밑줄. 조직이 하나면 탭 줄 자체를 만들지 않습니다(viewer.js). */
.org-tabs {
  display: flex;
  gap: 2px;
  margin: 0;
  padding: 0 0 8px;
  overflow-x: auto;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}
.org-tabs::-webkit-scrollbar {
  display: none;
}
.org-tab {
  flex: none;
  height: 34px;
  padding: 0 10px;
  border: 0;
  border-bottom: 2px solid transparent;
  background: transparent;
  color: var(--muted);
  font-size: 13.5px;
  font-weight: 500;
  cursor: pointer;
}
.org-tab:hover {
  color: var(--ink-2);
}
.org-tab[aria-selected="true"] {
  color: var(--ink);
  font-weight: 700;
  border-bottom-color: var(--ink);
}
.org-tab:focus-visible {
  outline-offset: -2px;
  border-radius: 6px;
}
.zoom-hint {
  margin: 0 0 10px;
  text-align: center;
  font-size: 12.5px;
  color: var(--muted);
}
.frame-wrap {
  position: relative;
  width: 100%;
  min-height: 240px;
}
.frame-box {
  position: relative;
  margin: 0 auto;
  overflow: hidden;
}
.report-frame {
  position: absolute;
  left: 0;
  top: 0;
  display: block;
  border: 0;
  background: transparent;
  transform-origin: 0 0;
}
.frame-status {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding-top: 32px;
  background: var(--viewer-mat);
}
.frame-status .state {
  width: 100%;
  max-width: 420px;
  margin: 0 4px;
}
/* 쪽 번호: 멈춰서 읽는 동안에는 문서 글자 위에 아무것도 얹지 않습니다.
   - 넓은 화면(1000px 이상): 문서 옆 빈 매트에 늘 둡니다. 스크롤하는 동안만 흐려집니다(is-dim).
   - 좁은 화면(1000px 미만): 옆에 자리가 없으므로 위쪽 막대 안(제목 오른쪽 · 버튼 앞)에 글자로 둡니다(.viewer-page).
     막대가 숨은 채 스크롤하는 동안만 칩(is-live)을 잠깐 보이고, 멈추면 흐려지는 게 아니라 완전히 사라집니다.
     동작 줄이기 설정이면 칩을 쓰지 않습니다(viewer.js 도 붙이지 않습니다). */
.viewer-page {
  flex: none;
  padding: 0 4px;
  color: var(--ink-2); /* 흐린 회색은 매트 위에서 대비가 모자랍니다 */
  font-size: 12.5px;
  font-weight: 600;
  letter-spacing: 0.02em;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.page-pill {
  position: fixed;
  z-index: 25;
  min-width: var(--pill-w);
  padding: 3px 10px;
  border: 1px solid var(--viewer-line);
  border-radius: 999px;
  background: var(--viewer-mat);
  color: var(--ink-2);
  text-align: center;
  font-size: 12.5px;
  font-weight: 600;
  letter-spacing: 0.02em;
  font-variant-numeric: tabular-nums;
  user-select: none;
  -webkit-user-select: none;
}
@media (max-width: 999.98px) {
  /* 칩은 숨은 막대 자리(위 가운데)에 뜹니다. 기본은 사라진 상태 — 보이지도, 눌리지도 않습니다. */
  .page-pill {
    left: 50%;
    top: calc(8px + var(--safe-t));
    transform: translateX(-50%);
    visibility: hidden;
    opacity: 0;
    pointer-events: none;
    transition: opacity var(--pill-fade) ease, visibility 0s linear var(--pill-fade);
  }
  .page-pill.is-live {
    visibility: visible;
    opacity: 1;
    transition: opacity var(--pill-fade) ease;
  }
}
@media (max-width: 999.98px) and (prefers-reduced-motion: reduce) {
  .page-pill {
    display: none;
  }
}
/* 문서 옆 매트가 쪽 번호를 놓을 만큼 넓어지면(A4 폭 794px + 양옆에 간격·쪽 번호·간격) 오른쪽 매트로 옮깁니다.
   문서는 화면 가운데에 서므로 쪽 번호 왼쪽 끝이 늘 문서 오른쪽 끝보다 밖입니다 → 문서와 겹치지 않습니다.
   매트 위에서는 테두리 · 바탕 없이 글자만 조용히 둡니다(글자색은 그대로 — 흐린 회색은 매트 위에서 대비가 모자랍니다).
   막대 안 쪽 번호는 화면에서만 숨깁니다(화면 낭독기는 그대로 읽습니다 — 옆 쪽 번호는 aria-hidden). */
@media (min-width: 1000px) {
  .page-pill {
    left: calc(50% + var(--page-w) / 2 + var(--pill-gap));
    bottom: calc(16px + var(--safe-b));
    transform: none;
    border-color: transparent;
    background: transparent;
    transition: opacity 0.25s ease;
  }
  .page-pill.is-dim {
    opacity: var(--pill-dim);
  }
  .page-pill:hover {
    opacity: 1;
  }
  .viewer-page {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
    border: 0;
  }
}
.toast {
  position: fixed;
  left: 50%;
  bottom: calc(var(--tab-h) + var(--safe-b) + 16px);
  z-index: 60;
  max-width: calc(100% - 32px);
  padding: 10px 16px;
  border-radius: 999px;
  background: var(--dark);
  color: #fff;
  font-size: 14px;
  opacity: 0;
  transform: translate(-50%, 12px);
  transition: opacity 0.2s, transform 0.2s;
  pointer-events: none;
}
.toast.on {
  opacity: 1;
  transform: translate(-50%, 0);
}
.mock-tag {
  position: fixed;
  right: 8px;
  top: calc(8px + var(--safe-t));
  z-index: 40;
  padding: 1px 8px;
  border: 1px solid #f1d08a;
  border-radius: 999px;
  background: #fff8e6;
  color: #7a4f00;
  font-size: 11px;
  font-weight: 600;
  pointer-events: none;
}
body[data-mode="app"] .mock-tag {
  top: auto;
  bottom: calc(var(--tab-h) + var(--safe-b) + 8px);
}
/* 보고서 보기에서는 숨깁니다 — 개발용 표시가 문서 읽는 데 걸립니다(목록 · 내 병원에서는 그대로 보입니다). */
body[data-mode="viewer"] .mock-tag,
body[data-mode="link"] .mock-tag {
  display: none;
}

@media (pointer: fine) {
  .zoom-hint {
    display: none;
  }
}

/* ───── 넓은 화면 ───── */
@media (min-width: 768px) {
  .topbar-in {
    padding: 0 24px;
    gap: 16px;
  }
  .brand {
    order: 0;
  }
  .top-nav {
    order: 1;
    display: flex;
    gap: 2px;
    margin-left: 12px;
  }
  .top-hospital {
    order: 2;
  }
  .top-actions {
    order: 3;
  }
  .top-link {
    display: flex;
    align-items: center;
    gap: 6px;
    height: 38px;
    padding: 0 12px;
    border-radius: 8px;
    color: var(--ink-2);
    text-decoration: none;
    font-size: 15px;
    font-weight: 500;
  }
  .top-link .ic {
    width: 18px;
    height: 18px;
  }
  .top-link:hover {
    background: var(--panel);
  }
  .top-link[aria-current="page"] {
    background: var(--panel);
    color: var(--ink);
    font-weight: 700;
  }
  .top-signout {
    display: inline-flex;
    align-items: center;
    height: 36px;
    padding: 0 12px;
    border: 1px solid var(--line-2);
    border-radius: 8px;
    background: var(--paper);
    color: var(--ink-2);
    font-size: 14px;
    cursor: pointer;
  }
  .top-signout:hover {
    border-color: var(--ink-3);
    color: var(--ink);
  }
  .tabbar {
    display: none !important;
  }
  body[data-mode="app"] .main {
    padding-bottom: 0;
  }
  .page {
    padding: 36px 24px 56px;
  }
  .page-head {
    padding-bottom: 18px;
  }
  .page-title {
    font-size: 28px;
  }
  .report-row {
    padding: 18px 16px 18px 20px;
    gap: 16px;
  }
  .card-h {
    padding: 18px 20px 6px;
  }
  .dl,
  .card > .contact {
    padding-left: 20px;
    padding-right: 20px;
  }
  .dl-row {
    grid-template-columns: 140px minmax(0, 1fr);
  }
  .rules {
    padding-left: 36px;
  }
  .nav-row {
    padding: 0 20px;
  }
  .card.pad {
    padding: 28px 24px;
  }
  .signout {
    grid-template-columns: 1fr 1fr;
  }
  .signout .hint {
    grid-column: 1 / -1;
  }
  .state {
    padding: 36px 32px 32px;
  }
  .auth-card {
    padding: 40px 36px 24px;
  }
  .sheet {
    margin: auto;
  }
  .sheet-inner {
    padding: 24px 28px 20px;
    border-radius: 16px;
  }
  .sheet-grip {
    display: none;
  }
  .toast {
    bottom: 24px;
  }
  .viewer-bar-in {
    padding: 4px 24px;
    gap: 14px;
  }
  .viewer-back {
    margin-left: -10px;
    padding: 0 6px 0 4px;
  }
  .viewer-back-label {
    display: inline;
  }
  .viewer-title {
    font-size: 15.5px;
  }
  .viewer-body {
    padding: 14px 24px 72px;
  }
  /* 문서가 가운데에 서 있으므로 탭 줄도 가운데로 맞춥니다. */
  .org-tabs {
    flex-wrap: wrap;
    justify-content: center;
    padding: 0 0 12px;
  }
  body[data-mode="app"] .mock-tag {
    bottom: 12px;
  }
}

/* 원본(A4 100%) ↔ 쪽 맞춤 버튼은 '원본'이 정말 A4 100%(794px)로 열리는 폭에서만 보입니다.
   문서 자리 = 화면 폭 − .viewer-body 좌우 여백 24px씩 → 794 + 48 = 842px.
   이보다 좁으면 '원본'도 폭 맞춤(100% 미만)이어서 두 단계가 같아지므로 버튼을 두지 않습니다(viewer.js zoomAvailable 이 이 표시를 그대로 따릅니다). */
@media (min-width: 842px) {
  .viewer-zoom {
    display: inline-flex;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}

/* ───── 인쇄(Ctrl+P): 보고서 한 쪽 = 종이 한 장 ─────
   보고서는 샌드박스 iframe 안에 있어서, 그 안의 쪽 나누기(break-after)가 바깥 종이로 전해지지 않습니다.
   브라우저는 iframe 을 한 덩어리로 보고 종이 높이마다 잘라 냅니다. 그래서
   ① 종이 한 장을 A4 한 쪽과 똑같은 크기(--page-w × --page-h)로 잡고
   ② iframe 안 쪽 사이 간격을 0 으로 만들고(js/report-doc.js VIEWER_CSS 의 인쇄 규칙)
   ③ iframe 을 첫 장 맨 위(0,0)에 붙이고 높이를 쪽 수 × 한 쪽 높이(--print-h)로 맞춥니다.
   간격이 남으면 장마다 어긋나 한 장에 두 쪽이 잘려 나옵니다. */
@media print {
  @page {
    size: 794px 1123px; /* --page-w × --page-h (report-doc.js PAGE_W · PAGE_H) */
    margin: 0;
  }
  .topbar,
  .tabbar,
  .viewer-bar,
  .page-pill,
  .mock-tag,
  .zoom-hint,
  .org-tabs,
  .link-note,
  .frame-status {
    display: none !important;
  }
  html,
  body {
    background: #fff !important;
  }
  /* 문서만 남기고 여백을 없애 첫 쪽이 첫 장 왼쪽 맨 위에서 시작하게 합니다. */
  .main,
  .viewer-body {
    max-width: none !important;
    margin: 0 !important;
    padding: 0 !important;
  }
  .frame-wrap {
    min-height: 0 !important;
  }
  .frame-box {
    width: var(--page-w) !important;
    height: auto !important;
    margin: 0 !important;
    overflow: visible !important;
  }
  /* 화면 배율(원본 · 쪽 맞춤)은 인쇄에서 쓰지 않습니다 — 늘 A4 100%.
     --print-h 는 viewer.js 가 쪽 수에 맞춰 넣습니다(쪽 사이 간격이 빠진 높이). */
  .report-frame {
    position: static !important;
    width: var(--page-w) !important;
    height: var(--print-h, auto) !important;
    transform: none !important;
  }
}

/* ───── 설정 · 주간 보고서 요일 ───── */
.card-body {
  padding: 0 16px 16px;
}
.weekly-now {
  margin: 0 0 12px;
  font-size: 16px;
  color: var(--ink-2);
}
.weekly-now b {
  color: var(--ink);
  font-weight: 700;
}
.dow-pick {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.dow-pick button {
  min-width: 56px;
  height: 40px;
  padding: 0 14px;
  border-radius: 999px;
  border: 1px solid var(--line-2);
  background: var(--paper);
  color: var(--ink-2);
  font: inherit;
  font-size: 14.5px;
  font-weight: 500;
  cursor: pointer;
}
.dow-pick button[aria-checked="true"] {
  background: var(--ink);
  border-color: var(--ink);
  color: #fff;
  font-weight: 700;
}
.dow-pick button:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
}
.weekly-preview {
  margin: 12px 0 0;
  min-height: 1.5em;
  font-size: 14.5px;
  color: var(--ink-2);
}
.weekly-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 14px;
}
