/* CryptoCodex V2 interface (block 9): mobile first, light/dark tokens, no framework. */
:root {
  --bg: #F5F6F8; --surface: #FFFFFF; --line: #E2E5EA; --chip: #EEF0F3; --text: #12161C; --muted: #56606D;
  --accent: #2563EB; --accent-soft: rgba(37,99,235,.10); --accent-text: #1D4ED8; --on-accent: #FFFFFF;
  --up: #16A34A; --up-soft: rgba(22,163,74,.12); --up-text: #15803D; --down-text: #C2410C; --down-soft: rgba(194,65,12,.10);
  --warn: #D97706; --warn-soft: rgba(217,119,6,.12); --warn-text: #9A5200;
  --radius: 16px; --shadow: 0 1px 2px rgba(16,24,40,.04);
  --font: 'Geist', system-ui, -apple-system, 'Segoe UI', sans-serif; --mono: 'Geist Mono', ui-monospace, 'SFMono-Regular', monospace;
  color-scheme: light;
}
:root[data-theme="escuro"] {
  --bg: #0D1015; --surface: #151A21; --line: #252C36; --chip: #202733; --text: #E8EBEF; --muted: #97A1AE;
  --accent: #4C8DFF; --accent-soft: rgba(76,141,255,.16); --accent-text: #7FAEFF; --on-accent: #FFFFFF;
  --up: #3DD68C; --up-soft: rgba(61,214,140,.14); --up-text: #5BE0A0; --down-text: #FF9A5C; --down-soft: rgba(255,154,92,.12);
  --warn: #F5A524; --warn-soft: rgba(245,165,36,.16); --warn-text: #F7B955; --shadow: none;
  color-scheme: dark;
}
@media (prefers-color-scheme: dark) {
  :root[data-theme="auto"] {
    --bg: #0D1015; --surface: #151A21; --line: #252C36; --chip: #202733; --text: #E8EBEF; --muted: #97A1AE;
    --accent: #4C8DFF; --accent-soft: rgba(76,141,255,.16); --accent-text: #7FAEFF; --on-accent: #FFFFFF;
    --up: #3DD68C; --up-soft: rgba(61,214,140,.14); --up-text: #5BE0A0; --down-text: #FF9A5C; --down-soft: rgba(255,154,92,.12);
    --warn: #F5A524; --warn-soft: rgba(245,165,36,.16); --warn-text: #F7B955; --shadow: none;
    color-scheme: dark;
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); font-family: var(--font); font-size: 14px; line-height: 1.45; }
a { color: var(--accent-text); text-decoration: none; }
a:hover { text-decoration: underline; }
button, input, select, textarea { font: inherit; color: inherit; }
h1 { margin: 0; font-size: 24px; font-weight: 700; letter-spacing: -.02em; }
h2 { margin: 0; font-size: 15px; font-weight: 600; }
p { margin: 0; }
.mono, .num { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.up { color: var(--up-text); }
.down { color: var(--down-text); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }

/* ---- shell */
.topbar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 12px; height: 60px; padding: 0 16px;
  background: color-mix(in srgb, var(--bg) 92%, transparent); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 16px; color: var(--text); }
.brand:hover { text-decoration: none; }
.brand .title-mobile { display: inline; }
.brand .title-desktop { display: none; }
.nav-desktop { display: none; gap: 2px; flex: 1; }
.nav-desktop a { padding: 8px 12px; border-radius: 8px; color: var(--muted); font-weight: 500; }
.nav-desktop a:hover { text-decoration: none; color: var(--text); }
.nav-desktop a[aria-current="page"] { background: var(--chip); color: var(--text); font-weight: 600; }
.spacer { flex: 1; }
.mode-pill { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px 4px 8px; border-radius: 999px; border: 1px solid var(--line);
  font-size: 12px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; white-space: nowrap; }
.mode-pill .dot { width: 8px; height: 8px; border-radius: 999px; background: var(--accent); }
.mode-pill.real .dot { background: var(--warn); }
.icon-btn { width: 44px; height: 44px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); display: inline-flex;
  align-items: center; justify-content: center; cursor: pointer; flex: none; }
