/* Desenhos de detalhe (E13, P02): valem para os dois visuais (Sereno e Aurora). O servidor já manda cada um no lugar
   final (app/ornaments.php, wallet_ornaments_place); aqui só se escolhe o que aparece em cada largura. Nenhum script.
   Cores só por tokens: o traço na cor do assunto (--orn-c) e o "+" no dourado da casa (--c-crypto-gold). */
.orn { position: absolute; z-index: 0; right: 12px; top: 8px; width: 150px; height: 84px; pointer-events: none; color: var(--orn-c, var(--c-accent)); }
.orn svg { display: block; width: 100%; height: 100%; overflow: visible; }
.orn .orn-dash { stroke: currentColor; stroke-width: 2; stroke-dasharray: 2 6; opacity: .55; }
.orn .orn-thin { stroke: currentColor; stroke-width: 1.2; opacity: .25; }
.orn .orn-line { stroke: currentColor; stroke-width: 2.2; opacity: .6; }
.orn .orn-fill { fill: color-mix(in srgb, currentColor 16%, transparent); stroke: none; }
.orn .orn-card { fill: color-mix(in srgb, currentColor 9%, transparent); stroke: currentColor; stroke-width: 1.4; opacity: .7; }
.orn .orn-ring { stroke: currentColor; stroke-width: 2.2; fill: color-mix(in srgb, currentColor 14%, transparent); }
.orn .orn-dot { fill: currentColor; opacity: .35; }
.orn .orn-coin { fill: color-mix(in srgb, var(--c-crypto-gold) 60%, transparent); stroke: none; }
.orn .orn-gold { stroke: var(--c-crypto-gold); stroke-width: 2.4; opacity: .85; }
.orn .orn-glyph { fill: currentColor; opacity: .18; font: 900 30px/1 var(--font-sans, Inter, system-ui, sans-serif); text-anchor: middle; }
.orn .orn-big { fill: currentColor; opacity: .07; font: 900 64px/1 var(--font-sans, Inter, system-ui, sans-serif); }
.orn :is(.orn-candle, .orn-wick).is-up { fill: color-mix(in srgb, var(--c-success) 40%, transparent); stroke: var(--c-success); stroke-width: 1.2; opacity: .55; }
.orn :is(.orn-candle, .orn-wick).is-down { fill: color-mix(in srgb, var(--c-danger) 40%, transparent); stroke: var(--c-danger); stroke-width: 1.2; opacity: .55; }

/* KPI: o desenho substitui o círculo do canto; os dados ficam à frente. */
.wallet-kpi { --orn-c: var(--wallet-kpi-tone); isolation: isolate; overflow: hidden; }
.wallet-kpi:has(> .orn)::after { display: none; }
.wallet-kpi > :not(.orn) { position: relative; z-index: 1; }
.wallet-kpi > .orn { right: 50px; top: 4px; width: 140px; height: 78px; }
.wallet-kpi:not(:has(.wallet-kpi-go)) > .orn { right: 14px; }
.wallet-kpi:has(.wallet-ring) > .orn { right: 86px; }
.wallet-kpi.is-compact > .orn { width: 104px; height: 58px; right: 10px; top: 6px; }

/* Destaque escuro (saldo): a órbita com o símbolo do lado, clara. */
.wallet-kpi-hero { position: relative; isolation: isolate; overflow: hidden; }
.wallet-kpi-hero > :not(.orn) { position: relative; z-index: 1; }
.wallet-kpi-hero > .orn { --orn-c: color-mix(in srgb, var(--c-accent) 55%, var(--c-on-color)); right: 64px; top: 10px; width: 170px; height: 96px; }

/* Topo das páginas de seção (o servidor põe o desenho do assunto no cabeçalho). */
.page-orn-host { position: relative; isolation: isolate; }
.page-orn-host > .orn { --orn-c: var(--c-accent); top: 50%; width: 190px; height: 106px; transform: translateY(-50%); opacity: .9; }
.page-orn-host > :not(.orn) { position: relative; z-index: 1; }

