:root {
    --bg: #f4f7fb;
    --surface: #ffffff;
    --sidebar: #0f2744;
    --sidebar-text: #c8d9ef;
    --brand-red: #b21e22;
    --brand-black: #1a1a1a;
    --primary: #b21e22;
    --primary-dark: #8f181b;
    --text: #1a2332;
    --muted: #64748b;
    --border: #dbe4f0;
    --green: #059669;
    --orange: #d97706;
    --red: #dc2626;
    --shadow: 0 10px 30px rgba(15, 39, 68, 0.08);
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
}

.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: 260px;
    height: 100vh;
    background: var(--sidebar);
    color: white;
    display: flex;
    flex-direction: column;
    padding: 1.25rem 0;
    overflow-y: auto;
}

.brand {
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
    align-items: center;
    padding: 0 1rem 1.5rem;
    border-bottom: 1px solid rgba(255,255,255,0.08);
    text-align: center;
}

.brand-logo {
    width: 100%;
    max-width: 180px;
    height: auto;
    display: block;
    background: white;
    border-radius: 10px;
    padding: 0.5rem;
}

.brand-tagline {
    display: block;
    color: var(--sidebar-text);
    font-size: 0.75rem;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.nav-links {
    list-style: none;
    padding: 1rem 0;
    margin: 0;
    flex: 1;
}

.nav-links li a {
    display: block;
    padding: 0.65rem 1.25rem;
    color: var(--sidebar-text);
    text-decoration: none;
    font-size: 0.92rem;
}

.nav-links li a:hover,
.nav-links li a.active {
    background: rgba(255,255,255,0.08);
    color: white;
}

.nav-section {
    padding: 1rem 1.25rem 0.35rem;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: rgba(255,255,255,0.45);
}

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

.user-badge { margin-bottom: 0.5rem; }
.role-tag {
    display: inline-block;
    margin-left: 0.5rem;
    padding: 0.1rem 0.45rem;
    border-radius: 999px;
    background: rgba(255,255,255,0.12);
    font-size: 0.72rem;
    text-transform: uppercase;
}

.logout-link { color: #93c5fd; font-size: 0.85rem; }

main.with-sidebar {
    margin-left: 260px;
    padding: 1.5rem 2rem 2rem;
}

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

.page-header h1 { margin: 0 0 0.25rem; font-size: 1.75rem; }
.page-subtitle { margin: 0; color: var(--muted); }

.header-actions { display: flex; gap: 0.5rem; flex-wrap: wrap; }

.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 1.25rem;
    margin-bottom: 1.25rem;
    box-shadow: var(--shadow);
}

.highlight-card {
    border-color: #93c5fd;
    background: linear-gradient(180deg, #f8fbff 0%, #ffffff 100%);
}

.card h2 {
    margin: 0 0 1rem;
    font-size: 1.05rem;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 1rem;
    margin-bottom: 1.25rem;
}

.stat-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 1.1rem 1.25rem;
    box-shadow: var(--shadow);
}

.stat-card.accent-green { border-left: 4px solid var(--green); }
.stat-card.accent-orange { border-left: 4px solid var(--orange); }
.stat-card.accent-red { border-left: 4px solid var(--red); }

.stat-label {
    display: block;
    color: var(--muted);
    font-size: 0.82rem;
    margin-bottom: 0.35rem;
}

.stat-value {
    font-size: 1.8rem;
    font-weight: 700;
}

.grid-2 {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 1.25rem;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

.data-table th,
.data-table td {
    padding: 0.75rem 0.65rem;
    border-bottom: 1px solid var(--border);
    text-align: left;
}

.data-table th {
    background: #f8fafc;
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--muted);
}

.data-table.compact th,
.data-table.compact td { padding: 0.55rem 0.5rem; }

.row-low { background: #fff5f5; }

.empty, .empty-state {
    color: var(--muted);
    text-align: center;
}

.badge {
    display: inline-block;
    padding: 0.15rem 0.55rem;
    border-radius: 999px;
    font-size: 0.72rem;
    font-weight: 600;
}

.badge-green { background: #d1fae5; color: #065f46; }
.badge-orange { background: #ffedd5; color: #9a3412; }
.badge-red { background: #fee2e2; color: #991b1b; }
.badge-blue { background: #dbeafe; color: #1e40af; }

.btn {
    display: inline-block;
    padding: 0.6rem 1rem;
    border: none;
    border-radius: 8px;
    font-size: 0.9rem;
    cursor: pointer;
    text-decoration: none;
    transition: background 0.15s;
}

.btn-primary { background: var(--primary); color: white; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-secondary { background: #e2e8f0; color: var(--text); }
.btn-secondary:hover { background: #cbd5e1; }
.btn-sm { padding: 0.35rem 0.65rem; font-size: 0.8rem; }
.btn-block { width: 100%; }

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

.form-group { display: flex; flex-direction: column; gap: 0.35rem; }
.form-group.full-width { grid-column: 1 / -1; }

label { font-size: 0.85rem; font-weight: 600; }

input, select, textarea {
    padding: 0.65rem 0.75rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 0.92rem;
    background: white;
}

.field-note, .hint { color: var(--muted); font-size: 0.78rem; font-weight: 400; }

.form-actions { grid-column: 1 / -1; }
.form-inline { display: flex; gap: 0.5rem; align-items: center; flex-wrap: wrap; }

.filter-bar {
    display: flex;
    gap: 0.65rem;
    flex-wrap: wrap;
    margin-bottom: 1rem;
}

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

.flash-container { margin-bottom: 1rem; }

.flash {
    padding: 0.75rem 1rem;
    border-radius: 8px;
    margin-bottom: 0.5rem;
}

.flash-success { background: #d1fae5; color: #065f46; }
.flash-danger { background: #fee2e2; color: #991b1b; }
.flash-info { background: #dbeafe; color: #1e40af; }
.flash-warning { background: #fef3c7; color: #92400e; }

.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    background: linear-gradient(135deg, var(--brand-black) 0%, var(--brand-red) 100%);
}

.login-card {
    width: 100%;
    max-width: 420px;
    background: white;
    border-radius: 16px;
    padding: 2rem;
    box-shadow: 0 20px 50px rgba(0,0,0,0.2);
}

.login-brand {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    margin-bottom: 1.5rem;
}

.login-logo {
    width: 100%;
    max-width: 260px;
    height: auto;
    display: block;
    margin-bottom: 0.75rem;
}

.subtitle {
    color: var(--brand-black);
    margin: 0;
    font-size: 1rem;
    font-weight: 700;
    letter-spacing: 0.03em;
    text-transform: uppercase;
}

.login-tagline {
    color: var(--muted);
    margin: 0.35rem 0 0;
    font-size: 0.9rem;
}

.login-card form { display: flex; flex-direction: column; gap: 0.85rem; }

.login-hint {
    margin-top: 1.25rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border);
    font-size: 0.82rem;
    color: var(--muted);
}

.login-hint ul { margin: 0.35rem 0 0; padding-left: 1.2rem; }

.role-legend {
    margin-top: 1rem;
    font-size: 0.85rem;
    color: var(--muted);
}

@media (max-width: 900px) {
    .sidebar {
        position: static;
        width: 100%;
        height: auto;
    }
    main.with-sidebar { margin-left: 0; padding: 1rem; }
    .page-header { flex-direction: column; }
}
