/* Brocks UI Theme Module v1.5.14
   Light remains the default. Dark is a local UI preference only. */
:root{
  color-scheme:light;
  --theme-bg:#f3f6fa;
  --theme-surface:#ffffff;
  --theme-surface-2:#f7f9fc;
  --theme-surface-3:#eef2f6;
  --theme-text:#17243a;
  --theme-text-soft:#415066;
  --theme-muted:#748197;
  --theme-line:#d9e1ea;
  --theme-shadow:rgba(20,35,55,.08);
  --theme-input:#ffffff;
  --theme-code:#f2f5f8;
  --theme-accent:#ec6a28;
  --theme-danger:#a93a2b;
}
html[data-theme="dark"]{
  color-scheme:dark;
  --theme-bg:#0d131c;
  --theme-surface:#151d28;
  --theme-surface-2:#1a2431;
  --theme-surface-3:#202c3b;
  --theme-text:#edf3fa;
  --theme-text-soft:#c9d4e2;
  --theme-muted:#93a4b9;
  --theme-line:#2d3a4a;
  --theme-shadow:rgba(0,0,0,.30);
  --theme-input:#111923;
  --theme-code:#101720;
  --theme-accent:#ff7a32;
  --theme-danger:#db5a48;
}

body{
  background:var(--theme-bg)!important;
  color:var(--theme-text)!important;
  transition:background-color .16s ease,color .16s ease;
}
header{
  background:var(--theme-surface)!important;
  color:var(--theme-text)!important;
  border-color:var(--theme-line)!important;
}
main,footer{color:var(--theme-text)!important}
footer{border-color:var(--theme-line)!important;color:var(--theme-muted)!important}
h1,h2,h3,h4,strong,b,.brand{color:var(--theme-text)}
p,.lead,.small,.muted{color:var(--theme-muted)!important}
a:not(.primary):not(.admin-button):not(.webclient-tab){color:inherit}

.card,
.admin-section,
.login-card,
.webclient-security-strip,
.webclient-toolbar,
.webclient-panel,
.permission-category,
.privacy-panel,
.qr-wrap{
  background:var(--theme-surface)!important;
  color:var(--theme-text)!important;
  border-color:var(--theme-line)!important;
  box-shadow:0 4px 18px var(--theme-shadow)!important;
}
.admin-nav-shell{
  background:var(--theme-surface-3)!important;
  border-color:var(--theme-line)!important;
  box-shadow:0 4px 14px var(--theme-shadow)!important;
}
.admin-nav a{color:var(--theme-text-soft)!important}
.admin-nav a:hover{
  background:var(--theme-surface)!important;
  color:var(--theme-text)!important;
}
.admin-nav a.active{
  background:var(--theme-text)!important;
  color:var(--theme-surface)!important;
}
.admin-user-chip{border-color:var(--theme-line)!important}
.admin-user-chip span{color:var(--theme-text)!important}
.admin-user-chip small{color:var(--theme-muted)!important}

.quick-action,
.permission-check,
.device-summary span,
.long-code{
  background:var(--theme-surface-2)!important;
  color:var(--theme-text)!important;
  border-color:var(--theme-line)!important;
}
.quick-action span,.permission-check small{color:var(--theme-muted)!important}

input,select,textarea{
  background:var(--theme-input)!important;
  color:var(--theme-text)!important;
  border-color:var(--theme-line)!important;
}
input::placeholder,textarea::placeholder{color:var(--theme-muted)!important}
option{background:var(--theme-input);color:var(--theme-text)}

table,.admin-table{color:var(--theme-text)!important}
table th,table td,.admin-table th,.admin-table td{
  border-color:var(--theme-line)!important;
}
table th,.admin-table th{background:var(--theme-surface-2)!important}
code,pre,.long-code{
  background:var(--theme-code)!important;
  color:var(--theme-text-soft)!important;
  border-color:var(--theme-line)!important;
}

.webclient-tab{
  background:var(--theme-surface-3)!important;
  color:var(--theme-text-soft)!important;
  border-color:var(--theme-line)!important;
}
.webclient-tab.active{
  background:var(--theme-surface)!important;
  color:var(--theme-text)!important;
  border-bottom-color:var(--theme-surface)!important;
}
.webclient-panel-bar,.webclient-popout-toolbar{
  background:var(--theme-surface-2)!important;
  color:var(--theme-text)!important;
  border-color:var(--theme-line)!important;
}
.webclient-panel-bar span,.webclient-popout-toolbar span{
  color:var(--theme-muted)!important;
}
.privacy-note{
  background:color-mix(in srgb,var(--theme-accent) 10%,var(--theme-surface))!important;
  color:var(--theme-text)!important;
}
.status.warn{
  background:color-mix(in srgb,#d39a00 18%,var(--theme-surface))!important;
}
.admin-button.danger{
  background:var(--theme-danger)!important;
  color:#fff!important;
  border-color:transparent!important;
}

/* Theme switch */
.header-actions{
  display:flex;
  align-items:center;
  justify-content:flex-end;
  gap:10px;
}
.theme-toggle{
  appearance:none;
  display:inline-flex;
  align-items:center;
  gap:8px;
  min-height:38px;
  padding:0 12px;
  border:1px solid var(--theme-line);
  border-radius:10px;
  background:var(--theme-surface-2);
  color:var(--theme-text);
  cursor:pointer;
  font:inherit;
  font-size:12px;
  font-weight:800;
  line-height:1;
}
.theme-toggle:hover{background:var(--theme-surface-3)}
.theme-toggle:focus-visible{
  outline:3px solid color-mix(in srgb,var(--theme-accent) 35%,transparent);
  outline-offset:2px;
}
.theme-toggle-icon{
  width:18px;
  height:18px;
  display:grid;
  place-items:center;
  font-size:16px;
}
html[data-theme="dark"] .theme-toggle{background:#202c3b}
html[data-theme="dark"] img:not(.captcha-row img){
  filter:brightness(.96);
}

@media(max-width:720px){
  .header-actions{gap:6px}
  .theme-toggle{padding:0 10px}
  .theme-toggle-label{display:none}
}
