/* ═══════════════════════════════════════════════════════════════════════════
   DENAPPS — App Factory & Deployment Platform
   Dark professional theme with indigo/violet accents
   ═══════════════════════════════════════════════════════════════════════════ */

:root {
    --primary: #6366f1;
    --primary-light: #818cf8;
    --primary-dark: #4f46e5;
    --secondary: #8b5cf6;
    --accent: #06b6d4;
    --success: #22c55e;
    --warning: #f59e0b;
    --danger: #ef4444;
    --info: #3b82f6;

    --bg: #09090b;
    --bg-raised: #0f0f13;
    --bg-card: #111118;
    --bg-hover: #16161f;
    --bg-sidebar: #0b0b10;
    --bg-input: #0d0d14;

    --text: #e2e8f0;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    --text-heading: #f1f5f9;

    --border: rgba(255,255,255,0.06);
    --border-hover: rgba(255,255,255,0.12);
    --border-focus: rgba(99,102,241,0.5);

    --radius: 10px;
    --radius-lg: 14px;
    --radius-sm: 6px;

    --font: 'Inter', system-ui, -apple-system, sans-serif;
    --font-mono: 'JetBrains Mono', 'Fira Code', monospace;

    --shadow: 0 4px 24px rgba(0,0,0,0.3);
    --shadow-lg: 0 8px 40px rgba(0,0,0,0.4);

    --sidebar-width: 240px;
    --topbar-height: 56px;
}

/* ── Reset ─────────────────────────────────────────────────────────────── */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-font-smoothing: antialiased; }
body { font-family: var(--font); background: var(--bg); color: var(--text); line-height: 1.6; font-size: 14px; }
a { color: var(--primary-light); text-decoration: none; transition: color 0.2s; }
a:hover { color: var(--primary); }
img { max-width: 100%; }
code { font-family: var(--font-mono); font-size: 0.85em; background: rgba(99,102,241,0.08); padding: 2px 6px; border-radius: 4px; color: var(--primary-light); }

/* ── App Layout ────────────────────────────────────────────────────────── */
.app-layout { display: flex; min-height: 100vh; }

/* ── Sidebar ───────────────────────────────────────────────────────────── */
.sidebar {
    width: var(--sidebar-width); background: var(--bg-sidebar);
    border-right: 1px solid var(--border); display: flex; flex-direction: column;
    position: fixed; top: 0; bottom: 0; z-index: 50;
    transition: width 0.2s, transform 0.2s;
}
.sidebar.collapsed { width: 64px; }
.sidebar.collapsed .logo-label,
.sidebar.collapsed .nav-section-label,
.sidebar.collapsed .nav-item span,
.sidebar.collapsed .user-details { display: none; }

.sidebar-header {
    padding: 16px 20px; border-bottom: 1px solid var(--border);
    display: flex; align-items: center;
}
.sidebar-logo { display: flex; align-items: center; gap: 10px; }
.logo-label { font-size: 1.05rem; font-weight: 800; letter-spacing: 1px; color: var(--primary-light); }

.sidebar-nav { flex: 1; overflow-y: auto; padding: 8px 0; }
.nav-section { margin-bottom: 8px; }
.nav-section-label {
    padding: 8px 20px 4px; font-size: 0.65rem; font-weight: 700;
    text-transform: uppercase; letter-spacing: 1.5px; color: var(--text-muted);
}
.nav-item {
    display: flex; align-items: center; gap: 10px; padding: 8px 20px;
    color: var(--text-secondary); font-size: 0.88rem; font-weight: 500;
    transition: all 0.15s; cursor: pointer; border-left: 3px solid transparent;
}
.nav-item:hover { color: var(--text); background: var(--bg-hover); }
.nav-item.active { color: var(--primary-light); background: rgba(99,102,241,0.06); border-left-color: var(--primary); }
.nav-item svg { width: 18px; height: 18px; flex-shrink: 0; }
.nav-item-sm { padding: 6px 20px 6px 28px; font-size: 0.82rem; }
.nav-item-sm svg { width: 15px; height: 15px; }

