:root {
    --app-bg: #eef3fb;
    --app-ink: #122038;
    --app-muted: #65738b;
    --app-line: #d9e2ef;
    --app-sidebar: #0f1f33;
    --app-sidebar-soft: #183251;
    --app-brand: #1f4b8f;
    --app-brand-2: #2f6fcc;
    --app-gold: #c7a46a;
    --sidebar-width: 284px;
    --topbar-height: 62px;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: 'Manrope', sans-serif;
    color: var(--app-ink);
    background:
        radial-gradient(circle at 8% -10%, #dbe7ff 0%, rgba(219, 231, 255, 0) 35%),
        radial-gradient(circle at 100% 0%, #f8eddc 0%, rgba(248, 237, 220, 0) 30%),
        var(--app-bg);
    min-height: 100vh;
}

h1, h2, h3, h4, h5, h6 {
    font-family: 'Sora', sans-serif;
    letter-spacing: -0.02em;
}

.app-shell {
    display: flex;
    min-height: 100vh;
}

.app-sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: var(--sidebar-width);
    z-index: 1040;
    display: flex;
    flex-direction: column;
    background: linear-gradient(165deg, var(--app-sidebar) 0%, var(--app-sidebar-soft) 100%);
    color: #e7f0ff;
    border-right: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow: 18px 0 40px rgba(8, 18, 35, 0.18);
    transition: transform .28s ease;
}

/* Legacy compatibility */
.sidebar.active {
    transform: translateX(0) !important;
}

.app-sidebar__header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    padding: 18px 18px 16px;
    border-bottom: 1px solid rgba(255,255,255,0.08);
}

.app-brand {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
    flex: 1 1 auto;
}

.app-brand__logo {
    width: 170px;
    max-width: 100%;
    height: auto;
    display: block;
}

.app-brand__mark {
    width: 34px;
    height: 34px;
    border-radius: 10px;
    background: linear-gradient(135deg, var(--app-brand), var(--app-brand-2));
    color: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 10px 22px rgba(47, 111, 204, 0.35);
}

.app-brand__text {
    color: #fff;
    font-family: 'Sora', sans-serif;
    font-weight: 700;
    letter-spacing: -0.01em;
}

.app-nav {
    padding: 12px 10px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    overflow-y: auto;
}

.app-nav__section {
    padding: 10px 12px 6px;
    font-size: .72rem;
    font-weight: 800;
    letter-spacing: .05em;
    text-transform: uppercase;
    color: rgba(221, 232, 247, 0.58);
}

.app-nav__link {
    color: rgba(237, 244, 255, 0.82);
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    padding: 11px 12px;
    border-radius: 12px;
    font-weight: 600;
    font-size: .95rem;
    transition: all .2s ease;
}

.app-nav__link i {
    width: 18px;
    text-align: center;
}

.app-nav__link:hover {
    background: rgba(255, 255, 255, 0.08);
    color: #fff;
}

.app-nav__link.is-active {
    background: rgba(255, 255, 255, 0.16);
    color: #fff;
    box-shadow: inset 0 0 0 1px rgba(255,255,255,0.08);
}

.app-sidebar__footer {
    margin-top: auto;
    padding: 14px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(10, 20, 34, 0.28);
}

.app-user {
    display: flex;
    align-items: center;
    gap: 10px;
}

