:root {
  --bg: #f6f7f9;
  --panel: #ffffff;
  --panel-subtle: #fafbfc;
  --line: #d7dce3;
  --line-soft: #e7eaf0;
  --text: #20242a;
  --muted: #667085;
  --accent: #4b5563;
  --accent-soft: #f0f2f5;
  --radius: 5px;
  --font: Arial, Helvetica, sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 13px var(--font);
}

button, input, select, textarea {
  font: inherit;
}

h1, h2, p {
  margin: 0;
}

h1 {
  font-size: 17px;
  font-weight: 650;
}

h2 {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin-bottom: 7px;
  font-size: 13px;
  font-weight: 650;
}

p {
  margin-top: 5px;
  color: var(--muted);
}

a {
  color: #344054;
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

.login-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 18px;
}

.login-layout {
  width: min(390px, 100%);
}

.login-panel {
  padding: 18px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.product-mark {
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  margin-bottom: 14px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: var(--panel-subtle);
  color: var(--text);
  font-weight: 700;
}

.login-panel h1 {
  font-size: 21px;
  line-height: 1.2;
}

.login-panel p {
  font-size: 13px;
  line-height: 1.42;
}

.developer-line {
  color: var(--text);
  font-weight: 600;
}

.login-actions {
  margin-top: 16px;
}

.login-note {
  margin-top: 10px;
  font-size: 12px;
}

.primary, button {
  min-height: 29px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #ffffff;
  color: var(--text);
  text-decoration: none;
  cursor: pointer;
  white-space: nowrap;
}

.primary {
  border-color: #c9ced6;
  color: var(--text);
}

.primary:hover, button:hover {
  background: var(--panel-subtle);
  text-decoration: none;
}

.primary.secondary, button.secondary {
  border-color: var(--line);
  color: var(--text);
}

.topbar {
  height: 52px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 7px 12px;
  background: #ffffff;
  border-bottom: 1px solid var(--line);
}

.topbar p {
  margin-top: 2px;
  font-size: 12px;
}

.topbar nav {
  display: flex;
  gap: 10px;
  align-items: center;
  color: var(--muted);
}

.workspace {
  min-height: calc(100vh - 52px);
  display: grid;
  grid-template-columns: 270px minmax(0, 1fr);
}

.sidebar {
  padding: 7px;
  border-right: 1px solid var(--line);
  background: var(--panel-subtle);
  overflow: auto;
}

.content, .admin-page {
  padding: 7px;
  overflow: auto;
}

.panel {
  margin-bottom: 7px;
  padding: 7px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

label {
  display: grid;
  gap: 4px;
  margin-bottom: 7px;
  color: var(--muted);
  font-size: 12px;
}

input, select, textarea {
  width: 100%;
  min-height: 29px;
  padding: 4px 7px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: #ffffff;
  color: var(--text);
}

input:focus, select:focus, textarea:focus {
  outline: 2px solid var(--accent-soft);
  border-color: #aeb5c0;
}

textarea {
  resize: vertical;
}

.grid-2, .grid-3 {
  display: grid;
  gap: 7px;
}

.grid-2 {
  grid-template-columns: 1fr 1fr;
}

.grid-3 {
  grid-template-columns: 140px 1fr 1fr;
}

.list {
  display: grid;
  gap: 4px;
  max-height: 360px;
  overflow: auto;
}

.experiment-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 22px;
  gap: 3px;
}

.list button {
  width: 100%;
  justify-content: flex-start;
  min-height: 34px;
  color: var(--text);
}

.list button[data-id] {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 6px;
  align-items: center;
}

.list button[data-id] span,
.list button[data-id] small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.list button[data-id] small {
  color: var(--muted);
  font-size: 11px;
}

.delete-experiment {
  width: 22px;
  min-width: 22px;
  min-height: 34px;
  padding: 0;
  border-color: transparent;
  background: transparent;
  color: #9b1c1c;
  font-size: 14px;
  line-height: 1;
  align-items: center;
  justify-content: center;
  text-transform: lowercase;
}

.delete-experiment:hover {
  border-color: #efcaca;
  background: #fff6f6;
  color: #7f1d1d;
}

.tabs {
  display: flex;
  gap: 2px;
  margin-bottom: 7px;
  border-bottom: 1px solid var(--line);
}

.tabs button {
  min-height: 30px;
  gap: 4px;
  border: 0;
  border-bottom: 2px solid transparent;
  border-radius: 0;
  background: transparent;
  color: var(--muted);
}

.tabs button.active {
  border-bottom-color: #667085;
  color: var(--text);
}

.tab {
  display: none;
}

.tab.active {
  display: block;
}

.hidden {
  display: none;
}

.kpis {
  display: grid;
  grid-template-columns: repeat(4, minmax(120px, 1fr));
  gap: 7px;
  margin-bottom: 7px;
}

.kpis div {
  padding: 7px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.kpis span {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.kpis strong {
  display: block;
  margin-top: 2px;
  font-size: 15px;
  font-weight: 650;
}

.controls {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 7px;
}

.table-wrap {
  max-height: 380px;
  overflow: auto;
  border: 1px solid var(--line-soft);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}

th, td {
  padding: 4px 6px;
  border-bottom: 1px solid var(--line-soft);
  border-right: 1px solid var(--line-soft);
  white-space: nowrap;
  text-align: left;
}

th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #f8f9fb;
  color: #3f4752;
  font-weight: 650;
}

th .info-button {
  margin-left: 2px;
}

.info-button {
  width: auto;
  height: auto;
  min-height: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: #98a2b3;
  font-size: 9px;
  line-height: 1;
  vertical-align: sub;
  cursor: help;
}

.info-button:hover {
  background: transparent;
  color: var(--muted);
}

.help-tooltip {
  position: fixed;
  z-index: 50;
  display: none;
  max-width: 290px;
  padding: 7px 8px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: #ffffff;
  color: var(--text);
  font-size: 12px;
  line-height: 1.35;
}

.help-tooltip.visible {
  display: block;
}

.chart-tooltip {
  position: fixed;
  z-index: 60;
  display: none;
  max-width: 250px;
  padding: 7px 8px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: #ffffff;
  color: var(--text);
  font-size: 12px;
  line-height: 1.35;
  white-space: pre-line;
}

.chart-tooltip.visible {
  display: block;
}

td.num, th.num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

td button {
  margin-right: 3px;
  margin-bottom: 3px;
}

.chart-mount {
  min-height: 330px;
  border: 1px solid var(--line-soft);
  background: #ffffff;
  overflow: auto;
}

.chart-tools {
  display: flex;
  gap: 3px;
  justify-content: flex-end;
  margin: -26px 0 5px;
}

.chart-tools button {
  min-height: 23px;
  padding: 0 7px;
  font-size: 12px;
}

svg {
  width: 100%;
  height: 330px;
  display: block;
}

.chart-label {
  fill: var(--muted);
  font-size: 11px;
}

.grid-line {
  stroke: #edf0f4;
}

.axis-line {
  stroke: #b5beca;
}

.series-line {
  fill: none;
  stroke: #475467;
  stroke-width: 1.8;
}

.point {
  fill: #ffffff;
  stroke: #475467;
  stroke-width: 1.8;
}

.bar {
  fill: #667085;
}

.error-bar {
  stroke: #3f4752;
  stroke-width: 1.2;
}

.findings {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 7px;
}

.finding {
  padding: 7px;
  border: 1px solid var(--line-soft);
  border-radius: 4px;
  background: #ffffff;
}

.finding strong {
  display: block;
  margin-bottom: 4px;
}

.section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.section-title h2 {
  margin-bottom: 0;
}

.image-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 7px;
  margin-top: 7px;
}

.image-list img {
  width: 100%;
  max-height: 140px;
  object-fit: cover;
  border: 1px solid var(--line-soft);
  margin-bottom: 6px;
}

pre {
  max-height: 360px;
  overflow: auto;
  padding: 7px;
  border: 1px solid var(--line-soft);
  background: #f8f9fb;
  white-space: pre-wrap;
}

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

  .controls, .grid-3, .kpis {
    grid-template-columns: 1fr;
  }
}