/* Espaço vago (o servidor põe um em cada grade de contas ou cartões, como primeiro filho; order o leva para o fim).
   O CSS conta os itens: aparece só quando a última linha fica incompleta. 2 colunas de 900 a 1499 px, 3 a partir de 1500. */
.grid-filler { display: none; order: 99; pointer-events: none; }
.grid-filler-box { position: relative; display: grid; place-items: center; align-content: center; gap: 14px; height: 100%; min-height: 160px; border-radius: 26px; }
.grid-filler-box > .orn { position: relative; inset: auto; width: min(240px, 70%); height: auto; aspect-ratio: 160 / 90; opacity: .85; }
@media (min-width: 900px) and (max-width: 1499px) { .center-grid > .grid-filler:nth-last-child(even) { display: grid; } }
@media (min-width: 1500px) {
  .center-grid > .grid-filler:nth-last-child(3n+2) { display: grid; grid-column: span 2; }
  .center-grid > .grid-filler:nth-last-child(3n) { display: grid; }
}
/* Início: cada coluna (contas, cartões) traz o seu. As colunas ficam da mesma altura e o espaço vago ocupa o que sobra
   na mais curta; com menos de 220 px de sobra, não aparece (consulta pelo tamanho do próprio espaço). */
@media (min-width: 1100px) {
  .dashboard-wallet-stacks:has(> * > .grid-filler.is-stack) { align-items: stretch; }
  .dashboard-wallet-stacks > :has(> .grid-filler.is-stack) { display: flex; flex-direction: column; }
  .grid-filler.is-stack { display: block; flex: 1 1 0; min-height: 0; container-type: size; }
  .grid-filler.is-stack .grid-filler-box { height: min(420px, calc(100% - 18px)); min-height: 0; margin-top: 18px; }
  @container (max-height: 219px) { .grid-filler.is-stack .grid-filler-box { display: none; } }
}

/* Celular: o tamanho do protótipo (120 x 68), no canto, ao lado da seta; o texto passa por cima com o halo. */
@media (max-width: 760px) {
  .wallet-kpi > .orn { width: 120px; height: 68px; top: 6px; right: 44px; }
  .wallet-kpi:has(.wallet-ring) > .orn { right: 44px; top: 4px; }
  .wallet-kpi:not(:has(.wallet-kpi-go)) > .orn { right: 10px; }
  .wallet-kpi-hero > .orn { width: 120px; height: 68px; right: 46px; top: 8px; }
  .page-orn-host > .orn { width: 120px; height: 68px; top: 0; transform: none; }
}

/* Balanço do Início: a balança no vão entre o resultado e as barras. */
.balance-meter { isolation: isolate; overflow: hidden; }
.balance-meter:has(> .orn)::after { display: none; }
.balance-meter > :not(.orn) { position: relative; z-index: 1; }
.balance-meter > .orn { --orn-c: var(--c-accent); right: auto; left: 30%; top: 50%; width: 130px; height: 74px; transform: translateY(-50%); }

