:root {
    --rose-50: #fff8f7;
    --rose-100: #f8e8e6;
    --rose-200: #eed4d2;
    --rose-300: #e2baba;
    --rose-400: #cc9699;
    --rose-500: #ad747a;
    --rose-600: #7d4f55;
    --rose-700: #633c42;
    --olive-100: #ebe7dd;
    --olive-300: #bdb197;
    --olive-500: #91846d;
    --ink-900: #3f3532;
    --ink-700: #615552;
    --ink-500: #827572;
    --paper: #fffdfb;
    --canvas: #f7f2ee;
    --white: #ffffff;
    --success: #4f745e;
    --success-soft: #e5efe8;
    --warning: #a8653d;
    --warning-soft: #fbebdd;
    --pending: #96772f;
    --pending-soft: #f5edcf;
    --danger: #a24e51;
    --danger-soft: #f7dddd;
    --clinical-alert: #e6b85c;
    --clinical-alert-border: #b47a22;
    --clinical-alert-ink: #4f3508;
    --shadow-soft: 0 16px 45px rgba(88, 61, 58, 0.08);
    --shadow-float: 0 24px 65px rgba(88, 61, 58, 0.14);
    --border: rgba(125, 79, 85, 0.14);
    --surface-translucent: rgba(255, 255, 255, .7);
    --surface-translucent-soft: rgba(255, 255, 255, .6);
    --surface-translucent-strong: rgba(255, 253, 251, .94);
    --field-surface: rgba(255, 255, 255, .9);
    --field-surface-soft: rgba(255, 255, 255, .84);
    --field-border: rgba(97, 85, 82, .19);
    --patient-backdrop-overlay: linear-gradient(120deg, rgba(247, 242, 238, .96), rgba(255, 248, 247, .92));
    --app-frame: rgba(255, 255, 255, .85);
    --decorative-highlight: rgba(255, 255, 255, .75);
    --sidebar-width: 224px;
    --sidebar-compact-width: 82px;
    --topbar-height: 82px;
    --radius-sm: 10px;
    --radius-md: 18px;
    --radius-lg: 28px;
    --ease: cubic-bezier(.22, 1, .36, 1);
    --font-increase: 0px;
    --gestational-orbit-size: 80px;
}

html[data-a11y-font="large"] {
    --font-increase: 2px;
    --gestational-orbit-size: 86px;
}

html[data-a11y-font="xlarge"] {
    --font-increase: 4px;
    --gestational-orbit-size: 92px;
}

* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    scroll-padding-top: 220px;
}

body {
    margin: 0;
    color: var(--ink-900);
    background: var(--canvas);
    font-family: "Segoe UI", Roboto, Arial, sans-serif;
    -webkit-font-smoothing: antialiased;
}

button,
input,
select,
textarea {
    color: inherit;
    font: inherit;
}

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

button,
a {
    touch-action: manipulation;
}

button {
    border: 0;
}

img,
svg {
    display: block;
}

h1,
h2,
h3,
p {
    margin-top: 0;
}

h1,
h2,
h3 {
    font-family: Georgia, "Times New Roman", serif;
}

:focus-visible {
    outline: 3px solid var(--rose-500);
    outline-offset: 3px;
}

.skip-link {
    position: fixed;
    z-index: 9999;
    top: 12px;
    left: 12px;
    padding: 10px 16px;
    color: var(--white);
    background: var(--rose-700);
    border-radius: var(--radius-sm);
    transform: translateY(-150%);
}

.skip-link:focus {
    transform: translateY(0);
}

.sr-only,
.visually-hidden {
    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;
}

.eyebrow {
    margin-bottom: 8px;
    color: var(--rose-600);
    font-size: calc(13px + var(--font-increase));
    font-weight: 800;
    letter-spacing: .16em;
    line-height: 1.2;
    text-transform: uppercase;
}

.portal-shell {
    min-height: 100vh;
}

.sidebar {
    position: fixed;
    z-index: 50;
    inset: 0 auto 0 0;
    display: flex;
    width: var(--sidebar-width);
    padding: 30px 20px 22px;
    flex-direction: column;
    background:
        linear-gradient(180deg, rgba(255, 255, 255, .9), rgba(255, 250, 247, .98)),
        url("fundo-floral.jpeg") center / cover;
    border-right: 1px solid var(--border);
    transition: width .32s var(--ease), padding .32s var(--ease), transform .32s var(--ease), box-shadow .32s var(--ease);
}

.brand-lockup {
    display: grid;
    margin: 0 0 46px;
    justify-items: center;
    gap: 7px;
}

.brand-logo-full {
    width: 170px;
    height: auto;
}

.brand-logo-compact {
    display: none;
    width: 42px;
    height: 42px;
    object-fit: contain;
}

.brand-lockup span {
    color: var(--olive-500);
    font-size: calc(12px + var(--font-increase));
    font-weight: 800;
    letter-spacing: .2em;
    text-align: center;
    text-transform: uppercase;
}

.nav-caption {
    margin: 0 14px 10px;
    color: var(--ink-500);
    font-size: calc(12px + var(--font-increase));
    font-weight: 800;
    letter-spacing: .16em;
    text-transform: uppercase;
}

.sidebar-nav {
    display: grid;
    gap: 6px;
}

.nav-link {
    position: relative;
    display: flex;
    width: 100%;
    min-height: 48px;
    padding: 0 14px;
    align-items: center;
    gap: 13px;
    color: var(--ink-700);
    background: transparent;
    border-radius: 12px;
    cursor: pointer;
    font-size: calc(16px + var(--font-increase));
    font-weight: 700;
    text-align: left;
    transition: color .2s ease, background .2s ease, transform .2s ease;
}

.nav-link svg {
    width: 19px;
    height: 19px;
    flex: 0 0 auto;
    fill: currentColor;
}

.nav-link:hover {
    color: var(--rose-700);
    background: var(--rose-50);
    transform: translateX(2px);
}

.nav-link.is-active {
    color: var(--rose-700);
    background: var(--rose-200);
}

.nav-link.is-active::before {
    position: absolute;
    left: -20px;
    width: 4px;
    height: 24px;
    background: var(--rose-600);
    border-radius: 0 4px 4px 0;
    content: "";
}

.nav-action-divider {
    height: 1px;
    margin: 8px 14px 4px;
    background: var(--border);
}

.nav-link.nav-action {
    min-height: 42px;
    color: var(--ink-500);
    font-size: calc(14px + var(--font-increase));
}

.nav-link:disabled {
    opacity: .42;
    cursor: not-allowed;
    transform: none;
}

.nav-link:disabled:hover {
    color: var(--ink-500);
    background: transparent;
    transform: none;
}

.sidebar-foot {
    display: grid;
    margin-top: auto;
    gap: 16px;
}

.patient-preview-link {
    display: flex;
    padding: 13px;
    align-items: center;
    gap: 10px;
    color: var(--ink-900);
    background: var(--surface-translucent);
    border: 1px solid var(--border);
    border-radius: 15px;
    text-decoration: none;
    transition: transform .2s ease, box-shadow .2s ease;
}

.patient-preview-link:hover {
    box-shadow: var(--shadow-soft);
    transform: translateY(-2px);
}

.preview-mark {
    display: grid;
    width: 38px;
    height: 38px;
    flex: 0 0 auto;
    place-items: center;
    color: var(--rose-700);
    background: var(--rose-200);
    border-radius: 50%;
    font-family: Georgia, "Times New Roman", serif;
    font-weight: 600;
}

.patient-preview-link strong,
.patient-preview-link small,
.doctor-profile strong,
.doctor-profile small {
    display: block;
}

.patient-preview-link strong,
.doctor-profile strong {
    font-size: calc(14px + var(--font-increase));
}

.patient-preview-link small,
.doctor-profile small {
    margin-top: 2px;
    color: var(--ink-500);
    font-size: calc(12px + var(--font-increase));
}

.doctor-profile {
    display: grid;
    padding-top: 16px;
    grid-template-columns: auto minmax(0, 1fr) auto auto;
    align-items: center;
    gap: 6px;
    border-top: 1px solid var(--border);
}

.doctor-profile > span:nth-child(2) {
    min-width: 0;
}

.doctor-profile strong,
.doctor-profile small {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.doctor-profile strong {
    overflow: visible;
    line-height: 1.15;
    text-overflow: clip;
    white-space: normal;
}

.avatar {
    display: grid;
    width: 38px;
    height: 38px;
    place-items: center;
    color: var(--white);
    background: var(--rose-600);
    border-radius: 50%;
    font-size: calc(13px + var(--font-increase));
    font-weight: 800;
    background-position: center;
    background-size: cover;
}

.icon-link,
.icon-button {
    position: relative;
    display: grid;
    width: 38px;
    height: 38px;
    place-items: center;
    color: var(--ink-700);
    background: transparent;
    border-radius: 50%;
    cursor: pointer;
}

.icon-link svg,
.icon-button svg {
    width: 20px;
    height: 20px;
    fill: currentColor;
}

.icon-link:hover,
.icon-button:hover {
    color: var(--rose-700);
    background: var(--rose-100);
}

.theme-icon-sun {
    display: none;
}

html[data-theme="dark"] .theme-icon-moon {
    display: none;
}

html[data-theme="dark"] .theme-icon-sun {
    display: block;
}

.portal-content {
    min-height: 100vh;
    margin-left: var(--sidebar-width);
    transition: margin-left .32s var(--ease);
}

body.sidebar-collapsed .sidebar {
    width: var(--sidebar-compact-width);
    padding: 24px 12px 18px;
}

body.sidebar-collapsed .portal-content {
    margin-left: var(--sidebar-compact-width);
}

body.sidebar-collapsed .brand-lockup {
    margin-bottom: 34px;
}

body.sidebar-collapsed .brand-logo-full,
body.sidebar-collapsed .nav-caption,
body.sidebar-collapsed .nav-link > span,
body.sidebar-collapsed .doctor-profile > span:nth-child(2),
body.sidebar-collapsed .doctor-profile > .avatar {
    display: none;
}

body.sidebar-collapsed .brand-logo-compact {
    display: block;
}

body.sidebar-collapsed .nav-link {
    min-height: 50px;
    padding: 0;
    justify-content: center;
    gap: 0;
}

body.sidebar-collapsed .nav-link svg {
    width: 22px;
    height: 22px;
}

body.sidebar-collapsed .nav-link:hover {
    transform: none;
}

body.sidebar-collapsed .nav-link.is-active::before {
    left: -12px;
}

body.sidebar-collapsed .nav-action-divider {
    margin-inline: 5px;
}

body.sidebar-collapsed .doctor-profile {
    padding-top: 14px;
    grid-template-columns: 1fr;
    justify-items: center;
    gap: 5px;
}

body.sidebar-collapsed .nav-link::after {
    position: absolute;
    z-index: 80;
    left: calc(100% + 13px);
    top: 50%;
    padding: 8px 11px;
    color: var(--white);
    background: var(--ink-900);
    border-radius: 8px;
    box-shadow: var(--shadow-soft);
    content: attr(data-tooltip);
    font-size: calc(14px + var(--font-increase));
    font-weight: 800;
    line-height: 1;
    opacity: 0;
    pointer-events: none;
    transform: translate(-4px, -50%);
    transition: opacity .18s ease, transform .18s ease;
    white-space: nowrap;
}

body.sidebar-collapsed .nav-link:hover::after,
body.sidebar-collapsed .nav-link:focus-visible::after {
    opacity: 1;
    transform: translate(0, -50%);
}

.desktop-sidebar-toggle {
    display: grid;
    background: var(--paper);
    border: 1px solid var(--border);
}

.desktop-sidebar-toggle svg {
    transition: transform .25s var(--ease);
}

body.sidebar-collapsed .desktop-sidebar-toggle svg {
    transform: rotate(180deg);
}

.topbar {
    position: sticky;
    z-index: 40;
    top: 0;
    display: grid;
    height: var(--topbar-height);
    padding: 0 clamp(24px, 4vw, 58px);
    grid-template-columns: auto minmax(260px, 720px) minmax(260px, 1fr);
    align-items: center;
    gap: 18px;
    background: rgba(247, 242, 238, .9);
    border-bottom: 1px solid var(--border);
    backdrop-filter: blur(20px);
}

.global-search {
    display: flex;
    height: 44px;
    padding: 0 12px;
    align-items: center;
    gap: 10px;
    background: var(--paper);
    border: 1px solid var(--border);
    border-radius: 999px;
}

.global-search svg {
    width: 18px;
    height: 18px;
    fill: var(--ink-500);
}

.global-search input {
    width: 100%;
    min-width: 0;
    padding: 0;
    background: transparent;
    border: 0;
    outline: 0;
    font-size: calc(15px + var(--font-increase));
}

.global-search kbd {
    padding: 3px 7px;
    color: var(--ink-500);
    background: var(--canvas);
    border: 1px solid var(--border);
    border-radius: 6px;
    font-family: inherit;
    font-size: calc(11px + var(--font-increase));
    white-space: nowrap;
}

.topbar-actions,
.save-cluster {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
}

.topbar-save-cluster {
    min-width: 0;
    padding-right: 10px;
    border-right: 1px solid var(--border);
}

.topbar-save-cluster[hidden] {
    display: none;
}

.save-label-short {
    display: none;
}

.notification-dot {
    position: absolute;
    top: 7px;
    right: 8px;
    width: 7px;
    height: 7px;
    background: var(--danger);
    border: 2px solid var(--canvas);
    border-radius: 50%;
}

.notification-badge {
    position: absolute;
    top: 2px;
    right: 1px;
    display: grid;
    min-width: 17px;
    height: 17px;
    padding: 0 4px;
    place-items: center;
    color: #fff;
    background: var(--danger);
    border: 2px solid var(--canvas);
    border-radius: 999px;
    font-size: calc(10px + var(--font-increase));
    font-weight: 800;
    line-height: 1;
}

.notification-badge[hidden] {
    display: none;
}

.primary-button,
.secondary-button,
.back-button,
.text-button {
    cursor: pointer;
    font-weight: 800;
}

.primary-button,
.secondary-button {
    min-height: 44px;
    padding: 0 19px;
    border-radius: 11px;
    transition: transform .2s ease, box-shadow .2s ease, background .2s ease;
}

.primary-button {
    color: var(--white);
    background: var(--rose-600);
    box-shadow: 0 8px 20px rgba(125, 79, 85, .18);
}

.primary-button:hover {
    background: var(--rose-700);
    box-shadow: 0 12px 25px rgba(125, 79, 85, .24);
    transform: translateY(-1px);
}

.primary-button.compact {
    min-height: 38px;
    padding-inline: 15px;
    font-size: calc(14px + var(--font-increase));
}

.secondary-button {
    color: var(--rose-700);
    background: var(--rose-50);
    border: 1px solid var(--rose-300);
}

.secondary-button:hover {
    background: var(--rose-100);
}

.text-button {
    padding: 6px;
    color: var(--rose-600);
    background: transparent;
    font-size: calc(14px + var(--font-increase));
}

.text-button:hover {
    color: var(--rose-700);
}

.mobile-menu-button,
.sidebar-scrim {
    display: none;
}

main {
    width: 100%;
}

.global-view,
.patient-workspace {
    display: none;
}

.global-view.is-active,
.patient-workspace.is-active {
    display: block;
}

.global-view {
    width: min(1480px, 100%);
    margin: 0 auto;
    padding: clamp(34px, 5vw, 20px) clamp(24px, 4vw, 58px) 80px;
}

.dashboard-intro,
.view-heading {
    display: flex;
    margin-bottom: 40px;
    align-items: flex-end;
    justify-content: space-between;
    gap: 28px;
}

.dashboard-intro h1,
.view-heading h1 {
    max-width: 760px;
    margin-bottom: 10px;
    font-size: calc(32px + var(--font-increase));
    font-weight: 500;
    letter-spacing: -.035em;
    line-height: 1.05;
}

.dashboard-intro > div > p:last-child,
.view-heading > div > p:last-child {
    margin-bottom: 0;
    color: var(--ink-500);
    font-size: calc(16px + var(--font-increase));
}

.metric-strip {
    display: grid;
    margin-bottom: 28px;
    padding: 22px 8px;
    grid-template-columns: repeat(4, 1fr);
    background: var(--paper);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-soft);
}

.metric-strip article {
    position: relative;
    display: grid;
    min-height: 92px;
    padding: 4px clamp(18px, 2.5vw, 34px);
    grid-template-columns: auto 1fr;
    align-items: end;
    gap: 0 12px;
    border-right: 1px solid var(--border);
}

.metric-strip article:last-child {
    border-right: 0;
}

.metric-index {
    grid-row: 1 / 4;
    align-self: start;
    color: var(--rose-400);
    font-family: Georgia, "Times New Roman", serif;
    font-size: calc(14px + var(--font-increase));
}

.metric-strip p {
    margin-bottom: 2px;
    color: var(--ink-500);
    font-size: calc(13px + var(--font-increase));
    font-weight: 700;
}

.metric-strip strong {
    font-family: Georgia, "Times New Roman", serif;
    font-size: calc(33px + var(--font-increase));
    font-weight: 500;
}

