:root {
    --bg: #02070b;
    --panel: rgba(255, 255, 255, 0.075);
    --panel-strong: rgba(255, 255, 255, 0.11);
    --border: rgba(255, 255, 255, 0.14);
    --text: #edf7ff;
    --muted: #9eb8ca;
    --accent: #18aee2;
    --accent-soft: rgba(24, 174, 226, 0.16);
    --success: #bbf7d0;
    --warning: #fde68a;
    --danger: #fecaca;
    --shadow: 0 24px 70px rgba(0, 0, 0, 0.44);
}

* {
    box-sizing: border-box;
}

html {
    min-height: 100%;
}

body {
    margin: 0;
    min-height: 100vh;
    font-family: Arial, Helvetica, sans-serif;
    color: var(--text);
    background:
        radial-gradient(circle at 18% 12%, rgba(24, 174, 226, 0.18), transparent 30%),
        radial-gradient(circle at 80% 0%, rgba(14, 116, 144, 0.12), transparent 34%),
        linear-gradient(135deg, #071821, var(--bg) 76%);
}

a {
    color: var(--accent);
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

button,
input,
textarea,
select {
    font: inherit;
}

.logo-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.logo-link img,
.portal-logo {
    display: block;
    width: min(420px, 78vw);
    max-height: 140px;
    object-fit: contain;
}

.auth-page {
    display: grid;
    place-items: center;
    padding: 30px 16px;
}

.auth-shell {
    width: min(460px, 100%);
}

.auth-shell.wide {
    width: min(720px, 100%);
}

.auth-card,
.hero-panel,
.info-card,
.studies-panel,
.content-card {
    border: 1px solid var(--border);
    background: linear-gradient(180deg, var(--panel), rgba(255, 255, 255, 0.04));
    box-shadow: var(--shadow);
    backdrop-filter: blur(16px);
}

.auth-card {
    padding: 30px;
    border-radius: 28px;
}

.auth-logo {
    display: flex;
    justify-content: center;
    margin-bottom: 24px;
}

.auth-card h1 {
    margin: 0 0 22px;
    text-align: center;
    font-size: 26px;
    letter-spacing: -0.5px;
}

label {
    display: block;
    margin: 14px 0 8px;
    color: #d8eef9;
    font-size: 14px;
    font-weight: 700;
}

input,
textarea,
select {
    width: 100%;
    padding: 12px 13px;
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: 14px;
    background: rgba(3, 12, 18, 0.72);
    color: var(--text);
    outline: none;
}

textarea {
    min-height: 120px;
    resize: vertical;
}

input:focus,
textarea:focus,
select:focus {
    border-color: rgba(24, 174, 226, 0.82);
    box-shadow: 0 0 0 4px rgba(24, 174, 226, 0.13);
}

input[readonly] {
    opacity: 0.8;
}

.grid {
    display: grid;
    gap: 14px;
}

.grid.two {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.btn,
button.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 43px;
    border: 0;
    border-radius: 14px;
    padding: 10px 16px;
    color: #041d28;
    font-weight: 900;
    cursor: pointer;
    background: linear-gradient(135deg, #31c6ef, #d9f7ff);
    text-decoration: none;
}

.btn:hover {
    text-decoration: none;
}

.btn-primary {
    width: 100%;
    margin-top: 18px;
}

.btn-secondary,
.btn-ghost {
    color: var(--text);
    background: rgba(255, 255, 255, 0.09);
    border: 1px solid var(--border);
}

.btn-compact {
    width: auto;
    margin-top: 0;
}

.alert {
    margin: 14px 0;
    padding: 12px 14px;
    border-radius: 14px;
    line-height: 1.45;
    border: 1px solid rgba(255, 255, 255, 0.15);
}

.alert-error {
    color: var(--danger);
    background: rgba(248, 113, 113, 0.14);
}

.alert-success {
    color: var(--success);
    background: rgba(34, 197, 94, 0.14);
}

.alert-warning {
    color: var(--warning);
    background: rgba(245, 158, 11, 0.14);
}

.alert-info {
    color: #bfdbfe;
    background: rgba(59, 130, 246, 0.14);
}

.auth-link,
.page-footer {
    margin: 18px 0 0;
    text-align: center;
    color: var(--muted);
}

.auth-links {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 18px;
    color: var(--muted);
}

.inline-form {
    margin-top: 12px;
}

.clean-topbar,
.topbar {
    position: sticky;
    top: 0;
    z-index: 10;
    min-height: 92px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 14px clamp(14px, 4vw, 42px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(3, 12, 18, 0.78);
    backdrop-filter: blur(16px);
}

.clean-topbar .logo-link img,
.topbar .logo-link img {
    width: min(330px, 52vw);
    max-height: 72px;
}

.clean-topbar nav,
.topbar nav {
    position: absolute;
    right: clamp(14px, 4vw, 42px);
    display: flex;
    gap: 10px;
    align-items: center;
}

.clean-topbar nav a,
.topbar nav a {
    padding: 9px 12px;
    border-radius: 999px;
    color: var(--text);
    background: rgba(255, 255, 255, 0.08);
}

.portal-shell,
.content-shell {
    width: min(1180px, calc(100% - 32px));
    margin: 28px auto;
}

.content-shell.narrow {
    width: min(760px, calc(100% - 32px));
}

.hero-panel {
    display: flex;
    justify-content: space-between;
    gap: 18px;
    align-items: center;
    padding: 24px;
    border-radius: 26px;
    margin-bottom: 18px;
}

.hero-panel h1,
.content-card h1 {
    margin: 0;
    font-size: clamp(30px, 5vw, 46px);
    line-height: 1.05;
    letter-spacing: -1.5px;
}

.hero-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
    justify-content: flex-end;
}

.status-pill {
    display: inline-flex;
    align-items: center;
    padding: 8px 11px;
    border-radius: 999px;
    color: var(--success);
    background: rgba(34, 197, 94, 0.15);
    font-weight: 900;
    font-size: 13px;
}

.card-grid {
    display: grid;
    gap: 16px;
}

.compact-grid {
    grid-template-columns: minmax(0, 1fr);
}

.info-card,
.studies-panel,
.content-card {
    padding: 22px;
    border-radius: 24px;
    margin-bottom: 18px;
}

.info-card h2,
.studies-panel h2,
.content-card h2 {
    margin: 0 0 14px;
}

.patient-card dl,
.detail-list {
    margin: 0;
    display: grid;
    gap: 12px;
}

.patient-card dl div {
    display: grid;
    gap: 4px;
}

dt {
    color: var(--muted);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

dd {
    margin: 0;
}

.section-head {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    align-items: center;
    margin-bottom: 14px;
}

.eyebrow {
    margin: 0 0 8px;
    color: var(--accent);
    text-transform: uppercase;
    letter-spacing: 0.14em;
    font-size: 12px;
    font-weight: 900;
}

.muted,
.policy-body {
    color: var(--muted);
    line-height: 1.7;
}

.meta-chip,
.study-badge,
.modality-pill,
.tiny-btn {
    display: inline-flex;
    align-items: center;
    border-radius: 999px;
    padding: 7px 10px;
    font-size: 12px;
    font-weight: 900;
}

.meta-chip {
    color: #bfdbfe;
    background: rgba(59, 130, 246, 0.14);
}

.study-badge.success {
    color: var(--success);
    background: rgba(34, 197, 94, 0.14);
}

.study-badge.warning {
    color: var(--warning);
    background: rgba(245, 158, 11, 0.14);
}

.study-badge.neutral,
.modality-pill {
    color: #bfdbfe;
    background: rgba(59, 130, 246, 0.14);
}

.tiny-btn {
    border: 1px solid rgba(255, 255, 255, 0.14);
    color: var(--text);
    background: rgba(255, 255, 255, 0.08);
    cursor: pointer;
}

.tiny-btn:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

.table-wrap {
    overflow-x: auto;
    border-radius: 18px;
    border: 1px solid rgba(255, 255, 255, 0.11);
}

.studies-table {
    width: 100%;
    min-width: 980px;
    border-collapse: collapse;
    background: rgba(3, 12, 18, 0.45);
}

.studies-table th,
.studies-table td {
    padding: 13px;
    text-align: left;
    border-bottom: 1px solid rgba(255, 255, 255, 0.09);
    vertical-align: middle;
}

.studies-table th {
    color: #d8eef9;
    background: rgba(255, 255, 255, 0.06);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.date-cell span,
.description-cell small {
    display: block;
    margin-top: 4px;
    color: var(--muted);
    font-size: 12px;
}

.actions-cell {
    display: flex;
    gap: 8px;
}

.loading-box,
.empty-study-box,
.success-panel {
    padding: 18px;
    border-radius: 18px;
    color: var(--muted);
    background: rgba(255, 255, 255, 0.055);
    border: 1px dashed rgba(255, 255, 255, 0.18);
}

.content-card {
    font-size: 16px;
}

.policy-body {
    margin-top: 18px;
    white-space: normal;
}

.content-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    justify-content: center;
}

.success-panel {
    text-align: center;
}

@media (max-width: 780px) {
    .grid.two {
        grid-template-columns: 1fr;
    }

    .clean-topbar,
    .topbar {
        padding-bottom: 68px;
    }

    .clean-topbar nav,
    .topbar nav {
        right: auto;
        bottom: 12px;
        justify-content: center;
    }

    .hero-panel,
    .section-head {
        align-items: flex-start;
        flex-direction: column;
    }

    .hero-actions {
        justify-content: flex-start;
    }
}