:root {
    --bg: #0b1220;
    --panel: #1a2438;
    --panel-soft: #101827;
    --panel-dark: #0d1423;
    --line: #2e3a56;
    --line-soft: rgba(96, 165, 250, 0.12);
    --text: #eef4ff;
    --muted: #8ea0c2;
    --green: #10c689;
    --green-2: #119d6d;
    --blue: #3b82f6;
    --yellow: #f59e0b;
    --red: #ef4444;
    --shadow: 0 18px 42px rgba(0, 0, 0, 0.28);
}

* { box-sizing: border-box; }

body {
    margin: 0;
    min-height: 100vh;
    font-family: "Segoe UI", Tahoma, sans-serif;
    color: var(--text);
    background: linear-gradient(180deg, #0b1220 0%, #0d1324 100%);
}

.hero-header {
    background: linear-gradient(180deg, #10936c 0%, #11885f 100%);
    padding: 40px 20px 30px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.hero-center {
    max-width: 1320px;
    margin: 0 auto;
    text-align: center;
}

.hero-center h1 {
    margin: 0;
    font-size: 28px;
    font-weight: 800;
}

.hero-center p {
    margin: 8px 0 0;
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #dcfff1;
}

.app-shell {
    max-width: 1320px;
    margin: 0 auto;
    padding: 22px 24px 48px;
}

.top-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    margin-bottom: 22px;
}

.tabs, .toolbar-right, .actions, .stats-row, .mode-switch {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.tab-btn, .btn, .close-btn {
    border: 1px solid var(--line);
    border-radius: 12px;
    font-weight: 700;
    cursor: pointer;
    transition: 0.18s ease;
}

.tab-btn {
    background: #182233;
    color: var(--muted);
    padding: 11px 18px;
}

.tab-btn.active,
.tab-btn:hover {
    background: linear-gradient(180deg, var(--green), var(--green-2));
    color: white;
    border-color: transparent;
}

.server-pill {
    background: rgba(16, 198, 137, 0.12);
    color: #6ff0c2;
    border: 1px solid rgba(16, 198, 137, 0.28);
    padding: 10px 14px;
    border-radius: 999px;
    font-size: 12px;
    text-transform: uppercase;
    font-weight: 800;
}

.btn {
    padding: 11px 18px;
    background: #1c2740;
    color: white;
}

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

.btn-primary {
    background: linear-gradient(180deg, var(--green), var(--green-2));
    border-color: transparent;
    color: white;
}

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

.btn-blue { background: rgba(59, 130, 246, 0.16); border-color: rgba(59, 130, 246, 0.26); }
.btn-yellow { background: rgba(245, 158, 11, 0.16); border-color: rgba(245, 158, 11, 0.26); }
.btn-red { background: rgba(239, 68, 68, 0.16); border-color: rgba(239, 68, 68, 0.26); }
.btn-sm { padding: 8px 12px; font-size: 13px; }

.card, .modal {
    background: var(--panel);
    border: 1px solid var(--line-soft);
    border-radius: 22px;
    box-shadow: var(--shadow);
}

.card {
    padding: 24px;
}

.tab-panel { display: none; }
.tab-panel.active { display: block; }

.section-head, .section-subhead, .modal-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
}

.section-head { margin-bottom: 18px; }
.section-subhead { margin: 26px 0 14px; }

.section-head h2,
.section-subhead h3,
.modal h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 800;
    color: #55f0bf;
}

.stats-row { margin-bottom: 18px; }

.stat-card {
    flex: 1;
    min-width: 180px;
    background: var(--panel-soft);
    border: 1px solid var(--line-soft);
    border-radius: 16px;
    padding: 22px;
    text-align: center;
}

.stat-number {
    font-size: 34px;
    font-weight: 900;
    color: var(--green);
}

.stat-label {
    margin-top: 8px;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    font-size: 12px;
}

.guide-box {
    background: var(--panel-dark);
    border: 1px solid rgba(16, 198, 137, 0.18);
    border-radius: 14px;
    padding: 16px 18px;
    margin-bottom: 18px;
    color: #b5c7e7;
    line-height: 1.65;
}

.guide-box strong { color: #6ff0c2; }

.form-grid.one-col,
.form-stack {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.field {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.field span,
.field label,
label span {
    color: #93abd3;
    font-size: 13px;
    font-weight: 700;
}

input, select, textarea {
    width: 100%;
    background: #0f1728;
    color: var(--text);
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 12px 14px;
    outline: none;
    font-size: 14px;
}

textarea { min-height: 96px; resize: vertical; }

input:focus, select:focus, textarea:focus {
    border-color: rgba(16, 198, 137, 0.6);
    box-shadow: 0 0 0 4px rgba(16, 198, 137, 0.12);
}

.mode-switch button {
    flex: 1;
    min-width: 120px;
    border: 1px solid var(--line);
    background: #182233;
    color: var(--muted);
    border-radius: 12px;
    padding: 12px;
    font-weight: 700;
    cursor: pointer;
}

.mode-switch button.active {
    background: rgba(16, 198, 137, 0.16);
    border-color: rgba(16, 198, 137, 0.35);
    color: white;
}

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

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

th, td {
    padding: 15px 14px;
    text-align: left;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    vertical-align: top;
}

th {
    font-size: 12px;
    color: #59efbf;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    background: rgba(0, 0, 0, 0.1);
}

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

.key-box,
.status-badge,
.device-chip {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    border-radius: 10px;
    font-size: 12px;
    font-weight: 700;
}

.key-box {
    font-family: Consolas, monospace;
    padding: 8px 10px;
    background: rgba(16, 198, 137, 0.12);
    color: #82f6d0;
}

.copy-link {
    background: none;
    border: none;
    color: #8ae3ff;
    cursor: pointer;
    font-weight: 700;
}

.status-badge { padding: 7px 10px; }
.status-active { background: rgba(16, 198, 137, 0.16); color: #6ff0c2; }
.status-expired { background: rgba(245, 158, 11, 0.15); color: #ffd27c; }
.status-revoked { background: rgba(239, 68, 68, 0.15); color: #ffb4b4; }

.device-chip {
    padding: 7px 10px;
    background: rgba(255, 255, 255, 0.05);
    color: #d9e6fb;
}

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

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

.overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.58);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    z-index: 100;
}

.modal {
    width: min(560px, 100%);
    padding: 22px;
}

.auth-modal { width: min(420px, 100%); }

.modal-top { margin-bottom: 14px; }

.close-btn {
    width: 36px;
    height: 36px;
    background: transparent;
    color: var(--text);
}

.result-key {
    margin: 18px 0;
    background: var(--panel-dark);
    border: 1px solid rgba(16, 198, 137, 0.22);
    border-radius: 14px;
    padding: 18px;
    font-family: Consolas, monospace;
    font-size: 24px;
    text-align: center;
    color: #82f6d0;
    word-break: break-word;
}

.hint {
    color: var(--muted);
    line-height: 1.6;
    margin: 0 0 14px;
}

.notif {
    position: fixed;
    right: 24px;
    bottom: 24px;
    background: #122238;
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 14px 16px;
    transform: translateY(120px);
    transition: transform 0.2s ease;
    z-index: 120;
}

.notif.show { transform: translateY(0); }
.notif.success { color: #7ff3cb; border-color: rgba(16, 198, 137, 0.28); }
.notif.error { color: #ffb4b4; border-color: rgba(239, 68, 68, 0.28); }

.hidden { display: none !important; }

@media (max-width: 860px) {
    .top-actions,
    .toolbar-right {
        flex-direction: column;
        align-items: stretch;
    }

    .tabs { width: 100%; }
    .tab-btn { flex: 1; }
}
