/* GC Cockpit - the palette of the ATAS decision panel (FxEntryFusionIndicator). */
:root {
  --bg: #0e1723;
  --surface: #172435;
  --surface-2: #131f2e;
  --border: #3a526c;
  --line: rgba(58, 82, 108, .45);
  --text: #e6eff8;
  --muted: #9eb1c6;
  --good: #49d68c;
  --warning: #ffbd59;
  --bad: #ff6675;
  --info: #62b8ff;
  --missing: #252018;
  --radius: 6px;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); }
body {
  font: 14px/1.4 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  padding-bottom: env(safe-area-inset-bottom);
}
button { font: inherit; color: inherit; }
.num { font-variant-numeric: tabular-nums; }

.good { color: var(--good); } .warning { color: var(--warning); } .bad { color: var(--bad); }
.info { color: var(--info); } .muted { color: var(--muted); }

/* ---- top bar and tabs ---------------------------------------------------------- */
.topbar {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  padding: calc(8px + env(safe-area-inset-top)) 16px 8px;
  background: rgba(14, 23, 35, .96); border-bottom: 1px solid var(--line);
  backdrop-filter: blur(6px);
}
.brand { font-weight: 700; letter-spacing: .04em; }
.brand-mark { height: 34px; width: auto; margin-right: -6px; display: block; }
.tabs { display: flex; gap: 4px; }
.tab {
  background: none; border: 1px solid transparent; border-radius: var(--radius);
  padding: 6px 12px; color: var(--muted); cursor: pointer;
}
.tab[aria-selected="true"] { color: var(--text); border-color: var(--border); background: var(--surface); }
.spacer { flex: 1; }
.pill {
  display: inline-flex; align-items: center; gap: 6px; padding: 3px 9px; border-radius: 999px;
  border: 1px solid var(--line); font-size: 12px; color: var(--muted); white-space: nowrap;
}
.pill::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.pill.good { color: var(--good); } .pill.warning { color: var(--warning); } .pill.bad { color: var(--bad); }
.linkish { background: none; border: 0; color: var(--muted); cursor: pointer; padding: 4px; font-size: 12px; }

main { padding: 14px 16px 40px; max-width: 1500px; margin: 0 auto; }
.view[hidden] { display: none; }

.banner {
  border: 1px solid var(--bad); background: rgba(255, 102, 117, .1); color: var(--text);
  border-radius: var(--radius); padding: 10px 12px; margin-bottom: 12px;
}
.banner.warning { border-color: var(--warning); background: rgba(255, 189, 89, .08); }

/* ---- the panel ------------------------------------------------------------------ */
.panel { background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.panel-head {
  display: flex; justify-content: space-between; align-items: flex-start; gap: 12px;
  background: var(--surface); padding: 10px 14px;
}
.panel-title { font-size: 18px; font-weight: 700; }
.panel-sub { color: var(--muted); font-size: 12.5px; margin-top: 2px; }
.armed { font-weight: 700; white-space: nowrap; padding-top: 3px; }

.summary {
  display: flex; gap: 16px; align-items: baseline; flex-wrap: wrap;
  background: var(--surface-2); padding: 12px 14px; font-size: 18px;
}
.status { font-weight: 800; letter-spacing: .02em; }
.summary-text { color: var(--info); flex: 1; min-width: 240px; }

.gates { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 10px; padding: 12px 14px 0; }
.gate { background: var(--surface); border: 1px solid currentColor; border-radius: 4px; padding: 8px 10px; min-height: 64px; }
.gate-title { font-weight: 700; display: flex; gap: 8px; align-items: center; }
.gate-detail { color: var(--muted); font-size: 12.5px; margin-top: 4px; }
.gate-symbol { width: 16px; text-align: center; }

.missing {
  margin: 12px 14px 0; background: var(--missing); border-left: 4px solid currentColor;
  padding: 8px 12px; border-radius: 0 4px 4px 0;
}
.missing-title { font-weight: 700; }
.missing-detail { color: var(--text); margin-top: 3px; }

.boxes { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; padding: 12px 14px; }
.box { background: var(--surface); border: 1px solid var(--border); border-radius: 4px; min-width: 0; }
.box-title { color: var(--muted); font-weight: 700; padding: 6px 9px; letter-spacing: .03em; font-size: 12.5px; }
.rows { display: grid; }
.rows.two { grid-template-columns: repeat(2, minmax(0, 1fr)); grid-auto-flow: column; }
.row {
  display: flex; justify-content: space-between; gap: 12px; padding: 4px 9px;
  border-top: 1px solid var(--line); min-width: 0;
}
.row .label { color: var(--text); white-space: nowrap; }
.row .value { font-weight: 700; text-align: right; overflow-wrap: anywhere; }
.box.quiet .row .label, .box.quiet .row .value { color: var(--muted); font-weight: 400; }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
th, td { text-align: left; padding: 4px 9px; border-top: 1px solid var(--line); white-space: nowrap; }
th { color: var(--muted); font-weight: 400; font-size: 12.5px; }
td.r, th.r { text-align: right; }
.box.quiet td { color: var(--muted); }

.currencies { display: grid; grid-template-columns: repeat(8, minmax(0, 1fr)); gap: 6px; padding: 2px 9px 6px; }
.cur { border: 1px solid var(--line); border-radius: 3px; text-align: center; padding: 6px 0; }
.cur.usd { border: 2px solid var(--text); }
.cur-code { font-weight: 700; }
.caption { color: var(--muted); font-size: 12px; padding: 0 9px 8px; }

.panel-foot {
  display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  border-top: 1px solid var(--border); padding: 7px 14px; color: var(--muted); font-size: 12.5px;
}

/* ---- cards (trades, context) ---------------------------------------------------- */
.grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); margin-bottom: 12px; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); min-width: 0; }
.card-title {
  display: flex; justify-content: space-between; align-items: center; gap: 8px;
  padding: 8px 12px; color: var(--muted); font-weight: 700; font-size: 12.5px; letter-spacing: .03em;
}
.card-body { padding: 0 12px 10px; }
/* A long value (CONTRADICTORY) moves the next figure to its own line instead of overlapping it. */
.kpis { display: flex; flex-wrap: wrap; gap: 8px 16px; }
.kpis > div { flex: 1 1 100px; min-width: max-content; }
.kpi-value { white-space: nowrap; }
.kpi-label { color: var(--muted); font-size: 12px; }
.kpi-value { font-size: 18px; font-weight: 700; font-variant-numeric: tabular-nums; }

