/*
 * Valley Training Operations 2.12
 * Complete high-contrast dark appearance and legacy-component compatibility.
 * Loaded after all other application styles.
 */

/* Card Inventory: every tile uses the same grid rules, including the first/BLS tile. */
.inventory-cards-grid {
    display: grid !important;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)) !important;
    grid-auto-flow: row !important;
    align-items: stretch !important;
    gap: .85rem !important;
}

.inventory-cards-grid > .stat-card,
.inventory-cards-grid > .stat-card:first-child,
.inventory-cards-grid > .stat-card:last-child {
    grid-column: auto !important;
    grid-row: auto !important;
    width: auto !important;
    min-width: 0 !important;
    min-height: 170px !important;
    height: 170px !important;
    padding: 1rem !important;
    color: inherit !important;
    background: #fff !important;
    border: 1px solid rgba(45, 27, 105, .12) !important;
    border-top: 3px solid var(--dynamic-border-top, #e97817) !important;
    border-radius: 16px !important;
    box-shadow: 0 8px 22px rgba(27, 18, 70, .06) !important;
}

.inventory-cards-grid > .stat-card::before,
.inventory-cards-grid > .stat-card:first-child::before {
    display: none !important;
}

.inventory-cards-grid > .stat-card .number,
.inventory-cards-grid > .stat-card:first-child .number {
    color: #1b1246 !important;
    font-size: 1.55rem !important;
}

.inventory-cards-grid > .stat-card .inventory-card-label,
.inventory-cards-grid > .stat-card:first-child .inventory-card-label {
    color: #575366 !important;
    font-size: .72rem !important;
}

.inventory-cards-grid > .stat-card .inventory-card-meta,
.inventory-cards-grid > .stat-card:first-child .inventory-card-meta {
    color: #726d80 !important;
}

.inventory-cards-grid > .stat-card.inventory-card-low-stock {
    background: #fff5f5 !important;
    border-color: #d95467 !important;
}

/* High-contrast dark appearance */
html[data-theme="dark"] {
    --app-slate-700: #f0ebf4;
    --app-slate-600: #d5cfdd;
    --app-slate-500: #b5aebf;
    --app-slate-300: #625a72;
    --app-slate-200: #4a4358;
    --app-slate-100: #2b2638;
    --app-slate-50: #211d2d;
}

html[data-theme="dark"] body,
html[data-theme="dark"] body.app-authenticated {
    color: #eee9f2 !important;
    background:
        radial-gradient(circle at 92% 5%, rgba(242, 140, 40, .11), transparent 28rem),
        radial-gradient(circle at 18% 90%, rgba(91, 65, 170, .16), transparent 34rem),
        #0b0910 !important;
}

html[data-theme="dark"] h1,
html[data-theme="dark"] h2,
html[data-theme="dark"] h3,
html[data-theme="dark"] h4,
html[data-theme="dark"] h5,
html[data-theme="dark"] h6,
html[data-theme="dark"] .card-header {
    color: #fff !important;
}

html[data-theme="dark"] .stat-card .number,
html[data-theme="dark"] .stat-card .stat-number,
html[data-theme="dark"] .stat-value,
html[data-theme="dark"] .profit-value,
html[data-theme="dark"] .profit-value-lg {
    color: #fff !important;
}

html[data-theme="dark"] p,
html[data-theme="dark"] li,
html[data-theme="dark"] td,
html[data-theme="dark"] .form-text {
    color: #ddd7e5;
}

html[data-theme="dark"] .text-muted,
html[data-theme="dark"] small.text-muted,
html[data-theme="dark"] .inventory-card-meta {
    color: #b5aebf !important;
}

html[data-theme="dark"] .card,
html[data-theme="dark"] .stat-card,
html[data-theme="dark"] .view-header,
html[data-theme="dark"] .settings-sidebar,
html[data-theme="dark"] .order-summary,
html[data-theme="dark"] .order-summary-sticky,
html[data-theme="dark"] .modal-content,
html[data-theme="dark"] .modal-content-large,
html[data-theme="dark"] .modal-content-medium {
    color: #eee9f2 !important;
    background: #181421 !important;
    border-color: #494253 !important;
}

html[data-theme="dark"] .card-header,
html[data-theme="dark"] .modal-header,
html[data-theme="dark"] .modal-header-sticky,
html[data-theme="dark"] .modal-footer {
    background: #1b1726 !important;
    border-color: #494253 !important;
}

html[data-theme="dark"] .app-authenticated .app-page-header {
    background:
        linear-gradient(90deg, #f28c28, #ffb15f) left / 5px 100% no-repeat,
        linear-gradient(125deg, #201b2d, #17131f) !important;
    border-color: #51485d !important;
}

html[data-theme="dark"] .app-authenticated .app-page-header p {
    color: #c9c2d1 !important;
}

html[data-theme="dark"] .filter-bar,
html[data-theme="dark"] .classes-filter-grid-extended,
html[data-theme="dark"] .students-filter-grid,
html[data-theme="dark"] .user-search-grid,
html[data-theme="dark"] .date-filter-grid,
html[data-theme="dark"] .instructor-report-filter-grid,
html[data-theme="dark"] .filter-row {
    color: #eee9f2 !important;
    background: #181421 !important;
    border-color: #51495d !important;
}

html[data-theme="dark"] .form-label,
html[data-theme="dark"] .form-group > label,
html[data-theme="dark"] .filter-bar label,
html[data-theme="dark"] .classes-filter-grid-extended label,
html[data-theme="dark"] .students-filter-grid label,
html[data-theme="dark"] .user-search-grid label,
html[data-theme="dark"] .date-filter-grid label {
    color: #ded8e6 !important;
}

html[data-theme="dark"] .form-control,
html[data-theme="dark"] .form-select,
html[data-theme="dark"] input:not([type="checkbox"]):not([type="radio"]):not([type="color"]),
html[data-theme="dark"] select,
html[data-theme="dark"] textarea {
    color: #fff !important;
    background-color: #231e30 !important;
    border-color: #6a6079 !important;
}

html[data-theme="dark"] .form-control::placeholder,
html[data-theme="dark"] input::placeholder,
html[data-theme="dark"] textarea::placeholder {
    color: #a9a1b3 !important;
    opacity: 1;
}

html[data-theme="dark"] .form-control:focus,
html[data-theme="dark"] .form-select:focus,
html[data-theme="dark"] input:focus,
html[data-theme="dark"] select:focus,
html[data-theme="dark"] textarea:focus {
    border-color: #ff9f43 !important;
    outline: 2px solid transparent;
    box-shadow: 0 0 0 3px rgba(255, 159, 67, .28) !important;
}

html[data-theme="dark"] .table-responsive,
html[data-theme="dark"] .table {
    color: #eee9f2 !important;
    background: #15111d !important;
    border-color: #4d4658 !important;
}

html[data-theme="dark"] .table th {
    color: #f4eff7 !important;
    background: #30293f !important;
    border-bottom-color: #62586e !important;
}

html[data-theme="dark"] .table td {
    color: #e8e2ed !important;
    border-bottom-color: #3d3747 !important;
}

html[data-theme="dark"] .table tbody tr:nth-child(even) {
    background: #1d1826 !important;
}

html[data-theme="dark"] .table tbody tr:hover {
    background: #332940 !important;
}

html[data-theme="dark"] a:not(.btn):not(.nav-link):not(.sidebar-brand) {
    color: #ddbfff;
}

html[data-theme="dark"] .btn-primary {
    color: #211002 !important;
    border-color: #ffab52 !important;
    background: linear-gradient(180deg, #ffad55, #f28c28) !important;
    box-shadow: 0 8px 22px rgba(242, 140, 40, .25) !important;
}

html[data-theme="dark"] .btn-primary:hover {
    color: #160a00 !important;
    background: linear-gradient(180deg, #ffbd78, #ff9a32) !important;
}

html[data-theme="dark"] .btn-secondary {
    color: #fff !important;
    border-color: #7769a2 !important;
    background: linear-gradient(180deg, #4f3b8f, #342568) !important;
}

html[data-theme="dark"] .btn-outline,
html[data-theme="dark"] .btn-outline-primary,
html[data-theme="dark"] .btn-outline-secondary {
    color: #f0ebf4 !important;
    background: #231e30 !important;
    border-color: #756b82 !important;
}

html[data-theme="dark"] .badge-success {
    color: #b8f7d6 !important;
    background: #123c2b !important;
    border: 1px solid #267653;
}

html[data-theme="dark"] .badge-warning {
    color: #ffe69a !important;
    background: #49350d !important;
    border: 1px solid #80611d;
}

html[data-theme="dark"] .badge-danger {
    color: #ffc1cb !important;
    background: #4c1e28 !important;
    border: 1px solid #8f394a;
}

html[data-theme="dark"] .badge-info {
    color: #b8e8ff !important;
    background: #15384c !important;
    border: 1px solid #2b6d8d;
}

html[data-theme="dark"] .badge-primary {
    color: #e4d5ff !important;
    background: #35265d !important;
    border: 1px solid #66519b;
}

html[data-theme="dark"] .badge-secondary {
    color: #e4deea !important;
    background: #37313f !important;
    border: 1px solid #655d6e;
}

html[data-theme="dark"] .alert-success {
    color: #c8f8df !important;
    background: #123326 !important;
    border-color: #2d805b !important;
}

html[data-theme="dark"] .alert-warning {
    color: #ffe8a6 !important;
    background: #3f2f0f !important;
    border-color: #927126 !important;
}

html[data-theme="dark"] .alert-error,
html[data-theme="dark"] .alert-danger {
    color: #ffd0d7 !important;
    background: #401b23 !important;
    border-color: #a34457 !important;
}

html[data-theme="dark"] .alert-info {
    color: #c8edff !important;
    background: #143244 !important;
    border-color: #34789a !important;
}

html[data-theme="dark"] .inventory-cards-grid > .stat-card,
html[data-theme="dark"] .inventory-cards-grid > .stat-card:first-child,
html[data-theme="dark"] .inventory-cards-grid > .stat-card:last-child {
    color: #eee9f2 !important;
    background: #1c1726 !important;
    border-color: #51495c !important;
    border-top-color: var(--dynamic-border-top, #f28c28) !important;
    box-shadow: 0 9px 24px rgba(0, 0, 0, .24) !important;
}

html[data-theme="dark"] .inventory-cards-grid > .stat-card .number,
html[data-theme="dark"] .inventory-cards-grid > .stat-card:first-child .number {
    color: #fff !important;
}

html[data-theme="dark"] .inventory-cards-grid > .stat-card .inventory-card-label,
html[data-theme="dark"] .inventory-cards-grid > .stat-card:first-child .inventory-card-label {
    color: #d9d2e1 !important;
}

html[data-theme="dark"] .inventory-cards-grid > .stat-card .inventory-card-meta,
html[data-theme="dark"] .inventory-cards-grid > .stat-card:first-child .inventory-card-meta {
    color: #b8b0c2 !important;
}

html[data-theme="dark"] .inventory-card-low-stock {
    background: #351820 !important;
    border-color: #9d4053 !important;
}

html[data-theme="dark"] .theme-selector-label {
    color: #d2cbd9 !important;
}

html[data-theme="dark"] .theme-selector-options {
    background: #0d0a12 !important;
    border-color: #5a5265 !important;
}

html[data-theme="dark"] .theme-selector-options button {
    color: #d1cad9 !important;
}

html[data-theme="dark"] .theme-selector-options button.active,
html[data-theme="dark"] .theme-selector-options button[aria-pressed="true"] {
    color: #211002 !important;
    background: #f6a14c !important;
}

html[data-theme="dark"] .nav-menu > ul > li > a {
    color: rgba(255,255,255,.84);
}

html[data-theme="dark"] .nav-menu .nav-section-title {
    color: rgba(255,255,255,.58);
}

html[data-theme="dark"] .user-identity small {
    color: rgba(255,255,255,.68);
}

/* Homepage: use a complete dark palette when viewed either signed out or
   inside the signed-in application shell. */
html[data-theme="dark"] body[data-page="home"] {
    color: #eef2f8 !important;
    background:
        radial-gradient(circle at 90% 8%, rgba(45, 77, 190, .16), transparent 34rem),
        radial-gradient(circle at 8% 55%, rgba(233, 120, 23, .08), transparent 28rem),
        #080b14 !important;
}

html[data-theme="dark"] body[data-page="home"] .home-section-header {
    color: #f8fafc !important;
}

html[data-theme="dark"] body[data-page="home"] .home-section-header i,
html[data-theme="dark"] body[data-page="home"] .info-section > h2 i {
    color: #ff9d45 !important;
}

html[data-theme="dark"] body[data-page="home"] .feature-card,
html[data-theme="dark"] body[data-page="home"] .info-section:not(.info-section-contact-gradient),
html[data-theme="dark"] body[data-page="home"] .stats-section .stat-box {
    color: #eef2f8 !important;
    background: #151a27 !important;
    border: 1px solid #374056 !important;
    box-shadow: 0 12px 28px rgba(0, 0, 0, .24) !important;
}

html[data-theme="dark"] body[data-page="home"] .feature-card {
    border-top: 3px solid #f28c28 !important;
}

html[data-theme="dark"] body[data-page="home"] .feature-icon {
    color: #ffad5d !important;
    background: #282131 !important;
}

html[data-theme="dark"] body[data-page="home"] .feature-title,
html[data-theme="dark"] body[data-page="home"] .stats-section .stat-label {
    color: #f8fafc !important;
}

html[data-theme="dark"] body[data-page="home"] .feature-description,
html[data-theme="dark"] body[data-page="home"] .text-dark-gray,
html[data-theme="dark"] body[data-page="home"] .text-gray-777 {
    color: #bdc6d6 !important;
}

html[data-theme="dark"] body[data-page="home"] .stats-section .stat-number {
    color: #ff9d45 !important;
}

html[data-theme="dark"] body[data-page="home"] .course-type-section {
    color: #eef2f8 !important;
    background: #1a202e !important;
    border: 1px solid #3a4358 !important;
    box-shadow: 0 10px 24px rgba(0, 0, 0, .26) !important;
}

html[data-theme="dark"] body[data-page="home"] .course-type-list {
    background: #1a202e !important;
}

html[data-theme="dark"] body[data-page="home"] .course-type-list li {
    color: #e8edf5 !important;
    border-bottom-color: #323b4e !important;
}

html[data-theme="dark"] body[data-page="home"] .course-type-list li:hover {
    color: #fff !important;
    background: #242c3d !important;
}

html[data-theme="dark"] body[data-page="home"] .info-section-blue-gradient {
    background: linear-gradient(135deg, #151a27, #14243a) !important;
    border-color: #345476 !important;
}

html[data-theme="dark"] body[data-page="home"] .info-section-orange-gradient {
    background: linear-gradient(135deg, #151a27, #302116) !important;
    border-color: #76502d !important;
}

html[data-theme="dark"] body[data-page="home"] .info-section-green-gradient {
    background: linear-gradient(135deg, #131d1a, #153326) !important;
    border-color: #35805b !important;
}

html[data-theme="dark"] body[data-page="home"] .info-section-green-gradient .text-green-primary {
    color: #86efac !important;
}

html[data-theme="dark"] body[data-page="home"] .info-section-green-gradient .text-green-dark {
    color: #c6f6d8 !important;
}

html[data-theme="dark"] body[data-page="home"] .btn-hero-primary {
    color: #1d0d00 !important;
    background: #ff9d45 !important;
}

html[data-theme="dark"] body[data-page="home"] .btn-hero-secondary {
    color: #24165c !important;
    background: #fff !important;
}

html[data-theme="dark"] body[data-page="home"] .btn-hero-secondary:hover {
    color: #170d43 !important;
    background: #f1edf9 !important;
}

/* Authenticated compatibility layer for legacy components that still use
   light-only utility classes or hard-coded component colors. */
html[data-theme="dark"] .app-authenticated .bg-white,
html[data-theme="dark"] .app-authenticated .bg-light-gray {
    color: #eef2f8 !important;
    background: #1b202d !important;
}

html[data-theme="dark"] .app-authenticated .text-dark,
html[data-theme="dark"] .app-authenticated .text-dark-gray {
    color: #e8edf5 !important;
}

html[data-theme="dark"] .app-authenticated .text-primary,
html[data-theme="dark"] .app-authenticated .text-info {
    color: #8ec5ff !important;
}

html[data-theme="dark"] .app-authenticated .text-success {
    color: #86efac !important;
}

html[data-theme="dark"] .app-authenticated code {
    color: #d8e8ff !important;
    background: #101522 !important;
    border: 1px solid #3b465c !important;
}

/* Order eCards */
html[data-theme="dark"] body[data-page="order-cards"] .org-header {
    color: #eaf0f8 !important;
    background: #252b3a !important;
    border-color: #4f8cff !important;
}

html[data-theme="dark"] body[data-page="order-cards"] .order-grid {
    background: #111622 !important;
    border: 1px solid #353e52 !important;
    box-shadow: 0 12px 28px rgba(0, 0, 0, .22) !important;
}

html[data-theme="dark"] body[data-page="order-cards"] .order-card-title {
    color: #f8fafc !important;
}

html[data-theme="dark"] body[data-page="order-cards"] .order-card-org {
    color: #b8c2d2 !important;
}

html[data-theme="dark"] body[data-page="order-cards"] .order-card-stock {
    color: #dbe4ef !important;
    background: #252c3b !important;
}

html[data-theme="dark"] body[data-page="order-cards"] .order-card-stock.low {
    color: #ffe49a !important;
    background: #49370f !important;
}

html[data-theme="dark"] body[data-page="order-cards"] .order-card-stock.out {
    color: #ffc7d0 !important;
    background: #4a1f29 !important;
}

html[data-theme="dark"] body[data-page="order-cards"] .quantity-input button {
    color: #f3f6fb !important;
    background: #262c3a !important;
    border-color: #59647a !important;
}

html[data-theme="dark"] body[data-page="order-cards"] .quantity-input button:hover {
    color: #fff !important;
    background: #343d51 !important;
    border-color: #ff9d45 !important;
}

html[data-theme="dark"] body[data-page="order-cards"] .order-group-card,
html[data-theme="dark"] body[data-page="order-cards"] .order-group-body {
    color: #e8edf5 !important;
    background: #181e2a !important;
    border-color: #394257 !important;
}

/* Reports and informational banners */
html[data-theme="dark"] body[data-page="class-report"] .date-range-info {
    color: #dce6f2 !important;
    background: #1c2432 !important;
    border: 1px solid #3c475d !important;
}

html[data-theme="dark"] body[data-page="class-report"] .chart-bar-value {
    color: #f8fafc !important;
}

html[data-theme="dark"] body[data-page="class-report"] .chart-bar-label,
html[data-theme="dark"] body[data-page="class-report"] .chart-bar-label-sm,
html[data-theme="dark"] body[data-page="class-report"] .stat-sublabel {
    color: #b8c2d2 !important;
}

/* Inquiries */
html[data-theme="dark"] body[data-page="inquiries"] .inquiry-stats .stat-card .number,
html[data-theme="dark"] body[data-page="inquiries"] .inquiry-stats .stat-card .label {
    color: #f8fafc !important;
}

html[data-theme="dark"] body[data-page="inquiries"] .inquiry-table {
    color: #e8edf5 !important;
    background: #161b27 !important;
}

html[data-theme="dark"] body[data-page="inquiries"] .inquiry-table th {
    color: #f5f7fb !important;
    background: #283044 !important;
    border-color: #465169 !important;
}

html[data-theme="dark"] body[data-page="inquiries"] .inquiry-table td {
    color: #e6ebf2 !important;
    border-color: #343d50 !important;
}

/* Class detail and other record information tiles */
html[data-theme="dark"] .app-authenticated .info-grid-compact .info-item,
html[data-theme="dark"] .app-authenticated .info-item {
    color: #e8edf5 !important;
    background: #202735 !important;
    border-left-color: #5b9cff !important;
}

html[data-theme="dark"] .app-authenticated .info-label {
    color: #aeb9ca !important;
}

html[data-theme="dark"] .app-authenticated .info-value {
    color: #f3f6fa !important;
}

html[data-theme="dark"] .app-authenticated .info-subtext {
    color: #b8c2d2 !important;
}

html[data-theme="dark"] .app-authenticated .course-option-tag {
    color: #dce6f2 !important;
    background: #111722 !important;
    border-color: #46536b !important;
}

html[data-theme="dark"] body[data-page="class-detail"] .stat-cards .stat-card.secondary .stat-number,
html[data-theme="dark"] body[data-page="class-detail"] .stat-cards .stat-card.secondary .stat-label,
html[data-theme="dark"] body[data-page="class-detail"] .stat-cards .stat-card .stat-label {
    color: #f5f7fb !important;
    text-shadow: none !important;
}

html[data-theme="dark"] body[data-page="class-detail"] .quick-add-student-section {
    color: #e8edf5 !important;
    background: #202735 !important;
    border-color: #3d475b !important;
}

html[data-theme="dark"] .app-authenticated .registrations-empty,
html[data-theme="dark"] .app-authenticated .empty-state {
    color: #b9c3d3 !important;
    background: #121824 !important;
    border-color: #465169 !important;
}

/* Create/edit class */
html[data-theme="dark"] body[data-page="create-class"] .pricing-guide-box,
html[data-theme="dark"] body[data-page="edit-class"] .pricing-guide-box {
    color: #e8edf5 !important;
    background: linear-gradient(135deg, #182537, #161d29) !important;
    border-color: #4b9bd8 !important;
}

html[data-theme="dark"] body[data-page="create-class"] .pricing-guide-box td,
html[data-theme="dark"] body[data-page="edit-class"] .pricing-guide-box td {
    color: #e7edf5 !important;
    border-color: #364157 !important;
}

html[data-theme="dark"] body[data-page="create-class"] #class-summary,
html[data-theme="dark"] body[data-page="edit-class"] #class-summary {
    color: #e8edf5 !important;
    background: #171e2a !important;
    border-color: #5b9cff !important;
}

html[data-theme="dark"] body[data-page="create-class"] #class-summary strong,
html[data-theme="dark"] body[data-page="edit-class"] #class-summary strong {
    color: #f8fafc !important;
}

/* Card Sales & Transfers */
html[data-theme="dark"] body[data-page="card-sales"] .transfer-form,
html[data-theme="dark"] body[data-page="card-sales"] .instructor-inventory-group {
    color: #e8edf5 !important;
    background: #1e2533 !important;
    border: 1px solid #3d485e !important;
}

html[data-theme="dark"] body[data-page="card-sales"] .inventory-item {
    color: #e8edf5 !important;
    background: #222a39 !important;
    border: 1px solid #3b465b !important;
}

html[data-theme="dark"] body[data-page="card-sales"] .inventory-item .cert-name,
html[data-theme="dark"] body[data-page="card-sales"] .inventory-item > span:not(.quantity) {
    color: #f2f5fa !important;
}

html[data-theme="dark"] body[data-page="card-sales"] .inventory-item .quantity {
    color: #79b8ff !important;
}

html[data-theme="dark"] body[data-page="card-sales"] .inventory-item .quantity.low {
    color: #ffe08a !important;
}

html[data-theme="dark"] body[data-page="card-sales"] .inventory-item .quantity.out {
    color: #ff9dab !important;
}

html[data-theme="dark"] body[data-page="card-sales"] .instructor-inventory-group h4 {
    color: #f8fafc !important;
}

/* Class payment confirmation and eCard source selection */
html[data-theme="dark"] .app-authenticated .payment-confirm-box {
    color: #eef2f8 !important;
    background: #1b202d !important;
    border-color: #59657c !important;
}

html[data-theme="dark"] .app-authenticated .payment-confirm-box-warn {
    background: #2d2514 !important;
    border-color: #e6b83f !important;
}

html[data-theme="dark"] .app-authenticated .payment-confirm-box-ok {
    background: #142b21 !important;
    border-color: #3e9b70 !important;
}

html[data-theme="dark"] .app-authenticated .payment-confirm-status,
html[data-theme="dark"] .app-authenticated .payment-confirm-details {
    color: #dce4ef !important;
}

html[data-theme="dark"] .app-authenticated .card-source-selector {
    color: #e8edf5 !important;
    background: #1e2634 !important;
    border-color: #5b9cff !important;
}

html[data-theme="dark"] .app-authenticated .card-source-option {
    color: #e8edf5 !important;
    background: #111722 !important;
    border-color: #46536b !important;
}

html[data-theme="dark"] .app-authenticated .card-source-option:hover {
    color: #fff !important;
    background: #202a3b !important;
    border-color: #ff9d45 !important;
}

/* AHA course-option controls used by Create Class and Edit Class */
html[data-theme="dark"] .app-authenticated .aha-roster-options {
    color: #e8edf5 !important;
    background: #1b2230 !important;
    border-color: #46536b !important;
}

html[data-theme="dark"] .app-authenticated .aha-course-name,
html[data-theme="dark"] .app-authenticated .aha-main-course,
html[data-theme="dark"] .app-authenticated .aha-suboption {
    color: #e8edf5 !important;
}

html[data-theme="dark"] .app-authenticated .aha-suboption:hover {
    color: #fff !important;
}

html[data-theme="dark"] .app-authenticated .heartsaver-options-display {
    color: #e8edf5 !important;
    background: #1b2230 !important;
    border: 1px solid #46536b !important;
}

html[data-theme="dark"] .app-authenticated .hs-option-badge.checked {
    color: #baf7d2 !important;
    background: #153a29 !important;
    border-color: #34795a !important;
}

html[data-theme="dark"] .app-authenticated .hs-option-badge.unchecked {
    color: #c2cad7 !important;
    background: #252c3a !important;
    border-color: #505b70 !important;
}

/* Certification rows on user and instructor records */
html[data-theme="dark"] .app-authenticated .cert-row,
html[data-theme="dark"] .app-authenticated .instructor-cert-row {
    color: #e8edf5 !important;
    background: #1b2230 !important;
    border-color: #3d485d !important;
}

html[data-theme="dark"] .app-authenticated .cert-row-expired {
    color: #ffe4e8 !important;
    background: #3a1e27 !important;
    border-color: #85394b !important;
}

html[data-theme="dark"] .app-authenticated .cert-row-expiring {
    color: #fff0bd !important;
    background: #3a2e17 !important;
    border-color: #856821 !important;
}

html[data-theme="dark"] .app-authenticated .cert-name,
html[data-theme="dark"] .app-authenticated .cert-date-wrapper {
    color: #f5f7fb !important;
}

html[data-theme="dark"] .app-authenticated .cert-days-left-muted {
    color: #b8c2d2 !important;
}

html[data-theme="dark"] .app-authenticated .cert-days-left-danger {
    color: #ff9dab !important;
}

html[data-theme="dark"] .app-authenticated .cert-days-left-warning {
    color: #ffe08a !important;
}

html[data-theme="dark"] .app-authenticated .cert-edit-form {
    color: #e8edf5 !important;
    background: #161d29 !important;
    border-color: #3d485d !important;
}

/* Totals rows shared by reports, financial reports, and invoice tables */
html[data-theme="dark"] .app-authenticated .table tfoot,
html[data-theme="dark"] .app-authenticated .table tfoot tr,
html[data-theme="dark"] .app-authenticated .table tfoot td,
html[data-theme="dark"] .app-authenticated .table-footer-total,
html[data-theme="dark"] .app-authenticated tr.table-footer-total,
html[data-theme="dark"] .app-authenticated tfoot.table-footer-total {
    color: #f5f7fb !important;
    background: #293144 !important;
    border-color: #59657c !important;
}

html[data-theme="dark"] .app-authenticated .table-footer-total strong,
html[data-theme="dark"] .app-authenticated .table tfoot strong {
    color: #fff !important;
}

/* Settings workspace shell */
html[data-theme="dark"] body[data-page="settings"] .settings-container,
html[data-theme="dark"] body[data-page="settings"] .settings-layout {
    color: #e8edf5 !important;
    background: #0f141e !important;
    border: 1px solid #30394c !important;
    box-shadow: 0 18px 42px rgba(0, 0, 0, .28) !important;
}

html[data-theme="dark"] body[data-page="settings"] .settings-main {
    color: #e8edf5 !important;
    background: #0f141e !important;
}

html[data-theme="dark"] body[data-page="settings"] .settings-nav {
    color: #e8edf5 !important;
    background: #181e2a !important;
    border-color: #394357 !important;
}

html[data-theme="dark"] body[data-page="settings"] .settings-header {
    border-color: #394357 !important;
}

html[data-theme="dark"] body[data-page="settings"] .settings-header h2 {
    color: #f8fafc !important;
}

html[data-theme="dark"] body[data-page="settings"] .settings-sidebar .nav-section-title {
    color: #aeb9ca !important;
}

/* Public class schedule */
html[data-theme="dark"] body[data-page="public-schedule"] .schedule-table {
    color: #e8edf5 !important;
    background: #111722 !important;
    border: 1px solid #3b465b !important;
}

html[data-theme="dark"] body[data-page="public-schedule"] .schedule-table thead,
html[data-theme="dark"] body[data-page="public-schedule"] .schedule-table th {
    color: #f8fafc !important;
    background: #293144 !important;
    border-color: #59657c !important;
}

html[data-theme="dark"] body[data-page="public-schedule"] .schedule-table td {
    color: #e6ebf2 !important;
    background: #111722 !important;
    border-color: #3a4458 !important;
}

html[data-theme="dark"] body[data-page="public-schedule"] .schedule-table tbody tr:hover td {
    color: #fff !important;
    background: #202a3a !important;
}

html[data-theme="dark"] body[data-page="public-schedule"] .schedule-table td::before {
    color: #aeb9ca !important;
}

/* Public class registration */
body[data-page="class-registration"] .registration-container {
    display: grid !important;
    grid-template-columns: minmax(320px, .82fr) minmax(0, 1.38fr) !important;
    align-items: start !important;
    gap: 1.5rem !important;
    width: min(calc(100% - 2rem), 1120px) !important;
    max-width: none !important;
    margin: 1.25rem auto 2.5rem !important;
}

body[data-page="class-registration"] .registration-container > h1 {
    grid-column: 1 / -1;
    margin: 0 !important;
    color: #17233a;
    font-size: clamp(1.65rem, 3vw, 2.25rem);
    letter-spacing: -.025em;
}

body[data-page="class-registration"] .registration-class-card,
body[data-page="class-registration"] .registration-form-card,
body[data-page="class-registration"] .registration-state-card {
    min-width: 0;
    margin: 0 !important;
    border: 1px solid #d9e0ea;
    border-radius: 16px !important;
    box-shadow: 0 16px 38px rgba(21, 33, 55, .09) !important;
}

body[data-page="class-registration"] .registration-class-card {
    position: sticky;
    top: 1.25rem;
    padding: 1.35rem !important;
    overflow: visible !important;
    background:
        linear-gradient(90deg, #f47b20, #f7a145) top / 100% 4px no-repeat,
        #fff !important;
}

body[data-page="class-registration"] .class-info-header {
    margin: .2rem 0 .8rem !important;
    color: #17233a !important;
    font-size: 1.32rem;
    line-height: 1.28;
}

body[data-page="class-registration"] .badge-container-row {
    margin-bottom: 1.2rem;
}

body[data-page="class-registration"] .class-info-grid {
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: .7rem !important;
    padding: 0 !important;
    box-shadow: none !important;
}

body[data-page="class-registration"] .class-info-grid .info-item {
    display: flex;
    align-items: flex-start;
    min-width: 0;
    gap: .55rem;
    padding: .8rem !important;
    color: #334155;
    background: #f5f7fb !important;
    border: 1px solid #e1e7f0 !important;
    border-radius: 10px;
}

body[data-page="class-registration"] .class-info-grid .info-item i {
    flex: 0 0 auto;
    width: 1rem;
    margin: .15rem 0 0 !important;
    color: #2563eb !important;
    text-align: center;
}

body[data-page="class-registration"] .class-info-grid .info-item span {
    min-width: 0;
    overflow-wrap: anywhere;
}

body[data-page="class-registration"] .status-badge {
    display: block;
    width: 100%;
    margin-top: 1rem;
    padding: .72rem .85rem;
    border-radius: 9px;
    font-weight: 700;
}

body[data-page="class-registration"] .location-details-box {
    margin-top: 1rem;
    padding: 1rem;
    color: #475569;
    background: #f8fafc;
    border: 1px solid #e1e7f0;
    border-radius: 10px;
}

body[data-page="class-registration"] .registration-form-card,
body[data-page="class-registration"] .registration-state-card {
    padding: clamp(1.25rem, 2.5vw, 2rem) !important;
}

body[data-page="class-registration"] .registration-form-card > h3 {
    margin: 0 0 1.5rem;
    padding-bottom: 1rem;
    color: #17233a;
    border-bottom: 1px solid #e1e7f0;
}

body[data-page="class-registration"] .registration-form-card .form-row {
    gap: 1rem;
}

body[data-page="class-registration"] .registration-form-card .form-group {
    margin-bottom: 1.15rem;
}

body[data-page="class-registration"] .registration-form-card .form-control {
    min-height: 46px;
    border-radius: 9px;
}

body[data-page="class-registration"] .registration-form-card textarea.form-control {
    min-height: 110px;
}

body[data-page="class-registration"] .what-to-expect-box {
    margin: .35rem 0 1.35rem;
    padding: 1.1rem 1.2rem;
    color: #34435a;
    background: #eef5ff;
    border: 1px solid #cfe0f7;
    border-left: 4px solid #2563eb;
    border-radius: 10px;
}

body[data-page="class-registration"] .what-to-expect-title {
    color: #163b73;
}

body[data-page="class-registration"] .what-to-expect-list {
    margin: .65rem 0 0 1.2rem;
    padding: 0;
}

body[data-page="class-registration"] .form-button-row {
    align-items: stretch;
}

body[data-page="class-registration"] .form-button-row .btn {
    min-height: 46px;
    justify-content: center;
}

html[data-theme="dark"] body[data-page="class-registration"] .registration-container > h1,
html[data-theme="dark"] body[data-page="class-registration"] .class-info-header,
html[data-theme="dark"] body[data-page="class-registration"] .registration-form-card > h3 {
    color: #f8fafc !important;
}

html[data-theme="dark"] body[data-page="class-registration"] .registration-class-card,
html[data-theme="dark"] body[data-page="class-registration"] .registration-form-card,
html[data-theme="dark"] body[data-page="class-registration"] .registration-state-card {
    color: #e8edf5 !important;
    background-color: #171d29 !important;
    border-color: #3c465a !important;
    box-shadow: 0 18px 44px rgba(0, 0, 0, .28) !important;
}

html[data-theme="dark"] body[data-page="class-registration"] .registration-class-card {
    background:
        linear-gradient(90deg, #ff8a2b, #f6a34e) top / 100% 4px no-repeat,
        #171d29 !important;
}

html[data-theme="dark"] body[data-page="class-registration"] .class-info-grid .info-item,
html[data-theme="dark"] body[data-page="class-registration"] .location-details-box {
    color: #e4eaf3 !important;
    background: #222b3a !important;
    border-color: #3b485d !important;
}

html[data-theme="dark"] body[data-page="class-registration"] .class-info-grid .info-item i {
    color: #65a6ff !important;
}

html[data-theme="dark"] body[data-page="class-registration"] .registration-form-card > h3 {
    border-color: #3b465a;
}

html[data-theme="dark"] body[data-page="class-registration"] .what-to-expect-box {
    color: #dbe7f7 !important;
    background: #1d3048 !important;
    border-color: #3e6086 !important;
    border-left-color: #62a7ff !important;
}

html[data-theme="dark"] body[data-page="class-registration"] .what-to-expect-title,
html[data-theme="dark"] body[data-page="class-registration"] .what-to-expect-box strong {
    color: #f8fbff !important;
}

html[data-theme="dark"] body[data-page="class-registration"] .status-available {
    color: #b9f6d3 !important;
    background: #123c2c !important;
    border: 1px solid #287958 !important;
}

html[data-theme="dark"] body[data-page="class-registration"] .status-limited {
    color: #ffe6a3 !important;
    background: #403415 !important;
    border: 1px solid #826b25 !important;
}

html[data-theme="dark"] body[data-page="class-registration"] .status-full {
    color: #ffc0c9 !important;
    background: #461f29 !important;
    border: 1px solid #914052 !important;
}

@media (max-width: 800px) {
    body[data-page="class-registration"] .registration-container {
        grid-template-columns: minmax(0, 1fr) !important;
        width: min(calc(100% - 1.25rem), 680px) !important;
        gap: 1rem !important;
        margin-top: 1rem !important;
    }

    body[data-page="class-registration"] .registration-container > h1 {
        grid-column: auto;
    }

    body[data-page="class-registration"] .registration-class-card {
        position: static;
    }
}

@media (max-width: 540px) {
    body[data-page="class-registration"] .class-info-grid,
    body[data-page="class-registration"] .registration-form-card .form-row {
        display: grid !important;
        grid-template-columns: minmax(0, 1fr) !important;
    }

    body[data-page="class-registration"] .form-button-row {
        display: grid;
        grid-template-columns: minmax(0, 1fr);
    }

    body[data-page="class-registration"] .form-button-row .btn {
        width: 100%;
    }
}

@media (max-width: 540px) {
    .inventory-cards-grid {
        grid-template-columns: 1fr 1fr !important;
    }
}

@media (max-width: 380px) {
    .inventory-cards-grid {
        grid-template-columns: 1fr !important;
    }
}

@media print {
    .inventory-cards-grid > .stat-card,
    html[data-theme="dark"] .inventory-cards-grid > .stat-card {
        color: #111827 !important;
        background: #fff !important;
        border-color: #9ca3af !important;
        box-shadow: none !important;
    }
}
