:root {
    --bg: #0a0a0f;
    --surface: #12121a;
    --surface2: #1a1a28;
    --border: #2a2a3a;
    --text: #e0e0e8;
    --text-dim: #888898;
    --accent: #6c5ce7;
    --accent-dim: #4a3db8;
    --accent-glow: rgba(108, 92, 231, 0.15);
    --success: #00d2a0;
    --error: #ff6b6b;
    --warn: #ffa94d;
    --mono: 'JetBrains Mono', 'Fira Code', 'Cascadia Code', monospace;
}
* { margin: 0; padding: 0; box-sizing: border-box; }
body { font-family: var(--mono); background: var(--bg); color: var(--text); font-size: 13px; line-height: 1.5; }

.app { display: grid; grid-template-rows: 52px 1fr; height: 100vh; overflow: hidden; }

/* Header */
.header {
    display: flex; align-items: center; padding: 0 24px; gap: 32px;
    background: var(--surface); border-bottom: 1px solid var(--border);
}
.header h1 { font-size: 16px; font-weight: 700; letter-spacing: 0.08em; color: var(--accent); }
.header-right { margin-left: auto; display: flex; align-items: center; gap: 12px; }
.ds-count { font-size: 11px; color: var(--text-dim); }

/* Tabs */
.tabs { display: flex; gap: 2px; }
.tab {
    background: none; border: none; color: var(--text-dim); font-family: var(--mono);
    font-size: 13px; padding: 8px 18px; cursor: pointer; border-bottom: 2px solid transparent;
    transition: all 0.15s; font-weight: 500;
}
.tab:hover { color: var(--text); }
.tab.active { color: var(--accent); border-bottom-color: var(--accent); }

/* Buttons */
.btn {
    background: var(--accent); color: white; border: none; padding: 10px 20px;
    border-radius: 6px; font-family: var(--mono); font-size: 13px; cursor: pointer;
    font-weight: 600; white-space: nowrap; transition: all 0.15s;
}
.btn:hover { background: var(--accent-dim); transform: translateY(-1px); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }
.btn-ask { padding: 12px 28px; font-size: 14px; }
.btn-sm { padding: 4px 10px; font-size: 11px; }
.refresh-btn {
    background: none; border: 1px solid var(--border); color: var(--text-dim);
    padding: 4px 10px; border-radius: 4px; font-family: var(--mono); font-size: 12px; cursor: pointer;
}
.refresh-btn:hover { border-color: var(--accent); color: var(--accent); }

/* Content */
.content-full { overflow-y: auto; flex: 1; }
.panel { padding: 32px; max-width: 1000px; margin: 0 auto; }

/* States */
.loading { color: var(--accent); padding: 24px; text-align: center; }
.error { color: var(--error); background: rgba(255,107,107,0.08); border: 1px solid rgba(255,107,107,0.2); padding: 14px 18px; border-radius: 6px; font-size: 12px; margin-top: 12px; }
.error-inline { color: var(--error); font-size: 12px; }
.empty { color: var(--text-dim); padding: 48px 24px; text-align: center; font-size: 13px; }
.empty-sm { color: var(--text-dim); padding: 16px; text-align: center; font-size: 12px; }

/* === ASK PANEL === */
.ask-panel { max-width: 860px; }
.ask-hero { margin-bottom: 28px; }
.ask-hero h2 { font-size: 28px; font-weight: 700; margin-bottom: 6px; }
.subtitle { color: var(--text-dim); font-size: 14px; }

.ask-input-row { display: flex; gap: 10px; margin-bottom: 12px; }
.ask-input {
    flex: 1; background: var(--surface); border: 2px solid var(--border); color: var(--text);
    font-family: var(--mono); font-size: 15px; padding: 14px 18px; border-radius: 8px; outline: none;
}
.ask-input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-glow); }
.ask-input::placeholder { color: var(--text-dim); }

.ask-examples { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 24px; font-size: 11px; color: var(--text-dim); align-items: center; }
.example-btn {
    background: var(--surface2); border: 1px solid var(--border); color: var(--text-dim);
    font-family: var(--mono); font-size: 11px; padding: 4px 10px; border-radius: 4px; cursor: pointer;
}
.example-btn:hover { border-color: var(--accent); color: var(--accent); }

.generated-sql {
    background: var(--surface); border: 1px solid var(--border); border-radius: 8px;
    padding: 16px; margin-bottom: 20px;
}
.sql-label { font-size: 10px; text-transform: uppercase; letter-spacing: 0.1em; color: var(--text-dim); display: block; margin-bottom: 8px; }
.sql-code { font-size: 13px; color: var(--accent); white-space: pre-wrap; word-break: break-all; }

/* === EXPLORE PANEL === */
.explore-panel { max-width: 1100px; }
.explore-grid { display: grid; grid-template-columns: 260px 1fr; gap: 24px; min-height: 500px; }
.ds-cards h3 { font-size: 12px; text-transform: uppercase; letter-spacing: 0.1em; color: var(--text-dim); margin-bottom: 12px; }

.ds-card {
    background: var(--surface); border: 1px solid var(--border); border-radius: 8px;
    padding: 14px; margin-bottom: 8px; cursor: pointer; transition: all 0.15s;
}
.ds-card:hover { border-color: var(--accent); }
.ds-card.active { border-color: var(--accent); background: var(--accent-glow); }
.ds-card-name { font-weight: 600; font-size: 14px; }
.ds-card-meta { font-size: 11px; color: var(--text-dim); margin-top: 4px; }

