/* =====================================================================
   RoboSniper — Design System (mockups)
   Tokens semânticos → componentes. Tema via [data-theme="dark|light"].
   ===================================================================== */
:root {
  --font-ui: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-num: 'JetBrains Mono', ui-monospace, 'Cascadia Mono', Consolas, monospace;
  --r-sm: 8px; --r-md: 12px; --r-lg: 16px; --r-pill: 999px;
  --ease: cubic-bezier(.22,.61,.36,1);
  --t-fast: 150ms; --t-base: 240ms; --t-slow: 360ms;
  --nav-h: 64px;
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #080C13; --bg-grad: radial-gradient(1200px 500px at 80% -10%, rgba(245,165,36,.08), transparent 60%), radial-gradient(900px 500px at -10% 0%, rgba(77,163,255,.07), transparent 55%);
  --surface: #0F1520; --surface-2: #151D2B; --surface-3: #1B2536;
  --border: #223049; --border-strong: #2E3F5C;
  --text: #E8EDF5; --text-2: #A9B5C8; --muted: #8493AB;
  --primary: #F5A524; --primary-hover: #FFB84D; --primary-text: #F5A524; --on-primary: #1A1203;
  --primary-soft: rgba(245,165,36,.12); --primary-ring: rgba(245,165,36,.45);
  --info: #5AAEFF; --info-soft: rgba(90,174,255,.12);
  --up: #1FCB84; --up-soft: rgba(31,203,132,.12); --up-text: #34D69A;
  --down: #F4506A; --down-soft: rgba(244,80,106,.12); --down-text: #FF7186;
  --warn: #F5A524; --warn-soft: rgba(245,165,36,.12);
  --shadow: 0 1px 0 rgba(255,255,255,.03) inset, 0 8px 24px rgba(0,0,0,.35);
  --nav-bg: rgba(8,12,19,.78);
  --chart-grid: rgba(148,170,204,.08); --chart-text: #8493AB; --ema1: #F5A524; --ema2: #5AAEFF; --ema3: #B79CFF;
  --violet: #B79CFF; --violet-soft: rgba(183,156,255,.14);
}
:root[data-theme="light"] {
  color-scheme: light;
  --bg: #F2F5FA; --bg-grad: radial-gradient(1100px 480px at 85% -10%, rgba(245,165,36,.10), transparent 60%), radial-gradient(900px 480px at -10% 0%, rgba(42,110,200,.07), transparent 55%);
  --surface: #FFFFFF; --surface-2: #F6F8FC; --surface-3: #EBF0F7;
  --border: #DCE3EE; --border-strong: #C6D1E1;
  --text: #0F1B2D; --text-2: #3C4A60; --muted: #5A6980;
  --primary: #F59E0B; --primary-hover: #E08E00; --primary-text: #9A5B00; --on-primary: #1A1203;
  --primary-soft: rgba(245,158,11,.14); --primary-ring: rgba(217,119,6,.5);
  --info: #1F63C4; --info-soft: rgba(31,99,196,.10);
  --up: #0E9F6E; --up-soft: rgba(14,159,110,.11); --up-text: #047857;
  --down: #D92D4A; --down-soft: rgba(217,45,74,.09); --down-text: #BE1E3B;
  --warn: #B45309; --warn-soft: rgba(245,158,11,.14);
  --shadow: 0 1px 2px rgba(16,32,60,.06), 0 8px 24px rgba(16,32,60,.07);
  --nav-bg: rgba(242,245,250,.82);
  --chart-grid: rgba(60,80,120,.09); --chart-text: #5A6980; --ema1: #D97706; --ema2: #1F63C4; --ema3: #7C4DDB;
  --violet: #6D3FD1; --violet-soft: rgba(109,63,209,.11);
}

*,*::before,*::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100vh; font-family: var(--font-ui); font-size: 14px; line-height: 1.5;
  color: var(--text); background: var(--bg); background-image: var(--bg-grad); background-attachment: fixed;
  -webkit-font-smoothing: antialiased; overflow-x: hidden;
}
/* transição suave de tema: aplicada só durante a troca */
html.theme-anim *, html.theme-anim *::before, html.theme-anim *::after {
  transition: background-color var(--t-slow) var(--ease), border-color var(--t-slow) var(--ease),
              color var(--t-slow) var(--ease), fill var(--t-slow) var(--ease), stroke var(--t-slow) var(--ease),
              box-shadow var(--t-slow) var(--ease) !important;
}
::view-transition-old(root), ::view-transition-new(root) { animation: none; mix-blend-mode: normal; }
::view-transition-new(root) { z-index: 9999; }
[hidden] { display: none !important; }
a { color: inherit; text-decoration: none; }
h1,h2,h3,h4 { margin: 0; letter-spacing: -.01em; }
.num { font-family: var(--font-num); font-variant-numeric: tabular-nums; letter-spacing: -.02em; }
.up { color: var(--up-text); } .down { color: var(--down-text); } .muted { color: var(--muted); } .primary-t { color: var(--primary-text); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
svg.i { width: 18px; height: 18px; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }
svg.i.sm { width: 15px; height: 15px; } svg.i.lg { width: 22px; height: 22px; }
:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; border-radius: 6px; }
button { font: inherit; color: inherit; cursor: pointer; }

