/* ============================================================
   LifeTrack - Dashboard do Paciente
   Tema: Vermelho · Preto · Branco
   ============================================================ */

:root {
    --red: #dc2626;
    --red-bright: #ef4444;
    --red-dark: #b91c1c;
    --red-deep: #7f1d1d;
    --red-soft: #fef2f2;

    --black: #0b0b0d;
    --black-2: #121216;
    --black-3: #1c1c22;
    --black-4: #26262d;

    --white: #ffffff;
    --bg: #eef0f5;
    --surface: #ffffff;

    --text: #1f2937;
    --muted: #6b7280;
    --line: #e8e9ef;

    --success: #059669;
    --warning: #d97706;
    --info: #2563eb;

    --radius: 14px;
    --radius-lg: 20px;
    --radius-xl: 26px;

    --shadow-sm: 0 1px 3px rgba(16, 16, 30, 0.06);
    --shadow-md: 0 8px 24px rgba(16, 16, 30, 0.08);
    --shadow-lg: 0 18px 45px rgba(16, 16, 30, 0.14);

    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

html[data-theme="dark"] {
    color-scheme: dark;
    --bg: #0b0b0f;
    --surface: #17171d;
    --text: #f4f4f6;
    --muted: #a6a6b0;
    --line: #303039;
    --red-soft: #321417;
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.28);
    --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.34);
    --shadow-lg: 0 18px 45px rgba(0, 0, 0, 0.46);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
    font-family: 'Plus Jakarta Sans', 'Segoe UI', sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
}

/* ------------------------- Scrollbar ------------------------- */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
    background: #cfd2dc;
    border-radius: 8px;
    border: 2px solid var(--bg);
}
::-webkit-scrollbar-thumb:hover { background: var(--red); }

/* ------------------------- Botões ------------------------- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 22px;
    border: none;
    border-radius: 12px;
    font-family: inherit;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    text-decoration: none;
    transition: var(--transition);
    white-space: nowrap;
}
.btn i { font-size: 15px; }
.btn:active { transform: scale(0.97); }

.btn-primary {
    background: linear-gradient(135deg, var(--red), var(--red-dark));
    color: #fff;
    box-shadow: 0 6px 18px rgba(220, 38, 38, 0.35);
}
.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 24px rgba(220, 38, 38, 0.45);
}

.btn-white {
    background: #fff;
    color: var(--black-2);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.25);
}
.btn-white:hover { transform: translateY(-2px); box-shadow: 0 12px 28px rgba(0, 0, 0, 0.35); }

.btn-dark {
    background: var(--black-2);
    color: #fff;
}
.btn-dark:hover { background: var(--black-4); transform: translateY(-2px); }

.btn-ghost-light {
    background: rgba(255, 255, 255, 0.12);
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.25);
    backdrop-filter: blur(6px);
}
.btn-ghost-light:hover { background: rgba(255, 255, 255, 0.22); transform: translateY(-2px); }

.btn-sm { padding: 9px 16px; font-size: 13px; }
.btn-block { width: 100%; }

/* ------------------------- Badges de seção ------------------------- */
.section-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: #fff;
    border: 1px solid var(--line);
    color: var(--muted);
    padding: 10px 18px;
    border-radius: 999px;
    font-size: 13px;
    font-weight: 600;
    box-shadow: var(--shadow-sm);
}
.section-badge i { color: var(--red); }
/* ------------------------- Sidebar ------------------------- */
.sidebar {
    position: fixed;
    left: 0;
    top: 0;
    height: 100vh;
    width: 268px;
    background: linear-gradient(180deg, var(--black) 0%, var(--black-2) 55%, #160c0d 130%);
    z-index: 100;
    display: flex;
    flex-direction: column;
    transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 8px 0 30px rgba(0, 0, 0, 0.25);
    border-right: 1px solid rgba(220, 38, 38, 0.12);
}
.sidebar::after {
    content: '';
    position: absolute;
    inset: auto 0 0 0;
    height: 260px;
    background: radial-gradient(circle at 50% 100%, rgba(220, 38, 38, 0.28), transparent 70%);
    pointer-events: none;
    z-index: 0;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 24px 20px 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.07);
    position: relative;
    z-index: 1;
}
.sidebar-logo {
    width: 44px;
    height: 44px;
    object-fit: contain;
    filter: drop-shadow(0 4px 10px rgba(220, 38, 38, 0.4));
}
.brand-name {
    display: block;
    font-size: 20px;
    font-weight: 800;
    color: #fff;
    line-height: 1.2;
    letter-spacing: -0.3px;
}
.brand-tagline {
    display: block;
    font-size: 11px;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.45);
    letter-spacing: 2.5px;
    text-transform: uppercase;
}
.sidebar-close {
    display: none;
    margin-left: auto;
    background: rgba(255, 255, 255, 0.08);
    border: none;
    color: #fff;
    width: 38px;
    height: 38px;
    border-radius: 10px;
    cursor: pointer;
}

