/* ==============================
   APP INFORMES · Clinical SaaS system
   Final visual layer loaded last.
============================== */

:root {
    --app-bg: #f6f7f9;
    --app-surface: #ffffff;
    --app-surface-soft: #fafbfc;
    --app-surface-muted: #f2f4f7;
    --app-text: #182230;
    --app-text-soft: #465466;
    --app-text-muted: #667085;
    --app-border: #d9dee7;
    --app-border-soft: #e7eaf0;
    --app-primary: #22354a;
    --app-primary-hover: #152233;
    --app-primary-soft: #edf3f8;
    --app-accent: #2f5d7c;
    --app-danger: #b42318;
    --app-danger-soft: #fff4f2;
    --app-warning: #a15c07;
    --app-success: #1f6b4f;
    --app-info: #245b83;
    --app-radius-xs: 6px;
    --app-radius-sm: 9px;
    --app-radius-md: 12px;
    --app-radius-lg: 16px;
    --app-shadow-xs: 0 1px 2px rgba(16, 24, 40, 0.04);
    --app-shadow-sm: 0 8px 24px rgba(16, 24, 40, 0.055);
    --app-focus: 0 0 0 3px rgba(47, 93, 124, 0.18);
    --app-header-h: 64px;
}

* {
    box-sizing: border-box;
}

html {
    background: var(--app-bg);
    scroll-padding-top: calc(var(--app-header-h) + 24px);
}

body {
    min-height: 100vh;
    background: var(--app-bg) !important;
    color: var(--app-text);
    font-size: 15px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

body::before,
.dashboard-pro::before,
.page-header::after,
.patient-detail-header::after,
.report-top::after,
.clinical-console::after {
    display: none !important;
}

body > * {
    position: relative;
    z-index: 1;
}

::selection {
    background: rgba(47, 93, 124, 0.18);
}

.sr-only {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    margin: -1px !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    white-space: nowrap !important;
    border: 0 !important;
}

a {
    color: var(--app-info);
}

a,
button,
input,
select,
textarea,
summary {
    -webkit-tap-highlight-color: transparent;
}

button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
summary:focus-visible,
[contenteditable="true"]:focus-visible {
    outline: none;
    box-shadow: var(--app-focus) !important;
}

p {
    color: var(--app-text-soft);
    line-height: 1.6;
}

h1,
h2,
h3 {
    color: var(--app-text);
    letter-spacing: -0.02em;
}

h1 {
    font-size: clamp(28px, 3.4vw, 38px);
    line-height: 1.14;
    font-weight: 700;
}

h2 {
    font-size: 21px;
    line-height: 1.22;
    font-weight: 680;
}

h3 {
    font-size: 15px;
    line-height: 1.3;
    font-weight: 650;
}

/* ==============================
   Product chrome
============================== */

.navbar {
    height: var(--app-header-h);
    padding: 0 clamp(18px, 4vw, 42px);
    background: var(--app-surface) !important;
    border-bottom: 1px solid var(--app-border-soft);
    box-shadow: none;
    backdrop-filter: none;
}

.nav-main,
.nav-left,
.nav-right {
    display: flex;
    align-items: center;
}

.nav-main {
    gap: clamp(16px, 2.4vw, 30px);
    min-width: 0;
}

.nav-left,
.nav-right {
    gap: 6px;
}

.navbar a {
    border-radius: var(--app-radius-sm);
    color: var(--app-text-soft);
    font-size: 14px;
    font-weight: 560;
    text-decoration: none;
    opacity: 1;
    transition: background 0.14s ease, color 0.14s ease, border-color 0.14s ease;
}

.navbar a:hover {
    background: var(--app-surface-muted);
    color: var(--app-text);
    opacity: 1;
}

.nav-brand {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 0;
    color: var(--app-text) !important;
    letter-spacing: 0;
}

.nav-brand:hover {
    background: transparent !important;
}

.brand-mark {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border: 1px solid #203145;
    border-radius: 9px;
    background: var(--app-primary);
    color: #ffffff;
    box-shadow: none;
    font-size: 12px;
    font-weight: 750;
    letter-spacing: 0.02em;
}

.brand-copy {
    display: inline-flex;
    flex-direction: column;
    gap: 1px;
    color: var(--app-text);
    font-size: 13px;
    font-weight: 760;
    line-height: 1.05;
}

.brand-copy small {
    color: var(--app-text-muted);
    font-size: 10px;
    font-weight: 650;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.nav-left a,
.nav-logout {
    display: inline-flex;
    align-items: center;
    min-height: 36px;
    padding: 0 11px;
}

.navbar a.nav-active,
.navbar a.nav-active:hover {
    background: var(--app-primary-soft);
    color: var(--app-primary);
    box-shadow: inset 0 0 0 1px rgba(47, 93, 124, 0.18);
    font-weight: 700;
}

.nav-logout {
    color: var(--app-text-muted) !important;
}

.nav-logout:hover {
    color: var(--app-danger) !important;
    background: var(--app-danger-soft) !important;
}

/* ==============================
   Layout + headers
============================== */

.page,
.dashboard-page {
    width: min(100%, 1240px);
    max-width: 1240px;
    margin: 0 auto;
    padding-left: clamp(18px, 4vw, 42px);
    padding-right: clamp(18px, 4vw, 42px);
}

.page {
    padding-top: clamp(28px, 4vw, 48px);
    padding-bottom: 72px;
}

.dashboard-page {
    padding-top: clamp(30px, 4vw, 50px);
    padding-bottom: 72px;
}

.page-header,
.patient-detail-header,
.report-top {
    overflow: visible;
    align-items: flex-start;
    margin-bottom: 22px;
    padding: 22px 24px;
    border: 1px solid var(--app-border-soft);
    border-radius: var(--app-radius-lg);
    background: var(--app-surface);
    box-shadow: var(--app-shadow-xs);
    cursor: default;
}

.page-header > *,
.patient-detail-header > *,
.report-top > * {
    position: relative;
    z-index: 1;
}

.eyebrow,
.section-kicker,
.panel-label,
.uccap-side-title,
.field-block h3,
.detail-item span,
.summary-card span,
.followup-detail-field strong {
    color: var(--app-text-muted);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.075em;
    line-height: 1.25;
    text-transform: uppercase;
}

.eyebrow,
.section-kicker {
    display: block;
    width: fit-content;
    min-height: auto;
    margin: 0 0 10px;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
    color: var(--app-accent);
}

.eyebrow::before,
.section-kicker::before {
    display: none;
}

.detail-subtitle,
.report-subtitle,
.patient-meta,
.helper-text,
.followup-status,
.ai-generator-actions span {
    color: var(--app-text-muted);
}

.detail-subtitle,
.report-subtitle {
    margin-top: 10px;
    font-size: 14px;
}

.header-actions,
.button-row,
.hero-actions,
.ai-generator-actions,
.followup-actions {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
}

/* ==============================
   Buttons and clear interactions
============================== */

button,
.primary-link,
.secondary-button,
.secondary-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 40px;
    padding: 0 15px;
    border-radius: var(--app-radius-sm);
    border: 1px solid transparent;
    font-size: 14px;
    font-weight: 680;
    line-height: 1;
    text-decoration: none;
    cursor: pointer;
    box-shadow: none;
    transition: background 0.14s ease, border-color 0.14s ease, color 0.14s ease, box-shadow 0.14s ease;
}

button,
.primary-link {
    background: var(--app-primary);
    border-color: var(--app-primary);
    color: #ffffff;
}

button:hover,
.primary-link:hover {
    background: var(--app-primary-hover);
    border-color: var(--app-primary-hover);
}

.danger-button {
    background: var(--app-danger);
    border-color: var(--app-danger);
    color: #ffffff;
}

.danger-button:hover {
    background: #912018;
    border-color: #912018;
}

.secondary-button,
.secondary-link {
    background: var(--app-surface);
    border-color: var(--app-border);
    color: var(--app-primary);
}

.secondary-button:hover,
.secondary-link:hover {
    background: var(--app-surface-muted);
    border-color: #c9d0dc;
}

.inline-form,
.ai-bottom-generator-form {
    margin: 0;
    padding: 0;
    border: 0;
    background: transparent;
    box-shadow: none;
}

/* ==============================
   Auth
============================== */

.login-container {
    min-height: 100vh;
    display: grid;
    grid-template-columns: minmax(300px, 440px) minmax(320px, 420px);
    gap: 28px;
    align-items: center;
    justify-content: center;
    padding: clamp(22px, 4vw, 42px);
    background: var(--app-bg);
}

.auth-intro,
.login-box {
    border: 1px solid var(--app-border-soft);
    border-radius: var(--app-radius-lg);
    background: var(--app-surface);
    box-shadow: var(--app-shadow-xs);
}

.auth-intro {
    padding: 30px;
}

.auth-badge {
    display: inline-flex;
    margin-bottom: 18px;
    color: var(--app-accent);
    font-size: 12px;
    font-weight: 760;
    letter-spacing: 0.08em;
}

.auth-intro h1 {
    max-width: 400px;
    font-size: clamp(28px, 4vw, 38px);
}

.auth-intro p {
    max-width: 410px;
    margin: 16px 0 0;
}

.auth-points {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 24px;
}

.auth-points span {
    display: inline-flex;
    align-items: center;
    min-height: 30px;
    padding: 0 10px;
    border: 1px solid var(--app-border-soft);
    border-radius: 999px;
    background: var(--app-surface-soft);
    color: var(--app-text-soft);
    font-size: 12px;
    font-weight: 620;
}

.login-box {
    width: 100%;
    max-width: none;
    padding: 30px;
}

.login-box h2 {
    margin: 0 0 22px;
    text-align: left;
    font-size: 24px;
}

.login-box input {
    margin-bottom: 12px;
}

.login-box button {
    width: 100%;
    margin-top: 6px;
}

.switch {
    margin: 18px 0 0;
    color: var(--app-text-muted);
    font-size: 14px;
    text-align: center;
}

.switch a {
    color: var(--app-primary);
    font-weight: 650;
    text-decoration: none;
}

.switch a:hover {
    text-decoration: underline;
}

/* ==============================
   Dashboard workspace
============================== */

.dashboard-hero {
    display: grid;
    grid-template-columns: minmax(0, 1.08fr) minmax(320px, 0.92fr);
    gap: 22px;
    align-items: stretch;
}

.dashboard-hero-copy,
.clinical-console,
.dashboard-actions {
    border: 1px solid var(--app-border-soft);
    border-radius: var(--app-radius-lg);
    background: var(--app-surface);
    box-shadow: var(--app-shadow-xs);
}

.dashboard-hero-copy {
    max-width: none;
    padding: clamp(24px, 3vw, 34px);
}

.dashboard-hero h1 {
    max-width: 680px;
    margin: 0 0 14px;
    font-size: clamp(30px, 4vw, 44px);
    line-height: 1.1;
    letter-spacing: -0.035em;
    font-weight: 720;
}

.hero-description {
    max-width: 660px;
    margin: 0;
    color: var(--app-text-soft);
    font-size: 15px;
    line-height: 1.65;
}

.hero-actions {
    margin-top: 24px;
}

.hero-actions .primary-link,
.hero-actions .secondary-link {
    min-height: 42px;
    padding: 0 16px;
    border-radius: var(--app-radius-sm);
    box-shadow: none;
}

.clinical-console {
    overflow: hidden;
    background: var(--app-surface);
}

.console-topbar {
    display: flex;
    align-items: center;
    min-height: 48px;
    padding: 0 18px;
    border-bottom: 1px solid var(--app-border-soft);
    color: var(--app-text-muted);
    font-size: 12px;
}

.console-topbar strong {
    margin: 0;
    color: var(--app-text);
    font-size: 13px;
    font-weight: 700;
}

.console-icon {
    display: none;
}

.console-patient-card {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    margin: 18px;
    padding: 18px;
    border: 1px solid var(--app-border-soft);
    border-radius: var(--app-radius-md);
    background: var(--app-surface-soft);
    box-shadow: none;
}

.console-patient-card h2 {
    max-width: 360px;
    margin: 0;
    font-size: 20px;
    line-height: 1.22;
}

.status-pill,
.info-tag,
.group-error-label,
.nav-error-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 700;
}

