:root {
    --bg: #0f1117;
    --surface: #1a1d27;
    --card: #222639;
    --accent: #6c5ce7;
    --accent-hover: #7c6ef7;
    --text: #e4e4e7;
    --text-muted: #9ca3af;
    --border: #2d3148;
    --danger: #ef4444;
    --success: #10b981;
    --sidebar-w: 220px;
}

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

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

/* Sidebar */
.sidebar {
    width: var(--sidebar-w);
    background: var(--surface);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 10;
}

.sidebar-header {
    padding: 1.25rem 1rem;
    border-bottom: 1px solid var(--border);
}

.sidebar-header h2 {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--accent);
    letter-spacing: 0.02em;
}

.nav-list {
    list-style: none;
    padding: 0.5rem 0;
    flex: 1;
}

.nav-list li a {
    display: block;
    padding: 0.55rem 1rem;
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.87rem;
    border-left: 3px solid transparent;
    transition: all 0.15s;
}

.nav-list li a:hover { color: var(--text); background: rgba(108, 92, 231, 0.08); }
.nav-list li a.active { color: var(--accent); border-left-color: var(--accent); background: rgba(108, 92, 231, 0.1); }

.nav-divider { border-top: 1px solid var(--border); margin: 0.5rem 0; }

.sidebar-footer {
    padding: 0.75rem 1rem;
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.8rem;
}

.user-name { color: var(--text-muted); }
.logout-link { color: var(--danger); text-decoration: none; }
.logout-link:hover { text-decoration: underline; }

/* Main content */
main {
    flex: 1;
    padding: 2rem;
}

main.with-sidebar {
    margin-left: var(--sidebar-w);
}

/* Login */
.login-container {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    width: 100%;
}

.login-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 2.5rem 2rem;
    width: 100%;
    max-width: 380px;
    text-align: center;
}

.login-card h1 { font-size: 1.5rem; margin-bottom: 0.25rem; }
.login-card .subtitle { color: var(--text-muted); margin-bottom: 1.5rem; font-size: 0.9rem; }

.alert { padding: 0.6rem 1rem; border-radius: 6px; margin-bottom: 1rem; font-size: 0.85rem; }
.alert-error { background: rgba(239,68,68,0.15); color: var(--danger); border: 1px solid rgba(239,68,68,0.3); }

.divider {
    display: flex;
    align-items: center;
    margin: 1.25rem 0;
    color: var(--text-muted);
    font-size: 0.8rem;
}
.divider::before, .divider::after { content: ''; flex: 1; border-top: 1px solid var(--border); }
.divider span { padding: 0 0.75rem; }

.local-form input {
    display: block;
    width: 100%;
    padding: 0.6rem 0.75rem;
    margin-bottom: 0.75rem;
    background: var(--bg);
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 0.9rem;
}
.local-form input:focus { outline: none; border-color: var(--accent); }

/* Buttons */
.btn {
    display: inline-block;
    padding: 0.6rem 1.25rem;
    border: none;
    border-radius: 6px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    text-align: center;
    transition: all 0.15s;
}

.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-hover); }
.btn-secondary { background: var(--card); color: var(--text); border: 1px solid var(--border); }
.btn-secondary:hover { border-color: var(--accent); }
.btn-full { display: block; width: 100%; }
.btn-sm { padding: 0.35rem 0.75rem; font-size: 0.8rem; }
.btn.active { background: var(--accent); color: #fff; }

/* Dashboard */
.dashboard h1 { font-size: 1.3rem; margin-bottom: 1.25rem; }

.tool-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 1rem;
}

.tool-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 1.5rem;
    text-decoration: none;
    color: var(--text);
    transition: all 0.2s;
}

.tool-card:hover {
    border-color: var(--accent);
    transform: translateY(-2px);
}

.tool-icon {
    width: 40px;
    height: 40px;
    background: rgba(108, 92, 231, 0.15);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 0.75rem;
    color: var(--accent);
}

.tool-card h3 { font-size: 1rem; margin-bottom: 0.3rem; }
.tool-card p { font-size: 0.82rem; color: var(--text-muted); }

/* Tool view */
.tool-view { height: calc(100vh - 4rem); display: flex; flex-direction: column; }

.tool-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
}

.tool-header h1 { font-size: 1.2rem; }
.tool-controls { display: flex; gap: 0.5rem; }

.panels { flex: 1; position: relative; }
.panel { display: none; height: 100%; }
.panel.active { display: block; }

.tool-frame {
    width: 100%;
    height: 100%;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--surface);
}

/* Terminal view */
.terminal-view { height: calc(100vh - 4rem); }
.terminal-view .tool-frame { border-radius: 8px; }