.sidebar-footer {
    padding: 12px 16px; border-top: 1px solid var(--border);
    display: flex; align-items: center; justify-content: space-between;
}
.user-info { display: flex; align-items: center; gap: 10px; min-width: 0; }
.user-avatar {
    width: 32px; height: 32px; border-radius: 8px;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    display: flex; align-items: center; justify-content: center;
    font-weight: 700; font-size: 0.8rem; color: #fff; flex-shrink: 0;
}
.user-details { min-width: 0; }
.user-name { font-size: 0.82rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-role { font-size: 0.7rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.5px; }
.logout-btn { color: var(--text-muted); padding: 4px; }
.logout-btn:hover { color: var(--danger); }
.logout-btn svg { width: 16px; height: 16px; }

/* ── Main Content ──────────────────────────────────────────────────────── */
.main-content { margin-left: var(--sidebar-width); flex: 1; min-height: 100vh; }
.sidebar.collapsed + .main-content { margin-left: 64px; }

.topbar {
    height: var(--topbar-height); border-bottom: 1px solid var(--border);
    display: flex; align-items: center; padding: 0 24px; gap: 16px;
    background: var(--bg-raised); position: sticky; top: 0; z-index: 40;
}
.sidebar-toggle { background: none; border: none; color: var(--text-secondary); cursor: pointer; display: none; }
.topbar-title { font-size: 1rem; font-weight: 600; color: var(--text-heading); }
.topbar-actions { margin-left: auto; display: flex; gap: 8px; }

.content-area { padding: 24px; }

/* ── Buttons ───────────────────────────────────────────────────────────── */
.btn {
    display: inline-flex; align-items: center; gap: 6px; padding: 8px 18px;
    border-radius: var(--radius-sm); font-weight: 600; font-size: 0.85rem;
    cursor: pointer; border: 1px solid transparent;
    transition: all 0.2s; font-family: var(--font); white-space: nowrap;
}
.btn svg { width: 16px; height: 16px; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-primary { background: var(--primary); color: #fff; border-color: var(--primary); }
.btn-primary:hover { background: var(--primary-dark); }
.btn-outline { background: transparent; color: var(--primary-light); border-color: var(--border-hover); }
.btn-outline:hover { border-color: var(--primary); background: rgba(99,102,241,0.06); }
.btn-ghost { background: transparent; color: var(--text-secondary); border-color: transparent; }
.btn-ghost:hover { color: var(--text); background: var(--bg-hover); }
.btn-danger { color: var(--danger); }
.btn-danger:hover { background: rgba(239,68,68,0.08); }
.btn-sm { padding: 5px 12px; font-size: 0.8rem; }
.btn-sm svg { width: 14px; height: 14px; }
.btn-full { width: 100%; justify-content: center; }

/* ── Stats Grid ────────────────────────────────────────────────────────── */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 16px; margin-bottom: 24px; }
.stat-card {
    background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius);
    padding: 20px; display: flex; align-items: center; gap: 16px;
}
.stat-icon {
    width: 44px; height: 44px; border-radius: 10px;
    display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.stat-icon svg { width: 20px; height: 20px; }
.stat-value { font-size: 1.6rem; font-weight: 800; line-height: 1; }
.stat-label { font-size: 0.78rem; color: var(--text-muted); margin-top: 2px; }

/* ── Quick Actions ─────────────────────────────────────────────────────── */
.quick-actions {
    display: flex; gap: 10px; margin-bottom: 28px; flex-wrap: wrap;
}
.quick-action {
    display: flex; align-items: center; gap: 8px; padding: 10px 18px;
    background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius);
    color: var(--text-secondary); font-size: 0.85rem; font-weight: 500;
    transition: all 0.2s; cursor: pointer;
}
.quick-action:hover { border-color: var(--primary); color: var(--primary-light); background: rgba(99,102,241,0.04); }
.quick-action svg { width: 16px; height: 16px; }

/* ── Section Header ────────────────────────────────────────────────────── */
.section-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.section-header h2 { font-size: 1.1rem; font-weight: 700; }
.filter-group { display: flex; gap: 4px; }
.filter-btn {
    padding: 5px 14px; border-radius: 6px; font-size: 0.8rem; font-weight: 500;
    background: transparent; border: 1px solid var(--border); color: var(--text-muted);
    cursor: pointer; transition: all 0.15s; font-family: var(--font);
}
.filter-btn:hover { border-color: var(--border-hover); color: var(--text); }
.filter-btn.active { background: var(--primary); color: #fff; border-color: var(--primary); }

/* ── Project Cards ─────────────────────────────────────────────────────── */
.projects-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 16px; }
.project-card {
    background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-lg);
    padding: 20px; transition: all 0.2s;
}
.project-card:hover { border-color: var(--border-hover); transform: translateY(-2px); box-shadow: var(--shadow); }
.project-card-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.project-type-badge {
    width: 36px; height: 36px; border-radius: 8px; display: flex;
    align-items: center; justify-content: center;
}
.project-type-badge svg { width: 18px; height: 18px; }
.project-type-badge.website { background: rgba(14,165,233,0.12); color: #0ea5e9; }
.project-type-badge.dashboard { background: rgba(99,102,241,0.12); color: #6366f1; }
.project-type-badge.portal { background: rgba(34,197,94,0.12); color: #22c55e; }
.project-type-badge.api_service { background: rgba(245,158,11,0.12); color: #f59e0b; }
.project-type-badge.internal_tool { background: rgba(148,163,184,0.12); color: #94a3b8; }
.project-type-badge.custom { background: rgba(139,92,246,0.12); color: #8b5cf6; }
.project-type-badge.large { width: 48px; height: 48px; }
.project-type-badge.large svg { width: 24px; height: 24px; }

.project-name { font-size: 1rem; font-weight: 700; margin-bottom: 4px; }
.project-desc { font-size: 0.82rem; color: var(--text-muted); margin-bottom: 12px; line-height: 1.5; }
.project-meta { display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.meta-item, .meta-tag {
    display: inline-flex; align-items: center; gap: 4px;
    font-size: 0.75rem; color: var(--text-muted);
}
.meta-item svg, .meta-tag svg { width: 12px; height: 12px; }
.project-card-footer { display: flex; gap: 8px; align-items: center; padding-top: 12px; border-top: 1px solid var(--border); }

/* ── Status Badges ─────────────────────────────────────────────────────── */
.project-status {
    display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px;
    border-radius: 20px; font-size: 0.72rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.5px;
}
.status-dot { width: 7px; height: 7px; border-radius: 50%; }
.status-deployed .status-dot { background: var(--success); box-shadow: 0 0 6px var(--success); }
.status-deployed { background: rgba(34,197,94,0.1); color: var(--success); }
.status-generated .status-dot { background: var(--info); }
.status-generated { background: rgba(59,130,246,0.1); color: var(--info); }
.status-draft .status-dot { background: var(--text-muted); }
.status-draft { background: rgba(100,116,139,0.1); color: var(--text-muted); }
.status-generating .status-dot, .status-deploying .status-dot { background: var(--warning); animation: pulse 1s infinite; }
.status-generating, .status-deploying { background: rgba(245,158,11,0.1); color: var(--warning); }
.status-error .status-dot { background: var(--danger); }
.status-error { background: rgba(239,68,68,0.1); color: var(--danger); }
.status-stopped .status-dot { background: var(--text-muted); }
.status-stopped { background: rgba(100,116,139,0.1); color: var(--text-muted); }

@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: 0.4; } }

/* ── Empty State ───────────────────────────────────────────────────────── */
.empty-state {
    grid-column: 1 / -1; text-align: center; padding: 60px 20px;
    background: var(--bg-card); border: 1px dashed var(--border); border-radius: var(--radius-lg);
}
.empty-state.small { padding: 32px; }
.empty-icon { margin-bottom: 16px; color: var(--text-muted); }
.empty-icon svg { width: 48px; height: 48px; }
.empty-state h3 { font-size: 1.1rem; margin-bottom: 4px; }
.empty-state p { color: var(--text-muted); margin-bottom: 16px; }

/* ── Builder ───────────────────────────────────────────────────────────── */
.builder-container { max-width: 900px; }
.builder-steps {
    display: flex; gap: 4px; margin-bottom: 32px;
    background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius);
    padding: 6px; overflow-x: auto;
}
.step {
    display: flex; align-items: center; gap: 8px; padding: 8px 20px;
    border-radius: var(--radius-sm); font-size: 0.85rem; font-weight: 500;
    color: var(--text-muted); transition: all 0.2s; flex: 1; justify-content: center;
}
.step.active { background: var(--primary); color: #fff; }
.step-num {
    width: 22px; height: 22px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 0.72rem; font-weight: 700; background: rgba(255,255,255,0.1);
}
.step.active .step-num { background: rgba(255,255,255,0.25); }

.builder-step { animation: fadeIn 0.3s ease; }
.builder-step.hidden { display: none; }
.builder-step h2 { font-size: 1.3rem; margin-bottom: 4px; }
.step-desc { color: var(--text-muted); margin-bottom: 24px; }

.builder-nav { display: flex; justify-content: space-between; margin-top: 32px; padding-top: 20px; border-top: 1px solid var(--border); }
.builder-nav-right { display: flex; gap: 8px; }

@keyframes fadeIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }

/* Type Grid */
.type-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 12px; }
.type-card {
    background: var(--bg-card); border: 2px solid var(--border); border-radius: var(--radius-lg);
    padding: 24px; cursor: pointer; transition: all 0.2s; position: relative;
}
.type-card:hover { border-color: var(--border-hover); background: var(--bg-hover); }
.type-card.selected { border-color: var(--primary); background: rgba(99,102,241,0.04); }
.type-card input { position: absolute; opacity: 0; pointer-events: none; }
.type-icon {
    width: 40px; height: 40px; border-radius: 10px;
    background: rgba(99,102,241,0.1); color: var(--primary-light);
    display: flex; align-items: center; justify-content: center; margin-bottom: 12px;
}
.type-icon svg { width: 20px; height: 20px; }
.type-card h3 { font-size: 0.95rem; margin-bottom: 4px; }
.type-card p { font-size: 0.8rem; color: var(--text-muted); line-height: 1.5; }

/* ── Forms ──────────────────────────────────────────────────────────────── */
.form-group { margin-bottom: 18px; }
.form-group label { display: block; margin-bottom: 6px; font-weight: 600; font-size: 0.82rem; color: var(--text-secondary); }
.required { color: var(--danger); }
.form-group input, .form-group textarea, .form-group select {
    width: 100%; padding: 10px 14px; background: var(--bg-input); border: 1px solid var(--border);
    border-radius: var(--radius-sm); color: var(--text); font-family: var(--font); font-size: 0.9rem;
    transition: border-color 0.2s;
}
.form-group input:focus, .form-group textarea:focus, .form-group select:focus {
    outline: none; border-color: var(--border-focus);
}
.form-group textarea { resize: vertical; min-height: 80px; }
.form-group select { cursor: pointer; }
.form-hint { font-size: 0.75rem; color: var(--text-muted); margin-top: 4px; display: block; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-row-3 { grid-template-columns: 1fr 1fr 1fr; }
@media (max-width: 640px) { .form-row, .form-row-3 { grid-template-columns: 1fr; } }
.input-with-prefix { display: flex; }
.input-prefix {
    padding: 10px 12px; background: var(--bg-hover); border: 1px solid var(--border);
    border-right: none; border-radius: var(--radius-sm) 0 0 var(--radius-sm);
    color: var(--text-muted); font-size: 0.85rem; white-space: nowrap;
}
.input-with-prefix input { border-radius: 0 var(--radius-sm) var(--radius-sm) 0; }

/* Color Inputs */
.color-presets { display: flex; gap: 8px; flex-wrap: wrap; }
.color-preset {
    display: flex; flex-direction: column; align-items: center; gap: 6px;
    padding: 10px 14px; background: var(--bg-card); border: 1px solid var(--border);
    border-radius: var(--radius-sm); cursor: pointer; font-size: 0.72rem;
    color: var(--text-muted); font-family: var(--font); transition: all 0.15s;
}
.color-preset:hover { border-color: var(--border-hover); }
.color-swatch-row { display: flex; gap: 4px; }
.color-dot { width: 16px; height: 16px; border-radius: 50%; border: 1px solid rgba(255,255,255,0.1); flex-shrink: 0; }
.color-input { display: flex; gap: 8px; align-items: center; }
.color-input input[type="color"] {
    width: 40px; height: 40px; border: 1px solid var(--border); border-radius: var(--radius-sm);
    cursor: pointer; padding: 2px; background: var(--bg-input);
}
.color-text { max-width: 100px; text-align: center; font-family: var(--font-mono); font-size: 0.85rem; }

/* Design Preview */
.design-preview { margin-top: 24px; }
.preview-label { font-size: 0.82rem; font-weight: 600; color: var(--text-secondary); margin-bottom: 8px; }
.preview-box {
    background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-lg);
    overflow: hidden; min-height: 200px;
}
.preview-nav {
    display: flex; align-items: center; justify-content: space-between;
    padding: 12px 20px; border-bottom: 2px solid var(--primary);
}
.preview-brand { font-weight: 700; font-size: 0.95rem; color: var(--primary); }
.preview-nav-links { display: flex; gap: 16px; font-size: 0.8rem; color: var(--text-muted); }
.preview-hero { padding: 40px 20px; text-align: center; }
.preview-title { font-size: 1.5rem; font-weight: 800; margin-bottom: 8px; }
.preview-subtitle { font-size: 0.85rem; color: var(--text-muted); margin-bottom: 16px; }
.preview-btn {
    display: inline-block; padding: 8px 20px; border-radius: 6px;
    background: var(--primary); color: #fff; font-size: 0.85rem; font-weight: 600;
}

/* ── Review ─────────────────────────────────────────────────────────────── */
.review-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 16px; margin-bottom: 16px; }
.review-card {
    background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius);
    padding: 20px;
}
.review-card h3 { display: flex; align-items: center; gap: 8px; font-size: 0.9rem; margin-bottom: 12px; color: var(--primary-light); }
.review-card h3 svg { width: 16px; height: 16px; }
.review-items { display: flex; flex-direction: column; gap: 8px; }
.review-item { display: flex; justify-content: space-between; align-items: center; font-size: 0.85rem; }
.review-item span { color: var(--text-muted); }
.review-item strong { color: var(--text); font-weight: 600; }
.review-colors { display: flex; gap: 4px; }
.review-desc-box {
    background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius);
    padding: 20px;
}
.review-desc-box h3 { font-size: 0.9rem; margin-bottom: 8px; }
.review-desc-box p { color: var(--text-secondary); font-size: 0.88rem; line-height: 1.6; }

