:root {
    --bg: #f4f7ff;
    --surface: #ffffff;
    --primary: #2e7dd7;
    --primary-dark: #1e5ea7;
    --accent: #f8b8cf;
    --text: #203248;
    --muted: #6f7f96;
    --ring: rgba(46, 125, 215, 0.25);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: "Tajawal", sans-serif;
    background:
        radial-gradient(circle at 100% 0%, #ffeaf3 0, transparent 35%),
        radial-gradient(circle at 0% 100%, #e8f6ff 0, transparent 40%),
        var(--bg);
    color: var(--text);
}

a {
    text-decoration: none;
}

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

.btn-primary:hover,
.btn-primary:focus {
    background-color: var(--primary-dark);
    border-color: var(--primary-dark);
}

.form-control:focus,
.form-select:focus,
.btn:focus {
    box-shadow: 0 0 0 .25rem var(--ring);
}

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

.side-nav {
    width: 280px;
    padding: 24px 18px;
    background: linear-gradient(180deg, #113861 0%, #1a4c80 100%);
    color: #fff;
    position: sticky;
    top: 0;
    align-self: flex-start;
    min-height: 100vh;
}

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

.brand-icon {
    width: 42px;
    height: 42px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.2);
    display: grid;
    place-items: center;
}

.brand-title {
    font-size: 18px;
    font-weight: 800;
}

.brand-sub {
    font-size: 12px;
    opacity: 0.8;
}

.side-nav .nav-link {
    color: rgba(255, 255, 255, 0.85);
    padding: 10px 12px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.side-nav .nav-link:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.1);
}

.side-nav .nav-link.active {
    background: rgba(255, 255, 255, 0.2);
    color: #fff;
    font-weight: 700;
}

.main-content {
    flex: 1;
    min-width: 0;
}

.topbar {
    position: sticky;
    top: 0;
    z-index: 5;
    background: rgba(244, 247, 255, 0.92);
    backdrop-filter: blur(8px);
    padding: 16px 24px;
    border-bottom: 1px solid #e3eaf5;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
}

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

.topbar-user {
    display: flex;
    align-items: center;
    gap: 12px;
}

.user-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: var(--surface);
    border-radius: 999px;
    padding: 6px 12px;
    border: 1px solid #e2e8f3;
}

.content-area {
    padding: 24px;
}

.guest-main {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
}

.login-card {
    border-radius: 18px;
}

.card {
    border-radius: 16px;
}

.stat-card {
    background: linear-gradient(145deg, #fff 0%, #f9fcff 100%);
    border: 1px solid #e3ecf7;
    border-radius: 16px;
    padding: 16px;
    height: 100%;
}

.stat-label {
    color: var(--muted);
    font-size: 13px;
    margin-bottom: 8px;
}

.stat-value {
    font-size: 22px;
    font-weight: 800;
    line-height: 1.2;
}

.summary-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
    font-size: 15px;
}

.summary-row.final {
    font-weight: 800;
    font-size: 17px;
    margin-top: 4px;
}

.sticky-top-summary {
    top: 88px;
}

@media (max-width: 992px) {
    .side-nav {
        position: relative;
        min-height: auto;
        width: 100%;
        transform: none;
        border-bottom-left-radius: 16px;
        border-bottom-right-radius: 16px;
    }

    .app-shell {
        display: block;
    }

    .topbar {
        padding: 14px 16px;
    }

    .content-area {
        padding: 16px;
    }
}