/* ------------------------------------------------------------ top nav */
.topbar {
  position: sticky; top: 0; z-index: 50; height: var(--nav-h);
  background: var(--nav-bg); backdrop-filter: blur(14px) saturate(140%); -webkit-backdrop-filter: blur(14px) saturate(140%);
  border-bottom: 1px solid var(--border);
}
.topbar-in { height: 100%; max-width: 1680px; margin: 0 auto; padding: 0 20px; display: flex; align-items: center; gap: 24px; }
.brand { display: flex; align-items: center; gap: 10px; flex: none; }
.brand img { height: 42px; width: auto; filter: drop-shadow(0 2px 6px rgba(0,0,0,.25)); }
.brand-txt b { display: block; font-size: 15px; font-weight: 800; letter-spacing: .12em; line-height: 1.1; }
.brand-txt span { font-size: 10.5px; color: var(--muted); letter-spacing: .02em; }
.nav { position: relative; display: flex; gap: 2px; height: 100%; align-items: stretch; overflow-x: auto; scrollbar-width: none; }
.nav::-webkit-scrollbar { display: none; }
.nav a { display: flex; align-items: center; gap: 8px; padding: 0 16px; color: var(--muted); font-weight: 500; font-size: 13.5px; white-space: nowrap;
  transition: color var(--t-fast) var(--ease), background var(--t-fast) var(--ease); border-radius: 8px; margin: 10px 0; }
.nav a:hover { color: var(--text); background: var(--surface-2); }
.nav a[aria-current="page"] { color: var(--primary-text); font-weight: 600; }
.nav-ind { position: absolute; bottom: 0; height: 2px; background: var(--primary); border-radius: 2px 2px 0 0; box-shadow: 0 0 12px var(--primary-ring); left: 0; width: 0; }
.nav-ind.go { transition: left var(--t-slow) var(--ease), width var(--t-slow) var(--ease); }
.top-right { margin-left: auto; display: flex; align-items: center; gap: 12px; }
.tick { display: flex; flex-direction: column; align-items: flex-end; line-height: 1.15; padding-right: 12px; border-right: 1px solid var(--border); }
.tick small { font-size: 10px; color: var(--muted); letter-spacing: .06em; }
.tick b { font-size: 14px; }
.avatar { width: 34px; height: 34px; border-radius: 50%; background: var(--surface-3); border: 1px solid var(--border); display: grid; place-items: center; color: var(--text-2); }

/* theme toggle */
.theme-toggle { position: relative; display: inline-grid; grid-template-columns: 1fr 1fr; width: 72px; height: 36px; padding: 3px; border-radius: var(--r-pill);
  background: var(--surface-2); border: 1px solid var(--border); }
.theme-toggle button { all: unset; position: relative; z-index: 1; display: grid; place-items: center; cursor: pointer; color: var(--muted); border-radius: 50%; transition: color var(--t-base) var(--ease); }
.theme-toggle button:focus-visible { outline: 2px solid var(--primary); }
.theme-toggle::before { content: ""; position: absolute; top: 3px; left: 3px; width: 28px; height: 28px; border-radius: 50%; background: var(--primary);
  box-shadow: 0 2px 8px var(--primary-ring); transition: transform var(--t-slow) cubic-bezier(.34,1.4,.64,1); }
:root[data-theme="light"] .theme-toggle::before { transform: translateX(36px); }
:root[data-theme="dark"] .theme-toggle [data-set="dark"], :root[data-theme="light"] .theme-toggle [data-set="light"] { color: var(--on-primary); }

/* mobile bottom nav */
.bottomnav { display: none; }
@media (max-width: 880px) {
  .brand-txt, .tick { display: none; }
  .topbar-in { padding: 0 14px; gap: 12px; }
  .nav { display: none; }
  .bottomnav { display: grid; grid-template-columns: repeat(5, 1fr); position: fixed; z-index: 60; left: 0; right: 0; bottom: 0; padding: 6px 6px calc(6px + env(safe-area-inset-bottom));
    background: var(--nav-bg); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); border-top: 1px solid var(--border); }
  .bottomnav a { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 6px 0; min-height: 48px; font-size: 10.5px; color: var(--muted); border-radius: 10px; transition: color var(--t-fast), background var(--t-fast); }
  .bottomnav a[aria-current="page"] { color: var(--primary-text); background: var(--primary-soft); font-weight: 600; }
  body { padding-bottom: 72px; }
}

/* ------------------------------------------------------------ layout */
.page { max-width: 1680px; margin: 0 auto; padding: 20px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 16px; flex-wrap: wrap; }
.page-head h1 { font-size: 22px; font-weight: 700; }
.page-head p { margin: 2px 0 0; color: var(--muted); font-size: 13px; }
.grid { display: grid; gap: 14px; }
.row { display: flex; gap: 12px; align-items: center; } .wrap { flex-wrap: wrap; } .grow { flex: 1; } .between { justify-content: space-between; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); box-shadow: var(--shadow); }
.card-p { padding: 16px; }
.card-h { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 12px 16px; border-bottom: 1px solid var(--border); font-weight: 600; font-size: 13px; }
.card-h .sub { color: var(--muted); font-weight: 400; font-size: 12px; }
.label { font-size: 11px; color: var(--muted); letter-spacing: .05em; text-transform: uppercase; font-weight: 500; }
.divider { height: 1px; background: var(--border); margin: 14px 0; border: 0; }