/* ── Project Detail ────────────────────────────────────────────────────── */
.project-header {
    display: flex; align-items: flex-start; justify-content: space-between;
    margin-bottom: 20px; gap: 16px; flex-wrap: wrap;
}
.project-header-left { display: flex; align-items: center; gap: 16px; }
.project-header h1 { font-size: 1.4rem; margin-bottom: 4px; }
.project-header-meta { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.project-header-actions { display: flex; gap: 8px; flex-wrap: wrap; }

.detail-panel {
    background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius);
    padding: 16px 20px; margin-bottom: 16px;
}
.desc-panel p { color: var(--text-secondary); font-size: 0.9rem; line-height: 1.6; }
.panel-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.panel-header h3 { display: flex; align-items: center; gap: 8px; font-size: 0.95rem; }
.panel-header h3 svg { width: 16px; height: 16px; color: var(--primary-light); }

/* Health */
.health-grid { display: flex; gap: 16px; flex-wrap: wrap; }
.health-item { display: flex; align-items: center; gap: 8px; font-size: 0.85rem; }
.health-dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
.health-item.healthy .health-dot { background: var(--success); box-shadow: 0 0 6px var(--success); }
.health-item.unhealthy .health-dot { background: var(--danger); }
.health-item.checking .health-dot { background: var(--warning); animation: pulse 1s infinite; }

