:root {
    --bg-deep: #050a14;
    --bg-card: #0d1525;
    --bg-panel: #111b2e;
    --border: rgba(255,255,255,0.06);
    --border-active: rgba(249,115,22,0.5);
    --text: #e8ecf4;
    --text-dim: #7a8ba3;
    --text-muted: #4a5b73;
    --accent: #f97316;
    --accent-dim: rgba(249,115,22,0.15);
    --danger: #ef4444;
    --warn: #eab308;
    --success: #22c55e;
    --purple: #a855f7;
    --sidebar-w: 92px;
}

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--bg-deep);
    color: var(--text);
    height: 100vh;
    overflow: hidden;
    display: flex;
}

/* ===== SIDEBAR ===== */
.sidebar {
    width: var(--sidebar-w);
    height: 100vh;
    background: rgba(8,12,22,0.95);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 16px 0;
    z-index: 100;
    flex-shrink: 0;
}

.sidebar-brand {
    text-align: center;
    margin-bottom: 24px;
}
.sidebar-brand span {
    font-size: 0.7rem;
    font-weight: 800;
    color: var(--accent);
    text-transform: uppercase;
    letter-spacing: 0.8px;
    line-height: 1.3;
    display: block;
    margin-top: 8px;
    text-shadow: 0 0 12px rgba(249,115,22,0.4);
}

.brand-flame {
    width: 36px; height: 36px;
    margin: 0 auto;
    background: radial-gradient(ellipse at 50% 80%, #f97316 0%, #ef4444 50%, transparent 70%);
    border-radius: 50% 50% 50% 50% / 60% 60% 40% 40%;
    animation: flame-dance 1.5s ease-in-out infinite alternate;
    box-shadow: 0 0 18px rgba(249,115,22,0.5), 0 0 40px rgba(239,68,68,0.2);
}
@keyframes flame-dance {
    0% { transform: scaleX(1) scaleY(1); }
    50% { transform: scaleX(0.9) scaleY(1.1); }
    100% { transform: scaleX(1.05) scaleY(0.95); }
}

.sidebar-nav {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 4px;
    width: 100%;
    padding: 0 8px;
}

.nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 14px 8px;
    border: none;
    background: transparent;
    color: var(--text-dim);
    cursor: pointer;
    border-radius: 10px;
    transition: all 0.2s;
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.3px;
}
.nav-item svg { width: 30px; height: 30px; fill: currentColor; transition: transform 0.2s; }
.nav-item:hover { background: rgba(255,255,255,0.06); color: var(--text); }
.nav-item:hover svg { transform: scale(1.1); }
.nav-item.active { background: var(--accent-dim); color: var(--accent); border: 1px solid rgba(249,115,22,0.3); box-shadow: 0 0 12px rgba(249,115,22,0.15); }

