
  :root{--radius-sm:8px;--radius:12px;--radius-lg:16px;--shadow:0 18px 48px rgba(8,20,42,.16);--shell-width:1600px;--shell-gutter:40px;--font-ui:Inter,ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif;--font-mono:ui-monospace,SFMono-Regular,Consolas,"Liberation Mono",monospace}
  html[data-theme="dark"]{color-scheme:dark;--bg:#08111f;--bg-glow:#102b55;--surface:#101c31;--surface-raised:#14233d;--surface-subtle:#0c1729;--text:#edf4ff;--muted:#93a7c8;--border:#273b5e;--border-strong:#45669e;--blue:#87b5ff;--blue-soft:#17335d;--good:#31d59b;--good-soft:#0d2a25;--bad:#ff6d86;--bad-soft:#321722;--warn:#ffc66e;--warn-soft:#302514;--sell:#ffb173;--scrim:rgba(3,9,20,.76);--chart-grid:#283d61;--focus:0 0 0 3px rgba(135,181,255,.36);--panel:var(--surface);--panel2:var(--surface-subtle);--line:var(--border);--green:var(--good);--red:var(--bad);--amber:var(--warn)}
  html[data-theme="light"]{color-scheme:light;--bg:#f4f7fc;--bg-glow:#dce9ff;--surface:#ffffff;--surface-raised:#ffffff;--surface-subtle:#f0f4fa;--text:#12233e;--muted:#61728f;--border:#d5dfef;--border-strong:#8fa9cf;--blue:#245fb9;--blue-soft:#e8f0ff;--good:#078457;--good-soft:#e7f8f0;--bad:#c43452;--bad-soft:#ffedf1;--warn:#a76308;--warn-soft:#fff6df;--sell:#b65713;--scrim:rgba(24,39,63,.42);--chart-grid:#cfdaeb;--focus:0 0 0 3px rgba(36,95,185,.24);--panel:var(--surface);--panel2:var(--surface-subtle);--line:var(--border);--green:var(--good);--red:var(--bad);--amber:var(--warn)}
  *{box-sizing:border-box}
  html{min-height:100%;background:var(--bg);scroll-behavior:smooth}
  body.portal-body{min-height:100vh;margin:0;background:radial-gradient(1100px 500px at 78% -280px,var(--bg-glow),transparent 70%),var(--bg);color:var(--text);font:15px/1.55 var(--font-ui)}
  button,input,select,textarea{font:inherit}button{touch-action:manipulation}
  a{color:var(--blue);text-decoration:none}a:hover{text-decoration:underline}
  .visually-hidden{position:absolute!important;width:1px!important;height:1px!important;padding:0!important;margin:-1px!important;overflow:hidden!important;clip:rect(0,0,0,0)!important;white-space:nowrap!important;border:0!important}
  .skip-link{position:fixed;z-index:1000;top:10px;left:10px;transform:translateY(-170%);padding:9px 12px;border-radius:9px;background:var(--text);color:var(--bg);font-weight:700}.skip-link:focus{transform:translateY(0);outline:none}
  .portal-topbar{display:block!important;position:sticky!important;top:0!important;z-index:100!important;width:100%!important;min-height:62px!important;margin:0!important;padding:0!important;border-bottom:1px solid color-mix(in srgb,var(--border) 84%,transparent)!important;background:color-mix(in srgb,var(--bg) 92%,transparent)!important;box-shadow:0 1px 0 rgba(0,0,0,.08);backdrop-filter:blur(16px);-webkit-backdrop-filter:blur(16px)}
  .portal-topbar__inner{display:grid;grid-template-columns:auto minmax(0,1fr) auto;align-items:center;gap:14px;width:100%;max-width:var(--shell-width);min-height:62px;margin:0 auto;padding:8px var(--shell-gutter)}
  .portal-brand{display:flex;align-items:center;gap:10px;min-width:0;color:var(--text);text-decoration:none}.portal-brand:hover{color:var(--text);text-decoration:none}.portal-brand__mark{display:grid;place-items:center;width:32px;height:32px;border:1px solid var(--border-strong);border-radius:10px;background:linear-gradient(145deg,var(--blue-soft),var(--surface));color:var(--blue);font:800 13px/1 var(--font-mono)}.portal-brand__copy{display:grid;gap:0;min-width:0}.portal-brand__name{font:800 14px/1.15 var(--font-ui);letter-spacing:-.02em}.portal-brand__section{overflow:hidden;color:var(--muted);font:11px/1.25 var(--font-mono);text-overflow:ellipsis;white-space:nowrap}
  .portal-nav{display:flex;align-items:center;gap:4px;min-width:0}.portal-nav__link,.portal-logout,.portal-control{display:inline-flex;align-items:center;justify-content:center;min-height:36px;padding:7px 10px;border:1px solid transparent;border-radius:9px;color:var(--muted);background:transparent;font:600 12px/1.1 var(--font-ui);white-space:nowrap}.portal-nav__link:hover,.portal-logout:hover,.portal-control:hover{border-color:var(--border);background:var(--surface);color:var(--text);text-decoration:none}.portal-nav__link[aria-current="page"]{border-color:var(--border);background:var(--blue-soft);color:var(--blue)}.portal-nav form{margin:0}
  /* Legacy overview CSS also styles .portal-logout broadly.  Reassert the
     shared shell contract so the header remains readable in both themes. */
  .portal-topbar .portal-logout{display:inline-flex!important;align-items:center!important;justify-content:center!important;min-height:36px!important;padding:7px 10px!important;border:1px solid transparent!important;border-radius:9px!important;color:var(--muted)!important;background:transparent!important;font:600 12px/1.1 var(--font-ui)!important;white-space:nowrap!important}.portal-topbar .portal-logout:hover,.portal-topbar .portal-logout:focus-visible{border-color:var(--border)!important;background:var(--surface)!important;color:var(--text)!important;text-decoration:none!important}
  .portal-utilities{display:flex;align-items:center;gap:7px}.portal-language{display:inline-flex;align-items:center;min-height:36px;padding:3px;border:1px solid var(--border);border-radius:10px;background:var(--surface-subtle)}.portal-language button{min-width:31px;min-height:28px;padding:5px;border:0;border-radius:7px;color:var(--muted);background:transparent;font:700 11px/1 var(--font-mono);cursor:pointer}.portal-language button[aria-pressed="true"]{background:var(--blue-soft);color:var(--blue);box-shadow:0 1px 2px rgba(0,0,0,.1)}.portal-theme{display:inline-grid;place-items:center;width:36px;height:36px;padding:0;border:1px solid var(--border);border-radius:10px;color:var(--blue);background:var(--surface-subtle);cursor:pointer}.portal-theme:hover{background:var(--blue-soft)}.portal-theme__icon{display:block;width:17px;height:17px;fill:none;stroke:currentColor;stroke-width:1.75;stroke-linecap:round;stroke-linejoin:round}.portal-theme__moon{display:none}.portal-theme[aria-pressed="true"] .portal-theme__sun{display:none}.portal-theme[aria-pressed="true"] .portal-theme__moon{display:block}
  .portal-main{width:100%;max-width:var(--shell-width);margin:0 auto;padding:28px var(--shell-gutter) 46px}.legacy-shell{min-width:0;overflow-x:clip}.portal-main>.auth{margin:8vh auto}.portal-main h1,.portal-main h2,.portal-main h3{color:var(--text);letter-spacing:-.025em}.portal-main h1{margin:0 0 9px;font-size:clamp(26px,4vw,34px);line-height:1.14}.portal-main h2{margin:0 0 7px;font-size:21px;line-height:1.25}.portal-main h3{margin:0 0 6px;font-size:16px}.portal-main p{margin-top:0}.muted{color:var(--muted)}.good{color:var(--good)}.bad{color:var(--bad)}
  .portal-main[data-spa-loading="true"]{opacity:.6;pointer-events:none;transition:opacity .12s ease}
  .card{padding:20px;border:1px solid var(--border);border-radius:var(--radius);background:var(--surface);box-shadow:0 1px 0 rgba(255,255,255,.04)}.flash{margin:0 0 16px;padding:11px 13px;border:1px solid var(--border-strong);border-radius:11px;background:var(--blue-soft);color:var(--text)}.flash.error{border-color:color-mix(in srgb,var(--bad) 70%,var(--border));background:var(--bad-soft)}.notice{border-left:3px solid var(--warn);padding:11px 14px;border-radius:0 10px 10px 0;background:var(--warn-soft);color:var(--text)}
  /* Keep the generic form treatment inside the modern pages.  Legacy terminal
     fragments have their own compact buttons and SVG actions; a global button
     selector would otherwise overrule them after an SPA navigation. */
  .portal-main>:not(.legacy-shell) :is(.button,button){display:inline-flex;align-items:center;justify-content:center;min-height:40px;padding:9px 13px;border:1px solid var(--border-strong);border-radius:10px;color:var(--blue);background:var(--surface);font:700 13px/1.15 var(--font-ui);cursor:pointer;text-decoration:none}.portal-main>:not(.legacy-shell) :is(.button,button):hover{border-color:var(--blue);background:var(--blue-soft);text-decoration:none}.portal-main>:not(.legacy-shell) button:disabled{opacity:.5;cursor:not-allowed}.danger{border-color:color-mix(in srgb,var(--bad) 72%,var(--border))!important;color:var(--bad)!important;background:var(--bad-soft)!important}
  .form-field{display:grid;gap:6px;margin:14px 0 0}.form-field>label,.form-field__label{color:var(--text);font:700 12px/1.3 var(--font-ui);letter-spacing:.01em}.form-field :is(input:not([type="checkbox"]):not([type="radio"]),select,textarea){width:100%;min-height:44px;padding:10px 12px;border:1px solid var(--border-strong);border-radius:10px;background:var(--surface-subtle);color:var(--text);font:14px/1.3 var(--font-ui);box-shadow:inset 0 1px 1px rgba(0,0,0,.03)}.form-field textarea{min-height:96px;resize:vertical}.form-field :is(input,select,textarea):focus{outline:none;border-color:var(--blue);box-shadow:var(--focus)}.form-field :is(input,select,textarea):disabled{opacity:.64}.field-help{margin:0;color:var(--muted);font-size:12px;line-height:1.4}.form-error{margin:0;color:var(--bad);font-size:12px;line-height:1.4}.form-actions{display:flex;flex-wrap:wrap;gap:9px;align-items:center;margin-top:20px}
  .form-field--toggle{gap:8px;padding:13px;border:1px solid var(--border);border-radius:12px;background:var(--surface-subtle)}.toggle-control{display:inline-flex;align-items:center;gap:10px;width:max-content;min-height:28px;color:var(--text);font-size:13px;cursor:pointer}.toggle-control input[type="checkbox"]{position:relative;width:44px;height:24px;margin:0;appearance:none;border:1px solid var(--border-strong);border-radius:999px;background:var(--muted);cursor:pointer;transition:background .18s,border-color .18s}.toggle-control input[type="checkbox"]::after{position:absolute;top:3px;left:3px;width:16px;height:16px;border-radius:50%;background:#fff;box-shadow:0 1px 3px rgba(0,0,0,.35);content:"";transition:transform .18s}.toggle-control input[type="checkbox"]:checked{border-color:var(--good);background:var(--good)}.toggle-control input[type="checkbox"]:checked::after{transform:translateX(20px)}.toggle-control input[type="checkbox"]:focus-visible{outline:none;box-shadow:var(--focus)}.toggle-state{min-width:58px;color:var(--muted);font:700 11px/1 var(--font-mono)}
  .table-wrap{overflow:auto;border:1px solid var(--border);border-radius:var(--radius);background:var(--surface)}table{width:100%;border-collapse:collapse;min-width:760px}th,td{padding:12px;text-align:right;border-bottom:1px solid var(--border);white-space:nowrap}th{color:var(--muted);font:700 11px/1.2 var(--font-mono);letter-spacing:.06em;text-transform:uppercase}th:nth-child(1),td:nth-child(1),th:nth-child(2),td:nth-child(2){text-align:left}tbody tr:last-child td{border-bottom:0}.split{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:18px}.account-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:18px}.account-section,.account-operator-note{margin-top:18px}.page-heading{display:flex;align-items:flex-end;justify-content:space-between;gap:16px;margin-bottom:18px}.metric-list{display:grid;grid-template-columns:1fr 1fr;gap:8px;margin:0}.metric-list>div{padding:10px;border:1px solid var(--border);border-radius:10px;background:var(--surface-subtle)}.metric-list dt{color:var(--muted);font-size:11px}.metric-list dd{margin:4px 0 0;font-weight:700}.connection-state{padding:10px 12px;border:1px solid var(--good);border-radius:10px;background:var(--good-soft)}
  .credentials-layout{align-items:start}.credential-list-card{padding:0;overflow:hidden}.credential-list-heading{padding:20px 22px 14px;border-bottom:1px solid var(--border)}.credential-list-heading h2{margin:0 0 4px}.credential-list-heading p{margin:0;font-size:12px}.credential-list{padding:0 22px}.credential-row{display:flex;align-items:center;justify-content:space-between;gap:18px;min-height:84px;padding:15px 0;border-bottom:1px solid var(--border)}.credential-row:last-child{border-bottom:0}.credential-copy{min-width:0}.credential-title{display:flex;align-items:center;gap:9px;font-weight:800}.credential-env{display:inline-flex;align-items:center;min-height:22px;padding:2px 7px;border:1px solid var(--border-strong);border-radius:6px;color:var(--blue);font-size:11px;letter-spacing:.04em;text-transform:uppercase}.credential-label{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.credential-meta{display:flex;flex-wrap:wrap;gap:4px 12px;margin-top:5px;color:var(--muted);font-size:12px}.credential-action{flex:0 0 auto}.credential-action form{margin:0}
  .legacy-shell>main{max-width:none!important;margin:0!important;padding:0!important}
  html[data-theme="light"] .legacy-shell :is(.leader>div,.fleet-kpi,.direction-stat,.settings-dialog,.chart-dialog,.target-popover,.experiment-card,.portfolio-section .table-wrap,.table-wrap){background:var(--surface)!important;color:var(--text)}html[data-theme="light"] .legacy-shell :is(.pnl-part,.open-detail-row>td,.execution-detail-row>td,.settings-field input,.settings-field select,.custom-period input){background:var(--surface-subtle)!important;color:var(--text)!important}html[data-theme="light"] .legacy-shell :is(.leader>div.green,.fleet-kpi--positive,.direction-stat.green){background:var(--good-soft)!important}html[data-theme="light"] .legacy-shell :is(.leader>div.red,.fleet-kpi--negative,.direction-stat.red){background:var(--bad-soft)!important}
  /* Legacy live views are data-rich trading terminals.  Their compact controls
     deliberately opt out of the generic portal button rule above: otherwise a
     normal form button's padding hides the SVG glyph and turns segmented
     controls into a row of disconnected pills. */
  .portal-body--legacy .legacy-shell{color:var(--text);font-family:var(--font-mono)}
  .legacy-shell .icon-button{--terminal-icon-size:30px;display:inline-grid!important;place-items:center!important;flex:0 0 var(--terminal-icon-size);min-width:var(--terminal-icon-size)!important;width:var(--terminal-icon-size)!important;height:var(--terminal-icon-size)!important;min-height:var(--terminal-icon-size)!important;padding:0!important;border:1px solid var(--border-strong)!important;border-radius:7px!important;color:var(--blue)!important;background:var(--surface-subtle)!important;font:700 16px/1 var(--font-mono)!important;line-height:1!important;vertical-align:middle}.legacy-shell :is(.closed-positions-table,.open-groups-table,.open-detail-table) .icon-button{--terminal-icon-size:26px}.legacy-shell .icon-button:hover,.legacy-shell .icon-button:focus-visible{border-color:var(--blue)!important;background:var(--blue-soft)!important}.legacy-shell .icon-button svg{display:block!important;width:16px!important;height:16px!important;max-width:none!important;max-height:none!important;overflow:visible!important;fill:none!important;stroke:currentColor!important;stroke-width:1.7!important;stroke-linecap:round!important;stroke-linejoin:round!important;opacity:1!important}.legacy-shell :is(.closed-positions-table,.open-groups-table,.open-detail-table) .icon-button svg{width:15px!important;height:15px!important}.legacy-shell .icon-button .chart-icon{width:17px!important;height:17px!important}.legacy-shell .icon-button .chevron-icon{width:16px!important;height:11px!important}.legacy-shell .trade-actions{align-items:center}.legacy-shell .open-group-name>.icon-button{margin:0}
  .legacy-shell :is(.control-button,.chart-close,.period-buttons button,.custom-period button,.metric-mode button,.closed-pnl-filter button,.history-actions button,.target-button,.dynamics-mode button,.pnl-mode-button){min-height:30px!important;height:auto;padding:5px 9px!important;border:1px solid var(--border-strong)!important;border-radius:7px!important;color:var(--blue)!important;background:var(--surface-subtle)!important;font:700 12px/1.15 var(--font-mono)!important;box-shadow:none!important}.legacy-shell :is(.control-button,.chart-close,.period-buttons button,.custom-period button,.metric-mode button,.closed-pnl-filter button,.history-actions button,.target-button,.dynamics-mode button,.pnl-mode-button):hover{border-color:var(--blue)!important;background:var(--blue-soft)!important;color:var(--text)!important}.legacy-shell .control-button.danger,.legacy-shell .danger{border-color:color-mix(in srgb,var(--bad) 72%,var(--border))!important;color:var(--bad)!important;background:var(--bad-soft)!important}
  .legacy-shell :is(.pnl-mode,.dynamics-mode,.metric-mode,.closed-pnl-filter){display:inline-flex!important;align-items:center!important;gap:3px!important;padding:3px!important;border:1px solid var(--border)!important;border-radius:9px!important;background:var(--surface-subtle)!important;box-shadow:inset 0 1px 0 rgba(255,255,255,.03)}.legacy-shell .pnl-mode{height:34px!important;gap:2px!important;padding:3px!important}.legacy-shell .pnl-mode>span{padding:0 7px!important;color:var(--muted)!important;font:700 10px/1 var(--font-mono)!important;letter-spacing:.08em!important}.legacy-shell :is(.pnl-mode-button,.dynamics-mode button,.metric-mode button,.closed-pnl-filter button){min-width:0!important;min-height:26px!important;height:26px!important;padding:0 10px!important;border:1px solid transparent!important;border-radius:6px!important;color:var(--muted)!important;background:transparent!important}.legacy-shell :is(.pnl-mode-button,.dynamics-mode button,.metric-mode button,.closed-pnl-filter button)[aria-pressed="true"]{border-color:var(--border-strong)!important;color:var(--text)!important;background:var(--blue-soft)!important;box-shadow:inset 0 0 0 1px color-mix(in srgb,var(--blue) 25%,transparent)!important}.legacy-shell .dynamics-mode{min-height:34px!important}.legacy-shell .dynamics-mode button{min-width:78px!important}.legacy-shell .metric-mode,.legacy-shell .closed-pnl-filter{padding:2px!important}.legacy-shell .metric-mode button,.legacy-shell .closed-pnl-filter button{min-width:0!important}
  /* A target disclosure can be an icon.  It must not inherit the text-button
     padding/auto-height contract above, otherwise its glyph drifts next to
     chart icons in fixed trading-table rows. */
  .legacy-shell .target-button.icon-button{display:inline-grid!important;place-items:center!important;flex:0 0 var(--terminal-icon-size)!important;min-width:var(--terminal-icon-size)!important;width:var(--terminal-icon-size)!important;height:var(--terminal-icon-size)!important;min-height:var(--terminal-icon-size)!important;padding:0!important;font:700 16px/1 var(--font-mono)!important;line-height:1!important}
  /* The old fragments include a few dark hex values for chart surfaces.  Map
     those terminal details back to theme tokens so light mode is readable,
     while preserving the original data layouts and interaction contracts. */
  html[data-theme="light"] .legacy-shell :is(.pnl-mode,.dynamics-mode,.metric-mode,.closed-pnl-filter,.outcome-scale-bar,.trade-dynamics-empty,.execution-detail-row>td,.open-detail-row>td,.target-popover,.settings-dialog,.chart-dialog,.custom-period input){background:var(--surface-subtle)!important;color:var(--text)!important}html[data-theme="light"] .legacy-shell :is(.pnl-part,.capital-track){background:var(--surface-subtle)!important;border-color:var(--border)!important}html[data-theme="light"] .legacy-shell :is(.execution-detail-row>td,.open-detail-row>td){box-shadow:inset 3px 0 0 var(--blue-soft)}html[data-theme="light"] .legacy-shell .icon-button{background:var(--surface)!important}html[data-theme="light"] .legacy-shell .trade-dynamics-chart .grid{stroke:var(--chart-grid)!important}html[data-theme="light"] .legacy-shell .trade-dynamics-chart .zero{stroke:var(--border-strong)!important}html[data-theme="light"] .legacy-shell .trade-dynamics-chart .axis-label{fill:var(--muted)!important}html[data-theme="light"] .legacy-shell :is(.trade-dynamics-chart .point-profit,.trade-dynamics-chart .point-loss,.trade-dynamics-chart .point-net,.trade-dynamics-chart .point-strategy){stroke:var(--surface)!important}
  :focus-visible{outline:none;box-shadow:var(--focus)}
  @media(max-width:920px){.portal-topbar__inner{grid-template-columns:minmax(0,1fr) auto;padding:9px 18px}.portal-nav{grid-column:1 / -1;grid-row:2;order:3;max-width:100%;padding:1px 0 3px;overflow-x:auto;scrollbar-width:none}.portal-nav::-webkit-scrollbar{display:none}.portal-topbar__inner{min-height:unset}.portal-nav__link,.portal-logout{flex:0 0 auto}.portal-main{padding:22px 18px 38px}.split,.account-grid{grid-template-columns:1fr}.page-heading{align-items:flex-start;flex-direction:column}.metric-list{grid-template-columns:1fr}}
  @media(max-width:560px){.portal-topbar__inner{gap:10px;padding:8px 12px}.portal-brand__section{max-width:170px}.portal-utilities{gap:5px}.portal-theme{width:34px;height:34px}.portal-main{padding:18px 12px 32px}.card{padding:16px;border-radius:12px}.credential-list{padding:0 15px}.credential-list-heading{padding:17px 15px 12px}.credential-row{gap:10px}.credential-meta{display:block;line-height:1.7}.credential-meta span{display:block}.credential-action button{min-width:auto;padding:8px 9px}.table-wrap{border-radius:12px}}
  /* Trading tables are intentionally wide.  On a phone, preserve their column
     relationships and let the user pan them; the earlier generic card-grid
     conversion hid headers and made live position data impossible to scan. */
  @media(max-width:660px){.portal-topbar{min-height:58px!important}.portal-topbar__inner{gap:8px;min-height:58px;padding:7px 12px 4px}.portal-brand__mark{width:30px;height:30px;border-radius:8px}.portal-nav{padding:4px 0 7px;overscroll-behavior-inline:contain;scroll-snap-type:x proximity}.portal-nav__link,.portal-logout{min-height:34px;padding:6px 9px;font-size:11px;scroll-snap-align:start}.portal-utilities{gap:4px}.portal-language{min-height:34px;padding:2px}.portal-language button{min-width:28px;min-height:28px}.portal-theme{width:34px;height:34px}.portal-main .table-wrap{overflow-x:auto!important;overflow-y:hidden!important;border:1px solid var(--border);background:var(--surface);-webkit-overflow-scrolling:touch;overscroll-behavior-inline:contain;scrollbar-width:thin}.portal-main .table-wrap table:not(.execution-table){display:table!important;background:transparent!important}}
  @media(max-width:660px){body.portal-body.portal-body--legacy .legacy-shell .settings-modal{align-items:end!important;padding:0!important}body.portal-body.portal-body--legacy .legacy-shell .settings-dialog{width:100%!important;max-width:720px!important;max-height:min(82dvh,680px)!important;padding:14px!important;border-radius:16px 16px 0 0!important;overflow:hidden!important;overscroll-behavior:contain}body.portal-body.portal-body--legacy .legacy-shell .settings-dialog__header{flex:0 0 auto}body.portal-body.portal-body--legacy .legacy-shell .settings-dialog__body{flex:1 1 auto;min-height:0;overflow-y:auto;overscroll-behavior:contain;padding:0 1px}body.portal-body.portal-body--legacy .legacy-shell .settings-description{margin:9px 0 10px!important;line-height:1.45}body.portal-body.portal-body--legacy .legacy-shell .settings-form{gap:10px!important}body.portal-body.portal-body--legacy .legacy-shell .settings-group{padding:10px!important;border-radius:10px!important}body.portal-body.portal-body--legacy .legacy-shell .settings-grid{grid-template-columns:repeat(2,minmax(0,1fr))!important;gap:10px!important}body.portal-body.portal-body--legacy .legacy-shell .settings-field{grid-template-rows:auto 40px auto!important;gap:4px!important}body.portal-body.portal-body--legacy .legacy-shell .settings-field input,body.portal-body.portal-body--legacy .legacy-shell .settings-field select{min-height:40px!important;height:40px!important;padding:8px 9px!important}body.portal-body.portal-body--legacy .legacy-shell .settings-field small{min-height:0!important;font-size:10px!important;line-height:1.3!important}body.portal-body.portal-body--legacy .legacy-shell .settings-actions{position:relative!important;bottom:auto!important;flex:0 0 auto;margin:0 -14px -14px!important;padding:10px 14px max(10px,env(safe-area-inset-bottom))!important}}
  @media(max-width:419px){.portal-brand__section{display:none}.portal-nav{gap:2px}.portal-nav__link,.portal-logout{padding:6px 5px;font-size:10px}body.portal-body.portal-body--legacy .legacy-shell .settings-grid{grid-template-columns:1fr!important}}


/* Utility pages share the portal container and existing form tokens. */
.export-page,.fleet-settings-page{width:100%;max-width:none;margin:0;min-width:0}
.export-grid{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:20px;margin:24px 0}
.export-field{display:grid;grid-template-rows:auto 44px;gap:8px;min-width:0;color:var(--text);font:700 12px/1.3 var(--font-ui)}
.portal-main .portal-form-control{box-sizing:border-box;width:100%;min-width:0;min-height:44px;height:44px;padding:10px 12px;border:1px solid var(--border-strong);border-radius:10px;background-color:var(--surface-subtle);color:var(--text);font:14px/1.3 var(--font-ui);color-scheme:dark}
html[data-theme="light"] .portal-main .portal-form-control{color-scheme:light}
.portal-main select.portal-form-control{appearance:none;padding-right:38px;background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2387a5ce' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");background-repeat:no-repeat;background-position:right 12px center}
.portal-main .portal-form-control:focus-visible{outline:none;border-color:var(--blue);box-shadow:var(--focus)}
.portal-main .portal-form-control option{color:var(--text);background:var(--surface)}
.health-toolbar .portal-form-control{width:180px;flex:0 0 180px}
.fleet-settings-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:20px;align-items:start;margin-top:20px}
.fleet-settings-grid>.form-field{margin:0;min-width:0}
.fleet-settings-grid .form-field--toggle{height:100%}
@media(max-width:900px){.export-grid{grid-template-columns:repeat(2,minmax(0,1fr))}}
@media(max-width:660px){.export-grid,.fleet-settings-grid{grid-template-columns:1fr;gap:16px}.health-toolbar{gap:12px}.health-toolbar #healthRange{flex-basis:100%}}


/* Live tables and SVG charts replace their children on each feed update.
   Do not let the browser anchor the document to those moving descendants. */
html:has(body.portal-body--legacy),
body.portal-body--legacy,
body.portal-body--legacy .legacy-shell { overflow-anchor: none; }
html:has(body.portal-body--legacy) { scroll-behavior: auto; }


/* Keep complete values and controls; scroll the table, never squeeze its cells. */
html body .portal-main .leaderboard-wrap{max-width:100%;min-width:0;overflow-x:auto!important;-webkit-overflow-scrolling:touch;overscroll-behavior-x:contain}
html body .portal-main .leaderboard-wrap table.leaderboard-table{table-layout:auto!important;width:max-content!important;min-width:100%!important}
html body .portal-main .leaderboard-wrap table.leaderboard-table th:nth-child(n),
html body .portal-main .leaderboard-wrap table.leaderboard-table td:nth-child(n){width:auto!important;min-width:0!important;max-width:none!important;overflow:visible!important;text-overflow:clip!important;white-space:nowrap!important;padding:12px 14px!important}
html body .portal-main .leaderboard-wrap .bot-link{max-width:none!important;overflow:visible!important;text-overflow:clip!important;white-space:nowrap!important}
html body .portal-main .leaderboard-wrap .capital-load{min-width:104px;overflow:visible!important}
html body .portal-main .leaderboard-wrap .capital-track{flex-shrink:0}
@media(max-width:800px){html body .portal-main .leaderboard-wrap table.leaderboard-table{font-size:12px!important}html body .portal-main .leaderboard-wrap table.leaderboard-table th:nth-child(n){font-size:11px!important}html body .portal-main .leaderboard-wrap table.leaderboard-table td:nth-child(n){padding:12px!important}}

@font-face{font-family:"Nexi UI";src:url("/ui-assets/d490a243d2162567e652dea595fa17e2eb13ae48390fa7532495a4faf0a6d219.woff2");font-weight:400 800;font-style:normal;font-display:optional}

/* Nexi application chrome; shared metrics prevent delayed CSS/font reflow. */
:root{--font-ui:"Nexi UI",ui-sans-serif,system-ui,-apple-system,"Segoe UI",sans-serif;--portal-font:var(--font-ui);--font-mono:var(--font-ui)}
body.portal-body{font-family:var(--font-ui);font-variant-numeric:tabular-nums;font-feature-settings:"ss01"}
body.portal-body :is(button,input,select,textarea){font-family:var(--font-ui)!important}
body.portal-body :is(.legacy-shell,.legacy-shell table,.legacy-shell th,.legacy-shell td,.legacy-shell svg text){font-family:var(--font-ui)!important}
body.portal-body :is(pre,code){font-family:ui-monospace,SFMono-Regular,Consolas,monospace}
body.portal-body .portal-brand--nexi{padding:0;gap:0;color:var(--text)!important;flex:none;line-height:1}
body.portal-body .portal-brand__logo{display:block;width:116px;height:32px;flex:none;overflow:visible}
body.portal-body .portal-topbar__inner{gap:24px;min-height:68px}
body.portal-body .portal-nav{gap:4px}
body.portal-body .portal-nav__link{font-size:13px;font-weight:600;letter-spacing:0;white-space:nowrap}
body.portal-body .portal-utilities{gap:8px;flex-wrap:nowrap;flex:none}
body.portal-body .portal-icon-link{display:inline-flex;align-items:center;justify-content:center;width:40px;height:40px;min-width:40px;flex:none;border:1px solid var(--border);border-radius:10px;background:var(--surface-subtle);color:var(--muted)!important;text-decoration:none;padding:0}
body.portal-body .portal-icon-link svg{display:block;width:20px;height:20px;flex:none}
body.portal-body .portal-icon-link:hover{color:var(--text)!important;border-color:var(--border-strong);background:var(--blue-soft)}
body.portal-body .portal-icon-link[aria-current="page"]{background:var(--blue-soft);color:var(--blue)!important;border-color:var(--border-strong)}
body.portal-body .portal-icon-link:focus-visible{outline:2px solid var(--blue);outline-offset:3px}
body.portal-body .portal-language button{font-family:var(--font-ui);font-weight:650}
body.portal-body .account-signout{display:flex;align-items:center;justify-content:space-between;gap:20px;margin-top:24px}
body.portal-body .account-signout h2,body.portal-body .account-signout p{margin:0}
body.portal-body .account-signout p{margin-top:5px}
body.portal-body .account-signout form{flex:none}
@media(max-width:1100px){body.portal-body .portal-topbar__inner{gap:12px}body.portal-body .portal-nav__link{padding-inline:10px}}
@media(max-width:920px){body.portal-body .portal-topbar__inner{padding-block:12px;gap:10px 14px}body.portal-body .portal-nav{padding:0;margin:0;gap:4px}body.portal-body .portal-brand__logo{width:110px;height:30px}}
@media(max-width:480px){body.portal-body .portal-topbar__inner{padding-inline:12px;gap:10px}body.portal-body .portal-brand__logo{width:96px;height:27px}body.portal-body .portal-utilities{gap:5px}body.portal-body .portal-icon-link,body.portal-body .portal-theme{width:36px;height:38px;min-width:36px}body.portal-body .portal-language{padding:3px}body.portal-body .portal-language button{min-width:27px;padding-inline:6px}body.portal-body .portal-nav__link{min-height:40px}body.portal-body .account-signout{align-items:flex-start;flex-direction:column}}
@media(max-width:400px){body.portal-body .portal-brand__logo{width:82px}body.portal-body .portal-utilities{gap:4px}}
@media(max-width:359px){body.portal-body .portal-brand__logo{width:64px;height:22px}body.portal-body .portal-utilities{gap:3px}body.portal-body .portal-topbar__inner{padding-inline:10px;column-gap:8px}body.portal-body .portal-icon-link,body.portal-body .portal-theme{width:32px;min-width:32px;height:36px}body.portal-body .portal-icon-link svg{width:18px;height:18px}}

body.portal-body{font-optical-sizing:auto}

/* Shared Fleet + Clients leaderboard. Keep this after the existing UI bundle.
   The ID intentionally outranks the older mobile max-content/nowrap !important
   rules. Only this leaderboard changes; trade journals retain their own layout. */
html body.portal-body .portal-main .legacy-shell #overviewMain .leaderboard-wrap {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  overflow: visible !important;
}
html body.portal-body .portal-main .legacy-shell #overviewMain .leaderboard-wrap table.leaderboard-table {
  width: 100% !important;
  min-width: 0 !important;
  max-width: 100% !important;
  table-layout: fixed !important;
  font-size: clamp(11px, .83vw, 12px) !important;
  font-variant-numeric: tabular-nums;
  border-collapse: collapse;
}
html body.portal-body .portal-main .legacy-shell #overviewMain .leaderboard-wrap table.leaderboard-table :is(th, td):nth-child(n) {
  box-sizing: border-box;
  min-width: 0 !important;
  max-width: none !important;
  padding: 10px 6px !important;
  height: auto !important;
  min-height: 0 !important;
  text-align: center !important;
  vertical-align: middle;
  white-space: normal !important;
  overflow-wrap: anywhere;
  overflow: visible !important;
  text-overflow: clip !important;
  letter-spacing: 0;
  line-height: 1.3;
}
html body.portal-body .portal-main .legacy-shell #overviewMain .leaderboard-wrap table.leaderboard-table th:nth-child(n) {
  padding-block: 9px !important;
  font-size: 10.5px !important;
  font-weight: 650;
  line-height: 1.25;
  text-transform: none;
  overflow-wrap: normal;
}
html body.portal-body .portal-main .legacy-shell #overviewMain .leaderboard-table .leaderboard-bot {
  display: block;
  width: 100%;
  max-width: none !important;
  white-space: normal !important;
  overflow-wrap: anywhere;
  overflow: visible !important;
  text-overflow: clip !important;
  text-align: left;
}
html body.portal-body .portal-main .legacy-shell #overviewMain .leaderboard-table :is(.capital-load, .capital-track, .margin-meter) {
  box-sizing: border-box;
  width: 100% !important;
  min-width: 0 !important;
  max-width: 88px !important;
  margin-inline: auto;
}
html body.portal-body .portal-main .legacy-shell #overviewMain .leaderboard-table :is(.capital-track, .margin-meter) {
  min-height: 25px;
  padding-inline: 3px;
  font-size: 11px;
  white-space: nowrap !important;
}
html body.portal-body .portal-main .legacy-shell #overviewMain .leaderboard-table .capital-track b {
  font-size: 11px;
  letter-spacing: 0;
}
html body.portal-body .portal-main .legacy-shell #overviewMain .leaderboard-table .leaderboard-status {
  width: 28px !important;
  height: 28px !important;
  margin-inline: auto;
  overflow: visible !important;
}
html body.portal-body .portal-main .legacy-shell #overviewMain .leaderboard-table .leaderboard-action .bot-actions {
  display: flex !important;
  width: 100%;
  min-width: 0;
  max-width: none !important;
  justify-content: center !important;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px !important;
  overflow: visible !important;
}
html body.portal-body .portal-main .legacy-shell #overviewMain .leaderboard-table .bot-actions .control-button {
  min-width: 0 !important;
  max-width: 100%;
  min-height: 30px;
  padding: 5px 8px;
  font-size: 11px;
  line-height: 1.2;
  white-space: normal !important;
  overflow-wrap: anywhere;
  overflow: visible !important;
  text-overflow: clip !important;
}
html body.portal-body .portal-main .legacy-shell #overviewMain .leaderboard-table .bot-actions .bot-settings {
  flex: 0 0 28px !important;
  width: 28px !important;
  height: 30px !important;
  padding: 0 !important;
  font-size: 16px;
}
html body.portal-body .portal-main .legacy-shell #overviewMain .leaderboard-table .dd-detail-trigger {
  max-width: 100%;
  padding: 5px 1px;
  white-space: normal;
  overflow-wrap: anywhere;
}

