:root {
    --color-surface: #ffffff;
    --color-text: #1f2d4a;
    --color-text-soft: #5e6a85;
    --color-muted: #6b7490;
    --color-border: #d8def0;
    --color-border-strong: #b9c3e5;
    --color-accent: #4c6ef5;
    --color-accent-soft: rgba(76, 110, 245, 0.16);
    --color-primary-dark: #364fc7;
    --color-surface-highlight: #f8faff;
    --radius-lg: 20px;
    --radius-md: 14px;
    --radius-sm: 10px;
    --shadow-card: 0 24px 48px rgba(15, 23, 42, 0.12);
}

body.patient-body {
    margin: 0;
    font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: #f5f6fb;
    color: #1f2d4a;
    min-height: 100vh;
    transition: background 0.3s ease, color 0.3s ease;
}

body.patient-body[data-theme="dark"] {
    background: #050816;
    color: #eef1ff;
}

[hidden] {
    display: none !important;
}

.patient-shell {
    min-height: 100vh;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding: 32px 16px 40px;
}

.patient-app {
    width: 100%;
    max-width: 420px;
    border-radius: 34px;
    background: #ffffff;
    box-shadow: none;
    padding: 18px;
    border: 1px solid rgba(15, 23, 42, 0.08);
    transition: background 0.3s ease, box-shadow 0.3s ease, border 0.3s ease;
}

body.patient-body[data-theme="dark"] .patient-app {
    background: rgba(10, 14, 32, 0.95);
    border-color: rgba(148, 163, 184, 0.2);
    box-shadow: none;
}

.patient-app__top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 4px 10px 18px;
    border-bottom: 1px solid rgba(76, 110, 245, 0.08);
    margin-bottom: 18px;
}

.patient-app__top-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

.patient-app__clinic {
    margin: 0;
    font-size: 0.75rem;
    text-transform: uppercase;
    color: #6b7490;
    letter-spacing: 0.2em;
}

.patient-app__badge {
    font-size: 0.75rem;
    font-weight: 600;
    color: #4c6ef5;
    padding: 6px 12px;
    border-radius: 999px;
    background: rgba(76, 110, 245, 0.12);
}

body.patient-body[data-theme="dark"] .patient-app__badge {
    color: #dbe1ff;
    background: rgba(76, 110, 245, 0.25);
}

.patient-theme-toggle,
.patient-menu-toggle {
    width: 42px;
    height: 42px;
    border-radius: 12px;
    border: 1px solid rgba(15, 23, 42, 0.12);
    background: #f7f7fb;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: border 0.2s ease, background 0.2s ease;
}

.patient-theme-toggle {
    font-size: 1.1rem;
    color: #1f2d4a;
}

.patient-theme-toggle:hover,
.patient-menu-toggle:hover {
    border-color: #4c6ef5;
    background: rgba(76, 110, 245, 0.1);
}

.patient-menu-toggle {
    flex-direction: column;
    gap: 5px;
}

.patient-menu-toggle span {
    width: 20px;
    height: 2px;
    border-radius: 999px;
    background: #4c5c92;
    transition: transform 0.25s ease, opacity 0.2s ease;
}

.patient-menu-toggle.is-active {
    border-color: #4c6ef5;
}

.patient-menu-toggle.is-active span:nth-child(1) {
    transform: translateY(7px) rotate(45deg);
}

.patient-menu-toggle.is-active span:nth-child(2) {
    opacity: 0;
}

.patient-menu-toggle.is-active span:nth-child(3) {
    transform: translateY(-7px) rotate(-45deg);
}

body.patient-body[data-theme="dark"] .patient-theme-toggle,
body.patient-body[data-theme="dark"] .patient-menu-toggle {
    background: rgba(14, 18, 35, 0.9);
    border-color: rgba(84, 108, 210, 0.4);
    color: #eef1ff;
}

body.patient-body[data-theme="dark"] .patient-menu-toggle span {
    background: #dde1ff;
}

.patient-menu {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin: 0 0 20px;
    padding: 12px 20px;
    border-radius: 24px;
    border: 1px solid rgba(15, 23, 42, 0.08);
    background: rgba(248, 249, 254, 0.96);
    box-shadow: none;
    transform-origin: top center;
    transform: translateY(-12px);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease, transform 0.2s ease;
}

.patient-menu--open {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}

.patient-menu__item {
    display: flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
    color: inherit;
    font-weight: 600;
    font-size: 0.9rem;
    padding: 10px 12px;
    border-radius: 16px;
    transition: background 0.2s ease, transform 0.2s ease;
}

.patient-menu__icon {
    font-size: 1.1rem;
}

.patient-menu__item:focus,
.patient-menu__item:hover {
    background: rgba(76, 110, 245, 0.08);
    transform: none;
}

.patient-menu__item--active {
    background: rgba(76, 110, 245, 0.12);
}

body.patient-body[data-theme="dark"] .patient-menu__item--active {
    background: rgba(94, 120, 255, 0.25);
}

body.patient-body[data-theme="dark"] .patient-menu {
    background: rgba(7, 11, 24, 0.96);
    border-color: rgba(148, 163, 184, 0.25);
    box-shadow: none;
}

body.patient-body[data-theme="dark"] .patient-menu__item:hover,
body.patient-body[data-theme="dark"] .patient-menu__item:focus {
    background: rgba(80, 105, 255, 0.2);
}

