:root {
    --bg: #0A0A0A;
    --panel: #111111;
    --panel-2: #161412;
    --line: #2A2520;
    --text: #E8E4DC;
    --muted: #8A8580;
    --faint: #5A5550;
    --accent: #E85D2B;
    --accent-2: #D45020;
    --danger: #C43030;
    --good: #4CAF50;
    --warn: #D4A050;
}

* {
    box-sizing: border-box;
}

html {
    min-width: 320px;
}

body {
    margin: 0;
    background: linear-gradient(180deg, #0A0A0A 0%, #080808 100%);
    color: var(--text);
    font-family: 'JetBrains Mono', 'Courier New', monospace;
    -webkit-font-smoothing: antialiased;
}

::selection {
    background: rgba(232, 93, 43, 0.3);
}

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

code {
    color: var(--accent);
}

.login-page {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 24px;
}

.login-box {
    width: 100%;
    max-width: 390px;
}

.login-logo {
    text-align: center;
    margin-bottom: 36px;
}

.mark {
    width: 60px;
    height: 60px;
    border-radius: 16px;
    background: linear-gradient(135deg, rgba(232, 93, 43, 0.2), rgba(196, 48, 48, 0.1));
    border: 1px solid rgba(232, 93, 43, 0.25);
    display: inline-grid;
    place-items: center;
    color: var(--accent);
    font-family: 'Oswald', 'Arial Black', sans-serif;
    font-size: 30px;
    box-shadow: 0 0 30px rgba(232, 93, 43, 0.08);
}

.mark-small {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    font-size: 20px;
    flex: 0 0 auto;
}

.login-logo h1,
.brand strong,
.card h2 {
    font-family: 'Oswald', 'Arial Black', sans-serif;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

.login-logo h1 {
    margin: 16px 0 4px;
    font-size: 30px;
}

.login-logo p,
.brand small,
.card p,
.field span,
.stat-card span {
    color: var(--muted);
}

.login-logo p {
    margin: 0;
    font-size: 11px;
    letter-spacing: 0.2em;
}

.panel-form,
.card,
.stat-card {
    background: linear-gradient(180deg, rgba(22, 20, 18, 0.96), rgba(17, 17, 17, 0.96));
    border: 1px solid var(--line);
    border-radius: 16px;
    box-shadow: 0 16px 60px rgba(0, 0, 0, 0.22);
}

.panel-form {
    padding: 24px;
}

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

.field span {
    font-size: 10px;
    letter-spacing: 0.15em;
    text-transform: uppercase;
}

.field input,
.field select,
.field textarea {
    width: 100%;
    min-height: 42px;
    padding: 11px 14px;
    background: var(--bg);
    border: 1px solid var(--line);
    border-radius: 8px;
    color: var(--text);
    font: inherit;
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.field textarea {
    resize: vertical;
    line-height: 1.55;
}

.field input:focus,
.field select:focus,
.field textarea:focus {
    border-color: rgba(232, 93, 43, 0.55);
    box-shadow: 0 0 20px rgba(232, 93, 43, 0.08);
}

.field + .field {
    margin-top: 16px;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 42px;
    padding: 11px 20px;
    border: 0;
    border-radius: 8px;
    font: inherit;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    cursor: pointer;
    transition: transform 0.2s, border-color 0.2s, color 0.2s, background 0.2s, box-shadow 0.2s;
}

.btn:hover {
    transform: translateY(-1px);
}

.btn-primary {
    background: linear-gradient(135deg, var(--accent), var(--accent-2));
    color: #fff;
    box-shadow: 0 0 28px rgba(232, 93, 43, 0.16);
}

.btn-primary:hover {
    background: linear-gradient(135deg, #F07040, var(--accent));
}

.btn-secondary {
    background: transparent;
    color: var(--text);
    border: 1px solid var(--line);
}

.btn-secondary:hover {
    border-color: rgba(232, 93, 43, 0.55);
    color: var(--accent);
}

.btn-danger {
    background: transparent;
    color: var(--danger);
    border: 1px solid rgba(196, 48, 48, 0.35);
}

.btn-danger:hover {
    background: rgba(196, 48, 48, 0.1);
}

.btn-full {
    width: 100%;
    margin-top: 18px;
}

.btn-sm {
    min-height: 36px;
    padding: 8px 14px;
    font-size: 11px;
}

.btn-xs {
    min-height: 30px;
    padding: 6px 9px;
    font-size: 10px;
}

.disabled {
    opacity: 0.45;
    pointer-events: none;
}

.alert {
    padding: 12px 14px;
    border-radius: 10px;
    margin: 0 0 16px;
    font-size: 13px;
    border: 1px solid;
}

.alert-danger {
    color: #ffb6ae;
    background: rgba(196, 48, 48, 0.1);
    border-color: rgba(196, 48, 48, 0.35);
}

.alert-success {
    color: #c8f4cb;
    background: rgba(76, 175, 80, 0.1);
    border-color: rgba(76, 175, 80, 0.35);
}

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

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
}

.brand strong {
    display: block;
    font-size: 20px;
}

.brand small {
    display: block;
    font-size: 10px;
    letter-spacing: 0.15em;
}

.topnav {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
    flex-wrap: wrap;
}

.admin-name {
    color: var(--muted);
    font-size: 12px;
}

.layout {
    width: min(1120px, 100%);
    margin: 0 auto;
    padding: 24px;
}

.layout-wide {
    width: min(1360px, 100%);
}

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

.stat-card {
    padding: 20px;
    overflow: hidden;
}

.stat-card span {
    display: block;
    font-size: 10px;
    letter-spacing: 0.15em;
    text-transform: uppercase;
}

.stat-card strong {
    display: block;
    margin-top: 10px;
    font-family: 'Oswald', 'Arial Black', sans-serif;
    font-size: 34px;
    line-height: 1;
}

.stat-card.good strong {
    color: var(--good);
}

.stat-card.warn strong {
    color: var(--warn);
}

.stat-card.danger strong {
    color: var(--danger);
}

.card {
    padding: 24px;
    margin-bottom: 16px;
}

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

.card h2 {
    margin: 0;
    font-size: 22px;
}

.card p {
    margin: 6px 0 0;
    font-size: 12px;
    line-height: 1.6;
}

.form-grid,
.toolbar {
    display: grid;
    grid-template-columns: 1fr 1fr auto;
    gap: 16px;
    align-items: end;
}

.form-submit {
    height: 42px;
}

.generated-box {
    margin-top: 20px;
}

.offset-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 16px;
    margin-bottom: 18px;
}

.offset-row {
    margin: 0;
}

.search-field {
    min-width: 280px;
}

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

.keys-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 980px;
}

.keys-table th,
.keys-table td {
    padding: 12px 14px;
    border-bottom: 1px solid var(--line);
    text-align: left;
    vertical-align: top;
    font-size: 12px;
}

.keys-table th {
    color: var(--muted);
    font-size: 10px;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    background: rgba(22, 20, 18, 0.8);
}

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

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

.copy-key {
    padding: 0;
    border: 0;
    background: transparent;
    color: var(--text);
    font: inherit;
    font-weight: 700;
    cursor: pointer;
    text-align: left;
}

.copy-key:hover,
.copy-key.copied {
    color: var(--accent);
}

.badge {
    display: inline-flex;
    align-items: center;
    min-height: 24px;
    padding: 3px 8px;
    border-radius: 999px;
    border: 1px solid;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.badge-active {
    color: var(--good);
    border-color: rgba(76, 175, 80, 0.4);
    background: rgba(76, 175, 80, 0.1);
}

.badge-expired {
    color: var(--warn);
    border-color: rgba(212, 160, 80, 0.4);
    background: rgba(212, 160, 80, 0.1);
}

.badge-banned {
    color: var(--danger);
    border-color: rgba(196, 48, 48, 0.4);
    background: rgba(196, 48, 48, 0.1);
}

.badge-frozen {
    color: var(--accent);
    border-color: rgba(232, 93, 43, 0.4);
    background: rgba(232, 93, 43, 0.1);
}

.bulk-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 14px;
    margin: 16px 0;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: var(--bg);
}

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

.row-actions form {
    margin: 0;
}

.pagination {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 12px;
    margin-top: 18px;
    color: var(--muted);
    font-size: 12px;
}

.empty {
    color: var(--muted);
    text-align: center;
    padding: 24px !important;
}

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

    .topnav {
        justify-content: flex-start;
    }

    .stats-grid,
    .offset-grid,
    .form-grid,
    .toolbar {
        grid-template-columns: 1fr;
    }

    .search-field {
        min-width: 0;
    }
}

@media (max-width: 520px) {
    .layout {
        padding: 16px;
    }

    .topbar {
        padding: 14px 16px;
    }

    .panel-form,
    .card,
    .stat-card {
        border-radius: 12px;
    }

    .card {
        padding: 18px;
    }

    .stats-grid {
        gap: 10px;
    }

    .btn {
        width: 100%;
    }

    .topnav .btn {
        width: auto;
    }
}
