:root {
    color-scheme: dark;
    --bg: #111412;
    --surface: #191d1a;
    --surface-2: #202521;
    --line: #343b36;
    --text: #f4f6f4;
    --muted: #9ba69e;
    --accent: #55d187;
    --accent-strong: #2fb86a;
    --danger: #ff6b6b;
    --warning: #f6c85f;
    --radius: 8px;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    min-height: 100vh;
    background: var(--bg);
    color: var(--text);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

a { color: inherit; text-decoration: none; }

.shell { min-height: 100vh; display: grid; grid-template-columns: 230px 1fr; }

.sidebar {
    border-right: 1px solid var(--line);
    background: #151815;
    padding: 22px 16px;
}

.brand { display: flex; gap: 11px; align-items: center; margin-bottom: 30px; }
.brand-mark { width: 34px; height: 34px; display: grid; place-items: center; background: var(--accent); color: #09110c; font-weight: 900; border-radius: 6px; }
.brand small { display: block; color: var(--muted); font-size: 11px; margin-top: 2px; }

.nav { display: grid; gap: 5px; }
.nav a { padding: 10px 11px; color: var(--muted); border-radius: 6px; }
.nav a:hover, .nav a.active { background: var(--surface-2); color: var(--text); }

.sidebar-footer { position: fixed; bottom: 18px; width: 196px; }
.sidebar-footer form { margin: 0; }

.main { min-width: 0; }
.topbar { min-height: 68px; display: flex; align-items: center; justify-content: space-between; padding: 0 28px; border-bottom: 1px solid var(--line); }
.content { max-width: 1280px; padding: 28px; }

h1 { margin: 0; font-size: 25px; letter-spacing: -.03em; }
h2 { font-size: 18px; margin: 0 0 16px; }
p { color: var(--muted); }
.eyebrow { color: var(--accent); font-size: 12px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; margin-bottom: 7px; }
.muted { color: var(--muted); }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }

.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.button, button {
    appearance: none;
    border: 1px solid var(--line);
    background: var(--surface-2);
    color: var(--text);
    min-height: 39px;
    padding: 9px 14px;
    border-radius: 6px;
    cursor: pointer;
    font: inherit;
    font-weight: 700;
}
.button.primary, button.primary { background: var(--accent); border-color: var(--accent); color: #09110c; }
.button.danger, button.danger { color: var(--danger); }
.button:hover, button:hover { border-color: var(--accent); }

.grid { display: grid; gap: 16px; }
.stats { grid-template-columns: repeat(4, minmax(0, 1fr)); margin: 24px 0; }
.stat, .panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.stat { padding: 18px; }
.stat strong { display: block; font-size: 30px; margin-top: 7px; }
.stat span { color: var(--muted); font-size: 13px; }
.panel { padding: 20px; margin-top: 18px; }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 12px 10px; text-align: left; border-bottom: 1px solid var(--line); vertical-align: top; }
th { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .05em; }
tr:last-child td { border-bottom: 0; }

.badge { display: inline-flex; align-items: center; padding: 4px 8px; border-radius: 999px; font-size: 12px; font-weight: 800; background: var(--surface-2); color: var(--muted); }
.badge.active { color: var(--accent); }
.badge.suspended, .badge.expired { color: var(--warning); }
.badge.revoked { color: var(--danger); }

.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.field { display: grid; gap: 7px; }
.field.full { grid-column: 1 / -1; }
label { font-size: 13px; font-weight: 750; }
input, select, textarea {
    width: 100%;
    min-height: 42px;
    border: 1px solid var(--line);
    border-radius: 5px;
    background: #101310;
    color: var(--text);
    padding: 9px 11px;
    font: inherit;
}
textarea { min-height: 110px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 2px solid color-mix(in srgb, var(--accent) 35%, transparent); border-color: var(--accent); }

.check-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 9px; }
.check { display: flex; align-items: center; gap: 9px; padding: 11px; border: 1px solid var(--line); border-radius: 5px; background: #141814; }
.check input { width: 17px; min-height: 17px; }

.flash, .errors { padding: 13px 15px; border-radius: 6px; margin-bottom: 18px; border: 1px solid; }
.flash { border-color: var(--accent-strong); background: #122219; }
.errors { border-color: #7f3939; background: #281717; color: #ffb0b0; }
.errors ul { margin: 0; padding-left: 20px; }

.license-key { background: #0c0f0d; border: 1px dashed var(--accent); padding: 16px; border-radius: 6px; font-size: 17px; overflow-wrap: anywhere; }

.login-page { min-height: 100vh; display: grid; place-items: center; padding: 22px; }
.login-card { width: min(430px, 100%); padding: 30px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); }
.login-card .brand { margin-bottom: 28px; }

@media (max-width: 900px) {
    .shell { grid-template-columns: 1fr; }
    .sidebar { border-right: 0; border-bottom: 1px solid var(--line); padding: 14px 18px; }
    .sidebar .brand { margin-bottom: 12px; }
    .nav { grid-template-columns: 1fr 1fr; }
    .sidebar-footer { position: static; width: auto; margin-top: 10px; }
    .topbar { padding: 14px 18px; }
    .content { padding: 20px 16px; }
    .stats { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 560px) {
    .stats, .form-grid, .check-grid { grid-template-columns: 1fr; }
    .field.full { grid-column: auto; }
    .topbar { align-items: flex-start; gap: 12px; }
    h1 { font-size: 22px; }
}
