:root {
    --app-bg: #FAF9F6; /* Clean, warm professional cream background */
    --app-surface: #ffffff;
    --app-text: #263973; /* Deep Navy from the color palette for elegant, high-contrast text */
    --app-muted: #5f74a8; /* Soft blue-gray for secondary text */
    --app-primary: #4274D9; /* Bright blue from the color palette */
    --app-primary-dark: #263973;
    --app-accent: #93cedf; /* Light blue accent from the color palette */
    --app-accent-dark: #4274D9;
    --app-border: #e6e2da; /* Clean warm beige-cream border */
    --app-border-mint: #d6ebe9; /* Soft mint border from the color palette */
    --app-radius: 16px;
    --app-shadow: 0 10px 25px -5px rgba(38, 57, 115, 0.03), 0 8px 10px -6px rgba(38, 57, 115, 0.02);
    --app-surface-rgb: 255, 255, 255;
}

html {
    -webkit-text-size-adjust: 100%;
}

body {
    background: var(--app-bg) !important;
    color: var(--app-text) !important;
    padding: max(14px, env(safe-area-inset-top)) 14px calc(82px + env(safe-area-inset-bottom)) !important;
}

.log-container {
    width: min(100%, 540px) !important;
    border-radius: var(--app-radius) !important;
    padding: 22px 18px !important;
    background: var(--app-surface) !important;
    border: 1px solid var(--app-border) !important;
    box-shadow: var(--app-shadow) !important;
}

.smart-input,
.smart-select,
.form-control,
.form-select {
    min-height: 46px;
    border-radius: 12px !important;
    border: 1.5px solid var(--app-border) !important;
    background-color: var(--app-bg) !important;
    color: var(--app-text) !important;
    transition: all 0.2s ease !important;
}

.smart-input:focus,
.smart-select:focus,
.form-control:focus,
.form-select:focus {
    border-color: var(--app-primary) !important;
    background-color: var(--app-surface) !important;
    box-shadow: 0 0 0 4px rgba(66, 116, 217, 0.12) !important;
    outline: none !important;
}

button,
.btn,
.nav-item,
.check-card,
.badge-day {
    touch-action: manipulation;
}

.btn,
button {
    min-height: 44px;
    border-radius: 12px !important;
}

.btn-primary,
.bg-primary {
    background-color: var(--app-primary) !important;
    border-color: var(--app-primary) !important;
    color: #ffffff !important;
}

.text-primary {
    color: var(--app-primary) !important;
}

.btn-success,
.bg-success {
    background-color: #5c8d76 !important; /* Soft professional green */
    border-color: #5c8d76 !important;
    color: #ffffff !important;
}

.text-success {
    color: #5c8d76 !important;
}

.btn-warning,
.bg-warning {
    background-color: var(--app-primary) !important;
    border-color: var(--app-primary) !important;
    color: #ffffff !important;
}

.text-warning {
    color: var(--app-primary) !important;
}

.btn-outline-day {
    border-color: var(--app-border) !important;
    color: var(--app-muted) !important;
    background: var(--app-bg) !important;
    min-height: 34px !important;
    padding: 6px 10px !important;
    font-size: 0.78rem !important;
    line-height: 1 !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    white-space: nowrap !important;
}

.btn-check:checked + .btn-outline-day {
    background-color: var(--app-primary) !important;
    border-color: var(--app-primary) !important;
    color: #ffffff !important;
    box-shadow: 0 4px 12px rgba(66, 116, 217, 0.2) !important;
}

.btn-outline-day .material-symbols-rounded,
.btn-outline-day span {
    font-size: 14px !important;
    line-height: 1 !important;
}

.gen-days-row,
.day-filter-row {
    display: grid !important;
    gap: 6px !important;
}

.gen-days-row {
    grid-template-columns: repeat(5, minmax(0, 1fr));
}

.day-filter-row {
    grid-template-columns: repeat(7, minmax(0, 1fr));
}

.gen-days-row .btn-outline-day,
.day-filter-row .btn-outline-day {
    width: 100%;
    min-width: 0;
    border-radius: 999px !important;
    margin: 0 !important;
}

.btn-add,
.btn-save,
.btn-magic {
    background: linear-gradient(135deg, var(--app-primary), var(--app-accent)) !important;
    box-shadow: 0 6px 16px rgba(66, 116, 217, 0.15) !important;
    border: none !important;
    color: #ffffff !important;
    font-weight: 700 !important;
}

.timeline {
    border-left-color: var(--app-border) !important;
    padding-left: 22px !important;
}

.timeline-item {
    background: var(--app-surface) !important;
    border: 1px solid var(--app-border) !important;
    border-radius: var(--app-radius) !important;
    padding: 14px 14px 14px 16px !important;
    margin-bottom: 12px !important;
    box-shadow: var(--app-shadow) !important;
}

.timeline-item::before {
    left: -33px !important;
    top: 17px !important;
}

.time-badge {
    border-radius: 999px !important;
    font-size: 0.86rem !important;
}

.activity-text {
    font-size: 1rem !important;
    line-height: 1.45 !important;
    word-break: break-word;
    color: var(--app-text) !important;
}

.holiday-banner {
    background: linear-gradient(135deg, rgba(66, 116, 217, 0.08), rgba(147, 206, 223, 0.08)) !important;
    color: var(--app-primary-dark) !important;
    border: 1px solid rgba(66, 116, 217, 0.15) !important;
    border-radius: var(--app-radius) !important;
}

.bottom-nav {
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    transform: none !important;
    width: 100% !important;
    max-width: none !important;
    border-radius: 20px 20px 0 0 !important;
    border-top: 1px solid var(--app-border) !important;
    padding: 8px 8px calc(8px + env(safe-area-inset-bottom)) !important;
    background: rgba(var(--app-surface-rgb), 0.97) !important;
    backdrop-filter: blur(12px) !important;
    -webkit-backdrop-filter: blur(12px) !important;
    box-shadow: 0 -8px 24px rgba(38, 57, 115, 0.02) !important;
}