.patient-auth {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.patient-auth__card {
    width: 100%;
    max-width: 420px;
    background: #fff;
    border-radius: 24px;
    box-shadow: none;
    padding: 36px 32px;
    border: 1px solid rgba(15, 23, 42, 0.08);
    transition: background 0.3s ease, border 0.3s ease, box-shadow 0.3s ease;
}

body.patient-body[data-theme="dark"] .patient-auth__card {
    background: rgba(13, 18, 37, 0.95);
    border-color: rgba(148, 163, 184, 0.25);
    box-shadow: none;
}

body.patient-body[data-theme="dark"] .patient-auth__header p,
body.patient-body[data-theme="dark"] .patient-form__hint {
    color: rgba(255, 255, 255, 0.7);
}

.patient-auth__header {
    display: flex;
    gap: 16px;
    align-items: center;
    margin-bottom: 28px;
}

.patient-auth__logo {
    width: 56px;
    height: 56px;
    display: grid;
    place-items: center;
    border-radius: 18px;
    background: rgba(76, 110, 245, 0.1);
    font-size: 1.6rem;
}

body.patient-body[data-theme="dark"] .patient-auth__logo {
    background: rgba(76, 110, 245, 0.3);
}

.patient-auth__header h1 {
    margin: 0;
    font-size: 1.5rem;
    font-weight: 700;
}

.patient-auth__header p {
    margin: 6px 0 0;
    color: #5e6a85;
}

.patient-form {
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.patient-form__field {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.patient-form__field label {
    font-weight: 600;
    font-size: 0.92rem;
}

.patient-form__field input,
.patient-inline-form textarea {
    border: 1px solid #ccd5f6;
    border-radius: 12px;
    padding: 12px 14px;
    font-size: 1rem;
    transition: border 0.2s ease, box-shadow 0.2s ease;
    font-family: inherit;
}

.patient-form__field input:focus,
.patient-inline-form textarea:focus {
    border-color: #4c6ef5;
    box-shadow: 0 0 0 3px rgba(76, 110, 245, 0.15);
    outline: none;
}

body.patient-body[data-theme="dark"] .patient-form__field input,
body.patient-body[data-theme="dark"] .patient-inline-form textarea {
    background: rgba(14, 18, 35, 0.9);
    border-color: rgba(93, 120, 255, 0.4);
    color: #eef1ff;
}

.patient-form__hint {
    font-size: 0.85rem;
    color: #6b7490;
    text-align: center;
    margin: 0;
}

.patient-feedback {
    min-height: 18px;
    font-size: 0.88rem;
    color: #d9480f;
    margin-top: -6px;
}

.patient-feedback--success {
    color: #0f9d58;
}

.patient-auth__divider {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 24px 0 18px;
    color: #8791a8;
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.patient-auth__divider::before,
.patient-auth__divider::after {
    content: "";
    height: 1px;
    flex: 1;
    background: rgba(148, 163, 184, 0.3);
}

.patient-qr-help {
    display: flex;
    align-items: flex-start;
    gap: 13px;
    padding: 15px;
    border: 1px solid rgba(76, 110, 245, 0.18);
    border-radius: 16px;
    background: linear-gradient(135deg, rgba(238, 242, 255, 0.9), rgba(240, 253, 250, 0.9));
}

.patient-qr-help__icon {
    width: 42px;
    height: 42px;
    flex: 0 0 42px;
    display: grid;
    place-items: center;
    border-radius: 13px;
    background: #fff;
    color: #364fc7;
    font-size: 1.55rem;
    line-height: 1;
}

.patient-qr-help strong {
    display: block;
    font-size: 0.92rem;
}

.patient-qr-help p {
    margin: 5px 0 0;
    color: #5e6a85;
    font-size: 0.82rem;
    line-height: 1.5;
}

body.patient-body[data-theme="dark"] .patient-qr-help {
    background: linear-gradient(135deg, rgba(76, 110, 245, 0.18), rgba(13, 148, 136, 0.14));
    border-color: rgba(129, 140, 248, 0.3);
}

body.patient-body[data-theme="dark"] .patient-qr-help__icon {
    background: rgba(255, 255, 255, 0.09);
    color: #c7d2fe;
}

body.patient-body[data-theme="dark"] .patient-qr-help p {
    color: rgba(255, 255, 255, 0.7);
}

.patient-card--module {
    margin-top: 20px;
}

.patient-module__badge {
    font-size: 0.78rem;
    font-weight: 600;
    padding: 6px 12px;
    border-radius: 999px;
    background: rgba(76, 110, 245, 0.12);
    color: #4c6ef5;
}

.patient-form__group {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.patient-form__field--full {
    width: 100%;
}

.patient-card--module input[type="range"] {
    width: 100%;
}

.patient-headache__insights {
    margin-top: 18px;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.patient-headache__chart {
    border: 1px dashed rgba(76, 110, 245, 0.2);
    border-radius: 16px;
    padding: 8px;
    background: #fff;
}

.patient-list--compact {
    gap: 8px;
}

.patient-select {
    width: 100%;
    padding: 10px 12px;
    border-radius: 10px;
    border: 1px solid rgba(148, 163, 184, 0.5);
    background: #fff;
    font: inherit;
}

.patient-exam-group {
    display: block;
    border: none;
    background: transparent;
    padding: 0;
}

.patient-exam-group__date {
    display: block;
    margin: 14px 0 6px;
    font-size: 13px;
    color: var(--cor-texto-suave, #64748b);
    text-transform: capitalize;
}

.patient-chat__typing {
    opacity: 0.75;
    font-style: italic;
}

.patient-chat__attachment {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-top: 6px;
    font-size: 13px;
}

.patient-chat__attachment img {
    max-width: 200px;
    border-radius: 10px;
    display: block;
}

.patient-chat-attach {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 8px;
    flex-wrap: wrap;
}

.patient-chat-attach__name {
    font-size: 13px;
    color: var(--cor-texto-suave, #64748b);
}

.patient-list--compact li {
    padding: 10px 12px;
}

.patient-documents__actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
}

.patient-link {
    color: #4c6ef5;
    font-weight: 600;
    text-decoration: none;
}

.patient-modules__empty {
    color: #6b7490;
    text-align: center;
    padding: 12px 0;
    font-size: 0.9rem;
}

.patient-dashboard {
    width: 100%;
    background: #fff;
    border-radius: 28px;
    padding: 20px;
    box-shadow: none;
    border: 1px solid rgba(15, 23, 42, 0.08);
}

body.patient-body[data-theme="dark"] .patient-dashboard {
    background: rgba(13, 17, 36, 0.95);
    border-color: rgba(76, 110, 245, 0.3);
}

.patient-dashboard__header {
    display: flex;
    flex-direction: column;
    gap: 16px;
    margin-bottom: 28px;
}

.patient-hero {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.patient-dashboard__welcome {
    font-size: 0.92rem;
    color: #6b7490;
}

.patient-dashboard__header h1 {
    margin: 0;
    font-size: 1.8rem;
}

.patient-dashboard__header p {
    margin: 6px 0 0;
    color: #5e6a85;
}

body.patient-body[data-theme="dark"] .patient-dashboard__welcome,
body.patient-body[data-theme="dark"] .patient-dashboard__header p,
body.patient-body[data-theme="dark"] .patient-card__header p,
body.patient-body[data-theme="dark"] .patient-list::before {
    color: rgba(255, 255, 255, 0.65);
}

.patient-dashboard__actions {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.patient-tabs {
    display: flex;
    gap: 8px;
    padding: 4px;
    border-radius: 18px;
    background: rgba(248, 249, 255, 0.95);
    border: 1px solid rgba(15, 23, 42, 0.08);
    box-shadow: none;
    margin-bottom: 24px;
    overflow-x: auto;
}

body.patient-body[data-theme="dark"] .patient-tabs {
    background: rgba(12, 16, 35, 0.92);
    border-color: rgba(84, 108, 210, 0.3);
    box-shadow: none;
}

.patient-tab {
    flex: 1;
    min-width: 110px;
    border: none;
    border-radius: 14px;
    background: transparent;
    padding: 10px 12px;
    font-weight: 600;
    font-size: 0.9rem;
    color: #5b6385;
    display: flex;
    flex-direction: column;
    gap: 4px;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.2s ease, color 0.2s ease, transform 0.2s ease;
}

.patient-tab span[aria-hidden="true"] {
    font-size: 1.2rem;
}

.patient-tab--active {
    background: rgba(76, 110, 245, 0.18);
    color: #1f2850;
    transform: none;
}

body.patient-body[data-theme="dark"] .patient-tab {
    color: rgba(255, 255, 255, 0.7);
}

body.patient-body[data-theme="dark"] .patient-tab--active {
    background: rgba(76, 110, 245, 0.4);
    color: #f5f6ff;
}

.patient-panels {
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.patient-panel {
    display: flex;
    flex-direction: column;
    gap: 18px;
    border-radius: 28px;
    background: #fff;
    padding: 20px;
    border: 1px solid rgba(15, 23, 42, 0.08);
    box-shadow: none;
}

.patient-panel[hidden] {
    display: none;
}

.patient-panel--active {
    border-color: rgba(76, 110, 245, 0.25);
}

body.patient-body[data-theme="dark"] .patient-panel {
    background: rgba(12, 16, 37, 0.92);
    border-color: rgba(76, 110, 245, 0.26);
    box-shadow: none;
}

body.patient-body[data-theme="dark"] .patient-panel--active {
    border-color: rgba(102, 128, 255, 0.45);
}

.patient-summary {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 18px;
    margin-bottom: 32px;
}

.summary-card {
    background: #f7f8fd;
    border-radius: 20px;
    padding: 20px 18px;
    border: 1px solid rgba(76, 110, 245, 0.15);
    box-shadow: none;
}

body.patient-body[data-theme="dark"] .summary-card {
    background: rgba(13, 17, 36, 0.95);
    border-color: rgba(76, 110, 245, 0.35);
}

.summary-card__label {
    font-size: 0.82rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #61709d;
}

.summary-card__value {
    display: block;
    margin-top: 8px;
    font-size: 1.15rem;
    font-weight: 600;
}

.summary-card__meta {
    display: block;
    margin-top: 6px;
    font-size: 0.88rem;
    color: #6b7490;
}

.patient-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 20px;
    margin-bottom: 24px;
}

.patient-card {
    background: #ffffff;
    border-radius: 22px;
    padding: 22px 20px;
    border: 1px solid rgba(15, 23, 42, 0.08);
    box-shadow: none;
}

body.patient-body[data-theme="dark"] .patient-card {
    background: rgba(12, 16, 37, 0.92);
    border-color: rgba(76, 110, 245, 0.3);
    box-shadow: none;
}

.patient-card--inline {
    margin-top: 28px;
}

.patient-card__header h2 {
    margin: 0;
    font-size: 1.25rem;
}

.patient-card__header p {
    margin: 8px 0 0;
    color: #6b7490;
    font-size: 0.9rem;
}

.patient-list {
    list-style: none;
    padding: 0;
    margin: 18px 0 0;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.patient-list::before {
    content: attr(data-empty);
    display: none;
    color: #6b7490;
    font-size: 0.9rem;
}

.patient-list:empty::before {
    display: block;
}

.patient-list li {
    border: 1px solid rgba(206, 212, 248, 0.6);
    border-radius: 14px;
    padding: 14px;
    background: rgba(248, 250, 255, 0.8);
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.patient-list li strong {
    font-size: 1rem;
}

.patient-list li span {
    font-size: 0.88rem;
    color: #61709d;
}

.patient-list__items {
    margin: 6px 0 0;
    padding-left: 18px;
    color: #61709d;
    font-size: 0.88rem;
}

.patient-list li a {
    color: #4c6ef5;
    font-weight: 600;
    text-decoration: none;
}

body.patient-body[data-theme="dark"] .patient-list::before {
    color: rgba(255, 255, 255, 0.6);
}

body.patient-body[data-theme="dark"] .patient-list li {
    background: rgba(16, 20, 45, 0.9);
    border-color: rgba(96, 120, 255, 0.35);
}

body.patient-body[data-theme="dark"] .patient-list li span,
body.patient-body[data-theme="dark"] .patient-list__items {
    color: rgba(223, 230, 255, 0.75);
}

.patient-inline-form {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
}

.patient-inline-form--stack {
    flex-direction: column;
    align-items: stretch;
}

.patient-inline-form textarea {
    width: 100%;
    resize: vertical;
    min-height: 90px;
}

.patient-upload {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 10px 16px;
    border-radius: 12px;
    border: 1px dashed rgba(76, 110, 245, 0.55);
    color: #4c6ef5;
    font-weight: 600;
    cursor: pointer;
}

.patient-upload input {
    display: none;
}

.patient-chat {
    display: flex;
    flex-direction: column;
    gap: 12px;
    max-height: 260px;
    overflow-y: auto;
    padding-right: 6px;
    margin: 18px 0;
}

.patient-chat::before {
    content: attr(data-empty);
    display: none;
    color: #6b7490;
    font-size: 0.9rem;
}

.patient-chat:empty::before {
    display: block;
}

.patient-chat__message {
    align-self: flex-start;
    max-width: 85%;
    padding: 12px 16px;
    border-radius: 16px 16px 16px 6px;
    background: rgba(76, 110, 245, 0.08);
    border: 1px solid rgba(76, 110, 245, 0.18);
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.patient-chat__message--clinic {
    align-self: flex-end;
    border-radius: 16px 16px 6px 16px;
    background: #4c6ef5;
    color: #fff;
    border: 1px solid transparent;
}

.patient-chat__message--clinic.patient-chat__message--bot {
    background: linear-gradient(135deg, #0f766e, #115e59);
    color: #f8fffd;
    border: 1px solid rgba(255, 255, 255, 0.14);
}

.patient-chat__author {
    font-size: 0.78rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.patient-chat__timestamp {
    font-size: 0.78rem;
    opacity: 0.75;
}

body.patient-body[data-theme="dark"] .patient-upload {
    border-color: rgba(120, 150, 255, 0.7);
    color: #a7b7ff;
}

body.patient-body[data-theme="dark"] .patient-chat::before {
    color: rgba(255, 255, 255, 0.6);
}

body.patient-body[data-theme="dark"] .patient-chat__message {
    background: rgba(97, 123, 255, 0.15);
    border-color: rgba(97, 123, 255, 0.25);
    color: #dfe4ff;
}

body.patient-body[data-theme="dark"] .patient-chat__message--clinic.patient-chat__message--bot {
    background: linear-gradient(135deg, #0f766e, #115e59);
    border-color: rgba(255, 255, 255, 0.14);
    color: #f8fffd;
}

.patient-modules {
    list-style: none;
    padding: 0;
    margin: 18px 0 0;
    display: flex;
    gap: 10px;
    overflow-x: auto;
    overscroll-behavior-inline: contain;
    scroll-snap-type: inline proximity;
    scrollbar-width: thin;
    padding-bottom: 4px;
}

.patient-modules::before {
    content: attr(data-empty);
    display: none;
    color: #6b7490;
}

.patient-modules:empty::before {
    display: block;
}

.patient-module {
    flex: 1 0 min(280px, 80vw);
    scroll-snap-align: start;
}

.patient-module__button {
    width: 100%;
    min-height: 68px;
    border: 1px solid rgba(76, 110, 245, 0.16);
    border-radius: 17px;
    padding: 10px 12px;
    background: rgba(245, 248, 255, 0.9);
    color: #1e293b;
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    text-align: left;
    font: inherit;
    transition: transform 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}

.patient-module__button:hover:not(:disabled) {
    transform: translateY(-1px);
    border-color: rgba(13, 138, 138, 0.46);
}

.patient-module__button.is-selected {
    border-color: #0d8a8a;
    background: linear-gradient(135deg, #ecfeff, #eff6ff);
    box-shadow: 0 9px 24px rgba(13, 138, 138, 0.12);
}

.patient-module__button:disabled {
    cursor: not-allowed;
    opacity: 0.64;
}

.patient-module__icon {
    width: 42px;
    height: 42px;
    flex: 0 0 42px;
    display: grid;
    place-items: center;
    border-radius: 13px;
    background: #fff;
    font-size: 1.35rem;
    box-shadow: inset 0 0 0 1px rgba(15, 23, 42, 0.06);
}

.patient-module__title {
    flex: 1;
    min-width: 0;
    font-size: 1rem;
    font-weight: 600;
}

.patient-module__status {
    font-size: 0.82rem;
    padding: 6px 12px;
    border-radius: 999px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.patient-module__status--active {
    background: rgba(56, 217, 169, 0.16);
    color: #127c54;
}

.patient-module__status--inactive {
    background: rgba(206, 212, 248, 0.35);
    color: #4c5a82;
}

body.patient-body[data-theme="dark"] .patient-modules::before {
    color: rgba(255, 255, 255, 0.6);
}

body.patient-body[data-theme="dark"] .patient-module {
    background: transparent;
    border-color: transparent;
}

body.patient-body[data-theme="dark"] .patient-module__button {
    background: rgba(16, 20, 45, 0.9);
    border-color: rgba(96, 120, 255, 0.35);
    color: #edf2ff;
}

body.patient-body[data-theme="dark"] .patient-module__button.is-selected {
    background: linear-gradient(135deg, rgba(13, 138, 138, 0.28), rgba(76, 110, 245, 0.22));
    border-color: #5eead4;
}

body.patient-body[data-theme="dark"] .patient-module__icon {
    background: rgba(255, 255, 255, 0.08);
}

body.patient-body[data-theme="dark"] .patient-module__status--inactive {
    background: rgba(114, 126, 197, 0.35);
    color: #dfe3ff;
}

.patient-postoperative {
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.patient-postoperative[hidden],
.patient-card--module[hidden] {
    display: none;
}

.postop-kicker {
    display: block;
    color: #0f766e;
    font-size: 0.72rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.postop-visual-hero {
    display: grid;
    grid-template-columns: minmax(0, 1.35fr) minmax(190px, 0.65fr);
    gap: 18px;
    align-items: stretch;
    overflow: hidden;
    border: 1px solid rgba(13, 138, 138, 0.18);
    border-radius: 20px;
    padding: 18px;
    background:
        radial-gradient(circle at 88% 5%, rgba(45, 212, 191, 0.24), transparent 36%),
        linear-gradient(135deg, #f0fdfa 0%, #eff6ff 100%);
}

.postop-visual-hero__content {
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-width: 0;
}

.postop-visual-hero h3,
.postop-section-heading h3,
.postop-checkin-intro h3 {
    margin: 4px 0 7px;
    color: #16324f;
    font-size: clamp(1.18rem, 2.4vw, 1.55rem);
    line-height: 1.2;
}

.postop-visual-hero p,
.postop-section-heading p,
.postop-checkin-intro p {
    margin: 0;
    color: #52647a;
    font-size: 0.88rem;
    line-height: 1.55;
}

.postop-hero-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 9px;
    margin-top: 15px;
}

.postop-hero-actions .btn {
    width: auto;
}

.postop-quick-cues {
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
    margin-top: 14px;
}

.postop-quick-cues span {
    padding: 6px 9px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.78);
    color: #31546b;
    font-size: 0.76rem;
    font-weight: 650;
}

.postop-visual-hero__image {
    position: relative;
    display: block;
    min-height: 230px;
    overflow: hidden;
    border-radius: 15px;
    background: #fff;
    box-shadow: 0 12px 30px rgba(15, 118, 110, 0.18);
}

.postop-visual-hero__image img {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: cover;
    object-position: center 19%;
}

.postop-visual-hero__image span {
    position: absolute;
    right: 9px;
    bottom: 9px;
    padding: 5px 9px;
    border-radius: 999px;
    background: rgba(15, 23, 42, 0.8);
    color: #fff;
    font-size: 0.7rem;
    font-weight: 700;
}

.postop-alert-guide {
    padding: 14px 16px;
    border: 1px solid rgba(220, 38, 38, 0.24);
    border-left: 4px solid #dc2626;
    border-radius: 12px;
    background: #fff7f7;
    color: #7f1d1d;
    display: flex;
    align-items: flex-start;
    gap: 12px;
}

.postop-alert-guide__icon {
    width: 34px;
    height: 34px;
    flex: 0 0 34px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    background: #dc2626;
    color: #fff;
    font-size: 1.15rem;
    font-weight: 900;
}

.postop-alert-guide p {
    margin: 5px 0 0;
    font-size: 0.86rem;
    line-height: 1.5;
}

.postop-illustrated-guide {
    display: flex;
    flex-direction: column;
    gap: 14px;
    padding: 17px;
    border: 1px solid rgba(13, 138, 138, 0.18);
    border-radius: 18px;
    background: #fbfefe;
}

.postop-section-heading,
.postop-checkin-intro {
    display: flex;
    align-items: flex-start;
    gap: 12px;
}

.postop-section-heading__icon,
.postop-checkin-intro__icon {
    width: 45px;
    height: 45px;
    flex: 0 0 45px;
    display: grid;
    place-items: center;
    border-radius: 14px;
    background: #ccfbf1;
    font-size: 1.35rem;
}

.postop-guide-gallery {
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: minmax(190px, 0.78fr);
    gap: 12px;
    overflow-x: auto;
    padding: 2px 2px 9px;
    scroll-snap-type: inline mandatory;
    scrollbar-width: thin;
}

.postop-guide-card {
    position: relative;
    display: block;
    height: 294px;
    overflow: hidden;
    border: 1px solid rgba(15, 118, 110, 0.16);
    border-radius: 15px;
    background: #fff;
    color: inherit;
    text-decoration: none;
    scroll-snap-align: start;
    box-shadow: 0 8px 20px rgba(15, 118, 110, 0.08);
    transition: transform 0.18s ease, box-shadow 0.18s ease;
}

.postop-guide-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 26px rgba(15, 118, 110, 0.14);
}

.postop-guide-card img {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: cover;
    object-position: top center;
}

.postop-guide-card > span {
    position: absolute;
    inset: auto 8px 8px;
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 9px 10px;
    border-radius: 11px;
    background: rgba(255, 255, 255, 0.94);
    color: #164e63;
    box-shadow: 0 5px 15px rgba(15, 23, 42, 0.12);
}

.postop-guide-card > span small {
    color: #64748b;
    font-size: 0.72rem;
}

.postop-guide-card--alert {
    border-color: rgba(220, 38, 38, 0.25);
}

.postop-guide-card--alert > span {
    color: #991b1b;
}

.postop-checkin-intro {
    padding: 15px 16px;
    border-radius: 17px;
    background: linear-gradient(135deg, #eef2ff, #f8fafc);
}

.postop-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.postop-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
    gap: 12px;
}

.postop-grid--date {
    grid-template-columns: repeat(auto-fit, minmax(145px, 1fr));
}

.postop-section {
    border: 1px solid rgba(76, 110, 245, 0.18);
    border-radius: 16px;
    padding: 15px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    min-width: 0;
}

.postop-section legend {
    padding: 0 7px;
    font-weight: 700;
    color: #243b72;
}

.postop-section legend span {
    margin-right: 4px;
}

.postop-help {
    margin: 0;
    color: #64748b;
    font-size: 0.82rem;
}

.postop-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
    font-size: 0.86rem;
    font-weight: 600;
    color: #334155;
}

.postop-field input:not([type="range"]),
.postop-field textarea {
    width: 100%;
    box-sizing: border-box;
    padding: 10px 12px;
    border: 1px solid #cbd5e1;
    border-radius: 10px;
    background: #fff;
    color: #0f172a;
    font: inherit;
    font-weight: 400;
}

.postop-check-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
    gap: 8px;
}

.postop-check-grid label,
.postop-check-card {
    display: flex;
    gap: 9px;
    align-items: flex-start;
    padding: 10px 12px;
    border: 1px solid #dbe3ef;
    border-radius: 11px;
    background: #f8fafc;
    color: #334155;
    font-size: 0.84rem;
    cursor: pointer;
}

.postop-check-grid input,
.postop-check-card input {
    margin-top: 2px;
    accent-color: #0d8a8a;
}

.postop-check-grid label:has(input:checked),
.postop-check-card:has(input:checked) {
    border-color: rgba(13, 138, 138, 0.55);
    background: #ecfdf5;
    box-shadow: 0 0 0 2px rgba(13, 138, 138, 0.08);
}

.postop-dressing-guide {
    border-radius: 16px;
    padding: 16px 18px;
    background: linear-gradient(135deg, #ecfeff, #eef6ff);
    border: 1px solid rgba(13, 138, 138, 0.2);
}

.postop-dressing-guide__header {
    display: flex;
    gap: 11px;
    align-items: center;
}

.postop-dressing-guide__header > span {
    width: 42px;
    height: 42px;
    flex: 0 0 42px;
    display: grid;
    place-items: center;
    border-radius: 13px;
    background: rgba(255, 255, 255, 0.8);
    font-size: 1.25rem;
}

.postop-dressing-guide h3,
.postop-history h3 {
    margin: 2px 0 10px;
    font-size: 1rem;
}

.postop-dressing-guide ol {
    margin: 10px 0 0;
    padding: 0;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 9px;
    color: #334155;
    font-size: 0.86rem;
    line-height: 1.45;
    list-style: none;
    counter-reset: postop-step;
}

.postop-dressing-guide li {
    counter-increment: postop-step;
    display: grid;
    grid-template-columns: 30px minmax(0, 1fr);
    gap: 8px;
    align-items: start;
    padding: 9px;
    border-radius: 11px;
    background: rgba(255, 255, 255, 0.7);
}

.postop-dressing-guide li::before {
    content: counter(postop-step);
    width: 28px;
    height: 28px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    background: #0d8a8a;
    color: #fff;
    font-size: 0.76rem;
    font-weight: 800;
}

.postop-photo-upload {
    display: flex;
    flex-direction: column;
    gap: 4px;
    align-items: center;
    text-align: center;
    border: 2px dashed rgba(13, 138, 138, 0.35);
    border-radius: 15px;
    padding: 18px;
    color: #0d6b6b;
    background: #f0fdfa;
    cursor: pointer;
}

.postop-photo-upload input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.postop-photo-upload span {
    font-weight: 700;
}

.postop-photo-upload small,
.postop-photo-selection {
    color: #64748b;
    font-size: 0.78rem;
}

.postop-photo-selection {
    text-align: center;
}

.postop-history {
    border-top: 1px solid rgba(148, 163, 184, 0.25);
    padding-top: 16px;
}

.postop-history__list {
    display: grid;
    gap: 12px;
}

.postop-entry {
    border: 1px solid rgba(148, 163, 184, 0.3);
    border-radius: 14px;
    padding: 14px;
    background: #fff;
}

.postop-entry__header,
.postop-entry__metrics {
    display: flex;
    gap: 8px;
    justify-content: space-between;
    flex-wrap: wrap;
    align-items: center;
}

.postop-entry__metrics {
    justify-content: flex-start;
    margin: 8px 0;
}

.postop-entry__metrics span {
    border-radius: 999px;
    padding: 4px 9px;
    background: #eef2ff;
    color: #3730a3;
    font-size: 0.78rem;
}

.postop-entry p {
    margin: 6px 0 0;
    color: #475569;
    font-size: 0.84rem;
}

.postop-entry__photos {
    display: flex;
    gap: 8px;
    margin-top: 10px;
    overflow-x: auto;
}

.postop-entry__photos img {
    width: 88px;
    height: 88px;
    object-fit: cover;
    border-radius: 10px;
    border: 1px solid #dbe3ef;
}

body.patient-body[data-theme="dark"] .postop-alert-guide {
    background: rgba(127, 29, 29, 0.24);
    color: #fecaca;
}

body.patient-body[data-theme="dark"] .postop-visual-hero,
body.patient-body[data-theme="dark"] .postop-illustrated-guide,
body.patient-body[data-theme="dark"] .postop-checkin-intro {
    background: linear-gradient(135deg, rgba(15, 118, 110, 0.2), rgba(30, 41, 59, 0.88));
    border-color: rgba(94, 234, 212, 0.25);
}

body.patient-body[data-theme="dark"] .postop-visual-hero h3,
body.patient-body[data-theme="dark"] .postop-section-heading h3,
body.patient-body[data-theme="dark"] .postop-checkin-intro h3,
body.patient-body[data-theme="dark"] .postop-kicker {
    color: #99f6e4;
}

body.patient-body[data-theme="dark"] .postop-visual-hero p,
body.patient-body[data-theme="dark"] .postop-section-heading p,
body.patient-body[data-theme="dark"] .postop-checkin-intro p {
    color: #cbd5e1;
}

body.patient-body[data-theme="dark"] .postop-quick-cues span,
body.patient-body[data-theme="dark"] .postop-section-heading__icon,
body.patient-body[data-theme="dark"] .postop-checkin-intro__icon {
    background: rgba(255, 255, 255, 0.1);
    color: #e2e8f0;
}

body.patient-body[data-theme="dark"] .postop-section,
body.patient-body[data-theme="dark"] .postop-entry {
    background: rgba(16, 20, 45, 0.9);
    border-color: rgba(96, 120, 255, 0.3);
}

body.patient-body[data-theme="dark"] .postop-section legend,
body.patient-body[data-theme="dark"] .postop-field,
body.patient-body[data-theme="dark"] .postop-check-grid label,
body.patient-body[data-theme="dark"] .postop-check-card,
body.patient-body[data-theme="dark"] .postop-dressing-guide ol,
body.patient-body[data-theme="dark"] .postop-entry p {
    color: #e2e8f0;
}

body.patient-body[data-theme="dark"] .postop-check-grid label,
body.patient-body[data-theme="dark"] .postop-check-card,
body.patient-body[data-theme="dark"] .postop-dressing-guide,
body.patient-body[data-theme="dark"] .postop-photo-upload {
    background: rgba(30, 41, 59, 0.85);
    border-color: rgba(94, 234, 212, 0.28);
}

body.patient-body[data-theme="dark"] .postop-check-grid label:has(input:checked),
body.patient-body[data-theme="dark"] .postop-check-card:has(input:checked) {
    background: rgba(13, 148, 136, 0.28);
    border-color: #5eead4;
}

body.patient-body[data-theme="dark"] .postop-dressing-guide li {
    background: rgba(255, 255, 255, 0.07);
}

body.patient-body[data-theme="dark"] .postop-field input:not([type="range"]),
body.patient-body[data-theme="dark"] .postop-field textarea {
    background: #111827;
    border-color: #475569;
    color: #f8fafc;
}

@media (max-width: 680px) {
    .patient-card--module-switcher {
        padding-inline: 16px;
    }

    .postop-visual-hero {
        grid-template-columns: minmax(0, 1fr);
    }

    .postop-visual-hero__image {
        min-height: 210px;
        max-height: 250px;
    }

    .postop-guide-gallery {
        grid-auto-columns: minmax(205px, 82vw);
    }

    .postop-guide-card {
        height: 310px;
    }

    .postop-section-heading,
    .postop-checkin-intro {
        align-items: flex-start;
    }
}

.patient-password-actions {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
}

@media (min-width: 768px) {
    .patient-shell {
        padding: 32px;
    }

    .patient-app {
        max-width: 900px;
        padding: 32px;
    }

    .patient-dashboard {
        padding: 28px;
    }

    .patient-dashboard__header {
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
        gap: 24px;
    }

    .patient-tabs {
        gap: 12px;
    }

    .patient-tab {
        flex-direction: row;
        min-width: 0;
        padding: 10px 16px;
        gap: 8px;
    }

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

@media (max-width: 599px) {
    .patient-dashboard {
        padding: 24px 18px 32px;
    }

    .patient-dashboard__actions {
        width: 100%;
        justify-content: space-between;
    }

    .patient-password-actions {
        flex-direction: column;
        align-items: stretch;
    }
}

/* Experiência de aplicativo em celulares */
@media (max-width: 767px) {
    html {
        background: #f5f6fb;
        overflow-x: hidden;
    }

    body.patient-body {
        min-height: 100dvh;
        overflow-x: hidden;
        -webkit-text-size-adjust: 100%;
    }

    .patient-shell {
        min-height: 100dvh;
        padding: 0;
        display: block;
    }

    .patient-app {
        width: 100%;
        min-height: 100dvh;
        max-width: none;
        box-sizing: border-box;
        padding: 0 0 calc(76px + env(safe-area-inset-bottom));
        border: 0;
        border-radius: 0;
        overflow: clip;
    }

    .patient-app__top {
        position: sticky;
        z-index: 50;
        top: 0;
        min-height: 64px;
        box-sizing: border-box;
        padding: calc(10px + env(safe-area-inset-top)) 16px 10px;
        margin: 0;
        background: rgba(255, 255, 255, 0.94);
        border-bottom-color: rgba(148, 163, 184, 0.18);
        backdrop-filter: blur(18px);
        -webkit-backdrop-filter: blur(18px);
    }

    body.patient-body[data-theme="dark"] .patient-app__top {
        background: rgba(8, 12, 28, 0.94);
    }

    .patient-app__top strong {
        display: block;
        max-width: 180px;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .patient-app__clinic {
        font-size: 0.64rem;
    }

    .patient-menu-toggle {
        display: none;
    }

    .patient-menu {
        display: none !important;
    }

    .patient-theme-toggle {
        width: 44px;
        height: 44px;
    }

    .patient-auth {
        min-height: calc(100dvh - 64px - env(safe-area-inset-top));
        padding: 18px 16px 24px;
        box-sizing: border-box;
        align-items: flex-start;
    }

    .patient-auth__card {
        max-width: 480px;
        padding: 22px 18px;
        border-radius: 22px;
    }

    .patient-auth__header {
        align-items: flex-start;
        gap: 13px;
        margin-bottom: 24px;
    }

    .patient-auth__logo {
        width: 50px;
        height: 50px;
        flex: 0 0 50px;
        border-radius: 15px;
    }

    .patient-auth__header h1 {
        font-size: clamp(1.3rem, 6vw, 1.55rem);
        line-height: 1.2;
    }

    .patient-auth__header p {
        font-size: 0.88rem;
        line-height: 1.45;
    }

    .patient-form {
        gap: 15px;
    }

    .patient-form .btn {
        min-height: 46px;
    }

    .patient-form__field input,
    .patient-inline-form textarea,
    .patient-select,
    .postop-field input:not([type="range"]),
    .postop-field textarea,
    .hd-field input,
    .hd-field textarea {
        min-height: 46px;
        box-sizing: border-box;
        font-size: 16px;
    }

    .patient-dashboard {
        width: 100%;
        box-sizing: border-box;
        padding: 18px 14px 26px;
        border: 0;
        border-radius: 0;
        background: transparent;
    }

    body.patient-body[data-theme="dark"] .patient-dashboard {
        background: transparent;
        border: 0;
    }

    .patient-dashboard__header {
        gap: 13px;
        margin-bottom: 18px;
    }

    .patient-dashboard__header h1 {
        max-width: 100%;
        font-size: clamp(1.45rem, 7vw, 1.85rem);
        line-height: 1.18;
        overflow-wrap: anywhere;
    }

    .patient-dashboard__header p {
        overflow-wrap: anywhere;
        line-height: 1.45;
    }

    .patient-dashboard__actions {
        width: 100%;
        display: grid;
        grid-template-columns: minmax(0, 1fr) minmax(92px, auto);
        gap: 9px;
    }

    .patient-dashboard__actions .btn {
        min-height: 44px;
        white-space: normal;
    }

    .patient-tabs {
        position: fixed;
        z-index: 100;
        inset: auto 0 0;
        width: 100%;
        box-sizing: border-box;
        display: grid;
        grid-template-columns: repeat(6, minmax(0, 1fr));
        gap: 2px;
        padding: 6px 5px calc(6px + env(safe-area-inset-bottom));
        margin: 0;
        border: 0;
        border-top: 1px solid rgba(148, 163, 184, 0.24);
        border-radius: 0;
        background: rgba(255, 255, 255, 0.97);
        box-shadow: 0 -10px 30px rgba(15, 23, 42, 0.08);
        overflow: visible;
        backdrop-filter: blur(18px);
        -webkit-backdrop-filter: blur(18px);
    }

    body.patient-body[data-theme="dark"] .patient-tabs {
        background: rgba(8, 12, 28, 0.97);
        border-color: rgba(148, 163, 184, 0.22);
        box-shadow: 0 -10px 30px rgba(0, 0, 0, 0.28);
    }

    .patient-tab {
        min-width: 0;
        min-height: 56px;
        padding: 6px 2px;
        gap: 2px;
        border-radius: 12px;
        font-size: clamp(0.58rem, 2.6vw, 0.69rem);
        line-height: 1.15;
    }

    .patient-tab span[aria-hidden="true"] {
        font-size: 1.15rem;
    }

    .patient-panels {
        gap: 14px;
    }

    .patient-panel,
    body.patient-body[data-theme="dark"] .patient-panel {
        gap: 14px;
        padding: 0;
        border: 0;
        border-radius: 0;
        background: transparent;
        box-shadow: none;
    }

    .patient-summary {
        grid-template-columns: minmax(0, 1fr);
        gap: 10px;
        margin-bottom: 0;
    }

    .summary-card {
        padding: 16px;
        border-radius: 17px;
    }

    .patient-grid {
        grid-template-columns: minmax(0, 1fr);
        gap: 12px;
    }

    .patient-card {
        min-width: 0;
        box-sizing: border-box;
        padding: 17px 15px;
        border-radius: 19px;
    }

    .patient-card--inline {
        margin-top: 18px;
    }

    .patient-card__header h2 {
        font-size: 1.12rem;
        line-height: 1.3;
    }

    .patient-list li {
        min-width: 0;
        overflow-wrap: anywhere;
    }

    .patient-inline-form,
    .patient-chat-attach,
    .patient-inline-form__actions {
        align-items: stretch;
        flex-direction: column;
    }

    .patient-inline-form > *,
    .patient-chat-attach > *,
    .patient-inline-form__actions .btn {
        width: 100%;
        box-sizing: border-box;
    }

    .patient-upload {
        min-height: 46px;
        justify-content: center;
        box-sizing: border-box;
    }

    .patient-chat {
        max-height: min(52dvh, 430px);
        padding-right: 2px;
    }

    .patient-chat__message {
        max-width: 92%;
        box-sizing: border-box;
        overflow-wrap: anywhere;
    }

    .patient-chat__attachment img {
        max-width: min(100%, 260px);
        height: auto;
    }

    .patient-module {
        flex-basis: min(280px, 86vw);
    }

    .postop-visual-hero,
    .postop-illustrated-guide,
    .postop-checkin-intro,
    .postop-section,
    .postop-dressing-guide {
        padding: 14px;
    }

    .postop-grid,
    .postop-grid--date,
    .postop-check-grid {
        grid-template-columns: minmax(0, 1fr);
    }

    .postop-hero-actions {
        flex-direction: column;
    }

    .postop-hero-actions .btn {
        width: 100%;
        box-sizing: border-box;
    }

    .postop-guide-gallery {
        grid-auto-columns: minmax(210px, 78vw);
    }

    .postop-dressing-guide ol {
        grid-template-columns: minmax(0, 1fr);
    }

    .patient-password-actions {
        flex-direction: column;
        align-items: stretch;
    }
}

@media (max-width: 370px) {
    .patient-app__badge {
        display: none;
    }

    .patient-dashboard,
    .patient-auth {
        padding-left: 10px;
        padding-right: 10px;
    }

    .patient-tab {
        font-size: 0.56rem;
    }
}