/* Tabs */
.detail-tabs {
    display: flex; gap: 4px; margin-bottom: 16px;
    background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius);
    padding: 4px; overflow-x: auto;
}
.tab-btn {
    display: flex; align-items: center; gap: 6px; padding: 8px 16px;
    border-radius: var(--radius-sm); font-size: 0.85rem; font-weight: 500;
    background: transparent; border: none; color: var(--text-muted);
    cursor: pointer; transition: all 0.15s; font-family: var(--font);
}
.tab-btn:hover { color: var(--text); background: var(--bg-hover); }
.tab-btn.active { background: var(--primary); color: #fff; }
.tab-btn svg { width: 15px; height: 15px; }
.tab-count { font-size: 0.7rem; background: rgba(255,255,255,0.15); padding: 1px 6px; border-radius: 10px; }
.tab-content { display: none; }
.tab-content.active { display: block; }

/* Files Layout */
.files-layout { display: grid; grid-template-columns: 260px 1fr; gap: 0; border: 1px solid var(--border); border-radius: var(--radius-lg); overflow: hidden; min-height: 500px; }
.file-tree { background: var(--bg-card); border-right: 1px solid var(--border); }
.file-tree-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 12px 14px; border-bottom: 1px solid var(--border);
    font-size: 0.82rem; font-weight: 600; color: var(--text-secondary);
}
.file-list { overflow-y: auto; max-height: 500px; }
.file-item {
    display: flex; align-items: center; gap: 8px; padding: 7px 14px;
    font-size: 0.8rem; color: var(--text-secondary); cursor: pointer;
    transition: all 0.1s; border-left: 2px solid transparent;
}
.file-item:hover { background: var(--bg-hover); color: var(--text); }
.file-item.active { background: rgba(99,102,241,0.06); color: var(--primary-light); border-left-color: var(--primary); }
.file-item svg { width: 14px; height: 14px; flex-shrink: 0; }
.file-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-size { font-size: 0.7rem; color: var(--text-muted); }
.file-editor { background: var(--bg); }
.editor-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 10px 16px; border-bottom: 1px solid var(--border);
    font-size: 0.82rem; font-weight: 500; color: var(--text-secondary);
    font-family: var(--font-mono);
}
.editor-actions { display: flex; gap: 6px; }
.code-editor {
    width: 100%; height: 460px; padding: 16px; background: var(--bg); border: none;
    color: var(--text); font-family: var(--font-mono); font-size: 0.82rem; line-height: 1.7;
    resize: none; outline: none; tab-size: 4;
}

