/* Global light and dark theme toggle. Homepage artwork remains unchanged. */
.theme-switch-item { display: flex; align-items: center; }
.theme-switch {
    width: 36px;
    height: 36px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid rgba(255,255,255,.28);
    border-radius: 8px;
    background: rgba(255,255,255,.08);
    color: #fff;
    cursor: pointer;
    font-size: 16px;
    transition: background .2s, border-color .2s, color .2s;
}
.theme-switch:hover { background: rgba(255,255,255,.16); }
.theme-icon-light { display: none; }
.theme-light .theme-icon-dark { display: none; }
.theme-light .theme-icon-light { display: inline-block; }

/* A light preference changes the interface chrome, not the homepage artwork. */
.theme-light body:not(.homepage) {
    background: #f4f5f9;
    color: #252536;
}
.theme-light body:not(.homepage) .navbar {
    background: rgba(255,255,255,.96);
    border-bottom-color: #e5e7eb;
    box-shadow: 0 4px 18px rgba(35,30,65,.08);
}
.theme-light body:not(.homepage) .nav-brand { color: #423d65; }
.theme-light body:not(.homepage) .nav-brand .brand-accent { color: #7967d8; }
.theme-light body:not(.homepage) .nav-links a { color: #55536a; }
.theme-light body:not(.homepage) .nav-links a:hover { color: #715fd0; }
.theme-light body:not(.homepage) .theme-switch {
    color: #5d4fc0;
    border-color: #dedaf2;
    background: #f7f5ff;
}
.theme-light body:not(.homepage) .theme-switch:hover { background: #eeebfb; }
.theme-light body:not(.homepage) .sidebar {
    background: #11161d;
    border-right-color: #e7e5ef;
    box-shadow: 6px 0 24px rgba(35,30,65,.06);
}
.theme-light body:not(.homepage) .sidebar-header {
    background: linear-gradient(135deg, #f3f0ff, #faf8ff);
    border-bottom-color: #e7e5ef;
}
.theme-light body:not(.homepage) .sidebar-username,
.theme-light body:not(.homepage) .main-content h1,
.theme-light body:not(.homepage) .main-content h2,
.theme-light body:not(.homepage) .main-content h3,
.theme-light body:not(.homepage) .admin-page-header h1,
.theme-light body:not(.homepage) .admin-card-body h3,
.theme-light body:not(.homepage) .admin-stat-num,
.theme-light body:not(.homepage) .dash-chart-header h3,
.theme-light body:not(.homepage) .dash-stat-num,
.theme-light body:not(.homepage) .dash-kw-title { color: #28263a; }
.theme-light body:not(.homepage) .sidebar-role,
.theme-light body:not(.homepage) .admin-page-header p,
.theme-light body:not(.homepage) .admin-card-body p,
.theme-light body:not(.homepage) .admin-stat-label,
.theme-light body:not(.homepage) .admin-form-group label,
.theme-light body:not(.homepage) .dash-stat-label,
.theme-light body:not(.homepage) .admin-detail-table td:first-child,
.theme-light body:not(.homepage) .admin-table thead th,
.theme-light body:not(.homepage) .admin-table tbody td { color: #68657a; }
.theme-light body:not(.homepage) .sidebar-link { color: #56536b; }
.theme-light body:not(.homepage) .sidebar-link:hover { background: #f3f0ff; color: #5145a6; }
.theme-light body:not(.homepage) .sidebar-link.active {
    color: #5145a6;
    background: linear-gradient(100deg, #efedff, #f7f3ff);
    box-shadow: inset 3px 0 0 #8874e6;
}
.theme-light body:not(.homepage) .admin-card,
.theme-light body:not(.homepage) .admin-stat-card,
.theme-light body:not(.homepage) .dash-chart-wrap,
.theme-light body:not(.homepage) .dash-stat-card,
.theme-light body:not(.homepage) .content-card,
.theme-light body:not(.homepage) .knowledge-card,
.theme-light body:not(.homepage) .main-content .card,
.theme-light body:not(.homepage) .main-content .panel,
.theme-light body:not(.homepage) .auth-form {
    background: #11161d;
    border-color: #e8e6f0;
    box-shadow: 0 8px 24px rgba(35,30,65,.06);
}
.theme-light body:not(.homepage) .admin-table tbody tr { border-bottom-color: #eeedf3; }
.theme-light body:not(.homepage) .admin-table tbody tr:hover { background: #f8f7fc; }
.theme-light body:not(.homepage) .admin-table a,
.theme-light body:not(.homepage) .quick-links a,
.theme-light body:not(.homepage) .auth-alt a { color: #6758c4; }
.theme-light body:not(.homepage) .admin-btn-ghost {
    color: #5d51a7;
    border-color: #dcd8ee;
    background: #faf9ff;
}
.theme-light body:not(.homepage) input,
.theme-light body:not(.homepage) select,
.theme-light body:not(.homepage) textarea {
    background: #11161d;
    color: #29273a;
    border-color: #d9d7e3;
}
.theme-light body:not(.homepage) input::placeholder,
.theme-light body:not(.homepage) textarea::placeholder { color: #9692a6; }
.theme-light body:not(.homepage) .dash-kw-item,
.theme-light body:not(.homepage) .admin-kw-item { background: #f6f5fa; color: #454257; }
.theme-light body:not(.homepage) .dash-kw-text { color: #454257; }
.theme-light body:not(.homepage) .footer {
    background: #11161d;
    border-top-color: #e8e6f0;
}
.theme-light body:not(.homepage) .footer p,
.theme-light body:not(.homepage) .auth-alt { color: #777487; }
.theme-light body:not(.homepage) .auth-form h2 { color: #28263a; }
.theme-light body:not(.homepage) .error-page h1 { color: #d4d1de; }
.theme-light body:not(.homepage) .error-page p { color: #68657a; }

@media (max-width: 640px) {
    .navbar .nav-inner { padding-left: 8px; padding-right: 8px; }
    .navbar .nav-links { gap: 10px !important; }
    .theme-switch { width: 32px; height: 32px; }
}
