/* shared-ui.css — shared styles for the new layouts (html.ll:not(.m-on) desktop >= 1200px, html.ll.m-on phone).
   One set of tokens for every page: Inter only, whole-pixel sizes, one of each colour. */
html.ll:not(.m-on),
html.ll.m-on {
    --u-t1: #F5F7FA; --u-t2: #C2CBD8; --u-t3: #8791A3; --u-t4: #5F6A7E;
    --u-pos: #2FE0A0; --u-neg: #FF5C7A; --u-amb: #D9A83C; --u-sky: #7DD3FC;
    --u-bg: #0A0D15; --u-panel: #10151F; --u-fill: #1A2131; --u-fill2: #232C40;
    --u-line: rgba(255, 255, 255, .07); --u-line2: rgba(255, 255, 255, .12);
    --u-font: 'Inter', -apple-system, 'Segoe UI', Roboto, sans-serif;
}

/* ---- the buy area: one status line, fixed height ------------------------------- */
html.ll body.v2 #v2-col2 :is(#v2-balance-line, #v2-commit-cause, #ticket-amount-note) { display: none !important; }
html.ll .l2-status { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--u-t3); font: 400 12px/24px var(--u-font); }
html.ll .l2-status b { font-weight: 500; color: var(--u-t2); }
html.ll .l2-status b.is-neg { color: var(--u-neg); }
html.ll .l2-status b.is-amb { color: var(--u-amb); }
html.ll:not(.m-on) body.v2 #v2-col2 #v2-presets { gap: 6px !important; align-items: center; }
html.ll:not(.m-on) .l2-status { margin-right: auto; }
/* not enough balance: the amount turns red and Max is the way out */
html.ll body.v2 #v2-col2 .select-amount-section.l2-short #ticket-amount-field { box-shadow: inset 0 0 0 1.5px rgba(255, 92, 122, .7) !important; }
html.ll body.v2 #v2-col2 .select-amount-section.l2-short #ticket-amount-input { color: var(--u-neg) !important; -webkit-text-fill-color: var(--u-neg) !important; }
html.ll body.v2 #v2-col2 .select-amount-section:is(.l2-short, .l2-capped) #v2-presets .v2-preset[data-max] { background: #fff !important; color: #0B0F19 !important; font-weight: 600 !important; }
/* "need more" becomes one full-width Deposit button in the buy button's place */
html.ll body.v2 #v2-col2 #v2-need-row:not([hidden]) { display: block !important; width: 100% !important; margin: 0 !important; padding: 0 !important; }
html.ll body.v2 #v2-col2 #v2-need-row .v2-need { display: none !important; }
html.ll body.v2 #v2-col2 #v2-need-row .v2-need-fund { display: flex !important; align-items: center; justify-content: center; width: 100% !important; height: 52px !important; margin: 0 !important; border: 0 !important; border-radius: 12px !important; background: #fff !important; color: #0B0F19 !important; font: 600 15px/1 var(--u-font) !important; letter-spacing: 0 !important; text-transform: none !important; }
@media (max-height: 917px) { html.ll:where(:not(.m-on)):where(:not(:has(#v2-view-region[data-v2-view="advanced"]))) body.v2 #v2-col2 #v2-need-row .v2-need-fund { height: 44px !important; } }
@media (max-height: 830px) { html.ll:where(:not(.m-on)):where(:has(#v2-view-region[data-v2-view="advanced"])) body.v2 #v2-col2 #v2-need-row .v2-need-fund { height: 44px !important; } }
/* wrong network: Base blue, with the Base mark */
html.ll body.v2.v2-wrong-net #v2-col2 #v2-switch-base { display: flex !important; align-items: center; justify-content: center; gap: 10px; background: #0052FF !important; color: #fff !important; border: 0 !important; font: 600 15px/1 var(--u-font) !important; text-transform: none !important; letter-spacing: 0 !important; }
html.ll .l2-base { width: 20px; height: 20px; flex: none; border-radius: 50%; background: #fff linear-gradient(#0052FF, #0052FF) left center / 61% 14% no-repeat; }
/* phone: the status line is a fixed row under the quick amounts */
html.ll.m-on body.v2 #v2-col2 #v2-need-row .v2-need-fund { height: 54px !important; border-radius: 14px !important; font-size: 16px !important; }
html.ll:not(.m-on) body.v2 #v2-col2 .trade-actions #v2-switch-base { height: 52px !important; min-height: 52px !important; margin: 0 !important; width: 100% !important; border-radius: 12px !important; }
@media (max-height: 917px) { html.ll:where(:not(.m-on)):where(:not(:has(#v2-view-region[data-v2-view="advanced"]))) body.v2 #v2-col2 .trade-actions #v2-switch-base { height: 44px !important; min-height: 44px !important; } }
@media (max-height: 830px) { html.ll:where(:not(.m-on)):where(:has(#v2-view-region[data-v2-view="advanced"])) body.v2 #v2-col2 .trade-actions #v2-switch-base { height: 44px !important; min-height: 44px !important; } }
/* wrong network: the Base button is the only thing in the button slot */
html.ll body.v2.v2-wrong-net #v2-col2 .trade-actions > :not(#v2-switch-base):not(.v2-visually-hidden) { display: none !important; }

/* ---- toasts -------------------------------------------------------------------- */
html.ll body.v2 .v2-toast { background: #161D2B !important; border: 0 !important; border-radius: 12px !important; box-shadow: 0 10px 30px rgba(0, 0, 0, .45), inset 0 0 0 1px var(--u-line) !important; padding: 13px 14px !important; gap: 12px !important; align-items: flex-start !important; font-family: var(--u-font) !important; }
html.ll body.v2 .v2-toast-icon { width: 22px !important; height: 22px !important; border-radius: 50% !important; flex: none; margin-top: 1px; }
html.ll body.v2 .v2-toast.is-success .v2-toast-icon { background: rgba(47, 224, 160, .16) !important; }
html.ll body.v2 .v2-toast.is-error .v2-toast-icon { background: rgba(255, 92, 122, .16) !important; }
html.ll body.v2 .v2-toast.is-success .v2-toast-icon svg path { stroke: var(--u-pos); }
html.ll body.v2 .v2-toast.is-error .v2-toast-icon svg path { stroke: var(--u-neg); }
html.ll body.v2 .v2-toast-title { font: 600 13px/1.35 var(--u-font) !important; color: var(--u-t1) !important; }
html.ll body.v2 .v2-toast-body { font: 400 12px/1.4 var(--u-font) !important; color: var(--u-t3) !important; margin-top: 3px !important; }
html.ll body.v2 .v2-toast-msg a,
html.ll body.v2 .v2-toast-tx { color: var(--u-sky) !important; font: 500 12px/1.4 var(--u-font) !important; }
html.ll body.v2 .v2-toast-close { width: 22px !important; height: 22px !important; border-radius: 7px !important; background: none !important; color: var(--u-t4) !important; font-size: 11px !important; border: 0 !important; }
html.ll body.v2 .v2-toast-close:hover { background: var(--u-fill) !important; color: var(--u-t1) !important; }
html.ll body.v2 .v2-toast.is-success .v2-toast-progress { background: var(--u-pos) !important; opacity: .7; }
html.ll body.v2 .v2-toast.is-warning .v2-toast-progress { background: var(--u-amb) !important; opacity: .7; }
/* phone: toasts drop in under the top bar, full width, clear of the tab bar */
html.ll.m-on body.v2 .notification-container,
html.ll.m-on body.v2 #notification-container { top: calc(env(safe-area-inset-top, 0px) + 58px) !important; bottom: auto !important; left: 10px !important; right: 10px !important; width: auto !important; max-width: none !important; }
html.ll.m-on body.v2 .notification-container .v2-toast { width: auto !important; max-width: none !important; }

/* ---- dialogs: one shell -------------------------------------------------------- */
html.ll body.v2 #position-detail-modal .modal-content,
html.ll body.v2 dialog { background: var(--u-panel) !important; border: 0 !important; border-radius: 12px !important; box-shadow: 0 24px 60px rgba(0, 0, 0, .5), inset 0 0 0 1px var(--u-line) !important; color: var(--u-t1) !important; font-family: var(--u-font) !important; }
html.ll body.v2 dialog { padding: 22px !important; max-width: min(440px, calc(100vw - 24px)); }
html.ll body.v2 dialog::backdrop { background: rgba(4, 6, 10, .62); }
html.ll body.v2 dialog h2 { margin: 0 0 8px !important; font: 600 18px/1.25 var(--u-font) !important; color: var(--u-t1) !important; }
html.ll body.v2 dialog p { font: 400 13px/1.5 var(--u-font) !important; color: var(--u-t2) !important; }
html.ll body.v2 #position-detail-modal .modal-header { border: 0 !important; padding: 18px 22px 0 !important; }
html.ll body.v2 #position-detail-modal .modal-title { font: 500 12px/1 var(--u-font) !important; color: var(--u-t3) !important; letter-spacing: 0 !important; text-transform: none !important; }
html.ll body.v2 #position-detail-modal .btn-close { width: 30px !important; height: 30px !important; padding: 0 !important; margin: 0 !important; border-radius: 9px !important; opacity: 1 !important; filter: none !important; background: var(--u-fill) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12' fill='none' stroke='%23C2CBD8' stroke-width='1.4' stroke-linecap='round'%3E%3Cpath d='M2.5 2.5l7 7M9.5 2.5l-7 7'/%3E%3C/svg%3E") center / 12px no-repeat !important; }
html.ll body.v2 #position-detail-modal .modal-body { padding: 8px 22px 22px !important; }
html.ll:not(.m-on) body.v2 #position-detail-modal .modal-dialog { max-width: min(520px, calc(100vw - 32px)) !important; }
html.ll body.v2 #position-detail-modal #position-modal-title { font: 600 16px/1.25 var(--u-font) !important; color: var(--u-t1) !important; letter-spacing: -.01em !important; }
/* the plain-words title (data-long, app.js setPositionModalTitle) keeps the 0 tracking it had as an overlay */
html.ll body.v2 #position-detail-modal #position-modal-title[data-long] { letter-spacing: 0 !important; }
html.ll body.v2 #position-detail-modal #v2-pd-tiles { border-bottom: 1px dashed rgba(255, 255, 255, .16); margin: 0 -22px 14px !important; padding: 0 22px 16px !important; }
html.ll body.v2 #position-detail-modal .v2-pd-fig b { font: 500 12px/1 var(--u-font) !important; color: var(--u-t3) !important; }
html.ll body.v2 #position-detail-modal .v2-pd-fig em { font-family: var(--u-font) !important; font-weight: 600 !important; letter-spacing: -.02em; }
html.ll body.v2 #position-detail-modal .v2-pd-fig em.is-up { color: var(--u-pos) !important; }
html.ll body.v2 #position-detail-modal .v2-pd-fig em.is-dn { color: var(--u-neg) !important; }
html.ll body.v2 #position-detail-modal .v2-pd-fig i { font: 400 12px/1 var(--u-font) !important; color: var(--u-t3) !important; }
html.ll body.v2 #position-detail-modal .modal-content :is(button.btn, .btn):not(.btn-close) { height: 46px !important; border-radius: 12px !important; border: 0 !important; font: 600 14px/1 var(--u-font) !important; text-transform: none !important; letter-spacing: 0 !important; }
/* phone: the position dialog is a bottom sheet, buttons within reach of a thumb */
html.ll.m-on body.v2 #position-detail-modal .modal-content { border-radius: 22px 22px 0 0 !important; max-height: 88vh; overflow-y: auto; padding-bottom: env(safe-area-inset-bottom, 0px); }
html.ll.m-on body.v2 #position-detail-modal .modal-header::before { content: ''; position: absolute; top: 8px; left: 50%; width: 38px; height: 4px; margin-left: -19px; border-radius: 2px; background: var(--u-line2); }
html.ll.m-on body.v2 #position-detail-modal .modal-content :is(button.btn, .btn):not(.btn-close) { height: 50px !important; font-size: 15px !important; }
html.ll.m-on body.v2 #position-detail-modal .modal-dialog { left: 0 !important; right: 0 !important; bottom: 0 !important; top: auto !important; margin: 0 !important; max-width: none !important; width: 100% !important; transform: none !important; min-height: 0 !important; height: auto !important; display: block !important; position: absolute !important; }

/* ---- one set of colours and one font, through the app's own variables ---------- */
html.ll,
html.ll body.v2 {
    --positive: #2FE0A0; --negative: #FF5C7A; --text-muted: #8791A3; --t3: #8791A3; --caution: #D9A83C;
    --v2-display: 'Inter', -apple-system, 'Segoe UI', Roboto, sans-serif;
    --sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --ll-disp: 'Inter', -apple-system, 'Segoe UI', Roboto, sans-serif;
}

/* ---- last consistency fixes ---------------------------------------------------- */
html.ll body.v2 :is(#portfolio-section, #trade-positions-block) .v2-pos-exp em { font-size: 11px !important; }

/* ---- payoff captions in the confirm and position dialogs: one clean line above the curve */
html.ll body.v2 :is(#v2-pd-payoff) { position: relative; padding-top: 26px !important; box-sizing: border-box; }
html.ll body.v2 :is(#v2-pd-payoff) :is(.v2-cf-cap-l, .v2-cf-cap-r) { position: absolute !important; top: 7px !important; max-width: calc(50% - 16px); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font: 400 11px/1.3 var(--u-font) !important; color: var(--u-t3) !important; background: none !important; }
html.ll body.v2 :is(#v2-pd-payoff) .v2-cf-cap-l { left: 12px !important; right: auto !important; }
html.ll body.v2 :is(#v2-pd-payoff) .v2-cf-cap-r { right: 12px !important; left: auto !important; text-align: right; max-width: calc(62% - 16px); }
html.ll body.v2 :is(#v2-pd-payoff) .v2-cf-cap-l { max-width: calc(38% - 8px); }
html.ll body.v2 :is(#v2-pd-payoff) .v2-cf-cap-r.is-pos { color: var(--u-pos) !important; }
html.ll body.v2 :is(#v2-pd-payoff) .v2-cf-cap-r.is-neg { color: var(--u-neg) !important; }

/* ---- motion (desktop). Short, eased, and switched off for reduced-motion users ---- */
@media (max-height: 917px) { html.ll:where(:not(.m-on)):where(:not(:has(#v2-view-region[data-v2-view="advanced"]))) #ll-none { height: 44px !important; min-height: 44px !important; } }
@media (max-height: 830px) { html.ll:where(:not(.m-on)):where(:has(#v2-view-region[data-v2-view="advanced"])) #ll-none { height: 44px !important; min-height: 44px !important; } }
@media (prefers-reduced-motion: no-preference) {
    /* small switches: a pill slides under the chosen tab; the others sit back in grey */
    html.ll:not(.m-on) :is(.ll-seg, .ll-fseg, .sc-tf).l2-haspill { position: relative; }
    html.ll:not(.m-on) .l2-pill { position: absolute; left: 0; top: 0; border-radius: 7px; background: var(--u-fill2); pointer-events: none; z-index: 0; transition: transform .24s cubic-bezier(.2, .8, .2, 1), width .24s cubic-bezier(.2, .8, .2, 1), opacity .15s ease-out; }
    html.ll:not(.m-on) :is(.ll-seg, .ll-fseg, .sc-tf).l2-haspill > button { position: relative; z-index: 1; background: none !important; }
    html.ll:not(.m-on) :is(.ll-seg, .ll-fseg, .sc-tf) > button { color: var(--u-t3) !important; transition: color .16s ease-out, background-color .16s ease-out; }
    html.ll:not(.m-on) :is(.ll-seg, .ll-fseg, .sc-tf) > button:hover:not(.is-on):not([aria-pressed="true"]) { color: var(--u-t1) !important; background: rgba(255, 255, 255, .05) !important; }
    html.ll:not(.m-on) :is(.ll-seg, .ll-fseg, .sc-tf) > button:is(.is-on, [aria-pressed="true"], [aria-selected="true"]) { color: var(--u-t1) !important; }
    /* text tabs: grey when off, brighten on hover, fade between */
    html.ll:not(.m-on) body.v2 :is(#trade-positions-block .trade-strip-tab, .v2-bigtabs button, .sbc-tab, #ns-dates .ns-date-day, .nav-link) { transition: color .16s ease-out, opacity .16s ease-out; }
    html.ll:not(.m-on) body.v2 #trade-positions-block .trade-strip-tab:not(.active) { color: var(--u-t4) !important; }
    html.ll:not(.m-on) body.v2 #trade-positions-block .trade-strip-tab:not(.active):hover { color: var(--u-t2) !important; }
    html.ll:not(.m-on) body.v2 #ns-dates .ns-date { transition: background-color .18s ease-out, border-color .18s ease-out; }
    /* a thin bar slides under the chosen text tab */
    html.ll:not(.m-on) body.v2 #trade-positions-block .trade-strip-tabs.l2-hasbar { position: relative; }
    html.ll:not(.m-on) .l2-bar { position: absolute; left: 0; bottom: 4px; height: 2px; border-radius: 1px; background: var(--u-t1); pointer-events: none; transition: transform .32s cubic-bezier(.3, .9, .3, 1), width .32s cubic-bezier(.3, .9, .3, 1), opacity .2s; }
    /* what a tab reveals slides in from the side you moved towards, and fades up */
    @keyframes l2-in { from { opacity: .35; transform: translateY(8px); } to { opacity: 1; transform: none; } }
    @keyframes l2-in-r { from { opacity: .35; transform: translateX(16px); } to { opacity: 1; transform: none; } }
    @keyframes l2-in-l { from { opacity: .35; transform: translateX(-16px); } to { opacity: 1; transform: none; } }
    html.ll:not(.m-on) body.v2 #trade-positions-block .trade-strip-pane,
html.ll:not(.m-on) #ns-view .ns-inputs > #ns-pick,
html.ll:not(.m-on) body.v2 #trollbox-messages,
html.ll:not(.m-on) body.v2 #v2-fills-pane,
html.ll:not(.m-on) body.v2 #v2-news { animation: l2-in .22s cubic-bezier(.2, .8, .2, 1) both; }
    html.ll:not(.m-on) body.v2 [data-l2-dir="1"] :is(.trade-strip-pane, #ns-pick, #trollbox-messages, #v2-fills-pane, #v2-news) { animation-name: l2-in-r; }
    html.ll:not(.m-on) body.v2 [data-l2-dir="-1"] :is(.trade-strip-pane, #ns-pick, #trollbox-messages, #v2-fills-pane, #v2-news) { animation-name: l2-in-l; }
    /* the picker's own content only fades: it never slides, so lines and labels hold their place */
    @keyframes l2-fade { from { opacity: .4; } to { opacity: 1; } }
    html.ll:not(.m-on) body.v2 #ns-view .ns-inputs > #ns-pick,
html.ll:not(.m-on) body.v2 [data-l2-dir] #ns-view .ns-inputs > #ns-pick,
html.ll:not(.m-on) body.v2 #ns-view .ns-inputs[data-l2-dir] > #ns-pick { animation: l2-fade .18s ease-out both !important; }
    html.ll:not(.m-on) #ns-view .ns-inputs { overflow-x: clip; }
    /* a book that is being replaced waits dimmed instead of flashing */
    html.ll:not(.m-on) #ns-view .ns-inputs > .l2-wait { opacity: .4 !important; transition: opacity .12s ease-out; animation: none !important; }
    /* the order card slides out from under the picker when a level is picked */
    @keyframes l2-card { from { opacity: 0; transform: translateY(-10px); } to { opacity: 1; transform: none; } }
    html.ll:not(.m-on) body.v2 #v2-col2 .trade-preview-card { animation: l2-card .26s cubic-bezier(.2, .8, .2, 1) both; }
    /* the step dots change state with a short fade */
    html.ll:not(.m-on) body.v2 #v2-col2 :is(#ns-dates, #v2-view-region, .select-amount-section, .trade-actions)::before { transition: background-color .3s ease, box-shadow .3s ease, color .3s ease; }
    html.ll:not(.m-on) body.v2 #v2-col2 .select-amount-section { transition: opacity .22s ease-out; }
    /* buttons give a little under the pointer */
    html.ll:not(.m-on) body.v2 #v2-col2 .trade-actions :is(button, .v2-need-fund),
html.ll:not(.m-on) #ll-none,
html.ll:not(.m-on) .ll-chip,
html.ll:not(.m-on) body.v2 .v2-preset { transition: transform .12s ease-out, background-color .16s ease-out, box-shadow .16s ease-out, filter .16s ease-out; }
    html.ll:not(.m-on) body.v2 #v2-col2 .trade-actions :is(button, .v2-need-fund):active,
html.ll:not(.m-on) body.v2 .v2-preset:active { transform: scale(.985); }
    html.ll:not(.m-on) body.v2 #v2-col2 .trade-actions button:not(:disabled):hover { filter: brightness(1.06); }
}

/* ---- Trade: the line beside the quick amounts is a two-tone tag ---- */
html.ll:not(.m-on) .l2-status:not(:empty) { display: inline-flex; align-items: center; height: 22px; padding: 0 7px; border-radius: 4px; background: #171E2B; font: 500 12px/22px var(--u-font) !important; color: var(--u-t3); flex: 0 1 auto; }
html.ll:not(.m-on) .l2-status i { font-style: normal; margin-right: 6px; color: var(--u-t3); }
html.ll:not(.m-on) .l2-status b { font-weight: 600; color: var(--u-t1); }