/* ---------- Constelação do Início (só no computador; app/ornaments.php wallet_constellation_html) ---------- */
.home-constellation { display: none; }
@media (min-width: 1180px) {
  .dashboard-heading:has(.home-constellation) { position: relative; }
  .home-constellation { display: block; position: absolute; z-index: 0; right: 10px; top: -14px; width: 300px; height: 290px; pointer-events: none; color: var(--c-accent); }
}
/* Peças da constelação (as mesmas no Início e na abertura do app) */
.cons-orbit { position: absolute; left: 50%; top: 50%; border-radius: 50%; translate: -50% -50%; }
.cons-orbit.is-outer { width: 262px; height: 262px; border: 1px dashed color-mix(in srgb, currentColor 32%, transparent); animation: cons-spin 80s linear infinite; }
.cons-orbit.is-inner { width: 168px; height: 168px; border: 1px solid color-mix(in srgb, currentColor 16%, transparent); }
.cons-piece { position: absolute; display: grid; place-items: center; width: 66px; height: 86px; border-radius: 16px; color: var(--c-on-color); font-size: 30px; font-weight: 900; box-shadow: inset 0 1px 0 color-mix(in srgb, var(--c-on-color) 45%, transparent), 0 18px 30px -18px var(--c-deep-900); animation: cons-float 7s ease-in-out infinite; }
.cons-piece.is-fiat { left: 78px; top: 104px; rotate: -14deg; background: linear-gradient(150deg, color-mix(in srgb, var(--c-category-blue) 85%, var(--c-on-color)), var(--c-category-blue)); }
.cons-piece.is-chart { left: 117px; top: 80px; z-index: 1; display: flex; align-items: flex-end; justify-content: center; gap: 5px; padding-bottom: 22px; background: linear-gradient(150deg, color-mix(in srgb, var(--c-category-teal) 80%, var(--c-on-color)), var(--c-category-teal)); animation-delay: -2s; }
.cons-piece.is-chart i { width: 8px; border-radius: 3px; background: var(--c-on-color); } .cons-piece.is-chart i:nth-child(1) { height: 18px; } .cons-piece.is-chart i:nth-child(2) { height: 30px; } .cons-piece.is-chart i:nth-child(3) { height: 42px; }
.cons-piece.is-crypto { left: 156px; top: 108px; rotate: 14deg; background: linear-gradient(150deg, color-mix(in srgb, var(--c-category-orange) 80%, var(--c-on-color)), var(--c-category-orange)); animation-delay: -4s; }
:root[data-mode="cripto"] .cons-piece.is-crypto { z-index: 2; }
.cons-sats { position: absolute; left: 50%; top: 50%; width: 262px; height: 262px; translate: -50% -50%; animation: cons-spin 120s linear infinite; }
.cons-sat { position: absolute; display: inline-flex; align-items: center; gap: 6px; translate: -50% -50%; white-space: nowrap; animation: cons-spin-back 120s linear infinite; }
.cons-sat.is-1 { left: 11.7%; top: 17.9%; } .cons-sat.is-2 { left: 93.3%; top: 25%; } .cons-sat.is-3 { left: 41.3%; top: 99.2%; }
.cons-sat i { width: 7px; height: 7px; border-radius: 50%; background: currentColor; box-shadow: 0 0 0 4px color-mix(in srgb, currentColor 18%, transparent), 0 0 12px currentColor; }
.cons-sat em { font-style: normal; font-size: 10.5px; font-weight: 750; letter-spacing: .16em; text-transform: uppercase; color: color-mix(in srgb, currentColor 72%, var(--n-900)); }
.cons-tagline { position: absolute; left: 50%; top: calc(50% + 84px); translate: -50% -50%; padding: 0 10px; background: var(--n-50); color: var(--n-600); font-size: 11.5px; font-weight: 700; letter-spacing: .08em; white-space: nowrap; }
@keyframes cons-spin { to { rotate: 360deg; } }
@keyframes cons-spin-back { to { rotate: -360deg; } }
@keyframes cons-float { 50% { translate: 0 -8px; } }
@media (prefers-reduced-motion: reduce) { .cons-orbit, .cons-sats, .cons-sat, .cons-piece { animation: none !important; } }

/* ---------- Menu do perfil · Painel de instrumentos (E13 rodada 2; escolha de Darlan em 29/10). Dois visuais. ----------
   Lista enxuta: ícone na cor do estado, nome (com o detalhe pequeno) e o mostrador à direita: barra, anel, número ou
   selo. No topo, "X de N em dia". Detalhes da casa: a órbita pontilhada no canto e a cor do estado nascendo no ícone. */
.instr-head { position: relative; overflow: hidden; isolation: isolate; display: flex; align-items: center; gap: 14px; margin: 12px 0 10px; padding: 14px; border-radius: 18px;
  background: radial-gradient(90% 100% at 0% 0%, color-mix(in srgb, var(--c-accent) 12%, transparent), transparent 70%), var(--n-0); box-shadow: inset 0 0 0 1px var(--n-150); }
