/* ==========================================================================
   Orbit Trader — base (tokens, reset, componentes compartilhados)
   ========================================================================== */
:root {
  --bg: #090d14;
  --bg-2: #0c111a;
  --panel: #10161f;
  --panel-2: #141b27;
  --panel-3: #19222f;
  --hover: #1c2636;
  --border: #1c2533;
  --border-2: #263144;
  --text: #e8edf5;
  --text-2: #b7c1d1;
  --muted: #7d889b;
  --faint: #536074;
  --green: #1fca7f;
  --green-2: #16ad6a;
  --green-bg: rgba(31, 202, 127, .12);
  --red: #f2434f;
  --red-2: #d4323e;
  --red-bg: rgba(242, 67, 79, .12);
  --blue: #3d8bfd;
  --blue-bg: rgba(61, 139, 253, .14);
  --yellow: #f5b544;
  --yellow-bg: rgba(245, 181, 68, .13);
  --radius: 10px;
  --radius-sm: 7px;
  --shadow: 0 18px 50px rgba(0, 0, 0, .45);
  --font: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 14px/1.45 var(--font);
  font-feature-settings: 'tnum' 1, 'cv11' 1;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; padding: 0; }
a { color: var(--blue); text-decoration: none; }
[hidden] { display: none !important; }
.num { font-variant-numeric: tabular-nums; }
.up { color: var(--green); }
.down { color: var(--red); }
.muted { color: var(--muted); }

::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb { background: #232d3d; border-radius: 8px; }
::-webkit-scrollbar-track { background: transparent; }

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

/* ---------- Marca ---------- */
.brand { display: inline-flex; align-items: center; gap: 9px; color: var(--text); font-weight: 700; font-size: 17px; letter-spacing: -.01em; white-space: nowrap; }
.brand svg { width: 28px; height: 28px; flex: none; }
.brand b { color: var(--green); font-weight: 700; }

/* ---------- Botões ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 38px; padding: 0 16px; border-radius: var(--radius-sm);
  font-weight: 600; font-size: 14px; white-space: nowrap;
  transition: background .15s, border-color .15s, transform .08s, opacity .15s;
  user-select: none;
}
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn svg { width: 16px; height: 16px; }
.btn-green { background: var(--green); color: #03150b; }
.btn-green:hover { background: #2bd98c; }
.btn-red { background: var(--red); color: #fff; }
.btn-red:hover { background: #ff5561; }
.btn-blue { background: var(--blue); color: #fff; }
.btn-ghost { border: 1px solid var(--border-2); color: var(--text-2); background: transparent; }
.btn-ghost:hover { border-color: #3a475d; color: var(--text); background: var(--panel-2); }
.btn-block { width: 100%; }
.btn-lg { height: 46px; font-size: 15px; }
.btn .spinner { width: 16px; height: 16px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.icon-btn {
  display: inline-grid; place-items: center; width: 32px; height: 32px; border-radius: var(--radius-sm);
  color: var(--muted); transition: background .15s, color .15s;
}
.icon-btn:hover { background: var(--hover); color: var(--text); }
.icon-btn.active { color: var(--text); background: var(--panel-3); }
.icon-btn svg { width: 18px; height: 18px; }

/* ---------- Formulários ---------- */
.field { display: grid; gap: 6px; margin-bottom: 14px; }
.field > label, .field-label { font-size: 12.5px; font-weight: 500; color: var(--text-2); }
.input, .select {
  width: 100%; height: 44px; padding: 0 13px; border-radius: var(--radius-sm);
  background: var(--bg-2); border: 1px solid var(--border-2); color: var(--text);
  transition: border-color .15s, box-shadow .15s; outline: none;
}
.input::placeholder { color: var(--faint); }
.input:focus, .select:focus { border-color: var(--blue); box-shadow: 0 0 0 3px var(--blue-bg); }
.input.invalid, .select.invalid { border-color: var(--red); box-shadow: 0 0 0 3px var(--red-bg); }
/* Tela de toque: 16px evita o zoom automático do iPhone ao tocar num campo */
@media (pointer: coarse) { .input, .select { font-size: 16px; } }
.select { appearance: none; padding-right: 36px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%237d889b' stroke-width='2.5' stroke-linecap='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 13px center; }
.select option { background: var(--panel); }
.input-wrap { position: relative; }
.input-wrap .input { padding-right: 44px; }
.input-wrap .icon-btn { position: absolute; right: 6px; top: 6px; }
.input-prefix { position: relative; }
.input-prefix span { position: absolute; left: 13px; top: 50%; transform: translateY(-50%); color: var(--muted); font-weight: 600; pointer-events: none; }
.input-prefix .input { padding-left: 46px; font-weight: 600; font-size: 16px; }

.check { display: flex; gap: 10px; align-items: flex-start; font-size: 13px; color: var(--text-2); cursor: pointer; line-height: 1.4; }
.check input { width: 17px; height: 17px; margin: 1px 0 0; accent-color: var(--green); flex: none; }

.form-error {
  display: flex; gap: 8px; align-items: flex-start; padding: 10px 12px; margin-bottom: 14px;
  border-radius: var(--radius-sm); background: var(--red-bg); color: #ff8a92; font-size: 13px; border: 1px solid rgba(242, 67, 79, .25);
}

/* Cartões de escolha (moeda, método de pagamento) */
.choice-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.choice-grid.three { grid-template-columns: repeat(3, 1fr); }
.choice {
  position: relative; display: flex; flex-direction: column; gap: 2px; padding: 12px 13px;
  border-radius: var(--radius-sm); border: 1px solid var(--border-2); background: var(--bg-2);
  cursor: pointer; transition: border-color .15s, background .15s;
}
.choice input { position: absolute; opacity: 0; pointer-events: none; }
.choice b { font-size: 15px; }
.choice small { color: var(--muted); font-size: 12px; }
.choice .choice-ico { font-size: 13px; font-weight: 700; color: var(--text-2); margin-bottom: 4px; display: flex; align-items: center; gap: 6px; }
.choice .choice-ico svg { width: 18px; height: 18px; }
.choice:hover { border-color: #39465b; }
.choice:has(input:checked) { border-color: var(--green); background: var(--green-bg); }
.choice:has(input:checked)::after {
  content: ''; position: absolute; top: 9px; right: 9px; width: 16px; height: 16px; border-radius: 50%;
  background: var(--green) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2303150b' stroke-width='4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 12l5 5L20 7'/%3E%3C/svg%3E") center/10px no-repeat;
}
.choice:has(input:focus-visible) { outline: 2px solid var(--blue); outline-offset: 2px; }

.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  height: 30px; padding: 0 12px; border-radius: 999px; border: 1px solid var(--border-2);
  color: var(--text-2); font-size: 12.5px; font-weight: 500; background: transparent; transition: all .15s;
}
.chip:hover { border-color: #3a475d; color: var(--text); }
.chip.active { background: var(--text); color: var(--bg); border-color: var(--text); }

/* ---------- Pílulas / status ---------- */
.pill { display: inline-flex; align-items: center; gap: 7px; height: 26px; padding: 0 11px; border-radius: 999px; background: var(--panel-2); border: 1px solid var(--border); font-size: 12px; font-weight: 500; color: var(--text-2); }
.dot { width: 7px; height: 7px; border-radius: 50%; background: var(--faint); flex: none; }
.dot.live { background: var(--green); box-shadow: 0 0 0 0 rgba(31, 202, 127, .6); animation: pulse 1.8s infinite; }
.dot.warn { background: var(--yellow); }
.dot.off { background: var(--red); }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(31, 202, 127, .55); } 70% { box-shadow: 0 0 0 7px rgba(31, 202, 127, 0); } 100% { box-shadow: 0 0 0 0 rgba(31, 202, 127, 0); } }

