:root {
  --bg: #f4f2fb;
  --panel: #ffffff;
  --ink: #241b45;
  --muted: #6d6786;
  --faint: #948eab;
  --line: #ece8f6;
  --line-strong: #d9d2ee;
  --purple: #6d4aff;
  --purple-deep: #5836e8;
  --purple-soft: #f3efff;
  --brass: #6d4aff;
  --brass-ink: #ffffff;
  --call: #1f9d62;
  --put: #e15b64;
  --wait: #c98612;
  --danger: #d4534a;
  --sans: "Manrope", sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, monospace;
  --shadow: 0 16px 40px rgba(72, 48, 140, 0.08);
  --text: var(--ink);
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; overflow-x: hidden; }
body {
  color: var(--ink);
  font-family: var(--sans);
  background:
    radial-gradient(900px 280px at 50% -40px, rgba(109, 74, 255, 0.16), transparent 70%),
    var(--bg);
}
button, input, select, label { font: inherit; color: inherit; }
button, .chip, .btn, .row, .pick {
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}
button { appearance: none; -webkit-appearance: none; }
img { max-width: 100%; display: block; }
a { color: inherit; }

.shell {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 22px 0 72px;
}

.hero {
  background: linear-gradient(105deg, #6a3df2 0%, #7a56ff 58%, #8b6cff 100%);
  color: #fff;
  border-radius: 28px;
  padding: 22px 24px 26px;
  box-shadow: 0 22px 50px rgba(88, 54, 232, 0.28);
}
.top {
  display: flex;
  gap: 16px;
  align-items: center;
  justify-content: space-between;
}
.brand { display: flex; gap: 12px; align-items: center; min-width: 0; }
.brand strong { display: block; font-size: 18px; font-weight: 750; letter-spacing: -0.03em; }
.brand span { display: block; font-size: 12px; color: rgba(255, 255, 255, 0.78); }
.mark {
  width: 40px;
  height: 40px;
  padding: 8px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.16);
}
.mark rect { fill: #fff; }
.clock {
  margin: 0;
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.04em;
  color: rgba(255, 255, 255, 0.86);
}
.top-actions, .dialog-actions, .compose-actions, .result-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}
.hero .btn.ghost {
  color: #fff;
  border-color: rgba(255, 255, 255, 0.28);
  background: rgba(255, 255, 255, 0.1);
  text-decoration: none;
}
.hero .btn.primary { background: #fff; color: var(--purple-deep); }
.key-pill {
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: 999px;
  padding: 6px 10px;
  font-size: 12px;
  color: #fff;
  background: rgba(255, 255, 255, 0.12);
}
.key-pill.ready { color: #d9ffe9; }
.key-pill.missing { color: #fff4c8; }

.hero-copy { margin-top: 28px; max-width: 680px; }
.kicker {
  display: inline-flex;
  margin: 0 0 10px;
  padding: 5px 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.16);
  font-size: 12px;
  letter-spacing: 0.04em;
}
.hero-copy h1 {
  margin: 0;
  font-size: 40px;
  line-height: 1.05;
  letter-spacing: -0.045em;
  font-weight: 750;
}
.hero-copy p { margin: 10px 0 0; color: rgba(255, 255, 255, 0.86); line-height: 1.5; max-width: 62ch; }

.disclaimer {
  margin: 14px 2px 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.stats {
  display: grid;
  grid-template-columns: 1.4fr repeat(3, 1fr);
  gap: 12px;
  margin-top: 16px;
}
.stat {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 16px;
  min-height: 112px;
  box-shadow: var(--shadow);
}
.stat span, .meta dt, .spec dt {
  color: var(--faint);
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}
.stat strong {
  display: block;
  margin-top: 8px;
  font-size: 32px;
  font-weight: 750;
  letter-spacing: -0.04em;
  color: var(--ink);
}
.stat em { font-style: normal; color: var(--muted); font-size: 12px; }
.stat small { display: block; margin-top: 6px; color: var(--faint); font-size: 12px; line-height: 1.4; }
.meter { display: flex; height: 8px; border-radius: 99px; overflow: hidden; background: #eee9f8; margin-top: 14px; }
.meter i { display: block; height: 100%; }
.meter .call { background: var(--call); }
.meter .put { background: var(--put); }
.meter .wait { background: var(--wait); }
.meter .neutro { background: #c8c2d8; }

.workspace {
  display: grid;
  grid-template-columns: minmax(320px, 0.92fr) minmax(380px, 1.15fr);
  gap: 14px;
  margin-top: 14px;
}
.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 24px;
  padding: 18px;
  box-shadow: var(--shadow);
}
.panel-head { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; }
.eyebrow { margin: 0 0 4px; font-size: 11px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--purple); font-weight: 700; }
.panel h1, h2 { margin: 0; font-size: 26px; letter-spacing: -0.04em; font-weight: 750; }
.lede, .hint { color: var(--muted); }
.lede { margin: 8px 0 14px; line-height: 1.5; font-size: 14px; }

.switch { display: flex; gap: 8px; align-items: center; color: var(--muted); font-size: 13px; }
.switch input { accent-color: var(--purple); width: 16px; height: 16px; }

.slots { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.slot {
  min-height: 210px;
  border-radius: 18px;
  border: 1px dashed #cfc6ee;
  background: linear-gradient(180deg, #f7f4ff, #fff 42%);
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.slot header { display: flex; justify-content: space-between; gap: 8px; align-items: center; }
.slot header strong { font-size: 13px; }
.slot header span, .slot p { color: var(--faint); font-size: 12px; margin: 0; }
.slot .preview {
  flex: 1;
  border-radius: 14px;
  overflow: hidden;
  background: #f3f0fa;
  display: grid;
  place-items: center;
  min-height: 140px;
  border: 0;
  width: 100%;
}
.slot img { width: 100%; height: 160px; object-fit: contain; }
.slot .pick, .text-btn { background: transparent; border: 0; color: var(--purple); padding: 0; font-weight: 700; }
.slot .pick { position: relative; overflow: hidden; }
.file-input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
  font-size: 16px;
}
.text-btn { min-height: 44px; }
.drop-label { text-align: center; padding: 18px 8px; color: var(--purple); }

.btn {
  border-radius: 999px;
  border: 1px solid var(--line-strong);
  background: #fff;
  padding: 10px 14px;
  font-weight: 700;
  transition: transform 0.15s ease, background 0.15s ease;
}
@media (hover: hover) {
  .btn:hover { transform: translateY(-1px); }
}
.btn:disabled, .btn.primary:disabled {
  opacity: 1;
  cursor: not-allowed;
  transform: none;
  background: #ece8f6;
  color: #9b95b2;
  border-color: transparent;
}
.btn.primary { background: var(--purple); color: #fff; border-color: transparent; }
.btn.ghost { color: var(--ink); text-decoration: none; background: #fff; }
.btn.call { background: #e8f8f0; border-color: #b7e7cd; color: #127a49; }
.btn.put { background: #fdecee; border-color: #f4c3c7; color: #b42336; }
.btn.wait { background: #fff6e4; border-color: #f0ddb0; color: #8a5a08; }
.btn.danger { color: var(--put); background: #fff; }
.compose-actions { margin-top: 14px; }
.hint { margin: 0; font-size: 12px; line-height: 1.45; }

.empty {
  min-height: 280px;
  display: grid;
  align-content: center;
  gap: 8px;
  padding: 22px;
  border-radius: 18px;
  background:
    linear-gradient(180deg, #f7f4ff, #fff);
  border: 1px solid var(--line);
}
.empty strong { font-size: 28px; font-weight: 750; letter-spacing: -0.04em; }
.empty p { margin: 0; max-width: 48ch; color: var(--muted); }

.progress { padding: 8px 2px 4px; }
.track { height: 6px; background: #eee9f8; border-radius: 99px; overflow: hidden; }
.track span {
  display: block;
  height: 100%;
  width: 40%;
  background: linear-gradient(90deg, #8b6cff, #6d4aff);
  animation: slide 1.1s ease-in-out infinite;
}
@keyframes slide {
  0% { transform: translateX(-120%); }
  100% { transform: translateX(320%); }
}
.progress ol { margin: 16px 0; padding: 0; list-style: none; display: grid; gap: 8px; }
.progress li { color: var(--faint); font-size: 14px; }
.progress li.on { color: var(--ink); font-weight: 700; }
.elapsed { font-family: var(--mono); color: var(--purple); }

.signal {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-end;
  padding: 16px 16px 14px;
  border-radius: 18px;
  background: linear-gradient(180deg, #f7f4ff, #fff);
  border: 1px solid #e6e0f8;
}
.signal .word {
  font-size: 64px;
  line-height: 0.9;
  letter-spacing: -0.05em;
  margin: 0;
  font-weight: 750;
}
.signal.is-call .word { color: var(--call); }
.signal.is-put .word { color: var(--put); }
.signal.is-wait .word { color: var(--wait); }
.signal.is-neutro .word { color: var(--muted); }
.signal .pattern { margin: 8px 0 0; color: var(--ink); font-size: 18px; font-weight: 700; }
.entry-note {
  margin: 12px 0 0;
  line-height: 1.45;
  padding: 12px 14px;
  border-radius: 14px;
  background: #faf8ff;
  border: 1px solid var(--line);
}
.entry-note.confirmada { background: #eefbf4; border-color: #cfeedd; }
.entry-note.confirmada strong { color: var(--call); }
.entry-note.arriscada { background: #fff8ec; border-color: #f3e2bc; }
.entry-note.arriscada strong { color: #9a6408; }
.entry-note.indeterminada strong { color: var(--muted); }
.signal p { margin: 6px 0 0; color: var(--muted); }
.quality {
  font-size: 12px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--purple);
  font-weight: 700;
}

.banners { display: grid; gap: 8px; margin: 12px 0; }
.banner {
  border-radius: 14px;
  padding: 10px 12px;
  background: #fff8ec;
  color: #8a5a08;
  font-size: 13px;
}
.banner.risk { background: #fdecee; color: #9f2434; }

.spec, .meta { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 16px; margin: 14px 0; }
.spec div, .meta div { border-top: 1px solid var(--line); padding-top: 8px; }
.spec dt, .meta dt { margin: 0; }
.spec dd, .meta dd { margin: 4px 0 0; font-size: 14px; line-height: 1.45; }
.wide { grid-column: 1 / -1; }

.confluences { display: grid; gap: 6px; margin: 8px 0 14px; }
.confluence {
  display: grid;
  grid-template-columns: 18px 1fr;
  gap: 8px;
  align-items: start;
  font-size: 13px;
  padding: 8px 10px;
  border-radius: 12px;
  background: #faf9fd;
}
.pip { width: 8px; height: 8px; border-radius: 99px; margin-top: 5px; background: var(--faint); }
.pip.favoravel { background: var(--call); }
.pip.desfavoravel { background: var(--put); }
.pip.inconclusiva { background: var(--wait); }
.confluence small { display: block; color: var(--faint); }

.shots { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 12px; }
.shots img { height: 140px; width: 100%; object-fit: contain; background: #f6f4fb; border-radius: 14px; border: 1px solid var(--line); }
details { margin-top: 8px; color: var(--muted); }
summary { cursor: pointer; color: var(--ink); font-weight: 700; }
.note {
  width: 100%;
  margin-top: 10px;
  border-radius: 14px;
  border: 1px solid var(--line-strong);
  background: #faf9fd;
  padding: 10px 12px;
  resize: vertical;
  min-height: 64px;
}

.history-panel { margin-top: 14px; }
.filters { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.chip {
  border-radius: 999px;
  border: 1px solid var(--line-strong);
  background: #fff;
  color: var(--muted);
  padding: 7px 12px;
  font-size: 12px;
  font-weight: 700;
}
.chip.on { color: #fff; background: var(--purple); border-color: transparent; }
.strategies { display: flex; gap: 8px; flex-wrap: wrap; margin: 0 0 12px; }
.history { display: grid; gap: 8px; }
.row {
  width: 100%;
  text-align: left;
  display: grid;
  grid-template-columns: 92px 1fr auto;
  gap: 12px;
  align-items: center;
  padding: 8px;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: #faf9fd;
}
.row:hover, .row.active { border-color: #c8b8ff; background: #f6f2ff; }
.row img, .ph {
  width: 92px;
  height: 58px;
  object-fit: cover;
  border-radius: 10px;
  background: #efeaf8;
}
.row strong { display: block; color: var(--ink); }
.row span { color: var(--muted); font-size: 12px; }
.tags { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; justify-content: flex-end; }
.tag {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.04em;
  border-radius: 999px;
  padding: 4px 8px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--muted);
}
.tag.call { color: var(--call); border-color: #b7e7cd; background: #f3fbf7; }
.tag.put { color: var(--put); border-color: #f4c3c7; background: #fff5f6; }
.tag.wait { color: #8a5a08; border-color: #f0ddb0; background: #fffaf0; }
.tag.neutro, .tag.pending, .tag.skip { color: var(--muted); }
.tag.win { color: var(--call); }
.tag.loss { color: var(--put); }
.void { color: var(--faint); padding: 12px 4px 4px; }

dialog {
  width: min(480px, calc(100% - 24px));
  border: 1px solid var(--line);
  border-radius: 24px;
  background: #fff;
  color: var(--ink);
  padding: 18px;
  box-shadow: var(--shadow);
}
dialog::backdrop { background: rgba(36, 27, 69, 0.46); }
dialog p { color: var(--muted); line-height: 1.5; }
dialog label { display: grid; gap: 6px; margin: 12px 0; font-size: 13px; color: var(--muted); }
dialog input, dialog select {
  width: 100%;
  border-radius: 12px;
  border: 1px solid var(--line-strong);
  background: #faf9fd;
  padding: 10px 12px;
}
.dialog-actions { justify-content: flex-end; }
#settings-feedback { min-height: 1.2em; margin-top: 10px; }

.toast {
  position: fixed;
  bottom: 18px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  opacity: 0;
  pointer-events: none;
  background: #241b45;
  color: #fff;
  border-radius: 999px;
  padding: 10px 14px;
  font-size: 13px;
  transition: 0.2s ease;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

@media (max-width: 980px) {
  .top { flex-wrap: wrap; }
  .workspace, .stats, .spec, .meta, .shots { grid-template-columns: 1fr; }
  .hero-copy h1 { font-size: 32px; }
  .signal .word { font-size: 52px; }
  .filters, .tags { justify-content: flex-start; }
  .row { grid-template-columns: 72px 1fr; }
  .tags { grid-column: 1 / -1; }
}

@media (max-width: 720px) {
  .shell {
    width: min(1180px, calc(100% - 16px));
    padding: 10px 0 calc(28px + env(safe-area-inset-bottom));
  }
  .hero { border-radius: 22px; padding: 16px 14px 18px; }
  .brand span { max-width: 46vw; }
  .clock { width: 100%; text-align: left; }
  .top-actions { width: 100%; }
  .top-actions .btn, .key-pill { min-height: 44px; display: inline-flex; align-items: center; justify-content: center; }
  .hero-copy { margin-top: 18px; }
  .hero-copy h1 { font-size: 28px; }
  .panel { padding: 14px; border-radius: 20px; }
  .panel h1 { font-size: 24px; }
  .panel-head { flex-direction: column; }
  .slots { grid-template-columns: 1fr; }
  .slot { min-height: 0; }
  .slot .preview, .slot .pick { min-height: 132px; }
  .compose-actions { display: grid; }
  .compose-actions .btn { width: 100%; min-height: 48px; }
  .chip { min-height: 40px; padding: 8px 12px; }
  .filters {
    flex-wrap: wrap;
    overflow: visible;
    justify-content: flex-start;
    max-width: 100%;
  }
  .result-actions { display: grid; grid-template-columns: 1fr 1fr; }
  .result-actions .btn { min-height: 44px; width: 100%; }
  .signal .word { font-size: 46px; }
  .row { min-height: 76px; }
  dialog {
    width: calc(100% - 16px);
    max-height: calc(100dvh - 16px);
    overflow: auto;
    margin: auto;
  }
  .dialog-actions { display: grid; grid-template-columns: 1fr; }
  .dialog-actions .btn { width: 100%; min-height: 44px; }
}

@media (prefers-reduced-motion: reduce) {
  .track span { animation: none; width: 100%; }
  .btn:hover { transform: none; }
}
