:root {
  color-scheme: light;
  --ink: #17212b;
  --muted: #687386;
  --line: #d9e0e8;
  --panel: #ffffff;
  --paper: #f4f7f9;
  --accent: #126b75;
  --leading: #28a266;
  --weakening: #d5a01f;
  --lagging: #d9534f;
  --improving: #2f7fd2;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--paper);
  color: var(--ink);
  font-family: Inter, "Segoe UI", Arial, sans-serif;
}

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

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

.controls,
.workspace {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.controls {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 18px;
}

.brand {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 12px;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: 24px;
  letter-spacing: 0;
}

h2 {
  font-size: 22px;
  letter-spacing: 0;
}

#status {
  color: var(--muted);
  font-size: 12px;
  line-height: 20px;
  text-align: right;
}

label {
  display: grid;
  gap: 7px;
  color: #394656;
  font-size: 13px;
  font-weight: 700;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid #c9d2dd;
  border-radius: 6px;
  padding: 10px 11px;
  background: #fff;
  color: var(--ink);
  outline: none;
}

textarea {
  min-height: 116px;
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(18, 107, 117, 0.14);
}

.grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

#run {
  border: 0;
  border-radius: 6px;
  padding: 12px 14px;
  background: var(--accent);
  color: white;
  font-weight: 800;
  cursor: pointer;
}

#run:disabled {
  cursor: wait;
  opacity: 0.65;
}

.templates {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
}

.templates button {
  border: 1px solid #c9d2dd;
  border-radius: 6px;
  padding: 9px 10px;
  background: #fff;
  color: #273544;
  cursor: pointer;
  text-align: left;
}

.note {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.workspace {
  display: grid;
  grid-template-rows: auto minmax(360px, 1fr) auto;
  min-width: 0;
  overflow: hidden;
}

.chart-head {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 20px;
  padding: 18px 20px 10px;
}

#chartMeta {
  color: var(--muted);
  margin-top: 5px;
  font-size: 13px;
}

.legend {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 9px 14px;
  color: #394656;
  font-size: 12px;
}

.legend span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.legend i {
  width: 10px;
  height: 10px;
  border-radius: 50%;
}

.leading {
  background: var(--leading);
}

.weakening {
  background: var(--weakening);
}

.lagging {
  background: var(--lagging);
}

.improving {
  background: var(--improving);
}

.chart-wrap {
  min-height: 0;
  padding: 8px 14px 4px;
}

#rrg {
  width: 100%;
  height: 100%;
  min-height: 430px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfd;
}

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

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

th,
td {
  padding: 10px 14px;
  border-bottom: 1px solid #edf1f5;
  text-align: left;
  white-space: nowrap;
}

th {
  position: sticky;
  top: 0;
  background: #f8fafb;
  color: #455365;
  font-size: 12px;
}

.empty {
  fill: var(--muted);
  font-size: 18px;
  text-anchor: middle;
}

.axis-label {
  fill: #596678;
  font-size: 13px;
  font-weight: 700;
}

.quadrant-label {
  fill: rgba(23, 33, 43, 0.35);
  font-size: 18px;
  font-weight: 800;
}

.symbol-label {
  fill: #182533;
  font-size: 13px;
  font-weight: 800;
  paint-order: stroke;
  stroke: #fff;
  stroke-width: 4px;
}

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

  .chart-head {
    display: grid;
  }

  .legend {
    justify-content: flex-start;
  }
}