.metric-strip small {
    color: var(--success);
    font-size: calc(12px + var(--font-increase));
}

.metric-strip .metric-attention small {
    color: var(--danger);
}

.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    align-items: stretch;
    gap: 18px;
}

.dashboard-card {
    position: relative;
    min-width: 0;
    min-height: 212px;
    padding: clamp(22px, 3vw, 32px);
    color: var(--ink-900);
    background:
        radial-gradient(circle at 100% 0, var(--rose-50), transparent 46%),
        var(--paper);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-soft);
}

button.dashboard-card {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    gap: 20px;
    cursor: pointer;
    text-align: left;
    transition: border-color .2s ease, box-shadow .2s ease, transform .2s ease;
}

button.dashboard-card:hover {
    border-color: var(--rose-300);
    box-shadow: var(--shadow-float);
    transform: translateY(-2px);
}

button.dashboard-card:focus-visible,
.dashboard-patient-button:focus-visible {
    outline: 3px solid var(--rose-500);
    outline-offset: 3px;
}

.dashboard-risk-card {
    background:
        radial-gradient(circle at 100% 0, var(--warning-soft), transparent 52%),
        var(--paper);
}

.dashboard-priority-card {
    background:
        radial-gradient(circle at 100% 0, var(--danger-soft), transparent 50%),
        var(--paper);
}

.dashboard-card-index {
    display: grid;
    width: 46px;
    height: 46px;
    flex: 0 0 auto;
    place-items: center;
    color: var(--rose-700);
    background: var(--rose-100);
    border: 1px solid var(--rose-200);
    border-radius: 50%;
    font-family: Georgia, "Times New Roman", serif;
    font-size: calc(16px + var(--font-increase));
}

.dashboard-risk-card .dashboard-card-index {
    color: var(--warning);
    background: var(--warning-soft);
    border-color: color-mix(in srgb, var(--warning) 28%, transparent);
}

.dashboard-card-copy {
    display: grid;
    min-width: 0;
    gap: 4px;
}

.dashboard-card-copy strong {
    font-family: Georgia, "Times New Roman", serif;
    font-size: calc(58px + var(--font-increase));
    font-weight: 500;
    line-height: 1;
}

.dashboard-card-copy small {
    color: var(--ink-500);
    font-size: calc(12px + var(--font-increase));
    line-height: 1.45;
}

.dashboard-card-arrow {
    align-self: end;
    color: var(--rose-600);
    font-size: calc(25px + var(--font-increase));
}

.dashboard-card-heading {
    display: flex;
    margin-bottom: 18px;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
}

.dashboard-card-heading h2 {
    margin: 3px 0 0;
    font-size: calc(25px + var(--font-increase));
    font-weight: 500;
}

.dashboard-card-heading .dashboard-card-index {
    width: 38px;
    height: 38px;
    font-size: calc(13px + var(--font-increase));
}

.dashboard-patient-list {
    display: grid;
    gap: 8px;
}

.dashboard-patient-button {
    display: grid;
    width: 100%;
    min-width: 0;
    min-height: 58px;
    padding: 9px 10px;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    gap: 10px;
    color: var(--ink-900);
    background: var(--canvas);
    border: 1px solid transparent;
    border-radius: 12px;
    cursor: pointer;
    text-align: left;
    transition: background .2s ease, border-color .2s ease;
}

.dashboard-patient-button:hover {
    background: var(--rose-50);
    border-color: var(--rose-200);
}

.dashboard-patient-avatar {
    display: grid;
    width: 37px;
    height: 37px;
    place-items: center;
    color: var(--rose-700);
    background: var(--rose-200);
    border-radius: 50%;
    font-size: calc(10px + var(--font-increase));
    font-weight: 800;
}

.dashboard-patient-copy {
    display: grid;
    min-width: 0;
    gap: 3px;
}

.dashboard-patient-copy strong,
.dashboard-patient-copy small {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.dashboard-patient-copy strong {
    font-size: calc(13px + var(--font-increase));
}

.dashboard-patient-copy small {
    color: var(--ink-500);
    font-size: calc(10px + var(--font-increase));
}

.dashboard-patient-status {
    max-width: 150px;
    color: var(--rose-700);
    font-size: calc(10px + var(--font-increase));
    font-weight: 800;
    text-align: right;
}

.dashboard-patient-button.is-priority {
    min-height: 90px;
    background: var(--danger-soft);
    border-color: color-mix(in srgb, var(--danger) 25%, transparent);
}

.dashboard-patient-button.is-priority .dashboard-patient-status {
    padding: 6px 9px;
    color: var(--danger);
    background: var(--paper);
    border-radius: 999px;
}

.dashboard-empty {
    display: grid;
    min-height: 76px;
    padding: 14px;
    align-content: center;
    gap: 5px;
    color: var(--ink-500);
    background: var(--canvas);
    border: 1px dashed var(--border);
    border-radius: 12px;
}

.dashboard-empty strong {
    color: var(--ink-700);
    font-size: calc(13px + var(--font-increase));
}

.dashboard-empty p,
.dashboard-rule-note {
    margin: 0;
    color: var(--ink-500);
    font-size: calc(10px + var(--font-increase));
    line-height: 1.45;
}

.dashboard-rule-note {
    margin-top: 12px;
}

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

@media (max-width: 520px) {
    .dashboard-card { min-height: 0; padding: 20px 17px; }
    button.dashboard-card { grid-template-columns: auto minmax(0, 1fr); gap: 14px; }
    button.dashboard-card .dashboard-card-arrow { display: none; }
    .dashboard-card-copy strong { font-size: calc(48px + var(--font-increase)); }
    .dashboard-card-heading h2 { font-size: calc(22px + var(--font-increase)); }
    .dashboard-patient-button { grid-template-columns: auto minmax(0, 1fr); }
    .dashboard-patient-status { grid-column: 2; max-width: none; text-align: left; }
}

.editorial-panel {
    padding: clamp(22px, 3vw, 34px);
    background: var(--paper);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
}

.panel-heading {
    display: flex;
    margin-bottom: 20px;
    align-items: flex-end;
    justify-content: space-between;
    gap: 16px;
}

.panel-heading h2 {
    margin-bottom: 0;
    font-size: calc(25px + var(--font-increase));
    font-weight: 500;
}

.patient-list,
.patient-directory {
    display: grid;
    gap: 8px;
}

.patient-list-header,
.patient-row {
    display: grid;
    grid-template-columns: 43px minmax(180px, 1fr) minmax(110px, .55fr) minmax(105px, .5fr) minmax(105px, .5fr) 20px;
    align-items: center;
    gap: 14px;
}

.patient-list-header {
    min-height: 30px;
    padding: 0 14px 8px;
    color: var(--ink-500);
    border-bottom: 1px solid var(--border);
    font-size: calc(10px + var(--font-increase));
    font-weight: 800;
    letter-spacing: .06em;
    text-transform: uppercase;
}

.patient-row {
    width: 100%;
    min-height: 74px;
    padding: 12px 14px;
    color: var(--ink-900);
    background: transparent;
    border: 1px solid transparent;
    border-radius: 13px;
    cursor: pointer;
    text-align: left;
    transition: background .2s ease, border-color .2s ease, transform .2s ease;
}

.patient-row:hover {
    background: var(--rose-50);
    border-color: var(--rose-200);
    transform: translateX(3px);
}

.patient-row .patient-avatar {
    display: grid;
    width: 43px;
    height: 43px;
    place-items: center;
    color: var(--rose-700);
    background: var(--rose-200);
    border-radius: 50% 50% 44% 56%;
    font-size: calc(13px + var(--font-increase));
    font-weight: 800;
}

.patient-primary strong,
.patient-primary small,
.patient-meta strong,
.patient-meta small {
    display: block;
}

.patient-primary strong {
    font-size: calc(15px + var(--font-increase));
}

.patient-primary small,
.patient-meta small {
    margin-top: 3px;
    color: var(--ink-500);
    font-size: calc(12px + var(--font-increase));
}

.patient-meta strong {
    font-size: calc(13px + var(--font-increase));
}

.row-arrow {
    color: var(--rose-500);
    font-size: calc(22px + var(--font-increase));
}

.status-pill {
    display: inline-flex;
    width: fit-content;
    min-height: 24px;
    padding: 0 9px;
    align-items: center;
    border-radius: 999px;
    font-size: calc(11px + var(--font-increase));
    font-weight: 800;
    letter-spacing: .04em;
    text-transform: uppercase;
}

.status-pill.success {
    color: var(--success);
    background: var(--success-soft);
}

.status-pill.attention {
    color: var(--danger);
    background: var(--danger-soft);
}

.status-pill.risk-habitual-pill {
    color: var(--rose-700);
    background: var(--rose-200);
    border: 1px solid var(--rose-400);
}

.status-pill.risk-high-pill {
    color: var(--clinical-alert-ink);
    background: var(--clinical-alert);
    border: 1px solid var(--clinical-alert-border);
}

.status-pill.pending {
    color: var(--pending);
    background: var(--pending-soft);
}

.entrance-item {
    animation: reveal-up .7s var(--ease) both;
}

.entrance-item:nth-child(2) {
    animation-delay: .08s;
}

.entrance-item:nth-child(3) {
    animation-delay: .16s;
}

@keyframes reveal-up {
    from { opacity: 0; transform: translateY(18px); }
    to { opacity: 1; transform: translateY(0); }
}

.filter-bar {
    display: grid;
    margin-bottom: 18px;
    padding: 14px;
    grid-template-columns: 1fr 230px;
    gap: 12px;
    background: var(--paper);
    border: 1px solid var(--border);
    border-radius: 15px;
}

.search-field input,
.filter-bar select {
    width: 100%;
    height: 44px;
    padding: 0 14px;
    color: var(--ink-900);
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: 10px;
    outline: none;
}

.patient-directory-shell {
    padding: 10px;
    background: var(--paper);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
}

.patient-directory-shell .patient-list-header {
    margin-bottom: 8px;
}

.document-directory-shell {
    padding: 10px;
    background: var(--paper);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
}

.document-directory {
    display: grid;
    gap: 8px;
}

.document-list-header,
.document-row {
    display: grid;
    grid-template-columns: 43px minmax(190px, 1.2fr) minmax(155px, 1fr) minmax(90px, .55fr) minmax(115px, .65fr) 95px 32px;
    align-items: center;
    gap: 12px;
}

.document-list-header {
    min-height: 34px;
    padding: 0 14px 8px;
    color: var(--ink-500);
    border-bottom: 1px solid var(--border);
    font-size: calc(10px + var(--font-increase));
    font-weight: 800;
    letter-spacing: .06em;
    text-transform: uppercase;
}

.document-row {
    min-height: 76px;
    padding: 12px 14px;
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: 13px;
    transition: border-color .2s ease, transform .2s ease;
}

.document-row:hover {
    border-color: var(--rose-300);
    transform: translateX(2px);
}

.document-row-primary,
.document-row-meta {
    min-width: 0;
}

.document-row-primary strong,
.document-row-primary small {
    display: block;
}

.document-row-primary strong {
    overflow: hidden;
    font-size: calc(15px + var(--font-increase));
    text-overflow: ellipsis;
    white-space: nowrap;
}

.document-row-primary small,
.document-row-meta {
    color: var(--ink-500);
    font-size: calc(12px + var(--font-increase));
}

.row-open-button {
    display: grid;
    width: 30px;
    height: 30px;
    place-items: center;
    color: var(--rose-700);
    background: var(--rose-100);
    border-radius: 9px;
    cursor: pointer;
    font-size: calc(19px + var(--font-increase));
}

.document-empty {
    min-height: 240px;
}

.clinic-document-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
}

.queue-reject {
    color: var(--danger);
}

.document-list {
    display: grid;
    align-content: start;
    gap: 8px;
}

.document-list article {
    display: grid;
    min-height: 82px;
    padding: 15px;
    grid-template-columns: auto 1fr auto;
    align-items: center;
    gap: 14px;
    background: var(--paper);
    border: 1px solid var(--border);
    border-radius: 14px;
}

.document-list strong {
    font-size: calc(15px + var(--font-increase));
}

.document-list p {
    margin: 4px 0 0;
    color: var(--ink-500);
    font-size: calc(12px + var(--font-increase));
}

.file-mark {
    display: grid;
    width: 43px;
    height: 50px;
    place-items: center;
    color: var(--rose-700);
    background: var(--rose-100);
    border: 1px solid var(--rose-200);
    border-radius: 6px 12px 6px 6px;
    font-size: calc(11px + var(--font-increase));
    font-weight: 800;
}

.document-overview {
    display: grid;
    margin-bottom: 26px;
    grid-template-columns: repeat(3, 1fr);
    gap: 14px;
}

.document-overview article {
    display: grid;
    min-height: 150px;
    padding: 25px;
    background: var(--paper);
    border: 1px solid var(--border);
    border-radius: 16px;
}

.document-overview span,
.document-overview small {
    color: var(--ink-500);
    font-size: calc(13px + var(--font-increase));
}

.document-overview strong {
    align-self: end;
    font-family: Georgia, "Times New Roman", serif;
    font-size: calc(38px + var(--font-increase));
    font-weight: 500;
}

.empty-editorial {
    display: flex;
    min-height: 310px;
    padding: 40px;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    background: var(--olive-100);
    border: 1px dashed var(--olive-300);
    border-radius: 8px 30px 8px 30px;
}

.empty-editorial > span {
    color: var(--olive-500);
    font-size: calc(12px + var(--font-increase));
    font-weight: 800;
    letter-spacing: .18em;
    text-transform: uppercase;
}

.empty-editorial h2 {
    max-width: 520px;
    margin: 14px auto 24px;
    font-size: calc(29px + var(--font-increase));
    font-weight: 500;
}

.empty-editorial > p {
    max-width: 560px;
    margin: 0;
    color: var(--ink-500);
    font-size: calc(14px + var(--font-increase));
    line-height: 1.6;
}

/* Patient workspace */
.patient-workspace {
    width: min(1500px, 100%);
    margin: 0 auto;
    padding: 12px clamp(24px, 4vw, 58px) 100px;
    overflow: visible;
}

.save-state {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    color: var(--success);
    font-size: calc(12px + var(--font-increase));
    font-weight: 800;
}

.save-state i {
    width: 7px;
    height: 7px;
    background: currentColor;
    border-radius: 50%;
}

.save-state.is-dirty {
    color: var(--warning);
}

.save-state.is-error {
    color: var(--danger);
}

.patient-sticky-stack {
    position: -webkit-sticky;
    position: sticky;
    z-index: 31;
    top: calc(var(--topbar-height) + 6px);
    align-self: start;
    isolation: isolate;
}

.patient-context {
    position: relative;
    z-index: 2;
    display: grid;
    min-height: 98px;
    padding: 10px clamp(18px, 2.2vw, 28px);
    grid-template-columns: auto 1fr auto;
    align-items: center;
    gap: clamp(16px, 2.5vw, 28px);
    overflow: hidden;
    background:
        radial-gradient(circle at 89% 15%, rgba(255, 255, 255, .8), transparent 27%),
        linear-gradient(120deg, var(--rose-300), var(--rose-200));
    border: 1px solid rgba(125, 79, 85, .1);
    border-radius: 8px var(--radius-lg) 8px var(--radius-lg);
    box-shadow: var(--shadow-float);
}

.patient-context::after {
    position: absolute;
    right: -45px;
    bottom: -100px;
    width: 240px;
    height: 240px;
    border: 1px solid rgba(125, 79, 85, .18);
    border-radius: 50%;
    content: "";
}

.gestational-orbit {
    position: relative;
    display: grid;
    width: var(--gestational-orbit-size);
    height: var(--gestational-orbit-size);
    flex: 0 0 auto;
    place-items: center;
}

.gestational-orbit svg {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    transform: rotate(-90deg);
}

.gestational-orbit circle {
    fill: none;
    stroke-width: 6;
}

.orbit-track {
    stroke: rgba(255, 255, 255, .5);
}

.orbit-progress {
    stroke: var(--rose-700);
    stroke-linecap: round;
    stroke-dasharray: 100;
    stroke-dashoffset: 100;
    transition: stroke-dashoffset .8s var(--ease);
}

.gestational-orbit > span {
    position: relative;
    z-index: 1;
    display: grid;
    width: calc(100% - 22px);
    place-items: center;
    gap: 2px;
    line-height: 1;
    text-align: center;
}

.gestational-orbit strong,
.gestational-orbit small {
    display: block;
}

.gestational-orbit strong {
    font-family: Georgia, "Times New Roman", serif;
    font-size: calc(22px + var(--font-increase));
    font-weight: 500;
    line-height: .95;
}

.gestational-orbit small {
    max-width: 100%;
    font-size: calc(7px + var(--font-increase));
    font-weight: 800;
    letter-spacing: .06em;
    line-height: 1.05;
    text-transform: uppercase;
    white-space: nowrap;
}

.patient-title-block {
    min-width: 0;
}

