/*
 * EUR/USD Monitor — light, banknote-paper palette. Dollar green marks a met
 * condition and healthy data, euro blue marks selection and EMA50, amber is
 * reserved for a complete 4/4 BUY setup and nothing else.
 */

:root {
  --paper: #eef1ec;
  --surface: #f9faf7;
  --ink: #17213a;
  --muted: #5d6677;
  --faint: #9aa2b1;
  --rule: #d2d8cf;
  --euro: #2b44a0;
  --euro-soft: #e2e7f5;
  --dollar: #2d6e50;
  --amber: #b86a12;
  --amber-soft: #f6e8d3;
  --alarm: #a8322d;
  --ema200: #7a8294;
  --rsi: #6b4fa0;

  --display: "Bricolage Grotesque", "Public Sans", system-ui, sans-serif;
  --text: "Public Sans", system-ui, sans-serif;

  --step--1: 0.8125rem;
  --step-0: 0.9375rem;
  --step-1: 1.125rem;
  --step-2: 1.5rem;
  --step-4: clamp(2rem, 4.5vw, 2.75rem);
  --step-5: clamp(2.75rem, 7vw, 4.25rem);

  color-scheme: light;
}

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

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 400 var(--step-0) / 1.5 var(--text);
  font-variant-numeric: lining-nums tabular-nums;
  -webkit-font-smoothing: antialiased;
}

.page {
  max-width: 1120px;
  margin: 0 auto;
  padding: 36px 24px 56px;
}

h1,
h2 {
  font-family: var(--display);
  font-weight: 700;
  margin: 0;
  letter-spacing: -0.01em;
}

h2 {
  font-size: var(--step-2);
}

button:focus-visible {
  outline: 2px solid var(--euro);
  outline-offset: 2px;
}

/* ---------- Quote and status ---------- */

.top {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 24px 40px;
  flex-wrap: wrap;
}

.quote h1 {
  font-size: var(--step-1);
  font-weight: 500;
  color: var(--muted);
}

/* The pair name is the picker: same type as the old heading, plus a chevron. */
.pair-select {
  appearance: none;
  font: inherit;
  color: inherit;
  background: transparent url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5 6 6.5 11 1.5' fill='none' stroke='%235d6677' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") no-repeat right 4px center;
  border: 1px solid transparent;
  border-radius: 6px;
  padding: 2px 26px 2px 6px;
  margin-left: -7px;
  cursor: pointer;
}

.pair-select:hover {
  border-color: var(--rule);
  background-color: var(--surface);
}

.pair-select:focus-visible {
  outline: 2px solid var(--euro);
  outline-offset: 2px;
}

.price {
  font-family: var(--display);
  font-size: var(--step-5);
  font-weight: 700;
  line-height: 1;
  letter-spacing: -0.03em;
  margin: 6px 0 8px;
}

.change {
  margin: 0;
  font-weight: 600;
  color: var(--muted);
}

.change.up {
  color: var(--dollar);
}

.change.down {
  color: var(--alarm);
}

.status {
  margin: 0;
  padding-left: 14px;
  border-left: 3px solid var(--dollar);
  max-width: 40ch;
}

.status.closed {
  border-left-color: var(--faint);
}

.status.alarm {
  border-left-color: var(--alarm);
  color: var(--alarm);
  font-weight: 600;
}

/* ---------- Timeframe strip ---------- */

.timeframes {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 8px;
  margin: 32px 0 28px;
}

.timeframes button {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
  padding: 12px 14px;
  font: 500 var(--step-0) / 1.2 var(--text);
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: 12px;
  cursor: pointer;
  text-align: left;
}

.timeframes button:hover {
  border-color: var(--faint);
}

.timeframes button[aria-pressed="true"] {
  border-color: var(--euro);
  box-shadow: inset 0 0 0 1px var(--euro);
  background: var(--euro-soft);
}

.timeframes .tf-off {
  display: block;
  font-size: 0.75rem;
  color: var(--muted);
}

.timeframes .tf-count {
  font-family: var(--display);
  font-weight: 700;
  color: var(--muted);
}

.timeframes button.setup {
  background: var(--amber-soft);
  border-color: var(--amber);
}

