:root {
    --brand-red: #dc3545;
    --brand-red-dark: #b02a37;
    --brand-red-light: #fdecee;
    --sidebar-width: 250px;
    --topbar-height: 64px;
    --body-bg: #f4f5f8;
}

* { box-sizing: border-box; }

body {
    background: var(--body-bg);
    font-family: "Segoe UI", Roboto, -apple-system, BlinkMacSystemFont, Arial, sans-serif;
    font-size: 0.925rem;
    color: #2b2f33;
}

a { text-decoration: none; }

/* ---------- Sidebar ---------- */
.app-sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: var(--sidebar-width);
    background: #ffffff;
    border-right: 1px solid #ebedf0;
    overflow-y: auto;
    z-index: 1030;
    transition: left .2s ease;
}

.app-sidebar .brand {
    display: flex;
    align-items: center;
    gap: .6rem;
    padding: 1.1rem 1.25rem;
    border-bottom: 1px solid #f0f1f3;
}

.app-sidebar .brand-icon {
    width: 34px;
    height: 34px;
    border-radius: 9px;
    background: var(--brand-red);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    flex: none;
}

.app-sidebar .brand-text {
    font-weight: 700;
    font-size: 1.02rem;
    color: #22262a;
    line-height: 1.1;
}

.app-sidebar .nav-heading {
    font-size: .68rem;
    font-weight: 700;
    letter-spacing: .08em;
    color: #9aa1a9;
    padding: 1rem 1.25rem .4rem;
}

.app-sidebar .nav-link {
    display: flex;
    align-items: center;
    gap: .65rem;
    padding: .62rem 1.25rem;
    color: #4b5157;
    font-weight: 500;
    font-size: .88rem;
    border-left: 3px solid transparent;
}

.app-sidebar .nav-link i { width: 18px; text-align: center; color: #868d94; }

.app-sidebar .nav-link:hover {
    background: #f7f8fa;
    color: #22262a;
}

.app-sidebar .nav-link.active {
    background: var(--brand-red-light);
    color: var(--brand-red);
    border-left-color: var(--brand-red);
    font-weight: 600;
}

.app-sidebar .nav-link.active i { color: var(--brand-red); }

/* ---------- Topbar / content ---------- */
.app-main {
    margin-left: var(--sidebar-width);
    min-height: 100vh;
}

.app-topbar {
    height: var(--topbar-height);
    background: #fff;
    border-bottom: 1px solid #ebedf0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1.5rem;
    position: sticky;
    top: 0;
    z-index: 1020;
}

.app-topbar .page-title {
    display: flex;
    align-items: center;
    gap: .6rem;
    font-size: 1.15rem;
    font-weight: 600;
    color: #22262a;
}

.app-topbar .page-title i { color: var(--brand-red); }

.app-topbar .topbar-actions { display: flex; gap: .55rem; flex-wrap: wrap; }

.app-content { padding: 1.5rem; }

.sidebar-toggle { display: none; }

@media (max-width: 991.98px) {
    .app-sidebar { left: -100%; }
    .app-sidebar.open { left: 0; box-shadow: 0 0 25px rgba(0,0,0,.25); }
    .app-main { margin-left: 0; }
    .sidebar-toggle { display: inline-flex; }
}

/* ---------- Buttons ---------- */
.btn-brand-red { background: var(--brand-red); border-color: var(--brand-red); color: #fff; }
.btn-brand-red:hover { background: var(--brand-red-dark); border-color: var(--brand-red-dark); color: #fff; }
.btn-brand-dark { background: #212529; border-color: #212529; color: #fff; }
.btn-brand-dark:hover { background: #000; border-color: #000; color: #fff; }
.btn-brand-green { background: #198754; border-color: #198754; color: #fff; }
.btn-brand-green:hover { background: #157347; border-color: #157347; color: #fff; }

/* ---------- Cards ---------- */
.card {
    border: 1px solid #edeef1;
    border-radius: .65rem;
    box-shadow: 0 1px 2px rgba(16,24,40,.04);
}

.card-header-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: .9rem 1.1rem;
    border-bottom: 1px solid #f0f1f3;
    flex-wrap: wrap;
    gap: .6rem;
}

.card-header-bar .card-title { font-weight: 600; margin: 0; font-size: 1rem; }
.card-header-bar .card-actions { display: flex; gap: .5rem; flex-wrap: wrap; }

.filter-card { padding: 1rem 1.1rem; }

/* ---------- Stat cards ---------- */
.stat-card {
    background: #fff;
    border: 1px solid #edeef1;
    border-radius: .75rem;
    padding: 1.1rem 1.25rem;
    display: flex;
    flex-direction: column;
    gap: .5rem;
    height: 100%;
}

.stat-card .stat-icon {
    width: 46px;
    height: 46px;
    border-radius: .7rem;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 1.15rem;
}

.stat-card .stat-value { font-size: 1.6rem; font-weight: 700; color: #1f2328; }
.stat-card .stat-label { font-size: .72rem; font-weight: 700; letter-spacing: .06em; color: #9aa1a9; }

.welcome-banner {
    background: linear-gradient(135deg, #7b5cf0, #9b6bf5 55%, #b178f0);
    border-radius: .85rem;
    color: #fff;
    padding: 1.6rem 1.9rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.welcome-banner h4 { font-weight: 700; margin-bottom: .25rem; }
.welcome-banner p { margin: 0; opacity: .92; font-size: .9rem; }

/* ---------- Tables ---------- */
.table-card table { margin-bottom: 0; }
.table-card thead th {
    background: #fafbfc;
    font-size: .72rem;
    text-transform: uppercase;
    letter-spacing: .04em;
    color: #8b929a;
    font-weight: 700;
    white-space: nowrap;
    border-bottom: 1px solid #edeef1;
}
.table-card tbody td { vertical-align: middle; font-size: .87rem; }
.table-card tbody tr:hover { background: #fafbfc; }

.pagination-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: .8rem 1.1rem;
    font-size: .82rem;
    color: #6b7178;
    flex-wrap: wrap;
    gap: .5rem;
}

.icon-btn {
    width: 32px;
    height: 32px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: .4rem;
    border: 1px solid transparent;
}

/* ---------- Nav tabs ---------- */
.status-tabs { border-bottom: 1px solid #ebedf0; margin-bottom: 1rem; }
.status-tabs .nav-link {
    color: #6b7178;
    font-weight: 600;
    font-size: .86rem;
    border: none;
    border-bottom: 2px solid transparent;
    padding: .65rem .2rem;
    margin-right: 1.5rem;
}
.status-tabs .nav-link.active { color: var(--brand-red); border-bottom-color: var(--brand-red); background: transparent; }

.info-banner {
    background: #e7f6fb;
    border: 1px solid #cdeef9;
    color: #0c5a73;
    border-radius: .6rem;
    padding: .85rem 1.1rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}

/* ---------- Report cards ---------- */
.report-card {
    background: #fff;
    border: 1px solid #edeef1;
    border-radius: .75rem;
    padding: 1.3rem;
    height: 100%;
    display: flex;
    flex-direction: column;
}
.report-card .report-icon { font-size: 1.4rem; color: #2f6fed; margin-bottom: .6rem; }
.report-card h6 { font-weight: 700; margin-bottom: .4rem; }
.report-card p { font-size: .82rem; color: #6b7178; flex: 1; }

.required-asterisk { color: var(--brand-red); }

.form-floating > label { font-size: .85rem; }

.badge-soft { font-weight: 600; font-size: .72rem; padding: .35em .6em; }
