:root {
    --bg: #eef2f7;
    --panel: #ffffff;
    --line: #d8e0ea;
    --text: #17212b;
    --muted: #5d6b79;
    --accent: #0d5ea6;
    --accent-dark: #0a477d;
    --danger: #b42318;
    --warning: #b54708;
    --success: #067647;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: "Segoe UI", Tahoma, sans-serif;
    background: linear-gradient(180deg, #f7fafc 0%, var(--bg) 100%);
    color: var(--text);
}

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

button,
.button-link {
    border: 0;
    border-radius: 10px;
    background: var(--accent);
    color: #fff;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font: inherit;
    min-height: 40px;
    padding: 0 16px;
}

button:hover,
.button-link:hover {
    background: var(--accent-dark);
}

input,
select {
    border: 1px solid var(--line);
    border-radius: 10px;
    font: inherit;
    min-height: 42px;
    padding: 0 12px;
    width: 100%;
}

.topbar {
    align-items: center;
    background: #0f1720;
    color: #fff;
    display: flex;
    gap: 24px;
    justify-content: space-between;
    padding: 16px 24px;
}

.brand {
    color: #fff;
    font-size: 1.1rem;
    font-weight: 700;
}

.nav {
    display: flex;
    gap: 16px;
}

.nav a {
    color: #d6e4f0;
}

.userbox {
    align-items: center;
    display: flex;
    gap: 12px;
}

.page {
    margin: 0 auto;
    max-width: 1280px;
    padding: 24px;
}

.panel {
    background: var(--panel);
    border: 1px solid rgba(15, 23, 32, 0.06);
    border-radius: 18px;
    box-shadow: 0 12px 32px rgba(15, 23, 32, 0.06);
    margin-bottom: 24px;
    padding: 24px;
}

.panel.narrow {
    margin-top: 64px;
    max-width: 420px;
}

.panel-head {
    align-items: flex-start;
    display: flex;
    gap: 16px;
    justify-content: space-between;
    margin-bottom: 16px;
}

.stack-form,
.filter-bar {
    display: grid;
    gap: 16px;
}

.filter-bar {
    align-items: end;
    grid-template-columns: repeat(auto-fit, minmax(180px, 220px));
    margin: 16px 0 20px;
}

.stack-form label,
.filter-bar label {
    display: grid;
    gap: 8px;
}

.cards {
    display: grid;
    gap: 16px;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    margin: 20px 0;
}

.card {
    background: #f8fbfe;
    border: 1px solid #dbe8f4;
    border-radius: 16px;
    display: grid;
    gap: 8px;
    padding: 18px;
}

.card strong {
    font-size: 1.4rem;
}

.card-label {
    color: var(--muted);
    font-size: 0.9rem;
    text-transform: uppercase;
}

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

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

th,
td {
    border-bottom: 1px solid var(--line);
    padding: 12px 10px;
    text-align: left;
    vertical-align: top;
}

th {
    color: var(--muted);
    font-size: 0.9rem;
    text-transform: uppercase;
}

.flash-stack {
    display: grid;
    gap: 12px;
    margin-bottom: 20px;
}

.flash {
    border-radius: 12px;
    padding: 14px 16px;
}

.flash-success {
    background: #ecfdf3;
    color: var(--success);
}

.flash-error {
    background: #fef3f2;
    color: var(--danger);
}

.badge {
    background: #e8f1fb;
    border-radius: 999px;
    color: var(--accent);
    display: inline-block;
    font-size: 0.8rem;
    padding: 4px 10px;
}

.badge-error {
    background: #fef3f2;
    color: var(--danger);
}

.badge-warning {
    background: #fff7ed;
    color: var(--warning);
}

.badge-info {
    background: #eff8ff;
    color: var(--accent);
}

.batch-links {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 20px;
}

.batch-link {
    background: #f3f7fb;
    border: 1px solid #dce6f1;
    border-radius: 999px;
    color: var(--text);
    padding: 8px 12px;
}

.batch-link.is-active {
    background: #dceeff;
    border-color: #9cc7ef;
}

@media (max-width: 780px) {
    .topbar {
        align-items: flex-start;
        flex-direction: column;
    }

    .userbox,
    .nav {
        flex-wrap: wrap;
    }

    .page {
        padding: 16px;
    }
}