.sidebar-footer {
    display: flex;
    flex-direction: column;
    gap: 6px;
    width: 100%;
    padding: 0 8px;
}
.sidebar-version {
    text-align: center;
    color: var(--text-muted);
    font-size: 0.66rem;
    letter-spacing: 0.5px;
    margin-top: 6px;
}
.sidebar-guide-wrap {
    position: relative;
    width: 100%;
}
.sidebar-btn {
    display: block;
    text-align: center;
    padding: 9px 6px;
    font-size: 0.72rem;
    font-weight: 700;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: transparent;
    color: var(--text-dim);
    cursor: pointer;
    text-decoration: none;
    transition: all 0.15s;
}
.sidebar-btn:hover { border-color: var(--accent); color: var(--accent); }
.sidebar-btn-accent { background: var(--accent); border-color: var(--accent); color: #fff; }
.sidebar-btn-accent {
    font-size: 0.84rem;
    font-weight: 800;
    padding: 11px 6px;
}
.sidebar-btn-accent:hover { background: #ea580c; }
.sidebar-guide-popover {
    position: absolute;
    left: calc(100% + 12px);
    bottom: -6px;
    width: 360px;
    padding: 16px 18px;
    background: rgba(10, 16, 29, 0.98);
    border: 1px solid rgba(249,115,22,0.28);
    border-radius: 12px;
    box-shadow: 0 20px 50px rgba(0,0,0,0.35);
    opacity: 0;
    pointer-events: none;
    transform: translateY(8px);
    transition: opacity 0.18s ease, transform 0.18s ease;
    z-index: 120;
}
.sidebar-guide-wrap.is-open .sidebar-guide-popover,
.sidebar-guide-wrap:hover .sidebar-guide-popover,
.sidebar-guide-wrap:focus-within .sidebar-guide-popover {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0);
}
.sidebar-guide-popover h3 {
    font-size: 0.92rem;
    color: var(--accent);
    margin-bottom: 12px;
}
.sidebar-guide-popover ol {
    padding-left: 18px;
    margin-bottom: 12px;
    color: var(--text);
    font-size: 0.76rem;
    line-height: 1.6;
}
.sidebar-guide-popover li + li {
    margin-top: 4px;
}
.sidebar-guide-section + .sidebar-guide-section {
    margin-top: 12px;
}
.sidebar-guide-section h4 {
    font-size: 0.72rem;
    color: #f4f7fb;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    margin-bottom: 6px;
}
.sidebar-guide-note {
    color: var(--text-dim);
    font-size: 0.72rem;
    line-height: 1.5;
}
.sidebar-guide-highlight {
    color: var(--warn);
    font-weight: 800;
}
.sidebar-guide-note + .sidebar-guide-note {
    margin-top: 8px;
}

@media (max-width: 900px) {
    .sidebar-guide-popover {
        left: calc(100% + 8px);
        width: 280px;
    }
}

/* ===== MAIN ===== */
.main-content {
    flex: 1;
    height: 100vh;
    overflow: hidden;
    position: relative;
}

.tab-content { display: none; height: 100%; }
.tab-content.active { display: block; }

/* ===== TOAST ===== */
.toast {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: var(--bg-panel);
    border: 1px solid var(--border);
    padding: 10px 24px;
    border-radius: 8px;
    font-size: 0.82rem;
    opacity: 0;
    transition: all 0.3s;
    z-index: 9999;
    pointer-events: none;
}
.toast.show { transform: translateX(-50%) translateY(0); opacity: 1; }

/* ===== REGISTER PAGE ===== */
.page-register {
    display: flex;
    align-items: center;
    justify-content: center;
    background: radial-gradient(ellipse at 50% 80%, #0d1a2e 0%, var(--bg-deep) 70%);
}
.register-wrap { text-align: center; }
.register-back {
    display: inline-block;
    margin-bottom: 16px;
    color: var(--text-dim);
    text-decoration: none;
    font-size: 0.8rem;
}
.register-back:hover { color: var(--accent); }

.register-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 40px 36px;
    width: 420px;
    text-align: left;
}
.register-brand { text-align: center; margin-bottom: 20px; }
.register-brand h1 { font-size: 1.2rem; color: var(--accent); margin-top: 8px; }
.register-version {
    margin-top: 6px;
    color: var(--text-muted);
    font-size: 0.72rem;
    letter-spacing: 0.4px;
}
.register-desc { color: var(--text-dim); font-size: 0.82rem; margin-bottom: 28px; text-align: center; }

.field { margin-bottom: 18px; }
.field label { display: block; font-size: 0.72rem; font-weight: 600; color: var(--text-dim); text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 6px; }
.field input {
    width: 100%; padding: 10px 14px;
    background: var(--bg-deep); border: 1px solid var(--border);
    border-radius: 8px; color: var(--text); font-size: 0.88rem;
    transition: border-color 0.2s;
}
.field input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(249,115,22,0.15); }
.field small { display: block; margin-top: 4px; color: var(--text-muted); font-size: 0.68rem; }
.field small a { color: var(--accent); }
.field small code { background: rgba(255,255,255,0.05); padding: 1px 4px; border-radius: 3px; }

.btn-register {
    width: 100%; padding: 12px;
    background: linear-gradient(135deg, #f97316, #ea580c);
    border: none; border-radius: 8px;
    color: #fff; font-size: 0.92rem; font-weight: 600;
    cursor: pointer; transition: all 0.2s;
}
.btn-register:hover { box-shadow: 0 4px 24px rgba(249,115,22,0.3); transform: translateY(-1px); }

.result { margin-top: 16px; padding: 10px 14px; border-radius: 8px; font-size: 0.82rem; }
.result.success { background: rgba(34,197,94,0.1); border: 1px solid rgba(34,197,94,0.3); color: var(--success); }
.result.error { background: rgba(239,68,68,0.1); border: 1px solid rgba(239,68,68,0.3); color: var(--danger); }
.hidden { display: none; }
