/* =========================================================
   MEINWEG 9.1 — SISTEMA DE TEMAS
   Claro = visual existente; Escuro = superfícies grafite/violeta;
   Sistema = acompanha prefers-color-scheme.
   A preferência é local ao navegador e não altera o banco.
   ========================================================= */

/* Controles de Aparência no Perfil */
.profile-appearance-card {
    margin-top: 0;
}

.profile-appearance-heading {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    margin-bottom: 20px;
}

.profile-appearance-heading h2 {
    margin: 0 0 3px;
}

.profile-appearance-heading p {
    color: var(--muted);
}

.profile-appearance-icon {
    width: 44px;
    height: 44px;
    flex: 0 0 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 14px;
    color: var(--primary);
    background: color-mix(in srgb, var(--primary) 10%, white);
    border: 1px solid color-mix(in srgb, var(--primary) 18%, var(--border));
}

.profile-appearance-icon svg {
    width: 23px;
    height: 23px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}

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

.theme-choice {
    position: relative;
    min-width: 0;
    padding: 13px;
    border: 1px solid var(--border);
    border-radius: 16px;
    background: #fff;
    color: var(--text);
    text-align: left;
    cursor: pointer;
    transition: .2s ease;
}

.theme-choice:hover {
    border-color: color-mix(in srgb, var(--primary) 42%, var(--border));
    transform: translateY(-1px);
    box-shadow: 0 10px 24px var(--shadow);
}

.theme-choice.is-selected {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 12%, transparent);
}

.theme-choice-copy {
    display: block;
    padding: 11px 30px 1px 2px;
}

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

.theme-choice-copy strong {
    font-size: 14px;
    color: var(--text);
}

.theme-choice-copy small {
    margin-top: 2px;
    color: var(--muted);
    font-size: 12px;
    line-height: 1.35;
}

.theme-choice-check {
    position: absolute;
    right: 14px;
    bottom: 15px;
    width: 22px;
    height: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: var(--primary);
    color: #fff;
    font-size: 12px;
    font-weight: 900;
    opacity: 0;
    transform: scale(.75);
    transition: .18s ease;
}

.theme-choice.is-selected .theme-choice-check {
    opacity: 1;
    transform: scale(1);
}

.theme-preview {
    position: relative;
    height: 82px;
    display: grid;
    grid-template-columns: 28% 1fr;
    overflow: hidden;
    border-radius: 11px;
    border: 1px solid #ded8e8;
}

.theme-preview-sidebar {
    display: block;
}

.theme-preview-content {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 14px 11px;
}

.theme-preview-content i {
    display: block;
    height: 18px;
    border-radius: 6px;
}

