:root {
    --sidebar-bg: #0f172a;
    --accent: #3b82f6;
    --content-bg: #f1f5f9;
}

* {
    box-sizing: border-box;
}

.bg-orange {
    background-color: #fd7e14 !important;
    color: #fff;
}

body {
    margin: 0;
    background-color: var(--content-bg);
    font-family: "Segoe UI", Roboto, Arial, sans-serif;
}

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

.sidebar {
    width: 264px;
    flex-shrink: 0;
    background-color: var(--sidebar-bg);
    color: #cbd5e1;
    display: flex;
    flex-direction: column;
    transition: margin-left 0.2s ease-in-out;
    border-right: 1px solid rgba(255, 255, 255, 0.06);
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 0.7rem;
    color: #fff;
    font-weight: 700;
    font-size: 1.05rem;
    padding: 1.15rem 1.25rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    flex-shrink: 0;
}

.sidebar-brand .brand-icon {
    width: 38px;
    height: 38px;
    border-radius: 0.65rem;
    background: linear-gradient(135deg, var(--accent) 0%, #2563eb 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    box-shadow: 0 2px 8px rgba(59, 130, 246, 0.35);
}

.sidebar-brand .brand-icon i {
    color: #fff;
    font-size: 1.15rem;
}

.sidebar-brand .brand-text {
    display: flex;
    flex-direction: column;
    line-height: 1.2;
    min-width: 0;
    overflow: hidden;
}

.sidebar-brand .brand-text span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.sidebar-brand .brand-subtitle {
    font-size: 0.68rem;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.45);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.sidebar-nav {
    list-style: none;
    margin: 0;
    padding: 0.6rem 0.75rem 1rem;
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
}

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

.sidebar-nav::-webkit-scrollbar-thumb {
    background-color: rgba(255, 255, 255, 0.12);
    border-radius: 3px;
}

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

.sidebar-section-label {
    padding: 1rem 0.6rem 0.35rem;
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.32);
}

.sidebar-section-label:first-child {
    padding-top: 0.25rem;
}

.sidebar-nav li a {
    display: flex;
    align-items: center;
    gap: 0.7rem;
    padding: 0.6rem 0.75rem;
    margin-bottom: 0.15rem;
    color: #cbd5e1;
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 500;
    border-radius: 0.6rem;
    transition: background-color 0.15s ease, color 0.15s ease;
}

.sidebar-nav li a i:not(.submenu-caret) {
    width: 20px;
    text-align: center;
    font-size: 1.05rem;
    color: #94a3b8;
    flex-shrink: 0;
    transition: color 0.15s ease;
}

.sidebar-nav li a:hover {
    background-color: rgba(255, 255, 255, 0.06);
    color: #fff;
}

.sidebar-nav li a:hover i:not(.submenu-caret) {
    color: #fff;
}

.sidebar-nav li a.active {
    background: linear-gradient(90deg, rgba(59, 130, 246, 0.22) 0%, rgba(59, 130, 246, 0.08) 100%);
    color: #fff;
    font-weight: 600;
    box-shadow: inset 3px 0 0 var(--accent);
}

.sidebar-nav li a.active i:not(.submenu-caret) {
    color: var(--accent);
}

.sidebar-nav .submenu-caret {
    transition: transform 0.2s ease-in-out;
    color: rgba(255, 255, 255, 0.35);
}

.sidebar-nav a[aria-expanded="true"] .submenu-caret {
    transform: rotate(180deg);
}

.sidebar-nav a[aria-expanded="true"] {
    color: #fff;
}

.sidebar-submenu {
    list-style: none;
    margin: 0.1rem 0 0.4rem;
    padding: 0;
    position: relative;
}

.sidebar-submenu li a {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    padding: 0.48rem 0.75rem 0.48rem 2.6rem;
    margin-bottom: 0.05rem;
    border-radius: 0.5rem;
    color: #94a3b8;
    text-decoration: none;
    font-size: 0.85rem;
    font-weight: 500;
    position: relative;
    transition: background-color 0.15s ease, color 0.15s ease;
}

.sidebar-submenu li a::before {
    content: "";
    position: absolute;
    left: 1.65rem;
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background-color: rgba(255, 255, 255, 0.25);
    transition: background-color 0.15s ease, transform 0.15s ease;
}

.sidebar-submenu li a:hover {
    background-color: rgba(255, 255, 255, 0.05);
    color: #fff;
}

.sidebar-submenu li a:hover::before {
    background-color: var(--accent);
}

.sidebar-submenu li a.active {
    color: #fff;
    font-weight: 600;
    background-color: rgba(59, 130, 246, 0.12);
}

.sidebar-submenu li a.active::before {
    background-color: var(--accent);
    transform: scale(1.3);
}

.main-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.topbar {
    background-color: #fff;
    padding: 0.85rem 1.5rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
}

.topbar-title {
    font-weight: 600;
    font-size: 1.15rem;
    color: #0f172a;
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

@media (max-width: 575.98px) {
    .topbar-title {
        display: none;
    }

    .topbar-search {
        margin-left: 0 !important;
    }
}

.topbar-user a {
    color: #0f172a;
}

.content-area {
    padding: 1.5rem;
    flex: 1;
}

.stat-card {
    background: #fff;
    border-radius: 0.9rem;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.07);
    padding: 1.25rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    border-top: 3px solid var(--stat-color, var(--accent));
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(15, 23, 42, 0.1);
}

