:root {
    --bg: #081018;
    --bg-2: #0d1722;
    --panel: #12202c;
    --panel-2: #173042;
    --line: #243748;
    --text: #e7eef5;
    --muted: #8aa0b5;
    --accent: #3ec6c9;
    --accent-2: #f0b429;
    --buy: #3dd68c;
    --sell: #ff6b6b;
    --danger: #e55353;
    --shadow: 0 18px 50px rgba(0, 0, 0, 0.28);
    --radius: 16px;
    --font: "Segoe UI", "IBM Plex Sans", sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
    font-family: var(--font);
    background:
        radial-gradient(1200px 500px at 10% -10%, rgba(62, 198, 201, 0.12), transparent 50%),
        radial-gradient(900px 400px at 100% 0%, rgba(240, 180, 41, 0.08), transparent 45%),
        var(--bg);
    color: var(--text);
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
code, .mono { font-family: Consolas, "IBM Plex Mono", monospace; }

.app-shell { display: grid; grid-template-columns: 250px 1fr; min-height: 100vh; }
.sidebar {
    background: linear-gradient(180deg, #0f1c28 0%, #0b151f 100%);
    border-right: 1px solid var(--line);
    padding: 22px 16px;
    display: flex;
    flex-direction: column;
    gap: 24px;
}
.brand { display: flex; gap: 12px; align-items: center; }
.brand-center { justify-content: center; margin-bottom: 8px; }
.brand strong { display: block; }
.brand small { color: var(--muted); }
.brand-mark {
    width: 42px; height: 42px; border-radius: 12px;
    display: grid; place-items: center;
    background: linear-gradient(135deg, var(--accent), #1d8f92);
    color: #062024; font-weight: 800; letter-spacing: 0.04em;
}
.side-nav { display: flex; flex-direction: column; gap: 6px; }
.side-nav a {
    color: var(--muted);
    padding: 10px 12px;
    border-radius: 10px;
    text-decoration: none;
}
.side-nav a:hover, .side-nav a.is-active {
    background: rgba(62, 198, 201, 0.12);
    color: var(--text);
}
.sidebar-foot { margin-top: auto; color: var(--muted); display: flex; justify-content: space-between; gap: 8px; font-size: 13px; }

.main { padding: 28px 32px 48px; }
.page-head h1 { margin: 0 0 4px; font-size: 28px; }
.page-head p { margin: 0; color: var(--muted); }

.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin: 22px 0; }
.stat {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 16px 18px;
    box-shadow: var(--shadow);
}
.stat span, .stat small { color: var(--muted); }
.stat strong { display: block; font-size: 28px; margin: 6px 0; }
.stat.up strong { color: var(--buy); }
.stat.down strong { color: var(--sell); }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 16px; }
.card {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 18px;
    margin-bottom: 16px;
    box-shadow: var(--shadow);
}
.card-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 12px; }
.card-head h2, .card h2 { margin: 0; font-size: 16px; }
.card h2.full { margin: 8px 0 0; }

.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th { text-align: left; color: var(--muted); font-weight: 600; padding: 8px 6px; border-bottom: 1px solid var(--line); }
.table td { padding: 10px 6px; border-bottom: 1px solid rgba(36, 55, 72, 0.7); vertical-align: top; }
.empty { color: var(--muted); text-align: center; padding: 20px !important; }
.up { color: var(--buy); }
.down { color: var(--sell); }

.badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 999px;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-left: 6px;
    background: #1d3142;
    color: var(--muted);
}
.badge-demo { background: rgba(62, 198, 201, 0.16); color: var(--accent); }
.badge-real { background: rgba(240, 180, 41, 0.16); color: var(--accent-2); }
.badge-info { background: #1d3142; }
.badge-warn { background: rgba(240, 180, 41, 0.16); color: var(--accent-2); }
.badge-error { background: rgba(229, 83, 83, 0.16); color: var(--sell); }

.side { font-weight: 700; }
.side-buy { color: var(--buy); }
.side-sell { color: var(--sell); }
.dot::before {
    content: "";
    display: inline-block;
    width: 8px; height: 8px; border-radius: 50%;
    background: #5b7184;
    margin-right: 6px;
}
.dot.live::before { background: var(--buy); box-shadow: 0 0 10px var(--buy); }

.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px 16px;
}
label { display: flex; flex-direction: column; gap: 6px; color: var(--muted); font-size: 13px; }
input, select, textarea, button { font: inherit; }
input, select, textarea {
    background: #0c1822;
    border: 1px solid var(--line);
    color: var(--text);
    border-radius: 10px;
    padding: 10px 12px;
}
input:focus, select:focus { outline: 2px solid rgba(62, 198, 201, 0.35); }
.full { grid-column: 1 / -1; }
button.full, .btn.full { width: 100%; }
.check { flex-direction: row; align-items: center; gap: 8px; color: var(--text); }
.toolbar { display: flex; gap: 12px; margin-bottom: 14px; }
.hint { color: var(--muted); font-size: 13px; margin: 0; }
.inline-form { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }

.btn {
    background: var(--panel-2);
    color: var(--text);
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 10px 14px;
    cursor: pointer;
}
.btn:hover { filter: brightness(1.08); }
.btn-primary { background: var(--accent); color: #062024; border: 0; font-weight: 700; }
.btn-danger { background: var(--danger); color: white; border: 0; font-weight: 700; }
.btn-ghost { background: transparent; }
.btn-danger-ghost { background: transparent; color: var(--sell); }

.flash { padding: 12px 14px; border-radius: 12px; margin: 14px 0; }
.flash-ok { background: rgba(61, 214, 140, 0.12); color: var(--buy); }
.flash-error { background: rgba(255, 107, 107, 0.12); color: var(--sell); }

.token-box {
    margin-top: 16px;
    padding: 12px;
    border-radius: 12px;
    background: #0c1822;
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
}
.token-box code { display: block; word-break: break-all; color: var(--accent); }
.token-box span { color: var(--muted); font-size: 12px; }

.auth-body { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.auth-card {
    width: min(460px, 100%);
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 20px;
    padding: 28px;
    box-shadow: var(--shadow);
    display: flex;
    flex-direction: column;
    gap: 14px;
}
.install-card { width: min(720px, 100%); }
.lead { color: var(--muted); margin-top: 0; }
.steps { display: grid; gap: 16px; }
.steps ol, .steps ul { color: var(--muted); }

@media (max-width: 980px) {
    .app-shell { grid-template-columns: 1fr; }
    .sidebar { flex-direction: row; flex-wrap: wrap; }
    .side-nav { flex-direction: row; flex-wrap: wrap; }
    .sidebar-foot { width: 100%; }
    .stats, .grid-2, .form-grid { grid-template-columns: 1fr; }
    .main { padding: 18px; }
}