/* Navegação */
.sidebar-nav {
    flex: 1;
    overflow-y: auto;
    padding: 18px 14px;
    position: relative;
    z-index: 1;
}
.sidebar-nav::-webkit-scrollbar { width: 6px; }
.nav-section-title {
    display: block;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 1.6px;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.35);
    padding: 14px 12px 8px;
}
.nav-item {
    display: flex;
    align-items: center;
    gap: 13px;
    padding: 12px 13px;
    border-radius: 12px;
    color: rgba(255, 255, 255, 0.68);
    text-decoration: none;
    margin-bottom: 3px;
    position: relative;
    transition: var(--transition);
    font-size: 14px;
    font-weight: 600;
}
.nav-icon {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.06);
    color: rgba(255, 255, 255, 0.7);
    flex-shrink: 0;
    transition: var(--transition);
}
.nav-item:hover { background: rgba(255, 255, 255, 0.07); color: #fff; }
.nav-item:hover .nav-icon { background: rgba(220, 38, 38, 0.25); color: #fff; }
.nav-item.active {
    background: linear-gradient(90deg, rgba(220, 38, 38, 0.28), rgba(220, 38, 38, 0.08));
    color: #fff;
}
.nav-item.active .nav-icon {
    background: linear-gradient(135deg, var(--red), var(--red-dark));
    color: #fff;
    box-shadow: 0 6px 14px rgba(220, 38, 38, 0.45);
}
.nav-indicator {
    margin-left: auto;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--red-bright);
    opacity: 0;
    transition: var(--transition);
}
.nav-item.active .nav-indicator { opacity: 1; }

/* Rodapé da sidebar */
.sidebar-footer {
    padding: 16px 14px;
    border-top: 1px solid rgba(255, 255, 255, 0.07);
    position: relative;
    z-index: 1;
}
.user-card {
    display: flex;
    align-items: center;
    gap: 12px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 14px;
    padding: 12px;
    backdrop-filter: blur(6px);
}
.user-avatar {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--red), var(--red-deep));
    color: #fff;
    font-weight: 800;
    font-size: 15px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    box-shadow: 0 4px 12px rgba(220, 38, 38, 0.4);
    overflow: hidden;
    position: relative;
}
.user-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
    border-radius: 50%;
    display: block;
}
.user-info { min-width: 0; flex: 1; }
.user-name {
    display: block;
    color: #fff;
    font-weight: 700;
    font-size: 14px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.user-role {
    display: block;
    font-size: 12px;
    color: rgba(255, 255, 255, 0.5);
}
.logout-btn {
    background: rgba(255, 255, 255, 0.08);
    border: none;
    color: rgba(255, 255, 255, 0.7);
    width: 38px;
    height: 38px;
    border-radius: 10px;
    cursor: pointer;
    transition: var(--transition);
    flex-shrink: 0;
}
.logout-btn:hover {
    background: var(--red);
    color: #fff;
    transform: translateY(-2px);
}

/* Toggle mobile */
.sidebar-toggle-mobile {
    display: none;
    position: fixed;
    top: 16px;
    left: 16px;
    z-index: 99;
    width: 46px;
    height: 46px;
    border: none;
    border-radius: 12px;
    background: linear-gradient(135deg, var(--red), var(--red-dark));
    color: #fff;
    font-size: 18px;
    cursor: pointer;
    box-shadow: 0 8px 20px rgba(220, 38, 38, 0.4);
}
/* ------------------------- Main Content ------------------------- */
.main-content {
    margin-left: 268px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    transition: margin-left 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

.topbar {
    position: sticky;
    top: 0;
    z-index: 60;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    padding: 18px 32px;
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(14px);
    border-bottom: 1px solid var(--line);
}
.topbar-left h1 {
    font-size: 24px;
    font-weight: 800;
    color: var(--text);
    line-height: 1.2;
}
.topbar-left p {
    font-size: 13px;
    color: var(--muted);
    margin-top: 2px;
}
.topbar-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}
.topbar-btn {
    position: relative;
    width: 44px;
    height: 44px;
    border: 1px solid var(--line);
    background: #fff;
    border-radius: 12px;
    color: var(--muted);
    font-size: 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    transition: var(--transition);
}
.topbar-btn:hover {
    color: var(--red);
    border-color: rgba(220, 38, 38, 0.35);
    transform: translateY(-2px);
    box-shadow: var(--shadow-sm);
}

.theme-toggle {
    overflow: hidden;
}

.theme-toggle i {
    transition: transform 0.3s ease, color 0.3s ease;
}

.theme-toggle:hover i {
    transform: rotate(18deg);
}

html[data-theme="dark"] body {
    background: var(--bg);
}

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

html[data-theme="dark"] .topbar-btn,
html[data-theme="dark"] .section-badge,
html[data-theme="dark"] .form-input,
html[data-theme="dark"] .tip-nav,
html[data-theme="dark"] .goal-checkbox,
html[data-theme="dark"] .modal {
    background: var(--surface);
    color: var(--text);
    border-color: var(--line);
}

html[data-theme="dark"] .notification-count {
    border-color: var(--surface);
}

html[data-theme="dark"] .card,
html[data-theme="dark"] .kpi-card,
html[data-theme="dark"] .appointment-card,
html[data-theme="dark"] .metric-card,
html[data-theme="dark"] .health-form-card,
html[data-theme="dark"] .profile-card,
html[data-theme="dark"] .perfil-card,
html[data-theme="dark"] .goals-card,
html[data-theme="dark"] .reminders-card {
    background-color: var(--surface);
    border-color: var(--line);
}

html[data-theme="dark"] .goal-item:hover {
    background: #202027;
}

html[data-theme="dark"] .health-tip,
html[data-theme="dark"] .tip-card {
    background: linear-gradient(120deg, #2b2315, #241b12);
    border-color: #594321;
}

html[data-theme="dark"] .perfil-card-main,
html[data-theme="dark"] .perfil-info-card {
    background-color: var(--surface);
    border-color: var(--line);
}

html[data-theme="dark"] input,
html[data-theme="dark"] textarea,
html[data-theme="dark"] select {
    color-scheme: dark;
}
.notification-count {
    position: absolute;
    top: -6px;
    right: -6px;
    background: var(--red);
    color: #fff;
    font-size: 11px;
    font-weight: 800;
    min-width: 20px;
    height: 20px;
    padding: 0 5px;
    border-radius: 999px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid #fff;
}

.dashboard-content {
    max-width: 1300px;
    width: 100%;
    margin: 0 auto;
    padding: 28px 32px 60px;
}

/* ------------------------- Hero Banner ------------------------- */
.hero-banner {
    position: relative;
    overflow: hidden;
    border-radius: var(--radius-xl);
    background: linear-gradient(115deg, #101014 0%, #241014 55%, #5c1416 100%);
    padding: 40px 44px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 28px;
    box-shadow: 0 20px 50px rgba(28, 9, 10, 0.35);
    margin-bottom: 28px;
    color: #fff;
}
.hero-glow {
    position: absolute;
    border-radius: 50%;
    filter: blur(70px);
    pointer-events: none;
}
.hero-glow-1 { width: 300px; height: 300px; background: rgba(220, 38, 38, 0.5); top: -120px; right: 80px; }
.hero-glow-2 { width: 260px; height: 260px; background: rgba(255, 255, 255, 0.08); bottom: -140px; left: 20px; }

.hero-ecg {
    position: absolute;
    width: 420px;
    height: 130px;
    right: -40px;
    top: 50%;
    transform: translateY(-50%);
    opacity: 0.3;
    pointer-events: none;
}
.hero-ecg polyline {
    fill: none;
    stroke: #fff;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-dasharray: 400;
    animation: ecg-dash 6s linear infinite;
}
@keyframes ecg-dash {
    to { stroke-dashoffset: -800; }
}

.hero-text { position: relative; z-index: 1; max-width: 560px; }
.hero-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: rgba(255, 255, 255, 0.12);
    border: 1px solid rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(8px);
    padding: 8px 16px;
    border-radius: 999px;
    font-size: 12.5px;
    font-weight: 600;
    margin-bottom: 18px;
}
.hero-badge i { color: #facc15; }
.hero-banner h2 {
    font-size: clamp(26px, 3.2vw, 38px);
    font-weight: 800;
    line-height: 1.15;
    margin-bottom: 10px;
    letter-spacing: -0.5px;
}
.hero-banner h2 span { background: linear-gradient(90deg, #f87171, #ffb4a2); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; }
.hero-banner p { color: rgba(255, 255, 255, 0.78); font-size: 15px; margin-bottom: 22px; max-width: 480px; }

.hero-actions { display: flex; gap: 12px; flex-wrap: wrap; }

.hero-stats {
    position: relative;
    z-index: 1;
    display: grid;
    gap: 14px;
    min-width: 190px;
}
.hero-stat {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.12);
    backdrop-filter: blur(8px);
    border-radius: 14px;
    padding: 12px 18px;
    text-align: center;
}
.hero-stat-value {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    font-size: 19px;
    font-weight: 800;
}
.hero-stat-value i { color: var(--red-bright); font-size: 15px; }
.hero-stat-label {
    display: block;
    font-size: 11.5px;
    color: rgba(255, 255, 255, 0.6);
    margin-top: 2px;
}
/* ------------------------- KPI Cards ------------------------- */
.kpi-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
    margin-bottom: 24px;
}
.kpi-card {
    position: relative;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    padding: 22px;
    display: flex;
    align-items: center;
    gap: 16px;
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
    overflow: hidden;
}
.kpi-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--red), var(--red-bright));
    transform: scaleX(0);
    transform-origin: left;
    transition: transform 0.4s ease;
}
.kpi-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-md);
    border-color: rgba(220, 38, 38, 0.25);
}
.kpi-card:hover::before { transform: scaleX(1); }

