:root {
    --primary: #2855d9;
    --primary-dark: #173aa5;
    --ink: #172033;
    --muted: #6b7486;
    --line: #e5e9f2;
    --surface: #ffffff;
    --bg: #f5f7fb;
    --success: #168451;
    --danger: #c33434;
    --warning: #a76b05;
    --shadow: 0 12px 35px rgba(29, 45, 80, .09);
}

* { box-sizing: border-box; }
body {
    margin: 0;
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
    color: var(--ink);
    background: var(--bg);
}
a { color: var(--primary); text-decoration: none; }
.topbar {
    min-height: 68px;
    padding: 0 5%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: #fff;
    border-bottom: 1px solid var(--line);
    position: sticky;
    top: 0;
    z-index: 20;
}
.brand { display: flex; gap: 10px; align-items: center; color: var(--ink); font-weight: 800; }
.brand-mark {
    display: grid; place-items: center; width: 38px; height: 38px; border-radius: 12px;
    color: #fff; background: linear-gradient(135deg, #3974ff, #1837a6);
}
.nav-links { display: flex; align-items: center; gap: 22px; }
.nav-links a { color: #404b60; font-weight: 650; font-size: 14px; }
.nav-links a:hover { color: var(--primary); }
.nav-toggle { display: none; border: 0; background: transparent; font-size: 24px; }
.page { width: min(1180px, 92%); margin: 32px auto 60px; }
.auth-page {
    min-height: 100vh; padding: 24px; display: grid; place-items: center;
    background:
        radial-gradient(circle at 15% 20%, rgba(72, 122, 255, .24), transparent 30%),
        radial-gradient(circle at 85% 80%, rgba(57, 195, 161, .2), transparent 30%),
        #f5f7fb;
}
.auth-card {
    width: min(440px, 100%); padding: 38px; border-radius: 24px;
    background: rgba(255, 255, 255, .96); box-shadow: var(--shadow);
}
.auth-logo { width: 56px; height: 56px; font-size: 18px; margin-bottom: 22px; }
h1, h2, h3 { margin-top: 0; }
h1 { font-size: clamp(26px, 4vw, 36px); margin-bottom: 8px; }
h2 { font-size: 21px; }
.muted { color: var(--muted); }
.page-head { display: flex; justify-content: space-between; gap: 20px; align-items: center; margin-bottom: 24px; }
.page-head p { margin: 4px 0 0; }
.grid { display: grid; gap: 20px; }
.stats { grid-template-columns: repeat(4, minmax(0, 1fr)); margin-bottom: 24px; }
.two-col { grid-template-columns: minmax(0, 1.35fr) minmax(300px, .65fr); }
.card {
    background: var(--surface); border: 1px solid var(--line); border-radius: 18px;
    padding: 22px; box-shadow: 0 5px 20px rgba(29, 45, 80, .04);
}
.stat-label { color: var(--muted); font-size: 13px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; }
.stat-value { display: block; margin-top: 8px; font-size: 25px; font-weight: 800; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.full { grid-column: 1 / -1; }
.field label { display: block; margin-bottom: 7px; font-size: 13px; font-weight: 750; color: #424d63; }
.input, select, textarea {
    width: 100%; border: 1px solid #d9deea; border-radius: 11px; padding: 11px 12px;
    font: inherit; color: var(--ink); background: #fff; outline: none;
}
.input:focus, select:focus, textarea:focus { border-color: #7296f5; box-shadow: 0 0 0 3px rgba(45, 91, 220, .1); }
textarea { min-height: 100px; resize: vertical; }
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 7px;
    border: 0; border-radius: 10px; padding: 10px 16px; font: inherit; font-weight: 750;
    cursor: pointer; background: #e9edf5; color: #28344a;
}
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-danger { background: #fee9e9; color: var(--danger); }
.btn-sm { padding: 7px 10px; font-size: 13px; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.table-wrap { width: 100%; overflow-x: auto; }
table { width: 100%; border-collapse: collapse; min-width: 720px; }
th, td { padding: 13px 12px; border-bottom: 1px solid var(--line); text-align: left; font-size: 14px; vertical-align: middle; }
th { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .035em; }
tr:last-child td { border-bottom: 0; }
.badge { display: inline-flex; padding: 5px 8px; border-radius: 999px; font-size: 11px; font-weight: 800; }
.badge-success { background: #ddf6e9; color: #0c7041; }
.badge-primary { background: #e2eaff; color: #244bac; }
.badge-warning { background: #fff1d6; color: #8b5800; }
.badge-danger { background: #fee4e4; color: #a62828; }
.badge-secondary { background: #e9edf4; color: #536075; }
.alert { width: 100%; padding: 13px 15px; border-radius: 11px; margin-bottom: 18px; border: 1px solid transparent; }
.alert-success { color: #0c7041; background: #e5f8ee; border-color: #b9ebd1; }
.alert-danger { color: #9f2828; background: #ffeded; border-color: #f6caca; }
.alert-warning { color: #805100; background: #fff4dc; border-color: #f3d79c; }
.filterbar { display: grid; grid-template-columns: 2fr 1fr 1fr auto; gap: 10px; margin-bottom: 18px; }
.empty { padding: 45px 15px; text-align: center; color: var(--muted); }
.detail-list { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.detail-item small { display: block; color: var(--muted); margin-bottom: 4px; }
.detail-item strong { display: block; overflow-wrap: anywhere; }
.progress { height: 9px; background: #edf0f5; border-radius: 999px; overflow: hidden; }
.progress > span { display: block; height: 100%; background: linear-gradient(90deg, #2f65eb, #44c49a); }
.summary-row { display: flex; justify-content: space-between; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.summary-row:last-child { border: 0; }
.text-danger { color: var(--danger); }
.text-success { color: var(--success); }
.help { color: var(--muted); font-size: 12px; margin-top: 5px; }

@media (max-width: 900px) {
    .stats { grid-template-columns: repeat(2, 1fr); }
    .two-col { grid-template-columns: 1fr; }
    .nav-toggle { display: block; }
    .nav-links {
        display: none; position: absolute; left: 4%; right: 4%; top: 62px; padding: 15px;
        flex-direction: column; align-items: stretch; border: 1px solid var(--line);
        border-radius: 14px; background: #fff; box-shadow: var(--shadow);
    }
    .nav-links.open { display: flex; }
}
@media (max-width: 640px) {
    .page { width: min(94%, 1180px); margin-top: 22px; }
    .page-head { align-items: flex-start; flex-direction: column; }
    .stats, .form-grid, .detail-list, .filterbar { grid-template-columns: 1fr; }
    .auth-card { padding: 28px 22px; }
    .card { padding: 18px; }
}
