:root {
    --bg: #f2f5f8;
    --surface: #ffffff;
    --surface-2: #f8fafc;
    --text: #11202d;
    --text-muted: #5a6977;
    --brand: #0f4c81;
    --brand-2: #0a7a78;
    --accent: #f29f05;
    --danger: #c0392b;
    --success: #2e7d32;
    --border: #d7e0e8;
    --shadow: 0 16px 40px rgba(16, 32, 45, 0.08);
    --radius-lg: 18px;
    --radius-md: 12px;
    --radius-sm: 8px;
}

* {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    padding: 0;
}

body {
    font-family: "Space Grotesk", "Segoe UI", Tahoma, sans-serif;
    color: var(--text);
    background:
        radial-gradient(circle at 10% 12%, rgba(10, 122, 120, 0.12), transparent 28%),
        radial-gradient(circle at 90% 2%, rgba(15, 76, 129, 0.16), transparent 22%),
        linear-gradient(165deg, #eff3f6 0%, #f6f9fb 48%, #eef6f7 100%);
    min-height: 100vh;
}

a {
    color: var(--brand);
    text-decoration: none;
}

.app-shell {
    display: grid;
    grid-template-columns: 270px minmax(0, 1fr);
    min-height: 100vh;
}

.sidebar {
    background: linear-gradient(180deg, #0f395f 0%, #0f2f4c 100%);
    color: #eaf2f8;
    padding: 1.3rem 1rem;
    position: sticky;
    top: 0;
    height: 100vh;
}

.brand {
    margin: 0;
    font-size: 1.25rem;
    line-height: 1.2;
}

.brand-tagline {
    margin: 0.35rem 0 1.8rem;
    color: rgba(234, 242, 248, 0.75);
    font-size: 0.9rem;
}

.nav-links {
    list-style: none;
    padding: 0;
    margin: 0;
    display: grid;
    gap: 0.45rem;
}

.nav-links a {
    display: block;
    color: #eaf2f8;
    padding: 0.7rem 0.8rem;
    border-radius: 10px;
    transition: background-color 0.2s ease, transform 0.2s ease;
}

.nav-links a:hover,
.nav-links a.active {
    background: rgba(242, 159, 5, 0.16);
    transform: translateX(2px);
}

.sidebar-meta {
    margin-top: 1.4rem;
    color: rgba(234, 242, 248, 0.7);
    font-size: 0.86rem;
}

.content {
    padding: 1.25rem 1.5rem;
}

.topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.page-title {
    margin: 0;
    font-size: 1.38rem;
    letter-spacing: 0.1px;
}

.user-badge {
    display: inline-flex;
    gap: 0.4rem;
    align-items: center;
    color: var(--text-muted);
    font-size: 0.92rem;
}

.logout-form {
    margin: 0;
}

.panel {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    padding: 1rem;
    animation: panelIn 280ms ease;
}

@keyframes panelIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.grid {
    display: grid;
    gap: 0.9rem;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 0.8rem;
}

.stat {
    background: linear-gradient(145deg, #ffffff 0%, #f8fbfd 100%);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 0.8rem;
}

.stat .label {
    color: var(--text-muted);
    font-size: 0.85rem;
}

.stat .value {
    margin-top: 0.25rem;
    font-size: 1.55rem;
    font-weight: 700;
}

.filters {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 0.7rem;
    align-items: end;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.75rem;
}

.form-field {
    display: grid;
    gap: 0.35rem;
}

.form-field.full {
    grid-column: 1 / -1;
}

label {
    color: #40505f;
    font-size: 0.88rem;
    font-weight: 600;
}

input,
select,
textarea {
    width: 100%;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 0.62rem 0.72rem;
    background: #fff;
    color: var(--text);
    font: inherit;
}

input:focus,
select:focus,
textarea:focus {
    outline: 2px solid rgba(10, 122, 120, 0.16);
    border-color: var(--brand-2);
}

textarea {
    min-height: 96px;
    resize: vertical;
}

.btn {
    border: 0;
    border-radius: 10px;
    padding: 0.58rem 0.9rem;
    font: inherit;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.12s ease, opacity 0.2s ease;
}

.btn:hover {
    transform: translateY(-1px);
}

.btn:disabled {
    opacity: 0.55;
    cursor: not-allowed;
    transform: none;
}

.btn.primary {
    background: linear-gradient(130deg, var(--brand) 0%, #1f679f 100%);
    color: #fff;
}

.btn.secondary {
    background: #e8f0f8;
    color: #174872;
}

.btn.warning {
    background: #fef5e6;
    color: #9b5d00;
}

.btn.danger {
    background: #feecea;
    color: #9e1e15;
}

.btn.ghost {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text);
}

.actions-inline {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: center;
}

table {
    width: 100%;
    border-collapse: collapse;
}

th,
td {
    border-bottom: 1px solid #ecf1f4;
    padding: 0.62rem 0.45rem;
    text-align: left;
    font-size: 0.93rem;
}

th {
    font-size: 0.82rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-muted);
}

.table-responsive {
    overflow: auto;
}

.chip {
    display: inline-flex;
    padding: 0.2rem 0.45rem;
    border-radius: 999px;
    font-size: 0.78rem;
    background: #edf4fb;
    color: #1a4c79;
}

.flash-wrap {
    display: grid;
    gap: 0.55rem;
    margin-bottom: 0.8rem;
}

.flash {
    border-radius: 10px;
    padding: 0.65rem 0.8rem;
    border: 1px solid transparent;
    font-size: 0.9rem;
}

.flash.success {
    background: #edf9ef;
    color: #1b6b24;
    border-color: #ccead1;
}

.flash.error {
    background: #fff2f1;
    color: #91271e;
    border-color: #f4d2ce;
}

.flash.info {
    background: #edf5ff;
    color: #214d84;
    border-color: #d5e4f9;
}

.muted {
    color: var(--text-muted);
}

.split-2 {
    display: grid;
    grid-template-columns: 1.25fr 0.95fr;
    gap: 0.9rem;
}

.login-shell {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 1rem;
}

.login-card {
    width: min(520px, 100%);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 22px;
    box-shadow: var(--shadow);
    padding: 1.2rem;
}

.login-head {
    margin-bottom: 0.8rem;
}

.login-head h1 {
    margin: 0;
}

.login-head p {
    margin: 0.4rem 0 0;
    color: var(--text-muted);
}

@media (max-width: 1100px) {
    .stats-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
    .filters {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
    .split-2 {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 840px) {
    .app-shell {
        grid-template-columns: 1fr;
    }
    .sidebar {
        position: static;
        height: auto;
    }
    .content {
        padding: 1rem;
    }
}

@media (max-width: 640px) {
    .stats-grid {
        grid-template-columns: 1fr;
    }
    .filters,
    .form-grid {
        grid-template-columns: 1fr;
    }
}