.kpi-icon {
    width: 54px;
    height: 54px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 21px;
    color: #fff;
    flex-shrink: 0;
}
.kpi-icon.red { background: linear-gradient(135deg, var(--red), var(--red-deep)); box-shadow: 0 6px 14px rgba(220, 38, 38, 0.35); }
.kpi-icon.orange { background: linear-gradient(135deg, #f59e0b, #d97706); box-shadow: 0 6px 14px rgba(245, 158, 11, 0.35); }
.kpi-icon.dark { background: linear-gradient(135deg, var(--black-3), var(--black)); box-shadow: 0 6px 14px rgba(28, 28, 34, 0.4); }
.kpi-icon.blue { background: linear-gradient(135deg, #3b82f6, #1d4ed8); box-shadow: 0 6px 14px rgba(59, 130, 246, 0.35); }

.kpi-info { flex: 1; min-width: 0; }
.kpi-label {
    display: block;
    font-size: 12.5px;
    font-weight: 600;
    color: var(--muted);
    margin-bottom: 2px;
}
.kpi-value {
    display: block;
    font-size: 25px;
    font-weight: 800;
    color: var(--text);
    line-height: 1.2;
    letter-spacing: -0.4px;
}
.kpi-sub {
    display: block;
    font-size: 12px;
    color: var(--muted);
    margin-top: 2px;
}
.kpi-ring {
    width: 72px;
    height: 72px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ------------------------- Cards gerais ------------------------- */
.card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    padding: 24px;
    transition: var(--transition);
}
.card:hover { box-shadow: var(--shadow-md); }

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}
.card-header h3 {
    font-size: 17px;
    font-weight: 800;
    color: var(--text);
    display: flex;
    align-items: center;
    gap: 8px;
}
.card-header h3 i { color: var(--red); }
.card-header p { font-size: 13px; color: var(--muted); }

/* ------------------------- Linha dashboard ------------------------- */
.dashboard-row {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 20px;
    margin-bottom: 24px;
}

.chart-card { min-width: 0; }
.chart-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    background: var(--bg);
    padding: 4px;
    border-radius: 12px;
}
.chart-tab {
    border: none;
    background: transparent;
    padding: 8px 16px;
    border-radius: 9px;
    font-family: inherit;
    font-size: 13px;
    font-weight: 700;
    color: var(--muted);
    cursor: pointer;
    transition: var(--transition);
}
.chart-tab:hover { color: var(--text); }
.chart-tab.active {
    background: var(--black-2);
    color: #fff;
    box-shadow: 0 4px 12px rgba(11, 11, 13, 0.3);
}
.chart-wrap { position: relative; height: 260px; }
.chart-wrap.tall { height: 360px; }
/* ------------------------- Card próxima consulta ------------------------- */
.next-appointment-card {
    background: linear-gradient(150deg, #121216 0%, #1d1215 60%, #3a1013 100%);
    border: none;
    color: #fff;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative;
}
.next-appointment-card::after {
    content: '';
    position: absolute;
    width: 220px;
    height: 220px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(220, 38, 38, 0.4), transparent 70%);
    bottom: -80px;
    right: -60px;
    pointer-events: none;
}
.next-appt-header {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 0.4px;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.7);
    margin-bottom: 16px;
}
.next-appt-header i { color: var(--red-bright); }
.next-appt-date {
    font-size: 13px;
    font-weight: 700;
    color: var(--red-bright);
    text-transform: uppercase;
    letter-spacing: 1px;
}
.next-appt-when { font-size: 32px; font-weight: 800; line-height: 1.1; margin: 4px 0 14px; letter-spacing: -0.5px; }
.next-appt-doctor { display: flex; align-items: center; gap: 12px; margin-bottom: 8px; }
.next-appt-avatar {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--red), var(--red-deep));
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 15px;
    flex-shrink: 0;
}
.next-appt-doctor-name { font-weight: 700; }
.next-appt-doctor-spec { font-size: 12.5px; color: rgba(255, 255, 255, 0.55); display: block; }
.next-appt-type {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.15);
    padding: 6px 12px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
    margin-top: 10px;
}
.next-appt-empty { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; gap: 10px; padding: 20px 0; }
.next-appt-empty i { font-size: 34px; color: rgba(255, 255, 255, 0.25); }
/* ------------------------- Métricas rápidas ------------------------- */
.quick-metrics-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin-bottom: 20px;
}
.quick-metric {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 16px;
    display: flex;
    align-items: center;
    gap: 14px;
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
}
.quick-metric:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); }
.quick-icon {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    background: var(--red-soft);
    color: var(--red);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 17px;
    flex-shrink: 0;
}
.quick-value {
    display: block;
    font-size: 18px;
    font-weight: 800;
    color: var(--text);
    line-height: 1.2;
}
.quick-label {
    display: block;
    font-size: 12px;
    color: var(--muted);
}