.meter { position: relative; height: 10px; background: var(--surface-2); border-radius: 5px; margin: 10px 0 4px; }
.meter-fill { position: absolute; inset: 0 auto 0 0; border-radius: 5px; background: var(--good); }
.meter-scale { display: flex; justify-content: space-between; color: var(--muted); font-size: 12px; }

.filters { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 12px; }
.chip {
  background: var(--surface); border: 1px solid var(--line); border-radius: 999px;
  padding: 5px 12px; cursor: pointer; color: var(--muted);
}
.chip[aria-pressed="true"] { color: var(--text); border-color: var(--info); }

tr.trade { cursor: pointer; }
tr.trade:hover td { background: rgba(98, 184, 255, .05); }
tr.more td { white-space: normal; color: var(--muted); background: var(--surface-2); }
.empty { color: var(--muted); padding: 10px 12px; }

.list-item { display: flex; gap: 10px; padding: 5px 0; border-top: 1px solid var(--line); align-items: baseline; }
.list-item:first-child { border-top: 0; }
.list-time { color: var(--muted); min-width: 92px; font-variant-numeric: tabular-nums; }

/* ---- login ---------------------------------------------------------------------- */
.login {
  max-width: 360px; margin: 8vh auto 0; padding: 22px; background: var(--surface);
  border: 1px solid var(--border); border-radius: 10px;
}
.login-logo { display: block; width: 100%; max-width: 300px; height: auto; margin: 0 auto 18px; }
.login input {
  width: 100%; padding: 10px 12px; font: inherit; color: var(--text); background: var(--bg);
  border: 1px solid var(--border); border-radius: var(--radius);
}
.login button {
  width: 100%; margin-top: 12px; padding: 10px; border: 0; border-radius: var(--radius);
  background: var(--info); color: #06121f; font-weight: 700; cursor: pointer;
}
.login .error { color: var(--bad); min-height: 20px; margin-top: 10px; font-size: 13px; }

