* {
    box-sizing: border-box;
}

body {
    margin: 0;
    background: #f4f6f9;
    color: #172033;
    font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    line-height: 1.5;
}

a {
    color: inherit;
}

.login-page {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 24px;
    background: linear-gradient(135deg, #111827 0%, #1d4f91 58%, #c49a45 100%);
}

.login-card {
    width: min(420px, 100%);
    background: #fff;
    border-radius: 8px;
    padding: 32px;
    box-shadow: 0 24px 80px rgba(12, 21, 35, .22);
}

.login-card h1,
.page-title h1 {
    margin: 0;
}

.login-card p,
.page-title p {
    color: #657084;
}

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

.sidebar {
    background: #111827;
    color: #dce4ef;
    padding: 24px 18px;
}

.brand {
    display: grid;
    gap: 4px;
    padding: 0 10px 22px;
    border-bottom: 1px solid rgba(255, 255, 255, .12);
}

.brand strong {
    color: #fff;
    font-size: 1.05rem;
}

.brand span {
    color: #9fb0c6;
    font-size: .88rem;
}

.nav {
    display: grid;
    gap: 5px;
    margin-top: 18px;
}

.nav a,
.logout-button {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 10px 12px;
    border: 1px solid transparent;
    border-radius: 6px;
    color: #dce4ef;
    background: transparent;
    font: inherit;
    text-decoration: none;
    text-align: left;
    cursor: pointer;
}

.nav a:hover,
.nav a.active,
.nav a:focus-visible,
.logout-button:hover,
.logout-button:focus-visible {
    border-color: rgba(255, 255, 255, .16);
    background: rgba(255, 255, 255, .12);
    color: #fff;
}

.content {
    padding: 28px;
}

.topbar {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    align-items: center;
    margin-bottom: 24px;
}

.page-title {
    display: grid;
    gap: 4px;
}

.button,
button.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 40px;
    padding: 9px 14px;
    border: 1px solid #cfd7e3;
    border-radius: 6px;
    color: #172033;
    background: #fff;
    font: inherit;
    text-decoration: none;
    cursor: pointer;
}

.button.primary {
    border-color: #1d4f91;
    background: #1d4f91;
    color: #fff;
}

.button.danger {
    border-color: #c0392b;
    color: #c0392b;
}

.grid {
    display: grid;
    gap: 18px;
}

.stats {
    grid-template-columns: repeat(6, minmax(0, 1fr));
}

.two-col {
    grid-template-columns: minmax(0, 1fr) minmax(340px, .52fr);
    align-items: start;
}

.card,
.panel {
    background: #fff;
    border: 1px solid #e1e7ef;
    border-radius: 8px;
    box-shadow: 0 8px 26px rgba(31, 45, 61, .05);
}

.card {
    padding: 18px;
}

.stat-value {
    display: block;
    color: #111827;
    font-size: 2rem;
    font-weight: 800;
}

.stat-label {
    color: #66758a;
    font-size: .9rem;
}

.panel-header {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    align-items: center;
    padding: 16px 18px;
    border-bottom: 1px solid #e8edf4;
}

.panel-header h2,
.panel-header h3 {
    margin: 0;
    font-size: 1.05rem;
}

.panel-body {
    padding: 18px;
}

.filters {
    display: grid;
    grid-template-columns: repeat(4, minmax(160px, 1fr));
    gap: 12px;
    align-items: end;
}

label {
    display: grid;
    gap: 6px;
    color: #536074;
    font-size: .88rem;
    font-weight: 650;
}

input,
select,
textarea {
    width: 100%;
    min-height: 40px;
    padding: 9px 10px;
    border: 1px solid #cfd7e3;
    border-radius: 6px;
    background: #fff;
    color: #172033;
    font: inherit;
}

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

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

.wide {
    grid-column: 1 / -1;
}

.checkbox-row {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #172033;
}

.checkbox-row input {
    width: auto;
    min-height: 0;
}

.table-wrap {
    overflow-x: auto;
}

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

th,
td {
    padding: 12px 14px;
    border-bottom: 1px solid #edf1f6;
    text-align: left;
    vertical-align: top;
    font-size: .92rem;
}

th {
    color: #5c6a80;
    background: #f8fafc;
    font-weight: 750;
}

.badge {
    display: inline-flex;
    align-items: center;
    min-height: 24px;
    padding: 3px 8px;
    border-radius: 999px;
    background: #eef2f8;
    color: #36445a;
    font-size: .78rem;
    font-weight: 750;
    white-space: nowrap;
}

.badge.green {
    background: #e8f7ef;
    color: #137a45;
}

.badge.gold {
    background: #fbf3df;
    color: #926b16;
}

.badge.red {
    background: #fae9e6;
    color: #b33224;
}

.muted {
    color: #6c7a8f;
}

.flash {
    margin-bottom: 18px;
    padding: 12px 14px;
    border-radius: 6px;
    background: #e8f7ef;
    color: #137a45;
}

.error-list {
    margin-bottom: 18px;
    padding: 12px 14px;
    border-radius: 6px;
    background: #fae9e6;
    color: #9d2d20;
}

.raw-json {
    max-height: 360px;
    overflow: auto;
    margin: 0;
    padding: 14px;
    border-radius: 6px;
    background: #101827;
    color: #dce4ef;
    font-size: .82rem;
}

.file-list {
    display: grid;
    gap: 10px;
}

.file-item {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    align-items: center;
    padding: 10px 12px;
    border: 1px solid #e1e7ef;
    border-radius: 6px;
}

.pagination {
    margin-top: 16px;
}

@media (max-width: 1100px) {
    .app-shell,
    .two-col {
        grid-template-columns: 1fr;
    }

    .sidebar {
        position: static;
    }

    .stats,
    .filters {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 720px) {
    .content {
        padding: 18px;
    }

    .stats,
    .filters,
    .form-grid {
        grid-template-columns: 1fr;
    }

    .topbar {
        align-items: flex-start;
        flex-direction: column;
    }
}
