/*
 * FastClass dark theme.
 *
 * Loaded after design-tokens.css, theme-dark-palette.css and the component
 * stylesheets, so it both defines the dark semantic tokens and patches the
 * handful of components that hardcode a light surface instead of consuming a
 * token. Everything is scoped to [data-bs-theme="dark"]: the same build serves
 * both themes and the attribute is set before first paint by
 * core/partials/theme_bootstrap.html.
 *
 * Palette tokens (--fc-color-palette-*) are generated by
 * scripts/build_dark_palette.mjs into theme-dark-palette.css. Only semantic
 * tokens and component fixes belong in this file.
 */

:root[data-bs-theme="dark"] {
    /* Brand and interaction */
    --fc-color-primary: #22c55e;
    --fc-color-primary-hover: #16a34a;
    --fc-color-accent: #34d399;
    --fc-color-accent-hover: #10b981;
    --fc-color-on-primary: #052e16;
    --fc-color-on-primary-hover: #052e16;

    /* Surfaces and text */
    --fc-color-background: #0b1220;
    --fc-color-surface: #111a2b;
    --fc-color-surface-soft: #162234;
    --fc-color-text: #e8eef7;
    --fc-color-text-muted: #9fb0c8;
    --fc-color-border: #263449;
    --fc-color-muted: #9fb0c8;

    /* Semantic states */
    --fc-color-success: #22c55e;
    --fc-color-success-soft: #10291b;
    --fc-color-success-text: #86efac;
    --fc-color-warning: #fbbf24;
    --fc-color-warning-soft: #2c2110;
    --fc-color-warning-text: #fcd34d;
    --fc-color-warning-bg: #2c2110;
    --fc-color-danger: #f87171;
    --fc-color-danger-soft: #2c1518;
    --fc-color-danger-text: #fca5a5;
    --fc-color-info: #60a5fa;
    --fc-color-info-soft: #12233c;
    --fc-color-info-text: #93c5fd;
    --fc-color-primary-soft: #0f2a1c;
    --fc-color-primary-border: #1f5c38;
    --fc-color-primary-dark: #86efac;
    --fc-color-accent-dark: #86efac;

    /* Contrast, shadow, and overlay */
    --fc-color-on-dark: #ffffff;
    --fc-color-shadow-rgb: 0, 0, 0;
    --fc-color-shadow-strong-rgb: 0, 0, 0;
    --fc-color-shadow-brand-rgb: 34, 197, 94;
    --fc-color-shadow-accent-rgb: 52, 211, 153;
    --fc-color-shadow-info-rgb: 96, 165, 250;
    --fc-color-shadow-warning-rgb: 251, 191, 36;
    --fc-color-shadow-danger-rgb: 248, 113, 113;
    --fc-color-shadow-black-rgb: 0, 0, 0;
    --fc-color-shadow-white-rgb: 255, 255, 255;
    --fc-color-shadow-purple-rgb: 167, 139, 250;
    --fc-color-shadow-success-soft: #103322;
    --fc-color-shadow-success-rgb: 34, 197, 94;
    --fc-color-shadow: rgba(0, 0, 0, 0.5);
    --fc-color-overlay: rgba(0, 0, 0, 0.65);

    /* Modal surface bridge (base.css derives these from the tokens above) */
    --fc-modal-surface: #131d2f;
    --fc-modal-surface-soft: #162234;
    --fc-modal-border: #2a3a52;
    --fc-modal-text: var(--fc-color-text);
    --fc-modal-muted: #9fb0c8;
    --fc-modal-shadow: 0 16px 40px rgba(0, 0, 0, 0.55);

    /*
     * Bootstrap bridge. Bootstrap's own dark theme is enabled by the same
     * data-bs-theme attribute; these values replace its neutral grays with the
     * app palette so custom components and Bootstrap components share one
     * canvas.
     */
    --bs-body-bg: var(--fc-color-background);
    --bs-body-bg-rgb: 11, 18, 32;
    --bs-body-color: var(--fc-color-text);
    --bs-body-color-rgb: 232, 238, 247;
    --bs-emphasis-color: #ffffff;
    --bs-emphasis-color-rgb: 255, 255, 255;
    --bs-secondary-color: rgba(232, 238, 247, 0.68);
    --bs-secondary-color-rgb: 232, 238, 247;
    --bs-tertiary-color: rgba(232, 238, 247, 0.52);
    --bs-tertiary-color-rgb: 232, 238, 247;
    --bs-secondary-bg: var(--fc-color-surface-soft);
    --bs-secondary-bg-rgb: 22, 34, 52;
    --bs-tertiary-bg: #1b293d;
    --bs-tertiary-bg-rgb: 27, 41, 61;
    --bs-border-color: var(--fc-color-border);
    --bs-border-color-translucent: rgba(255, 255, 255, 0.14);
    --bs-heading-color: var(--fc-color-text);
    --bs-link-color: #4ade80;
    --bs-link-hover-color: #86efac;
    --bs-link-color-rgb: 74, 222, 128;
    --bs-link-hover-color-rgb: 134, 239, 172;

    --bs-success: var(--fc-color-primary);
    --bs-success-rgb: 34, 197, 94;
    --bs-success-text-emphasis: #86efac;
    --bs-success-bg-subtle: #10291b;
    --bs-success-border-subtle: #1f5c38;
    --bs-danger-text-emphasis: #fca5a5;
    --bs-danger-bg-subtle: #2c1518;
    --bs-danger-border-subtle: #6b2b2f;
    --bs-warning-text-emphasis: #fcd34d;
    --bs-warning-bg-subtle: #2c2110;
    --bs-warning-border-subtle: #66501d;
    --bs-info-text-emphasis: #93c5fd;
    --bs-info-bg-subtle: #12233c;
    --bs-info-border-subtle: #284b78;
    --bs-light: var(--fc-color-surface-soft);
    --bs-light-rgb: 22, 34, 52;
    --bs-dark: #0b1220;
    --bs-dark-rgb: 11, 18, 32;

    --bs-card-bg: var(--fc-color-surface);
    --bs-card-border-color: var(--fc-color-border);
    --bs-card-cap-bg: transparent;
    --bs-modal-bg: var(--fc-modal-surface);
    --bs-modal-border-color: var(--fc-color-border);
    --bs-modal-header-border-color: var(--fc-color-border);
    --bs-modal-footer-border-color: var(--fc-color-border);
    --bs-dropdown-bg: #131d2f;
    --bs-dropdown-border-color: var(--fc-color-border);
    --bs-dropdown-link-hover-bg: #1d2b40;
    --bs-offcanvas-bg: var(--fc-color-surface);
    --bs-accordion-bg: var(--fc-color-surface);
    --bs-accordion-border-color: var(--fc-color-border);
    --bs-accordion-btn-color: var(--fc-color-text);
    --bs-accordion-active-bg: #17253a;
    --bs-accordion-active-color: var(--fc-color-text);
    --bs-table-bg: transparent;
    --bs-table-color: var(--fc-color-text);
    --bs-table-border-color: var(--fc-color-border);
    --bs-table-striped-bg: rgba(255, 255, 255, 0.035);
    --bs-table-hover-bg: rgba(255, 255, 255, 0.055);
    --bs-form-valid-color: #86efac;
    --bs-form-valid-border-color: #22c55e;
    --bs-form-invalid-color: #fca5a5;
    --bs-form-invalid-border-color: #f87171;
    --bs-highlight-bg: #3b2f12;
    --bs-focus-ring-color: rgba(34, 197, 94, 0.3);
}

