:root {
    --brand-primary: #405090;
    --brand-secondary: #0090d0;
    --brand-deep: #1f2f63;
    --brand-ink: #1f2937;
    --sidebar-width: 260px;

    --bs-primary: #405090;
    --bs-primary-rgb: 64, 80, 144;

    --sidebar-bg: #213467;
    --sidebar-bg-2: #17294f;
    --header-bg: #ffffff;
    --content-bg: #f2f6fb;
    --footer-bg: #eaf1f8;
}

* {
    box-sizing: border-box;
}

html,
body {
    height: 100%;
}

body {
    margin: 0;
    font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
    color: var(--brand-ink);
    background: #eef3f9;
}

.app-bg {
    overflow: hidden;
}

.auth-bg {
    position: relative;
    isolation: isolate;
    background: linear-gradient(150deg, #e9f0fb 0%, #edf5ff 46%, #e6f0fa 100%);
    min-height: 100vh;
    overflow-x: hidden;
    overflow-y: auto;
}

.auth-bg::before {
    content: "";
    position: fixed;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    background:
        radial-gradient(circle at 12% 18%, rgba(66, 87, 152, 0.32) 0%, rgba(66, 87, 152, 0.16) 28%, rgba(66, 87, 152, 0) 56%),
        radial-gradient(circle at 86% 16%, rgba(0, 144, 208, 0.26) 0%, rgba(0, 144, 208, 0.12) 30%, rgba(0, 144, 208, 0) 58%),
        radial-gradient(circle at 70% 82%, rgba(64, 122, 186, 0.24) 0%, rgba(64, 122, 186, 0.1) 26%, rgba(64, 122, 186, 0) 56%);
    filter: blur(82px);
    transform: scale(1.06);
    opacity: 0.82;
}

.auth-bg::after {
    content: "";
    position: fixed;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.42) 0%, rgba(255, 255, 255, 0.14) 44%, rgba(233, 243, 252, 0.45) 100%);
}

.auth-shell {
    position: relative;
    z-index: 1;
    min-height: 100vh;
    display: flex;
    align-items: center;
}

.auth-container {
    position: relative;
    z-index: 1;
    width: 100%;
}

.auth-card {
    border: 1px solid rgba(201, 216, 235, 0.9);
    border-radius: 1rem;
    box-shadow: 0 20px 42px rgba(17, 36, 68, 0.16);
    background: rgba(255, 255, 255, 0.98);
}

.auth-card-body {
    padding: 1.2rem 1.1rem;
}

.auth-footer {
    font-size: 0.76rem;
    color: #55657f;
    line-height: 1.35;
}

.auth-login-brand {
    border: 1px solid #d4e2f2;
    border-radius: 0.88rem;
    background: linear-gradient(145deg, #ffffff 0%, #f2f8ff 62%, #edf5ff 100%);
    padding: 0.75rem 0.75rem 0.65rem;
}

.auth-login-logo-wrap {
    width: 124px;
    height: 124px;
    margin: 0 auto 0.45rem;
    border-radius: 50%;
    background: radial-gradient(circle at 35% 30%, #ffffff 0%, #f3f8ff 72%, #dbe8fb 100%);
    border: 2px solid rgba(255, 255, 255, 0.84);
    box-shadow: 0 8px 18px rgba(10, 25, 56, 0.15), inset 0 0 0 2px rgba(0, 144, 208, 0.16);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.auth-login-logo {
    width: 98px;
    height: 98px;
    object-fit: cover;
    object-position: center;
    border-radius: 50%;
    display: block;
}

.auth-login-title {
    font-size: 1.2rem;
    line-height: 1.18;
    font-weight: 800;
    color: #1e2f57;
    letter-spacing: 0.01em;
    margin: 0;
}

.auth-login-subtitle {
    font-size: 0.79rem;
    color: #4e617f;
    margin: 0;
}

.auth-login-school {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    gap: 0.42rem;
}

.auth-login-pill {
    display: inline-flex;
    align-items: center;
    border: 1px solid #cddbec;
    background: #f8fbff;
    border-radius: 999px;
    padding: 0.22rem 0.56rem;
    font-size: 0.71rem;
    line-height: 1.2;
    font-weight: 700;
    color: #30486f;
}

.auth-login-panel {
    border: 1px solid #d6e3f2;
    border-radius: 0.88rem;
    background: rgba(255, 255, 255, 0.98);
    padding: 0.85rem 0.82rem 0.8rem;
}

.auth-login-panel h4 {
    color: #1f2f63;
    font-size: 1.08rem;
}

.auth-login-form .form-label {
    margin-bottom: 0.18rem;
    font-size: 0.79rem;
    font-weight: 700;
    color: #32425d;
}

.auth-login-form .form-control {
    min-height: 2.22rem;
    font-size: 0.9rem;
}

.auth-login-form .btn {
    margin-top: 0.2rem;
    min-height: 2.3rem;
    font-weight: 700;
    letter-spacing: 0.01em;
}

.auth-login-disclaimer {
    text-align: center;
}

.auth-setup-page .auth-container {
    max-width: min(1240px, 96vw);
}

.auth-signin-page .auth-container {
    max-width: min(1160px, 95vw);
}

.auth-signin {
    display: grid;
    grid-template-columns: minmax(0, 0.94fr) minmax(0, 1.06fr);
    gap: 1rem;
    align-items: stretch;
}

.auth-signin .auth-login-brand,
.auth-signin .auth-login-panel {
    height: 100%;
    margin-top: 0 !important;
    min-width: 0;
}

.auth-signin-brand {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 0.86rem;
    border: 1px solid #d4e0ef;
    border-radius: 1rem;
    background: linear-gradient(158deg, #1f3868 0%, #225183 56%, #118abc 100%);
    color: #eef6ff;
    padding: 1.2rem 1.14rem 1.08rem;
    box-shadow: 0 20px 36px rgba(18, 40, 74, 0.24);
}

.auth-signin-logo-shell {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 170px;
    border: 1px solid rgba(210, 226, 246, 0.9);
    border-radius: 0.9rem;
    background: #ffffff;
    padding: 0.62rem 0.72rem;
    overflow: hidden;
}

.auth-signin-logo {
    width: 100%;
    height: 100%;
    object-fit: contain;
    object-position: center center;
    border-radius: 0;
    background: transparent;
    transform: scale(2.75);
    transform-origin: center center;
}

.auth-signin-brand .auth-login-title {
    font-size: 1.48rem;
    color: #ffffff;
}

.auth-signin-brand .auth-login-subtitle {
    font-size: 0.84rem;
    line-height: 1.4;
    color: rgba(237, 245, 255, 0.92);
}

.auth-signin-meta {
    display: grid;
    gap: 0.54rem;
    margin-top: 0.12rem;
}

.auth-signin-meta-item {
    border: 1px solid rgba(225, 238, 255, 0.34);
    border-radius: 0.7rem;
    background: rgba(255, 255, 255, 0.13);
    padding: 0.52rem 0.62rem;
}

.auth-signin-meta-label {
    display: block;
    font-size: 0.66rem;
    line-height: 1.1;
    text-transform: uppercase;
    letter-spacing: 0.09em;
    color: rgba(227, 239, 255, 0.9);
}

.auth-signin-meta-value {
    display: block;
    margin-top: 0.16rem;
    font-size: 0.9rem;
    line-height: 1.24;
    font-weight: 800;
    color: #ffffff;
    word-break: break-word;
}

.auth-signin-panel {
    padding: 1.16rem 1.12rem 1.05rem;
    border: 1px solid #d4e2f1;
    border-radius: 1rem;
    background: rgba(255, 255, 255, 0.96);
    width: 100%;
    max-width: 100%;
}

.auth-signin-form .form-control {
    min-height: 2.55rem;
    border-radius: 0.7rem;
}

.auth-signin-panel-head {
    margin-bottom: 0.28rem;
}

.auth-signin-panel-head h4 {
    font-size: 1.22rem;
    color: #1f2f63;
}

.auth-signin-links {
    margin-top: -0.04rem;
}

.auth-signin-submit {
    min-height: 2.62rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.34rem;
    border-radius: 0.72rem;
    font-weight: 800;
}

.auth-setup {
    display: grid;
    grid-template-columns: minmax(270px, 0.95fr) minmax(440px, 1.3fr);
    gap: 1rem;
    align-items: stretch;
}

.auth-setup-modern .auth-signin-panel {
    padding-top: 1.08rem;
}

.auth-setup-modern .auth-signin-meta-value {
    font-size: 0.88rem;
}

.auth-setup .auth-login-brand,
.auth-setup .auth-login-panel {
    height: 100%;
    margin-top: 0 !important;
}

.auth-setup .auth-login-brand {
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 1rem 1rem 0.9rem;
}

.auth-setup .auth-login-panel {
    padding: 1.02rem 1rem 0.95rem;
}

.auth-setup-form {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.72rem 0.9rem;
}

.auth-setup-field {
    margin: 0;
}

.auth-setup-field-wide,
.auth-setup-actions {
    grid-column: 1 / -1;
}

.auth-setup-actions .btn {
    margin-top: 0.2rem;
}

.auth-setup-note {
    margin-top: 0.95rem !important;
}

@media (max-width: 575px) {
    .auth-card-body {
        padding: 0.9rem;
    }

    .auth-login-title {
        font-size: 1.08rem;
    }

    .auth-login-logo-wrap {
        width: 104px;
        height: 104px;
    }

    .auth-login-logo {
        width: 82px;
        height: 82px;
    }

    .auth-login-panel {
        padding: 0.76rem 0.72rem;
    }
}

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

    .auth-signin-brand {
        padding: 1rem 0.94rem 0.9rem;
    }

    .auth-signin-panel {
        padding: 1rem 0.94rem 0.9rem;
    }

    .auth-setup {
        grid-template-columns: 1fr;
    }

    .auth-setup .auth-login-brand {
        padding: 0.9rem 0.9rem 0.84rem;
    }

    .auth-setup .auth-login-panel {
        padding: 0.92rem 0.9rem 0.86rem;
    }
}

@media (max-width: 767px) {
    .auth-signin-logo-shell {
        min-height: 140px;
        padding: 0.56rem 0.64rem;
    }

    .auth-signin-logo {
        transform: scale(2.35);
    }

    .auth-setup-form {
        grid-template-columns: 1fr;
    }
}
.app-shell {
    display: flex;
    height: 100vh;
    max-height: 100vh;
    overflow: hidden;
}

.sidebar {
    width: var(--sidebar-width);
    background: linear-gradient(165deg, var(--sidebar-bg) 0%, var(--sidebar-bg-2) 100%);
    border-right: 1px solid rgba(255, 255, 255, 0.12);
    height: 100vh;
    max-height: 100vh;
    position: sticky;
    top: 0;
    overflow: hidden;
    flex-shrink: 0;
    box-shadow: 8px 0 26px rgba(8, 18, 38, 0.26);
}
.sidebar-modern {
    position: relative;
    isolation: isolate;
}
.sidebar::before {
    content: "";
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at 24% 12%, rgba(0, 144, 208, 0.28) 0%, transparent 54%),
                radial-gradient(circle at 86% 84%, rgba(64, 80, 144, 0.22) 0%, transparent 58%);
    opacity: 0.95;
    pointer-events: none;
}
.sidebar-inner {
    position: relative;
    z-index: 1;
    height: 100%;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
.sidebar-brand {
    padding: 0.6rem 0.55rem 0.72rem;
    margin-bottom: 0.75rem !important;
    border: 1px solid rgba(255, 255, 255, 0.14);
    border-radius: 0.92rem;
    background: rgba(255, 255, 255, 0.05);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.11);
}
.sidebar-logo-shell {
    width: 100%;
    max-width: 190px;
    height: 98px;
    margin: 0 auto;
    border-radius: 0.95rem;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #ffffff;
    border: 1px solid rgba(203, 224, 248, 0.96);
    box-shadow: 0 10px 22px rgba(6, 13, 33, 0.32);
    padding: 0.52rem 0.64rem;
    overflow: hidden;
}
.sidebar-logo {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: contain;
    object-position: center;
    border-radius: 0;
    background: transparent;
    transform: scale(1.46);
    transform-origin: center center;
}
.sidebar-title {
    font-weight: 800;
    letter-spacing: 0.01em;
    font-size: 1.04rem;
    line-height: 1.18;
    white-space: normal;
    overflow-wrap: anywhere;
    text-wrap: balance;
}
.sidebar-subtitle {
    display: block;
    color: rgba(255, 255, 255, 0.82);
    letter-spacing: 0.01em;
    font-size: 0.79rem;
    line-height: 1.25;
}
.sidebar-nav {
    gap: 0.3rem !important;
    flex: 1 1 auto;
    min-height: 0;
    margin-top: 0.2rem;
}
.sidebar-link {
    display: flex;
    align-items: center;
    gap: 0.58rem;
    color: rgba(255, 255, 255, 0.9);
    border-radius: 0.68rem;
    padding: 0.5rem 0.62rem;
    font-size: 0.86rem;
    line-height: 1.2;
    border: 1px solid transparent;
    background: rgba(255, 255, 255, 0.04);
    transition: background-color 0.18s ease, border-color 0.18s ease, transform 0.18s ease, box-shadow 0.18s ease;
}
.sidebar-link-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.58);
    box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.1);
    flex-shrink: 0;
}
.sidebar-link:hover {
    color: #ffffff;
    background: rgba(0, 144, 208, 0.2);
    border-color: rgba(157, 220, 255, 0.36);
    transform: translateX(2px);
}
.sidebar-link.active {
    color: #ffffff;
    background: linear-gradient(90deg, rgba(0, 144, 208, 0.38) 0%, rgba(76, 107, 184, 0.4) 100%);
    border-color: rgba(171, 221, 255, 0.48);
    box-shadow: 0 8px 16px rgba(4, 12, 30, 0.26);
}
.sidebar-link.active .sidebar-link-dot {
    background: #ffffff;
    box-shadow: 0 0 0 2px rgba(214, 240, 255, 0.5);
}
.sidebar-user {
    margin-top: auto;
    padding: 0.78rem !important;
    border-top: 0 !important;
    border: 1px solid rgba(255, 255, 255, 0.16);
    border-radius: 0.82rem;
    background: rgba(12, 25, 52, 0.45);
}
.sidebar-user .small {
    font-size: 0.76rem;
}
.sidebar-user .fw-semibold {
    font-size: 0.92rem;
    line-height: 1.24;
}
.sidebar-user .btn {
    padding-top: 0.32rem;
    padding-bottom: 0.32rem;
}

/* Keep full sidebar menu visible after adding Newcomer Double Claim */
.sidebar-inner {
    padding: 0.94rem 0.82rem !important;
}

.sidebar-brand {
    padding: 0.56rem 0.52rem 0.62rem;
    margin-bottom: 0.62rem !important;
}

.sidebar-logo-shell {
    max-width: 178px;
    height: 90px;
}

.sidebar-logo {
    transform: scale(1.54);
}

.sidebar-title {
    font-size: 1.01rem;
}

.sidebar-subtitle {
    font-size: 0.78rem;
}

.sidebar-nav {
    gap: 0.28rem !important;
    flex-wrap: nowrap !important;
    overflow-y: auto;
    overflow-x: hidden;
    padding-right: 0.18rem;
    scrollbar-width: thin;
    scrollbar-color: rgba(173, 210, 243, 0.5) transparent;
}

.sidebar-link {
    padding: 0.47rem 0.6rem;
    font-size: 0.9rem;
    font-weight: 600;
    line-height: 1.25;
}

.sidebar-user {
    padding: 0.66rem !important;
    flex-shrink: 0;
}

.sidebar-nav::-webkit-scrollbar {
    width: 6px;
}

.sidebar-nav::-webkit-scrollbar-track {
    background: transparent;
}

.sidebar-nav::-webkit-scrollbar-thumb {
    background: rgba(173, 210, 243, 0.42);
    border-radius: 999px;
}

.sidebar-nav::-webkit-scrollbar-thumb:hover {
    background: rgba(173, 210, 243, 0.65);
}

@media (max-height: 920px) {
    .sidebar-inner {
        padding: 0.7rem 0.62rem !important;
    }

    .sidebar-brand {
        padding: 0.46rem 0.42rem 0.5rem;
        margin-bottom: 0.5rem !important;
    }

    .sidebar-logo-shell {
        max-width: 150px;
        height: 74px;
        border-width: 1px;
    }

    .sidebar-logo {
        transform: scale(1.34);
    }

    .sidebar-title {
        font-size: 0.94rem;
    }

    .sidebar-subtitle {
        font-size: 0.72rem;
    }

    .sidebar-link {
        padding: 0.39rem 0.52rem;
        font-size: 0.84rem;
    }

    .sidebar-link-dot {
        width: 6px;
        height: 6px;
    }

    .sidebar-user {
        padding: 0.56rem !important;
    }
}

.app-main {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    height: 100vh;
    max-height: 100vh;
    overflow: hidden;
}

.app-header {
    background: var(--header-bg);
    border-bottom: 2px solid rgba(0, 144, 208, 0.2);
    padding: 0.9rem 1.1rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.85rem;
    flex-shrink: 0;
}

.app-header-glass {
    background: rgba(255, 255, 255, 0.58);
    border-bottom: 1px solid rgba(88, 130, 180, 0.34);
    backdrop-filter: blur(14px) saturate(140%);
    -webkit-backdrop-filter: blur(14px) saturate(140%);
    box-shadow: 0 8px 20px rgba(19, 42, 77, 0.08);
}

.app-header-left {
    min-width: 0;
    flex: 1 1 auto;
}

.header-page-title {
    color: #1d2f57;
    letter-spacing: 0.01em;
}

.header-school-line {
    display: flex;
    flex-wrap: nowrap;
    align-items: center;
    gap: 0.55rem;
    color: #425676;
    white-space: nowrap;
    overflow: hidden;
}

.header-school-item {
    display: inline-flex;
    align-items: baseline;
    gap: 0.34rem;
    white-space: nowrap;
    min-width: 0;
}

.header-school-item:last-child .header-school-value {
    overflow: hidden;
    text-overflow: ellipsis;
}

.header-school-label {
    font-size: 0.82rem;
    font-weight: 700;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    color: #5b6f8f;
}

.header-school-value {
    font-size: 1.05rem;
    line-height: 1.1;
}

.header-school-sep {
    color: #7b8da8;
    font-size: 0.9rem;
    font-weight: 700;
}

.header-school-glow {
    color: #0d4f94;
    font-weight: 800;
    text-shadow: 0 0 8px rgba(0, 144, 208, 0.4), 0 0 16px rgba(64, 80, 144, 0.24);
}

.app-header-actions {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    flex-shrink: 0;
}

.header-help-btn {
    white-space: nowrap;
    min-width: 108px;
}

.header-live-clock {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 0.06rem;
    padding: 0.34rem 0.6rem;
    border: 1px solid rgba(66, 108, 161, 0.32);
    border-radius: 0.6rem;
    background: rgba(255, 255, 255, 0.5);
}

.header-clock-label {
    font-size: 0.66rem;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: #5e7291;
    line-height: 1.1;
}

.header-clock-value {
    font-size: 0.84rem;
    color: #1d2f57;
    letter-spacing: 0.02em;
    line-height: 1.2;
}

.app-content {
    flex: 1;
    min-height: 0;
    padding: 1rem 1.1rem;
    background: var(--content-bg);
    overflow-y: auto;
    overflow-x: hidden;
}

.app-footer {
    background: var(--footer-bg);
    border-top: 1px solid #d2deea;
    padding: 0.65rem 1.1rem;
    display: flex;
    justify-content: space-between;
    font-size: 0.82rem;
    color: #4b5563;
    flex-shrink: 0;
}
.card {
    border: 1px solid #dce6f2;
}

.card-header {
    background: #f8fbff;
    border-bottom: 1px solid #dce6f2;
}

.stat-card {
    box-shadow: 0 1px 2px rgba(21, 36, 71, 0.06);
}

.preview-frame {
    width: 100%;
    min-height: 76vh;
    border: 1px solid #d4deea;
    border-radius: 8px;
    background: #fff;
}

.builder-workspace {
    display: grid;
    grid-template-columns: minmax(0, 1fr) var(--sidebar-width);
    gap: 1rem;
    align-items: start;
    min-height: calc(100vh - 150px);
}

.builder-main {
    min-height: calc(100vh - 150px);
    display: flex;
    flex-direction: column;
}

.builder-preview-card {
    min-height: calc(100vh - 220px);
}

.preview-frame-lg {
    min-height: calc(100vh - 295px);
}

.builder-tools-column {
    width: var(--sidebar-width);
    min-height: calc(100vh - 150px);
}

.builder-tools-stack {
    position: sticky;
    top: 0.8rem;
}

summary {
    cursor: pointer;
}

@media (max-width: 1199px) {
    .builder-workspace {
        grid-template-columns: 1fr;
        min-height: auto;
    }

    .builder-main,
    .builder-tools-column {
        min-height: auto;
    }

    .builder-tools-column {
        width: 100%;
    }

    .builder-preview-card,
    .preview-frame-lg,
    .preview-frame {
        min-height: 62vh;
    }

    .builder-bottom-grid {
        flex: initial;
    }

    .builder-tools-stack {
        position: static;
    }
}

@media (max-width: 991px) {
    .app-bg {
        overflow: auto;
    }

    .app-shell {
        flex-direction: column;
        height: auto;
        max-height: none;
        overflow: visible;
    }

    .sidebar {
        width: 100%;
        height: auto;
        max-height: none;
        position: relative;
        top: auto;
        overflow: visible;
    }
    .sidebar-inner {
        min-height: 0;
    }
    .sidebar-nav {
        flex-direction: row;
        flex-wrap: wrap;
        gap: 0.4rem !important;
    }
    .sidebar-link {
        flex: 1 1 calc(50% - 0.4rem);
        justify-content: flex-start;
    }

    .app-main {
        height: auto;
        max-height: none;
        overflow: visible;
    }

    .app-content {
        overflow: visible;
    }

    .app-header,
    .app-footer {
        flex-direction: column;
        align-items: flex-start;
    }
}
.register-shell {
    display: block;
}

.register-hero {
    border-left: 4px solid var(--brand-secondary);
    background: linear-gradient(145deg, #ffffff 0%, #f3f8ff 100%);
}

.register-metrics {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 0.75rem;
}

.register-metric {
    background: #ffffff;
    border: 1px solid #d7e3f1;
    border-radius: 0.75rem;
    padding: 0.9rem 1rem;
    box-shadow: 0 1px 2px rgba(20, 36, 68, 0.05);
}

.register-metric-label {
    font-size: 0.78rem;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: #637088;
    margin-bottom: 0.1rem;
}

.register-metric-value {
    font-size: 1.7rem;
    line-height: 1;
    font-weight: 700;
    color: #1e2d51;
}

.register-filter-form .form-label {
    font-weight: 600;
    font-size: 0.87rem;
}

.grade-chip-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: center;
}

.grade-chip {
    border: 1px solid #c7d6ea;
    border-radius: 999px;
    padding: 0.35rem 0.72rem;
    background: #fff;
    color: #2d3b58;
    font-size: 0.82rem;
    line-height: 1;
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
}

.grade-chip:hover {
    border-color: var(--brand-primary);
    color: var(--brand-primary);
}

.grade-chip.active {
    background: var(--brand-primary);
    color: #fff;
    border-color: var(--brand-primary);
}

.grade-chip-count {
    background: rgba(255, 255, 255, 0.28);
    border-radius: 999px;
    padding: 0.14rem 0.38rem;
    font-size: 0.75rem;
}

.register-table-card .table-responsive {
    max-height: 68vh;
}

.register-table thead th {
    font-size: 0.76rem;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: #5f6f87;
    border-bottom: 1px solid #d7e3f1;
    background: #f7fbff;
    position: sticky;
    top: 0;
    z-index: 2;
}

.register-table tbody tr:hover {
    background: #f7fbff;
}

.pin-badge {
    font-family: Consolas, "Courier New", monospace;
    font-size: 0.82rem;
    background: #eef4fb;
    border: 1px solid #d2dfef;
    border-radius: 0.35rem;
    padding: 0.24rem 0.42rem;
    display: inline-block;
}

.grade-tag {
    display: inline-block;
    background: #eaf3ff;
    color: #24407b;
    border: 1px solid #c7d8f3;
    border-radius: 999px;
    padding: 0.2rem 0.56rem;
    font-weight: 600;
    font-size: 0.78rem;
}

.status-pill {
    display: inline-block;
    border-radius: 999px;
    padding: 0.22rem 0.6rem;
    font-size: 0.76rem;
    font-weight: 700;
    letter-spacing: 0.02em;
}

.status-pill.is-active {
    background: #e8f7ef;
    color: #1f6d45;
    border: 1px solid #bde6cf;
}

