:root {
    --dg-primary: #b35ce5;
    --dg-accent: #f06292;
    --dg-plum-900: #0f0b14;
    --dg-plum-800: #1a1321;
    --dg-plum-700: #2a1d34;
    --dg-text: #f5ecff;
    --dg-body-bg: radial-gradient(circle at 20% 10%, rgba(179, 92, 229, 0.2) 0%, rgba(179, 92, 229, 0) 45%),
    radial-gradient(circle at 80% 0%, rgba(240, 98, 146, 0.15) 0%, rgba(240, 98, 146, 0) 40%),
    linear-gradient(180deg, var(--dg-plum-900) 0%, #09070d 100%);
    --dg-card-bg: linear-gradient(160deg, #21182b 0%, #171120 100%);
    --dg-card-shadow: 0 14px 36px rgba(0, 0, 0, 0.4);
    --dg-muted-text: #cbb8df;
    --dg-token-bg: #21192c;
}

[data-theme="light"] {
    --dg-primary: #8b3fd1;
    --dg-accent: #c4417b;
    --dg-text: #24162f;
    --dg-body-bg: radial-gradient(circle at 20% 10%, rgba(139, 63, 209, 0.14) 0%, rgba(139, 63, 209, 0) 42%),
    radial-gradient(circle at 80% 0%, rgba(196, 65, 123, 0.10) 0%, rgba(196, 65, 123, 0) 38%),
    linear-gradient(180deg, #fffafe 0%, #f3edf8 100%);
    --dg-card-bg: linear-gradient(160deg, #ffffff 0%, #f7f0fb 100%);
    --dg-card-shadow: 0 12px 30px rgba(93, 61, 122, 0.12);
    --dg-muted-text: #6a5a78;
    --dg-token-bg: #f4edf9;
}

html,
body {
    font-family: 'Outfit', sans-serif;
    background: var(--dg-body-bg);
    color: var(--dg-text);
    min-height: 100%;
}

.dg-appbar {
    background: linear-gradient(180deg, #120d19 0%, #1a1321 100%) !important;
    color: #f5ecff !important;
    border-bottom: 1px solid rgba(245, 236, 255, 0.08);
    backdrop-filter: saturate(150%) blur(6px);
}

.dg-appbar .mud-button-root,
.dg-appbar .mud-typography,
.dg-appbar .mud-icon-root,
.dg-appbar .mud-switch,
.dg-appbar .mud-switch .mud-typography-root {
    color: #f5ecff !important;
}

.dg-appbar .mud-button-outlined {
    border-color: rgba(240, 98, 146, 0.6) !important;
}

.dg-brand {
    letter-spacing: 0.04em;
    font-weight: 600;
}

.dg-brand-link {
    display: inline-flex;
    align-items: center;
    color: #f5ecff;
    text-decoration: none;
}

.dg-brand-link:hover,
.dg-brand-link:focus-visible {
    color: #f5ecff;
    text-decoration: none;
    opacity: 0.92;
}

.dg-main {
    animation: rise-in 320ms ease-out;
    padding-bottom: calc(120px + env(safe-area-inset-bottom));
}

.dg-fab-stack {
    position: fixed;
    right: 22px;
    bottom: calc(92px + env(safe-area-inset-bottom));
    align-items: flex-end;
    z-index: 2100;
}

.dg-fab-menu {
    min-width: min(280px, calc(100vw - 28px));
    border-radius: 16px;
    border: 1px solid rgba(245, 236, 255, 0.22);
    background: linear-gradient(180deg, rgba(48, 35, 63, 0.97) 0%, rgba(30, 22, 40, 0.97) 100%);
    box-shadow: 0 14px 34px rgba(9, 7, 13, 0.45), 0 1px 0 rgba(255, 255, 255, 0.06) inset;
    backdrop-filter: saturate(140%) blur(7px);
}

.dg-fab-link,
.dg-fab-link .mud-icon-root {
    color: #f5ecff !important;
}

.dg-fab-link {
    justify-content: flex-start;
    border-radius: 12px;
    font-weight: 600;
    letter-spacing: 0.01em;
    min-height: 42px;
    text-transform: none;
}

.dg-fab-link:hover,
.dg-fab-link:focus-visible {
    background: rgba(255, 255, 255, 0.06);
}

[data-theme="light"] .dg-fab-link,
[data-theme="light"] .dg-fab-link .mud-icon-root {
    color: #f5ecff !important;
}

[data-theme="light"] .dg-fab-menu {
    border: 1px solid rgba(106, 90, 120, 0.2);
    background: linear-gradient(180deg, rgba(37, 24, 51, 0.96) 0%, rgba(21, 14, 30, 0.96) 100%);
}

.dg-main-fab {
    width: 62px;
    height: 62px;
    border-radius: 50% !important;
    background: linear-gradient(145deg, #f06292 0%, #b35ce5 100%) !important;
    color: #ffffff !important;
    box-shadow: 0 14px 30px rgba(17, 10, 24, 0.48) !important;
}

@media (max-width: 600px) {
    .dg-fab-stack {
        right: 14px;
        bottom: calc(84px + env(safe-area-inset-bottom));
    }

    .dg-fab-menu {
        min-width: min(250px, calc(100vw - 18px));
    }
}

.hero-card {
    border-radius: 24px;
    background: var(--dg-card-bg);
    box-shadow: var(--dg-card-shadow);
}

.status-card {
    border-radius: 20px;
    background-color: var(--dg-token-bg);
}

.hero-subtitle {
    color: var(--dg-muted-text);
}

.auth-card {
    border-radius: 22px;
    background: var(--dg-card-bg);
    box-shadow: var(--dg-card-shadow);
}

.auth-layout {
    max-width: 820px;
    margin: 0 auto;
}

.subscription-dashboard {
    padding-bottom: calc(240px + env(safe-area-inset-bottom));
}

.subscription-dashboard .term-selected.mud-button-root {
    background-color: #e9fbf6 !important;
    border-color: #2aa889 !important;
    color: #1f7d67 !important;
    border-width: 1px !important;
    box-shadow: none !important;
}

.subscription-dashboard .term-unselected.mud-button-root {
    background-color: #e5e0ec !important;
    border-color: #d6cce3 !important;
    color: #3a2f47 !important;
}

[data-theme="dark"] .subscription-dashboard .term-unselected.mud-button-root {
    background-color: #2c2337 !important;
    border-color: #443454 !important;
    color: #d9ccea !important;
}

[data-theme="dark"] .subscription-dashboard .term-selected.mud-button-root {
    background-color: rgba(42, 168, 137, 0.20) !important;
    border-color: #63d3b5 !important;
    color: #baf3e3 !important;
}

.auth-caption {
    color: var(--dg-muted-text);
}

.token-block {
    border-left: 4px solid var(--dg-primary);
    background: var(--dg-token-bg);
    border-radius: 12px;
    padding: 12px;
    word-break: break-all;
}

.mud-switch {
    margin-inline: 0.15rem;
}

.validation-message {
    color: #e50000;
}

.calendar-month-grid {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    gap: 8px;
}

.calendar-month-head {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--dg-muted-text);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.calendar-month-cell {
    min-height: 110px;
    border-radius: 12px;
    border: 1px solid rgba(245, 236, 255, 0.15);
    background: rgba(255, 255, 255, 0.03);
    padding: 8px;
}

.calendar-month-cell.is-empty {
    opacity: 0.25;
}

.calendar-month-item {
    margin-top: 6px;
    border-radius: 8px;
    background: rgba(179, 92, 229, 0.2);
    color: #f5ecff;
    padding: 4px 6px;
    font-size: 0.76rem;
    line-height: 1.2;
}

.calendar-item-button {
    width: 100%;
    text-align: left;
    border: 1px solid rgba(179, 92, 229, 0.45);
    cursor: pointer;
}

.calendar-item-button:hover {
    filter: brightness(1.08);
}

.calendar-agenda-row {
    padding: 6px 0;
    border-top: 1px solid rgba(245, 236, 255, 0.12);
}

.calendar-agenda-row:first-of-type {
    border-top: none;
}

.calendar-day-title {
    font-weight: 700;
    letter-spacing: 0.01em;
}

.calendar-toolbar {
    margin-bottom: 2px;
    gap: 10px;
}

.calendar-nav-bar {
    flex-wrap: wrap;
    gap: 2px;
}

.calendar-today-btn {
    border-radius: 40px;
    font-weight: 600;
    letter-spacing: 0.02em;
    padding: 2px 14px;
    min-width: 0;
}

.calendar-period-label {
    font-weight: 700;
    background: linear-gradient(90deg, #b39ddb 0%, #ce93d8 55%, #f48fb1 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    letter-spacing: 0.01em;
    white-space: nowrap;
}

.calendar-modal-filter {
    width: min(440px, 100%);
    border-radius: 16px;
    border: 1px solid rgba(245, 236, 255, 0.16);
    background: linear-gradient(160deg, #21182b 0%, #171120 100%);
}

.calendar-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 8px;
}

.calendar-usage-stack {
    gap: 16px;
}

.calendar-usage-header {
    gap: 12px;
    flex-wrap: wrap;
}

.calendar-usage-chart-shell {
    position: relative;
    min-height: 280px;
    width: 100%;
}

.calendar-usage-chart-canvas {
    width: 100% !important;
    height: 280px !important;
}

.calendar-usage-summary-card,
.calendar-usage-stat,
.calendar-usage-week-card {
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.03);
}

.calendar-usage-breakdown-row {
    padding: 4px 0;
    border-top: 1px solid rgba(245, 236, 255, 0.08);
}

.calendar-usage-breakdown-row:first-of-type {
    border-top: none;
}

/* Mobile breakdown bottom-sheet */
.calendar-breakdown-sheet {
    align-items: flex-end;
    padding: 0;
}

.calendar-breakdown-panel {
    border-radius: 20px 20px 0 0 !important;
    width: 100%;
    max-height: 85vh;
    overflow-y: auto;
    padding-bottom: env(safe-area-inset-bottom, 16px) !important;
}

@media (max-width: 900px) {
    .calendar-usage-chart-shell {
        min-height: 240px;
    }

    .calendar-usage-chart-canvas {
        height: 240px !important;
    }

    /* Prompt tap hint on bar charts */
    .calendar-usage-chart-canvas {
        cursor: pointer;
    }
}

.calendar-create-panel {
    border-radius: 14px;
    border: 1px solid rgba(245, 236, 255, 0.14);
    background: rgba(255, 255, 255, 0.03);
}

.calendar-modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(7, 5, 10, 0.55);
    backdrop-filter: blur(2px);
    z-index: 2200;
    display: grid;
    place-items: center;
    padding: 20px;
}

.calendar-drawer-shell {
    position: fixed;
    inset: 0;
    z-index: 2200;
    pointer-events: none;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    padding: 24px 24px 0;
}

.calendar-drawer-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(7, 5, 10, 0.48);
    backdrop-filter: blur(2px);
    pointer-events: auto;
}

.calendar-editor-drawer {
    position: relative;
    width: min(920px, calc(100vw - 48px));
    max-height: min(88vh, 980px);
    border-radius: 24px 24px 0 0;
    border: 1px solid rgba(245, 236, 255, 0.16);
    border-bottom: none;
    background: linear-gradient(180deg, #21182b 0%, #171120 100%);
    box-shadow: 0 -18px 50px rgba(0, 0, 0, 0.28);
    display: flex;
    flex-direction: column;
    pointer-events: auto;
    overflow: hidden;
    transform-origin: bottom center;
    animation: calendar-sheet-rise 420ms cubic-bezier(0.16, 1, 0.3, 1);
}

.calendar-editor-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    padding: 24px 24px 18px;
    border-bottom: 1px solid rgba(245, 236, 255, 0.1);
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.04) 0%, rgba(255, 255, 255, 0) 100%);
}

.calendar-editor-subtitle {
    margin-top: 6px;
    max-width: 52ch;
    color: var(--dg-muted-text);
}

.calendar-editor-body {
    flex: 1 1 auto;
    overflow-y: auto;
    padding: 20px 24px;
}

.calendar-editor-footer {
    border-top: 1px solid rgba(245, 236, 255, 0.12);
    padding: 16px 24px 20px;
    margin-top: 0;
    background: linear-gradient(0deg, rgba(10, 7, 14, 0.9) 0%, rgba(10, 7, 14, 0.78) 100%);
}

.calendar-modal-card {
    width: min(780px, 100%);
    max-height: calc(100vh - 40px);
    border-radius: 16px;
    border: 1px solid rgba(245, 236, 255, 0.16);
    background: linear-gradient(160deg, #21182b 0%, #171120 100%);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.calendar-modal-body {
    flex-grow: 1;
    overflow-y: auto;
    padding-right: 4px;
}

.calendar-modal-actions {
    border-top: 1px solid rgba(245, 236, 255, 0.12);
    padding: 10px 0 12px;
    margin-top: 10px;
}

.calendar-location-select-row {
    margin-top: 2px;
}

.calendar-location-card {
    border-radius: 10px;
    border: 1px solid rgba(245, 236, 255, 0.14);
    background: rgba(255, 255, 255, 0.02);
}

.calendar-directions-link {
    margin-left: 6px;
    font-size: 0.75rem;
    opacity: 0.7;
}

.calendar-directions-link:hover {
    opacity: 1;
    text-decoration: underline;
}

.calendar-day-shell {
    border-radius: 16px;
    border: 1px solid rgba(245, 236, 255, 0.16);
    background: linear-gradient(135deg, rgba(179, 92, 229, 0.08) 0%, rgba(240, 98, 146, 0.04) 100%);
    padding: 12px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.24);
}

.calendar-day-heron {
    min-height: 640px;
}

.calendar-day-item-template {
    display: flex;
    flex-direction: column;
    gap: 10px;
    height: 100%;
    width: 100%;
    box-sizing: border-box;
    padding: 12px 14px;
    border-radius: 12px;
    background: linear-gradient(135deg, rgba(179, 92, 229, 0.15) 0%, rgba(179, 92, 229, 0.08) 100%);
    border: 1.5px solid rgba(179, 92, 229, 0.35);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    transition: all 240ms cubic-bezier(0.4, 0, 0.2, 1);
}

.calendar-day-item-template:hover {
    background: linear-gradient(135deg, rgba(179, 92, 229, 0.22) 0%, rgba(179, 92, 229, 0.15) 100%);
    border-color: rgba(179, 92, 229, 0.55);
    box-shadow: 0 8px 20px rgba(179, 92, 229, 0.2);
    transform: translateY(-2px);
}

.calendar-day-item-title {
    font-weight: 800;
    line-height: 1.4;
    color: #fff;
    font-size: 0.95rem;
    letter-spacing: 0.3px;
}

.calendar-day-item-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 4px;
}

.calendar-day-item-actions .mud-button-text {
    padding: 4px 10px;
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.calendar-day-item-actions .mud-button-text:not(.mud-button-color-info) {
    color: #f5ecff;
}

.calendar-day-item-actions .mud-button-text:not(.mud-button-color-info):hover {
    background: rgba(240, 98, 146, 0.2);
}

.calendar-week-shell {
    border-radius: 16px;
    border: 1px solid rgba(245, 236, 255, 0.16);
    background: linear-gradient(135deg, rgba(179, 92, 229, 0.08) 0%, rgba(240, 98, 146, 0.04) 100%);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.24);
}

.calendar-week-heron {
    min-height: 640px;
}

.calendar-week-item-template {
    display: flex;
    flex-direction: column;
    gap: 10px;
    height: 100%;
    width: 100%;
    box-sizing: border-box;
    padding: 12px 14px;
    border-radius: 12px;
    background: linear-gradient(135deg, rgba(179, 92, 229, 0.15) 0%, rgba(179, 92, 229, 0.08) 100%);
    border: 1.5px solid rgba(179, 92, 229, 0.35);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    transition: all 240ms cubic-bezier(0.4, 0, 0.2, 1);
}

.calendar-week-item-template:hover {
    background: linear-gradient(135deg, rgba(179, 92, 229, 0.22) 0%, rgba(179, 92, 229, 0.15) 100%);
    border-color: rgba(179, 92, 229, 0.55);
    box-shadow: 0 8px 20px rgba(179, 92, 229, 0.2);
    transform: translateY(-2px);
}

.calendar-week-item-title {
    font-weight: 800;
    line-height: 1.4;
    color: #fff;
    font-size: 0.95rem;
    letter-spacing: 0.3px;
}

.calendar-week-item-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 4px;
}

