:root {
    --bg: #081120;
    --bg-2: #0d1728;
    --panel: rgba(15, 23, 42, 0.78);
    --panel-strong: rgba(17, 24, 39, 0.92);
    --panel-soft: rgba(255, 255, 255, 0.04);
    --border: rgba(255, 255, 255, 0.08);
    --text: #f8fafc;
    --muted: #94a3b8;
    --accent: #38bdf8;
    --accent-2: #6366f1;
    --danger: #ef4444;
    --danger-soft: rgba(239, 68, 68, 0.14);
    --success: #22c55e;
    --success-soft: rgba(34, 197, 94, 0.14);
    --warning: #f59e0b;
    --warning-soft: rgba(245, 158, 11, 0.14);
    --info: #60a5fa;
    --info-soft: rgba(96, 165, 250, 0.14);
    --shadow: 0 20px 60px rgba(0, 0, 0, 0.35);
    --radius-xl: 24px;
    --radius-lg: 18px;
    --radius-md: 14px;
    --max-width: 1380px;
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
    margin: 0;
    font-family: Inter, "Segoe UI", Arial, sans-serif;
    color: var(--text);
    min-height: 100vh;
    background:
        radial-gradient(circle at top left, rgba(56, 189, 248, 0.12), transparent 28%),
        radial-gradient(circle at 85% 15%, rgba(99, 102, 241, 0.14), transparent 24%),
        linear-gradient(180deg, var(--bg), var(--bg-2));
    overflow-x: hidden;
}
a { color: inherit; text-decoration: none; }
button, input, select { font: inherit; }
.bg-blur {
    position: fixed; border-radius: 50%; filter: blur(90px); opacity: 0.35; pointer-events: none; z-index: 0;
}
.bg-blur-1 { width: 280px; height: 280px; background: var(--accent); top: 90px; left: -80px; }
.bg-blur-2 { width: 320px; height: 320px; background: var(--accent-2); bottom: 60px; right: -100px; }
.site-shell { position: relative; z-index: 1; min-height: 100vh; }
.page-shell { max-width: var(--max-width); margin: 0 auto; padding: 24px; }
.page-shell-wide { max-width: 1800px; margin: 0 auto; padding: 24px; }
.header {
    position: sticky; top: 0; z-index: 20; backdrop-filter: blur(14px);
    background: rgba(8, 17, 32, 0.55); border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}