.status-pill.is-inactive {
    background: #f1f3f7;
    color: #59657a;
    border: 1px solid #d5dbe5;
}

.register-actions details summary {
    list-style: none;
}

.register-actions details summary::-webkit-details-marker {
    display: none;
}

.register-edit-panel {
    background: #f9fbff;
    border: 1px solid #dbe6f3;
    border-radius: 0.65rem;
    padding: 0.65rem;
}

.import-preview-card {
    border: 1px solid #d4e1f0;
    box-shadow: 0 4px 10px rgba(26, 46, 84, 0.05);
}

.import-preview-modal .modal-dialog {
    max-width: min(96vw, 1500px);
}

.import-preview-modal .modal-body {
    padding-top: 0.78rem;
}

.import-preview-modal .modal-header {
    align-items: flex-start;
    gap: 0.65rem;
}

.import-preview-header-main {
    min-width: 0;
}

.import-preview-header-actions {
    margin-left: auto;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 0.35rem;
}

.import-preview-file-badge {
    max-width: min(42vw, 520px);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.import-auto-status {
    min-height: 1.2rem;
}

.import-summary-grid {
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 0.55rem;
}

.import-summary-item {
    border: 1px solid #d8e3f1;
    border-radius: 0.68rem;
    background: #fff;
    padding: 0.58rem 0.62rem;
}

.import-summary-item span {
    display: block;
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #60708c;
}

.import-summary-item strong {
    display: block;
    margin-top: 0.1rem;
    font-size: 1.06rem;
    line-height: 1;
    color: #1f2f63;
}

.import-summary-item.is-ready {
    border-color: #bfe4cc;
    background: #f2fbf6;
}

.import-summary-item.is-blocked,
.import-summary-item.is-duplicate {
    border-color: #f1c6cc;
    background: #fff6f7;
}

.import-scan-report-wrap {
    border: 1px solid #d9e4f2;
    border-radius: 0.68rem;
    max-height: 240px;
}

.import-upload-progress {
    border: 1px solid #d9e4f2;
    border-radius: 0.68rem;
    background: #f8fbff;
    padding: 0.58rem 0.62rem;
}

.import-upload-progress .progress {
    height: 0.66rem;
    border-radius: 999px;
    background: #e7eef8;
}

.import-upload-progress .progress-bar {
    min-width: 0.1rem;
}

.import-upload-progress.is-complete {
    border-color: #bfe4cc;
    background: #f2fbf6;
}

.import-upload-progress.is-error {
    border-color: #efb5bd;
    background: #fff3f5;
}

.import-scan-report thead th {
    font-size: 0.69rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #5f6f87;
    background: #f7fbff;
    position: sticky;
    top: 0;
    z-index: 1;
}

.import-scan-report td {
    font-size: 0.78rem;
}

.import-preview-table-wrap {
    max-height: 64vh;
    overflow-x: hidden;
}

.import-preview-table {
    width: 100%;
    table-layout: fixed;
}

.import-preview-table th,
.import-preview-table td {
    white-space: normal;
    word-break: break-word;
}

.import-preview-table th:nth-child(1),
.import-preview-table td:nth-child(1) { width: 3%; }
.import-preview-table th:nth-child(2),
.import-preview-table td:nth-child(2) { width: 8%; }
.import-preview-table th:nth-child(3),
.import-preview-table td:nth-child(3) { width: 7%; }
.import-preview-table th:nth-child(4),
.import-preview-table td:nth-child(4) { width: 11%; }
.import-preview-table th:nth-child(5),
.import-preview-table td:nth-child(5) { width: 13%; }
.import-preview-table th:nth-child(6),
.import-preview-table td:nth-child(6) { width: 12%; }
.import-preview-table th:nth-child(7),
.import-preview-table td:nth-child(7) { width: 9%; }
.import-preview-table th:nth-child(8),
.import-preview-table td:nth-child(8) { width: 6%; }
.import-preview-table th:nth-child(9),
.import-preview-table td:nth-child(9) { width: 23%; }
.import-preview-table th:nth-child(10),
.import-preview-table td:nth-child(10) { width: 8%; }

.import-preview-table thead th {
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #5f6f87;
    background: #f6faff;
    position: sticky;
    top: 0;
    z-index: 2;
}

.import-preview-table td {
    vertical-align: top;
    padding-top: 0.38rem;
    padding-bottom: 0.38rem;
}

.import-preview-table .form-control-sm {
    min-width: 0;
    width: 100%;
}

.import-preview-table .font-monospace {
    min-width: 0;
}

.import-pin-duplicate {
    border-color: #d7374a !important;
    background: #fff1f3 !important;
    color: #8a1f2c !important;
    box-shadow: inset 0 0 0 1px rgba(215, 55, 74, 0.08);
}

.import-notes-cell {
    min-width: 0;
}

.import-issue-list {
    margin: 0;
    padding-left: 1rem;
    font-size: 0.75rem;
    color: #8a1f2c;
}

.import-issue-list li {
    margin-bottom: 0.18rem;
}

.import-row-ready {
    background: #f3fbf7;
}

.import-row-blocked {
    background: #fff7f8;
}

.import-row-skipped,
.import-row-skipped-manual {
    opacity: 0.65;
    background: #f2f4f8;
}

@media (max-width: 1199px) {
    .import-summary-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .import-preview-table th:nth-child(2),
    .import-preview-table td:nth-child(2),
    .import-preview-table th:nth-child(10),
    .import-preview-table td:nth-child(10) {
        display: none;
    }
}

@media (max-width: 767px) {
    .import-summary-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .import-scan-report-wrap {
        max-height: none;
    }

    .import-notes-cell {
        min-width: 0;
    }

    .import-preview-table-wrap {
        max-height: none;
    }

    .import-preview-table th:nth-child(3),
    .import-preview-table td:nth-child(3) {
        display: none;
    }

    .import-preview-table td {
        padding-top: 0.28rem;
        padding-bottom: 0.28rem;
    }

    .import-preview-table .form-control-sm {
        font-size: 0.76rem;
        padding: 0.24rem 0.34rem;
    }
}

@media (max-width: 1199px) {
    .register-metrics {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .register-table-card .table-responsive {
        max-height: none;
    }
}

@media (max-width: 575px) {
    .register-metrics {
        grid-template-columns: 1fr;
    }
}


.rollover-shell {
    display: block;
}

.rollover-hero {
    border-left: 4px solid var(--brand-secondary);
    background: linear-gradient(145deg, #ffffff 0%, #f4f9ff 100%);
}

.rollover-metrics {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 0.72rem;
}

.rollover-metric {
    background: #fff;
    border: 1px solid #d8e4f1;
    border-radius: 0.74rem;
    padding: 0.74rem 0.86rem;
}

.rollover-metric-label {
    font-size: 0.73rem;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: #64738e;
    margin-bottom: 0.12rem;
}

.rollover-metric-value {
    font-size: 1.2rem;
    line-height: 1;
    font-weight: 700;
    color: #1f2f63;
}

.rollover-setup-card,
.rollover-preview-card {
    border: 1px solid #d7e3f1;
}

.rollover-summary-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 0.56rem;
}

.rollover-summary-item {
    border: 1px solid #d8e3f1;
    border-radius: 0.68rem;
    background: #fff;
    padding: 0.56rem 0.62rem;
}

.rollover-summary-item span {
    display: block;
    font-size: 0.71rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #5f6f88;
}

.rollover-summary-item strong {
    display: block;
    margin-top: 0.1rem;
    font-size: 1rem;
    line-height: 1;
    color: #1f2f63;
}

.rollover-summary-item.is-ready {
    border-color: #bfe4cc;
    background: #f2fbf6;
}

.rollover-summary-item.is-blocked {
    border-color: #f1c6cc;
    background: #fff5f6;
}

.rollover-modal-backdrop {
    position: fixed;
    inset: 0;
    z-index: 4000;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    background: rgba(12, 22, 40, 0.3);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
}

.rollover-modal-backdrop.is-open {
    display: flex;
}

.rollover-modal {
    width: min(96vw, 1520px);
    max-height: calc(100vh - 2rem);
    border: 1px solid #cddbec;
    border-radius: 0.9rem;
    background: #ffffff;
    box-shadow: 0 20px 42px rgba(11, 25, 53, 0.24);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.rollover-modal-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.8rem 1rem;
    border-bottom: 1px solid #d9e4f2;
    background: #f8fbff;
}

.rollover-modal-meta {
    font-size: 0.8rem;
    color: #61708a;
}

.rollover-modal-close {
    min-width: 84px;
}

.rollover-modal-body {
    padding: 0.9rem 1rem 1rem;
    overflow: auto;
}

.rollover-bulk-controls {
    border: 1px solid #d8e3f1;
    border-radius: 0.72rem;
    background: #fbfdff;
    padding: 0.7rem 0.76rem;
}

.rollover-grade-checklist {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 0.46rem;
}

.rollover-grade-option {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.6rem;
    border: 1px solid #cedced;
    border-radius: 0.62rem;
    background: #ffffff;
    padding: 0.42rem 0.5rem;
}

.rollover-grade-option-left {
    display: inline-flex;
    align-items: center;
    gap: 0.46rem;
    min-width: 0;
}

.rollover-grade-name {
    font-size: 0.82rem;
    font-weight: 700;
    color: #233d71;
}

.rollover-grade-count {
    display: inline-flex;
    align-items: center;
    border-radius: 999px;
    background: #eef4fb;
    color: #486084;
    font-size: 0.72rem;
    font-weight: 700;
    padding: 0.14rem 0.4rem;
    white-space: nowrap;
}

.rollover-table-wrap {
    max-height: 56vh;
    border: 1px solid #d9e4f2;
    border-radius: 0.68rem;
}

.rollover-table thead th {
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #5f6f87;
    background: #f7fbff;
    position: sticky;
    top: 0;
    z-index: 2;
}

.rollover-table td {
    vertical-align: top;
    padding-top: 0.36rem;
    padding-bottom: 0.36rem;
}

.rollover-table .form-select-sm {
    min-width: 11rem;
}

.rollover-row-ready {
    background: #f2fbf7;
}

.rollover-row-blocked {
    background: #fff7f8;
}

.rollover-row-skipped,
.rollover-row-skipped-manual {
    opacity: 0.66;
    background: #f2f4f8;
}

.rollover-issues {
    margin: 0;
    padding-left: 1rem;
    font-size: 0.75rem;
    color: #8a1f2c;
}

body.rollover-modal-open {
    overflow: hidden;
}

body.rollover-modal-open .app-header,
body.rollover-modal-open .app-footer {
    visibility: hidden;
    pointer-events: none;
}

body.theme-dark .rollover-modal {
    background: #14213a;
    border-color: #2f4468;
}

body.theme-dark .rollover-modal-head {
    background: #182845;
    border-bottom-color: #2f4468;
}

body.theme-dark .rollover-modal-meta,
body.theme-dark .rollover-grade-name,
body.theme-dark .rollover-grade-count {
    color: #bfd1ee;
}

body.theme-dark .rollover-bulk-controls,
body.theme-dark .rollover-grade-option,
body.theme-dark .rollover-table-wrap {
    background: #162640;
    border-color: #314b6d;
}

@media (max-width: 1399px) {
    .rollover-grade-checklist {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

@media (max-width: 1199px) {
    .rollover-metrics {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .rollover-summary-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .rollover-grade-checklist {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .rollover-modal {
        width: min(98vw, 1360px);
    }
}

@media (max-width: 575px) {
    .rollover-metrics {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .rollover-summary-grid {
        grid-template-columns: 1fr;
    }

    .rollover-grade-checklist {
        grid-template-columns: 1fr;
    }

    .rollover-modal-head {
        padding: 0.66rem 0.72rem;
    }

    .rollover-modal-body {
        padding: 0.72rem;
    }
}

.dashboard-shell {
    display: block;
}

.dashboard-filters {
    border-left: 4px solid var(--brand-secondary);
    background: linear-gradient(140deg, #ffffff 0%, #f4f9ff 100%);
}

.dashboard-filters .form-label {
    font-weight: 600;
    font-size: 0.82rem;
    color: #36435f;
    margin-bottom: 0.25rem;
}

.dashboard-filter-actions {
    display: flex;
    gap: 0.5rem;
    flex-wrap: nowrap;
    justify-content: flex-end;
}

.dashboard-filter-actions .btn {
    white-space: nowrap;
}

.dashboard-filter-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.9rem;
    flex-wrap: wrap;
}

.dashboard-auto-refresh {
    margin-bottom: 0;
}

.dashboard-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
}

.dashboard-kpi-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 0.75rem;
}

.dashboard-kpi-card {
    border: 1px solid #d8e3f1;
    border-radius: 0.75rem;
    padding: 0.8rem 0.9rem;
    background: #fff;
    box-shadow: 0 1px 2px rgba(17, 38, 78, 0.05);
}

.dashboard-kpi-label {
    font-size: 0.76rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #5f6f87;
    margin-bottom: 0.24rem;
}

.dashboard-kpi-value {
    font-size: 1.55rem;
    line-height: 1.1;
    font-weight: 700;
    color: #1f2f63;
}

.dashboard-chart-card {
    border: 1px solid #d8e3f1;
    box-shadow: 0 1px 2px rgba(17, 38, 78, 0.05);
}

.dashboard-chart-card .card-header {
    font-size: 0.86rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    color: #344565;
    background: #f7fbff;
}

.chart-panel {
    position: relative;
    height: 300px;
}

.chart-panel-sm {
    height: 220px;
}

.dashboard-latest-table th,
.dashboard-latest-table td {
    white-space: nowrap;
}

@media (max-width: 1400px) {
    .dashboard-kpi-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 767px) {
    .dashboard-kpi-grid {
        grid-template-columns: 1fr;
    }

    .dashboard-filter-toolbar {
        flex-direction: column-reverse;
        align-items: stretch;
    }

    .dashboard-filter-actions {
        justify-content: stretch;
        flex-wrap: wrap;
    }

    .dashboard-filter-actions .btn {
        flex: 1 1 9.5rem;
    }

    .dashboard-meta {
        flex-direction: column;
        align-items: flex-start;
    }

    .chart-panel {
        height: 260px;
    }

    .chart-panel-sm {
        height: 240px;
    }
}

.dashboard-live-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.42rem;
    padding: 0.28rem 0.62rem;
    border-radius: 999px;
    border: 1px solid #d6dfeb;
    background: #ffffff;
    color: #334155;
    font-size: 0.78rem;
    font-weight: 700;
    line-height: 1;
}

.dashboard-live-dot {
    width: 0.56rem;
    height: 0.56rem;
    border-radius: 50%;
    background: #94a3b8;
}

.dashboard-live-badge.is-live {
    color: #991b1b;
    border-color: #fecaca;
    background: #fff5f5;
}

.dashboard-live-badge.is-live .dashboard-live-dot {
    background: #dc2626;
    animation: dashboard-live-blink 1.2s infinite;
}

.dashboard-live-badge.is-pending {
    color: #92400e;
    border-color: #fcd34d;
    background: #fffbeb;
}

.dashboard-live-badge.is-pending .dashboard-live-dot {
    background: #f59e0b;
}

.dashboard-live-badge.is-manual {
    color: #475569;
    border-color: #cbd5e1;
    background: #f8fafc;
}

.dashboard-live-badge.is-manual .dashboard-live-dot {
    background: #64748b;
}

.dashboard-live-badge.is-error {
    color: #991b1b;
    border-color: #fecaca;
    background: #fff5f5;
}

.dashboard-live-badge.is-error .dashboard-live-dot {
    background: #dc2626;
}

/* Fallback confirm UI when Bootstrap JS modal is unavailable (e.g. blocked CDN). */
.app-confirm-fallback {
    position: fixed;
    inset: 0;
    z-index: 4700;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    background: rgba(12, 24, 44, 0.45);
}

.app-confirm-fallback.is-open {
    display: flex;
}

.app-confirm-fallback-dialog {
    width: min(94vw, 360px);
    border-radius: 0.75rem;
    border: 1px solid #d7e3f1;
    background: #fff;
    box-shadow: 0 20px 42px rgba(16, 30, 58, 0.22);
    overflow: hidden;
}

.app-confirm-fallback-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    padding: 0.7rem 0.85rem;
    border-bottom: 1px solid #e4edf8;
}

.app-confirm-fallback-title {
    margin: 0;
    font-size: 0.95rem;
    font-weight: 700;
    color: #2f3f63;
}

.app-confirm-fallback-close {
    width: 1.9rem;
    height: 1.9rem;
    border: 0;
    border-radius: 0.5rem;
    background: transparent;
    color: #5a6a84;
    font-size: 1.3rem;
    line-height: 1;
}

.app-confirm-fallback-close:hover,
.app-confirm-fallback-close:focus-visible {
    background: #eef4fc;
    color: #30476c;
    outline: none;
}

.app-confirm-fallback-body {
    padding: 0.9rem 0.85rem 0.8rem;
}

.app-confirm-fallback-message {
    margin: 0;
    color: #4b5c79;
    font-size: 0.9rem;
    line-height: 1.35;
}

.app-confirm-fallback-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
    padding: 0.75rem 0.85rem 0.85rem;
    border-top: 1px solid #eef4fc;
}

@keyframes dashboard-live-blink {
    0% {
        opacity: 1;
        box-shadow: 0 0 0 0 rgba(220, 38, 38, 0.42);
    }

    70% {
        opacity: 0.48;
        box-shadow: 0 0 0 7px rgba(220, 38, 38, 0);
    }

    100% {
        opacity: 1;
        box-shadow: 0 0 0 0 rgba(220, 38, 38, 0);
    }
}

.builder-tool-card {
    border: 1px solid #d7e3f1;
    box-shadow: 0 1px 2px rgba(18, 34, 66, 0.06);
}

.builder-tool-card .card-header {
    font-size: 0.84rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    color: #2f3f63;
    background: #f8fbff;
}

.builder-settings-form .form-check-label {
    font-size: 0.82rem;
    line-height: 1.25;
}

.builder-settings-form .form-label {
    margin-bottom: 0.22rem;
    font-size: 0.8rem;
    font-weight: 700;
    line-height: 1.2;
}

.builder-settings-form .form-control,
.builder-settings-form .form-select {
    font-size: 0.9rem;
    line-height: 1.2;
    min-height: 2.15rem;
    padding-top: 0.36rem;
    padding-bottom: 0.36rem;
}

.builder-settings-form .form-select {
    padding-right: 1.9rem;
}

.builder-settings-form .builder-tool-actions .btn {
    font-size: 0.84rem;
    padding: 0.34rem 0.62rem;
}

.builder-meta-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.5rem;
}

.builder-meta-item {
    border: 1px solid #d7e3f1;
    border-radius: 0.55rem;
    padding: 0.45rem 0.55rem;
    background: #fbfdff;
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
}

.builder-meta-item span {
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #61708a;
}

.builder-meta-item strong {
    font-size: 0.86rem;
    color: #1d2f57;
}

.builder-tool-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.manual-learner-list {
    max-height: 14.2rem;
    overflow-y: auto;
    border: 1px solid #cddbeb;
    border-radius: 0.55rem;
    background: #fff;
    padding: 0.28rem;
}

.manual-learner-option {
    border: 1px solid transparent;
    border-radius: 0.5rem;
    padding: 0.34rem 0.42rem;
    display: grid;
    grid-template-columns: auto 1fr;
    align-items: start;
    gap: 0.5rem;
    cursor: pointer;
}

.manual-learner-option + .manual-learner-option {
    margin-top: 0.2rem;
}

.manual-learner-option:hover {
    background: #f5f9ff;
    border-color: #d9e6f5;
}

.manual-learner-checkbox {
    margin-top: 0.16rem;
}

.manual-learner-copy {
    display: flex;
    flex-direction: column;
    gap: 0.12rem;
    min-width: 0;
}

.manual-learner-name {
    font-size: 0.8rem;
    font-weight: 700;
    color: #233553;
    line-height: 1.2;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.manual-learner-meta {
    font-size: 0.72rem;
    color: #607089;
    line-height: 1.2;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.manual-picker-modal .manual-learner-list {
    max-height: 20rem;
}

.builder-grade-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.45rem;
}

.builder-grade-choice {
    border: 1px solid #cddbeb;
    border-radius: 0.55rem;
    padding: 0.46rem 0.56rem;
    background: #fff;
    display: flex;
    flex-direction: column;
    gap: 0.16rem;
    cursor: pointer;
}

.builder-grade-choice input {
    margin-bottom: 0.12rem;
}

.builder-grade-choice.is-disabled {
    background: #f8fafc;
    color: #94a3b8;
    border-color: #e2e8f0;
    cursor: not-allowed;
}

.builder-grade-name {
    font-size: 0.8rem;
    font-weight: 700;
    color: #243653;
}

.builder-grade-count {
    font-size: 0.72rem;
    color: #5f6f87;
}

.builder-lines-table {
    --builder-lines-visible-rows: 12;
    --builder-lines-row-height: 31px;
    --builder-lines-header-height: 33px;
    max-height: calc((var(--builder-lines-visible-rows) * var(--builder-lines-row-height)) + var(--builder-lines-header-height));
    overflow-y: auto;
    overflow-x: auto;
    border-top: 1px solid #c9d9ec;
    border-bottom: 1px solid #c9d9ec;
}

.builder-lines-grid {
    margin-bottom: 0;
    width: 100%;
    table-layout: fixed;
    border-collapse: collapse;
    font-size: 0.79rem;
}

.builder-lines-grid col.bcol-no { width: 6%; }
.builder-lines-grid col.bcol-name { width: 35%; }
.builder-lines-grid col.bcol-name.no-action { width: 44%; }
.builder-lines-grid col.bcol-pin { width: 24%; }
.builder-lines-grid col.bcol-grade { width: 8%; }
.builder-lines-grid col.bcol-amount { width: 13%; }
.builder-lines-grid col.bcol-amount.no-action { width: 18%; }
.builder-lines-grid col.bcol-action { width: 14%; }

.builder-lines-grid th,
.builder-lines-grid td {
    border: 1px solid #cfdced;
    padding: 0.28rem 0.36rem;
    vertical-align: middle;
    line-height: 1.15;
    background: #fff;
}

.builder-lines-grid thead tr {
    height: var(--builder-lines-header-height);
}

.builder-lines-grid tbody tr {
    height: var(--builder-lines-row-height);
}

.builder-lines-grid thead th {
    height: var(--builder-lines-header-height);
}

.builder-lines-grid tbody td {
    height: var(--builder-lines-row-height);
}

.builder-lines-grid thead th {
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: #4f6078;
    background: #f4f8fd;
    position: sticky;
    top: 0;
    z-index: 1;
}

.builder-lines-grid .cell-no,
.builder-lines-grid .cell-grade,
.builder-lines-grid .cell-action {
    text-align: center;
    white-space: nowrap;
}

.builder-lines-grid .cell-name {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-weight: 600;
}

.builder-lines-grid .cell-pin {
    font-family: Consolas, "Courier New", monospace;
    font-size: 0.76rem;
    white-space: nowrap;
    letter-spacing: 0.01em;
}

.builder-lines-grid .cell-amount {
    text-align: right;
    white-space: nowrap;
    font-weight: 600;
}

.builder-lines-grid tbody tr:nth-child(even) td {
    background: #fbfdff;
}

.builder-lines-grid tbody tr:hover td {
    background: #f2f7ff;
}

.builder-remove-btn {
    padding: 0.14rem 0.4rem;
    font-size: 0.69rem;
    line-height: 1.1;
    border-radius: 0.32rem;
}

@media (max-width: 1199px) {
    .builder-meta-grid,
    .builder-grade-grid {
        grid-template-columns: 1fr;
    }

    .builder-lines-table {
        --builder-lines-visible-rows: 12;
    }

    .builder-lines-grid {
        font-size: 0.8rem;
    }

    .builder-lines-grid .cell-pin {
        font-size: 0.76rem;
    }
}

.builder-preview-toolbar {
    align-items: center;
    gap: 0.45rem;
}

.builder-preview-toolbar .btn {
    padding: 0.26rem 0.62rem;
    font-size: 0.78rem;
    font-weight: 600;
    border-radius: 0.38rem;
    line-height: 1.2;
}

.builder-print-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.42rem 0.92rem !important;
    border-radius: 0.54rem !important;
    border: 1px solid #2f5ea7 !important;
    background: linear-gradient(140deg, #3f4f8f 0%, #2f67ac 100%);
    color: #fff !important;
    font-size: 0.86rem !important;
    font-weight: 700 !important;
    letter-spacing: 0.01em;
    box-shadow: 0 6px 14px rgba(37, 68, 119, 0.2);
}

.builder-print-btn:hover,
.builder-print-btn:focus {
    background: linear-gradient(140deg, #34417c 0%, #285793 100%);
    color: #fff !important;
    border-color: #285793 !important;
    box-shadow: 0 8px 16px rgba(30, 55, 98, 0.24);
}

.builder-print-btn:focus-visible {
    outline: 2px solid rgba(0, 144, 208, 0.46);
    outline-offset: 2px;
}

.builder-print-btn .bi {
    font-size: 0.92rem;
    line-height: 1;
}

@media (max-width: 767px) {
    .builder-print-btn {
        width: 100%;
        justify-content: center;
    }
}

.builder-bottom-grid {
    align-items: stretch;
    flex: 1 1 auto;
    min-height: 0;
    margin-bottom: 0;
}

.builder-bottom-grid > [class*="col-"] {
    display: flex;
    flex-direction: column;
}

.builder-lines-card {
    flex: 1 1 auto;
    min-height: 0;
    display: flex;
    flex-direction: column;
}

.builder-lines-card .card-body {
    flex: 1 1 auto;
    min-height: 0;
    display: flex;
    flex-direction: column;
}

.builder-lines-card .builder-lines-table {
    flex: 1 1 auto;
    min-height: 0;
    max-height: calc((var(--builder-lines-visible-rows) * var(--builder-lines-row-height)) + var(--builder-lines-header-height));
}

.builder-inline-form {
    margin: 0;
    display: inline-flex;
}

.builder-preview-toolbar .badge {
    font-size: 0.74rem;
}

.builder-bottom-grid .card {
    border: 1px solid #d7e3f1;
}

/* Claims and Rates Redesign */
.claims-shell,
.rates-shell {
    display: block;
}

.claims-hero,
.rates-hero {
    border-left: 4px solid var(--brand-secondary);
    background: linear-gradient(145deg, #ffffff 0%, #f3f8ff 100%);
}

.claims-hero-head,
.rates-hero-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 0.85rem;
    flex-wrap: wrap;
}

.claims-hero-actions,
.rates-hero-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.claims-kpi-grid,
.rates-kpi-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 0.75rem;
}

.claims-kpi-card,
.rates-kpi-card {
    border: 1px solid #d8e3f1;
    border-radius: 0.75rem;
    background: #fff;
    padding: 0.82rem 0.9rem;
    box-shadow: 0 1px 2px rgba(18, 34, 66, 0.05);
}

.claims-kpi-label,
.rates-kpi-label {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #62728c;
    margin-bottom: 0.22rem;
}

.claims-kpi-value,
.rates-kpi-value {
    font-size: 1.38rem;
    line-height: 1.1;
    font-weight: 700;
    color: #1f2f63;
}

.claims-flow {
    display: flex;
    flex-wrap: wrap;
    gap: 0.48rem;
}

.claims-flow-step {
    display: inline-flex;
    align-items: center;
    border: 1px solid #c7d8ec;
    border-radius: 999px;
    background: #ffffff;
    color: #2c3d5b;
    font-size: 0.77rem;
    font-weight: 700;
    padding: 0.26rem 0.62rem;
    line-height: 1;
}

.claims-panel,
.rates-panel,
.claims-table-card,
.rates-table-card {
    border: 1px solid #d7e3f1;
    box-shadow: 0 1px 2px rgba(18, 34, 66, 0.06);
}

.claims-filter-form .form-label,
.rates-grade-label {
    font-weight: 700;
    font-size: 0.82rem;
    color: #33435f;
}

.claims-empty-period {
    border: 1px dashed #c7d8ec;
    border-radius: 0.65rem;
    background: #f9fbff;
    padding: 0.75rem;
}

.claims-table-card .table-responsive {
    max-height: 67vh;
}

.claims-table thead th {
    font-size: 0.74rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #5f6f87;
    border-bottom: 1px solid #d6e3f1;
    background: #f7fbff;
    position: sticky;
    top: 0;
    z-index: 2;
}

.claims-table tbody td {
    border-color: #e0e9f4;
}

.claims-table tbody tr:hover {
    background: #f5f9ff;
}

.claims-status {
    display: inline-flex;
    align-items: center;
    border-radius: 999px;
    padding: 0.2rem 0.6rem;
    font-size: 0.74rem;
    font-weight: 700;
    letter-spacing: 0.02em;
}

.claims-status.is-draft {
    background: #fff5dc;
    color: #8a5a00;
    border: 1px solid #f6db9e;
}

.claims-status.is-submitted {
    background: #e8f7ef;
    color: #1f6d45;
    border: 1px solid #bde6cf;
}

.claims-action-stack {
    display: flex;
    flex-wrap: wrap;
    gap: 0.3rem;
}

.claims-action-stack .btn {
    font-size: 0.71rem;
    padding: 0.2rem 0.42rem;
    line-height: 1.2;
}

.rates-meta-line {
    font-size: 0.85rem;
    color: #44546f;
}

.rates-form {
    margin: 0;
}

.rates-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.75rem;
}

.rates-grade-card {
    border: 1px solid #d7e3f1;
    border-radius: 0.72rem;
    background: #fbfdff;
    padding: 0.65rem;
}

.rates-input {
    text-align: right;
    font-weight: 700;
}

.rates-grade-help {
    margin-top: 0.36rem;
    font-size: 0.74rem;
    color: #64748b;
}

.rates-table-card .table-responsive {
    max-height: 360px;
}

.rates-table thead th {
    font-size: 0.74rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #5f6f87;
    border-bottom: 1px solid #d6e3f1;
    background: #f7fbff;
    position: sticky;
    top: 0;
    z-index: 2;
}

.rates-table tbody tr:hover {
    background: #f5f9ff;
}

@media (max-width: 1399px) {
    .claims-kpi-grid,
    .rates-kpi-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .rates-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 767px) {
    .claims-kpi-grid,
    .rates-kpi-grid,
    .rates-grid {
        grid-template-columns: 1fr;
    }

    .claims-hero-actions,
    .rates-hero-actions {
        width: 100%;
    }

    .claims-hero-actions .btn,
    .rates-hero-actions .btn {
        flex: 1 1 100%;
    }

    .claims-table-card .table-responsive,
    .rates-table-card .table-responsive {
        max-height: none;
    }
}

/* Periods and Archive Redesign */
.periods-shell,
.archive-shell {
    display: block;
}

.periods-hero,
.archive-hero {
    border-left: 4px solid var(--brand-secondary);
    background: linear-gradient(145deg, #ffffff 0%, #f3f8ff 100%);
}

.periods-hero-head,
.archive-hero-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 0.85rem;
    flex-wrap: wrap;
}

.periods-hero-actions,
.archive-hero-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.periods-kpi-grid,
.archive-kpi-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 0.75rem;
}