.status-pill {
    min-height: 26px;
    padding: 0 9px;
    border: 1px solid rgba(31, 107, 79, 0.18);
    background: #eef8f3;
    color: var(--app-success);
}

.workflow-list {
    display: grid;
    padding: 0 18px 18px;
}

.workflow-step {
    display: grid;
    grid-template-columns: 34px 1fr;
    gap: 12px;
    align-items: start;
    padding: 14px 0;
    border-top: 1px solid var(--app-border-soft);
    background: transparent;
}

.workflow-step::before {
    display: none;
}

.workflow-step span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    border: 1px solid var(--app-border-soft);
    border-radius: var(--app-radius-xs);
    background: var(--app-surface);
    color: var(--app-text-muted);
    font-size: 12px;
    font-weight: 750;
}

.workflow-step.is-current span {
    border-color: var(--app-primary);
    background: var(--app-primary);
    color: #ffffff;
}

.workflow-step strong {
    display: block;
    margin: 0 0 3px;
    color: var(--app-text);
    font-size: 14px;
}

.workflow-step p {
    margin: 0;
    color: var(--app-text-muted);
    font-size: 13px;
}

.dashboard-actions {
    margin-top: 22px;
    padding: 22px;
}

.section-heading {
    margin-bottom: 14px;
}

.action-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 14px;
}

.action-card,
.quality-note {
    position: relative;
    min-height: 142px;
    padding: 18px;
    border-radius: var(--app-radius-md);
}

.action-card {
    display: grid;
    grid-template-columns: 38px 1fr;
    column-gap: 12px;
    row-gap: 5px;
    align-items: center;
    border: 1px solid rgba(47, 93, 124, 0.28);
    background: var(--app-surface);
    color: var(--app-text);
    text-decoration: none;
    cursor: pointer;
    box-shadow: var(--app-shadow-xs);
    transition: border-color 0.14s ease, background 0.14s ease, box-shadow 0.14s ease;
}

