:root {
    --bg: #070b14;
    --panel: #0d1524;
    --panel-2: #111c30;
    --line: #1c2a44;
    --line-soft: #16233a;
    --text: #e6edf7;
    --muted: #8fa3c0;
    --accent: #6366f1;
    --accent-hover: #7c7ff5;
    --green: #22c55e;
    --red: #ef4444;
    --amber: #f59e0b;
    --radius: 12px;
    --mono: ui-monospace, "Cascadia Code", "JetBrains Mono", Consolas, monospace;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html, body {
    height: 100%;
}

body {
    background: radial-gradient(1200px 600px at 70% -10%, rgba(99, 102, 241, 0.14), transparent 60%),
                radial-gradient(900px 500px at 0% 110%, rgba(139, 92, 246, 0.10), transparent 60%),
                var(--bg);
    color: var(--text);
    font-family: "Inter", "Segoe UI", system-ui, -apple-system, sans-serif;
    font-size: 15px;
    line-height: 1.55;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

a {
    color: #a5b4fc;
    text-decoration: none;
}

a:hover {
    color: #c7d2fe;
    text-decoration: underline;
}

code {
    font-family: var(--mono);
    font-size: 0.86em;
    background: rgba(99, 102, 241, 0.10);
    border: 1px solid rgba(99, 102, 241, 0.20);
    border-radius: 6px;
    padding: 2px 7px;
    word-break: break-all;
}

.container {
    width: 100%;
    max-width: 1080px;
    margin: 0 auto;
    padding: 0 24px;
}

.main {
    flex: 1;
    padding-top: 36px;
    padding-bottom: 48px;
}

/* Topbar */

.topbar {
    border-bottom: 1px solid var(--line-soft);
    background: rgba(7, 11, 20, 0.85);
    backdrop-filter: blur(10px);
    position: sticky;
    top: 0;
    z-index: 20;
}

.topbar-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 64px;
}

.brand {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 700;
    font-size: 17px;
    color: var(--text);
    letter-spacing: 0.2px;
}

.brand:hover {
    text-decoration: none;
}

.brand-mark {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent), #a78bfa);
    box-shadow: 0 0 14px rgba(99, 102, 241, 0.9);
}

.brand-accent {
    color: #a5b4fc;
    margin-left: 1px;
}

.nav {
    display: flex;
    align-items: center;
    gap: 18px;
}

.nav-link {
    color: var(--muted);
    font-weight: 500;
}

.nav-link:hover {
    color: var(--text);
    text-decoration: none;
}

/* Headings */

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

.page-head h1 {
    font-size: 26px;
    letter-spacing: -0.3px;
}

h3 {
    font-size: 15px;
    margin: 22px 0 10px;
    color: #cdd8ea;
}

h3:first-child {
    margin-top: 0;
}

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

.hint {
    color: var(--muted);
    font-size: 12.5px;
}

.strong {
    font-weight: 600;
}

.right {
    text-align: right;
}

.center {
    text-align: center;
}

.mt-1 {
    margin-top: 8px;
}

.mt-2 {
    margin-top: 16px;
}

.mb-3 {
    margin-bottom: 24px;
}

/* Cards */

.card {
    background: linear-gradient(180deg, var(--panel), var(--panel-2));
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 22px;
    box-shadow: 0 12px 34px rgba(2, 6, 16, 0.45);
}

.card-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 14px;
}

.card-title {
    font-size: 17px;
    letter-spacing: -0.2px;
}

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

.grid-2 {
    grid-template-columns: 1fr 1fr;
}

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

/* Buttons */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    border: 1px solid transparent;
    border-radius: 9px;
    padding: 9px 16px;
    font-size: 14px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s, transform 0.05s;
    color: var(--text);
    background: transparent;
}

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

.btn-primary {
    background: linear-gradient(135deg, var(--accent), #7c6cf5);
    color: #fff;
    box-shadow: 0 6px 18px rgba(99, 102, 241, 0.35);
}

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

.btn-ghost {
    border-color: var(--line);
    background: rgba(99, 102, 241, 0.06);
}

.btn-ghost:hover {
    border-color: #33436b;
    background: rgba(99, 102, 241, 0.14);
}

.btn-danger {
    border-color: rgba(239, 68, 68, 0.45);
    background: rgba(239, 68, 68, 0.10);
    color: #fca5a5;
}

.btn-danger:hover {
    background: rgba(239, 68, 68, 0.20);
}

.btn-sm {
    padding: 6px 12px;
    font-size: 13px;
    border-radius: 8px;
}

.btn-block {
    width: 100%;
}

.inline {
    display: inline-block;
}

.actions {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
    align-items: center;
}

/* Forms */

.stack {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

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

.field label {
    font-size: 13px;
    font-weight: 600;
    color: #c3cfe2;
}

.field input[type="text"],
.field input[type="email"],
.field input[type="password"] {
    background: #0a1120;
    border: 1px solid var(--line);
    border-radius: 9px;
    color: var(--text);
    padding: 10px 12px;
    font-size: 14px;
    font-family: inherit;
    outline: none;
    transition: border-color 0.15s, box-shadow 0.15s;
}

.field input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.20);
}

.check {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    font-size: 13.5px;
    color: #c3cfe2;
    cursor: pointer;
}

.check input {
    margin-top: 3px;
    accent-color: var(--accent);
}

/* Alerts */

.alert {
    border-radius: 10px;
    padding: 12px 14px;
    font-size: 14px;
    margin-bottom: 18px;
    border: 1px solid;
}