/* entrada de página + stagger */
@keyframes rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@keyframes leave { to { opacity: 0; transform: translateY(-6px); } }
.rise { opacity: 0; animation: rise var(--t-slow) var(--ease) forwards; animation-delay: calc(var(--i, 0) * 55ms + 40ms); }
body.leaving main { animation: leave 170ms ease-in forwards; }
.fade-swap { animation: rise var(--t-base) var(--ease); }

/* ------------------------------------------------------------ controls */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 40px; padding: 0 16px; border-radius: var(--r-md); border: 1px solid var(--border-strong);
  background: var(--surface-2); color: var(--text); font-weight: 600; font-size: 13.5px; transition: transform var(--t-fast) var(--ease), background var(--t-fast), border-color var(--t-fast), box-shadow var(--t-base), opacity var(--t-fast); }
.btn:hover { background: var(--surface-3); border-color: var(--muted); }
.btn:active { transform: scale(.97); }
.btn.primary { background: var(--primary); border-color: transparent; color: var(--on-primary); box-shadow: 0 4px 16px var(--primary-ring); }
.btn.primary:hover { background: var(--primary-hover); }
.btn.buy { background: var(--up); border-color: transparent; color: #04170F; box-shadow: 0 4px 16px color-mix(in srgb, var(--up) 40%, transparent); }
.btn.sell { background: var(--down); border-color: transparent; color: #fff; box-shadow: 0 4px 16px color-mix(in srgb, var(--down) 40%, transparent); }
.btn.buy:hover, .btn.sell:hover { filter: brightness(1.08); }
.btn.ghost { background: transparent; border-color: var(--border); }
.btn.danger { background: var(--down-soft); border-color: transparent; color: var(--down-text); }
.btn.lg { min-height: 52px; font-size: 15px; letter-spacing: .02em; }
.btn.sm { min-height: 32px; padding: 0 12px; font-size: 12.5px; border-radius: 9px; }
.btn.block { width: 100%; }
.btn[disabled] { opacity: .45; pointer-events: none; }
.btn .spin { 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); } }

.field { display: grid; gap: 6px; }
.field > label { font-size: 12px; color: var(--text-2); font-weight: 500; }
.input, select.input { width: 100%; min-height: 40px; padding: 0 12px; border-radius: var(--r-md); border: 1px solid var(--border-strong); background: var(--surface-2); color: var(--text);
  font: inherit; transition: border-color var(--t-fast), box-shadow var(--t-fast), background var(--t-fast); }
.input.num { font-family: var(--font-num); }
.input:hover { border-color: var(--muted); }
.input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
.input-wrap { position: relative; } .input-wrap .i { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--muted); }
.input-wrap .input { padding-left: 38px; }
.help { font-size: 12px; color: var(--muted); }
select.input { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%238493AB' stroke-width='2' stroke-linecap='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; padding-right: 34px; }

.seg { display: inline-flex; padding: 3px; gap: 2px; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--r-md); }
.seg button { all: unset; cursor: pointer; padding: 6px 12px; border-radius: 9px; font-size: 12.5px; font-weight: 500; color: var(--muted); transition: all var(--t-fast) var(--ease); min-height: 20px; }
.seg button:hover { color: var(--text); }
.seg button[aria-pressed="true"], .seg button[aria-selected="true"] { background: var(--surface); color: var(--text); box-shadow: 0 1px 3px rgba(0,0,0,.25); font-weight: 600; }
.seg button:focus-visible { outline: 2px solid var(--primary); }

.switch { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 8px 0; cursor: pointer; position: relative; }
.switch .tx { font-size: 13px; } .switch .tx small { display: block; color: var(--muted); font-size: 11.5px; }
.switch input { position: absolute; opacity: 0; }
.switch .tg { flex: none; width: 40px; height: 22px; border-radius: 999px; background: var(--border-strong); position: relative; transition: background var(--t-base) var(--ease); }
.switch .tg::after { content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: transform var(--t-base) cubic-bezier(.34,1.4,.64,1); box-shadow: 0 1px 3px rgba(0,0,0,.4); }
.switch input:checked + .tg { background: var(--primary); } .switch input:checked + .tg::after { transform: translateX(18px); }
.switch input:focus-visible + .tg { outline: 2px solid var(--primary); outline-offset: 2px; }