.theme-preview-light {
    background: #f5f3ff;
}
.theme-preview-light .theme-preview-sidebar { background: #ffffff; border-right: 1px solid #e9e1f8; }
.theme-preview-light .theme-preview-content i { background: #ffffff; border: 1px solid #e9e1f8; }
.theme-preview-light .theme-preview-content i:last-child { width: 72%; background: #f2ecff; }

.theme-preview-dark {
    background: #12111a;
    border-color: #393344;
}
.theme-preview-dark .theme-preview-sidebar { background: #1b1824; border-right: 1px solid #393344; }
.theme-preview-dark .theme-preview-content i { background: #211d2b; border: 1px solid #3b3448; }
.theme-preview-dark .theme-preview-content i:last-child { width: 72%; background: #2b2040; }

.theme-preview-system {
    display: grid;
    grid-template-columns: 1fr 1fr;
    background: transparent;
}
.theme-preview-system-light { background: linear-gradient(135deg, #fff 0 34%, #f5f3ff 34% 100%); }
.theme-preview-system-dark { background: linear-gradient(135deg, #1b1824 0 34%, #12111a 34% 100%); }

.profile-theme-note {
    margin-top: 14px;
    color: var(--muted);
    font-size: 13px;
}

/* -------------------- Tema escuro -------------------- */
html[data-theme="dark"] {
    --background: #12111A !important;
    --white: #1D1926;
    --text: #F5F2FA;
    --muted: #B8B0C4;
    --border: #3A3347;
    --shadow: rgba(0, 0, 0, .28);
    --success: #5BD39B;
    --warning: #F4BC61;
    --danger: #FF7A86;
    --mw-dark-surface: #1D1926;
    --mw-dark-surface-2: #231E2E;
    --mw-dark-surface-3: #2A2337;
    --mw-dark-soft: #191620;
    --mw-dark-blue: #182638;
    --mw-dark-green: #172A23;
    --mw-dark-orange: #2D2519;
    --mw-dark-purple: #2A2040;
    --mw-dark-pink: #30202A;
}

html[data-theme="dark"] body.theme-app {
    background: var(--background);
    color: var(--text);
}

html[data-theme="dark"] body.theme-app .site-header {
    background: rgba(29, 25, 38, .96);
    border-color: var(--border);
    box-shadow: 0 2px 18px rgba(0, 0, 0, .28);
}

html[data-theme="dark"] body.theme-app .main-nav a {
    color: var(--text);
}

html[data-theme="dark"] body.theme-app .main-nav a:hover,
html[data-theme="dark"] body.theme-app .main-nav a.active {
    color: #C9B5FF;
    background: color-mix(in srgb, var(--primary) 18%, var(--mw-dark-surface));
}

html[data-theme="dark"] body.theme-app .site-footer {
    color: var(--muted);
}

html[data-theme="dark"] body.theme-app :is(.card,.item-card,.admin-v51-panel,.admin-v51-user-row,.admin-v51-user-editor,.professional-agenda-tabs,.professional-shared-filter,.professional-shared-appointment,.agenda-visual-card,.agenda-shared-visual-card,.goal-card,.goal-detail-hero,.goals-toolbar-card,.diary-standard-comments .diary-comment) {
    background: var(--mw-dark-surface);
    border-color: var(--border);
    box-shadow: 0 8px 26px rgba(0, 0, 0, .18);
}

html[data-theme="dark"] body.theme-app .card:hover {
    box-shadow: 0 15px 38px rgba(0, 0, 0, .30);
}

html[data-theme="dark"] body.theme-app :is(input,textarea,select) {
    background: var(--mw-dark-surface-2);
    color: var(--text);
    border-color: #4A4258;
}

html[data-theme="dark"] body.theme-app :is(input,textarea,select)::placeholder {
    color: #91889F;
}

html[data-theme="dark"] body.theme-app input[readonly] {
    background: #19161F;
    color: #B9B1C5;
}

html[data-theme="dark"] body.theme-app :is(.info-box,.feature-item,.registration-security-block) {
    background: var(--mw-dark-surface-2);
    border-color: var(--border);
}

html[data-theme="dark"] body.theme-app :is(.menu-toggle,.notification-toggle,.language-toggle,.language-menu,.notification-dropdown,.dashboard-action,.pagination-link,.patient-light-button,.patient-approved-light-button,.professional-shared-followup-button,.goal-icon-action) {
    background: var(--mw-dark-surface-2);
    color: #CDBBFF;
    border-color: var(--border);
}

html[data-theme="dark"] body.theme-app :is(.language-option,.notification-dropdown-item,.notifications-page-item) {
    color: var(--text);
}

html[data-theme="dark"] body.theme-app :is(.language-option:hover,.language-option.is-selected,.notification-dropdown-item:hover,.notifications-page-item:hover,.notification-view-all) {
    background: var(--mw-dark-surface-3);
}

html[data-theme="dark"] body.theme-app .notification-dropdown-head,
html[data-theme="dark"] body.theme-app .notification-view-all {
    border-color: var(--border);
}

html[data-theme="dark"] body.theme-app :is(table,th,td) {
    border-color: var(--border);
}

html[data-theme="dark"] body.theme-app th {
    color: #CDBBFF;
}

html[data-theme="dark"] body.theme-app :is(.bar-track,.dashboard-progress,.patient-goal-progress,.goal-progress-track,.shared-evolution-bar-track) {
    background: #373041;
}

html[data-theme="dark"] body.theme-app :is(.badge-muted,.pagination-link.is-disabled,.status-pendente,.status-andamento,.priority-baixa,.goal-task-state.is-completed) {
    background: #302B38;
    color: #C9C2D1;
}

html[data-theme="dark"] body.theme-app .badge-success,
html[data-theme="dark"] body.theme-app .alert-success {
    background: #153425;
    color: #83E2B2;
}

html[data-theme="dark"] body.theme-app .badge-warning,
html[data-theme="dark"] body.theme-app .alert-warning {
    background: #3B2E16;
    color: #F2C66D;
}

html[data-theme="dark"] body.theme-app .badge-danger,
html[data-theme="dark"] body.theme-app .alert-error {
    background: #3A1D24;
    color: #FF9AA4;
}

/* Dashboard paciente: preserva as quatro famílias de cor em tons escuros. */
html[data-theme="dark"] body.theme-app :is(.patient-metric-card.is-purple,.patient-quick-item.is-purple,.patient-approved-metric.is-purple,.patient-approved-action.is-purple,.evolution-summary-card.is-purple,.goals-summary-card.is-purple,.shared-evolution-stat.is-purple,.admin-v51-stat-purple,.admin-v51-activity-purple,.admin-v51-quick-purple) {
    background: var(--mw-dark-purple) !important;
    border-color: #4B3767 !important;
}

html[data-theme="dark"] body.theme-app :is(.patient-metric-card.is-blue,.patient-quick-item.is-blue,.patient-approved-metric.is-blue,.patient-approved-action.is-blue,.evolution-summary-card.is-blue,.goals-summary-card.is-blue,.shared-evolution-stat.is-blue,.admin-v51-stat-blue,.admin-v51-activity-blue,.admin-v51-quick-blue,.mw428-quick-action.mw428-blue) {
    background: var(--mw-dark-blue) !important;
    border-color: #29445F !important;
}

html[data-theme="dark"] body.theme-app :is(.patient-metric-card.is-green,.patient-quick-item.is-green,.patient-approved-metric.is-green,.patient-approved-action.is-green,.evolution-summary-card.is-green,.goals-summary-card.is-green,.shared-evolution-stat.is-green,.admin-v51-stat-green,.admin-v51-activity-green,.admin-v51-quick-green,.mw428-quick-action.mw428-green) {
    background: var(--mw-dark-green) !important;
    border-color: #29513F !important;
}

html[data-theme="dark"] body.theme-app :is(.patient-metric-card.is-orange,.patient-quick-item.is-orange,.patient-approved-metric.is-orange,.patient-approved-action.is-orange,.evolution-summary-card.is-orange,.goals-summary-card.is-orange,.shared-evolution-stat.is-orange,.admin-v51-stat-orange,.admin-v51-activity-orange,.mw428-quick-action.mw428-orange) {
    background: var(--mw-dark-orange) !important;
    border-color: #5A4829 !important;
}

html[data-theme="dark"] body.theme-app :is(.patient-attention-item,.patient-approved-attention,.patient-approved-week,.patient-approved-motivation,.mw428-week,.patient-dashboard-bottom-strip,.patient-appointment-detail,.patient-goal-item,.patient-empty-state,.dashboard-empty-positive,.professional-shared-empty) {
    background: var(--mw-dark-surface-2);
    border-color: var(--border);
}

html[data-theme="dark"] body.theme-app :is(.patient-positive-state,.admin-v51-attention,.professional-shared-privacy-note) {
    background: var(--mw-dark-green);
    border-color: #29513F;
}

html[data-theme="dark"] body.theme-app :is(.patient-approved-attention-count,.admin-v51-attention-count,.patient-appointment-datebox,.patient-goal-icon,.goals-section-icon,.goal-sharing-avatar,.diary-sharing-avatar,.agenda-sharing-avatar,.professional-shared-patient-avatar,.goal-detail-comment-avatar,.diary-comment-avatar) {
    background: var(--mw-dark-surface-3);
    border-color: var(--border);
}

/* Diário, metas, agenda e compartilhamentos. */
html[data-theme="dark"] body.theme-app :is(.goals-readonly-value,.goal-detail-numbers>div,.goal-detail-meta-grid>div,.goal-sharing-option,.diary-sharing-option,.agenda-sharing-option,.professional-shared-notes,.agenda-visual-notes,.diary-comment-form,.patient-comments-block,.goal-comment-notice,.goal-detail-comment,.therapist-comment-form textarea) {
    background: var(--mw-dark-surface-2);
    border-color: var(--border);
}

html[data-theme="dark"] body.theme-app :is(.goal-sharing-box,.diary-sharing-box,.agenda-sharing-box) {
    background: color-mix(in srgb, var(--primary) 8%, var(--mw-dark-surface));
    border-color: color-mix(in srgb, var(--primary) 28%, var(--border));
}

html[data-theme="dark"] body.theme-app :is(.goal-sharing-badge.is-private,.diary-privacy-badge.is-private,.agenda-privacy-badge.is-private,.evolution-sharing-badge.is-private,.shared-evolution-privacy-badge) {
    background: #302B38;
    color: #C9C2D1;
}

html[data-theme="dark"] body.theme-app :is(.goal-sharing-badge.is-shared,.diary-privacy-badge.is-shared,.agenda-privacy-badge.is-shared,.evolution-sharing-badge.is-shared,.comment-visible-badge) {
    background: #173326;
    color: #83E2B2;
}

html[data-theme="dark"] body.theme-app :is(.goal-tip-card,.therapist-communication-note) {
    background: var(--mw-dark-purple);
    border-color: #4B3767;
    color: #D8CCEA;
}

html[data-theme="dark"] body.theme-app :is(.goal-comment-notice.has-new,.goal-comment-notice.is-private) {
    background: var(--mw-dark-purple);
    border-color: #4B3767;
}

html[data-theme="dark"] body.theme-app :is(.agenda-list-total,.diary-result-count,.goals-result-count,.professional-shared-total) {
    background: var(--mw-dark-surface-2);
    color: var(--muted);
}

html[data-theme="dark"] body.theme-app :is(.agenda-visual-date,.agenda-visual-sharing.is-private,.agenda-visual-sharing.is-shared,.agenda-shared-patient-standard,.agenda-goal-card .goal-shared-badge) {
    background: var(--mw-dark-surface-3);
    border-color: var(--border);
}

html[data-theme="dark"] body.theme-app :is(.professional-agenda-tab:hover,.professional-shared-filter:hover,.goals-filter-chip:hover,.goals-filter-chip.is-active) {
    background: var(--mw-dark-purple);
}

/* Evolução 9: gráficos e blocos analíticos. */
html[data-theme="dark"] body.theme-app .evolution-privacy-notice {
    background: linear-gradient(135deg, #211A2D, #2B2040);
    border-color: #4B3B62;
    box-shadow: 0 7px 22px rgba(0, 0, 0, .20);
}

html[data-theme="dark"] body.theme-app :is(.evolution-chart-card,.evolution-insight-card,.evolution-frequency-card,.evolution-distribution-card,.evolution-goals-card) {
    background: var(--mw-dark-surface);
    border-color: var(--border);
}

html[data-theme="dark"] body.theme-app :is(.evolution-chart-grid-line,.evolution-frequency-day.is-empty) {
    border-color: #3A3347;
    background: #211D2A;
}

/* Administração. */
html[data-theme="dark"] body.theme-app .admin-v51-stat small,
html[data-theme="dark"] body.theme-app .admin-v51-stat p,
html[data-theme="dark"] body.theme-app .admin-v51-role,
html[data-theme="dark"] body.theme-app .admin-v51-quick small,
html[data-theme="dark"] body.theme-app .admin-v51-activity small {
    color: var(--muted);
}

html[data-theme="dark"] body.theme-app .admin-v51-admin-toggle {
    background: var(--mw-dark-surface-2);
    border-color: var(--border);
}

html[data-theme="dark"] body.theme-app .admin-v51-stat-icon,
html[data-theme="dark"] body.theme-app .admin-v51-quick-icon {
    background: rgba(255,255,255,.06);
}

/* Perfil / seletor de tema. */
html[data-theme="dark"] body.theme-app .profile-appearance-icon {
    background: var(--mw-dark-purple);
    border-color: #4B3767;
}

html[data-theme="dark"] body.theme-app .theme-choice {
    background: var(--mw-dark-surface-2);
    color: var(--text);
    border-color: var(--border);
}

html[data-theme="dark"] body.theme-app .theme-choice:hover {
    background: var(--mw-dark-surface-3);
}

/* Corrige color-mix que usa explicitamente white em regras antigas. */
html[data-theme="dark"] body.theme-app :is(.dashboard-action:hover,.patient-light-button:hover,.patient-approved-light-button:hover) {
    background: color-mix(in srgb, var(--primary) 14%, var(--mw-dark-surface));
}

/* Mantém textos secundários legíveis sem apagar cores semânticas. */
html[data-theme="dark"] body.theme-app :is(.page-heading p,.meta-text,.profile-appearance-heading p,.profile-theme-note,.goal-detail-description,.agenda-list-heading p,.diary-list-heading p,.evolution-privacy-notice p) {
    color: var(--muted);
}

@media (max-width: 760px) {
    .theme-choice-grid {
        grid-template-columns: 1fr;
    }

    .theme-choice {
        display: grid;
        grid-template-columns: 104px minmax(0, 1fr);
        align-items: center;
        gap: 12px;
    }

    .theme-preview {
        height: 72px;
    }

    .theme-choice-copy {
        padding: 0 30px 0 0;
    }
}

/* Evolução do MeinWeg 9 (evo820) usa CSS local na própria página.
   Estes seletores têm especificidade maior para o tema escuro prevalecer. */
html[data-theme="dark"] body.theme-app .evo820 {
    --evo-border: var(--border);
    --evo-soft: var(--mw-dark-surface-2);
    --evo-text: var(--text);
    --evo-muted: var(--muted);
}

html[data-theme="dark"] body.theme-app .evo820-period,
html[data-theme="dark"] body.theme-app .evo820-journey,
html[data-theme="dark"] body.theme-app .evo820-card {
    background: var(--mw-dark-surface);
    border-color: var(--border);
    box-shadow: 0 8px 26px rgba(0, 0, 0, .18);
}

html[data-theme="dark"] body.theme-app .evo820-period a {
    color: var(--muted);
}

html[data-theme="dark"] body.theme-app .evo820-period a.is-active {
    background: var(--mw-dark-purple);
    color: #D8C8FF;
}

html[data-theme="dark"] body.theme-app .evo820-privacy {
    background: linear-gradient(135deg, #211A2D, #2B2040);
    border-color: #4B3B62;
}

html[data-theme="dark"] body.theme-app .evo820-privacy-icon,
html[data-theme="dark"] body.theme-app .evo820-journey-stat-icon,
html[data-theme="dark"] body.theme-app .evo820-insight-icon {
    background: var(--mw-dark-purple);
}

html[data-theme="dark"] body.theme-app .evo820-privacy strong {
    color: #CDB8FF;
}

html[data-theme="dark"] body.theme-app .evo820-journey-main h2,
html[data-theme="dark"] body.theme-app .evo820-journey-stat strong,
html[data-theme="dark"] body.theme-app .evo820-card-head h3,
html[data-theme="dark"] body.theme-app .evo820-donut-center strong,
html[data-theme="dark"] body.theme-app .evo820-insight strong {
    color: var(--text);
}

html[data-theme="dark"] body.theme-app .evo820-journey-main p,
html[data-theme="dark"] body.theme-app .evo820-journey-stat span:last-child,
html[data-theme="dark"] body.theme-app .evo820-card-head p,
html[data-theme="dark"] body.theme-app .evo820-legend-row small,
html[data-theme="dark"] body.theme-app .evo820-donut-center span,
html[data-theme="dark"] body.theme-app .evo820-goal-average,
html[data-theme="dark"] body.theme-app .evo820-heatmap-scale,
html[data-theme="dark"] body.theme-app .evo820-insight p,
html[data-theme="dark"] body.theme-app .evo820-empty {
    color: var(--muted);
}

html[data-theme="dark"] body.theme-app .evo820-journey-stat {
    border-color: var(--border);
}

html[data-theme="dark"] body.theme-app .evo820-summary-card {
    color: var(--text);
    border-color: var(--border);
}

html[data-theme="dark"] body.theme-app .evo820-summary-card.is-purple { background: var(--mw-dark-purple); }
html[data-theme="dark"] body.theme-app .evo820-summary-card.is-green { background: var(--mw-dark-green); }
html[data-theme="dark"] body.theme-app .evo820-summary-card.is-orange { background: var(--mw-dark-orange); }
html[data-theme="dark"] body.theme-app .evo820-summary-card.is-blue { background: var(--mw-dark-blue); }

html[data-theme="dark"] body.theme-app .evo820-summary-icon {
    background: rgba(255, 255, 255, .06);
}

html[data-theme="dark"] body.theme-app .evo820-summary-copy span,
html[data-theme="dark"] body.theme-app .evo820-goal-title span {
    color: #D9D3E2;
}

html[data-theme="dark"] body.theme-app .evo820-summary-copy small {
    color: var(--muted);
}

html[data-theme="dark"] body.theme-app .evo820-gridline {
    stroke: #3B3448;
}

html[data-theme="dark"] body.theme-app .evo820-axis-label {
    fill: #A8A0B3;
}

html[data-theme="dark"] body.theme-app .evo820-point {
    stroke: var(--mw-dark-surface);
}

html[data-theme="dark"] body.theme-app .evo820-donut:after {
    background: var(--mw-dark-surface);
}

html[data-theme="dark"] body.theme-app .evo820-progress,
html[data-theme="dark"] body.theme-app .evo820-heatmap-scale i {
    background: #373041;
}

html[data-theme="dark"] body.theme-app .evo820-goal-average {
    border-color: var(--border);
}

html[data-theme="dark"] body.theme-app .evo820-heatday {
    background: #2A2631;
}

html[data-theme="dark"] body.theme-app .evo820-heatday[data-level="1"] { background: #3A2D50; }
html[data-theme="dark"] body.theme-app .evo820-heatday[data-level="2"] { background: #594078; }
html[data-theme="dark"] body.theme-app .evo820-heatday[data-level="3"] { background: #8258B5; }
html[data-theme="dark"] body.theme-app .evo820-heatday[data-level="4"] { background: #9B6BDF; }
html[data-theme="dark"] body.theme-app .evo820-heatmap-scale i:nth-of-type(2) { background: #594078; }
html[data-theme="dark"] body.theme-app .evo820-heatmap-scale i:nth-of-type(3) { background: #8258B5; }
html[data-theme="dark"] body.theme-app .evo820-heatmap-scale i:nth-of-type(4) { background: #9B6BDF; }

html[data-theme="dark"] body.theme-app .evo820-insight {
    background: var(--mw-dark-surface-2);
    border-color: var(--border);
}

@media (max-width: 1100px) {
    html[data-theme="dark"] body.theme-app .evo820-journey-stat {
        border-color: var(--border);
    }
}

/* =========================================================
   MEINWEG 9.1.1 — CORREÇÕES DE CONTRASTE DO TEMA ESCURO
   Corrige componentes antigos que ainda forçavam fundo branco.
   ========================================================= */

/* Dashboard — Resumo da semana (regra legada usa #fff !important). */
html[data-theme="dark"] body.theme-app .mw428-week {
    background: var(--mw-dark-surface-2) !important;
    border-color: var(--border) !important;
}

html[data-theme="dark"] body.theme-app .mw428-week-item + .mw428-week-item {
    border-left-color: var(--border) !important;
}

html[data-theme="dark"] body.theme-app .mw428-week-item small,
html[data-theme="dark"] body.theme-app .mw428-week-item strong {
    color: var(--text) !important;
}

/* Vínculo — profissionais vinculados. */
html[data-theme="dark"] body.theme-app .multi-link-card {
    background: var(--mw-dark-surface-2) !important;
    color: var(--text);
    border-color: var(--border) !important;
}

html[data-theme="dark"] body.theme-app .multi-link-card h3 {
    color: var(--text);
}

html[data-theme="dark"] body.theme-app .multi-link-card p {
    color: var(--muted);
}

html[data-theme="dark"] body.theme-app .multi-link-count {
    background: var(--mw-dark-purple);
    color: #D8C8FF;
    border: 1px solid #4B3767;
}

/* Código de vínculo e pequenos elementos claros dessa mesma área. */
html[data-theme="dark"] body.theme-app .link-code-inline {
    background: var(--mw-dark-surface-2);
    color: #CDBBFF;
    border-color: var(--border);
}

/* =========================================================
   MEINWEG 9.1.2 — DASHBOARD DO TERAPEUTA NO TEMA ESCURO
   O painel profissional possui CSS local legado; estes seletores
   mais específicos adaptam seus componentes sem alterar a lógica.
   ========================================================= */

/* Resumos superiores: preserva as quatro famílias de cor em tons escuros. */
html[data-theme="dark"] body.theme-app .psych-summary-card.is-purple,
html[data-theme="dark"] body.theme-app .psych-quick-item.is-purple {
    background: var(--mw-dark-purple);
    border-color: #4B3767;
}

html[data-theme="dark"] body.theme-app .psych-summary-card.is-blue,
html[data-theme="dark"] body.theme-app .psych-quick-item.is-blue {
    background: var(--mw-dark-blue);
    border-color: #29445F;
}

html[data-theme="dark"] body.theme-app .psych-summary-card.is-green,
html[data-theme="dark"] body.theme-app .psych-quick-item.is-green {
    background: var(--mw-dark-green);
    border-color: #29513F;
}

html[data-theme="dark"] body.theme-app .psych-summary-card.is-orange,
html[data-theme="dark"] body.theme-app .psych-quick-item.is-orange {
    background: var(--mw-dark-orange);
    border-color: #5A4829;
}

html[data-theme="dark"] body.theme-app .psych-summary-card {
    color: var(--text);
    box-shadow: 0 10px 28px rgba(0, 0, 0, .16);
}

html[data-theme="dark"] body.theme-app .psych-summary-card:hover {
    box-shadow: 0 15px 34px rgba(0, 0, 0, .28);
}

html[data-theme="dark"] body.theme-app .psych-summary-title,
html[data-theme="dark"] body.theme-app .psych-quick-copy strong,
html[data-theme="dark"] body.theme-app .psych-appointment-copy h3,
html[data-theme="dark"] body.theme-app .psych-patient-copy h3 {
    color: var(--text);
}

html[data-theme="dark"] body.theme-app .psych-summary-meta,
html[data-theme="dark"] body.theme-app .psych-quick-copy span,
html[data-theme="dark"] body.theme-app .psych-appointment-copy p,
html[data-theme="dark"] body.theme-app .psych-patient-copy p,
html[data-theme="dark"] body.theme-app .psych-patient-date {
    color: var(--muted);
}

/* Ícones e setas dos cards coloridos. */
html[data-theme="dark"] body.theme-app .psych-summary-card.is-purple :is(.psych-summary-icon,.psych-summary-arrow),
html[data-theme="dark"] body.theme-app .psych-quick-item.is-purple .psych-quick-icon {
    background: #3A2856;
    color: #C9A9FF;
}

html[data-theme="dark"] body.theme-app .psych-summary-card.is-blue :is(.psych-summary-icon,.psych-summary-arrow),
html[data-theme="dark"] body.theme-app .psych-quick-item.is-blue .psych-quick-icon {
    background: #203B55;
    color: #8FC2FF;
}

html[data-theme="dark"] body.theme-app .psych-summary-card.is-green :is(.psych-summary-icon,.psych-summary-arrow),
html[data-theme="dark"] body.theme-app .psych-quick-item.is-green .psych-quick-icon {
    background: #214535;
    color: #83E2B2;
}

html[data-theme="dark"] body.theme-app .psych-summary-card.is-orange :is(.psych-summary-icon,.psych-summary-arrow),
html[data-theme="dark"] body.theme-app .psych-quick-item.is-orange .psych-quick-icon {
    background: #4A391D;
    color: #F4BC61;
}

/* Conteúdo interno dos cards do painel profissional. */
html[data-theme="dark"] body.theme-app :is(.psych-appointment-item,.psych-attention-item,.psych-recent-patient-item) {
    background: var(--mw-dark-surface-2);
    border-color: var(--border);
    color: var(--text);
}

html[data-theme="dark"] body.theme-app :is(.psych-appointment-slider-button,.psych-open-button,.psych-follow-button) {
    background: var(--mw-dark-surface-3);
    border-color: #554A66;
    color: #CDBBFF;
    box-shadow: none;
}

html[data-theme="dark"] body.theme-app .psych-appointment-slider-button:hover,
html[data-theme="dark"] body.theme-app .psych-appointment-slider-button:focus-visible,
html[data-theme="dark"] body.theme-app :is(.psych-open-button,.psych-follow-button):hover {
    background: var(--mw-dark-purple);
    border-color: #654B86;
    color: #DECFFF;
}

html[data-theme="dark"] body.theme-app .psych-appointment-time-box {
    background: var(--mw-dark-purple);
    color: #CDB8FF;
}

html[data-theme="dark"] body.theme-app .psych-appointment-tag {
    background: #3A2856;
    color: #D7C0FF;
}

html[data-theme="dark"] body.theme-app .psych-attention-item.is-yellow .psych-attention-icon {
    background: #4A391D;
    color: #F4BC61;
}

html[data-theme="dark"] body.theme-app .psych-attention-item.is-pink .psych-attention-icon {
    background: #44232D;
    color: #FF9AA4;
}

html[data-theme="dark"] body.theme-app .psych-attention-item.is-neutral .psych-attention-icon,
html[data-theme="dark"] body.theme-app .psych-patient-avatar {
    background: #3A2856;
    color: #C9A9FF;
}

html[data-theme="dark"] body.theme-app .psych-attention-arrow {
    background: var(--mw-dark-surface-3);
    border-color: #554A66;
    color: #CDBBFF;
}

html[data-theme="dark"] body.theme-app .psych-card-footer-link,
html[data-theme="dark"] body.theme-app .psych-text-link {
    color: #B895FF;
}

/* Evita que ações rápidas claras reapareçam por regras locais do dashboard. */
html[data-theme="dark"] body.theme-app .psych-quick-item {
    color: var(--text);
}

/* Estados vazios dentro do painel profissional. */
html[data-theme="dark"] body.theme-app .psych-approved-grid .empty-state {
    background: var(--mw-dark-surface-2);
    border-color: var(--border);
    color: var(--muted);
}

/* MeinWeg 9.2 — componentes no tema escuro */
html[data-theme="dark"] .profile-photo-card,
html[data-theme="dark"] .profile-feedback-card,
html[data-theme="dark"] .diary-mood-choice,
html[data-theme="dark"] .growth-onboarding-card,
html[data-theme="dark"] .growth-onboarding-steps>a,
html[data-theme="dark"] .growth-onboarding-steps>div,
html[data-theme="dark"] .growth-stat-card,
html[data-theme="dark"] .growth-feedback-item,
html[data-theme="dark"] .growth-funnel>div,
html[data-theme="dark"] .growth-tier-grid>div,
html[data-theme="dark"] .growth-prof-list>div,
html[data-theme="dark"] .growth-invite-block .link-code-box input{
    background:var(--surface,#211c2c)!important;color:var(--text,#f5f0ff)!important;border-color:var(--border,#3a3248)!important;
}
html[data-theme="dark"] .diary-mood-choice:has(input:checked){background:color-mix(in srgb,var(--primary) 18%,#211c2c)!important}
html[data-theme="dark"] .growth-onboarding-steps .is-done{background:#173327!important;border-color:#2e6249!important}
html[data-theme="dark"] .header-profile-avatar{background:#312641;border-color:#4c3c61}

/* MeinWeg 9.2 — Perfil / profissionais vinculados no tema escuro */
html[data-theme="dark"] body.theme-app .linked-professionals-card,
html[data-theme="dark"] body.theme-app .linked-professional-item,
html[data-theme="dark"] body.theme-app .linked-professionals-empty{
    background:var(--mw-dark-surface-2,#211c2c)!important;
    border-color:var(--border,#3a3248)!important;
}
html[data-theme="dark"] body.theme-app .linked-professional-avatar{
    background:#312641;
    border-color:#443653;
    color:#cdbbff;
}
html[data-theme="dark"] body.theme-app .linked-professional-status{background:#173327;color:#8ee0b2}
html[data-theme="dark"] body.theme-app .linked-professionals-empty-icon{background:#312641;color:#cdbbff}