.icon-btn svg { width: 18px; height: 18px; }
.avatar { width: 36px; height: 36px; border-radius: 999px; background: var(--chip); display: inline-flex; align-items: center; justify-content: center;
  font-weight: 600; border: 0; cursor: pointer; flex: none; }
.menu { position: absolute; right: 12px; top: 56px; min-width: 200px; padding: 6px; border-radius: 12px; background: var(--surface); border: 1px solid var(--line);
  box-shadow: 0 8px 30px rgba(0,0,0,.18); z-index: 30; }
.menu button, .menu a { display: block; width: 100%; text-align: left; padding: 10px 12px; border: 0; background: none; border-radius: 8px; cursor: pointer; color: var(--text); }
.menu button:hover, .menu a:hover { background: var(--chip); text-decoration: none; }
main#view { max-width: 1376px; margin: 0 auto; padding: 16px 16px 104px; display: flex; flex-direction: column; gap: 16px; }
.tabbar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; display: grid; grid-template-columns: repeat(5, minmax(0, 1fr));
  background: var(--surface); border-top: 1px solid var(--line); padding: 4px 4px calc(10px + env(safe-area-inset-bottom)); }
.tabbar a { display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 8px 0; font-size: 11px; color: var(--muted); font-weight: 500; }
.tabbar a:hover { text-decoration: none; }
.tabbar a[aria-current="page"] { color: var(--accent-text); font-weight: 600; }
.tabbar svg { width: 22px; height: 22px; }
@media (min-width: 960px) {
  .topbar { gap: 24px; height: 64px; padding: 0 32px; }
  .brand .title-mobile { display: none; }
  .brand .title-desktop { display: inline; }
  .nav-desktop { display: flex; }
  .tabbar { display: none; }
  main#view { padding: 24px 32px 48px; gap: 20px; }
  h1 { font-size: 28px; }
}