.timeframes button.setup .tf-count {
  color: var(--amber);
}

/* Direction next to a setup's timeframe. */
.side {
  font-size: var(--step--1);
  font-weight: 600;
  color: var(--muted);
}

/* ---------- Condition count and cards ---------- */

.count-line {
  display: flex;
  align-items: baseline;
  gap: 8px 20px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.count {
  font-size: var(--step-4);
  line-height: 1.1;
}

.count.setup {
  color: var(--amber);
}

.count-note {
  margin: 0;
  color: var(--muted);
}

.cards {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
}

.card {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 18px 18px 16px;
  background: var(--surface);
  border: 1px solid var(--rule);
  border-top: 4px solid var(--rule);
  border-radius: 12px;
}

.card.met {
  border-top-color: var(--dollar);
}

.cards.setup .card {
  border-top-color: var(--amber);
}

.card-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
}

.card h3 {
  margin: 0;
  font-family: var(--display);
  font-size: var(--step-1);
  font-weight: 700;
}

.verdict {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: var(--step--1);
  font-weight: 600;
  color: var(--muted);
  white-space: nowrap;
}

.verdict::before {
  content: "";
  width: 10px;
  height: 10px;
  border-radius: 50%;
  border: 2px solid var(--faint);
}

.card.met .verdict {
  color: var(--dollar);
}

.card.met .verdict::before {
  background: var(--dollar);
  border-color: var(--dollar);
}

.cards.setup .card .verdict {
  color: var(--amber);
}

.cards.setup .card .verdict::before {
  background: var(--amber);
  border-color: var(--amber);
}

/* Not checked yet: an earlier condition in the sequence is unmet. */
.card.waiting {
  border-top-style: dashed;
}

.card.waiting .verdict::before {
  border-style: dashed;
}

.card.waiting .evidence dd,
.card.waiting .evidence dt {
  color: var(--faint);
}

.rule {
  margin: 0;
  color: var(--muted);
  font-size: var(--step--1);
  min-height: 2.6em;
}

.evidence {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 4px 12px;
  margin: 0;
  padding-top: 10px;
  border-top: 1px solid var(--rule);
}

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

.evidence dd {
  margin: 0;
  text-align: right;
  font-weight: 500;
}

/* ---------- Chart ---------- */

.chart-section,
.alerts-section {
  padding-top: 40px;
}

.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px 24px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}

.legend {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  margin: 0;
  font-size: var(--step--1);
  color: var(--muted);
}

.swatch {
  display: inline-block;
  width: 18px;
  height: 3px;
  border-radius: 2px;
  margin-left: 12px;
}

.swatch:first-child {
  margin-left: 0;
}

.swatch.ema50 {
  background: var(--euro);
}

.swatch.ema200 {
  background: var(--ema200);
}

.swatch.rsi {
  background: var(--rsi);
}

.swatch.alert,
.swatch.unsent {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--amber);
}

.swatch.unsent {
  background: var(--faint);
}

.chart {
  height: 380px;
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: 12px 12px 0 0;
  overflow: hidden;
}

.rsi-chart {
  height: 150px;
  border-top: 0;
  border-radius: 0 0 12px 12px;
}

/* ---------- Alerts ---------- */

table {
  width: 100%;
  border-collapse: collapse;
}

th {
  font-weight: 500;
  font-size: var(--step--1);
  color: var(--muted);
  text-align: left;
  padding: 8px 6px;
}

td {
  padding: 12px 6px;
  text-align: left;
  border-top: 1px solid var(--rule);
}

.alerts .num,
.record .num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.record-summary {
  margin: 0 0 12px;
  max-width: 70ch;
}

/* Seven columns: scroll sideways on narrow screens rather than squeeze. */
.record-wrap {
  overflow-x: auto;
}

.record {
  min-width: 680px;
}

.chance-bar {
  display: inline-block;
  vertical-align: middle;
  width: 64px;
  height: 6px;
  margin-left: 8px;
  border-radius: 3px;
  background: linear-gradient(to right, var(--euro) var(--fill), var(--rule) var(--fill));
  position: relative;
}


.result.sent {
  color: var(--dollar);
}

.result.warn {
  color: var(--alarm);
}