/* Result: 14 complete columns, including average and controls, total = 100%. */
html body.portal-body[data-leaderboard-metric-mode="result"] .portal-main .legacy-shell #overviewMain .leaderboard-table :is(th, td):nth-child(1) { width: 2.5% !important; }
html body.portal-body[data-leaderboard-metric-mode="result"] .portal-main .legacy-shell #overviewMain .leaderboard-table :is(th, td):nth-child(2) { width: 9.5% !important; text-align: left !important; }
html body.portal-body[data-leaderboard-metric-mode="result"] .portal-main .legacy-shell #overviewMain .leaderboard-table :is(th, td):nth-child(3) { width: 4.5% !important; }
html body.portal-body[data-leaderboard-metric-mode="result"] .portal-main .legacy-shell #overviewMain .leaderboard-table :is(th, td):nth-child(4) { width: 9% !important; }
html body.portal-body[data-leaderboard-metric-mode="result"] .portal-main .legacy-shell #overviewMain .leaderboard-table :is(th, td):nth-child(5) { width: 6% !important; }
html body.portal-body[data-leaderboard-metric-mode="result"] .portal-main .legacy-shell #overviewMain .leaderboard-table :is(th, td):nth-child(6) { width: 7.5% !important; }
html body.portal-body[data-leaderboard-metric-mode="result"] .portal-main .legacy-shell #overviewMain .leaderboard-table :is(th, td):nth-child(7) { width: 6.5% !important; }
html body.portal-body[data-leaderboard-metric-mode="result"] .portal-main .legacy-shell #overviewMain .leaderboard-table :is(th, td):nth-child(8) { width: 8.5% !important; }
html body.portal-body[data-leaderboard-metric-mode="result"] .portal-main .legacy-shell #overviewMain .leaderboard-table :is(th, td):nth-child(9) { width: 5.5% !important; }
html body.portal-body[data-leaderboard-metric-mode="result"] .portal-main .legacy-shell #overviewMain .leaderboard-table :is(th, td):nth-child(10) { width: 6.5% !important; }
html body.portal-body[data-leaderboard-metric-mode="result"] .portal-main .legacy-shell #overviewMain .leaderboard-table :is(th, td):nth-child(11) { width: 8.5% !important; }
html body.portal-body[data-leaderboard-metric-mode="result"] .portal-main .legacy-shell #overviewMain .leaderboard-table :is(th, td):nth-child(12) { width: 6.5% !important; }
html body.portal-body[data-leaderboard-metric-mode="result"] .portal-main .legacy-shell #overviewMain .leaderboard-table :is(th, td):nth-child(13) { width: 8% !important; }
html body.portal-body[data-leaderboard-metric-mode="result"] .portal-main .legacy-shell #overviewMain .leaderboard-table :is(th, td):nth-child(14) { width: 11% !important; }

