:root {
  --bg: #0f1724;
  --card: #0f172833;
  --glass: rgba(255, 255, 255, 0.03);
  --accent1: linear-gradient(135deg, #7b61ff, #22c1c3);
  --accent2: linear-gradient(135deg, #ff7ab6, #ffb86b);
  --muted: #9aa4b2;
  --radius: 18px;
  --shadow: 0 8px 30px rgba(2, 6, 23, 0.6);
  font-family: "Poppins", system-ui, Arial;
}

/* Light theme overrides (applied via body.light) */
.light {
  --bg: #f6f8fb;
  --card: rgba(255, 255, 255, 0.9);
  --glass: rgba(0, 0, 0, 0.04);
  --muted: #51606a;
}
* {
  box-sizing: border-box;
}
html,
body,
#app {
  height: 100%;
}
body {
  margin: 0;
  background: radial-gradient(
      1200px 600px at 10% 10%,
      rgba(123, 97, 255, 0.08),
      transparent
    ),
    radial-gradient(
      900px 400px at 90% 90%,
      rgba(34, 193, 195, 0.06),
      transparent
    ),
    var(--bg);
  color: #e6eef6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
.app {
  display: grid;
  grid-template-columns: 300px 1fr;
  min-height: 100vh;
}
.sidebar {
  padding: 28px;
  background: transparent;
}
.brand {
  font-weight: 700;
  font-size: 20px;
  margin-bottom: 18px;
}
.card {
  background: linear-gradient(
    180deg,
    rgba(255, 255, 255, 0.02),
    rgba(255, 255, 255, 0.01)
  );
  border-radius: var(--radius);
  padding: 18px;
  margin-bottom: 18px;
  box-shadow: var(--shadow);
}
.glass {
  backdrop-filter: blur(6px);
  border: 1px solid rgba(255, 255, 255, 0.04);
}
.controls input[type="file"] {
  width: 100%;
  margin-bottom: 8px;
}
.btn {
  display: inline-block;
  padding: 8px 12px;
  border-radius: 10px;
  border: none;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  margin: 6px 4px;
}
.btn.primary {
  background: var(--accent1);
  color: #fff;
  font-weight: 600;
}
.small {
  padding: 12px;
}
.switch {
  display: inline-block;
}
.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 18px;
}
.kpis {
  display: flex;
  gap: 18px;
  padding: 0 18px;
}
.kpi {
  flex: 1;
  text-align: left;
}
.kpi h5 {
  margin: 0;
  color: var(--muted);
}
.kpiVal {
  font-size: 24px;
  font-weight: 700;
  margin-top: 6px;
}
.charts {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 18px;
  padding: 18px;
}
.chartCard {
  min-height: 220px;
}
.tableCard {
  padding: 12px;
}
.tableWrap {
  max-height: 260px;
  overflow: auto;
}
table {
  width: 100%;
  border-collapse: collapse;
  color: #dfe9f3;
}
th,
td {
  padding: 8px;
  text-align: left;
  border-bottom: 1px solid rgba(255, 255, 255, 0.03);
}
.results {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 18px;
  padding: 18px;
}
.insights {
  min-height: 200px;
}

/* responsive */
@media (max-width: 900px) {
  .app {
    grid-template-columns: 1fr;
  }
  .sidebar {
    order: 2;
  }
  .main {
    order: 1;
  }
  .charts {
    grid-template-columns: 1fr;
  }
  .results {
    grid-template-columns: 1fr;
  }
}

/* small UI niceties */
.separator {
  height: 1px;
  background: rgba(255, 255, 255, 0.03);
  margin: 8px 0;
}
.btn:active {
  transform: translateY(1px);
}
.kpi .kpiVal {
  background: linear-gradient(90deg, #7b61ff, #22c1c3);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.controls select,
input[type="range"] {
  width: 100%;
  margin: 6px 0;
}

/* toasts */
.toasts {
  position: relative;
}
.toast {
  background: rgba(0, 0, 0, 0.5);
  padding: 8px 12px;
  border-radius: 10px;
  margin: 6px 0;
  color: #fff;
}

/* small helper */
.btn[disabled] {
  opacity: 0.45;
  cursor: not-allowed;
}

/* styled upload box */
.uploadBox {
  display: inline-block;
  position: relative;
  width: 160px;
  height: 140px;
  border: 2px dashed rgba(255, 255, 255, 0.08);
  border-radius: 16px;
  cursor: pointer;
  overflow: hidden;
  transition: transform 0.18s ease, border-color 0.18s ease,
    background 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(
    180deg,
    rgba(255, 255, 255, 0.012),
    rgba(255, 255, 255, 0.008)
  );
}
.uploadBox:hover {
  transform: translateY(-6px);
  border-color: rgba(123, 97, 255, 0.35);
  box-shadow: 0 8px 30px rgba(11, 15, 30, 0.45);
}
.uploadBox input[type="file"] {
  position: absolute;
  left: 0;
  top: 0;
  opacity: 0;
  width: 100%;
  height: 100%;
  cursor: pointer;
}
.uploadContent {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  padding: 10px;
}
.uploadIcon {
  font-size: 28px;
}
.uploadText {
  font-weight: 700;
}
.uploadHint {
  font-size: 12px;
  opacity: 0.8;
}

/* floating theme toggle */
.floatingToggle {
  position: fixed;
  right: 22px;
  top: 22px;
  padding: 10px;
  border-radius: 14px;
  z-index: 1200;
  box-shadow: 0 10px 30px rgba(2, 6, 23, 0.5);
  background: linear-gradient(
    180deg,
    rgba(255, 255, 255, 0.02),
    rgba(255, 255, 255, 0.01)
  );
}
.floatingToggle .switch {
  display: block;
}

/* switch slider style (simple) */
.switch {
  position: relative;
  display: inline-block;
  width: 48px;
  height: 28px;
}
.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}
.slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(255, 255, 255, 0.06);
  transition: 0.2s;
  border-radius: 28px;
}
.slider:before {
  position: absolute;
  content: "";
  height: 22px;
  width: 22px;
  left: 3px;
  top: 3px;
  background: white;
  border-radius: 50%;
  transition: 0.2s;
}
.switch input:checked + .slider {
  background: linear-gradient(90deg, #7b61ff, #22c1c3);
}
.switch input:checked + .slider:before {
  transform: translateX(20px);
}

/* modern model select */
.modelSelect {
  appearance: none;
  -webkit-appearance: none;
  padding: 10px 14px;
  border-radius: 12px;
  background: linear-gradient(
    90deg,
    rgba(123, 97, 255, 0.12),
    rgba(34, 193, 195, 0.06)
  );
  border: 1px solid rgba(255, 255, 255, 0.04);
  color: var(--muted);
  font-weight: 600;
  box-shadow: 0 6px 18px rgba(2, 6, 23, 0.45);
  width: 100%;
}
.modelSelect:focus {
  outline: none;
  box-shadow: 0 8px 28px rgba(123, 97, 255, 0.12);
}
.modelSelect option {
  color: #0b1720;
}