.action-card:hover {
    border-color: var(--app-accent);
    background: #fbfdff;
    box-shadow: var(--app-shadow-sm);
}

.action-card strong,
.quality-note strong {
    align-self: end;
    color: var(--app-text);
    font-size: 15px;
    font-weight: 700;
}

.action-card small,
.quality-note small {
    align-self: start;
    color: var(--app-text-muted);
    font-size: 13px;
    line-height: 1.45;
}

.quick-icon,
.info-icon {
    grid-row: span 2;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    border-radius: var(--app-radius-sm);
    font-size: 16px;
    font-weight: 760;
}

.quick-icon {
    border: 1px solid var(--app-primary);
    background: var(--app-primary);
    color: #ffffff;
}

.info-icon {
    border: 1px solid var(--app-border-soft);
    background: var(--app-surface-muted);
    color: var(--app-text-muted);
}

.action-cta {
    grid-column: 2;
    align-self: end;
    width: fit-content;
    margin-top: 6px;
    color: var(--app-accent);
    font-size: 13px;
    font-weight: 720;
}

.quality-note {
    display: grid;
    grid-template-columns: 38px 1fr;
    column-gap: 12px;
    row-gap: 5px;
    align-items: center;
    border: 1px dashed var(--app-border);
    background: var(--app-surface-soft);
    cursor: default;
}

.info-tag {
    position: absolute;
    top: 14px;
    right: 14px;
    min-height: 24px;
    padding: 0 8px;
    border: 1px solid var(--app-border-soft);
    background: var(--app-surface);
    color: var(--app-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

/* ==============================
   Lists
============================== */

.search-bar {
    margin-bottom: 16px;
}

.search-bar input {
    height: 46px;
    border-radius: var(--app-radius-md);
    border-color: var(--app-border);
    background: var(--app-surface);
    font-size: 14px;
}

.list {
    overflow: hidden;
    border: 1px solid var(--app-border-soft);
    border-radius: var(--app-radius-lg);
    background: var(--app-surface);
    box-shadow: var(--app-shadow-xs);
}

.list-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    padding: 16px 18px;
    border-bottom: 1px solid var(--app-border-soft);
    background: var(--app-surface);
    transition: background 0.14s ease;
}

.list-item:last-child {
    border-bottom: 0;
}

.list-item:hover {
    background: var(--app-surface-soft);
}

.patient-name {
    color: var(--app-text);
    font-size: 15px;
    font-weight: 700;
}

.patient-meta {
    margin-top: 4px;
    color: var(--app-text-muted);
    font-size: 13px;
}

.list-right a {
    display: inline-flex;
    align-items: center;
    min-height: 34px;
    padding: 0 11px;
    border: 1px solid var(--app-border);
    border-radius: var(--app-radius-sm);
    background: var(--app-surface);
    color: var(--app-primary);
    font-size: 13px;
    font-weight: 700;
    text-decoration: none;
}

.list-right a:hover {
    background: var(--app-primary-soft);
    border-color: rgba(47, 93, 124, 0.28);
    text-decoration: none;
}

/* ==============================
   Forms
============================== */

.form-card,
.report-card,
.ai-generator-panel,
.summary-card,
.clinical-section,
.uccap-group,
.followup-visit-card,
.detail-item,
.followup-detail-card {
    border: 1px solid var(--app-border-soft);
    background: var(--app-surface);
    box-shadow: var(--app-shadow-xs);
}

.form-card,
.report-card,
.ai-generator-panel,
.clinical-section {
    border-radius: var(--app-radius-lg);
}

.form-card {
    padding: clamp(20px, 3vw, 28px);
}

.required-help {
    margin: 0 0 16px;
    color: var(--app-text-muted);
    font-size: 13px;
}

.required-mark {
    color: var(--app-danger);
    font-weight: 760;
}

.form-section {
    margin-bottom: 28px;
    padding-top: 0;
    border-top: 0;
    scroll-margin-top: calc(var(--app-header-h) + 24px);
}

.form-section h2 {
    margin-bottom: 18px;
    padding: 0 0 14px;
    border-left: 0;
    border-bottom: 1px solid var(--app-border-soft);
}

.form-grid,
.followup-visit-grid,
.detail-grid,
.followup-detail-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
}

.full-width,
.detail-full,
.followup-visit-grid .full-width {
    grid-column: span 2;
}

.form-field {
    width: 100%;
}

label,
.form-grid label {
    display: block;
    margin: 0 0 6px;
    color: var(--app-text-soft);
    font-size: 13px;
    font-weight: 650;
}

input,
textarea,
select,
.form-field select {
    width: 100%;
    border: 1px solid var(--app-border);
    border-radius: var(--app-radius-sm);
    background: var(--app-surface);
    color: var(--app-text);
    font-size: 14px;
    line-height: 1.45;
    outline: none;
    transition: border-color 0.14s ease, box-shadow 0.14s ease, background 0.14s ease;
}

input,
select,
.form-field select {
    height: 42px;
    padding: 0 12px;
}

textarea {
    min-height: 108px;
    padding: 11px 12px;
    resize: vertical;
}

input:hover,
textarea:hover,
select:hover {
    border-color: #c8d0da;
}

input:focus,
textarea:focus,
select:focus,
.form-field select:focus {
    border-color: var(--app-accent);
    background: #ffffff;
    box-shadow: var(--app-focus);
}

input::placeholder,
textarea::placeholder {
    color: #98a2b3;
}

.radio-row {
    display: flex !important;
    flex-direction: row !important;
    flex-wrap: wrap;
    align-items: center !important;
    gap: 8px !important;
    min-height: 42px !important;
    padding: 0 !important;
}

.radio-option {
    display: inline-flex !important;
    align-items: center !important;
    gap: 7px !important;
    width: auto !important;
    min-height: 34px !important;
    margin: 0 !important;
    padding: 0 10px !important;
    border: 1px solid var(--app-border-soft);
    border-radius: var(--app-radius-sm);
    background: var(--app-surface-soft);
    color: var(--app-text-soft) !important;
    font-size: 13px !important;
    font-weight: 620;
    cursor: pointer;
}

.radio-option:has(input:checked) {
    border-color: rgba(47, 93, 124, 0.38);
    background: var(--app-primary-soft);
    color: var(--app-primary) !important;
}

.form-card input[type="radio"],
.form-card input[type="checkbox"],
.radio-row input[type="radio"],
.radio-row input[type="checkbox"],
.radio-input {
    appearance: auto !important;
    -webkit-appearance: radio !important;
    width: 14px !important;
    height: 14px !important;
    min-width: 14px !important;
    min-height: 14px !important;
    max-width: 14px !important;
    max-height: 14px !important;
    padding: 0 !important;
    margin: 0 !important;
    border: 0 !important;
    box-shadow: none !important;
    flex: 0 0 14px !important;
    accent-color: var(--app-primary);
}

