:root {
    --app-primary: #173f73;
    --app-primary-2: #245ca3;
    --app-secondary: #0f766e;
    --app-bg: #f4f7fb;
    --app-sidebar: #ffffff;
    --app-sidebar-width: 260px;
    --app-navbar-height: 72px;
    --app-border: #e6ebf2;
    --app-text: #243447;
    --app-muted: #667085;
}

html,
body {
    min-height: 100%;
}

body {
    margin: 0;
    font-family: Inter, system-ui, -apple-system, "Segoe UI", sans-serif;
    background: var(--app-bg);
    color: var(--app-text);
}

.app-body {
    min-height: 100vh;
    overflow-x: hidden;
}

.app-navbar {
    min-height: var(--app-navbar-height);
    background: linear-gradient(110deg, var(--app-primary), var(--app-primary-2));
    box-shadow: 0 5px 20px rgba(15, 46, 82, .18);
    z-index: 1040;
}

.app-navbar .container-fluid {
    min-width: 0;
    padding-inline: clamp(1rem, 2vw, 1.75rem);
}

.app-navbar .navbar-brand {
    min-width: 0;
    font-size: 1.45rem;
    letter-spacing: -.02em;
}

.navbar-user {
    max-width: 240px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.logout-button {
    flex: 0 0 auto;
}

.public-body {
    min-height: 100vh;
    background: linear-gradient(145deg, #eef5ff, #f8fafc 55%, #e8f6f3);
}

.app-layout {
    display: flex;
    align-items: stretch;
    min-width: 0;
    min-height: calc(100vh - var(--app-navbar-height));
}

/*
 * Bootstrap membuat .offcanvas-lg .offcanvas-body menjadi display:flex
 * pada layar desktop. Override di bawah memastikan menu sidebar tetap
 * tersusun vertikal dan tidak menimpa konten dashboard.
 */
.app-sidebar {
    --bs-offcanvas-width: min(290px, 86vw);
    background: var(--app-sidebar);
    border-right: 1px solid var(--app-border) !important;
}

.app-sidebar .offcanvas-body {
    display: block !important;
    width: 100%;
}

.sidebar-nav {
    display: block;
    width: 100%;
}

.sidebar-label {
    margin: .35rem .85rem 1rem;
    color: #98a2b3;
    font-size: .72rem;
    font-weight: 800;
    letter-spacing: .12em;
}

.sidebar-link {
    display: flex;
    align-items: center;
    width: 100%;
    min-width: 0;
    gap: .8rem;
    margin-bottom: .35rem;
    padding: .8rem .9rem;
    border-radius: .75rem;
    color: #475467;
    text-decoration: none;
    font-weight: 600;
    line-height: 1.35;
    transition: background-color .15s ease, color .15s ease, transform .15s ease;
}

.sidebar-link i {
    flex: 0 0 1.25rem;
    width: 1.25rem;
    font-size: 1.1rem;
    text-align: center;
}

.sidebar-link span {
    min-width: 0;
}

.sidebar-link:hover,
.sidebar-link.active {
    color: var(--app-primary);
    background: #edf4ff;
}

.sidebar-link:hover {
    transform: translateX(2px);
}

.app-main {
    display: flex;
    flex: 1 1 auto;
    flex-direction: column;
    width: 100%;
    min-width: 0;
    min-height: calc(100vh - var(--app-navbar-height));
}

.app-content {
    flex: 1 1 auto;
    width: 100%;
    max-width: 1680px;
    margin-inline: auto;
    padding: clamp(1.25rem, 2.2vw, 2.25rem);
}

.app-footer {
    padding: 1rem 1.5rem 1.35rem;
}

.card {
    border: 0;
    border-radius: 1rem;
    box-shadow: 0 8px 28px rgba(15, 46, 82, .07);
}

.card-header {
    padding: 1rem 1.25rem;
    border-bottom: 1px solid #edf0f5;
    background: transparent;
}

.dashboard-heading {
    min-width: 0;
}

.page-eyebrow {
    margin-bottom: .3rem;
    color: var(--app-primary-2);
    font-size: .75rem;
    font-weight: 800;
    letter-spacing: .11em;
    text-transform: uppercase;
}

.page-title {
    color: #172b4d;
    font-size: clamp(1.75rem, 2.5vw, 2.35rem);
    font-weight: 800;
    letter-spacing: -.035em;
    line-height: 1.15;
}

.dashboard-action {
    flex: 0 0 auto;
    min-height: 46px;
    padding-inline: 1.15rem;
    border-radius: .75rem;
    font-weight: 700;
    box-shadow: 0 8px 18px rgba(13, 110, 253, .18);
}

.stat-card {
    overflow: hidden;
    border: 1px solid rgba(230, 235, 242, .72);
    transition: transform .18s ease, box-shadow .18s ease;
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 32px rgba(15, 46, 82, .10);
}

.stat-card .card-body {
    min-height: 190px;
    padding: 1.35rem;
}

.stat-icon,
.stat-card .icon {
    display: grid;
    width: 52px;
    height: 52px;
    place-items: center;
    border-radius: 15px;
    color: var(--app-primary);
    background: #eaf2ff;
    font-size: 1.4rem;
}

.stat-value {
    color: #101828;
    font-size: 1.75rem;
    font-weight: 800;
    letter-spacing: -.025em;
    line-height: 1.1;
}

.stat-label {
    margin-top: .45rem;
    color: var(--app-muted);
    font-size: .95rem;
}

.activity-card {
    overflow: hidden;
}

.activity-card .card-header {
    padding: 1.25rem 1.5rem;
}

.activity-link {
    flex: 0 0 auto;
    font-weight: 600;
    text-decoration: none;
}

.dashboard-table > :not(caption) > * > * {
    padding: 1rem 1.25rem;
}

.table thead th {
    color: #667085;
    font-size: .78rem;
    font-weight: 800;
    letter-spacing: .045em;
    text-transform: uppercase;
    white-space: nowrap;
}

.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 190px;
    padding: 2rem;
    text-align: center;
}

.empty-state-icon {
    display: grid;
    width: 52px;
    height: 52px;
    margin-bottom: .8rem;
    place-items: center;
    border-radius: 50%;
    color: var(--app-primary);
    background: #edf4ff;
    font-size: 1.35rem;
}

.badge {
    font-weight: 600;
}

.hero {
    padding: 5rem 0;
}

.hero-badge {
    display: inline-flex;
    align-items: center;
    gap: .5rem;
    padding: .4rem .8rem;
    border: 1px solid #d9e7f8;
    border-radius: 99px;
    color: var(--app-primary);
    background: white;
}

.auth-card {
    max-width: 520px;
    margin: 3rem auto;
}

.question-nav {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(42px, 1fr));
    gap: .5rem;
}

