:root {
    --sl-bg: #f4f7fb;
    --sl-surface: #ffffff;
    --sl-surface-soft: #f8fafc;
    --sl-border: #dbe4ee;
    --sl-text: #142033;
    --sl-muted: #64748b;
    --sl-primary: #1f4f82;
    --sl-primary-dark: #16385c;
    --sl-accent: #caa76a;
    --sl-success: #198754;
    --sl-warning: #b7791f;
    --sl-danger: #c24141;
    --sl-shadow: 0 18px 45px rgba(15, 23, 42, 0.08);
    --sl-radius-lg: 20px;
    --sl-radius-md: 16px;
    --sl-radius-sm: 12px;
}

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

body {
    font-family: "Inter", "Segoe UI", sans-serif;
    background:
        radial-gradient(
            circle at top left,
            rgba(31, 79, 130, 0.08),
            transparent 28%
        ),
        linear-gradient(180deg, #f7f9fc 0%, #f2f5f9 100%);
    color: var(--sl-text);
}

a {
    text-decoration: none;
}

.app-shell {
    padding-top: 2rem;
    padding-bottom: 2.5rem;
}

.authenticated-shell {
    background:
        radial-gradient(
            circle at top left,
            rgba(31, 79, 130, 0.08),
            transparent 28%
        ),
        linear-gradient(180deg, #f5f7fb 0%, #eff3f8 100%);
}

.guest-shell {
    background:
        radial-gradient(
            circle at top left,
            rgba(31, 79, 130, 0.06),
            transparent 24%
        ),
        linear-gradient(180deg, #f7f9fc 0%, #f2f5f9 100%);
}

.app-layout {
    display: flex;
    min-height: 100vh;
    transition: all 0.25s ease;
}

.app-sidebar {
    width: 300px;
    flex: 0 0 300px;
    padding: 1.25rem;
    transition:
        width 0.25s ease,
        flex-basis 0.25s ease,
        padding 0.25s ease;
}

.app-sidebar-inner {
    display: flex;
    flex-direction: column;
    width: 100%;
    min-height: calc(100vh - 2.5rem);
    padding: 1.25rem;
    border-radius: 28px;
    background: linear-gradient(
        180deg,
        rgba(16, 32, 54, 0.98),
        rgba(22, 56, 92, 0.96)
    );
    box-shadow: 0 24px 50px rgba(15, 23, 42, 0.22);
    color: rgba(255, 255, 255, 0.9);
    position: sticky;
    top: 1.25rem;
    overflow: hidden;
    transition:
        opacity 0.2s ease,
        transform 0.25s ease;
}

.sidebar-top {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 0.9rem;
}

.sidebar-toggle {
    border: 1px solid rgba(255, 255, 255, 0.12);
    background: rgba(255, 255, 255, 0.08);
    color: rgba(255, 255, 255, 0.9);
    border-radius: 999px;
    padding: 0.45rem 0.85rem;
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.03em;
}

.sidebar-toggle:hover {
    background: rgba(255, 255, 255, 0.14);
    color: #fff;
}

.icon-button {
    width: 42px;
    height: 42px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.topbar-icon-button {
    min-width: 42px;
}

.icon-burger {
    display: inline-flex;
    flex-direction: column;
    gap: 4px;
}

.icon-burger span {
    display: block;
    width: 18px;
    height: 2px;
    border-radius: 999px;
    background: currentColor;
}

.icon-collapse {
    position: relative;
    width: 16px;
    height: 16px;
    display: inline-block;
}

.icon-collapse span {
    position: absolute;
    left: 7px;
    width: 2px;
    height: 10px;
    border-radius: 999px;
    background: currentColor;
    transform-origin: center;
}

.icon-collapse span:first-child {
    top: 1px;
    transform: rotate(35deg);
}

.icon-collapse span:last-child {
    bottom: 1px;
    transform: rotate(-35deg);
}

.sidebar-nav-scroll {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    padding-right: 0.2rem;
}

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

.sidebar-nav-scroll::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.14);
    border-radius: 999px;
}

.sidebar-brand-wrap {
    margin-bottom: 1.75rem;
}

.sidebar-brand {
    display: inline-flex;
    align-items: center;
    gap: 0.75rem;
    color: #fff;
    font-weight: 700;
    letter-spacing: 0.04em;
}

.sidebar-brand-mark {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.15);
    font-size: 0.86rem;
}

.sidebar-brand-subtitle {
    margin-top: 0.5rem;
    color: rgba(255, 255, 255, 0.58);
    font-size: 0.76rem;
    text-transform: uppercase;
    letter-spacing: 0.12em;
}

.sidebar-nav-group + .sidebar-nav-group {
    margin-top: 1rem;
}

.sidebar-nav-title {
    color: rgba(255, 255, 255, 0.52);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    font-weight: 700;
    margin-bottom: 0.6rem;
}

.sidebar-link {
    display: flex;
    align-items: center;
    padding: 0.78rem 0.95rem;
    border-radius: 14px;
    color: rgba(255, 255, 255, 0.8);
    font-weight: 500;
    transition: all 0.2s ease;
}

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

.sidebar-link.active {
    color: #fff;
    background: linear-gradient(
        135deg,
        rgba(202, 167, 106, 0.18),
        rgba(255, 255, 255, 0.12)
    );
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.sidebar-footer {
    margin-top: auto;
    padding-top: 1rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.sidebar-user-name {
    color: #fff;
    font-weight: 600;
}

.sidebar-user-role {
    color: rgba(255, 255, 255, 0.58);
    font-size: 0.88rem;
    margin-top: 0.2rem;
}

.sidebar-offcanvas {
    background: linear-gradient(
        180deg,
        rgba(16, 32, 54, 0.99),
        rgba(22, 56, 92, 0.97)
    );
    color: rgba(255, 255, 255, 0.9);
    border-right: 0;
}

.sidebar-offcanvas .offcanvas-header {
    padding: 1.25rem 1.25rem 1rem;
    background: transparent;
    border-bottom: 1px solid rgba(255, 255, 255, 0.12) !important;
    color: #fff;
}

.sidebar-offcanvas .offcanvas-title {
    color: #fff;
    font-weight: 700;
}

.sidebar-offcanvas .btn-close {
    filter: invert(1) grayscale(100%) brightness(200%);
    opacity: 0.9;
}

.sidebar-offcanvas .btn-close:hover {
    opacity: 1;
}

.sidebar-offcanvas .offcanvas-body {
    padding: 1.1rem 1.25rem 1.25rem;
    color: inherit;
    overflow-y: auto;
}

.sidebar-offcanvas .sidebar-brand-wrap {
    margin-bottom: 1.5rem;
}

.sidebar-offcanvas .sidebar-nav-scroll {
    padding-right: 0;
}

.sidebar-offcanvas .sidebar-footer {
    border-top-color: rgba(255, 255, 255, 0.12);
}

.app-main {
    flex: 1 1 auto;
    min-width: 0;
    padding: 1.25rem 1.25rem 1.25rem 0;
    transition:
        padding 0.25s ease,
        width 0.25s ease;
}

.app-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 1rem 1.25rem;
    margin-bottom: 1.25rem;
    border-radius: 22px;
    background: rgba(255, 255, 255, 0.9);
    border: 1px solid rgba(148, 163, 184, 0.16);
    box-shadow: 0 16px 32px rgba(15, 23, 42, 0.06);
}

.app-topbar-title {
    font-weight: 700;
    font-size: 1rem;
    color: var(--sl-text);
}

.app-topbar-subtitle,
.app-topbar-user-role {
    color: var(--sl-muted);
    font-size: 0.88rem;
}

.app-topbar-user {
    text-align: right;
}

.app-topbar-user-name {
    font-weight: 600;
}

.app-layout.sidebar-hidden .app-sidebar {
    width: 0;
    flex-basis: 0;
    padding-left: 0;
    padding-right: 0;
    overflow: hidden;
}

.app-layout.sidebar-hidden .app-sidebar-inner {
    opacity: 0;
    transform: translateX(-16px);
    pointer-events: none;
}

.app-layout.sidebar-hidden .app-main {
    padding-left: 1.25rem;
}

.app-layout.sidebar-hidden .icon-collapse span:first-child {
    transform: rotate(-35deg);
}

.app-layout.sidebar-hidden .icon-collapse span:last-child {
    transform: rotate(35deg);
}

.guest-topbar {
    padding: 1.1rem 0;
}

.guest-brand {
    color: var(--sl-primary-dark);
    font-weight: 700;
    letter-spacing: 0.05em;
}

.topbar {
    background: linear-gradient(
        135deg,
        rgba(16, 32, 54, 0.96),
        rgba(31, 79, 130, 0.95)
    );
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow: 0 14px 35px rgba(15, 23, 42, 0.22);
}

.topbar .navbar-brand {
    font-weight: 700;
    letter-spacing: 0.04em;
    font-size: 0.98rem;
}

.topbar .nav-link {
    color: rgba(255, 255, 255, 0.82);
    border-radius: 999px;
    padding: 0.55rem 0.9rem;
    transition: all 0.2s ease;
}

.topbar .nav-link:hover,
.topbar .nav-link.active {
    color: #fff;
    background: rgba(255, 255, 255, 0.12);
}

.topbar .dropdown-menu {
    border: 1px solid rgba(15, 23, 42, 0.08);
    border-radius: 14px;
    padding: 0.55rem;
    box-shadow: var(--sl-shadow);
}

.topbar .dropdown-item {
    border-radius: 10px;
    padding: 0.65rem 0.8rem;
}

.topbar .dropdown-item:hover {
    background: #eff5fb;
    color: var(--sl-primary-dark);
}

.navbar-user {
    color: rgba(255, 255, 255, 0.92);
    font-size: 0.94rem;
}

.page-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.page-title {
    margin: 0;
    font-size: 1.8rem;
    font-weight: 700;
    letter-spacing: -0.02em;
}

.page-subtitle {
    margin: 0.45rem 0 0;
    color: var(--sl-muted);
    max-width: 720px;
}

.eyebrow {
    display: inline-block;
    font-size: 0.74rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--sl-primary);
    font-weight: 700;
    margin-bottom: 0.65rem;
}

.surface-card,
.card {
    border: 1px solid rgba(148, 163, 184, 0.16);
    border-radius: var(--sl-radius-lg);
    box-shadow: var(--sl-shadow);
    background: rgba(255, 255, 255, 0.96);
}

.card-header {
    background: transparent;
    border-bottom: 1px solid var(--sl-border);
    padding: 1rem 1.25rem;
    font-weight: 700;
}

.card-body {
    padding: 1.25rem;
}

.hero-panel {
    background: linear-gradient(
        135deg,
        rgba(21, 49, 79, 0.98),
        rgba(31, 79, 130, 0.94)
    );
    color: #fff;
    border-radius: 24px;
    padding: 1.5rem;
    box-shadow: 0 20px 45px rgba(15, 23, 42, 0.18);
}

.hero-panel .muted,
.hero-panel p {
    color: rgba(255, 255, 255, 0.82);
}

.stat-card {
    height: 100%;
    padding: 1.35rem;
    border: 1px solid rgba(148, 163, 184, 0.14);
    border-radius: 18px;
    background: linear-gradient(180deg, #ffffff, #fbfdff);
    box-shadow: 0 14px 30px rgba(15, 23, 42, 0.06);
}

.stat-label {
    color: var(--sl-muted);
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin-bottom: 0.75rem;
    font-weight: 700;
}

.stat-value {
    font-size: 2rem;
    line-height: 1;
    font-weight: 700;
    letter-spacing: -0.04em;
}

.quick-link {
    display: inline-flex;
    align-items: center;
    padding: 0.7rem 1rem;
    border-radius: 12px;
    border: 1px solid var(--sl-border);
    background: #fff;
    color: var(--sl-text);
    font-weight: 600;
}

.quick-link:hover {
    border-color: rgba(31, 79, 130, 0.3);
    background: #f8fbff;
    color: var(--sl-primary-dark);
}

.section-stack > * + * {
    margin-top: 1rem;
}

.data-table {
    margin: 0;
}

.data-table thead th {
    background: #f8fafc;
    color: var(--sl-muted);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    font-size: 0.76rem;
    font-weight: 700;
    border-bottom: 1px solid var(--sl-border);
    padding: 1rem 1.1rem;
}

.data-table tbody td {
    padding: 1rem 1.1rem;
    vertical-align: middle;
    border-color: rgba(219, 228, 238, 0.9);
}

.data-table tbody tr:hover {
    background: rgba(248, 250, 252, 0.9);
}

.empty-state {
    padding: 2.25rem 1rem;
    text-align: center;
    color: var(--sl-muted);
}

.form-label {
    font-size: 0.92rem;
    font-weight: 600;
    color: var(--sl-text);
    margin-bottom: 0.55rem;
}

.form-control,
.form-select {
    min-height: 46px;
    border-radius: 12px;
    border-color: var(--sl-border);
    background-color: #fcfdff;
}

.form-control:focus,
.form-select:focus {
    border-color: rgba(31, 79, 130, 0.5);
    box-shadow: 0 0 0 0.2rem rgba(31, 79, 130, 0.12);
}

textarea.form-control {
    min-height: unset;
}

.form-check-input {
    border-color: #a5b4c7;
}

.btn {
    border-radius: 12px;
    padding: 0.68rem 1rem;
    font-weight: 600;
}

.btn-sm {
    border-radius: 10px;
}

.btn-primary {
    background: linear-gradient(
        135deg,
        var(--sl-primary),
        var(--sl-primary-dark)
    );
    border-color: transparent;
}

.btn-primary:hover,
.btn-primary:focus {
    background: linear-gradient(135deg, #21486f, #122d48);
    border-color: transparent;
}

.btn-light {
    background: #fff;
    border-color: var(--sl-border);
    color: var(--sl-text);
}

.btn-light:hover {
    background: #f8fafc;
    border-color: #cbd5e1;
}

.btn-outline-primary,
.btn-outline-success,
.btn-outline-secondary,
.btn-outline-danger {
    background: #fff;
}

.badge-soft {
    display: inline-flex;
    align-items: center;
    padding: 0.45rem 0.7rem;
    border-radius: 999px;
    font-size: 0.76rem;
    font-weight: 700;
    letter-spacing: 0.03em;
}

.badge-soft-primary {
    background: rgba(31, 79, 130, 0.1);
    color: var(--sl-primary-dark);
}

.badge-soft-success {
    background: rgba(25, 135, 84, 0.12);
    color: #12663f;
}

.badge-soft-warning {
    background: rgba(183, 121, 31, 0.14);
    color: #915b0f;
}

.badge-soft-danger {
    background: rgba(194, 65, 65, 0.12);
    color: #9f2d2d;
}

.meta-list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 1rem;
}

.meta-item {
    padding: 1rem;
    border-radius: 14px;
    background: var(--sl-surface-soft);
    border: 1px solid rgba(219, 228, 238, 0.8);
}

.meta-label {
    color: var(--sl-muted);
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-weight: 700;
    margin-bottom: 0.45rem;
}

.meta-value {
    font-weight: 600;
    color: var(--sl-text);
}

.timeline-list .list-group-item,
.step-list .list-group-item {
    border-left: 0;
    border-right: 0;
    padding: 1rem 1.25rem;
}

.timeline-list .list-group-item:first-child,
.step-list .list-group-item:first-child {
    border-top: 0;
}

.panel-note {
    color: var(--sl-muted);
    font-size: 0.92rem;
}

.table-toolbar {
    display: flex;
    gap: 1rem;
    align-items: end;
    flex-wrap: wrap;
}

.table-toolbar-search {
    flex: 1 1 420px;
}

.table-toolbar-per-page {
    flex: 0 0 140px;
}

.table-toolbar-actions {
    display: flex;
    gap: 0.75rem;
    align-items: end;
}

.pagination-wrap {
    min-width: 0;
}

.pagination-wrap .pagination,
.app-shell .pagination {
    margin-bottom: 0;
    gap: 0.35rem;
    flex-wrap: wrap;
}

.pagination-wrap .page-link,
.app-shell .page-link {
    border: 1px solid var(--sl-border);
    color: var(--sl-primary-dark);
    border-radius: 10px;
    padding: 0.55rem 0.85rem;
    min-width: 42px;
    text-align: center;
}

.pagination-wrap .page-item.active .page-link,
.app-shell .page-item.active .page-link {
    background: linear-gradient(
        135deg,
        var(--sl-primary),
        var(--sl-primary-dark)
    );
    border-color: transparent;
    color: #fff;
}

.pagination-wrap .page-item.disabled .page-link,
.app-shell .page-item.disabled .page-link {
    background: #f8fafc;
    color: #94a3b8;
}

.pagination-summary {
    white-space: nowrap;
}

.auth-shell {
    min-height: calc(100vh - 120px);
    display: flex;
    align-items: center;
}

.auth-card {
    overflow: hidden;
}

.auth-aside {
    background: linear-gradient(
        160deg,
        rgba(17, 39, 63, 0.98),
        rgba(31, 79, 130, 0.95)
    );
    color: #fff;
    padding: 2rem;
    height: 100%;
}

.auth-aside p {
    color: rgba(255, 255, 255, 0.8);
}

.auth-content {
    padding: 2rem;
}

.page-actions {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.topbar-search {
    max-width: 420px;
    width: 100%;
    background: #f8fafc;
    border: 1px solid var(--sl-border);
    border-radius: 14px;
    padding: 0.35rem 0.75rem;
    align-items: center;
    gap: 0.65rem;
}

.topbar-search i {
    color: var(--sl-muted);
}

.topbar-action-btn,
.topbar-profile-btn {
    min-height: 46px;
    border-radius: 14px;
}

.topbar-avatar {
    width: 34px;
    height: 34px;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: rgba(31, 79, 130, 0.12);
    color: var(--sl-primary-dark);
    font-weight: 700;
}

.app-footer {
    color: var(--sl-muted);
    font-size: 0.9rem;
}

.sl-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.45rem 0.7rem;
    border-radius: 999px;
    font-size: 0.76rem;
    font-weight: 700;
    letter-spacing: 0.03em;
}

.sl-badge-secondary {
    background: #e2e8f0;
    color: #475569;
}
.sl-badge-primary {
    background: #dbeafe;
    color: #1d4ed8;
}
.sl-badge-warning {
    background: #fef3c7;
    color: #a16207;
}
.sl-badge-purple {
    background: #ede9fe;
    color: #6d28d9;
}
.sl-badge-orange {
    background: #ffedd5;
    color: #c2410c;
}
.sl-badge-info {
    background: #cffafe;
    color: #0f766e;
}
.sl-badge-success {
    background: #dcfce7;
    color: #166534;
}
.sl-badge-danger {
    background: #fee2e2;
    color: #b91c1c;
}
.sl-badge-dark-success {
    background: #bbf7d0;
    color: #14532d;
}
.sl-badge-dark {
    background: #cbd5e1;
    color: #0f172a;
}

.timeline-item {
    position: relative;
    display: flex;
    gap: 1rem;
    padding: 0 0 1.25rem 0;
}

.timeline-item:not(:last-child)::after {
    content: "";
    position: absolute;
    left: 7px;
    top: 20px;
    bottom: 0;
    width: 2px;
    background: #e2e8f0;
}

.timeline-item-dot {
    width: 16px;
    height: 16px;
    border-radius: 999px;
    background: var(--sl-primary);
    margin-top: 2px;
    flex: 0 0 auto;
}

.timeline-item-content {
    min-width: 0;
}

.workflow-stepper-item {
    flex: 1 1 220px;
    display: flex;
    gap: 0.9rem;
    align-items: flex-start;
    padding: 1rem;
    border-radius: 16px;
    background: #fff;
    border: 1px solid var(--sl-border);
}

.workflow-stepper-item.active {
    border-color: rgba(31, 79, 130, 0.45);
    background: #eff6ff;
}

.workflow-stepper-item.completed {
    border-color: rgba(25, 135, 84, 0.3);
    background: #f0fdf4;
}

.workflow-stepper-index {
    width: 34px;
    height: 34px;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: rgba(31, 79, 130, 0.12);
    color: var(--sl-primary-dark);
    font-weight: 700;
    flex: 0 0 auto;
}

@media (max-width: 991.98px) {
    .app-layout {
        display: block;
    }

    .app-sidebar {
        width: auto;
        flex: none;
        padding: 0;
    }

    .app-main {
        padding: 1rem;
    }

    .page-header {
        flex-direction: column;
        align-items: stretch;
    }

    .app-shell {
        padding-top: 0.5rem;
    }

    .table-toolbar-per-page {
        flex: 1 1 160px;
    }

    .topbar-search {
        display: none !important;
    }
}
