.theme-toggle { width: 32px; height: 32px; flex-shrink: 0; }
.theme-toggle .theme-sun { display: none; }
[data-theme="dark"] .theme-toggle .theme-sun { display: block; }
[data-theme="dark"] .theme-toggle .theme-moon { display: none; }

/* Color changes only: spacing and the compact layout use the existing rules. */
[data-theme="dark"] {
    color-scheme: dark;
    --green: #287a5c;
    --deep: #34936f;
    --ink: #e0e9e2;
    --muted: #a1b0a6;
    --border: #33463c;
    --bg: #17231d;
    --mint: #263f31;
}
[data-theme="dark"] .sidebar,
[data-theme="dark"] .topbar,
[data-theme="dark"] .panel,
[data-theme="dark"] .stat-card,
[data-theme="dark"] .filters,
[data-theme="dark"] dialog { background: #1f2e25; }
[data-theme="dark"] .workspace,
[data-theme="dark"] .year-badge,
[data-theme="dark"] .sidebar-note,
[data-theme="dark"] .form-footer,
[data-theme="dark"] .branding-preview,
[data-theme="dark"] th { background: #25362b; border-color: var(--border); }
[data-theme="dark"] .sidebar nav a { color: #b2c1b6; }
[data-theme="dark"] .sidebar nav a.selected,
[data-theme="dark"] .sidebar nav a:hover,
[data-theme="dark"] .icon-button:hover { background: #2b4435; color: #b8dfbd; }
[data-theme="dark"] .nav-dot { background: #97caa6; }
[data-theme="dark"] .icon-button,
[data-theme="dark"] .text-link,
[data-theme="dark"] .text-button,
[data-theme="dark"] .panel-bottom,
[data-theme="dark"] .green { color: #a2d4b1; }
[data-theme="dark"] .button:not(.primary) { background: #283d30; color: #c3d5c4; border-color: #435b48; }
[data-theme="dark"] .button:not(.primary):hover { background: #334d3c; }
[data-theme="dark"] .button.primary { color: #fff; }
[data-theme="dark"] input,
[data-theme="dark"] select,
[data-theme="dark"] .branding-control input[type="file"] { background: #18271e; color: #dce6db; border-color: #435a48; }
[data-theme="dark"] input::placeholder { color: #9eae9f; }
[data-theme="dark"] label,
[data-theme="dark"] .form-footer,
[data-theme="dark"] .attendance-tools,
[data-theme="dark"] .info-note,
[data-theme="dark"] .table-footer,
[data-theme="dark"] .footer { color: #a8b8a8; }
[data-theme="dark"] .branding-control input[type="file"]::file-selector-button { background: #314d39; color: #c4dfc3; }
[data-theme="dark"] .page-heading p,
[data-theme="dark"] .panel-heading p,
[data-theme="dark"] .stat-card span,
[data-theme="dark"] .stat-card > small,
[data-theme="dark"] td,
[data-theme="dark"] td small,
[data-theme="dark"] th,
[data-theme="dark"] .class-bar small,
[data-theme="dark"] .sidebar-note p,
[data-theme="dark"] .breadcrumb > span:first-of-type,
[data-theme="dark"] .today,
[data-theme="dark"] .nav-label,
[data-theme="dark"] .eyebrow,
[data-theme="dark"] .muted,
[data-theme="dark"] .empty p,
[data-theme="dark"] .report-card > p,
[data-theme="dark"] .class-card > p { color: #a9b9a7; }
[data-theme="dark"] td strong,
[data-theme="dark"] .class-bar strong,
[data-theme="dark"] .class-bar span,
[data-theme="dark"] .empty h3 { color: #d0dfcb; }
[data-theme="dark"] td,
[data-theme="dark"] th,
[data-theme="dark"] .panel-bottom,
[data-theme="dark"] .due-row,
[data-theme="dark"] .filters,
[data-theme="dark"] .quick-card a { border-color: var(--border); }
[data-theme="dark"] tbody tr:hover { background: #263b2d; }
[data-theme="dark"] .class-tag,
[data-theme="dark"] .badge.neutral,
[data-theme="dark"] .count { background: #314334; border-color: #435743; color: #c2d3b7; }
[data-theme="dark"] .badge.success { background: #2c4530; color: #c1dfae; }
[data-theme="dark"] .badge.warning { background: #473c25; color: #edcf8b; }
[data-theme="dark"] .badge.danger { background: #4a302b; color: #f0b6a6; }
[data-theme="dark"] .attendance-options span { border-color: #4b6049; color: #bfd0b7; }
[data-theme="dark"] .attendance-options input:checked + span { background: #345234; border-color: #83a56e; color: #d6edc1; }
[data-theme="dark"] .attendance-options input[value="Absent"]:checked + span { background: #54362d; border-color: #be8b77; color: #f1c4b2; }
[data-theme="dark"] .bar-track { background: #334334; }
[data-theme="dark"] .avatar { background: #3b4d33; color: #d3dfb9; border-color: #26362b; box-shadow: 0 0 0 1px #43543c; }
[data-theme="dark"] .hue-0 { background: #453e59; color: #d6c9f1; }
[data-theme="dark"] .hue-1 { background: #3b5039; color: #c5dfb6; }
[data-theme="dark"] .hue-2 { background: #584633; color: #efcda5; }
[data-theme="dark"] .hue-3 { background: #344d58; color: #c0dfec; }
[data-theme="dark"] .mint { background: #2c4530; color: #adce99 !important; }
[data-theme="dark"] .blue { background: #303f56; color: #bacded !important; }
[data-theme="dark"] .amber { background: #493f2a; color: #e6c68a !important; }
[data-theme="dark"] .rose { background: #4e3732; color: #e6b7a8 !important; }
[data-theme="dark"] .welcome-banner,
[data-theme="dark"] .quick-card { background: #2b3929; border-color: #40513a; }
[data-theme="dark"] .welcome-banner h2,
[data-theme="dark"] .quick-card h2 { color: #d0dfb7; }
[data-theme="dark"] .welcome-banner p,
[data-theme="dark"] .quick-card p,
[data-theme="dark"] .quick-card .eyebrow { color: #b1bfa0; }
[data-theme="dark"] .welcome-banner a,
[data-theme="dark"] .quick-card a { color: #c5dbac; }
[data-theme="dark"] .pill { background: #3a4c32; color: #d0e1bb; }
[data-theme="dark"] .banner-art { opacity: .65; }
[data-theme="dark"] .flash { background: #2b4430; border-color: #4b6543; color: #c1dda9; }
[data-theme="dark"] .flash.error { background: #4a322b; border-color: #725044; color: #f0c4ae; }
[data-theme="dark"] dialog::backdrop { background: #07130dbb; }
[data-theme="dark"] .auth-body { background: var(--bg); }
[data-theme="dark"] .auth-story { background: #2b3929; }
[data-theme="dark"] .auth-story h1 { color: #d0dfb7; }
[data-theme="dark"] .auth-story em { color: #aacb8f; }
[data-theme="dark"] .auth-story p,
[data-theme="dark"] .auth-story > small,
[data-theme="dark"] .auth-story .eyebrow,
[data-theme="dark"] .auth-card > p,
[data-theme="dark"] .auth-card .auth-foot { color: #afbea1; }
[data-theme="dark"] .auth-art > span { background: #3c4d34; border-color: #5c714a; box-shadow: 3px 4px #1e2c20; }
[data-theme="dark"] .auth-art svg { color: #bdd49f; }
@media (max-width: 650px) {
    .theme-toggle { width: 36px; height: 36px; }
    .topbar-right { gap: 8px; }
    .year-badge { white-space: nowrap; }
}