.nav-item {
    flex: 1 1 0;
    width: auto !important;
    min-height: 54px;
    justify-content: center;
    border-radius: 12px !important;
    font-size: 0.68rem !important;
    color: var(--app-muted) !important;
}

.nav-item.active {
    background: rgba(66, 116, 217, 0.08) !important;
    color: var(--app-primary) !important;
    transform: none !important;
}

.card-section,
.copy-box,
.period-card,
.check-card,
.holiday-card {
    border-color: var(--app-border) !important;
    background-color: var(--app-surface) !important;
    border-radius: var(--app-radius) !important;
}

.quick-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
}

.quick-action {
    min-height: 86px;
    border: 1px solid var(--app-border) !important;
    border-radius: var(--app-radius) !important;
    background-color: var(--app-surface) !important;
    color: var(--app-text) !important;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    justify-content: space-between;
    padding: 14px;
    text-decoration: none;
    font-weight: 700;
    box-shadow: var(--app-shadow) !important;
}

.quick-action .material-symbols-rounded {
    width: 34px;
    height: 34px;
    border-radius: 10px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    background: rgba(95, 116, 168, 0.08);
}

.quick-action.primary .material-symbols-rounded {
    color: var(--app-primary);
    background: rgba(66, 116, 217, 0.08);
}

.quick-action.danger .material-symbols-rounded {
    color: #d35c5c;
    background: rgba(211, 92, 92, 0.08);
}

.quick-action.success .material-symbols-rounded {
    color: #5c8d76;
    background: rgba(92, 141, 118, 0.08);
}

.quick-action.warning .material-symbols-rounded {
    color: var(--app-primary);
    background: rgba(66, 116, 217, 0.08);
}

.quick-action.info .material-symbols-rounded {
    color: #5b9bcf;
    background: rgba(91, 155, 207, 0.08);
}

.qa-card {
    min-height: 96px !important;
    aspect-ratio: 16 / 9 !important;
    padding: 16px !important;
    display: flex !important;
    flex-direction: column !important;
    justify-content: space-between !important;
    align-items: stretch !important;
    box-sizing: border-box !important;
}

.qa-header {
    display: flex !important;
    justify-content: space-between !important;
    align-items: center !important;
    width: 100% !important;
}

.qa-header .material-symbols-rounded {
    width: 38px !important;
    height: 38px !important;
    border-radius: 10px !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    font-size: 22px !important;
}

/* Card Icons Tints */
.qa-card.primary .material-symbols-rounded {
    color: var(--app-primary) !important;
    background: rgba(66, 116, 217, 0.08) !important;
}
.qa-card.danger .material-symbols-rounded {
    color: #d35c5c !important;
    background: rgba(211, 92, 92, 0.08) !important;
}
.qa-card.success .material-symbols-rounded {
    color: #5c8d76 !important;
    background: rgba(92, 141, 118, 0.08) !important;
}
.qa-card.warning .material-symbols-rounded {
    color: var(--app-primary) !important;
    background: rgba(66, 116, 217, 0.08) !important;
}
.qa-card.info .material-symbols-rounded {
    color: #5b9bcf !important;
    background: rgba(91, 155, 207, 0.08) !important;
}
.qa-card.students-info .material-symbols-rounded {
    color: #0ea5e9 !important;
    background: rgba(14, 165, 233, 0.08) !important;
}

.qa-count {
    font-size: 1.25rem !important;
    font-weight: 900 !important;
    color: var(--app-text) !important;
    letter-spacing: -0.02em !important;
}

.qa-label {
    font-size: 0.88rem !important;
    font-weight: 800 !important;
    color: var(--app-muted) !important;
    text-align: left !important;
    margin-top: 8px !important;
}

.reminder-alert {
    background: linear-gradient(135deg, rgba(147, 206, 223, 0.08), rgba(66, 116, 217, 0.08)) !important;
    border: 1px solid rgba(147, 206, 223, 0.18) !important;
    border-radius: var(--app-radius) !important;
    color: var(--app-text) !important;
    padding: 16px;
}

.app-cover {
    background: linear-gradient(135deg, var(--app-surface) 0%, var(--app-bg) 100%) !important;
    border: 1.5px solid var(--app-border) !important;
    border-radius: var(--app-radius) !important;
    padding: 18px;
    box-shadow: var(--app-shadow) !important;
}

