:root {
    --brand: #0A4D8C;
    --brand-dark: #073a6b;
    --accent: #F5B041;
    --bg: #f5f7fb;
    --card-bg: #ffffff;
    --text: #1a1a2e;
    --muted: #6b7280;
    --border: #e5e7eb;
    --danger: #dc3545;
    --success: #198754;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    background: var(--bg);
    color: var(--text);
}

/* ---- Auth pages ---- */
.auth-wrap {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem 1rem;
    background: linear-gradient(135deg, #0A4D8C 0%, #073a6b 100%);
}

.auth-card {
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0,0,0,.25);
    padding: 2.5rem 2rem;
    width: 100%;
    max-width: 440px;
}

    .auth-card h1 {
        font-size: 1.5rem;
        margin: 0 0 .25rem;
        color: var(--brand);
    }

    .auth-card p.subtitle {
        color: var(--muted);
        margin: 0 0 1.5rem;
        font-size: .9rem;
    }

/* ---- App shell ---- */
.app-shell {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: 240px;
    background: #0f172a;
    color: #e2e8f0;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    padding: 1.25rem 0;
}

    .sidebar .brand {
        padding: 0 1.25rem 1.25rem;
        font-weight: 700;
        font-size: 1.05rem;
        color: #fff;
        border-bottom: 1px solid #1e293b;
    }

        .sidebar .brand small {
            color: var(--accent);
            font-weight: 500;
            font-size: .72rem;
            display: block;
            margin-top: 2px;
        }

    .sidebar nav {
        flex: 1;
        padding: 1rem 0;
    }

        .sidebar nav a {
            display: block;
            padding: .65rem 1.25rem;
            color: #cbd5e1;
            text-decoration: none;
            font-size: .9rem;
            border-left: 3px solid transparent;
        }

            .sidebar nav a:hover {
                background: #1e293b;
                color: #fff;
            }

            .sidebar nav a.active {
                background: #1e293b;
                color: #fff;
                border-left-color: var(--accent);
            }

    .sidebar footer {
        padding: 1rem 1.25rem 0;
        border-top: 1px solid #1e293b;
        font-size: .8rem;
        color: #94a3b8;
    }

.main {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.topbar {
    background: #fff;
    border-bottom: 1px solid var(--border);
    padding: .9rem 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

    .topbar h2 {
        font-size: 1.15rem;
        margin: 0;
    }

    .topbar .who {
        font-size: .85rem;
        color: var(--muted);
    }

.content {
    padding: 1.5rem;
}

/* ---- Cards & panels ---- */
.stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.stat-card {
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 1.1rem 1.2rem;
}

    .stat-card .label {
        font-size: .75rem;
        color: var(--muted);
        text-transform: uppercase;
        letter-spacing: .04em;
    }

    .stat-card .value {
        font-size: 1.9rem;
        font-weight: 700;
        color: var(--brand);
        margin-top: .25rem;
    }

.panel {
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 1.25rem 1.25rem;
    margin-bottom: 1.25rem;
}

    .panel h3 {
        font-size: 1rem;
        margin: 0 0 1rem;
    }

    .panel .table {
        margin-bottom: 0;
    }

/* ---- Buttons ---- */
.btn-brand {
    background: var(--brand);
    color: #fff;
    border: 0;
}

    .btn-brand:hover {
        background: var(--brand-dark);
        color: #fff;
    }

/* ---- Toasts ---- */
#toast-container {
    position: fixed;
    top: 1rem;
    right: 1rem;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: .5rem;
}

.toast-msg {
    padding: .7rem 1rem;
    border-radius: 8px;
    color: #fff;
    font-size: .88rem;
    box-shadow: 0 6px 18px rgba(0,0,0,.15);
    animation: slideIn .2s ease-out;
}

    .toast-msg.success {
        background: var(--success);
    }

    .toast-msg.error {
        background: var(--danger);
    }

    .toast-msg.info {
        background: var(--brand);
    }

@keyframes slideIn {
    from {
        transform: translateX(30px);
        opacity: 0;
    }

    to {
        transform: none;
        opacity: 1;
    }
}

.muted {
    color: var(--muted);
}

.hidden {
    display: none !important;
}

@media (max-width: 768px) {
    .sidebar {
        width: 60px;
    }

        .sidebar .brand, .sidebar footer {
            display: none;
        }

        .sidebar nav a {
            font-size: 1.1rem;
            text-align: center;
            padding: .75rem 0;
        }

            .sidebar nav a .label {
                display: none;
            }
}
