:root {
    --bg: #111111;
    --card: #171717;
    --input: #1e1e1e;
    --secondary: #232323;
    --accent: #d1742d;
    --text: #f6f6f6;
    --muted: #b8c4dd;
    --border: #343434;
    --good: #5ff0a8;
    --bad: #ff5f5f;
    --shadow: rgba(0, 0, 0, .18);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100vh;
    background: var(--bg);
    color: var(--text);
    font: 14px/1.45 "Segoe UI", Arial, sans-serif;
}

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

button,
input,
textarea {
    font: inherit;
}

input,
textarea {
    width: 100%;
    border: 1px solid #626262;
    border-radius: 10px;
    background: var(--input);
    color: var(--text);
    outline: none;
}

input {
    min-height: 42px;
    padding: 0 14px;
}

textarea {
    min-height: 104px;
    padding: 12px 14px;
    resize: vertical;
}

input[type="file"] {
    padding: 9px 12px;
}

input:focus,
textarea:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 2px rgba(209, 116, 45, .16);
}

label {
    display: grid;
    gap: 8px;
    color: var(--text);
    font-weight: 700;
}

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

.check-row input {
    width: auto;
    min-height: auto;
}

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

.sidebar {
    position: sticky;
    top: 0;
    height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    padding: 28px 16px;
    border-right: 1px solid var(--border);
    background: #121212;
}

.brand-icon,
.nav-btn {
    width: 52px;
    height: 52px;
    border: 1px solid transparent;
    border-radius: 14px;
    display: grid;
    place-items: center;
    background: var(--secondary);
    color: var(--text);
    font-size: 22px;
    font-weight: 800;
}

.brand-icon,
.nav-btn.active {
    background: var(--accent);
    border-color: var(--accent);
    color: #070707;
}

.nav-btn {
    cursor: pointer;
}

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

.workspace {
    padding: 34px 36px 42px;
    min-width: 0;
}

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

.topbar h1,
.auth-card h1 {
    margin: 0;
    font-size: clamp(28px, 3vw, 42px);
    line-height: 1;
    letter-spacing: -.03em;
}

.topbar p,
.auth-card p {
    margin: 8px 0 0;
    color: var(--muted);
}

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

.view {
    display: grid;
    gap: 18px;
}

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

.cards {
    grid-template-columns: repeat(4, minmax(160px, 1fr));
}

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

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

.card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 22px;
    padding: 20px;
    box-shadow: none;
}

.card h2,
.card h3 {
    margin: 0 0 14px;
    line-height: 1.15;
}

.stat {
    min-height: 116px;
}

.stat .label {
    color: var(--muted);
    font-weight: 700;
}

.stat .value {
    margin-top: 12px;
    font-size: 34px;
    font-weight: 900;
}

.toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
}

.btn {
    min-height: 40px;
    border: 0;
    border-radius: 12px;
    padding: 0 18px;
    display: inline-grid;
    place-items: center;
    cursor: pointer;
    font-weight: 800;
    color: #050505;
    background: var(--accent);
}

.btn.small {
    min-height: 34px;
    padding-inline: 14px;
    border-radius: 10px;
    font-size: 12px;
}

.btn.secondary {
    background: var(--secondary);
    color: var(--text);
}

.btn.danger {
    background: #4a1f1f;
    color: #ffdada;
}

.btn:disabled {
    opacity: .55;
    cursor: not-allowed;
}

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

.table-wrap {
    overflow: auto;
    border-radius: 18px;
    background: #0f0f0f;
    border: 1px solid #202020;
}

.card > .btn + .table-wrap,
.card > .table-wrap + .btn {
    margin-top: 14px;
}

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

th,
td {
    padding: 13px 14px;
    border-bottom: 1px solid var(--border);
    text-align: left;
    vertical-align: middle;
}

th {
    color: var(--accent);
    font-size: 12px;
}

td {
    color: var(--text);
}

td.tight {
    max-width: 360px;
}

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

.mono {
    font-family: Consolas, "Courier New", monospace;
    font-size: 13px;
    overflow-wrap: anywhere;
}

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

.status {
    display: inline-flex;
    align-items: center;
    min-height: 26px;
    border-radius: 999px;
    padding: 0 10px;
    font-weight: 800;
    font-size: 12px;
}

.status.new {
    background: var(--secondary);
    color: var(--muted);
}

.status.active {
    background: rgba(95, 240, 168, .12);
    color: var(--good);
}

.status.blocked {
    background: rgba(255, 95, 95, .12);
    color: var(--bad);
}

.reason {
    margin-top: 6px;
    color: var(--muted);
    font-size: 12px;
    max-width: 260px;
}

.allowed {
    color: var(--good);
}

.denied {
    color: var(--bad);
}

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

.modal {
    position: fixed;
    inset: 0;
    display: grid;
    place-items: center;
    padding: 24px;
    background: rgba(0, 0, 0, .72);
    backdrop-filter: blur(8px);
    z-index: 20;
}

.modal.hidden {
    display: none;
}

.modal-card {
    position: relative;
    width: min(440px, 100%);
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 24px;
    padding: 26px;
    box-shadow: none;
}

.modal-close {
    position: absolute;
    top: 14px;
    right: 14px;
    width: 34px;
    height: 34px;
    border: 0;
    border-radius: 10px;
    background: var(--secondary);
    color: var(--text);
    cursor: pointer;
    font-size: 24px;
}

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

.toasts {
    position: fixed;
    top: 18px;
    right: 18px;
    display: grid;
    gap: 10px;
    z-index: 50;
}

.toast {
    min-width: 260px;
    max-width: 360px;
    padding: 14px 16px;
    border-radius: 14px;
    border: 1px solid var(--border);
    background: var(--card);
    color: var(--text);
    box-shadow: none;
}

.toast.ok {
    border-color: rgba(95, 240, 168, .5);
}

.toast.error {
    border-color: rgba(255, 95, 95, .55);
}

.auth-page {
    display: grid;
    place-items: center;
    padding: 24px;
}

.auth-card {
    width: min(460px, 100%);
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 28px;
    padding: 30px;
    box-shadow: none;
}

.hint-card {
    border-left: 3px solid var(--accent);
}

.detail-list {
    display: grid;
    gap: 5px;
    color: var(--muted);
    font-size: 12px;
}

.detail-list b {
    color: var(--text);
}

.detail-list .mono {
    color: var(--muted);
    font-size: 12px;
}

.activation-meta {
    display: grid;
    gap: 4px;
}

.pill {
    display: inline-flex;
    align-items: center;
    min-height: 24px;
    border-radius: 999px;
    padding: 0 9px;
    background: var(--secondary);
    color: var(--muted);
    font-size: 12px;
    font-weight: 800;
}

.auth-mark {
    width: 58px;
    height: 58px;
    margin-bottom: 20px;
    border-radius: 16px;
    display: grid;
    place-items: center;
    background: var(--accent);
    color: #070707;
    font-size: 24px;
    font-weight: 900;
}

.alert {
    margin: 16px 0;
    padding: 12px 14px;
    border: 1px solid rgba(255, 95, 95, .5);
    border-radius: 12px;
    background: rgba(255, 95, 95, .08);
    color: #ffdada;
}

@media (max-width: 1180px) {
    .cards,
    .two-cols,
    .settings-grid {
        grid-template-columns: 1fr;
    }
}

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

    .sidebar {
        position: static;
        height: auto;
        flex-direction: row;
        justify-content: center;
        padding: 14px;
    }

    .workspace {
        padding: 22px 16px 32px;
    }

    .topbar {
        flex-direction: column;
    }
}
