/* TradeFX dashboard (PHP edition). Colour tokens follow the same validated palette as the Python dashboard. */
:root {
  color-scheme: light;
  --page: #f9f9f7;
  --surface: #fcfcfb;
  --sidebar: #f0f0ed;
  --text: #0b0b0b;
  --text-2: #52514e;
  --muted: #898781;
  --grid: #e1e0d9;
  --base: #c3c2b7;
  --border: rgba(11, 11, 11, 0.10);
  --s1: #2a78d6;
  --s2: #eb6834;
  --good: #0ca30c;
  --good-text: #006300;
  --critical: #d03b3b;
  --warning: #fab219;
  --neutral: #898781;
  --band: rgba(137, 135, 129, 0.14);
  --info-bg: #e9f1fb;
  --warn-bg: #fdf6e3;
  --ok-bg: #e9f6ea;
  --err-bg: #fbeaea;
  --accent: #2a78d6;
}
@media (prefers-color-scheme: dark) {
  :root:where(:not([data-theme="light"])) {
    color-scheme: dark;
    --page: #0d0d0d;
    --surface: #1a1a19;
    --sidebar: #141413;
    --text: #f0efec;
    --text-2: #c3c2b7;
    --muted: #898781;
    --grid: #2c2c2a;
    --base: #383835;
    --border: rgba(255, 255, 255, 0.10);
    --s1: #3987e5;
    --s2: #d95926;
    --good-text: #0ca30c;
    --band: rgba(137, 135, 129, 0.20);
    --info-bg: #17263a;
    --warn-bg: #2f2814;
    --ok-bg: #15281a;
    --err-bg: #331a1a;
    --accent: #3987e5;
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--page);
  color: var(--text);
  font: 15px/1.5 system-ui, -apple-system, "Segoe UI", sans-serif;
}
.layout {
  display: grid; grid-template-columns: 290px minmax(0, 1fr); min-height: 100vh;
  background: linear-gradient(90deg, var(--sidebar) 0 290px, var(--page) 290px); /* sidebar colour runs the full page height */
}
.sidebar {
  background: var(--sidebar);
  border-right: 1px solid var(--border);
  padding: 22px 20px;
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
}
main { padding: 18px 28px 48px; min-width: 0; }
.brand { font-size: 1.45rem; font-weight: 700; display: flex; align-items: center; gap: 8px; }
.tag { font-size: .7rem; font-weight: 600; border: 1px solid var(--border); border-radius: 999px; padding: 1px 8px; color: var(--text-2); }
h1, h2, h3 { line-height: 1.25; }
h2 { font-size: 1.05rem; margin: 18px 0 8px; }
h3 { font-size: 1rem; margin: 22px 0 8px; }
hr { border: 0; border-top: 1px solid var(--border); margin: 18px 0; }
.muted { color: var(--muted); }
.small { font-size: .82rem; }
.field { display: block; margin: 12px 0; font-size: .88rem; color: var(--text-2); }
.field output { color: var(--text); font-weight: 600; margin-left: 4px; }
.field select, .field input[type=number], .field input:not([type]), input[type=search], input[type=text] {
  display: block; width: 100%; margin-top: 4px; padding: 7px 9px; font: inherit; color: var(--text);
  background: var(--surface); border: 1px solid var(--border); border-radius: 8px;
}
.field input[type=range] { display: block; width: 100%; margin-top: 6px; accent-color: var(--accent); }
.check { display: block; margin: 10px 0; font-size: .9rem; }
.check input { accent-color: var(--accent); margin-right: 6px; }
.check .hint { display: block; font-size: .78rem; color: var(--muted); margin-left: 22px; }

.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 18px; overflow-x: auto; }
.tabs button {
  background: none; border: 0; border-bottom: 2px solid transparent; padding: 10px 12px; font: inherit; color: var(--text-2);
  cursor: pointer; white-space: nowrap;
}
.tabs button[aria-selected=true] { color: var(--text); border-bottom-color: var(--accent); font-weight: 600; }
.tabs button:focus-visible, button:focus-visible, select:focus-visible, input:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.title { font-size: 1.5rem; font-weight: 700; margin: 4px 0 14px; }
.tiles { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-bottom: 14px; }
.tiles.five { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.tile { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 12px 14px; min-width: 0; }
.tile .label { font-size: .82rem; color: var(--text-2); }
.tile .value { font-size: 1.75rem; font-weight: 600; line-height: 1.25; margin-top: 2px; overflow-wrap: anywhere; }
.tile .sub { font-size: .78rem; color: var(--muted); margin-top: 2px; }
.signal { border-left: 6px solid var(--neutral); }
.signal .value { font-size: 2rem; font-weight: 700; }
.signal .icon { margin-right: 4px; }
.signal.UP { border-left-color: var(--good); } .signal.UP .icon { color: var(--good); }
.signal.DOWN { border-left-color: var(--critical); } .signal.DOWN .icon { color: var(--critical); }
.signal.WAIT .icon { color: var(--neutral); }

.box { border-radius: 10px; padding: 11px 14px; margin: 10px 0; border: 1px solid var(--border); }
.box.info { background: var(--info-bg); }
.box.warning { background: var(--warn-bg); }
.box.ok { background: var(--ok-bg); }
.box.error { background: var(--err-bg); }
.box ul { margin: 6px 0 0; padding-left: 20px; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 14px; margin: 12px 0; }
.chart { width: 100%; min-height: 300px; }
.grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.grid32 { display: grid; grid-template-columns: 3fr 2fr; gap: 16px; align-items: start; }
.caption { font-size: .82rem; color: var(--muted); margin: 6px 0 12px; }

table { border-collapse: collapse; width: 100%; font-size: .86rem; }
.tablewrap { overflow-x: auto; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); }
th, td { text-align: left; padding: 7px 10px; border-bottom: 1px solid var(--border); white-space: nowrap; }
th { color: var(--text-2); font-weight: 600; background: var(--sidebar); position: sticky; top: 0; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
tr:last-child td { border-bottom: 0; }
details { margin: 10px 0; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); }
details > summary { cursor: pointer; padding: 9px 14px; font-size: .9rem; }
details > div { padding: 0 14px 12px; }
pre { white-space: pre-wrap; word-break: break-word; font-size: .8rem; max-height: 420px; overflow: auto; }

.btn {
  display: inline-block; font: inherit; font-size: .9rem; padding: 8px 14px; border-radius: 8px; cursor: pointer;
  border: 1px solid var(--border); background: var(--surface); color: var(--text);
}
.btn:hover { border-color: var(--accent); }
.btn.primary { background: var(--accent); color: #fff; border-color: var(--accent); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.row { display: flex; flex-wrap: wrap; gap: 10px; align-items: end; margin: 8px 0; }
.row .field { margin: 0; }
.progress { height: 8px; background: var(--grid); border-radius: 999px; overflow: hidden; margin: 8px 0 4px; }
.progress > div { height: 100%; width: 0; background: var(--accent); transition: width .3s; }
.book { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--border); }
.answer { white-space: pre-wrap; }
.loading { color: var(--muted); padding: 30px 0; }
.stale { opacity: .55; transition: opacity .2s; }

@media (max-width: 960px) {
  .layout { grid-template-columns: 1fr; background: var(--page); }
  .sidebar { position: static; height: auto; border-right: 0; border-top: 1px solid var(--border); order: 2; } /* signal first on phones */
  main { padding: 12px 16px 40px; }
  .tiles, .tiles.five { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid2, .grid32 { grid-template-columns: 1fr; }
}