[data-bs-theme="dark"] body {
    background-color: var(--fc-color-background);
    color: var(--fc-color-text);
}

html[data-bs-theme="dark"] {
    background-color: var(--fc-color-background);
}

/* --- Bootstrap utilities that hardcode a light theme --- */

[data-bs-theme="dark"] .bg-white,
[data-bs-theme="dark"] .bg-body,
[data-bs-theme="dark"] .bg-body-secondary,
[data-bs-theme="dark"] .bg-body-tertiary {
    background-color: var(--fc-color-surface) !important;
}

[data-bs-theme="dark"] .bg-light {
    background-color: var(--fc-color-surface-soft) !important;
}

[data-bs-theme="dark"] .text-dark,
[data-bs-theme="dark"] .text-black,
[data-bs-theme="dark"] .text-body {
    color: var(--fc-color-text) !important;
}

/*
 * Lesson icon tiles keep the lesson's own light pastel color as their
 * background in both themes, so their glyph must stay dark ink here even
 * though the remaps above (and the dark palette) turn .text-dark and the
 * dark-ink palette variables into light text.
 */
[data-bs-theme="dark"] .lesson-ready-icon .text-dark {
    color: #212529 !important;
}

/* The lesson-design chips in the editor are pastel swatches too: the tint is
   set inline from LESSON_COLOR_CHOICES, so the glyph keeps its light-theme
   ink instead of following the palette remap above. */