.instr-head::after { content: ""; position: absolute; z-index: -1; right: -26px; bottom: -46px; width: 110px; height: 110px; border-radius: 50%; border: 1.5px dashed color-mix(in srgb, var(--c-accent) 30%, transparent); }
.instr-head strong { display: block; font-size: 15px; } .instr-head small { color: var(--n-600); font-size: 12.5px; }
.instr-score { position: relative; display: grid; place-items: center; flex: none; width: 54px; height: 54px; }
.instr-score svg { position: absolute; inset: 0; rotate: -90deg; }
.instr-score circle { fill: none; stroke-width: 4; } .instr-score .track { stroke: color-mix(in srgb, var(--c-danger) 55%, transparent); } .instr-score .fill { stroke: var(--c-success); stroke-linecap: round; }
.instr-score b { position: relative; font-size: 13px; }
.instr-list { margin: 0; padding: 4px 0; list-style: none; border-radius: 18px; background: var(--n-0); box-shadow: inset 0 0 0 1px var(--n-150); }
.instr { --s: var(--n-600); } .instr.is-ok { --s: var(--c-success); } .instr.is-bad { --s: var(--c-danger); } .instr.is-tip { --s: var(--c-warning); } .instr.is-neutral { --s: var(--c-accent); }
.instr + .instr { border-top: 1px solid var(--n-150); }
.instr a { position: relative; display: flex; align-items: center; gap: 12px; padding: 10px 14px; color: var(--n-900); text-decoration: none; }
.instr a::before { content: ""; position: absolute; left: 0; top: 10px; bottom: 10px; width: 3px; border-radius: 0 3px 3px 0; background: var(--s); }
.instr.is-neutral a::before { opacity: .35; }
.instr a:hover { background: color-mix(in srgb, var(--s) 6%, transparent); }
.instr-ico { display: grid; place-items: center; flex: none; width: 34px; height: 34px; border-radius: 11px; background: color-mix(in srgb, var(--s) 13%, transparent); color: var(--s); }
.instr-ico svg { width: 17px; height: 17px; }
.instr-name { flex: 1; min-width: 0; } .instr-name b { display: block; font-size: 14px; } .instr-name small { display: block; overflow: hidden; color: var(--n-600); font-size: 11.5px; text-overflow: ellipsis; white-space: nowrap; }
.dial { flex: none; max-width: 46%; padding: 4px 10px; border-radius: 99px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12.5px; font-weight: 800; color: var(--s); background: color-mix(in srgb, var(--s) 12%, transparent); }
.dial.is-num { min-width: 34px; text-align: center; font-size: 17px; padding: 2px 10px; }
.dial.is-check { display: grid; place-items: center; width: 26px; height: 26px; padding: 0; border-radius: 50%; background: var(--s); color: var(--c-on-color); font-size: 13px; }
.dial-text { display: none; }
.dial.is-bar { display: grid; gap: 4px; width: 84px; padding: 0; background: none; text-align: right; } .dial.is-bar s { text-decoration: none; font-size: 12px; }
.dial.is-bar svg { width: 100%; height: 6px; } .dial.is-bar .track { fill: color-mix(in srgb, var(--s) 15%, transparent); } .dial.is-bar .fill { fill: var(--s); }
.dial.is-ring { position: relative; display: grid; place-items: center; width: 34px; height: 34px; padding: 0; border-radius: 50%; background: none; }
.dial.is-ring svg { position: absolute; inset: 0; rotate: -90deg; } .dial.is-ring circle { fill: none; stroke-width: 4; } .dial.is-ring .track { stroke: color-mix(in srgb, var(--s) 15%, transparent); } .dial.is-ring .fill { stroke: var(--s); stroke-linecap: round; }
.dial.is-ring s { position: relative; text-decoration: none; font-size: 9.5px; }
:root[data-look="aurora"] :is(.instr-list, .instr-head) { box-shadow: none; border: 1px solid transparent; background: radial-gradient(90% 100% at 0% 0%, color-mix(in srgb, var(--c-accent) 10%, transparent), transparent 70%) padding-box, linear-gradient(var(--n-0), var(--n-0)) padding-box, linear-gradient(140deg, color-mix(in srgb, var(--c-accent) 60%, transparent), var(--n-150) 30%, var(--n-150) 70%, color-mix(in srgb, var(--c-accent) 24%, transparent)) border-box; }