input[type=range] { -webkit-appearance: none; appearance: none; width: 100%; height: 22px; background: transparent; cursor: pointer; --p: 50%; }
input[type=range]::-webkit-slider-runnable-track { height: 6px; border-radius: 6px; background: linear-gradient(to right, var(--primary) var(--p), var(--border-strong) var(--p)); }
input[type=range]::-moz-range-track { height: 6px; border-radius: 6px; background: var(--border-strong); } input[type=range]::-moz-range-progress { height: 6px; border-radius: 6px; background: var(--primary); }
input[type=range]::-webkit-slider-thumb { -webkit-appearance: none; width: 18px; height: 18px; margin-top: -6px; border-radius: 50%; background: #fff; border: 3px solid var(--primary); box-shadow: 0 1px 4px rgba(0,0,0,.4); transition: transform var(--t-fast); }
input[type=range]:active::-webkit-slider-thumb { transform: scale(1.15); }
input[type=range]::-moz-range-thumb { width: 14px; height: 14px; border-radius: 50%; background: #fff; border: 3px solid var(--primary); }

.pill { display: inline-flex; align-items: center; gap: 6px; padding: 2px 10px; border-radius: var(--r-pill); font-size: 11.5px; font-weight: 600; line-height: 20px; background: var(--surface-3); color: var(--text-2); white-space: nowrap; }
.pill.up { background: var(--up-soft); color: var(--up-text); } .pill.down { background: var(--down-soft); color: var(--down-text); }
.pill.warn { background: var(--warn-soft); color: var(--warn); } .pill.info { background: var(--info-soft); color: var(--info); }
.dot { width: 8px; height: 8px; border-radius: 50%; background: currentColor; flex: none; }
.dot.live { animation: pulse 1.8s ease-in-out infinite; }
@keyframes pulse { 0%,100% { box-shadow: 0 0 0 0 color-mix(in srgb, currentColor 55%, transparent); } 50% { box-shadow: 0 0 0 6px transparent; } }
.mode { padding: 3px 10px; border-radius: 6px; font-size: 11px; font-weight: 800; letter-spacing: .1em; }
.mode.demo { background: var(--warn-soft); color: var(--warn); } .mode.real { background: var(--down-soft); color: var(--down-text); }

.progress { height: 8px; border-radius: 8px; background: var(--surface-3); overflow: hidden; }
.progress > i { display: block; height: 100%; width: 0; border-radius: 8px; background: linear-gradient(90deg, var(--primary), var(--primary-hover)); transition: width .6s var(--ease); }

/* stat tiles */
.stats { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(min(170px, 100%), 1fr)); }
.stat { padding: 14px 16px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-md); transition: transform var(--t-base) var(--ease), border-color var(--t-base); }
.stat:hover { transform: translateY(-2px); border-color: var(--border-strong); }
.stat .v { font-size: 22px; font-weight: 700; margin-top: 4px; line-height: 1.2; }
.stat .d { font-size: 12px; margin-top: 2px; }
.stat.hl { border-color: color-mix(in srgb, var(--primary) 40%, var(--border)); background: linear-gradient(180deg, var(--primary-soft), transparent 70%), var(--surface); }

/* tables */
.tbl-wrap { overflow: auto; border: 1px solid var(--border); border-radius: var(--r-md); max-height: 460px; background: var(--surface); }
table.tbl { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 12.5px; }
.tbl th { position: sticky; top: 0; z-index: 1; background: var(--surface-2); color: var(--muted); font-weight: 600; font-size: 11px; letter-spacing: .05em; text-transform: uppercase; text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--border); white-space: nowrap; }
.tbl td { padding: 10px 12px; border-bottom: 1px solid var(--border); white-space: nowrap; transition: background var(--t-fast); }
.tbl tr:last-child td { border-bottom: 0; } .tbl tbody tr:hover td { background: var(--surface-2); }
.tbl .r { text-align: right; } .tbl .num { font-size: 12.5px; }

/* accordion */
details.acc { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-md); overflow: hidden; transition: border-color var(--t-base); }
details.acc[open] { border-color: var(--border-strong); }
details.acc > summary { list-style: none; display: flex; align-items: center; gap: 10px; padding: 14px 16px; cursor: pointer; font-weight: 600; font-size: 13.5px; min-height: 48px; transition: background var(--t-fast); }
details.acc > summary::-webkit-details-marker { display: none; }
details.acc > summary:hover { background: var(--surface-2); }
details.acc > summary .chev { margin-left: auto; color: var(--muted); transition: transform var(--t-base) var(--ease); }
details.acc[open] > summary .chev { transform: rotate(180deg); }
details.acc .acc-b { padding: 4px 16px 16px; animation: rise var(--t-base) var(--ease); }

.callout { display: flex; gap: 10px; padding: 12px 14px; border-radius: var(--r-md); font-size: 12.5px; border: 1px solid transparent; }
.callout.warn { background: var(--warn-soft); color: var(--text); border-color: color-mix(in srgb, var(--warn) 35%, transparent); }
.callout.warn svg { color: var(--warn); }
.callout.info { background: var(--info-soft); border-color: color-mix(in srgb, var(--info) 30%, transparent); } .callout.info svg { color: var(--info); }
.callout.ok { background: var(--up-soft); border-color: color-mix(in srgb, var(--up) 30%, transparent); } .callout.ok svg { color: var(--up-text); }

.toast { position: fixed; right: 20px; bottom: 20px; z-index: 100; display: flex; gap: 10px; align-items: center; padding: 12px 16px; border-radius: var(--r-md); background: var(--surface-3); border: 1px solid var(--border-strong); box-shadow: var(--shadow); transform: translateY(20px); opacity: 0; pointer-events: none; transition: all var(--t-base) var(--ease); max-width: calc(100vw - 40px); }
.toast.show { transform: none; opacity: 1; }
@media (max-width: 880px) { .toast { bottom: 84px; right: 14px; } }

canvas.chart { display: block; width: 100%; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }

/* ------------------------------------------------------------ trading */
.tr-grid { display: grid; gap: 14px; grid-template-columns: 250px minmax(0,1fr) 340px; align-items: stretch; }
.tr-grid > aside.card { display: flex; flex-direction: column; }
.tr-grid > aside.card > .card-p, .tr-grid > aside.card > #book, .tr-grid > aside.card > #mkt { flex: 1; }
.tr-grid > aside.card > #vivo:not([hidden]), .tr-grid > aside.card > #meus:not([hidden]) { display: flex; flex-direction: column; }
#vivo > .pos-card { flex: 1; display: flex; flex-direction: column; } #vivo > .pos-card .pos-grid { margin-bottom: auto; }
/* (breakpoints do grid de trading: ver bloco "trading+" no fim do arquivo) */
.ticker-bar { display: flex; flex-wrap: wrap; gap: 8px 28px; padding: 14px 18px; align-items: center; }
.ticker-bar .big { font-size: 28px; font-weight: 700; line-height: 1; }
.ticker-bar .sep { width: 1px; align-self: stretch; background: var(--border); }
.ticker-bar .kv small { display: block; font-size: 10.5px; color: var(--muted); letter-spacing: .04em; text-transform: uppercase; }
.ticker-bar .kv b { font-size: 13.5px; font-weight: 600; }
.ob-row { position: relative; display: grid; grid-template-columns: 1.2fr 1fr 1fr; padding: 2.5px 12px; font-size: 12px; overflow: hidden; }
.ob-row i { position: absolute; top: 0; bottom: 0; right: 0; opacity: .14; transition: width var(--t-slow) var(--ease); }
.ob-row.ask i { background: var(--down); } .ob-row.bid i { background: var(--up); }
.ob-row span { position: relative; } .ob-row span:nth-child(n+2) { text-align: right; color: var(--text-2); }
.ob-mid { text-align: center; padding: 8px; font-size: 18px; font-weight: 700; border-block: 1px solid var(--border); background: var(--surface-2); }
.ob-head { display: grid; grid-template-columns: 1.2fr 1fr 1fr; padding: 8px 12px; font-size: 10.5px; color: var(--muted); letter-spacing: .05em; text-transform: uppercase; }
.ob-head span:nth-child(n+2) { text-align: right; }
.auto-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; padding: 12px 14px; border-radius: var(--r-md); border: 1px solid color-mix(in srgb, var(--up) 45%, var(--border)); background: linear-gradient(90deg, var(--up-soft), transparent 80%), var(--surface); }
.auto-bar .st { flex: 1; min-width: 180px; padding: 5px 12px; border-radius: 8px; background: var(--info-soft); color: var(--info); font-size: 12.5px; }
.order-panel { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.pos-card { padding: 14px; border-radius: var(--r-md); border: 1px solid var(--border); background: var(--surface-2); position: relative; overflow: hidden; transition: transform var(--t-base) var(--ease), border-color var(--t-base); }
.pos-card::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--c); }
.pos-card:hover { transform: translateY(-2px); border-color: var(--border-strong); }
.pos-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 14px; margin-top: 10px; }
.pos-grid small { display: block; font-size: 10.5px; color: var(--muted); letter-spacing: .04em; text-transform: uppercase; }
.pos-grid b { font-size: 13px; font-weight: 600; }
.sltp { position: relative; height: 6px; border-radius: 6px; margin: 16px 0 6px; background: linear-gradient(90deg, var(--down) 0 33%, var(--border-strong) 33% 55%, var(--up) 55% 100%); opacity: .9; }
.sltp i { position: absolute; top: -5px; width: 4px; height: 16px; border-radius: 3px; background: var(--text); box-shadow: 0 0 0 3px var(--surface-2); transition: left var(--t-slow) var(--ease); }

/* ------------------------------------------------------------ profile cards */
.profiles { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.profile { position: relative; text-align: left; padding: 16px; border-radius: var(--r-lg); border: 1.5px solid var(--border); background: var(--surface); transition: all var(--t-base) var(--ease); }
.profile:hover { transform: translateY(-3px); border-color: var(--border-strong); }
.profile[aria-pressed="true"] { border-color: var(--pc); background: linear-gradient(180deg, color-mix(in srgb, var(--pc) 12%, transparent), transparent 75%), var(--surface); box-shadow: 0 8px 28px color-mix(in srgb, var(--pc) 22%, transparent); }
.profile .ic { width: 38px; height: 38px; border-radius: 10px; display: grid; place-items: center; background: color-mix(in srgb, var(--pc) 16%, transparent); color: var(--pc); margin-bottom: 10px; }
.profile h3 { font-size: 15px; } .profile p { margin: 4px 0 12px; font-size: 12.5px; color: var(--muted); }
.profile dl { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 10px; margin: 0; }
.profile dt { font-size: 10.5px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; } .profile dd { margin: 0; font-weight: 600; font-family: var(--font-num); font-size: 13px; }
.profile .chk { position: absolute; top: 14px; right: 14px; width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; background: var(--pc); color: #fff; transform: scale(0); transition: transform var(--t-base) cubic-bezier(.34,1.5,.64,1); }
.profile[aria-pressed="true"] .chk { transform: scale(1); }

.two { display: grid; gap: 14px; grid-template-columns: 1fr 1fr; } .three { display: grid; gap: 12px; grid-template-columns: repeat(3, 1fr); }
@media (max-width: 880px) { .two, .three { grid-template-columns: minmax(0,1fr); } .page { padding: 14px; } }

/* Login */
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 24px; position: relative; overflow: hidden; }
.login-wrap::before, .login-wrap::after { content: ""; position: absolute; border-radius: 50%; filter: blur(80px); opacity: .5; pointer-events: none; }
.login-wrap::before { width: 420px; height: 420px; background: var(--primary-soft); top: -100px; right: -80px; }
.login-wrap::after { width: 380px; height: 380px; background: var(--info-soft); bottom: -120px; left: -80px; }
.login-card { position: relative; width: 100%; max-width: 410px; padding: 32px 28px; z-index: 1; }
.login-top { position: absolute; top: 16px; right: 16px; z-index: 2; }

.guide-art { background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--r-md); padding: 8px; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
  .rise { opacity: 1; }
}