.app-user__avatar {
    width: 42px;
    height: 42px;
    border-radius: 12px;
    background: linear-gradient(135deg, var(--app-brand), var(--app-brand-2));
    color: #fff;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.app-user__meta {
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.app-user__name {
    color: #fff;
    font-size: .9rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.app-user__role {
    color: rgba(220, 231, 245, 0.72);
    font-size: .78rem;
}

.app-main {
    flex: 1;
    margin-left: var(--sidebar-width);
    min-width: 0;
    transition: margin-left .28s ease;
}

.main-content {
    margin-left: var(--sidebar-width);
}

.app-topbar {
    height: var(--topbar-height);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 0 14px;
    border-bottom: 1px solid var(--app-line);
    background: rgba(255, 255, 255, 0.86);
    backdrop-filter: blur(10px);
    position: sticky;
    top: 0;
    z-index: 1020;
}

.app-topbar__title {
    color: var(--app-ink);
    font-weight: 700;
    font-family: 'Sora', sans-serif;
    font-size: .95rem;
    letter-spacing: -0.01em;
}

.app-topbar__logo {
    width: 116px;
    height: auto;
    display: block;
}

.app-content {
    padding: 18px;
}

.app-overlay {
    position: fixed;
    inset: 0;
    background: rgba(8, 16, 30, 0.35);
    opacity: 0;
    pointer-events: none;
    transition: opacity .2s ease;
    z-index: 1035;
}

.btn-brand {
    background: linear-gradient(135deg, var(--app-brand), var(--app-brand-2));
    border: 0;
    color: #fff;
    font-weight: 700;
}

.btn-brand:hover,
.btn-brand:focus {
    color: #fff;
    filter: brightness(1.03);
}

.btn-ghost-brand {
    border: 1px solid rgba(31, 75, 143, 0.28);
    background: #fff;
    color: var(--app-brand);
    font-weight: 700;
}

.btn-ghost-brand:hover,
.btn-ghost-brand:focus {
    color: var(--app-brand);
    background: #eef3ff;
}

.form-check-input {
    border: 1.5px solid var(--app-brand-2);
    background-color: #fff;
}

.form-check-input:hover {
    border-color: var(--app-brand);
}

.form-check-input:focus {
    border-color: var(--app-brand);
    box-shadow: 0 0 0 .22rem rgba(47, 111, 204, 0.28);
}

.form-check-input:checked {
    background-color: var(--app-brand);
    border-color: var(--app-brand);
}

.card {
    border: 1px solid var(--app-line);
    border-radius: 16px;
    box-shadow: 0 10px 24px rgba(18, 32, 56, 0.06);
}

.table-responsive {
    border-radius: 14px;
}

.table-hover tbody tr:hover {
    background: rgba(47, 111, 204, 0.06);
}

pre {
    white-space: pre-wrap;
    word-break: break-word;
}

@media (max-width: 991.98px) {
    .app-brand__logo {
        width: 150px;
    }

    .app-sidebar {
        transform: translateX(-100%);
    }

    .app-shell.is-sidebar-open .app-sidebar {
        transform: translateX(0);
    }

    .app-shell.is-sidebar-open .app-overlay {
        opacity: 1;
        pointer-events: auto;
    }

    .app-main {
        margin-left: 0;
    }

    .main-content {
        margin-left: 0;
    }

    .app-content {
        padding: 14px;
    }
}

@media (min-width: 992px) {
    .app-overlay {
        display: none;
    }
}

/* Onboarding */
.onboarding-wrap {
    max-width: 1280px;
    margin: 0 auto;
    padding-top: 4px;
}

.onboarding-wrap .chip {
    display: inline-block;
    border: 1px solid rgba(255, 255, 255, 0.24);
    border-radius: 999px;
    padding: 6px 12px;
    font-size: 11px;
    font-weight: 800;
    letter-spacing: .04em;
    text-transform: uppercase;
    background: rgba(255, 255, 255, 0.12);
    color: #fff;
}

.onboarding-wrap .card {
    border-radius: 20px;
    border: 1px solid var(--app-line);
    box-shadow: 0 14px 32px rgba(12, 25, 44, 0.08);
}

.onboarding-wrap .onboarding-aside {
    border-radius: 20px;
    padding: 24px;
    color: #e9f1ff;
    background: linear-gradient(150deg, #0f1f33 0%, #173454 54%, #264c78 100%);
    box-shadow: 0 18px 34px rgba(12, 24, 42, 0.24);
    min-height: 100%;
}

.onboarding-wrap .onboarding-steps {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.onboarding-wrap .onboarding-step {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 10px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.08);
    color: rgba(239, 247, 255, 0.85);
    font-size: .92rem;
}

.onboarding-wrap .onboarding-step span {
    width: 28px;
    height: 28px;
    border-radius: 9px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    background: rgba(255, 255, 255, 0.15);
    color: #fff;
    flex: 0 0 auto;
}

.onboarding-wrap .onboarding-step.is-active {
    background: rgba(255, 255, 255, 0.18);
    color: #fff;
}

.onboarding-wrap .onboarding-step.is-active span {
    background: linear-gradient(135deg, var(--app-brand), var(--app-brand-2));
}

.onboarding-wrap .onboarding-step.is-done span {
    background: linear-gradient(135deg, #1e9a64, #2bbf7e);
}

.onboarding-wrap .form-control,
.onboarding-wrap .form-select {
    border-radius: 12px;
}

@media (max-width: 1199.98px) {
    .onboarding-wrap .onboarding-aside {
        margin-bottom: 8px;
    }
}
.support-fab {
    position: fixed;
    right: 20px;
    bottom: 0;
    width: 58px;
    height: 58px;
    border: none;
    border-radius: 50%;
    background: linear-gradient(140deg, #0f9a4a, #25d366);
    color: #fff;
    font-size: 1.65rem;
    box-shadow: 0 12px 28px rgba(15, 154, 74, 0.35);
    z-index: 1090;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.15s ease, box-shadow 0.2s ease;
}

.support-fab:hover {
    transform: translateY(-2px);
    box-shadow: 0 16px 32px rgba(15, 154, 74, 0.42);
}

.support-fab:focus-visible {
    outline: 0;
    box-shadow: 0 0 0 0.25rem rgba(37, 211, 102, 0.35), 0 16px 32px rgba(15, 154, 74, 0.42);
}

@media (max-width: 768px) {
    .support-fab {
        right: 14px;
        bottom: 0;
        width: 54px;
        height: 54px;
        font-size: 1.5rem;
    }
}

.pwa-install-banner {
    position: fixed;
    left: 16px;
    right: 16px;
    bottom: 18px;
    z-index: 1085;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    padding: 14px 16px;
    border: 1px solid rgba(17, 43, 79, 0.12);
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.98);
    box-shadow: 0 18px 40px rgba(12, 25, 44, 0.16);
    backdrop-filter: blur(10px);
}

.pwa-install-banner__content {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
}

.pwa-install-banner__icon {
    width: 44px;
    height: 44px;
    border-radius: 14px;
    background: linear-gradient(135deg, #1f4b8f, #2f6fcc);
    color: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    flex: 0 0 auto;
}

.pwa-install-banner__text {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.pwa-install-banner__text strong {
    color: #12294a;
    font-size: 0.96rem;
}

.pwa-install-banner__text span {
    color: #5a6b83;
    font-size: 0.84rem;
    line-height: 1.45;
}

.pwa-install-banner__actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 0 0 auto;
}

@media (max-width: 768px) {
    .pwa-install-banner {
        left: 12px;
        right: 12px;
        bottom: 12px;
        align-items: stretch;
        flex-direction: column;
    }

    .pwa-install-banner__actions {
        width: 100%;
    }

    .pwa-install-banner__actions .btn {
        flex: 1 1 auto;
    }
}