/* Logs */
.logs-panel { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); padding: 4px 0; max-height: 500px; overflow-y: auto; }
.log-entry { display: flex; align-items: center; gap: 10px; padding: 6px 16px; font-size: 0.82rem; border-bottom: 1px solid var(--border); }
.log-entry:last-child { border-bottom: none; }
.log-time { font-family: var(--font-mono); font-size: 0.75rem; color: var(--text-muted); min-width: 60px; }
.log-badge {
    font-size: 0.65rem; font-weight: 700; text-transform: uppercase; padding: 2px 8px;
    border-radius: 4px; min-width: 50px; text-align: center;
}
.log-badge.info { background: rgba(59,130,246,0.12); color: var(--info); }
.log-badge.success { background: rgba(34,197,94,0.12); color: var(--success); }
.log-badge.warning { background: rgba(245,158,11,0.12); color: var(--warning); }
.log-badge.error { background: rgba(239,68,68,0.12); color: var(--danger); }
.log-phase { font-weight: 600; color: var(--text-secondary); min-width: 60px; }
.log-message { color: var(--text); flex: 1; }

/* Config */
.config-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 16px; }
.config-card { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; }
.config-card h3 { font-size: 0.95rem; margin-bottom: 12px; color: var(--primary-light); }
.config-items { display: flex; flex-direction: column; gap: 8px; }
.config-item { display: flex; justify-content: space-between; align-items: center; font-size: 0.85rem; }
.config-item span { color: var(--text-muted); }
.config-item code { font-size: 0.78rem; }

