/* Modo oscuro de ARVIA. Se activa con <html data-theme="dark"> (ver wwwroot/js/theme.js). */
.theme-btn { width: 44px; height: 44px; border: none; border-radius: 12px; background: #F1F5F9; color: #334155; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; }
.theme-btn .theme-icon-sun { display: none; }
html[data-theme="dark"] .theme-btn .theme-icon-sun { display: block; }
html[data-theme="dark"] .theme-btn .theme-icon-moon { display: none; }
.mobile-topbar .theme-btn { width: 38px; height: 38px; margin-left: auto; }
.mobile-topbar .theme-btn + .bell-wrap { margin-left: 0; }
.theme-fab { position: fixed; right: 16px; bottom: 16px; z-index: 2000; box-shadow: 0 6px 20px rgba(0,0,0,.2); }

html[data-theme="dark"] {
    --background: #0B1220; --surface: #111A2B; --border: #27364F; --text: #E5EDF7; --text-muted: #9FB0C6;
    --primary-dark: #0F4D60;
    color-scheme: dark;
}
html[data-theme="dark"] body { background: #0B1220; color: #E5EDF7; }
html[data-theme="dark"] a:not([class]) { color: #5EC8DB; }
html[data-theme="dark"] .theme-btn { background: #17233A; color: #FDE68A; }

/* ---- Estructura ---- */
html[data-theme="dark"] .sidebar,
html[data-theme="dark"] .topbar,
html[data-theme="dark"] .mobile-topbar,
html[data-theme="dark"] .navbar-custom,
html[data-theme="dark"] .footer-custom { background: #111A2B; border-color: #27364F; }
html[data-theme="dark"] .navbar-custom { background: rgba(17,26,43,.92); }
html[data-theme="dark"] .sidebar-divider { background: #27364F; }
html[data-theme="dark"] .sidebar-user { border-top-color: #27364F; }
html[data-theme="dark"] .sidebar-logo, html[data-theme="dark"] .navbar-logo, html[data-theme="dark"] .mobile-topbar img { filter: brightness(1.35); }
html[data-theme="dark"] .sidebar-brand, html[data-theme="dark"] .navbar-brand, html[data-theme="dark"] .footer-brand,
html[data-theme="dark"] .mobile-topbar strong { color: #5EC8DB !important; }
html[data-theme="dark"] .nav-item { color: #9FB0C6; }
html[data-theme="dark"] .nav-item:hover { background: #17233A; }
html[data-theme="dark"] .nav-item.active { background: #155E75; color: #fff; }
html[data-theme="dark"] .mobile-menu-btn { background: #17233A; border-color: #27364F; color: #E5EDF7; }
html[data-theme="dark"] .logout-btn { color: #7C8DA6; }
html[data-theme="dark"] .logout-btn:hover { background: #3B1A1F; color: #FCA5A5; }
html[data-theme="dark"] .user-role, html[data-theme="dark"] .page-subtitle, html[data-theme="dark"] .dashboard-date { color: #9FB0C6; }
html[data-theme="dark"] .page-title, html[data-theme="dark"] .dashboard-header h1, html[data-theme="dark"] .dashboard-page h1,
html[data-theme="dark"] .section-title h3, html[data-theme="dark"] .stat-card h2 { color: #E5EDF7; }
html[data-theme="dark"] .search-box input { background: #17233A; border-color: #27364F; color: #E5EDF7; }
html[data-theme="dark"] .notification-btn { background: #17233A; color: #E5EDF7; }
html[data-theme="dark"] .sidebar-overlay.open { background: rgba(0,0,0,.6); }
html[data-theme="dark"] .navbar-links a { color: #9FB0C6; }
html[data-theme="dark"] .navbar-links a:hover, html[data-theme="dark"] .nav-login { color: #5EC8DB; }

/* ---- Tarjetas y contenido ---- */
html[data-theme="dark"] .stat-card, html[data-theme="dark"] .pet-card, html[data-theme="dark"] .appointment-card,
html[data-theme="dark"] .activity-section, html[data-theme="dark"] .form-card, html[data-theme="dark"] .empty-state,
html[data-theme="dark"] .vaccine-card, html[data-theme="dark"] .benefit-card, html[data-theme="dark"] .pet-card-large,
html[data-theme="dark"] .dashboard-card, html[data-theme="dark"] .activity-item { background: #111A2B; border-color: #27364F; box-shadow: none; }
html[data-theme="dark"] .empty-state { border-style: dashed; color: #9FB0C6; }
html[data-theme="dark"] .empty-state small, html[data-theme="dark"] .empty-state .svg-icon,
html[data-theme="dark"] .stat-card small, html[data-theme="dark"] .pet-info small, html[data-theme="dark"] .appointment-card small { color: #7C8DA6; }
html[data-theme="dark"] .stat-card p, html[data-theme="dark"] .pet-info span, html[data-theme="dark"] .pet-card span, html[data-theme="dark"] .vaccine-card span { color: #9FB0C6; }
html[data-theme="dark"] .pet-info strong, html[data-theme="dark"] .appointment-card p { color: #E5EDF7; }
html[data-theme="dark"] .appointment-card strong, html[data-theme="dark"] .section-title a { color: #5EC8DB; }
html[data-theme="dark"] .stat-icon, html[data-theme="dark"] .pet-avatar, html[data-theme="dark"] .icon { background: #12333B; color: #5EEAD4; }
html[data-theme="dark"] .activity-item { color: #E5EDF7; border-bottom-color: #27364F; }
html[data-theme="dark"] .pet-status.healthy { background: #0F2E26; color: #6EE7B7; }
html[data-theme="dark"] .pet-status.warning { background: #3A2F0B; color: #FCD34D; }
html[data-theme="dark"] .tag.consultation { background: #0C2A3F; color: #7DD3FC; }
html[data-theme="dark"] .tag.lab { background: #2A1B3F; color: #D8B4FE; }
html[data-theme="dark"] .tag.vaccine { background: #0F2E26; color: #6EE7B7; }
html[data-theme="dark"] .tag.diagnosis { background: #3B1A1F; color: #FCA5A5; }

/* ---- Formularios ---- */
html[data-theme="dark"] input:not([type="checkbox"]):not([type="radio"]), html[data-theme="dark"] select, html[data-theme="dark"] textarea {
    background: #0E1829; color: #E5EDF7; border-color: #34466A;
}
html[data-theme="dark"] input::placeholder, html[data-theme="dark"] textarea::placeholder { color: #6B7C95; }
html[data-theme="dark"] input:focus, html[data-theme="dark"] select:focus, html[data-theme="dark"] textarea:focus { border-color: #5EC8DB; outline-color: #5EC8DB; }
html[data-theme="dark"] input:disabled, html[data-theme="dark"] select:disabled { background: #111A2B; color: #7C8DA6; }
html[data-theme="dark"] .form-card label, html[data-theme="dark"] label { color: #C9D6E8; }
html[data-theme="dark"] .auth-error, html[data-theme="dark"] .form-card .auth-error { background: #3B1A1F; border-color: #7F2D35; color: #FCA5A5; }
html[data-theme="dark"] .auth-success { background: #0F2E26; border-color: #1E6B55; color: #6EE7B7; }
html[data-theme="dark"] .field-error, html[data-theme="dark"] .form-card .field-error { color: #FCA5A5; }
html[data-theme="dark"] .btn-outline-custom, html[data-theme="dark"] .btn-light { background: transparent; color: #E5EDF7; border-color: #27364F; }

/* ---- Notificaciones ---- */
html[data-theme="dark"] .bell-panel { background: #111A2B; border-color: #27364F; box-shadow: 0 12px 32px rgba(0,0,0,.5); }
html[data-theme="dark"] .bell-head, html[data-theme="dark"] .bell-item { border-color: #27364F; }
html[data-theme="dark"] .bell-item { color: #E5EDF7; }
html[data-theme="dark"] .bell-item.unread { background: #0E2A33; }
html[data-theme="dark"] .bell-item:hover { background: #17233A; }
html[data-theme="dark"] .bell-title, html[data-theme="dark"] .bell-readall { color: #5EC8DB; }
html[data-theme="dark"] .bell-body { color: #9FB0C6; }
html[data-theme="dark"] .bell-time { color: #7C8DA6; }
html[data-theme="dark"] .bell-empty { color: #9FB0C6; }
html[data-theme="dark"] .bell-perm { background: #3A3110; border-color: #27364F; }
html[data-theme="dark"] .bell-enable, html[data-theme="dark"] .bell-perm small { color: #FDE68A; }

/* ---- Landing ---- */
html[data-theme="dark"] .hero-badge { background: #12333B; color: #5EEAD4; }
html[data-theme="dark"] .hero h1 { color: #5EC8DB; }
html[data-theme="dark"] .hero-image-wrapper { background: #17233A; }
html[data-theme="dark"] .step-number { background: #12333B; color: #5EEAD4; }

/* ---- Login / registro ---- */
html[data-theme="dark"] .auth-form h2, html[data-theme="dark"] .forgot-card h1, html[data-theme="dark"] h1, html[data-theme="dark"] h3 { color: #E5EDF7; }
html[data-theme="dark"] .subtitle, html[data-theme="dark"] .forgot-subtitle, html[data-theme="dark"] .register-link { color: #9FB0C6; }
html[data-theme="dark"] .form-group label { color: #C9D6E8; }
html[data-theme="dark"] .login-options a, html[data-theme="dark"] .register-link a, html[data-theme="dark"] .back-link, html[data-theme="dark"] .login-link a { color: #5EC8DB; }
html[data-theme="dark"] .forgot-wrapper { background: #0B1220; }
html[data-theme="dark"] .forgot-card, html[data-theme="dark"] .register-form, html[data-theme="dark"] .type-card { background: #111A2B; border-color: #27364F; }
html[data-theme="dark"] .type-card.active { background: #0E2A33; border-color: #5EC8DB; }
html[data-theme="dark"] .type-icon { background: #17233A; }
html[data-theme="dark"] .btn-google, html[data-theme="dark"] .demo-buttons button { background: #17233A; color: #E5EDF7; border-color: #27364F; }
html[data-theme="dark"] .demo-card, html[data-theme="dark"] .info-box { background: #0E2A33; border-color: #1E5566; color: #E5EDF7; }
html[data-theme="dark"] .demo-card p, html[data-theme="dark"] .checkmark { color: #5EC8DB; }

/* ---- Páginas públicas de verificación y administración ---- */
html[data-theme="dark"] .c, html[data-theme="dark"] .card { background: #111A2B; box-shadow: none; color: #E5EDF7; }
html[data-theme="dark"] .ok { color: #5EEAD4; }
html[data-theme="dark"] .bad { color: #FCA5A5; }
html[data-theme="dark"] .warn { color: #FCD34D; }
html[data-theme="dark"] .c small, html[data-theme="dark"] dt, html[data-theme="dark"] .k { color: #9FB0C6; }
html[data-theme="dark"] a.doc { color: #5EC8DB; }
html[data-theme="dark"] td, html[data-theme="dark"] th { border-color: #27364F; }
html[data-theme="dark"] .a { background: #155E75; color: #fff; }
html[data-theme="dark"] .r { background: transparent; color: #FCA5A5; border-color: #7F2D35; }

/* ---- Mapas (Leaflet) ---- */
html[data-theme="dark"] .leaflet-tile-pane { filter: invert(1) hue-rotate(180deg) brightness(.92) contrast(.9); }
html[data-theme="dark"] .leaflet-container { background: #1b2433; }
html[data-theme="dark"] .leaflet-popup-content-wrapper, html[data-theme="dark"] .leaflet-popup-tip { background: #17233A; color: #E5EDF7; }
html[data-theme="dark"] .leaflet-popup-content a { color: #5EC8DB; }
html[data-theme="dark"] .leaflet-bar a { background: #17233A; color: #E5EDF7; border-color: #27364F; }
html[data-theme="dark"] .leaflet-control-attribution { background: rgba(17,26,43,.8); color: #9FB0C6; }
html[data-theme="dark"] .leaflet-control-attribution a { color: #5EC8DB; }

/* ---- Gráfica de peso (SVG con colores en atributos) ---- */
html[data-theme="dark"] svg text[fill="#64748B"] { fill: #9FB0C6; }
html[data-theme="dark"] svg text[fill="#134E4A"] { fill: #99F6E4; }
html[data-theme="dark"] svg line[stroke="#E2E8F0"] { stroke: #27364F; }
html[data-theme="dark"] svg path[stroke="#0F766E"] { stroke: #2DD4BF; }
html[data-theme="dark"] svg circle[stroke="#0F766E"] { stroke: #2DD4BF; fill: #111A2B; }

/* ---- Colores escritos directamente en style="..." ---- */
html[data-theme="dark"] [style^="background:#fff" i],
html[data-theme="dark"] [style*=";background:#fff" i],
html[data-theme="dark"] [style*="; background:#fff" i],
html[data-theme="dark"] [style*=" background:#fff" i],
html[data-theme="dark"] [style*=" background: #fff" i],
html[data-theme="dark"] [style^="background-color:#fff" i],
html[data-theme="dark"] [style*=";background-color:#fff" i],
html[data-theme="dark"] [style*="; background-color:#fff" i],
html[data-theme="dark"] [style*=" background-color:#fff" i],
html[data-theme="dark"] [style*=" background-color: #fff" i] { background: #17233A !important; }
html[data-theme="dark"] [style^="background:white" i],
html[data-theme="dark"] [style*=";background:white" i],
html[data-theme="dark"] [style*="; background:white" i],
html[data-theme="dark"] [style*=" background:white" i],
html[data-theme="dark"] [style*=" background: white" i],
html[data-theme="dark"] [style^="background-color:white" i],
html[data-theme="dark"] [style*=";background-color:white" i],
html[data-theme="dark"] [style*="; background-color:white" i],
html[data-theme="dark"] [style*=" background-color:white" i],
html[data-theme="dark"] [style*=" background-color: white" i] { background: #17233A !important; }
html[data-theme="dark"] [style^="background:#F1F5F9" i],
html[data-theme="dark"] [style*=";background:#F1F5F9" i],
html[data-theme="dark"] [style*="; background:#F1F5F9" i],
html[data-theme="dark"] [style*=" background:#F1F5F9" i],
html[data-theme="dark"] [style*=" background: #F1F5F9" i],
html[data-theme="dark"] [style^="background-color:#F1F5F9" i],
html[data-theme="dark"] [style*=";background-color:#F1F5F9" i],
html[data-theme="dark"] [style*="; background-color:#F1F5F9" i],
html[data-theme="dark"] [style*=" background-color:#F1F5F9" i],
html[data-theme="dark"] [style*=" background-color: #F1F5F9" i] { background: #17233A !important; }
html[data-theme="dark"] [style^="background:#ECFEFF" i],
html[data-theme="dark"] [style*=";background:#ECFEFF" i],
html[data-theme="dark"] [style*="; background:#ECFEFF" i],
html[data-theme="dark"] [style*=" background:#ECFEFF" i],
html[data-theme="dark"] [style*=" background: #ECFEFF" i],
html[data-theme="dark"] [style^="background-color:#ECFEFF" i],
html[data-theme="dark"] [style*=";background-color:#ECFEFF" i],
html[data-theme="dark"] [style*="; background-color:#ECFEFF" i],
html[data-theme="dark"] [style*=" background-color:#ECFEFF" i],
html[data-theme="dark"] [style*=" background-color: #ECFEFF" i] { background: #0E2A33 !important; }
html[data-theme="dark"] [style^="background:#FEF9C3" i],
html[data-theme="dark"] [style*=";background:#FEF9C3" i],
html[data-theme="dark"] [style*="; background:#FEF9C3" i],
html[data-theme="dark"] [style*=" background:#FEF9C3" i],
html[data-theme="dark"] [style*=" background: #FEF9C3" i] { background: #3A3110 !important; color: #FDE68A !important; }
html[data-theme="dark"] [style^="background:#FEF2F2" i],
html[data-theme="dark"] [style*=";background:#FEF2F2" i],
html[data-theme="dark"] [style*="; background:#FEF2F2" i],
html[data-theme="dark"] [style*=" background:#FEF2F2" i],
html[data-theme="dark"] [style*=" background: #FEF2F2" i] { background: #3B1A1F !important; }
html[data-theme="dark"] [style^="background:#ECFDF5" i],
html[data-theme="dark"] [style*=";background:#ECFDF5" i],
html[data-theme="dark"] [style*="; background:#ECFDF5" i],
html[data-theme="dark"] [style*=" background:#ECFDF5" i],
html[data-theme="dark"] [style*=" background: #ECFDF5" i] { background: #0F2E26 !important; }
html[data-theme="dark"] [style^="color:#475569" i],
html[data-theme="dark"] [style*=";color:#475569" i],
html[data-theme="dark"] [style*="; color:#475569" i],
html[data-theme="dark"] [style*=" color:#475569" i],
html[data-theme="dark"] [style*=" color: #475569" i] { color: #9FB0C6 !important; }
html[data-theme="dark"] [style^="color:#64748B" i],
html[data-theme="dark"] [style*=";color:#64748B" i],
html[data-theme="dark"] [style*="; color:#64748B" i],
html[data-theme="dark"] [style*=" color:#64748B" i],
html[data-theme="dark"] [style*=" color: #64748B" i] { color: #9FB0C6 !important; }
html[data-theme="dark"] [style^="color:#94A3B8" i],
html[data-theme="dark"] [style*=";color:#94A3B8" i],
html[data-theme="dark"] [style*="; color:#94A3B8" i],
html[data-theme="dark"] [style*=" color:#94A3B8" i],
html[data-theme="dark"] [style*=" color: #94A3B8" i] { color: #7C8DA6 !important; }
html[data-theme="dark"] [style^="color:#1E293B" i],
html[data-theme="dark"] [style*=";color:#1E293B" i],
html[data-theme="dark"] [style*="; color:#1E293B" i],
html[data-theme="dark"] [style*=" color:#1E293B" i],
html[data-theme="dark"] [style*=" color: #1E293B" i] { color: #E5EDF7 !important; }
html[data-theme="dark"] [style^="color:#334155" i],
html[data-theme="dark"] [style*=";color:#334155" i],
html[data-theme="dark"] [style*="; color:#334155" i],
html[data-theme="dark"] [style*=" color:#334155" i],
html[data-theme="dark"] [style*=" color: #334155" i] { color: #C9D6E8 !important; }
html[data-theme="dark"] [style^="color:#155E75" i],
html[data-theme="dark"] [style*=";color:#155E75" i],
html[data-theme="dark"] [style*="; color:#155E75" i],
html[data-theme="dark"] [style*=" color:#155E75" i],
html[data-theme="dark"] [style*=" color: #155E75" i] { color: #5EC8DB !important; }
html[data-theme="dark"] [style^="color:#B91C1C" i],
html[data-theme="dark"] [style*=";color:#B91C1C" i],
html[data-theme="dark"] [style*="; color:#B91C1C" i],
html[data-theme="dark"] [style*=" color:#B91C1C" i],
html[data-theme="dark"] [style*=" color: #B91C1C" i] { color: #FCA5A5 !important; }
html[data-theme="dark"] [style^="color:#0F766E" i],
html[data-theme="dark"] [style*=";color:#0F766E" i],
html[data-theme="dark"] [style*="; color:#0F766E" i],
html[data-theme="dark"] [style*=" color:#0F766E" i],
html[data-theme="dark"] [style*=" color: #0F766E" i] { color: #5EEAD4 !important; }
html[data-theme="dark"] [style^="color:#0F9D8A" i],
html[data-theme="dark"] [style*=";color:#0F9D8A" i],
html[data-theme="dark"] [style*="; color:#0F9D8A" i],
html[data-theme="dark"] [style*=" color:#0F9D8A" i],
html[data-theme="dark"] [style*=" color: #0F9D8A" i] { color: #5EEAD4 !important; }
html[data-theme="dark"] [style^="color:#059669" i],
html[data-theme="dark"] [style*=";color:#059669" i],
html[data-theme="dark"] [style*="; color:#059669" i],
html[data-theme="dark"] [style*=" color:#059669" i],
html[data-theme="dark"] [style*=" color: #059669" i] { color: #6EE7B7 !important; }
html[data-theme="dark"] [style^="color:#854D0E" i],
html[data-theme="dark"] [style*=";color:#854D0E" i],
html[data-theme="dark"] [style*="; color:#854D0E" i],
html[data-theme="dark"] [style*=" color:#854D0E" i],
html[data-theme="dark"] [style*=" color: #854D0E" i] { color: #FDE68A !important; }
html[data-theme="dark"] [style^="color:#B45309" i],
html[data-theme="dark"] [style*=";color:#B45309" i],
html[data-theme="dark"] [style*="; color:#B45309" i],
html[data-theme="dark"] [style*=" color:#B45309" i],
html[data-theme="dark"] [style*=" color: #B45309" i] { color: #FCD34D !important; }
html[data-theme="dark"] [style*="#E2E8F0" i] { border-color: #27364F !important; }
html[data-theme="dark"] [style*="#CBD5E1" i] { border-color: #27364F !important; }
html[data-theme="dark"] [style*="#E5E7EB" i] { border-color: #27364F !important; }
html[data-theme="dark"] [style*="border:1px solid #FCA5A5" i] { border-color: #7F2D35 !important; }

/* Historial */
html[data-theme="dark"] .hist-wrap { background:#1E293B; border-color:#334155; }
html[data-theme="dark"] table.hist th { background:#0F172A; color:#94A3B8; border-bottom-color:#334155; }
html[data-theme="dark"] table.hist td { color:#CBD5E1; border-bottom-color:#273449; }
html[data-theme="dark"] table.hist tr:hover td { background:#243247; }
html[data-theme="dark"] .hist-date { color:#67E8F9; }
html[data-theme="dark"] .hist-title { color:#F1F5F9; }
html[data-theme="dark"] .hist-desc { color:#94A3B8; }
html[data-theme="dark"] .hist-back { color:#94A3B8; }
html[data-theme="dark"] .chip { background:#1E293B; color:#CBD5E1; border-color:#475569; }
html[data-theme="dark"] .chip.on { background:#0E7490; color:#fff; border-color:#0E7490; }
html[data-theme="dark"] .hist-filters input { background:#0F172A; color:#E2E8F0; border-color:#475569; }

/* Gráfica de peso por método */
html[data-theme="dark"] svg.weight-chart .wc-pt { fill: #111A2B; }
html[data-theme="dark"] svg.weight-chart line.wc-trend { stroke: #9FB0C6; }
html[data-theme="dark"] svg.weight-chart [stroke="#4F46E5"] { stroke: #A5B4FC; }
html[data-theme="dark"] svg.weight-chart [stroke="#D97706"] { stroke: #FCD34D; }
html[data-theme="dark"] .wc-notes { color: #9FB0C6 !important; }
html[data-theme="dark"] .wc-notes b[style*="#4F46E5"] { color: #A5B4FC !important; }
html[data-theme="dark"] .wc-notes b[style*="#D97706"] { color: #FCD34D !important; }
html[data-theme="dark"] .wc-notes b[style*="#0F766E"] { color: #5EEAD4 !important; }