/* ---- small screens ------------------------------------------------------------- */
@media (max-width: 900px) {
  .gates { grid-template-columns: 1fr; gap: 6px; }
  .gate { min-height: 0; display: flex; gap: 10px; align-items: baseline; }
  .gate-detail { margin-top: 0; }
  .boxes { grid-template-columns: 1fr; }
  .rows.two { grid-template-columns: 1fr; grid-template-rows: none !important; grid-auto-flow: row; }
  .currencies { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .summary { font-size: 16px; }
  main { padding: 10px 8px 40px; }
  .topbar { padding-left: 10px; padding-right: 10px; }
}

/* ---- panel page layout: the panel, and on wide screens the account beside it ------- */
.panel-layout { display: grid; gap: 12px; grid-template-columns: minmax(0, 1fr); }
.side { display: grid; gap: 12px; align-content: start; }
@media (min-width: 1280px) {
  .panel-layout { grid-template-columns: minmax(0, 1fr) 340px; }
}

.trade-items { display: grid; gap: 6px; }
.trade-item { padding: 7px 10px; border: 1px solid var(--tone); border-radius: 6px; cursor: pointer; }
.trade-line { display: flex; gap: 8px; align-items: baseline; }
.trade-sub { font-size: 12.5px; margin-top: 2px; }

/* ---- account card ------------------------------------------------------------------ */
.acct-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 10px; margin-top: 10px; }
.acct-section .rows { margin-top: 4px; }
.grid > .card.account { grid-column: 1 / -1; }

/* ---- closed trades: every trade its own box, border = result -------------------------- */
.win { --tone: rgba(73, 214, 140, .7); } .loss { --tone: rgba(255, 102, 117, .7); } .flat { --tone: var(--border); }
.filters { align-items: center; }
.legend { margin-left: auto; display: flex; gap: 12px; color: var(--muted); font-size: 12.5px; }
.swatch { display: inline-block; width: 11px; height: 11px; margin-right: 5px; vertical-align: -1px;
  border: 1.5px solid var(--tone); border-radius: 3px; }
.chev { color: var(--muted); width: 1.2em; text-align: center; }
table.trades { border-collapse: separate; border-spacing: 0 5px; padding: 0 8px; }
table.trades th { border-top: 0; }
table.trades td { border-top: 1px solid var(--tone); border-bottom: 1px solid var(--tone); }
table.trades tr.trade td:first-child, table.trades tr.more td { border-left: 1px solid var(--tone); }
table.trades tr.trade td:last-child, table.trades tr.more td { border-right: 1px solid var(--tone); }
table.trades tr.trade td:first-child { border-radius: 6px 0 0 6px; }
table.trades tr.trade td:last-child { border-radius: 0 6px 6px 0; }
table.trades tr.trade.open td { border-bottom: 0; }
table.trades tr.trade.open td:first-child { border-radius: 6px 0 0 0; }
table.trades tr.trade.open td:last-child { border-radius: 0 6px 0 0; }
/* Pull the details up against their trade across the row spacing. */
table.trades tr.more td { border-top: 0; border-radius: 0 0 6px 6px; position: relative; top: -5px; }

/* ---- trade detail ------------------------------------------------------------------- */
.detail { display: grid; gap: 12px; padding: 8px 2px 4px; white-space: normal; color: var(--text); }
.ladder { position: relative; height: 50px; margin: 0 8px; max-width: 760px; }
.ladder .track { position: absolute; left: 0; right: 0; top: 21px; height: 6px; border-radius: 3px; background: var(--bg); }
.ladder .zone { position: absolute; top: 21px; height: 6px; }
.zone.loss { background: rgba(255, 102, 117, .35); border-radius: 3px 0 0 3px; }
.zone.gain { background: rgba(73, 214, 140, .3); }
.ladder .band { position: absolute; top: 18px; height: 12px; border-radius: 6px;
  background: rgba(98, 184, 255, .14); border: 1px solid rgba(98, 184, 255, .45); box-sizing: border-box; }
.ladder .tick { position: absolute; top: 15px; width: 2px; height: 18px; margin-left: -1px; background: var(--muted); }
.ladder .tick.entry { background: var(--text); }
.ladder .dot { position: absolute; top: 17px; width: 14px; height: 14px; margin-left: -7px; border-radius: 50%;
  border: 2px solid var(--surface); box-sizing: border-box; }
.dot.win { background: var(--good); } .dot.loss { background: var(--bad); } .dot.flat { background: var(--muted); }
.ladder .lbl { position: absolute; font-size: 11.5px; line-height: 1; white-space: nowrap; transform: translateX(-50%); }
.lbl.top { top: 0; font-weight: 700; } .lbl.bottom { top: 37px; color: var(--muted); }
.lbl.start { transform: none; } .lbl.end { transform: translateX(-100%); }
.facts { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 8px 14px; }
.fact-label { font-size: 11.5px; color: var(--muted); }
.fact-value { font-variant-numeric: tabular-nums; font-weight: 600; }
.reason { display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap; }
.code { font-size: 11px; padding: 1px 6px; border: 1px solid var(--border); border-radius: 4px; color: var(--muted);
  letter-spacing: .02em; }
.code.bad { border-color: var(--bad); color: var(--bad); }
.detail-foot { font-size: 11.5px; color: var(--muted); overflow-wrap: anywhere; }