.radio-option span {
    display: inline !important;
    margin: 0 !important;
}

.uccap-group {
    margin-bottom: 18px;
    padding: 20px;
    border-radius: var(--app-radius-md);
}

.uccap-group legend {
    padding: 0 8px;
    color: var(--app-text);
    font-size: 14px;
    font-weight: 700;
}

.followup-visits,
.followup-visits-list,
.followup-detail-list {
    display: grid;
    gap: 14px;
}

.followup-visit-card,
.followup-detail-card,
.detail-item {
    border-radius: var(--app-radius-md);
    background: var(--app-surface-soft);
    box-shadow: none;
}

.followup-visit-card {
    padding: 16px;
}

.followup-visit-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 14px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--app-border-soft);
}

.followup-visit-title {
    margin: 0;
    color: var(--app-text);
    font-size: 14px;
    font-weight: 720;
}

.followup-add-visit,
.followup-remove-visit {
    min-height: 34px;
    padding: 0 12px;
    font-size: 13px;
}

.followup-status {
    margin: 0;
    color: var(--app-text-muted);
    font-size: 12px;
}

.followup-summary-grid {
    margin-top: 14px;
}

/* ==============================
   eUCCAP navigation + detail
============================== */

.uccap-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 286px;
    gap: 22px;
    align-items: start;
}

.uccap-main-content {
    min-width: 0;
}

.uccap-side-menu {
    position: sticky;
    top: calc(var(--app-header-h) + 18px);
    align-self: start;
    max-height: calc(100vh - var(--app-header-h) - 34px);
    overflow: auto;
    order: 2;
}

.uccap-side-card {
    padding: 14px;
    border: 1px solid var(--app-border-soft);
    border-radius: var(--app-radius-lg);
    background: var(--app-surface);
    box-shadow: var(--app-shadow-xs);
}

.uccap-side-title {
    margin: 0 0 10px;
}

.uccap-side-section,
.uccap-side-submenu a {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    border-radius: var(--app-radius-sm);
    color: var(--app-text-soft);
    text-decoration: none;
    transition: background 0.14s ease, color 0.14s ease, box-shadow 0.14s ease;
}

.uccap-side-section {
    margin-top: 4px;
    padding: 9px 10px;
    color: var(--app-text);
    font-size: 13px;
    font-weight: 720;
}

.uccap-side-submenu {
    display: grid;
    gap: 2px;
    margin: 2px 0 8px 0;
    padding-left: 10px;
    border-left: 1px solid var(--app-border-soft);
}

.uccap-side-submenu a {
    padding: 7px 9px;
    font-size: 12px;
    line-height: 1.3;
}

.uccap-side-section:hover,
.uccap-side-submenu a:hover {
    background: var(--app-surface-muted);
    color: var(--app-primary);
    transform: none;
}

[data-uccap-dynamic] .uccap-side-section.is-active,
[data-uccap-dynamic] .uccap-side-submenu a.is-active {
    background: var(--app-primary-soft);
    color: var(--app-primary);
    box-shadow: inset 3px 0 0 var(--app-accent);
    font-weight: 760;
}

[data-uccap-dynamic] .uccap-side-submenu.is-open {
    border-left-color: rgba(47, 93, 124, 0.28);
}

.uccap-side-section.is-disabled {
    border: 1px dashed var(--app-border);
    background: var(--app-surface-muted);
    color: var(--app-text-muted);
    cursor: not-allowed;
    pointer-events: none;
}

.uccap-side-section-note {
    flex-shrink: 0;
    color: var(--app-text-muted);
    font-size: 10px;
    font-weight: 760;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.uccap-group,
.clinical-section,
.field-block {
    scroll-margin-top: calc(var(--app-header-h) + 24px);
}

.clinical-layout {
    display: grid;
    gap: 16px;
}

.clinical-section {
    padding: 24px;
}

.clinical-section h2 {
    margin: 0 0 18px;
    padding-bottom: 14px;
    border-bottom: 1px solid var(--app-border-soft);
}

.field-block {
    margin: 0;
    padding: 18px 0;
    border-top: 1px solid var(--app-border-soft);
}

.field-block:first-of-type {
    padding-top: 0;
    border-top: 0;
}

.field-block:last-of-type {
    padding-bottom: 0;
}

.field-block h3 {
    margin: 0 0 12px;
    color: var(--app-text-muted);
}

.detail-grid,
.followup-detail-grid {
    gap: 12px;
}

.detail-item {
    padding: 14px;
}

.detail-item span {
    display: block;
    margin-bottom: 7px;
}

.detail-item p,
.followup-detail-field p {
    margin: 0;
    color: var(--app-text);
    font-size: 14px;
    line-height: 1.55;
}

.followup-detail-card {
    display: block;
}

.followup-detail-grid {
    margin-top: 10px;
}

.followup-detail-field strong {
    display: block;
    margin-bottom: 4px;
}

.summary-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 12px;
    margin-bottom: 22px;
}

.summary-card {
    padding: 16px;
    border-radius: var(--app-radius-md);
    box-shadow: none;
}

.summary-card strong {
    display: block;
    margin-top: 6px;
    color: var(--app-text);
    font-size: 16px;
    line-height: 1.35;
}

.empty-group-message,
.empty-section-message {
    margin: 0;
    padding: 13px 14px;
    border: 1px dashed var(--app-border);
    border-radius: var(--app-radius-md);
    background: var(--app-surface-soft);
    color: var(--app-text-muted);
    font-size: 13px;
}

.empty-section-message {
    margin-top: 14px;
}

/* ==============================
   AI/report surfaces
============================== */

.ai-generator-panel {
    display: grid;
    grid-template-columns: minmax(0, 0.9fr) minmax(320px, 1.1fr);
    gap: 22px;
    margin-bottom: 22px;
    padding: 22px;
}

.ai-generator-copy h2 {
    margin-bottom: 10px;
}

.ai-generator-form {
    display: grid;
    gap: 14px;
    margin: 0;
}

.ai-auto-detection-note {
    padding: 14px;
    border: 1px solid var(--app-border-soft);
    border-left: 3px solid var(--app-info);
    border-radius: var(--app-radius-md);
    background: var(--app-surface-soft);
    color: var(--app-text-soft);
    font-size: 13px;
    line-height: 1.55;
}

.ai-auto-detection-note strong {
    color: var(--app-text);
}

.ai-advanced-options {
    border: 1px solid var(--app-border-soft);
    border-radius: var(--app-radius-md);
    background: var(--app-surface);
}

.ai-advanced-options summary {
    min-height: 42px;
    padding: 0 14px;
    color: var(--app-primary);
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
}

.ai-form-row {
    padding: 0 14px 14px;
}

.ai-generator-actions {
    margin-top: 0;
}

.ai-generator-actions span {
    font-size: 13px;
}

.ai-bottom-generator {
    margin-top: 22px;
    display: flex;
    justify-content: flex-end;
}

.report-card {
    padding: 22px;
}

