:root{
    --bg:#f3f6fb;
    --card:#ffffff;
    --text:#182230;
    --muted:#667085;
    --line:#e4e7ec;
    --primary:#2563eb;
    --primary-2:#1d4ed8;
    --soft:#eff6ff;
    --shadow:0 12px 35px rgba(16,24,40,.08);
}

*{box-sizing:border-box}
body{
    margin:0;
    background:var(--bg);
    color:var(--text);
    font-family:Inter,system-ui,-apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif;
}

.topbar{
    min-height:78px;
    padding:14px 28px;
    background:#111827;
    color:white;
    display:flex;
    align-items:center;
    justify-content:space-between;
    gap:20px;
    position:sticky;
    top:0;
    z-index:1020;
    box-shadow:0 8px 25px rgba(17,24,39,.18);
}

.topbar>div:first-child{
    display:flex;
    align-items:center;
    gap:12px;
}

.brand-mark{
    width:44px;height:44px;border-radius:14px;
    display:grid;place-items:center;
    background:linear-gradient(135deg,#3b82f6,#2563eb);
    font-size:20px;
}

.brand-title{font-weight:800;font-size:1.05rem}
.brand-subtitle{font-size:.78rem;color:#cbd5e1}
.back-link{
    width:42px;height:42px;border-radius:13px;
    display:grid;place-items:center;
    color:white;text-decoration:none;
    background:rgba(255,255,255,.1);
}

.page-shell{padding:28px}
.narrow-shell{max-width:980px}

.hero-card{
    background:linear-gradient(135deg,#fff,#f8fbff);
    border:1px solid var(--line);
    border-radius:24px;
    padding:32px;
    display:flex;
    justify-content:space-between;
    align-items:center;
    gap:30px;
    box-shadow:var(--shadow);
}
.hero-card h1{font-size:clamp(1.8rem,3vw,3rem);max-width:840px;margin:7px 0 10px}
.hero-card p{color:var(--muted);max-width:850px;margin:0}
.hero-stat{
    min-width:150px;height:150px;border-radius:26px;
    background:#111827;color:#fff;
    display:flex;flex-direction:column;align-items:center;justify-content:center;
}
.hero-stat span{font-size:3rem;font-weight:900;line-height:1}
.hero-stat small{color:#cbd5e1;margin-top:8px}

.eyebrow{
    font-size:.72rem;
    font-weight:800;
    letter-spacing:.12em;
    color:var(--primary);
}

.section-block{margin-top:30px}
.section-title-row{
    display:flex;align-items:end;justify-content:space-between;gap:16px;margin-bottom:16px
}
.section-title-row h2{margin:3px 0 0;font-size:1.5rem}

.area-grid{
    display:grid;
    grid-template-columns:repeat(auto-fit,minmax(220px,1fr));
    gap:14px;
}
.area-card{
    border:1px solid var(--line);
    background:var(--card);
    border-radius:18px;
    padding:18px;
    display:flex;align-items:center;gap:14px;
    text-align:left;
    transition:.2s ease;
    box-shadow:0 4px 15px rgba(16,24,40,.04);
}
.area-card:hover,.area-card.active{
    border-color:#93c5fd;
    transform:translateY(-2px);
    box-shadow:var(--shadow);
}
.area-card.active{background:var(--soft)}
.area-icon{
    width:48px;height:48px;border-radius:15px;
    background:var(--soft);color:var(--primary);
    display:grid;place-items:center;font-size:20px;
}
.area-content{display:flex;flex-direction:column;flex:1}
.area-content strong{font-size:1rem}
.area-content span{font-size:.8rem;color:var(--muted);margin-top:3px}
.area-arrow{color:#98a2b3}

.search-box{
    min-width:min(360px,100%);
    background:white;border:1px solid var(--line);
    border-radius:14px;padding:0 14px;
    display:flex;align-items:center;gap:10px;
}
.search-box input{
    width:100%;padding:11px 0;border:0;outline:0;background:transparent;
}

.dashboard-grid{
    display:grid;
    grid-template-columns:repeat(auto-fit,minmax(300px,1fr));
    gap:16px;
}
.dashboard-card{
    background:white;border:1px solid var(--line);
    border-radius:20px;padding:20px;
    box-shadow:0 6px 20px rgba(16,24,40,.05);
}
.dash-head{display:flex;justify-content:space-between;align-items:center;margin-bottom:16px}
.dash-icon{
    width:46px;height:46px;border-radius:14px;
    background:#ecfdf3;color:#039855;display:grid;place-items:center;font-size:20px;
}
.dashboard-card h3{font-size:1.15rem;margin:0 0 8px}
.dashboard-card p{color:var(--muted);min-height:44px;font-size:.9rem}
.dash-meta{
    display:flex;flex-wrap:wrap;gap:10px 16px;
    padding:14px 0;border-top:1px solid var(--line);
    color:var(--muted);font-size:.78rem;
}
.dash-meta span{display:flex;align-items:center;gap:6px}
.dash-actions{display:flex;gap:8px;margin-top:4px}

.empty-state{
    background:white;border:1px dashed #cbd5e1;
    border-radius:20px;padding:38px;text-align:center;color:var(--muted)
}
.empty-state>i{font-size:36px;color:#94a3b8;margin-bottom:12px}
.empty-state h3{color:var(--text)}
.big-empty{padding:80px 20px}

.wizard-card{
    margin:20px auto;
    background:white;border:1px solid var(--line);
    border-radius:26px;padding:34px;
    box-shadow:var(--shadow);
}
.wizard-card h1{font-size:2rem;margin:5px 0 6px}
.wizard-card>p{color:var(--muted)}

.upload-zone{
    margin-top:26px;
    border:2px dashed #bfdbfe;
    background:#f8fbff;
    border-radius:22px;
    padding:48px 20px;
    text-align:center;
    transition:.2s;
}
.upload-zone.dragging{border-color:var(--primary);background:#eff6ff;transform:scale(1.01)}
.upload-zone>i{font-size:48px;color:#16a34a;margin-bottom:14px}
.upload-zone h3{margin:0}
.upload-zone p{color:var(--muted);margin:6px 0 18px}

.file-summary{
    margin-top:24px;padding:16px 18px;border:1px solid var(--line);border-radius:16px;
    display:flex;justify-content:space-between;align-items:center;gap:12px;
}
.file-summary div{display:flex;flex-direction:column}
.file-summary span{font-size:.8rem;color:var(--muted)}

.schema-grid{
    display:grid;
    grid-template-columns:repeat(auto-fit,minmax(220px,1fr));
    gap:10px;
}
.schema-chip{
    border:1px solid var(--line);border-radius:14px;padding:12px;
    display:flex;align-items:center;gap:10px;background:#fff;
}
.schema-icon{
    width:38px;height:38px;border-radius:12px;background:#f2f4f7;
    display:grid;place-items:center;font-weight:800;color:#475467
}
.schema-chip div{display:flex;flex-direction:column;min-width:0}
.schema-chip strong{white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.schema-chip small{color:var(--muted);font-size:.72rem}

.dashboard-page{padding-top:24px}
.dashboard-header{
    display:flex;justify-content:space-between;align-items:flex-start;gap:20px;margin-bottom:20px
}
.dashboard-header h1{margin:4px 0;font-size:2rem}
.dashboard-header p{margin:0;color:var(--muted)}
.source-pill{
    background:white;border:1px solid var(--line);border-radius:16px;padding:12px 16px;
    display:flex;align-items:center;gap:12px;min-width:180px;
}
.source-pill i{color:var(--primary)}
.source-pill div{display:flex;flex-direction:column}
.source-pill span{font-size:.78rem;color:var(--muted)}

.dataset-strip{display:flex;gap:10px;overflow:auto;margin-bottom:16px}
.dataset-pill{
    background:white;border:1px solid var(--line);border-radius:14px;padding:10px 14px;
    display:flex;align-items:center;gap:10px;white-space:nowrap
}
.dataset-dot{width:9px;height:9px;border-radius:50%;background:#22c55e}
.dataset-pill div{display:flex;flex-direction:column}
.dataset-pill small{color:var(--muted);font-size:.72rem}

.widget-grid{
    display:grid;
    grid-template-columns:repeat(12,1fr);
    gap:16px;
}
.widget-card{
    grid-column:span 6;
    min-height:390px;
    background:white;border:1px solid var(--line);
    border-radius:20px;padding:18px;
    box-shadow:0 6px 20px rgba(16,24,40,.05);
}
.widget-wide{grid-column:span 12;min-height:350px}
.kpi-widget{grid-column:span 3;min-height:210px}
.widget-titlebar{
    display:flex;justify-content:space-between;align-items:start;gap:12px;margin-bottom:10px
}
.widget-type{font-size:.64rem;letter-spacing:.11em;font-weight:800;color:#98a2b3}
.widget-titlebar h3{font-size:1rem;margin:3px 0 0}
.chart-wrap{height:310px}
.kpi-value{font-size:clamp(2.2rem,4vw,4.2rem);font-weight:900;margin-top:30px}
.kpi-caption{color:var(--muted);font-size:.76rem}
.table-widget{max-height:390px;overflow:auto}
.table-widget th{position:sticky;top:0;background:#f8fafc;z-index:2;white-space:nowrap}
.table-widget td{white-space:nowrap}
.table-note{padding:10px;color:var(--muted);font-size:.8rem;border-top:1px solid var(--line)}

.modal-content{border:0;border-radius:20px;box-shadow:0 20px 60px rgba(0,0,0,.15)}
.form-control,.form-select{border-radius:12px;border-color:#d0d5dd}
.btn{border-radius:12px}
.btn-primary{background:var(--primary);border-color:var(--primary)}
.btn-primary:hover{background:var(--primary-2);border-color:var(--primary-2)}

@media (max-width:900px){
    .topbar{padding:12px 14px;align-items:flex-start;flex-direction:column}
    .dashboard-topbar>div:last-child{width:100%}
    .page-shell{padding:16px}
    .hero-card{padding:22px;align-items:flex-start}
    .hero-stat{display:none}
    .section-title-row{align-items:stretch;flex-direction:column}
    .search-box{min-width:100%}
    .dashboard-header{flex-direction:column}
    .source-pill{width:100%}
    .widget-card,.kpi-widget{grid-column:span 12}
}

@media (max-width:520px){
    .wizard-card{padding:20px}
    .upload-zone{padding:34px 14px}
    .dashboard-grid{grid-template-columns:1fr}
}
