.session-notice { margin-bottom: 18px; padding: 16px; border: 1px solid #e5cf9b; border-radius: 10px; background: #fff9ec; color: #674e21; }
.session-notice p { margin: 0 0 12px; line-height: 1.6; }
.session-notice .button { margin: 0 8px 6px 0; }
[data-consultation-only][hidden], #registration-access-notice[hidden] { display: none !important; }

:root {
  font-family: "DM Sans", "Avenir Next", Avenir, sans-serif;
  color: #172d3c;
  background: #f6f8fb;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
  --navy: #153c4c;
  --teal: #167d78;
  --muted: #75858e;
  --line: #e5ebee;
  --soft: #f7f9fa;
}

* { box-sizing: border-box; }
body { margin: 0; min-width: 320px; background: #f6f8fb; }
button, input, select, textarea { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }

.topbar {
  height: 68px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 max(28px, calc((100vw - 1320px) / 2));
  background: #fff;
  border-bottom: 1px solid #e8edef;
}
.brand { display: flex; align-items: center; gap: 11px; text-decoration: none; color: #183541; font-weight: 700; letter-spacing: -.25px; }
.brand-logo { display: block; width: 36px; height: 50px; object-fit: contain; border-radius: 4px; }
.ocr-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 12px; margin: 3px 0 12px; }
.ocr-actions > span, .ocr-status { color: #657982; font-size: 12px; line-height: 1.5; }
.ocr-status:empty { display: none; }
.ocr-status[data-error="true"] { color: #b74842; }
.ocr-review-dialog { width: min(480px, calc(100% - 28px)); padding: 26px; border: 1px solid #dce5e8; border-radius: 14px; color: #183441; }
.ocr-review-dialog::backdrop { background: rgba(15, 38, 48, .5); }
.ocr-review-dialog p { font-size: 13px; line-height: 1.6; color: #657982; }
.ocr-review-dialog .field { margin-top: 14px; }
.ocr-review-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 10px; margin-top: 22px; }
.local-records-notice { margin: 12px 0; padding: 12px; border: 1px solid #dce5e8; border-radius: 8px; font-size: 12px; line-height: 1.5; }
.local-records-notice .button { margin: 5px 0; }
.history-panel-link { display: inline-block; margin: 8px 0; color: #167d78; font-size: 12px; }
.brand-separator { margin: 0 4px; color: #b7c3c7; font-weight: 400; }
.topbar-note { display: flex; align-items: center; gap: 9px; color: #788890; font-size: 12px; font-weight: 600; }
.logout-button { margin-left: 8px; padding: 6px 10px; border: 1px solid #dce8e8; border-radius: 7px; color: #47716f; text-decoration: none; font-size: 11px; font-weight: 700; }
.logout-button:hover { background: #f3f8f7; }
.live-dot { width: 7px; height: 7px; border-radius: 99px; background: #39a58e; box-shadow: 0 0 0 3px #e5f4ef; }
.page-shell { width: min(1320px, calc(100% - 56px)); margin: 38px auto 0; }
.page-intro { display: flex; justify-content: space-between; align-items: end; gap: 24px; margin-bottom: 23px; }
.intro-actions { display: flex; align-items: center; gap: 10px; }
.button-print { min-height: 42px; border-color: #dce8e8; background: #fff; color: #326966; }
.button-print:hover { background: #f3f8f7; }
.button-print svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.eyebrow { margin: 0 0 8px; font-size: 10px; line-height: 1.2; letter-spacing: 1.35px; font-weight: 700; color: #799099; }
h1, h2 { font-family: "Avenir Next", Avenir, sans-serif; }
h1 { margin: 0; font-size: clamp(26px, 3vw, 34px); line-height: 1.2; letter-spacing: -1.2px; color: #183441; }
.intro-copy { margin: 8px 0 0; color: #788890; font-size: 14px; }
.record-count { display: flex; align-items: baseline; gap: 8px; padding: 11px 15px; border: 1px solid #e2e9eb; border-radius: 10px; background: #fff; color: #829099; font-size: 12px; white-space: nowrap; }
.record-count span:first-child { font-family: "Avenir Next", Avenir, sans-serif; color: var(--navy); font-size: 19px; font-weight: 800; }
.privacy-note { display: flex; align-items: flex-start; gap: 12px; padding: 13px 16px; margin-bottom: 18px; border: 1px solid #ecdcb8; border-radius: 10px; background: #fffaf0; color: #786843; font-size: 12px; line-height: 1.55; }
.privacy-note strong { color: #63532f; }
.notice-icon { display: grid; place-items: center; width: 18px; height: 18px; flex: none; margin-top: 1px; border-radius: 50%; background: #f0dfb9; color: #725b28; font: 700 12px "Avenir Next", Avenir, sans-serif; }
.workspace-grid { display: grid; grid-template-columns: minmax(0, 1.62fr) minmax(310px, .9fr); gap: 18px; align-items: start; }
.panel { background: #fff; border: 1px solid #e5ebee; border-radius: 13px; box-shadow: 0 4px 15px rgba(28, 57, 70, .025); }
.form-panel { padding: 25px 27px 23px; }
.panel-heading { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 23px; }
.panel-heading .eyebrow { margin-bottom: 6px; }
h2 { margin: 0; font-size: 18px; line-height: 1.35; letter-spacing: -.4px; color: #203b47; }
.required-hint { font-size: 11px; color: #849199; }
.required-hint span, .field b, .fieldset legend b { color: #ca6660; font-weight: 700; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 17px 16px; }
.field { display: flex; flex-direction: column; gap: 7px; min-width: 0; color: #425660; font-size: 12px; font-weight: 600; }
.field input, .field select, .field textarea, .fundus-field select, .fundus-description, .opacity-item select, .biometry-row > input {
  width: 100%; min-width: 0; border: 1px solid #dce5e8; border-radius: 7px; background: #fff; color: #344d58; outline: none; transition: border-color .16s, box-shadow .16s; font-size: 13px;
}
.field input, .field select, .fundus-field select, .fundus-description, .opacity-item select, .biometry-row > input { height: 39px; padding: 0 11px; }
.field textarea { resize: vertical; min-height: 72px; padding: 10px 11px; line-height: 1.5; }
.field input::placeholder, .field textarea::placeholder, .fundus-description::placeholder { color: #a2afb4; font-weight: 400; }
.field input:focus, .field select:focus, .field textarea:focus, .fundus-field select:focus, .fundus-description:focus, .opacity-item select:focus, .biometry-row > input:focus { border-color: #56a29b; box-shadow: 0 0 0 3px rgba(22, 125, 120, .1); }
.field input:disabled, select:disabled { color: #9ba8ae; background: #f7f9fa; }
.section-divider { height: 1px; background: #edf1f2; margin: 21px 0; }
.fieldset { min-width: 0; margin: 0; padding: 0; border: 0; }
.clinical-fields { min-width: 0; margin: 0; padding: 0; border: 0; }
.clinical-fields:disabled { opacity: .58; }
.fields-lock-note { margin: 14px 0 17px; padding: 10px 12px; border: 1px solid #ecdcb8; border-radius: 8px; background: #fffaf0; color: #786843; font-size: 12px; line-height: 1.45; }
.fieldset legend { margin-bottom: 12px; padding: 0; color: #425660; font-size: 12px; font-weight: 600; }
.opacity-grid { display: flex; align-items: center; flex-wrap: wrap; gap: 13px 18px; }
.opacity-item { display: flex; align-items: center; gap: 9px; }
.check-label { display: inline-flex; align-items: center; gap: 7px; color: #586b74; font-size: 12px; font-weight: 600; white-space: nowrap; }
.check-label input, .radio-option input { accent-color: var(--teal); width: 15px; height: 15px; margin: 0; }
.opacity-item select { width: 79px; height: 34px; padding: 0 8px; }
.total-check { margin-left: 1px; }
.usg-grid { display: flex; align-items: center; flex-wrap: wrap; gap: 14px 22px; }
.usg-cupping { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 12px; min-width: 250px; margin: 0; padding: 0; border: 0; }
.usg-radio-row { display: flex; align-items: center; gap: 13px; }
.inline-validation-error { flex-basis: 100%; margin: 0 0 0 22px; color: #b64d47; font-size: 11px; line-height: 1.4; font-weight: 500; }
.observation-field { margin-top: 17px; }
.fundus-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; align-items: end; }
.fundus-field { display: flex; flex-direction: column; gap: 7px; min-width: 0; }
.field-label { color: #586b74; font-size: 12px; font-weight: 600; }
.fundus-field select { height: 37px; }
.fundus-description { height: 35px; font-size: 12px; }
.impossible-check { grid-column: 1 / -1; margin-top: 1px; }
.fundus-validation-error { grid-column: 1 / -1; margin-left: 0; }
.conditional-field { margin-top: 13px; }
.biometry-field { display: block; }
.biometry-field legend { margin-bottom: 11px; }
.biometry-row { display: flex; align-items: center; gap: 11px; }
.radio-option { display: inline-flex; align-items: center; gap: 5px; color: #62747c; font-size: 13px; }
.biometry-row > input { flex: 1; text-align: center; }
.date-field { justify-content: end; }
.date-field > label { color: #425660; }
.field-hint { margin: 1px 0 0; color: #9a6733; font-size: 11px; line-height: 1.4; font-weight: 500; }
.form-actions { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-top: 23px; padding-top: 17px; border-top: 1px solid #edf1f2; }
.button { display: inline-flex; align-items: center; justify-content: center; gap: 12px; min-height: 39px; padding: 0 15px; border: 1px solid transparent; border-radius: 7px; text-decoration: none; cursor: pointer; transition: transform .14s, background .14s, border-color .14s; font-size: 12px; font-weight: 700; }
.button:hover { transform: translateY(-1px); }
.button-primary { min-width: 160px; background: var(--navy); color: white; }
.button-primary:hover { background: #204f60; }
.button-primary:disabled { opacity: .65; cursor: wait; transform: none; }
.button-secondary { background: white; border-color: #dfe7e9; color: #64757d; }
.button-secondary:hover { background: #f7f9fa; }
.form-error { margin-top: 15px; padding: 10px 12px; border-radius: 7px; background: #fff1f0; color: #a74843; font-size: 12px; line-height: 1.5; }
.save-feedback { margin-top: 15px; padding: 12px; border: 1px solid #b8d9d4; border-radius: 7px; background: #edf8f4; color: #214e49; font-size: 13px; line-height: 1.6; }
.save-feedback a { color: #125b55; font-weight: 700; text-underline-offset: 3px; }
.surgery-date-control { display: flex; align-items: center; gap: 8px; }
.surgery-date-control input { flex: 1; min-width: 0; }
.open-calendar-button { min-height: 39px; white-space: nowrap; }
.side-column { display: grid; gap: 18px; }
.result-panel, .records-panel { padding: 20px; }
.compact-heading { margin-bottom: 15px; }
.compact-heading h2 { font-size: 16px; }
.button-small { min-height: 32px; padding: 0 12px; background: #f0f5f5; border-color: #e1ebea; color: #3e6c6a; font-size: 11px; }
.button-small:hover { background: #e4efed; }
.result-preview { min-height: 170px; max-height: 360px; overflow: auto; margin: 0; padding: 13px; border: 1px solid #e8eef0; border-radius: 8px; background: #f8fafb; color: #50646d; white-space: pre-wrap; overflow-wrap: anywhere; font: 11px/1.7 "DM Sans", "Avenir Next", Avenir, sans-serif; }
.copy-status { min-height: 14px; margin: 7px 1px 0; color: var(--teal); font-size: 11px; }
.records-heading { margin-bottom: 13px; }
.count-pill { display: grid; place-items: center; min-width: 27px; height: 27px; padding: 0 7px; border-radius: 20px; background: #edf5f3; color: #24786f; font-size: 11px; font-weight: 700; }
.export-actions { display: flex; gap: 8px; margin-bottom: 14px; }
.button-export { flex: 1; min-height: 34px; padding: 0 10px; border-color: #e0e9e9; background: white; color: #47716f; font-size: 11px; }
.button-export:hover { background: #f4f9f8; }
.records-list { display: grid; gap: 9px; max-height: 530px; overflow: auto; }
.empty-state { display: flex; min-height: 140px; flex-direction: column; align-items: center; justify-content: center; color: #829099; text-align: center; }
.empty-icon { display: grid; place-items: center; width: 32px; height: 32px; margin-bottom: 9px; border-radius: 10px; background: #f0f5f5; color: #52837e; font-size: 22px; font-weight: 400; }
.empty-state p { margin: 0 0 5px; color: #5e7179; font-size: 12px; font-weight: 700; }
.empty-state > span:last-child { font-size: 11px; }
.record-card { padding: 12px; border: 1px solid #e6edef; border-radius: 8px; background: #fff; }
.record-card-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; }
.record-title { margin: 0; color: #284652; font-size: 12px; font-weight: 700; }
.record-date { margin: 4px 0 0; color: #89969c; font-size: 10px; }
.record-detail { margin: 9px 0 0; color: #62747c; font-size: 11px; }
.record-summary { display: block; margin-top: 7px; color: #76878d; font-size: 10px; line-height: 1.4; }
.delete-record { flex: none; border: 0; padding: 3px 5px; background: transparent; color: #a87875; cursor: pointer; font-size: 10px; }
.delete-record:hover { color: #a33e38; text-decoration: underline; }
.page-footer { padding: 23px 0 30px; text-align: center; color: #9aa6ab; font-size: 10px; }
.page-footer span { margin: 0 5px; }
.toast { position: fixed; right: 24px; bottom: 24px; z-index: 2; max-width: min(400px, calc(100% - 40px)); padding: 12px 16px; border-radius: 9px; background: #1b404c; color: white; box-shadow: 0 8px 26px #132e3a2b; font-size: 12px; opacity: 0; transform: translateY(8px); pointer-events: none; transition: .2s; }
.toast.show { opacity: 1; transform: translateY(0); }
.is-hidden { display: none !important; }

@media (max-width: 920px) {
  .workspace-grid { grid-template-columns: minmax(0, 1.3fr) minmax(280px, .9fr); gap: 13px; }
  .form-panel { padding: 21px 19px; }
  .fundus-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .impossible-check { grid-column: auto; align-self: end; min-height: 37px; }
  .opacity-grid { gap: 12px; }
  .usg-grid { gap: 12px 16px; }
}
@media (max-width: 740px) {
  .topbar { height: 60px; padding: 0 18px; }
  .topbar-note { font-size: 0; gap: 0; }
  .live-dot { width: 8px; height: 8px; }
  .page-shell { width: min(100% - 32px, 590px); margin-top: 27px; }
  .page-intro { align-items: start; }
  .record-count { flex-direction: column; gap: 0; padding: 8px 10px; font-size: 10px; }
  .record-count span:first-child { font-size: 17px; }
  .workspace-grid { grid-template-columns: 1fr; }
  .side-column { grid-row: auto; }
  .result-preview { min-height: 145px; }
}
@media (max-width: 480px) {
  .page-shell { width: calc(100% - 24px); margin-top: 21px; }
  .page-intro { gap: 9px; }
  .intro-actions { flex-direction: column-reverse; align-items: end; gap: 7px; }
  .button-print { min-height: 35px; padding: 0 9px; gap: 6px; font-size: 10px; }
  h1 { font-size: 25px; }
  .intro-copy { max-width: 260px; font-size: 12px; line-height: 1.5; }
  .record-count { align-self: end; }
  .privacy-note { padding: 11px; font-size: 11px; }
  .form-panel { padding: 18px 15px; }
  .panel-heading { align-items: flex-start; }
  .form-grid { grid-template-columns: 1fr; gap: 14px; }
  .fundus-grid { grid-template-columns: 1fr; }
  .impossible-check { min-height: auto; }
  .opacity-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 11px 7px; }
  .opacity-item { justify-content: space-between; gap: 5px; }
  .opacity-item select { width: 66px; }
  .total-check { min-height: 34px; }
  .form-actions { align-items: stretch; }
  .form-actions .button { padding: 0 10px; }
  .button-primary { min-width: 145px; }
  .result-panel, .records-panel { padding: 16px; }
}

@media print {
  @page { size: A4 portrait; margin: 12mm; }
  :root, body { background: #fff !important; color: #182d36; }
  body { min-width: 0; font-size: 10pt; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .topbar, .privacy-note, .button-print, .form-actions, #copy-result, .copy-status, .export-actions, .delete-record, .toast, .ocr-actions, .ocr-status, .history-panel-link, .local-records-notice, .ocr-review-dialog { display: none !important; }
  .page-shell { width: 100%; margin: 0; }
  .page-intro { margin-bottom: 12px; align-items: end; }
  h1 { font-size: 23pt; }
  .intro-copy { margin-top: 4px; font-size: 9pt; }
  .intro-actions { display: block; }
  .record-count { padding: 6px 9px; border-color: #d8e0e3; font-size: 8pt; }
  .workspace-grid { display: grid; grid-template-columns: 1fr; gap: 10px; }
  .panel { box-shadow: none; border-color: #dce4e7; border-radius: 6px; break-inside: auto; }
  .form-panel, .result-panel, .records-panel { padding: 14px; }
  .panel-heading { margin-bottom: 12px; }
  h2 { font-size: 13pt; }
  .form-grid { gap: 10px 12px; }
  .field { gap: 4px; font-size: 9pt; }
  .field input, .field select, .field textarea, .fundus-field select, .fundus-description, .opacity-item select, .biometry-row > input {
    min-height: 27px; height: auto; padding: 4px 6px; border-color: #d8e0e3; border-radius: 3px; box-shadow: none !important; color: #263c45; font-size: 9pt;
  }
  .field textarea { min-height: 42px; }
  .save-feedback { display: none !important; }
  .open-calendar-button { display: none !important; }
  .section-divider { margin: 12px 0; }
  .fieldset legend, .field-label, .check-label { font-size: 9pt; }
  .opacity-grid { gap: 8px 13px; }
  .opacity-item select { min-height: 24px; }
  .fundus-grid { gap: 9px; }
  .biometry-row { gap: 7px; }
  .result-preview { min-height: 0; max-height: none; overflow: visible; padding: 8px; font-size: 9pt; }
  .side-column { display: grid; grid-template-columns: 1fr; gap: 10px; }
  .records-list { max-height: none; overflow: visible; }
  .record-card { padding: 8px; break-inside: avoid; }
  .record-title { font-size: 9pt; }
  .record-date, .record-detail, .record-summary { font-size: 8pt; }
  .page-footer { padding: 12px 0 0; font-size: 8pt; }
  input, select, textarea { color: #263c45 !important; }
}
