/* Frontier Terminal beta — client styles.
   Zero dependencies, no external references, no build step.
   Dark, dense, data-first. Every colour below is a pair measured for AA
   contrast against the surface it sits on. */

:root {
  color-scheme: dark;

  --bg: #0b0e12;
  --panel: #12171d;
  --panel-2: #171d25;
  --line: #26303b;
  --line-strong: #35424f;

  --text: #e7edf3;
  --muted: #a7b6c5;
  --dim: #8194a6;

  --accent: #e8a33d;
  --accent-2: #63b3ed;
  --good: #4cc38a;
  --bad: #ef6f68;
  --warn: #e3b341;

  --radius: 10px;
  --radius-sm: 6px;
  --wrap: 1120px;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background-color: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 14px;
  line-height: 1.48;
  overflow-wrap: break-word;
}

h1,
h2,
h3 {
  margin: 0;
  line-height: 1.25;
  font-weight: 650;
}

h1 {
  font-size: 1.35rem;
}

h2 {
  font-size: 1.05rem;
}

h3 {
  font-size: 0.95rem;
}

p {
  margin: 0;
}

a {
  color: var(--accent-2);
  text-decoration-thickness: 1px;
  text-underline-offset: 2px;
}

a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
summary:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 3px;
}

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  padding: 8px 12px;
  background-color: var(--panel-2);
  color: var(--text);
  border: 1px solid var(--accent);
  z-index: 10;
}

.skip-link:focus {
  left: 8px;
  top: 8px;
}

.wrap {
  width: 100%;
  max-width: var(--wrap);
  margin: 0 auto;
  padding: 0 12px;
  min-width: 0;
}

/* ---------- top bar ---------- */

.top {
  border-bottom: 1px solid var(--line);
  background-color: var(--panel);
  padding: 10px 0;
}

.top__inner {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 6px 14px;
  min-width: 0;
}

.top__brand {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--text);
  text-decoration: none;
  min-height: 28px;
}

.top__mark {
  display: block;
  flex: none;
}

.top__tag {
  color: var(--dim);
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.top__nav {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 14px;
  margin-left: auto;
  min-width: 0;
}

.top__nav a {
  display: inline-block;
  min-height: 28px;
  padding: 5px 2px;
  font-size: 0.8125rem;
}

/* ---------- generic blocks ---------- */

main {
  display: block;
  padding: 14px 0 40px;
}

.section {
  margin-top: 22px;
  min-width: 0;
}

.section > h2 {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 6px 10px;
}

.section__note {
  margin-top: 6px;
  color: var(--dim);
  font-size: 0.78125rem;
}

.mono {
  font-family: var(--mono);
}

.dim {
  color: var(--dim);
}

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

.nowrap {
  white-space: nowrap;
}

/* ---------- status strip ---------- */

.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(9.5rem, 1fr));
  gap: 8px;
  margin-top: 10px;
}

.stat {
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background-color: var(--panel);
  padding: 8px 10px;
  min-width: 0;
}

.stat__label {
  display: block;
  font-size: 0.6875rem;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--dim);
}

.stat__value {
  display: block;
  margin-top: 2px;
  font-family: var(--mono);
  font-size: 0.9375rem;
  color: var(--text);
  overflow-wrap: anywhere;
}

.stat--fail {
  border-color: var(--bad);
}

.stat--fail .stat__value {
  color: var(--bad);
}

/* ---------- toolbar ---------- */

.toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 10px 14px;
  margin-top: 12px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background-color: var(--panel);
  min-width: 0;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}

.field > label {
  font-size: 0.6875rem;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--dim);
}

input[type="text"],
input[type="search"],
select {
  min-height: 34px;
  padding: 5px 8px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background-color: var(--bg);
  color: var(--text);
  font: inherit;
  font-size: 0.875rem;
  max-width: 100%;
}

input[type="text"],
input[type="search"] {
  width: 9rem;
}

button {
  min-height: 34px;
  padding: 5px 12px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background-color: var(--panel-2);
  color: var(--text);
  font: inherit;
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
}

button:hover:not([disabled]) {
  border-color: var(--accent);
  color: var(--accent);
}

button[disabled] {
  opacity: 0.6;
  cursor: progress;
}

button.primary {
  border-color: var(--accent);
  color: var(--accent);
}

/* ---------- notices ---------- */

.notice {
  margin-top: 12px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-left: 3px solid var(--dim);
  border-radius: var(--radius-sm);
  background-color: var(--panel);
  color: var(--muted);
  min-width: 0;
}

.notice--error {
  border-left-color: var(--bad);
}

.notice--error strong {
  color: var(--bad);
}

.notice--empty {
  border-left-color: var(--accent);
}

.notice strong {
  color: var(--text);
}

/* ---------- signals ---------- */

.signals {
  display: grid;
  gap: 10px;
  margin: 10px 0 0;
  padding: 0;
  list-style: none;
}

.signal {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background-color: var(--panel);
  padding: 10px 12px;
  min-width: 0;
}

.signal__head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 6px 12px;
  min-width: 0;
}

.signal__ticker {
  font-family: var(--mono);
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.signal__ticker a {
  display: inline-block;
  min-height: 24px;
  padding: 1px 0;
  color: inherit;
}

.signal__type {
  font-size: 0.6875rem;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--accent);
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  padding: 1px 8px;
  white-space: nowrap;
}

.signal__when {
  margin-left: auto;
  color: var(--dim);
  font-size: 0.75rem;
  font-family: var(--mono);
}