.alert ul {
    padding-left: 18px;
}

.alert-success {
    background: rgba(34, 197, 94, 0.10);
    border-color: rgba(34, 197, 94, 0.35);
    color: #86efac;
}

.alert-error {
    background: rgba(239, 68, 68, 0.10);
    border-color: rgba(239, 68, 68, 0.35);
    color: #fca5a5;
}

.card .alert {
    margin-bottom: 14px;
}

/* Badges */

.badge {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    font-size: 12.5px;
    font-weight: 600;
    border-radius: 999px;
    padding: 4px 12px;
    border: 1px solid;
}

.badge .dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: currentColor;
}

.badge-online {
    color: #86efac;
    background: rgba(34, 197, 94, 0.10);
    border-color: rgba(34, 197, 94, 0.35);
}

.badge-online .dot {
    animation: pulse 1.6s ease-in-out infinite;
}

.badge-offline {
    color: #fca5a5;
    background: rgba(239, 68, 68, 0.10);
    border-color: rgba(239, 68, 68, 0.35);
}

.badge-info {
    color: #a5b4fc;
    background: rgba(99, 102, 241, 0.12);
    border-color: rgba(99, 102, 241, 0.35);
}

.badge-muted {
    color: var(--muted);
    background: rgba(143, 163, 192, 0.08);
    border-color: var(--line);
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
        box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.5);
    }
    50% {
        opacity: 0.65;
        box-shadow: 0 0 0 5px rgba(34, 197, 94, 0);
    }
}

/* Tables */

.table-wrap {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

th {
    text-align: left;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--muted);
    padding: 8px 10px;
    border-bottom: 1px solid var(--line);
    white-space: nowrap;
}

td {
    padding: 12px 10px;
    border-bottom: 1px solid var(--line-soft);
    vertical-align: middle;
}

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

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

.method {
    display: inline-block;
    font-family: var(--mono);
    font-size: 11px;
    font-weight: 700;
    color: #a5b4fc;
    background: rgba(99, 102, 241, 0.12);
    border: 1px solid rgba(99, 102, 241, 0.30);
    border-radius: 6px;
    padding: 2px 8px;
}

/* Empty state */

.empty {
    text-align: center;
    padding: 36px 12px;
}

.empty p:first-child {
    font-weight: 600;
    font-size: 15px;
}

/* Auth */

.auth-wrap {
    display: flex;
    justify-content: center;
    padding-top: 24px;
}

.auth-card {
    width: 100%;
    max-width: 420px;
}

.auth-card .card-title {
    font-size: 21px;
    margin-bottom: 4px;
}

.auth-card .muted {
    margin-bottom: 18px;
}

/* Tabs */

.tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    border-bottom: 1px solid var(--line);
    margin: -6px -6px 20px;
    padding: 0 2px 12px;
}

.tab {
    background: transparent;
    border: 1px solid transparent;
    border-radius: 8px;
    color: var(--muted);
    font-family: inherit;
    font-size: 13.5px;
    font-weight: 600;
    padding: 8px 14px;
    cursor: pointer;
    transition: color 0.15s, background 0.15s;
}

.tab:hover {
    color: var(--text);
}

.tab.active {
    color: #dfe6f5;
    background: rgba(99, 102, 241, 0.14);
    border-color: rgba(99, 102, 241, 0.35);
}

.tab-panel {
    display: none;
}

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

/* Credentials */

.cred-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

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

.cred-row {
    display: flex;
    align-items: center;
    gap: 10px;
    background: #0a1120;
    border: 1px solid var(--line-soft);
    border-radius: 10px;
    padding: 10px 12px;
    min-width: 0;
}

.cred-row.full {
    grid-column: 1 / -1;
}

.cred-label {
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--muted);
    min-width: 108px;
}

.cred-row code {
    background: transparent;
    border: none;
    padding: 0;
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 13px;
    color: #cdd8ea;
}

/* Code blocks */

.codeblock {
    background: #0a1120;
    border: 1px solid var(--line);
    border-radius: 10px;
    overflow: hidden;
    margin-bottom: 6px;
}

.codeblock-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 8px 12px;
    border-bottom: 1px solid var(--line-soft);
    background: rgba(13, 21, 36, 0.7);
}

.codeblock-head span {
    font-family: var(--mono);
    font-size: 12px;
    color: var(--muted);
}

.codeblock pre {
    margin: 0;
    padding: 14px 16px;
    overflow-x: auto;
}

.codeblock pre code {
    background: transparent;
    border: none;
    padding: 0;
    font-size: 12.8px;
    line-height: 1.65;
    color: #c9d6ea;
    white-space: pre;
    word-break: normal;
}

.copy-mini {
    background: rgba(99, 102, 241, 0.10);
    border: 1px solid rgba(99, 102, 241, 0.30);
    border-radius: 7px;
    color: #a5b4fc;
    font-family: inherit;
    font-size: 12px;
    font-weight: 600;
    padding: 4px 10px;
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.15s;
}

.copy-mini:hover {
    background: rgba(99, 102, 241, 0.22);
}

/* Footer */

.footer {
    border-top: 1px solid var(--line-soft);
    padding-top: 18px;
    padding-bottom: 22px;
    color: #5b6e8f;
    font-size: 12.5px;
}

/* Monitor */

.data-cell {
    display: inline-block;
    max-width: 320px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    vertical-align: middle;
}

#events-body code,
#channels-body code {
    font-size: 12px;
}