[data-bs-theme="dark"] .lesson-material-design-chip {
    color: #2b3e5d;
}

[data-bs-theme="dark"] .classroom-inline-block--lesson .classroom-inline-block__icon {
    color: #172033 !important;
}

/* The card itself is a dark surface here, so its fixed light-theme title
   ink must not survive the theme switch. */
[data-bs-theme="dark"] .lesson-ready-card .lesson-ready-title {
    color: var(--fc-color-text) !important;
}

[data-bs-theme="dark"] .border-light,
[data-bs-theme="dark"] .border-white {
    border-color: var(--fc-color-border) !important;
}

[data-bs-theme="dark"] .table-light,
[data-bs-theme="dark"] .table-white {
    --bs-table-bg: var(--fc-color-surface-soft);
    --bs-table-color: var(--fc-color-text);
    --bs-table-border-color: var(--fc-color-border);
    --bs-table-striped-bg: rgba(255, 255, 255, 0.035);
    --bs-table-hover-bg: rgba(255, 255, 255, 0.055);
}

[data-bs-theme="dark"] .text-bg-light {
    color: var(--fc-color-text) !important;
    background-color: var(--fc-color-surface-soft) !important;
}

/*
 * Primary/accent surfaces become brighter in dark mode, so their labels use
 * the dark "on primary" ink. Bootstrap's .btn-success hardcodes white.
 */
[data-bs-theme="dark"] .btn-success {
    --bs-btn-color: var(--fc-color-on-primary);
    --bs-btn-hover-color: var(--fc-color-on-primary);
    --bs-btn-active-color: var(--fc-color-on-primary);
    --bs-btn-disabled-color: rgba(5, 46, 22, 0.6);
}

[data-bs-theme="dark"] .fc-btn-create-class,
[data-bs-theme="dark"] .fc-btn-assign,
[data-bs-theme="dark"] .fc-experience-modal__footer .fc-experience-card__primary,
[data-bs-theme="dark"] .fc-log-chip.is-active,
[data-bs-theme="dark"] .fc-instruction__step-num,
[data-bs-theme="dark"] .attendance-calendar__grid button.is-selected {
    --bs-btn-color: var(--fc-color-on-primary);
    --bs-btn-hover-color: var(--fc-color-on-primary);
    color: var(--fc-color-on-primary);
}

[data-bs-theme="dark"] .fc-btn-create-class:hover,
[data-bs-theme="dark"] .fc-btn-assign:hover,
[data-bs-theme="dark"] .fc-experience-modal__footer .fc-experience-card__primary:hover:not(:disabled),
[data-bs-theme="dark"] .fc-btn-create-class:active,
[data-bs-theme="dark"] .fc-btn-create-class:focus-visible,
[data-bs-theme="dark"] .fc-btn-create-class.active,
[data-bs-theme="dark"] .fc-btn-assign:active,
[data-bs-theme="dark"] .fc-btn-assign:focus-visible,
[data-bs-theme="dark"] .fc-btn-assign.active {
    color: var(--fc-color-on-primary);
}

[data-bs-theme="dark"] .fc-desk-filter-badge,
[data-bs-theme="dark"] .fc-desk-drag-ghost-count {
    color: var(--fc-color-on-primary);
}

[data-bs-theme="dark"] .btn-outline-success {
    --bs-btn-color: var(--fc-color-success-text);
    --bs-btn-border-color: var(--fc-color-primary);
    --bs-btn-hover-color: var(--fc-color-on-primary);
    --bs-btn-hover-bg: var(--fc-color-primary);
    --bs-btn-active-color: var(--fc-color-on-primary);
    --bs-btn-active-bg: var(--fc-color-primary);
}

[data-bs-theme="dark"] .btn-light {
    --bs-btn-color: var(--fc-color-text);
    --bs-btn-bg: var(--fc-color-surface-soft);
    --bs-btn-border-color: var(--fc-color-border);
    --bs-btn-hover-color: var(--fc-color-text);
    --bs-btn-hover-bg: #1d2b40;
    --bs-btn-hover-border-color: #33465f;
    --bs-btn-active-color: var(--fc-color-text);
    --bs-btn-active-bg: #1d2b40;
    --bs-btn-active-border-color: #33465f;
}

