/* Final theme normalization — loaded after every legacy/theme stylesheet. */
html[data-theme="dark"]{
  color-scheme:dark;
  --bg:#07101d;--panel:#0e1928;--panel2:#121f30;--surface:#0e1928;--surface2:#121f30;
  --text:#f3f7fc;--muted:#93a4b8;--line:#25354a;--border:#25354a;
  --v3-bg:#07101d;--v3-surface:#0e1928;--v3-card:#101d2d;--v3-card-2:#142235;
  --v3-line:#25354a;--v3-text:#f3f7fc;--v3-muted:#93a4b8;
}
html[data-theme="light"]{
  color-scheme:light;
  --bg:#f2f6fb;--panel:#fff;--panel2:#f7f9fc;--surface:#fff;--surface2:#f7f9fc;
  --text:#14243a;--muted:#65768c;--line:#d8e2ed;--border:#d8e2ed;
  --v3-bg:#f2f6fb;--v3-surface:#fff;--v3-card:#fff;--v3-card-2:#f7f9fc;
  --v3-line:#d8e2ed;--v3-text:#14243a;--v3-muted:#65768c;
}
html[data-theme] body{background:var(--bg)!important;color:var(--text)!important}
html[data-theme] main{background:var(--bg)!important;color:var(--text)}
html[data-theme] .content{color:var(--text)}
html[data-theme] .sidebar,
html[data-theme] .topbar,
html[data-theme] .panel,
html[data-theme] .stat-card,
html[data-theme] .v3-panel,
html[data-theme] .v3-kpi,
html[data-theme] .device-card,
html[data-theme] .table-card,
html[data-theme] .subscriber-modal,
html[data-theme] .history-panel,
html[data-theme] .more-grid button{border-color:var(--line)!important;color:var(--text)!important}
html[data-theme="dark"] .sidebar,
html[data-theme="dark"] .topbar,
html[data-theme="dark"] .panel,
html[data-theme="dark"] .stat-card,
html[data-theme="dark"] .v3-panel,
html[data-theme="dark"] .v3-kpi,
html[data-theme="dark"] .device-card,
html[data-theme="dark"] .table-card,
html[data-theme="dark"] .subscriber-modal,
html[data-theme="dark"] .history-panel,
html[data-theme="dark"] .more-grid button{background:var(--panel)!important}
html[data-theme="light"] .sidebar,
html[data-theme="light"] .topbar,
html[data-theme="light"] .panel,
html[data-theme="light"] .stat-card,
html[data-theme="light"] .v3-panel,
html[data-theme="light"] .v3-kpi,
html[data-theme="light"] .device-card,
html[data-theme="light"] .table-card,
html[data-theme="light"] .subscriber-modal,
html[data-theme="light"] .history-panel,
html[data-theme="light"] .more-grid button{background:#fff!important;box-shadow:0 7px 24px rgba(32,62,96,.055)}
html[data-theme] h1,html[data-theme] h2,html[data-theme] h3,html[data-theme] h4,
html[data-theme] strong,html[data-theme] b{color:var(--text)}
html[data-theme] p,html[data-theme] small,html[data-theme] .muted,html[data-theme] .hint{color:var(--muted)}
html[data-theme] input,html[data-theme] select,html[data-theme] textarea{
  background:var(--panel2)!important;color:var(--text)!important;border-color:var(--line)!important;
}
html[data-theme] input::placeholder,html[data-theme] textarea::placeholder{color:var(--muted)!important;opacity:.9}
html[data-theme] input:focus,html[data-theme] select:focus,html[data-theme] textarea:focus{
  border-color:#ff9418!important;box-shadow:0 0 0 3px rgba(255,148,24,.14)!important;outline:0;
}
html[data-theme] .table-card th,html[data-theme] .v3-table th,html[data-theme] .v3-core-table th{
  background:var(--panel2)!important;color:var(--muted)!important;border-color:var(--line)!important;
}
html[data-theme] .table-card td,html[data-theme] .v3-table td,html[data-theme] .v3-core-table td{
  color:var(--text)!important;border-color:var(--line)!important;
}
html[data-theme="dark"] .modal-backdrop{background:rgba(1,7,15,.78)!important}
html[data-theme="light"] .modal-backdrop{background:rgba(19,34,55,.48)!important}
html[data-theme] .theme-toggle{background:var(--panel2)!important;color:var(--text)!important;border-color:var(--line)!important}
html[data-theme] .theme-toggle .theme-icon{color:#ff9418}
html[data-theme] .sidebar nav button{color:var(--muted)!important}
html[data-theme] .sidebar nav button:hover{background:var(--panel2)!important;color:var(--text)!important}
html[data-theme] .sidebar nav button.active{background:linear-gradient(135deg,#ff9418,#ff7a00)!important;color:#111827!important;border-color:#ff9418!important}
html[data-theme] .sidebar nav button.active b,html[data-theme] .sidebar nav button.active i{color:#111827!important}
html[data-theme="dark"] .topbar{background:rgba(7,16,29,.94)!important}
html[data-theme="light"] .topbar{background:rgba(255,255,255,.94)!important}
html[data-theme] .cloud-pill,html[data-theme] .language-select{background:var(--panel2)!important;color:var(--text)!important;border-color:var(--line)!important}
html[data-theme] .ghost{color:#ff9418}
html[data-theme] .primary{background:linear-gradient(135deg,#ff9d1f,#ff7900)!important;color:#172033!important}
html[data-theme] *{scrollbar-color:#ff9418 var(--panel2)}
@media (prefers-reduced-motion:no-preference){
  html[data-theme] body,html[data-theme] main,html[data-theme] .sidebar,html[data-theme] .topbar,
  html[data-theme] .panel,html[data-theme] .stat-card,html[data-theme] .subscriber-modal,
  html[data-theme] input,html[data-theme] select,html[data-theme] textarea{transition:background-color .2s ease,color .2s ease,border-color .2s ease}
}
