/* Guide me! — 사이트 스타일
 * 색은 로고에서 추출: 남색(Guide) · 파랑(me!) · 치아 윤곽의 하늘/짙은 파랑 · 가이드 레진
 */
:root {
  --ink: #1a2a3c;          /* 로고 'Guide' 남색 — 본문·제목 */
  --ink-2: #4f5d70;        /* 보조 글자 (흰 바탕 대비 6.4:1) */
  --ink-3: #6b778a;        /* 약한 글자 (4.6:1) */
  --blue: #0077e0;         /* 로고 'me!' — 장식·강조 면 */
  --blue-text: #0068c9;    /* 글자·버튼용 파랑 (흰 글자와 5.2:1) */
  --blue-deep: #033c8c;    /* 치아 윤곽 짙은 쪽 */
  --sky: #12a0f8;          /* 치아 윤곽 밝은 쪽 */
  --resin: #f2f5f9;        /* 가이드 레진 — 도면 바탕 */
  --line: #d8e0ea;
  --grid: #e3e9f1;
  --white: #ffffff;
  --ok: #0f7b55;
  --warn: #a15c00;
  --danger: #c0262d;
  --font: 'IBM Plex Sans KR', 'Apple SD Gothic Neo', 'Malgun Gothic', system-ui, sans-serif;
  --radius-s: 6px;
  --radius-m: 10px;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100vh; display: flex; flex-direction: column;
  font-family: var(--font); font-size: 16px; line-height: 1.6; color: var(--ink); background: var(--white);
  font-feature-settings: 'tnum' 1;
}
img { max-width: 100%; height: auto; display: block; }
a { color: var(--blue-text); text-underline-offset: 3px; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--blue-text); outline-offset: 2px; border-radius: 3px; }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