[data-bs-theme="dark"] .btn-outline-dark {
    --bs-btn-color: var(--fc-color-text);
    --bs-btn-border-color: var(--fc-color-border);
    --bs-btn-hover-color: #052e16;
    --bs-btn-hover-bg: var(--fc-color-text);
    --bs-btn-hover-border-color: var(--fc-color-text);
}

/* Keep form controls on the app surface instead of Bootstrap's near-black. */
[data-bs-theme="dark"] .form-control,
[data-bs-theme="dark"] .form-select,
[data-bs-theme="dark"] .form-check-input,
[data-bs-theme="dark"] .input-group-text {
    background-color: var(--fc-color-surface);
    border-color: var(--fc-color-border);
    color: var(--fc-color-text);
}

[data-bs-theme="dark"] .form-control::placeholder,
[data-bs-theme="dark"] .form-select::placeholder {
    color: var(--fc-color-text-muted);
    opacity: 0.8;
}

[data-bs-theme="dark"] .form-control:focus,
[data-bs-theme="dark"] .form-select:focus {
    background-color: var(--fc-color-surface);
    border-color: var(--fc-color-accent);
    color: var(--fc-color-text);
}

[data-bs-theme="dark"] .form-check-input:checked {
    background-color: var(--fc-color-primary);
    border-color: var(--fc-color-primary);
}

[data-bs-theme="dark"] .form-check-input:focus {
    border-color: var(--fc-color-accent);
    box-shadow: 0 0 0 0.2rem rgba(var(--fc-color-shadow-accent-rgb), 0.25);
}

[data-bs-theme="dark"] .modal-content {
    background: linear-gradient(180deg, var(--fc-modal-surface) 0%, var(--fc-modal-surface-soft) 100%);
    color: var(--fc-color-text);
}

[data-bs-theme="dark"] .modal-header,
[data-bs-theme="dark"] .modal-footer {
    border-color: var(--fc-color-border);
}

[data-bs-theme="dark"] .dropdown-menu {
    background-color: #131d2f;
    border-color: var(--fc-color-border);
    color: var(--fc-color-text);
}

[data-bs-theme="dark"] .dropdown-item {
    color: var(--fc-color-text);
}

[data-bs-theme="dark"] .dropdown-item:hover,
[data-bs-theme="dark"] .dropdown-item:focus {
    background-color: #1d2b40;
    color: var(--fc-color-text);
}

[data-bs-theme="dark"] .dropdown-divider {
    border-color: var(--fc-color-border);
}

[data-bs-theme="dark"] .list-group-item {
    background-color: var(--fc-color-surface);
    border-color: var(--fc-color-border);
    color: var(--fc-color-text);
}

[data-bs-theme="dark"] .offcanvas,
[data-bs-theme="dark"] .toast,
[data-bs-theme="dark"] .popover {
    background-color: var(--fc-color-surface);
    border-color: var(--fc-color-border);
    color: var(--fc-color-text);
}

[data-bs-theme="dark"] .popover-header {
    background-color: var(--fc-color-surface-soft);
    border-color: var(--fc-color-border);
    color: var(--fc-color-text);
}

[data-bs-theme="dark"] .tooltip {
    --bs-tooltip-bg: #253449;
    --bs-tooltip-color: var(--fc-color-text);
}

[data-bs-theme="dark"] code,
[data-bs-theme="dark"] pre {
    color: #f0abfc;
}

[data-bs-theme="dark"] ::selection {
    background: rgba(34, 197, 94, 0.35);
    color: #ffffff;
}

/* --- App shell components --- */

[data-bs-theme="dark"] .app-navbar {
    background: var(--fc-color-palette-rgba-255-255-255-0p92);
    border-bottom-color: var(--fc-color-border);
}

[data-bs-theme="dark"] .app-nav-link {
    color: var(--fc-color-success-text);
    border-color: var(--fc-color-primary-border);
    background: var(--fc-color-primary-soft);
}

[data-bs-theme="dark"] .app-nav-link:hover {
    color: #d1fae5;
    background: #14351f;
}

[data-bs-theme="dark"] .fc-home-account-dropdown,
[data-bs-theme="dark"] .fc-role-switch__menu {
    border-color: var(--fc-color-border);
    background: rgba(19, 29, 47, 0.98);
}