/* Analysis: Frozen retains room for TO BE and Debt; percentages wrap honestly. */
html body.portal-body[data-leaderboard-metric-mode="analysis"] .portal-main .legacy-shell #overviewMain .leaderboard-table :is(th, td):nth-child(1) { width: 9% !important; text-align: left !important; }
html body.portal-body[data-leaderboard-metric-mode="analysis"] .portal-main .legacy-shell #overviewMain .leaderboard-table :is(th, td):nth-child(2) { width: 6% !important; }
html body.portal-body[data-leaderboard-metric-mode="analysis"] .portal-main .legacy-shell #overviewMain .leaderboard-table :is(th, td):nth-child(3) { width: 6% !important; }
html body.portal-body[data-leaderboard-metric-mode="analysis"] .portal-main .legacy-shell #overviewMain .leaderboard-table :is(th, td):nth-child(4) { width: 10% !important; }
html body.portal-body[data-leaderboard-metric-mode="analysis"] .portal-main .legacy-shell #overviewMain .leaderboard-table :is(th, td):nth-child(5) { width: 10% !important; }
html body.portal-body[data-leaderboard-metric-mode="analysis"] .portal-main .legacy-shell #overviewMain .leaderboard-table :is(th, td):nth-child(6) { width: 8% !important; }
html body.portal-body[data-leaderboard-metric-mode="analysis"] .portal-main .legacy-shell #overviewMain .leaderboard-table :is(th, td):nth-child(7) { width: 20% !important; }
html body.portal-body[data-leaderboard-metric-mode="analysis"] .portal-main .legacy-shell #overviewMain .leaderboard-table :is(th, td):nth-child(8) { width: 13% !important; }
html body.portal-body[data-leaderboard-metric-mode="analysis"] .portal-main .legacy-shell #overviewMain .leaderboard-table :is(th, td):nth-child(9) { width: 8% !important; }
html body.portal-body[data-leaderboard-metric-mode="analysis"] .portal-main .legacy-shell #overviewMain .leaderboard-table :is(th, td):nth-child(10) { width: 10% !important; }

