:root {
    --studio-blue: #3b6cff;
    --studio-ink: #1c2434;
    --studio-muted: #8b95a8;
    --studio-line: #e7ebf2;
    --studio-card: #ffffff;
    --studio-canvas: #f5f7fb;
    --studio-accent: #3b6cff;
    --lms-accent: #3b6cff;
    --lms-accent-dark: #2a56e0;
    --lms-sidebar: #ffffff;
    --lms-bg: var(--studio-canvas);
    --lms-text: var(--studio-ink);
}

body {
    background: var(--studio-canvas);
    color: var(--studio-ink);
    font-family: "Segoe UI", system-ui, sans-serif;
    overflow-x: clip;
}

.app-shell {
    display: flex;
    min-height: 100vh;
    background: var(--studio-canvas);
}

.sidebar {
    --bs-offcanvas-bg: #fff;
    --bs-offcanvas-color: var(--studio-ink);
    background: #fff !important;
    color: var(--studio-ink);
    width: 248px;
    border-right: 1px solid var(--studio-line);
}

.brand {
    display: flex;
    align-items: center;
    gap: .7rem;
    padding: .2rem .35rem 1.1rem;
}

.brand-mark {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: var(--studio-accent);
    color: #fff;
    display: grid;
    place-items: center;
    font-weight: 700;
    flex: 0 0 auto;
}

.brand-name {
    font-weight: 700;
    line-height: 1.1;
}

.brand-meta {
    color: var(--studio-muted);
    font-size: .75rem;
}

.profile-card {
    display: flex;
    align-items: center;
    gap: .75rem;
    padding: .35rem .35rem 1rem;
}

.avatar {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background: #e8f0ff;
    color: var(--studio-accent);
    display: grid;
    place-items: center;
    font-weight: 700;
    flex: 0 0 auto;
}

.profile-card .name {
    font-weight: 700;
    line-height: 1.15;
}

.profile-card .role {
    color: var(--studio-muted);
    font-size: .82rem;
}

.side-search {
    position: relative;
    margin-bottom: 1rem;
}

.side-search i {
    position: absolute;
    left: .75rem;
    top: .55rem;
    color: #b0b7c6;
}

.side-search input {
    width: 100%;
    border: 0;
    background: #f3f5f9;
    border-radius: 12px;
    padding: .5rem .75rem .5rem 2.1rem;
    outline: none;
}

.sidebar .nav-link {
    color: #5c6578;
    border-radius: 12px;
    margin-bottom: .15rem;
    display: flex;
    align-items: center;
    gap: .7rem;
    padding: .55rem .75rem;
    font-weight: 500;
}

.sidebar .nav-link i {
    font-size: 1.05rem;
    width: 1.2rem;
}

.sidebar .nav-link:hover,
.sidebar .nav-link.active {
    background: #eef3ff;
    color: var(--studio-accent);
}

.sidebar .nav-link .badge {
    margin-left: auto;
}

.nav-label {
    color: #a0a8b8;
    font-size: .72rem;
    letter-spacing: .06em;
    text-transform: uppercase;
    margin: 1rem .75rem .35rem;
}

.side-foot {
    margin-top: auto;
    padding-top: 1rem;
}

.side-foot .btn-link {
    color: #5c6578;
    text-decoration: none;
    font-weight: 500;
}

.app-main {
    min-width: 0;
    background: var(--studio-canvas);
}

.topbar {
    background: #fff;
    border-bottom: 1px solid var(--studio-line);
    padding: .75rem 1.5rem;
    position: sticky;
    top: 0;
    z-index: 20;
    flex-wrap: wrap;
}

.crumbs {
    color: var(--studio-muted);
    font-size: .92rem;
    min-width: 0;
}

.crumbs strong {
    color: var(--studio-ink);
    font-weight: 600;
}

.top-search {
    position: relative;
}

.top-search i {
    position: absolute;
    left: .75rem;
    top: .5rem;
    color: #b0b7c6;
}

.top-search input {
    width: 220px;
    border: 1px solid var(--studio-line);
    background: #f7f8fb;
    border-radius: 10px;
    padding: .4rem .75rem .4rem 2.1rem;
    outline: none;
}

.user-toggle {
    border: 0;
    background: transparent;
    padding: 0;
}