.periods-kpi-card,
.archive-kpi-card {
    border: 1px solid #d8e3f1;
    border-radius: 0.75rem;
    background: #fff;
    padding: 0.82rem 0.9rem;
    box-shadow: 0 1px 2px rgba(18, 34, 66, 0.05);
}

.periods-kpi-label,
.archive-kpi-label {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #62728c;
    margin-bottom: 0.22rem;
}

.periods-kpi-value,
.archive-kpi-value {
    font-size: 1.38rem;
    line-height: 1.1;
    font-weight: 700;
    color: #1f2f63;
}

.periods-flow {
    display: flex;
    flex-wrap: wrap;
    gap: 0.48rem;
}

.periods-flow-step,
.archive-flow-step {
    display: inline-flex;
    align-items: center;
    border: 1px solid #c7d8ec;
    border-radius: 999px;
    background: #ffffff;
    color: #2c3d5b;
    font-size: 0.77rem;
    font-weight: 700;
    padding: 0.26rem 0.62rem;
    line-height: 1;
}

.archive-flow-step {
    border-radius: 0.6rem;
    width: 100%;
    margin-bottom: 0.42rem;
    font-weight: 600;
}

.periods-panel,
.archive-panel,
.archive-table-card {
    border: 1px solid #d7e3f1;
    box-shadow: 0 1px 2px rgba(18, 34, 66, 0.06);
}

.periods-table thead th,
.archive-table thead th {
    font-size: 0.74rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #5f6f87;
    border-bottom: 1px solid #d6e3f1;
    background: #f7fbff;
    position: sticky;
    top: 0;
    z-index: 2;
}

.periods-table tbody tr:hover,
.archive-table tbody tr:hover {
    background: #f5f9ff;
}

.periods-panel .table-responsive {
    max-height: 67vh;
}

.archive-table-card .table-responsive {
    max-height: 68vh;
}

.period-status {
    display: inline-flex;
    align-items: center;
    border-radius: 999px;
    padding: 0.2rem 0.58rem;
    font-size: 0.74rem;
    font-weight: 700;
    letter-spacing: 0.02em;
}

.period-status.is-open {
    background: #e8f7ef;
    color: #1f6d45;
    border: 1px solid #bde6cf;
}

.period-status.is-closed {
    background: #f1f3f7;
    color: #59657a;
    border: 1px solid #d5dbe5;
}

.period-links,
.archive-action-stack {
    display: flex;
    flex-wrap: wrap;
    gap: 0.3rem;
}

.period-links .btn,
.archive-action-stack .btn {
    font-size: 0.71rem;
    padding: 0.2rem 0.42rem;
    line-height: 1.2;
}

.periods-help {
    border: 1px dashed #c7d8ec;
    border-radius: 0.65rem;
    background: #f9fbff;
    padding: 0.65rem;
}

.archive-filter-form .form-label {
    font-weight: 700;
    font-size: 0.82rem;
    color: #33435f;
}

@media (max-width: 1399px) {
    .periods-kpi-grid,
    .archive-kpi-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 767px) {
    .periods-kpi-grid,
    .archive-kpi-grid {
        grid-template-columns: 1fr;
    }

    .periods-hero-actions,
    .archive-hero-actions {
        width: 100%;
    }

    .periods-hero-actions .btn,
    .archive-hero-actions .btn {
        flex: 1 1 100%;
    }

    .periods-panel .table-responsive,
    .archive-table-card .table-responsive {
        max-height: none;
    }
}

/* Users and Settings Redesign */
.users-shell,
.settings-shell {
    display: block;
}

.users-hero,
.settings-hero {
    border-left: 4px solid var(--brand-secondary);
    background: linear-gradient(145deg, #ffffff 0%, #f3f8ff 100%);
}

.users-hero-head,
.settings-hero-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 0.85rem;
    flex-wrap: wrap;
}

.users-hero-actions,
.settings-hero-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.users-kpi-grid,
.settings-kpi-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 0.75rem;
}

.users-kpi-card,
.settings-kpi-card {
    border: 1px solid #d8e3f1;
    border-radius: 0.75rem;
    background: #fff;
    padding: 0.82rem 0.9rem;
    box-shadow: 0 1px 2px rgba(18, 34, 66, 0.05);
}

.users-kpi-label,
.settings-kpi-label {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #62728c;
    margin-bottom: 0.22rem;
}

.users-kpi-value,
.settings-kpi-value {
    font-size: 1.38rem;
    line-height: 1.1;
    font-weight: 700;
    color: #1f2f63;
}

.users-role-strip {
    display: flex;
    flex-wrap: wrap;
    gap: 0.45rem;
}

.users-role-chip {
    display: inline-flex;
    align-items: center;
    border: 1px solid #c7d8ec;
    border-radius: 999px;
    background: #ffffff;
    color: #2c3d5b;
    font-size: 0.77rem;
    font-weight: 700;
    padding: 0.26rem 0.62rem;
    line-height: 1;
}

.users-panel,
.users-table-card,
.settings-panel {
    border: 1px solid #d7e3f1;
    box-shadow: 0 1px 2px rgba(18, 34, 66, 0.06);
}

.users-form .form-label,
.settings-form .form-label {
    font-weight: 700;
    font-size: 0.82rem;
    color: #33435f;
}

.users-help,
.settings-help {
    border: 1px dashed #c7d8ec;
    border-radius: 0.65rem;
    background: #f9fbff;
    padding: 0.65rem;
}

.users-table-card .table-responsive {
    max-height: 68vh;
}

.users-table thead th {
    font-size: 0.74rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #5f6f87;
    border-bottom: 1px solid #d6e3f1;
    background: #f7fbff;
    position: sticky;
    top: 0;
    z-index: 2;
}

.users-table tbody tr:hover {
    background: #f5f9ff;
}

.user-role-pill,
.user-status-pill,
.user-flag-pill {
    display: inline-flex;
    align-items: center;
    border-radius: 999px;
    padding: 0.2rem 0.58rem;
    font-size: 0.74rem;
    font-weight: 700;
    letter-spacing: 0.02em;
}

.user-role-pill.is-admin {
    background: #eef2ff;
    color: #3346a8;
    border: 1px solid #ccd6ff;
}

.user-role-pill.is-clerk {
    background: #e6f5ff;
    color: #0d5f8f;
    border: 1px solid #b8e1f7;
}

.user-role-pill.is-head {
    background: #fff4e8;
    color: #8a4b00;
    border: 1px solid #f6d3aa;
}

.user-status-pill.is-active {
    background: #e8f7ef;
    color: #1f6d45;
    border: 1px solid #bde6cf;
}

.user-status-pill.is-inactive {
    background: #f1f3f7;
    color: #59657a;
    border: 1px solid #d5dbe5;
}

.user-flag-pill.is-warning {
    background: #fff5dc;
    color: #8a5a00;
    border: 1px solid #f6db9e;
}

.user-flag-pill.is-normal {
    background: #ecfdf5;
    color: #166534;
    border: 1px solid #bbf7d0;
}

.users-edit-details summary {
    list-style: none;
}

.users-edit-details summary::-webkit-details-marker {
    display: none;
}

.users-edit-panel {
    background: #f9fbff;
    border: 1px solid #dbe6f3;
    border-radius: 0.65rem;
    padding: 0.65rem;
}

.settings-snapshot-item {
    display: flex;
    justify-content: space-between;
    gap: 0.5rem;
    border: 1px solid #d7e3f1;
    border-radius: 0.55rem;
    padding: 0.48rem 0.58rem;
    background: #fbfdff;
    margin-bottom: 0.45rem;
}

.settings-snapshot-item span {
    color: #61708a;
    font-size: 0.78rem;
}

.settings-snapshot-item strong {
    color: #1d2f57;
    font-size: 0.82rem;
}

@media (max-width: 1399px) {
    .users-kpi-grid,
    .settings-kpi-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 767px) {
    .users-kpi-grid,
    .settings-kpi-grid {
        grid-template-columns: 1fr;
    }

    .users-hero-actions,
    .settings-hero-actions {
        width: 100%;
    }

    .users-hero-actions .btn,
    .settings-hero-actions .btn {
        flex: 1 1 100%;
    }

    .users-table-card .table-responsive {
        max-height: none;
    }
}

/* Theme and Density */
body.density-compact .table > :not(caption) > * > * {
    padding: 0.3rem 0.45rem;
}

body.density-compact .btn-sm {
    padding: 0.2rem 0.46rem;
    font-size: 0.74rem;
}

body.density-compact .form-control,
body.density-compact .form-select,
body.density-compact .input-group-text {
    padding-top: 0.3rem;
    padding-bottom: 0.3rem;
}

body.theme-dark {
    --brand-primary: #6f83d8;
    --bs-primary: #6f83d8;
    --bs-primary-rgb: 111, 131, 216;
    --brand-ink: #dbe7fb;
    --sidebar-bg: #101a31;
    --sidebar-bg-2: #0a1325;
    --header-bg: #111b30;
    --content-bg: #0d1629;
    --footer-bg: #111b30;
    color: var(--brand-ink);
    background: #0a1220;
}