/* Reserve the same compact rows before and after first data. Table cells may
   still grow for wrapped content; this is a floor, never a clipping height. */
@media (min-width: 1120px) {
  html body.portal-body .portal-main .legacy-shell #overviewMain .leaderboard-wrap table.leaderboard-table > :is(tbody, tfoot) > tr > td:nth-child(n) {
    height: 52px !important;
  }
  html body.portal-body .portal-main .legacy-shell #overviewMain .leaderboard-wrap table.leaderboard-table > thead > tr > th:nth-child(n) {
    height: 44px !important;
  }
}

/* Keep the familiar table on phones and tablets. Only this region scrolls;
   desktop retains the compact, complete set of columns above. */
@media (max-width: 1119px) {
  html body.portal-body .portal-main .legacy-shell #overviewMain .leaderboard-wrap {
    overflow-x: auto !important;
    overflow-y: hidden !important;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-x: contain;
    scrollbar-width: thin;
    scrollbar-color: var(--border-strong, #42628e) var(--surface-subtle, #0c1728);
  }
  html body.portal-body .portal-main .legacy-shell #overviewMain .leaderboard-wrap table.leaderboard-table {
    display: table !important;
    width: 1280px !important;
    min-width: 1280px !important;
    max-width: none !important;
    font-size: 12px !important;
  }
  html body.portal-body .portal-main .legacy-shell #overviewMain .leaderboard-wrap table.leaderboard-table td:nth-child(n) {
    height: 54px !important;
    white-space: nowrap !important;
    overflow-wrap: normal;
  }
  html body.portal-body .portal-main .legacy-shell #overviewMain .leaderboard-wrap table.leaderboard-table th:nth-child(n) {
    height: 44px !important;
  }
  html body.portal-body .portal-main .legacy-shell #overviewMain .leaderboard-table td[data-mobile-label]::before {
    content: none !important;
    display: none !important;
  }
  html body.portal-body .portal-main .legacy-shell #overviewMain .leaderboard-table .leaderboard-action .bot-actions {
    flex-wrap: nowrap;
  }
  html body.portal-body .portal-main .legacy-shell #overviewMain .leaderboard-table .bot-actions .control-button {
    min-height: 40px !important;
    padding: 9px 12px !important;
    font-size: 12px !important;
    white-space: nowrap !important;
  }
  html body.portal-body .portal-main .legacy-shell #overviewMain .leaderboard-table .bot-actions .bot-settings {
    flex-basis: 40px !important;
    width: 40px !important;
    height: 40px !important;
    padding: 0 !important;
    font-size: 18px !important;
  }
}