.header-content {
    max-width: var(--max-width); margin: 0 auto; padding: 18px 24px;
    display: flex; gap: 18px; justify-content: space-between; align-items: center;
}
.brand-wrap { display: flex; flex-direction: column; gap: 4px; }
.brand-title { font-size: 1.2rem; font-weight: 800; letter-spacing: -0.02em; }
.brand-subtitle { color: var(--muted); font-size: 0.95rem; }
.top-nav { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.btn, .btn-secondary, .btn-danger, .btn-ghost, .btn-small, .btn-icon {
    border: 1px solid transparent; cursor: pointer;
    transition: transform .2s ease, box-shadow .2s ease, border-color .2s ease, background .2s ease;
}
.btn:hover, .btn-secondary:hover, .btn-danger:hover, .btn-ghost:hover, .btn-small:hover, .btn-icon:hover { transform: translateY(-2px); }
.btn, .btn-secondary, .btn-danger, .btn-ghost, .btn-small {
    display: inline-flex; align-items: center; justify-content: center;
    min-height: 46px; padding: 0 18px; border-radius: 14px; font-weight: 700;
}
.btn-small { min-height: 36px; padding: 0 14px; border-radius: 12px; font-size: .92rem; }
.btn { color: #fff; background: linear-gradient(135deg, var(--accent), #2563eb); box-shadow: 0 12px 28px rgba(37, 99, 235, 0.28); }
.btn:disabled { opacity: .7; cursor: wait; transform: none; }
.btn-secondary { color: var(--text); background: rgba(255,255,255,.05); border-color: var(--border); }
.btn-danger { color: #fff; background: linear-gradient(135deg, #ef4444, #b91c1c); box-shadow: 0 12px 28px rgba(185, 28, 28, 0.24); }
.btn-ghost { color: var(--muted); background: transparent; border-color: var(--border); }
.btn-icon {
    width: 36px; height: 36px; border-radius: 10px; background: rgba(255,255,255,.06);
    border-color: var(--border); color: var(--text); display: inline-flex; align-items: center; justify-content: center;
}
.btn-icon-danger { background: var(--danger-soft); color: #fecaca; border-color: rgba(239,68,68,.24); }
.page-topbar {
    display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; margin-bottom: 24px; flex-wrap: wrap;
}
.page-title { font-size: clamp(2rem, 4vw, 2.8rem); line-height: 1.02; font-weight: 800; letter-spacing: -0.04em; margin: 0 0 10px; }
.page-meta { color: var(--muted); font-size: .98rem; line-height: 1.7; }
.page-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.card, .panel, .hero-card, .glass-card {
    background: linear-gradient(180deg, rgba(17, 24, 39, 0.88), rgba(15, 23, 42, 0.94));
    border: 1px solid var(--border); border-radius: var(--radius-xl); box-shadow: var(--shadow);
}
.card, .glass-card { padding: 24px; }
.panel { overflow: hidden; display: flex; flex-direction: column; min-height: 0; }
.panel-header { padding: 18px 20px 14px; border-bottom: 1px solid var(--border); background: rgba(255,255,255,.02); }
.panel-header h2, .card h2, .card h3, .panel h3, .panel h4 { margin: 0 0 12px; letter-spacing: -0.02em; }
.panel-body { padding: 20px; }
.panel-scroll { padding: 20px; overflow: auto; min-height: 0; }
.section { margin-bottom: 22px; padding-bottom: 20px; border-bottom: 1px solid var(--border); }
.section:last-child { margin-bottom: 0; padding-bottom: 0; border-bottom: none; }
.muted { color: var(--muted); }
.section-kicker {
    color: var(--accent); text-transform: uppercase; letter-spacing: 0.12em; font-size: 0.82rem; font-weight: 800; margin-bottom: 10px;
}
.flash-list { display: flex; flex-direction: column; gap: 12px; margin-bottom: 20px; }
.flash { padding: 14px 16px; border-radius: 14px; border: 1px solid var(--border); backdrop-filter: blur(12px); }
.flash.success { background: var(--success-soft); color: #dcfce7; border-color: rgba(34,197,94,.22); }
.flash.danger { background: var(--danger-soft); color: #fecaca; border-color: rgba(239,68,68,.22); }
.flash.warning { background: var(--warning-soft); color: #fde68a; border-color: rgba(245,158,11,.22); }
.flash.info { background: var(--info-soft); color: #dbeafe; border-color: rgba(96,165,250,.22); }
.empty-state, .error-box, .info-box { padding: 16px; border-radius: 16px; border: 1px solid var(--border); }
.empty-state { background: rgba(255,255,255,.04); color: var(--muted); }
.error-box { background: var(--danger-soft); color: #fecaca; border-color: rgba(239,68,68,.24); }
.info-box { background: rgba(56,189,248,.08); color: #dbeafe; border-color: rgba(56,189,248,.2); }
.form-grid, .form-stack { display: grid; gap: 14px; }
.inline-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.inline-grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 12px; }
label { display: block; margin-bottom: 7px; font-size: .95rem; font-weight: 700; }
input[type="text"], input[type="password"], input[type="number"], input[type="file"], select, textarea {
    width: 100%; min-height: 46px; padding: 12px 14px; border-radius: 14px;
    border: 1px solid rgba(255,255,255,.09); background: rgba(255,255,255,.05); color: var(--text); outline: none;
}
input::placeholder, textarea::placeholder { color: #7c8ba1; }
select option { background: #0f172a; color: var(--text); }
.table-wrap { overflow: auto; border-radius: 18px; border: 1px solid var(--border); background: rgba(255,255,255,.03); }
table { width: 100%; border-collapse: collapse; min-width: 760px; }
th, td { padding: 12px 14px; border-bottom: 1px solid var(--border); text-align: left; vertical-align: top; font-size: .92rem; }
th { position: sticky; top: 0; z-index: 1; background: rgba(8,17,32,.92); backdrop-filter: blur(8px); }
tr:hover td { background: rgba(255,255,255,.025); }
.kpi-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.kpi-card { padding: 16px; border-radius: 18px; border: 1px solid var(--border); background: rgba(255,255,255,.04); }
.kpi-label { margin: 0 0 8px; font-size: .82rem; color: var(--muted); }
.kpi-value { margin: 0; font-size: 1.6rem; font-weight: 800; letter-spacing: -0.03em; }
.dataset-list, .steps-list, .ai-list, .stack-list { list-style: none; margin: 0; padding: 0; }
.stack-list { display: grid; gap: 14px; }
.dataset-item, .step-card, .list-card, .chart-block { border: 1px solid var(--border); border-radius: 18px; background: rgba(255,255,255,.04); }
.dataset-item, .step-card, .list-card { padding: 16px; }
.chart-block { padding: 14px; overflow: hidden; }
.chart-list { display: grid; gap: 18px; }
.dataset-row, .split-row, .row-between { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; flex-wrap: wrap; }
.dataset-actions, .step-actions, .action-row { display: flex; gap: 10px; flex-wrap: wrap; }
.checkbox-list {
    max-height: 180px; overflow: auto; border: 1px solid var(--border); border-radius: 16px; padding: 12px; margin-bottom: 12px; background: rgba(255,255,255,.03);
}
.checkbox-item { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.checkbox-item:last-child { margin-bottom: 0; }
.checkbox-item label { margin: 0; font-weight: 500; }
.checkbox-item input { margin: 0; width: auto; min-height: auto; }
.auth-shell { min-height: calc(100vh - 90px); display: flex; align-items: center; justify-content: center; padding: 24px; }
.auth-card { width: 100%; max-width: 460px; padding: 28px; }
.auth-card h1 { margin: 0 0 10px; font-size: 2rem; letter-spacing: -0.03em; }
.auth-card p { margin: 0 0 22px; color: var(--muted); }
.hero-panel { padding: 36px; margin-bottom: 24px; }
.hero-panel h1 { font-size: clamp(2.4rem, 5vw, 4rem); line-height: 1.02; font-weight: 800; letter-spacing: -0.04em; margin: 0 0 18px; }
.hero-panel h1 span {
    display: block; background: linear-gradient(90deg, #67e8f9, #60a5fa, #818cf8);
    -webkit-background-clip: text; background-clip: text; color: transparent;
}
.hero-text { max-width: 900px; color: var(--muted); font-size: 1.05rem; line-height: 1.8; }
.summary-grid { display: grid; grid-template-columns: 360px 1fr; gap: 18px; align-items: start; }
.bottom-layout { display: grid; grid-template-columns: 340px 1fr 340px; gap: 20px; align-items: start; }
.preview-layout { min-height: calc(100vh - 170px); display: grid; grid-template-columns: 360px 1fr 320px; gap: 20px; }
.loading-inline {
    display: none; align-items: center; gap: 10px; margin-top: 12px; padding: 12px 14px; border-radius: 14px;
    background: rgba(56,189,248,.08); color: #dbeafe; border: 1px solid rgba(56,189,248,.18); font-weight: 700;
}
.spinner { width: 18px; height: 18px; border: 2px solid rgba(56, 189, 248, 0.2); border-top-color: var(--accent); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.footer {
    padding: 30px 24px 40px; text-align: center; color: var(--muted);
    border-top: 1px solid rgba(255,255,255,.04); margin-top: 40px;
}
@media (max-width: 1280px) {
    .bottom-layout { grid-template-columns: 320px 1fr; }
    .ai-panel { grid-column: 1 / -1; }
    .preview-layout { grid-template-columns: 1fr; min-height: auto; }
}
@media (max-width: 1100px) { .summary-grid { grid-template-columns: 1fr; } }
@media (max-width: 900px) { .inline-grid-2, .inline-grid-3, .kpi-grid { grid-template-columns: 1fr; } }
@media (max-width: 720px) {
    .header-content { flex-direction: column; align-items: flex-start; }
    .page-shell, .page-shell-wide { padding: 16px; }
    .page-title { font-size: 2rem; }
    .hero-panel { padding: 24px; }
    .hero-panel h1 { font-size: 2.2rem; }
}
.brand-logo {
    height: 62px;
    width: auto;
    max-width: 160px;
    border-radius: 18px;
    display: block;
    box-shadow: 0 16px 40px rgba(56, 189, 248, 0.18);
}
@media (max-width: 720px) {
    .brand-logo {
        height: 36px;
        max-width: 100px;
    }
}
.header-left {
    display: flex;
    align-items: center;
    gap: 10px;
}