body.theme-dark.auth-bg {
    background:
        radial-gradient(circle at 18% 20%, rgba(56, 135, 210, 0.22) 0%, rgba(56, 135, 210, 0) 38%),
        radial-gradient(circle at 84% 16%, rgba(84, 160, 255, 0.16) 0%, rgba(84, 160, 255, 0) 42%),
        linear-gradient(145deg, #0f1a30 0%, #0a1325 100%);
}

body.theme-dark.auth-bg::before {
    background:
        radial-gradient(circle at 14% 18%, rgba(92, 125, 209, 0.28) 0%, rgba(92, 125, 209, 0.14) 30%, rgba(92, 125, 209, 0) 58%),
        radial-gradient(circle at 84% 16%, rgba(48, 171, 231, 0.24) 0%, rgba(48, 171, 231, 0.12) 28%, rgba(48, 171, 231, 0) 56%),
        radial-gradient(circle at 72% 82%, rgba(89, 166, 241, 0.2) 0%, rgba(89, 166, 241, 0.08) 26%, rgba(89, 166, 241, 0) 54%);
    opacity: 0.7;
}

body.theme-dark.auth-bg::after {
    background: linear-gradient(180deg, rgba(8, 16, 32, 0.48) 0%, rgba(8, 16, 32, 0.3) 44%, rgba(9, 20, 38, 0.52) 100%);
}

body.theme-dark .auth-card {
    background: rgba(14, 25, 46, 0.94);
    border-color: #2f4468;
    box-shadow: 0 18px 40px rgba(3, 9, 20, 0.45);
}

body.theme-dark .auth-login-brand {
    background: linear-gradient(145deg, #14233e 0%, #101d36 100%);
    border-color: #2f4468;
}

body.theme-dark .auth-signin-brand {
    background: linear-gradient(155deg, #142540 0%, #11203a 62%, #10213b 100%);
}

body.theme-dark .auth-signin-logo-shell {
    background: #ffffff;
    border-color: rgba(186, 208, 236, 0.85);
}

body.theme-dark .auth-login-title {
    color: #dbe7fb;
}

body.theme-dark .auth-login-subtitle,
body.theme-dark .auth-login-school,
body.theme-dark .auth-login-form .form-label,
body.theme-dark .auth-footer {
    color: #9fb3d0;
}

body.theme-dark .auth-login-pill {
    background: #152946;
    border-color: #31507a;
    color: #a9bfdc;
}

body.theme-dark .auth-signin-meta-item {
    background: rgba(20, 37, 64, 0.54);
    border-color: #34537e;
}

body.theme-dark .auth-signin-meta-label {
    color: #a9bfdc;
}

body.theme-dark .auth-signin-meta-value {
    color: #e3efff;
}

body.theme-dark .auth-signin-panel {
    background: rgba(18, 35, 62, 0.95);
    border-color: #31507a;
}

body.theme-dark .auth-login-panel {
    background: #12233e;
    border-color: #2f4468;
}

body.theme-dark .auth-login-panel h4 {
    color: #dbe7fb;
}

body.theme-dark .app-header,
body.theme-dark .app-footer {
    color: #c9d8f0;
    border-color: #233754;
}

body.theme-dark .card {
    background: #14213a;
    border-color: #2a3f60;
    color: #dbe7fb;
}

body.theme-dark .card-header {
    background: #182845;
    border-bottom-color: #2a3f60;
    color: #dbe7fb;
}

body.theme-dark .text-muted,
body.theme-dark .form-text,
body.theme-dark .small.text-muted {
    color: #9bb0cf !important;
}

body.theme-dark .form-control,
body.theme-dark .form-select,
body.theme-dark .input-group-text {
    background: #0f1a31;
    border-color: #304867;
    color: #dbe7fb;
}

body.theme-dark .form-control:focus,
body.theme-dark .form-select:focus {
    border-color: #5f79d9;
    box-shadow: 0 0 0 0.2rem rgba(111, 131, 216, 0.22);
}

body.theme-dark .table {
    color: #dbe7fb;
}

body.theme-dark .table > :not(caption) > * > * {
    border-color: #314b6d;
    background-color: transparent;
}

body.theme-dark .table thead th {
    background: #162640 !important;
    color: #bfd1ee !important;
}

body.theme-dark .btn-outline-secondary {
    color: #cedcf2;
    border-color: #647b9f;
}

body.theme-dark .btn-outline-secondary:hover {
    background: #273d61;
    border-color: #7088ad;
}

body.theme-dark .btn-outline-dark {
    color: #d7e3f8;
    border-color: #8ea2c2;
}

body.theme-dark .btn-outline-dark:hover {
    background: #2a3f62;
    border-color: #a0b4d3;
}

body.theme-dark .alert {
    background: #162845;
    border-color: #30507a;
    color: #dbe7fb;
}

body.theme-dark .sidebar-logo-shell {
    background: #ffffff;
    border-color: rgba(184, 208, 239, 0.84);
}
body.theme-dark .sidebar-logo {
    background: transparent;
}

@media (prefers-color-scheme: dark) {
    body.theme-system {
        --brand-primary: #6f83d8;
        --bs-primary: #6f83d8;
        --bs-primary-rgb: 111, 131, 216;
        --brand-ink: #dbe7fb;
        --sidebar-bg: #101a31;
        --sidebar-bg-2: #0a1325;
        --header-bg: #111b30;
        --content-bg: #0d1629;
        --footer-bg: #111b30;
        color: var(--brand-ink);
        background: #0a1220;
    }

    body.theme-system.auth-bg {
        background:
            radial-gradient(circle at 18% 20%, rgba(56, 135, 210, 0.22) 0%, rgba(56, 135, 210, 0) 38%),
            radial-gradient(circle at 84% 16%, rgba(84, 160, 255, 0.16) 0%, rgba(84, 160, 255, 0) 42%),
            linear-gradient(145deg, #0f1a30 0%, #0a1325 100%);
    }

    body.theme-system.auth-bg::before {
        background:
            radial-gradient(circle at 14% 18%, rgba(92, 125, 209, 0.28) 0%, rgba(92, 125, 209, 0.14) 30%, rgba(92, 125, 209, 0) 58%),
            radial-gradient(circle at 84% 16%, rgba(48, 171, 231, 0.24) 0%, rgba(48, 171, 231, 0.12) 28%, rgba(48, 171, 231, 0) 56%),
            radial-gradient(circle at 72% 82%, rgba(89, 166, 241, 0.2) 0%, rgba(89, 166, 241, 0.08) 26%, rgba(89, 166, 241, 0) 54%);
        opacity: 0.7;
    }

    body.theme-system.auth-bg::after {
        background: linear-gradient(180deg, rgba(8, 16, 32, 0.48) 0%, rgba(8, 16, 32, 0.3) 44%, rgba(9, 20, 38, 0.52) 100%);
    }

    body.theme-system .auth-card {
        background: rgba(14, 25, 46, 0.94);
        border-color: #2f4468;
        box-shadow: 0 18px 40px rgba(3, 9, 20, 0.45);
    }

    body.theme-system .auth-login-brand {
        background: linear-gradient(145deg, #14233e 0%, #101d36 100%);
        border-color: #2f4468;
    }

    body.theme-system .auth-signin-brand {
        background: linear-gradient(155deg, #142540 0%, #11203a 62%, #10213b 100%);
    }

    body.theme-system .auth-signin-logo-shell {
        background: #ffffff;
        border-color: rgba(186, 208, 236, 0.85);
    }

    body.theme-system .auth-login-title {
        color: #dbe7fb;
    }

    body.theme-system .auth-login-subtitle,
    body.theme-system .auth-login-school,
    body.theme-system .auth-login-form .form-label,
    body.theme-system .auth-footer {
        color: #9fb3d0;
    }

    body.theme-system .auth-login-pill {
        background: #152946;
        border-color: #31507a;
        color: #a9bfdc;
    }

    body.theme-system .auth-signin-meta-item {
        background: rgba(20, 37, 64, 0.54);
        border-color: #34537e;
    }

    body.theme-system .auth-signin-meta-label {
        color: #a9bfdc;
    }

    body.theme-system .auth-signin-meta-value {
        color: #e3efff;
    }

    body.theme-system .auth-signin-panel {
        background: rgba(18, 35, 62, 0.95);
        border-color: #31507a;
    }

    body.theme-system .auth-login-panel {
        background: #12233e;
        border-color: #2f4468;
    }

    body.theme-system .auth-login-panel h4 {
        color: #dbe7fb;
    }

    body.theme-system .app-header,
    body.theme-system .app-footer {
        color: #c9d8f0;
        border-color: #233754;
    }

    body.theme-system .card {
        background: #14213a;
        border-color: #2a3f60;
        color: #dbe7fb;
    }

    body.theme-system .card-header {
        background: #182845;
        border-bottom-color: #2a3f60;
        color: #dbe7fb;
    }

    body.theme-system .text-muted,
    body.theme-system .form-text,
    body.theme-system .small.text-muted {
        color: #9bb0cf !important;
    }

    body.theme-system .form-control,
    body.theme-system .form-select,
    body.theme-system .input-group-text {
        background: #0f1a31;
        border-color: #304867;
        color: #dbe7fb;
    }

    body.theme-system .form-control:focus,
    body.theme-system .form-select:focus {
        border-color: #5f79d9;
        box-shadow: 0 0 0 0.2rem rgba(111, 131, 216, 0.22);
    }

    body.theme-system .table {
        color: #dbe7fb;
    }

    body.theme-system .table > :not(caption) > * > * {
        border-color: #314b6d;
        background-color: transparent;
    }

    body.theme-system .table thead th {
        background: #162640 !important;
        color: #bfd1ee !important;
    }

    body.theme-system .btn-outline-secondary {
        color: #cedcf2;
        border-color: #647b9f;
    }

    body.theme-system .btn-outline-secondary:hover {
        background: #273d61;
        border-color: #7088ad;
    }

    body.theme-system .btn-outline-dark {
        color: #d7e3f8;
        border-color: #8ea2c2;
    }

    body.theme-system .btn-outline-dark:hover {
        background: #2a3f62;
        border-color: #a0b4d3;
    }

    body.theme-system .alert {
        background: #162845;
        border-color: #30507a;
        color: #dbe7fb;
    }

    body.theme-system .sidebar-logo-shell {
        background: #ffffff;
        border-color: rgba(184, 208, 239, 0.84);
    }
    body.theme-system .sidebar-logo {
        background: transparent;
    }
}

/* Header Glass Theme */
body.theme-dark .app-header-glass {
    background: rgba(12, 22, 39, 0.72);
    border-bottom-color: rgba(71, 106, 153, 0.48);
    box-shadow: 0 8px 20px rgba(3, 9, 20, 0.42);
}

body.theme-dark .header-page-title,
body.theme-dark .header-clock-value {
    color: #dbe7fb;
}

body.theme-dark .header-school-line,
body.theme-dark .header-clock-label {
    color: #9fb3d0;
}

body.theme-dark .header-school-label {
    color: #a9bddb;
}

body.theme-dark .header-school-sep {
    color: #90a7cb;
}

body.theme-dark .header-school-glow {
    color: #7ec7ff;
    text-shadow: 0 0 8px rgba(126, 199, 255, 0.48), 0 0 16px rgba(111, 131, 216, 0.36);
}

body.theme-dark .header-live-clock {
    border-color: rgba(116, 152, 199, 0.48);
    background: rgba(17, 31, 54, 0.64);
}

@media (prefers-color-scheme: dark) {
    body.theme-system .app-header-glass {
        background: rgba(12, 22, 39, 0.72);
        border-bottom-color: rgba(71, 106, 153, 0.48);
        box-shadow: 0 8px 20px rgba(3, 9, 20, 0.42);
    }

    body.theme-system .header-page-title,
    body.theme-system .header-clock-value {
        color: #dbe7fb;
    }

    body.theme-system .header-school-line,
    body.theme-system .header-clock-label {
        color: #9fb3d0;
    }

    body.theme-system .header-school-label {
        color: #a9bddb;
    }

    body.theme-system .header-school-sep {
        color: #90a7cb;
    }

    body.theme-system .header-school-glow {
        color: #7ec7ff;
        text-shadow: 0 0 8px rgba(126, 199, 255, 0.48), 0 0 16px rgba(111, 131, 216, 0.36);
    }

    body.theme-system .header-live-clock {
        border-color: rgba(116, 152, 199, 0.48);
        background: rgba(17, 31, 54, 0.64);
    }
}

/* Flash notifications float above the workspace instead of shifting page content. */
.flash-toast-region {
    position: fixed;
    z-index: 4550;
    top: 1rem;
    right: 1rem;
    display: grid;
    width: min(30rem, calc(100vw - 2rem));
    gap: 0.65rem;
    margin: 0;
    pointer-events: none;
}

body.app-bg .flash-toast-region {
    top: calc(72px + 0.85rem);
}

.flash-toast {
    --flash-accent: #2c7a58;
    --flash-duration: 4000ms;
    position: relative;
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: start;
    gap: 0.72rem;
    min-height: 3.5rem;
    margin: 0;
    padding: 0.9rem 0.92rem 0.94rem;
    overflow: hidden;
    color: #174c38;
    border: 1px solid #b9decf;
    border-radius: 0.78rem;
    background: #f2fbf7;
    box-shadow: 0 18px 42px rgba(21, 39, 65, 0.18), 0 3px 10px rgba(21, 39, 65, 0.08);
    pointer-events: auto;
    animation: flash-toast-in 260ms cubic-bezier(0.2, 0.8, 0.2, 1) both;
}

.flash-toast.alert-danger {
    --flash-accent: #c24141;
    color: #762525;
    border-color: #edc1c1;
    background: #fff6f6;
}

.flash-toast.alert-warning {
    --flash-accent: #b7791f;
    color: #68420f;
    border-color: #ead19f;
    background: #fffaf0;
}

.flash-toast-icon {
    margin-top: 0.08rem;
    color: var(--flash-accent);
    font-size: 1.05rem;
    line-height: 1.25;
}

.flash-toast-message {
    min-width: 0;
    font-size: 0.9rem;
    font-weight: 550;
    line-height: 1.48;
}

.flash-toast-close {
    display: inline-grid;
    width: 1.65rem;
    height: 1.65rem;
    margin: -0.18rem -0.22rem 0 0;
    padding: 0;
    place-items: center;
    color: currentColor;
    border: 0;
    border-radius: 50%;
    background: transparent;
    opacity: 0.62;
    transition: opacity 150ms ease, background-color 150ms ease;
}

.flash-toast-close:hover,
.flash-toast-close:focus-visible {
    color: currentColor;
    background: rgba(15, 34, 56, 0.08);
    opacity: 1;
    outline: none;
}

.flash-toast-progress {
    position: absolute;
    right: 0;
    bottom: 0;
    left: 0;
    height: 3px;
    overflow: hidden;
    background: rgba(15, 34, 56, 0.06);
}

.flash-toast-progress::after {
    position: absolute;
    inset: 0;
    content: "";
    background: var(--flash-accent);
    transform-origin: left center;
    animation: flash-toast-countdown var(--flash-duration) linear forwards;
}

.flash-toast.is-paused .flash-toast-progress::after {
    animation-play-state: paused;
}

.flash-toast.is-leaving {
    pointer-events: none;
    animation: flash-toast-out 240ms ease-in forwards;
}

body.theme-dark .flash-toast,
body.theme-dark .flash-toast.alert-success {
    color: #c7f2dc;
    border-color: #285c49;
    background: #132d27;
}

body.theme-dark .flash-toast.alert-danger {
    color: #ffd1d1;
    border-color: #6d3338;
    background: #351d24;
}

body.theme-dark .flash-toast.alert-warning {
    color: #ffe4a8;
    border-color: #6c5224;
    background: #332916;
}

body.theme-dark .flash-toast-close:hover,
body.theme-dark .flash-toast-close:focus-visible {
    background: rgba(255, 255, 255, 0.1);
}

@keyframes flash-toast-in {
    from {
        opacity: 0;
        transform: translate3d(0, -0.7rem, 0) scale(0.985);
    }
    to {
        opacity: 1;
        transform: translate3d(0, 0, 0) scale(1);
    }
}

@keyframes flash-toast-out {
    from {
        opacity: 1;
        transform: translate3d(0, 0, 0) scale(1);
    }
    to {
        opacity: 0;
        transform: translate3d(1rem, -0.25rem, 0) scale(0.98);
    }
}

@keyframes flash-toast-countdown {
    from { transform: scaleX(1); }
    to { transform: scaleX(0); }
}

@media (prefers-color-scheme: dark) {
    body.theme-system .flash-toast,
    body.theme-system .flash-toast.alert-success {
        color: #c7f2dc;
        border-color: #285c49;
        background: #132d27;
    }

    body.theme-system .flash-toast.alert-danger {
        color: #ffd1d1;
        border-color: #6d3338;
        background: #351d24;
    }

    body.theme-system .flash-toast.alert-warning {
        color: #ffe4a8;
        border-color: #6c5224;
        background: #332916;
    }

    body.theme-system .flash-toast-close:hover,
    body.theme-system .flash-toast-close:focus-visible {
        background: rgba(255, 255, 255, 0.1);
    }
}

@media (max-width: 991.98px) {
    body.app-bg .flash-toast-region {
        top: calc(64px + 0.7rem);
    }
}

@media (max-width: 767.98px) {
    .flash-toast-region,
    body.app-bg .flash-toast-region {
        top: calc(60px + 0.62rem);
        right: 0.62rem;
        left: 0.62rem;
        width: auto;
    }

    body.auth-modern-page .flash-toast-region {
        top: 0.62rem;
    }

    .flash-toast {
        gap: 0.58rem;
        min-height: 3.25rem;
        padding: 0.78rem 0.78rem 0.84rem;
    }
}

/* Smart Import uses one viewport-bound vertical scroll area. */
body.modal-open .app-content {
    overflow: hidden;
}

.import-preview-modal .modal-dialog {
    width: calc(100vw - 2rem);
    max-width: 1500px;
    height: calc(100vh - 2rem);
    height: calc(100dvh - 2rem);
    margin: 1rem auto;
}

.import-preview-modal .modal-content {
    height: 100%;
    max-height: 100%;
    overflow: hidden;
}

.import-preview-modal .modal-header {
    align-items: center;
    flex: 0 0 auto;
    padding: 0.85rem 1rem;
}

.import-preview-modal #smartImportPreviewForm {
    display: flex;
    min-height: 0;
    flex: 1 1 auto;
    flex-direction: column;
    overflow: hidden;
}

.import-preview-modal .modal-body {
    min-height: 0;
    padding: 0.9rem 1rem 1rem;
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior: contain;
}

.import-preview-modal .import-preview-header-main {
    flex: 1 1 auto;
}

.import-preview-modal .import-preview-header-actions {
    max-width: 62%;
    flex: 0 1 auto;
}

.import-preview-modal .import-preview-table-wrap,
.import-preview-modal .import-scan-report-wrap {
    max-height: none;
    overflow-x: auto;
    overflow-y: visible;
}

.import-preview-modal .import-preview-table {
    min-width: 1240px;
}

.import-preview-modal .import-scan-report {
    min-width: 760px;
}

.import-preview-modal .import-preview-table thead th,
.import-preview-modal .import-scan-report thead th {
    position: static;
}

.import-preview-modal .import-preview-table th:nth-child(9),
.import-preview-modal .import-preview-table td:nth-child(9) {
    width: 21%;
}

.import-preview-modal .import-preview-table th:nth-child(10),
.import-preview-modal .import-preview-table td:nth-child(10) {
    display: table-cell;
    position: sticky;
    right: 0;
    z-index: 1;
    width: 10%;
    background: var(--client-surface, #fff);
    box-shadow: -8px 0 12px -12px rgba(15, 23, 42, 0.45);
}

.import-preview-modal .import-preview-table thead th:nth-child(10) {
    z-index: 2;
    background: var(--client-surface-alt, #f8fafb) !important;
}

@media (max-width: 991.98px) {
    .import-preview-modal .modal-header {
        align-items: stretch;
        flex-direction: column;
    }

    .import-preview-modal .import-preview-header-actions {
        width: 100%;
        max-width: none;
        margin-left: 0;
        align-items: stretch;
    }

    .import-preview-modal .import-preview-file-badge {
        max-width: 100%;
        align-self: flex-start;
    }

    .import-preview-modal .import-preview-header-actions > .d-flex > .btn {
        flex: 1 1 auto;
    }
}

@media (max-width: 767.98px) {
    .import-preview-modal .modal-dialog {
        width: 100%;
        max-width: none;
        height: 100vh;
        height: 100dvh;
        margin: 0;
    }

    .import-preview-modal .modal-content {
        border: 0;
        border-radius: 0;
    }

    .import-preview-modal .modal-header,
    .import-preview-modal .modal-body {
        padding-right: 0.75rem;
        padding-left: 0.75rem;
    }

    .import-preview-modal #smartImportRowFilters .ms-auto {
        width: 100%;
        margin-left: 0 !important;
    }
}

@media (prefers-reduced-motion: reduce) {
    .flash-toast,
    .flash-toast.is-leaving {
        animation-duration: 1ms;
    }

    .flash-toast-progress::after {
        animation: none;
    }
}

@media (max-width: 991px) {
    .app-header {
        align-items: flex-start;
    }

    .header-school-line {
        white-space: normal;
        flex-wrap: wrap;
    }

    .header-school-sep {
        display: none;
    }

    .app-header-actions {
        width: 100%;
        justify-content: space-between;
    }

    .header-live-clock {
        align-items: flex-start;
    }
}

@media (max-width: 575px) {
    .header-school-line {
        gap: 0.28rem;
    }

    .header-school-label {
        font-size: 0.74rem;
    }

    .header-school-value {
        font-size: 0.9rem;
    }

    .header-live-clock {
        padding: 0.3rem 0.48rem;
    }

    .header-clock-value {
        font-size: 0.78rem;
    }
}

/* Modern UI refresh (sidebar intentionally unchanged) */
:root {
    --ui-font-body: "Manrope", "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
    --ui-font-display: "Sora", "Manrope", "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
    --ui-main-glow-a: rgba(0, 144, 208, 0.2);
    --ui-main-glow-b: rgba(64, 80, 144, 0.16);
    --ui-surface: rgba(255, 255, 255, 0.84);
    --ui-surface-strong: #ffffff;
    --ui-surface-soft: #f5f9ff;
    --ui-border-soft: #dde7f3;
    --ui-border-strong: #cad9ea;
    --ui-text: #1f2f57;
    --ui-text-muted: #5e7190;
    --ui-accent: #1f79be;
    --ui-accent-strong: #0f5fa3;
    --ui-shadow-card: 0 10px 24px rgba(17, 35, 68, 0.1);
    --ui-shadow-card-hover: 0 18px 34px rgba(14, 34, 67, 0.16);
    --ui-shadow-strong: 0 26px 48px rgba(10, 24, 48, 0.22);
    --ui-radius-md: 0.78rem;
    --ui-radius-lg: 1rem;
}

body.theme-dark {
    --ui-main-glow-a: rgba(56, 135, 210, 0.16);
    --ui-main-glow-b: rgba(126, 164, 229, 0.13);
    --ui-surface: rgba(18, 30, 53, 0.78);
    --ui-surface-strong: #152540;
    --ui-surface-soft: #172b49;
    --ui-border-soft: #2d4568;
    --ui-border-strong: #365279;
    --ui-text: #dbe7fb;
    --ui-text-muted: #a4bad7;
    --ui-accent: #77b8ff;
    --ui-accent-strong: #5ca4f0;
    --ui-shadow-card: 0 12px 28px rgba(3, 10, 21, 0.38);
    --ui-shadow-card-hover: 0 18px 34px rgba(3, 10, 21, 0.5);
    --ui-shadow-strong: 0 26px 52px rgba(2, 8, 18, 0.62);
}

@media (prefers-color-scheme: dark) {
    body.theme-system {
        --ui-main-glow-a: rgba(56, 135, 210, 0.16);
        --ui-main-glow-b: rgba(126, 164, 229, 0.13);
        --ui-surface: rgba(18, 30, 53, 0.78);
        --ui-surface-strong: #152540;
        --ui-surface-soft: #172b49;
        --ui-border-soft: #2d4568;
        --ui-border-strong: #365279;
        --ui-text: #dbe7fb;
        --ui-text-muted: #a4bad7;
        --ui-accent: #77b8ff;
        --ui-accent-strong: #5ca4f0;
        --ui-shadow-card: 0 12px 28px rgba(3, 10, 21, 0.38);
        --ui-shadow-card-hover: 0 18px 34px rgba(3, 10, 21, 0.5);
        --ui-shadow-strong: 0 26px 52px rgba(2, 8, 18, 0.62);
    }
}

body.app-bg {
    background: linear-gradient(160deg, #edf4ff 0%, #f7fbff 100%);
}

body.auth-bg {
    background: linear-gradient(150deg, #e9f0fb 0%, #edf5ff 46%, #e6f0fa 100%);
}

body.theme-dark.app-bg {
    background: #0a1220;
}

body.theme-dark.auth-bg {
    background:
        radial-gradient(circle at 18% 20%, rgba(56, 135, 210, 0.22) 0%, rgba(56, 135, 210, 0) 38%),
        radial-gradient(circle at 84% 16%, rgba(84, 160, 255, 0.16) 0%, rgba(84, 160, 255, 0) 42%),
        linear-gradient(145deg, #0f1a30 0%, #0a1325 100%);
}

@media (prefers-color-scheme: dark) {
    body.theme-system.app-bg {
        background: #0a1220;
    }

    body.theme-system.auth-bg {
        background:
            radial-gradient(circle at 18% 20%, rgba(56, 135, 210, 0.22) 0%, rgba(56, 135, 210, 0) 38%),
            radial-gradient(circle at 84% 16%, rgba(84, 160, 255, 0.16) 0%, rgba(84, 160, 255, 0) 42%),
            linear-gradient(145deg, #0f1a30 0%, #0a1325 100%);
    }
}

.app-main,
.auth-shell {
    font-family: var(--ui-font-body);
    color: var(--ui-text);
}

.app-main {
    position: relative;
    isolation: isolate;
}

.app-main::before {
    content: "";
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 0;
    background: radial-gradient(circle at 22% 9%, var(--ui-main-glow-a) 0%, transparent 42%),
                radial-gradient(circle at 86% 90%, var(--ui-main-glow-b) 0%, transparent 44%);
}

.app-main > * {
    position: relative;
    z-index: 1;
}

.app-header {
    position: sticky;
    top: 0;
    z-index: 25;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--ui-border-strong);
}

.app-header-glass {
    background: var(--ui-surface);
    box-shadow: 0 14px 30px rgba(17, 35, 68, 0.12);
}

body.theme-dark .app-header-glass {
    box-shadow: 0 14px 30px rgba(2, 8, 18, 0.45);
}

@media (prefers-color-scheme: dark) {
    body.theme-system .app-header-glass {
        box-shadow: 0 14px 30px rgba(2, 8, 18, 0.45);
    }
}

.header-page-title,
.card-header,
.modal-title,
.auth-login-title {
    font-family: var(--ui-font-display);
}

.header-page-title {
    font-weight: 700;
}

.header-school-label,
.header-clock-label {
    color: var(--ui-text-muted);
}

.header-school-value,
.header-clock-value {
    color: var(--ui-text);
}

.header-school-glow {
    color: var(--ui-text);
    font-weight: 700;
    text-shadow: none;
}

body.theme-dark .header-school-glow {
    color: var(--ui-text);
    text-shadow: none;
}

@media (prefers-color-scheme: dark) {
    body.theme-system .header-school-glow {
        color: var(--ui-text);
        text-shadow: none;
    }
}

.header-live-clock {
    border: 1px solid var(--ui-border-strong);
    border-radius: 0.7rem;
    background: var(--ui-surface-strong);
}

.header-support-actions {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.header-wa-btn {
    min-width: 2.18rem;
    height: 2.18rem;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid #b4dfc7;
    color: #0f8f4d;
    background: linear-gradient(160deg, #f6fffa 0%, #e8f8f0 100%);
}

.header-wa-btn .bi {
    font-size: 1.04rem;
    line-height: 1;
}

.header-wa-btn:hover,
.header-wa-btn:focus {
    color: #ffffff;
    border-color: #0d8748;
    background: #0d8748;
    box-shadow: 0 10px 20px rgba(13, 135, 72, 0.24);
}

body.theme-dark .header-wa-btn {
    border-color: #2f7f57;
    color: #8be0ad;
    background: linear-gradient(160deg, #1a3b2b 0%, #183726 100%);
}

body.theme-dark .header-wa-btn:hover,
body.theme-dark .header-wa-btn:focus {
    color: #ffffff;
    border-color: #2aa55b;
    background: #2aa55b;
}

@media (prefers-color-scheme: dark) {
    body.theme-system .header-wa-btn {
        border-color: #2f7f57;
        color: #8be0ad;
        background: linear-gradient(160deg, #1a3b2b 0%, #183726 100%);
    }

    body.theme-system .header-wa-btn:hover,
    body.theme-system .header-wa-btn:focus {
        color: #ffffff;
        border-color: #2aa55b;
        background: #2aa55b;
    }
}

.app-content {
    padding: 1.15rem 1.25rem 1.35rem;
    background: transparent;
}

.app-footer {
    border-top: 1px solid var(--ui-border-soft);
    background: var(--ui-surface);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

.app-main .card,
.auth-shell .card,
.rollover-modal,
.modal-content {
    border: 1px solid var(--ui-border-soft);
    border-radius: var(--ui-radius-lg);
    background: var(--ui-surface-strong);
    box-shadow: var(--ui-shadow-card);
}

.modal-content {
    box-shadow: var(--ui-shadow-strong);
}

.app-main .card-header,
.auth-shell .card-header,
.modal-header {
    background: linear-gradient(180deg, var(--ui-surface-soft) 0%, var(--ui-surface-strong) 100%);
    border-bottom: 1px solid var(--ui-border-soft);
    color: var(--ui-text);
    font-size: 0.86rem;
    letter-spacing: 0.01em;
}

.app-main .table-responsive,
.auth-shell .table-responsive {
    border-radius: var(--ui-radius-md);
}

.app-main .btn,
.auth-shell .btn {
    border-radius: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.01em;
    transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease, background-color 0.18s ease, color 0.18s ease;
}

.app-main .btn:hover,
.auth-shell .btn:hover {
    transform: translateY(-1px);
}

.app-main .btn:active,
.auth-shell .btn:active {
    transform: translateY(0);
}

.app-main .btn:focus-visible,
.auth-shell .btn:focus-visible,
.app-main .form-control:focus-visible,
.app-main .form-select:focus-visible,
.auth-shell .form-control:focus-visible,
.auth-shell .form-select:focus-visible {
    outline: 2px solid rgba(var(--bs-primary-rgb), 0.28);
    outline-offset: 1px;
}

.app-main .btn-primary,
.auth-shell .btn-primary {
    border-color: transparent;
    background: linear-gradient(135deg, var(--ui-accent-strong) 0%, var(--brand-secondary) 100%);
    box-shadow: 0 10px 18px rgba(15, 95, 163, 0.24);
}

.app-main .btn-primary:hover,
.auth-shell .btn-primary:hover,
.app-main .btn-primary:focus,
.auth-shell .btn-primary:focus {
    border-color: transparent;
    background: linear-gradient(135deg, #0c558f 0%, #007cb4 100%);
    box-shadow: 0 14px 22px rgba(12, 86, 143, 0.3);
}

.app-main .btn-outline-primary,
.auth-shell .btn-outline-primary {
    color: var(--ui-accent-strong);
    border-color: var(--ui-border-strong);
    background: var(--ui-surface-strong);
}

.app-main .btn-outline-primary:hover,
.auth-shell .btn-outline-primary:hover {
    color: #ffffff;
    border-color: var(--ui-accent-strong);
    background: var(--ui-accent-strong);
}

.app-main .btn-outline-secondary,
.auth-shell .btn-outline-secondary {
    color: var(--ui-text-muted);
    border-color: var(--ui-border-strong);
    background: var(--ui-surface-strong);
}

.app-main .btn-outline-secondary:hover,
.auth-shell .btn-outline-secondary:hover {
    color: var(--ui-text);
    border-color: var(--ui-border-strong);
    background: var(--ui-surface-soft);
}

.app-main .btn-light.border,
.auth-shell .btn-light.border {
    border-color: var(--ui-border-strong) !important;
    color: var(--ui-text);
    background: var(--ui-surface-strong);
}

.app-main .btn-light.border:hover,
.auth-shell .btn-light.border:hover {
    background: var(--ui-surface-soft);
}

.app-main .form-control,
.app-main .form-select,
.app-main .input-group-text,
.auth-shell .form-control,
.auth-shell .form-select,
.auth-shell .input-group-text {
    border: 1px solid var(--ui-border-strong);
    border-radius: 0.68rem;
    background: var(--ui-surface-strong);
    color: var(--ui-text);
    min-height: 2.32rem;
    transition: border-color 0.18s ease, box-shadow 0.18s ease, background-color 0.18s ease;
}

.app-main .form-control:focus,
.app-main .form-select:focus,
.auth-shell .form-control:focus,
.auth-shell .form-select:focus {
    border-color: var(--ui-accent);
    box-shadow: 0 0 0 0.2rem rgba(var(--bs-primary-rgb), 0.18);
    background: var(--ui-surface-strong);
}

.app-main .form-control-sm,
.app-main .form-select-sm {
    border-radius: 0.58rem;
}

.app-main .form-check-input {
    border-color: #9fb4ce;
}

.app-main .form-check-input:checked {
    border-color: var(--ui-accent-strong);
    background-color: var(--ui-accent-strong);
}

.app-main .table,
.auth-shell .table {
    color: var(--ui-text);
}

.app-main .table > :not(caption) > * > *,
.auth-shell .table > :not(caption) > * > * {
    border-color: var(--ui-border-soft);
    padding-top: 0.52rem;
    padding-bottom: 0.52rem;
}

.app-main .table thead th,
.auth-shell .table thead th {
    background: var(--ui-surface-soft) !important;
    color: var(--ui-text-muted) !important;
}

.app-main .table tbody tr,
.auth-shell .table tbody tr {
    transition: background-color 0.16s ease;
}

.app-main .table tbody tr:hover,
.auth-shell .table tbody tr:hover {
    background: rgba(var(--bs-primary-rgb), 0.05);
}

.dashboard-filters,
.register-hero,
.rollover-hero,
.claims-hero,
.rates-hero,
.periods-hero,
.archive-hero,
.users-hero,
.settings-hero {
    position: relative;
    overflow: hidden;
    border-left: 4px solid rgba(var(--bs-primary-rgb), 0.8);
    border-radius: var(--ui-radius-lg);
    background: linear-gradient(135deg, var(--ui-surface-strong) 0%, var(--ui-surface-soft) 100%);
    box-shadow: var(--ui-shadow-card);
}

.dashboard-filters::after,
.register-hero::after,
.rollover-hero::after,
.claims-hero::after,
.rates-hero::after,
.periods-hero::after,
.archive-hero::after,
.users-hero::after,
.settings-hero::after {
    content: "";
    position: absolute;
    width: 150px;
    height: 150px;
    right: -42px;
    top: -64px;
    pointer-events: none;
    background: radial-gradient(circle, rgba(var(--bs-primary-rgb), 0.22) 0%, rgba(var(--bs-primary-rgb), 0) 72%);
}

.dashboard-kpi-card,
.claims-kpi-card,
.rates-kpi-card,
.periods-kpi-card,
.archive-kpi-card,
.users-kpi-card,
.settings-kpi-card,
.register-metric,
.rollover-metric,
.import-summary-item,
.rollover-summary-item {
    position: relative;
    overflow: hidden;
    border: 1px solid var(--ui-border-soft);
    border-radius: 0.86rem;
    background: linear-gradient(150deg, var(--ui-surface-strong) 0%, var(--ui-surface-soft) 100%);
    box-shadow: var(--ui-shadow-card);
    transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.dashboard-kpi-card::before,
.claims-kpi-card::before,
.rates-kpi-card::before,
.periods-kpi-card::before,
.archive-kpi-card::before,
.users-kpi-card::before,
.settings-kpi-card::before,
.register-metric::before,
.rollover-metric::before,
.import-summary-item::before,
.rollover-summary-item::before {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    top: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--ui-accent-strong) 0%, var(--brand-secondary) 100%);
    opacity: 0.92;
}

.dashboard-kpi-card:hover,
.claims-kpi-card:hover,
.rates-kpi-card:hover,
.periods-kpi-card:hover,
.archive-kpi-card:hover,
.users-kpi-card:hover,
.settings-kpi-card:hover,
.register-metric:hover,
.rollover-metric:hover,
.import-summary-item:hover,
.rollover-summary-item:hover {
    transform: translateY(-4px);
    border-color: rgba(var(--bs-primary-rgb), 0.45);
    box-shadow: var(--ui-shadow-card-hover);
}

.dashboard-kpi-label,
.claims-kpi-label,
.rates-kpi-label,
.periods-kpi-label,
.archive-kpi-label,
.users-kpi-label,
.settings-kpi-label,
.register-metric-label,
.rollover-metric-label {
    color: var(--ui-text-muted);
}

.dashboard-kpi-value,
.claims-kpi-value,
.rates-kpi-value,
.periods-kpi-value,
.archive-kpi-value,
.users-kpi-value,
.settings-kpi-value,
.register-metric-value,
.rollover-metric-value {
    color: var(--ui-text);
}

.dashboard-chart-card,
.builder-tool-card,
.claims-panel,
.rates-panel,
.claims-table-card,
.rates-table-card,
.periods-panel,
.archive-panel,
.archive-table-card,
.users-panel,
.users-table-card,
.settings-panel,
.register-table-card,
.import-preview-card,
.rollover-setup-card,
.rollover-preview-card {
    border: 1px solid var(--ui-border-soft);
    border-radius: var(--ui-radius-lg);
    box-shadow: var(--ui-shadow-card);
}

.claims-status,
.period-status,
.status-pill,
.user-role-pill,
.user-status-pill,
.user-flag-pill,
.grade-tag,
.grade-chip,
.users-role-chip {
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.42);
}

.app-main .alert,
.auth-shell .alert {
    border-radius: 0.76rem;
    border-width: 1px;
    box-shadow: 0 8px 18px rgba(18, 35, 64, 0.08);
}

.modal-header,
.modal-footer {
    border-color: var(--ui-border-soft);
}

.app-content > * {
    animation: ui-fade-up 260ms ease both;
}

@keyframes ui-fade-up {
    from {
        opacity: 0;
        transform: translateY(8px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@media (hover: none) {
    .dashboard-kpi-card:hover,
    .claims-kpi-card:hover,
    .rates-kpi-card:hover,
    .periods-kpi-card:hover,
    .archive-kpi-card:hover,
    .users-kpi-card:hover,
    .settings-kpi-card:hover,
    .register-metric:hover,
    .rollover-metric:hover,
    .import-summary-item:hover,
    .rollover-summary-item:hover {
        transform: none;
    }
}

@media (prefers-reduced-motion: reduce) {
    .app-content > *,
    .app-main .btn,
    .auth-shell .btn,
    .dashboard-kpi-card,
    .claims-kpi-card,
    .rates-kpi-card,
    .periods-kpi-card,
    .archive-kpi-card,
    .users-kpi-card,
    .settings-kpi-card,
    .register-metric,
    .rollover-metric,
    .import-summary-item,
    .rollover-summary-item {
        animation: none !important;
        transition: none !important;
    }
}

.auth-login-form .form-text {
    margin-top: 0.24rem;
    font-size: 0.72rem;
    color: #5f7391;
}

.auth-setup .auth-login-pill,
.auth-security .auth-login-pill {
    letter-spacing: 0.01em;
}

.action-progress-overlay {
    position: fixed;
    inset: 0;
    z-index: 5000;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    background: rgba(20, 35, 55, 0.46);
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
}

.action-progress-overlay.is-active {
    display: flex;
    animation: action-progress-fade 160ms ease both;
}

body.is-action-progress-active {
    overflow: hidden;
}

.action-progress-panel {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    gap: 1rem;
    align-items: start;
    width: min(94vw, 510px);
    padding: 1.35rem;
    border: 1px solid #d7e0eb;
    border-radius: 0.9rem;
    color: #172033;
    background: #ffffff;
    box-shadow: 0 22px 55px rgba(15, 35, 60, 0.26);
}

.action-progress-spinner {
    width: 2.6rem;
    height: 2.6rem;
    margin-top: 0.2rem;
    border: 4px solid #dbe6f2;
    border-top-color: #2c70b7;
    border-radius: 50%;
    animation: action-progress-spin 0.8s linear infinite;
}

.action-progress-copy {
    min-width: 0;
}

.action-progress-label {
    display: block;
    margin-bottom: 0.2rem;
    color: #63748b;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.action-progress-copy h2 {
    margin: 0;
    color: #172b4a;
    font-size: 1.12rem;
    font-weight: 750;
    line-height: 1.3;
}

.action-progress-copy p {
    min-height: 2.8em;
    margin: 0.38rem 0 0;
    color: #5f6f84;
    font-size: 0.88rem;
    line-height: 1.45;
}

.action-progress-track {
    position: relative;
    height: 5px;
    margin-top: 0.9rem;
    border-radius: 999px;
    overflow: hidden;
    background: #e3ebf4;
}

.action-progress-track span {
    position: absolute;
    inset-block: 0;
    left: 0;
    width: 38%;
    border-radius: inherit;
    background: #2c70b7;
    animation: action-progress-move 1.15s ease-in-out infinite;
}

.action-progress-copy strong {
    display: block;
    margin-top: 0.48rem;
    color: #52647a;
    font-size: 0.75rem;
    font-weight: 650;
}

.is-action-loading {
    cursor: wait !important;
}

@keyframes action-progress-fade {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes action-progress-spin {
    from {
        transform: rotate(0deg);
    }

    to {
        transform: rotate(360deg);
    }
}

@keyframes action-progress-move {
    from {
        transform: translateX(-110%);
    }

    to {
        transform: translateX(340%);
    }
}

@media (max-width: 1366px), (max-height: 900px) {
    .app-header {
        padding: 0.86rem 1rem;
    }

    .app-content {
        padding: 0.92rem 1rem 1.1rem;
    }

    .auth-card-body {
        padding: 1rem;
    }

    .app-main .card,
    .auth-shell .card,
    .dashboard-kpi-card,
    .claims-kpi-card,
    .rates-kpi-card,
    .periods-kpi-card,
    .archive-kpi-card,
    .users-kpi-card,
    .settings-kpi-card,
    .register-metric,
    .rollover-metric,
    .import-summary-item,
    .rollover-summary-item {
        box-shadow: 0 7px 16px rgba(17, 35, 68, 0.09);
    }
}

@media (max-width: 1024px), (max-height: 780px), (pointer: coarse) {
    .app-header-glass,
    .app-footer,
    .rollover-modal-backdrop {
        backdrop-filter: none;
        -webkit-backdrop-filter: none;
    }

    .app-main::before {
        opacity: 0.62;
    }

    .app-content > * {
        animation: none;
    }

    .app-main .btn,
    .auth-shell .btn,
    .dashboard-kpi-card,
    .claims-kpi-card,
    .rates-kpi-card,
    .periods-kpi-card,
    .archive-kpi-card,
    .users-kpi-card,
    .settings-kpi-card,
    .register-metric,
    .rollover-metric,
    .import-summary-item,
    .rollover-summary-item {
        transition-duration: 0.12s;
    }

    .auth-login-logo-wrap {
        width: 102px;
        height: 102px;
    }

    .auth-login-logo {
        width: 80px;
        height: 80px;
    }
}

@media (max-width: 991px) {
    .header-support-actions {
        width: 100%;
        justify-content: flex-end;
    }

    .header-help-btn {
        min-width: 96px;
    }

    .action-progress-panel {
        grid-template-columns: 1fr;
        text-align: center;
    }

    .action-progress-spinner {
        margin: 0 auto;
    }
}

@media (prefers-reduced-motion: reduce) {
    .action-progress-overlay,
    .action-progress-spinner,
    .action-progress-track span {
        animation: none !important;
    }

    .action-progress-track span {
        width: 100%;
        transform: none;
    }
}

@media print {
    .action-progress-overlay {
        display: none !important;
    }
}
















.password-toggle-btn {
    position: absolute;
    top: 50%;
    right: 0.38rem;
    z-index: 6;
    width: 2rem;
    height: 2rem;
    padding: 0;
    border: 0;
    border-radius: 0.5rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #52647a;
    background: transparent;
    transform: translateY(-50%);
    transition: color 0.16s ease, background-color 0.16s ease;
}

.password-toggle-btn:hover {
    color: #174f7c;
    background: #e8eef5;
}

.password-toggle-btn:focus-visible {
    outline: 2px solid #2589be;
    outline-offset: 1px;
}

.password-toggle-btn svg {
    width: 1.12rem;
    height: 1.12rem;
    display: block;
}

.password-toggle-group {
    position: relative;
    display: block;
    width: 100%;
}

.password-toggle-group > .form-control {
    width: 100%;
    padding-right: 3rem;
}

/* Platform super-admin console */
.platform-admin-bg .app-content {
    background: linear-gradient(145deg, #eef5ff 0%, #f8fbff 55%, #eef2f8 100%);
}

.platform-admin-sidebar {
    background: linear-gradient(180deg, #17254a 0%, #243d70 58%, #14213f 100%);
}

.platform-admin-shell .card {
    border-color: #d7e2f1;
    box-shadow: 0 8px 24px rgba(23, 47, 89, 0.07);
}

.platform-admin-hero {
    border-top: 4px solid #1d73b7;
}

.platform-admin-table th,
.platform-admin-table td {
    white-space: nowrap;
}

.platform-delete-details {
    min-width: 9rem;
    position: relative;
}

.platform-delete-details > summary {
    list-style: none;
    cursor: pointer;
}

.platform-delete-details > summary::-webkit-details-marker {
    display: none;
}

.platform-delete-form {
    width: min(22rem, 75vw);
    position: absolute;
    right: 0;
    z-index: 20;
    box-shadow: 0 12px 30px rgba(20, 33, 63, 0.18);
}

.platform-audit-details {
    max-width: 36rem;
    max-height: 14rem;
    overflow: auto;
    padding: 0.6rem;
    border-radius: 0.4rem;
    background: #f1f5f9;
    font-size: 0.72rem;
    white-space: pre-wrap;
}
.auth-modern-page {
    margin: 0;
    min-height: 100vh;
    min-height: 100dvh;
    background: #f4f7fb;
    color: #17213a;
}

.auth-modern-shell {
    min-height: 100vh;
    min-height: 100dvh;
    display: grid;
    grid-template-columns: minmax(0, 48%) minmax(0, 52%);
}

.auth-modern-visual {
    position: sticky;
    top: 0;
    height: 100vh;
    height: 100dvh;
    overflow: hidden;
    background: #173762;
    isolation: isolate;
}

.auth-modern-slides,
.auth-modern-slide,
.auth-modern-scrim {
    position: absolute;
    inset: 0;
}

.auth-modern-slide {
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: 0;
    transform: scale(1.08);
    filter: blur(3px) saturate(0.92) brightness(0.82);
    transition: opacity 1.6s ease, transform 8s ease, filter 1.6s ease;
}

.auth-modern-slide.is-active {
    opacity: 1;
    transform: scale(1.025);
    filter: blur(1.2px) saturate(1.04) brightness(0.9);
}

.auth-modern-scrim {
    z-index: 1;
    background: rgba(5, 18, 43, 0.58);
    backdrop-filter: blur(0.7px);
}

.auth-modern-visual-content {
    position: absolute;
    z-index: 2;
    left: clamp(1.5rem, 5vw, 4.75rem);
    right: clamp(1.5rem, 5vw, 4.75rem);
    bottom: clamp(2rem, 8vh, 6rem);
    color: #fff;
    text-shadow: 0 2px 18px rgba(5, 18, 43, 0.35);
}

.auth-modern-brand-mark {
    width: 5.2rem;
    height: 5.2rem;
    display: grid;
    place-items: center;
    margin-bottom: 1.15rem;
    border: 1px solid rgba(255, 255, 255, 0.7);
    border-radius: 1.3rem;
    background: rgba(255, 255, 255, 0.9);
    box-shadow: 0 18px 45px rgba(3, 16, 39, 0.28);
    backdrop-filter: blur(14px);
}

.auth-modern-brand-mark img {
    width: 82%;
    height: 82%;
    object-fit: contain;
}

.auth-modern-eyebrow {
    margin-bottom: 0.65rem;
    font-size: 0.76rem;
    font-weight: 800;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: #d9f4ff;
}

.auth-modern-visual-content h1 {
    max-width: 38rem;
    margin: 0;
    font-size: clamp(2rem, 4.4vw, 4.35rem);
    line-height: 1.01;
    font-weight: 800;
    letter-spacing: -0.045em;
}

.auth-modern-visual-content p {
    max-width: 36rem;
    margin: 1.15rem 0 0;
    font-size: clamp(0.95rem, 1.4vw, 1.12rem);
    line-height: 1.65;
    color: rgba(246, 251, 255, 0.9);
}

.auth-modern-trust {
    display: flex;
    flex-wrap: wrap;
    gap: 0.65rem;
    margin-top: 1.35rem;
}

.auth-modern-trust span {
    display: inline-flex;
    align-items: center;
    gap: 0.42rem;
    padding: 0.48rem 0.72rem;
    border: 1px solid rgba(255, 255, 255, 0.26);
    border-radius: 999px;
    background: rgba(9, 31, 64, 0.38);
    font-size: 0.78rem;
    font-weight: 700;
    backdrop-filter: blur(12px);
}

.auth-modern-slide-status {
    position: absolute;
    z-index: 2;
    left: clamp(1.5rem, 5vw, 4.75rem);
    bottom: 1.3rem;
    display: flex;
    gap: 0.35rem;
}

.auth-modern-slide-status span {
    width: 1.6rem;
    height: 0.22rem;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.35);
    transition: width 0.4s ease, background 0.4s ease;
}

.auth-modern-slide-status span.is-active {
    width: 2.8rem;
    background: #fff;
}

.auth-modern-main {
    min-width: 0;
    min-height: 100vh;
    min-height: 100dvh;
    display: grid;
    place-items: center;
    overflow-y: auto;
    padding: clamp(1.35rem, 4vw, 4rem);
    background: #f4f7fb;
}

.auth-modern-main-inner {
    width: min(100%, 46rem);
}

.auth-modern-side-logo {
    display: flex;
    justify-content: flex-end;
    height: clamp(6.15rem, 8.5vw, 7.7rem);
    overflow: hidden;
    margin-bottom: clamp(0.55rem, 1.5vh, 1rem);
}

.auth-modern-side-logo img {
    width: clamp(7.25rem, 10vw, 9rem);
    height: clamp(7.25rem, 10vw, 9rem);
    object-fit: contain;
    transform: translateY(-16%);
}

.auth-modern-form-card {
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
    backdrop-filter: none;
}

.auth-modern-form-card .auth-login,
.auth-modern-form-card .auth-signin {
    display: block;
    width: 100%;
}

.auth-modern-form-card .auth-login-brand,
.auth-modern-form-card .auth-signin-brand {
    display: block;
    height: auto;
    min-height: 0;
    margin: 0 0 1.15rem !important;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
    color: #17213a;
    text-shadow: none;
}

.auth-modern-form-card .auth-login-brand.text-center {
    text-align: left !important;
}

.auth-modern-form-card .auth-signin-logo-shell,
.auth-modern-form-card .auth-login-logo-wrap {
    display: none;
}

.auth-modern-form-card .auth-login-title {
    color: #172b50;
    font-size: clamp(1.55rem, 2.4vw, 2.15rem);
    letter-spacing: -0.025em;
}

.auth-modern-form-card .auth-login-subtitle {
    max-width: 38rem;
    margin-top: 0.5rem !important;
    color: #60708a;
    font-size: 0.9rem;
    line-height: 1.55;
}

.auth-modern-form-card .auth-login-panel,
.auth-modern-form-card .auth-signin-panel {
    height: auto;
    margin: 0 !important;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
}

.auth-modern-form-card .form-control,
.auth-modern-form-card .form-select,
.auth-modern-form-card .input-group-text {
    min-height: 2.72rem;
    border-color: #cbd8e8;
    border-radius: 0.72rem;
}

.auth-modern-form-card .input-group .form-control {
    border-radius: 0.72rem !important;
}

.auth-modern-form-card .form-control:focus,
.auth-modern-form-card .form-select:focus {
    border-color: #2589be;
    box-shadow: 0 0 0 0.22rem rgba(37, 137, 190, 0.13);
}

.auth-modern-form-card .btn-primary {
    min-height: 2.72rem;
    border-radius: 0.72rem;
    background: #176f9f;
    border-color: #176f9f;
    box-shadow: 0 10px 24px rgba(22, 111, 161, 0.2);
}

.auth-modern-form-card .btn-primary:hover {
    background: #125d87;
    border-color: #125d87;
    transform: translateY(-1px);
}

.auth-modern-mobile-brand {
    display: none;
    align-items: center;
    gap: 0.7rem;
    margin-bottom: 1rem;
    color: #1d355d;
    font-weight: 800;
}

.auth-modern-mobile-brand img {
    width: 2.7rem;
    height: 2.7rem;
    object-fit: contain;
    border-radius: 0.65rem;
    background: #fff;
}

.auth-modern-footer {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    margin-top: 1rem;
    padding: 0 0.35rem;
    color: #718098;
    font-size: 0.72rem;
}

@media (max-width: 991.98px) {
    .auth-modern-shell {
        display: block;
    }

    .auth-modern-visual {
        position: relative;
        height: min(34vh, 18rem);
    }

    .auth-modern-visual-content {
        left: 1.25rem;
        right: 1.25rem;
        bottom: 1.4rem;
    }

    .auth-modern-brand-mark,
    .auth-modern-visual-content p,
    .auth-modern-trust,
    .auth-modern-slide-status {
        display: none;
    }

    .auth-modern-eyebrow {
        margin-bottom: 0.35rem;
        font-size: 0.66rem;
    }

    .auth-modern-visual-content h1 {
        max-width: 32rem;
        font-size: clamp(1.65rem, 7vw, 2.5rem);
    }

    .auth-modern-main {
        min-height: auto;
        padding: 1.25rem;
    }
}

@media (max-width: 575.98px) {
    .auth-modern-visual {
        height: 12rem;
    }

    .auth-modern-main {
        padding: 0.85rem;
    }

    .auth-modern-form-card {
        padding: 0;
        border-radius: 0;
    }

    .auth-modern-mobile-brand {
        display: flex;
    }

    .auth-modern-footer {
        display: block;
        text-align: center;
    }

    .auth-modern-footer span {
        display: block;
        margin-top: 0.22rem;
    }
}

@media (prefers-reduced-motion: reduce) {
    .auth-modern-slide,
    .auth-modern-form-card .btn-primary {
        transition: none;
    }
}

/* Professional responsive application shell */
:root {
    --sidebar-width: 264px;
    --sidebar-collapsed-width: 76px;
    --brand-primary: #2563a7;
    --brand-secondary: #4e8eb8;
    --brand-deep: #183b63;
    --bs-primary: #2563a7;
    --bs-primary-rgb: 37, 99, 167;
    --ui-font-body: "Segoe UI", Tahoma, Arial, sans-serif;
    --ui-font-display: "Segoe UI", Tahoma, Arial, sans-serif;
    --ui-surface: #ffffff;
    --ui-surface-strong: #ffffff;
    --ui-surface-soft: #f7f9fb;
    --ui-border-soft: #e2e7ec;
    --ui-border-strong: #cfd7df;
    --ui-text: #172033;
    --ui-text-muted: #6b778c;
    --ui-accent: #2563a7;
    --ui-accent-strong: #1e568f;
    --ui-shadow-card: none;
    --ui-shadow-card-hover: none;
    --ui-shadow-strong: 0 18px 45px rgba(15, 23, 42, 0.16);
    --ui-radius-md: 0.55rem;
    --ui-radius-lg: 0.7rem;
}

body.app-bg,
.platform-admin-bg .app-content {
    background: #f7f8fa;
}

.app-shell {
    height: 100vh;
    height: 100dvh;
    max-height: 100vh;
    max-height: 100dvh;
}

.app-main {
    height: 100vh;
    height: 100dvh;
    max-height: 100vh;
    max-height: 100dvh;
    background: #f7f8fa;
}

.app-main::before {
    display: none;
}

.sidebar,
.platform-admin-sidebar {
    width: var(--sidebar-width);
    color: var(--ui-text);
    background: var(--ui-surface-strong) !important;
    border-right: 1px solid var(--ui-border-soft);
    box-shadow: none;
    transition: width 180ms ease, transform 220ms ease;
}

.sidebar::before {
    display: none;
}

.sidebar-inner {
    padding: 0.9rem 0.75rem !important;
}

.sidebar-brand {
    padding: 0.15rem 0.25rem 1rem;
    margin-bottom: 0.45rem !important;
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
}

.sidebar-brand-main {
    display: flex;
    align-items: center;
    min-width: 0;
    gap: 0.7rem;
}

.sidebar-logo-shell {
    width: 40px;
    min-width: 40px;
    height: 40px;
    margin: 0;
    padding: 0.16rem;
    border: 1px solid var(--ui-border-soft);
    border-radius: 50%;
    background: #ffffff;
    box-shadow: none;
}

.sidebar-logo {
    width: 100%;
    height: 100%;
    object-fit: contain;
    transform: none;
}

.sidebar-brand-copy {
    min-width: 0;
    flex: 1 1 auto;
}

.sidebar-title {
    color: var(--ui-text);
    font-size: 0.98rem;
    font-weight: 700;
    letter-spacing: 0.01em;
    white-space: nowrap;
}

.sidebar-subtitle {
    display: block;
    max-width: 170px;
    margin-top: 0.08rem;
    color: var(--ui-text-muted);
    font-size: 0.73rem;
    line-height: 1.25;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.sidebar-nav {
    gap: 0.2rem !important;
    padding: 0.2rem 0;
    scrollbar-color: #cbd3dc transparent;
}

.sidebar-link {
    min-height: 42px;
    padding: 0.58rem 0.7rem;
    gap: 0.72rem;
    color: #354154;
    border: 0;
    border-radius: 0.5rem;
    background: transparent;
    font-size: 0.86rem;
    font-weight: 500;
    transition: color 150ms ease, background-color 150ms ease;
}

.sidebar-link:hover {
    color: #183b63;
    border: 0;
    background: #f2f5f8;
    transform: none;
}

.sidebar-link.active {
    color: #1f67a8;
    border: 0;
    background: #eaf3fb;
    box-shadow: none;
    font-weight: 600;
}

.sidebar-link-dot {
    display: none;
}

.sidebar-link-icon {
    width: 1.15rem;
    min-width: 1.15rem;
    color: #7a8797;
    font-size: 1rem;
    line-height: 1;
    text-align: center;
}

.sidebar-link:hover .sidebar-link-icon,
.sidebar-link.active .sidebar-link-icon {
    color: currentColor;
}

.sidebar-user {
    margin-top: auto;
    padding: 0.8rem 0.2rem 0 !important;
    border: 0;
    border-top: 1px solid var(--ui-border-soft) !important;
    border-radius: 0;
    background: transparent;
}

.sidebar-user-profile {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    min-width: 0;
    padding: 0 0.45rem 0.65rem;
}

.sidebar-avatar {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    min-width: 34px;
    height: 34px;
    border-radius: 50%;
    color: #496078;
    background: #eef1f4;
    font-size: 0.76rem;
    font-weight: 700;
}

.sidebar-user-copy {
    min-width: 0;
    flex: 1 1 auto;
    color: var(--ui-text);
}

.sidebar-user-copy .fw-semibold {
    font-size: 0.82rem;
}

.sidebar-user-copy .small {
    font-size: 0.72rem;
}

.sidebar-logout-form {
    margin-bottom: 0.15rem;
}

.sidebar-action-btn {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 0.72rem;
    min-height: 38px;
    padding: 0.45rem 0.68rem;
    color: #566274;
    border: 0;
    border-radius: 0.48rem;
    background: transparent;
    font-size: 0.82rem;
    font-weight: 500;
    box-shadow: none;
}

.sidebar-action-btn:hover,
.sidebar-action-btn:focus {
    color: #172033;
    background: #f2f5f8;
}

.sidebar-action-btn i {
    width: 1.15rem;
    font-size: 0.98rem;
    text-align: center;
}

.sidebar-close-btn,
.header-menu-btn,
.sidebar-backdrop {
    display: none;
}

body.sidebar-collapsed .sidebar {
    width: var(--sidebar-collapsed-width);
}

body.sidebar-collapsed .sidebar-inner {
    padding-right: 0.55rem !important;
    padding-left: 0.55rem !important;
}

body.sidebar-collapsed .sidebar-brand {
    padding-right: 0;
    padding-left: 0;
}

body.sidebar-collapsed .sidebar-brand-main,
body.sidebar-collapsed .sidebar-link,
body.sidebar-collapsed .sidebar-action-btn,
body.sidebar-collapsed .sidebar-user-profile {
    justify-content: center;
}

body.sidebar-collapsed .sidebar-brand-copy,
body.sidebar-collapsed .sidebar-link-label,
body.sidebar-collapsed .sidebar-action-label,
body.sidebar-collapsed .sidebar-user-copy {
    display: none;
}

body.sidebar-collapsed .sidebar-link,
body.sidebar-collapsed .sidebar-action-btn {
    padding-right: 0.5rem;
    padding-left: 0.5rem;
}

body.sidebar-collapsed .sidebar-collapse-btn i {
    transform: rotate(180deg);
}

.app-header {
    position: relative;
    top: auto;
    min-height: 70px;
    padding: 0.78rem 1.5rem;
    color: var(--ui-text);
    border-bottom: 1px solid var(--ui-border-soft);
    background: #ffffff;
}

.app-header-glass {
    background: #ffffff;
    box-shadow: none;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
}

.header-page-title {
    margin-bottom: 0.2rem !important;
    color: var(--ui-text);
    font-size: 1.05rem;
    font-weight: 700;
    letter-spacing: 0;
}

.header-school-line {
    gap: 0.38rem;
    color: var(--ui-text-muted);
}

.header-school-item {
    gap: 0.25rem;
}

.header-school-label {
    color: #8792a2;
    font-size: 0.67rem;
    font-weight: 600;
    letter-spacing: 0.045em;
}

.header-school-value {
    color: #566274;
    font-size: 0.78rem;
    font-weight: 600;
}

.header-school-glow {
    color: #566274;
    text-shadow: none;
}

.header-school-sep {
    color: #c4cbd3;
}

.header-live-clock {
    padding: 0.36rem 0.55rem;
    border-color: var(--ui-border-soft);
    border-radius: 0.5rem;
    background: #ffffff;
}

.header-clock-label {
    color: #8792a2;
    font-size: 0.6rem;
}

.header-clock-value {
    color: #3d495b;
    font-size: 0.75rem;
    font-weight: 600;
}

.header-help-btn,
.header-wa-btn {
    min-height: 34px;
    border-radius: 0.5rem;
    box-shadow: none;
}

.header-wa-btn {
    color: #2f7d5c;
    border-color: #d3e4dc;
    background: #ffffff;
}

.app-content {
    padding: 1.5rem;
    background: #f7f8fa;
}

.app-content > * {
    width: min(100%, 1720px);
    margin-right: auto;
    margin-left: auto;
    animation: none;
}

.app-footer {
    min-height: 42px;
    padding: 0.58rem 1.5rem;
    color: #778295;
    border-top: 1px solid var(--ui-border-soft);
    background: #ffffff;
    font-size: 0.73rem;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
}

.app-main .card,
.auth-shell .card,
.platform-admin-shell .card,
.modal-content {
    border: 1px solid var(--ui-border-soft);
    border-radius: var(--ui-radius-lg);
    background: var(--ui-surface-strong);
    box-shadow: none;
}

.app-main .card-header,
.auth-shell .card-header,
.modal-header {
    padding: 0.78rem 1rem;
    color: var(--ui-text);
    border-bottom: 1px solid var(--ui-border-soft);
    background: #ffffff;
    font-family: var(--ui-font-display);
    font-size: 0.84rem;
    font-weight: 600;
    letter-spacing: 0;
}

.app-main .btn,
.auth-shell .btn {
    border-radius: 0.5rem;
    font-weight: 600;
    letter-spacing: 0;
    box-shadow: none;
    transition: color 150ms ease, background-color 150ms ease, border-color 150ms ease;
}

.app-main .btn:hover,
.auth-shell .btn:hover,
.app-main .btn:active,
.auth-shell .btn:active {
    transform: none;
}

.app-main .btn-primary,
.auth-shell .btn-primary,
.app-main .btn-primary:hover,
.auth-shell .btn-primary:hover,
.app-main .btn-primary:focus,
.auth-shell .btn-primary:focus {
    color: #ffffff;
    border-color: #2563a7;
    background: #2563a7;
    box-shadow: none;
}

.app-main .btn-primary:hover,
.auth-shell .btn-primary:hover {
    border-color: #1e568f;
    background: #1e568f;
}

.app-main .btn-outline-primary,
.auth-shell .btn-outline-primary,
.app-main .btn-outline-secondary,
.auth-shell .btn-outline-secondary {
    border-color: var(--ui-border-strong);
    background: #ffffff;
}

.app-main .form-control,
.app-main .form-select,
.app-main .input-group-text,
.auth-shell .form-control,
.auth-shell .form-select,
.auth-shell .input-group-text {
    min-height: 2.45rem;
    color: var(--ui-text);
    border: 1px solid var(--ui-border-strong);
    border-radius: 0.5rem;
    background: #ffffff;
    box-shadow: none;
}

.app-main .form-control:focus,
.app-main .form-select:focus,
.auth-shell .form-control:focus,
.auth-shell .form-select:focus {
    border-color: #6e9cc5;
    background: #ffffff;
    box-shadow: 0 0 0 3px rgba(37, 99, 167, 0.1);
}

.app-main .table > :not(caption) > * > *,
.auth-shell .table > :not(caption) > * > * {
    padding: 0.64rem 0.75rem;
    border-color: var(--ui-border-soft);
}

.app-main .table thead th,
.auth-shell .table thead th {
    color: #657184 !important;
    background: #f8fafb !important;
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.035em;
    text-transform: uppercase;
}

.app-main .table tbody tr:hover,
.auth-shell .table tbody tr:hover {
    background: #fafbfd;
}

.dashboard-filters,
.register-hero,
.rollover-hero,
.claims-hero,
.rates-hero,
.periods-hero,
.archive-hero,
.users-hero,
.settings-hero,
.platform-admin-hero {
    border: 1px solid var(--ui-border-soft);
    border-left: 1px solid var(--ui-border-soft);
    border-top: 1px solid var(--ui-border-soft);
    border-radius: var(--ui-radius-lg);
    background: #ffffff;
    box-shadow: none;
}

.dashboard-filters::after,
.register-hero::after,
.rollover-hero::after,
.claims-hero::after,
.rates-hero::after,
.periods-hero::after,
.archive-hero::after,
.users-hero::after,
.settings-hero::after,
.dashboard-kpi-card::before,
.claims-kpi-card::before,
.rates-kpi-card::before,
.periods-kpi-card::before,
.archive-kpi-card::before,
.users-kpi-card::before,
.settings-kpi-card::before,
.register-metric::before,
.rollover-metric::before,
.import-summary-item::before,
.rollover-summary-item::before {
    display: none;
}

.dashboard-kpi-card,
.claims-kpi-card,
.rates-kpi-card,
.periods-kpi-card,
.archive-kpi-card,
.users-kpi-card,
.settings-kpi-card,
.register-metric,
.rollover-metric,
.import-summary-item,
.rollover-summary-item {
    padding: 1rem;
    border: 1px solid var(--ui-border-soft);
    border-radius: var(--ui-radius-lg);
    background: #ffffff;
    box-shadow: none;
}

.dashboard-kpi-card:hover,
.claims-kpi-card:hover,
.rates-kpi-card:hover,
.periods-kpi-card:hover,
.archive-kpi-card:hover,
.users-kpi-card:hover,
.settings-kpi-card:hover,
.register-metric:hover,
.rollover-metric:hover,
.import-summary-item:hover,
.rollover-summary-item:hover {
    border-color: var(--ui-border-strong);
    box-shadow: none;
    transform: none;
}

.dashboard-kpi-label {
    margin-bottom: 0.35rem;
    color: #778295;
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.045em;
}

.dashboard-kpi-value {
    margin-bottom: 0.32rem;
    color: #172033;
    font-size: 1.65rem;
    font-weight: 700;
}

.page-eyebrow {
    margin-bottom: 0.3rem;
    color: #6b778c;
    font-size: 0.67rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.platform-updated,
.analytics-range,
.platform-delivery-status {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    color: #6b778c;
    font-size: 0.72rem;
    font-weight: 500;
}

.analytics-range {
    padding: 0.24rem 0.48rem;
    border: 1px solid var(--ui-border-soft);
    border-radius: 999px;
    background: #f8fafb;
    white-space: nowrap;
}

.platform-kpi-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.75rem;
}

.platform-kpi-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    color: #4f6f91;
    border-radius: 0.45rem;
    background: #edf3f8;
    font-size: 0.88rem;
}

.platform-signal-grid {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 0.75rem;
}

.platform-signal-card {
    display: flex;
    align-items: center;
    min-width: 0;
    gap: 0.72rem;
    padding: 0.78rem;
    border: 1px solid var(--ui-border-soft);
    border-radius: var(--ui-radius-lg);
    background: #ffffff;
}

.platform-signal-card > div {
    min-width: 0;
}

.platform-signal-card strong,
.platform-signal-card span {
    display: block;
}

.platform-signal-card strong {
    color: #172033;
    font-size: 1.12rem;
    line-height: 1.1;
}

.platform-signal-card div span {
    margin-top: 0.18rem;
    color: #6b778c;
    font-size: 0.7rem;
    line-height: 1.25;
}

.platform-signal-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    min-width: 34px;
    height: 34px;
    border-radius: 0.5rem;
}

.platform-signal-icon.is-blue { color: #2563a7; background: #eaf3fb; }
.platform-signal-icon.is-green { color: #2f7d5c; background: #eaf4ef; }
.platform-signal-icon.is-amber { color: #9a681c; background: #fbf2e3; }
.platform-signal-icon.is-red { color: #a34240; background: #f9eaea; }
.platform-signal-icon.is-slate { color: #64748b; background: #eef1f4; }

.platform-analytics-card .card-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.75rem;
}

.platform-analytics-card .card-header > div > span,
.platform-analytics-card .card-header > span:first-child {
    display: block;
    color: #273348;
    font-size: 0.83rem;
    font-weight: 700;
}

.platform-analytics-card .card-header small {
    display: block;
    margin-top: 0.18rem;
    color: #7a8596;
    font-size: 0.7rem;
    font-weight: 400;
    line-height: 1.3;
}

.platform-chart-panel {
    position: relative;
    height: 290px;
    min-height: 230px;
}

.platform-chart-panel-lg {
    height: 340px;
}

.platform-chart-panel-tall {
    height: 390px;
}

.platform-chart-panel-doughnut {
    height: 300px;
}

.platform-chart-panel-compact {
    height: 250px;
}

.platform-region-table {
    font-size: 0.76rem;
}

.platform-notification-list .list-group-item {
    padding: 0.85rem 1rem;
    border-color: var(--ui-border-soft);
    background: #ffffff;
}

.analytics-summary {
    color: #6b778c;
    font-size: 0.72rem;
}

@media (max-width: 1399.98px) {
    .platform-signal-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

@media (max-width: 1199.98px) {
    .app-content {
        padding: 1.15rem;
    }

    .platform-signal-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 991.98px) {
    body.app-bg {
        overflow: hidden;
    }

    .app-shell {
        flex-direction: row;
        height: 100vh;
        height: 100dvh;
        max-height: 100vh;
        max-height: 100dvh;
        overflow: hidden;
    }

    .sidebar,
    body.sidebar-collapsed .sidebar {
        position: fixed;
        z-index: 1050;
        top: 0;
        left: 0;
        width: min(84vw, 288px);
        height: 100vh;
        height: 100dvh;
        max-height: 100vh;
        max-height: 100dvh;
        overflow: hidden;
        transform: translateX(-102%);
        box-shadow: 14px 0 35px rgba(15, 23, 42, 0.16);
    }

    body.sidebar-mobile-open .sidebar {
        transform: translateX(0);
    }

    body.sidebar-collapsed .sidebar-inner {
        padding: 0.9rem 0.75rem !important;
    }

    .sidebar-nav {
        flex-direction: column !important;
        flex-wrap: nowrap !important;
    }

    .sidebar-link {
        flex: 0 0 auto;
        width: 100%;
    }

    body.sidebar-collapsed .sidebar-brand-main,
    body.sidebar-collapsed .sidebar-link,
    body.sidebar-collapsed .sidebar-action-btn,
    body.sidebar-collapsed .sidebar-user-profile {
        justify-content: flex-start;
    }

    body.sidebar-collapsed .sidebar-brand-copy,
    body.sidebar-collapsed .sidebar-link-label,
    body.sidebar-collapsed .sidebar-action-label,
    body.sidebar-collapsed .sidebar-user-copy {
        display: block;
    }

    .sidebar-close-btn {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        width: 32px;
        height: 32px;
        padding: 0;
        color: #667386;
        border: 0;
        border-radius: 0.42rem;
        background: transparent;
    }

    .sidebar-collapse-btn {
        display: none;
    }

    .sidebar-backdrop {
        position: fixed;
        z-index: 1040;
        inset: 0;
        width: 100%;
        height: 100%;
        padding: 0;
        border: 0;
        background: rgba(15, 23, 42, 0.38);
        opacity: 0;
        visibility: hidden;
        transition: opacity 180ms ease, visibility 180ms ease;
    }

    body.sidebar-mobile-open .sidebar-backdrop {
        display: block;
        opacity: 1;
        visibility: visible;
    }

    .header-menu-btn {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        width: 36px;
        min-width: 36px;
        height: 36px;
        padding: 0;
        color: #3d495b;
        border: 1px solid var(--ui-border-soft);
        border-radius: 0.5rem;
        background: #ffffff;
        font-size: 1.2rem;
    }

    .app-main {
        width: 100%;
        height: 100vh;
        height: 100dvh;
        max-height: 100vh;
        max-height: 100dvh;
        overflow: hidden;
    }

    .app-header {
        flex-direction: row;
        align-items: center;
        min-height: 64px;
        padding: 0.65rem 1rem;
    }

    .app-header-actions {
        width: auto;
        margin-left: auto;
    }

    .header-support-actions {
        width: auto;
    }

    .header-live-clock {
        display: none;
    }

    .app-content {
        overflow-y: auto;
        overflow-x: hidden;
    }

    .app-footer {
        flex-direction: row;
        align-items: center;
    }
}

@media (max-width: 767.98px) {
    .app-header {
        min-height: 58px;
        padding: 0.55rem 0.75rem;
    }

    .header-page-title {
        max-width: 58vw;
        margin-bottom: 0 !important;
        overflow: hidden;
        font-size: 0.94rem;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .header-school-line {
        display: none;
    }

    .header-support-actions {
        gap: 0.35rem;
    }

    .header-help-btn {
        min-width: 0;
        padding-right: 0.55rem;
        padding-left: 0.55rem;
        font-size: 0.72rem;
    }

    .app-content {
        padding: 0.8rem;
    }

    .app-footer {
        padding: 0.5rem 0.8rem;
        font-size: 0.66rem;
    }

    .app-main .card-header,
    .auth-shell .card-header,
    .modal-header {
        padding: 0.7rem 0.8rem;
    }

    .app-main .card-body {
        padding: 0.9rem;
    }

    .dashboard-kpi-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .platform-signal-grid {
        grid-template-columns: 1fr;
    }

    .platform-chart-panel,
    .platform-chart-panel-lg,
    .platform-chart-panel-tall {
        height: 270px;
    }

    .platform-chart-panel-doughnut,
    .platform-chart-panel-compact {
        height: 240px;
    }

    .platform-admin-hero .card-body > div:last-child {
        width: 100%;
    }

    .platform-updated {
        width: 100%;
    }
}

@media (max-width: 575.98px) {
    .app-footer {
        display: none;
    }

    .dashboard-kpi-grid {
        grid-template-columns: 1fr;
    }

    .dashboard-kpi-value {
        font-size: 1.45rem;
    }

    .platform-chart-panel,
    .platform-chart-panel-lg,
    .platform-chart-panel-tall {
        height: 245px;
    }

    .platform-region-table {
        min-width: 520px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .sidebar,
    .sidebar-backdrop {
        transition: none;
    }
}

body.theme-dark .app-main,
body.theme-dark .app-content {
    background: #0d1629;
}

body.theme-dark .sidebar {
    color: #dbe7fb;
    background: #111b30 !important;
    border-right-color: #273a57;
}

body.theme-dark .sidebar-title,
body.theme-dark .sidebar-user-copy,
body.theme-dark .platform-signal-card strong {
    color: #dbe7fb;
}

body.theme-dark .sidebar-subtitle,
body.theme-dark .sidebar-user-copy .text-muted {
    color: #9fb0c8 !important;
}

body.theme-dark .sidebar-link,
body.theme-dark .sidebar-action-btn {
    color: #b8c7db;
}

body.theme-dark .sidebar-link:hover,
body.theme-dark .sidebar-action-btn:hover {
    color: #e6effc;
    background: #1a2a45;
}

body.theme-dark .sidebar-link.active {
    color: #b9dcff;
    background: #1b3858;
}

body.theme-dark .sidebar-user,
body.theme-dark .sidebar-logo-shell {
    border-color: #2b405f !important;
}

body.theme-dark .sidebar-avatar {
    color: #c9d7ea;
    background: #223451;
}

body.theme-dark .app-header,
body.theme-dark .app-header-glass,
body.theme-dark .app-footer {
    background: #111b30;
}

body.theme-dark .platform-signal-card,
body.theme-dark .platform-notification-list .list-group-item,
body.theme-dark .dashboard-kpi-card,
body.theme-dark .platform-admin-hero {
    background: #14213a;
}

@media (prefers-color-scheme: dark) {
    body.theme-system .app-main,
    body.theme-system .app-content {
        background: #0d1629;
    }

    body.theme-system .sidebar {
        color: #dbe7fb;
        background: #111b30 !important;
        border-right-color: #273a57;
    }

    body.theme-system .sidebar-title,
    body.theme-system .sidebar-user-copy,
    body.theme-system .platform-signal-card strong {
        color: #dbe7fb;
    }

    body.theme-system .sidebar-subtitle,
    body.theme-system .sidebar-user-copy .text-muted {
        color: #9fb0c8 !important;
    }

    body.theme-system .sidebar-link,
    body.theme-system .sidebar-action-btn {
        color: #b8c7db;
    }

    body.theme-system .sidebar-link:hover,
    body.theme-system .sidebar-action-btn:hover {
        color: #e6effc;
        background: #1a2a45;
    }

    body.theme-system .sidebar-link.active {
        color: #b9dcff;
        background: #1b3858;
    }

    body.theme-system .sidebar-user,
    body.theme-system .sidebar-logo-shell {
        border-color: #2b405f !important;
    }

    body.theme-system .sidebar-avatar {
        color: #c9d7ea;
        background: #223451;
    }

    body.theme-system .app-header,
    body.theme-system .app-header-glass,
    body.theme-system .app-footer {
        background: #111b30;
    }
}

/* Full-width application header and restrained analytics visuals. */
.app-shell {
    display: flex;
    flex-direction: column;
}

.app-header {
    position: relative;
    z-index: 1060;
    display: flex;
    align-items: stretch;
    width: 100%;
    min-height: 72px;
    padding: 0;
    flex: 0 0 72px;
}

.app-topbar-brand {
    display: flex;
    align-items: center;
    width: var(--sidebar-width);
    min-width: var(--sidebar-width);
    gap: 0.7rem;
    padding: 0.35rem 1rem;
    overflow: hidden;
    border-right: 0;
    transition: width 180ms ease, min-width 180ms ease;
}

.app-topbar-logo {
    display: block;
    width: 54px;
    min-width: 54px;
    height: 58px;
    object-fit: contain;
    object-position: center;
    background: transparent;
    border: 0;
    border-radius: 0;
    box-shadow: none;
    transform: scale(1.12);
    transform-origin: center;
}

.app-topbar-brand-copy {
    min-width: 0;
    line-height: 1.2;
}

.app-topbar-brand-copy strong,
.app-topbar-brand-copy span {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.app-topbar-brand-copy strong {
    color: var(--ui-text);
    font-size: 0.94rem;
    font-weight: 700;
    letter-spacing: 0.025em;
}

.app-topbar-brand-copy span {
    margin-top: 0.12rem;
    color: var(--ui-text-muted);
    font-size: 0.7rem;
}

.app-header-main {
    display: flex;
    align-items: center;
    min-width: 0;
    gap: 0.85rem;
    padding: 0.78rem 1.5rem;
    flex: 1 1 auto;
}

.app-workspace {
    display: flex;
    width: 100%;
    min-height: 0;
    overflow: hidden;
    flex: 1 1 auto;
}

.app-workspace .sidebar,
.app-workspace .app-main {
    height: 100%;
    max-height: none;
}

.app-workspace .sidebar {
    position: relative;
    top: auto;
}

.app-workspace .app-main {
    flex: 1 1 auto;
}

.sidebar-mobile-head {
    display: none;
}

body.sidebar-collapsed .app-topbar-brand {
    width: var(--sidebar-collapsed-width);
    min-width: var(--sidebar-collapsed-width);
    justify-content: center;
    padding-right: 0.45rem;
    padding-left: 0.45rem;
}

body.sidebar-collapsed .app-topbar-brand-copy {
    display: none;
}

body.sidebar-collapsed .app-topbar-logo {
    width: 45px;
    min-width: 45px;
}

.platform-kpi-icon,
.platform-signal-icon,
.platform-chart-empty-icon {
    width: auto;
    min-width: 0;
    height: auto;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent !important;
    box-shadow: none;
}

.platform-kpi-icon {
    color: #52779c;
    font-size: 1.08rem;
    line-height: 1;
}

.platform-signal-icon {
    width: 1.35rem;
    min-width: 1.35rem;
    color: #64748b;
    font-size: 1.12rem;
    line-height: 1;
    text-align: center;
}

.platform-signal-icon.is-blue { color: #2563a7; }
.platform-signal-icon.is-green { color: #2f7d5c; }
.platform-signal-icon.is-amber { color: #9a681c; }
.platform-signal-icon.is-red { color: #a34240; }
.platform-signal-icon.is-slate { color: #64748b; }

.platform-chart-panel canvas {
    max-width: 100%;
}

.platform-chart-empty {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    padding: 1.25rem;
    color: var(--ui-text-muted);
    text-align: center;
}

.platform-chart-empty-icon {
    margin-bottom: 0.7rem;
    color: #718096;
    font-size: 1.55rem;
    line-height: 1;
}

.platform-chart-empty strong {
    color: #354154;
    font-size: 0.84rem;
    font-weight: 650;
}

.platform-chart-empty > span:last-child {
    max-width: 330px;
    margin-top: 0.3rem;
    color: #7a8596;
    font-size: 0.72rem;
    line-height: 1.45;
}

@media (max-width: 991.98px) {
    .app-shell {
        flex-direction: column;
    }

    .app-header {
        min-height: 64px;
        padding: 0;
        flex: 0 0 64px;
    }

    .app-topbar-brand,
    body.sidebar-collapsed .app-topbar-brand {
        width: 68px;
        min-width: 68px;
        justify-content: center;
        padding: 0.2rem 0.45rem;
    }

    .app-topbar-brand-copy,
    body.sidebar-collapsed .app-topbar-brand-copy {
        display: none;
    }

    .app-topbar-logo,
    body.sidebar-collapsed .app-topbar-logo {
        width: 45px;
        min-width: 45px;
        height: 52px;
        transform: scale(1.08);
    }

    .app-header-main {
        padding: 0.6rem 0.85rem;
    }

    .app-workspace {
        height: calc(100vh - 64px);
        height: calc(100dvh - 64px);
    }

    .app-workspace .sidebar,
    body.sidebar-collapsed .app-workspace .sidebar {
        position: fixed;
        top: 64px;
        height: calc(100vh - 64px);
        height: calc(100dvh - 64px);
        max-height: calc(100vh - 64px);
        max-height: calc(100dvh - 64px);
    }

    .app-workspace .app-main {
        width: 100%;
        height: 100%;
        max-height: 100%;
    }

    .sidebar-mobile-head {
        display: flex;
        align-items: center;
        justify-content: space-between;
        min-height: 42px;
        margin-bottom: 0.45rem;
        padding: 0 0.55rem 0.55rem;
        color: var(--ui-text-muted);
        border-bottom: 1px solid var(--ui-border-soft);
        font-size: 0.72rem;
        font-weight: 700;
        letter-spacing: 0.06em;
        text-transform: uppercase;
    }

    .sidebar-backdrop {
        top: 64px;
        height: calc(100vh - 64px);
        height: calc(100dvh - 64px);
    }
}

@media (max-width: 767.98px) {
    .app-header {
        min-height: 60px;
        flex-basis: 60px;
    }

    .app-topbar-brand,
    body.sidebar-collapsed .app-topbar-brand {
        width: 58px;
        min-width: 58px;
    }

    .app-topbar-logo,
    body.sidebar-collapsed .app-topbar-logo {
        width: 40px;
        min-width: 40px;
        height: 48px;
        transform: scale(1.05);
    }

    .app-header-main {
        gap: 0.6rem;
        padding: 0.5rem 0.7rem;
    }

    .app-workspace {
        height: calc(100vh - 60px);
        height: calc(100dvh - 60px);
    }

    .app-workspace .sidebar,
    body.sidebar-collapsed .app-workspace .sidebar {
        top: 60px;
        height: calc(100vh - 60px);
        height: calc(100dvh - 60px);
        max-height: calc(100vh - 60px);
        max-height: calc(100dvh - 60px);
    }

    .sidebar-backdrop {
        top: 60px;
        height: calc(100vh - 60px);
        height: calc(100dvh - 60px);
    }

    .platform-chart-empty {
        padding: 1rem;
    }
}

@media (max-width: 575.98px) {
    .header-support-actions {
        display: none;
    }
}

body.theme-dark .app-topbar-brand,
body.theme-dark .sidebar-mobile-head {
    border-color: #273a57;
}

body.theme-dark .app-topbar-brand-copy strong,
body.theme-dark .platform-chart-empty strong {
    color: #dbe7fb;
}

body.theme-dark .app-topbar-brand-copy span,
body.theme-dark .platform-chart-empty > span:last-child {
    color: #9fb0c8;
}

@media (prefers-color-scheme: dark) {
    body.theme-system .app-topbar-brand,
    body.theme-system .sidebar-mobile-head {
        border-color: #273a57;
    }

    body.theme-system .app-topbar-brand-copy strong,
    body.theme-system .platform-chart-empty strong {
        color: #dbe7fb;
    }

    body.theme-system .app-topbar-brand-copy span,
    body.theme-system .platform-chart-empty > span:last-child {
        color: #9fb0c8;
    }
}

/* Consistent table pagination for tenant and platform directories. */
.table-pagination {
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 56px;
    gap: 1rem;
    padding: 0.65rem 1rem;
    color: #6b778c;
    border-top: 1px solid var(--ui-border-soft);
    background: #ffffff;
    font-size: 0.75rem;
}

.table-pagination-summary {
    white-space: nowrap;
}

.table-pagination-summary strong {
    color: #354154;
    font-weight: 650;
}

.table-pagination-pages {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.2rem;
}

.table-page-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 32px;
    gap: 0.3rem;
    padding: 0.35rem 0.55rem;
    color: #526174;
    border: 1px solid transparent;
    border-radius: 0.42rem;
    background: transparent;
    font-weight: 600;
    line-height: 1;
    text-decoration: none;
}

.table-page-link:hover,
.table-page-link:focus {
    color: #1f67a8;
    border-color: #d7e2ec;
    background: #f7fafc;
}

.table-page-link.active {
    color: #ffffff;
    border-color: #2563a7;
    background: #2563a7;
}

.table-page-link.disabled {
    color: #a6afbb;
    pointer-events: none;
}

.table-page-number {
    width: 32px;
    padding-right: 0.25rem;
    padding-left: 0.25rem;
}

.table-page-size {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    white-space: nowrap;
}

.table-page-size label {
    margin: 0;
    color: #6b778c;
    font-weight: 600;
}

.table-page-size .form-select {
    width: 72px;
    min-height: 32px;
    padding-top: 0.25rem;
    padding-bottom: 0.25rem;
}

@media (max-width: 767.98px) {
    .table-pagination {
        align-items: stretch;
        flex-wrap: wrap;
        gap: 0.6rem;
        padding: 0.65rem 0.8rem;
    }

    .table-pagination-summary {
        order: 1;
    }

    .table-page-size {
        order: 2;
        margin-left: auto;
    }

    .table-pagination-pages {
        width: 100%;
        order: 3;
    }
}

@media (max-width: 479.98px) {
    .table-page-link > span {
        display: none;
    }

    .table-pagination-pages {
        justify-content: space-between;
    }
}

body.theme-dark .table-pagination {
    color: #9fb0c8;
    border-color: #273a57;
    background: #14213a;
}

body.theme-dark .table-pagination-summary strong {
    color: #dbe7fb;
}

body.theme-dark .table-page-link {
    color: #b8c7db;
}

body.theme-dark .table-page-link:hover,
body.theme-dark .table-page-link:focus {
    color: #b9dcff;
    border-color: #334a69;
    background: #1a2a45;
}

@media (prefers-color-scheme: dark) {
    body.theme-system .table-pagination {
        color: #9fb0c8;
        border-color: #273a57;
        background: #14213a;
    }

    body.theme-system .table-pagination-summary strong {
        color: #dbe7fb;
    }
}

/* Client workspace theme tokens keep every panel consistent in dark mode. */
body.theme-dark {
    --client-bg: #0b1424;
    --client-surface: #121f34;
    --client-surface-alt: #17263f;
    --client-input: #0e1a2e;
    --client-border: #2b405f;
    --client-border-strong: #3a5477;
    --client-text: #dbe7fb;
    --client-muted: #9fb0c8;
    --client-hover: #1a2a45;
}

@media (prefers-color-scheme: dark) {
    body.theme-system {
        --client-bg: #0b1424;
        --client-surface: #121f34;
        --client-surface-alt: #17263f;
        --client-input: #0e1a2e;
        --client-border: #2b405f;
        --client-border-strong: #3a5477;
        --client-text: #dbe7fb;
        --client-muted: #9fb0c8;
        --client-hover: #1a2a45;
    }
}

body.app-bg .app-main,
body.app-bg .app-content {
    color: var(--client-text, var(--ui-text));
    background: var(--client-bg, #f7f8fa);
}

body.app-bg .app-header,
body.app-bg .app-header-glass,
body.app-bg .app-footer {
    color: var(--client-text, var(--ui-text));
    border-color: var(--client-border, var(--ui-border-soft));
    background: var(--client-surface, #ffffff);
}

body.app-bg .app-topbar-brand {
    border-color: var(--client-border, var(--ui-border-soft));
}

body.app-bg .app-main .card,
body.app-bg .modal-content,
body.app-bg .dashboard-filters,
body.app-bg .register-hero,
body.app-bg .rollover-hero,
body.app-bg .claims-hero,
body.app-bg .rates-hero,
body.app-bg .periods-hero,
body.app-bg .archive-hero,
body.app-bg .users-hero,
body.app-bg .settings-hero,
body.app-bg .platform-admin-hero {
    color: var(--client-text, var(--ui-text));
    border-color: var(--client-border, var(--ui-border-soft));
    background: var(--client-surface, #ffffff);
}

body.app-bg .app-main .card-header,
body.app-bg .modal-header,
body.app-bg .modal-footer {
    color: var(--client-text, var(--ui-text));
    border-color: var(--client-border, var(--ui-border-soft));
    background: var(--client-surface-alt, #ffffff);
}

body.app-bg .dashboard-kpi-card,
body.app-bg .claims-kpi-card,
body.app-bg .rates-kpi-card,
body.app-bg .periods-kpi-card,
body.app-bg .archive-kpi-card,
body.app-bg .users-kpi-card,
body.app-bg .settings-kpi-card,
body.app-bg .register-metric,
body.app-bg .rollover-metric,
body.app-bg .import-summary-item,
body.app-bg .rollover-summary-item,
body.app-bg .platform-signal-card,
body.app-bg .archive-flow-step,
body.app-bg .periods-flow-step,
body.app-bg .users-role-chip,
body.app-bg .periods-help,
body.app-bg .settings-side-item {
    color: var(--client-text, var(--ui-text));
    border-color: var(--client-border, var(--ui-border-soft));
    background: var(--client-surface, #ffffff);
}

body.app-bg .dashboard-kpi-value,
body.app-bg .claims-kpi-value,
body.app-bg .rates-kpi-value,
body.app-bg .periods-kpi-value,
body.app-bg .archive-kpi-value,
body.app-bg .users-kpi-value,
body.app-bg .settings-kpi-value,
body.app-bg .register-metric-value,
body.app-bg .rollover-metric-value,
body.app-bg .platform-signal-card strong,
body.app-bg .app-main h1,
body.app-bg .app-main h2,
body.app-bg .app-main h3,
body.app-bg .app-main h4,
body.app-bg .app-main h5,
body.app-bg .app-main h6 {
    color: var(--client-text, var(--ui-text));
}

body.app-bg .text-muted,
body.app-bg .form-text,
body.app-bg .small.text-muted,
body.app-bg .dashboard-kpi-label,
body.app-bg .claims-kpi-label,
body.app-bg .rates-kpi-label,
body.app-bg .periods-kpi-label,
body.app-bg .archive-kpi-label,
body.app-bg .users-kpi-label,
body.app-bg .settings-kpi-label,
body.app-bg .register-metric-label,
body.app-bg .rollover-metric-label {
    color: var(--client-muted, var(--ui-text-muted)) !important;
}

body.app-bg .app-main .form-label,
body.app-bg .app-main .form-check-label {
    color: var(--client-text, var(--ui-text));
}

body.app-bg .app-main .form-control,
body.app-bg .app-main .form-select,
body.app-bg .app-main .input-group-text,
body.app-bg .modal-content .form-control,
body.app-bg .modal-content .form-select {
    color: var(--client-text, var(--ui-text));
    border-color: var(--client-border-strong, var(--ui-border-strong));
    background-color: var(--client-input, #ffffff);
}

body.app-bg .app-main .form-control::placeholder {
    color: var(--client-muted, #8792a2);
    opacity: 0.8;
}

body.theme-dark .app-main .form-control:-webkit-autofill,
body.theme-dark .app-main .form-control:-webkit-autofill:hover,
body.theme-dark .app-main .form-control:-webkit-autofill:focus {
    -webkit-text-fill-color: var(--client-text);
    -webkit-box-shadow: 0 0 0 1000px var(--client-input) inset !important;
    box-shadow: 0 0 0 1000px var(--client-input) inset !important;
    caret-color: var(--client-text);
    transition: background-color 9999s ease-out 0s;
}

body.app-bg .app-main .form-control:disabled,
body.app-bg .app-main .form-control[readonly],
body.app-bg .app-main .form-select:disabled {
    color: var(--client-muted, #778295);
    background: var(--client-surface-alt, #eef1f4);
}

body.app-bg .app-main .table,
body.app-bg .app-main .table > :not(caption) > * > * {
    color: var(--client-text, var(--ui-text));
    border-color: var(--client-border, var(--ui-border-soft));
    background-color: transparent;
}

body.app-bg .app-main .table thead th {
    color: var(--client-muted, #657184) !important;
    background: var(--client-surface-alt, #f8fafb) !important;
}

body.app-bg .app-main .table tbody tr:hover {
    background: var(--client-hover, #fafbfd);
}

body.app-bg .app-main .list-group-item,
body.app-bg .app-main .dropdown-menu,
body.app-bg .app-main .accordion-item,
body.app-bg .app-main .bg-light,
body.app-bg .settings-snapshot-item,
body.app-bg .settings-help {
    color: var(--client-text, var(--ui-text)) !important;
    border-color: var(--client-border, var(--ui-border-soft)) !important;
    background: var(--client-surface-alt, #f8f9fa) !important;
}

body.theme-dark .app-main .btn-outline-primary,
body.theme-dark .app-main .btn-outline-secondary,
body.theme-dark .app-main .btn-light,
body.theme-dark .header-wa-btn {
    color: #b9dcff;
    border-color: #48698d;
    background: transparent;
}

body.theme-dark .app-main .btn-outline-primary:hover,
body.theme-dark .app-main .btn-outline-secondary:hover,
body.theme-dark .app-main .btn-light:hover,
body.theme-dark .header-wa-btn:hover {
    color: #ffffff;
    border-color: #5d82a9;
    background: #203653;
}

body.theme-dark .pin-badge,
body.theme-dark .grade-tag,
body.theme-dark .period-status,
body.theme-dark .user-role-pill,
body.theme-dark .user-status-pill,
body.theme-dark .user-flag-pill,
body.theme-dark .status-pill {
    border-color: #3a5477;
    background: #1a2a45;
}

body.theme-dark .grade-chip:not(.active) {
    color: var(--client-text);
    border-color: var(--client-border);
    background: var(--client-surface-alt);
}

body.theme-dark .grade-chip:not(.active) .grade-chip-count {
    color: var(--client-muted);
    background: rgba(159, 176, 200, 0.14);
}

body.theme-dark .import-upload-progress,
body.theme-dark .import-upload-progress .progress {
    color: var(--client-text);
    border-color: var(--client-border);
    background: var(--client-surface-alt);
}

body.theme-dark .builder-meta-item,
body.theme-dark .claims-empty-period,
body.theme-dark .manual-learner-list,
body.theme-dark .manual-learner-option {
    color: var(--client-text);
    border-color: var(--client-border);
    background: var(--client-surface-alt);
}

body.theme-dark .builder-meta-item span {
    color: var(--client-muted);
}

body.theme-dark .builder-meta-item strong {
    color: var(--client-text);
}

body.theme-dark .dashboard-live-badge.is-live,
body.theme-dark .dashboard-live-badge.is-error {
    color: #fecaca;
    border-color: #7f1d1d;
    background: #3f1720;
}

body.theme-dark .dashboard-live-badge.is-pending {
    color: #fde68a;
    border-color: #854d0e;
    background: #3b2b13;
}

body.theme-dark .dashboard-live-badge.is-manual {
    color: var(--client-muted);
    border-color: var(--client-border);
    background: var(--client-surface-alt);
}

@media (prefers-color-scheme: dark) {
    body.theme-system .app-main .btn-outline-primary,
    body.theme-system .app-main .btn-outline-secondary,
    body.theme-system .app-main .btn-light,
    body.theme-system .header-wa-btn {
        color: #b9dcff;
        border-color: #48698d;
        background: transparent;
    }

    body.theme-system .app-main .form-control:-webkit-autofill,
    body.theme-system .app-main .form-control:-webkit-autofill:hover,
    body.theme-system .app-main .form-control:-webkit-autofill:focus {
        -webkit-text-fill-color: var(--client-text);
        -webkit-box-shadow: 0 0 0 1000px var(--client-input) inset !important;
        box-shadow: 0 0 0 1000px var(--client-input) inset !important;
        caret-color: var(--client-text);
        transition: background-color 9999s ease-out 0s;
    }

    body.theme-system .grade-chip:not(.active),
    body.theme-system .builder-meta-item,
    body.theme-system .claims-empty-period,
    body.theme-system .manual-learner-list,
    body.theme-system .manual-learner-option,
    body.theme-system .import-upload-progress,
    body.theme-system .import-upload-progress .progress {
        color: var(--client-text);
        border-color: var(--client-border);
        background: var(--client-surface-alt);
    }

    body.theme-system .grade-chip:not(.active) .grade-chip-count,
    body.theme-system .builder-meta-item span {
        color: var(--client-muted);
    }

    body.theme-system .grade-chip:not(.active) .grade-chip-count {
        background: rgba(159, 176, 200, 0.14);
    }

    body.theme-system .builder-meta-item strong {
        color: var(--client-text);
    }

    body.theme-system .dashboard-live-badge.is-live,
    body.theme-system .dashboard-live-badge.is-error {
        color: #fecaca;
        border-color: #7f1d1d;
        background: #3f1720;
    }

    body.theme-system .dashboard-live-badge.is-pending {
        color: #fde68a;
        border-color: #854d0e;
        background: #3b2b13;
    }

    body.theme-system .dashboard-live-badge.is-manual {
        color: var(--client-muted);
        border-color: var(--client-border);
        background: var(--client-surface-alt);
    }
}

/* Keep toast geometry above later workspace utility rules. */
.app-content > .flash-toast-region,
.flash-toast-region {
    width: min(30rem, calc(100vw - 2rem));
    margin: 0;
}

.flash-toast-region .flash-toast {
    box-shadow: 0 18px 42px rgba(21, 39, 65, 0.18), 0 3px 10px rgba(21, 39, 65, 0.08);
}

@media (max-width: 767.98px) {
    .app-content > .flash-toast-region,
    .flash-toast-region {
        width: auto;
        margin: 0;
    }
}

.platform-user-delete-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.28rem 0.34rem;
    color: #a23b3b;
    border: 0;
    border-radius: 0.4rem;
    background: transparent;
    font-size: 0.76rem;
    font-weight: 650;
    line-height: 1.2;
    transition: color 150ms ease, background-color 150ms ease;
}

.platform-user-delete-btn:hover,
.platform-user-delete-btn:focus-visible {
    color: #7f1d1d;
    background: #fff0f0;
    outline: none;
}

/* Guided school workflow */
.workflow-eyebrow {
    margin-bottom: 0.35rem;
    color: var(--client-muted, #68768b);
    font-size: 0.72rem;
    font-weight: 750;
    letter-spacing: 0.09em;
    text-transform: uppercase;
}

.workflow-hero {
    overflow: hidden;
    border-color: var(--client-border, #dfe5ec);
    background: var(--client-surface, #fff);
}

.workflow-mini-stats {
    display: flex;
    flex-wrap: wrap;
    gap: 0.55rem;
}

.workflow-mini-stats span {
    padding: 0.52rem 0.7rem;
    border: 1px solid var(--client-border, #dfe5ec);
    border-radius: 0.65rem;
    background: var(--client-surface, #fff);
    color: var(--client-muted, #68768b);
    font-size: 0.8rem;
}

.workflow-mini-stats strong {
    color: var(--client-text, #15243a);
}

.workflow-tabs {
    display: flex;
    gap: 0.35rem;
    padding: 0.3rem;
    width: fit-content;
    border: 1px solid var(--client-border, #dfe5ec);
    border-radius: 0.75rem;
    background: var(--client-surface-alt, #f7f9fb);
}

.workflow-tab {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.55rem 0.8rem;
    border-radius: 0.55rem;
    color: var(--client-muted, #637086);
    font-size: 0.86rem;
    font-weight: 700;
    text-decoration: none;
}

.workflow-tab:hover,
.workflow-tab.active {
    color: #fff;
    background: #276db1;
}

.workflow-step-number,
.claim-journey-marker {
    display: inline-grid;
    place-items: center;
    width: 2.15rem;
    height: 2.15rem;
    border-radius: 999px;
    background: #276db1;
    color: #fff;
    font-size: 0.88rem;
    font-weight: 800;
}

.workflow-step-number {
    margin-bottom: 0.75rem;
}

.workflow-empty-card .card-body > p {
    max-width: 38rem;
}

.workflow-empty-inline {
    padding: 1rem;
    border: 1px dashed var(--client-border-strong, #cbd5e1);
    border-radius: 0.75rem;
    background: var(--client-surface-alt, #f8fafc);
}

.claim-cycle-card {
    border-color: rgba(39, 109, 177, 0.2);
}

.claim-cycle-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 1rem 1.15rem;
}

.claim-journey-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1rem;
}

.claim-journey-step {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    gap: 0.8rem;
    padding: 1rem;
    min-height: 9rem;
    border: 1px solid var(--client-border, #dfe5ec);
    border-radius: 0.8rem;
    background: var(--client-surface-alt, #f8fafc);
}

.claim-journey-step.is-active {
    border-color: rgba(217, 164, 46, 0.55);
    background: rgba(217, 164, 46, 0.07);
}

.claim-journey-step.is-complete {
    border-color: rgba(47, 133, 90, 0.4);
    background: rgba(47, 133, 90, 0.07);
}

.claim-journey-step.is-complete .claim-journey-marker {
    background: #2f855a;
}

.claim-journey-copy {
    min-width: 0;
}

.claim-cycle-footer {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 0.8rem;
    margin-top: 1rem;
    padding-top: 0.8rem;
    border-top: 1px solid var(--client-border, #dfe5ec);
}

.home-next-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(14rem, 19rem);
    align-items: start;
    gap: 1.5rem;
}

.home-progress-card {
    padding-left: 1.25rem;
    border-left: 1px solid var(--client-border, #dfe5ec);
}

.home-progress-step {
    display: grid;
    grid-template-columns: 1.65rem 1fr;
    align-items: center;
    gap: 0.55rem;
    padding: 0.35rem 0;
    color: var(--client-muted, #68768b);
    font-size: 0.82rem;
}

.home-progress-step > span {
    display: grid;
    place-items: center;
    width: 1.45rem;
    height: 1.45rem;
    border: 1px solid var(--client-border-strong, #cbd5e1);
    border-radius: 999px;
    font-size: 0.7rem;
    font-weight: 800;
}

.home-progress-step.is-complete {
    color: var(--client-text, #15243a);
}

.home-progress-step.is-complete > span {
    color: #fff;
    border-color: #2f855a;
    background: #2f855a;
}

.home-summary-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 0.8rem;
}

.home-summary-card {
    display: grid;
    gap: 0.35rem;
    padding: 1rem;
    border: 1px solid var(--client-border, #dfe5ec);
    border-radius: 0.8rem;
    background: var(--client-surface, #fff);
}

.home-summary-card > span {
    color: var(--client-muted, #68768b);
    font-size: 0.78rem;
    font-weight: 700;
    text-transform: uppercase;
}

.home-summary-card > strong {
    color: var(--client-text, #15243a);
    font-size: 1.45rem;
}

.home-summary-card > a {
    color: #276db1;
    font-size: 0.78rem;
    font-weight: 700;
    text-decoration: none;
}

.home-rollover-card {
    border-color: rgba(217, 164, 46, 0.38);
    background: rgba(217, 164, 46, 0.06);
}

.home-analytics-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.1fr) minmax(15rem, 0.75fr) minmax(0, 1.1fr);
    gap: 0.9rem;
}

.home-report-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
}

.home-report-header small {
    display: block;
    margin-top: 0.15rem;
    color: var(--client-muted, #68768b);
    font-weight: 400;
}

.home-timeframe-form {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.home-timeframe-form label {
    margin-right: 0.1rem;
    color: var(--client-muted, #68768b);
    font-size: 0.78rem;
    font-weight: 700;
}

.home-timeframe-form .form-select {
    width: 10rem;
}

.home-chart-panel {
    min-width: 0;
    height: 17rem;
    padding: 0.9rem;
    border: 1px solid var(--client-border, #dfe5ec);
    border-radius: 0.75rem;
    background: var(--client-surface-alt, #f8fafc);
}

.home-chart-heading {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 0.75rem;
    height: 1.5rem;
}

.home-chart-heading h3 {
    margin-bottom: 0;
}

.home-chart-heading span {
    color: var(--client-muted, #68768b);
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
}

.home-chart-panel canvas {
    max-height: calc(100% - 1.5rem);
}

.home-chart-empty {
    display: grid;
    place-items: center;
    height: calc(100% - 1.5rem);
    padding: 1rem;
    color: var(--client-muted, #68768b);
    text-align: center;
    font-size: 0.86rem;
}

/* Milestone actions receive a restrained, accessible attention pulse. */
.btn-attention {
    --attention-rgb: var(--bs-primary-rgb);
    animation: button-attention-pulse 2.8s ease-in-out infinite;
}

.btn-warning.btn-attention {
    --attention-rgb: 217, 164, 46;
}

.claim-cycle-footer .btn-attention {
    min-width: 9.5rem;
    font-weight: 700;
}

@keyframes button-attention-pulse {
    0%, 100% {
        box-shadow: 0 0 0 0 rgba(var(--attention-rgb), 0), 0 2px 5px rgba(15, 35, 64, 0.08);
    }
    50% {
        box-shadow: 0 0 0 0.32rem rgba(var(--attention-rgb), 0.16), 0 7px 18px rgba(var(--attention-rgb), 0.2);
    }
}

/* Modern school settings */
.settings-page-heading {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.15rem 0.15rem 0.35rem;
}

.settings-verified-pill,
.settings-lock-label {
    display: inline-flex;
    align-items: center;
    width: fit-content;
    border-radius: 999px;
    font-size: 0.72rem;
    font-weight: 750;
    white-space: nowrap;
}

.settings-verified-pill {
    padding: 0.42rem 0.7rem;
    color: #216a4a;
    border: 1px solid rgba(47, 133, 90, 0.3);
    background: rgba(47, 133, 90, 0.08);
}

.settings-modern-grid {
    display: grid;
    grid-template-columns: minmax(17rem, 0.72fr) minmax(0, 1.55fr);
    gap: 1rem;
    align-items: stretch;
}

.settings-modern-card {
    overflow: hidden;
    border-color: var(--client-border, #dfe5ec);
    border-radius: 0.9rem;
    background: var(--client-surface, #fff);
    box-shadow: 0 8px 24px rgba(25, 49, 82, 0.05);
}

.settings-profile-card {
    background:
        linear-gradient(160deg, rgba(39, 109, 177, 0.09), rgba(39, 109, 177, 0) 48%),
        var(--client-surface, #fff);
}

.settings-section-heading {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
}

.settings-section-kicker {
    margin-bottom: 0.25rem;
    color: #276db1;
    font-size: 0.7rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.settings-lock-label {
    padding: 0.32rem 0.55rem;
    color: var(--client-muted, #68768b);
    border: 1px solid var(--client-border, #dfe5ec);
    background: var(--client-surface-alt, #f8fafc);
}

.settings-identity-list {
    display: grid;
    gap: 0.75rem;
}

.settings-identity-list > div {
    padding: 0.9rem;
    border: 1px solid var(--client-border, #dfe5ec);
    border-radius: 0.72rem;
    background: var(--client-surface, #fff);
}

.settings-identity-list dt {
    margin-bottom: 0.25rem;
    color: var(--client-muted, #68768b);
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.settings-identity-list dd {
    margin: 0;
    color: var(--client-text, #15243a);
    font-size: 1rem;
    font-weight: 700;
}

.settings-identity-list .settings-code-value {
    font-size: 1.3rem;
    letter-spacing: 0.08em;
}

.settings-fieldset {
    margin: 0 0 1.35rem;
    padding: 0;
    border: 0;
}

.settings-fieldset legend,
.settings-fieldset > .form-label,
.settings-security-form .form-label {
    margin-bottom: 0.55rem;
    color: var(--client-text, #15243a);
    font-size: 0.8rem;
    font-weight: 750;
}

.settings-choice-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.65rem;
}

.settings-choice-grid-three {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.settings-choice {
    display: grid;
    gap: 0.18rem;
    min-width: 0;
    padding: 0.8rem;
    border: 1px solid var(--client-border, #dfe5ec);
    border-radius: 0.72rem;
    background: var(--client-surface-alt, #f8fafc);
    cursor: pointer;
    transition: border-color 160ms ease, background-color 160ms ease, box-shadow 160ms ease;
}

.settings-choice strong {
    color: var(--client-text, #15243a);
    font-size: 0.88rem;
}

.settings-choice span {
    overflow: hidden;
    color: var(--client-muted, #68768b);
    font-size: 0.74rem;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.btn-check:checked + .settings-choice {
    border-color: rgba(39, 109, 177, 0.7);
    background: rgba(39, 109, 177, 0.09);
    box-shadow: inset 0 0 0 1px rgba(39, 109, 177, 0.14);
}

.btn-check:focus-visible + .settings-choice {
    outline: 3px solid rgba(39, 109, 177, 0.2);
    outline-offset: 2px;
}

.settings-grade-preview {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    margin-top: 0.55rem;
}

.settings-grade-preview span {
    padding: 0.28rem 0.48rem;
    border-radius: 0.45rem;
    color: #276db1;
    background: rgba(39, 109, 177, 0.09);
    font-size: 0.7rem;
    font-weight: 750;
}

.settings-card-footer,
.settings-security-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.settings-card-footer {
    margin-top: auto;
    padding: 0.85rem 1rem;
    border-top: 1px solid var(--client-border, #dfe5ec);
    background: var(--client-surface-alt, #f8fafc);
}

.settings-card-footer > span,
.settings-security-actions > span {
    color: var(--client-muted, #68768b);
    font-size: 0.76rem;
}

.settings-account-email {
    display: grid;
    gap: 0.1rem;
    text-align: right;
}

.settings-account-email span {
    color: var(--client-muted, #68768b);
    font-size: 0.7rem;
}

.settings-account-email strong {
    color: var(--client-text, #15243a);
    font-size: 0.82rem;
}

.settings-security-actions {
    margin-top: 0.3rem;
    padding-top: 0.85rem;
    border-top: 1px solid var(--client-border, #dfe5ec);
}

.builder-flow-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.7rem 0.8rem;
    border: 1px solid var(--client-border, #dfe5ec);
    border-radius: 0.7rem;
    background: var(--client-surface, #fff);
}

body.theme-dark .workflow-hero,
body.theme-dark .home-rollover-card,
body.theme-dark .claim-journey-step.is-active,
body.theme-dark .claim-journey-step.is-complete {
    background-color: var(--client-surface, #142138);
}

@media (max-width: 1199.98px) {
    .home-summary-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .home-analytics-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .home-chart-panel:last-child {
        grid-column: 1 / -1;
    }

    .settings-modern-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 767.98px) {
    .workflow-tabs {
        width: 100%;
    }

    .workflow-tab {
        flex: 1;
        justify-content: center;
    }

    .claim-journey-grid,
    .home-summary-grid,
    .home-next-layout,
    .home-analytics-grid {
        grid-template-columns: 1fr;
    }

    .home-chart-panel,
    .home-chart-panel:last-child {
        grid-column: auto;
        height: 16rem;
    }

    .home-progress-card {
        padding-top: 1rem;
        padding-left: 0;
        border-top: 1px solid var(--client-border, #dfe5ec);
        border-left: 0;
    }

    .home-timeframe-form,
    .home-timeframe-form .form-select {
        width: 100%;
    }

    .home-timeframe-form label {
        position: absolute;
        width: 1px;
        height: 1px;
        overflow: hidden;
        clip: rect(0, 0, 0, 0);
    }

    .home-timeframe-form .form-select {
        flex: 1 1 auto;
    }

    .settings-page-heading,
    .settings-section-heading,
    .settings-card-footer,
    .settings-security-actions {
        align-items: stretch;
        flex-direction: column;
    }

    .settings-choice-grid,
    .settings-choice-grid-three {
        grid-template-columns: 1fr;
    }

    .settings-account-email {
        text-align: left;
    }

    .settings-card-footer .btn,
    .settings-security-actions .btn {
        width: 100%;
    }

    .claim-cycle-footer,
    .builder-flow-bar {
        align-items: stretch;
        flex-direction: column;
    }
}

@media (prefers-reduced-motion: reduce) {
    .btn-attention {
        animation: none;
        box-shadow: 0 0 0 0.2rem rgba(var(--attention-rgb), 0.12);
    }
}

/* Header manual cue */
.header-support-actions {
    display: flex;
    align-items: center;
    gap: 0.45rem;
}

.header-manual-btn {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 0.38rem;
    min-height: 2.35rem;
    padding: 0.38rem 0.65rem;
    color: #215f9f;
    border: 1px solid rgba(39, 109, 177, 0.34);
    background: rgba(255, 255, 255, 0.72);
    font-weight: 750;
    white-space: nowrap;
}

.header-manual-btn:hover,
.header-manual-btn:focus-visible {
    color: #174f88;
    border-color: rgba(39, 109, 177, 0.62);
    background: #fff;
}

.manual-short-label {
    display: none;
}

.header-manual-new {
    padding: 0.14rem 0.3rem;
    border-radius: 999px;
    color: #fff;
    background: #276db1;
    font-size: 0.58rem;
    font-weight: 800;
    letter-spacing: 0.03em;
    text-transform: uppercase;
}

.header-manual-btn:not(.is-unread) .header-manual-new {
    display: none;
}

.header-manual-btn.is-unread {
    animation: manual-help-pulse 2.5s ease-in-out infinite;
}

@keyframes manual-help-pulse {
    0%, 100% {
        box-shadow: 0 0 0 0 rgba(39, 109, 177, 0), 0 2px 5px rgba(22, 51, 84, 0.08);
    }
    50% {
        box-shadow: 0 0 0 0.3rem rgba(39, 109, 177, 0.16), 0 7px 18px rgba(39, 109, 177, 0.2);
    }
}

body.theme-dark .header-manual-btn {
    color: #8bc9ff;
    border-color: rgba(126, 199, 255, 0.4);
    background: rgba(17, 31, 54, 0.72);
}

/* School documentation portal */
.manual-page-body {
    min-width: 20rem;
    min-height: 100vh;
    margin: 0;
    color: var(--client-text, #172033);
    background: var(--client-surface, #ffffff);
    font-family: "Inter", "Aptos", "Segoe UI Variable Text", "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    font-size: 1rem;
    font-synthesis: none;
    text-rendering: optimizeLegibility;
    -webkit-font-smoothing: antialiased;
}

.manual-page-body.theme-dark {
    background: var(--client-surface, #121f34);
}

@media (prefers-color-scheme: dark) {
    .manual-page-body.theme-system {
        background: var(--client-surface, #121f34);
    }
}

.manual-page-body .btn,
.manual-page-body input,
.manual-page-body button {
    font: inherit;
}

.manual-page-body h1,
.manual-page-body h2,
.manual-page-body h3,
.manual-docs-brand strong {
    font-family: "Aptos Display", "Segoe UI Variable Display", "Segoe UI", Inter, Helvetica, Arial, sans-serif;
}

.manual-skip-link:focus {
    position: fixed !important;
    top: 0.75rem;
    left: 0.75rem;
    z-index: 30;
    padding: 0.6rem 0.8rem;
    border-radius: 0.45rem;
    color: #fff;
    background: #174f88;
}

.manual-shell {
    min-height: 100vh;
    margin: 0;
    background: var(--client-surface, #fff);
}

.manual-docs-toolbar {
    position: sticky;
    top: 0;
    z-index: 8;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    min-height: 4.6rem;
    padding: 0.85rem 1.4rem;
    border-bottom: 1px solid var(--client-border, #dfe5ec);
    background: color-mix(in srgb, var(--client-surface, #fff) 94%, transparent);
    backdrop-filter: blur(12px);
}

.manual-docs-brand,
.manual-docs-toolbar-actions,
.manual-search-control {
    display: flex;
    align-items: center;
}

.manual-docs-brand {
    gap: 0.65rem;
}

.manual-docs-logo {
    width: 2.65rem;
    height: 2.65rem;
    object-fit: contain;
}

.manual-docs-brand > div {
    display: grid;
    gap: 0.05rem;
}

.manual-docs-brand strong {
    color: var(--client-text, #15243a);
    font-size: 0.95rem;
}

.manual-docs-brand > div > span {
    color: var(--client-muted, #68768b);
    font-size: 0.68rem;
}

.manual-docs-toolbar-actions {
    gap: 0.65rem;
}

.manual-search-control {
    position: relative;
    min-width: min(24rem, 35vw);
}

.manual-search-control > i {
    position: absolute;
    left: 0.75rem;
    z-index: 1;
    color: var(--client-muted, #68768b);
}

.manual-search-control .form-control {
    min-height: 2.4rem;
    padding-left: 2.2rem;
    padding-right: 3.4rem;
    border-color: transparent;
    background: var(--client-surface-alt, #f4f6f8);
}

.manual-search-control [data-manual-search-clear] {
    position: absolute;
    right: 0.35rem;
    color: var(--client-muted, #68768b);
    font-size: 0.7rem;
    text-decoration: none;
}

.manual-docs-layout {
    display: grid;
    grid-template-columns: 13.5rem minmax(0, 1fr) 11.5rem;
    gap: clamp(1.5rem, 2.5vw, 3rem);
    max-width: 94rem;
    margin: 0 auto;
    padding: 2rem 1.5rem 4rem;
}

.manual-docs-sidebar,
.manual-page-toc {
    position: sticky;
    top: 5.1rem;
    align-self: start;
    max-height: calc(100vh - 7rem);
    overflow-y: auto;
}

.manual-docs-sidebar {
    padding-right: 1rem;
    border-right: 1px solid var(--client-border, #dfe5ec);
}

.manual-nav-disclosure > summary {
    display: none;
}

.manual-nav-disclosure > .manual-nav-content {
    display: block !important;
}

.manual-docs-nav-group {
    display: grid;
    gap: 0.12rem;
    margin-bottom: 1.25rem;
}

.manual-docs-nav-group > span,
.manual-page-toc-title {
    margin-bottom: 0.28rem;
    color: var(--client-text, #15243a);
    font-size: 0.72rem;
    font-weight: 800;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.manual-docs-nav-group a,
.manual-page-toc > a,
.manual-docs-home-link {
    display: block;
    padding: 0.38rem 0.45rem;
    border-radius: 0.4rem;
    color: var(--client-muted, #68768b);
    font-size: 0.8rem;
    line-height: 1.35;
    text-decoration: none;
}

.manual-docs-nav-group a:hover,
.manual-page-toc > a:hover,
.manual-docs-home-link:hover {
    color: #276db1;
    background: rgba(39, 109, 177, 0.07);
}

.manual-docs-home-link {
    margin-top: 1rem;
    border-top: 1px solid var(--client-border, #dfe5ec);
    border-radius: 0;
    padding-top: 1rem;
    font-weight: 700;
}

.manual-content {
    min-width: 0;
    max-width: 52rem;
}

.manual-docs-intro {
    padding: 0.2rem 0 2.2rem;
    border-bottom: 1px solid var(--client-border, #dfe5ec);
}

.manual-docs-intro h1 {
    margin: 0 0 0.75rem;
    color: var(--client-text, #15243a);
    font-size: clamp(2rem, 4vw, 3.1rem);
    font-weight: 750;
    line-height: 1.08;
    letter-spacing: -0.035em;
}

.manual-docs-intro > p {
    max-width: 46rem;
    margin: 0;
    color: var(--client-muted, #68768b);
    font-size: 1rem;
    line-height: 1.75;
}

.manual-context-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.45rem;
    margin-top: 1.15rem;
}

.manual-context-row span {
    padding: 0.32rem 0.55rem;
    border: 1px solid var(--client-border, #dfe5ec);
    border-radius: 999px;
    color: var(--client-muted, #68768b);
    background: var(--client-surface-alt, #f8fafc);
    font-size: 0.7rem;
    font-weight: 700;
}

.manual-search-status {
    display: block;
    min-height: 1.2rem;
    margin-top: 0.65rem;
    color: #276db1;
    font-size: 0.75rem;
    font-weight: 700;
}

.manual-topic {
    scroll-margin-top: 5.5rem;
    padding: 2.2rem 0;
    border-bottom: 1px solid var(--client-border, #dfe5ec);
}

.manual-topic[hidden] {
    display: none;
}

.manual-topic-heading {
    margin-bottom: 1.25rem;
}

.manual-topic-heading > span {
    display: block;
    margin-bottom: 0.35rem;
    color: #276db1;
    font-size: 0.7rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.manual-topic h2 {
    margin: 0 0 0.55rem;
    color: var(--client-text, #15243a);
    font-size: 1.65rem;
    line-height: 1.25;
}

.manual-topic h3 {
    margin: 1.4rem 0 0.65rem;
    color: var(--client-text, #15243a);
    font-size: 1rem;
}

.manual-topic p,
.manual-topic li,
.manual-topic td {
    color: var(--client-muted, #5f6f84);
    line-height: 1.65;
}

.manual-path-grid,
.manual-two-column,
.manual-rule-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.85rem;
}

.manual-path-card,
.manual-two-column > div,
.manual-rule-grid > div {
    padding: 1rem;
    border: 1px solid var(--client-border, #dfe5ec);
    border-radius: 0.75rem;
    background: var(--client-surface-alt, #f8fafc);
}

.manual-path-card h3,
.manual-two-column h3 {
    margin-top: 0;
}

.manual-path-card ol,
.manual-path-card ul,
.manual-check-list,
.manual-compact-steps {
    margin-bottom: 0;
    padding-left: 1.2rem;
}

.manual-path-card li,
.manual-check-list li,
.manual-compact-steps li {
    margin-bottom: 0.45rem;
}

.manual-role-note,
.manual-callout,
.manual-warning,
.manual-support-box {
    display: grid;
    gap: 0.25rem;
    margin-top: 1rem;
    padding: 0.9rem 1rem;
    border-left: 4px solid #276db1;
    border-radius: 0.45rem;
    background: rgba(39, 109, 177, 0.07);
}

.manual-warning {
    border-left-color: #d9a62e;
    background: rgba(217, 166, 46, 0.09);
}

.manual-role-note strong,
.manual-callout strong,
.manual-warning strong,
.manual-support-box strong {
    color: var(--client-text, #15243a);
}

.manual-role-note span,
.manual-support-box span {
    color: var(--client-muted, #68768b);
    font-size: 0.84rem;
}

.manual-destination-list {
    display: grid;
    gap: 0.65rem;
}

.manual-destination-list > div {
    display: grid;
    grid-template-columns: 7.5rem minmax(0, 1fr);
    gap: 1rem;
    padding: 0.8rem 0;
    border-bottom: 1px solid var(--client-border, #dfe5ec);
}

.manual-destination-list strong,
.manual-rule-grid strong {
    color: var(--client-text, #15243a);
}

.manual-destination-list span,
.manual-rule-grid span {
    color: var(--client-muted, #68768b);
    font-size: 0.84rem;
    line-height: 1.55;
}

.manual-step-list {
    display: grid;
    gap: 0.75rem;
    margin: 0;
    padding: 0;
    list-style: none;
    counter-reset: manual-step;
}

.manual-step-list > li {
    display: grid;
    grid-template-columns: 2rem minmax(0, 1fr);
    gap: 0.8rem;
    margin: 0;
    counter-increment: manual-step;
}

.manual-step-list > li::before {
    content: counter(manual-step);
    display: grid;
    place-items: center;
    width: 1.8rem;
    height: 1.8rem;
    border-radius: 999px;
    color: #fff;
    background: #276db1;
    font-size: 0.75rem;
    font-weight: 800;
}

.manual-step-list > li > div {
    padding-bottom: 0.8rem;
    border-bottom: 1px solid var(--client-border, #dfe5ec);
}

.manual-step-list strong,
.manual-step-list span {
    display: block;
}

.manual-step-list strong {
    margin-bottom: 0.2rem;
    color: var(--client-text, #15243a);
}

.manual-rule-grid > div {
    display: grid;
    gap: 0.2rem;
}

.manual-status-table {
    width: 100%;
    margin: 0.75rem 0 1.25rem;
    border-collapse: separate;
    border-spacing: 0;
    border: 1px solid var(--client-border, #dfe5ec);
    border-radius: 0.65rem;
    overflow: hidden;
}

.manual-status-table th,
.manual-status-table td {
    padding: 0.7rem;
    border-bottom: 1px solid var(--client-border, #dfe5ec);
    vertical-align: top;
    text-align: left;
    font-size: 0.8rem;
}

.manual-status-table th {
    color: var(--client-text, #15243a);
    background: var(--client-surface-alt, #f8fafc);
    font-size: 0.72rem;
    text-transform: uppercase;
}

.manual-status-table tr:last-child td {
    border-bottom: 0;
}

.manual-page-toc {
    display: grid;
    gap: 0.12rem;
}

.manual-page-help {
    display: grid;
    gap: 0.25rem;
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--client-border, #dfe5ec);
}

.manual-page-help strong {
    color: var(--client-text, #15243a);
    font-size: 0.78rem;
}

.manual-page-help span {
    color: var(--client-muted, #68768b);
    font-size: 0.72rem;
    line-height: 1.5;
}

.manual-no-results {
    display: grid;
    gap: 0.25rem;
    margin-top: 2rem;
    padding: 1rem;
    border: 1px dashed var(--client-border, #dfe5ec);
    border-radius: 0.65rem;
    color: var(--client-muted, #68768b);
    text-align: center;
}

.manual-no-results[hidden] {
    display: none;
}

@media (max-width: 1399.98px) {
    .manual-docs-layout {
        grid-template-columns: 12.5rem minmax(0, 1fr);
    }

    .manual-page-toc {
        display: none;
    }
}

@media (max-width: 991.98px) {
    .manual-docs-toolbar,
    .manual-docs-toolbar-actions {
        align-items: stretch;
        flex-direction: column;
    }

    .manual-docs-toolbar {
        position: static;
    }

    .manual-search-control {
        width: 100%;
        min-width: 0;
    }

    .manual-docs-layout {
        grid-template-columns: 1fr;
        padding: 1.25rem 1rem 3rem;
    }

    .manual-docs-sidebar {
        position: static;
        max-height: none;
        padding: 0;
        border-right: 0;
    }

    .manual-nav-disclosure {
        border: 1px solid var(--client-border, #dfe5ec);
        border-radius: 0.7rem;
        background: var(--client-surface-alt, #f8fafc);
    }

    .manual-nav-disclosure > summary {
        display: flex;
        align-items: center;
        gap: 0.5rem;
        padding: 0.8rem 0.9rem;
        color: var(--client-text, #15243a);
        font-weight: 750;
        cursor: pointer;
        list-style: none;
    }

    .manual-nav-disclosure > summary::-webkit-details-marker {
        display: none;
    }

    .manual-nav-disclosure > summary::after {
        content: "+";
        margin-left: auto;
        color: #276db1;
        font-size: 1.15rem;
    }

    .manual-nav-disclosure[open] > summary::after {
        content: "−";
    }

    .manual-nav-disclosure:not([open]) > .manual-nav-content {
        display: none !important;
    }

    .manual-nav-disclosure[open] > .manual-nav-content {
        display: grid !important;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 0.75rem 1rem;
        padding: 0.2rem 0.9rem 0.9rem;
        border-top: 1px solid var(--client-border, #dfe5ec);
    }

    .manual-docs-nav-group {
        margin: 0;
        padding-top: 0.75rem;
    }

    .manual-docs-home-link {
        grid-column: 1 / -1;
    }
}

@media (max-width: 575.98px) {
    .manual-full-label {
        display: none;
    }

    .manual-short-label {
        display: inline;
    }

    .header-manual-new {
        display: none;
    }

    .manual-docs-sidebar,
    .manual-path-grid,
    .manual-two-column,
    .manual-rule-grid {
        grid-template-columns: 1fr;
    }

    .manual-nav-disclosure[open] > .manual-nav-content {
        grid-template-columns: 1fr;
    }

    .manual-docs-home-link {
        grid-column: auto;
    }

    .manual-docs-toolbar-actions .btn-primary {
        width: 100%;
    }

    .manual-destination-list > div {
        grid-template-columns: 1fr;
        gap: 0.25rem;
    }

    .manual-status-table {
        display: block;
        overflow-x: auto;
        white-space: normal;
    }
}

@media (prefers-reduced-motion: reduce) {
    .header-manual-btn.is-unread {
        animation: none;
        box-shadow: 0 0 0 0.2rem rgba(39, 109, 177, 0.14);
    }
}

/* Bootstrap dialogs and backdrops must cover the application header. */
.app-header {
    z-index: 1030;
}