.user-menu .dropdown-item {
    display: flex;
    align-items: center;
    gap: .5rem;
}

.user-menu .dropdown-item.text-danger {
    color: #e5484d;
}

.page-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    padding: 1.25rem 1.5rem .25rem;
}

.page-head h1 {
    font-weight: 700;
    letter-spacing: -.03em;
    margin: 0;
}

.welcome-title {
    color: var(--studio-accent);
    font-size: 1.85rem;
}

.page-actions {
    display: flex;
    align-items: center;
    gap: .5rem;
    flex-wrap: wrap;
}

.today-chip {
    color: var(--studio-muted);
    font-size: .92rem;
    display: flex;
    align-items: center;
    gap: .4rem;
}

.page-kicker {
    color: var(--studio-muted);
    margin: .15rem 0 0;
}

.stat-card,
.card {
    border: 0;
    border-radius: 18px;
    box-shadow: 0 10px 30px rgba(31, 36, 48, .05);
    background: var(--studio-card);
}

.stat-card .card-body {
    padding: 1.1rem 1.15rem 1rem;
}

.stat-card .label {
    color: var(--studio-muted);
    font-size: .92rem;
}

.stat-card .value {
    font-size: 1.55rem;
    font-weight: 700;
    letter-spacing: -.03em;
    margin-top: .2rem;
}

.stat-card .stat-icon {
    width: 34px;
    height: 34px;
    border-radius: 10px;
    display: grid;
    place-items: center;
    margin-left: auto;
}