/* ------------------------- Dica do dia + promo ------------------------- */
.tips-row {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 20px;
}
.tip-card {
    display: flex;
    align-items: center;
    gap: 18px;
    background: linear-gradient(120deg, #fff, #fff7f0);
    border-color: #fbe2c9;
    position: relative;
}
.tip-icon {
    width: 54px;
    height: 54px;
    border-radius: 50%;
    background: linear-gradient(135deg, #fbbf24, #f59e0b);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    flex-shrink: 0;
    box-shadow: 0 8px 18px rgba(245, 158, 11, 0.35);
}
.tip-content { flex: 1; min-width: 0; }
.tip-label {
    display: block;
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 1.2px;
    text-transform: uppercase;
    color: #d97706;
    margin-bottom: 4px;
}
.tip-content p { font-size: 14.5px; color: var(--text); }
.tip-nav {
    width: 40px;
    height: 40px;
    border: 1px solid #fbe2c9;
    background: #fff;
    color: #d97706;
    border-radius: 12px;
    cursor: pointer;
    transition: var(--transition);
    flex-shrink: 0;
}
.tip-nav:hover { background: #f59e0b; color: #fff; transform: translateX(3px); }

.promo-card {
    display: flex;
    align-items: center;
    gap: 14px;
    background: linear-gradient(120deg, #121216, #1c0f11);
    border: none;
    color: #fff;
}
.promo-img {
    width: 64px;
    height: 64px;
    object-fit: contain;
    flex-shrink: 0;
    filter: drop-shadow(0 6px 14px rgba(220, 38, 38, 0.5));
}
.promo-title { display: block; font-size: 16px; font-weight: 800; }
.promo-text { display: block; font-size: 12.5px; color: rgba(255, 255, 255, 0.6); margin-top: 2px; }
.promo-card .btn { margin-left: auto; flex-shrink: 0; }

/* ------------------------- Conteúdo das seções ------------------------- */
.content-section {
    display: none;
    animation: fadeInUp 0.45s ease;
}
.content-section.active { display: block; }

@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(16px); }
    to { opacity: 1; transform: translateY(0); }
}

.section-intro {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    margin-bottom: 22px;
    flex-wrap: wrap;
}
.section-intro h2 {
    font-size: 26px;
    font-weight: 800;
    color: var(--text);
    letter-spacing: -0.4px;
}
.section-intro p { color: var(--muted); font-size: 14px; margin-top: 2px; }

/* ------------------------- Formulários ------------------------- */
.form-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 14px;
}
.form-group { display: flex; flex-direction: column; gap: 6px; }
.form-group.full { grid-column: 1 / -1; }
.form-group label {
    font-size: 12.5px;
    font-weight: 700;
    color: var(--text);
}
.form-input {
    width: 100%;
    padding: 12px 14px;
    border: 1px solid var(--line);
    border-radius: 12px;
    font-family: inherit;
    font-size: 14px;
    color: var(--text);
    background: #fff;
    transition: var(--transition);
    outline: none;
}
.form-input:focus {
    border-color: var(--red);
    box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.12);
}
.form-input::placeholder { color: #b0b4bf; }
textarea.form-input { resize: vertical; min-height: 46px; }
select.form-input { cursor: pointer; }

.form-range {
    width: 100%;
    accent-color: var(--red);
    cursor: pointer;
}
.range-labels {
    display: flex;
    justify-content: space-between;
    font-size: 12px;
    font-weight: 700;
    color: var(--muted);
}
.range-labels #hfMedsVal { color: var(--red); }
/* ------------------------- Minha Saúde ------------------------- */
.saude-grid {
    display: grid;
    grid-template-columns: 3fr 2fr;
    gap: 20px;
    align-items: start;
}
.form-card h3, .history-card h3 {
    font-size: 17px;
    font-weight: 800;
    margin-bottom: 18px;
    display: flex;
    align-items: center;
    gap: 8px;
}
.form-card h3 i, .history-card h3 i { color: var(--red); }

.history-list { display: flex; flex-direction: column; gap: 10px; }
.history-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background: var(--bg);
    border-radius: 12px;
    font-size: 13.5px;
    transition: var(--transition);
}
.history-item:hover { background: var(--red-soft); transform: translateX(4px); }
.history-item-date {
    font-weight: 800;
    color: var(--red-dark);
    font-size: 12px;
    min-width: 62px;
}
.history-item-info { flex: 1; color: var(--text); }
.history-item-info strong { font-weight: 700; }
.history-item-info small { color: var(--muted); }

