:root { font-family: Inter, ui-sans-serif, system-ui, -apple-system, Segoe UI, sans-serif; color: #213047; background: #f5f8fc; }
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; }
.site-header { display: flex; justify-content: space-between; align-items: center; gap: 1rem; padding: 1rem clamp(1rem, 4vw, 3rem); color: white; background: #173959; }
.brand { display: flex; align-items: baseline; gap: 1rem; }
.brand strong { font-size: 1.15rem; }
.brand span { color: #c5d9e9; }
.environment { font-weight: 700; letter-spacing: .04em; border: 1px solid #a8cadf; border-radius: 999px; padding: .4rem .8rem; white-space: nowrap; }
main { max-width: 1600px; margin: 0 auto; padding: 2rem clamp(1rem, 3vw, 2.5rem) 5rem; }
h1, h2, h3, h4, p { margin-top: 0; }
h1 { font-size: clamp(1.55rem, 2.3vw, 2rem); margin-bottom: .4rem; }
h2 { font-size: 1.45rem; margin-bottom: 0; }
h3 { font-size: 1.13rem; margin-bottom: .8rem; }
p { line-height: 1.55; }
.eyebrow { margin-bottom: .4rem; color: #537a9d; font-size: .72rem; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; }
.panel { padding: 1.4rem; background: white; border: 1px solid #dce6f0; border-radius: .9rem; box-shadow: 0 3px 14px #1739590a; }
.login-panel { max-width: 700px; margin: 4rem auto; }
.login-panel > p:not(.eyebrow) { color: #54677b; }
form { display: flex; align-items: end; flex-wrap: wrap; gap: .9rem; }
form > div { flex: 1 1 180px; }
#login-form input { width: min(28rem, 100%); }
label { display: block; margin-bottom: .4rem; font-weight: 700; }
input, select, button { font: inherit; border-radius: .48rem; }
input, select { width: 100%; padding: .7rem .8rem; color: #213047; background: white; border: 1px solid #a9bdce; }
input:focus, select:focus, button:focus-visible, summary:focus-visible { outline: 3px solid #80c4ed; outline-offset: 2px; }
button { padding: .72rem 1.1rem; border: 1px solid #245e8e; color: white; background: #245e8e; cursor: pointer; font-weight: 700; }
button:hover { background: #174d79; }
button:disabled { opacity: .6; cursor: wait; }
button.secondary { background: white; color: #245e8e; }
button.secondary:hover { background: #eaf4fb; }
.page-heading, .patient-heading, .section-heading { display: flex; justify-content: space-between; align-items: end; gap: 1.2rem; }
.page-heading { margin-bottom: 1.5rem; }
.page-heading p:last-child { color: #586e83; margin: 0; }
.selector-panel { margin-bottom: 1.5rem; }
.load-form > div:first-child { flex: 1 1 160px; max-width: 250px; }
.load-form > .patient-select { flex: 2 1 280px; }
.helper { color: #61758a; font-size: .87rem; line-height: 1.4; }
.selector-panel .helper { margin: .85rem 0 0; }
.message { min-height: 1.3rem; margin: .8rem 0 0; color: #345e7a; }
.message.error { color: #b42e35; }
.patient-heading { padding: 1.4rem 1.5rem; background: linear-gradient(105deg, #e9f4fb, #fff); border: 1px solid #d6e6f1; border-radius: .9rem; align-items: center; }
.patient-title { display: flex; align-items: center; flex-wrap: wrap; gap: .8rem; }
.patient-heading .helper { margin: .55rem 0 0; }
.role-badge { padding: .33rem .68rem; color: #235d80; background: #dceffa; border-radius: 999px; font-weight: 800; font-size: .8rem; }
.role-badge.reference { color: #14634e; background: #d7f5e8; }
.pool-control { display: flex; align-items: center; gap: .4rem; flex-wrap: wrap; }
.pool-control > span { margin-right: .45rem; color: #526b83; font-size: .85rem; font-weight: 700; }
.pool-button { background: white; color: #245e8e; padding: .55rem .85rem; }
.pool-button.active { background: #245e8e; color: white; }
.tabs { display: flex; gap: .35rem; border-bottom: 1px solid #cddce8; margin: 1.2rem 0 1.5rem; }
.tab { border: 0; border-radius: .5rem .5rem 0 0; background: transparent; color: #536b80; padding: .75rem 1.2rem; }
.tab:hover { color: #1d4f78; background: #e8f3fb; }
.tab.active { color: #174e77; background: white; border-bottom: 3px solid #2474a5; }
.section-heading { margin: 2rem 0 .85rem; }
.section-heading:first-child { margin-top: 0; }
.section-heading .helper { margin-bottom: .1rem; text-align: right; }
.section-heading #comparison-caption span, .section-heading #comparison-caption time { display: block; }
.section-heading #comparison-caption time { margin-top: .2rem; color: #315371; font-weight: 700; }
.source-note { padding: .75rem 1rem; color: #47627a; background: #eaf3f9; border-left: 3px solid #78a9ca; border-radius: .3rem; font-size: .9rem; }
.data-panel { padding: 1rem 1.2rem; margin: .9rem 0; }
.data-panel h3 { margin-bottom: .8rem; }
.table-scroll { width: 100%; max-height: 470px; overflow: auto; border: 1px solid #e3ebf2; border-radius: .55rem; }
table { border-collapse: separate; border-spacing: 0; width: 100%; font-size: .86rem; }
.matrix-table { min-width: 900px; }
th, td { padding: .62rem .7rem; text-align: left; vertical-align: top; border-bottom: 1px solid #e6edf3; overflow-wrap: anywhere; }
thead th { position: sticky; top: 0; z-index: 2; color: #315371; background: #eaf2f8; font-weight: 800; white-space: nowrap; }
tbody th { color: #415d76; background: #f8fbfd; font-weight: 750; }
.matrix-table .row-label { position: sticky; left: 0; z-index: 1; min-width: 140px; max-width: 190px; }
.matrix-table thead .row-label { z-index: 3; }
.matrix-table td { min-width: 150px; max-width: 280px; }
.matrix-table .query-column { background: #dceefa; }
.matrix-table tbody td:nth-child(2) { background: #f2f9fe; font-weight: 650; }
.clinical-matrix, .compact-matrix, .treatment-table { min-width: 0; table-layout: fixed; }
.clinical-matrix th, .clinical-matrix td, .compact-matrix th, .compact-matrix td,
.treatment-table th, .treatment-table td { min-width: 0; max-width: none; white-space: normal; overflow-wrap: anywhere; }
.clinical-matrix, .compact-matrix { font-size: .76rem; }
.clinical-matrix th, .clinical-matrix td, .compact-matrix th, .compact-matrix td { padding: .5rem .42rem; }
.clinical-matrix .row-label, .compact-matrix .row-label { min-width: 0; max-width: none; width: 13%; }
#clinical-table { overflow-x: hidden; }
.genomic-group + .genomic-group { margin-top: 1.5rem; border-top: 1px solid #dce6f0; padding-top: 1.35rem; }
.genomic-group h4 { margin-bottom: .3rem; color: #245e8e; }
.genomic-group > .helper { margin: 0 0 .7rem; }
.genomic-scroll { max-height: 370px; }
.genomic-group .category-row th { position: static; color: #285a83; background: #edf5fb; font-size: .77rem; }
td.missing, .missing { color: #778898; font-style: italic; font-weight: 400 !important; }
.treatment-table { font-size: .82rem; }
.treatment-table tbody tr:nth-child(even) { background: #fafcfe; }
.treatment-table th, .treatment-table td { padding: .8rem .65rem; }
.treatment-table thead th strong, .treatment-table thead th small,
.treatment-table tbody td small { display: block; }
.treatment-table thead th small, .treatment-table tbody td small { color: #8295aa; font-weight: 450; margin-top: .25rem; }
.treatment-table tbody td:first-child { background: #f2f9fe; }
.treatment-agent { color: #245d99; font-weight: 650; }
.similarity-pill { display: inline-block; margin-left: .35rem; padding: .15rem .35rem; border: 1px solid #b8c8d5; border-radius: 999px; color: #566b7d; font-size: .72rem; font-weight: 600; }
.insight-card { margin-bottom: 1rem; }
.recommendation-top { display: flex; justify-content: space-between; align-items: center; gap: 1rem; }
.recommendation-class { color: #155a3e; font-size: 1.25rem; font-weight: 800; }
.confidence-badge { color: #6b4d05; background: #fff0c7; border-radius: 999px; padding: .3rem .7rem; font-size: .82rem; font-weight: 750; white-space: nowrap; }
.recommendation-meta { color: #577086; margin: .5rem 0 1.1rem; }
.insight-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 1rem; }
.text-card p:last-child { margin-bottom: 0; }
.text-card { min-width: 0; }
.text-card p, .insight-card p, .plain-list { white-space: pre-wrap; overflow-wrap: anywhere; }
.plain-list { margin: 0; padding-left: 1.25rem; }
.plain-list li { margin: .35rem 0; }
.provenance { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: .7rem; padding: 1rem; margin-bottom: 1.2rem; background: white; border: 1px solid #dce6f0; border-radius: .7rem; }
dt { color: #61758a; font-size: .72rem; text-transform: uppercase; letter-spacing: .05em; }
dd { margin: .25rem 0 0; font-family: ui-monospace, Consolas, monospace; font-size: .8rem; overflow-wrap: anywhere; }
.audit-section { margin: .65rem 0; background: white; border: 1px solid #dce6f0; border-radius: .65rem; overflow: hidden; }
.audit-section summary { padding: .9rem 1rem; cursor: pointer; font-weight: 750; background: #fbfdff; }
.audit-content { padding: 1rem; border-top: 1px solid #e3ebf2; }
.audit-content h4 { margin: 1.2rem 0 .55rem; }
.audit-content h4:first-child { margin-top: 0; }
.audit-field { padding: .4rem 0; border-bottom: 1px solid #edf2f6; }
.audit-label { display: block; color: #365c79; font-weight: 750; }
.readable, .nested { white-space: pre-wrap; overflow-wrap: anywhere; }
.nested { margin: .4rem 0 .4rem .8rem; padding-left: .7rem; border-left: 2px solid #d5e6f1; }
.audit-list { padding-left: 1.5rem; }
.audit-list li { margin: .4rem 0; overflow-wrap: anywhere; }
pre { max-height: 65vh; overflow: auto; padding: 1rem; border-radius: .4rem; background: #f3f7fa; white-space: pre-wrap; overflow-wrap: anywhere; font-size: .8rem; }
@media (max-width: 760px) {
  .site-header, .page-heading, .patient-heading, .section-heading { align-items: start; flex-direction: column; }
  .site-header { padding: .85rem 1rem; }
  .section-heading .helper { text-align: left; }
  main { padding: 1.1rem 1rem 3rem; }
  .load-form > div:first-child { max-width: none; }
  .insight-grid { grid-template-columns: 1fr; }
}