.question-nav button {
    height: 42px;
    border: 1px solid #d0d5dd;
    border-radius: .6rem;
    background: white;
    font-weight: 700;
}

.question-nav button.answered {
    color: #065f46;
    border-color: #6ee7b7;
    background: #d1fae5;
}

.question-nav button.marked {
    box-shadow: inset 0 0 0 3px #fbbf24;
}

.question-nav button.current {
    color: white;
    border-color: var(--app-primary);
    background: var(--app-primary);
}

.option-label {
    padding: .85rem 1rem;
    border: 1px solid #dde3ec;
    border-radius: .8rem;
    cursor: pointer;
    transition: .15s ease;
}

.option-label:hover {
    border-color: #8bb2e3;
    background: #f6f9ff;
}

.form-check-input:checked + .option-label {
    border-color: var(--app-primary);
    background: #edf4ff;
    box-shadow: 0 0 0 2px rgba(23, 63, 115, .08);
}

.timer-box {
    color: #b42318;
    font-size: 1.25rem;
    font-variant-numeric: tabular-nums;
    font-weight: 800;
}

.status-dot {
    display: inline-block;
    width: 9px;
    height: 9px;
    border-radius: 50%;
}

@media (min-width: 992px) {
    .app-sidebar.offcanvas-lg {
        position: sticky !important;
        top: var(--app-navbar-height);
        z-index: 1020;
        display: block !important;
        flex: 0 0 var(--app-sidebar-width);
        width: var(--app-sidebar-width) !important;
        max-width: var(--app-sidebar-width);
        height: calc(100vh - var(--app-navbar-height));
        min-height: calc(100vh - var(--app-navbar-height));
        overflow-x: hidden;
        overflow-y: auto;
        visibility: visible !important;
        transform: none !important;
    }

    .app-sidebar.offcanvas-lg .offcanvas-body {
        display: block !important;
        width: 100%;
        height: auto;
        padding: 1.5rem 1rem !important;
        overflow: visible;
    }
}

@media (max-width: 991.98px) {
    :root {
        --app-navbar-height: 64px;
    }

    .app-navbar {
        min-height: var(--app-navbar-height);
    }

    .app-navbar .navbar-brand {
        font-size: 1.2rem;
    }

    .app-layout,
    .app-main {
        min-height: calc(100vh - var(--app-navbar-height));
    }

    .app-sidebar {
        width: var(--bs-offcanvas-width) !important;
        min-height: 100vh;
    }

    .app-sidebar .offcanvas-body {
        padding: 1rem !important;
    }

    .app-content {
        padding: 1.25rem 1rem 1.75rem;
    }

    .hero {
        padding: 3rem 0;
    }
}

@media (max-width: 575.98px) {
    .app-navbar .container-fluid {
        padding-inline: .85rem;
    }

    .dashboard-action {
        width: 100%;
    }

    .activity-card .card-header {
        padding: 1rem;
    }

    .dashboard-table > :not(caption) > * > * {
        padding: .85rem 1rem;
    }

    .stat-card .card-body {
        min-height: 160px;
    }
}

@media print {
    .app-navbar,
    .app-sidebar,
    .app-footer,
    footer,
    .no-print {
        display: none !important;
    }

    .app-layout,
    .app-main,
    .container-fluid,
    .app-content {
        display: block !important;
        width: 100% !important;
        max-width: none !important;
        min-height: 0 !important;
        padding: 0 !important;
    }

    body {
        background: white;
    }

    .card {
        border: 1px solid #ddd;
        box-shadow: none;
    }
}