/* ------------------------- Progresso ------------------------- */
.progress-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    margin-bottom: 20px;
}
.progress-stat {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 18px;
    display: flex;
    align-items: center;
    gap: 14px;
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
}
.progress-stat:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); }
.progress-stat-icon {
    width: 46px;
    height: 46px;
    border-radius: 12px;
    background: linear-gradient(135deg, var(--red), var(--red-dark));
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    flex-shrink: 0;
    box-shadow: 0 6px 14px rgba(220, 38, 38, 0.3);
}
.progress-stat-value {
    display: block;
    font-size: 20px;
    font-weight: 800;
    color: var(--text);
    line-height: 1.2;
}
.progress-stat-label {
    display: block;
    font-size: 12px;
    color: var(--muted);
}
.full-chart-card { min-width: 0; }

/* ------------------------- Consultas ------------------------- */
.appointments-list {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
}
.appointment-card {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 20px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
}
.appointment-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-md);
    border-color: rgba(220, 38, 38, 0.25);
}
.appointment-avatar {
    width: 54px;
    height: 54px;
    border-radius: 14px;
    background: linear-gradient(135deg, var(--black-3), var(--black));
    color: #fff;
    font-weight: 800;
    font-size: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.appointment-info { flex: 1; min-width: 0; }
.appointment-info h4 { font-size: 15.5px; font-weight: 800; color: var(--text); }
.appointment-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    font-size: 12.5px;
    color: var(--muted);
    margin-top: 4px;
}
.appointment-meta span { display: inline-flex; align-items: center; gap: 5px; }
.appointment-meta i { color: var(--red); }
.appointment-status {
    padding: 6px 13px;
    border-radius: 999px;
    font-size: 11.5px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    flex-shrink: 0;
}
.status-confirmado, .status-confirmed { background: rgba(5, 150, 105, 0.12); color: var(--success); }
.status-pendente { background: rgba(217, 119, 6, 0.12); color: var(--warning); }
.status-concluido { background: rgba(37, 99, 235, 0.12); color: var(--info); }
.status-cancelado { background: rgba(239, 68, 68, 0.12); color: var(--red); }
/* ------------------------- Conquistas ------------------------- */
.achievements-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
    gap: 16px;
    margin-bottom: 20px;
}
.achievement-card {
    position: relative;
    overflow: hidden;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    padding: 22px;
    text-align: center;
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
}
.achievement-card:hover { transform: translateY(-5px) rotate(-1deg); box-shadow: var(--shadow-md); }
.achievement-card::before {
    content: '';
    position: absolute;
    top: -40px;
    left: 50%;
    transform: translateX(-50%);
    width: 110px;
    height: 110px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(220, 38, 38, 0.18), transparent 70%);
}
.achievement-icon {
    width: 64px;
    height: 64px;
    margin: 0 auto 12px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--red), var(--red-deep));
    color: #fff;
    font-size: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 8px 18px rgba(220, 38, 38, 0.35);
    position: relative;
}
.achievement-title { font-size: 14.5px; font-weight: 800; color: var(--text); }
.achievement-date { font-size: 12px; color: var(--muted); margin-top: 3px; }