/* ---- building blocks */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); }
@media (min-width: 960px) { .card { padding: 20px; } }
.card-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 12px; flex-wrap: wrap; }
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; flex-wrap: wrap; }
.page-head p { margin-top: 4px; color: var(--muted); }
.grid { display: grid; gap: 12px; }
.kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (min-width: 960px) { .grid { gap: 16px; } .kpis { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.two { grid-template-columns: minmax(0, 1fr); }
@media (min-width: 960px) { .two { grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); } .two.even { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.kpi .label { color: var(--muted); font-size: 13px; }
.kpi .value { font-family: var(--mono); font-size: 24px; font-weight: 600; letter-spacing: -.02em; margin: 4px 0 2px; }
@media (min-width: 960px) { .kpi .value { font-size: 30px; } }
.kpi .hint { font-size: 12px; color: var(--muted); }
.stats { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 16px; }
@media (min-width: 960px) { .stats { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.stats .value { font-family: var(--mono); font-size: 20px; font-weight: 600; }

.segmented { display: inline-flex; flex-wrap: wrap; gap: 2px; padding: 4px; border-radius: 10px; background: var(--chip); }
.segmented button { min-height: 36px; padding: 6px 12px; border: 0; border-radius: 7px; background: transparent; color: var(--muted); cursor: pointer; font-size: 13px; }
.segmented button[aria-pressed="true"] { background: var(--surface); color: var(--text); font-weight: 600; box-shadow: var(--shadow); }

.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); overflow-x: auto; scrollbar-width: none; }
.tabs button { flex: none; min-height: 44px; padding: 0 14px; border: 0; background: none; color: var(--muted); cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tabs button[aria-selected="true"] { color: var(--text); font-weight: 600; border-bottom-color: var(--accent); }

.btn { min-height: 44px; padding: 0 18px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); color: var(--text);
  font-weight: 600; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 8px; }
.btn.primary { background: var(--accent); color: var(--on-accent); border-color: transparent; }
.btn.danger { color: var(--down-text); }
.btn.ghost { background: transparent; border-color: transparent; }
.btn.small { min-height: 36px; padding: 0 12px; font-size: 13px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; }

.pill { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px; background: var(--chip); font-size: 12px; font-weight: 600; white-space: nowrap; }
.pill.ok { background: var(--up-soft); color: var(--up-text); }
.pill.warn { background: var(--warn-soft); color: var(--warn-text); }
.pill.bad { background: var(--down-soft); color: var(--down-text); }
.pill.info { background: var(--accent-soft); color: var(--accent-text); }
.pill.wrap-pill { display: inline-block; white-space: normal; line-height: 1.35; border-radius: 10px; }
.status-dot { width: 8px; height: 8px; border-radius: 999px; background: var(--muted); flex: none; }
.status-dot.ok { background: var(--up); box-shadow: 0 0 0 4px var(--up-soft); }
.status-dot.warn { background: var(--warn); box-shadow: 0 0 0 4px var(--warn-soft); }
.status-dot.info { background: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }

.engine { display: flex; align-items: center; gap: 10px 20px; flex-wrap: wrap; padding: 12px 16px; font-size: 13px; }
.engine .lead { display: flex; align-items: center; gap: 8px; font-weight: 600; }

.list-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 12px 0; border-top: 1px solid var(--line); }
.list-row:first-child { border-top: 0; }
.list-row .title { font-weight: 600; }

.bar { position: relative; height: 6px; border-radius: 999px; background: var(--chip); margin: 8px 0 4px; }
.bar .fill { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 999px; background: var(--accent-soft); border-right: 2px solid var(--accent); }
.bar .mark { position: absolute; top: -4px; width: 14px; height: 14px; margin-left: -7px; border-radius: 999px; background: var(--surface); border: 2px solid var(--muted); }
.bar-legend { display: flex; justify-content: space-between; font-size: 11px; color: var(--muted); }

.table-wrap { overflow-x: auto; margin: 0 -16px; padding: 0 16px; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th { text-align: left; font-weight: 500; color: var(--muted); padding: 10px 8px; border-bottom: 1px solid var(--line); white-space: nowrap; }
td { padding: 11px 8px; border-bottom: 1px solid var(--line); white-space: nowrap; }
td.num, th.num { text-align: right; font-family: var(--mono); }
tr:last-child td { border-bottom: 0; }
.pager { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-top: 12px; flex-wrap: wrap; }

.form { display: grid; gap: 16px; grid-template-columns: minmax(0, 1fr); }
@media (min-width: 720px) { .form.cols { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.field { display: flex; flex-direction: column; gap: 6px; }
.field > span { font-weight: 500; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.field small { color: var(--muted); font-size: 12px; }
.field.changed input, .field.changed select { border: 2px solid var(--warn); }
input[type=text], input[type=search], input[type=email], input[type=password], input[type=number], input[type=date], select, textarea {
  min-height: 44px; padding: 0 12px; border-radius: 10px; border: 1px solid var(--line); background: var(--bg); width: 100%; }
textarea { padding: 10px 12px; min-height: 88px; }
input.mono { font-family: var(--mono); }
.switch { position: relative; width: 36px; height: 20px; flex: none; }
.switch input { position: absolute; opacity: 0; inset: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.switch .track { position: absolute; inset: 0; border-radius: 999px; background: var(--chip); border: 1px solid var(--line); transition: background .15s; pointer-events: none; }
.switch .track::after { content: ''; position: absolute; left: 3px; top: 3px; width: 14px; height: 14px; border-radius: 999px; background: #FFF; box-shadow: 0 1px 2px rgba(0,0,0,.25); transition: transform .15s; }
.switch input:checked + .track { background: var(--accent); border-color: var(--accent); }
.switch input:checked + .track::after { transform: translateX(16px); }
.switch input:focus-visible + .track { outline: 2px solid var(--accent); outline-offset: 2px; }
.toggle-row { display: flex; justify-content: space-between; align-items: center; gap: 16px; padding: 12px 0; border-top: 1px solid var(--line); }
.toggle-row:first-child { border-top: 0; }

.choice { display: grid; gap: 10px; grid-template-columns: minmax(0, 1fr); }
@media (min-width: 720px) { .choice { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
/* Four cards side by side (the profiles), two on a mid screen; a little less padding to fit. */
@media (min-width: 480px) { .choice.four { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 720px) { .choice.four { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.choice.four button { padding: 12px 14px; }
.choice button { text-align: left; padding: 14px 16px; border-radius: 12px; border: 1px solid var(--line); background: var(--bg); cursor: pointer; }
.choice button[aria-pressed="true"], .choice button[aria-checked="true"] { border: 2px solid var(--accent); background: var(--accent-soft); }
.choice small { display: block; color: var(--muted); margin-top: 2px; }

details.group { border-top: 1px solid var(--line); }
/* A group written as sentences: the value boxes sit on the text line and grow with what is typed. */
.sentences { border: 1px solid var(--line); border-radius: 12px; padding: 0 16px; margin-bottom: 12px; }
.srow { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 16px; align-items: center; min-height: 56px; padding: 8px 0; border-top: 1px solid var(--line); }
.srow:first-child { border-top: 0; }
.srow .s { font-size: 15px; line-height: 34px; }
.srow.off .s { color: var(--muted); }
.srow.dim .s, .srow.dim .s .v { color: var(--muted); }
.srow .note { font-size: 12px; line-height: 1.4; color: var(--muted); margin-top: -4px; }
.srow .n { display: inline-block; height: 28px; line-height: 26px; padding: 0 8px; margin: 0 4px; box-sizing: border-box; vertical-align: middle;
  border: 1px solid var(--line); border-radius: 8px; background: var(--chip); white-space: nowrap; cursor: text; }
.srow .n:focus-within { border-color: var(--accent); }
.srow .n.changed { border: 2px solid var(--warn); line-height: 24px; }
.srow .n.invalid { border: 2px solid var(--down-text); line-height: 24px; }
.srow .v { font-family: var(--mono); font-variant-numeric: tabular-nums; font-size: 14px; color: var(--text); outline: none; display: inline-block; min-width: 1ch; }
.srow .u { font-size: 12px; color: var(--muted); margin-left: 3px; }
.srow.changed .switch .track { box-shadow: 0 0 0 2px var(--warn); }
.srow .v:empty::before { content: attr(data-placeholder); color: var(--muted); }
.srow select.inl, .srow input.inl { display: inline-block; width: auto; min-height: 0; height: 28px; padding: 0 6px; margin: 0 4px; vertical-align: middle;
  border: 1px solid var(--line); border-radius: 8px; background: var(--chip); font-size: 14px; color: var(--text); }
.srow select.inl.changed, .srow input.inl.changed { border: 2px solid var(--warn); }
.srow .scan { margin-left: 8px; font-size: 11px; vertical-align: middle; }
.srow .sub { font-size: 12px; color: var(--muted); line-height: 1.4; margin: -4px 0 4px; }
@media (max-width: 520px) { .sentences { padding: 0 12px; } .srow { gap: 10px; } .srow .s { font-size: 14px; } }
details.group > summary { list-style: none; cursor: pointer; display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 14px 0; }
details.group > summary::-webkit-details-marker { display: none; }
details.group[open] > summary { padding-bottom: 8px; }
details.group .form { padding-bottom: 16px; }

.savebar { position: sticky; bottom: 84px; z-index: 15; display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding: 12px 16px; border-radius: 14px;
  background: var(--surface); border: 1px solid var(--line); box-shadow: 0 8px 30px rgba(0,0,0,.14); }
@media (min-width: 960px) { .savebar { bottom: 16px; } }

.notice { padding: 12px 14px; border-radius: 12px; background: var(--chip); font-size: 13px; }
.notice.warn { background: var(--warn-soft); color: var(--warn-text); }
.notice.bad { background: var(--down-soft); color: var(--down-text); }
.notice.ok { background: var(--up-soft); color: var(--up-text); }
.notice.info { background: var(--accent-soft); color: var(--accent-text); }
.sim-banner { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 16px; }
.sim-banner .spacer { flex: 1; }
.sim-pick { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; min-width: 0; }
.sim-pick select { width: auto; max-width: 100%; min-height: 32px; padding: 4px 28px 4px 10px; font-size: 13px; }
.progress { height: 8px; border-radius: 99px; background: var(--chip); overflow: hidden; }
.progress > span { display: block; height: 100%; background: var(--accent); transition: width .4s; }
.empty { padding: 24px 8px; text-align: center; color: var(--muted); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chips .pill button { border: 0; background: none; cursor: pointer; padding: 0 0 0 2px; color: inherit; font-size: 14px; line-height: 1; }

.chart { position: relative; }
.chart svg { display: block; width: 100%; }
.chart .tip { position: absolute; pointer-events: none; padding: 6px 10px; border-radius: 8px; background: var(--text); color: var(--bg); font-size: 12px;
  font-family: var(--mono); white-space: nowrap; transform: translate(-50%, -120%); }
.chart-marks { position: absolute; inset: 0 0 auto 0; height: calc(100% - 22px); pointer-events: none; }
.chart-marks .mark { position: absolute; transform: translate(-50%, 4px); font-size: 13px; line-height: 1; pointer-events: auto; cursor: default;
  text-shadow: 0 0 3px var(--surface); }
.chart-marks .mark.sell { transform: translate(-50%, calc(-100% - 4px)); }
.chart-marks .mark.buy { color: var(--up); }
.chart-marks .mark.sell { color: var(--down-text); }
.chart .candle-tip { white-space: normal; line-height: 1.5; min-width: 170px; font-size: 12px; z-index: 5; }
.chart .candle-tip .up { color: #4ade80; }
.chart .candle-tip .down { color: #f87171; }
.axis { display: flex; justify-content: space-between; font-family: var(--mono); font-size: 11px; color: var(--muted); margin-top: 6px; }

.toast { position: fixed; left: 50%; bottom: 96px; transform: translateX(-50%); z-index: 50; max-width: min(560px, calc(100vw - 32px));
  padding: 12px 16px; border-radius: 12px; background: var(--text); color: var(--bg); font-weight: 500; box-shadow: 0 8px 30px rgba(0,0,0,.25); }
.toast.bad { background: var(--down-text); color: #FFF; }
@media (min-width: 960px) { .toast { bottom: 24px; } }
dialog { border: 1px solid var(--line); border-radius: 16px; background: var(--surface); color: var(--text); padding: 20px; width: min(480px, calc(100vw - 32px)); }
dialog::backdrop { background: rgba(0,0,0,.45); }
dialog h2 { font-size: 18px; margin-bottom: 8px; }
.skeleton { height: 18px; border-radius: 8px; background: linear-gradient(90deg, var(--chip), var(--line), var(--chip)); background-size: 200% 100%; animation: shine 1.2s infinite; }
@keyframes shine { to { background-position: -200% 0; } }
@media (prefers-reduced-motion: reduce) { .skeleton { animation: none; } * { transition: none !important; } }

/* ---- fixes after the first visual review */
[hidden] { display: none !important; }
main#view:focus, main#view:focus-visible { outline: none; }
.btn svg { width: 16px; height: 16px; flex: none; }
.reason { font-size: 12px; color: var(--muted); text-align: right; max-width: 60%; line-height: 1.35; }
.reason.ok { color: var(--up-text); font-weight: 600; }
.y-range { display: flex; justify-content: space-between; font-family: var(--mono); font-size: 11px; color: var(--muted); margin-bottom: 4px; }

/* ---- notices follow the theme */
.toast { display: flex; align-items: flex-start; gap: 10px; background: var(--surface); color: var(--text); border: 1px solid var(--line);
  border-radius: 12px; padding: 12px 12px 12px 14px; font-weight: 500; box-shadow: 0 10px 30px rgba(0,0,0,.18); }
.toast.bad { background: var(--surface); color: var(--text); border-color: var(--down-text); }
.toast-mark { width: 4px; align-self: stretch; border-radius: 4px; background: var(--up); flex: none; }
.toast.bad .toast-mark { background: var(--down-text); }
.toast.info .toast-mark { background: var(--accent); }
.toast-close { border: 0; background: none; color: var(--muted); font-size: 18px; line-height: 1; cursor: pointer; padding: 0 2px; }
.combo { display: block; width: 100%; }
.combo input { width: 100%; }
.reasons { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 2px; text-align: right; max-width: 62%; }
.reasons li { font-size: 12px; color: var(--muted); line-height: 1.35; }
.reasons li.ok { color: var(--up-text); font-weight: 600; }
.kpis.five { grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (min-width: 960px) { .kpis.five { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (min-width: 1200px) { .kpis.five { grid-template-columns: repeat(5, minmax(0, 1fr)); } }
.split { display: flex; gap: 4px 12px; flex-wrap: wrap; font-size: 12px; color: var(--muted); }
.split b { font-family: var(--mono); font-weight: 600; }
.price-head { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.price-head .last { font-family: var(--mono); font-size: 24px; font-weight: 600; }
.input-row { display: flex; gap: 8px; align-items: center; }
.input-row > :first-child { flex: 1; min-width: 0; }
.bar .fill.up { background: var(--up-soft); border-right-color: var(--up); }
.bar .fill.down { background: var(--down-soft); border-right-color: var(--down-text); }
td.wrap { white-space: normal; min-width: 220px; max-width: 360px; }
.only-desktop { display: none; }
@media (min-width: 960px) { .only-desktop { display: block; } .only-mobile { display: none !important; } }

/* ---- dropdown list with search */
.combo { position: relative; display: block; width: 100%; }
.combo-trigger { width: 100%; min-height: 44px; padding: 0 12px; border-radius: 10px; border: 1px solid var(--line); background: var(--bg);
  display: flex; align-items: center; justify-content: space-between; gap: 8px; cursor: pointer; text-align: left; }
.combo-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.combo-caret { color: var(--muted); flex: none; }
.combo-panel { position: absolute; z-index: 40; left: 0; right: 0; top: calc(100% + 6px); min-width: 240px; padding: 8px; border-radius: 12px;
  background: var(--surface); border: 1px solid var(--line); box-shadow: 0 12px 32px rgba(0,0,0,.22); }
.combo-panel input { margin-bottom: 6px; }
.combo-list { list-style: none; margin: 0; padding: 0; max-height: 300px; overflow-y: auto; }
.combo-list li { display: flex; justify-content: space-between; gap: 8px; padding: 10px; border-radius: 8px; cursor: pointer; }
.combo-list li:hover, .combo-list li.active { background: var(--chip); }
.combo-list li[aria-selected="true"] { color: var(--accent-text); font-weight: 600; }
.combo-empty { color: var(--muted); cursor: default !important; }
.coin-link { color: inherit; font-weight: 600; text-decoration: none; border-bottom: 1px dotted var(--muted); }
.coin-link:hover, .coin-link:focus-visible { color: var(--accent); border-bottom-color: var(--accent); }
@media (min-width: 960px) { .kpis.five { grid-template-columns: repeat(5, minmax(0, 1fr)); } .kpis.five .kpi .value { font-size: 24px; } }
details.cand > summary.cand-head { display: flex; align-items: flex-start; gap: 12px; cursor: pointer; list-style: none; }
details.cand > summary.cand-head::-webkit-details-marker { display: none; }
details.cand .cand-chevron { color: var(--muted); font-size: 14px; line-height: 24px; transition: transform .15s ease; }
details.cand[open] .cand-chevron { transform: rotate(180deg); }
details.cand:not([open]) > summary.cand-head .muted { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
dialog.coin-modal { width: min(1040px, calc(100vw - 24px)); max-height: calc(100vh - 24px); overflow: auto; padding: 16px; }
.coin-modal-body { display: grid; gap: 12px; }
.coin-modal-chart { min-width: 0; display: flex; flex-direction: column; gap: 8px; }
.coin-modal-side .coin-modal-box { gap: 6px; }
@media (min-width: 860px) { .coin-modal-body { grid-template-columns: minmax(0, 1fr) 280px; align-items: start; } dialog.coin-modal { padding: 16px 20px; } }
.coin-modal-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; margin-top: 12px; }
.coin-modal-box { border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; display: flex; flex-direction: column; gap: 4px; }
.coin-modal-row { display: flex; justify-content: space-between; gap: 12px; font-size: 13px; }
.kpi .value .unit, .equity-row .value .unit { font-size: 13px; font-weight: 500; color: var(--muted); margin-left: 6px; letter-spacing: 0; }
.kpi-lines { display: grid; gap: 2px; font-size: 13px; color: var(--muted); }
.kpi-lines b { font-family: var(--mono); font-weight: 600; color: var(--text); }
.kpi-lines b.up { color: var(--up-text, var(--up)); }
.kpi-lines b.down { color: var(--down-text); }
/* Dashboard cards: as wide as their content, side by side, wrapping as the screen narrows. */
.kpis.six { display: flex; flex-wrap: wrap; align-items: stretch; }
.kpis.six > .kpi { flex: 0 1 auto; min-width: 0; }
@media (max-width: 420px) { .kpis.six > .kpi { flex: 1 1 100%; } }
/* Patrimônio: a compact table, name on the left and value on the right, on every screen. */
.equity-rows { display: grid; grid-template-columns: auto auto; column-gap: 28px; row-gap: 8px; align-items: baseline; margin-top: 8px; }
.equity-row { display: contents; }
.equity-row .title { font-weight: 600; font-size: 14px; }
.equity-row .value { justify-self: end; font-family: var(--mono); font-size: 22px; font-weight: 600; margin: 0; white-space: nowrap; }
@media (min-width: 960px) { .equity-row .value { font-size: 26px; } }
.engine .pauses { display: flex; gap: 8px; margin-left: auto; }
.pause-toggle { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px 3px 4px; border-radius: 999px; font-size: 12px; font-weight: 600; cursor: pointer; white-space: nowrap; }
.pause-toggle.ok { background: var(--up-soft); color: var(--up-text); }
.pause-toggle.warn { background: var(--warn-soft); color: var(--warn-text); }
.pause-toggle .state { font-weight: 500; }
@media (max-width: 520px) { .engine .pauses { width: 100%; margin-left: 0; } .engine .pauses .pause-toggle { flex: 1; justify-content: flex-start; } }
.perf-head { flex-wrap: wrap; gap: 10px; }
.perf-filters { display: flex; flex-wrap: wrap; gap: 8px; justify-content: space-between; flex: 1 1 100%; }
.perf-grid { display: grid; gap: 16px; grid-template-columns: minmax(0, 1fr); margin-top: 4px; }
@media (min-width: 860px) { .perf-grid { grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); align-items: start; } }
.sys { display: grid; gap: 10px; margin-top: 12px; }
.sys-alert { font-size: 13px; }
.sys-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 10px; }
@media (min-width: 640px) { .sys-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.sys-box { border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; display: grid; gap: 8px; min-width: 0; align-content: start; }
.sys-head { display: flex; align-items: center; gap: 8px; }
.sys-head .muted { margin-left: auto; }
.sys-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--up); flex: none; }
.sys-dot.warn { background: var(--warn); } .sys-dot.bad { background: var(--down-text); }
.sys-row { display: grid; grid-template-columns: auto minmax(0, 1fr); column-gap: 10px; row-gap: 4px; font-size: 13px; }
.sys-row .mono { text-align: right; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sys-row .sys-bar { grid-column: 1 / -1; margin: 0; }
.sys-foot { border-top: 1px solid var(--line); padding-top: 8px; }
.sys-bar { height: 6px; border-radius: 999px; background: var(--chip); overflow: hidden; margin: 2px 0; }
.sys-bar span { display: block; height: 100%; background: var(--up); }
.sys-bar.warn span { background: var(--warn); } .sys-bar.bad span { background: var(--down-text); }
.stmt-box { border: 1px solid var(--line); border-radius: 12px; padding: 8px 12px; }
/* The number columns fit their widest value (up to 000.000.000,00 and R$ amounts); the label takes the rest and wraps. */
table.stmt { width: 100%; table-layout: auto; border-collapse: collapse; font-size: 14px; }
table.stmt th { font-size: 12px; font-weight: 500; color: var(--muted); text-align: right; padding: 4px 0; }
table.stmt td { padding: 5px 0; vertical-align: baseline; }
table.stmt td.n, table.stmt td.p, table.stmt th { font-family: var(--mono); text-align: right; white-space: nowrap; width: 1%; }
table.stmt th { font-family: inherit; }
table.stmt th:first-child { width: auto; }
table.stmt td.n { padding-left: 10px; }
table.stmt td.p { font-size: 12px; color: var(--muted); }
table.stmt td.p.up { color: var(--up-text, var(--up)); } table.stmt td.p.down { color: var(--down-text); }
table.stmt tr.g td { font-size: 12px; color: var(--muted); padding-top: 10px; }
table.stmt tr.sum td { font-weight: 600; }
table.stmt tr.t td { border-top: 1px solid var(--line); padding-top: 8px; font-weight: 600; font-size: 15px; }
table.stmt tr.i td { color: var(--muted); font-size: 13px; }
table.stmt td.p { padding-left: 8px; }
table.stmt td small.sub { display: block; font-size: 11px; color: var(--muted); font-weight: 400; line-height: 1.3; }
table.stmt td:first-child { overflow-wrap: anywhere; padding-right: 6px; white-space: normal; } /* the labels wrap: no sideways scroll */
@media (max-width: 420px) {
  table.stmt { font-size: 13px; }
  table.stmt tr.t td { font-size: 14px; }
}
table.stmt tr.i td.n.up, table.stmt tr.i td.n.down { font-size: 13px; }
dialog.profile-dialog { width: min(680px, calc(100vw - 32px)); }
/* A card folded to its title line (Backtest › Simulação). */
.fold { display: inline-flex; align-items: baseline; gap: 8px; background: none; border: 0; padding: 0; color: inherit; cursor: pointer; text-align: left; flex-wrap: wrap; }
.fold h2 { margin: 0; }
.fold .chev { font-size: 11px; color: var(--muted); width: 12px; }
.fold:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; border-radius: 6px; }
/* Backtest › Simulação (model B): progress strip on top, result tiles below; phone first. */
.sim-strip { display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; margin-bottom: 14px; }
.sim-line { display: flex; justify-content: space-between; gap: 8px; font-size: 13px; margin-bottom: 6px; }
.sim-line .muted { min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sim-line .mono { text-align: right; white-space: nowrap; flex: none; }
.sim-kpis { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.sim-kpi { background: var(--chip); border-radius: 12px; padding: 10px 12px; display: grid; gap: 2px; min-width: 0; align-content: start; }
.sim-kpi .mono { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
@media (min-width: 640px) { .sim-strip { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 20px; } .sim-kpis { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
td small.sub { display: block; font-size: 11px; color: var(--muted); font-weight: 400; line-height: 1.3; }

/* Mercado > Grupos (D45) */
.groups-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 360px), 1fr)); gap: 12px; align-items: start; }
.group-coins { display: flex; flex-direction: column; }
.group-coin { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 4px 12px; padding: 6px 0; border-top: 1px solid var(--line); }
.group-coin-name { display: flex; align-items: baseline; gap: 8px; min-width: 120px; }
.group-arrows { display: flex; flex-wrap: wrap; gap: 6px; }
.arrow-chip { font-size: 12px; font-variant-numeric: tabular-nums; padding: 2px 8px; border-radius: 999px; background: var(--chip); white-space: nowrap; }
.market-now { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 8px; font-weight: 600; }
.col-filters th { padding: 4px 4px 6px; font-weight: 400; }
input[type=search].col-filter { min-height: 28px; padding: 0 6px; font-size: 12px; border-radius: 6px; min-width: 64px; font-family: inherit; text-align: left; }
/* Sobre: the documents */
.doc { line-height: 1.6; overflow-wrap: anywhere; }
.doc h2 { font-size: 22px; margin: 4px 0 12px; } .doc h3 { font-size: 17px; margin: 22px 0 8px; } .doc h4, .doc h5 { font-size: 15px; margin: 16px 0 6px; }
.doc p, .doc ul, .doc ol, .doc blockquote, .doc pre, .doc .table-wrap { margin: 0 0 12px; }
.doc ul, .doc ol { padding-left: 22px; } .doc li { margin: 2px 0; } .doc li > ul, .doc li > ol { margin: 2px 0 0; }
.doc code { font-family: var(--mono); font-size: 0.9em; background: var(--chip); padding: 1px 5px; border-radius: 5px; }
.doc pre { background: var(--chip); padding: 10px 12px; border-radius: 10px; overflow-x: auto; } .doc pre code { background: none; padding: 0; }
.doc blockquote { border-left: 3px solid var(--line); padding-left: 12px; color: var(--muted); }
.doc hr { border: 0; border-top: 1px solid var(--line); margin: 18px 0; }
.doc table.doc-table td, .doc table.doc-table th { white-space: normal; vertical-align: top; min-width: 80px; }
.doc a { color: var(--accent); }