.signal__message {
  margin-top: 6px;
  color: var(--text);
}

.conf {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
  min-width: 0;
}

.conf__num {
  font-family: var(--mono);
  font-size: 0.875rem;
  font-weight: 700;
  color: var(--accent);
  min-width: 2.75rem;
}

.conf__label {
  font-size: 0.6875rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--dim);
}

progress.bar {
  flex: 1 1 4rem;
  width: 100%;
  min-width: 3rem;
  height: 8px;
  border: 0;
  border-radius: 999px;
  background-color: var(--line);
  appearance: none;
  -webkit-appearance: none;
}

progress.bar::-webkit-progress-bar {
  background-color: var(--line);
  border-radius: 999px;
}

progress.bar::-webkit-progress-value {
  background-color: var(--accent);
  border-radius: 999px;
}

progress.bar::-moz-progress-bar {
  background-color: var(--accent);
  border-radius: 999px;
}

.sources {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 8px;
  padding: 0;
  list-style: none;
}

.sources li {
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  padding: 1px 8px;
  font-size: 0.75rem;
  color: var(--muted);
  font-family: var(--mono);
  overflow-wrap: anywhere;
}

/* ---------- generic key/value rendering (API data, verbatim) ---------- */

.kv {
  display: grid;
  grid-template-columns: minmax(5.5rem, max-content) minmax(0, 1fr);
  gap: 2px 10px;
  margin: 6px 0 0;
  min-width: 0;
}

.kv dt {
  color: var(--dim);
  font-size: 0.75rem;
  letter-spacing: 0.03em;
  overflow-wrap: anywhere;
}

.kv dd {
  margin: 0;
  min-width: 0;
  font-family: var(--mono);
  font-size: 0.8125rem;
  color: var(--text);
  overflow-wrap: anywhere;
}

.kv dd > .kv,
.kv dd > .json-block {
  font-family: var(--sans);
}

.json-block {
  border-left: 2px solid var(--line);
  padding-left: 8px;
  margin-top: 4px;
  min-width: 0;
}

.json-list {
  margin: 4px 0 0;
  padding-left: 14px;
  min-width: 0;
}

.json-list > li {
  margin-top: 4px;
  overflow-wrap: anywhere;
}

.item {
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background-color: var(--panel-2);
  padding: 8px 10px;
  min-width: 0;
}

.items {
  display: grid;
  gap: 8px;
  margin: 8px 0 0;
  padding: 0;
  list-style: none;
}

.badge {
  display: inline-block;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  padding: 0 7px;
  font-size: 0.6875rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  font-family: var(--mono);
}

.badge--fail {
  border-color: var(--bad);
  color: var(--bad);
}

.badge--ok {
  border-color: var(--good);
  color: var(--good);
}

.badge--off {
  border-color: var(--line-strong);
  color: var(--dim);
}

.pair {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  min-width: 0;
}

/* A standalone back/action link (not inline prose), so it needs a real target. */
.back-link {
  display: inline-block;
  min-height: 28px;
  padding: 5px 0;
}

/* ---------- details ---------- */

details {
  margin-top: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background-color: var(--panel);
  min-width: 0;
}

details > summary {
  min-height: 32px;
  padding: 7px 12px;
  cursor: pointer;
  color: var(--muted);
  font-size: 0.8125rem;
}

details[open] > summary {
  border-bottom: 1px solid var(--line);
}

details > .details__body {
  padding: 10px 12px;
  min-width: 0;
}

/* ---------- chart ---------- */

figure.chart {
  margin: 10px 0 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background-color: var(--panel);
  padding: 10px 12px;
  min-width: 0;
}

figure.chart svg {
  display: block;
  width: 100%;
  height: auto;
}

.chart__caption {
  margin-top: 6px;
  color: var(--dim);
  font-size: 0.75rem;
}

.grid-line {
  stroke: var(--line);
  stroke-width: 1;
}

.axis-line {
  stroke: var(--line-strong);
  stroke-width: 1;
}

.axis-text {
  fill: var(--dim);
  font-family: var(--mono);
  font-size: 10px;
}

.series-line {
  fill: none;
  stroke: var(--accent);
  stroke-width: 2;
  stroke-linejoin: round;
  stroke-linecap: round;
}

.series-area {
  fill: rgba(232, 163, 61, 0.12);
  stroke: none;
}

.series-dot {
  fill: var(--accent);
}

/* ---------- table (quote values) ---------- */

table.values {
  width: 100%;
  border-collapse: collapse;
  font-family: var(--mono);
  font-size: 0.78125rem;
  table-layout: fixed;
}

table.values th,
table.values td {
  text-align: left;
  padding: 3px 6px;
  border-bottom: 1px solid var(--line);
  overflow-wrap: anywhere;
}

table.values th {
  color: var(--dim);
  font-weight: 600;
  font-size: 0.6875rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

table.values td.num {
  text-align: right;
}

/* ---------- footer ---------- */

.foot {
  border-top: 1px solid var(--line);
  padding: 14px 0 28px;
  color: var(--dim);
  font-size: 0.78125rem;
}

.foot p + p {
  margin-top: 4px;
}

/* ---------- small screens ---------- */

@media (max-width: 26rem) {
  body {
    font-size: 13.5px;
  }

  .top__nav {
    margin-left: 0;
  }

  .kv {
    grid-template-columns: minmax(0, 1fr);
    gap: 0 0;
  }

  .kv dd {
    margin-bottom: 4px;
  }

  .signal__when {
    margin-left: 0;
  }
}