/* Source selection stays disabled when locked, but remains legible in light UI. */
html[data-theme="light"] body.portal-body .portal-main :is(.client-form, .source-row) {
  --input-bg: var(--surface, #fff);
}
html[data-theme="light"] body.portal-body .portal-main :is(.client-form select, .client-form input:not([type="hidden"]), .source-row select) {
  background-color: var(--input-bg, #fff) !important;
  border-color: var(--border-strong, #a5b8d0) !important;
  color: var(--text, #15263c) !important;
  color-scheme: light;
}
html[data-theme="light"] body.portal-body .portal-main :is(.client-form select, .source-row select) {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 16 16'%3E%3Cpath d='m4 6 4 4 4-4' fill='none' stroke='%23566880' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") !important;
}
html[data-theme="light"] body.portal-body .portal-main :is(.client-form select:disabled, .client-form input:disabled, .source-row select:disabled) {
  opacity: 1 !important;
  background-color: var(--surface-subtle, #edf2f8) !important;
  color: var(--text, #15263c) !important;
  -webkit-text-fill-color: var(--text, #15263c) !important;
  border-color: var(--border, #c5d2e3) !important;
  cursor: not-allowed;
}
html[data-theme="light"] body.portal-body .portal-main :is(.client-form select option, .source-row select option) {
  background: var(--surface, #fff) !important;
  color: var(--text, #15263c) !important;
}
