/* Site template layer: admin header/footer settings and dark mode. Loaded after app.css. */

/* ---- Header (defaults match the original look; admin values arrive as --header-* custom properties) ---- */
.topbar{background:var(--header-bg,#16202a);color:var(--header-text,#fff)}
.brand-title,.userbox a{color:var(--header-text,#fff)}
.brand span,.topbar nav a,.userbox,.nav-group-toggle{color:var(--header-text,#d8e0e7)}
.topbar nav a:hover,.topbar nav a.active{background:var(--header-hover,#263545);color:var(--header-text,#fff)}
.nav-group:hover .nav-group-toggle,.nav-group:focus-within .nav-group-toggle,.nav-group.active .nav-group-toggle{background:var(--header-hover,#263545);color:var(--header-text,#fff)}
.nav-submenu{background:var(--header-bg,#16202a);border-color:var(--header-line,#324151)}
.nav-submenu a:hover,.nav-submenu a.active{background:var(--header-hover,#263545)!important}
@media(max-width:1024px){
  .topbar nav a{background:var(--header-hover-soft,#1d2a36)}
  .topbar nav a.active{background:var(--header-hover,#2b3e50)}
  .userbox{border-top-color:var(--header-line,#324151)}
  .nav-toggle{background:var(--header-hover,#263545);border-color:var(--header-line,#405064);color:var(--header-text,#fff)}
}

/* ---- Logo size (only when the admin sets one) and desktop position ---- */
@media(min-width:701px){.topbar[data-logosize="custom"] .brand-logo{max-height:var(--logo-h);max-width:var(--logo-w)}}
@media(min-width:1025px){
  .topbar[data-logo="center"]{flex-wrap:wrap;justify-content:center}
  .topbar[data-logo="center"] .brand{flex:0 0 100%;justify-content:center}
  .topbar[data-logo="right"] .brand{order:3}
  .topbar[data-logo="right"] .userbox{order:2;margin-left:0}
}

/* ---- Footer ---- */
.app-footer{background:var(--footer-bg,transparent);color:var(--footer-text,var(--muted));padding-top:12px}
.app-footer .footer-text{margin-bottom:4px}
.app-footer .footer-links{margin-bottom:4px}
.app-footer .footer-links a{color:inherit;text-decoration:underline}

/* ---- Theme toggle button ---- */
.theme-toggle{border:1px solid var(--header-line,#405064);background:transparent;color:inherit;border-radius:8px;padding:5px 10px;margin-right:8px;font:inherit;font-size:12px;font-weight:700;cursor:pointer}
.theme-toggle:hover{background:var(--header-hover,#263545)}
.theme-toggle:disabled{opacity:.6;cursor:wait}

/* ---- Dark mode (the header and footer keep the admin's colours) ---- */
html[data-theme="dark"]{color-scheme:dark;--bg:#0f1419;--card:#1a2129;--text:#e6eaee;--muted:#9aa5b1;--line:#2c3742;--accent:#7db4e6;--danger:#f97066;--ok:#47cd89;--warn:#fdb022}
html[data-theme="dark"] .btn{background:#2f6fa8;color:#fff}
html[data-theme="dark"] .btn.secondary{background:#3d4a57}
html[data-theme="dark"] .btn.danger{background:#b42318}
html[data-theme="dark"] .tabs a{background:var(--card);color:var(--text)}
html[data-theme="dark"] .tabs a.active{background:#2f6fa8;border-color:#2f6fa8;color:#fff}
html[data-theme="dark"] .tablewrap{background:var(--card)}
html[data-theme="dark"] th{background:#222b35;color:#aab4be}
html[data-theme="dark"] .sectionrow td{background:#222d38}
html[data-theme="dark"] .progress{background:#2a343e}
html[data-theme="dark"] .field label{color:#b4bec8}
html[data-theme="dark"] input,html[data-theme="dark"] select,html[data-theme="dark"] textarea{background:#10171e;border-color:#3a4754;color:var(--text)}
html[data-theme="dark"] ::placeholder{color:#7b8794}
html[data-theme="dark"] .flash{background:#10291f;color:#8ee3b8;border-color:#1e5a41}
html[data-theme="dark"] .alert{background:#2d1512;color:#ffb4ab;border-color:#6b2a24}
html[data-theme="dark"] .badge{background:#26323e;color:var(--text)}
html[data-theme="dark"] .badge.warn{background:#3a2a10;color:#fdb022}
html[data-theme="dark"] .badge.danger{background:#3b1714;color:#f97066}
html[data-theme="dark"] .badge.ok{background:#12301f;color:#47cd89}
html[data-theme="dark"] .checkitem,html[data-theme="dark"] .snapshot,html[data-theme="dark"] .knowledge-suggestion{background:var(--card)}
html[data-theme="dark"] .knowledge-suggestion:hover,html[data-theme="dark"] .knowledge-suggestion:focus{background:#222d38;border-color:#4a6a86}
html[data-theme="dark"] .dangerzone{border-color:#6b2a24}
html[data-theme="dark"] .team-chip{background:#222d38}
html[data-theme="dark"] .brand-preview{background:#222b35}
html[data-theme="dark"] table.mobile-card-table tr{background:var(--card);box-shadow:0 1px 2px #00000040}
html[data-theme="dark"] table.mobile-card-table td{border-bottom-color:#2c3742}
html[data-theme="dark"] table.mobile-card-table td::before{color:#9aa5b1}
html[data-theme="dark"] table.mobile-card-table tr.sectionrow{background:#222d38}