/* ------------------------- Metas ------------------------- */
.goals-card { margin-top: 4px; }
.inline-form {
    display: flex;
    gap: 12px;
    margin-bottom: 22px;
    flex-wrap: wrap;
}
.inline-form .form-input { flex: 1; min-width: 200px; }
.inline-form-3 .form-input:nth-child(2) { flex: 0 0 130px; }
.inline-form-3 .form-input:nth-child(3) { flex: 0 0 180px; }

.goals-list { display: flex; flex-direction: column; gap: 10px; }
.goal-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 16px;
    background: var(--bg);
    border: 1px solid transparent;
    border-radius: var(--radius);
    transition: var(--transition);
}
.goal-item:hover { border-color: rgba(220, 38, 38, 0.2); background: #fff; box-shadow: var(--shadow-sm); }
.goal-checkbox {
    width: 26px;
    height: 26px;
    border: 2px solid #c9ccd6;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
    flex-shrink: 0;
    background: #fff;
}
.goal-checkbox:hover { border-color: var(--red); }
.goal-checkbox.checked {
    background: linear-gradient(135deg, #10b981, #059669);
    border-color: #059669;
}
.goal-checkbox.checked::after {
    content: '✓';
    color: #fff;
    font-size: 13px;
    font-weight: 800;
}
.goal-progress { flex: 1; min-width: 0; }
.goal-title {
    font-weight: 700;
    color: var(--text);
    font-size: 14px;
    margin-bottom: 7px;
}
.goal-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 7px; }
.goal-pct { font-size: 12px; font-weight: 800; color: var(--red); }
.goal-bar {
    height: 8px;
    background: #e4e6ec;
    border-radius: 999px;
    overflow: hidden;
}
.goal-bar-fill {
    height: 100%;
    border-radius: 999px;
    background: linear-gradient(90deg, var(--red), var(--red-bright));
    transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
}
.goal-bar-fill::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.4), transparent);
    animation: goal-shine 2.4s ease infinite;
}
@keyframes goal-shine { 0% { transform: translateX(-100%); } 100% { transform: translateX(100%); } }