.empty {
  color: var(--muted);
  max-width: 60ch;
  margin: 0;
}

.note {
  margin-top: 48px;
  padding-top: 20px;
  border-top: 1px solid var(--rule);
  color: var(--muted);
  font-size: var(--step--1);
  max-width: 72ch;
}

/* ---------- Pages and My trades ---------- */

.pages {
  display: flex;
  gap: 20px;
  margin-bottom: 20px;
  font-size: var(--step--1);
  font-weight: 600;
}

.pages a {
  color: var(--muted);
  text-decoration: none;
  padding-bottom: 2px;
  border-bottom: 2px solid transparent;
}

.pages a:hover {
  color: var(--ink);
}

.pages a[aria-current="page"] {
  color: var(--ink);
  border-bottom-color: var(--euro);
}

.pages a:focus-visible,
.import-button:focus-within {
  outline: 2px solid var(--euro);
  outline-offset: 2px;
}

.trades-heading {
  font-size: var(--step-1);
  color: var(--muted);
}

.price.up,
td.up {
  color: var(--dollar);
}

.price.down,
td.down {
  color: var(--alarm);
}

.import {
  display: grid;
  justify-items: start;
  gap: 10px;
  max-width: 44ch;
}

.import-button {
  display: inline-block;
  padding: 10px 16px;
  border-radius: 10px;
  background: var(--ink);
  color: var(--surface);
  font-weight: 600;
  cursor: pointer;
}

.import-button:hover {
  background: var(--euro);
}

.timeframes.scope {
  grid-template-columns: repeat(5, minmax(0, 140px));
}

/* Eight results: four across, two across on phones; hairlines between cells. */
.stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  margin: 24px 0 40px;
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: 12px;
  overflow: hidden;
}

.stats div {
  padding: 14px 16px;
  box-shadow: -1px -1px 0 var(--rule);
}

@media (max-width: 760px) {
  .timeframes.scope {
    grid-template-columns: repeat(3, 1fr);
  }
  .stats {
    grid-template-columns: repeat(2, 1fr);
  }
}

.stats dt {
  font-size: var(--step--1);
  color: var(--muted);
}

.stats dd {
  margin: 4px 0 0;
  font-size: var(--step-1);
  font-weight: 600;
}

.chart.curve {
  height: 300px;
  border-radius: 12px;
}

.positions {
  min-width: 940px;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

/* ---------- Smaller screens ---------- */

@media (max-width: 960px) {
  .cards {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 640px) {
  .page {
    padding: 24px 16px 40px;
  }

  .timeframes {
    grid-template-columns: repeat(3, 1fr);
  }

  .timeframes button {
    flex-direction: column;
    gap: 2px;
    padding: 10px 12px;
  }

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

  .rule {
    min-height: 0;
  }

  .chart {
    height: 300px;
  }

  .rsi-chart {
    height: 130px;
  }

  .chance-bar {
    display: none;
  }

  /* Alerts as short rows: when + timeframe, entry + chance, stop / target, result. */
  .alerts thead {
    display: none;
  }

  .alerts tr {
    display: grid;
    grid-template-columns: 1fr auto;
    column-gap: 12px;
    padding: 12px 0;
    border-top: 1px solid var(--rule);
  }

  .alerts td {
    border: 0;
    padding: 2px 0;
  }

  .alerts td:nth-child(2),
  .alerts td:nth-child(5) {
    text-align: right;
  }

  .alerts td:nth-child(3),
  .alerts td:nth-child(4) {
    text-align: left;
  }

  .alerts td:nth-child(3) {
    grid-row: 2;
  }

  .alerts td:nth-child(5) {
    grid-row: 2;
    grid-column: 2;
  }

  .alerts td:nth-child(4),
  .alerts td:nth-child(6) {
    grid-column: 1 / -1;
    font-size: var(--step--1);
  }
}

@media (prefers-reduced-motion: no-preference) {
  .count.setup {
    animation: arrive 1.2s ease-out 1;
  }

  @keyframes arrive {
    from {
      opacity: 0.25;
    }
  }
}

/* fx-only / oil-only parts switch with the selected pair */
[hidden] { display: none !important; }