.report-card .helper-text {
    margin: 0 0 14px;
    padding: 12px 14px;
    border: 1px solid var(--app-border-soft);
    border-radius: var(--app-radius-md);
    background: var(--app-surface-soft);
    color: var(--app-text-muted);
    font-size: 13px;
}

.report-editor-rich {
    min-height: 520px;
    padding: clamp(22px, 4vw, 44px);
    border: 1px solid var(--app-border);
    border-radius: var(--app-radius-md);
    background: #ffffff;
    color: var(--app-text);
    font-family: Georgia, "Times New Roman", serif;
    font-size: 16px;
    line-height: 1.72;
    outline: none;
    box-shadow: inset 0 0 0 1px rgba(16, 24, 40, 0.015);
}

.report-editor-rich:focus {
    border-color: var(--app-accent);
    box-shadow: var(--app-focus) !important;
}

.report-editor-rich strong,
.report-editor-rich b {
    color: #111827;
}

/* ==============================
   Modal dialogs
============================== */

body.modal-open {
    overflow: hidden;
}

.modal-backdrop {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: rgba(15, 23, 42, 0.42);
}

.modal-backdrop[hidden] {
    display: none !important;
}

.modal-card {
    width: min(100%, 520px);
    padding: 22px;
    border: 1px solid var(--app-border);
    border-radius: var(--app-radius-lg);
    background: var(--app-surface);
    box-shadow: 0 18px 46px rgba(16, 24, 40, 0.16);
}

.modal-header {
    margin-bottom: 10px;
}

.modal-header h2 {
    margin: 4px 0 0;
    font-size: 22px;
}

.modal-card p {
    margin: 0;
}

.modal-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 22px;
}

/* ==============================
   Validation and states
============================== */

.error-box,
.form-error-summary {
    border: 1px solid #f3b5ad;
    border-radius: var(--app-radius-md);
    background: var(--app-danger-soft);
    color: #7a271a;
}

.error-box {
    padding: 16px;
}

.compact-error {
    margin-bottom: 14px;
    padding: 11px 12px;
    font-size: 13px;
}

.form-error-summary {
    margin-bottom: 18px;
    padding: 16px;
}

.form-error-summary h2 {
    margin: 0 0 6px;
    color: var(--app-danger);
    font-size: 17px;
}

.form-error-summary p {
    margin: 0 0 10px;
    color: #7a271a;
}

.form-error-summary ul {
    margin: 0;
    padding-left: 18px;
}

.form-error-summary li + li {
    margin-top: 5px;
}

.form-error-summary a {
    color: var(--app-danger);
    font-weight: 700;
}

.form-field.has-error label {
    color: var(--app-danger);
}

.form-field.has-error input,
.form-field.has-error textarea,
.form-field.has-error select {
    border-color: #d92d20;
    background: #fffafa;
    box-shadow: 0 0 0 3px rgba(217, 45, 32, 0.08);
}

.form-field.has-error .radio-row {
    border: 1px solid #d92d20;
    border-radius: var(--app-radius-md);
    padding: 8px !important;
    background: #fffafa;
}

.field-error {
    margin: 6px 0 0;
    color: var(--app-danger);
    font-size: 12px;
    line-height: 1.35;
}

.uccap-group.has-errors,
.followup-visit-card.has-errors {
    border-color: #f3b5ad;
    box-shadow: 0 0 0 3px rgba(217, 45, 32, 0.05);
}

.group-error-label,
.nav-error-badge {
    background: #fee4e2;
    color: var(--app-danger);
}

.group-error-label {
    margin-left: 8px;
    padding: 3px 8px;
}

.nav-error-badge {
    min-width: 19px;
    height: 19px;
    padding: 0 6px;
}

.uccap-side-submenu a.has-group-errors {
    color: var(--app-danger);
    font-weight: 720;
}

[data-uccap-section].is-hidden,
[data-uccap-section][hidden] {
    display: none !important;
}

[data-uccap-section]:not(.is-hidden) {
    animation: section-enter 0.16s ease-out;
}

