/*
 * TXA Cloud Monitor — tema claro/escuro
 * O tema escuro continua sendo o padrão. As regras abaixo convertem também
 * páginas antigas que ainda possuem cores escuras escritas diretamente.
 */

html{
    color-scheme:dark;
}

html[data-theme="light"]{
    color-scheme:light;
    --txa-black:#f4f6f9;
    --txa-card:#ffffff;
    --txa-border:#d8dee8;
    --txa-white:#172033;
    --txa-text:#5f6b7a;
    --txa-bg:#f4f6f9;
    --txa-surface:#ffffff;
    --txa-surface-soft:#f7f9fc;
    --txa-surface-muted:#eef2f6;
    --txa-heading:#172033;
    --txa-input-bg:#ffffff;
    --txa-hover:#eef2f6;
    --txa-shadow:0 14px 36px rgba(15,23,42,.09);
    --offline:#667085;
}

html[data-theme="light"] body{
    background:var(--txa-bg)!important;
    color:var(--txa-white)!important;
}

html[data-theme="light"] body,
html[data-theme="light"] .main-content,
html[data-theme="light"] .viewer-main,
html[data-theme="light"] .viewer-page,
html[data-theme="light"] .monitor,
html[data-theme="light"] .shopping-shell{
    color:var(--txa-white);
}

html[data-theme="light"] h1,
html[data-theme="light"] h2,
html[data-theme="light"] h3,
html[data-theme="light"] h4,
html[data-theme="light"] h5,
html[data-theme="light"] strong{
    color:var(--txa-heading);
}

html[data-theme="light"] .muted,
html[data-theme="light"] .user-info,
html[data-theme="light"] .subtitle,
html[data-theme="light"] .section-title p,
html[data-theme="light"] .form-group label,
html[data-theme="light"] .form-group small,
html[data-theme="light"] .table-subtitle,
html[data-theme="light"] .empty-state,
html[data-theme="light"] .daily-stat-label,
html[data-theme="light"] .support-profile-copy>span,
html[data-theme="light"] .support-card-heading p,
html[data-theme="light"] .quick-access-card small{
    color:var(--txa-text)!important;
}

/* Superfícies principais */
html[data-theme="light"] .card,
html[data-theme="light"] .dashboard-card,
html[data-theme="light"] .summary-card,
html[data-theme="light"] .table-card,
html[data-theme="light"] .form-card,
html[data-theme="light"] .detail-card,
html[data-theme="light"] .info-summary-card,
html[data-theme="light"] .filter-card,
html[data-theme="light"] .filters-card,
html[data-theme="light"] .settings-card,
html[data-theme="light"] .plans-card,
html[data-theme="light"] .plan-card,
html[data-theme="light"] .modal-card,
html[data-theme="light"] .daily-modal,
html[data-theme="light"] .daily-table-card,
html[data-theme="light"] .profile-summary-card,
html[data-theme="light"] .profile-support-card,
html[data-theme="light"] .quick-access-card,
html[data-theme="light"] .company-identity-card,
html[data-theme="light"] .unit-overview-card,
html[data-theme="light"] .unit-support-card,
html[data-theme="light"] .support-contact-card,
html[data-theme="light"] .shopping-card,
html[data-theme="light"] .shopping-identity-card,
html[data-theme="light"] .shopping-contact-card,
html[data-theme="light"] .responsible-card,
html[data-theme="light"] .contact-card,
html[data-theme="light"] .recipient-card,
html[data-theme="light"] .request-card,
html[data-theme="light"] .billing-card,
html[data-theme="light"] .invoices-card,
html[data-theme="light"] .reports-card,
html[data-theme="light"] .companies-card,
html[data-theme="light"] .units-card,
html[data-theme="light"] .inputs-card,
html[data-theme="light"] .events-card,
html[data-theme="light"] .telegram-card,
html[data-theme="light"] .support-card,
html[data-theme="light"] .settings-panel,
html[data-theme="light"] .staff-scope-panel,
html[data-theme="light"] .group-panel,
html[data-theme="light"] .simulator-panel,
html[data-theme="light"] .notification-panel,
html[data-theme="light"] .license-panel,
html[data-theme="light"] .compact-license-panel,
html[data-theme="light"] .selected-release-panel,
html[data-theme="light"] .firmware-table-card,
html[data-theme="light"] .firmware-summary-card,
html[data-theme="light"] .equipment-card,
html[data-theme="light"] .equipment-health-card,
html[data-theme="light"] .communication-card,
html[data-theme="light"] .operational-block-card,
html[data-theme="light"] .health-card,
html[data-theme="light"] .input-card,
html[data-theme="light"] .virtual-input-card{
    background:var(--txa-card)!important;
    border-color:var(--txa-border)!important;
    color:var(--txa-white)!important;
    box-shadow:var(--txa-shadow);
}

