:root {
  color-scheme: light;
  --red: #dc2626;
  --green: #166534;
  --ink: #172033;
  --muted: #64748b;
  --line: #d8dee8;
  --panel: #ffffff;
  --soft: #f6f8fb;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--soft);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.shell {
  display: grid;
  grid-template-columns: 320px minmax(0, 1fr);
  min-height: 100vh;
}

.controls {
  background: #fff;
  border-right: 1px solid var(--line);
  padding: 24px;
}

.controls h2 {
  margin: 0 0 20px;
  font-size: 18px;
}

.controls label {
  display: grid;
  gap: 8px;
  margin-bottom: 18px;
  color: #334155;
  font-size: 14px;
}

.controls input[type="range"] {
  width: 100%;
}

.controls output {
  color: var(--ink);
  font-weight: 700;
}

.workspace {
  padding: 28px;
}

.app-header {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 22px;
}

h1 {
  margin: 0;
  font-size: clamp(28px, 4vw, 42px);
  line-height: 1.05;
}

.app-header p {
  margin: 8px 0 0;
  color: var(--muted);
}

.uploads {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}

.upload-box {
  display: grid;
  gap: 12px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 18px;
}

.upload-box strong {
  font-size: 16px;
}

.upload-box input {
  width: 100%;
  border: 1px dashed #94a3b8;
  border-radius: 8px;
  padding: 16px;
  background: #f8fafc;
}

.demo-toggle {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 18px 0 8px;
  font-weight: 600;
}

.note,
.message {
  border-left: 4px solid #2563eb;
  background: #eff6ff;
  padding: 12px 14px;
  margin: 10px 0 18px;
}

.actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin: 18px 0;
}

button {
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  padding: 12px 16px;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

button.primary {
  background: var(--green);
  border-color: var(--green);
  color: #fff;
}

button:hover {
  filter: brightness(0.98);
}

.source-badge {
  display: inline-block;
  margin: 4px 0 18px;
  border-radius: 999px;
  padding: 8px 12px;
  background: #ecfdf5;
  color: var(--green);
  font-weight: 800;
}

.metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}

.metrics div {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
}

.metrics span {
  display: block;
  font-size: 24px;
  font-weight: 800;
}

.metrics small {
  color: var(--muted);
}

.chart-wrap {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  overflow-x: auto;
}

#chart {
  width: 100%;
  min-width: 760px;
  height: 380px;
}

.event-title {
  color: var(--red);
  margin: 24px 0 8px;
}

.event-summary {
  border-left: 4px solid var(--red);
  background: #fff7f7;
  padding: 12px 14px;
  margin-bottom: 14px;
}

.event-summary strong,
.events-table-start {
  color: var(--red);
  font-weight: 800;
}

.table-wrap {
  overflow-x: auto;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 920px;
}

th,
td {
  border-bottom: 1px solid var(--line);
  padding: 10px 12px;
  text-align: left;
  white-space: nowrap;
  font-size: 14px;
}

th {
  background: #f8fafc;
  font-weight: 800;
}

#exportButton {
  margin-top: 14px;
}

.hidden {
  display: none;
}

@media (max-width: 920px) {
  .shell {
    grid-template-columns: 1fr;
  }

  .controls {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .uploads,
  .actions,
  .metrics {
    grid-template-columns: 1fr;
  }

  .workspace {
    padding: 18px;
  }
}