[data-bs-theme="dark"] .fc-dropdown-divider {
    border-color: var(--fc-color-border);
}

/* --- Auth modal (socialAuth.js injects its own light palette at runtime) --- */

[data-bs-theme="dark"] .social-auth-caption {
    color: #9fb0c8;
}

[data-bs-theme="dark"] .social-auth-title {
    color: var(--fc-color-text);
}

[data-bs-theme="dark"] .social-auth-subtitle {
    color: var(--fc-color-text-muted);
}

[data-bs-theme="dark"] .social-auth-more-toggle {
    color: var(--fc-color-text);
    border-color: var(--fc-color-border);
}

[data-bs-theme="dark"] .social-auth-consent {
    color: var(--fc-color-text-muted);
}

[data-bs-theme="dark"] .social-auth-consent a {
    color: #86efac;
}

[data-bs-theme="dark"] .social-auth-consent a:hover {
    color: #d1fae5;
}

[data-bs-theme="dark"] .social-auth-webview-hint {
    color: #fcd34d;
}

[data-bs-theme="dark"] .social-auth-logo {
    color: var(--fc-color-on-primary);
}

/* --- Site notifications: category colors are component-scoped variables --- */

[data-bs-theme="dark"] .site-notification {
    --site-notification-bg: #131f33;
    --site-notification-border: #2a3f5c;
    --site-notification-text: #cfe1f7;
    --site-notification-accent: #93c5fd;
    --site-notification-icon-bg: #17304f;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
}

[data-bs-theme="dark"] .site-notification--info {
    --site-notification-bg: #12233c;
    --site-notification-border: #284b78;
    --site-notification-accent: #93c5fd;
    --site-notification-text: #cfe3ff;
    --site-notification-icon-bg: #17304f;
}

[data-bs-theme="dark"] .site-notification--update {
    --site-notification-bg: #10291b;
    --site-notification-border: #1f5c38;
    --site-notification-accent: #86efac;
    --site-notification-text: #d1fae5;
    --site-notification-icon-bg: #14351f;
}

[data-bs-theme="dark"] .site-notification--maintenance,
[data-bs-theme="dark"] .site-notification--paid-grace {
    --site-notification-bg: #2a2213;
    --site-notification-border: #66501d;
    --site-notification-accent: #fcd34d;
    --site-notification-text: #fde7b0;
    --site-notification-icon-bg: #3a2c12;
}

/* --- Home page badges with hardcoded light-theme colors --- */

[data-bs-theme="dark"] .fc-lesson-status-badge--published {
    color: var(--fc-color-success-text);
    background: var(--fc-color-success-soft);
    border-color: #1f5c38;
}

[data-bs-theme="dark"] .fc-lesson-status-badge--unpublished {
    color: var(--fc-color-danger-text);
    background: var(--fc-color-danger-soft);
    border-color: #6b2b2f;
}

[data-bs-theme="dark"] .fc-lesson-status-badge--collaborator,
[data-bs-theme="dark"] .fc-lesson-status-badge--source_updated,
[data-bs-theme="dark"] .fc-lesson-status-badge--publication_queued {
    color: var(--fc-color-info-text);
    background: var(--fc-color-info-soft);
    border-color: #284b78;
}

[data-bs-theme="dark"] .fc-lesson-status-badge--unsaved_changes,
[data-bs-theme="dark"] .fc-lesson-status-badge--copy {
    color: var(--fc-color-warning-text);
    background: var(--fc-color-warning-soft);
    border-color: #66501d;
}

[data-bs-theme="dark"] .fc-lesson-status-badge--teacher_changes_reset {
    color: #fda4af;
    background: #2f151d;
    border-color: #6d2b3a;
}

[data-bs-theme="dark"] .fc-variant-icon--draft {
    color: var(--fc-color-warning-text);
    background: var(--fc-color-warning-soft);
}

/* --- Video call stage with the default (camera-off) letter avatar ---

   The stage background is a hardcoded light gray for the light theme, so
   in the dark theme it follows the dark surface and the fixed light-theme
   labels on the avatar and the empty state switch to theme text. */
html[data-bs-theme="dark"] #callContainer {
    background: var(--fc-color-surface-soft);
}

html[data-bs-theme="dark"] #callContainer .call-avatar-state,
html[data-bs-theme="dark"] #callContainer .call-empty-state {
    color: var(--fc-color-text-muted);
}