html[data-theme="light"] .profile-meta div,
html[data-theme="light"] .quick-access-icon,
html[data-theme="light"] .support-profile-links a,
html[data-theme="light"] .support-profile-links span,
html[data-theme="light"] .info-box,
html[data-theme="light"] .preview-box,
html[data-theme="light"] .logic-box,
html[data-theme="light"] .notification-box,
html[data-theme="light"] .result-box,
html[data-theme="light"] .activation-box,
html[data-theme="light"] .save-first-box,
html[data-theme="light"] .telegram-chat-box,
html[data-theme="light"] .staff-companies-box,
html[data-theme="light"] .shopping-logo-box,
html[data-theme="light"] .pix-qr-box,
html[data-theme="light"] .checkbox-card,
html[data-theme="light"] .toggle-card,
html[data-theme="light"] .option-card{
    background:var(--txa-surface-soft)!important;
    border-color:var(--txa-border)!important;
    color:var(--txa-white)!important;
}

/* Formulários */
html[data-theme="light"] input:not([type="checkbox"]):not([type="radio"]),
html[data-theme="light"] select,
html[data-theme="light"] textarea,
html[data-theme="light"] .input-prefix,
html[data-theme="light"] .filter-field input,
html[data-theme="light"] .filter-field select,
html[data-theme="light"] .filter-group select,
html[data-theme="light"] .rotation-control select,
html[data-theme="light"] .table-filter{
    background:var(--txa-input-bg)!important;
    border-color:#cbd3df!important;
    color:var(--txa-white)!important;
}

html[data-theme="light"] input::placeholder,
html[data-theme="light"] textarea::placeholder{
    color:#8a96a8!important;
}

html[data-theme="light"] input:disabled,
html[data-theme="light"] select:disabled,
html[data-theme="light"] textarea:disabled{
    background:#eef2f6!important;
    color:#7b8798!important;
}

/* Tabelas */
html[data-theme="light"] table,
html[data-theme="light"] .data-table,
html[data-theme="light"] .table-responsive{
    color:var(--txa-white)!important;
}

html[data-theme="light"] table thead,
html[data-theme="light"] table th,
html[data-theme="light"] .data-table th{
    background:#eef2f6!important;
    color:#344054!important;
    border-color:var(--txa-border)!important;
}

html[data-theme="light"] table td,
html[data-theme="light"] .data-table td,
html[data-theme="light"] table tr{
    border-color:var(--txa-border)!important;
}

html[data-theme="light"] table tbody tr:hover,
html[data-theme="light"] .data-table tbody tr:hover{
    background:#f7f9fc!important;
}

/* Botões neutros */
html[data-theme="light"] .btn.secondary,
html[data-theme="light"] .btn-secondary,
html[data-theme="light"] .header-button:not(.primary):not(.logout),
html[data-theme="light"] .pagination-button,
html[data-theme="light"] .pagination-btn,
html[data-theme="light"] .filter-button,
html[data-theme="light"] .unit-filter-button,
html[data-theme="light"] .action-button,
html[data-theme="light"] .daily-action-button,
html[data-theme="light"] .viewer-action-button,
html[data-theme="light"] .monitor-actions a,
html[data-theme="light"] .monitor-actions button:not(.primary){
    background:#ffffff!important;
    border-color:#cbd3df!important;
    color:#344054!important;
}

html[data-theme="light"] .btn.secondary:hover,
html[data-theme="light"] .btn-secondary:hover,
html[data-theme="light"] .header-button:not(.primary):not(.logout):hover,
html[data-theme="light"] .pagination-button:hover,
html[data-theme="light"] .filter-button:hover,
html[data-theme="light"] .action-button:hover{
    background:#eef2f6!important;
    border-color:#aeb8c8!important;
}