/* ── Monitoring ────────────────────────────────────────────────────────── */
.monitoring-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; }
.monitoring-header h2 { font-size: 1.1rem; }
.monitoring-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 16px; }
.monitor-card { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 18px; }
.monitor-header { display: flex; align-items: center; gap: 12px; margin-bottom: 10px; }
.monitor-status { flex-shrink: 0; }
.monitor-info { flex: 1; min-width: 0; }
.monitor-info h3 { font-size: 0.95rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.monitor-type { font-size: 0.75rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.5px; }
.monitor-port { font-family: var(--font-mono); font-size: 0.85rem; color: var(--primary-light); font-weight: 600; }
.monitor-details { display: flex; gap: 12px; margin-bottom: 12px; }
.monitor-actions { display: flex; gap: 6px; padding-top: 10px; border-top: 1px solid var(--border); }

/* ── Login ──────────────────────────────────────────────────────────────── */
.login-body { display: flex; align-items: center; justify-content: center; min-height: 100vh; background: var(--bg); }
.login-container { width: 100%; max-width: 420px; padding: 20px; }
.login-card {
    background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-lg);
    padding: 36px; box-shadow: var(--shadow-lg);
}
.login-logo { display: flex; align-items: center; gap: 14px; margin-bottom: 28px; }
.logo-icon svg { width: 40px; height: 40px; }
.logo-text h1 { font-size: 1.3rem; font-weight: 800; letter-spacing: 1px; color: var(--primary-light); }
.logo-text p { font-size: 0.78rem; color: var(--text-muted); margin-top: 2px; }
.login-form .form-group { margin-bottom: 16px; }
.login-footer { margin-top: 24px; text-align: center; }
.login-footer p { font-size: 0.78rem; color: var(--text-muted); }
.login-brand { margin-top: 8px; font-size: 0.7rem; color: var(--text-muted); letter-spacing: 0.5px; }
.alert { padding: 10px 14px; border-radius: var(--radius-sm); margin-bottom: 16px; font-size: 0.85rem; }
.alert-error { background: rgba(239,68,68,0.08); color: var(--danger); border: 1px solid rgba(239,68,68,0.15); }

