/* PrimeTrade — versão de PC: menu lateral, páginas (Robôs, Sinais, Conta), resumo da conta,
   painéis com mais acabamento e gráfico maior. Carregado por último; o celular não muda. */

.d-rail, .d-acct, .c-quote, .d-min, #grid-btn { display: none; }

/* botão "ajustar o gráfico" (PC e celular), igual aos outros do canto */
.fit-btn {
  display: grid; place-items: center; position: relative; width: 30px; height: 30px; padding: 0; cursor: pointer; opacity: .75;
  border-radius: 10px; color: #c7cdf0; background: rgba(14,20,38,.7); border: 1px solid var(--line2, rgba(255,255,255,.12));
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); box-shadow: 0 6px 16px rgba(0,0,0,.35);
  transition: transform .15s, color .2s, opacity .2s;
}
.fit-btn:hover { opacity: 1; color: #fff; }
.fit-btn:active { transform: scale(.92) rotate(-30deg); }
.fit-btn svg { fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }

@media (min-width: 821px) and (min-height: 501px) {
  /* ================================================================ grade */
  .layout {
    gap: 10px; padding: 10px 12px 12px 10px;
    grid-template-columns: 76px 264px minmax(0, 1fr) 316px;
    grid-template-rows: minmax(0, 1fr) clamp(170px, 31vh, 310px);
    grid-template-areas: "rail watch chart ticket" "rail watch bottom bottom";
    transition: grid-template-rows .25s var(--ease);
  }
  .app.bottom-min .layout { grid-template-rows: minmax(0, 1fr) 46px; }
  .app.bottom-min .bottom .tab-body { display: none !important; }
  .app.bottom-min .d-min svg { transform: rotate(180deg); }

  /* foco: só o gráfico (e o menu) */
  .app.focus .layout { grid-template-columns: 76px minmax(0, 1fr); grid-template-rows: minmax(0, 1fr); grid-template-areas: "rail chart"; }
  .app.focus .layout > .watch, .app.focus .layout > .ticket, .app.focus .layout > .bottom { display: none; }
  .app.focus .d-rail [data-dact="focus"] { color: #fff; background: linear-gradient(135deg, rgba(139,92,246,.45), rgba(34,211,238,.25)); }

  .card { border-radius: 18px; border-color: rgba(139,147,255,.12); }

  /* ================================================================ menu lateral */
  .d-rail {
    grid-area: rail; display: flex; flex-direction: column; align-items: stretch; gap: 6px; padding: 10px 7px;
    border-radius: 18px; background: rgba(12,17,34,.72); border: 1px solid rgba(139,147,255,.12);
    backdrop-filter: blur(22px) saturate(150%); -webkit-backdrop-filter: blur(22px) saturate(150%);
    box-shadow: 0 18px 50px rgba(0,0,0,.35), inset 0 1px 0 rgba(255,255,255,.05);
  }
  .d-rail button {
    position: relative; display: grid; justify-items: center; gap: 4px; padding: 10px 2px 8px; border: 0; border-radius: 14px;
    background: transparent; color: var(--muted); font-size: 10.5px; font-weight: 700; letter-spacing: .01em;
    transition: background .2s, color .2s, transform .15s;
  }
  .d-rail button:hover { color: var(--text); background: rgba(139,147,255,.08); }
  .d-rail button:active { transform: scale(.95); }
  .d-rail svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
  .d-rail button.on { color: #fff; background: linear-gradient(160deg, rgba(139,92,246,.42), rgba(99,102,241,.22) 55%, rgba(34,211,238,.16)); box-shadow: inset 0 0 0 1px rgba(167,139,250,.35), 0 8px 22px rgba(99,102,241,.25); }
  .d-rail button.on svg { filter: drop-shadow(0 0 6px rgba(167,139,250,.8)); }
  .d-rail button.on::before { content: ""; position: absolute; left: -7px; top: 12px; bottom: 12px; width: 3px; border-radius: 0 3px 3px 0; background: var(--grad); }
  .d-rail-sp { flex: 1; }
  .d-rail [data-dact] { padding: 8px 2px 6px; font-size: 10px; }
  .d-rail [data-dact] svg { width: 19px; height: 19px; }

  /* ================================================================ topo */
  .topbar { gap: 14px; padding: 10px 14px; background: rgba(8,12,24,.62); }
  .brand { font-size: 17px; gap: 9px; }
  .brand .logo { width: 26px; height: 26px; }
  .acct { padding: 5px 12px 5px 6px; border-radius: 14px; background: rgba(139,147,255,.06); border: 1px solid var(--line); }
  .acct .badge { padding: 5px 8px; border-radius: 9px; }
  .acct-text b { font-size: 13px; }
  .metrics { gap: 8px; padding: 2px 0; }
  .metric {
    position: relative; flex: none; min-width: 96px; padding: 6px 12px 7px; border-radius: 13px; gap: 1px;
    background: linear-gradient(160deg, rgba(139,147,255,.07), rgba(139,147,255,.02)); border: 1px solid var(--line);
  }
  .metric span { font-size: 10px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; }
  .metric b { font-size: 14.5px; letter-spacing: -.01em; }
  .metric:nth-child(2) { background: linear-gradient(160deg, rgba(139,92,246,.2), rgba(34,211,238,.06)); border-color: rgba(167,139,250,.3); }
  .metric b.gain { text-shadow: 0 0 16px rgba(0,227,154,.35); }
  .metric b.loss { text-shadow: 0 0 16px rgba(255,77,109,.3); }
  .top-right { gap: 8px; }
  .conn { padding: 6px 11px; border-radius: 99px; background: rgba(139,147,255,.06); border: 1px solid var(--line); font-weight: 600; }

  /* ================================================================ lista de símbolos */
  .watch { display: flex; flex-direction: column; }
  .watch-search { padding: 12px 12px 8px; border-bottom: 0; }
  .watch-search input { border-radius: 12px; padding: 10px 12px 10px 34px; font-size: 13px;
    background: rgba(6,9,19,.55) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Ccircle cx='11' cy='11' r='6.5' fill='none' stroke='%238b93b5' stroke-width='2.2'/%3E%3Cpath d='M16 16l4 4' stroke='%238b93b5' stroke-width='2.2' stroke-linecap='round'/%3E%3C/svg%3E") no-repeat 11px center / 15px; }
  .watch-head { display: none; }
  .watch-list { padding: 2px 8px 8px; }
  .watch-row {
    grid-template-columns: minmax(0, 1fr) 50px auto; grid-template-rows: auto auto; column-gap: 8px; row-gap: 1px;
    padding: 9px 10px; margin-bottom: 3px; border: 1px solid transparent; border-bottom-color: transparent; border-radius: 13px;
    transition: background .2s, border-color .2s;
  }
  .watch-row:hover { background: rgba(139,147,255,.07); }
  .watch-row.active { background: linear-gradient(120deg, rgba(139,92,246,.22), rgba(34,211,238,.06)); border-color: rgba(167,139,250,.3); box-shadow: none; }
  .watch-row .nm { grid-row: 1 / 3; grid-column: 1; display: grid; align-content: center; gap: 1px; min-width: 0; }
  .watch-row .nm b { font-size: 13.5px; font-weight: 700; letter-spacing: -.01em; }
  .watch-row .desc { display: block !important; font-size: 10.5px; color: var(--muted); font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .watch-row .spark { display: block !important; grid-row: 1 / 3; grid-column: 2; align-self: center; height: 24px; opacity: .9; }
  .watch-row .spark svg { width: 100%; height: 24px; display: block; }
  .watch-row [data-bid] { grid-row: 1; grid-column: 3; font-size: 12.5px; font-weight: 600; color: var(--text); }
  .watch-row [data-ask] { display: none; }
  .watch-row .ch { grid-row: 2; grid-column: 3; justify-self: end; font-size: 10.5px; font-weight: 700; padding: 1px 6px; border-radius: 7px; background: rgba(139,147,255,.08); color: var(--muted); }
  .watch-row .ch.gain { background: rgba(0,227,154,.12); color: var(--gain); }
  .watch-row .ch.loss { background: rgba(255,77,109,.12); color: var(--loss); }
  .watch-row .rm { right: 8px; top: 6px; transform: none; border-radius: 8px; padding: 2px 7px; }

  /* resumo da conta embaixo da lista */
  .d-acct {
    display: grid; gap: 10px; margin: 0 10px 10px; padding: 13px 14px; border-radius: 16px;
    background: linear-gradient(150deg, rgba(139,92,246,.26), rgba(99,102,241,.12) 40%, rgba(34,211,238,.08) 75%, rgba(16,23,42,.6));
    border: 1px solid rgba(167,139,250,.28); box-shadow: 0 14px 34px rgba(76,29,149,.18);
  }
  .d-acct span { display: block; font-size: 10px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
  .da-top b { font-family: var(--display); font-size: 22px; font-weight: 800; letter-spacing: -.04em; }
  .da-row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
  .da-row b { font-size: 13.5px; font-weight: 700; }
  .da-lvl { display: grid; gap: 6px; }
  .da-lvl-top { display: flex; justify-content: space-between; align-items: baseline; }
  .da-lvl-top b { font-size: 12px; }
  .da-bar { height: 6px; border-radius: 99px; background: rgba(139,147,255,.12); overflow: hidden; }
  .da-bar i { display: block; height: 100%; width: 100%; border-radius: 99px; transition: width .5s var(--ease); background: linear-gradient(90deg, #22d3ee, var(--gain)); box-shadow: 0 0 10px rgba(0,227,154,.5); }
  .da-bar i.mid { background: linear-gradient(90deg, #f59e0b, #fbbf24); box-shadow: 0 0 10px rgba(251,191,36,.5); }
  .da-bar i.low { background: linear-gradient(90deg, #e0244d, var(--loss)); box-shadow: 0 0 10px rgba(255,77,109,.55); }

  /* ================================================================ gráfico */
  .chart-toolbar { padding: 10px 12px 9px 14px; gap: 12px; border-bottom-color: rgba(139,147,255,.08); }
  .chart-title { display: flex; align-items: baseline; gap: 10px; min-width: 0; }
  .chart-title b#c-symbol { font-family: var(--display); font-size: 19px; font-weight: 800; letter-spacing: -.03em; margin: 0; }
  .chart-title #c-desc { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 220px; }
  .c-quote { display: inline-flex; align-items: baseline; gap: 8px; }
  .c-quote b { font-size: 16px; font-weight: 700; }
  .c-quote em { font-style: normal; font-size: 11.5px; font-weight: 700; padding: 2px 7px; border-radius: 8px; background: rgba(139,147,255,.08); color: var(--muted); }
  .c-quote em.gain { background: rgba(0,227,154,.12); color: var(--gain); }
  .c-quote em.loss { background: rgba(255,77,109,.12); color: var(--loss); }
  .tfs { padding: 3px; border-radius: 12px; }
  .tfs button { padding: 5px 11px; border-radius: 9px; font-size: 12px; }
  .chart-help { font-size: 11px; color: var(--muted); padding: 6px 14px; border-top-color: rgba(139,147,255,.06); opacity: .8; }

  /* ================================================================ vários gráficos (2×2) */
  #grid-btn { display: inline-flex; align-items: center; gap: 6px; }
  #grid-btn svg { fill: none; stroke: currentColor; stroke-width: 1.9; }
  .chart-wrap.multi { --mcx: calc(50% + 3px); --mcy: calc(50% + 3px); }
  .chart-wrap.multi > .chart { right: var(--mcx); bottom: var(--mcy); border-radius: 12px; outline: 1px solid rgba(167,139,250,.28); }
  .chart-wrap.multi > .float-bars { right: calc(var(--mcx) + 56px); bottom: calc(var(--mcy) + 30px); }
  .chart-wrap.multi > .place-banner { left: 25%; max-width: calc(50% - 20px); white-space: normal; }
  .chart-wrap.multi > .gz-chips { right: var(--mcx); }
  .mc-grid { display: none; }
  .chart-wrap.multi > .mc-grid { display: block; position: absolute; inset: 0; pointer-events: none; z-index: 2; }
  .mc-pane {
    position: absolute; pointer-events: auto; display: flex; flex-direction: column; overflow: hidden;
    border-radius: 12px; background: rgba(6,9,19,.35); outline: 1px solid rgba(139,147,255,.14);
  }
  .mc-pane[data-slot="1"] { left: var(--mcx); right: 0; top: 0; bottom: var(--mcy); }
  .mc-pane[data-slot="2"] { left: 0; right: var(--mcx); top: var(--mcy); bottom: 0; }
  .mc-pane[data-slot="3"] { left: var(--mcx); right: 0; top: var(--mcy); bottom: 0; }
  .mc-head { display: flex; align-items: center; gap: 6px; padding: 5px 6px 4px 8px; border-bottom: 1px solid rgba(139,147,255,.08); }
  .mc-sym { width: auto; padding: 3px 24px 3px 8px; font-size: 12px; font-weight: 700; border-radius: 8px; background-position: right 5px center; background-size: 13px; }
  .mc-tfs { display: flex; gap: 1px; padding: 2px; border-radius: 8px; background: rgba(6,9,19,.5); border: 1px solid var(--line); }
  .mc-tfs button { border: 0; background: none; color: var(--muted); font-size: 10.5px; font-weight: 700; padding: 2px 6px; border-radius: 6px; }
  .mc-tfs button.on { background: var(--grad); color: #fff; }
  .mc-px { margin-left: auto; font-size: 12px; }
  .mc-open { display: grid; place-items: center; width: 24px; height: 24px; padding: 0; border-radius: 7px; border: 1px solid var(--line2); background: rgba(6,9,19,.45); color: var(--muted); }
  .mc-open:hover { color: #fff; }
  .mc-open svg { fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
  .mc-chart { position: relative; flex: 1; min-height: 0; }
  @media (max-width: 1800px) { #grid-btn .tool-lbl { display: none; } }
  @media (max-width: 1500px) { .mc-tfs button { padding: 2px 4px; } }

  /* ================================================================ boleta */
  .ticket { padding: 16px; gap: 14px; }
  .t-symbol { font-family: var(--display); font-size: 21px; font-weight: 800; letter-spacing: -.03em; }
  .trade-btn { padding: 12px 8px; border-radius: 15px; }
  .trade-btn span { font-size: 10.5px; font-weight: 800; letter-spacing: .12em; }
  .trade-btn b { font-size: 19px; }
  .stepper { border-radius: 12px; }
  .stepper input { font-size: 15px; font-weight: 600; }
  .presets button { border-radius: 10px; padding: 6px 4px; }
  .plan-btns .btn { padding: 10px 6px; border-radius: 12px; }

  /* ================================================================ painel de baixo */
  .tabs { padding: 8px 10px 0 12px; gap: 4px; border-bottom-color: rgba(139,147,255,.08); }
  .tabs button { padding: 8px 14px 10px; font-size: 13px; border-radius: 10px 10px 0 0; }
  .tabs button:hover { color: var(--text); }
  .count { background: rgba(139,147,255,.14); font-weight: 700; }
  .tabs button.on .count { background: var(--grad); color: #fff; }
  .tab-total { font-size: 12px; }
  .tab-total b { font-family: var(--mono); font-size: 13px; }
  .d-min {
    display: grid; place-items: center; width: 30px; height: 30px; margin: 0 0 6px 6px; padding: 0; border-radius: 10px;
    border: 1px solid var(--line2); background: rgba(6,9,19,.45); color: var(--muted); transition: color .2s, background .2s;
  }
  .d-min:hover { color: #fff; background: rgba(139,147,255,.12); }
  .d-min svg { fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; transition: transform .25s var(--ease); }
  .bulk { padding: 10px 12px; gap: 8px; }
  .bulk .btn.small { border-radius: 10px; padding: 6px 11px; }
  .grid { font-size: 13px; }
  .grid th { font-size: 10.5px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; padding: 8px 14px; background: rgba(12,17,34,.96); border-bottom-color: rgba(139,147,255,.1); }
  .grid td { padding: 9px 14px; border-bottom-color: rgba(139,147,255,.06); }
  .grid tbody tr { transition: background .15s; }
  .grid tbody tr:nth-child(even) { background: rgba(139,147,255,.025); }
  .grid tbody tr:hover { background: rgba(139,92,246,.1); }
  .grid td.num { font-size: 12.5px; }
  .empty { padding: 30px; font-size: 13px; }

  /* ================================================================ páginas (Robôs, Sinais, Conta) no lugar da negociação */
  .app[data-view="robots"] .layout > :is(.watch, .chart-area, .ticket, .bottom),
  .app[data-view="istore"] .layout > :is(.watch, .chart-area, .ticket, .bottom),
  .app[data-view="calendar"] .layout > :is(.watch, .chart-area, .ticket, .bottom),
  .app[data-view="signals"] .layout > :is(.watch, .chart-area, .ticket, .bottom),
  .app[data-view="account"] .layout > :is(.watch, .chart-area, .ticket, .bottom) { display: none; }
  .app[data-view="robots"] .layout, .app[data-view="signals"] .layout, .app[data-view="account"] .layout,
  .app[data-view="istore"] .layout, .app[data-view="calendar"] .layout { grid-template-rows: minmax(0, 1fr); }
  .app[data-view="robots"] #mv-robots, .app[data-view="signals"] #mv-signals, .app[data-view="account"] #mv-account,
  .app[data-view="istore"] #mv-istore, .app[data-view="calendar"] #mv-calendar {
    display: flex; flex-direction: column; grid-column: 2 / -1; grid-row: 1 / -1; min-height: 0; overflow: hidden;
    border-radius: 18px; background: rgba(12,17,34,.55); border: 1px solid rgba(139,147,255,.12);
    backdrop-filter: blur(22px) saturate(150%); -webkit-backdrop-filter: blur(22px) saturate(150%);
    box-shadow: 0 18px 50px rgba(0,0,0,.35), inset 0 1px 0 rgba(255,255,255,.05);
    animation: dPageIn .35s var(--ease);
  }
  @keyframes dPageIn { from { opacity: 0; transform: translateY(8px); } }

  .m-view .mv-hero {
    display: grid; grid-template-columns: 1fr auto; align-items: end; gap: 14px 24px; padding: 26px 32px 18px; position: relative;
    background: radial-gradient(120% 140% at 0% 0%, rgba(139,92,246,.2), transparent 55%), radial-gradient(90% 120% at 100% 0%, rgba(34,211,238,.1), transparent 60%);
    border-bottom: 1px solid rgba(139,147,255,.08);
  }
  .m-view .hero-top { display: flex; align-items: flex-end; gap: 36px; }
  .m-view .hero-lbl { display: block; font-size: 11px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .08em; }
  .m-view .hero-val { font-family: var(--display); font-size: 38px; font-weight: 800; letter-spacing: -.045em; line-height: 1.05; }
  .m-view .hero-side b { font-family: var(--display); font-size: 22px; font-weight: 700; }
  .m-view .mv-hero > .seg.wide { width: auto; min-width: 420px; }
  .m-view .mv-hero > .seg.wide button { padding: 8px 14px; font-size: 13px; }
  .m-view .mv-scroll { flex: 1; min-height: 0; overflow-y: auto; padding: 22px 32px 28px; }
  .m-view .m-section-title { display: flex; justify-content: space-between; align-items: center; font-size: 12px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; margin: 6px 2px 12px; }

  /* robôs e salas em grade de cartões */
  .m-view .rooms { grid-template-columns: repeat(auto-fill, minmax(360px, 1fr)); gap: 16px; align-items: start; }
  .m-view .room { cursor: pointer; transition: transform .2s var(--ease), box-shadow .2s, border-color .2s; }
  .m-view .room:hover { transform: translateY(-3px); border-color: rgba(167,139,250,.4); box-shadow: 0 22px 50px rgba(0,0,0,.45), 0 0 0 1px rgba(167,139,250,.15); }
  .m-view .rcvs { grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); margin-bottom: 8px; }
  .m-view .rm-disclaimer { margin-top: 18px; }

  /* conta: cartão da conta à esquerda, configurações à direita */
  #mv-account .mv-scroll { display: grid; grid-template-columns: minmax(340px, 420px) minmax(0, 1fr); grid-template-rows: auto auto 1fr; gap: 0 28px; align-content: start; }
  #mv-account .acc-card {
    grid-column: 1; grid-row: 1 / 4; align-self: start; position: sticky; top: 0; display: grid; gap: 16px; padding: 20px;
    background: linear-gradient(150deg, rgba(139,92,246,.35), rgba(99,102,241,.18) 35%, rgba(34,211,238,.12) 70%, rgba(16,23,42,.85));
    border: 1px solid rgba(139,92,246,.35); border-radius: 24px; box-shadow: 0 20px 50px rgba(76,29,149,.25);
  }
  #mv-account .acc-head { display: flex; justify-content: space-between; align-items: flex-start; }
  #mv-account .acc-head > div { display: grid; gap: 2px; }
  #mv-account .acc-head b { font-family: var(--display); font-size: 20px; font-weight: 800; letter-spacing: -.03em; }
  #mv-account .acc-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 18px; }
  #mv-account .acc-grid span { display: block; font-size: 10.5px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
  #mv-account .acc-grid b { font-family: var(--display); font-size: 19px; font-weight: 700; letter-spacing: -.03em; }
  #mv-account .set-head { grid-column: 2; margin-top: 4px; }
  #mv-account .set-list { grid-column: 2; }
  #mv-account .credit { grid-column: 2; text-align: left; }

  /* painéis laterais das páginas: mais largos no PC */
  #bot-sheet, #buy-sheet, #set-sheet { width: 520px; }

  /* tela muito larga: um pouco maior para ler sem esforço */
  @media (min-width: 1700px) {
    .layout { grid-template-columns: 80px 288px minmax(0, 1fr) 340px; }
    .topbar, .watch, .ticket, .bottom, .d-rail { zoom: 1.06; }
  }
}

/* PC baixo (ex.: janela larga e pouco alta): painel de baixo menor */
@media (min-width: 821px) and (min-height: 501px) and (max-height: 760px) {
  .layout { grid-template-rows: minmax(0, 1fr) clamp(150px, 28vh, 220px); padding-top: 8px; gap: 8px; }
  .chart-help { display: none; }
}

/* PC médio: topo sem Margem/Livre (estão na página Conta) e sem a descrição do ativo */
@media (min-width: 821px) and (max-width: 1500px) and (min-height: 501px) {
  .metric:nth-child(5), .metric:nth-child(6) { display: none; }
  .chart-title #c-desc { display: none; }
  #alert-btn .tool-lbl, .c-quote em { display: none; }
  .layout { grid-template-columns: 72px 240px minmax(0, 1fr) 296px; }
  .tfs button { padding: 5px 8px; }
  .chart-toolbar { gap: 8px; }
}

/* PC estreito: lista mais fina */
@media (min-width: 821px) and (max-width: 1250px) and (min-height: 501px) {
  .layout { grid-template-columns: 68px 220px minmax(0, 1fr) 290px; }
  .metric { min-width: 0; }
  .metric:nth-child(n+4) { display: none; }
  .acct-text .muted { display: none; }
  .d-rail button span { font-size: 9.5px; }
}
