:root {
    --app-primary: #355c7d;
    --app-primary-soft: #e6eef7;
    --app-success: #5f9f7d;
    --app-success-soft: #e8f5ee;
    --app-warning-soft: #fff4dd;
    --app-danger-soft: #fdecec;
    --app-info-soft: #e7f2fb;
    --app-bg: #f8fafc;
    --app-surface: #ffffff;
    --app-sidebar: #fbfcfe;
    --app-border: #dbe4ee;
    --app-text: #25364a;
    --app-muted: #6b7b8d;
    --app-shadow: 0 18px 45px rgba(37, 54, 74, 0.08);
    --app-radius: 1.1rem;
    --navbar-height: 78px;
    --sidebar-width: 280px;
    --sidebar-width-collapsed: 92px;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: "Public Sans", sans-serif;
    background:
        radial-gradient(circle at top right, rgba(53, 92, 125, 0.08), transparent 26%),
        linear-gradient(180deg, #fbfdff 0%, var(--app-bg) 100%);
    color: var(--app-text);
}

a {
    color: var(--app-primary);
    text-decoration: none;
}

.app-navbar {
    min-height: var(--navbar-height);
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(14px);
    border-bottom: 1px solid rgba(219, 228, 238, 0.8);
}

.navbar-brand {
    color: var(--app-text);
}

.brand-mark {
    width: 2.65rem;
    height: 2.65rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 0.9rem;
    background: linear-gradient(135deg, var(--app-primary), #4d7a9f);
    color: #fff;
    box-shadow: 0 12px 24px rgba(53, 92, 125, 0.2);
}

.brand-title {
    font-size: 1rem;
    font-weight: 700;
    line-height: 1.1;
}

.brand-subtitle {
    color: var(--app-muted);
    font-size: 0.73rem;
}

.btn-icon {
    width: 2.7rem;
    height: 2.7rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 0.9rem;
}

.app-search {
    width: min(100%, 460px);
}

.app-search .input-group {
    border: 1px solid var(--app-border);
    border-radius: 999px;
    background: #fff;
    padding: 0.2rem 0.5rem;
}

.app-search .form-control,
.app-search .input-group-text {
    background: transparent;
}

.user-menu-btn {
    border: 1px solid var(--app-border);
    background: #fff;
    border-radius: 999px;
    padding: 0.45rem 0.65rem;
    display: inline-flex;
    align-items: center;
    gap: 0.75rem;
    color: var(--app-text);
}

.user-avatar,
.sidebar-user-avatar {
    width: 2.55rem;
    height: 2.55rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: linear-gradient(135deg, #dfeaf5, #eef5fb);
    color: var(--app-primary);
    font-weight: 700;
}

.notification-badge {
    position: absolute;
    top: 0.3rem;
    right: 0.3rem;
    min-width: 1.15rem;
    height: 1.15rem;
    border-radius: 999px;
    background: #ea5455;
    color: #fff;
    font-size: 0.7rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.app-sidebar {
    position: fixed;
    top: var(--navbar-height);
    left: 0;
    width: var(--sidebar-width);
    height: calc(100vh - var(--navbar-height));
    padding: 1.25rem;
    background: var(--app-sidebar);
    border-right: 1px solid rgba(219, 228, 238, 0.85);
    overflow-y: auto;
    transition: width 0.3s ease, transform 0.3s ease;
    z-index: 1020;
}

.sidebar-inner {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.sidebar-user-card {
    display: flex;
    align-items: center;
    gap: 0.9rem;
    padding: 1rem;
    background: #fff;
    border: 1px solid var(--app-border);
    border-radius: 1rem;
    box-shadow: 0 10px 25px rgba(37, 54, 74, 0.05);
}

.sidebar-section-title {
    margin: 0.2rem 0 0.65rem;
    padding: 0 0.7rem;
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #8a9aad;
}

.sidebar-nav {
    gap: 0.35rem;
}

.sidebar-link,
.sidebar-sublink,
.sidebar-dropdown {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 0.8rem;
    padding: 0.82rem 0.9rem;
    border-radius: 0.95rem;
    color: var(--app-text);
    border: 0;
    background: transparent;
    text-align: left;
    transition: all 0.2s ease;
}

.sidebar-link:hover,
.sidebar-sublink:hover,
.sidebar-dropdown:hover {
    background: #f0f5fa;
    color: var(--app-primary);
}

.sidebar-link.active,
.sidebar-sublink.active,
.sidebar-dropdown:not(.collapsed) {
    background: linear-gradient(135deg, rgba(53, 92, 125, 0.14), rgba(95, 159, 125, 0.08));
    color: var(--app-primary);
    box-shadow: inset 0 0 0 1px rgba(53, 92, 125, 0.08);
}

.sidebar-link-icon {
    width: 1.15rem;
    text-align: center;
    flex-shrink: 0;
}

.sidebar-link-text {
    flex-grow: 1;
}

.sidebar-link-arrow {
    transition: transform 0.25s ease;
}

.sidebar-dropdown:not(.collapsed) .sidebar-link-arrow {
    transform: rotate(90deg);
}

.sidebar-submenu {
    padding-left: 2.75rem;
}

.sidebar-sublink {
    padding-top: 0.6rem;
    padding-bottom: 0.6rem;
    color: var(--app-muted);
}

.app-main {
    min-height: 100vh;
    padding-top: calc(var(--navbar-height) + 1.5rem);
    margin-left: var(--sidebar-width);
    transition: margin-left 0.3s ease;
}

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

.app-content {
    padding: 0 1.5rem 1.5rem;
}

.app-shell.sidebar-collapsed .app-sidebar {
    width: var(--sidebar-width-collapsed);
}

.app-shell.sidebar-collapsed .app-main {
    margin-left: var(--sidebar-width-collapsed);
}

.app-shell.sidebar-collapsed .sidebar-section-title,
.app-shell.sidebar-collapsed .sidebar-user-card > div:last-child,
.app-shell.sidebar-collapsed .sidebar-link-text,
.app-shell.sidebar-collapsed .sidebar-link-arrow,
.app-shell.sidebar-collapsed .sidebar-submenu {
    display: none;
}

.app-shell.sidebar-collapsed .sidebar-user-card {
    justify-content: center;
}

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

.breadcrumb {
    margin-bottom: 0;
}

.breadcrumb-item + .breadcrumb-item::before {
    color: #99a7b5;
}

.page-title {
    margin: 0;
    font-size: clamp(1.65rem, 3vw, 2.15rem);
    font-weight: 700;
    color: var(--app-text);
}

.page-subtitle {
    max-width: 700px;
    color: var(--app-muted);
}

.app-card {
    border: 1px solid rgba(219, 228, 238, 0.95);
    border-radius: var(--app-radius);
    box-shadow: var(--app-shadow);
    background: var(--app-surface);
}

.app-card .card-header {
    padding: 1.25rem 1.25rem 0;
    background: transparent;
    border-bottom: 0;
}

.app-card .card-body {
    padding: 1.25rem;
}

.card-title {
    font-weight: 700;
}

.stat-card {
    position: relative;
    overflow: hidden;
    padding: 1.4rem;
    border-radius: 1.3rem;
    box-shadow: var(--app-shadow);
    border: 1px solid rgba(255, 255, 255, 0.45);
}

.stat-card::after {
    content: "";
    position: absolute;
    width: 8rem;
    height: 8rem;
    border-radius: 50%;
    top: -2.4rem;
    right: -2rem;
    opacity: 0.25;
}

.stat-card-primary {
    background: linear-gradient(135deg, #eef4fb, #ffffff);
}

.stat-card-primary::after {
    background: #aac1d8;
}

.stat-card-success {
    background: linear-gradient(135deg, #edf7f1, #ffffff);
}

.stat-card-success::after {
    background: #a9d2ba;
}

.stat-card-warning {
    background: linear-gradient(135deg, #fff7e7, #ffffff);
}

.stat-card-warning::after {
    background: #ead4a3;
}

.stat-card-danger {
    background: linear-gradient(135deg, #fff0f0, #ffffff);
}

.stat-card-danger::after {
    background: #f0b2b2;
}

.stat-icon {
    width: 3rem;
    height: 3rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 1rem;
    margin-bottom: 1rem;
    background: rgba(255, 255, 255, 0.75);
    color: var(--app-primary);
    font-size: 1.15rem;
}

.stat-label {
    color: var(--app-muted);
    font-weight: 600;
}

.stat-value {
    margin: 0.35rem 0;
    font-size: 2rem;
    font-weight: 700;
}

.stat-meta {
    color: var(--app-muted);
    font-size: 0.92rem;
}

.timeline-list {
    display: grid;
    gap: 1rem;
}

.timeline-item {
    display: flex;
    gap: 1rem;
    align-items: flex-start;
}

.timeline-icon {
    width: 2.75rem;
    height: 2.75rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 0.95rem;
    flex-shrink: 0;
}

.quick-actions-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.95rem;
}

.quick-action-tile {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.8rem;
    padding: 1rem;
    background: linear-gradient(180deg, #fbfdff, #f4f8fb);
    border: 1px solid var(--app-border);
    border-radius: 1rem;
    color: var(--app-text);
    min-height: 120px;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.quick-action-tile i {
    width: 2.6rem;
    height: 2.6rem;
    border-radius: 0.9rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--app-primary-soft);
    color: var(--app-primary);
}

.quick-action-tile:hover {
    transform: translateY(-2px);
    box-shadow: 0 14px 28px rgba(53, 92, 125, 0.08);
}

.chart-card .card-body {
    min-height: 320px;
}

.chart-placeholder {
    width: 100%;
}

.chart-ring {
    width: 180px;
    height: 180px;
    margin: 0 auto;
    border-radius: 50%;
    display: grid;
    place-items: center;
    background: conic-gradient(var(--app-success) 0 84%, #e9eef4 84% 100%);
    position: relative;
}

.chart-ring::after {
    content: "";
    position: absolute;
    inset: 18px;
    background: #fff;
    border-radius: 50%;
}

.chart-ring span {
    position: relative;
    z-index: 1;
    font-size: 2rem;
    font-weight: 700;
    color: var(--app-text);
}

.btn-soft-primary,
.btn-soft-success {
    border-radius: 999px;
    border: 1px solid transparent;
}

.btn-soft-primary {
    background: var(--app-primary-soft);
    color: var(--app-primary);
}

.btn-soft-success {
    background: var(--app-success-soft);
    color: #397156;
}

.table,
.form-control,
.form-select,
.input-group-text {
    border-color: var(--app-border);
}

.form-control,
.form-select {
    min-height: 2.85rem;
    border-radius: 0.9rem;
}

.table > :not(caption) > * > * {
    padding: 0.9rem 0.75rem;
}

.datatable thead th {
    color: var(--app-muted);
    font-size: 0.85rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.mobile-sidebar {
    background: #fff;
}

.mobile-sidebar .offcanvas-header {
    border-bottom: 1px solid var(--app-border);
}

.mobile-actions-menu {
    width: 290px;
    border: 0;
    border-radius: 1rem;
    box-shadow: var(--app-shadow);
}

.app-footer {
    margin: 0 1.5rem 1.5rem;
    padding: 1rem 1.25rem;
    border: 1px solid rgba(219, 228, 238, 0.95);
    border-radius: 1rem;
    background: rgba(255, 255, 255, 0.85);
    color: var(--app-muted);
}

.swal2-popup {
    border-radius: 1.2rem;
}

@media (max-width: 991.98px) {
    .app-main {
        margin-left: 0;
        padding-top: calc(var(--navbar-height) + 1rem);
    }

    .app-content {
        padding: 0 1rem 1rem;
    }

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

    .app-footer {
        margin: 0 1rem 1rem;
    }
}

@media (max-width: 767.98px) {
    :root {
        --navbar-height: 72px;
    }

    .quick-actions-grid {
        grid-template-columns: 1fr;
    }

    .stat-card,
    .app-card .card-body,
    .app-card .card-header {
        padding-left: 1rem;
        padding-right: 1rem;
    }

    .page-heading {
        margin-bottom: 1.25rem;
    }

    .chart-card .card-body {
        min-height: 260px;
    }
}