@keyframes section-enter {
    from {
        opacity: 0;
        transform: translateY(4px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

[data-uccap-group]:target,
[data-uccap-section]:target {
    outline: 3px solid rgba(47, 93, 124, 0.18);
    outline-offset: 4px;
}

/* ==============================
   Responsive
============================== */

@media (max-width: 1100px) {
    .dashboard-hero,
    .ai-generator-panel,
    .uccap-layout {
        grid-template-columns: 1fr;
    }

    .uccap-side-menu {
        position: sticky;
        top: var(--app-header-h);
        z-index: 4;
        order: -1;
        max-height: 46vh;
    }

    .uccap-side-card {
        padding: 12px;
    }

    .summary-grid,
    .action-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 900px) {
    .login-container {
        grid-template-columns: 1fr;
    }

    .auth-intro,
    .login-box {
        max-width: 620px;
        width: 100%;
        justify-self: center;
    }

    .page-header,
    .patient-detail-header,
    .report-top {
        flex-direction: column;
        align-items: stretch;
    }

    .form-grid,
    .followup-visit-grid,
    .detail-grid,
    .followup-detail-grid,
    .summary-grid,
    .action-grid {
        grid-template-columns: 1fr;
    }

    .full-width,
    .detail-full,
    .followup-visit-grid .full-width,
    .action-cta {
        grid-column: span 1;
    }

    .ai-generator-actions span {
        flex-basis: 100%;
    }
}

@media (max-width: 640px) {
    .navbar {
        height: auto;
        min-height: 0;
        align-items: flex-start;
        flex-direction: column;
        gap: 12px;
        padding: 14px 16px;
    }

    .nav-main {
        width: 100%;
        align-items: flex-start;
        flex-direction: column;
        gap: 12px;
    }

    .nav-left,
    .nav-right {
        width: 100%;
        flex-wrap: wrap;
    }

    .nav-left a,
    .nav-logout {
        flex: 1 1 auto;
        justify-content: center;
    }

    .page,
    .dashboard-page {
        padding-left: 16px;
        padding-right: 16px;
    }

    .page-header,
    .patient-detail-header,
    .report-top,
    .dashboard-hero-copy,
    .clinical-console,
    .dashboard-actions,
    .form-card,
    .report-card,
    .ai-generator-panel,
    .clinical-section {
        border-radius: var(--app-radius-md);
    }

    .button-row,
    .hero-actions,
    .header-actions,
    .ai-generator-actions,
    .followup-actions {
        flex-direction: column;
        align-items: stretch;
    }

    button,
    .primary-link,
    .secondary-button,
    .secondary-link {
        width: 100%;
    }

    .modal-backdrop {
        align-items: flex-end;
        padding: 14px;
    }

    .modal-card {
        border-radius: var(--app-radius-md);
    }

    .modal-actions {
        flex-direction: column-reverse;
    }

    .modal-actions button {
        width: 100%;
    }

    .list-item,
    .console-patient-card,
    .followup-visit-header {
        flex-direction: column;
        align-items: stretch;
    }

    .list-right a {
        width: 100%;
        justify-content: center;
    }

    .uccap-side-menu {
        position: static;
        max-height: none;
    }
}

/* Collapsible assessment cards */
.assessment-card.is-collapsible {
    padding: 0;
    overflow: hidden;
}

.assessment-card.is-collapsible > summary {
    list-style: none;
    cursor: pointer;
    margin: 0;
    padding: 16px;
    border-bottom: 0;
}

.assessment-card.is-collapsible > summary::-webkit-details-marker {
    display: none;
}

.assessment-card.is-collapsible > summary::before {
    content: '▸';
    color: var(--app-text-muted);
    font-size: 13px;
    line-height: 1;
    margin-top: 4px;
    transition: transform 0.18s ease;
}

.assessment-card.is-collapsible[open] > summary::before {
    transform: rotate(90deg);
}

.assessment-card.is-collapsible[open] > summary {
    border-bottom: 1px solid var(--app-border-soft);
}

.assessment-card.is-collapsible > .followup-visit-grid {
    padding: 16px;
}

.assessment-card.is-collapsible .followup-remove-visit {
    margin-left: auto;
}

.pat-child-sessions {
    margin-top: 18px;
}

.pat-child-session-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
}

@media (max-width: 1100px) {
    .pat-child-session-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 700px) {
    .pat-child-session-grid {
        grid-template-columns: 1fr;
    }
}

.repeatable-field-heading h3 {
    margin: 0;
    color: var(--app-text);
    font-size: 14px;
    font-weight: 720;
}

.repeatable-field-heading {
    display: grid;
    gap: 6px;
}


/* Repeatable clinical records: collapsible cards in edit and detail views */
.followup-visit-card.is-collapsible {
    padding: 0;
    overflow: hidden;
}

.followup-visit-card.is-collapsible > summary {
    list-style: none;
    cursor: pointer;
    margin: 0;
    padding: 16px;
    border-bottom: 0;
}

.followup-visit-card.is-collapsible > summary::-webkit-details-marker,
.repeatable-detail-card.is-collapsible > summary::-webkit-details-marker {
    display: none;
}

.followup-visit-card.is-collapsible > summary::before,
.repeatable-detail-card.is-collapsible > summary::before {
    content: '▸';
    color: var(--app-text-muted);
    font-size: 13px;
    line-height: 1;
    margin-top: 4px;
    transition: transform 0.18s ease;
}

.followup-visit-card.is-collapsible[open] > summary::before,
.repeatable-detail-card.is-collapsible[open] > summary::before {
    transform: rotate(90deg);
}

.followup-visit-card.is-collapsible[open] > summary {
    border-bottom: 1px solid var(--app-border-soft);
}

.followup-visit-card.is-collapsible > .followup-visit-grid {
    padding: 16px;
}

.followup-visit-card.is-collapsible .followup-remove-visit {
    margin-left: auto;
}

.repeatable-detail-card.is-collapsible {
    padding: 0;
    overflow: hidden;
}

.repeatable-detail-card.is-collapsible > summary {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    list-style: none;
    cursor: pointer;
    padding: 14px;
}

.repeatable-detail-card.is-collapsible > summary span {
    margin-bottom: 0;
    color: var(--app-text);
    font-weight: 720;
}

.repeatable-detail-card.is-collapsible[open] > summary {
    border-bottom: 1px solid var(--app-border-soft);
}

.repeatable-detail-card.is-collapsible > .followup-detail-grid {
    margin-top: 0;
    padding: 14px;
}

.ai-bottom-generator-form {
    display: grid;
    gap: 12px;
    justify-items: end;
}

.ai-bottom-language-row {
    width: min(280px, 100%);
    padding: 0;
}

.ai-bottom-generator-form .ai-generator-actions {
    justify-content: flex-end;
}

@media (max-width: 680px) {
    .ai-bottom-generator-form {
        justify-items: stretch;
    }

    .ai-bottom-language-row {
        width: 100%;
    }
}

/* ==============================
   Report draft safety flow + bottom generator polish
============================== */

.report-header-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    flex-wrap: wrap;
    gap: 10px;
}

.modal-check {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    gap: 10px;
    align-items: flex-start;
    margin-top: 18px;
    padding: 14px;
    border: 1px solid var(--app-border-soft);
    border-radius: var(--app-radius-md);
    background: var(--app-surface-soft);
    color: var(--app-text-soft);
    font-size: 13px;
    line-height: 1.45;
    cursor: pointer;
}

.modal-check input {
    width: 18px;
    height: 18px;
    margin-top: 1px;
    accent-color: var(--app-primary);
}

button:disabled,
button:disabled:hover {
    border-color: var(--app-border);
    background: var(--app-surface-muted);
    color: var(--app-text-muted);
    cursor: not-allowed;
    opacity: 0.72;
}

.ai-bottom-generator {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(300px, 360px);
    gap: 22px;
    align-items: center;
    justify-content: stretch;
    margin-top: 24px;
    padding: 22px;
    border: 1px solid var(--app-border-soft);
    border-radius: var(--app-radius-lg);
    background: var(--app-surface);
    box-shadow: var(--app-shadow-xs);
    text-align: left;
}

.ai-bottom-generator-copy h2 {
    margin: 0 0 8px;
    font-size: clamp(22px, 3vw, 28px);
}

.ai-bottom-generator-copy p:not(.eyebrow) {
    max-width: 620px;
    margin: 0;
    color: var(--app-text-muted);
    font-size: 14px;
    line-height: 1.55;
}

.ai-bottom-generator-form {
    display: grid;
    gap: 12px;
    justify-items: stretch;
    width: 100%;
}

.ai-bottom-language-row {
    width: 100%;
    padding: 0;
}

.ai-bottom-generator-form .ai-generator-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    flex-wrap: wrap;
    gap: 10px;
    margin: 0;
}

.ai-bottom-generator-form .ai-generator-actions span {
    flex: 1 1 160px;
    min-width: 160px;
    color: var(--app-text-muted);
    font-size: 12px;
    line-height: 1.4;
}

.ai-bottom-generator-form .ai-generator-actions button {
    min-width: 180px;
}

@media (max-width: 760px) {
    .report-header-actions,
    .button-row {
        width: 100%;
    }

    .report-header-actions > *,
    .button-row > * {
        width: 100%;
    }

    .ai-bottom-generator {
        grid-template-columns: 1fr;
        padding: 20px;
    }

    .ai-bottom-generator-form .ai-generator-actions {
        flex-direction: column;
        align-items: stretch;
    }

    .ai-bottom-generator-form .ai-generator-actions span,
    .ai-bottom-generator-form .ai-generator-actions button {
        width: 100%;
        min-width: 0;
    }
}

/* ==============================
   AI generation loading overlay
============================== */

.ai-report-loading-modal {
    z-index: 1200;
    background: rgba(15, 23, 42, 0.52);
    backdrop-filter: blur(4px);
}

.ai-report-loading-card {
    width: min(100%, 500px);
    padding: 30px;
    text-align: center;
}

