/* Veste grafica del pannello perpsbot sopra Bootstrap 5.3 (tema scuro di default, chiaro a scelta). */
:root {
  --pb-buy: #1f9d55; --pb-buy-hover: #1a8a4a;
  --pb-sell: #d9463e; --pb-sell-hover: #c23a33;
  --pb-radius: 12px;
}
[data-bs-theme="dark"] {
  --bs-body-bg: #0e1116; --bs-body-color: #e6e8ee;
  --bs-tertiary-bg: #151a22; --bs-secondary-bg: #1b212b;
  --bs-border-color: #2a313d; --bs-border-color-translucent: rgba(255,255,255,.08);
  --bs-secondary-color: #9aa3b2;
}
[data-bs-theme="light"] { --bs-body-bg: #f4f6f9; --bs-tertiary-bg: #ffffff; }
body { -webkit-font-smoothing: antialiased; font-size: 15px; }
.num { font-variant-numeric: tabular-nums; }
.card { border-radius: var(--pb-radius); border-color: var(--bs-border-color-translucent); background: var(--bs-tertiary-bg); }
.card-body { padding: .9rem 1rem; }
.card .titolo { font-size: .72rem; text-transform: uppercase; letter-spacing: .08em; color: var(--bs-secondary-color); margin-bottom: .5rem; font-weight: 600; }
.valore { font-size: 1.6rem; font-weight: 650; line-height: 1.15; }
.table { margin-bottom: 0; --bs-table-bg: transparent; }
.table > :not(caption) > * > * { padding: .35rem .4rem; }
.table-sm > :not(caption) > * > * { padding: .25rem .35rem; }
.navbar { border-bottom: 1px solid var(--bs-border-color-translucent); }
.navbar-brand { font-weight: 700; letter-spacing: .01em; }
.orologi { font-size: .8rem; color: var(--bs-secondary-color); white-space: nowrap; }
main.contenuto { padding-bottom: 24px; }

/* bottoni compra/vendi */
.btn-buy, .btn-sell { color: #fff; font-weight: 700; border: 0; }
.btn-buy { background: var(--pb-buy); } .btn-buy:hover, .btn-buy:focus { background: var(--pb-buy-hover); color: #fff; }
.btn-sell { background: var(--pb-sell); } .btn-sell:hover, .btn-sell:focus { background: var(--pb-sell-hover); color: #fff; }
.btn-buy:disabled, .btn-sell:disabled { color: #fff; opacity: .45; }
.btn-grande { padding: .9rem .5rem; font-size: 1.15rem; }
.btn-medio { padding: .65rem .4rem; font-size: .95rem; }
.btn-check:checked + .btn-outline-secondary { background: var(--bs-primary); border-color: var(--bs-primary); color: #fff; }

/* pagina di trading */
.ticket { position: sticky; top: 10px; }
.striscia .q { font-size: 1.65rem; font-weight: 650; line-height: 1.1; }
.striscia .etichetta { font-size: .72rem; color: var(--bs-secondary-color); text-transform: uppercase; letter-spacing: .06em; }
.striscia .stat { font-size: .82rem; color: var(--bs-secondary-color); }
.striscia .stat b { color: var(--bs-body-color); font-weight: 600; }
.quantita .form-control { font-size: 1.5rem; font-weight: 650; text-align: center; }
.quantita .btn { width: 3.2rem; font-size: 1.4rem; }
.atm .btn { font-size: .78rem; line-height: 1.2; padding: .4rem .2rem; }
.atm .btn strong { display: block; font-size: .85rem; }
.registro { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .78rem; max-height: 160px; overflow: auto; white-space: pre-wrap; }
.registro .no { color: var(--bs-danger); } .registro .ok { color: var(--bs-success); }
.pnl-pos { color: var(--bs-success) !important; } .pnl-neg { color: var(--bs-danger) !important; }
.posizione-lato { font-size: 1.35rem; font-weight: 700; }
.toast-container { z-index: 1090; }

/* barra fissa in basso su schermi piccoli */
.barra-mobile { display: none; }
@media (max-width: 991.98px) {
  .ticket { position: static; }
  .barra-mobile { display: grid; grid-template-columns: 1fr 1fr auto; gap: 8px; position: fixed; left: 0; right: 0; bottom: 0; padding: 8px 10px calc(8px + env(safe-area-inset-bottom));
    background: var(--bs-tertiary-bg); border-top: 1px solid var(--bs-border-color); z-index: 1040; }
  .barra-mobile .btn { padding: .8rem .4rem; font-size: 1.05rem; }
  body.con-barra { padding-bottom: 84px; }
}

/* comandi: bias */
.bias .btn { padding: .9rem .4rem; font-weight: 700; font-size: 1rem; }
.bias .btn.scelto { outline: 3px solid var(--bs-warning); outline-offset: -3px; }

/* login */
.login-wrap { min-height: 100dvh; display: grid; place-items: center; padding: 16px; }
.login-wrap .card { width: 100%; max-width: 380px; }

/* varie */
.badge-soft { background: var(--bs-secondary-bg); color: var(--bs-secondary-color); border: 1px solid var(--bs-border-color); font-weight: 500; }
summary { cursor: pointer; }
input[type=number] { -moz-appearance: textfield; }
input[type=number]::-webkit-outer-spin-button, input[type=number]::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }

/* grafico e pannello alla Quantower */
.grafico { height: 54vh; min-height: 320px; width: 100%; }
@media (max-width: 991.98px) { .grafico { height: 40vh; min-height: 260px; } }
.readout { border: 1px solid var(--bs-border-color); border-radius: 8px; padding: .35rem .6rem; background: var(--bs-body-bg); }
.readout .etichetta { font-size: .68rem; color: var(--bs-secondary-color); text-transform: uppercase; letter-spacing: .06em; }
.nav-tabs-sm .nav-link { padding: .3rem .7rem; }
.ticket .btn-medio { padding: .5rem .3rem; font-size: .9rem; }
.ticket .btn-grande { padding: .8rem .3rem; font-size: 1.05rem; }

/* ticket con più sezioni (ordini, protezione, template): sta nello schermo e scorre da solo se serve */
.ticket .card-body { max-height: calc(100dvh - 20px); overflow-y: auto; scrollbar-width: thin; }
@media (max-width: 991.98px) { .ticket .card-body { max-height: none; overflow: visible; } }
.sezione { border-top: 1px solid var(--bs-border-color-translucent); margin-top: .6rem; padding-top: .5rem; }
.sezione > summary { list-style: none; display: flex; align-items: center; justify-content: space-between; font-size: .72rem; text-transform: uppercase; letter-spacing: .08em; color: var(--bs-secondary-color); font-weight: 600; padding: .15rem 0; }
.sezione > summary::-webkit-details-marker { display: none; }
.sezione > summary::after { content: "▾"; font-size: .9rem; transition: transform .15s; }
.sezione:not([open]) > summary::after { transform: rotate(-90deg); }
.sezione > summary .badge { font-size: .62rem; text-transform: none; letter-spacing: 0; }
.guardiano .campo { display: grid; grid-template-columns: 1fr 92px; align-items: center; gap: .4rem; margin-bottom: .3rem; font-size: .82rem; }
.guardiano .campo .form-control { text-align: right; padding: .2rem .4rem; font-size: .85rem; }
.guardiano .stato-riga { font-size: .78rem; color: var(--bs-secondary-color); }
.guardiano .armato { color: var(--bs-warning-text-emphasis) !important; font-weight: 600; }
.btn-arma { background: #a85f10; color: #fff; border: 0; font-weight: 700; }
.btn-arma:hover, .btn-arma:focus { background: #8f500d; color: #fff; }
.btn-arma.on { background: #b02a2a; }

/* disposizione senza scroll sugli schermi larghi: il grafico prende lo spazio che resta, il ticket è compatto */
@media (min-width: 992px) {
  .trading .grafico { height: calc(80dvh - 310px); min-height: 220px; }
  .trading .tab-content { max-height: 24vh; min-height: 110px; overflow: auto; }
  .trading .alert { margin-bottom: .4rem; padding-top: .25rem; padding-bottom: .25rem; }
  .ticket .card-body { max-height: calc(100dvh - 76px); overflow-y: auto; }
}
.guardiano-bar .titolo { margin: 0; }
.g-campo { display: flex; flex-direction: column; width: 92px; }
.g-campo label { font-size: .62rem; text-transform: uppercase; letter-spacing: .05em; color: var(--bs-secondary-color); line-height: 1.1; margin-bottom: 2px; white-space: nowrap; }
.g-campo .form-control { text-align: right; padding: .15rem .35rem; font-size: .85rem; }
.guardiano-bar .stato-riga { font-size: .76rem; color: var(--bs-secondary-color); }
.guardiano-bar .armato { color: var(--bs-warning-text-emphasis) !important; font-weight: 600; }
.guardiano-bar .g-opzioni .form-check-label { font-size: .74rem; }
.ticket .btn-grande { padding: .55rem .3rem; font-size: 1rem; }
.ticket .btn-medio { padding: .38rem .3rem; font-size: .85rem; }
.ticket .quantita .form-control { font-size: 1.25rem; }
.ticket .quantita .btn { width: 2.6rem; font-size: 1.2rem; }
.ticket .readout { padding: .25rem .45rem; }
.ticket .anteprima, .ticket .punti { font-size: .72rem; line-height: 1.25; margin-top: .2rem; }
.ticket .btn-sm.px-0 { font-size: .78rem; }
