:root {
    --bg: #f6f7f9;
    --panel: #ffffff;
    --text: #18202a;
    --muted: #667085;
    --line: #d9dee7;
    --brand: #146c5f;
    --brand-strong: #0b5147;
    --danger: #b42318;
    --warn: #b54708;
    --ok: #027a48;
    --shadow: 0 8px 24px rgba(16, 24, 40, 0.08);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: Arial, "Microsoft YaHei", sans-serif;
    font-size: 14px;
    line-height: 1.55;
}

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

a:hover {
    text-decoration: underline;
}

code {
    background: #eef2f6;
    border: 1px solid #dde3ea;
    border-radius: 5px;
    padding: 2px 6px;
    font-family: Consolas, monospace;
    font-size: 12px;
}

.topbar {
    position: sticky;
    top: 0;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    min-height: 58px;
    padding: 0 28px;
    border-bottom: 1px solid var(--line);
    background: rgba(255, 255, 255, 0.94);
    backdrop-filter: blur(10px);
}

.brand {
    color: var(--text);
    font-weight: 700;
    font-size: 18px;
}

nav {
    display: flex;
    flex-wrap: wrap;
    gap: 14px;
}

nav a {
    color: #344054;
    font-weight: 600;
}

.page {
    width: min(1240px, calc(100% - 32px));
    margin: 28px auto 60px;
}

h1,
h2,
h3 {
    line-height: 1.25;
    margin: 0 0 16px;
}

h1 {
    font-size: 28px;
}

h2 {
    font-size: 18px;
}

h3 {
    font-size: 15px;
    margin-top: 20px;
}

.panel {
    margin-bottom: 18px;
    padding: 20px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--panel);
    box-shadow: var(--shadow);
}

.panel.narrow {
    max-width: 480px;
    margin: 60px auto;
}

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

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

.grid.four {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    align-items: end;
}

.wide {
    grid-column: span 2;
}

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

label {
    display: grid;
    gap: 6px;
    color: #344054;
    font-weight: 600;
}

input,
select,
textarea {
    width: 100%;
    min-height: 38px;
    padding: 8px 10px;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    background: #fff;
    color: var(--text);
    font: inherit;
}

.button,
button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 38px;
    padding: 8px 14px;
    border: 1px solid #b8c2cc;
    border-radius: 6px;
    background: #fff;
    color: #24313f;
    font: inherit;
    font-weight: 700;
    cursor: pointer;
}

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

.button:hover,
button:hover {
    text-decoration: none;
    filter: brightness(0.98);
}

.link-button {
    min-height: auto;
    padding: 0;
    border: 0;
    background: transparent;
    color: var(--brand);
    font-weight: 700;
}

.actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.inline-form {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: end;
}

.inline-form input {
    min-width: 260px;
    flex: 1;
}

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

.between {
    justify-content: space-between;
}

.toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 14px;
}

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

.flash {
    margin-bottom: 14px;
    padding: 10px 12px;
    border-radius: 6px;
    border: 1px solid var(--line);
}

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

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

.flash.info {
    color: #175cd3;
    background: #eff8ff;
    border-color: #b2ddff;
}

.stats {
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 12px;
    margin: 18px 0;
}

.stat {
    padding: 18px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
}

.stat strong {
    display: block;
    font-size: 26px;
}

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

.facts {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 12px;
    margin: 16px 0;
}

.facts div {
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: #fafbfc;
}

.facts dt {
    color: var(--muted);
    font-size: 12px;
}

.facts dd {
    margin: 4px 0 0;
    font-weight: 700;
}

.chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 14px;
}

.chip,
.badge {
    display: inline-flex;
    align-items: center;
    min-height: 24px;
    padding: 2px 8px;
    border-radius: 999px;
    border: 1px solid #d0d5dd;
    background: #f8fafc;
    font-size: 12px;
    font-weight: 700;
}

.badge.active,
.badge.success,
.badge.trial {
    color: var(--ok);
    border-color: #abefc6;
    background: #ecfdf3;
}

.badge.banned,
.badge.revoked,
.badge.denied {
    color: var(--danger);
    border-color: #fecdca;
    background: #fef3f2;
}

.badge.warning {
    color: var(--warn);
    border-color: #fedf89;
    background: #fffaeb;
}

.table-wrap {
    width: 100%;
    overflow-x: auto;
}

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

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

th {
    color: #475467;
    background: #f8fafc;
    font-size: 12px;
    white-space: nowrap;
}

.empty {
    padding: 18px;
    border: 1px dashed #cbd5e1;
    border-radius: 8px;
    color: var(--muted);
    background: #fff;
}

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

    .grid.two,
    .grid.four,
    .facts,
    .stats {
        grid-template-columns: 1fr;
    }

    .wide {
        grid-column: auto;
    }

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