.ai-report-loading-spinner {
    width: 56px;
    height: 56px;
    margin: 0 auto 18px;
    border: 4px solid rgba(34, 53, 74, 0.14);
    border-top-color: var(--app-primary);
    border-radius: 999px;
    animation: ai-report-spin 0.85s linear infinite;
}

.ai-report-loading-card h2 {
    margin: 4px 0 10px;
    font-size: clamp(22px, 4vw, 28px);
}

.ai-report-loading-status {
    margin: 0 auto;
    max-width: 390px;
    color: var(--app-text-soft);
    font-size: 14px;
    line-height: 1.55;
}

.ai-report-loading-bar {
    position: relative;
    height: 6px;
    margin: 22px auto 16px;
    overflow: hidden;
    border-radius: 999px;
    background: var(--app-surface-muted);
}

.ai-report-loading-bar span {
    position: absolute;
    inset: 0 auto 0 0;
    width: 42%;
    border-radius: inherit;
    background: var(--app-primary);
    animation: ai-report-progress 1.25s ease-in-out infinite;
}

.ai-report-loading-hint {
    margin: 0;
    color: var(--app-text-muted);
    font-size: 12px;
}

@keyframes ai-report-spin {
    to {
        transform: rotate(360deg);
    }
}

@keyframes ai-report-progress {
    0% {
        transform: translateX(-120%);
    }

    55% {
        transform: translateX(80%);
    }

    100% {
        transform: translateX(250%);
    }
}

@media (prefers-reduced-motion: reduce) {
    .ai-report-loading-spinner,
    .ai-report-loading-bar span {
        animation: none;
    }
}

/* ==============================
   Multicentre, professionals and support
============================== */
.nav-centre-identity {
    display: inline-flex;
    align-items: center;
    gap: 9px;
    min-width: 0;
    max-width: 230px;
    padding: 6px 10px;
    border-left: 1px solid var(--app-border-soft);
    color: var(--app-text-soft);
    font-size: 13px;
    font-weight: 650;
}

.nav-centre-identity img,
.centre-avatar {
    width: 30px;
    height: 30px;
    flex: 0 0 30px;
    border-radius: 8px;
    object-fit: contain;
    background: var(--app-surface);
    border: 1px solid var(--app-border-soft);
}

.centre-avatar {
    display: grid;
    place-items: center;
    color: var(--app-primary);
    background: var(--app-primary-soft);
    font-size: 11px;
    font-weight: 800;
}

.nav-centre-identity > span:last-child,
.nav-user-name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.nav-user-name {
    max-width: 180px;
    color: var(--app-text-muted);
    font-size: 12px;
}

.centre-welcome {
    display: flex;
    align-items: center;
    gap: 18px;
    margin: 22px auto 16px;
    max-width: 1200px;
    padding: 22px 24px;
    border: 1px solid var(--app-border-soft);
    border-radius: var(--app-radius-lg);
    background: var(--app-surface);
    box-shadow: var(--app-shadow-xs);
}

.centre-welcome h1,
.centre-welcome p {
    margin: 0;
}

.centre-welcome-logo {
    width: 68px;
    height: 68px;
    flex: 0 0 68px;
    display: grid;
    place-items: center;
    overflow: hidden;
    border: 1px solid var(--app-border-soft);
    border-radius: 14px;
    background: var(--app-primary-soft);
    color: var(--app-primary);
    font-size: 26px;
    font-weight: 800;
}

.centre-welcome-logo img {
    width: 100%;
    height: 100%;
    padding: 8px;
    object-fit: contain;
}

.dashboard-stat-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 14px;
    max-width: 1200px;
    margin: 0 auto 20px;
}

.dashboard-stat-card {
    display: flex;
    flex-direction: column;
    gap: 7px;
    min-height: 108px;
    padding: 20px;
    border: 1px solid var(--app-border-soft);
    border-radius: var(--app-radius-md);
    background: var(--app-surface);
    box-shadow: var(--app-shadow-xs);
}

.dashboard-stat-card span {
    color: var(--app-text-muted);
    font-size: 12px;
    font-weight: 650;
    text-transform: uppercase;
    letter-spacing: .04em;
}

.dashboard-stat-card strong {
    color: var(--app-text);
    font-size: 24px;
    line-height: 1.2;
}

.dashboard-flash {
    max-width: 1200px;
    margin: 18px auto 0;
}

.narrow-page {
    max-width: 900px;
}

.form-field-full {
    grid-column: 1 / -1;
}

.field-error {
    display: block;
    margin-top: 6px;
    color: var(--app-danger);
    font-size: 12px;
}

.success-box,
.warning-box {
    margin: 14px 0;
    padding: 13px 15px;
    border-radius: var(--app-radius-sm);
}

.success-box {
    color: var(--app-success);
    border: 1px solid rgba(31, 107, 79, .24);
    background: rgba(31, 107, 79, .07);
}

.warning-box {
    color: var(--app-warning);
    border: 1px solid rgba(161, 92, 7, .24);
    background: rgba(161, 92, 7, .08);
}

.success-box p,
.warning-box p {
    margin: 0;
}

.data-table-wrap {
    overflow-x: auto;
    border: 1px solid var(--app-border-soft);
    border-radius: var(--app-radius-md);
    background: var(--app-surface);
    box-shadow: var(--app-shadow-xs);
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 860px;
}

.data-table th,
.data-table td {
    padding: 14px 16px;
    border-bottom: 1px solid var(--app-border-soft);
    text-align: left;
    vertical-align: middle;
}

.data-table th {
    color: var(--app-text-muted);
    background: var(--app-surface-soft);
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .035em;
}

.data-table tbody tr:last-child td {
    border-bottom: 0;
}

.table-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.table-actions form {
    margin: 0;
}

.compact-button {
    min-height: 34px !important;
    padding: 7px 10px !important;
    font-size: 12px !important;
}

.status-pill {
    display: inline-flex;
    align-items: center;
    padding: 4px 8px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 700;
}

.status-pill.is-active {
    color: var(--app-success);
    background: rgba(31, 107, 79, .09);
}

.status-pill.is-inactive {
    color: var(--app-danger);
    background: var(--app-danger-soft);
}

.credential-card {
    padding: 28px;
    border: 1px solid var(--app-border-soft);
    border-radius: var(--app-radius-lg);
    background: var(--app-surface);
    box-shadow: var(--app-shadow-sm);
}

.credential-card dl {
    display: grid;
    gap: 12px;
    margin: 22px 0;
}

.credential-card dl > div {
    display: grid;
    grid-template-columns: 180px 1fr;
    gap: 14px;
    padding: 14px;
    border-radius: var(--app-radius-sm);
    background: var(--app-surface-muted);
}

.credential-card dt {
    color: var(--app-text-muted);
    font-weight: 650;
}

.credential-card dd {
    margin: 0;
}

.credential-card code {
    font-size: 15px;
    font-weight: 750;
    user-select: all;
}

.consent-check {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    margin: 20px 0 8px;
    padding: 14px;
    border: 1px solid var(--app-border-soft);
    border-radius: var(--app-radius-sm);
    background: var(--app-surface-soft);
}