.stat-card .icon-box {
    width: 52px;
    height: 52px;
    border-radius: 0.65rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    flex-shrink: 0;
    color: var(--stat-color, var(--accent));
    background-color: var(--stat-color-soft, rgba(59, 130, 246, 0.12));
}

.stat-card .stat-value {
    font-size: 1.4rem;
    font-weight: 700;
    color: #0f172a;
    line-height: 1.2;
}

.stat-card .stat-label {
    color: #64748b;
    font-size: 0.85rem;
}

.card {
    border: none;
    border-radius: 0.75rem;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.07);
}

/* Dashboard welcome banner */
.dashboard-welcome {
    background: linear-gradient(120deg, var(--sidebar-bg) 0%, #1e3a5f 100%);
    color: #fff;
    border-radius: 1rem;
    padding: 1.5rem 1.75rem;
    position: relative;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
}

.dashboard-welcome::before {
    content: "";
    position: absolute;
    width: 220px;
    height: 220px;
    border-radius: 50%;
    background: rgba(59, 130, 246, 0.18);
    top: -90px;
    right: -60px;
    pointer-events: none;
}

.dashboard-welcome h4 {
    margin: 0;
    font-weight: 700;
}

.dashboard-welcome .welcome-date {
    color: rgba(255, 255, 255, 0.65);
    font-size: 0.85rem;
}

.dashboard-welcome .welcome-icon {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.12);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    flex-shrink: 0;
}

/* Quick action tiles */
.quick-action-tile {
    border: 1px solid #e2e8f0;
    border-radius: 0.85rem;
    background: #fff;
    padding: 1rem 0.75rem;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    color: #0f172a;
    text-decoration: none;
    transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
    cursor: pointer;
    width: 100%;
    height: 100%;
}

.quick-action-tile:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 18px rgba(15, 23, 42, 0.08);
    border-color: var(--accent);
    color: #0f172a;
}

.quick-action-tile .qa-icon {
    width: 44px;
    height: 44px;
    border-radius: 0.65rem;
    background: rgba(59, 130, 246, 0.12);
    color: var(--accent);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
}

.quick-action-tile .qa-label {
    font-size: 0.85rem;
    font-weight: 600;
}

/* Recent activity type badges */
.activity-badge {
    font-weight: 500;
    padding: 0.3rem 0.6rem;
    border-radius: 2rem;
}

@media (max-width: 991.98px) {
    .sidebar {
        position: fixed;
        z-index: 1040;
        height: 100vh;
        margin-left: -250px;
    }

    .sidebar.show {
        margin-left: 0;
    }
}

.login-page {
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: radial-gradient(circle at 20% 15%, #1e293b 0%, #0f172a 55%, #090f1e 100%);
    padding: max(1rem, env(safe-area-inset-top)) max(1rem, env(safe-area-inset-right)) max(1.5rem, env(safe-area-inset-bottom)) max(1rem, env(safe-area-inset-left));
    position: relative;
    overflow: hidden;
}

.login-page::before,
.login-page::after {
    content: "";
    position: absolute;
    border-radius: 50%;
    background: rgba(59, 130, 246, 0.18);
    filter: blur(10px);
    pointer-events: none;
}

.login-page::before {
    width: 320px;
    height: 320px;
    top: -120px;
    left: -100px;
}

.login-page::after {
    width: 260px;
    height: 260px;
    bottom: -100px;
    right: -80px;
    background: rgba(59, 130, 246, 0.12);
}

.login-card {
    width: 100%;
    max-width: 400px;
    border-radius: 1.25rem;
    overflow: hidden;
    position: relative;
    z-index: 1;
    animation: loginCardIn 0.45s ease-out;
}

@keyframes loginCardIn {
    from { opacity: 0; transform: translateY(14px); }
    to { opacity: 1; transform: translateY(0); }
}

.login-card .login-header {
    background-color: var(--sidebar-bg);
    color: #fff;
    padding: 2.25rem 1.5rem 1.75rem;
    text-align: center;
}

.login-card .login-header .login-icon-wrap {
    width: 64px;
    height: 64px;
    margin: 0 auto;
    border-radius: 50%;
    background: rgba(59, 130, 246, 0.18);
    display: flex;
    align-items: center;
    justify-content: center;
}

.login-card .login-header i {
    font-size: 1.9rem;
    color: var(--accent);
}

.login-card .login-body {
    padding: 1.75rem;
    background: #fff;
}

/* Inputs use 16px+ font so iOS Safari doesn't auto-zoom on focus. */
.login-card .form-control {
    font-size: 16px;
    padding-top: 0.65rem;
    padding-bottom: 0.65rem;
}

.login-card .input-group .btn-toggle-password {
    border-color: #ced4da;
}

.login-card #btnLogin {
    min-height: 48px;
    font-size: 1rem;
}

.login-footer-text {
    text-align: center;
    color: rgba(255, 255, 255, 0.55);
    font-size: 0.8rem;
    margin-top: 1.25rem;
    position: relative;
    z-index: 1;
}

/* Small phones: let the card touch the viewport edges with a little breathing room. */
@media (max-width: 380px) {
    .login-page {
        padding-left: 0.5rem;
        padding-right: 0.5rem;
    }

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

    .login-card .login-body {
        padding: 1.5rem 1.25rem;
    }
}
