:root {
    --bg: #050505;
    --panel: #0d0d0a;
    --panel-soft: #151509;
    --border: #4d4800;
    --accent: #fff200;
    --accent-soft: #fff15a;
    --text: #f8f8ee;
    --muted: #aaa66e;
    --danger: #ff5c5c;
    --ok: #72e672;
}

* {
    box-sizing: border-box;
}

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

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

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

.sidebar {
    background: #000;
    border-right: 1px solid var(--border);
    padding: 28px 22px;
}

.brand {
    display: flex;
    align-items: center;
    gap: 14px;
    color: white;
    font-weight: 800;
    letter-spacing: .08em;
    text-transform: uppercase;
    margin-bottom: 38px;
}

.brand-mark {
    width: 46px;
    height: 46px;
    display: grid;
    place-items: center;
    color: #000;
    background: var(--accent);
    border-radius: 8px;
    box-shadow: 0 0 24px rgba(255, 242, 0, .45);
}

.nav {
    display: grid;
    gap: 8px;
}

.nav a {
    display: block;
    padding: 13px 14px;
    border: 1px solid transparent;
    border-radius: 8px;
    color: var(--accent-soft);
    background: #080804;
}

.nav a:hover {
    border-color: var(--accent);
    color: white;
}

.main {
    min-width: 0;
    padding: 26px;
}

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

h1, h2 {
    margin: 0;
}

h1 {
    color: white;
    font-size: clamp(26px, 4vw, 40px);
}

h2 {
    color: var(--accent-soft);
    font-size: 18px;
    margin-bottom: 16px;
}

.admin-menu {
    display: flex;
    gap: 14px;
    align-items: center;
    color: var(--muted);
}

.content {
    display: grid;
    gap: 20px;
}

.panel, .stat {
    background: linear-gradient(180deg, var(--panel), #070705);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 18px;
    box-shadow: 0 0 24px rgba(255, 242, 0, .08);
}

.auth-panel {
    max-width: 430px;
}

.danger-panel {
    border-color: #665b00;
}

.muted {
    color: var(--muted);
    line-height: 1.6;
}

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

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

.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(160px, 1fr));
    gap: 16px;
}

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

.stat strong {
    color: white;
    font-size: 34px;
    line-height: 1.3;
}

.panel-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

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

.inline-form {
    display: flex;
    gap: 8px;
    align-items: center;
}

.inline-form select {
    min-width: 125px;
}

.inline-form button {
    padding: 9px 12px;
}

label {
    display: grid;
    gap: 7px;
    color: var(--accent-soft);
    font-weight: 700;
}

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

textarea {
    resize: vertical;
}

button {
    justify-self: start;
    border: 1px solid var(--accent);
    background: #2c2900;
    color: white;
    border-radius: 6px;
    padding: 11px 18px;
    font-weight: 800;
    cursor: pointer;
}

button:hover {
    background: #4a4400;
}

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

th, td {
    padding: 12px 10px;
    border-bottom: 1px solid #262300;
    text-align: left;
    vertical-align: top;
}

th {
    color: var(--accent-soft);
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: .04em;
}

td {
    color: #f0efe0;
}

code, pre {
    background: #020201;
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--accent-soft);
}

code {
    padding: 3px 6px;
}

pre {
    overflow: auto;
    padding: 14px;
}

.badge {
    display: inline-block;
    padding: 4px 8px;
    border-radius: 999px;
    background: #252200;
    color: var(--accent-soft);
    font-size: 12px;
    font-weight: 800;
}

.badge.active {
    background: rgba(114, 230, 114, .12);
    color: var(--ok);
}

.badge.revoked, .badge.expired {
    background: rgba(255, 92, 92, .12);
    color: var(--danger);
}

.actions {
    white-space: nowrap;
}

.actions a {
    margin-right: 10px;
}

.flash {
    padding: 12px 14px;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: #161400;
    color: var(--accent-soft);
    margin-bottom: 16px;
}

.flash.error {
    border-color: #602323;
    background: #1d0909;
    color: #ffb4b4;
}

.flash.warning {
    border-color: #665b00;
}

.flash.success {
    border-color: rgba(114, 230, 114, .45);
    background: rgba(114, 230, 114, .1);
    color: var(--ok);
}

@media (max-width: 980px) {
    .shell {
        grid-template-columns: 1fr;
    }

    .sidebar {
        border-right: 0;
        border-bottom: 1px solid var(--border);
    }

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