:root {
    --bg: #f6f7f9;
    --panel: #ffffff;
    --panel-soft: #f1f5f9;
    --text: #17202a;
    --muted: #667085;
    --line: #d9e0e8;
    --brand: #2457c5;
    --brand-dark: #1f4598;
    --good: #18794e;
    --warn: #a15c00;
    --bad: #b42318;
    --radius: 8px;
    --shadow: 0 1px 2px rgba(16, 24, 40, 0.05);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    font-size: 15px;
    line-height: 1.45;
}

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

a:hover {
    text-decoration: underline;
}

.topbar {
    min-height: 64px;
    border-bottom: 1px solid var(--line);
    background: var(--panel);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 28px;
    position: sticky;
    top: 0;
    z-index: 10;
}

.brand {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--text);
    font-weight: 700;
}

.brand-mark {
    width: 30px;
    height: 30px;
    border-radius: 7px;
    background: var(--brand);
    color: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
}

.nav {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

.nav a,
.nav button {
    border: 0;
    background: transparent;
    color: var(--muted);
    padding: 8px 10px;
    border-radius: 7px;
    font: inherit;
    cursor: pointer;
}

.nav a.active,
.nav a:hover,
.nav button:hover {
    background: var(--panel-soft);
    color: var(--text);
    text-decoration: none;
}

.shell {
    max-width: 1180px;
    margin: 0 auto;
    padding: 28px;
}

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

h1,
h2,
h3 {
    margin: 0;
    letter-spacing: 0;
}

h1 {
    font-size: 26px;
    line-height: 1.2;
}

h2 {
    font-size: 18px;
}

h3 {
    font-size: 15px;
}

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

.grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
    gap: 16px;
}

.two-col {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(280px, 380px);
    gap: 16px;
}

.panel,
.card {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.panel {
    padding: 20px;
    margin-bottom: 16px;
}

.card {
    padding: 16px;
}

.stat {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.stat strong {
    font-size: 28px;
}

.flash {
    border: 1px solid var(--line);
    border-left-width: 4px;
    background: var(--panel);
    border-radius: var(--radius);
    padding: 12px 14px;
    margin-bottom: 12px;
}

.flash.success {
    border-left-color: var(--good);
}

.flash.error {
    border-left-color: var(--bad);
}

form {
    margin: 0;
}

.form-grid {
    display: grid;
    gap: 14px;
}

.field {
    display: grid;
    gap: 6px;
}

label {
    font-weight: 650;
}

input,
textarea,
select {
    width: 100%;
    border: 1px solid var(--line);
    border-radius: 7px;
    background: #fff;
    color: var(--text);
    padding: 10px 11px;
    font: inherit;
}

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

input:focus,
textarea:focus,
select:focus {
    outline: 2px solid rgba(36, 87, 197, 0.18);
    border-color: var(--brand);
}

.check-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

.check-row input {
    width: auto;
}

.actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.button,
button {
    min-height: 38px;
    border: 1px solid var(--line);
    border-radius: 7px;
    background: #fff;
    color: var(--text);
    padding: 8px 12px;
    font: inherit;
    font-weight: 650;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    cursor: pointer;
}

.button:hover,
button:hover {
    text-decoration: none;
    background: var(--panel-soft);
}

.button.primary,
button.primary {
    border-color: var(--brand);
    background: var(--brand);
    color: #fff;
}

.button.primary:hover,
button.primary:hover {
    background: var(--brand-dark);
}

.button.danger,
button.danger {
    border-color: rgba(180, 35, 24, 0.35);
    color: var(--bad);
}

.button.small,
button.small {
    min-height: 30px;
    padding: 5px 10px;
    font-size: 13px;
    line-height: 1.2;
}

.table-wrap {
    overflow-x: auto;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--panel);
}

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

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

th {
    font-size: 13px;
    color: var(--muted);
    background: #fbfcfe;
    font-weight: 700;
}

tr:last-child td {
    border-bottom: 0;
}

.table-action {
    width: 1%;
    text-align: right;
    vertical-align: middle;
    white-space: nowrap;
}

.table-action form {
    display: inline-flex;
    justify-content: flex-end;
}

.badge {
    display: inline-flex;
    align-items: center;
    border-radius: 999px;
    padding: 3px 8px;
    font-size: 12px;
    font-weight: 700;
    background: var(--panel-soft);
    color: var(--muted);
}

.badge.good {
    color: var(--good);
    background: #e9f6ef;
}

.badge.warn {
    color: var(--warn);
    background: #fff4df;
}

.badge.bad {
    color: var(--bad);
    background: #ffebe8;
}

.code {
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    font-size: 13px;
    overflow-wrap: anywhere;
}

.login-box {
    max-width: 430px;
    margin: 42px auto;
}

.empty {
    color: var(--muted);
    padding: 18px;
}

@media (max-width: 760px) {
    .topbar,
    .page-head {
        align-items: stretch;
        flex-direction: column;
    }

    .topbar {
        padding: 16px;
    }

    .shell {
        padding: 18px;
    }

    .two-col {
        grid-template-columns: 1fr;
    }
}
