:root {
  color-scheme: light;
  --ink: #172d2a;
  --muted: #576d67;
  --line: #dce7e2;
  --bg: #f3f7f5;
  --card: #fff;
  --accent: #116b5b;
  --accent-hover: #0c5447;
  --sidebar: #142e2b;
  --red: #9a3a36;
  --shadow: 0 2px 4px #183b2e06, 0 10px 30px #183b2e06;
}
* { box-sizing: border-box; }
body { margin: 0; font: 15px/1.55 system-ui, "Segoe UI", sans-serif; color: var(--ink); background: var(--bg); }
a { color: var(--accent); text-underline-offset: .19em; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 3px solid #1e927e; outline-offset: 3px; }
svg { display: block; width: 20px; height: 20px; flex: none; }
h1, h2, h3, p { margin: 0; overflow-wrap: anywhere; }
h1 { font-size: clamp(28px, 4vw, 43px); letter-spacing: -.045em; line-height: 1.1; }
h2 { font-size: 20px; letter-spacing: -.025em; line-height: 1.3; }
h3 { font-size: 16px; line-height: 1.4; }
p + p { margin-top: 12px; }
.muted, small { color: var(--muted); }
.skip-link { position: fixed; z-index: 3; top: 10px; left: 10px; padding: 10px; background: white; transform: translateY(-160%); }
.skip-link:focus { transform: none; }

.workspace { min-height: 100vh; display: grid; grid-template-columns: 228px minmax(0, 1fr); }
.sidebar { position: sticky; top: 0; height: 100dvh; overflow-y: auto; display: flex; flex-direction: column; padding: 28px 18px 18px; color: #f5fffa; background: var(--sidebar); }
.brand { display: flex; align-items: center; gap: 12px; min-width: 0; color: inherit; font-size: 19px; font-weight: 740; text-decoration: none; line-height: 1.15; overflow-wrap: anywhere; }
.sidebar .brand { padding: 0 8px; }
.brand small { display: block; margin-top: 4px; font-size: 12px; color: #a9c5ba; font-weight: 500; }
.brand-mark, .avatar, .section-icon { display: inline-grid; place-items: center; flex: none; width: 40px; height: 40px; border-radius: 12px; background: #d6f4e8; color: #116b5b; }
.navigation { display: grid; gap: 5px; margin-top: 37px; }
.navigation a { display: flex; align-items: center; gap: 12px; min-height: 45px; padding: 9px 12px; border-radius: 10px; color: #c3d9d0; text-decoration: none; font-weight: 580; }
.navigation a:hover { background: #ffffff10; color: white; }
.navigation [aria-current] { color: #edfff7; background: #31574e; }
.navigation [aria-current] svg { color: #a8e9d0; }
.account { margin-top: auto; min-width: 0; padding: 15px 4px 0; border-top: 1px solid #ffffff24; display: flex; align-items: center; gap: 10px; }
.avatar { width: 34px; height: 34px; border-radius: 50%; color: #d9eee5; background: #ffffff17; }
.avatar svg { width: 17px; }
.account-name { flex: 1; min-width: 0; font-size: 13px; overflow: hidden; text-overflow: ellipsis; }
.account a { display: grid; place-items: center; color: #d7eae2; width: 38px; height: 38px; flex: none; border-radius: 9px; }
.account a:hover { background: #ffffff15; }

.content { width: 100%; max-width: 1400px; margin-inline: auto; padding: 38px clamp(22px, 4vw, 56px) 50px; min-width: 0; }
.content > h2, .content > p { margin-block: 16px; }
.page-header { display: flex; justify-content: space-between; gap: 16px; align-items: flex-end; margin-bottom: 24px; }
.page-header p { color: var(--muted); margin-top: 8px; }
.page-header .btn { flex: none; }
.btn, button, input::file-selector-button { min-height: 42px; border: 1px solid transparent; background: var(--accent); color: white; border-radius: 10px; padding: 9px 15px; font: inherit; font-weight: 650; cursor: pointer; text-decoration: none; line-height: 1.35; }
.btn { display: inline-flex; gap: 8px; align-items: center; justify-content: center; }
.btn:hover, button:hover, input::file-selector-button:hover { background: var(--accent-hover); text-decoration: none; }
.btn svg { width: 18px; height: 18px; }
button.danger { color: var(--red); background: #fff1ef; border-color: #f2d5d1; }
button.danger:hover { background: #fbe0dc; }

.hero { position: relative; isolation: isolate; overflow: hidden; min-height: 236px; border-radius: 22px; padding: 32px clamp(22px, 4vw, 43px); color: white; background: linear-gradient(115deg, #15443d 8%, #146554 83%, #237560); display: flex; align-items: center; }
.hero-copy { width: min(66%, 550px); }
.hero h2 { font-size: clamp(25px, 3.05vw, 39px); letter-spacing: -.045em; line-height: 1.12; }
.hero p { max-width: 43ch; color: #d4eee4; margin: 12px 0 20px; }
.hero .btn { background: #e2faee; color: #144a3f; }
.hero .btn:hover { background: #fff; }
.hero :focus-visible { outline-color: #a2f7d4; }
.hero-art { position: absolute; z-index: -1; display: grid; place-items: center; width: 335px; aspect-ratio: 1; top: 50%; right: 0; transform: translate(7%, -50%); border: 1px solid #ddfff131; border-radius: 50%; background: repeating-radial-gradient(circle, transparent 0 31px, #ddfff121 32px 33px, transparent 34px 48px); }
.hero-tile { display: grid; place-items: center; width: 136px; aspect-ratio: 1; border: 1px solid #e5fff577; border-radius: 38px; color: #d2fae9; background: linear-gradient(145deg, #73bda5, #277362); box-shadow: 8px 16px 35px #05342666, inset 0 1px 2px #eefff6aa; transform: rotate(-12deg); }
.hero-tile svg { width: 74px; height: 74px; transform: rotate(12deg); }

.stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; margin: 18px 0; }
.stat, .panel, .card, .table-wrap { min-width: 0; border-radius: 16px; border: 1px solid var(--line); background: var(--card); box-shadow: var(--shadow); }
.stat { display: grid; align-content: start; gap: 4px; padding: 16px 18px; color: var(--ink); text-decoration: none; overflow-wrap: anywhere; }
.stat:hover { border-color: #86b6a8; }
.stat-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; }
.stat-top > svg { width: 17px; color: var(--muted); }
.section-icon { width: 36px; height: 36px; border-radius: 10px; }
.section-icon svg { width: 19px; height: 19px; }
.section-icon.labs { background: #e0f4ea; color: #116b5b; }
.section-icon.meds { background: #f1eafa; color: #6c4b9b; }
.section-icon.files { background: #e7effa; color: #365e8e; }
.stat-label { font-weight: 650; }
.stat strong { font-size: 32px; letter-spacing: -.045em; line-height: 1.12; }

.dashboard-grid { display: grid; grid-template-columns: 1.15fr 1fr; gap: 16px; align-items: start; }
.panel-wide { grid-column: 1 / -1; }
.panel-head { display: flex; align-items: center; gap: 10px; padding: 15px 16px; border-bottom: 1px solid var(--line); }
.panel-head h2 { font-size: 17px; }
.panel-head > a { display: flex; align-items: center; gap: 4px; margin-left: auto; font-weight: 650; font-size: 13px; text-decoration: none; white-space: nowrap; }
.panel-head > a:hover { text-decoration: underline; }
.panel-head > a svg { width: 14px; height: 14px; }
.panel-empty { margin: 13px; padding: 15px; background: #f4f8f6; border: 1px dashed #cadaD3; border-radius: 12px; }
.panel-empty p, .empty p { margin-top: 4px; color: var(--muted); font-size: 14px; }
.records { list-style: none; padding: 0 16px; margin: 0; }
.records li { display: flex; align-items: start; justify-content: space-between; gap: 12px; padding: 12px 0; overflow-wrap: anywhere; }
.records li + li { border-top: 1px solid var(--line); }
.records a { font-weight: 650; }
.records small, td small { display: block; margin-top: 3px; }
.records time { color: var(--muted); font-size: 13px; white-space: nowrap; }
.result-badge { display: inline-block; padding: 3px 8px; border-radius: 8px; background: #eef3f1; color: #415851; font-size: 13px; font-weight: 650; }
.result-badge.high, .result-badge.failed { background: #fbe9e6; color: var(--red); }
.result-badge.low, .result-badge.pending { background: #fff1dc; color: #865510; }
.result-badge.active, .result-badge.processed { background: #e2f4ea; color: #23624c; }
.records .result-badge { max-width: 45%; flex-shrink: 0; }

.card { padding: clamp(16px, 3vw, 26px); margin: 14px 0 18px; overflow-wrap: anywhere; }
.card > p, .card > form, .card > h3 { margin-top: 12px; }
.empty { padding-block: 27px; }
.table-wrap { overflow-x: auto; margin: 12px 0 20px; }
table { width: 100%; min-width: 570px; border-collapse: collapse; font-size: 14px; }
th, td { padding: 12px 15px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; overflow-wrap: anywhere; }
th { background: #eaf2ee; font-weight: 670; }
tbody tr:last-child td { border-bottom: 0; }
tr:hover td { background: #f7faf8; }
td.cat { color: var(--muted); background: #f2f7f4; font-weight: 650; }
tr.st-high td:nth-child(2) { color: var(--red); font-weight: 650; }
tr.st-low td:nth-child(2) { color: #865510; font-weight: 650; }
.table-actions { min-width: 155px; }
table button { color: var(--accent); background: #e9f4ef; font-size: 13px; margin: 1px 0; }
table button:hover { background: #d7ece4; }
.review-table { min-width: 850px; }
.review-table :is(th, td) { padding-inline: 8px; }
.review-table td:nth-child(2) input { min-width: 12rem; }
.review-table td:nth-child(7) input { min-width: 9rem; }
.chart-card h2 { margin-bottom: 12px; }
.chart-frame { position: relative; height: 300px; margin-top: 12px; }

input, select, textarea { font: inherit; color: var(--ink); background: white; padding: 9px 10px; border-radius: 9px; border: 1px solid #bacdc4; max-width: 100%; min-width: 0; }
input[type=checkbox] { accent-color: var(--accent); width: 18px; height: 18px; vertical-align: middle; }
textarea { width: 100%; resize: vertical; }
.entry-card summary { cursor: pointer; font-size: 17px; font-weight: 680; }
.entry-card summary::marker { color: var(--accent); }
.entry-form { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 18px; max-width: 760px; }
.entry-form label, .login-card label { display: grid; gap: 5px; font-weight: 600; }
.full-field { grid-column: 1 / -1; }
.upload-card { max-width: 730px; }
.file-picker { display: grid; justify-items: center; gap: 8px; text-align: center; padding: clamp(16px, 4vw, 38px) 12px; border: 1px dashed #9bbcaf; background: #f5faf7; border-radius: 13px; }
.file-picker label { font-size: 20px; font-weight: 700; }
.file-picker p { color: var(--muted); }
input[type=file] { width: min(100%, 395px); margin-top: 8px; text-align: left; font-size: 14px; }
input::file-selector-button { margin-right: 9px; min-height: 34px; padding: 6px 10px; }
.form-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 12px; margin-top: 18px; }
.flash-ok, .flash-err { padding: 12px 15px; border-radius: 10px; margin: 12px 0; overflow-wrap: anywhere; }
.flash-ok { background: #e5f5ea; color: #285e43; }
.flash-err { background: #fbe9e6; color: var(--red); }
.flash-err a { color: inherit; }
code.big { font-size: 18px; letter-spacing: 1px; background: var(--bg); padding: 6px 10px; display: inline-block; }
code.small { word-break: break-all; font-size: 11px; color: var(--muted); }
body.login { min-height: 100vh; display: grid; place-items: center; padding: 18px; background: radial-gradient(ellipse at 50% 0, #dcedE6, var(--bg) 70%); }
.login main { width: min(440px, 100%); }
.login-card { padding: clamp(20px, 5vw, 36px); }
.login-card h1 { font-size: 28px; }
.login-card .brand { color: var(--ink); margin-bottom: 20px; }
.login-card label { margin: 14px 0; }
.login-card button, .login-card input { width: 100%; }
.login-card button { margin-top: 6px; }

@media (max-width: 1050px) {
  .workspace { grid-template-columns: 190px minmax(0, 1fr); }
  .sidebar { padding-inline: 12px; }
  .dashboard-grid { grid-template-columns: 1fr; }
}
@media (max-width: 760px) {
  .workspace { display: block; }
  .sidebar { display: grid; grid-template-columns: minmax(0, 1fr) auto; column-gap: 8px; height: auto; position: static; padding: 12px 14px 8px; }
  .sidebar .brand { padding: 0; font-size: 17px; }
  .brand-mark { width: 35px; height: 35px; border-radius: 9px; }
  .account { grid-column: 2; grid-row: 1; margin: 0; border: 0; padding: 0; }
  .account-name { max-width: 110px; }
  .avatar { display: none; }
  .navigation { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 3px; margin-top: 10px; }
  .navigation a { padding: 6px 8px; min-height: 42px; gap: 5px; font-size: 13px; }
  .navigation svg { width: 16px; height: 16px; }
  .content { padding: 22px 15px 34px; }
  .page-header { align-items: flex-start; flex-wrap: wrap; margin-bottom: 17px; }
  .hero { min-height: 0; }
  .hero-art { right: -28px; width: 270px; }
  .hero-tile { width: 100px; border-radius: 27px; }
  .hero-tile svg { width: 52px; height: 52px; }
}
@media (max-width: 500px) {
  .sidebar { padding-inline: 10px; }
  .navigation { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 2px; }
  .navigation a { flex-direction: column; justify-content: center; gap: 3px; padding: 5px 0; min-height: 46px; font-size: clamp(10px, 2.8vw, 11px); }
  .hero { padding: 22px 17px; border-radius: 16px; }
  .hero-copy { width: 100%; }
  .hero-art { display: none; }
  .stats { gap: 8px; margin: 12px 0; }
  .stat { padding: 10px 8px; border-radius: 12px; font-size: 12px; }
  .stat small { line-height: 1.3; font-size: 11px; }
  .stat strong { font-size: 24px; }
  .stat-top > svg { width: 13px; }
  .stat .section-icon { width: 30px; height: 30px; }
  .panel-head { padding: 12px; gap: 7px; }
  .panel-head h2 { font-size: 15px; }
  .panel-head > a { font-size: 12px; }
  .entry-form { grid-template-columns: minmax(0, 1fr); }
  .chart-frame { height: 220px; }
}