.app-cover-icon {
    width: 64px;
    height: 64px;
    border-radius: 14px !important;
    background: rgba(66, 116, 217, 0.06) !important;
    border: 1px solid rgba(66, 116, 217, 0.15) !important;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.app-cover-icon img {
    width: 52px;
    height: 52px;
    border-radius: 10px !important;
    border: none !important;
}

.app-cover-kicker {
    color: var(--app-primary) !important;
    font-size: 0.72rem;
    font-weight: 800;
    letter-spacing: 0.05em;
}

.app-cover h3 {
    margin: 2px 0 4px;
    font-size: 1.35rem;
    font-weight: 800;
    color: var(--app-text) !important;
}

.app-cover p {
    margin: 0;
    color: var(--app-muted) !important;
    font-size: 0.9rem;
}

.app-cover-strip {
    display: flex;
    flex-wrap: nowrap;
    gap: 8px;
    margin-top: 14px;
}

.app-cover-strip span {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: rgba(66, 116, 217, 0.06) !important;
    color: var(--app-primary) !important;
    border: 1px solid rgba(66, 116, 217, 0.1) !important;
    border-radius: 999px;
    padding: 6px 8px;
    font-size: 0.72rem;
    font-weight: 700;
    white-space: nowrap;
    flex: 1 1 0;
    justify-content: center;
}

.app-cover-strip .material-symbols-rounded {
    font-size: 15px;
}

.app-launch-splash {
    position: fixed;
    inset: 0;
    z-index: 100000;
    background: radial-gradient(circle at 50% 30%, var(--app-border-mint) 0%, var(--app-primary) 45%, var(--app-primary-dark) 100%);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 28px;
    overflow: hidden;
    color: #ffffff;
    transition: opacity 0.35s ease, visibility 0.35s ease;
}

.app-launch-splash.hide {
    opacity: 0;
    visibility: hidden;
}

.app-launch-glow {
    position: absolute;
    width: min(78vw, 340px);
    aspect-ratio: 1;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    filter: blur(18px);
    transform: translateY(-46px);
}

.app-launch-mark {
    position: relative;
    width: 112px;
    height: 112px;
    border-radius: 32px;
    background: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 24px 58px rgba(38, 57, 115, 0.3);
    margin-bottom: 22px;
}

.app-launch-mark img {
    width: 84px;
    height: 84px;
}

.app-launch-kicker {
    position: relative;
    font-size: 0.82rem;
    font-weight: 800;
    color: var(--app-accent);
    margin-bottom: 8px;
}

.app-launch-title {
    position: relative;
    font-size: clamp(2.35rem, 12vw, 3.6rem);
    line-height: 1;
    font-weight: 900;
    color: #ffffff;
    text-shadow: 0 12px 30px rgba(38, 57, 115, 0.24);
}

.app-launch-subtitle {
    position: relative;
    color: var(--app-border-mint);
    margin-top: 12px;
    font-size: 1rem;
    line-height: 1.55;
    max-width: 310px;
    font-weight: 700;
}

.app-launch-tags {
    position: relative;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px;
    margin-top: 20px;
    max-width: 310px;
}

.app-launch-tags span {
    border: 1px solid rgba(255, 255, 255, 0.3);
    background: rgba(255, 255, 255, 0.16);
    color: #ffffff;
    border-radius: 999px;
    padding: 7px 11px;
    font-size: 0.78rem;
    font-weight: 800;
}

.install-banner {
    position: fixed;
    left: 12px;
    right: 12px;
    bottom: calc(74px + env(safe-area-inset-bottom));
    z-index: 2000;
    background: var(--app-surface) !important;
    border: 1px solid var(--app-border) !important;
    border-radius: var(--app-radius) !important;
    box-shadow: var(--app-shadow) !important;
    padding: 12px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.install-banner-text {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    line-height: 1.25;
}

.install-banner-text strong {
    color: var(--app-text);
    font-size: 0.95rem;
}

.install-banner-text span {
    color: var(--app-muted);
    font-size: 0.78rem;
}

.install-action,
.install-close {
    border: 0;
    border-radius: 10px;
    font-weight: 800;
}

.install-action {
    background: var(--app-primary);
    color: #ffffff;
    padding: 8px 12px;
}

.install-close {
    width: 32px;
    min-height: 32px;
    background: var(--app-bg);
    color: var(--app-text);
    font-size: 1.2rem;
}

.update-banner {
    position: fixed;
    left: 12px;
    right: 12px;
    bottom: calc(74px + env(safe-area-inset-bottom));
    z-index: 2200;
    background: var(--app-surface) !important;
    border: 1.5px solid var(--app-border) !important;
    border-radius: var(--app-radius) !important;
    box-shadow: var(--app-shadow) !important;
    padding: 14px 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    animation: updateBannerSlideIn 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.update-banner-text {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.update-banner-text strong {
    color: var(--app-text) !important;
    font-size: 0.95rem;
    font-weight: 800;
}

.update-banner-text span {
    color: var(--app-muted) !important;
    font-size: 0.8rem;
    line-height: 1.3;
}

.update-action {
    background: var(--app-primary) !important;
    color: #ffffff !important;
    border: 0;
    border-radius: 10px !important;
    padding: 8px 14px;
    font-weight: 800;
    font-size: 0.85rem;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(66, 116, 217, 0.2);
    transition: transform 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    white-space: nowrap;
}

.update-action:hover {
    transform: scale(1.05);
}

.update-action:active {
    transform: scale(0.95);
}

@media (min-width: 768px) {
    body {
        padding-top: 24px !important;
    }

    .log-container {
        padding: 28px 26px !important;
    }
}

@media (min-width: 992px) {
    body {
        padding: 28px 32px 32px 132px !important;
    }

    .log-container {
        width: min(100%, 980px) !important;
        max-width: 980px !important;
        padding: 34px 38px !important;
        border-radius: var(--app-radius) !important;
    }

    .log-container > h4,
    .log-container > h5,
    .log-container > .d-flex:first-child {
        max-width: 100%;
    }

    .bottom-nav {
        top: 50% !important;
        bottom: auto !important;
        left: 24px !important;
        right: auto !important;
        transform: translateY(-50%) !important;
        width: 88px !important;
        max-width: 88px !important;
        padding: 10px !important;
        flex-direction: column !important;
        gap: 8px !important;
        border-radius: var(--app-radius) !important;
        border-right: 1px solid var(--app-border) !important;
        border-top: none !important;
    }

    .nav-item {
        width: 100% !important;
        min-height: 74px;
        padding: 8px 4px;
        font-size: 0.72rem !important;
    }

    .nav-item .material-symbols-rounded {
        font-size: 28px !important;
        margin-bottom: 5px !important;
    }

    .row.g-2 {
        --bs-gutter-x: 16px;
        --bs-gutter-y: 16px;
    }

    .smart-input {
        font-size: 1.05rem !important;
    }

    .card-section,
    .copy-box {
        border-radius: var(--app-radius) !important;
        padding: 28px !important;
    }

    .quick-actions {
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: 14px;
    }

    .app-cover {
        padding: 24px;
    }

    .app-cover h3 {
        font-size: 1.65rem;
    }

    .app-cover-strip {
        flex-wrap: wrap;
    }

    .app-cover-strip span {
        flex: 0 0 auto;
        padding: 6px 10px;
        font-size: 0.78rem;
    }

    .install-banner {
        left: auto;
        right: 28px;
        bottom: 28px;
        width: 390px;
    }

    .update-banner {
        left: auto;
        right: 28px;
        bottom: 28px;
        width: 420px;
    }

    .quick-action {
        min-height: 104px;
        padding: 18px;
        border-radius: var(--app-radius) !important;
    }

    .quick-action.visual-action {
        min-height: 104px;
        aspect-ratio: 16 / 9;
        padding: 0;
    }

    .quick-action:hover {
        transform: translateY(-2px);
        border-color: var(--app-primary) !important;
        box-shadow: 0 14px 28px rgba(38, 57, 115, 0.04) !important;
    }

    .period-card {
        display: grid;
        grid-template-columns: minmax(190px, 240px) minmax(0, 1fr);
        align-items: center;
        gap: 18px;
        border-radius: var(--app-radius) !important;
    }

    .period-info {
        margin-bottom: 0 !important;
    }

    #dataList {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 14px;
    }

    .check-card {
        height: 100%;
        margin-bottom: 0 !important;
    }

    .holiday-card {
        min-height: 78px;
    }

    .modal-dialog {
        max-width: 560px !important;
    }

    .timeline {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 14px 18px;
        border-left: 0 !important;
        margin-left: 0 !important;
        padding-left: 0 !important;
    }

    .timeline-item {
        margin-bottom: 0 !important;
    }

    .timeline-item::before {
        display: none;
    }

    .floating-action-bar {
        bottom: 28px !important;
        left: calc(50% + 50px) !important;
        max-width: 620px !important;
    }
}

@media (min-width: 1280px) {
    .log-container {
        width: min(100%, 1120px) !important;
        max-width: 1120px !important;
    }

    #dataList,
    .timeline {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

@media print {
    body {
        background: #ffffff !important;
        padding: 0 !important;
    }

    .bottom-nav,
    .btn,
    button,
    #app-loader,
    .floating-action-bar {
        display: none !important;
    }

    .log-container {
        width: 100% !important;
        max-width: none !important;
        box-shadow: none !important;
        border-radius: 0 !important;
        padding: 0 !important;
    }
}

/* =========================================================================
   🌟 PREMIUM DARK MODE STYLES
   ========================================================================= */
[data-theme="dark"] {
    --app-bg: #0f1624; /* Professional dark navy-slate background */
    --app-surface: #1e263c; /* Dark navy card surface */
    --app-text: #f0f3fa; /* Light off-white */
    --app-muted: #8d9bb7; /* Muted navy-gray */
    --app-primary: #4274D9;
    --app-primary-dark: #cbd8f3;
    --app-accent: #93cedf;
    --app-accent-dark: #bde4ef;
    --app-border: #2c3a5b; /* Dark navy border */
    --app-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.4), 0 8px 10px -6px rgba(0, 0, 0, 0.4);
    --app-surface-rgb: 30, 38, 60;
}

[data-theme="dark"] body {
    background: var(--app-bg) !important;
    color: var(--app-text) !important;
}

[data-theme="dark"] .log-container {
    background: var(--app-surface) !important;
    border-color: var(--app-border) !important;
}

[data-theme="dark"] .smart-select,
[data-theme="dark"] .form-control,
[data-theme="dark"] .form-select,
[data-theme="dark"] .input-group-text,
[data-theme="dark"] .modal-content {
    background-color: var(--app-surface) !important;
    border-color: var(--app-border) !important;
    color: var(--app-text) !important;
}

[data-theme="dark"] .modal-content {
    border: 1px solid var(--app-border) !important;
    box-shadow: var(--app-shadow) !important;
}

[data-theme="dark"] .bottom-nav {
    background: rgba(30, 38, 60, 0.96) !important;
    border-top: 1px solid var(--app-border) !important;
    box-shadow: 0 -8px 24px rgba(0, 0, 0, 0.2) !important;
}

[data-theme="dark"] .bottom-nav .nav-item {
    color: var(--app-muted) !important;
}

[data-theme="dark"] .bottom-nav .nav-item.active {
    background: rgba(66, 116, 217, 0.15) !important;
    color: var(--app-primary) !important;
}

[data-theme="dark"] .history-item {
    background: var(--app-surface) !important;
    border-color: var(--app-border) !important;
}

[data-theme="dark"] .date-header {
    background-color: var(--app-bg) !important;
    color: var(--app-text) !important;
    border-bottom: 1.5px solid var(--app-border) !important;
}

[data-theme="dark"] .holiday-card {
    background: rgba(211, 92, 92, 0.1) !important;
    border-color: rgba(211, 92, 92, 0.2) !important;
}

[data-theme="dark"] .holiday-card .text-danger {
    color: #fca5a5 !important;
}

[data-theme="dark"] .holiday-card .text-secondary {
    color: #cbd5e1 !important;
}

[data-theme="dark"] .period-shortcuts {
    background: rgba(66, 116, 217, 0.08) !important;
    border-color: rgba(66, 116, 217, 0.2) !important;
}

[data-theme="dark"] .period-shortcut-btn {
    background: var(--app-surface) !important;
    border-color: var(--app-border) !important;
    color: var(--app-text) !important;
}

[data-theme="dark"] .period-shortcut-btn.is-selected {
    background: linear-gradient(135deg, var(--app-primary), var(--app-accent)) !important;
    border-color: var(--app-primary) !important;
    color: #ffffff !important;
}

[data-theme="dark"] .profile-block {
    background: var(--app-surface) !important;
    border-color: var(--app-border) !important;
}

[data-theme="dark"] .profile-block .text-dark {
    color: var(--app-text) !important;
}

[data-theme="dark"] .inbox-box {
    background: var(--app-surface) !important;
    border-color: var(--app-border) !important;
}

[data-theme="dark"] .inbox-item {
    background: var(--app-surface) !important;
    border-bottom-color: var(--app-border) !important;
}

[data-theme="dark"] .inbox-item .text-dark {
    color: var(--app-text) !important;
}

[data-theme="dark"] .download-box {
    background: var(--app-surface) !important;
    border-color: var(--app-border) !important;
}

[data-theme="dark"] .filter-box {
    background: var(--app-surface) !important;
    border-color: var(--app-border) !important;
}

[data-theme="dark"] .student-card {
    background: var(--app-surface) !important;
    border-color: var(--app-border) !important;
}

[data-theme="dark"] .card-section {
    background: var(--app-surface) !important;
    border-color: var(--app-border) !important;
}

[data-theme="dark"] .text-secondary,
[data-theme="dark"] .text-muted,
[data-theme="dark"] label {
    color: var(--app-muted) !important;
}

[data-theme="dark"] .text-dark,
[data-theme="dark"] h1,
[data-theme="dark"] h2,
[data-theme="dark"] h3,
[data-theme="dark"] h4,
[data-theme="dark"] h5,
[data-theme="dark"] h6 {
    color: var(--app-text) !important;
}

[data-theme="dark"] .timeline-item::after {
    background: var(--app-border) !important;
}

[data-theme="dark"] .time-badge {
    background: rgba(66, 116, 217, 0.15) !important;
    color: var(--app-primary) !important;
}

[data-theme="dark"] .card {
    background: var(--app-surface) !important;
    border-color: var(--app-border) !important;
    color: var(--app-text) !important;
}

[data-theme="dark"] .table {
    color: var(--app-text) !important;
    border-color: var(--app-border) !important;
}

[data-theme="dark"] .table-light {
    background: var(--app-surface) !important;
    color: var(--app-text) !important;
}

[data-theme="dark"] .table th,
[data-theme="dark"] .table td {
    border-color: var(--app-border) !important;
}

/* =========================================================================
   🧸 CUTE INTERACTIVE BUTTON EFFECT (MICRO-ANIMATIONS)
   ========================================================================= */
.btn,
.quick-action,
.nav-item,
.card-section,
.timeline-item,
.student-card,
.visit-zone-card,
.reminder-item {
    transition: all 0.22s cubic-bezier(0.175, 0.885, 0.32, 1.275) !important;
}

.btn:hover,
.quick-action:hover,
.visit-zone-card:hover {
    transform: translateY(-2px) scale(1.01) !important;
    box-shadow: 0 12px 24px -6px rgba(38, 57, 115, 0.06) !important;
}

.btn:active,
.quick-action:active,
.visit-zone-card:active {
    transform: translateY(0) scale(0.98) !important;
}

.global-reminder-alert {
    position: fixed;
    left: 16px;
    right: 16px;
    bottom: 96px;
    z-index: 2200;
    max-width: 500px;
    margin: 0 auto;
    background: #1e263c;
    color: #ffffff;
    border-radius: var(--app-radius);
    padding: 16px;
    box-shadow: 0 20px 55px rgba(0, 0, 0, 0.42);
    display: none;
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.global-reminder-alert.is-visible {
    display: block;
}

.global-reminder-alert .alert-head {
    display: flex;
    align-items: flex-start;
    gap: 10px;
}

.global-reminder-alert .alert-icon {
    color: var(--app-accent);
    font-size: 30px;
    flex: 0 0 auto;
}

.global-reminder-alert .alert-title {
    font-weight: 800;
    font-size: 1rem;
}

.global-reminder-alert .alert-detail {
    color: #cbd5e1;
    font-size: 0.88rem;
    margin-top: 4px;
}

.global-reminder-alert .alert-actions {
    display: flex;
    gap: 8px;
    margin-top: 12px;
}

.global-reminder-alert .alert-actions form {
    flex: 1;
    margin: 0;
}

.global-reminder-alert .alert-actions button {
    width: 100%;
    border: 0;
    border-radius: 10px;
    padding: 10px 12px;
    font-weight: 800;
}

.global-reminder-alert .mute-action {
    background: rgba(147, 206, 223, 0.15);
    color: var(--app-accent);
}

.global-reminder-alert .complete-action {
    background: #5c8d76;
    color: #ffffff;
}

.global-reminder-alert .dismiss-action {
    background: #2c3a5b;
    color: #ffffff;
}

.global-reminder-alert .followup-actions {
    display: none;
}

.global-reminder-alert.is-followup .initial-actions {
    display: none;
}

.global-reminder-alert.is-followup .followup-actions {
    display: flex;
}

@media (max-width: 991.98px) {
    body {
        min-height: 100dvh !important;
        padding-bottom: calc(98px + env(safe-area-inset-bottom)) !important;
    }

    .bottom-nav {
        position: fixed !important;
        top: auto !important;
        left: 0 !important;
        right: 0 !important;
        bottom: 0 !important;
        width: 100% !important;
        max-width: none !important;
        transform: translate3d(0, 0, 0) !important;
        -webkit-transform: translate3d(0, 0, 0) !important;
        backface-visibility: hidden !important;
        -webkit-backface-visibility: hidden !important;
        will-change: transform !important;
        z-index: 2147483000 !important;
        padding-bottom: calc(8px + env(safe-area-inset-bottom)) !important;
    }
}

@supports (-webkit-touch-callout: none) {
    @media (max-width: 991.98px) {
        html,
        body {
            min-height: -webkit-fill-available;
            overscroll-behavior-y: none;
        }

        .bottom-nav {
            position: fixed !important;
            top: auto !important;
            bottom: 0 !important;
            transform: translate3d(0, 0, 0) !important;
            -webkit-transform: translate3d(0, 0, 0) !important;
        }
    }
}

@media (max-width: 991.98px) {
    body {
        padding-left: 14px !important;
        padding-right: 14px !important;
        padding-bottom: calc(92px + env(safe-area-inset-bottom)) !important;
    }

    body .bottom-nav {
        position: fixed !important;
        inset: auto 0 0 0 !important;
        top: auto !important;
        right: 0 !important;
        bottom: 0 !important;
        left: 0 !important;
        width: 100vw !important;
        max-width: 100vw !important;
        margin: 0 !important;
        transform: none !important;
        -webkit-transform: none !important;
        border-radius: 20px 20px 0 0 !important;
        padding: 8px 8px max(8px, env(safe-area-inset-bottom)) !important;
        box-sizing: border-box !important;
    }
}

@media (min-width: 768px) and (max-width: 991.98px) and (orientation: landscape) {
    body {
        padding: 28px 32px 32px 132px !important;
    }

    .log-container {
        width: min(100%, 980px) !important;
        max-width: 980px !important;
        padding: 34px 38px !important;
        border-radius: 18px !important;
    }

    body .bottom-nav {
        position: fixed !important;
        top: 50% !important;
        bottom: auto !important;
        left: 24px !important;
        right: auto !important;
        width: 88px !important;
        max-width: 88px !important;
        padding: 10px !important;
        flex-direction: column !important;
        gap: 8px !important;
        border-radius: 22px !important;
        transform: translateY(-50%) !important;
        -webkit-transform: translateY(-50%) !important;
        border-top: none !important;
        border-right: 1px solid var(--app-border) !important;
    }

    body .bottom-nav .nav-item {
        width: 100% !important;
        min-height: 74px !important;
        padding: 8px 4px !important;
        font-size: 0.72rem !important;
    }

    body .bottom-nav .nav-item .material-symbols-rounded {
        font-size: 28px !important;
        margin-bottom: 5px !important;
    }
}

/* =========================================================================
   🌟 INLINE STYLE OVERRIDES FOR CLEAN & BEAUTIFUL UI
   ========================================================================= */
.student-toolbar,
.import-card,
.student-card,
.visit-zone-section,
.visit-zone-card,
.location-collection-panel,
.location-progress-card,
.card-section,
.period-card,
.check-card,
.holiday-card,
.reminder-item {
    background-color: var(--app-surface) !important;
    border: 1px solid var(--app-border) !important;
    border-radius: var(--app-radius) !important;
    box-shadow: var(--app-shadow) !important;
    color: var(--app-text) !important;
}

.student-avatar {
    background: rgba(66, 116, 217, 0.08) !important;
    color: var(--app-primary) !important;
    box-shadow: inset 0 0 0 1.5px rgba(66, 116, 217, 0.15) !important;
}

.student-chip {
    background: var(--app-bg) !important;
    border: 1px solid var(--app-border) !important;
    color: var(--app-text) !important;
}

.location-status-chip.done {
    background: rgba(92, 141, 118, 0.08) !important;
    color: #5c8d76 !important;
    border: 1.5px solid rgba(92, 141, 118, 0.15) !important;
}

.location-status-chip.waiting {
    background: rgba(66, 116, 217, 0.08) !important;
    color: var(--app-primary) !important;
    border: 1.5px solid rgba(66, 116, 217, 0.15) !important;
}

.reminder-item.is-alerting {
    border-color: var(--app-accent) !important;
    background: rgba(147, 206, 223, 0.05) !important;
    box-shadow: 0 10px 20px rgba(147, 206, 223, 0.06) !important;
}

.reminder-item.is-overdue {
    border-color: #d35c5c !important;
    background: rgba(211, 92, 92, 0.04) !important;
    box-shadow: 0 10px 20px rgba(211, 92, 92, 0.06) !important;
}

.weekday-apply-toggle {
    border: 1px solid var(--app-border) !important;
    background: var(--app-bg) !important;
    color: var(--app-text) !important;
}

.student-activity-card {
    background: var(--app-bg) !important;
    border: 1px solid var(--app-border) !important;
    border-radius: var(--app-radius) !important;
}

.student-activity-title {
    color: var(--app-primary) !important;
}

.remove-student-activity-btn {
    border-radius: 12px !important;
}

.add-student-activity-btn {
    border: 1.5px solid var(--app-border) !important;
    background: var(--app-surface) !important;
    color: var(--app-text) !important;
}

.add-student-activity-btn:hover {
    border-color: var(--app-primary) !important;
    color: var(--app-primary) !important;
}

/* =========================================================================
   Purple Music-Inspired UI Theme
   UI-only overrides based on the provided mobile app reference.
   ========================================================================= */
:root {
    --app-bg: #f6f3ff;
    --app-surface: #ffffff;
    --app-text: #241f4f;
    --app-muted: #8279aa;
    --app-primary: #6d4adf;
    --app-primary-dark: #3f2b8c;
    --app-accent: #b7f04b;
    --app-accent-dark: #8dd817;
    --app-border: #e5def8;
    --app-border-mint: #d9f5b2;
    --app-radius: 18px;
    --app-shadow: 0 18px 40px rgba(65, 43, 140, 0.12);
    --app-surface-rgb: 255, 255, 255;
}

html {
    background: #ece8f7;
}

body {
    background: linear-gradient(180deg, #f7f4ff 0%, #f4f1fb 100%) !important;
    color: var(--app-text) !important;
}

.log-container {
    border: 1px solid rgba(109, 74, 223, 0.12) !important;
    border-radius: 22px !important;
    background: #ffffff !important;
    box-shadow: 0 14px 34px rgba(65, 43, 140, 0.08) !important;
}

.log-container::before {
    content: none !important;
}

.smart-input,
.smart-select,
.form-control,
.form-select {
    border-color: #e8e0fb !important;
    border-radius: 16px !important;
    background-color: #fbfaff !important;
    color: var(--app-text) !important;
}

.smart-input:focus,
.smart-select:focus,
.form-control:focus,
.form-select:focus {
    border-color: var(--app-primary) !important;
    background-color: #ffffff !important;
    box-shadow: 0 0 0 4px rgba(109, 74, 223, 0.14) !important;
}

.btn-primary,
.bg-primary,
.btn-add,
.btn-save,
.btn-magic,
.period-shortcut-btn.is-selected {
    background: linear-gradient(135deg, #7b5cff, #4830a8) !important;
    border-color: transparent !important;
    color: #ffffff !important;
    box-shadow: 0 12px 24px rgba(109, 74, 223, 0.24) !important;
}

.text-primary,
.text-warning,
.forgot-link {
    color: var(--app-primary) !important;
}

.voice-btn,
.activity-edit-btn,
.period-shortcuts {
    border-color: #ded3fb !important;
    background: #f7f3ff !important;
    color: var(--app-primary-dark) !important;
    box-shadow: 0 8px 18px rgba(109, 74, 223, 0.10) !important;
}

.period-shortcut-head,
.period-shortcut-btn,
.activity-text,
.time-badge {
    color: var(--app-text) !important;
}

.period-shortcut-btn {
    border-color: #e3dcf7 !important;
    background: #ffffff !important;
    border-radius: 16px !important;
}

.period-shortcut-btn small {
    color: var(--app-muted) !important;
}

.timeline {
    border-left-color: rgba(109, 74, 223, 0.22) !important;
}

.timeline-item {
    border-color: rgba(109, 74, 223, 0.12) !important;
    background: rgba(255, 255, 255, 0.95) !important;
    box-shadow: 0 14px 30px rgba(65, 43, 140, 0.08) !important;
}

.timeline-item::before {
    background: var(--app-accent) !important;
    box-shadow: 0 0 0 4px rgba(109, 74, 223, 0.16) !important;
}

.time-badge {
    background: #f3efff !important;
    color: var(--app-primary-dark) !important;
}

.quick-action,
.qa-card,
.card-section,
.copy-box,
.period-card,
.check-card,
.holiday-card,
.student-toolbar,
.import-card,
.student-card,
.visit-zone-section,
.visit-zone-card,
.location-collection-panel,
.location-progress-card,
.reminder-item {
    border-color: rgba(109, 74, 223, 0.10) !important;
    background: #ffffff !important;
    border-radius: 16px !important;
    box-shadow: 0 8px 20px rgba(65, 43, 140, 0.06) !important;
}

.quick-action .material-symbols-rounded,
.qa-card .material-symbols-rounded,
.student-avatar {
    background: linear-gradient(135deg, #f0ebff, #ffffff) !important;
    color: var(--app-primary) !important;
}

.subscription-admin,
.subscription-trial,
.subscription-active,
.subscription-pending,
.subscription-warning {
    background: #f1ecff !important;
    border-color: #ded3fb !important;
    color: var(--app-primary-dark) !important;
}

.subscription-expired {
    background: #fff1f2 !important;
    border-color: #fecdd3 !important;
    color: #be123c !important;
}

.bottom-nav {
    background: rgba(255, 255, 255, 0.92) !important;
    border-top: 1px solid rgba(109, 74, 223, 0.14) !important;
    box-shadow: 0 -18px 38px rgba(65, 43, 140, 0.14) !important;
}

.nav-item {
    color: #b2a8d2 !important;
}

.nav-item.active {
    background: #f1ecff !important;
    color: var(--app-primary) !important;
}

.nav-item.active .material-symbols-rounded {
    color: var(--app-accent-dark) !important;
}

.holiday-banner {
    background: linear-gradient(135deg, rgba(109, 74, 223, 0.12), rgba(183, 240, 75, 0.16)) !important;
    border: 1px solid rgba(109, 74, 223, 0.14) !important;
    color: var(--app-primary-dark) !important;
}

.loader-spinner {
    border-color: #e7e0fb !important;
    border-top-color: var(--app-primary) !important;
}

#app-loader {
    background: linear-gradient(135deg, #f8f5ff 0%, #ede7ff 100%) !important;
}

/* =========================================================================
   Remove Page-Level Background Frame
   The page wrapper should not look like a second card behind every screen.
   ========================================================================= */
.log-container {
    background: transparent !important;
    border: 0 !important;
    box-shadow: none !important;
    border-radius: 0 !important;
    overflow: visible !important;
}

.log-container::before,
.log-container::after {
    content: none !important;
    display: none !important;
}

@media (min-width: 992px) {
    .log-container {
        background: transparent !important;
        border: 0 !important;
        box-shadow: none !important;
        border-radius: 0 !important;
    }
}

/* =========================================================================
   Flatten Section Frames
   Remove the large white nested panels that made every page look double-framed.
   ========================================================================= */
.card-section,
.period-card,
.copy-box,
.check-card,
.holiday-card,
.student-toolbar,
.import-card,
.visit-zone-section,
.location-collection-panel {
    background: transparent !important;
    box-shadow: none !important;
    border-color: transparent !important;
}

.card-section {
    padding-left: 0 !important;
    padding-right: 0 !important;
}

.period-card,
.check-card,
.holiday-card,
.student-card,
.visit-zone-card,
.location-progress-card,
.reminder-item,
.student-activity-card {
    background: rgba(255, 255, 255, 0.78) !important;
    border-color: rgba(109, 74, 223, 0.10) !important;
    box-shadow: 0 6px 18px rgba(65, 43, 140, 0.045) !important;
}

.generated-summary,
.period-shortcuts {
    background: rgba(255, 255, 255, 0.58) !important;
    border-color: rgba(109, 74, 223, 0.10) !important;
    box-shadow: none !important;
}

/* =========================================================================
   Mobile Quick Actions Polish
   Keep dashboard cards readable on phone-sized screens.
   ========================================================================= */
@media (max-width: 680px) {
    .quick-actions,
    div.quick-actions {
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
        gap: 14px !important;
    }

    .quick-action,
    .qa-card {
        min-height: 112px !important;
        padding: 16px !important;
        border-radius: 18px !important;
        justify-content: space-between !important;
    }

    .qa-header {
        width: 100%;
        display: grid !important;
        grid-template-columns: 40px minmax(0, 1fr);
        align-items: start !important;
        gap: 12px !important;
    }

    .quick-action .material-symbols-rounded,
    .qa-card .material-symbols-rounded {
        width: 40px !important;
        height: 40px !important;
        font-size: 22px !important;
        border-radius: 12px !important;
    }

    .qa-count {
        min-width: 0;
        color: #140f3b !important;
        font-size: clamp(1rem, 4.2vw, 1.22rem) !important;
        line-height: 1.18 !important;
        font-weight: 900 !important;
        overflow-wrap: anywhere;
    }

    .qa-label {
        color: #71689a !important;
        font-size: 0.86rem !important;
        line-height: 1.2 !important;
        font-weight: 800 !important;
        margin-top: 12px !important;
    }
}

@media (max-width: 380px) {
    .quick-actions,
    div.quick-actions {
        gap: 10px !important;
    }

    .quick-action,
    .qa-card {
        min-height: 106px !important;
        padding: 13px !important;
    }

    .qa-header {
        grid-template-columns: 36px minmax(0, 1fr);
        gap: 9px !important;
    }

    .quick-action .material-symbols-rounded,
    .qa-card .material-symbols-rounded {
        width: 36px !important;
        height: 36px !important;
        font-size: 20px !important;
    }

    .qa-count {
        font-size: 1rem !important;
    }
}

/* =========================================================================
   Phone Dashboard Card Fix
   Narrow phones need full-width action cards instead of squeezed columns.
   ========================================================================= */
@media (max-width: 575px) {
    .quick-actions,
    div.quick-actions {
        width: 100% !important;
        display: grid !important;
        grid-template-columns: 1fr !important;
        gap: 12px !important;
    }

    .quick-action,
    .qa-card {
        width: 100% !important;
        min-height: 86px !important;
        aspect-ratio: auto !important;
        padding: 15px 16px !important;
        border-radius: 18px !important;
        display: grid !important;
        grid-template-columns: 1fr !important;
        align-content: center !important;
        gap: 8px !important;
    }

    .qa-header {
        display: grid !important;
        grid-template-columns: 44px minmax(0, 1fr) !important;
        align-items: center !important;
        gap: 13px !important;
        width: 100% !important;
    }

    .quick-action .material-symbols-rounded,
    .qa-card .material-symbols-rounded {
        width: 44px !important;
        height: 44px !important;
        min-width: 44px !important;
        font-size: 23px !important;
        border-radius: 14px !important;
    }

    .qa-count {
        font-size: clamp(1.08rem, 4.5vw, 1.28rem) !important;
        line-height: 1.22 !important;
        white-space: normal !important;
        overflow-wrap: break-word !important;
        word-break: keep-all !important;
    }

    .qa-label {
        margin-top: 0 !important;
        margin-left: 57px !important;
        font-size: 0.9rem !important;
        line-height: 1.25 !important;
    }
}

@media (max-width: 360px) {
    .quick-action,
    .qa-card {
        min-height: 82px !important;
        padding: 14px !important;
    }

    .qa-header {
        grid-template-columns: 40px minmax(0, 1fr) !important;
        gap: 11px !important;
    }

    .quick-action .material-symbols-rounded,
    .qa-card .material-symbols-rounded {
        width: 40px !important;
        height: 40px !important;
        min-width: 40px !important;
        font-size: 21px !important;
    }

    .qa-label {
        margin-left: 51px !important;
    }
}

/* =========================================================================
   Soft Dashboard Card Colors
   Make link and button dashboard cards share the same visual behavior.
   ========================================================================= */
.quick-action.qa-card,
button.quick-action.qa-card {
    appearance: none !important;
    -webkit-appearance: none !important;
    border: 1px solid rgba(122, 93, 226, 0.12) !important;
    box-shadow: 0 12px 28px rgba(57, 39, 118, 0.055) !important;
    color: #150f3d !important;
    font-family: inherit !important;
    text-align: left !important;
    cursor: pointer !important;
}

button.quick-action.qa-card {
    line-height: inherit !important;
}

.qa-card.primary {
    background: linear-gradient(135deg, #fbf9ff 0%, #f1ecff 100%) !important;
}

.qa-card.danger {
    background: linear-gradient(135deg, #fffafa 0%, #ffedf0 100%) !important;
}

.qa-card.success {
    background: linear-gradient(135deg, #f8fffc 0%, #eaf8f0 100%) !important;
}

.qa-card.info {
    background: linear-gradient(135deg, #f8fcff 0%, #e9f5ff 100%) !important;
}

.qa-card.warning {
    background: linear-gradient(135deg, #fffdfa 0%, #fff2da 100%) !important;
}

.qa-card.students-info {
    background: linear-gradient(135deg, #f8fdff 0%, #e8f7ff 100%) !important;
}

.qa-card.primary .material-symbols-rounded {
    color: #6f54e8 !important;
    background: rgba(111, 84, 232, 0.10) !important;
}

.qa-card.danger .material-symbols-rounded {
    color: #dc5d73 !important;
    background: rgba(220, 93, 115, 0.10) !important;
}

.qa-card.success .material-symbols-rounded {
    color: #4e8b72 !important;
    background: rgba(78, 139, 114, 0.11) !important;
}

.qa-card.info .material-symbols-rounded {
    color: #478ed4 !important;
    background: rgba(71, 142, 212, 0.10) !important;
}

.qa-card.warning .material-symbols-rounded {
    color: #7a5de2 !important;
    background: rgba(122, 93, 226, 0.10) !important;
}

.qa-card.students-info .material-symbols-rounded {
    color: #1c9bd7 !important;
    background: rgba(28, 155, 215, 0.11) !important;
}

.qa-card:hover,
button.qa-card:hover {
    border-color: rgba(122, 93, 226, 0.22) !important;
    box-shadow: 0 16px 34px rgba(57, 39, 118, 0.075) !important;
}

@media (max-width: 575px) {
    button.quick-action.qa-card {
        text-align: left !important;
    }

    .quick-action.qa-card,
    button.quick-action.qa-card {
        grid-template-columns: 1fr !important;
        justify-items: stretch !important;
    }

    .qa-header {
        justify-items: stretch !important;
    }

    .qa-count,
    .qa-label {
        text-align: left !important;
    }
}
