/* Controlador X — layout para PC (somente telas largas; celular não muda) */
@media (min-width: 1024px) {
  /* ---------- navegação inferior ---------- */
  body.cx .nav-bottom { max-width: 720px; bottom: 16px; padding: 10px 10px calc(10px + env(safe-area-inset-bottom) * 0.5); }
  body.cx .nav-bottom a { font-size: 0.74rem; gap: 5px; padding: 8px 4px; }
  body.cx .nav-bottom a svg { width: 24px; height: 24px; }

  /* ---------- cabeçalhos ---------- */
  body.cx .app-header { margin: 14px 0 12px; padding: 16px 22px; }
  body.cx .app-header__title strong, body.cx .brand strong { font-size: 1.3rem; }
  body.cx .app-header__title small, body.cx .brand span { font-size: 0.78rem; }

  /* ---------- Home ---------- */
  body.cx.cx-home .screen {
    max-width: 1180px;
    padding: 28px 32px 120px !important;
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    column-gap: 16px;
    align-content: start;
  }
  body.cx.cx-home .screen > * { grid-column: 1 / -1; }
  body.cx.cx-home .brand { margin-bottom: 20px; padding: 16px 22px; }
  body.cx.cx-home .cx-profile {
    display: grid;
    grid-template-columns: 170px minmax(0, 1fr) minmax(0, 1.25fr) minmax(0, 1.25fr);
    grid-template-rows: 1fr auto auto auto auto auto 1fr;
    column-gap: 32px;
    padding: 30px 34px;
    margin-bottom: 18px;
  }
  body.cx.cx-home .cx-profile > * { grid-column: 2; margin-left: 0; margin-right: 0; }
  body.cx.cx-home .cx-profile > .cx-avatar { grid-column: 1; grid-row: 1 / -1; align-self: center; justify-self: center; width: 140px; height: 140px; margin: 0; }
  body.cx.cx-home .cx-profile .cx-avatar__face { width: 126px; height: 126px; font-size: 3rem; }
  body.cx.cx-home .cx-profile > #avatar-btn { grid-row: 2; }
  body.cx.cx-home .cx-profile > #avatar-msg { grid-row: 3; }
  body.cx.cx-home .cx-profile > #nome { grid-row: 4; font-size: 1.6rem; }
  body.cx.cx-home .cx-profile > #email { grid-row: 5; }
  body.cx.cx-home .cx-profile > #whatsapp { grid-row: 6; }
  body.cx.cx-home .cx-profile > .sub-box { grid-column: 3; grid-row: 1 / -1; align-self: center; margin: 0; padding-top: 0; border-top: 0; }
  body.cx.cx-home .cx-profile > .countdown { grid-column: 4; grid-row: 1 / -1; align-self: center; margin: 0; padding: 20px 18px; }
  body.cx.cx-home .cx-profile .countdown__value { font-size: 1.35rem; }
  body.cx.cx-home .cx-profile .countdown__grid b { font-size: 1.6rem; }
  body.cx.cx-home #btn-start { margin: 0 0 18px; padding: 24px !important; font-size: 1.25rem !important; }
  body.cx.cx-home #renew-box { margin-bottom: 18px; }
  body.cx.cx-home #renew-box .plans-pick { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 12px; }
  body.cx.cx-home .menu-links { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 12px; margin: 0 0 18px; }
  body.cx.cx-home .menu-links a { padding: 16px 18px; font-size: 0.86rem; }
  body.cx.cx-home #btn-logout { grid-column: 3; }

  /* ---------- Controlador ---------- */
  body.cx.cx-ctrl .app-shell {
    max-width: 1320px;
    padding: 4px 28px 120px;
    display: grid;
    grid-template-columns: minmax(0, 1fr) 440px;
    grid-template-rows: auto auto auto auto minmax(380px, 1fr) auto;
    column-gap: 18px;
    align-content: start;
  }
  body.cx.cx-ctrl .app-header { grid-column: 1 / -1; grid-row: 1; }
  body.cx.cx-ctrl .cx-chips { grid-column: 1; grid-row: 2; }
  body.cx.cx-ctrl .status-row { grid-column: 1; grid-row: 3; }
  body.cx.cx-ctrl .asset-tabs { grid-column: 1; grid-row: 4; }
  body.cx.cx-ctrl .chart-wrap { grid-column: 1; grid-row: 5; min-height: 380px; margin: 0; }
  body.cx.cx-ctrl .cx-hud { grid-column: 1; grid-row: 6; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 8px; margin: 12px 0 0; }
  body.cx.cx-ctrl .cx-hud__cell { padding: 10px 12px 9px; }
  body.cx.cx-ctrl .cx-hud__cell b { font-size: 0.9rem; }
  body.cx.cx-ctrl .ctrl-deck { grid-column: 2; grid-row: 2 / -1; align-self: start; margin-top: 0; padding: 18px 16px 16px; }
  body.cx.cx-ctrl .status-row > span { font-size: 0.78rem; }

  /* Controlador: animações mais leves no PC */
  body.cx.cx-ctrl::before, body.cx.cx-ctrl::after { animation: none; }
  body.cx.cx-ctrl .app-header, body.cx.cx-ctrl .ctrl-deck, body.cx.cx-ctrl .nav-bottom,
  body.cx.cx-ctrl .card, body.cx.cx-ctrl .btn--ghost, body.cx.cx-ctrl .modal { backdrop-filter: none; -webkit-backdrop-filter: none; }
  body.cx.cx-ctrl .app-header { background: linear-gradient(135deg, rgba(14, 32, 72, 0.94), rgba(6, 14, 34, 0.94)); }
  body.cx.cx-ctrl .ctrl-deck { background: linear-gradient(160deg, rgba(12, 27, 62, 0.95), rgba(5, 12, 30, 0.97)); }
  body.cx.cx-ctrl .nav-bottom { background: linear-gradient(180deg, rgba(14, 30, 68, 0.96), rgba(5, 12, 30, 0.98)); }
  body.cx.cx-ctrl .card::before,
  body.cx.cx-ctrl .chart-wrap::before,
  body.cx.cx-ctrl .app-header__title strong,
  body.cx.cx-ctrl .app-header > a,
  body.cx.cx-ctrl .price-tag,
  body.cx.cx-ctrl .btn--primary,
  body.cx.cx-ctrl .ctrl-dir-btn--alta,
  body.cx.cx-ctrl .ctrl-dir-btn--baixa { animation: none; }
  body.cx.cx-ctrl .chart-wrap::before { display: none; }
  body.cx.cx-ctrl .ctrl-market-btn::after, body.cx.cx-ctrl .ctrl-dir-btn::after { animation-duration: 6s; }

  /* ---------- I.A ---------- */
  body.cx.cx-ia .app-shell {
    max-width: 1320px;
    padding: 4px 28px 120px;
    display: grid;
    grid-template-columns: minmax(0, 1fr) 440px;
    grid-template-rows: auto auto auto auto auto minmax(340px, 1fr) auto auto auto auto;
    column-gap: 18px;
    align-content: start;
  }
  body.cx.cx-ia .app-shell > .app-header { grid-column: 1 / -1; grid-row: 1; }
  body.cx.cx-ia .app-shell > .cx-chips { grid-column: 1 / -1; grid-row: 2; }
  body.cx.cx-ia .app-shell > .cx-sec { grid-column: 1; grid-row: 3; margin-top: 4px; }
  body.cx.cx-ia .app-shell > .ia-brokers { grid-column: 1; grid-row: 4; grid-template-columns: repeat(9, minmax(0, 1fr)); gap: 8px; }
  body.cx.cx-ia .app-shell > .asset-tabs { grid-column: 1; grid-row: 5; margin-top: 10px !important; }
  body.cx.cx-ia .app-shell > .ia-chart-wrap { grid-column: 1; grid-row: 6; height: auto; min-height: 340px; margin-top: 0; }
  body.cx.cx-ia .app-shell > .ia-phase { grid-column: 1; grid-row: 7; }
  body.cx.cx-ia .app-shell > .ia-card:has(#f-banca) { grid-column: 2; grid-row: 3 / 8; align-self: start; margin-top: 4px; }
  body.cx.cx-ia .app-shell > .ia-card:has(#st-banca) { grid-column: 1; grid-row: 8; }
  body.cx.cx-ia .app-shell > .ia-card:has(#ia-ops) { grid-column: 1; grid-row: 9; }
  body.cx.cx-ia .app-shell > .cx-term { grid-column: 1; grid-row: 10; }
  body.cx.cx-ia .app-shell > section.ia-card { grid-column: 2; grid-row: 8 / 11; align-self: start; }
  body.cx.cx-ia .ia-stats { grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 8px; }
  body.cx.cx-ia .ia-stat b { font-size: 1.1rem; }
  body.cx.cx-ia .ia-broker { font-size: 0.64rem; padding: 10px 2px 8px; }
  body.cx.cx-ia .ia-broker img { width: 38px; height: 38px; }

  /* ---------- Corretoras ---------- */
  body.cx.cx-brk .screen { max-width: 1180px; padding: 28px 32px 120px !important; }
  body.cx.cx-brk .brand { margin-bottom: 18px; padding: 16px 22px; }
  body.cx.cx-brk .corretoras-lead { font-size: 0.95rem; margin-bottom: 18px; }
  body.cx.cx-brk .corretoras-list { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
  body.cx.cx-brk .corretora-card-wrap { display: flex; flex-direction: column; gap: 10px; padding: 14px; }
  body.cx.cx-brk .corretora-card { grid-template-columns: 56px 1fr; grid-template-areas: "logo info" "cta cta"; row-gap: 12px; }
  body.cx.cx-brk .corretora-card img { grid-area: logo; width: 56px; height: 56px; }
  body.cx.cx-brk .corretora-card__info { grid-area: info; }
  body.cx.cx-brk .corretora-card__cta { grid-area: cta; text-align: center; padding: 10px; }
  body.cx.cx-brk .corretora-card__ctrl { margin-top: auto; }

  /* ---------- Histórico ---------- */
  body.cx.cx-hist .app-shell { max-width: 1180px; padding: 4px 28px 120px !important; }
  body.cx.cx-hist .app-shell > .card { margin: 0 0 6px !important; }
  body.cx.cx-hist .hist-list { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; padding: 12px 0 24px; }
  body.cx.cx-hist .hist-empty { padding: 80px 20px; font-size: 0.95rem; }

  /* ---------- Config ---------- */
  body.cx.cx-cfg .app-shell {
    max-width: 1180px;
    padding: 4px 28px 120px !important;
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr);
    column-gap: 18px;
    align-content: start;
    align-items: stretch;
  }
  body.cx.cx-cfg .app-header { grid-column: 1 / -1; }
  body.cx.cx-cfg .app-shell > .card { margin: 0 !important; padding: 24px 26px; }
  body.cx.cx-cfg .app-shell > section.card { display: flex; flex-direction: column; justify-content: center; text-align: center; }
  body.cx.cx-cfg #cfg-clock { font-size: 3.6rem !important; }
  body.cx.cx-cfg .cfg-color-row { padding: 16px 18px; }
}

@media (min-width: 1024px) and (max-width: 1240px) {
  body.cx.cx-ctrl .app-shell, body.cx.cx-ia .app-shell { grid-template-columns: minmax(0, 1fr) 380px; }
  body.cx.cx-ia .app-shell > .ia-brokers { grid-template-columns: repeat(5, minmax(0, 1fr)); }
  body.cx.cx-ctrl .cx-hud { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  body.cx.cx-brk .corretoras-list, body.cx.cx-hist .hist-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  body.cx.cx-home .cx-profile { grid-template-columns: 150px minmax(0, 1fr) minmax(0, 1.2fr); }
  body.cx.cx-home .cx-profile > .countdown { grid-column: 2 / -1; grid-row: auto; margin-top: 16px; }
  body.cx.cx-home .menu-links { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