html[data-bs-theme="dark"] #callContainer .call-avatar-name,
html[data-bs-theme="dark"] #callContainer .call-empty-title {
    color: var(--fc-color-text);
}

/* The letter avatar keeps its saturated getAvatarColor() background in both
   themes, so its initial stays white; --fc-color-on-primary flips to dark
   ink in this theme for the bright primary buttons. */
html[data-bs-theme="dark"] #callContainer .call-avatar-circle,
html[data-bs-theme="dark"] #callContainer .call-participant-card-avatar {
    color: #ffffff;
}

[data-bs-theme="dark"] .fc-variant-icon--copy {
    color: var(--fc-color-info-text);
    background: var(--fc-color-info-soft);
}

/* --- Landing: CTA used a deep green gradient stop that now reads as text --- */

[data-bs-theme="dark"] .fc-cta {
    background: linear-gradient(130deg, #16a34a 0%, #14532d 58%, #0b2a19 100%);
    box-shadow: 0 22px 48px rgba(var(--fc-color-shadow-brand-rgb), 0.18);
}

[data-bs-theme="dark"] .fc-cta-title,
[data-bs-theme="dark"] .fc-cta-text,
[data-bs-theme="dark"] .fc-cta-note {
    color: #ffffff;
}

[data-bs-theme="dark"] .fc-cta .fc-primary-btn {
    color: #052e16;
    background: #dcfce7;
}

[data-bs-theme="dark"] .fc-cta .fc-primary-btn:hover {
    color: #052e16;
    background: #ffffff;
}

/* --- Connector settings page defines its own page-scoped palette --- */

[data-bs-theme="dark"] {
    --cs-border: #263449;
    --cs-soft: #162234;
    --cs-ink: #e8eef7;
    --cs-muted: #9fb0c8;
    --cs-muted2: #7f91aa;
    --cs-green: #22c55e;
    --cs-green-btn: #22c55e;
    --cs-green-btn-hover: #16a34a;
    --cs-green-soft: #10291b;
    --cs-green-border: #1f5c38;
    --cs-red: #f87171;
    --cs-amber: #fbbf24;
    --cs-accent: #34d399;
}

/* --- Business landing: its own compact stylesheet predates the tokens --- */

[data-bs-theme="dark"] .fc-business-page .fc-landing-hero-eyebrow,
[data-bs-theme="dark"] .fc-business-kicker {
    color: #4ade80;
}

[data-bs-theme="dark"] .fc-business-cta .fc-business-kicker {
    color: #d1fae5;
}

[data-bs-theme="dark"] .fc-business-flow {
    color: var(--fc-color-text);
    background: var(--fc-color-surface);
    border-color: var(--fc-color-border);
}

[data-bs-theme="dark"] .fc-business-stage {
    border-top-color: var(--fc-color-border);
}

[data-bs-theme="dark"] .fc-business-stage h3,
[data-bs-theme="dark"] .fc-business-benefit h3 {
    color: var(--fc-color-text);
}

[data-bs-theme="dark"] .fc-business-stage p,
[data-bs-theme="dark"] .fc-business-benefit p {
    color: var(--fc-color-text-muted);
}

[data-bs-theme="dark"] .fc-business-checks {
    color: var(--fc-color-text);
}

[data-bs-theme="dark"] .fc-business-checks li::before {
    color: var(--fc-color-success-text);
    background: var(--fc-color-success-soft);
}

[data-bs-theme="dark"] .fc-business-stage-number {
    color: #7f91aa;
}

[data-bs-theme="dark"] .fc-business-icon--purple {
    color: #c4b5fd;
    background: linear-gradient(135deg, #221d3a, #2a2147);
}

[data-bs-theme="dark"] .fc-business-icon--green {
    color: #86efac;
    background: linear-gradient(135deg, #10291b, #14351f);
}

[data-bs-theme="dark"] .fc-business-icon--blue {
    color: #93c5fd;
    background: linear-gradient(135deg, #12233c, #17304f);
}

[data-bs-theme="dark"] .fc-business-icon--orange {
    color: #fcd34d;
    background: linear-gradient(135deg, #2c2110, #3a2c12);
}

[data-bs-theme="dark"] .fc-business-benefit {
    background: var(--fc-color-surface);
    border-color: var(--fc-color-border);
}

[data-bs-theme="dark"] .fc-business-faq-list details {
    background: var(--fc-color-surface);
    border-color: var(--fc-color-border);
}

[data-bs-theme="dark"] .fc-business-faq-list details[open] {
    border-color: var(--fc-color-primary-border);
}

[data-bs-theme="dark"] .fc-business-faq-list summary {
    color: var(--fc-color-text);
}

[data-bs-theme="dark"] .fc-business-faq-list details p {
    color: var(--fc-color-text-muted);
}

[data-bs-theme="dark"] .fc-business-faq-list summary i {
    border-color: var(--fc-color-primary-border);
}

[data-bs-theme="dark"] .fc-business-faq-list summary i::before,
[data-bs-theme="dark"] .fc-business-faq-list summary i::after {
    background: var(--fc-color-success-text);
}

/* Business meeting form, rendered in a Bootstrap modal. */
[data-bs-theme="dark"] #businessMeetingModal .modal-content {
    background: var(--fc-color-surface);
}

[data-bs-theme="dark"] .bm-modal {
    color: var(--fc-color-text);
}

[data-bs-theme="dark"] .bm-title,
[data-bs-theme="dark"] .bm-cal-month,
[data-bs-theme="dark"] .bm-label,
[data-bs-theme="dark"] .bm-input,
[data-bs-theme="dark"] .bm-time-row select {
    color: var(--fc-color-text);
}

[data-bs-theme="dark"] .bm-label em,
[data-bs-theme="dark"] .bm-tz,
[data-bs-theme="dark"] .bm-consent,
[data-bs-theme="dark"] .bm-weekdays span,
[data-bs-theme="dark"] .bm-time-field span,
[data-bs-theme="dark"] .bm-time-colon,
[data-bs-theme="dark"] .bm-cal-day:disabled {
    color: var(--fc-color-text-muted);
}

[data-bs-theme="dark"] .bm-close,
[data-bs-theme="dark"] .bm-cal-nav {
    background: var(--fc-color-surface-soft);
    border-color: var(--fc-color-border);
    color: var(--fc-color-text-muted);
}

[data-bs-theme="dark"] .bm-close:hover,
[data-bs-theme="dark"] .bm-cal-nav:hover:not(:disabled) {
    background: #1d2b40;
    color: var(--fc-color-text);
}

[data-bs-theme="dark"] .bm-cal-day {
    background: var(--fc-color-surface-soft);
    color: var(--fc-color-text);
}

[data-bs-theme="dark"] .bm-cal-day:hover:not(:disabled) {
    background: var(--fc-color-success-soft);
    border-color: var(--fc-color-primary-border);
}

[data-bs-theme="dark"] .bm-cal-day.is-today {
    box-shadow: inset 0 0 0 1px var(--fc-color-primary-border);
}

[data-bs-theme="dark"] .bm-cal-day.is-selected {
    background: var(--fc-color-primary);
    border-color: var(--fc-color-primary);
    color: var(--fc-color-on-primary);
}

[data-bs-theme="dark"] .bm-time-row {
    background: var(--fc-color-surface-soft);
    border-color: var(--fc-color-border);
}

[data-bs-theme="dark"] .bm-input {
    background: var(--fc-color-surface);
    border-color: var(--fc-color-border);
}

[data-bs-theme="dark"] .bm-time-row select {
    background-color: var(--fc-color-surface);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5 6 6.5l5-5' fill='none' stroke='%23a9b8c9' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    border-color: var(--fc-color-border);
}

[data-bs-theme="dark"] .bm-input::placeholder {
    color: var(--fc-color-text-muted);
}

[data-bs-theme="dark"] .bm-input:focus,
[data-bs-theme="dark"] .bm-time-row select:focus-visible {
    border-color: var(--fc-color-primary);
    box-shadow: 0 0 0 3px rgba(var(--fc-color-shadow-brand-rgb), 0.18);
}

[data-bs-theme="dark"] .bm-consent a {
    color: var(--fc-color-primary);
}

[data-bs-theme="dark"] .bm-consent a:hover {
    color: var(--fc-color-primary-hover);
}

[data-bs-theme="dark"] .bm-error {
    background: var(--fc-color-danger-soft);
    border-color: #6b2b2f;
    color: var(--fc-color-danger-text);
}

[data-bs-theme="dark"] .bm-submit {
    background: var(--fc-color-primary);
    color: var(--fc-color-on-primary);
}

[data-bs-theme="dark"] .bm-submit:hover {
    background: var(--fc-color-primary-hover);
    color: var(--fc-color-on-primary);
}

[data-bs-theme="dark"] .bm-submit--ghost {
    background: var(--fc-color-surface-soft);
    color: var(--fc-color-text);
}

/* --- Classroom wallpaper presets ---
 * The wallpaper is a per-class setting, so it is painted inline on <body>.
 * Each built-in preset gets a deep variant here; uploaded pictures are kept
 * as the teacher chose them. The body data attributes come from
 * classroom/templates/classroom/classroom_page.html.
 */

/* A page that renders the classroom shell without a wallpaper context (the
   lesson preview iframe) leaves both attributes empty, so no preset rule
   below matches and the light gradient that JS paints on body would stay
   white under a dark theme. */
html[data-bs-theme="dark"] body[data-classroom-background-kind=""] {
    background-image: linear-gradient(180deg, #0b1220 0%, #111a2b 100%);
}

html[data-bs-theme="dark"] body[data-classroom-background-kind="preset"][data-classroom-background-preset="default"] {
    background-image: linear-gradient(180deg, #0b1220 0%, #111a2b 100%);
}

html[data-bs-theme="dark"] body[data-classroom-background-kind="preset"][data-classroom-background-preset="mint"] {
    background-image: linear-gradient(160deg, #0b1f16 0%, #0f2a1c 48%, #0b1b2a 100%);
}

html[data-bs-theme="dark"] body[data-classroom-background-kind="preset"][data-classroom-background-preset="sky"] {
    background-image: linear-gradient(160deg, #0b1726 0%, #10233c 50%, #101a2e 100%);
}

html[data-bs-theme="dark"] body[data-classroom-background-kind="preset"][data-classroom-background-preset="peach"] {
    background-image: linear-gradient(160deg, #241a12 0%, #2c1e14 52%, #221812 100%);
}

html[data-bs-theme="dark"] body[data-classroom-background-kind="preset"][data-classroom-background-preset="lilac"] {
    background-image: linear-gradient(160deg, #171426 0%, #201a36 54%, #171326 100%);
}

html[data-bs-theme="dark"] body[data-classroom-background-kind="preset"][data-classroom-background-preset="aurora"] {
    background-image:
        radial-gradient(circle at 18% 12%, rgba(34, 197, 94, 0.16), transparent 44%),
        radial-gradient(circle at 82% 4%, rgba(96, 165, 250, 0.16), transparent 42%),
        radial-gradient(circle at 62% 92%, rgba(236, 72, 153, 0.12), transparent 46%),
        linear-gradient(180deg, #0b1220 0%, #101a2a 100%);
}

/* --- Classroom floating toolbar (video call / chat / whiteboard) --- */
/* The pill turns dark via the bg-white override while the glyphs stay
   hardcoded dark, so the call/chat/board icons blend into the background.
   Keep the glyphs on the theme text color, identical in both states. */
[data-bs-theme="dark"] #panel .icon-btn,
[data-bs-theme="dark"] #panel .icon-btn:hover,
[data-bs-theme="dark"] #panel .icon-btn:focus-visible,
[data-bs-theme="dark"] #panel .icon-btn:active,
[data-bs-theme="dark"] #panel .icon-btn:focus {
    color: var(--fc-color-text);
}

[data-bs-theme="dark"] #panel .icon-btn:hover,
[data-bs-theme="dark"] #panel .icon-btn:focus-visible {
    background: rgba(255, 255, 255, 0.08);
}

[data-bs-theme="dark"] #panel > .d-flex {
    border-color: var(--fc-color-border);
}

/* --- AI assistant file chips --- */
/* The generated dark palette darkens the chip fill while the ink stays
   black, leaving black-on-dark text. Keep the glyph on the theme text. */
[data-bs-theme="dark"] #aiAttachedFilesContainer .badge,
[data-bs-theme="dark"] .ai-file-badge {
    color: var(--fc-color-text);
}

/* --- Premium "popular choice" ribbon --- */
/* The pill keeps its light-gold fill in dark mode, but the generated dark
   palette lightens its ink token, leaving near-white text on gold. Pin the
   glyph to the same dark gold the light theme uses. */
[data-bs-theme="dark"] .fc-premium-plan__ribbon {
    color: #6d4b00;
}

/* --- Reduced motion --- */

@media (prefers-reduced-motion: reduce) {
    [data-bs-theme="dark"] * {
        scroll-behavior: auto;
    }
}