/* ------------------------- Lembretes ------------------------- */
.reminders-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 14px;
}
.reminder-card {
    position: relative;
    overflow: hidden;
    padding: 20px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface);
    transition: var(--transition);
}
.reminder-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-md); border-color: rgba(220, 38, 38, 0.25); }
.reminder-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.reminder-icon {
    width: 46px;
    height: 46px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    color: #fff;
}
.reminder-icon.medicamento { background: linear-gradient(135deg, var(--red), var(--red-deep)); box-shadow: 0 5px 12px rgba(220, 38, 38, 0.3); }
.reminder-icon.exame { background: linear-gradient(135deg, #f59e0b, #d97706); box-shadow: 0 5px 12px rgba(245, 158, 11, 0.3); }
.reminder-icon.outro { background: linear-gradient(135deg, var(--black-3), var(--black)); box-shadow: 0 5px 12px rgba(28, 28, 34, 0.3); }
.reminder-time {
    font-size: 20px;
    font-weight: 800;
    color: var(--text);
    letter-spacing: 0.5px;
}
.reminder-title { font-weight: 700; color: var(--text); font-size: 14.5px; }
.reminder-type-label {
    font-size: 11.5px;
    color: var(--muted);
    font-weight: 600;
    text-transform: capitalize;
    margin-top: 3px;
}

/* ------------------------- Estado vazio ------------------------- */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    gap: 10px;
    padding: 40px 20px;
    color: var(--muted);
}
.empty-state i { font-size: 38px; color: #c9ccd6; }
/* ------------------------- Modais ------------------------- */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(11, 11, 13, 0.6);
    backdrop-filter: blur(5px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 20px;
}
.modal-overlay.active { display: flex; animation: fadeIn 0.25s ease; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.modal {
    background: #fff;
    border-radius: var(--radius-lg);
    box-shadow: 0 30px 70px rgba(0, 0, 0, 0.4);
    width: 100%;
    max-width: 480px;
    max-height: 90vh;
    overflow-y: auto;
    animation: modalUp 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
@keyframes modalUp {
    from { opacity: 0; transform: translateY(24px) scale(0.97); }
}
.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 22px 26px;
    border-bottom: 1px solid var(--line);
}
.modal-header h3 {
    font-size: 18px;
    font-weight: 800;
    display: flex;
    align-items: center;
    gap: 10px;
}
.modal-header h3 i { color: var(--red); }
.modal-close {
    background: var(--bg);
    border: none;
    width: 36px;
    height: 36px;
    border-radius: 10px;
    cursor: pointer;
    color: var(--muted);
    transition: var(--transition);
}
.modal-close:hover { background: var(--red-soft); color: var(--red); }
.modal-body { padding: 26px; }

/* ------------------------- Toast ------------------------- */
.toast {
    position: fixed;
    bottom: 26px;
    right: 26px;
    z-index: 1200;
    background: var(--black-2);
    color: #fff;
    padding: 15px 22px;
    border-radius: 14px;
    font-size: 14px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 10px;
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.4);
    transform: translateY(120px);
    opacity: 0;
    transition: var(--transition);
    max-width: 360px;
    border-left: 4px solid var(--red);
}
.toast.visible { transform: translateY(0); opacity: 1; }
.toast.success { border-left-color: #10b981; }
.toast.error { border-left-color: var(--red); }
.toast i { font-size: 16px; }

/* ------------------------- Telemedicina ------------------------- */
.telemed-content { text-align: center; }
.telemed-icon {
    width: 74px;
    height: 74px;
    margin: 0 auto 16px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--red), var(--red-deep));
    color: #fff;
    font-size: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 12px 26px rgba(220, 38, 38, 0.4);
}
.telemed-content h4 { font-size: 18px; font-weight: 800; color: var(--text); margin-bottom: 8px; }
.telemed-content p { color: var(--muted); font-size: 14px; margin-bottom: 20px; }

/* ------------------------- Perfil ------------------------- */
.perfil-grid {
    display: grid;
    grid-template-columns: 320px 1fr;
    gap: 20px;
    align-items: start;
}
.perfil-card-main {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    text-align: center;
    transition: var(--transition);
}
.perfil-card-main:hover { box-shadow: var(--shadow-md); transform: translateY(-3px); }
.perfil-cover {
    height: 110px;
    background: linear-gradient(120deg, var(--black) 0%, #2a1113 55%, var(--red-dark) 130%);
    position: relative;
}
.perfil-cover::after {
    content: '';
    position: absolute;
    width: 160px;
    height: 160px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(220, 38, 38, 0.4), transparent 70%);
    right: -40px;
    top: -60px;
}
.perfil-avatar {
    width: 92px;
    height: 92px;
    border-radius: 50%;
    margin: -46px auto 0;
    background: linear-gradient(135deg, var(--red), var(--red-deep));
    color: #fff;
    font-size: 28px;
    font-weight: 800;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 5px solid #fff;
    box-shadow: 0 10px 24px rgba(220, 38, 38, 0.4);
    position: relative;
    z-index: 1;
    overflow: hidden;
}
.perfil-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
    border-radius: 50%;
    display: block;
}
.perfil-identity { padding: 14px 20px 18px; }
.perfil-identity h3 {
    font-size: 21px;
    font-weight: 800;
    color: var(--text);
    letter-spacing: -0.3px;
}
.perfil-role {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 12.5px;
    font-weight: 700;
    color: var(--red);
    background: var(--red-soft);
    padding: 6px 14px;
    border-radius: 999px;
    margin-top: 8px;
}
.perfil-stats {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    padding: 0 20px 22px;
}
.perfil-stat {
    background: var(--bg);
    border-radius: 12px;
    padding: 12px;
}
.perfil-stat-value {
    display: block;
    font-size: 19px;
    font-weight: 800;
    color: var(--text);
    line-height: 1.2;
}
.perfil-stat-label {
    display: block;
    font-size: 11px;
    font-weight: 700;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.6px;
    margin-top: 3px;
}