/* Sidebar e cabeçalho móvel */
html[data-theme="light"] .sidebar{
    background:linear-gradient(180deg,rgba(245,190,0,.08),transparent 170px),#ffffff!important;
    border-color:var(--txa-border)!important;
    box-shadow:8px 0 28px rgba(15,23,42,.08)!important;
}

html[data-theme="light"] .sidebar-header,
html[data-theme="light"] .sidebar-account-bar{
    border-color:rgba(15,23,42,.08)!important;
}

html[data-theme="light"] .sidebar-user-card,
html[data-theme="light"] .sidebar-group-toggle,
html[data-theme="light"] .sidebar-theme-button,
html[data-theme="light"] .sidebar-close,
html[data-theme="light"] .header-monitor-btn,
html[data-theme="light"] .mobile-theme-button{
    background:#f7f9fc!important;
    border-color:var(--txa-border)!important;
    color:#344054!important;
}

html[data-theme="light"] .sidebar-user-copy strong,
html[data-theme="light"] .sidebar-group-toggle,
html[data-theme="light"] .sidebar-group-content a,
html[data-theme="light"] .sidebar-nav>a{
    color:#344054!important;
}

html[data-theme="light"] .sidebar-user-copy small,
html[data-theme="light"] .nav-icon{
    color:#667085!important;
}

html[data-theme="light"] .sidebar-group.active-group{
    background:rgba(245,190,0,.07)!important;
    border-color:rgba(194,143,0,.24)!important;
}

html[data-theme="light"] .sidebar-group-content a:hover,
html[data-theme="light"] .sidebar-nav>a:hover{
    background:#f5f7fa!important;
    border-color:var(--txa-border)!important;
    color:#7a5a00!important;
}

html[data-theme="light"] .sidebar-group-content a.active,
html[data-theme="light"] .sidebar-nav>a.active,
html[data-theme="light"] .sidebar-user-card.active{
    background:linear-gradient(90deg,rgba(245,190,0,.20),rgba(245,190,0,.08))!important;
    border-color:rgba(194,143,0,.42)!important;
    color:#6f5100!important;
}

html[data-theme="light"] .sidebar-divider{
    background:rgba(15,23,42,.09)!important;
}

html[data-theme="light"] .mobile-header{
    background:#ffffff!important;
    border-color:var(--txa-border)!important;
    box-shadow:0 8px 24px rgba(15,23,42,.06);
}

/* Home, listas e eventos */
html[data-theme="light"] .event-item,
html[data-theme="light"] .offline-item,
html[data-theme="light"] .compact-item,
html[data-theme="light"] .compact-event-item,
html[data-theme="light"] .event-compact-item,
html[data-theme="light"] .unit-item,
html[data-theme="light"] .timeline-item,
html[data-theme="light"] .daily-table-state-row{
    background:#ffffff!important;
    border-color:var(--txa-border)!important;
    color:var(--txa-white)!important;
}

html[data-theme="light"] .event-item:hover,
html[data-theme="light"] .offline-item:hover,
html[data-theme="light"] .unit-item:hover{
    background:#f8fafc!important;
}

/* Monitor e Shopping Viewer */
html[data-theme="light"] .monitor-shell,
html[data-theme="light"] .shopping-identity,
html[data-theme="light"] .shopping-identity-content,
html[data-theme="light"] .filters-bar,
html[data-theme="light"] .status-strip,
html[data-theme="light"] .single-inputs-panel,
html[data-theme="light"] .device-card-header,
html[data-theme="light"] .device-picker-trigger,
html[data-theme="light"] .device-picker-dropdown,
html[data-theme="light"] .viewer-metric,
html[data-theme="light"] .ihm-card,
html[data-theme="light"] .unit-row{
    background:#ffffff!important;
    border-color:var(--txa-border)!important;
    color:var(--txa-white)!important;
    box-shadow:0 10px 28px rgba(15,23,42,.07);
}

html[data-theme="light"] .monitor-header,
html[data-theme="light"] .monitor-footer{
    border-color:var(--txa-border)!important;
}

html[data-theme="light"] .monitor-heading h1,
html[data-theme="light"] .device-identification h2,
html[data-theme="light"] .single-inputs-title strong,
html[data-theme="light"] .ihm-content strong,
html[data-theme="light"] .unit-name,
html[data-theme="light"] .shopping-identity-copy h2{
    color:var(--txa-heading)!important;
}

