:root {
  --bg: #f5f7f8;
  --surface: #ffffff;
  --surface-soft: #f9fbfb;
  --line: #d8e0df;
  --text: #13201f;
  --muted: #63706e;
  --accent: #1e675f;
  --accent-dark: #155149;
  --success: #167648;
  --danger: #a93434;
  --warn: #966312;
  --neutral: #53615f;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: Cambria, "Book Antiqua", "Palatino Linotype", Palatino, serif;
  font-size: 14px;
}

.shell {
  width: min(1400px, calc(100% - 32px));
  margin: 0 auto;
  padding: 26px 0 42px;
}

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

h1,
h2,
h3,
p {
  margin: 0;
  letter-spacing: 0;
}

h1 {
  font-size: 1.65rem;
  line-height: 1.2;
}

h2 {
  font-size: 1.05rem;
}

h3 {
  font-size: 0.96rem;
  margin-bottom: 8px;
}

.sub {
  color: var(--muted);
  margin-top: 6px;
}

.subLine {
  color: var(--muted);
  font-size: 0.86rem;
  line-height: 1.35;
}

.subInline {
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 600;
}

.actions,
.pillRow {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.actions {
  justify-content: flex-end;
}

.pillRow {
  margin-top: 12px;
}

.btn {
  min-height: 36px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text);
  border-radius: 8px;
  padding: 7px 12px;
  font: inherit;
  cursor: pointer;
}

.btn:hover {
  background: var(--surface-soft);
}

.btnPrimary {
  color: #ffffff;
  background: var(--accent);
  border-color: var(--accent);
}

.btnPrimary:hover {
  background: var(--accent-dark);
}

.pill {
  display: inline-flex;
  min-height: 28px;
  align-items: center;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--muted);
  padding: 5px 10px;
  font-weight: 800;
  font-size: 0.82rem;
}

.pillGood {
  color: var(--success);
  background: #edf8f2;
  border-color: #bee3cc;
}

.pillWarn {
  color: var(--warn);
  background: #fff5e7;
  border-color: #edcf9f;
}

.pillBad {
  color: var(--danger);
  background: #fdeeed;
  border-color: #efc1bd;
}

.pillNeutral {
  color: var(--neutral);
  background: #f1f4f3;
}

.metricGrid {
  margin-top: 18px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
}

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

.metric {
  padding: 15px;
  min-height: 108px;
}

.label {
  font-size: 0.76rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  font-weight: 900;
}

.metricValue {
  margin-top: 7px;
  font-size: 1.85rem;
  line-height: 1.1;
  font-weight: 900;
}

.panel {
  margin-top: 12px;
  padding: 15px;
}

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

.smallMono {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  color: var(--muted);
  font-size: 0.76rem;
  overflow-wrap: anywhere;
  text-align: right;
}

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

.signalGrid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(245px, 1fr));
  gap: 10px;
}

.signalCard {
  border: 1px solid #dfe6e4;
  border-radius: 8px;
  padding: 12px;
  background: var(--surface-soft);
}

.signalHead,
.symbolCell {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
}

.symbolCell {
  justify-content: flex-start;
  align-items: center;
}

.symbol {
  font-weight: 900;
  letter-spacing: 0;
}

.signalMain {
  margin-top: 10px;
  font-size: 1.35rem;
  line-height: 1.2;
  font-weight: 900;
  text-transform: capitalize;
}

.miniGrid {
  margin-top: 10px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 5px 10px;
  color: var(--muted);
  font-size: 0.86rem;
}

.stateBadge,
.tinyState {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  padding: 3px 7px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 900;
  border: 1px solid transparent;
  text-transform: uppercase;
}

.stateTrigger,
.rowTrigger .tinyState {
  color: var(--danger);
  background: #fdeeed;
  border-color: #efc1bd;
}

.stateWatch,
.rowWatch .tinyState {
  color: var(--warn);
  background: #fff5e7;
  border-color: #edcf9f;
}

.tableWrap {
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: auto;
}

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

.tradeTable {
  min-width: 720px;
}

th,
td {
  border-top: 1px solid var(--line);
  padding: 9px 10px;
  vertical-align: middle;
  text-align: left;
}

thead th {
  border-top: 0;
  background: #f3f6f6;
  color: var(--muted);
  font-size: 0.76rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  white-space: nowrap;
}

tbody tr:hover {
  background: var(--surface-soft);
}

.right {
  text-align: right;
  white-space: nowrap;
}

.upText {
  color: var(--success);
}

.downText {
  color: var(--danger);
}

.warnText {
  color: var(--warn);
  font-weight: 800;
}

.catalogGrid {
  display: grid;
  grid-template-columns: minmax(180px, 0.7fr) repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.tagList {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.tag {
  display: inline-flex;
  gap: 5px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 5px 8px;
  background: var(--surface-soft);
  font-weight: 800;
}

.tag small {
  color: var(--muted);
  font-weight: 600;
}

.fieldBox {
  min-height: 180px;
  max-height: 260px;
  overflow: auto;
  white-space: pre-wrap;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  background: var(--surface-soft);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.78rem;
  line-height: 1.45;
  color: #263331;
}

.empty {
  padding: 16px;
  color: var(--muted);
}

@media (max-width: 980px) {
  .topbar,
  .splitGrid,
  .catalogGrid {
    grid-template-columns: 1fr;
    display: grid;
  }

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

  .metricGrid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 620px) {
  .shell {
    width: min(100% - 20px, 1400px);
    padding-top: 18px;
  }

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

  .panelHead {
    display: grid;
  }

  .smallMono {
    text-align: left;
  }
}