.badge { display: inline-flex; align-items: center; height: 20px; padding: 0 7px; border-radius: 5px; font-size: 11px; font-weight: 600; letter-spacing: .02em; }
.badge.green { background: var(--green-bg); color: var(--green); }
.badge.red { background: var(--red-bg); color: var(--red); }
.badge.gray { background: var(--panel-3); color: var(--text-2); }
.badge.yellow { background: var(--yellow-bg); color: var(--yellow); }
.badge.blue { background: var(--blue-bg); color: var(--blue); }

/* ---------- Modal ---------- */
.modal {
  position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; padding: 16px;
  background: rgba(3, 6, 10, .72); backdrop-filter: blur(4px);
  opacity: 0; pointer-events: none; transition: opacity .18s;
}
.modal.open { opacity: 1; pointer-events: auto; }
.modal-card {
  width: 100%; max-width: 460px; max-height: calc(100vh - 32px); max-height: calc(100dvh - 32px); overflow: auto;
  overscroll-behavior: contain;
  background: var(--panel); border: 1px solid var(--border-2); border-radius: 14px; box-shadow: var(--shadow);
  transform: translateY(10px) scale(.98); transition: transform .2s;
}
.modal.open .modal-card { transform: none; }
.modal-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 18px 20px 6px; }
.modal-head h2 { margin: 0; font-size: 18px; font-weight: 700; letter-spacing: -.01em; }
.modal-body { padding: 12px 20px 20px; }
.modal-sub { margin: 0 0 16px; color: var(--muted); font-size: 13px; }

/* ---------- Toasts ---------- */
.toasts { position: fixed; top: 70px; right: 16px; z-index: 200; display: grid; gap: 10px; width: min(340px, calc(100vw - 32px)); pointer-events: none; }
.toast {
  pointer-events: auto; display: flex; gap: 12px; align-items: center; padding: 13px 14px;
  border-radius: 12px; background: var(--panel-2); border: 1px solid var(--border-2); box-shadow: var(--shadow);
  animation: toast-in .25s ease-out;
}
.toast.out { animation: toast-out .25s ease-in forwards; }
.toast .t-ico { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; flex: none; background: var(--panel-3); }
.toast .t-ico svg { width: 18px; height: 18px; }
.toast.win .t-ico { background: var(--green-bg); color: var(--green); }
.toast.loss .t-ico { background: var(--red-bg); color: var(--red); }
.toast.info .t-ico { background: var(--blue-bg); color: var(--blue); }
.toast.warn .t-ico { background: var(--yellow-bg); color: var(--yellow); }
.toast .t-title { font-weight: 600; font-size: 13.5px; }
.toast .t-text { color: var(--muted); font-size: 12.5px; }
.toast .t-amt { margin-left: auto; font-weight: 700; font-size: 15px; white-space: nowrap; }
@keyframes toast-in { from { opacity: 0; transform: translateX(20px); } }
@keyframes toast-out { to { opacity: 0; transform: translateX(20px); } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