.calendar-week-item-actions .mud-button-text {
    padding: 4px 10px;
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.calendar-week-item-actions .mud-button-text:not(.mud-button-color-info) {
    color: #f5ecff;
}

.calendar-week-item-actions .mud-button-text:not(.mud-button-color-info):hover {
    background: rgba(240, 98, 146, 0.2);
}

.calendar-day-item-template.calendar-subtype-unavailable,
.calendar-week-item-template.calendar-subtype-unavailable {
    background: linear-gradient(135deg, rgba(96, 100, 112, 0.72) 0%, rgba(74, 78, 88, 0.78) 100%);
    border-color: rgba(165, 170, 184, 0.45);
}

.calendar-day-item-template.calendar-subtype-gap,
.calendar-week-item-template.calendar-subtype-gap {
    background: linear-gradient(135deg, rgba(120, 124, 134, 0.42) 0%, rgba(104, 108, 118, 0.52) 100%);
    border-color: rgba(160, 165, 178, 0.42);
}

.calendar-day-item-template.calendar-subtype-gap-auto,
.calendar-week-item-template.calendar-subtype-gap-auto {
    background: repeating-linear-gradient(
        135deg,
        rgba(118, 122, 132, 0.42) 0,
        rgba(118, 122, 132, 0.42) 8px,
        rgba(99, 104, 115, 0.55) 8px,
        rgba(99, 104, 115, 0.55) 16px
    );
    border-color: rgba(160, 165, 178, 0.42);
}

.calendar-day-item-template.calendar-subtype-driving-test,
.calendar-week-item-template.calendar-subtype-driving-test {
    background: linear-gradient(135deg, rgba(58, 126, 216, 0.42) 0%, rgba(38, 95, 178, 0.52) 100%);
    border-color: rgba(133, 183, 255, 0.45);
}

.calendar-day-item-template.calendar-subtype-mock-test,
.calendar-week-item-template.calendar-subtype-mock-test {
    background: linear-gradient(135deg, rgba(112, 96, 214, 0.4) 0%, rgba(89, 74, 190, 0.5) 100%);
    border-color: rgba(170, 156, 255, 0.44);
}

.calendar-day-item-template.is-off-hours,
.calendar-week-item-template.is-off-hours {
    background: rgba(100, 100, 100, 0.4) !important;
    border: 1px solid rgba(100, 100, 100, 0.6) !important;
    box-shadow: none !important;
    transform: none !important;
    pointer-events: none !important;
    color: transparent !important;
    min-height: 40px !important;
}

.calendar-hours-row {
    width: 100%;
}

.calendar-slot-available {
    background: linear-gradient(135deg, rgba(46, 204, 113, 0.18) 0%, rgba(46, 204, 113, 0.1) 100%) !important;
    border-color: rgba(46, 204, 113, 0.45) !important;
}

.calendar-slot-busy {
    background: linear-gradient(135deg, rgba(179, 92, 229, 0.2) 0%, rgba(179, 92, 229, 0.12) 100%) !important;
    border-color: rgba(179, 92, 229, 0.5) !important;
}

.calendar-slot-booked {
    background: linear-gradient(135deg, rgba(52, 152, 219, 0.24) 0%, rgba(52, 152, 219, 0.14) 100%) !important;
    border-color: rgba(52, 152, 219, 0.52) !important;
}

[data-theme="light"] .calendar-slot-available {
    background: linear-gradient(135deg, rgba(39, 174, 96, 0.22) 0%, rgba(39, 174, 96, 0.14) 100%) !important;
    border-color: rgba(39, 174, 96, 0.55) !important;
}

[data-theme="light"] .calendar-slot-busy {
    background: linear-gradient(135deg, rgba(139, 63, 209, 0.24) 0%, rgba(139, 63, 209, 0.16) 100%) !important;
    border-color: rgba(139, 63, 209, 0.55) !important;
}

[data-theme="light"] .calendar-slot-booked {
    background: linear-gradient(135deg, rgba(41, 128, 185, 0.28) 0%, rgba(41, 128, 185, 0.18) 100%) !important;
    border-color: rgba(41, 128, 185, 0.58) !important;
}

.calendar-day-item .mud-timeline-item-content {
    border-radius: 12px;
    border: 1px solid rgba(245, 236, 255, 0.12);
    background: rgba(15, 11, 20, 0.35);
    padding: 10px 12px;
}

.calendar-event-time {
    opacity: 0.9;
    font-weight: 600;
}

.calendar-event-subtype {
    margin-top: 2px;
    margin-bottom: 6px;
}

.calendar-subtype-chip {
    display: inline-block;
    padding: 4px 8px;
    border-radius: 999px;
    background: rgba(179, 92, 229, 0.2);
    border: 1px solid rgba(179, 92, 229, 0.45);
    color: #2c1f3d;
    font-weight: 600;
    font-size: 0.8rem;
}

.calendar-status-badge {
    display: inline-block;
    padding: 4px 8px;
    border-radius: 999px;
    font-size: 0.76rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.calendar-status-badge.is-confirmed {
    background: rgba(46, 204, 113, 0.2);
    border: 1px solid rgba(46, 204, 113, 0.45);
    color: #1f7a45;
}

.calendar-status-badge.is-tentative {
    background: rgba(241, 196, 15, 0.2);
    border: 1px solid rgba(241, 196, 15, 0.45);
    color: #7b5b00;
}

.calendar-status-badge.is-cancelled {
    background: rgba(231, 76, 60, 0.2);
    border: 1px solid rgba(231, 76, 60, 0.45);
    color: #8e2f24;
}

.calendar-week-table {
    border-radius: 14px;
    overflow: hidden;
    border: 1px solid rgba(245, 236, 255, 0.14);
}

.calendar-week-table table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
}

.calendar-week-table th,
.calendar-week-table td {
    padding: 14px 16px;
    vertical-align: middle;
}

.calendar-week-table thead th {
    background: rgba(255, 255, 255, 0.06);
    font-weight: 700;
    letter-spacing: 0.02em;
}

.calendar-week-table tbody tr:nth-child(even) {
    background: rgba(255, 255, 255, 0.02);
}

[data-theme="light"] .calendar-day-shell {
    background: linear-gradient(135deg, rgba(139, 63, 209, 0.12) 0%, rgba(196, 65, 123, 0.08) 100%);
    border-color: rgba(106, 90, 120, 0.3);
    box-shadow: 0 8px 24px rgba(93, 61, 122, 0.12);
}

[data-theme="light"] .calendar-week-shell {
    background: linear-gradient(135deg, rgba(139, 63, 209, 0.12) 0%, rgba(196, 65, 123, 0.08) 100%);
    border-color: rgba(106, 90, 120, 0.3);
    box-shadow: 0 8px 24px rgba(93, 61, 122, 0.12);
}

[data-theme="light"] .calendar-day-item-template,
[data-theme="light"] .calendar-week-item-template {
    background: linear-gradient(135deg, rgba(139, 63, 209, 0.18) 0%, rgba(139, 63, 209, 0.1) 100%);
    border-color: rgba(139, 63, 209, 0.4);
    box-shadow: 0 2px 8px rgba(93, 61, 122, 0.15);
}

[data-theme="light"] .calendar-day-item-template:hover,
[data-theme="light"] .calendar-week-item-template:hover {
    background: linear-gradient(135deg, rgba(139, 63, 209, 0.26) 0%, rgba(139, 63, 209, 0.18) 100%);
    border-color: rgba(139, 63, 209, 0.6);
    box-shadow: 0 8px 20px rgba(139, 63, 209, 0.22);
    transform: translateY(-2px);
}

[data-theme="light"] .calendar-day-item-template.calendar-subtype-unavailable,
[data-theme="light"] .calendar-week-item-template.calendar-subtype-unavailable {
    background: linear-gradient(135deg, rgba(186, 190, 198, 0.78) 0%, rgba(170, 174, 183, 0.84) 100%);
    border-color: rgba(122, 128, 141, 0.42);
}

[data-theme="light"] .calendar-day-item-template.calendar-subtype-gap,
[data-theme="light"] .calendar-week-item-template.calendar-subtype-gap {
    background: linear-gradient(135deg, rgba(205, 209, 218, 0.58) 0%, rgba(188, 193, 204, 0.62) 100%);
    border-color: rgba(122, 128, 141, 0.36);
}

[data-theme="light"] .calendar-day-item-template.calendar-subtype-gap-auto,
[data-theme="light"] .calendar-week-item-template.calendar-subtype-gap-auto {
    background: repeating-linear-gradient(
        135deg,
        rgba(199, 204, 214, 0.62) 0,
        rgba(199, 204, 214, 0.62) 8px,
        rgba(183, 188, 199, 0.68) 8px,
        rgba(183, 188, 199, 0.68) 16px
    );
    border-color: rgba(122, 128, 141, 0.36);
}

[data-theme="light"] .calendar-day-item-template.calendar-subtype-driving-test,
[data-theme="light"] .calendar-week-item-template.calendar-subtype-driving-test {
    background: linear-gradient(135deg, rgba(206, 227, 252, 0.9) 0%, rgba(188, 214, 247, 0.92) 100%);
    border-color: rgba(92, 145, 214, 0.46);
}

[data-theme="light"] .calendar-day-item-template.calendar-subtype-mock-test,
[data-theme="light"] .calendar-week-item-template.calendar-subtype-mock-test {
    background: linear-gradient(135deg, rgba(225, 214, 255, 0.9) 0%, rgba(211, 198, 248, 0.92) 100%);
    border-color: rgba(112, 96, 201, 0.42);
}

[data-theme="light"] .calendar-day-item-template.is-off-hours,
[data-theme="light"] .calendar-week-item-template.is-off-hours {
    background: rgba(150, 150, 150, 0.4) !important;
    border: 1px solid rgba(100, 100, 100, 0.6) !important;
    box-shadow: none !important;
    color: transparent !important;
    min-height: 40px !important;
}

[data-theme="light"] .calendar-day-item-title,
[data-theme="light"] .calendar-week-item-title {
    color: #24162f;
}

[data-theme="light"] .calendar-day-item-actions .mud-button-text:not(.mud-button-color-info),
[data-theme="light"] .calendar-week-item-actions .mud-button-text:not(.mud-button-color-info) {
    color: #6a5a78;
}

[data-theme="light"] .calendar-day-item-actions .mud-button-text:not(.mud-button-color-info):hover,
[data-theme="light"] .calendar-week-item-actions .mud-button-text:not(.mud-button-color-info):hover {
    background: rgba(196, 65, 123, 0.15);
}

[data-theme="light"] .calendar-modal-backdrop {
    background: rgba(36, 22, 47, 0.2);
}

[data-theme="light"] .calendar-drawer-backdrop {
    background: rgba(36, 22, 47, 0.2);
}

[data-theme="light"] .calendar-editor-drawer {
    background: linear-gradient(180deg, #ffffff 0%, #f7f0fb 100%);
    border-color: rgba(106, 90, 120, 0.2);
    box-shadow: 0 -18px 50px rgba(93, 61, 122, 0.16);
}

[data-theme="light"] .calendar-editor-header {
    border-bottom-color: rgba(106, 90, 120, 0.12);
    background: linear-gradient(180deg, rgba(139, 63, 209, 0.04) 0%, rgba(255, 255, 255, 0) 100%);
}

[data-theme="light"] .calendar-editor-footer {
    border-top-color: rgba(106, 90, 120, 0.14);
    background: linear-gradient(0deg, rgba(244, 237, 249, 0.96) 0%, rgba(255, 255, 255, 0.92) 100%);
}

[data-theme="light"] .calendar-modal-card {
    background: linear-gradient(160deg, #ffffff 0%, #f7f0fb 100%);
    border-color: rgba(106, 90, 120, 0.24);
}

[data-theme="light"] .calendar-modal-filter {
    background: linear-gradient(160deg, #ffffff 0%, #f7f0fb 100%);
    border-color: rgba(106, 90, 120, 0.24);
}

@media (max-width: 900px) {
    .calendar-drawer-shell {
        padding: 0;
    }

    .calendar-editor-drawer {
        width: 100vw;
        border-radius: 0;
        max-height: 100vh;
    }

    .calendar-editor-header,
    .calendar-editor-body,
    .calendar-editor-footer {
        padding-left: 16px;
        padding-right: 16px;
    }
}

@keyframes calendar-sheet-rise {
    from {
        opacity: 0;
        transform: translateY(120px) scale(0.985);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

[data-theme="light"] .calendar-day-item .mud-timeline-item-content {
    background: rgba(255, 255, 255, 0.75);
    border-color: rgba(106, 90, 120, 0.18);
}

[data-theme="light"] .calendar-week-table {
    border-color: rgba(106, 90, 120, 0.22);
}

[data-theme="light"] .calendar-week-table thead th {
    background: rgba(139, 63, 209, 0.08);
}

@keyframes rise-in {
    from {
        opacity: 0;
        transform: translateY(8px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@media (max-width: 960px) {
    .dg-main {
        padding-bottom: calc(210px + env(safe-area-inset-bottom));
    }

    .subscription-dashboard {
        padding-bottom: calc(280px + env(safe-area-inset-bottom));
    }

    .home-grid {
        padding-bottom: 72px;
    }

    .calendar-toolbar {
        align-items: flex-start;
    }

    .calendar-actions {
        width: 100%;
        justify-content: flex-start;
    }
}

.blazor-error-boundary {
    background: url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNTYiIGhlaWdodD0iNDkiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIG92ZXJmbG93PSJoaWRkZW4iPjxkZWZzPjxjbGlwUGF0aCBpZD0iY2xpcDAiPjxyZWN0IHg9IjIzNSIgeT0iNTEiIHdpZHRoPSI1NiIgaGVpZ2h0PSI0OSIvPjwvY2xpcFBhdGg+PC9kZWZzPjxnIGNsaXAtcGF0aD0idXJsKCNjbGlwMCkiIHRyYW5zZm9ybT0idHJhbnNsYXRlKC0yMzUgLTUxKSI+PHBhdGggZD0iTTI2My41MDYgNTFDMjY0LjcxNyA1MSAyNjUuODEzIDUxLjQ4MzcgMjY2LjYwNiA1Mi4yNjU4TDI2Ny4wNTIgNTIuNzk4NyAyNjcuNTM5IDUzLjYyODMgMjkwLjE4NSA5Mi4xODMxIDI5MC41NDUgOTIuNzk1IDI5MC42NTYgOTIuOTk2QzI5MC44NzcgOTMuNTEzIDI5MSA5NC4wODE1IDI5MSA5NC42NzgyIDI5MSA5Ny4wNjUxIDI4OS4wMzggOTkgMjg2LjYxNyA5OUwyNDAuMzgzIDk5QzIzNy45NjMgOTkgMjM2IDk3LjA2NTEgMjM2IDk0LjY3ODIgMjM2IDk0LjM3OTkgMjM2LjAzMSA5NC4wODg2IDIzNi4wODkgOTMuODA3MkwyMzYuMzM4IDkzLjAxNjIgMjM2Ljg1OCA5Mi4xMzE0IDI1OS40NzMgNTMuNjI5NCAyNTkuOTYxIDUyLjc5ODUgMjYwLjQwNyA1Mi4yNjU4QzI2MS4yIDUxLjQ4MzcgMjYyLjI5NiA1MSAyNjMuNTA2IDUxWk0yNjMuNTg2IDY2LjAxODNDMjYwLjczNyA2Ni4wMTgzIDI1OS4zMTMgNjcuMTI0NSAyNTkuMzEzIDY5LjMzNyAyNTkuMzEzIDY5LjYxMDIgMjU5LjMzMiA2OS44NjA4IDI1OS4zNzEgNzAuMDg4N0wyNjEuNzk1IDg0LjAxNjEgMjY1LjM4IDg0LjAxNjEgMjY3LjgyMSA2OS43NDc1QzI2Ny44NiA2OS43MzA5IDI2Ny44NzkgNjkuNTg3NyAyNjcuODc5IDY5LjMxNzkgMjY3Ljg3OSA2Ny4xMTgyIDI2Ni40NDggNjYuMDE4MyAyNjMuNTg2IDY2LjAxODNaTTI2My41NzYgODYuMDU0N0MyNjEuMDQ5IDg2LjA1NDcgMjU5Ljc4NiA4Ny4zMDA1IDI1OS43ODYgODkuNzkyMSAyNTkuNzg2IDkyLjI4MzcgMjYxLjA0OSA5My41Mjk1IDI2My41NzYgOTMuNTI5NSAyNjYuMTE2IDkzLjUyOTUgMjY3LjM4NyA5Mi4yODM3IDI2Ny4zODcgODkuNzkyMSAyNjcuMzg3IDg3LjMwMDUgMjY2LjExNiA4Ni4wNTQ3IDI2My41NzYgODYuMDU0N1oiIGZpbGw9IiNGRkU1MDAiIGZpbGwtcnVsZT0iZXZlbm9kZCIvPjwvZz48L3N2Zz4=) no-repeat 1rem/1.8rem, #b32121;
    padding: 1rem 1rem 1rem 3.7rem;
    color: white;
}

    .blazor-error-boundary::after {
        content: "An error has occurred."
    }

.darker-border-checkbox.form-check-input {
    border-color: #929292;
}

/* Learning Engine drag-and-drop styles */
.learning-dropzone {
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-height: 40px;
}

.learning-category-card {
    background: var(--mud-palette-surface);
    border: 1px solid var(--mud-palette-lines-default);
    border-radius: 8px;
    padding: 12px;
    cursor: grab;
    user-select: none;
    transition: box-shadow 0.15s ease, border-color 0.15s ease;
}

.learning-category-card:hover {
    border-color: var(--mud-palette-primary);
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}

.learning-category-card:active {
    cursor: grabbing;
}

.learning-category-card.drag-over {
    border-color: var(--mud-palette-primary);
    background: var(--mud-palette-primary-lighten);
    box-shadow: 0 0 0 2px var(--mud-palette-primary);
}

.learning-competency-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.learning-competency-row {
    display: flex;
    padding: 6px 8px;
    border-radius: 4px;
    border: 1px solid transparent;
    cursor: grab;
    user-select: none;
    transition: background 0.12s ease, border-color 0.12s ease;
}

.learning-competency-row:hover {
    background: var(--mud-palette-action-default-hover);
    border-color: var(--mud-palette-lines-default);
}

.learning-competency-row:active {
    cursor: grabbing;
}

.learning-competency-row.drag-over {
    border-color: var(--mud-palette-primary);
    background: var(--mud-palette-primary-lighten);
}

.learning-admin-panel {
    height: 100%;
}

/* ========== Pupil Progress Dashboard ========== */

.progress-sidebar {
    height: 100%;
}

.progress-velocity-panel {
    height: 100%;
}