/* ── Toast ──────────────────────────────────────────────────────────────── */
.toast-container { position: fixed; bottom: 20px; right: 20px; z-index: 10000; display: flex; flex-direction: column; gap: 8px; }
.toast {
    padding: 12px 20px; border-radius: var(--radius-sm); font-size: 0.85rem; font-weight: 500;
    box-shadow: var(--shadow); animation: slideUp 0.3s ease;
    display: flex; align-items: center; gap: 8px; min-width: 250px;
}
.toast.info { background: #1e3a5f; color: #93c5fd; border: 1px solid rgba(59,130,246,0.3); }
.toast.success { background: #14332a; color: #86efac; border: 1px solid rgba(34,197,94,0.3); }
.toast.error { background: #3b1010; color: #fca5a5; border: 1px solid rgba(239,68,68,0.3); }
.toast.warning { background: #3b2e10; color: #fcd34d; border: 1px solid rgba(245,158,11,0.3); }
@keyframes slideUp { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }

/* ── Responsive ────────────────────────────────────────────────────────── */
@media (max-width: 768px) {
    .sidebar { transform: translateX(-100%); position: fixed; z-index: 100; }
    .sidebar.collapsed { transform: translateX(0); width: var(--sidebar-width); }
    .main-content { margin-left: 0; }
    .sidebar-toggle { display: block; }
    .project-header { flex-direction: column; }
    .project-header-actions { width: 100%; }
    .files-layout { grid-template-columns: 1fr; }
    .file-tree { max-height: 200px; border-right: none; border-bottom: 1px solid var(--border); }
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
}
