:root{color-scheme:light}.theme-to-light{display:none}[data-theme=dark]{color-scheme:dark}[data-theme=dark] .theme-to-light{display:inline}[data-theme=dark] .theme-to-dark{display:none}.theme-toggle{white-space:nowrap}.login-card>.theme-toggle{float:right;margin:0 0 12px 12px}
html[data-theme=dark]{--h-bg:#14202b;--h-panel:#1d2d3b;--h-raised:#253b4c;--h-border:#394e60;--h-text:#e2edf5;--h-muted:#a9bccd;--h-teal:#68d2c5;--h-yellow:#edd08c;--h-yellow-bg:#3b3425}
[data-theme=dark] body{background:var(--h-bg);color:var(--h-text)}
[data-theme=dark] :is(.panel,.metric,.position-card,.topbar,.search,.login-card,dialog){background:var(--h-panel);color:var(--h-text);border-color:var(--h-border)}
[data-theme=dark] :is(th,td,.topbar,.modal-footer,.paper-leg-pnl>div,.physical-group-totals,.settlement-fields,.mini-tag,.status-pill){border-color:var(--h-border)}
[data-theme=dark] :is(button,input,select,textarea){background:var(--h-raised);color:var(--h-text);border-color:#4a6377}
[data-theme=dark] button:hover{background:#304d61}
[data-theme=dark] :is(.quiet,.icon-button,.row-link,.footer-links button,.search input){background:transparent}
[data-theme=dark] :is(.row-link,.icon-button){color:#b4dfec}
[data-theme=dark] .row-link:hover{background:transparent;color:var(--h-teal)}
[data-theme=dark] input:disabled{background:#23333f;color:#93a8b8}
[data-theme=dark] input::placeholder,[data-theme=dark] textarea::placeholder{color:#9aafbf;opacity:1}
[data-theme=dark] :is(p,.muted,.subline,.metric-note,.metric-label,.eyebrow,.check,.field,.breadcrumb,.count,.unit-label,.empty,.curve-actions label,.curve-grid-scope,.curve-matrix small,.paper-leg-pnl summary,.detail-metrics span,.physical-group-count,.physical-group-totals,.physical-totals-label,.exposure-explanation,.card-split,.card-exposure,.exposure-line span,.footer-links button,footer){color:var(--h-muted)}
[data-theme=dark] :is(.physical-group-totals strong,.physical-group-name){color:var(--h-text)}
[data-theme=dark] :is(.segmented,.detail-metrics,.index-tag,.count,.avatar,.curve-cell-detail,.physical-group-heading){background:var(--h-raised);border-color:var(--h-border);color:var(--h-text)}
[data-theme=dark] .physical-group-heading:hover{background:#304d61}
[data-theme=dark] .segmented button{background:transparent;color:var(--h-muted)}
[data-theme=dark] .segmented button.active,[data-theme=dark] .curve-grid-toolbar .segmented button[aria-pressed=true]{background:#3c5c70;color:#f4fafc}
[data-theme=dark] th{background:#203342;color:var(--h-muted)}
[data-theme=dark] tbody tr:hover{background:#263d4e}
[data-theme=dark] :is(.positive,.side.buy,.physical-group-id){color:var(--h-teal)}
[data-theme=dark] :is(.negative,.danger,.form-error,#login-error){color:#ff9ca2}
[data-theme=dark] .side.sell{color:#edb092}
[data-theme=dark] :is(.comparison,.attention,.subline.attention,.market-warning){color:var(--h-yellow)}
[data-theme=dark] :is(.notice,.detail-warning,.review-row){background:var(--h-yellow-bg);border-color:#796640;color:var(--h-yellow)}
[data-theme=dark] :is(.notice button,.scenario-banner button){background:#4b402b;border-color:#8b7548;color:#f7dfaa}
[data-theme=dark] .notice.neutral{background:#233e52;border-color:#426278;color:#bddcea}
[data-theme=dark] .badge{background:#354957;color:#d4e1eb}
[data-theme=dark] .badge.valuation{background:#254761;color:#b1daf5}
[data-theme=dark] .badge.scenario{background:#493958;color:#e0c5f1}
[data-theme=dark] .badge.review{background:#514329;color:#f5dca5}
[data-theme=dark] .status-pill{color:#b4d0e2}
[data-theme=dark] .status-pill.closed{background:#293844;color:#b3bfca}
[data-theme=dark] .primary{background:#147d7c;border-color:#299b96;color:#fff}
[data-theme=dark] .primary:hover{background:#1a9390;border-color:#48b4ad}
[data-theme=dark] .trade-table tr.selected-row,[data-theme=dark] .curve-matrix .curve-changed{background:#20473f}
[data-theme=dark] .curve-changed .curve-cell-note{color:#8cdec8}
[data-theme=dark] .curve-matrix .curve-settled{background:#243442}
[data-theme=dark] .curve-matrix .curve-cell-input{background:#2c4355;color:var(--h-text);border-color:#4a6173}
[data-theme=dark] .curve-matrix .curve-cell-input:focus{background:#324f63;border-color:var(--h-teal)}
[data-theme=dark] .curve-matrix .curve-cell-input.curve-scenario-price,[data-theme=dark] .curve-matrix .curve-cell-input.curve-scenario-price:focus{background:#54472b;border-color:#a58a4f;color:#fff0c8}
[data-theme=dark] .sidebar{background:#10273a}[data-theme=dark] .nav-item{background:transparent;border:0;color:#bdcedc}[data-theme=dark] .nav-item:hover{background:#193a54}[data-theme=dark] .nav-item.selected{background:#23465f;color:#fff}
[data-theme=dark] .login-page{background:#10273a}[data-theme=dark] dialog::backdrop{background:#07111ab8}[data-theme=dark] #toast{background:#34556a;color:#fff}
@media(max-width:700px){.topbar{height:auto;min-height:74px;gap:12px;flex-wrap:wrap;padding-top:12px;padding-bottom:12px}.top-actions{flex-wrap:wrap}}

[data-theme=dark] .status-pill.open{background:#204632;border-color:#3b7451;color:#9ee0b4}[data-theme=dark] .side.buy{background:#204b41;color:#9be4d2}[data-theme=dark] .side.sell{background:#55392a;color:#f8c29f}[data-theme=dark] .clickable-row:focus-visible{outline-color:#68d2c5}

[data-theme=dark] .position-vessel{color:var(--h-muted)}

[data-theme=dark] .paper-exposure-total span{color:var(--h-muted)}

[data-theme=dark] .cargo-unsold{background:#4c3e1f;border-color:#806b32;color:#f5d681}[data-theme=dark] .cargo-quantity{color:#f5d681}[data-theme=dark] .cargo-valuation{color:var(--h-muted)}[data-theme=dark] .cargo-valuation.needs-valuation{color:#f2c170}

[data-theme=dark] #editor .badge.valuation{background:#4c3e1f;color:#f5d681;border-color:#806b32}

/* Final semantic overrides keep the same meaning in light and dark mode. */
[data-theme=dark]{--tag-scenario-bg:#392e4e;--tag-scenario-fg:#ddc8f5;--tag-scenario-border:#7e629e;--tag-valuation-bg:#1c403b;--tag-valuation-fg:#a5e1d3;--tag-valuation-border:#407e70;--tag-short-bg:#4c2930;--tag-short-fg:#ffbcc5;--tag-short-border:#97515f}
.badge.scenario,[data-theme=dark] .badge.scenario,.scenario-banner,[data-theme=dark] .scenario-banner,.overview-scenario-comparison,[data-theme=dark] .overview-scenario-comparison{background:var(--tag-scenario-bg);color:var(--tag-scenario-fg);border-color:var(--tag-scenario-border)}
.scenario-banner button,[data-theme=dark] .scenario-banner button{background:var(--tag-scenario-bg);color:var(--tag-scenario-fg);border-color:var(--tag-scenario-border)}
.curve-matrix .curve-cell-input.curve-scenario-price,.curve-matrix .curve-cell-input.curve-scenario-price:focus,[data-theme=dark] .curve-matrix .curve-cell-input.curve-scenario-price,[data-theme=dark] .curve-matrix .curve-cell-input.curve-scenario-price:focus{background:var(--tag-scenario-bg);color:var(--tag-scenario-fg);border-color:var(--tag-scenario-border)}
.badge.valuation,#editor .badge.valuation,[data-theme=dark] .badge.valuation,[data-theme=dark] #editor .badge.valuation,.market-valuation-tag,[data-theme=dark] .market-valuation-tag,.cargo-valuation,[data-theme=dark] .cargo-valuation{display:inline-block;background:var(--tag-valuation-bg);color:var(--tag-valuation-fg);border:1px solid var(--tag-valuation-border);border-radius:5px;padding:3px 7px}
.physical-legs-table .physical-scenario-row,.physical-group-table .physical-scenario-row,[data-theme=dark] .physical-group-table .physical-scenario-row{background:var(--tag-scenario-bg)}
.physical-legs-table .physical-valuation-row,.physical-group-table .physical-valuation-row,[data-theme=dark] .physical-group-table .physical-valuation-row{background:var(--tag-valuation-bg)}
/* Valuation is violet, scenarios orange; both commercial gaps share amber. */
:root{--tag-scenario-bg:#fff0e3;--tag-scenario-fg:#91420e;--tag-scenario-border:#e7ad7f;--tag-valuation-bg:#f1eafb;--tag-valuation-fg:#65428a;--tag-valuation-border:#cbb8e2;--tag-short-bg:#fff0c2;--tag-short-fg:#78500b;--tag-short-border:#e8ca73}
[data-theme=dark]{--tag-scenario-bg:#4b3021;--tag-scenario-fg:#ffc394;--tag-scenario-border:#a2683f;--tag-valuation-bg:#392e4e;--tag-valuation-fg:#ddc8f5;--tag-valuation-border:#7e629e;--tag-short-bg:#4c3e1f;--tag-short-fg:#f5d681;--tag-short-border:#806b32}
.physical-legs-table .physical-valuation-row,.physical-group-table .physical-valuation-row,[data-theme=dark] .physical-group-table .physical-valuation-row{background:transparent}

/* Shared presentation tokens and responsive primitives. */
:root{--ui-space-1:4px;--ui-space-2:8px;--ui-space-3:12px;--ui-space-4:16px;--ui-space-6:24px;--ui-radius:8px;--ui-control-height:36px;--h-muted:#526779;--h-border:#cbd6df;--h-panel:#fff;--h-text:#182d40;--h-raised:#edf3f6}
.ui-icon{flex-shrink:0;vertical-align:middle}.nav-icon{display:inline-flex;align-items:center;justify-content:center}.tools-menu>summary,.mobile-menu>summary{align-items:center;gap:8px}
:is(main,.workspace,.panel,.metric,.form-grid,.field,.modal-heading>div,.detail-actions){min-width:0}
.form-grid>*{min-width:0}.field :is(input,select,textarea){width:100%;min-width:0;max-width:100%;box-sizing:border-box}.field{overflow-wrap:anywhere}
.login-page{grid-template-columns:minmax(0,1fr);padding:24px;min-height:100dvh}.login-card{justify-self:center;min-width:0}.login-card .check{white-space:normal;align-items:flex-start}.login-card :is(input,select,textarea){min-width:0;max-width:100%}.login-card h1{clear:both}
:is(button,summary,a,input,select,textarea,[tabindex]):focus-visible{outline:2px solid #168c89;outline-offset:3px}
[data-theme=dark] :is(button,summary,a,input,select,textarea,[tabindex]):focus-visible{outline-color:#68d2c5}
:root:not([data-theme=dark]) :is(th,.subline,.metric-label,.metric-note,.eyebrow,.unit-label,.empty,.section-unit,.detail-metrics span,.page-heading p,footer){color:var(--h-muted)}
:root:not([data-theme=dark]) .subline.attention{color:#815b12}
.table-wrap{max-width:100%;overscroll-behavior-x:contain;scrollbar-width:thin}.table-wrap:focus-visible{outline-offset:-2px}td.numeric{font-variant-numeric:tabular-nums}
#editor{max-height:calc(100dvh - 32px);max-width:calc(100vw - 32px);overscroll-behavior:contain;scrollbar-gutter:stable;padding:24px}
.modal-heading{gap:var(--ui-space-4);margin-bottom:var(--ui-space-6)}.modal-heading h2{line-height:1.3;overflow-wrap:anywhere}.modal-heading h2:focus{outline:none}.modal-heading .icon-button{display:inline-flex;align-items:center;justify-content:center;min-width:36px;min-height:36px;flex-shrink:0}.modal-footer{gap:var(--ui-space-3);padding-top:var(--ui-space-4)}.modal-footer>div{flex-wrap:wrap}.modal-footer button{white-space:normal}.account-settings #profile-form{padding-bottom:var(--ui-space-6);margin-bottom:var(--ui-space-6)}
button.overview-help{display:inline-flex;align-items:center;justify-content:center;position:static;width:28px;height:28px;min-height:28px;padding:4px;border:0;background:transparent;color:var(--h-muted);vertical-align:middle;flex:0 0 28px;cursor:pointer}
.overview-help .overview-tooltip{display:none;position:fixed;inset:auto;right:auto;transform:none;margin:0;width:300px;max-width:calc(100vw - 24px);max-height:calc(100dvh - 24px);overflow:auto;border:1px solid #4a6377;background:#15384f;color:#fff;text-align:left;box-sizing:border-box;z-index:1000;padding:12px;cursor:auto;font:400 13px/1.5 system-ui,sans-serif;letter-spacing:normal;text-transform:none}
.overview-help .overview-tooltip.help-visible{display:block}.overview-heading .overview-help .overview-tooltip,.metric .overview-help .overview-tooltip{right:auto;transform:none}
.info-control{display:inline-flex;align-items:center;gap:4px;max-width:100%}.info-control .check{white-space:normal}.metric-label{display:flex;align-items:center;gap:4px;flex-wrap:wrap}.metric-value{overflow-wrap:anywhere}
.header-menu-panel{max-height:calc(100dvh - 100px);overflow:auto}.header-menu-panel button{min-height:40px}.segmented{scrollbar-width:thin}
.market-import-form textarea{min-height:120px;height:160px}.market-import-form .footnote{max-width:70ch}
.curve-matrix input{min-width:90px;width:100%;font-variant-numeric:tabular-nums}.curve-grid-panel .curve-matrix th:not(:first-child),.curve-grid-panel .curve-matrix td{min-width:130px}.curve-grid-panel .curve-matrix{width:100%;min-width:310px}
button[aria-busy=true]{cursor:progress}.report-preview h2{display:flex;align-items:center;gap:6px;flex-wrap:wrap}.compact-help-line{margin:8px 0 12px;font-size:.8125rem;color:var(--h-muted)}.selected-position-list{margin:12px 0}.selected-position-list summary{cursor:pointer;padding:6px 0}
@media(max-width:800px){#editor .form-grid{grid-template-columns:minmax(0,1fr)}.overview-heading>.detail-actions{min-width:0;flex-wrap:wrap}.position-search-actions{flex-wrap:wrap}.position-search-actions .search{min-width:0}.trade-pagination>div{flex-wrap:wrap}.table-sort-button{min-height:36px}.curve-grid-panel .curve-matrix input{font-size:16px}}
@media(max-width:480px){.login-page{padding:16px}.login-card{padding:24px 20px}#editor{padding:16px}.modal-footer>div{width:100%}.modal-footer button{flex:1}.trade-pagination{align-items:flex-start}.form-grid{grid-template-columns:minmax(0,1fr)}button,input,select{min-height:40px}input[type=checkbox],input[type=radio]{min-height:0}.overview-toolbar .segmented{display:flex;flex-wrap:wrap;overflow:visible}.overview-toolbar .segmented button{flex:1}.modal-heading{margin-bottom:16px}}

.trade-date-disclosure{grid-template-columns:18px minmax(0,1fr)}.disclosure-icon{display:inline-flex}.physical-summary-row[aria-expanded=false] .disclosure-icon{transform:rotate(-90deg)}
.header-menu:not([open])>.header-menu-panel{display:none}

/* Compact shared table density retains room for row actions and keyboard focus. */
th{padding-top:10px;padding-bottom:10px}td{padding-top:12px;padding-bottom:12px}
:where(button,input:not([type=checkbox]):not([type=radio]),select){min-height:var(--ui-control-height)}
:where(.panel,.login-card,.header-menu-panel){border-radius:var(--ui-radius)}
.delivery-filter-menu:has(summary strong)>summary{border-color:var(--h-teal,#087d7e)}

/* Overview spacing and compact, labelled pagination controls. */
.desktop-positions>.trade-pagination{margin:16px 20px}.sensitivity-table th:first-child,.sensitivity-table td:first-child{padding-left:20px}.sensitivity-table th:last-child,.sensitivity-table td:last-child{padding-right:20px}
.pagination-arrow{display:inline-flex;align-items:center;justify-content:center;width:36px;height:36px;padding:8px;border-radius:8px}.pagination-arrow .ui-icon{width:18px;height:18px}
.curve-grid-panel>.curve-scope-notice{margin:12px 20px}.administration-actions{display:flex;justify-content:flex-end;margin:16px 0}.user-active{color:#137455;font-weight:600}[data-theme=dark] .user-active{color:#83e2ba}

.modal-heading h2+p{margin-top:10px}.administration-actions{margin:0 0 12px}.user-row-actions{display:flex;gap:6px;justify-content:flex-end}#account-name{margin:12px 0 20px}

#trade-form[data-book="paper"] #paper-period-summary{grid-column:1 / -1}
#trade-form[data-book="paper"] #paper-period-summary:empty{display:none}

/* Desktop navigation keeps every destination accessible in its compact rail. */
.sidebar-controls{display:flex;align-items:center;justify-content:space-between;gap:8px;margin:0 12px 12px}
.sidebar-controls .nav-label{margin:0}.sidebar-toggle{display:grid;place-items:center;width:32px;height:32px;min-height:32px;padding:0;border:1px solid #456076;border-radius:6px;background:transparent;color:#c8d9e5;flex:none}
.sidebar-toggle:hover{background:#23465f;color:#fff}.sidebar-toggle .ui-icon{width:17px;height:17px}.sidebar .nav-icon{display:flex;align-items:center;justify-content:center;flex:0 0 22px}.sidebar .nav-icon .ui-icon{width:20px;height:20px}.sidebar .nav-text{white-space:nowrap}.sidebar .brand .sidebar-monogram{display:none}
@media(min-width:801px){
 .sidebar.is-collapsed{width:72px;padding-left:12px;padding-right:12px}.sidebar.is-collapsed+.workspace{margin-left:72px}
 .sidebar.is-collapsed .hms-brand{margin:0 0 28px;justify-content:center;min-height:60px}.sidebar.is-collapsed .hms-logo{display:none}.sidebar.is-collapsed .sidebar-monogram{display:block;width:48px;height:42px;filter:brightness(0) invert(1)}
 .sidebar.is-collapsed .nav-text,.sidebar.is-collapsed .nav-count,.sidebar.is-collapsed .nav-label,.sidebar.is-collapsed .sidebar-status-text{display:none}
 .sidebar.is-collapsed .sidebar-controls{justify-content:center;margin:0 0 12px}.sidebar.is-collapsed .sidebar-toggle .ui-icon{transform:rotate(180deg)}
 .sidebar.is-collapsed .nav-item{justify-content:center;padding:12px 0;min-height:46px;gap:0}.sidebar.is-collapsed .local-status{justify-content:center;margin-left:0;margin-right:0;padding:20px 0 0}
 .sidebar .nav-item.selected .nav-icon{color:#6bd9cf}
}
