@font-face { font-family:Pretendard; font-style:normal; font-weight:100 900; font-display:swap; src:url('/PretendardVariable.woff2') format('woff2'); }
:root { color-scheme:light; --paper:#fff; --surface:#f6f7fb; --ink:#252638; --muted:#6b6e82; --line:#e6e7ef; --brand:#4f4ff7; --brand-hover:#4141da; --selection:#f0f0ff; --page-max-width:1760px; --page-gutter:32px; font-family:Pretendard,'Apple SD Gothic Neo','Malgun Gothic',sans-serif; color:var(--ink); background:var(--surface); font-size:16px; line-height:1.55; -webkit-font-smoothing:antialiased; }
* { box-sizing:border-box; }
html { scrollbar-gutter:stable; }
body { margin:0; min-height:100dvh; display:flex; flex-direction:column; }
a { color:inherit; }
button,input,select { font:inherit; }
button,a,input,select { -webkit-tap-highlight-color:transparent; }
button { cursor:pointer; }
button:disabled { cursor:default; opacity:.55; }
:focus-visible { outline:3px solid var(--brand); outline-offset:4px; }
[hidden] { display:none !important; }
h1,h2,p { margin:0; }
h1 { font-size:28px; line-height:1.3; letter-spacing:-.035em; font-weight:650; }
h2 { font-size:18px; font-weight:650; line-height:1.45; }
p { max-width:70ch; }
.muted { color:var(--muted); font-size:14px; }
.sr-only { position:absolute; width:1px; height:1px; overflow:hidden; clip-path:inset(50%); white-space:nowrap; }
.skip-link { position:absolute; top:-100px; left:16px; z-index:5; background:white; padding:10px; }
.skip-link:focus { top:12px; }
.page-container { width:calc(100% - 2 * var(--page-gutter)); max-width:var(--page-max-width); margin-inline:auto; }
.app-header { position:sticky; top:0; z-index:10; border-bottom:1px solid var(--line); background:var(--paper); }
/* Center the letters, rather than the font's asymmetric ascent/descent box. */
.app-header .nav-text { display:block; min-width:0; line-height:1; white-space:nowrap; overflow-x:clip; overflow-y:visible; text-overflow:ellipsis; text-box:trim-both cap alphabetic; }
.app-header-inner { min-height:72px; padding-block:12px; display:flex; align-items:center; justify-content:space-between; gap:24px; }
.account { display:flex; align-items:center; min-height:44px; flex-shrink:0; gap:16px; margin-left:auto; }
.header-actions { display:flex; align-items:center; min-height:44px; flex-shrink:0; gap:24px; }
.viewer-controls { display:flex; align-items:center; min-height:44px; }
.account-text { display:flex; align-items:center; min-height:44px; text-align:right; font-size:13px; line-height:20px; font-weight:500; color:var(--muted); overflow-wrap:anywhere; }
main { padding-block:24px; flex:1; }
.button { display:inline-flex; align-items:center; justify-content:center; gap:8px; min-height:44px; padding:10px 17px; border:1px solid var(--line); border-radius:10px; background:white; color:var(--ink); text-decoration:none; font-size:14px; font-weight:550; line-height:1.5; }
.button:hover { border-color:var(--brand); background:var(--selection); }
.button.primary { background:var(--brand); border-color:var(--brand); color:white; }
.button.primary:hover { background:var(--brand-hover); border-color:var(--brand-hover); }
.button.quiet { background:transparent; border-color:transparent; color:var(--muted); }
.button.quiet:hover { background:var(--surface); color:var(--ink); }
.text-link { color:var(--brand); font-size:14px; text-underline-offset:4px; }
main.login-main { display:grid; align-items:center; min-height:100dvh; padding-block:48px; }
.login-panel { width:min(100%,420px); margin:auto; padding:36px; background:var(--paper); border:1px solid var(--line); border-radius:24px; box-shadow:0 16px 56px #25263806; }
.login-heading { display:flex; align-items:center; gap:11px; margin-bottom:36px; }
.wordmark { font-size:clamp(15px,4.6vw,21px); font-weight:650; letter-spacing:-.6px; white-space:nowrap; }
.login-privacy { display:flex; align-items:center; justify-content:center; gap:7px; color:var(--muted); font-size:12px; margin-top:26px; }
.login-privacy .icon { width:14px; height:14px; }
.login-heading img { display:block; flex-shrink:0; }
.login-expired { color:var(--muted); font-size:14px; margin-bottom:20px; }
.login-form { display:flex; flex-direction:column; gap:16px; }
.login-form .button { min-height:48px; margin-top:8px; }
.login-form input { min-height:48px; padding:12px 14px; border-color:var(--line); background:#fbfbfd; font-size:15px; line-height:1.4; }
.login-form input::placeholder { color:#8b8d9f; font-weight:400; opacity:1; }
.field { display:flex; flex-direction:column; gap:7px; }
.field label { font-size:13px; font-weight:550; }
input { width:100%; border:1px solid var(--line); border-radius:10px; padding:11px 14px; background:white; color:var(--ink); min-height:46px; min-width:0; }
input::placeholder { color:#848699; }
input:focus { border-color:var(--brand); }
input:focus-visible { outline:3px solid #4f4ff71a; outline-offset:0; }
.form-error,.inline-error { color:#9b3030; background:#fff5f4; padding:13px; border-radius:6px; font-size:14px; }
.page-heading { display:flex; align-items:flex-end; justify-content:space-between; gap:24px; margin-bottom:32px; }
.page-heading p { margin-top:9px; }
.back-link { display:inline-block; color:var(--muted); font-size:14px; margin-bottom:17px; text-underline-offset:4px; }
.patient-meta { font-size:15px; color:var(--muted); }
.patients-main { max-width:1040px; padding-block:24px; }
.patient-directory { border:1px solid var(--line); background:var(--paper); border-radius:18px; }
.patient-toolbar { position:sticky; top:73px; z-index:5; padding:20px 24px; border-radius:17px 17px 0 0; background:var(--paper); box-shadow:0 1px 0 var(--line); }
.patient-search-field { position:relative; }
.patient-search-field > .icon { position:absolute; width:18px; height:18px; top:15px; left:16px; color:var(--muted); pointer-events:none; }
.patient-search-field input { min-height:48px; padding-left:44px; background:var(--surface); border-color:transparent; font-size:14px; }
.patient-search-field input:focus { border-color:var(--brand); background:var(--paper); }
.patient-list-heading { display:grid; grid-template-columns:minmax(0,1fr) 120px 16px; gap:24px; padding:12px 24px; color:var(--muted); background:#fbfbfd; border-top:1px solid var(--line); font-size:12px; }
.patient-list { border-top:1px solid var(--line); }
.patient-row { display:grid; grid-template-columns:minmax(0,1fr) 120px 16px; gap:24px; align-items:center; text-decoration:none; padding:16px 24px; border-bottom:1px solid var(--line); }
.patient-row:last-child { border-bottom:0; border-radius:0 0 17px 17px; }
.patient-row:focus-visible { outline-offset:-3px; }
.patient-row-identity { display:flex; align-items:center; gap:14px; min-width:0; }
.patient-avatar { width:38px; height:38px; flex-shrink:0; display:grid; place-items:center; background:#f0f0f8; color:#686987; border-radius:13px; font-size:14px; font-weight:550; }
.patient-row-arrow { color:#a0a2b4; }
.patient-row:hover { background:var(--selection); }
.patient-name { font-size:16px; font-weight:550; overflow-wrap:anywhere; }
.patient-chart { font-size:14px; color:var(--muted); font-variant-numeric:tabular-nums; }
.patient-empty { padding:64px 20px; text-align:center; color:var(--muted); font-size:14px; }
.context-note { padding:14px 18px; background:var(--selection); border-left:3px solid var(--brand); margin-bottom:26px; display:flex; align-items:center; justify-content:space-between; gap:12px; flex-wrap:wrap; font-size:14px; }
.album-layout { display:grid; grid-template-columns:218px minmax(0,1fr); gap:36px; }
.visits { border-top:2px solid var(--ink); padding-top:17px; }
.visits h2 { margin-bottom:6px; font-size:16px; }
.visits p { margin-bottom:20px; }
.visit-link { padding:16px 0; display:flex; flex-direction:column; gap:5px; border-bottom:1px solid var(--line); text-decoration:none; }
.visit-link:hover { color:var(--brand); }
.visit-link strong { font-weight:550; font-size:14px; }
.visit-link span { font-size:12px; color:var(--muted); }
.gallery-main { min-width:0; }
.visit-section { margin-bottom:40px; scroll-margin-top:20px; }
.visit-heading { display:flex; align-items:center; justify-content:space-between; gap:16px; margin-bottom:18px; padding-top:13px; border-top:2px solid var(--line); }
.visit-heading p { margin-top:4px; }
.photo-grid { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:20px 16px; }
.photo-card { text-align:left; border:0; padding:0; background:transparent; color:var(--ink); min-width:0; border-radius:5px; }
.photo-frame { display:flex; justify-content:center; align-items:center; aspect-ratio:1; width:100%; background:var(--surface); border-radius:5px; overflow:hidden; }
.photo-frame img { display:block; width:100%; height:100%; object-fit:contain; }
.photo-placeholder { padding:16px; text-align:center; font-size:13px; color:var(--muted); }
.photo-caption { display:flex; justify-content:space-between; gap:8px; margin-top:9px; font-size:14px; }
.photo-caption .muted { font-size:12px; }
.synthetic-label { display:block; font-size:12px; color:#846225; margin-top:4px; }
.gallery-more { display:flex; flex-direction:column; align-items:center; gap:16px; }
.state { padding:32px 20px; text-align:center; max-width:600px; margin:clamp(60px,18dvh,180px) auto; }
.state-symbol { display:grid; place-items:center; width:56px; height:56px; border:1px solid var(--line); border-radius:18px; background:var(--paper); color:var(--muted); margin:0 auto 24px; }
.icon { display:block; width:20px; height:20px; flex-shrink:0; }
.state-symbol .icon { width:24px; height:24px; }
.state-error .state-symbol { color:#a75247; background:#fff5f2; border-color:#f2ddd7; }
.loading-mark { position:relative; display:grid; place-items:center; width:76px; height:76px; margin:0 auto 28px; }
.loading-mark img { display:block; border-radius:11px; }
.spinner { display:inline-block; flex-shrink:0; width:24px; height:24px; border:2px solid #4f4ff724; border-top-color:var(--brand); border-radius:50%; animation:spin .85s linear infinite; }
.loading-mark .spinner { position:absolute; inset:0; width:76px; height:76px; }
.button.primary .spinner { width:17px; height:17px; border-color:#ffffff55; border-top-color:#fff; }
@keyframes spin { to { transform:rotate(360deg); } }
.state h1 { font-size:22px; }
.state.state-loading h1 { font-size:18px; font-weight:550; }
.state p { margin:12px auto 0; color:var(--muted); font-size:15px; }
.state-actions { margin-top:25px; display:flex; justify-content:center; gap:12px; flex-wrap:wrap; }
.viewer { border:0; border-radius:12px; padding:24px; width:min(1180px,calc(100vw - 48px)); max-height:calc(100dvh - 36px); color:var(--ink); background:white; }
.viewer::backdrop { background:#17262bcc; }
.viewer-heading { display:flex; align-items:center; justify-content:space-between; gap:20px; }
.viewer-heading > div { min-width:0; }
.viewer-heading > .button { flex-shrink:0; white-space:nowrap; }
.viewer-heading p { margin-top:4px; }
.viewer-toolbar { display:flex; align-items:center; justify-content:space-between; gap:16px; margin:20px 0 16px; }
.version-switch { display:inline-flex; border:1px solid var(--line); border-radius:7px; padding:3px; }
.version-button { border:0; border-radius:4px; background:white; color:var(--muted); padding:8px 18px; min-height:40px; font-size:14px; }
.version-button[aria-pressed=true] { background:var(--brand); color:white; }
.viewer-stage { background:var(--surface); display:flex; align-items:center; justify-content:center; height:clamp(180px,58dvh,700px); min-width:0; overflow:hidden; border-radius:5px; }
.viewer-stage img { width:100%; height:100%; object-fit:contain; }
.viewer-stage p { font-size:14px; color:var(--muted); }
.viewer-note { margin-top:10px; color:var(--muted); font-size:13px; }
.viewer-bottom { display:flex; justify-content:space-between; margin-top:16px; }
.viewer-file-error { padding:25px; text-align:center; }
.viewer-file-error p { margin-bottom:18px; }
@media(min-width:1500px) { .photo-grid { grid-template-columns:repeat(4,minmax(0,1fr)); } }
@media(max-width:1000px) { .album-layout { grid-template-columns:180px minmax(0,1fr); gap:24px; } .photo-grid { grid-template-columns:repeat(2,minmax(0,1fr)); } }
@media(max-width:700px) { :root { --page-gutter:16px; } main.login-main { padding-block:32px; } main { padding-block:16px; } .album-layout { display:block; } .visits { margin-bottom:26px; } .visits h2 { font-size:14px; } .visits p { margin-bottom:3px; } .visit-link { padding:12px 0; } .page-heading { align-items:center; gap:12px; } .page-heading h1 { font-size:25px; } .visit-heading { flex-wrap:wrap; } .photo-grid { gap:20px 12px; } .viewer { width:calc(100vw - 20px); padding:16px; max-height:calc(100dvh - 20px); } .viewer-heading { align-items:flex-start; gap:10px; } .viewer-toolbar { gap:10px; } .version-button { padding:8px 12px; } .viewer-heading .muted { font-size:12px; } .state { padding:38px 0; } .state h1 { font-size:20px; } }
@media(max-width:380px) { .photo-grid { grid-template-columns:1fr; } .viewer-toolbar { flex-wrap:wrap; } }
@media(prefers-reduced-motion:reduce) { * { scroll-behavior:auto !important; animation:none !important; transition:none !important; } }

.patient-context { display:flex; align-items:center; min-height:44px; gap:12px; flex:1; min-width:0; }
.patient-home { display:inline-flex; align-items:center; gap:10px; flex-shrink:0; min-height:44px; font-size:17px; line-height:1.3; font-weight:650; letter-spacing:-.035em; white-space:nowrap; text-decoration:none; border-radius:4px; }
.patient-home:hover { color:var(--brand); }
.patient-home img { display:block; border-radius:8px; }
.patient-detail { display:flex; align-items:center; gap:12px; min-width:0; }
.patient-separator { display:block; flex-shrink:0; color:var(--muted); }
.comparison-patient { display:flex; align-items:center; justify-content:center; gap:12px; min-width:0; }
.comparison-patient h1 { display:flex; align-items:center; min-width:0; font-size:17px; line-height:1; white-space:nowrap; }
.comparison-patient .patient-meta { display:flex; align-items:center; min-height:20px; min-width:0; font-size:13px; line-height:20px; white-space:nowrap; overflow:hidden; }
.patient-identity { display:grid; place-items:center start; min-width:0; }
.patient-chart-link { height:44px; padding:0 10px; border:1px solid var(--line); border-radius:7px; text-decoration:none; }
.patient-chart-link:hover { border-color:var(--brand); background:var(--selection); }
.patient-chart-action { display:inline-flex; align-items:center; gap:6px; flex-shrink:0; color:var(--brand); font-size:12px; line-height:1; font-weight:600; white-space:nowrap; }
/* A shared image plane keeps the two visits at the same viewing size. */
.comparison-panels { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:20px; }
.comparison-sync { display:inline-flex; align-items:center; min-height:44px; gap:7px; font-size:13px; line-height:20px; color:var(--muted); cursor:pointer; white-space:nowrap; }
.comparison-sync input { width:16px; height:16px; min-height:0; padding:0; margin:0; accent-color:var(--brand); }
.comparison-panel { min-width:0; padding:12px; background:var(--paper); border:1px solid var(--line); border-radius:16px; }
.encounter-select { display:block; width:100%; min-width:0; min-height:44px; border:1px solid var(--line); border-radius:9px; padding:8px 30px 8px 12px; background:white; color:var(--ink); font-size:14px; font-weight:550; text-overflow:ellipsis; cursor:pointer; }
.panel-heading { margin-bottom:8px; }
.comparison-stage { position:relative; background:var(--paper); height:clamp(220px,calc(100dvh - 284px),1080px); border-radius:8px; overflow:hidden; touch-action:pan-y pinch-zoom; }
.comparison-stage:focus-visible { outline-offset:2px; }
.comparison-canvas { height:100%; width:100%; display:flex; align-items:center; justify-content:center; }
.photo-loading,.photo-empty { display:flex; flex-direction:column; align-items:center; gap:16px; padding:24px 48px; color:var(--muted); font-size:13px; text-align:center; }
.photo-empty > .icon { width:28px; height:28px; color:#a1a3b7; }
.comparison-canvas img { display:block; width:100%; height:100%; object-fit:contain; user-select:none; -webkit-user-drag:none; transform:translate(var(--photo-x,0px),var(--photo-y,0px)) scale(var(--photo-scale,1)); transform-origin:center; }
.comparison-stage.pan-ready { cursor:grab; user-select:none; }
.comparison-stage.panning { cursor:grabbing; }
.photo-step { position:absolute; z-index:1; top:50%; transform:translateY(-50%); display:flex; align-items:center; justify-content:center; width:36px; height:48px; border:1px solid var(--line); border-radius:12px; background:#ffffffed; color:var(--ink); line-height:1; }
.photo-step span { font:30px/1 Pretendard,sans-serif; margin-top:-2px; }
.photo-step.previous { left:12px; }
.photo-step.next { right:12px; }
.photo-step:hover:enabled { background:white; border-color:var(--brand); color:var(--brand); }
.photo-step:disabled { opacity:.2; }
.comparison-notice { color:#846225; font-size:12px; margin-top:8px; }
.photo-sequence { display:flex; flex-wrap:wrap; align-content:flex-start; gap:8px; padding:12px 0 0; }
.sequence-button { flex:0 0 56px; width:56px; height:56px; padding:3px; overflow:hidden; border:1px solid var(--line); border-radius:8px; background:var(--surface); }
.sequence-button[aria-busy=true]::after { content:''; display:block; width:16px; height:16px; margin:auto; border:2px solid var(--line); border-top-color:var(--brand); border-radius:50%; animation:spin .85s linear infinite; }
.sequence-button img { display:block; width:100%; height:100%; object-fit:contain; border-radius:2px; pointer-events:none; user-select:none; -webkit-user-drag:none; }
.sequence-button:hover { border-color:var(--brand); }
.sequence-button[aria-pressed=true] { border:2px solid var(--brand); padding:2px; background:var(--selection); }
.comparison-file-error { text-align:center; padding:24px 58px; font-size:14px; }
.comparison-file-error p { margin-bottom:15px; }
@media(max-width:1000px) {
  .account-text { display:none; }
}
@media(max-width:700px) {
  .app-header-inner { display:grid; grid-template-columns:minmax(0,1fr) auto; gap:4px 12px; }
  .patient-context { grid-column:1; grid-row:1; }
  .header-actions { display:contents; }
  .account { grid-column:2; grid-row:1; }
  .viewer-controls { grid-column:1 / -1; grid-row:2; justify-self:end; padding-block:4px; }
  .account .button { min-height:36px; padding:8px; font-size:12px; white-space:nowrap; }
  .patient-context, .patient-detail { gap:6px; }
  .patient-home { font-size:16px; }
  .comparison-patient { gap:0; flex-direction:column; align-items:flex-start; }
  .comparison-patient h1 { max-width:100%; font-size:16px; }
  .comparison-patient .patient-meta { max-width:100%; font-size:11px; }
  .patient-chart-link { flex-direction:row; align-items:center; justify-content:space-between; gap:10px; padding:0 8px; }
  .patient-chart-action { font-size:11px; }
  .app-header-inner:has(.patient-detail:not([hidden])) .patient-context { grid-column:1 / -1; }
  .app-header-inner:has(.patient-detail:not([hidden])) .account { grid-column:2; grid-row:2; }
  .app-header-inner:has(.patient-detail:not([hidden])) .viewer-controls { grid-column:1; grid-row:2; justify-self:start; padding-block:0; }
  .comparison-panels { gap:10px; }
  .comparison-panel { padding:6px; border-radius:12px; }
  .patients-main { padding-block:16px; }
  .patient-toolbar { padding:16px; }
  .patient-list-heading,.patient-row { grid-template-columns:minmax(0,1fr) 64px 12px; gap:12px; padding-inline:16px; }
  .patient-row-identity { gap:10px; }
  .patient-avatar { width:32px; height:32px; border-radius:10px; }
  .patient-name { font-size:14px; }
  .patient-chart { font-size:12px; }
  .login-panel { padding:28px 24px; }
  .encounter-select { font-size:13px; padding-left:8px; }
  .comparison-stage { height:clamp(230px,45dvh,430px); }
  .photo-step { width:30px; height:46px; }
  .photo-step.previous { left:5px; }
  .photo-step.next { right:5px; }
  .photo-step span { font-size:30px; }
  .photo-loading,.photo-empty { padding:15px 24px; font-size:12px; gap:12px; }
  .comparison-notice { font-size:11px; }
  .sequence-button { flex-basis:44px; width:44px; height:44px; }
  .photo-sequence { gap:6px; }
  .comparison-file-error { padding:12px 32px; font-size:12px; }
  .comparison-file-error .button { padding:8px; font-size:12px; }
}
@media(max-width:380px) {
  .login-heading { gap:8px; }
  .login-heading img { width:32px; height:32px; }
}