.tone-blue { background: #e8f1ff; color: #2f7cf6; }
.tone-green { background: #e8f8ef; color: #18a957; }
.tone-violet { background: #f1e9ff; color: #7c4dff; }
.tone-amber { background: #fff4e5; color: #f5a524; }

.meet-row {
    border-radius: 14px;
    color: #fff;
    padding: .85rem 1rem;
    margin-bottom: .65rem;
}

.meet-row a {
    color: #fff;
    font-weight: 650;
    text-decoration: none;
}

.meet-row .when {
    opacity: .9;
    font-size: .85rem;
}

.meet-red { background: #ff5d73; }
.meet-blue { background: #3d7eff; }
.meet-green { background: #3dcb7a; }

.table thead th {
    color: #98a0b3;
    font-size: .75rem;
    text-transform: uppercase;
    letter-spacing: .04em;
    border-bottom-color: #f0f2f6;
}

.table td {
    border-bottom-color: #f4f6fa;
    vertical-align: middle;
}

.form-control,
.form-select {
    border-radius: 12px;
    border-color: #e6ebf2;
    padding-top: .55rem;
    padding-bottom: .55rem;
}

.form-control:focus,
.form-select:focus {
    border-color: #b9d2ff;
    box-shadow: 0 0 0 .2rem rgba(47, 124, 246, .12);
}

.btn {
    border-radius: 12px;
}

.btn .bi {
    margin-right: .35rem;
    vertical-align: -0.125em;
}

.btn-icon .bi,
.date-nav .bi,
.date-field-btn .bi {
    margin-right: 0;
}

.btn-accent {
    background: var(--studio-accent);
    border-color: var(--studio-accent);
    color: #fff;
}

.btn-accent:hover {
    background: var(--lms-accent-dark);
    border-color: var(--lms-accent-dark);
    color: #fff;
}

.card-header {
    background: #fff;
    border-bottom: 1px solid #f2f4f8;
    border-radius: 18px 18px 0 0 !important;
}

.timeline {
    border-left: 2px solid #e4e9f2;
    margin-left: .5rem;
    padding-left: 1.25rem;
}

.timeline-item {
    position: relative;
    margin-bottom: 1.25rem;
}

.timeline-item::before {
    content: "";
    position: absolute;
    left: -1.45rem;
    top: .35rem;
    width: .7rem;
    height: .7rem;
    border-radius: 50%;
    background: var(--studio-accent);
}

.auth-split {
    min-height: 100vh;
    display: grid;
    grid-template-columns: 1.1fr .9fr;
}

.auth-hero {
    color: #fff;
    padding: 2rem 3.5rem;
    display: flex;
    flex-direction: column;
    background: linear-gradient(160deg, #5b4dff 0%, #3b6cff 48%, #7a5cff 100%);
}

.auth-hero h1 {
    font-size: 2.6rem;
    font-weight: 700;
    letter-spacing: -.03em;
    max-width: 14ch;
    margin-top: auto;
}

.auth-quote {
    margin-top: auto;
    background: rgba(255, 255, 255, .14);
    border-radius: 16px;
    padding: 1rem 1.1rem;
    max-width: 440px;
}

.auth-panel {
    background: #f7f8fb;
    display: flex;
    flex-direction: column;
    padding: 1.5rem 2.5rem 2rem;
}

.auth-panel-top {
    display: flex;
    justify-content: space-between;
    color: var(--studio-muted);
    font-size: .92rem;
}

.auth-panel-top a {
    color: var(--studio-accent);
    text-decoration: none;
}

.auth-card {
    width: min(420px, 100%);
    margin: auto;
}

.modal-content {
    border: 0;
    border-radius: 16px;
}

.guest-wrap {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem 1rem;
    background: var(--studio-canvas);
}

.guest-card {
    width: min(440px, 100%);
    background: #fff;
    border-radius: 18px;
    padding: 1.5rem;
    box-shadow: 0 10px 30px rgba(31, 36, 48, .06);
}

@media (max-width: 991.98px) {
    .auth-split {
        grid-template-columns: 1fr;
    }

    .auth-hero {
        min-height: 280px;
        padding: 1.5rem;
    }

    .auth-hero h1 {
        font-size: 2rem;
    }
}

.date-field {
    position: relative;
}

.date-field .form-control {
    padding-right: 2.4rem;
}

.date-field-btn {
    position: absolute;
    right: .35rem;
    top: 50%;
    transform: translateY(-50%);
    border: 0;
    background: transparent;
    color: var(--studio-muted);
    line-height: 1;
    padding: .25rem .4rem;
}

.date-pop {
    position: fixed;
    z-index: 2000;
    width: 280px;
    background: #fff;
    border: 1px solid var(--studio-line);
    border-radius: 16px;
    padding: .75rem;
}

.date-pop-head,
.date-pop-foot,
.date-time {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .5rem;
}

.date-nav {
    border: 0;
    background: #f4f6fb;
    border-radius: 8px;
    width: 2rem;
    height: 2rem;
}

.date-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 2px;
    margin: .5rem 0;
}

.date-weekday,
.date-day {
    text-align: center;
    font-size: .8rem;
}

.date-weekday {
    color: var(--studio-muted);
    padding: .25rem 0;
}

.date-day {
    border: 0;
    background: transparent;
    border-radius: 8px;
    height: 2rem;
}

.date-day.is-selected {
    background: var(--studio-accent);
    color: #fff;
}

.date-day.is-today {
    box-shadow: inset 0 0 0 1px var(--studio-accent);
}

.date-time {
    margin-bottom: .5rem;
}

@media (max-width: 991.98px) {
    .studio {
        padding: 0;
    }

    .studio-frame {
        min-height: 100vh;
        border-radius: 0;
    }
}

@media (min-width: 992px) {
    .sidebar.offcanvas-lg {
        position: sticky;
        top: 0;
        flex: 0 0 248px;
        width: 248px !important;
        height: 100vh;
        transform: none !important;
        visibility: visible !important;
        background: #fff !important;
        border-right: 1px solid var(--studio-line);
        overflow: hidden;
    }

    .sidebar.offcanvas-lg .offcanvas-header {
        display: none;
    }

    .sidebar.offcanvas-lg .offcanvas-body {
        display: flex;
        flex-direction: column;
        flex-grow: 1;
        padding: 1.25rem 1rem 1rem;
        overflow-y: auto;
        background: #fff;
    }
}

.login-screen {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 1.5rem;
    background-color: #1e3a8a;
    background-image: linear-gradient(rgba(15, 23, 42, .55), rgba(15, 23, 42, .55)), var(--login-bg-mobile);
    background-position: center;
    background-repeat: no-repeat;
    background-size: cover;
}

.login-card {
    width: min(26rem, 100%);
    padding: 2rem 1.5rem;
    border-radius: 20px;
    background: rgba(255, 255, 255, .88);
    box-shadow: 0 24px 60px rgba(15, 23, 42, .28);
    backdrop-filter: blur(16px);
}

.flatpickr-calendar {
    z-index: 2000;
}

.pwa-banner {
    position: fixed;
    right: 1rem;
    bottom: 1rem;
    z-index: 1040;
    display: flex;
    gap: .75rem;
    align-items: center;
    max-width: calc(100% - 2rem);
    padding: .75rem 1rem;
    border-radius: 14px;
    background: #fff;
    box-shadow: 0 12px 30px rgba(15, 23, 42, .16);
}

body.modal-open .pwa-banner {
    display: none;
}

.action-menu summary {
    list-style: none;
}

.action-menu summary::-webkit-details-marker {
    display: none;
}

canvas,
img,
svg {
    max-width: 100%;
}

@media (min-width: 768px) {
    .login-screen {
        background-image: linear-gradient(rgba(15, 23, 42, .55), rgba(15, 23, 42, .55)), var(--login-bg);
    }

    .action-menu summary {
        display: none;
    }

    .action-menu-panel {
        display: flex;
        flex-wrap: wrap;
        justify-content: flex-end;
        gap: .35rem;
    }
}

@media (max-width: 767.98px) {
    .topbar {
        padding: .75rem 1rem;
    }

    .top-search {
        display: none;
    }

    .crumbs {
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .page-head,
    .page-actions {
        flex-wrap: wrap;
        width: 100%;
    }
    .action-menu {
        position: relative;
    }

    .action-menu-panel {
        display: none;
        position: absolute;
        right: 0;
        z-index: 5;
        min-width: 10rem;
        padding: .4rem;
        border: 1px solid var(--studio-line);
        border-radius: 12px;
        background: #fff;
        box-shadow: 0 10px 24px rgba(15, 23, 42, .12);
    }

    .action-menu[open] .action-menu-panel {
        display: flex;
        flex-direction: column;
        gap: .35rem;
    }
}

@media (max-width: 575.98px) {
    .form-control,
    .form-select,
    .btn {
        min-height: 44px;
        font-size: 16px;
    }

    .modal-dialog {
        width: 100%;
        max-width: none;
        height: 100%;
        margin: 0;
    }

    .modal-content {
        min-height: 100%;
        border: 0;
        border-radius: 0;
    }

    table.table-cards thead {
        display: none;
    }

    table.table-cards,
    table.table-cards tbody,
    table.table-cards tr,
    table.table-cards td {
        display: block;
        width: 100%;
    }

    table.table-cards tr {
        padding: .85rem 1rem;
        border-bottom: 1px solid var(--studio-line);
    }

    table.table-cards td {
        display: flex;
        justify-content: space-between;
        gap: 1rem;
        padding: .35rem 0;
        border: 0;
        text-align: right;
    }

    table.table-cards td::before {
        content: attr(data-label);
        font-weight: 600;
        color: #64748b;
        text-align: left;
    }
}

.page-loader {
    position: fixed;
    inset: 0;
    z-index: 3000;
    display: grid;
    place-items: center;
    background: rgba(245, 247, 251, .55);
    pointer-events: none;
}

.page-loader-bar {
    position: absolute;
    top: 0;
    left: 0;
    height: 3px;
    width: 35%;
    background: var(--studio-accent, #3b6cff);
    animation: loader-slide 1s ease-in-out infinite;
}

.page-loader-pill {
    display: inline-flex;
    align-items: center;
    gap: .6rem;
    padding: .7rem 1rem;
    border-radius: 999px;
    background: #fff;
    box-shadow: 0 12px 30px rgba(15, 23, 42, .16);
    font-weight: 600;
}

.page-loader-spin,
button.is-loading::after {
    width: 1rem;
    height: 1rem;
    border: 2px solid rgba(59, 108, 255, .25);
    border-top-color: #3b6cff;
    border-radius: 50%;
    animation: loader-spin .7s linear infinite;
}

button.is-loading {
    position: relative;
    color: transparent !important;
}

button.is-loading > * {
    visibility: hidden;
}

button.is-loading::after {
    content: "";
    position: absolute;
    inset: 0;
    margin: auto;
}

.btn-accent.is-loading::after,
.btn-danger.is-loading::after {
    border-color: rgba(255, 255, 255, .35);
    border-top-color: #fff;
}

@keyframes loader-spin {
    to { transform: rotate(360deg); }
}

@keyframes loader-slide {
    0% { transform: translateX(-120%); }
    100% { transform: translateX(320%); }
}