html[data-theme="light"] .monitor-unit,
html[data-theme="light"] .device-meta,
html[data-theme="light"] .viewer-metric span,
html[data-theme="light"] .viewer-metric small,
html[data-theme="light"] .ihm-content span,
html[data-theme="light"] .company-name,
html[data-theme="light"] .monitor-footer{
    color:var(--txa-text)!important;
}

html[data-theme="light"] .status-pill{
    background:#ffffff!important;
    border-color:var(--txa-border)!important;
}

html[data-theme="light"] .monitor-device-tab{
    background:#f7f9fc!important;
    border-color:var(--txa-border)!important;
    color:#344054!important;
}

html[data-theme="light"] .monitor-device-tab.active{
    background:rgba(245,190,0,.16)!important;
    border-color:rgba(194,143,0,.40)!important;
    color:#6f5100!important;
}

/* Login e recuperação */
html[data-theme="light"] body.login-page,
html[data-theme="light"] body.auth-page{
    background:
        radial-gradient(circle at top,rgba(245,190,0,.18),transparent 38%),
        #f4f6f9!important;
}

html[data-theme="light"] .login-box,
html[data-theme="light"] .auth-card{
    background:rgba(255,255,255,.96)!important;
    border-color:var(--txa-border)!important;
    box-shadow:0 24px 60px rgba(15,23,42,.14)!important;
}

html[data-theme="light"] .login-box label,
html[data-theme="light"] .auth-card label,
html[data-theme="light"] .auth-title{
    color:#344054!important;
}

html[data-theme="light"] .daily-message{
    background:#f8fafc!important;
    border-color:#d8dee8!important;
}

html[data-theme="light"] .daily-message-text,
html[data-theme="light"] .daily-message-author-name{
    color:#172033!important;
}

/* Modais e overlays */
html[data-theme="light"] .modal-backdrop,
html[data-theme="light"] .daily-modal-backdrop,
html[data-theme="light"] .sidebar-overlay{
    background:rgba(15,23,42,.48)!important;
}

/* Alternador de tema */
.theme-toggle-button{
    display:inline-flex;
    align-items:center;
    justify-content:center;
    cursor:pointer;
}

.theme-toggle-button svg{
    width:19px;
    height:19px;
    display:block;
}

html[data-theme="dark"] .theme-icon-moon,
html[data-theme="light"] .theme-icon-sun{
    display:none!important;
}

html[data-theme="dark"] .theme-icon-sun,
html[data-theme="light"] .theme-icon-moon{
    display:inline-flex!important;
}

.theme-floating-toggle{
    position:fixed;
    top:16px;
    right:16px;
    z-index:2000;
    width:44px;
    height:44px;
    border-radius:13px;
    border:1px solid var(--txa-border);
    background:var(--txa-card);
    color:var(--txa-white);
    box-shadow:var(--txa-shadow);
}

.theme-floating-toggle:hover{
    border-color:var(--txa-yellow);
    color:var(--txa-yellow);
}

@media(max-width:700px){
    .theme-floating-toggle{
        top:10px;
        right:10px;
        width:40px;
        height:40px;
    }
}

html[data-theme="light"] .support-preview-card,
html[data-theme="light"] .settings-form,
html[data-theme="light"] .theme-choice,
html[data-theme="light"] .image-upload-card,
html[data-theme="light"] .company-mobile-card,
html[data-theme="light"] .unit-card,
html[data-theme="light"] .action-card,
html[data-theme="light"] .addon-form-card,
html[data-theme="light"] .plan-form-card{
    background:var(--txa-card)!important;
    border-color:var(--txa-border)!important;
    color:var(--txa-white)!important;
}

html[data-theme="light"] .preview-avatar,
html[data-theme="light"] .preview-actions span,
html[data-theme="light"] .photo-fields input[type="file"]{
    background:var(--txa-surface-soft)!important;
    border-color:var(--txa-border)!important;
    color:var(--txa-white)!important;
}

html[data-theme="light"] .theme-choice.selected{
    background:rgba(245,190,0,.08)!important;
    border-color:rgba(194,143,0,.48)!important;
}

html[data-theme="light"] .theme-choice-copy strong{
    color:var(--txa-heading)!important;
}

html[data-theme="light"] .theme-choice-copy small{
    color:var(--txa-text)!important;
}
