:root {
  --bg: #f4f1ea;
  --panel: #fffcf7;
  --ink: #1c1915;
  --muted: #6d655c;
  --line: #e4ddd2;
  --accent: #9a3412;
  --buy: #0f6b45;
  --buy-bg: #e7f6ee;
  --sell: #9f2332;
  --sell-bg: #fdecee;
  --wait: #8a5a12;
  --wait-bg: #fbf3e4;
  --shadow: 0 18px 50px rgba(48, 32, 16, 0.08);
  font-family: "Public Sans", "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--bg);
}

* { box-sizing: border-box; }

body { margin: 0; min-height: 100vh; }

h1, h2, p { margin: 0; }

button, input { font: inherit; color: inherit; }

button { cursor: pointer; }

.eyebrow {
  font-family: "IBM Plex Mono", ui-monospace, monospace;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  font-size: 12px;
  color: var(--accent);
}

.gate {
  min-height: 100vh;
  display: none;
  place-items: center;
  padding: 32px 20px;
  background:
    radial-gradient(900px 420px at 50% -10%, rgba(255, 236, 214, 0.55), transparent 60%),
    linear-gradient(165deg, #241c16 0%, #3a2820 48%, #8d4d2a 160%);
}

body.locked .gate { display: grid; }
body.locked .shell { display: none; }

.gate-brand { display: none; }

.gate-card {
  width: min(440px, 100%);
  background: var(--panel);
  border-radius: 24px;
  box-shadow: var(--shadow);
  padding: 32px 28px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.gate-card::before {
  content: "FOREX DESK";
  font-family: "IBM Plex Mono", ui-monospace, monospace;
  letter-spacing: 0.16em;
  font-size: 12px;
  color: var(--accent);
}

.gate-card h2 { font-size: 40px; line-height: 1; }

.brand h1, .gate-card h2 {
  font-family: Fraunces, Georgia, serif;
  font-weight: 560;
  letter-spacing: -0.03em;
}

.field { display: flex; flex-direction: column; gap: 6px; color: var(--muted); font-size: 13px; }

.field input {
  width: 100%;
  border: 1px solid var(--line);
  background: var(--panel);
  border-radius: 12px;
  padding: 12px 14px;
  color: var(--ink);
}

.primary, .quiet {
  border-radius: 999px;
  padding: 12px 16px;
}

.primary { border: 0; background: var(--ink); color: #f8f1e7; }

.quiet { border: 1px solid var(--line); background: var(--panel); }

.gate-error {
  color: var(--sell);
  background: var(--sell-bg);
  border-radius: 12px;
  padding: 10px 12px;
}

.shell { max-width: 1240px; margin: 0 auto; padding: 22px 22px 40px; }

.top {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 20px;
  align-items: center;
  margin-bottom: 16px;
}

.brand h1 { font-size: 32px; line-height: 1; }

.status { color: var(--muted); font-size: 14px; }

.session-user { display: flex; align-items: center; gap: 10px; color: var(--muted); }

.rules {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 14px 16px;
  color: var(--muted);
  line-height: 1.5;
}

.science {
  margin-top: 18px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 18px 18px 14px;
}

.science-head {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 16px;
  align-items: baseline;
  margin-bottom: 14px;
}

.science-head strong {
  font-family: "Fraunces", Georgia, serif;
  font-size: 22px;
  font-weight: 560;
  color: var(--ink);
}

.science-head .muted { font-size: 14px; }

.science-stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin: 0 0 18px;
}

.science-stats span {
  display: flex;
  flex-direction: column;
  gap: 4px;
  background: #fffaf3;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px 14px;
  font-family: "IBM Plex Mono", monospace;
  font-size: 18px;
  color: var(--ink);
}

.science-stats span::before {
  font-family: "Public Sans", sans-serif;
  font-size: 12px;
  color: var(--muted);
}

.science-stats .ok { color: var(--buy); }
.science-stats .bad { color: var(--sell); }
.science-stats .ok::before,
.science-stats .bad::before,
.science-stats .open::before { color: var(--muted); }

.science-stats .wins::before { content: "No alvo"; }
.science-stats .partials::before { content: "No 1º alvo"; }
.science-stats .losses::before { content: "No stop"; }
.science-stats .open::before { content: "Abertas"; }

.science-entries {
  border-top: 1px solid var(--line);
  padding-top: 14px;
}

.science-entries h3 {
  margin: 0 0 10px;
  font-family: "Public Sans", sans-serif;
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.science-list {
  display: grid;
  gap: 0;
  margin: 0;
  padding: 0;
  list-style: none;
  font-size: 13px;
  color: var(--ink);
}

.science-list li,
.science-cols {
  display: grid;
  grid-template-columns: 96px 72px 88px 88px minmax(120px, 1fr);
  gap: 10px;
  align-items: baseline;
  padding: 9px 4px;
}

.science-cols {
  color: var(--muted);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  border-bottom: 1px solid var(--line);
  padding-bottom: 8px;
  margin-bottom: 2px;
}

.science-list li {
  border-bottom: 1px solid rgba(228, 221, 210, 0.65);
}

.science-list li:last-child { border-bottom: 0; }

.science-list .pair { font-family: "IBM Plex Mono", monospace; font-weight: 500; }
.science-list .result { font-family: "IBM Plex Mono", monospace; font-weight: 500; }
.science-list .when { color: var(--muted); }

.science-list .outcome-Win,
.science-list .outcome-Partial,
.science-list .result.ok { color: var(--buy); }
.science-list .outcome-Loss,
.science-list .result.bad { color: var(--sell); }

@media (max-width: 720px) {
  .science-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .science-list li,
  .science-cols {
    grid-template-columns: 72px 56px 72px 72px minmax(0, 1fr);
    gap: 6px;
    font-size: 12px;
  }
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  margin: 14px 0;
}

.segments {
  display: flex;
  gap: 2px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 4px;
}

.segments button {
  border: 0;
  background: transparent;
  border-radius: 999px;
  padding: 8px 12px;
}

.segments button.is-active { background: var(--ink); color: #f8f1e7; }

.desk {
  display: grid;
  grid-template-columns: 360px minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}

.board, .detail {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 20px;
  box-shadow: var(--shadow);
}

.rows { padding: 8px; max-height: calc(100vh - 220px); overflow: auto; }

.row, .empty {
  width: 100%;
  text-align: left;
  border: 0;
  background: transparent;
  border-radius: 14px;
  padding: 12px;
}

.row { cursor: pointer; }

.row + .row { margin-top: 2px; }

.row:hover, .row.is-selected { background: #f6f0e6; }

.row.is-marked { box-shadow: inset 3px 0 0 var(--buy); }

.marks { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; justify-content: flex-end; }

.row-top, .row-levels, .factor-head, .metrics, .detail-top, .cards, .legend {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
}

.pair { font-weight: 600; }

.muted, .legend, footer, .empty, .history { color: var(--muted); }

.symbol { font-family: "IBM Plex Mono", ui-monospace, monospace; font-size: 12px; }

.badge {
  font-size: 12px;
  font-weight: 600;
  border-radius: 999px;
  padding: 4px 8px;
  white-space: nowrap;
}

.badge.Buy, .badge.pips { color: var(--buy); background: var(--buy-bg); }
.badge.Sell { color: var(--sell); background: var(--sell-bg); }
.badge.Wait { color: var(--wait); background: var(--wait-bg); }

.row-levels, .price, .card strong, .metric b, .lots {
  font-family: "IBM Plex Mono", ui-monospace, monospace;
}

.row-levels { margin-top: 8px; font-size: 13px; }

.detail { padding: 20px; }

h2 { font-family: Fraunces, Georgia, serif; font-size: 30px; font-weight: 560; }

.price { font-size: 28px; letter-spacing: -0.03em; text-align: right; }

.summary { margin: 14px 0 8px; line-height: 1.55; }

.history { margin: 0 0 10px; line-height: 1.45; }

.equity, #chart {
  width: 100%;
  background: #fffaf3;
  border: 1px solid var(--line);
  border-radius: 16px;
}

.equity { height: 88px; margin: 0 0 14px; }

#chart { height: 380px; }

.book { display: flex; flex-wrap: wrap; gap: 12px; align-items: end; margin: 0 0 16px; }

.book .field { width: 140px; }

.book .field input { padding: 10px 12px; }

.lots { margin: 0; align-self: center; }

.cards { align-items: stretch; flex-wrap: wrap; gap: 10px; }

.card {
  flex: 1;
  min-width: 120px;
  background: #fffaf3;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 12px;
}

.card span, .metric span { display: block; color: var(--muted); font-size: 12px; }

.card strong, .metric b { display: block; margin-top: 4px; font-weight: 500; }

.metrics { margin: 16px 0; flex-wrap: wrap; gap: 14px 18px; }

.metric { min-width: 110px; }

.factors { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }

ul { margin: 8px 0 0; padding-left: 18px; }

li { margin: 6px 0; line-height: 1.4; }

.chart-wrap { margin-top: 16px; }

.legend { margin-top: 8px; font-size: 13px; justify-content: flex-start; }

.swatch { width: 18px; height: 3px; border-radius: 99px; display: inline-block; }

.swatch.ema { background: var(--accent); }

.swatch.sma { background: #3d6b8a; margin-left: 12px; }

.swatch.channel { background: #5c6b7a; margin-left: 12px; }

.swatch.mid { background: #b0893d; margin-left: 12px; }

.swatch.neutral { background: #9a8b7a; margin-left: 12px; opacity: 0.7; }

.error { color: var(--sell); background: var(--sell-bg); border-radius: 12px; padding: 10px 12px; }

footer { margin-top: 18px; color: var(--muted); font-size: 13px; }

@media (max-width: 980px) {
  .desk, .factors, .top { display: block; }
  .status, .session-user { margin-top: 10px; }
  .rows { max-height: none; }
  .price { text-align: left; margin-top: 8px; }
  #chart { height: 280px; }
}