/* =====================================================================
   Aplicação web — complementos ao design do mockup
   ===================================================================== */
.skip-link { position: absolute; left: 8px; top: -48px; z-index: 200; padding: 10px 14px; border-radius: var(--r-md); background: var(--primary); color: var(--on-primary); font-weight: 700; transition: top var(--t-fast); }
.skip-link:focus { top: 8px; }
main.page:focus { outline: none; }
button.avatar { padding: 0; cursor: pointer; font: inherit; transition: color var(--t-fast), background var(--t-fast), border-color var(--t-fast); }
button.avatar:hover { color: var(--text); background: var(--surface-2); border-color: var(--border-strong); }
.avatar { width: 40px; height: 40px; }
.tick.stale b { opacity: .5; }
.tick b.up, .tick b.down { transition: color var(--t-base); }
.dot.warn { color: var(--warn); } .dot.muted { color: var(--muted); }

/* piscar ao mudar valor */
@keyframes flash-up { from { background: var(--up-soft); } to { background: transparent; } }
@keyframes flash-down { from { background: var(--down-soft); } to { background: transparent; } }
.flash-up { animation: flash-up .7s var(--ease); } .flash-down { animation: flash-down .7s var(--ease); }

/* esqueleto de carregamento */
@keyframes shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }
.skeleton { border-radius: var(--r-sm); min-height: 14px; background: linear-gradient(90deg, var(--surface-2) 25%, var(--surface-3) 50%, var(--surface-2) 75%); background-size: 200% 100%; animation: shimmer 1.6s linear infinite; }

/* modal */
dialog.modal { padding: 22px; width: min(440px, calc(100vw - 32px)); color: var(--text); border: 1px solid var(--border-strong); background: var(--surface); box-shadow: 0 24px 64px rgba(0,0,0,.5); }
dialog.modal::backdrop { background: rgba(4,8,14,.62); backdrop-filter: blur(3px); }
dialog.modal[open] { animation: rise var(--t-base) var(--ease); }