/* Rodada 2 (Darlan, 29/10: "seções vazias, como o gráfico das carteiras"): no computador, a alocação ao lado do histórico
   acompanha a altura do histórico e rola por dentro, em vez de esticar o histórico com um vão vazio embaixo. */
@media (min-width: 980px) {
  .crypto-overview:has(> .crypto-history-card) > :not(.crypto-history-card) { height: 0; min-height: 100%; overflow-y: auto; scrollbar-width: none; overscroll-behavior: contain; }
  .crypto-overview:has(> .crypto-history-card) > :not(.crypto-history-card)::-webkit-scrollbar { display: none; } /* sem barra de rolagem, como no resto do app */
}

/* Botões do "+" no escuro (Darlan, 29/10): o mesmo tom mais claro da barra de baixo, com o fio de luz por cima. */
:root.mw-dark:not([data-mode="cripto"]) .entry-fan-bubble { background: color-mix(in srgb, var(--n-150) 92%, transparent); box-shadow: inset 0 1px 0 color-mix(in srgb, var(--n-900) 14%, transparent), inset 0 0 0 1px color-mix(in srgb, var(--n-900) 12%, transparent), 0 12px 24px -14px var(--c-deep-900); }

/* Faixa do chat (servidor: .chat-band = chat + busca do Início + o desenho do lado). No celular e em telas médias ela
   não existe para o layout (display: contents) e o desenho fica no cabeçalho. No computador largo, o desenho (ou a
   Constelação, no Início) fica ao lado das mensagens e o do cabeçalho (.is-wide-off) some. */
.chat-band { display: contents; }
.chat-side { display: none; }
@media (min-width: 1180px) {
  .chat-band { display: grid; grid-template-columns: minmax(0, 680px) minmax(0, 1fr); column-gap: 24px; align-items: start; }
  .chat-band > :not(.chat-side) { grid-column: 1; }
  .chat-side { position: relative; display: block; grid-column: 2; grid-row: 1 / span 2; align-self: stretch; container-type: inline-size; pointer-events: none; } /* não ocupa altura: a faixa tem a altura do chat e da busca */
  .chat-side > * { position: absolute; left: 50%; top: 50%; translate: -50% -50%; }
  .chat-side > .orn { inset: auto; left: 50%; top: 50%; width: min(260px, 90%); height: auto; aspect-ratio: 160 / 90; --orn-c: var(--c-accent); }
  .chat-side > .home-constellation { inset: auto; left: 50%; top: 50%; display: block; scale: .82; }
  @container (max-width: 219px) { .chat-side > * { display: none; } }
  .is-wide-off { display: none !important; }
}
:where(:root.mw-dark:not([data-mode="cripto"])) .entry-fan-bubble { color: var(--n-900); } /* ícones neutros legíveis no escuro (os coloridos mantêm a cor) */
/* Grupos do menu (Darlan, 29/10): Administração no alto, depois Seu mês (ou Seu cripto), Sua conta e Mercado. */
.instr-group { margin: 14px 4px 6px; font-size: 11px; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; color: var(--n-600); }
.instr-groups .instr-list + .instr-group { margin-top: 16px; }
.instr-legend { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 6px; margin: -2px 4px 4px; font-size: 11.5px; color: var(--n-600); }
.instr-legend i { width: 8px; height: 8px; margin-left: 6px; border-radius: 2px; background: var(--s); } .instr-legend i:first-child { margin-left: 0; }
.instr-legend .is-ok { --s: var(--c-success); } .instr-legend .is-tip { --s: var(--c-warning); } .instr-legend .is-bad { --s: var(--c-danger); } .instr-legend .is-neutral { --s: var(--c-accent); }
.instr-admin-row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 4px; }
.instr-admin { display: flex; align-items: center; gap: 10px; padding: 12px; border-radius: 16px; text-decoration: none; color: var(--c-on-color);
  background: radial-gradient(90% 120% at 100% 0%, color-mix(in srgb, var(--c-accent) 50%, transparent), transparent 60%), linear-gradient(150deg, var(--c-deep-800), var(--c-deep-900));
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--c-accent) 35%, transparent), 0 12px 24px -16px var(--c-deep-900); }
.instr-admin .instr-ico { --s: var(--c-on-color); background: color-mix(in srgb, var(--c-on-color) 14%, transparent); color: var(--c-on-color); }
.instr-admin b { display: block; font-size: 14px; } .instr-admin small { display: block; font-size: 11.5px; color: color-mix(in srgb, var(--c-on-color) 72%, transparent); }