.perfil-info-card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    padding: 24px;
    transition: var(--transition);
}
.perfil-info-card:hover { box-shadow: var(--shadow-md); }
.perfil-info-card h3 {
    font-size: 16px;
    font-weight: 800;
    color: var(--text);
    display: flex;
    align-items: center;
    gap: 9px;
    margin-bottom: 18px;
}
.perfil-info-card h3 i { color: var(--red); }
.perfil-info-list, .perfil-health-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.perfil-info-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    background: var(--bg);
    border-radius: 12px;
    transition: var(--transition);
}
.perfil-info-item:hover { background: var(--red-soft); transform: translateX(4px); }
.perfil-info-icon {
    width: 38px;
    height: 38px;
    border-radius: 10px;
    background: linear-gradient(135deg, var(--red), var(--red-dark));
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    flex-shrink: 0;
    box-shadow: 0 4px 10px rgba(220, 38, 38, 0.3);
}

/* ============================================================
   NOTIFICAÇÕES CLICÁVEIS - DASHBOARD DO PACIENTE
   ============================================================ */

.patient-notification-list {
    display: grid;
    gap: 10px;
}

.patient-notification-item {
    width: 100%;
    display: grid;
    grid-template-columns: 42px minmax(0, 1fr) auto;
    align-items: center;
    gap: 12px;
    padding: 13px 14px;
    color: var(--text);
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 14px;
    text-align: left;
    font: inherit;
    cursor: pointer;
    transition: var(--transition);
}

.patient-notification-item:hover {
    border-color: rgba(220, 38, 38, 0.34);
    box-shadow: var(--shadow-sm);
    transform: translateY(-1px);
}

.patient-notification-icon {
    width: 42px;
    height: 42px;
    display: grid;
    place-items: center;
    border-radius: 12px;
    color: var(--red);
    background: var(--red-soft);
    font-size: 16px;
}

.patient-notification-icon.warning {
    color: #b45309;
    background: #fff7ed;
}

.patient-notification-icon.info {
    color: #2563eb;
    background: #eff6ff;
}

.patient-notification-icon.neutral {
    color: var(--muted);
    background: var(--bg);
}

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

.patient-notification-copy strong {
    color: var(--text);
    font-size: 13px;
    line-height: 1.35;
}

.patient-notification-copy small {
    color: var(--muted);
    font-size: 12px;
    line-height: 1.45;
}

.patient-notification-arrow {
    color: var(--muted);
    font-size: 11px;
}

html[data-theme="dark"] .patient-notification-item {
    background: var(--surface);
    border-color: var(--line);
}

html[data-theme="dark"] .patient-notification-icon.warning {
    color: #fbbf24;
    background: #3a2610;
}

html[data-theme="dark"] .patient-notification-icon.info {
    color: #60a5fa;
    background: #12243d;
}

@media (max-width: 560px) {
    .patient-notification-item {
        grid-template-columns: 38px minmax(0, 1fr) auto;
        gap: 10px;
        padding: 12px;
    }

    .patient-notification-icon {
        width: 38px;
        height: 38px;
    }
}


/* ============================================================
   Editor universal da foto do paciente - ADIÇÃO
   ============================================================ */
.perfil-avatar-editable,
.user-avatar-editable {
    cursor: pointer;
}

.perfil-avatar-editable {
    position: relative;
}

.perfil-avatar-camera {
    position: absolute;
    right: -2px;
    bottom: -2px;
    width: 30px;
    height: 30px;
    display: grid;
    place-items: center;
    border: 3px solid var(--surface, #fff);
    border-radius: 50%;
    color: #fff;
    background: var(--primary, #dc2626);
    font-size: 11px;
    box-shadow: 0 6px 16px rgba(0, 0, 0, .16);
    pointer-events: none;
}

.perfil-avatar-editable:focus-visible,
.user-avatar-editable:focus-visible {
    outline: 3px solid rgba(220, 38, 38, .24);
    outline-offset: 4px;
}
