:root {
  color-scheme: light;
  --bg: #f7f8fc;
  --surface: #fff;
  --surface-soft: #f2f4fb;
  --navy: #101d3f;
  --muted: #6f7890;
  --line: #e6e9f2;
  --blue: #4269e1;
  --blue-soft: #edf1ff;
  --violet: #8068e8;
  --violet-soft: #f1edff;
  --green: #37aa69;
  --green-soft: #e8f8ef;
  --orange: #e99a2f;
  --orange-soft: #fff4e2;
  --red: #d94e5d;
  --red-soft: #feeaed;
  --shadow: 0 7px 24px rgba(27, 43, 86, .07);
  --radius: 18px;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Inter", "Segoe UI", sans-serif;
}
* { box-sizing: border-box; min-width: 0; }
html, body { margin: 0; min-height: 100%; max-width: 100%; background: var(--bg); color: var(--navy); }
body { min-height: 100dvh; overflow: hidden; }
button, input { font: inherit; }
button { color: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button:focus-visible, a:focus-visible, input:focus-visible, summary:focus-visible { outline: 3px solid rgba(66,105,225,.35); outline-offset: 2px; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.eyebrow { margin: 0 0 5px; color: var(--blue); font-size: 12px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; }
.app { display: grid; grid-template-columns: 232px 350px minmax(0, 1fr); height: 100dvh; }
.sidebar { border-right: 1px solid var(--line); background: rgba(250,251,255,.96); padding: 28px 20px max(24px, env(safe-area-inset-bottom)); display: flex; flex-direction: column; }
.brand { display: flex; align-items: center; gap: 10px; margin: 0 8px 40px; font-size: 21px; }
.brand img { width: 42px; height: 42px; }
.brand span, .mobile-header strong span { color: var(--blue); font-size: 12px; }
.sidebar nav { display: grid; gap: 8px; }
.nav { min-height: 48px; padding: 0 14px; border: 0; border-radius: 13px; background: transparent; display: flex; align-items: center; gap: 12px; color: var(--muted); cursor: pointer; text-align: left; }
.nav:hover { background: #f2f4fb; color: var(--navy); }
.nav.active { background: linear-gradient(100deg, #e9edff, #f0ecff); color: #345dd4; font-weight: 650; }
.nav .badge { margin-left: auto; }
.account { margin-top: auto; padding: 16px 6px 0; border-top: 1px solid var(--line); display: flex; align-items: center; gap: 10px; min-width: 0; }
.account div:last-child { min-width: 0; display: grid; }
.account strong { overflow: hidden; text-overflow: ellipsis; font-size: 12px; }
.account small { color: var(--muted); }
.patient-rail { overflow: hidden; background: #fbfcff; border-right: 1px solid var(--line); padding: 28px 16px; display: flex; flex-direction: column; }
.rail-heading { display: flex; justify-content: space-between; align-items: center; padding: 0 4px 18px; }
.rail-heading h2 { margin: 0; font-size: 21px; }
.icon-button { width: 42px; height: 42px; border: 1px solid var(--line); background: var(--surface); border-radius: 12px; display: inline-grid; place-items: center; cursor: pointer; position: relative; }
.icon-button:hover { border-color: #cbd3ea; }
.search-box { height: 44px; border: 1px solid var(--line); border-radius: 13px; background: var(--surface); display: flex; align-items: center; gap: 9px; padding: 0 12px; margin-bottom: 14px; }
.search-box input { border: 0; outline: 0; background: transparent; width: 100%; color: var(--navy); }
.search-box input::placeholder { color: #9aa2b5; }
.patient-list { overflow-y: auto; padding: 1px 4px 80px; scrollbar-width: thin; }
.patient-card { width: 100%; padding: 15px; border: 1px solid var(--line); border-radius: 16px; background: var(--surface); box-shadow: 0 3px 13px rgba(26,42,82,.035); margin-bottom: 11px; cursor: pointer; text-align: left; }
.patient-card:hover, .patient-card.active { border-color: #6e89ea; box-shadow: 0 7px 20px rgba(55,85,175,.1); }
.patient-card-head { display: grid; grid-template-columns: 46px minmax(0,1fr); gap: 11px; align-items: center; }
.patient-card h3 { margin: 0 0 4px; font-size: 15px; overflow-wrap: anywhere; }
.meta { color: var(--muted); font-size: 12px; }
.patient-card .diagnosis { margin: 10px 0 8px; font-size: 13px; font-weight: 600; line-height: 1.4; min-height: 18px; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.card-foot { display: flex; justify-content: space-between; gap: 6px; align-items: flex-end; }
.latest { margin-top: 9px; color: var(--muted); font-size: 11px; line-height: 1.35; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.pill { display: inline-flex; align-items: center; gap: 5px; max-width: 100%; border-radius: 999px; padding: 4px 8px; font-size: 10px; font-weight: 650; line-height: 1.2; }
.pill::before { content: ""; width: 6px; height: 6px; flex: 0 0 6px; border-radius: 50%; background: currentColor; }
.pill.ready, .pill.active { color: var(--green); background: var(--green-soft); }
.pill.processing { color: var(--blue); background: var(--blue-soft); }
.pill.review { color: var(--orange); background: var(--orange-soft); }
.workspace { overflow-y: auto; min-width: 0; padding: 28px clamp(22px,3vw,52px) 70px; scroll-behavior: smooth; }
.welcome-state { height: 100%; display: grid; place-content: center; justify-items: center; text-align: center; color: var(--muted); }
.welcome-state img { width: 92px; margin-bottom: 15px; }
.welcome-state h1 { color: var(--navy); margin: 0 0 8px; }
.welcome-state p { max-width: 430px; margin: 0; line-height: 1.55; }
.content { max-width: 920px; margin: 0 auto; }
.back-button { border: 0; background: transparent; color: var(--blue); padding: 5px 0 15px; cursor: pointer; }
.dossier-back { display: block; min-height: 42px; padding: 8px 2px 10px; }
.dossier-header { background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow); border-radius: 22px; overflow: hidden; }
.dossier-person { display: grid; grid-template-columns: 72px minmax(0,1fr) auto; gap: 18px; align-items: center; padding: 22px; }
.dossier-person h1 { font-size: clamp(22px,2.4vw,30px); margin: 0 0 7px; }
.person-meta { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; color: var(--muted); font-size: 13px; }
.patient-id { border: 0; background: var(--surface-soft); color: var(--blue); border-radius: 8px; padding: 4px 7px; font-size: 11px; cursor: pointer; max-width: 100%; overflow-wrap: anywhere; }
.header-status { align-self: start; }
.update-strip { display: flex; gap: 30px; flex-wrap: wrap; border-top: 1px solid var(--line); background: #fbfcff; padding: 12px 22px; color: var(--muted); font-size: 12px; }
.update-strip strong { color: var(--navy); margin-left: 5px; }
.action-grid { display: grid; grid-template-columns: repeat(3,1fr); gap: 12px; margin: 16px 0; }
.action-card { min-height: 76px; background: var(--surface); border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow); display: flex; align-items: center; justify-content: center; gap: 10px; padding: 12px; font-weight: 650; cursor: pointer; }
.action-card:hover { border-color: #c3ccec; transform: translateY(-1px); }
.module-icon { width: 42px; height: 42px; flex: 0 0 auto; display: grid; place-items: center; border-radius: 12px; background: var(--blue-soft); }
.module-icon img { display: block; width: 29px; height: 29px; }
.module-icon-radiology { background: var(--violet-soft); }
.module-icon-documents { background: var(--green-soft); }
.clinical-card { margin: 12px 0; border: 1px solid var(--line); background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.clinical-card[open] > summary { border-bottom: 1px solid #eff1f7; }
.clinical-card summary { list-style: none; cursor: pointer; padding: 16px 18px; display: flex; align-items: center; gap: 10px; font-weight: 700; color: #17316f; }
.clinical-card summary::-webkit-details-marker { display: none; }
.clinical-card summary::after { content: "⌃"; margin-left: auto; color: #8490aa; }
.clinical-card:not([open]) summary::after { content: "⌄"; }
.section-icon { width: 30px; height: 30px; flex: 0 0 30px; border-radius: 9px; display: grid; place-items: center; }
.section-icon img { width: 30px; height: 30px; display: block; }
.source-page-range { outline: 2px solid rgba(75,111,222,.22); outline-offset: 3px; border-radius: 5px; }
.clinical-body { padding: 16px 18px 18px; line-height: 1.58; font-size: 14px; }
.clinical-body p { margin: 0 0 10px; }
.clinical-body p:last-child { margin-bottom: 0; }
.clinical-body .lead { font-size: 15px; font-weight: 650; line-height: 1.48; overflow-wrap: anywhere; }
.event-row { border-bottom: 1px solid #eff1f7; padding: 11px 0; display: grid; gap: 5px; }
.event-row:last-child { border-bottom: 0; padding-bottom: 0; }
.event-date { display: block; color: var(--muted); font-size: 12px; line-height: 1.35; }
.event-summary { display: block; line-height: 1.5; overflow-wrap: anywhere; }
.detail-list { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 7px 18px; margin-top: 7px; }
.detail-list div { display: grid; gap: 3px; font-size: 13px; }
.detail-list b { color: var(--muted); font-weight: 500; }
.empty-copy { color: var(--muted); font-style: italic; }
.warning-card { border-color: #f4d2a2; }
.warning-card summary { color: #a76a16; }
.subpage-head { display: flex; align-items: center; justify-content: space-between; gap: 15px; margin-bottom: 18px; }
.subpage-head h1 { margin: 0; font-size: 28px; }
.timeline { position: relative; margin-left: 13px; padding-left: 34px; }
.timeline::before { content: ""; position: absolute; left: 8px; top: 8px; bottom: 8px; width: 2px; background: #dfe5f5; }
.timeline-year { position: relative; z-index: 1; width: max-content; margin: 24px 0 12px -34px; padding: 3px 9px; border: 1px solid var(--line); border-radius: 999px; background: var(--bg); font-size: 12px; color: var(--muted); }
.timeline-event { position: relative; background: var(--surface); border: 1px solid var(--line); border-radius: 15px; padding: 14px 16px; margin-bottom: 12px; }
.timeline-event::before { content: ""; position: absolute; width: 14px; height: 14px; border: 4px solid var(--blue-soft); background: var(--blue); border-radius: 50%; left: -35px; top: 18px; }
.timeline-event[data-kind="morphology"]::before { background: var(--violet); }
.timeline-event[data-kind="surgery"]::before { background: var(--orange); }
.timeline-event[data-kind="radiology"]::before { background: var(--green); }
.timeline-event h3 { margin: 4px 0 6px; font-size: 15px; }
.timeline-event .category { color: var(--blue); font-size: 11px; font-weight: 700; }
.meta-chips { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 8px; }
.meta-chip { max-width: 100%; padding: 4px 7px; border-radius: 999px; background: var(--surface-soft); color: var(--muted); font-size: 11px; overflow-wrap: anywhere; }
.event-more { margin-top: 9px; border-top: 1px solid #eff1f7; padding-top: 8px; }
.event-more summary { color: var(--blue); cursor: pointer; font-size: 12px; font-weight: 650; }
.event-more p { font-size: 13px; line-height: 1.5; }
.timeline-extra { display: grid; gap: 9px; padding-top: 9px; }
.timeline-extra > div { display: grid; gap: 3px; }
.timeline-extra b { color: var(--muted); font-size: 11px; font-weight: 650; }
.timeline-extra span { font-size: 13px; line-height: 1.5; overflow-wrap: anywhere; }
.radiology-year { margin: 20px 0 9px; color: var(--muted); font-size: 13px; font-weight: 700; }
.report-card { background: var(--surface); border: 1px solid var(--line); border-radius: 18px; padding: 16px 17px; box-shadow: var(--shadow); margin-bottom: 11px; }
.report-card h2 { font-size: 16px; margin: 5px 0 8px; line-height: 1.35; }
.radiology-card-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.radiology-date { color: var(--muted); font-size: 12px; font-weight: 650; }
.radiology-impression { margin: 0; color: #25314d; font-size: 14px; font-weight: 580; line-height: 1.52; overflow-wrap: anywhere; }
.radiology-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 13px; }
.radiology-actions .button { min-height: 38px; }
.radiology-unavailable { color: var(--muted); font-size: 12px; }
.ai-badge { display: inline-flex; width: max-content; padding: 3px 7px; border-radius: 999px; color: #6550c8; background: var(--violet-soft); font-size: 10px; font-weight: 750; letter-spacing: .01em; }
.radiology-chips { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 10px; }
.radiology-chip { padding: 4px 8px; border-radius: 999px; background: var(--blue-soft); color: #3559bd; font-size: 10px; font-weight: 700; }
.radiology-more { margin-top: 11px; border-top: 1px solid #edf0f6; padding-top: 9px; }
.radiology-more > summary { width: max-content; color: var(--blue); cursor: pointer; list-style: none; font-size: 12px; font-weight: 700; }
.radiology-more > summary::-webkit-details-marker { display: none; }
.radiology-more > summary::after { content: " ›"; }
.radiology-more[open] > summary::after { content: " ⌃"; }
.radiology-expanded { display: grid; gap: 12px; padding-top: 11px; }
.ai-compact { border-left: 3px solid #b4a6f2; padding-left: 10px; }
.radiology-detail-row { margin-top: 8px; }
.radiology-detail-row b { color: var(--muted); font-size: 11px; }
.radiology-detail-row p { margin: 3px 0 0; font-size: 13px; line-height: 1.5; overflow-wrap: anywhere; }
.source-report { border-top: 1px solid var(--line); padding-top: 11px; }
.source-report summary { color: var(--navy); cursor: pointer; font-size: 13px; font-weight: 700; }
.source-report[open] summary { margin-bottom: 10px; }
.source-report pre { white-space: pre-wrap; overflow-wrap: anywhere; font: inherit; line-height: 1.55; margin: 0; color: #29344f; }
.radiology-source-link { justify-self: start; min-height: 38px; padding: 0; border: 0; background: transparent; color: var(--blue); cursor: pointer; font-size: 12px; font-weight: 650; }
.document-grid { display: grid; grid-template-columns: repeat(auto-fill,minmax(220px,1fr)); gap: 13px; }
.document-card { border: 1px solid var(--line); background: var(--surface); border-radius: 16px; padding: 16px; min-height: 145px; cursor: pointer; text-align: left; }
.document-card:hover { border-color: #adbbe9; }
.document-card.unavailable { cursor: default; opacity: .72; }
.document-card strong, .document-card p { max-width: 100%; overflow-wrap: anywhere; }
.document-icon { width: 45px; height: 54px; display: grid; place-items: center; border-radius: 9px; background: var(--green-soft); color: var(--green); font-weight: 800; margin-bottom: 15px; }
.document-index { display: flex; gap: 7px; overflow-x: auto; max-width: 100%; padding: 1px 1px 12px; margin-bottom: 4px; scrollbar-width: thin; }
.document-index button { flex: 0 0 auto; max-width: min(72vw, 280px); min-height: 38px; border: 1px solid var(--line); border-radius: 999px; padding: 7px 12px; background: var(--surface); color: var(--blue); font-size: 12px; font-weight: 650; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; cursor: pointer; }
.document-reader { display: grid; gap: 18px; }
.document-section { scroll-margin-top: 76px; border: 1px solid var(--line); border-radius: 18px; background: #eef1f6; box-shadow: var(--shadow); overflow: clip; }
.document-section-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 14px 16px; background: rgba(255,255,255,.97); border-bottom: 1px solid var(--line); }
.document-section-head h2 { margin: 0 0 4px; font-size: 17px; }
.document-section-head p { margin: 0; }
.document-original { color: var(--blue); font-size: 11px; line-height: 1.35; text-decoration: none; text-align: right; max-width: 210px; }
.document-body { padding: 12px; }
.document-page { position: relative; width: min(100%, 820px); margin: 0 auto 12px; }
.document-page:last-child { margin-bottom: 0; }
.document-page-open { display: block; width: 100%; padding: 0; border: 0; border-radius: 4px; overflow: hidden; background: linear-gradient(110deg,#e6e9f0 25%,#f2f4f8 38%,#e6e9f0 52%); background-size: 220% 100%; animation: document-placeholder 1.5s ease-in-out infinite; box-shadow: 0 3px 13px rgba(21,34,68,.12); cursor: zoom-in; }
.document-page-open.dimensions-pending { min-height: 180px; }
.document-page-open.loaded, .document-page-open:has(img[src]) { animation: none; background: #fff; }
.document-page img { display: block; width: 100%; height: auto; object-fit: contain; object-position: top center; background: #fff; }
.document-page figcaption { position: absolute; right: 7px; bottom: 7px; padding: 3px 7px; border-radius: 999px; background: rgba(16,29,63,.76); color: #fff; font-size: 10px; backdrop-filter: blur(5px); }
.native-pdf-frame { display: block; width: 100%; height: min(82dvh,900px); border: 0; background: #fff; }
.document-loading { min-height: 240px; display: grid; place-content: center; justify-items: center; gap: 12px; color: var(--muted); font-size: 12px; text-align: center; }
.loading-pulse { width: 36px; height: 36px; border-radius: 50%; background: var(--blue-soft); box-shadow: 0 0 0 0 rgba(66,105,225,.25); animation: loading-pulse 1.5s infinite; }
.docx-preview-host { width: min(100%,820px); margin: 0 auto; background: #fff; border-radius: 6px; box-shadow: 0 3px 13px rgba(21,34,68,.1); overflow: hidden; }
.docx-preview { padding: clamp(22px,5vw,52px); color: #26324e; font-family: Arial,-apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif; font-size: 14px; line-height: 1.58; overflow-wrap: anywhere; }
.docx-preview h1 { margin: 0 0 24px; color: #1f4e79; font-size: clamp(22px,4vw,30px); text-align: center; }
.docx-preview h2 { margin: 27px 0 10px; padding-bottom: 6px; border-bottom: 2px solid #9cc2e5; color: #1f4e79; font-size: 18px; }
.docx-preview h3 { margin: 20px 0 7px; color: #315f89; font-size: 15px; }
.docx-preview p { margin: 0 0 9px; }
.docx-preview ul { margin: 5px 0 12px; padding-left: 22px; }
.docx-preview li { margin-bottom: 5px; }
.docx-table-wrap { max-width: 100%; overflow-x: auto; margin: 14px 0; }
.docx-preview table { width: 100%; border-collapse: collapse; font-size: 13px; }
.docx-preview td { min-width: 110px; padding: 8px; border: 1px solid #dce2ef; vertical-align: top; }
@keyframes document-placeholder { 0% { background-position: 100% 0; } 100% { background-position: -100% 0; } }
@keyframes loading-pulse { 70% { box-shadow: 0 0 0 14px rgba(66,105,225,0); } 100% { box-shadow: 0 0 0 0 rgba(66,105,225,0); } }
.page-title { margin: 0 0 20px; font-size: 28px; }
.notification-heading { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 14px; }
.notification-heading .page-title { margin: 0; }
.notification-read-all { min-height: 40px; font-size: 12px; }
.notification { display: grid; grid-template-columns: minmax(0,1fr) auto; gap: 8px; align-items: center; padding: 8px 10px; border-bottom: 1px solid var(--line); }
.notification:last-child { border: 0; }
.notification.read { opacity: .68; }
.notification-main { width: 100%; min-height: 56px; padding: 6px; border: 0; background: transparent; display: flex; gap: 12px; align-items: center; cursor: pointer; text-align: left; }
.notification-dot { width: 38px; height: 38px; border-radius: 12px; background: var(--blue-soft); display: grid; place-items: center; color: var(--blue); }
.notification.ready .notification-dot { background: var(--green-soft); color: var(--green); }
.notification h3 { font-size: 14px; margin: 0 0 5px; }
.notification p { margin: 0; color: var(--muted); font-size: 12px; }
.notification-read-one { min-height: 38px; padding: 0 8px; border: 0; background: transparent; color: var(--blue); cursor: pointer; font-size: 11px; }
.notification-empty { margin: 0; padding: 22px; color: var(--muted); text-align: center; }
.panel { border: 1px solid var(--line); background: var(--surface); border-radius: 18px; box-shadow: var(--shadow); overflow: hidden; }
.health-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 13px; }
.health-card { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 17px; }
.health-card header { display: flex; justify-content: space-between; margin-bottom: 12px; }
.health-card h3 { margin: 0; font-size: 14px; }
.health-value { font-size: 27px; font-weight: 750; }
.status-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--green); box-shadow: 0 0 0 5px var(--green-soft); }
.status-dot.unknown { background: var(--muted); box-shadow: 0 0 0 5px #eef0f4; }
.device { display: grid; grid-template-columns: minmax(0,1fr) auto; gap: 12px; align-items: center; padding: 16px; border-bottom: 1px solid var(--line); }
.device:last-child { border: 0; }
.device h3 { margin: 0 0 5px; font-size: 14px; }
.device p { margin: 0; color: var(--muted); font-size: 12px; }
.button, button.primary { border: 0; border-radius: 12px; min-height: 42px; padding: 0 16px; display: inline-flex; align-items: center; justify-content: center; cursor: pointer; text-decoration: none; font-weight: 650; }
button.primary { background: var(--blue); color: #fff; box-shadow: 0 7px 15px rgba(66,105,225,.22); }
.button.subtle { background: var(--surface-soft); color: var(--navy); }
.button.danger { background: var(--red-soft); color: var(--red); }
.wide { width: 100%; }
.badge { display: inline-grid; place-items: center; min-width: 18px; height: 18px; border-radius: 10px; background: var(--red); color: #fff; font-size: 10px; padding: 0 5px; }
.auth-screen { min-height: 100dvh; overflow-y: auto; display: grid; place-items: center; padding: max(28px, env(safe-area-inset-top)) 20px max(28px, env(safe-area-inset-bottom)); background: radial-gradient(circle at 50% 12%, #edf0ff, transparent 35%), var(--bg); }
.auth-card { width: min(440px,100%); background: rgba(255,255,255,.96); border: 1px solid var(--line); box-shadow: 0 24px 60px rgba(27,43,86,.12); border-radius: 26px; padding: 34px; }
.auth-logo { width: 74px; height: 74px; }
.auth-card h1 { margin: 4px 0 8px; font-size: 27px; line-height: 1.2; }
.auth-card form { display: grid; gap: 15px; margin-top: 25px; }
.auth-card label { display: grid; gap: 7px; font-size: 13px; font-weight: 650; }
.auth-card input[type="email"], .auth-card input[type="password"] { width: 100%; height: 48px; border: 1px solid #dfe3ee; border-radius: 12px; padding: 0 13px; outline: 0; }
.auth-card input:focus { border-color: var(--blue); box-shadow: 0 0 0 3px var(--blue-soft); }
.trusted-choice { grid-template-columns: auto 1fr; align-items: start; padding: 12px; background: var(--surface-soft); border-radius: 12px; cursor: pointer; }
.trusted-choice input { width: 18px; height: 18px; accent-color: var(--blue); }
.trusted-choice span { display: grid; gap: 4px; }
.trusted-choice small { color: var(--muted); font-weight: 400; line-height: 1.4; }
.form-error { min-height: 18px; color: var(--red); font-size: 12px; margin: -4px 0; }
.security-note { text-align: center; color: var(--muted); font-size: 11px; margin: 18px 0 0; }
.viewer { width: min(1200px,100vw); height: min(900px,100dvh); max-width: none; max-height: none; border: 0; padding: 0; border-radius: 20px; overflow: hidden; background: #e8ebf2; }
.viewer::backdrop { background: rgba(13,22,45,.55); backdrop-filter: blur(5px); }
.viewer-bar { height: 64px; padding: 0 16px; background: #fff; border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; gap: 15px; }
.viewer-bar > div:first-child { display: grid; min-width: 0; }
.viewer-bar strong { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.viewer-bar small { color: var(--muted); }
.viewer-actions { display: flex; gap: 8px; }
.viewer-canvas { height: calc(100% - 124px); display: grid; place-items: center; overflow: auto; padding: 15px; }
.viewer-canvas iframe { width: 100%; height: 100%; border: 0; background: #fff; }
.viewer-canvas img { display: block; max-width: none; height: auto; object-fit: contain; box-shadow: var(--shadow); }
.viewer-thumbs { height: 60px; display: flex; gap: 8px; align-items: center; overflow-x: auto; padding: 8px 15px max(8px, env(safe-area-inset-bottom)); background: #fff; }
.viewer-thumbs button { min-width: 42px; height: 38px; border-radius: 8px; border: 1px solid var(--line); background: var(--surface-soft); }
.viewer-thumbs button.active { color: #fff; border-color: var(--blue); background: var(--blue); }
.viewer-thumbs button:disabled { opacity: .4; }
.toast { position: fixed; z-index: 100; left: 50%; bottom: max(28px, env(safe-area-inset-bottom)); transform: translateX(-50%); background: #172444; color: #fff; border-radius: 12px; padding: 12px 17px; box-shadow: var(--shadow); font-size: 13px; }
.mobile-header, .mobile-menu { display: none; }
.account-mark { width: 36px; height: 36px; flex: 0 0 auto; }
.patient-avatar { display: block; flex: 0 0 auto; width: 48px; height: 48px; border-radius: 14px; object-fit: cover; filter: drop-shadow(0 3px 6px rgba(25,41,83,.12)); }
.patient-avatar.large { width: 72px; height: 72px; }
.patient-avatar.small { width: 36px; height: 36px; }
.i { width: 20px; height: 20px; display: inline-block; background: currentColor; mask-size: contain; mask-repeat: no-repeat; mask-position: center; }
.i-people { mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.8' stroke-linecap='round'%3E%3Ccircle cx='9' cy='8' r='3'/%3E%3Cpath d='M3 19c0-4 2-6 6-6s6 2 6 6M16 6a3 3 0 0 1 0 6M17 14c2.7.3 4 2 4 5'/%3E%3C/svg%3E"); }
.i-search { mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round'%3E%3Ccircle cx='10.5' cy='10.5' r='6.5'/%3E%3Cpath d='m16 16 5 5'/%3E%3C/svg%3E"); }
.i-bell { mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.8'%3E%3Cpath d='M5 17h14l-2-3V9a5 5 0 0 0-10 0v5l-2 3Z'/%3E%3Cpath d='M10 20h4'/%3E%3C/svg%3E"); }
.i-system { mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.8'%3E%3Crect x='3' y='4' width='18' height='14' rx='3'/%3E%3Cpath d='M8 21h8M9 13l2-2 2 2 3-4'/%3E%3C/svg%3E"); }
.i-settings { mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.8'%3E%3Ccircle cx='12' cy='12' r='3'/%3E%3Cpath d='M19 13.5v-3l-2-.7-.5-1.2.9-1.9-2.1-2.1-1.9.9-1.2-.5-.7-2h-3l-.7 2-1.2.5-1.9-.9-2.1 2.1.9 1.9-.5 1.2-2 .7v3l2 .7.5 1.2-.9 1.9 2.1 2.1 1.9-.9 1.2.5.7 2h3l.7-2 1.2-.5 1.9.9 2.1-2.1-.9-1.9.5-1.2 2-.7Z'/%3E%3C/svg%3E"); }
.i-refresh { mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2'%3E%3Cpath d='M20 7v5h-5M4 17v-5h5M18 12a6 6 0 0 0-10-4L5 11M6 12a6 6 0 0 0 10 4l3-3'/%3E%3C/svg%3E"); }

@media (max-width: 1180px) {
  .app { grid-template-columns: 82px 320px minmax(0,1fr); }
  .sidebar { padding-inline: 14px; }
  .brand { margin-inline: auto; }
  .brand strong, .nav:not(.active)::after, .nav { font-size: 0; }
  .nav { justify-content: center; padding: 0; }
  .nav .i { width: 22px; height: 22px; }
  .nav .badge { position: absolute; margin: -27px 0 0 25px; }
  .account > div:last-child { display: none; }
  .account { justify-content: center; }
}
@media (max-width: 820px) {
  html, body { overflow-x: hidden; }
  body { overflow-y: auto; }
  .app { display: block; height: auto; min-height: 100dvh; padding-top: calc(56px + env(safe-area-inset-top)); padding-bottom: env(safe-area-inset-bottom); }
  .sidebar { display: none; }
  .mobile-header { position: fixed; z-index: 40; left: 0; right: 0; top: 0; height: calc(56px + env(safe-area-inset-top)); padding: env(safe-area-inset-top) 12px 0 14px; background: rgba(250,251,255,.94); backdrop-filter: blur(18px); border-bottom: 1px solid rgba(223,227,239,.8); display: flex; align-items: center; justify-content: space-between; }
  .mobile-brand { display: flex; align-items: center; gap: 7px; font-size: 17px; }
  .mobile-brand strong { white-space: nowrap; }
  .mobile-header .brand-mark { width: 32px; height: 32px; }
  .mobile-menu-button { position: relative; width: 42px; height: 42px; display: grid; place-items: center; padding: 0; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); color: var(--navy); cursor: pointer; }
  .mobile-menu-button svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
  .mobile-menu-button .badge { position: absolute; top: -4px; right: -4px; }
  .mobile-menu { position: absolute; display: grid; top: calc(100% + 7px); right: 10px; width: min(286px,calc(100vw - 20px)); padding: 7px; border: 1px solid var(--line); border-radius: 17px; background: rgba(255,255,255,.98); box-shadow: 0 18px 50px rgba(20,34,70,.18); }
  .mobile-menu button { width: 100%; min-height: 46px; display: grid; grid-template-columns: 24px minmax(0,1fr) auto; gap: 10px; align-items: center; padding: 0 11px; border: 0; border-radius: 11px; background: transparent; color: var(--navy); cursor: pointer; text-align: left; }
  .mobile-menu button.active { background: var(--blue-soft); color: #345dd4; font-weight: 700; }
  .mobile-menu .i { width: 20px; height: 20px; }
  .patient-rail { display: block; overflow: visible; border: 0; padding: 20px 15px; min-height: calc(100dvh - 132px); }
  .patient-rail.hidden-mobile { display: none; }
  .rail-heading { padding-top: 4px; }
  .patient-list { overflow: visible; padding-bottom: 20px; }
  .patient-card { padding: 13px 14px; margin-bottom: 9px; }
  .workspace { display: none; overflow: visible; padding: 12px 14px 30px; }
  .workspace.mobile-active { display: block; }
  .workspace.mobile-active { scroll-padding-top: calc(62px + env(safe-area-inset-top)); }
  .content { max-width: none; }
  .welcome-state { min-height: 50vh; }
  .dossier-person { grid-template-columns: 54px minmax(0,1fr); gap: 11px; padding: 13px 14px; }
  .dossier-person { grid-template-columns: 64px minmax(0,1fr); }
  .patient-avatar.large { width: 64px; height: 64px; border-radius: 18px; }
  .header-status { grid-column: 1 / -1; margin-top: -2px; }
  .dossier-person h1 { font-size: 20px; }
  .person-meta { gap: 5px 7px; font-size: 12px; }
  .update-strip { display: grid; gap: 5px; padding: 9px 14px; }
  .action-grid { gap: 8px; }
  .action-card { min-height: 64px; display: grid; justify-items: center; text-align: center; gap: 3px; padding: 6px 3px; font-size: 10px; line-height: 1.15; }
  .module-icon { width: 34px; height: 34px; border-radius: 10px; }
  .module-icon img { width: 25px; height: 25px; }
  .clinical-card { border-radius: 16px; }
  .clinical-card summary { padding: 15px 14px; }
  .clinical-body { padding: 14px; }
  .clinical-body .lead { font-size: 14px; }
  .detail-list { grid-template-columns: 1fr; }
  .document-index { margin-inline: -2px; }
  .document-reader { gap: 14px; }
  .document-section { scroll-margin-top: calc(62px + env(safe-area-inset-top)); border-radius: 15px; margin-inline: -4px; }
  .document-section-head { align-items: flex-start; padding: 12px; }
  .document-section-head h2 { font-size: 16px; }
  .document-original { max-width: 42%; font-size: 10px; }
  .document-body { padding: 6px; }
  .document-page { margin-bottom: 7px; }
  .document-page-open { border-radius: 2px; }
  .docx-preview { padding: 22px 16px 28px; font-size: 13px; line-height: 1.55; }
  .docx-preview h1 { margin-bottom: 20px; font-size: 21px; }
  .docx-preview h2 { margin-top: 23px; font-size: 16px; }
  .docx-preview td { min-width: 96px; padding: 7px; }
  .dossier-back { margin-top: 2px; min-height: 46px; padding-top: 10px; }
  .health-grid { grid-template-columns: 1fr; }
  .notification-heading { align-items: flex-start; }
  .notification-heading { flex-direction: column; }
  .notification-read-all { width: 100%; }
  .report-card { padding: 14px; border-radius: 16px; }
  .radiology-impression { font-size: 13px; }
  .page-title, .subpage-head h1 { font-size: 24px; }
  .viewer { width: 100vw; height: 100dvh; border-radius: 0; }
  .viewer-canvas { height: calc(100% - 130px - env(safe-area-inset-bottom)); display: block; padding: 6px; }
  .viewer-canvas img { width: 100%; min-height: min-content; }
  .viewer-bar { padding-top: env(safe-area-inset-top); height: calc(64px + env(safe-area-inset-top)); }
  .viewer-actions .button { display: none; }
  .auth-card { padding: 27px 22px; border-radius: 22px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; }
}
@media (max-width: 390px) {
  .workspace { padding-inline: 10px; }
  .action-card { font-size: 10px; }
  .report-card { padding: 14px; }
  .timeline { margin-left: 8px; padding-left: 29px; }
  .timeline-event::before { left: -30px; }
  .timeline-year { margin-left: -29px; }
}
@media (min-width: 821px) and (max-width: 1050px) {
  .app { grid-template-columns: 290px minmax(0,1fr); }
  .sidebar { display: none; }
}