.consent-check input {
    margin-top: 3px;
}

@media (max-width: 920px) {
    .nav-centre-identity {
        display: none;
    }

    .nav-user-name {
        display: none;
    }

    .dashboard-stat-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 640px) {
    .centre-welcome {
        align-items: flex-start;
        margin-inline: 14px;
    }

    .dashboard-stat-grid {
        margin-inline: 14px;
    }

    .credential-card dl > div {
        grid-template-columns: 1fr;
    }
}

/* ==============================
   Auth account setup and recovery
============================== */

.auth-page {
    min-height: 100vh;
    min-height: 100svh;
    background:
        radial-gradient(circle at 15% 15%, rgba(91, 111, 207, 0.12), transparent 34%),
        radial-gradient(circle at 85% 80%, rgba(0, 113, 227, 0.09), transparent 34%),
        var(--app-bg);
}

.auth-page-shell {
    min-height: 100vh;
    min-height: 100svh;
    display: grid;
    place-items: center;
    padding: clamp(18px, 4vw, 48px);
}

.auth-card {
    width: min(100%, 520px);
    padding: clamp(24px, 5vw, 38px);
    border: 1px solid var(--app-border-soft);
    border-radius: clamp(22px, 4vw, 30px);
    background: rgba(255, 255, 255, 0.96);
    box-shadow: 0 26px 80px rgba(30, 37, 70, 0.10);
    backdrop-filter: blur(16px);
}

.auth-card-wide {
    width: min(100%, 720px);
}

.auth-card-header {
    display: grid;
    gap: 28px;
    margin-bottom: 26px;
}

.auth-brand-row {
    display: flex;
    align-items: center;
    gap: 13px;
}

.auth-brand-row .brand-mark {
    flex: 0 0 auto;
}

.auth-brand-row .eyebrow,
.auth-feedback-card .eyebrow {
    margin: 0;
}

.auth-centre-name {
    margin: 2px 0 0;
    color: var(--app-text-soft);
    font-size: 14px;
    line-height: 1.3;
}

.auth-heading-copy h1,
.auth-feedback-card h1 {
    margin: 0;
    font-size: clamp(30px, 5vw, 44px);
    line-height: 1.04;
    letter-spacing: -0.035em;
}

.auth-heading-copy p,
.auth-feedback-card > p {
    margin: 12px 0 0;
    color: var(--app-text-soft);
    font-size: 16px;
    line-height: 1.65;
}

.auth-form {
    display: grid;
    gap: 22px;
    margin: 0;
    padding: 0;
    border: 0;
    background: transparent;
    box-shadow: none;
}

.auth-form-section {
    padding: clamp(18px, 4vw, 26px);
    border: 1px solid var(--app-border-soft);
    border-radius: 20px;
    background: var(--app-surface-soft);
}

.auth-section-heading {
    display: flex;
    gap: 13px;
    align-items: flex-start;
    margin-bottom: 18px;
}

.auth-section-heading h2 {
    margin: 0;
    font-size: 18px;
    line-height: 1.25;
}

.auth-section-heading p {
    margin: 5px 0 0;
    color: var(--app-text-soft);
    font-size: 14px;
    line-height: 1.55;
}

.auth-step {
    display: inline-grid;
    flex: 0 0 28px;
    width: 28px;
    height: 28px;
    place-items: center;
    border-radius: 999px;
    background: rgba(49, 84, 201, 0.12);
    color: var(--app-primary);
    font-size: 13px;
    font-weight: 760;
}

.auth-field-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
}

.auth-field {
    min-width: 0;
}

.auth-form label,
.auth-field label,
.auth-form-section > label {
    margin: 0 0 8px;
    color: var(--app-text);
    font-size: 13px;
    font-weight: 650;
}

.auth-form input,
.auth-form-section > input {
    min-height: 50px;
    margin: 0;
    border-radius: 14px;
    background: #ffffff;
    font-size: 16px;
}

.password-requirements {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
    margin: 18px 0 0;
    padding: 0;
    list-style: none;
}

.password-requirements li {
    min-width: 0;
    padding: 9px 10px;
    border: 1px solid var(--app-border-soft);
    border-radius: 12px;
    background: #ffffff;
    color: var(--app-text-soft);
    font-size: 12px;
    line-height: 1.35;
    text-align: center;
}

.auth-primary-button,
.auth-primary-link {
    display: inline-flex;
    width: 100%;
    min-height: 50px;
    align-items: center;
    justify-content: center;
    padding: 0 20px;
    border: 0;
    border-radius: 14px;
    background: var(--app-primary);
    color: #ffffff;
    font-size: 15px;
    font-weight: 720;
    text-decoration: none;
    cursor: pointer;
    transition: transform 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}

.auth-primary-button:hover,
.auth-primary-link:hover {
    transform: translateY(-1px);
    box-shadow: 0 12px 28px rgba(49, 84, 201, 0.20);
}

.auth-message {
    margin: 0 0 22px;
}

.auth-message p {
    margin: 0;
}

.auth-security-note,
.auth-secondary-action {
    margin: 22px 0 0;
    color: var(--app-text-muted);
    font-size: 13px;
    line-height: 1.55;
    text-align: center;
}

.auth-secondary-action a {
    color: var(--app-primary);
    font-weight: 650;
    text-decoration: none;
}

.auth-secondary-action a:hover {
    text-decoration: underline;
}

.auth-feedback-card {
    text-align: center;
}

.auth-feedback-icon {
    display: grid;
    width: 58px;
    height: 58px;
    margin: 0 auto 20px;
    place-items: center;
    border-radius: 999px;
    background: rgba(33, 150, 83, 0.12);
    color: #167443;
    font-size: 26px;
    font-weight: 800;
}

.auth-info-box {
    margin: 24px 0;
    padding: 14px 16px;
    border: 1px solid var(--app-border-soft);
    border-radius: 14px;
    background: var(--app-surface-soft);
}

.auth-info-box p {
    margin: 0;
    color: var(--app-text-soft);
    font-size: 14px;
    line-height: 1.55;
}

@media (max-width: 640px) {
    .auth-page-shell {
        display: block;
        padding: 12px;
    }

    .auth-card,
    .auth-card-wide {
        width: 100%;
        min-height: calc(100svh - 24px);
        display: flex;
        flex-direction: column;
        justify-content: center;
        border-radius: 22px;
        padding: 24px 18px;
    }

    .auth-card-header {
        gap: 22px;
        margin-bottom: 22px;
    }

    .auth-heading-copy h1,
    .auth-feedback-card h1 {
        font-size: 32px;
    }

    .auth-field-grid,
    .password-requirements {
        grid-template-columns: 1fr;
    }

    .password-requirements li {
        text-align: left;
    }

    .auth-form-section {
        padding: 18px 14px;
    }
}

/* Dashboard stats: professionals only see the centre identity card. */
.dashboard-stat-grid.dashboard-stat-grid--single {
    grid-template-columns: minmax(0, 1fr);
}
