:root {
    --bg: #0b1020; --card: #141a2e; --ink: #e9eefb; --muted: #a9b4d0;
    --brand: #5db0ff; --border: #2a3558; --accent: #2dd4bf; --bad: #ef4444;
}
body { background: var(--bg); color: var(--ink); font-family: 'Segoe UI', system-ui, sans-serif; margin: 0; display: flex; flex-direction: column; min-height: 100vh; }
.wrap { max-width: 1320px; margin: 0 auto; padding: 20px; width: 100%; box-sizing: border-box; }
.wrap-container { margin: 0 auto; padding: 20px; width: 100%; box-sizing: border-box; }

/* Header & Inputs */
header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; flex-wrap: wrap; gap: 15px; }
h1 { margin: 0; font-size: 1.5rem; color: var(--brand); letter-spacing: -0.5px; }

.drop-zone {
    border: 2px dashed var(--border); border-radius: 8px; padding: 20px;
    text-align: center; transition: all 0.2s; background: rgba(255,255,255,0.02);
    flex: 1; min-width: 250px; cursor: pointer; position: relative;
}
.drop-zone:hover, .drop-zone.dragover { border-color: var(--brand); background: rgba(93, 176, 255, 0.05); }
.drop-zone p { margin: 0 0 8px; color: var(--muted); font-size: 0.9rem; }
.drop-zone input { opacity: 0; position: absolute; top: 0; left: 0; width: 100%; height: 100%; cursor: pointer; }
.file-status { font-size: 0.8rem; color: var(--accent); font-weight: 600; display: block; min-height: 1.2em; }

button {
    background: var(--brand); color: #000; border: none; padding: 10px 24px;
    border-radius: 6px; font-weight: 700; cursor: pointer; transition: opacity 0.2s;
    font-size: 0.9rem;
}
button:disabled { background: var(--border); color: var(--muted); cursor: not-allowed; }
button:hover:not(:disabled) { opacity: 0.9; }

/* Dashboard Grid */
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 20px; margin-bottom: 24px; }
.card { background: var(--card); border: 1px solid var(--border); border-radius: 8px; padding: 16px; display: flex; flex-direction: column; }
.card h3 { margin: 0 0 12px; font-size: 1rem; color: var(--muted); font-weight: 500; display: flex; justify-content: space-between; }
.stat-val { font-size: 1.8rem; font-weight: 700; color: var(--ink); }
.chart-box { height: 250px; position: relative; width: 100%; }

/* Analytics Section */
.analytics-row { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin-bottom: 24px; }
.list-group { list-style: none; padding: 0; margin: 0; overflow-y: auto; max-height: 200px; }
.list-group li { display: flex; justify-content: space-between; padding: 8px 0; border-bottom: 1px solid var(--border); font-size: 0.9rem; }
.list-group li:last-child { border-bottom: none; }
.badge { background: var(--border); padding: 2px 8px; border-radius: 4px; font-size: 0.8rem; }

/* Tables Section */
.tabs { display: flex; gap: 4px; margin-bottom: 0; overflow-x: auto; padding-bottom: 8px; }
.tab-btn {
    background: var(--card); border: 1px solid var(--border); color: var(--muted);
    padding: 8px 16px; border-radius: 6px 6px 0 0; cursor: pointer; white-space: nowrap;
    font-size: 0.9rem;
}
.tab-btn.active { background: var(--brand); color: #000; border-color: var(--brand); }

.table-wrap { overflow: auto; height: 500px; background: var(--card); border: 1px solid var(--border); border-radius: 0 4px 4px 4px; }
table { width: 100%; border-collapse: collapse; font-size: 0.85rem; }
th { position: sticky; top: 0; background: #0f1525; color: var(--brand); padding: 10px; text-align: left; z-index: 10; box-shadow: 0 1px 0 var(--border); }
td { padding: 8px 10px; border-bottom: 1px solid var(--border); white-space: nowrap; max-width: 300px; overflow: hidden; text-overflow: ellipsis; }
tr:hover { background: rgba(255,255,255,0.03); }

/* Loading Overlay */
#loader {
    position: fixed; inset: 0; background: rgba(11,16,32,0.9); z-index: 1000;
    display: none; justify-content: center; align-items: center; flex-direction: column;
}
.spinner {
    width: 40px; height: 40px; border: 4px solid var(--border); border-top-color: var(--brand);
    border-radius: 50%; animation: spin 1s linear infinite; margin-bottom: 16px;
}
@keyframes spin { to { transform: rotate(360deg); } }

@media (max-width: 768px) { .analytics-row { grid-template-columns: 1fr; } }