/* botões / pills extras */
:root[data-theme="dark"] .btn.sell { color: #1B040A; }
.btn.sell:focus-visible, .btn.buy:focus-visible { outline-offset: 3px; }
.pill.violet { background: var(--violet-soft); color: var(--violet); }
.help.err, .field-err { color: var(--down-text); font-size: 12px; }
.input[aria-invalid="true"] { border-color: var(--down); }
.login-wrap .callout { margin: 0; }

/* ---------------------------------------------------------------- trading+ */
.tr-grid { --book-w: 250px; --side-w: 340px; grid-template-columns: var(--book-w) minmax(0,1fr) var(--side-w); transition: grid-template-columns .3s var(--ease); }
.tr-grid.book-collapsed { --book-w: 22px; } .tr-grid.side-collapsed { --side-w: 22px; }
.tr-grid > aside.card { position: relative; min-width: 0; }
.tr-grid > aside.card > .panel { flex: 1; min-height: 0; }
.tr-grid > aside.card > .panel:not([hidden]) { display: flex; flex-direction: column; }
@media (max-width: 1279px) { .tr-grid { grid-template-columns: minmax(0,1fr) var(--side-w); } }
@media (min-width: 981px) and (max-width: 1279px) { .tr-book { display: none !important; } }
@media (max-width: 980px) { .tr-grid { grid-template-columns: minmax(0,1fr); } .strip { display: none !important; } }

/* tiras de recolher (laterais) */
.strip { position: absolute; z-index: 5; top: 50%; transform: translateY(-50%); width: 14px; height: 52px; padding: 0; display: grid; place-items: center;
  background: var(--surface-2); border: 1px solid var(--border); color: var(--muted); cursor: pointer; opacity: .9; transition: opacity var(--t-fast), color var(--t-fast), background var(--t-fast); }
.strip svg.i { width: 11px; height: 11px; stroke-width: 2.4; }
.strip:hover { opacity: 1; color: var(--info); background: var(--info-soft); }
.strip.r { right: 0; border-left: 0; border-radius: 0 6px 6px 0; box-shadow: 2px 0 8px rgba(0,0,0,.25); }
.strip.l { left: 0; border-right: 0; border-radius: 6px 0 0 6px; box-shadow: -2px 0 8px rgba(0,0,0,.25); }
.collapsed > *:not(.strip) { display: none !important; }
.collapsed .strip { top: 0; bottom: 0; transform: none; width: 100%; height: 100%; border: 0; border-radius: var(--r-lg); box-shadow: none; }
.collapsed .strip svg.i { width: 14px; height: 14px; }

/* barra de mercado */
.ticker-bar .big { min-width: 8ch; }
.ticker-bar .push { margin-left: auto; display: flex; gap: 8px; align-items: center; }

/* livro de ordens */
.ob-row { min-height: 21px; }
.ob-row span { white-space: nowrap; }
.ob-mid { transition: color var(--t-base); }
.ob-empty { padding: 28px 16px; text-align: center; color: var(--muted); font-size: 12.5px; }
.ob-scroll { max-height: 420px; overflow: auto; }

/* barra do bot automático */
.auto-bar.idle { border-color: var(--border); background: var(--surface); }
.auto-bar.warnbar { border-color: color-mix(in srgb, var(--warn) 55%, var(--border)); background: linear-gradient(90deg, var(--warn-soft), transparent 80%), var(--surface); }
.auto-bar.downbar { border-color: color-mix(in srgb, var(--down) 50%, var(--border)); background: linear-gradient(90deg, var(--down-soft), transparent 80%), var(--surface); }
.auto-bar .st { transition: background var(--t-base), color var(--t-base); }
.auto-bar .st.info { background: var(--info-soft); color: var(--info); }
.auto-bar .st.up { background: var(--up-soft); color: var(--up-text); }
.auto-bar .st.down { background: var(--down-soft); color: var(--down-text); }
.auto-bar .st.warn { background: var(--warn-soft); color: var(--warn); }
.auto-bar .st.muted { background: var(--surface-3); color: var(--muted); }
.auto-bar .st b.up { color: var(--up-text); } .auto-bar .st b.down { color: var(--down-text); }
.auto-bar .ttl { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 13px; white-space: nowrap; }
.auto-bar .cap { flex: 1 1 100%; order: 9; color: var(--muted); font-size: 12px; }
.auto-bar.idle .ttl { margin-right: auto; }
.auto-bar .cap b { color: var(--text-2); font-weight: 600; }
.auto-bar select.input { width: auto; min-width: 150px; }
.auto-bar .switch { padding: 0; gap: 10px; min-height: 40px; }
.auto-bar .switch .tx { font-size: 12.5px; color: var(--text-2); }
.auto-bar .grow-bar { flex: 1; min-width: 140px; }
.auto-det { flex-basis: 100%; display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; padding-top: 10px; border-top: 1px dashed var(--border); font-size: 12.5px; }
.auto-det .k { font-size: 11px; color: var(--muted); letter-spacing: .05em; text-transform: uppercase; font-weight: 500; }
.auto-det .c { display: inline-flex; align-items: center; gap: 5px; }
.auto-det .m { color: var(--muted); }
.sc-up, .t-up { color: var(--up-text); } .sc-warn, .t-warn { color: var(--warn); } .sc-mut { color: var(--muted); } .t-down { color: var(--down-text); }

/* gráfico */
.lwc { position: relative; height: 430px; width: 100%; }
@media (max-width: 699px) { .lwc { height: 300px; } }
.chart-body { position: relative; padding: 8px 8px 4px; }
.ohlc { position: absolute; z-index: 3; left: 16px; top: 12px; display: flex; flex-wrap: wrap; gap: 2px 10px; font-size: 11px; pointer-events: none; color: var(--text-2); padding: 2px 6px; border-radius: 6px; }
.ohlc span { color: var(--muted); margin-right: 3px; } .ohlc b { font-weight: 500; }
.chart-loading { position: absolute; inset: 8px; display: grid; place-items: center; color: var(--muted); font-size: 13px; pointer-events: none; }

/* ordem manual */
.order-msg { margin-top: 12px; animation: rise var(--t-base) var(--ease); }

/* posições */
.pos-stack { display: grid; gap: 12px; flex: 1; align-content: start; }
.pos-card .pos-grid { margin-bottom: auto; }
.pos-card .sltp { background: linear-gradient(90deg, var(--down) 0 calc(var(--ent, 38%) - 3%), var(--border-strong) calc(var(--ent, 38%) - 3%) calc(var(--ent, 38%) + 3%), var(--up) calc(var(--ent, 38%) + 3%) 100%); }
.pos-card .sltp i { margin-left: -2px; }
.empty { padding: 26px 8px; text-align: center; color: var(--muted); font-size: 13px; }
.empty .i { width: 28px; height: 28px; margin: 0 auto 8px; display: block; opacity: .6; }
.tbl-wrap.compact .tbl th, .tbl-wrap.compact .tbl td { padding: 9px 8px; font-size: 12px; }

/* diagnóstico / registro */
.diag-row { display: grid; gap: 3px; padding: 10px 12px; border-radius: 8px; border-left: 3px solid var(--c); background: var(--bgc); }
.diag-row.ok { --c: var(--up-text); --bgc: var(--up-soft); }
.diag-row.opcional { --c: var(--warn); --bgc: var(--warn-soft); }
.diag-row.aguarda { --c: var(--down-text); --bgc: var(--down-soft); }
.diag-row .t { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.diag-row .t b { font-size: 13px; }
.diag-row .d { font-size: 11.5px; color: var(--muted); }
.diag-row .kvs { display: flex; flex-wrap: wrap; gap: 4px 18px; margin-top: 3px; font-size: 12px; }
.diag-row .kvs small { color: var(--muted); font-size: 10.5px; letter-spacing: .04em; text-transform: uppercase; margin-right: 6px; }
.diag-pend { font-size: 12px; padding: 2px 0 2px 8px; border-left: 2px solid var(--down-text); margin-top: 6px; }
.log-line { display: flex; gap: 10px; line-height: 1.45; }
.log-line .ts { color: var(--muted); flex: none; }
.log-line .tx { overflow-wrap: anywhere; }
.log-line .tx.up { color: var(--up-text); } .log-line .tx.down { color: var(--down-text); } .log-line .tx.warn { color: var(--warn); }
.acc > summary:focus-visible { outline-offset: -2px; }
.two > details.acc { align-self: start; min-width: 0; }

@media (max-width: 880px) {
  .ticker-bar { gap: 8px 20px; padding: 12px 14px; }
  .ticker-bar .sep { display: none; }
}
@media (max-width: 560px) { .ticker-bar .kv { min-width: 40%; } .ticker-bar > div:first-child { flex-basis: 100%; } }

.chips span { white-space: nowrap; }
.card-h { flex-wrap: wrap; }
@media (max-width: 980px) { .tr-book .strip { display: none; } .tr-book .ob-scroll { max-height: 320px; } }
@media (max-width: 560px) { .ohlc { display: none; } }

/* Meus trades: a tabela ocupa todo o cartao ate a base e rola por dentro (sem esticar a linha) */
.tr-grid > aside.card > .panel.meus { position: relative; min-height: 240px; }
.tr-grid > aside.card > .panel.meus > .tbl-wrap { position: absolute; inset: 16px; max-height: none; }
.tr-grid > aside.card > .panel.meus > .empty { margin: 8px 0; }
@media (max-width: 980px) { .tr-grid > aside.card > .panel.meus { min-height: 420px; } }
/* barras de rolagem discretas, no tema */
.tbl-wrap, .tr-grid * { scrollbar-width: thin; scrollbar-color: var(--border-strong) transparent; }
.tbl-wrap::-webkit-scrollbar { width: 10px; height: 10px; }
.tbl-wrap::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 8px; border: 2px solid var(--surface); }
.tbl-wrap::-webkit-scrollbar-track, .tbl-wrap::-webkit-scrollbar-corner { background: transparent; }
.tr-grid > aside.card .tbl-wrap.compact .tbl th, .tr-grid > aside.card .tbl-wrap.compact .tbl td { padding: 9px 5px; font-size: 11.5px; }
.tr-grid > aside.card .tbl-wrap.compact .tbl th:first-child, .tr-grid > aside.card .tbl-wrap.compact .tbl td:first-child { padding-left: 10px; }
.tr-grid > aside.card .tbl-wrap.compact .pill { padding: 1px 7px; font-size: 11px; }
.tr-grid > aside.card .tbl-wrap.compact .tbl th { letter-spacing: .02em; }

.tr-grid > aside.card .tbl-wrap.compact { overflow-x: hidden; }
.tr-grid > aside.card .tbl-wrap.compact .tbl { table-layout: auto; width: 100%; }
.tr-grid > aside.card .tbl-wrap.compact .tbl th, .tr-grid > aside.card .tbl-wrap.compact .tbl td { padding: 8px 4px; font-size: 11px; }
.tr-grid > aside.card .tbl-wrap.compact .tbl th { font-size: 10px; letter-spacing: .01em; }
.tr-grid > aside.card .tbl-wrap.compact .pill { padding: 1px 6px; font-size: 10.5px; }

/* Livro: ocupa o cartao ate a base; mostra tantos niveis quantos couberem (asks coladas ao preco medio) */
.tr-book .panel > .ob-head { flex: none; }
.tr-book .panel > .ob-mid { flex: none; }
.tr-book .panel > .ob-asks, .tr-book .panel > .ob-bids, .tr-book .panel > .ob-scroll { flex: 1 1 0; min-height: 0; overflow: hidden; }
.tr-book .panel > .ob-asks { display: flex; flex-direction: column; justify-content: flex-end; }
.tr-book .panel > .ob-asks[hidden], .tr-book .panel > .ob-bids[hidden] { display: none; }
.tr-book .panel > .ob-scroll { overflow-y: auto; }
@media (max-width: 980px) { .tr-book .panel { min-height: 560px; } }
.tr-book .panel > .ob-scroll { max-height: none; }
@media (max-width: 980px) { .tr-book .panel > .ob-scroll { max-height: none; } }
@media (max-width: 980px) { .tr-grid > aside.tr-book > .panel:not([hidden]) { min-height: 560px; } }
/* coluna central do Trading: nunca alarga alem da sua faixa (antes o conteudo empurrava e o painel lateral ficava por cima) */
.tr-grid > section.grid, .tr-grid > section.grid > .grid { grid-template-columns: minmax(0, 1fr); min-width: 0; }
.tr-grid > section.grid > *, .tr-grid > section.grid .card { min-width: 0; max-width: 100%; }
.tr-grid > section.grid .auto-bar, .tr-grid > section.grid .auto-det { flex-wrap: wrap; min-width: 0; }
.tr-grid > section.grid .auto-bar .st { min-width: 0; overflow-wrap: anywhere; }