/* Desenho em todos os cards e em todas as páginas, no celular igual ao computador (Darlan, 30/10, como no protótipo
   prototipos/cards/): o desenho fica atrás e o texto ganha um halo na cor do próprio fundo, para o traço não roubar a
   leitura quando passa por baixo. --orn-halo: o fundo de cada lugar (card claro, destaque e face escuros, página). */
.wallet-kpi, .balance-meter { --orn-halo: var(--n-0); }
.wallet-kpi.is-face-dark, .wallet-kpi-hero { --orn-halo: var(--c-deep-900); }
.page-orn-host { --orn-halo: var(--c-bg); }
:is(.wallet-kpi, .wallet-kpi-hero, .page-orn-host, .balance-meter):has(> .orn) :is(small, p, b, strong, h1, h2, span, em, dt, dd, .eyebrow) {
  text-shadow: 0 0 2px var(--orn-halo), 0 0 6px var(--orn-halo), 0 0 12px var(--orn-halo);
}
/* Cabeçalho com botões à direita (imprimir, mais): o desenho fica à esquerda deles. */
@media (min-width: 761px) { .page-orn-host:has(> :last-child :is(button, a.icon-button)) > .orn, .page-orn-host:has(> button:last-child) > .orn { right: 116px; } }

/* Celular com espaço próprio (Darlan, 30/10: "se necessário, vamos criar os espaços nas telas visando o mobile").
   Cabeçalho: o desenho desce para o lado da linha de apoio, que ganha margem à direita; título e botões ficam livres.
   Cards em dupla (dois lado a lado): desenho menor no canto. Início: a Constelação menor, abaixo do título e do "Bom dia". */
@media (max-width: 760px) {
  .page-orn-host > .orn { top: 58px; bottom: auto; right: 0; width: 112px; height: 63px; transform: none; } /* na altura da linha de apoio, logo abaixo do título (Categorias tem o seletor dentro do cabeçalho) */
  .page-orn-host:not(:has(> :last-child :is(button, a.icon-button)), :has(> button:last-child)) p { padding-right: 104px; } /* sem botões à direita: a linha de apoio abre o espaço */
  .wallet-kpi-grid.is-duo > .wallet-kpi > .orn { width: 84px; height: 47px; right: 8px; top: 6px; }
}
/* Constelação do Início (Darlan, 30/10): só ao lado do texto. Em tela média fica à direita do título, menor; no
   celular, onde ela iria para baixo do texto, fica oculta. No computador largo segue ao lado do chat (.chat-side). */
@media (min-width: 761px) and (max-width: 1179px) {
  .dashboard-heading:has(> .home-constellation) { display: flex; flex-wrap: nowrap; align-items: center; justify-content: space-between; gap: 12px; }
  .dashboard-heading > .home-constellation { display: block; position: relative; inset: auto; flex: none; width: 300px; height: 290px; margin: -40px -20px -40px 0; zoom: .58; pointer-events: none; color: var(--c-accent); }
}
@media (max-width: 760px) { .dashboard-heading > .home-constellation { display: none; } }