.ds-detail h3 { font-size: 20px; font-weight: 700; margin-bottom: 16px; }

.summary-box {
    background: var(--accent-glow); border: 1px solid rgba(108,92,231,0.3); border-radius: 8px;
    padding: 16px; margin-bottom: 20px;
}
.summary-label { font-size: 10px; text-transform: uppercase; letter-spacing: 0.1em; color: var(--accent); display: block; margin-bottom: 8px; font-weight: 600; }
.summary-text { font-size: 13px; line-height: 1.7; }

.section-label { font-size: 10px; text-transform: uppercase; letter-spacing: 0.1em; color: var(--text-dim); display: block; margin-bottom: 10px; font-weight: 600; }
.schema-box, .preview-box { margin-bottom: 24px; }

/* === SQL PANEL === */
.sql-editor { margin-bottom: 16px; }
.sql-textarea {
    width: 100%; background: var(--surface); border: 1px solid var(--border); color: var(--text);
    font-family: var(--mono); font-size: 14px; padding: 16px; border-radius: 8px;
    resize: vertical; min-height: 120px; outline: none; margin-bottom: 10px;
}
.sql-textarea:focus { border-color: var(--accent); }
.sql-actions { display: flex; gap: 8px; }
.results-area { margin-top: 8px; }

/* === STATUS PANEL === */
.status-hero { margin-bottom: 28px; }
.status-hero h2 { font-size: 24px; font-weight: 700; margin-bottom: 6px; }
.status-hero .btn { margin-top: 16px; }

.check-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 12px; }
.check-card {
    background: var(--surface); border: 1px solid var(--border); border-radius: 8px;
    padding: 16px; display: flex; gap: 14px; align-items: flex-start;
}
.check-card.pass { border-left: 3px solid var(--success); }
.check-card.fail { border-left: 3px solid var(--error); }
.check-icon { font-size: 18px; font-weight: 700; min-width: 24px; text-align: center; }
.pass .check-icon { color: var(--success); }
.fail .check-icon { color: var(--error); }
.check-info { flex: 1; min-width: 0; }
.check-name { font-weight: 600; font-size: 13px; }
.check-desc { font-size: 11px; color: var(--text-dim); margin: 2px 0; }
.check-msg { font-size: 11px; color: var(--text-dim); word-break: break-word; overflow: hidden; text-overflow: ellipsis; max-height: 3em; }
.pass .check-msg { color: var(--success); }
.fail .check-msg { color: var(--error); }

/* Results table */
.results-info { font-size: 11px; color: var(--text-dim); margin-bottom: 8px; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 12px; }
th {
    text-align: left; padding: 10px 14px; background: var(--surface2); border-bottom: 2px solid var(--accent);
    font-weight: 600; font-size: 11px; text-transform: uppercase; letter-spacing: 0.05em;
    color: var(--accent); position: sticky; top: 0;
}
td { padding: 8px 14px; border-bottom: 1px solid var(--border); }
tr:hover td { background: var(--accent-glow); }

/* Dashboard */
.dashboard-hero { margin-bottom: 28px; }
.dashboard-hero h2 { font-size: 32px; font-weight: 700; }

.stat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 12px; margin-bottom: 32px; }
.stat-card {
    background: var(--surface); border: 1px solid var(--border); border-radius: 10px;
    padding: 20px 16px; text-align: center;
}
.stat-card.accent { border-color: var(--accent); background: var(--accent-glow); }
.stat-value { font-size: 28px; font-weight: 700; color: var(--text); }
.stat-card.accent .stat-value { color: var(--accent); }
.stat-label { font-size: 11px; color: var(--text-dim); margin-top: 4px; text-transform: uppercase; letter-spacing: 0.05em; }

.architecture-section, .phases-section { margin-bottom: 28px; }
.architecture-section h3, .phases-section h3 { font-size: 16px; font-weight: 600; color: var(--text-dim); margin-bottom: 12px; text-transform: uppercase; letter-spacing: 0.08em; }

.arch-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 10px; }
.arch-card {
    background: var(--surface); border: 1px solid var(--border); border-radius: 8px;
    padding: 14px; border-left: 3px solid var(--accent);
}
.arch-title { font-weight: 600; font-size: 13px; margin-bottom: 4px; color: var(--accent); }
.arch-items { font-size: 11px; color: var(--text-dim); line-height: 1.6; }

.phase-list { display: flex; flex-direction: column; gap: 2px; }
.phase-item {
    display: grid; grid-template-columns: 40px 180px 1fr; gap: 12px; align-items: center;
    padding: 8px 12px; border-radius: 6px; font-size: 12px;
    background: var(--surface); border-left: 3px solid var(--success);
}
.phase-num { font-weight: 700; color: var(--accent); text-align: center; }
.phase-name { font-weight: 600; }
.phase-detail { color: var(--text-dim); }

/* Ingest */
.table-list { margin-top: 12px; }
.table-item {
    display: flex; justify-content: space-between; align-items: center;
    padding: 8px 12px; border-bottom: 1px solid var(--border); font-size: 13px;
}
.table-item:hover { background: var(--accent-glow); }

/* Phase 19 — Playbook panel */
.boosted-row { background: rgba(120, 200, 120, 0.10); }
.boosted-row td { border-top: 1px solid rgba(120, 200, 120, 0.30); }
.mono-cell {
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: 11px; color: var(--text-dim);
    max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.panel-section + .panel-section { margin-top: 18px; }