/* ---------------------------------------------------------------- 버튼 */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 40px; padding: 0 16px; border-radius: var(--radius-s);
  border: 1px solid var(--line); background: var(--white); color: var(--ink);
  font-weight: 600; font-size: 15px; text-decoration: none; cursor: pointer; white-space: nowrap;
}
.btn:hover { border-color: #b7c3d2; background: var(--resin); }
.btn--primary { background: var(--blue-text); border-color: var(--blue-text); color: var(--white); }
.btn--primary:hover { background: #0057a8; border-color: #0057a8; }
.btn--quiet { border-color: transparent; background: transparent; color: var(--ink-2); }
.btn--quiet:hover { background: var(--resin); border-color: transparent; color: var(--ink); }
.btn--danger { color: var(--danger); }
.btn--danger:hover { border-color: var(--danger); background: #fdf2f2; }
.btn--small { min-height: 32px; padding: 0 10px; font-size: 14px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

/* ---------------------------------------------------------------- 안내 · 로그인 상태 (공개 첫 화면·앱 공용) */
.notice { margin: 0 0 16px; padding: 12px 14px; border-radius: var(--radius-s); border-left: 3px solid var(--danger); background: #fdf2f2; color: #8a1c22; font-size: 15px; }
.notice--ok { border-left-color: var(--ok); background: #eef8f3; color: #0b5c40; }
.notice--warn { border-left-color: var(--warn); background: #fdf6ea; color: #7a4600; }

.session { display: flex; align-items: center; gap: 12px; margin-top: 28px; padding-top: 24px; border-top: 1px solid var(--line); }
.session__avatar { width: 40px; height: 40px; border-radius: 50%; background: var(--resin); }
.session__who { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.35; }
.session__who strong { font-weight: 600; }
.session__who span { font-size: 14px; color: var(--ink-3); overflow: hidden; text-overflow: ellipsis; }

.foot { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 16px 48px; border-top: 1px solid var(--line); font-size: 14px; color: var(--ink-3); }
.foot__links { display: flex; gap: 20px; }
.foot__links a { color: var(--ink-3); }
@media (max-width: 900px) { .foot { padding: 16px 24px; flex-direction: column; align-items: flex-start; } }

/* ---------------------------------------------------------------- 앱(대시보드) */
.topbar { position: sticky; top: 0; z-index: 10; display: flex; align-items: center; gap: 28px; height: 64px; padding: 0 32px; background: rgba(7,22,46,.96); border-bottom: 1px solid rgba(61,155,255,.16); backdrop-filter: saturate(1.4) blur(8px); color: #eaf2fc; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; }
.brand__mark { width: 36px; height: auto; filter: drop-shadow(0 0 8px rgba(61,155,255,.35)); }
.brand__word { width: 108px; height: auto; }
.topnav { display: flex; gap: 4px; flex: 1; }
.topnav a { position: relative; padding: 8px 12px; border-radius: var(--radius-s); color: #a7b4c4; text-decoration: none; font-weight: 500; font-size: 15px; }
.topnav a:hover { background: rgba(61,155,255,.12); color: #fff; }
.topnav a[aria-current="page"] { color: #fff; background: rgba(61,155,255,.18); }
.topnav .count { display: inline-grid; place-items: center; min-width: 20px; height: 20px; margin-left: 6px; padding: 0 6px; border-radius: 999px; background: #3d9bff; color: #04122a; font-size: 12px; font-weight: 700; }
.me { display: flex; align-items: center; gap: 10px; font-size: 15px; color: #a7b4c4; }
.topbar .btn--quiet { color: #a7b4c4; }
.topbar .btn--quiet:hover { background: rgba(61,155,255,.12); color: #fff; }
.topbar :focus-visible { outline-color: #3d9bff; }
.me__avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--resin); }

.page { width: 100%; max-width: 1040px; margin: 0 auto; padding: 48px 32px 72px; flex: 1; }
.hello { margin-bottom: 48px; }
.hello__title { margin: 0 0 6px; font-size: 30px; line-height: 1.3; font-weight: 700; letter-spacing: -.01em; word-break: keep-all; }
.hello__summary { margin: 0; color: var(--ink-2); }

.block { padding: 32px 0; border-top: 1px solid var(--line); }
.block__head { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 16px; }
.block__title { margin: 0; font-size: 20px; font-weight: 700; }
.block__note { margin: 12px 0 0; font-size: 14px; color: var(--ink-3); }

/* 케이스 표 */
.table-wrap { overflow-x: auto; }
.cases { width: 100%; border-collapse: collapse; font-size: 15px; }
.cases th { text-align: left; font-weight: 600; font-size: 14px; color: var(--ink-3); padding: 0 12px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.cases td { padding: 14px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.cases tr:hover td { background: #f8fafc; }
.cases .col-title { font-weight: 600; }
.cases .col-actions { text-align: right; white-space: nowrap; }
.cases .col-actions .btn + .btn { margin-left: 6px; }
.status { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: 13px; font-weight: 600; background: var(--resin); color: var(--ink-2); white-space: nowrap; }
.status--planned { background: #e7f1fc; color: #0b4f96; }
.status--exported { background: #e6f5ee; color: var(--ok); }

.empty { display: grid; grid-template-columns: 96px 1fr; gap: 24px; align-items: center; padding: 28px; border: 1px dashed #c6d2e0; border-radius: var(--radius-m); background: var(--resin); }
.empty img { width: 96px; opacity: .9; }
.empty h3 { margin: 0 0 4px; font-size: 17px; }
.empty p { margin: 0 0 14px; color: var(--ink-2); font-size: 15px; }

/* 정의 목록 */
.facts { display: grid; grid-template-columns: 140px 1fr; gap: 10px 20px; margin: 0; font-size: 15px; }
.facts dt { color: var(--ink-3); }
.facts dd { margin: 0; }
.btn-row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 20px; }

.sessions { list-style: none; margin: 16px 0 0; padding: 0; }
.sessions li { padding: 12px 0; border-bottom: 1px solid var(--line); font-size: 14px; color: var(--ink-2); }
.sessions strong { color: var(--ink); font-weight: 600; margin-right: 8px; }

/* 관리자 표 */
.admin-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.admin-table th { text-align: left; color: var(--ink-3); font-weight: 600; padding: 0 10px 8px; border-bottom: 1px solid var(--line); }
.admin-table td { padding: 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.admin-table select { padding: 4px 8px; border: 1px solid var(--line); border-radius: var(--radius-s); background: var(--white); }
.person { display: flex; align-items: center; gap: 10px; }
.person img { width: 26px; height: 26px; border-radius: 50%; background: var(--resin); }
.person span { color: var(--ink-3); }
.role-admin { color: var(--blue-deep); font-weight: 600; }

/* 새 케이스 대화상자 */
.dialog { width: min(440px, calc(100vw - 32px)); padding: 0; border: 1px solid var(--line); border-radius: var(--radius-m); box-shadow: 0 24px 60px rgba(26,42,60,.22); color: var(--ink); }
.dialog::backdrop { background: rgba(26,42,60,.38); }
.dialog form { padding: 24px; }
.dialog h2 { margin: 0 0 20px; font-size: 19px; }
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 16px; }
.field label, .field legend { font-size: 14px; font-weight: 600; color: var(--ink-2); padding: 0; }
.field input[type=text] { min-height: 42px; padding: 0 12px; border: 1px solid #c6d2e0; border-radius: var(--radius-s); background: var(--white); }
.field input[type=text]:focus { border-color: var(--blue-text); outline: none; box-shadow: 0 0 0 3px rgba(0,104,201,.18); }
.field--choice { border: 0; margin: 0 0 16px; }
.choices { display: flex; gap: 8px; }
.choices label { flex: 1; display: flex; align-items: center; justify-content: center; gap: 8px; min-height: 42px; border: 1px solid #c6d2e0; border-radius: var(--radius-s); cursor: pointer; font-weight: 500; color: var(--ink); }
.choices input { accent-color: var(--blue-text); }
.choices label:has(input:checked) { border-color: var(--blue-text); background: #eef5fd; }
.dialog__actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 8px; }
.field__error { font-size: 13px; color: var(--danger); }

.toasts { position: fixed; right: 20px; bottom: 20px; display: flex; flex-direction: column; gap: 8px; z-index: 60; }
.toast { padding: 10px 14px; border-radius: var(--radius-s); background: var(--ink); color: var(--white); font-size: 14px; box-shadow: 0 10px 30px rgba(26,42,60,.25); }
.toast--danger { background: var(--danger); }

@media (max-width: 760px) {
  /* 휴대폰: 메뉴를 아래 줄로 내리고 옆으로 넘겨 본다 */
  .topbar { flex-wrap: wrap; gap: 0 12px; padding: 8px 16px 0; height: auto; }
  .topnav { order: 3; flex: 1 0 100%; gap: 4px; margin: 6px -16px 0; padding: 0 12px 8px; overflow-x: auto; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
  .topnav::-webkit-scrollbar { display: none; }
  .topnav a { flex: none; white-space: nowrap; min-height: 36px; display: inline-flex; align-items: center; }
  .me { margin-left: auto; }
  .brand__word { display: none; }
  .topnav a { padding: 6px 8px; font-size: 14px; }
  .me__name { display: none; }
  .page { padding: 32px 16px 56px; }
  .hello__title { font-size: 24px; }
  .facts { grid-template-columns: 1fr; gap: 2px; }
  .facts dd { margin-bottom: 10px; }
  .empty { grid-template-columns: 1fr; text-align: left; }
  .empty img { width: 72px; }
  .cases .col-patient, .cases .col-jaw { display: none; }
}

/* ---------------------------------------------------------------- 약관 페이지 */
.doc { max-width: 720px; margin: 0 auto; padding: 48px 24px 72px; flex: 1; }
.doc h1 { font-size: 28px; margin: 0 0 8px; }
.doc h2 { font-size: 18px; margin: 32px 0 8px; }
.doc p { color: var(--ink-2); margin: 0; }
.doc__draft { display: inline-block; margin-bottom: 20px; font-size: 14px; color: var(--warn); }
