/* InCellVu Clean design tokens, matched to https://incellvu.pl/new/styles.css.
   Fonts are self-hosted in fonts.css; never import third-party CSS into the patient portal. */
:root {
    color-scheme: light;
    --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --font-display: 'Space Grotesk', 'Inter', sans-serif;
    --ink: #0a2340;
    --muted: #4d6485;
    --placeholder: #8397b1;
    --accent: #1e6fdc;
    --accent-2: #0f4a7d;
    --success: #12b981;
    --warn: #d97706;
    --line: rgba(15, 74, 125, .12);
    --line-strong: rgba(15, 74, 125, .30);
    --border: var(--line-strong);
    --surface: #ffffff;
    --surface-glass: rgba(255, 255, 255, .88);
    --soft: #eaf1f8;
    --background: #f5f9fc;
    --sidebar: #f5f9fc;
    --brand-gradient: linear-gradient(135deg, #1e6fdc 0%, #0f4a7d 100%);
    --radius: 16px;
    --radius-small: 10px;
    --radius-pill: 999px;
    --shadow-card: 0 0 0 1px rgba(15, 74, 125, .025), 0 16px 40px -28px rgba(15, 74, 125, .28);
    --shadow-glow: 0 0 0 1px rgba(15, 74, 125, .10), 0 20px 60px -20px rgba(15, 74, 125, .25);
    --bg-mesh: radial-gradient(800px 600px at 80% -10%, rgba(30, 111, 220, .08), transparent 60%),
        radial-gradient(700px 500px at -10% 30%, rgba(15, 74, 125, .06), transparent 60%),
        radial-gradient(900px 700px at 50% 110%, rgba(18, 185, 129, .04), transparent 60%);
}

/* Base typography and accessible interactions. */
* { box-sizing: border-box; }
body {
    margin: 0;
    background: var(--bg-mesh) fixed, var(--background);
    color: var(--ink);
    font: 400 14px/1.6 var(--font-sans);
    -webkit-font-smoothing: antialiased;
}
h1, h2, h3, .brand { font-family: var(--font-display); font-weight: 600; letter-spacing: -.02em; }
h1 { font-size: clamp(28px, 3vw, 36px); font-weight: 700; line-height: 1.15; margin: 0 0 12px; }
h2 { font-size: 21px; line-height: 1.25; margin: 0; }
h3 { font-size: 15px; line-height: 1.35; margin: 0; }
p { line-height: 1.7; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
button, a, input, select, textarea, summary { outline-offset: 4px; }
:focus-visible { outline: 2px solid var(--accent); }
.primary:focus-visible { outline-color: var(--accent-2); box-shadow: 0 0 0 3px var(--surface); }
h1:focus { outline: none; }
.muted { color: var(--muted); }
.eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    border: 1px solid var(--line);
    border-radius: var(--radius-pill);
    background: rgba(30, 111, 220, .055);
    padding: 5px 11px;
    margin: 0 0 14px;
    color: var(--accent-2);
    font-size: 10px;
    font-weight: 600;
    letter-spacing: .13em;
}
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
::selection { background: rgba(30, 111, 220, .20); color: var(--ink); }

/* Shared actions: the same blue gradient and pill silhouette as the website. */
.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    min-height: 42px;
    max-width: 100%;
    padding: 10px 20px;
    border: 1px solid transparent;
    border-radius: var(--radius-pill);
    font-size: 13px;
    font-weight: 600;
    line-height: 1.5;
    text-align: center;
    text-decoration: none;
    white-space: normal;
    transition: transform .15s, box-shadow .2s, background-color .2s;
}
.button:hover { text-decoration: none; }
.primary { background: var(--brand-gradient); color: #fff; box-shadow: 0 10px 30px -10px rgba(30, 111, 220, .5); }
.primary:hover:not(:disabled) { transform: translateY(-1px); box-shadow: 0 14px 32px -12px rgba(30, 111, 220, .55); }
.secondary { background: rgba(30, 111, 220, .045); border-color: var(--line-strong); color: var(--ink); }
.secondary:hover:not(:disabled) { background: rgba(30, 111, 220, .10); }
.button:disabled { opacity: .5; cursor: not-allowed; }
.text-button { background: none; border: 0; border-radius: 6px; color: var(--muted); padding: 8px; font-size: 12px; min-height: 36px; }
.text-button:hover { color: var(--accent-2); }

/* Form controls stay neutral; scientific range/canvas controls retain viewer.css. */
input:not([type=checkbox]):not([type=radio]):not([type=range]), select, textarea {
    min-height: 44px;
    max-width: 100%;
    padding: 11px 13px;
    border: 1px solid var(--line-strong);
    border-radius: var(--radius-small);
    background: var(--surface);
    color: var(--ink);
    transition: border-color .15s, box-shadow .15s;
}
input::placeholder, textarea::placeholder { color: var(--muted); opacity: .8; }
input:focus-visible, select:focus-visible, textarea:focus-visible { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(30, 111, 220, .10); }
input[type=checkbox], input[type=radio] { accent-color: var(--accent); }

/* Persistent application navigation, using the reference's light glass header. */
.portal-shell { display: flex; min-height: 100vh; }
.portal-sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 30;
    display: flex;
    flex-direction: column;
    width: 248px;
    padding: 32px 20px 24px;
    overflow-y: auto;
    background: var(--surface-glass);
    border-right: 1px solid var(--line);
    backdrop-filter: blur(14px) saturate(140%);
    color: var(--ink);
}
.brand.brand-logo { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; flex-shrink: 0; max-width: 100%; color: var(--accent-2); text-decoration: none; }
.brand-wordmark { display: block; width: 180px; max-width: 100%; height: auto; object-fit: contain; }
.brand-logo .brand-subtitle { display: block; margin: 0 0 0 35px; color: var(--muted); font: 600 9px/1.3 var(--font-sans); letter-spacing: .28em; }
.sidebar-label { margin: 42px 14px 14px; color: var(--muted); font-size: 10px; font-weight: 600; letter-spacing: .12em; }
.portal-sidebar nav { display: flex; flex-direction: column; gap: 5px; }
.portal-sidebar nav a { display: flex; align-items: center; gap: 11px; padding: 12px 14px; border: 1px solid transparent; border-radius: var(--radius-small); color: var(--muted); font-size: 13px; font-weight: 500; transition: background-color .15s, color .15s; }
.portal-sidebar nav a:hover { background: rgba(30, 111, 220, .05); color: var(--accent-2); text-decoration: none; }
.portal-sidebar nav .nav-selected { background: rgba(30, 111, 220, .08); border-color: rgba(30, 111, 220, .15); color: var(--accent-2); font-weight: 600; }
.portal-sidebar nav span { font-size: 21px; line-height: 1; color: var(--accent); }
.sidebar-bottom { margin-top: auto; padding: 32px 12px 0; color: var(--muted); font-size: 11px; line-height: 1.9; }
.sidebar-bottom > span:last-child { font-size: 10px; }
.small-dot { display: inline-block; width: 6px; height: 6px; margin-right: 5px; border-radius: 50%; background: var(--success); }
.portal-main { display: flex; flex: 1; flex-direction: column; min-width: 0; margin-left: 248px; }
.portal-topbar { display: flex; align-items: center; justify-content: space-between; gap: 20px; min-height: 84px; padding: 18px 40px; border-bottom: 1px solid var(--line); background: rgba(245, 249, 252, .78); backdrop-filter: blur(14px) saturate(140%); }
.organization { min-width: 0; overflow-wrap: anywhere; color: var(--accent-2); font-size: 13px; font-weight: 600; }
.account { display: flex; align-items: center; gap: 10px; min-width: 0; font-size: 12px; }
.account > span:not(.avatar) { min-width: 0; overflow-wrap: anywhere; }
.avatar { display: grid; place-items: center; flex-shrink: 0; width: 34px; height: 34px; border: 1px solid var(--line); border-radius: 50%; background: var(--soft); color: var(--accent-2); font-size: 11px; font-weight: 600; }
.account form { flex-shrink: 0; margin: 0 0 0 6px; }
.demo-banner { padding: 10px 40px; border-bottom: 1px solid #f2e5c8; background: #fff6e4; color: #8a6627; font-size: 11px; }
.page-content { width: 100%; max-width: 1600px; flex: 1; padding: 36px 40px 64px; margin: 0 auto; }
.page-heading { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin-bottom: 28px; }
.page-heading > div { min-width: 0; }
.page-heading h1 { overflow-wrap: anywhere; }
.page-heading p.muted { margin: 0; }
.portal-footer { display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; padding: 20px 40px; border-top: 1px solid var(--line); color: var(--muted); font-size: 11px; }
.back-link { display: inline-block; margin-bottom: 26px; color: var(--muted); font-size: 12px; }

/* Cards, lists and metadata. Image data themselves are not themed. */
.summary-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; margin-bottom: 26px; }
.summary-card { padding: 22px 24px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow-card); }
.summary-card > span { display: block; color: var(--muted); font-size: 12px; }
.summary-card strong { display: block; margin: 10px 0 8px; color: var(--accent-2); font: 600 30px/1.2 var(--font-display); letter-spacing: -.025em; }
.summary-card small { color: var(--muted); font-size: 11px; }
.summary-card strong small { font-size: 17px; }
.panel { overflow: hidden; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow-card); }
.measurement-panel:has(> .filters) { margin-bottom: 24px; }
.filters { display: flex; align-items: center; flex-wrap: wrap; gap: 12px; padding: 22px; border-bottom: 1px solid var(--line); }
.search-field { position: relative; flex: 1; min-width: min(200px, 100%); }
.search-field input { width: 100%; padding-left: 39px !important; }
.search-field > span { position: absolute; left: 14px; top: 7px; color: var(--muted); font-size: 24px; }
.table-scroll { overflow: auto; }
table { width: 100%; border-collapse: collapse; text-align: left; }
th { padding: 15px 22px; background: var(--background); color: var(--muted); font-size: 10px; font-weight: 600; text-transform: uppercase; letter-spacing: .07em; white-space: nowrap; }
td { padding: 20px 22px; border-top: 1px solid var(--line); font-size: 12px; vertical-align: middle; }
tbody tr:hover { background: rgba(30, 111, 220, .025); }
.measurement-link { color: var(--ink); font-size: 13px; font-weight: 600; }
.table-subline { display: block; margin-top: 7px; color: var(--muted); font-size: 11px; }
.type-badge { display: inline-block; padding: 4px 10px; border: 1px solid var(--line); border-radius: var(--radius-pill); background: var(--soft); color: var(--accent-2); font-size: 11px; font-weight: 600; }
.type-badge.large { padding: 7px 13px; font-size: 12px; }
.status { display: inline-flex; align-items: center; gap: 6px; font-size: 11px; font-weight: 600; }
.status::before { content: ''; width: 5px; height: 5px; border-radius: 50%; background: currentColor; }
.ready { color: #087b54; }
.ready::before { background: var(--success); }
.pending { color: #9a4d05; }
.pending::before { background: var(--warn); }
.details-link { color: var(--accent); font-size: 12px; font-weight: 600; white-space: nowrap; }
.pagination { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 18px 22px; border-top: 1px solid var(--line); color: var(--muted); font-size: 12px; }
.pagination > div { display: flex; flex-wrap: wrap; gap: 10px; }
.pagination .button { min-height: 36px; font-size: 12px; }
.empty-state { padding: 52px 24px; text-align: center; }
.empty-state p { max-width: 480px; margin: 12px auto; color: var(--muted); }
.empty-icon { display: block; margin-bottom: 16px; color: var(--accent); font-size: 40px; }
.details-grid { display: grid; grid-template-columns: minmax(0, 1.65fr) minmax(220px, 1fr); gap: 22px; margin-bottom: 25px; }
.panel-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 23px 26px; border-bottom: 1px solid var(--line); }
.panel-heading .muted { font-size: 12px; }
.metadata-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 25px; padding: 27px; margin: 0; }
.metadata-grid dt { margin-bottom: 7px; color: var(--muted); font-size: 11px; }
.metadata-grid dd { margin: 0; font-size: 12px; overflow-wrap: anywhere; }
.mono { font-family: ui-monospace, monospace; font-size: 11px !important; line-height: 1.6; }
.preview-state { display: flex; flex-direction: column; align-items: center; justify-content: center; min-height: 280px; padding: 32px; background: linear-gradient(140deg, var(--surface), var(--soft)); text-align: center; }
.preview-symbol { margin-bottom: 22px; color: var(--accent); font-size: 65px; font-weight: 400; line-height: 1; }
.preview-state p { max-width: 270px; color: var(--muted); font-size: 12px; }
.preview-note { color: var(--muted); font-size: 11px; }
.artifact-row { display: flex; align-items: center; gap: 20px; padding: 25px 27px; border-bottom: 1px solid var(--line); }
.artifact-row:last-child { border-bottom: 0; }
.file-icon { display: grid; place-items: center; flex-shrink: 0; width: 42px; height: 48px; border-radius: var(--radius-small); background: var(--soft); color: var(--accent); font-size: 26px; }
.artifact-info { flex: 1; min-width: 0; }
.artifact-info h3 { overflow-wrap: anywhere; }
.artifact-info p { margin: 7px 0; color: var(--muted); font-size: 12px; }
.artifact-info details, .artifact-info code { color: var(--muted); font-size: 11px; }
.artifact-info code { display: block; margin-top: 10px; overflow-wrap: anywhere; }
.artifact-action { display: flex; align-items: center; gap: 20px; }
.artifact-action .button { font-size: 12px; }
.alert-error { padding: 15px; margin-bottom: 20px; border: 1px solid #f1d4d0; border-radius: var(--radius-small); background: #fff0ee; color: #943c3b; font-size: 12px; line-height: 1.6; }
.alert-error[hidden] { display: none; }

/* Authentication pages use the same Clean mesh, heading treatment and glass cards. */
.login-shell { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); min-height: 100vh; background: var(--bg-mesh), var(--background); }
.login-story { position: relative; display: flex; flex-direction: column; justify-content: space-between; overflow: hidden; padding: clamp(32px, 5vw, 72px); border-right: 1px solid var(--line); color: var(--ink); }
.login-story::after { content: ''; position: absolute; right: -120px; bottom: -170px; width: 440px; height: 440px; border: 1px solid rgba(30, 111, 220, .11); border-radius: 50%; box-shadow: 0 0 0 38px rgba(30, 111, 220, .025), 0 0 0 76px rgba(30, 111, 220, .02); pointer-events: none; }
.login-story > * { position: relative; z-index: 1; }
.login-story .brand-wordmark { width: 208px; }
.login-story-content { max-width: 500px; margin: 72px 0 80px; }
.login-story h1 { margin: 20px 0 24px; font-size: clamp(38px, 4.4vw, 62px); font-weight: 700; line-height: 1.12; letter-spacing: -.035em; }
.login-story h1 .brand-gradient-text { display: inline; color: var(--accent-2); background: var(--brand-gradient); background-clip: text; -webkit-background-clip: text; -webkit-text-fill-color: transparent; }
.login-story p:not(.eyebrow) { max-width: 390px; color: var(--muted); font-size: 15px; line-height: 1.8; }
.story-footer { color: var(--muted); font-size: 11px; letter-spacing: .02em; }
.story-lines { display: flex; align-items: center; gap: 20px; height: 90px; margin-top: 35px; opacity: .45; }
.story-lines span { width: 110px; height: 60px; border-top: 1px solid var(--accent); border-bottom: 1px solid var(--accent-2); border-radius: 50%; transform: skewY(-14deg); }
.story-lines span:nth-child(2) { height: 85px; }
.story-lines span:nth-child(3) { height: 42px; }
.login-form-area { display: flex; align-items: center; justify-content: center; min-width: 0; padding: 96px 40px 56px; }
.login-shell > .login-form-area:only-child { grid-column: 1 / -1; }
.login-card { width: 100%; max-width: 450px; padding: 36px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface-glass); box-shadow: var(--shadow-glow); }
.login-card > .brand-logo { margin-bottom: 24px; }
.login-card h2 { margin-bottom: 15px; font-size: 28px; line-height: 1.2; }
.login-card .muted { margin-bottom: 28px; font-size: 13px; }
.login-card label { display: block; margin: 19px 0 9px; color: var(--ink); font-size: 12px; font-weight: 600; }
.login-card input { width: 100%; }
.login-submit { justify-content: space-between; width: 100%; padding: 12px 18px; margin-top: 26px; }
.login-help { margin-top: 25px; padding-top: 20px; border-top: 1px solid var(--line); color: var(--muted); font-size: 12px; text-align: center; }
.login-help + .login-help { margin-top: 14px; padding-top: 0; border: 0; }
.secret-output { width: 100%; min-height: 110px; padding: 16px; border: 1px solid var(--border); border-radius: var(--radius-small); background: var(--background); color: var(--ink); font: 13px/1.6 ui-monospace, monospace; resize: vertical; overflow-wrap: anywhere; }
.mfa-qr { display: flex; justify-content: center; margin: 20px 0; }
.mfa-qr img { display: block; width: 256px; max-width: 100%; height: auto; border: 1px solid var(--line); border-radius: var(--radius-small); background: #fff; }
.mfa-manual-key { margin: 16px 0; font-size: 12px; }
.mfa-manual-key summary { color: var(--accent); cursor: pointer; line-height: 1.6; }
.mfa-manual-key code { overflow-wrap: anywhere; }

/* Operational forms share the same components without changing their behavior. */
.management-panel { padding: 24px; }
.management-form { display: flex; flex-wrap: wrap; align-items: end; gap: 16px; margin-top: 18px; }
.management-form label { display: flex; flex: 1; flex-direction: column; gap: 7px; min-width: min(200px, 100%); }
.management-form label:has(input[type=checkbox]) { flex-direction: row; align-items: center; min-width: 140px; }
.management-form input:not([type=checkbox]), .management-form select { width: 100%; }
.management-form input[type=checkbox], .inline-management input[type=checkbox] { min-height: 20px; width: 18px; }
.inline-management { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; }
.inline-management label { display: flex; align-items: center; gap: 6px; }
.lifecycle-operations { margin-top: 16px; padding: 14px; border: 1px solid var(--line); border-radius: var(--radius-small); background: var(--background); }
.lifecycle-operations form { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-top: 12px; }
.lifecycle-operations label { display: flex; align-items: center; gap: 8px; }
.lifecycle-operations input[type=checkbox] { min-height: 20px; width: 18px; }

@media (max-width: 1100px) {
    .portal-sidebar { width: 210px; padding: 28px 16px; }
    .portal-sidebar .brand-wordmark { width: 168px; }
    .portal-main { margin-left: 210px; }
    .page-content { padding: 30px 24px 48px; }
    .portal-topbar, .portal-footer { padding-right: 24px; padding-left: 24px; }
    .summary-card { padding: 20px; }
    .details-grid { grid-template-columns: minmax(0, 1fr); }
    .artifact-action { flex-direction: column; align-items: flex-end; gap: 10px; }
    .login-story { padding: 40px; }
    .login-story h1 { font-size: 42px; }
    .login-form-area { padding-right: 28px; padding-left: 28px; }
    .login-card { padding: 30px; }
}

@media (max-width: 740px) {
    .portal-shell { display: block; }
    .portal-sidebar { position: static; flex-direction: row; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 16px; width: 100%; padding: 20px; border-right: 0; border-bottom: 1px solid var(--line); overflow-y: visible; }
    .portal-sidebar .brand-wordmark { width: 164px; }
    .portal-sidebar nav { flex-direction: row; flex-wrap: wrap; gap: 6px; max-width: 100%; }
    .portal-sidebar nav a { padding: 8px 12px; border-radius: var(--radius-pill); font-size: 12px; }
    .sidebar-label, .sidebar-bottom { display: none; }
    .portal-main { margin-left: 0; }
    .portal-topbar { flex-wrap: wrap; min-height: 72px; padding: 16px 20px; gap: 14px; }
    .organization { font-size: 12px; }
    .account { font-size: 11px; }
    .page-content { padding: 26px 18px 45px; }
    .demo-banner { padding: 10px 20px; }
    .page-heading { align-items: flex-start; flex-wrap: wrap; gap: 16px; }
    .page-heading .button { font-size: 12px; }
    .summary-grid { gap: 10px; }
    .summary-card { padding: 16px 12px; }
    .summary-card > span { font-size: 11px; }
    .summary-card strong { font-size: 25px; }
    .summary-card strong small { font-size: 13px; }
    .summary-card > small { font-size: 10px; }
    .filters { padding: 16px; }
    .search-field { flex-basis: 100%; }
    .metadata-grid { grid-template-columns: minmax(0, 1fr); padding: 22px; }
    .artifact-row { flex-wrap: wrap; align-items: flex-start; gap: 12px; padding: 20px; }
    .artifact-action { flex-direction: row; justify-content: flex-end; width: 100%; }
    .file-icon { width: 32px; height: 38px; }
    .portal-footer { padding: 20px; }
    .pagination { flex-direction: column; align-items: flex-start; }
    .login-shell { grid-template-columns: minmax(0, 1fr); }
    .login-story { padding: 30px 24px; border-right: 0; border-bottom: 1px solid var(--line); }
    .login-story .brand-wordmark { width: 180px; }
    .login-story-content { max-width: 560px; margin: 34px 0 0; }
    .login-story h1 { margin: 16px 0; font-size: 36px; }
    .login-story p:not(.eyebrow) { max-width: 480px; font-size: 13px; }
    .story-lines, .story-footer, .login-story::after { display: none; }
    .login-form-area { padding: 28px 20px 36px; }
    .login-card { max-width: 480px; padding: 28px; }
}

@media (max-width: 460px) {
    .summary-grid { grid-template-columns: minmax(0, 1fr); }
    .summary-card { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 0 12px; padding: 16px 18px; }
    .summary-card strong { grid-column: 2; grid-row: 1 / 3; margin: 0; }
    .summary-card > small { grid-column: 1; font-size: 10px; }
    .login-story { padding: 26px 20px 22px; }
    .login-story .brand-wordmark { width: 154px; }
    .login-story h1 { font-size: 32px; }
    .login-card { padding: 24px 20px; }
    .login-card h2 { font-size: 25px; }
    .filters > div:not(.search-field) { flex: 1; }
    .filters select { width: 100%; }
    .panel-heading { flex-wrap: wrap; padding: 20px; }
    .management-panel { padding: 20px; }
    .management-form label { min-width: 0; flex-basis: 100%; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; animation: none !important; }
    .primary:hover:not(:disabled) { transform: none; }
}

@media (forced-colors: active) {
    .login-story h1 .brand-gradient-text { background: none; -webkit-text-fill-color: currentColor; }
    .nav-selected { outline: 1px solid currentColor; }
}
