/* ============================================================
   Modo oscuro de la app (html.theme-dark)
   Se activa desde el menú de usuario; se guarda en localStorage.
   ============================================================ */
html.theme-dark{
  --ink:#eef1f7;--muted:#98a2b3;--line:rgba(255,255,255,.1);--surface:#131c31;
  --bg:#0b1220;--card:#131c31;--card-2:#182339;--card-3:#1d2a44;
  --line-2:rgba(255,255,255,.16);--txt-2:#c3cad8;--txt-3:#8b94a8;--blue-l:#7f9dff;
  color-scheme:dark;
}
html.theme-dark body{background:var(--bg);color:var(--ink)}
html.theme-dark h1,html.theme-dark h2,html.theme-dark h3{color:#fff}
html.theme-dark .text-link{color:var(--blue-l)}
html.theme-dark .muted-copy,html.theme-dark .app-heading p,html.theme-dark .stat-hint,html.theme-dark .cell-stack small,html.theme-dark .form-fields .helptext,html.theme-dark .empty-state{color:var(--txt-3)}
html.theme-dark .empty-state h3{color:#fff}

/* Header y navegación */
html.theme-dark .site-header{background:rgba(11,18,32,.82);border-bottom-color:var(--line);backdrop-filter:blur(16px);-webkit-backdrop-filter:blur(16px)}
html.theme-dark .brand{color:#fff}
html.theme-dark .brand>span:last-child>span{color:var(--blue-l)}
html.theme-dark .nav a:not(.button),html.theme-dark .nav-link{color:var(--txt-2)}
html.theme-dark .nav>a:not(.button):hover{color:#fff}
html.theme-dark .nav-toggle{background:var(--card);border-color:var(--line-2)}
html.theme-dark .nav-toggle-bar{background:#fff}
html.theme-dark .user-menu-toggle{background:var(--card);border-color:var(--line-2);color:#fff}
html.theme-dark .user-menu-toggle:hover{background:var(--card-2);border-color:rgba(255,255,255,.3)}
html.theme-dark .user-menu-caret{border-top-color:var(--txt-2)}
html.theme-dark .user-menu-panel{background:var(--card);border-color:var(--line-2);box-shadow:0 20px 50px rgba(0,0,0,.5)}
html.theme-dark .user-menu-panel a,html.theme-dark .user-menu-panel .nav-link{color:var(--txt-2)}
html.theme-dark .user-menu-panel a:hover,html.theme-dark .user-menu-panel .nav-link:hover{background:var(--card-3);color:#fff}
html.theme-dark .user-menu-panel form{border-top-color:var(--line)}
html.theme-dark .user-menu-panel form .nav-link{color:#fda29b}
html.theme-dark .button-outline{background:var(--card);border-color:var(--line-2);color:#fff!important}
html.theme-dark .button-outline:hover{background:var(--card-2)}
html.theme-dark .button-light{background:#fff;color:var(--blue)!important}
@media(max-width:950px){
  html.theme-dark .site-header{background:var(--bg)}
  html.theme-dark .nav{background:var(--card);border-bottom-color:var(--line)}
  html.theme-dark .nav>a,html.theme-dark .nav form{border-bottom-color:var(--line)}
  html.theme-dark .nav-backdrop{background:rgba(0,0,0,.6)}
  html.theme-dark .user-menu-panel{border-color:var(--line)}
}

/* Avisos */
html.theme-dark .aviso-pago{background:rgba(181,71,8,.16);color:#fec84b;border-bottom-color:rgba(254,200,75,.25)}
html.theme-dark .aviso-pago-error{background:rgba(180,35,24,.18);color:#fda29b;border-bottom-color:rgba(253,162,155,.3)}
html.theme-dark .aviso-pago-btn{background:rgba(255,255,255,.06);border-color:rgba(254,200,75,.5);color:#fec84b!important}
html.theme-dark .aviso-pago-btn:hover{background:rgba(254,200,75,.12);border-color:#fec84b;color:#fff!important}
html.theme-dark .aviso-pago .text-link{color:inherit;text-decoration:underline}
html.theme-dark .test-banner{background:rgba(49,87,213,.14);border-color:rgba(127,157,255,.3);color:var(--txt-2)}
html.theme-dark .test-banner b{color:var(--blue-l)}
html.theme-dark .warning-label{background:rgba(181,71,8,.18);color:#fec84b}

/* Onboarding */
html.theme-dark .onboarding-card{background:linear-gradient(120deg,rgba(49,87,213,.22),var(--card) 75%);border-color:rgba(127,157,255,.3)}
html.theme-dark .onboarding-card>.onboarding-copy>p{color:var(--txt-2)}
html.theme-dark .onboarding-steps li{color:var(--txt-2)}
html.theme-dark .onboarding-steps i{background:var(--card);border-color:rgba(127,157,255,.45);color:var(--blue-l)}
html.theme-dark .onboarding-steps li.is-done{color:#6ce9a6}
html.theme-dark .onboarding-cta small{color:var(--txt-3)}

/* Tarjetas, paneles y tablas */
html.theme-dark .stat-card,html.theme-dark .panel,html.theme-dark .form-card,html.theme-dark .auth-card,html.theme-dark .admin-plan-card,html.theme-dark .admin-chart-card,html.theme-dark .monotributo-card,html.theme-dark .monotributo-form,html.theme-dark .arca-block,html.theme-dark .openai-option{background:var(--card);border-color:var(--line);box-shadow:none}
html.theme-dark .stat-card:hover{border-color:var(--line-2);box-shadow:0 20px 44px rgba(0,0,0,.45)}
html.theme-dark .stat-card small,html.theme-dark .monotributo-card small{color:var(--txt-3)}
html.theme-dark .stat-card strong{color:#fff}
html.theme-dark .data-table th{color:var(--txt-3);border-bottom-color:var(--line)}
html.theme-dark .data-table td{border-bottom-color:var(--line)}
html.theme-dark .data-table tbody tr:hover{background:rgba(255,255,255,.035)}
html.theme-dark .status{background:rgba(8,122,85,.22);color:#6ce9a6}
html.theme-dark .status-borrador{background:rgba(255,255,255,.08);color:var(--txt-2)}
html.theme-dark .status-rechazada,html.theme-dark .status-anulada{background:rgba(180,35,24,.22);color:#fda29b}
html.theme-dark .action-chip{background:var(--card-2);border-color:var(--line-2);color:#fff}
html.theme-dark .action-chip:hover{background:var(--card-3);border-color:rgba(255,255,255,.3)}
html.theme-dark .action-chip-danger{border-color:rgba(253,162,155,.5);color:#fda29b}
html.theme-dark .action-chip-danger:hover{background:rgba(180,35,24,.2)}
html.theme-dark .email-estado-ok{color:#6ce9a6}
html.theme-dark .filter-links .text-link{color:var(--txt-3)}
html.theme-dark .filter-links .text-link.is-active{color:var(--blue-l)}
html.theme-dark .metric-list>div{border-bottom-color:var(--line)}
html.theme-dark .metric-list span{color:var(--txt-2)}
html.theme-dark .metric-list span em{color:var(--txt-3)}
html.theme-dark .admin-nav{border-bottom-color:var(--line)}
html.theme-dark .admin-kicker{color:var(--blue-l)}
html.theme-dark .admin-chart-card h3{color:#fff}
html.theme-dark .admin-check{color:var(--txt-2)}
html.theme-dark .admin-plan-grid label{color:var(--txt-2)}

/* Formularios */
html.theme-dark .form-fields label,html.theme-dark .admin-cred-grid label,html.theme-dark .monotributo-form-fields label,html.theme-dark .voice-sheet-form label{color:var(--txt-2)}
html.theme-dark .form-fields input,html.theme-dark .form-fields select,html.theme-dark .form-fields textarea,
html.theme-dark .search-bar input[type=search],html.theme-dark .admin-cred-grid input,html.theme-dark .admin-field-row select,
html.theme-dark .admin-plan-grid input[type=text],html.theme-dark .admin-plan-grid input[type=number],
html.theme-dark .monotributo-form-fields input,html.theme-dark .monotributo-form-fields select,
html.theme-dark .voice-sheet-form input,html.theme-dark .voice-sheet-form select,html.theme-dark .arca-pv-field .arca-pv-input{background:var(--card-2);border-color:var(--line-2);color:#fff}
html.theme-dark .form-fields input:focus,html.theme-dark .form-fields select:focus,html.theme-dark .search-bar input[type=search]:focus,html.theme-dark .admin-cred-grid input:focus,html.theme-dark .arca-pv-field .arca-pv-input:focus{outline-color:rgba(127,157,255,.35);border-color:var(--blue-l)}
html.theme-dark input::placeholder,html.theme-dark textarea::placeholder{color:var(--txt-3)}
html.theme-dark .form-fields ul.errorlist,html.theme-dark .form-error{color:#fda29b}
html.theme-dark .condicion-option,html.theme-dark .plan-option{background:var(--card);border-color:var(--line-2)}
html.theme-dark .condicion-option:hover,html.theme-dark .plan-option:hover{border-color:rgba(127,157,255,.5)}
html.theme-dark .condicion-option:has(input:checked),html.theme-dark .plan-option:has(input:checked){border-color:var(--blue-l);box-shadow:0 0 0 4px rgba(127,157,255,.18)}
html.theme-dark .condicion-option-body small,html.theme-dark .plan-option-detail,html.theme-dark .plan-option-price small{color:var(--txt-3)}
html.theme-dark .condicion-option.is-disabled:hover,html.theme-dark .condicion-option:has(input:disabled):hover{border-color:var(--line-2)}
html.theme-dark .envio-email-box{background:linear-gradient(180deg,var(--card-2),var(--card));border-color:var(--line-2)}
html.theme-dark .envio-email-head strong{color:#fff}
html.theme-dark .envio-email-detalle-row input[type=email]{background:var(--card-2);border-color:var(--line-2);color:#fff}
html.theme-dark .plan-option-check{background:var(--card-2);border-color:var(--line-2)}
html.theme-dark .wizard-step-dot{background:var(--card);border-color:var(--line-2);color:var(--txt-3)}
html.theme-dark .wizard-steps li:not(:last-child)::after{background:var(--line-2)}
html.theme-dark .wizard-steps li.is-current .wizard-step-dot{box-shadow:0 0 0 4px rgba(127,157,255,.2)}
html.theme-dark .wizard-step-label{color:var(--txt-3)}
html.theme-dark .wizard-steps li.is-current .wizard-step-label,html.theme-dark .wizard-steps li.is-done .wizard-step-label{color:#fff}
html.theme-dark .openai-option:has(input:checked){background:rgba(49,87,213,.18);border-color:var(--blue-l);box-shadow:0 0 0 3px rgba(127,157,255,.15)}
html.theme-dark .openai-option small{color:var(--txt-3)}
html.theme-dark .openai-vel{color:#fff}

/* Auth */
html.theme-dark .auth-page{background:radial-gradient(circle at 80% 10%,rgba(49,87,213,.25),transparent 45%),var(--bg)}
html.theme-dark .auth-page::before{background:rgba(49,87,213,.18)}
html.theme-dark .auth-page::after{background:rgba(200,242,106,.1)}
html.theme-dark .auth-card{box-shadow:0 30px 70px rgba(0,0,0,.5)}
html.theme-dark .auth-card>p{color:var(--txt-3)}
html.theme-dark .auth-icon{background:rgba(49,87,213,.18);border-color:rgba(127,157,255,.3);color:var(--blue-l)}

/* Monotributo */
html.theme-dark .monotributo-card strong{color:#fff}
html.theme-dark .monotributo-card>span,html.theme-dark .monotributo-note,html.theme-dark .monotributo-cuota{color:var(--txt-2)}
html.theme-dark .progress-track{background:rgba(255,255,255,.1)}
html.theme-dark .monotributo-warn{background:rgba(180,35,24,.18);color:#fda29b}
html.theme-dark .monotributo-table tr.is-actual{background:rgba(49,87,213,.16)}
html.theme-dark .monotributo-table tr.is-proy{background:rgba(181,71,8,.14)}
html.theme-dark .mono-tag{background:rgba(49,87,213,.25);color:var(--blue-l)}
html.theme-dark .mono-tag-proy{background:rgba(181,71,8,.2);color:#fec84b}

/* Guía ARCA */
html.theme-dark .arca-summary{background:rgba(49,87,213,.14);border-color:rgba(127,157,255,.3)}
html.theme-dark .arca-summary small{color:var(--txt-3)}
html.theme-dark .arca-part{background:rgba(49,87,213,.25);color:var(--blue-l)}
html.theme-dark .arca-block-head p,html.theme-dark .arca-step-copy p,html.theme-dark .arca-step-copy li{color:var(--txt-2)}
html.theme-dark .arca-step-fig{background:var(--card-2);border-color:var(--line)}
html.theme-dark .arca-step-fig figcaption{border-top-color:var(--line);color:var(--txt-3)}
html.theme-dark .arca-note{background:rgba(181,71,8,.14);border-color:rgba(254,200,75,.3);color:#fde68a}
html.theme-dark .arca-note b{color:#fec84b}
html.theme-dark .arca-alert{background:rgba(180,35,24,.16);border-color:rgba(253,162,155,.45)}
html.theme-dark .arca-alert-title,html.theme-dark .arca-alert-lead,html.theme-dark .arca-alert-hint{color:#fda29b}
html.theme-dark .arca-skip-verify{background:rgba(49,87,213,.16);border-color:rgba(127,157,255,.35);color:var(--blue-l)}
html.theme-dark .arca-pv-field .helptext,html.theme-dark .arca-disclaimer{color:var(--txt-3)}
html.theme-dark .arca-step-copy .arca-cuit-box{background:#fff;color:var(--bg)}

/* Factura por voz (hoja inferior en móvil) */
html.theme-dark .voice-sheet{background:var(--card);box-shadow:0 -18px 50px rgba(0,0,0,.6)}
html.theme-dark .voice-sheet-head h2{color:var(--txt-3)}
html.theme-dark .voice-sheet-close{background:var(--card-3);color:#fff}
html.theme-dark .voice-sheet-client-name,html.theme-dark .voice-sheet-amount-currency,html.theme-dark .voice-sheet-amount input,html.theme-dark .voice-sheet-form .voice-sheet-amount input{color:#fff}
html.theme-dark .voice-sheet-client-name.is-empty{color:var(--txt-3)}
html.theme-dark .voice-sheet-more-btn{background:var(--card-3);color:#fff}
html.theme-dark .voice-sheet-transcript{background:rgba(49,87,213,.18);color:var(--txt-2)}

/* Comprobante en pantalla: se mantiene como "papel" claro */
html.theme-dark .invoice-paper{background:#fff;color:#101828;border-color:transparent;box-shadow:0 30px 70px rgba(0,0,0,.5)}
html.theme-dark .invoice-paper h1,html.theme-dark .invoice-paper h2,html.theme-dark .invoice-paper h3{color:#101828}
html.theme-dark .invoice-paper .text-link{color:var(--blue)}

/* Pie */
html.theme-dark .footer{border-top-color:var(--line);color:var(--txt-3)}
html.theme-dark .brand-footer{color:#fff}
html.theme-dark .footer-links a:hover{color:#fff}

/* Conmutador de tema en el menú de usuario */
.theme-toggle{display:flex;align-items:center;justify-content:space-between;gap:10px;width:100%;min-height:40px;padding:0 12px;border:0;border-radius:8px;background:transparent;color:#344054;font-size:14px;font-weight:600;cursor:pointer;text-align:left}
.theme-toggle:hover{background:#f2f4f7}
.theme-toggle-icon{width:28px;height:16px;border-radius:999px;background:#d0d5dd;position:relative;flex-shrink:0;transition:background .25s ease}
.theme-toggle-icon::after{content:"";position:absolute;top:2px;left:2px;width:12px;height:12px;border-radius:50%;background:#fff;transition:transform .25s cubic-bezier(.2,.7,.2,1)}
html.theme-dark .theme-toggle{color:var(--txt-2)}
html.theme-dark .theme-toggle:hover{background:var(--card-3);color:#fff}
html.theme-dark .theme-toggle-icon{background:var(--blue)}
html.theme-dark .theme-toggle-icon::after{transform:translateX(12px)}
@media(max-width:950px){.theme-toggle{min-height:48px;padding:0 6px}}