.patient-title-block h1 {
    margin: 0 0 6px;
    overflow: hidden;
    font-size: clamp(25px, 2.6vw, 34px);
    font-weight: 500;
    letter-spacing: -.03em;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.patient-title-block > p:last-child {
    display: flex;
    margin-bottom: 0;
    flex-wrap: wrap;
    gap: 8px;
    color: var(--ink-700);
    font-size: calc(15px + var(--font-increase));
    font-weight: 800;
}

.patient-title-block b {
    color: var(--rose-500);
}

.clinical-flags {
    position: relative;
    z-index: 1;
    display: flex;
    gap: 10px;
}

.clinical-flags > span {
    min-width: 110px;
    padding: 10px 12px;
    background: var(--paper);
    border: 1px solid var(--border);
    border-radius: 12px;
    box-shadow: 0 6px 18px rgba(63, 53, 50, .08);
}

.clinical-flags small,
.clinical-flags strong {
    display: block;
}

.clinical-flags small {
    margin-bottom: 4px;
    color: var(--ink-500);
    font-size: calc(10px + var(--font-increase));
    font-weight: 800;
    letter-spacing: .08em;
    text-transform: uppercase;
}

.clinical-flags strong {
    max-width: 150px;
    overflow: hidden;
    font-size: calc(13px + var(--font-increase));
    text-overflow: ellipsis;
    white-space: nowrap;
}

.risk-habitual,
.allergy-clear,
.allergy-unknown {
    background: var(--rose-100) !important;
    border-color: var(--rose-400) !important;
}

.risk-habitual small,
.risk-habitual strong,
.allergy-clear small,
.allergy-clear strong,
.allergy-unknown small,
.allergy-unknown strong {
    color: var(--rose-700);
}

.risk-high,
.allergy-present {
    background: var(--clinical-alert) !important;
    border-color: var(--clinical-alert-border) !important;
}

.risk-high small,
.risk-high strong,
.allergy-present small,
.allergy-present strong {
    color: var(--clinical-alert-ink);
}

.section-index {
    position: relative;
    z-index: 1;
    top: auto;
    display: flex;
    margin: 6px 0 18px;
    padding: 6px 8px;
    gap: 2px;
    overflow-x: auto;
    scrollbar-width: none;
    background: var(--surface-translucent-strong);
    border: 1px solid var(--border);
    border-radius: 12px;
    backdrop-filter: blur(18px);
}

.section-index::-webkit-scrollbar {
    display: none;
}

.section-index a {
    min-width: max-content;
    padding: 8px 9px;
    flex: 1 1 auto;
    color: var(--ink-500);
    border-radius: 8px;
    font-size: calc(12px + var(--font-increase));
    font-weight: 800;
    letter-spacing: .02em;
    text-decoration: none;
    white-space: nowrap;
}

.section-index a:hover,
.section-index a.is-active {
    color: var(--rose-700);
    background: var(--rose-100);
}

.record-section {
    position: relative;
    padding: 38px clamp(24px, 3.5vw, 48px) 44px;
    background: var(--paper);
    border: 1px solid var(--border);
    border-bottom: 0;
}

.record-section:first-child {
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}

.record-section:last-child {
    border-bottom: 1px solid var(--border);
    border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}

.record-section:nth-child(even) {
    background: var(--rose-50);
}

.section-heading {
    display: grid;
    max-width: 800px;
    margin-bottom: 24px;
    grid-template-columns: 42px 1fr;
    gap: 12px;
}

.section-heading > span {
    padding-top: 5px;
    color: var(--rose-400);
    font-family: Georgia, "Times New Roman", serif;
    font-size: calc(15px + var(--font-increase));
}

.section-heading > div {
    padding-left: 20px;
    border-left: 1px solid var(--olive-300);
}

.section-heading h2 {
    margin-bottom: 5px;
    font-size: clamp(25px, 2.5vw, 33px);
    font-weight: 500;
    letter-spacing: -.025em;
}

.section-heading div > p:last-child {
    margin-bottom: 0;
    color: var(--ink-500);
    font-size: calc(14px + var(--font-increase));
}

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

.span-2 { grid-column: span 2; }
.span-3 { grid-column: span 3; }
.span-4 { grid-column: span 4; }
.span-5 { grid-column: span 5; }
.span-6 { grid-column: span 6; }
.span-9 { grid-column: span 9; }
.span-12 { grid-column: span 12; }

.identity-primary-row,
.identity-contact-row,
.identity-health-row,
.identity-companion-row,
.identity-clinical-row {
    display: grid;
    min-width: 0;
    grid-column: 1 / -1;
    align-items: stretch;
    gap: 16px;
}

.identity-contact-row {
    grid-template-columns: minmax(260px, 1fr) minmax(360px, 1.6fr);
}

.patient-email-status {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-content: center;
    gap: 3px 12px;
    min-height: 64px;
    padding: 9px 13px;
    border: 1px solid var(--border);
    border-radius: 11px;
    background: var(--paper);
}

.patient-email-status > span,
.patient-email-status > p {
    color: var(--ink-500);
    font-size: calc(11px + var(--font-increase));
}

.patient-email-status > strong {
    color: var(--ink-700);
    font-size: calc(13px + var(--font-increase));
}

.patient-email-status > p {
    grid-column: 1;
    margin: 0;
    line-height: 1.35;
}

.patient-email-status > button {
    grid-column: 2;
    grid-row: 1 / 4;
    align-self: center;
    min-height: 38px;
    white-space: nowrap;
}

.patient-email-status[data-state="verified"] { border-color: #7f9b82; background: #eef4ee; }
.patient-email-status[data-state="pending"] { border-color: #c6a45e; background: #fff8e8; }
.patient-email-status[data-state="changed"] { border-color: var(--rose-300); background: var(--rose-50); }

.identity-primary-row {
    grid-template-columns:
        minmax(245px, 2.35fr)
        minmax(145px, 1.05fr)
        minmax(72px, .55fr)
        minmax(165px, 1.15fr)
        minmax(175px, 1.25fr)
        minmax(155px, 1.1fr);
}

.identity-health-row {
    grid-template-columns:
        minmax(130px, .9fr)
        minmax(130px, .9fr)
        minmax(150px, 1.05fr)
        minmax(220px, 1.55fr)
        minmax(220px, 1.55fr);
}

.identity-companion-row {
    grid-template-columns:
        minmax(210px, 2fr)
        minmax(155px, 1.05fr)
        minmax(180px, 1.25fr)
        minmax(165px, 1.1fr)
        minmax(165px, 1.1fr);
}

.identity-clinical-row {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) minmax(170px, .55fr);
}

.identity-primary-row .field > span,
.identity-health-row .field > span,
.identity-companion-row .field > span {
    display: flex;
    min-height: 32px;
    align-items: flex-end;
    line-height: 1.2;
}

.field {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    min-width: 0;
    gap: 6px;
}

.field > span,
.obstetric-counts label > span {
    color: var(--ink-700);
    font-size: calc(12px + var(--font-increase));
    font-weight: 800;
    letter-spacing: .035em;
}

.field input,
.field select,
.field textarea,
.obstetric-counts input {
    width: 100%;
    min-width: 0;
    max-width: 100%;
    min-height: 44px;
    padding: 10px 12px;
    color: var(--ink-900);
    background: var(--white);
    border: 1px solid rgba(97, 85, 82, .24);
    border-radius: 9px;
    outline: none;
    font-size: calc(14px + var(--font-increase));
    transition: border-color .2s ease, box-shadow .2s ease, background .2s ease;
}

.field textarea {
    min-height: 82px;
    resize: vertical;
}

.field input:hover,
.field select:hover,
.field textarea:hover,
.obstetric-counts input:hover {
    border-color: var(--rose-400);
}

.field input:focus,
.field select:focus,
.field textarea:focus,
.obstetric-counts input:focus {
    background: var(--paper);
    border-color: var(--rose-600);
    box-shadow: 0 0 0 3px rgba(226, 186, 186, .35);
}

.field input:invalid:not(:placeholder-shown) {
    border-color: var(--danger);
}

.readonly-field input {
    color: var(--rose-700);
    background: var(--olive-100);
    border-color: transparent;
    font-weight: 800;
}

.field-help {
    color: var(--ink-500);
    font-size: calc(10px + var(--font-increase));
    line-height: 1.3;
}

.bmi-field-shell {
    position: relative;
    display: grid;
    min-width: 0;
}

.bmi-field-shell input {
    padding-right: 38px;
}

.bmi-status-dot {
    position: absolute;
    top: 50%;
    right: 14px;
    width: 12px;
    height: 12px;
    background: var(--ink-400);
    border: 2px solid var(--paper);
    border-radius: 50%;
    box-shadow: 0 0 0 1px rgba(63, 53, 50, .16);
    transform: translateY(-50%);
}

.bmi-status-dot[data-state="healthy"] { background: #4f8060; }
.bmi-status-dot[data-state="warning"] { background: #d4a72c; }
.bmi-status-dot[data-state="danger"] { background: #a84a52; }

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

.choice-panel {
    min-width: 0;
    margin: 0;
    padding: 18px;
    background: var(--surface-translucent);
    border: 1px solid var(--border);
    border-radius: 14px;
}

.choice-panel legend {
    padding: 0 8px;
    color: var(--rose-700);
    font-family: Georgia, "Times New Roman", serif;
    font-size: calc(17px + var(--font-increase));
    font-weight: 600;
}

.binary-list {
    display: grid;
}

.binary-list > div {
    display: grid;
    min-height: 42px;
    padding: 7px 0;
    grid-template-columns: 1fr auto auto;
    align-items: center;
    gap: 10px;
    border-bottom: 1px solid var(--border);
}

.binary-list > div:last-child {
    border-bottom: 0;
}

.binary-list span,
.binary-list label,
.long-question,
.long-question label {
    font-size: calc(12px + var(--font-increase));
}

.binary-list label,
.long-question label {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-weight: 700;
}

.antecedent-other {
    margin-top: 12px;
}

.antecedent-other input {
    min-height: 38px;
}

input[type="radio"],
input[type="checkbox"] {
    accent-color: var(--rose-600);
}

.obstetric-counts {
    display: grid;
    margin-bottom: 15px;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    align-items: end;
    gap: 8px;
}

.obstetric-counts > label,
.birth-counts,
.birth-counts > label {
    width: 100%;
    min-width: 0;
}

.obstetric-counts label {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 5px;
}

.obstetric-counts label > span {
    overflow-wrap: anywhere;
    font-size: calc(10px + var(--font-increase));
    letter-spacing: 0;
    line-height: 1.15;
    text-align: center;
}

.obstetric-counts input {
    text-align: center;
}

.obstetric-counts.is-invalid input {
    border-color: var(--danger);
    box-shadow: 0 0 0 3px rgba(168, 74, 82, .14);
}

.obstetric-counts-feedback {
    min-height: 18px;
    margin: -7px 0 12px;
    color: var(--danger);
    font-size: calc(11px + var(--font-increase));
    font-weight: 700;
    line-height: 1.35;
}

.birth-counts {
    position: relative;
    display: grid;
    min-width: 0;
    margin: -8px 0 0;
    padding: 38px 0 0;
    grid-column: span 2;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    border: 0;
}

.birth-counts::before {
    position: absolute;
    top: 18px;
    left: 25%;
    width: 50%;
    height: 14px;
    content: "";
    pointer-events: none;
    border: 1px solid var(--rose-300);
    border-bottom: 0;
    border-radius: 10px 10px 0 0;
}

.birth-counts legend {
    position: absolute;
    z-index: 1;
    top: 0;
    left: 50%;
    padding: 0 8px;
    color: var(--rose-700);
    background: var(--paper);
    font-family: "Segoe UI", Roboto, Arial, sans-serif;
    font-size: calc(11px + var(--font-increase));
    font-weight: 800;
    letter-spacing: .08em;
    text-transform: uppercase;
    transform: translateX(-50%);
}

.birth-counts label {
    display: grid;
    gap: 5px;
}

.long-question {
    display: flex;
    margin-bottom: 12px;
    padding: 12px;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
    background: var(--rose-100);
    border-radius: 9px;
}

.long-question p {
    width: 100%;
    margin-bottom: 0;
    font-weight: 700;
    line-height: 1.4;
}

.textarea-field {
    margin-top: 16px;
}

.table-note {
    display: flex;
    margin-bottom: 9px;
    align-items: center;
    justify-content: space-between;
    gap: 15px;
    color: var(--ink-500);
    font-size: calc(11px + var(--font-increase));
}

.highlight-legend {
    display: flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
}

.highlight-legend i {
    width: 8px;
    height: 8px;
    margin-left: 6px;
    border-radius: 50%;
}

.highlight-legend .attention { background: var(--danger); }
.highlight-legend .pending { background: var(--pending); }
.highlight-legend .checked { background: var(--success); }

.clinical-table-wrap {
    max-width: 100%;
    overflow-x: auto;
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: 12px;
    scrollbar-color: var(--rose-300) transparent;
}

.clinical-table {
    width: 100%;
    border-spacing: 0;
    border-collapse: separate;
    font-size: calc(12px + var(--font-increase));
}

.clinical-table th,
.clinical-table td {
    position: relative;
    height: 46px;
    padding: 6px 8px;
    border-right: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
    text-align: center;
}

.clinical-table tr:last-child > * {
    border-bottom: 0;
}

.clinical-table tr > *:last-child {
    border-right: 0;
}

.clinical-table thead th {
    position: sticky;
    z-index: 2;
    top: 0;
    min-width: 132px;
    color: var(--rose-700);
    background: var(--rose-200);
    font-size: calc(11px + var(--font-increase));
    letter-spacing: .04em;
    text-transform: uppercase;
}

.clinical-table thead th:first-child,
.clinical-table tbody th {
    position: sticky;
    z-index: 3;
    left: 0;
    min-width: 150px;
    color: var(--ink-700);
    background: var(--paper);
    font-weight: 800;
    text-align: left;
}

.clinical-table thead th:first-child {
    z-index: 4;
    background: var(--rose-200);
}

.evolution-table thead .consultation-heading,
.ultrasound-table thead th:first-child {
    text-align: center;
}

.ig-row-heading {
    display: flex;
    width: 100%;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    color: var(--ink-700);
    cursor: pointer;
    font-weight: 900;
    text-align: left;
}

.ig-row-heading:has(input:checked) {
    color: var(--rose-700);
}

.clinical-table .ig-row-heading input[type="radio"] {
    width: 16px;
    min-width: 16px;
    height: 16px;
    min-height: 16px;
    flex: 0 0 auto;
    margin: 0;
    padding: 0;
    background: transparent;
    border: 0;
    border-radius: 50%;
}

.clinical-table .ig-row-heading input[type="radio"]:focus {
    border-radius: 50%;
    box-shadow: 0 0 0 2px rgba(226, 186, 186, .55);
}

.gestational-age-entry {
    display: grid;
    width: fit-content;
    max-width: 100%;
    margin-inline: auto;
    grid-template-columns: 38px auto 38px auto;
    align-items: center;
    justify-content: center;
    gap: 4px;
}

.clinical-table .gestational-age-entry input:not([type="hidden"]) {
    width: 38px;
    min-width: 38px;
    min-height: 34px;
    padding: 4px;
    appearance: textfield;
    text-align: center;
}

.gestational-age-entry input::-webkit-inner-spin-button,
.gestational-age-entry input::-webkit-outer-spin-button {
    margin: 0;
    appearance: none;
}

.gestational-age-unit {
    color: var(--ink-700);
    font-size: calc(11px + var(--font-increase));
    font-weight: 900;
    text-transform: lowercase;
}

.clinical-table .gestational-age-entry.is-calculated input:not([type="hidden"]) {
    color: var(--rose-700);
    background: var(--olive-100);
    font-weight: 900;
}

.consultation-table-shell {
    display: grid;
    gap: 10px;
}

.consultation-table-actions {
    display: flex;
    min-height: 42px;
    padding-inline: 4px;
    align-items: center;
    justify-content: flex-end;
    gap: 12px;
}

.consultation-table-actions > span {
    color: var(--ink-500);
    font-size: calc(11px + var(--font-increase));
    font-weight: 700;
}

.add-consultation-button,
.remove-consultation-button {
    display: inline-flex;
    min-height: 38px;
    padding: 8px 14px;
    align-items: center;
    white-space: nowrap;
}

.add-consultation-button > span,
.remove-consultation-button > span {
    margin-right: 3px;
    font-size: calc(18px + var(--font-increase));
    line-height: 0;
}

.remove-consultation-button[hidden] {
    display: none;
}

.add-consultation-button:disabled {
    cursor: not-allowed;
    opacity: .58;
}

.clinical-table input,
.clinical-table textarea,
.clinical-table select {
    width: 100%;
    min-height: 30px;
    padding: 5px 7px;
    color: var(--ink-900);
    background: var(--field-surface-soft);
    border: 1px solid var(--field-border);
    border-radius: 6px;
    outline: none;
    font-size: calc(11px + var(--font-increase));
}

.clinical-table textarea {
    min-height: 54px;
    resize: vertical;
}

.clinical-table input:focus,
.clinical-table textarea:focus,
.clinical-table select:focus {
    border-color: var(--rose-600);
    box-shadow: 0 0 0 2px rgba(226, 186, 186, .35);
}

.consultation-weight-stack {
    display: grid;
    gap: 4px;
}

.consultation-bmi-output {
    display: block;
    min-height: 18px;
    padding-inline: 3px;
    overflow: hidden;
    color: var(--rose-700);
    font-size: calc(9px + var(--font-increase));
    font-weight: 800;
    line-height: 1.25;
    text-align: left;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.clinical-table .textarea-row td,
.clinical-table .textarea-row th {
    height: 70px;
}

.highlightable {
    --cell-state: transparent;
    background: var(--cell-state);
    transition: background .2s ease;
}

.highlightable[data-highlight="attention"] { --cell-state: var(--danger-soft); }
.highlightable[data-highlight="pending"] { --cell-state: var(--pending-soft); }
.highlightable[data-highlight="checked"] { --cell-state: var(--success-soft); }

.cell-highlight {
    position: absolute;
    z-index: 2;
    top: 3px;
    right: 3px;
    width: 12px;
    height: 12px;
    padding: 0;
    background: var(--white);
    border: 1px solid var(--olive-300);
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 1px 3px rgba(63, 53, 50, .12);
}

.highlightable[data-highlight="attention"] .cell-highlight { background: var(--danger); border-color: var(--danger); }
.highlightable[data-highlight="pending"] .cell-highlight { background: var(--pending); border-color: var(--pending); }
.highlightable[data-highlight="checked"] .cell-highlight { background: var(--success); border-color: var(--success); }

.ultrasound-table {
    min-width: 980px;
}

.ultrasound-table thead th:first-child,
.ultrasound-table tbody th {
    min-width: 130px;
}

.ultrasound-table .wide-column {
    min-width: 260px;
}

.exam-details-grid {
    display: grid;
    margin-top: 18px;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 12px;
}

.dated-note {
    padding: 18px;
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: 14px;
}

.dated-note h3 {
    margin-bottom: 16px;
    color: var(--rose-700);
    font-size: calc(17px + var(--font-increase));
}

.dated-note .field + .field {
    margin-top: 10px;
}

.dental-note {
    grid-column: auto;
}

.dental-note .two-dates {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 7px;
}

.dental-note .two-dates .field {
    min-width: 0;
}

.dental-note .two-dates + .field {
    margin-top: 10px;
}

.dental-note .two-dates .field > span {
    font-size: calc(10px + var(--font-increase));
}

.dental-note .two-dates input[type="date"] {
    min-width: 0;
    min-height: 44px;
    padding: 8px 4px;
    font-size: calc(11px + var(--font-increase));
}

.dental-visits {
    display: grid;
    gap: 12px;
}

.dental-visit {
    display: grid;
    padding-bottom: 12px;
    gap: 9px;
    border-bottom: 1px solid var(--border);
}

.dental-visit:last-child {
    padding-bottom: 0;
    border-bottom: 0;
}

.dental-visit textarea {
    min-height: 58px;
}

.two-dates,
.dose-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
}

.lab-table {
    min-width: 1240px;
    table-layout: fixed;
}

.laboratory-table-wrap {
    scrollbar-gutter: stable;
}

.lab-table .lab-col-exam {
    width: 20%;
}

.lab-table .lab-col-result {
    width: 16%;
}

.lab-table .lab-col-guidance {
    width: 32%;
}

.lab-table thead th {
    height: 76px;
    padding: 8px 10px;
    vertical-align: middle;
}

.lab-table thead th:first-child,
.lab-table tbody th {
    min-width: 230px;
}

.lab-axis-heading {
    padding: 8px 14px !important;
    font-size: calc(11px + var(--font-increase));
    letter-spacing: .04em;
    text-align: center;
    text-transform: uppercase;
}

.lab-date-heading {
    display: grid;
    min-width: 0;
    gap: 5px;
}

.lab-date-heading > span {
    color: var(--rose-700);
    font-size: calc(10px + var(--font-increase));
    font-weight: 800;
}

.lab-date-heading input {
    min-height: 36px;
    color: var(--ink-900);
    background: var(--white);
    border-color: rgba(125, 79, 85, .22);
}

.lab-guidance-heading {
    line-height: 1.35;
}

.lab-table tbody th {
    color: var(--rose-700);
}

.lab-table tbody td {
    height: 50px;
    padding: 6px;
}

.lab-table tbody input {
    min-height: 36px;
    color: var(--ink-900);
    background: var(--white);
}

.glicemia-result-group {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 4px;
}

.glicemia-result-group input {
    min-width: 0;
    padding-inline: 5px !important;
    text-align: center;
}

.lab-table .lab-guidance-cell input {
    background: var(--olive-100);
}

.lab-table .lab-other-row th,
.lab-table .lab-other-row td {
    background-color: var(--rose-50);
}

.lab-table .lab-other-row th {
    color: var(--rose-800);
}

.not-applicable {
    color: var(--ink-500);
    background: var(--canvas);
}

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

.vaccine-grid article {
    display: grid;
    min-width: 0;
    padding: 20px;
    grid-template-columns: minmax(124px, .5fr) minmax(125px, .65fr) minmax(0, 1.35fr);
    align-items: center;
    gap: 14px;
    overflow: hidden;
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: 14px;
}

.vaccine-grid .vaccine-wide {
    grid-column: 1 / -1;
}

.vaccine-title {
    display: flex;
    min-width: 0;
    flex-direction: column;
    align-items: flex-start;
    gap: 5px;
}

.vaccine-title span {
    color: var(--rose-400);
    font-family: Georgia, "Times New Roman", serif;
    font-size: calc(13px + var(--font-increase));
}

.vaccine-title h3 {
    margin-bottom: 0;
    font-size: calc(20px + var(--font-increase));
    overflow-wrap: anywhere;
}

.vaccine-grid article:not(.vaccine-wide) .vaccine-title h3 {
    font-size: calc(18px + var(--font-increase));
}

.vaccine-grid .field,
.vaccine-grid .dose-grid,
.vaccine-grid input {
    min-width: 0;
}

.vaccine-grid .dose-grid {
    grid-template-columns: repeat(auto-fit, minmax(min(132px, 100%), 1fr));
}

.documents-layout {
    display: grid;
    grid-template-columns: 1.2fr .8fr;
    gap: 18px;
}

.upload-zone {
    display: flex;
    min-height: 180px;
    padding: 24px;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: var(--ink-700);
    background: var(--olive-100);
    border: 1px dashed var(--olive-500);
    border-radius: 8px 24px 8px 24px;
    cursor: pointer;
    text-align: center;
    transition: background .2s ease, border-color .2s ease;
}

.upload-zone:hover {
    background: var(--rose-100);
    border-color: var(--rose-600);
}

.upload-zone input {
    position: absolute;
    width: 1px;
    height: 1px;
    opacity: 0;
}

.upload-symbol {
    display: grid;
    width: 42px;
    height: 42px;
    margin-bottom: 12px;
    place-items: center;
    color: var(--white);
    background: var(--rose-600);
    border-radius: 50%;
    font-size: calc(24px + var(--font-increase));
}

.upload-zone strong,
.upload-zone small {
    display: block;
}

.upload-zone strong {
    font-family: Georgia, "Times New Roman", serif;
    font-size: calc(18px + var(--font-increase));
}

.upload-zone small {
    margin-top: 5px;
    color: var(--ink-500);
    font-size: calc(11px + var(--font-increase));
}

.toast {
    position: fixed;
    z-index: 100;
    right: 24px;
    bottom: 24px;
    max-width: min(360px, calc(100vw - 48px));
    padding: 13px 17px;
    color: var(--white);
    background: var(--ink-900);
    border-radius: 12px;
    box-shadow: var(--shadow-float);
    font-size: calc(14px + var(--font-increase));
    font-weight: 700;
    opacity: 0;
    pointer-events: none;
    transform: translateY(12px);
    transition: opacity .2s ease, transform .2s ease;
}

.toast.is-visible {
    opacity: 1;
    transform: translateY(0);
}

.settings-dialog {
    width: min(780px, calc(100vw - 32px));
    max-height: min(820px, calc(100dvh - 32px));
    padding: 0;
    color: var(--ink-900);
    background: var(--paper);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-float);
    overflow: hidden;
}

.settings-dialog::backdrop {
    background: rgba(35, 27, 27, .52);
    backdrop-filter: blur(5px);
}

.settings-panel {
    display: flex;
    max-height: min(820px, calc(100dvh - 32px));
    flex-direction: column;
}

.settings-heading {
    display: flex;
    padding: 28px 30px 22px;
    align-items: flex-start;
    justify-content: space-between;
    gap: 24px;
    background: var(--rose-50);
    border-bottom: 1px solid var(--border);
}

.settings-heading h2 {
    margin-bottom: 7px;
    font-size: calc(31px + var(--font-increase));
    font-weight: 500;
}

.settings-heading > div > p:last-child,
.settings-section-heading p {
    margin-bottom: 0;
    color: var(--ink-500);
    font-size: calc(13px + var(--font-increase));
}

.dialog-close {
    display: grid;
    width: 38px;
    height: 38px;
    flex: 0 0 auto;
    place-items: center;
    color: var(--ink-700);
    background: var(--paper);
    border: 1px solid var(--border);
    border-radius: 50%;
    cursor: pointer;
    font-size: calc(26px + var(--font-increase));
    line-height: 1;
}

.dialog-close:hover {
    color: var(--rose-700);
    background: var(--rose-100);
}

.settings-content {
    padding: 26px 30px;
    overflow-y: auto;
}

.settings-section + .settings-section {
    margin-top: 30px;
    padding-top: 26px;
    border-top: 1px solid var(--border);
}

.settings-section-heading {
    display: grid;
    margin-bottom: 18px;
    grid-template-columns: 28px 1fr;
    gap: 10px;
}

.settings-section-heading > span {
    padding-top: 3px;
    color: var(--rose-400);
    font-family: Georgia, "Times New Roman", serif;
    font-size: calc(13px + var(--font-increase));
}

.settings-section-heading h3 {
    margin-bottom: 4px;
    font-size: calc(20px + var(--font-increase));
}

.profile-photo-editor {
    display: grid;
    margin-bottom: 18px;
    padding: 14px;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    gap: 12px;
    background: var(--canvas);
    border: 1px solid var(--border);
    border-radius: 13px;
}

.profile-avatar-preview {
    width: 50px;
    height: 50px;
}

.profile-photo-editor strong,
.profile-photo-editor small {
    display: block;
}

.profile-photo-editor strong {
    font-size: calc(14px + var(--font-increase));
}

.profile-photo-editor small {
    margin-top: 3px;
    color: var(--ink-500);
    font-size: calc(11px + var(--font-increase));
}

.profile-photo-button {
    display: inline-flex;
    min-height: 38px;
    align-items: center;
    cursor: pointer;
    font-size: calc(12px + var(--font-increase));
    white-space: nowrap;
}

.profile-photo-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
}

.profile-photo-remove {
    display: inline-flex;
    min-height: 38px;
    padding: 8px 4px;
    align-items: center;
    justify-content: center;
    color: var(--danger);
    font-size: calc(12px + var(--font-increase));
    white-space: nowrap;
}

.profile-photo-remove[hidden] {
    display: none;
}

.profile-photo-remove:hover {
    color: var(--danger);
    text-decoration: underline;
}

.profile-photo-button input {
    position: absolute;
    width: 1px;
    height: 1px;
    opacity: 0;
    pointer-events: none;
}

.settings-fields {
    gap: 12px;
}

.settings-fields,
.doctor-form-grid {
    grid-template-columns: repeat(12, minmax(0, 1fr));
    align-items: start;
    gap: 14px;
}

.settings-fields .field,
.doctor-form-grid .field,
.settings-fields input,
.settings-fields select,
.doctor-form-grid input,
.doctor-form-grid select {
    min-width: 0;
}

.profile-security-action {
    display: grid;
    padding: 16px;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 16px;
    background: var(--canvas);
    border: 1px solid var(--border);
    border-radius: 14px;
}

.profile-security-action strong,
.profile-security-action small {
    display: block;
}

.profile-security-action strong {
    font-size: calc(14px + var(--font-increase));
}

.profile-security-action small {
    margin-top: 4px;
    color: var(--ink-500);
    font-size: calc(12px + var(--font-increase));
    line-height: 1.45;
}

.profile-security-action .secondary-button {
    white-space: nowrap;
}

.theme-choice {
    display: grid;
    padding: 16px;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    gap: 14px;
    background: var(--canvas);
    border: 1px solid var(--border);
    border-radius: 14px;
    cursor: pointer;
}

.theme-choice > span > strong,
.theme-choice > span > small {
    display: block;
}

.theme-choice > span > strong {
    font-size: calc(14px + var(--font-increase));
}

.theme-choice > span > small {
    margin-top: 3px;
    color: var(--ink-500);
    font-size: calc(11px + var(--font-increase));
}

.theme-preview {
    display: grid;
    width: 54px;
    height: 42px;
    padding: 8px;
    grid-template-columns: 10px 1fr;
    gap: 4px;
    background: #242023;
    border: 1px solid #4e454b;
    border-radius: 8px;
}

.theme-preview i:first-child {
    grid-row: span 2;
    background: #42383d;
    border-radius: 3px;
}

.theme-preview i:nth-child(2),
.theme-preview i:nth-child(3) {
    background: #e2baba;
    border-radius: 2px;
}

.theme-choice > input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.switch-control {
    position: relative;
    width: 42px;
    height: 24px;
    background: var(--olive-300);
    border-radius: 999px;
    transition: background .2s ease;
}

.switch-control::after {
    position: absolute;
    top: 3px;
    left: 3px;
    width: 18px;
    height: 18px;
    background: var(--white);
    border-radius: 50%;
    box-shadow: 0 2px 5px rgba(63, 53, 50, .22);
    content: "";
    transition: transform .2s var(--ease);
}

.theme-choice > input:focus-visible + .switch-control {
    outline: 3px solid var(--rose-500);
    outline-offset: 3px;
}

.theme-choice > input:checked + .switch-control {
    background: var(--rose-600);
}

.theme-choice > input:checked + .switch-control::after {
    transform: translateX(18px);
}

.accessibility-toolbar-button {
    color: var(--rose-700);
}

.accessibility-login-button {
    position: fixed;
    z-index: 80;
    top: 22px;
    right: 24px;
    color: var(--rose-700);
    background: var(--surface-translucent-strong);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-soft);
    backdrop-filter: blur(12px);
}

.accessibility-dialog {
    width: min(680px, calc(100vw - 32px));
}

.accessibility-content {
    display: grid;
    padding: 26px 30px;
    gap: 24px;
    overflow-y: auto;
}

.accessibility-section-heading h3 {
    margin-bottom: 4px;
    font-size: calc(20px + var(--font-increase));
}

.accessibility-section-heading p {
    margin-bottom: 14px;
    color: var(--ink-500);
    font-size: calc(13px + var(--font-increase));
}

.accessibility-font-options {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
}

.accessibility-font-options button {
    display: grid;
    min-height: 74px;
    padding: 10px;
    place-items: center;
    align-content: center;
    gap: 5px;
    color: var(--ink-700);
    background: var(--canvas);
    border: 2px solid transparent;
    border-radius: 13px;
    cursor: pointer;
    font-size: calc(13px + var(--font-increase));
    font-weight: 800;
}

.accessibility-font-options button span {
    color: var(--rose-700);
    font-family: Georgia, "Times New Roman", serif;
    font-size: calc(22px + var(--font-increase));
}

.accessibility-font-options button[aria-pressed="true"] {
    color: var(--rose-700);
    background: var(--rose-50);
    border-color: var(--rose-500);
}

.accessibility-preferences {
    display: grid;
    gap: 9px;
}

.accessibility-choice {
    position: relative;
    display: grid;
    min-height: 64px;
    padding: 12px 14px;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 12px;
    background: var(--canvas);
    border: 1px solid var(--border);
    border-radius: 13px;
    cursor: pointer;
}

.accessibility-choice strong,
.accessibility-choice small {
    display: block;
}

.accessibility-choice strong {
    font-size: calc(14px + var(--font-increase));
}

.accessibility-choice small {
    margin-top: 3px;
    color: var(--ink-500);
    font-size: calc(11px + var(--font-increase));
}

.accessibility-choice > input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.accessibility-choice > input:focus-visible + .switch-control {
    outline: 3px solid var(--rose-500);
    outline-offset: 3px;
}

.accessibility-choice > input:checked + .switch-control {
    background: var(--rose-600);
}

.accessibility-choice > input:checked + .switch-control::after {
    transform: translateX(18px);
}

.accessibility-status {
    min-height: 20px;
    margin: -8px 0 0;
    color: var(--success);
    font-size: calc(12px + var(--font-increase));
    font-weight: 800;
    text-align: center;
}

.settings-actions {
    display: flex;
    padding: 18px 30px;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
    background: var(--paper);
    border-top: 1px solid var(--border);
}

.confirm-dialog {
    width: min(520px, calc(100vw - 32px));
}

.confirm-content {
    display: grid;
    padding: 28px 30px;
    grid-template-columns: auto minmax(0, 1fr);
    align-items: center;
    gap: 16px;
}

.confirm-symbol {
    display: grid;
    width: 48px;
    height: 48px;
    place-items: center;
    color: var(--rose-700);
    background: var(--rose-100);
    border: 1px solid var(--rose-300);
    border-radius: 50%;
    font-size: calc(22px + var(--font-increase));
    font-weight: 800;
}

.confirm-content strong {
    display: block;
    margin-bottom: 5px;
    font-size: calc(15px + var(--font-increase));
}

.confirm-content p {
    margin-bottom: 0;
    color: var(--ink-500);
    font-size: calc(13px + var(--font-increase));
    line-height: 1.5;
}

.doctor-directory-shell {
    padding: 12px;
    background: var(--paper);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-soft);
}

.doctor-list-header,
.doctor-row {
    display: grid;
    grid-template-columns: 42px minmax(190px, 1.15fr) minmax(130px, .7fr) minmax(120px, .6fr) minmax(140px, .75fr) auto;
    align-items: center;
    gap: 14px;
}

.doctor-list-header {
    min-height: 32px;
    padding: 0 14px 8px;
    color: var(--ink-500);
    border-bottom: 1px solid var(--border);
    font-size: calc(10px + var(--font-increase));
    font-weight: 800;
    letter-spacing: .06em;
    text-transform: uppercase;
}

.doctor-directory {
    display: grid;
    gap: 7px;
}

.doctor-row {
    min-height: 74px;
    padding: 12px 14px;
    border: 1px solid transparent;
    border-radius: 13px;
}

.doctor-row:hover {
    background: var(--rose-50);
    border-color: var(--rose-200);
}

.doctor-row-avatar {
    width: 42px;
    height: 42px;
}

.doctor-row-primary,
.doctor-row-meta {
    min-width: 0;
}

.doctor-row-primary strong,
.doctor-row-primary small,
.doctor-row-meta strong,
.doctor-row-meta small {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.doctor-row-primary strong {
    font-size: calc(14px + var(--font-increase));
}

.doctor-row-primary small,
.doctor-row-meta small {
    margin-top: 3px;
    color: var(--ink-500);
    font-size: calc(11px + var(--font-increase));
}

.doctor-row-meta strong {
    font-size: calc(12px + var(--font-increase));
}

.form-security-note {
    margin: 20px 0 0;
    padding: 12px 14px;
    color: var(--ink-500);
    background: var(--olive-100);
    border-radius: 10px;
    font-size: calc(12px + var(--font-increase));
    line-height: 1.5;
}

.notification-dialog {
    width: min(720px, calc(100vw - 32px));
}

.notification-list {
    display: grid;
    min-height: 220px;
    max-height: min(520px, calc(100dvh - 250px));
    padding: 18px 22px;
    align-content: start;
    gap: 9px;
    overflow-y: auto;
}

.notification-item {
    position: relative;
    display: grid;
    min-width: 0;
    min-height: 82px;
    padding: 14px;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    gap: 13px;
    background: var(--canvas);
    border: 1px solid var(--border);
    border-radius: 13px;
}

.notification-item.is-unread {
    background: var(--rose-50);
    border-color: var(--rose-300);
}

.notification-item.is-unread::before {
    position: absolute;
    top: 14px;
    bottom: 14px;
    left: -1px;
    width: 3px;
    background: var(--rose-600);
    border-radius: 0 3px 3px 0;
    content: "";
}

.notification-item strong,
.notification-item p,
.notification-item small {
    display: block;
}

.notification-item strong {
    font-size: calc(14px + var(--font-increase));
}

.notification-item p {
    margin: 4px 0 2px;
    color: var(--ink-700);
    font-size: calc(12px + var(--font-increase));
}

.notification-item small {
    color: var(--ink-500);
    font-size: calc(11px + var(--font-increase));
}

.notification-open {
    min-height: 36px;
    padding-inline: 13px;
    font-size: calc(11px + var(--font-increase));
    white-space: nowrap;
}

.notification-actions {
    justify-content: space-between;
}

.notification-actions > span {
    color: var(--ink-500);
    font-size: calc(12px + var(--font-increase));
    font-weight: 700;
}

.notification-empty {
    display: grid;
    min-height: 190px;
    place-content: center;
    gap: 6px;
    color: var(--ink-500);
    text-align: center;
}

.notification-empty strong {
    color: var(--ink-900);
    font-family: Georgia, "Times New Roman", serif;
    font-size: calc(20px + var(--font-increase));
}

.secondary-button:disabled {
    cursor: default;
    opacity: .52;
}

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

.clinic-document-card {
    display: grid;
    min-height: 270px;
    padding: 24px;
    grid-template-columns: auto 1fr;
    align-content: start;
    gap: 18px;
    background: var(--paper);
    border: 1px solid var(--border);
    border-radius: 18px;
    box-shadow: var(--shadow-soft);
}

.clinic-document-card > div {
    min-width: 0;
}

.clinic-document-card h2 {
    margin-bottom: 10px;
    font-size: calc(20px + var(--font-increase));
    line-height: 1.25;
}

.clinic-document-card p:not(.eyebrow) {
    margin-bottom: 0;
    color: var(--ink-500);
    font-size: calc(13px + var(--font-increase));
    line-height: 1.55;
}

.clinic-document-card .secondary-button {
    align-self: end;
    justify-self: start;
}

.clinic-document-actions {
    grid-column: 1 / -1;
    align-self: end;
}

.clinic-document-visibility {
    display: block;
    margin-top: 14px;
    color: var(--ink-500);
    font-size: calc(11px + var(--font-increase));
}

.clinic-document-empty {
    grid-column: 1 / -1;
}

.document-visibility {
    display: flex;
    padding: 14px 16px;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    background: var(--surface-translucent-soft);
    border: 1px solid var(--border);
    border-radius: 14px;
}

.document-visibility span {
    display: grid;
    gap: 4px;
}

.document-visibility small {
    color: var(--ink-500);
    line-height: 1.4;
}

.document-visibility input {
    width: 20px;
    height: 20px;
    flex: 0 0 auto;
}

.patient-exams-layout {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
}

.patient-exam-category {
    min-width: 0;
    padding: 18px;
    background: var(--surface-translucent);
    border: 1px solid var(--border);
    border-radius: 16px;
}

.patient-exam-heading {
    display: flex;
    margin-bottom: 14px;
    align-items: center;
    gap: 12px;
}

.patient-exam-heading > span {
    display: grid;
    width: 44px;
    height: 44px;
    flex: 0 0 auto;
    place-items: center;
    color: var(--rose-700);
    background: var(--rose-100);
    border-radius: 10px;
    font-size: calc(10px + var(--font-increase));
    font-weight: 900;
}

.patient-exam-heading h3,
.patient-exam-heading p {
    margin-bottom: 0;
}

.patient-exam-heading h3 {
    font-size: calc(18px + var(--font-increase));
}

.patient-exam-heading p {
    color: var(--ink-500);
    font-size: calc(11px + var(--font-increase));
}

.patient-exam-upload {
    display: grid;
    min-height: 150px;
    padding: 20px;
    grid-column: 1 / -1;
    gap: 16px;
    background: var(--paper);
    border: 1px dashed var(--rose-400);
    border-radius: 16px;
}

.patient-exam-upload-heading p {
    margin-bottom: 0;
}

.patient-exam-upload-heading p:not(.eyebrow) {
    margin-top: 4px;
    color: var(--ink-500);
    font-size: calc(12px + var(--font-increase));
}

.patient-exam-upload-grid {
    display: grid;
    grid-template-columns: minmax(220px, 1.5fr) minmax(150px, .8fr) minmax(220px, 1.2fr);
    gap: 12px;
}

.patient-exam-notes {
    grid-column: 1 / -1;
}

.patient-exam-file input {
    padding: 8px;
}

.patient-exam-upload-actions,
.patient-exam-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.patient-exam-upload-actions {
    justify-content: space-between;
}

.patient-exam-upload-actions p {
    margin: 0;
    color: var(--success);
    font-size: calc(12px + var(--font-increase));
    font-weight: 700;
}

.patient-exam-actions {
    flex-wrap: wrap;
    justify-content: flex-end;
}

.patient-exam-delete {
    color: var(--danger);
}

html[data-theme="dark"] {
    color-scheme: dark;
    --rose-50: #2d262a;
    --rose-100: #3a2d32;
    --rose-200: #503a40;
    --rose-300: #e2baba;
    --rose-400: #dca9ad;
    --rose-500: #cf9298;
    --rose-600: #bd7f86;
    --rose-700: #f0c9cc;
    --olive-100: #34322e;
    --olive-300: #bdb197;
    --olive-500: #d2c6ae;
    --ink-900: #f5eeec;
    --ink-700: #ded3d0;
    --ink-500: #b7aaa7;
    --paper: #211d20;
    --canvas: #181517;
    --white: #292428;
    --success: #8fbea0;
    --success-soft: #203329;
    --warning: #e4a778;
    --warning-soft: #3a2a20;
    --pending: #d9bd6a;
    --pending-soft: #39321f;
    --danger: #e49196;
    --danger-soft: #3e2528;
    --clinical-alert: #c99b48;
    --clinical-alert-border: #e0b86b;
    --clinical-alert-ink: #2d1e05;
    --shadow-soft: 0 16px 45px rgba(0, 0, 0, .22);
    --shadow-float: 0 24px 65px rgba(0, 0, 0, .36);
    --border: rgba(226, 186, 186, .16);
    --surface-translucent: rgba(41, 36, 40, .82);
    --surface-translucent-soft: rgba(50, 43, 47, .72);
    --surface-translucent-strong: rgba(33, 29, 32, .94);
    --field-surface: #332d31;
    --field-surface-soft: #302a2e;
    --field-border: rgba(226, 186, 186, .24);
    --patient-backdrop-overlay: linear-gradient(120deg, rgba(24, 21, 23, .97), rgba(45, 36, 40, .94));
    --app-frame: rgba(226, 186, 186, .16);
    --decorative-highlight: rgba(255, 255, 255, .08);
}

html[data-theme="dark"] .sidebar {
    background:
        linear-gradient(180deg, rgba(31, 27, 29, .95), rgba(24, 21, 23, .98)),
        url("fundo-floral.jpeg") center / cover;
}

html[data-theme="dark"] .topbar {
    background: rgba(24, 21, 23, .9);
}

html[data-theme="dark"] .patient-context {
    background:
        radial-gradient(circle at 89% 15%, rgba(255, 255, 255, .07), transparent 27%),
        linear-gradient(120deg, #513a41, #372a2f);
}

html[data-theme="dark"] .clinical-flags > span {
    box-shadow: 0 8px 22px rgba(0, 0, 0, .22);
}

html[data-theme="dark"] .section-index {
    background: rgba(33, 29, 32, .94);
}

html[data-theme="dark"] .choice-panel {
    background: rgba(41, 36, 40, .82);
}

html[data-theme="dark"] .global-search input,
html[data-theme="dark"] input:not([type="radio"]):not([type="checkbox"]):not([type="file"]),
html[data-theme="dark"] select,
html[data-theme="dark"] textarea {
    color: var(--ink-900);
    background-color: var(--field-surface);
    border-color: var(--field-border);
    caret-color: var(--rose-300);
}

html[data-theme="dark"] input::placeholder,
html[data-theme="dark"] textarea::placeholder {
    color: var(--ink-500);
    opacity: 1;
}

html[data-theme="dark"] input:not([type="radio"]):not([type="checkbox"]):not([type="file"]):disabled,
html[data-theme="dark"] select:disabled,
html[data-theme="dark"] textarea:disabled,
html[data-theme="dark"] input[readonly] {
    color: var(--ink-700);
    background: var(--olive-100);
    -webkit-text-fill-color: var(--ink-700);
    opacity: 1;
}

html[data-theme="dark"] input[type="date"]::-webkit-calendar-picker-indicator {
    filter: invert(1) brightness(1.25);
    opacity: .82;
}

html[data-theme="dark"] input[type="date"]::-webkit-datetime-edit,
html[data-theme="dark"] input[type="date"]::-webkit-datetime-edit-fields-wrapper,
html[data-theme="dark"] input[type="date"]::-webkit-datetime-edit-text,
html[data-theme="dark"] input[type="date"]::-webkit-datetime-edit-month-field,
html[data-theme="dark"] input[type="date"]::-webkit-datetime-edit-day-field,
html[data-theme="dark"] input[type="date"]::-webkit-datetime-edit-year-field {
    color: var(--ink-900);
}

html[data-theme="dark"] input:-webkit-autofill,
html[data-theme="dark"] input:-webkit-autofill:hover,
html[data-theme="dark"] input:-webkit-autofill:focus {
    -webkit-text-fill-color: var(--ink-900);
    box-shadow: 0 0 0 1000px var(--field-surface) inset;
    transition: background-color 9999s ease-out;
}

html[data-theme="dark"] option {
    color: var(--ink-900);
    background: var(--paper);
}

html[data-theme="dark"] .toast {
    color: var(--ink-900);
    background: #3a2d32;
    border: 1px solid var(--border);
}

html[data-theme="dark"] .login-story {
    background:
        linear-gradient(140deg, rgba(67, 48, 55, .92), rgba(42, 34, 37, .96)),
        url("fundo-floral.jpeg") center / cover;
}

html[data-theme="dark"] .login-access {
    background: var(--canvas);
}

html[data-a11y-contrast="high"] {
    --ink-900: #241416;
    --ink-700: #3d2529;
    --ink-500: #53383d;
    --border: rgba(63, 20, 28, .48);
    --rose-600: #7a303c;
    --rose-700: #5f1825;
    --paper: #ffffff;
    --canvas: #fffafa;
}

html[data-theme="dark"][data-a11y-contrast="high"] {
    --ink-900: #ffffff;
    --ink-700: #f8eeee;
    --ink-500: #e8d4d7;
    --border: rgba(255, 230, 233, .62);
    --rose-600: #f0b6bc;
    --rose-700: #ffdce0;
    --paper: #171214;
    --canvas: #080607;
    --white: #211a1d;
}

html[data-a11y-contrast="high"] :focus-visible {
    outline-color: #005fcc;
    outline-width: 4px;
}

html[data-a11y-contrast="high"] input,
html[data-a11y-contrast="high"] select,
html[data-a11y-contrast="high"] textarea,
html[data-a11y-contrast="high"] .global-search,
html[data-a11y-contrast="high"] .field,
html[data-a11y-contrast="high"] .editorial-panel,
html[data-a11y-contrast="high"] .record-section,
html[data-a11y-contrast="high"] .settings-dialog {
    border-color: var(--border);
}

html[data-a11y-links="underlined"] a:not(.icon-link):not(.patient-preview-link) {
    text-decoration: underline !important;
    text-decoration-thickness: 2px !important;
    text-underline-offset: 3px;
}

html[data-a11y-motion="reduced"] {
    scroll-behavior: auto;
}

html[data-a11y-motion="reduced"] *,
html[data-a11y-motion="reduced"] *::before,
html[data-a11y-motion="reduced"] *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
    transition-duration: .01ms !important;
}

@media (prefers-reduced-motion: reduce) {
    html {
        scroll-behavior: auto;
    }

    *,
    *::before,
    *::after {
        animation-duration: .01ms !important;
        animation-iteration-count: 1 !important;
        scroll-behavior: auto !important;
        transition-duration: .01ms !important;
    }
}

@media (max-width: 1180px) {
    :root { --sidebar-width: 220px; }
    .topbar { grid-template-columns: auto minmax(220px, 1fr) minmax(220px, auto); gap: 12px; }
    .metric-strip { grid-template-columns: repeat(2, 1fr); }
    .metric-strip article:nth-child(2) { border-right: 0; }
    .metric-strip article:nth-child(-n+2) { border-bottom: 1px solid var(--border); }
    .patient-list-header, .patient-row { grid-template-columns: 43px minmax(140px, 1fr) 95px 95px 95px 18px; gap: 8px; }
    .document-list-header, .document-row { grid-template-columns: 43px minmax(180px, 1.2fr) minmax(145px, 1fr) minmax(110px, .7fr) 90px 32px; gap: 9px; }
    .document-list-header > :nth-child(4), .document-row > :nth-child(4) { display: none; }
    .doctor-list-header, .doctor-row { grid-template-columns: 42px minmax(150px, 1fr) minmax(110px, .7fr) 105px minmax(115px, .7fr) auto; gap: 9px; }
    .antecedents-grid { grid-template-columns: repeat(2, 1fr); }
    .obstetric-panel { grid-column: span 2; }
    .identity-primary-row {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
    .identity-primary-row .identity-name { grid-column: span 2; }
    .identity-health-row {
        grid-template-columns: minmax(110px, .85fr) minmax(110px, .85fr) minmax(135px, 1fr) minmax(180px, 1.45fr) minmax(180px, 1.45fr);
    }
    .identity-companion-row {
        grid-template-columns: minmax(180px, 1.8fr) minmax(140px, 1fr) minmax(150px, 1.1fr) minmax(145px, 1fr) minmax(145px, 1fr);
    }
    .exam-details-grid { grid-template-columns: repeat(2, 1fr); }
    .dental-note { grid-column: auto; }
    .clinic-document-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .vaccine-grid article:not(.vaccine-wide) { grid-template-columns: 1fr; align-items: stretch; }
    .vaccine-grid article:not(.vaccine-wide) .vaccine-title { flex-direction: row; align-items: center; gap: 10px; }
}

@media (max-width: 1120px) {
    .identity-primary-row,
    .identity-contact-row,
    .identity-health-row,
    .identity-companion-row { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .identity-primary-row .identity-name,
    .identity-companion-name { grid-column: 1 / -1; }
}

@media (max-width: 880px) {
    :root { --topbar-height: 70px; }
    .sidebar {
        width: min(300px, 86vw);
        padding: 30px 20px 22px;
        box-shadow: var(--shadow-float);
        transform: translateX(-105%);
        transition: transform .35s var(--ease);
    }
    .sidebar.is-open { transform: translateX(0); }
    body.sidebar-collapsed .sidebar {
        width: min(300px, 86vw);
        padding: 30px 20px 22px;
        transform: translateX(-105%);
    }
    body.sidebar-collapsed .sidebar.is-open { transform: translateX(0); }
    body.sidebar-collapsed .brand-lockup { margin-bottom: 46px; }
    body.sidebar-collapsed .brand-logo-full { display: block; }
    body.sidebar-collapsed .brand-logo-compact { display: none; }
    body.sidebar-collapsed .nav-caption,
    body.sidebar-collapsed .nav-link > span,
    body.sidebar-collapsed .doctor-profile > span:nth-child(2) { display: block; }
    body.sidebar-collapsed .doctor-profile > .avatar { display: grid; }
    body.sidebar-collapsed .nav-link {
        min-height: 48px;
        padding: 0 14px;
        justify-content: flex-start;
        gap: 13px;
    }
    body.sidebar-collapsed .nav-link svg { width: 19px; height: 19px; }
    body.sidebar-collapsed .nav-link:hover { transform: translateX(2px); }
    body.sidebar-collapsed .nav-link.is-active::before { left: -20px; }
    body.sidebar-collapsed .nav-action-divider { margin: 8px 14px 4px; }
    body.sidebar-collapsed .doctor-profile {
        padding-top: 16px;
        grid-template-columns: auto minmax(0, 1fr) auto auto;
        justify-items: stretch;
        gap: 6px;
    }
    body.sidebar-collapsed .nav-link::after { display: none; }
    .sidebar-scrim {
        position: fixed;
        z-index: 45;
        inset: 0;
        width: 100%;
        height: 100%;
        background: rgba(63, 53, 50, .35);
        backdrop-filter: blur(3px);
        cursor: pointer;
    }
    .sidebar-scrim.is-open { display: block; }
    .portal-content,
    body.sidebar-collapsed .portal-content { margin-left: 0; }
    .desktop-sidebar-toggle { display: none; }
    .topbar { padding-inline: 18px; grid-template-columns: auto 1fr; }
    .mobile-menu-button {
        display: grid;
        width: 38px;
        height: 38px;
        padding: 10px;
        align-content: center;
        gap: 4px;
        background: var(--paper);
        border: 1px solid var(--border);
        border-radius: 10px;
    }
    .mobile-menu-button span { width: 100%; height: 2px; background: var(--ink-700); border-radius: 2px; }
    .global-search { display: none; }
    .topbar-actions { justify-self: end; }
    .topbar-save-cluster { padding-right: 6px; gap: 6px; }
    .save-label-full { display: none; }
    .save-label-short { display: inline; }
    .global-view, .patient-workspace { padding-inline: 18px; }
    .patient-sticky-stack { top: calc(var(--topbar-height) + 8px); }
    .patient-context { top: auto; grid-template-columns: auto 1fr; }
    .clinical-flags { grid-column: span 2; grid-template-columns: 1fr 1fr; }
    .section-index { top: auto; }
    .identity-primary-row,
    .identity-contact-row,
    .identity-health-row { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .identity-primary-row .identity-name { grid-column: 1 / -1; }
    .identity-companion-row { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .identity-companion-name { grid-column: 1 / -1; }
    .identity-grid .span-2, .identity-grid .span-3, .identity-grid .span-4 { grid-column: span 4; }
    .identity-grid .span-5 { grid-column: span 8; }
    .identity-grid .span-6 { grid-column: span 6; }
    .antecedents-grid { grid-template-columns: 1fr; }
    .obstetric-panel { grid-column: auto; }
    .vaccine-grid { grid-template-columns: 1fr; }
    .vaccine-grid .vaccine-wide { grid-column: auto; grid-template-columns: 1fr; align-items: stretch; }
    .vaccine-grid .vaccine-wide .vaccine-title { flex-direction: row; align-items: center; gap: 10px; }
}

@media (max-width: 640px) {
    html { scroll-padding-top: 170px; }
    .topbar-actions { gap: 2px; }
    .topbar-save-cluster .save-state { display: none; }
    .topbar-save-cluster .primary-button { min-height: 36px; padding-inline: 10px; }
    .global-view { padding-top: 32px; }
    .dashboard-intro, .view-heading { display: grid; align-items: start; }
    .dashboard-intro h1, .view-heading h1 { font-size: calc(36px + var(--font-increase)); }
    .today-note { min-width: 0; }
    .metric-strip { grid-template-columns: 1fr 1fr; padding: 8px; }
    .metric-strip article { min-height: 110px; padding: 16px 12px; grid-template-columns: 1fr; }
    .metric-strip article .metric-index { grid-row: auto; }
    .metric-strip article:nth-child(odd) { border-right: 1px solid var(--border); }
    .metric-strip article:nth-child(even) { border-right: 0; }
    .patient-list-header, .doctor-list-header, .document-list-header { display: none; }
    .patient-row, .patient-directory .patient-row { grid-template-columns: auto minmax(0, 1fr) auto; gap: 10px; }
    .patient-row .patient-meta, .patient-row .row-arrow { display: none; }
    .patient-row .status-pill { display: inline-flex; justify-self: end; }
    .doctor-row { grid-template-columns: auto minmax(0, 1fr) auto; gap: 10px; }
    .doctor-row .doctor-row-meta { display: none; }
    .doctor-directory-shell { padding: 8px; }
    .filter-bar { grid-template-columns: 1fr; }
    .documents-layout { grid-template-columns: 1fr; }
    .document-overview { grid-template-columns: 1fr; }
    .document-row { grid-template-columns: auto minmax(0, 1fr) auto; gap: 10px; }
    .document-row > .file-mark { grid-row: 1 / 3; }
    .document-row-primary { grid-column: 2; grid-row: 1; }
    .document-row > :nth-child(3) { display: block; grid-column: 2; grid-row: 2; }
    .document-row > :nth-child(4),
    .document-row > :nth-child(5),
    .document-row > :nth-child(6) { display: none; }
    .document-row .row-open-button { grid-column: 3; grid-row: 1 / 3; }
    .patient-workspace { padding-top: 12px; }
    .patient-sticky-stack { position: relative; top: auto; z-index: auto; }
    .patient-context { position: relative; top: auto; min-height: 0; padding: 20px; grid-template-columns: auto minmax(0, 1fr); gap: 14px; }
    .gestational-orbit strong { font-size: calc(25px + var(--font-increase)); }
    .patient-title-block h1 { font-size: calc(26px + var(--font-increase)); }
    .clinical-flags { grid-template-columns: 1fr 1fr; }
    .clinical-flags > span { min-width: 0; }
    .section-index { top: auto; margin-bottom: 18px; }
    .record-section { padding: 38px 18px 44px; }
    .section-heading { grid-template-columns: 32px 1fr; gap: 8px; }
    .section-heading > div { padding-left: 14px; }
    .section-heading h2 { font-size: calc(29px + var(--font-increase)); }
    .form-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
    .form-grid > * { grid-column: span 1 !important; }
    .form-grid .span-6:first-child, .form-grid .span-12 { grid-column: span 2 !important; }
    .identity-grid .identity-name { grid-column: 1 / -1 !important; }
    .identity-grid > .identity-primary-row,
    .identity-grid > .identity-contact-row,
    .identity-grid > .identity-health-row,
    .identity-grid > .identity-companion-row,
    .identity-grid > .identity-clinical-row { grid-column: 1 / -1 !important; }
    .identity-primary-row,
    .identity-contact-row,
    .identity-health-row,
    .identity-companion-row,
    .identity-clinical-row { gap: 12px; }
    .identity-contact-row { grid-template-columns: 1fr; }
    .patient-email-status { grid-template-columns: minmax(0, 1fr); }
    .patient-email-status > button { grid-column: 1; grid-row: auto; justify-self: start; }
    .identity-companion-row { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .identity-companion-name { grid-column: 1 / -1; }
    .identity-clinical-row { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .identity-clinical-row .identity-risk { grid-column: 1 / -1; }
    .identity-dum input,
    .identity-dpp input,
    .identity-birth input {
        padding-inline: 6px;
        font-size: calc(12px + var(--font-increase));
    }
    .obstetric-counts { grid-template-columns: repeat(4, minmax(0, 1fr)); }
    .table-note { align-items: flex-start; flex-direction: column; }
    .highlight-legend { white-space: normal; }
    .consultation-table-actions { align-items: stretch; flex-direction: column; }
    .consultation-table-actions > span { text-align: right; }
    .add-consultation-button,
    .remove-consultation-button { width: 100%; justify-content: center; }
    .exam-details-grid { grid-template-columns: 1fr; }
    .dental-note { grid-column: auto; }
    .two-dates { grid-template-columns: 1fr; }
    .vaccine-grid article { padding: 16px; gap: 12px; }
    .vaccine-grid .dose-grid { grid-template-columns: 1fr; }
    .settings-heading, .settings-content, .settings-actions { padding-inline: 20px; }
    .settings-fields,
    .doctor-form-grid { grid-template-columns: 1fr; }
    .settings-fields > *,
    .doctor-form-grid > * { grid-column: auto !important; }
    .confirm-content { padding: 22px; grid-template-columns: 1fr; }
    .profile-photo-editor { grid-template-columns: auto 1fr; }
    .profile-photo-actions { grid-column: 1 / -1; justify-content: stretch; }
    .profile-photo-button,
    .profile-photo-remove { flex: 1 1 0; justify-content: center; text-align: center; }
    .profile-security-action { grid-template-columns: 1fr; align-items: stretch; }
    .profile-security-action .secondary-button { width: 100%; justify-content: center; }
    .notification-list { padding-inline: 14px; }
    .notification-item { grid-template-columns: auto minmax(0, 1fr); }
    .notification-item .file-mark { grid-row: 1 / 3; }
    .notification-open { grid-column: 2; width: fit-content; }
    .notification-actions { align-items: stretch; flex-direction: column; }
    .clinic-document-grid,
    .patient-exams-layout { grid-template-columns: 1fr; }
    .clinic-document-card { min-height: 0; }
    .patient-exam-upload { grid-column: auto; }
    .patient-exam-upload-grid { grid-template-columns: 1fr; }
    .patient-exam-notes { grid-column: auto; }
    .patient-exam-upload-actions { align-items: stretch; flex-direction: column; }
    .patient-exam-category .document-list article {
        grid-template-columns: auto minmax(0, 1fr);
        gap: 10px 12px;
    }
    .patient-exam-category .document-list article > div { min-width: 0; }
    .patient-exam-category .document-list strong,
    .patient-exam-category .document-list p { overflow-wrap: anywhere; }
    .patient-exam-category .document-list .text-button {
        grid-column: 2;
        justify-self: start;
    }
    .patient-exam-actions { grid-column: 2; justify-content: flex-start; }
}

@media print {
    @page {
        size: A4 landscape;
        margin: 8mm;
    }

    html,
    body {
        color: #2f2928;
        background: #fff;
    }

    .sidebar,
    .sidebar-scrim,
    .topbar,
    .global-view,
    .section-index,
    .cell-highlight,
    .consultation-table-actions,
    .upload-zone,
    .patient-exam-upload,
    .toast,
    .accessibility-fab,
    dialog {
        display: none !important;
    }

    .portal-content {
        margin-left: 0 !important;
    }

    .patient-workspace,
    .patient-workspace.is-active {
        display: block !important;
        width: 100%;
        max-width: none;
        padding: 0;
    }

    #prenatalForm {
        display: block !important;
    }

    .patient-workspace button {
        display: none !important;
    }

    .patient-sticky-stack,
    .patient-context {
        position: static;
    }

    .patient-context {
        min-height: 86px;
        margin-bottom: 8px;
        padding: 10px 14px;
        box-shadow: none;
        break-inside: avoid;
        print-color-adjust: exact;
    }

    .record-section {
        padding: 20px 16px 24px;
        border: 1px solid #ded8d4;
        break-before: page;
        print-color-adjust: exact;
    }

    .record-section:first-child {
        break-before: auto;
    }

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

    .clinical-table-wrap {
        overflow: visible;
    }

    .clinical-table,
    .ultrasound-table,
    .lab-table {
        min-width: 0;
        font-size: calc(9px + var(--font-increase));
    }

    .clinical-table thead th,
    .clinical-table tbody th {
        position: static;
        min-width: 0;
    }

    .clinical-table th,
    .clinical-table td {
        height: auto;
        padding: 3px;
    }

    .clinical-table input,
    .clinical-table textarea,
    .field input,
    .field select,
    .field textarea {
        min-height: 26px;
        padding: 4px 5px;
        color: #2f2928;
        background: #fff;
        border-color: #d7d0cc;
        font-size: calc(10px + var(--font-increase));
    }

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

@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
    *, *::before, *::after {
        animation-duration: .01ms !important;
        animation-iteration-count: 1 !important;
        scroll-behavior: auto !important;
        transition-duration: .01ms !important;
    }
}

/* Patient mobile experience */
.patient-page {
    min-height: 100vh;
    background: var(--canvas);
}

.patient-backdrop {
    position: fixed;
    z-index: -1;
    inset: 0;
    overflow: hidden;
    background:
        var(--patient-backdrop-overlay),
        url("fundo-floral.png") center / cover;
}

.patient-backdrop span {
    position: absolute;
    border: 1px solid rgba(125, 79, 85, .1);
    border-radius: 50%;
}

.patient-backdrop span:nth-child(1) { width: 520px; height: 520px; top: -260px; right: -120px; }
.patient-backdrop span:nth-child(2) { width: 340px; height: 340px; bottom: -170px; left: 15%; }
.patient-backdrop span:nth-child(3) { width: 180px; height: 180px; top: 38%; left: -90px; }

.patient-stage {
    display: grid;
    width: min(1160px, 100%);
    min-height: 100vh;
    margin: 0 auto;
    padding: 48px 32px;
    grid-template-columns: minmax(320px, 1fr) 440px;
    align-items: center;
    gap: clamp(50px, 8vw, 120px);
}

.patient-presentation {
    max-width: 560px;
}

.patient-presentation img {
    width: 220px;
    margin-bottom: 80px;
}

.patient-presentation h1 {
    margin-bottom: 20px;
    font-size: clamp(44px, 6vw, 72px);
    font-weight: 500;
    letter-spacing: -.05em;
    line-height: 1.03;
}

.patient-presentation > p:not(.eyebrow) {
    max-width: 480px;
    color: var(--ink-500);
    font-size: calc(17px + var(--font-increase));
    line-height: 1.7;
}

.patient-presentation > a {
    display: inline-block;
    margin-top: 34px;
    color: var(--rose-700);
    font-size: calc(14px + var(--font-increase));
    font-weight: 800;
    text-decoration: none;
}

.patient-app-shell {
    position: relative;
    display: flex;
    width: 100%;
    height: min(840px, calc(100vh - 60px));
    min-height: 840px;
    max-height: calc(100vh - 60px);
    flex-direction: column;
    overflow: hidden;
    background: var(--paper);
    border: 8px solid var(--app-frame);
    border-radius: 42px;
    box-shadow: 0 40px 100px rgba(83, 57, 55, .2);
    scrollbar-width: none;
}

.patient-app-shell > main {
    min-height: 0;
    flex: 1;
    overflow-x: hidden;
    overflow-y: auto;
    scrollbar-width: none;
}

.patient-app-shell > main::-webkit-scrollbar {
    display: none;
}

.patient-app-header {
    position: relative;
    flex: 0 0 auto;
    z-index: 15;
    top: 0;
    display: flex;
    height: 82px;
    padding: 18px 22px;
    align-items: center;
    justify-content: space-between;
    background: var(--surface-translucent-strong);
    border-bottom: 1px solid var(--border);
    backdrop-filter: blur(18px);
}

.patient-mini-profile {
    display: flex;
    align-items: center;
    gap: 11px;
}

.patient-photo,
.profile-avatar {
    display: grid;
    place-items: center;
    color: var(--rose-700);
    background: var(--rose-200);
    border-radius: 50% 50% 43% 57%;
    font-weight: 800;
}

.patient-photo {
    width: 42px;
    height: 42px;
    font-size: calc(12px + var(--font-increase));
}

.patient-mini-profile small,
.patient-mini-profile strong {
    display: block;
}

.patient-mini-profile small {
    color: var(--ink-500);
    font-size: calc(11px + var(--font-increase));
}

.patient-mini-profile strong {
    font-family: Georgia, "Times New Roman", serif;
    font-size: calc(16px + var(--font-increase));
}

.patient-icon-button {
    position: relative;
    display: grid;
    width: 40px;
    height: 40px;
    place-items: center;
    color: var(--ink-700);
    background: var(--rose-50);
    border-radius: 50%;
}

.patient-icon-button svg {
    width: 19px;
    height: 19px;
    fill: currentColor;
}

.patient-icon-button i {
    position: absolute;
    top: 8px;
    right: 9px;
    width: 6px;
    height: 6px;
    background: var(--danger);
    border: 1px solid var(--paper);
    border-radius: 50%;
}

.patient-tab {
    display: none;
    min-height: 700px;
    padding: 18px 18px 106px;
}

.patient-tab.is-active {
    display: block;
    animation: reveal-up .5s var(--ease) both;
}

.week-hero {
    position: relative;
    display: grid;
    min-height: 250px;
    padding: 28px 24px;
    grid-template-columns: 1fr 128px;
    align-items: center;
    gap: 10px;
    overflow: hidden;
    background:
        radial-gradient(circle at 95% 5%, var(--decorative-highlight), transparent 32%),
        linear-gradient(145deg, var(--rose-300), var(--rose-200));
    border-radius: 10px 30px 10px 30px;
}

.week-hero::before {
    position: absolute;
    right: -65px;
    bottom: -120px;
    width: 260px;
    height: 260px;
    border: 1px solid rgba(125, 79, 85, .16);
    border-radius: 50%;
    content: "";
}

.week-copy {
    position: relative;
    z-index: 1;
}

.week-copy h1 {
    margin-bottom: 8px;
    font-size: calc(39px + var(--font-increase));
    font-weight: 500;
    letter-spacing: -.04em;
}

.week-copy > p:not(.eyebrow) {
    max-width: 190px;
    margin-bottom: 18px;
    color: var(--ink-700);
    font-size: calc(12px + var(--font-increase));
    line-height: 1.5;
}

.week-copy > small {
    color: var(--ink-700);
    font-size: calc(10px + var(--font-increase));
    font-weight: 700;
}

.week-progress {
    width: 100%;
    height: 5px;
    margin-bottom: 7px;
    overflow: hidden;
    background: var(--surface-translucent-soft);
    border-radius: 999px;
}

.week-progress span {
    display: block;
    width: var(--progress);
    height: 100%;
    background: var(--rose-700);
    border-radius: inherit;
}

.mobile-orbit {
    position: relative;
    z-index: 1;
    display: grid;
    width: 120px;
    height: 120px;
    place-items: center;
}

.mobile-orbit svg {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    transform: rotate(-90deg);
}

.mobile-orbit circle {
    fill: none;
    stroke-width: 6;
}

.mobile-orbit span {
    position: relative;
    z-index: 1;
    text-align: center;
}

.mobile-orbit strong,
.mobile-orbit small {
    display: block;
}

.mobile-orbit strong {
    font-family: Georgia, "Times New Roman", serif;
    font-size: calc(35px + var(--font-increase));
    font-weight: 500;
}

.mobile-orbit small {
    font-size: calc(10px + var(--font-increase));
    font-weight: 800;
    text-transform: uppercase;
}

.next-appointment {
    display: grid;
    min-height: 96px;
    margin: 14px 0;
    padding: 15px;
    grid-template-columns: auto 1fr auto;
    align-items: center;
    gap: 13px;
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: 16px;
    box-shadow: var(--shadow-soft);
}

.appointment-date {
    display: grid;
    width: 54px;
    height: 62px;
    place-content: center;
    text-align: center;
    background: var(--olive-100);
    border-radius: 8px 16px 8px 8px;
}

.appointment-date strong {
    font-family: Georgia, "Times New Roman", serif;
    font-size: calc(24px + var(--font-increase));
    line-height: 1;
}

.appointment-date small {
    margin-top: 4px;
    color: var(--olive-500);
    font-size: calc(10px + var(--font-increase));
    font-weight: 800;
}

.next-appointment h2 {
    margin-bottom: 3px;
    font-size: calc(16px + var(--font-increase));
}

.next-appointment p:not(.eyebrow) {
    margin-bottom: 0;
    color: var(--ink-500);
    font-size: calc(10px + var(--font-increase));
}

.next-appointment > button {
    width: 32px;
    height: 32px;
    color: var(--rose-700);
    background: var(--rose-100);
    border-radius: 50%;
}

.week-story {
    position: relative;
    display: grid;
    min-height: 190px;
    margin: 14px 0;
    padding: 24px;
    grid-template-columns: 70px 1fr;
    gap: 18px;
    overflow: hidden;
    background: var(--olive-100);
    border: 1px solid rgba(145, 132, 109, .15);
    border-radius: 26px 8px 26px 8px;
}

.story-number {
    align-self: start;
    color: var(--olive-300);
    font-family: Georgia, "Times New Roman", serif;
    font-size: calc(66px + var(--font-increase));
    line-height: 1;
}

.week-story h2 {
    margin-bottom: 9px;
    font-size: calc(21px + var(--font-increase));
}

.week-story div > p:not(.eyebrow) {
    margin-bottom: 10px;
    color: var(--ink-700);
    font-size: calc(11px + var(--font-increase));
    line-height: 1.55;
}

.patient-text-button {
    padding: 4px 0;
    color: var(--rose-700);
    background: transparent;
    font-size: calc(11px + var(--font-increase));
    font-weight: 800;
}

.patient-section {
    margin-top: 24px;
}

.patient-section-title {
    display: flex;
    margin-bottom: 12px;
    align-items: flex-end;
    justify-content: space-between;
}

.patient-section-title h2 {
    margin-bottom: 0;
    font-size: calc(22px + var(--font-increase));
}

.patient-section-title > span {
    color: var(--ink-500);
    font-size: calc(11px + var(--font-increase));
}

.patient-task-list,
.mobile-document-list {
    display: grid;
    gap: 8px;
}

.patient-task-list article,
.mobile-document-list article {
    display: grid;
    min-height: 70px;
    padding: 12px;
    grid-template-columns: auto 1fr auto;
    align-items: center;
    gap: 11px;
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: 13px;
}

.task-icon {
    display: grid;
    width: 34px;
    height: 34px;
    place-items: center;
    color: var(--rose-700);
    background: var(--rose-100);
    border-radius: 50%;
    font-size: calc(11px + var(--font-increase));
    font-weight: 800;
}

.task-icon.task-done { color: var(--success); background: var(--success-soft); }
.task-icon.task-warn { color: var(--pending); background: var(--pending-soft); }

.patient-task-list strong,
.mobile-document-list strong {
    font-size: calc(12px + var(--font-increase));
}

.patient-task-list p,
.mobile-document-list p {
    margin: 3px 0 0;
    color: var(--ink-500);
    font-size: calc(10px + var(--font-increase));
}

.task-status {
    display: inline-flex;
    min-height: 23px;
    padding: 0 8px;
    align-items: center;
    color: var(--pending);
    background: var(--pending-soft);
    border-radius: 999px;
    font-size: calc(9px + var(--font-increase));
    font-weight: 800;
    text-transform: uppercase;
}

.task-status.done { color: var(--success); background: var(--success-soft); }

.card-completion {
    display: grid;
    margin-top: 14px;
    padding: 20px;
    grid-template-columns: auto 1fr;
    align-items: center;
    gap: 16px;
    background: var(--rose-50);
    border: 1px solid var(--rose-200);
    border-radius: 16px;
}

.completion-ring {
    display: grid;
    width: 56px;
    height: 56px;
    place-items: center;
    background: conic-gradient(var(--success) 84%, var(--success-soft) 0);
    border-radius: 50%;
}

.completion-ring::before {
    position: absolute;
    width: 44px;
    height: 44px;
    background: var(--rose-50);
    border-radius: 50%;
    content: "";
}

.completion-ring span {
    position: relative;
    z-index: 1;
    font-size: calc(11px + var(--font-increase));
    font-weight: 800;
}

.card-completion h2 {
    margin-bottom: 4px;
    font-size: calc(17px + var(--font-increase));
}

.card-completion p:not(.eyebrow) {
    margin-bottom: 0;
    color: var(--ink-500);
    font-size: calc(10px + var(--font-increase));
}

.patient-view-heading {
    padding: 18px 5px 26px;
}

.patient-view-heading h1 {
    margin-bottom: 10px;
    font-size: calc(37px + var(--font-increase));
    font-weight: 500;
    letter-spacing: -.04em;
}

.patient-view-heading > p:last-child {
    margin-bottom: 0;
    color: var(--ink-500);
    font-size: calc(12px + var(--font-increase));
    line-height: 1.55;
}

.journey-scale {
    display: grid;
    margin: 0 6px 30px;
    grid-template-columns: auto 1fr auto;
    align-items: center;
    gap: 10px;
    color: var(--ink-500);
    font-size: calc(9px + var(--font-increase));
    font-weight: 800;
    text-transform: uppercase;
}

.journey-scale div {
    height: 5px;
    overflow: hidden;
    background: var(--rose-100);
    border-radius: 99px;
}

.journey-scale i {
    display: block;
    width: var(--journey);
    height: 100%;
    background: var(--rose-600);
}

.journey-timeline {
    margin: 0;
    padding: 0;
    list-style: none;
}

.journey-timeline li {
    position: relative;
    display: grid;
    min-height: 155px;
    padding-bottom: 16px;
    grid-template-columns: 48px 1fr;
    gap: 14px;
}

.journey-timeline li::before {
    position: absolute;
    top: 43px;
    bottom: -3px;
    left: 23px;
    width: 1px;
    background: var(--olive-300);
    content: "";
}

.journey-timeline li:last-child::before { display: none; }

.journey-timeline li > span {
    display: grid;
    width: 48px;
    height: 48px;
    place-items: center;
    color: var(--ink-500);
    background: var(--paper);
    border: 1px solid var(--olive-300);
    border-radius: 50%;
    font-family: Georgia, "Times New Roman", serif;
    font-size: calc(15px + var(--font-increase));
}

.journey-timeline .is-complete > span { color: var(--success); background: var(--success-soft); border-color: var(--success); }
.journey-timeline .is-current > span { color: var(--white); background: var(--rose-600); border-color: var(--rose-600); box-shadow: 0 0 0 7px var(--rose-100); }

.journey-timeline article {
    padding: 17px;
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: 7px 18px 7px 18px;
}

.journey-timeline article > small {
    color: var(--rose-600);
    font-size: calc(9px + var(--font-increase));
    font-weight: 800;
    letter-spacing: .06em;
    text-transform: uppercase;
}

.journey-timeline h2 {
    margin: 5px 0;
    font-size: calc(17px + var(--font-increase));
}

.journey-timeline p {
    margin-bottom: 9px;
    color: var(--ink-500);
    font-size: calc(10px + var(--font-increase));
    line-height: 1.5;
}

.featured-document {
    display: grid;
    min-height: 180px;
    padding: 23px;
    grid-template-columns: auto 1fr;
    align-items: center;
    gap: 15px;
    background: linear-gradient(145deg, var(--rose-300), var(--rose-200));
    border-radius: 8px 28px 8px 28px;
}

.featured-file {
    display: grid;
    width: 62px;
    height: 76px;
    place-items: center;
    color: var(--rose-700);
    background: var(--surface-translucent);
    border-radius: 8px 18px 8px 8px;
    font-size: calc(12px + var(--font-increase));
    font-weight: 800;
}

.featured-document h2 {
    margin-bottom: 4px;
    font-size: calc(21px + var(--font-increase));
}

.featured-document p:not(.eyebrow) {
    margin-bottom: 0;
    color: var(--ink-700);
    font-size: calc(10px + var(--font-increase));
}

.featured-document button {
    grid-column: span 2;
    min-height: 38px;
    color: var(--white);
    background: var(--rose-700);
    border-radius: 9px;
    font-size: calc(11px + var(--font-increase));
    font-weight: 800;
}

.mobile-document-list article > button {
    padding: 6px;
    color: var(--rose-700);
    background: transparent;
    font-size: calc(10px + var(--font-increase));
    font-weight: 800;
}

.patient-upload-card {
    display: grid;
    margin-top: 22px;
    padding: 24px;
    grid-template-columns: auto 1fr;
    align-items: center;
    gap: 0 14px;
    background: var(--olive-100);
    border: 1px dashed var(--olive-500);
    border-radius: 24px 8px 24px 8px;
}

.patient-upload-card h2 {
    margin-bottom: 5px;
    font-size: calc(21px + var(--font-increase));
}

.patient-upload-card p:not(.eyebrow) {
    margin-bottom: 0;
    color: var(--ink-500);
    font-size: calc(10px + var(--font-increase));
    line-height: 1.5;
}

.patient-upload-card > label {
    display: block;
    grid-column: span 2;
    margin-top: 16px;
}

.patient-upload-card > label input {
    position: absolute;
    width: 1px;
    height: 1px;
    opacity: 0;
}

.patient-upload-card > label span {
    display: grid;
    min-height: 40px;
    place-items: center;
    color: var(--white);
    background: var(--rose-600);
    border-radius: 9px;
    font-size: calc(11px + var(--font-increase));
    font-weight: 800;
    cursor: pointer;
}

.patient-upload-feedback {
    display: none;
    grid-column: span 2;
    margin-top: 10px;
    padding: 10px;
    color: var(--success);
    background: var(--success-soft);
    border-radius: 8px;
    font-size: calc(10px + var(--font-increase));
    font-weight: 700;
}

.patient-upload-feedback.is-visible { display: block; }

.profile-hero {
    padding: 38px 20px;
    text-align: center;
    background: linear-gradient(150deg, var(--rose-200), var(--rose-50));
    border-radius: 10px 28px 10px 28px;
}

.profile-avatar {
    width: 76px;
    height: 76px;
    margin: 0 auto 17px;
    font-size: calc(17px + var(--font-increase));
}

.profile-hero h1 {
    margin-bottom: 6px;
    font-size: calc(27px + var(--font-increase));
}

.profile-hero > p:last-child {
    margin-bottom: 0;
    color: var(--ink-500);
    font-size: calc(11px + var(--font-increase));
}

.profile-data {
    display: grid;
    margin: 16px 0;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

.profile-data article {
    min-height: 85px;
    padding: 15px;
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: 12px;
}

.profile-data small,
.profile-data strong {
    display: block;
}

.profile-data small {
    margin-bottom: 8px;
    color: var(--ink-500);
    font-size: calc(9px + var(--font-increase));
    text-transform: uppercase;
}

.profile-data strong {
    font-size: calc(12px + var(--font-increase));
}

.profile-actions {
    display: grid;
    gap: 7px;
}

.profile-actions button,
.profile-actions a {
    display: grid;
    min-height: 66px;
    padding: 12px 15px;
    grid-template-columns: 1fr auto;
    align-items: center;
    color: var(--ink-900);
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: 12px;
    text-align: left;
    text-decoration: none;
}

.profile-actions span,
.profile-actions small {
    display: block;
}

.profile-actions span {
    font-size: calc(12px + var(--font-increase));
    font-weight: 800;
}

.profile-actions small {
    margin-top: 3px;
    color: var(--ink-500);
    font-size: calc(10px + var(--font-increase));
}

.profile-actions b {
    grid-column: 2;
    grid-row: 1 / 3;
    color: var(--rose-600);
}

.patient-bottom-nav {
    position: relative;
    flex: 0 0 auto;
    z-index: 20;
    bottom: 0;
    display: grid;
    min-height: 75px;
    padding: 8px 10px max(8px, env(safe-area-inset-bottom));
    grid-template-columns: repeat(4, 1fr);
    background: var(--surface-translucent-strong);
    border-top: 1px solid var(--border);
    backdrop-filter: blur(20px);
}

.patient-bottom-nav button {
    display: grid;
    place-items: center;
    align-content: center;
    gap: 4px;
    color: var(--ink-500);
    background: transparent;
    border-radius: 12px;
    font-size: calc(9px + var(--font-increase));
    font-weight: 800;
}

.patient-bottom-nav svg {
    width: 20px;
    height: 20px;
    fill: currentColor;
}

.patient-bottom-nav button.is-active {
    color: var(--rose-700);
    background: var(--rose-100);
}

/* Login */
.login-page {
    min-height: 100vh;
    background: var(--paper);
}

.login-layout {
    display: grid;
    min-height: 100vh;
    grid-template-columns: minmax(420px, 1.04fr) minmax(480px, .96fr);
}

.login-story {
    position: relative;
    display: flex;
    min-height: 100vh;
    padding: clamp(40px, 6vw, 86px);
    flex-direction: column;
    overflow: hidden;
    background:
        linear-gradient(145deg, rgba(226, 186, 186, .9), rgba(238, 212, 210, .78)),
        url("fundo-floral.png") center / cover;
}

.login-story::after {
    position: absolute;
    right: -160px;
    bottom: -210px;
    width: 560px;
    height: 560px;
    border: 1px solid rgba(125, 79, 85, .15);
    border-radius: 50%;
    content: "";
}

.login-story-copy {
    position: relative;
    z-index: 1;
    max-width: 660px;
    margin: auto 0;
}

.login-story-copy h1 {
    margin-bottom: 25px;
    font-size: clamp(48px, 6vw, 78px);
    font-weight: 500;
    letter-spacing: -.055em;
    line-height: .99;
}

.login-story-copy > p:last-child {
    max-width: 530px;
    margin-bottom: 0;
    color: var(--ink-700);
    font-size: calc(17px + var(--font-increase));
    line-height: 1.7;
}

.login-access {
    display: grid;
    min-height: 100vh;
    padding: clamp(32px, 5vw, 72px);
    place-items: center;
    background:
        radial-gradient(circle at 90% 5%, rgba(226, 186, 186, .22), transparent 34%),
        var(--canvas);
}

.login-access-inner {
    width: min(520px, 100%);
    padding: clamp(28px, 4vw, 44px);
    background: var(--paper);
    border: 1px solid var(--border);
    border-radius: 24px;
    box-shadow: var(--shadow-float);
}

.login-logo-frame {
    display: grid;
    width: fit-content;
    min-height: 76px;
    margin: 0 auto 28px;
    padding: 10px 18px;
    place-items: center;
    background: #ffffff;
    border: 1px solid rgba(125, 79, 85, .12);
    border-radius: 16px;
}

.login-brand {
    width: min(235px, 62vw);
    height: auto;
}

.login-progress {
    position: relative;
    display: grid;
    margin: 0 0 28px;
    padding: 0;
    grid-template-columns: 1fr 1fr;
    gap: 42px;
    list-style: none;
}

.login-progress::before {
    position: absolute;
    top: 15px;
    right: calc(25% + 15px);
    left: calc(25% + 15px);
    height: 2px;
    background: var(--border);
    content: "";
}

.login-progress li {
    position: relative;
    z-index: 1;
    display: grid;
    justify-items: center;
    gap: 7px;
    color: var(--ink-500);
    font-size: calc(11px + var(--font-increase));
}

.login-progress li > span {
    display: grid;
    width: 31px;
    height: 31px;
    place-items: center;
    color: var(--ink-500);
    background: var(--paper);
    border: 2px solid var(--border);
    border-radius: 50%;
    font-size: 12px;
    font-weight: 900;
}

.login-progress li.is-active,
.login-progress li.is-complete {
    color: var(--rose-700);
}

.login-progress li.is-active > span,
.login-progress li.is-complete > span {
    color: #ffffff;
    background: var(--rose-700);
    border-color: var(--rose-700);
}

.login-progress li.is-complete > span {
    font-size: 0;
}

.login-progress li.is-complete > span::after {
    font-size: 14px;
    content: "✓";
}

.login-access-inner > h2 {
    margin-bottom: 10px;
    font-size: calc(40px + var(--font-increase));
    font-weight: 500;
    letter-spacing: -.04em;
}

.login-access-inner > p:not(.eyebrow):not(.prototype-note) {
    margin-bottom: 34px;
    color: var(--ink-500);
    font-size: calc(14px + var(--font-increase));
}

.login-access form {
    display: grid;
    gap: 17px;
}

.login-access form[hidden] {
    display: none;
}

.login-access form.is-entering {
    animation: login-step-in 240ms ease-out both;
}

.login-step-heading {
    display: grid;
    gap: 8px;
    margin-bottom: 5px;
}

.login-step-heading .eyebrow {
    margin: 0;
}

.login-step-heading h2 {
    margin: 0;
    font-size: calc(32px + var(--font-increase));
    font-weight: 550;
    letter-spacing: -.035em;
    line-height: 1.08;
}

.login-step-heading > p:last-child {
    margin: 0;
    color: var(--ink-500);
    font-size: calc(13px + var(--font-increase));
    line-height: 1.55;
}

.login-confirmed-account {
    display: grid;
    padding: 13px 14px;
    grid-template-columns: auto 1fr;
    align-items: center;
    gap: 11px;
    background: var(--rose-50);
    border: 1px solid var(--rose-200);
    border-radius: 13px;
}

.login-confirmed-icon {
    display: grid;
    width: 29px;
    height: 29px;
    place-items: center;
    color: #ffffff;
    background: var(--rose-700);
    border-radius: 50%;
    font-size: 13px;
    font-weight: 900;
}

.login-confirmed-account small,
.login-confirmed-account strong {
    display: block;
}

.login-confirmed-account small {
    margin-bottom: 2px;
    color: var(--ink-500);
    font-size: calc(10px + var(--font-increase));
}

.login-confirmed-account strong {
    overflow-wrap: anywhere;
    color: var(--ink-900);
    font-size: calc(13px + var(--font-increase));
}

.mfa-code-field input {
    font-size: calc(20px + var(--font-increase));
    font-variant-numeric: tabular-nums;
    letter-spacing: .28em;
    text-align: center;
}

.mfa-expiry-note {
    margin: -7px 0 0;
    color: var(--ink-500);
    font-size: calc(10px + var(--font-increase));
    line-height: 1.45;
}

.login-back-button {
    width: fit-content;
    margin: -2px auto 0;
    padding: 7px 9px;
    color: var(--rose-700);
    background: transparent;
    border-radius: 8px;
    font-size: calc(12px + var(--font-increase));
    font-weight: 800;
}

.login-back-button:hover {
    background: var(--rose-50);
}

@keyframes login-step-in {
    from { opacity: 0; transform: translateY(7px); }
    to { opacity: 1; transform: translateY(0); }
}

.password-field {
    position: relative;
}

.password-field input {
    padding-right: 48px;
}

.password-field button {
    position: absolute;
    right: 5px;
    bottom: 4px;
    display: grid;
    width: 36px;
    height: 36px;
    place-items: center;
    color: var(--ink-500);
    background: transparent;
    border-radius: 8px;
}

.password-field button:hover {
    color: var(--rose-700);
    background: var(--rose-50);
}

.password-field svg {
    width: 18px;
    height: 18px;
    fill: currentColor;
}

.login-options {
    display: flex;
    margin-top: -3px;
    align-items: center;
    justify-content: flex-end;
    gap: 12px;
}

.login-options label {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--ink-500);
    font-size: calc(11px + var(--font-increase));
    font-weight: 700;
}

.login-options button {
    padding: 4px;
    color: var(--rose-700);
    background: transparent;
    font-size: calc(11px + var(--font-increase));
    font-weight: 800;
    cursor: pointer;
}

.login-submit {
    display: flex;
    width: 100%;
    min-height: 50px;
    margin-top: 5px;
    align-items: center;
    justify-content: space-between;
}

.patient-access-callout {
    display: grid;
    margin-top: 28px;
    padding: 14px;
    grid-template-columns: auto 1fr auto;
    align-items: center;
    gap: 11px;
    background: var(--rose-50);
    border: 1px solid var(--rose-200);
    border-radius: 14px;
}

.patient-access-callout strong,
.patient-access-callout small {
    display: block;
}

.patient-access-callout strong {
    font-size: calc(13px + var(--font-increase));
}

.patient-access-callout small {
    margin-top: 3px;
    color: var(--ink-500);
    font-size: calc(10px + var(--font-increase));
}

.patient-access-callout a {
    color: var(--rose-700);
    font-size: calc(11px + var(--font-increase));
    font-weight: 800;
    text-decoration: none;
}

.prototype-note {
    margin: 16px 0 0;
    color: var(--ink-500);
    font-size: calc(10px + var(--font-increase));
    text-align: center;
}

.login-clinic-contact {
    display: grid;
    margin: 24px 0 0;
    padding-top: 22px;
    justify-items: center;
    gap: 4px;
    color: var(--ink-700);
    border-top: 1px solid var(--border);
    font-size: calc(12px + var(--font-increase));
    font-style: normal;
    line-height: 1.5;
    text-align: center;
}

.login-clinic-contact strong {
    margin-bottom: 2px;
    color: var(--ink-900);
    font-size: calc(14px + var(--font-increase));
}

.login-clinic-contact a {
    color: var(--rose-700);
    font-weight: 800;
    text-decoration: none;
}

.login-phone {
    margin-top: 7px;
}

.insta-link {
    display: inline-flex;
    margin-top: 3px;
    padding: 5px 8px;
    align-items: center;
    justify-content: center;
    gap: 5px;
    border-radius: 8px;
}

.insta-link:hover {
    background: var(--rose-50);
}

.insta-link svg {
    width: 16px;
    height: 16px;
    flex: 0 0 auto;
}

@media (max-width: 900px) {
    .patient-page { width: 100%; max-width: 100vw; overflow: hidden; }
    .patient-stage { display: block; width: 100vw; max-width: 100vw; min-width: 0; padding: 0; }
    .patient-presentation { display: none; }
    .patient-app-shell { width: 100vw; max-width: 100vw; min-width: 0; height: 100vh; height: 100svh; min-height: 100vh; min-height: 100svh; max-height: 100vh; max-height: 100svh; border: 0; border-radius: 0; box-shadow: none; }
    .patient-app-shell > main, .patient-tab, .patient-bottom-nav { width: 100%; min-width: 0; max-width: 100%; }
    .patient-bottom-nav button { min-width: 0; }
    .week-copy, .week-story > div, .next-appointment > div { min-width: 0; }
    .patient-app-header { padding-top: max(18px, env(safe-area-inset-top)); height: calc(82px + env(safe-area-inset-top)); }
    .login-layout { grid-template-columns: 1fr; }
    .login-story { min-height: 38vh; padding: 34px; }
    .login-brand { width: min(220px, 58vw); }
    .login-story-copy { margin: 70px 0 20px; }
    .login-story-copy h1 { max-width: 620px; font-size: clamp(38px, 8vw, 58px); }
    .login-access { min-height: 62vh; padding: 42px 24px; }
}

@media (max-width: 520px) {
    .patient-tab { padding-inline: 14px; }
    .week-hero { min-height: 230px; padding: 24px 18px; grid-template-columns: 1fr 100px; }
    .mobile-orbit { width: 100px; height: 100px; }
    .week-copy h1 { font-size: calc(34px + var(--font-increase)); }
    .next-appointment { grid-template-columns: auto 1fr; }
    .next-appointment > button { display: none; }
    .week-story { grid-template-columns: 58px 1fr; padding: 20px; }
    .story-number { font-size: calc(54px + var(--font-increase)); }
    .login-story { display: none; }
    .login-access { min-height: 100vh; padding: 70px 14px 24px; }
    .login-access-inner { padding: 26px 20px; border-radius: 20px; }
    .login-logo-frame { min-height: 68px; margin-bottom: 24px; padding: 8px 14px; }
    .login-access-inner > h2 { font-size: calc(36px + var(--font-increase)); }
    .login-options { align-items: flex-start; flex-direction: column; }
    .login-clinic-contact { font-size: calc(12px + var(--font-increase)); }
    .accessibility-login-button { top: 16px; right: 16px; }
    .accessibility-font-options { grid-template-columns: 1fr; }
    .patient-access-callout { grid-template-columns: auto 1fr; }
    .patient-access-callout a { grid-column: 2; }
}
.mfa-secret {
    display: grid;
    gap: .45rem;
    margin: 1rem 0;
    padding: .9rem;
    border: 1px solid var(--border, #d7c5c5);
    border-radius: .75rem;
    background: rgba(255, 255, 255, .7);
}

.mfa-secret code {
    overflow-wrap: anywhere;
    font-size: 1rem;
    letter-spacing: .08em;
    user-select: all;
}

/* Gestão segura da equipe e foto privada da paciente. */
.doctor-list-header,
.doctor-row {
    grid-template-columns: 42px minmax(180px, 1.1fr) minmax(120px, .65fr) 110px minmax(130px, .7fr) auto minmax(155px, .8fr);
}

.doctor-row .status-pill.is-inactive {
    color: var(--ink-500);
    background: var(--white);
    border: 1px solid var(--border);
}

.doctor-admin-badge {
    display: inline-flex;
    width: fit-content;
    margin-top: 5px;
    padding: 3px 7px;
    color: var(--rose-700);
    background: var(--rose-100);
    border: 1px solid var(--rose-200);
    border-radius: 999px;
    font-size: calc(9px + var(--font-increase));
    font-weight: 800;
}

.doctor-row-actions {
    display: flex;
    min-width: 0;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 6px;
}

.doctor-row-action {
    min-height: 32px;
    padding: 6px 9px;
    color: var(--rose-700);
    background: var(--white);
    border: 1px solid var(--rose-300);
    border-radius: 9px;
    cursor: pointer;
    font-size: calc(10px + var(--font-increase));
    font-weight: 800;
}

.doctor-row-action:hover {
    background: var(--rose-100);
}

.doctor-row-action.danger {
    color: var(--danger);
    border-color: color-mix(in srgb, var(--danger) 42%, transparent);
}

.doctor-row-action:disabled {
    opacity: .55;
    cursor: not-allowed;
}

.doctor-row-readonly {
    color: var(--ink-500);
    font-size: calc(10px + var(--font-increase));
}

.patient-identity-block {
    display: flex;
    min-width: 0;
    align-items: center;
    gap: 13px;
}

.workspace-patient-photo {
    position: relative;
    display: grid;
    width: 54px;
    height: 54px;
    flex: 0 0 54px;
    padding: 0;
    overflow: hidden;
    place-items: center;
    color: var(--rose-700);
    background: rgba(255, 255, 255, .52);
    border: 2px solid rgba(255, 255, 255, .75);
    border-radius: 50%;
    font-weight: 800;
}

.workspace-patient-photo:not(:disabled) {
    cursor: zoom-in;
}

.workspace-patient-photo:disabled {
    opacity: .82;
}

.workspace-patient-photo img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.workspace-patient-photo img[hidden] {
    display: none;
}

.patient-responsible-doctor {
    display: block;
    margin-top: 6px;
    overflow: hidden;
    color: var(--ink-700);
    font-size: calc(11px + var(--font-increase));
    font-weight: 700;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.photo-preview-dialog {
    width: min(620px, calc(100vw - 28px));
    max-height: calc(100dvh - 28px);
    padding: 0;
    color: var(--ink-900);
    background: transparent;
    border: 0;
    border-radius: 18px;
    overflow: visible;
}

.photo-preview-dialog::backdrop {
    background: rgba(24, 19, 21, .78);
    backdrop-filter: blur(6px);
}

.photo-preview-panel {
    overflow: hidden;
    background: var(--paper);
    border: 1px solid var(--border);
    border-radius: 18px;
    box-shadow: var(--shadow-float);
}

.photo-preview-panel > header {
    display: flex;
    padding: 18px 20px;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    background: var(--rose-50);
    border-bottom: 1px solid var(--border);
}

.photo-preview-panel h2 {
    margin: 3px 0 0;
    font-size: calc(25px + var(--font-increase));
    font-weight: 500;
}

.photo-preview-panel > img {
    display: block;
    width: 100%;
    max-height: calc(100dvh - 150px);
    background: var(--ink-900);
    object-fit: contain;
}

@media (max-width: 1180px) {
    .doctor-list-header,
    .doctor-row {
        grid-template-columns: 42px minmax(150px, 1fr) minmax(110px, .65fr) 100px auto minmax(145px, .8fr);
    }

    .doctor-list-header > :nth-child(5),
    .doctor-row > :nth-child(5) {
        display: none;
    }
}

@media (max-width: 640px) {
    .doctor-row {
        grid-template-columns: auto minmax(0, 1fr) auto;
    }

    .doctor-row-actions {
        grid-column: 2 / -1;
        justify-content: flex-start;
    }

    .patient-identity-block {
        align-items: flex-start;
    }

    .workspace-patient-photo {
        width: 46px;
        height: 46px;
        flex-basis: 46px;
    }

    .patient-responsible-doctor {
        white-space: normal;
    }
}
/* Identidade de paciente compartilhada, cartões separados por gestação. */
.gestation-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px 14px;
    padding: 12px 20px;
    background: var(--surface-translucent-strong);
    border: 1px solid var(--border);
    color: var(--ink-900);
}
.gestation-toolbar[hidden], .gestation-closed-notice[hidden], .gestation-toolbar button[hidden], .gestation-toolbar select[hidden], .patient-exam-upload[hidden] { display: none; }
.gestation-toolbar label { font-weight: 700; }
.gestation-toolbar select {
    max-width: min(100%, 340px);
    padding: 10px 12px;
    border: 1px solid var(--field-border);
    border-radius: var(--radius-sm);
    background: var(--field-surface);
}
.gestation-toolbar .gestation-badge {
    border-radius: 100px;
    padding: 6px 11px;
    font-size: .85em;
    background: var(--rose-100);
}
.gestation-toolbar button { margin-left: auto; }
.gestation-closed-notice {
    margin: 0;
    padding: 12px 20px;
    background: var(--olive-100);
    border: 1px solid var(--border);
    color: var(--ink-900);
}
.historical-card .record-section:not(#documentos-paciente) {
    /* A leitura e o download permanecem disponíveis; não há edição clínica. */
    cursor: default;
}
.historical-card .record-section input:read-only,
.historical-card .record-section select:disabled,
.historical-card .record-section textarea:read-only {
    opacity: 1;
    -webkit-text-fill-color: currentColor;
}
@media (max-width: 720px) {
    .gestation-toolbar button { margin-left: 0; }
    .gestation-toolbar select { width: 100%; max-width: 100%; }
}
