:root{color-scheme:dark;accent-color:#e8c675;--gold:#e8c675;--hair:#3b3b3b}
body{font-family:'Instrument Sans','Helvetica Neue',system-ui,sans-serif}
::selection{background:#685730;color:#fff4d8}
a{color:var(--gold);text-underline-offset:.2em}
:focus-visible{outline:2px solid var(--gold);outline-offset:3px}
button:not(:disabled):hover,summary:hover{border-color:#a49063;color:#ffe2a0}
button.primary:not(:disabled):hover,#start:not(:disabled):hover{color:#211d15;background:#f3d699}
.desk-nav{display:flex;align-items:center;max-width:none;padding:0 max(3vw,calc((100vw - 1390px)/2));height:62px;gap:34px;background:#1c1d1e;border-bottom:1px solid var(--hair)}
.desk-nav>b{display:inline-flex;align-items:center;gap:10px;color:#e8c675;letter-spacing:.09em;font-size:19px}
.desk-nav>b:before{content:"";width:17px;height:18px;border:2px solid var(--gold);border-right-width:6px;transform:skewY(-17deg);box-shadow:inset -3px 0 #1c1d1e}
.desk-nav nav{display:flex;height:100%;gap:22px;align-items:stretch}
.desk-nav nav a{display:flex;align-items:center;text-decoration:none;font-size:14px;color:#bcb9b2;border-bottom:2px solid transparent;margin:0}
.desk-nav nav a[aria-current]{color:var(--gold);border-color:var(--gold)}
.desk-nav .venue{margin-left:auto;color:#bcb9b2;display:flex;align-items:center;gap:9px;font-size:13px}
.venue i{width:3px;height:3px;border-radius:50%;background:#9f9481}
h1,h2{letter-spacing:-.025em}h1{font-weight:650}h2{font-weight:600}
#form>h2:not(:first-child){border-top:1px solid var(--hair);margin-top:6px;padding-top:19px}
#form summary{padding:6px 0;color:#d7c8a6}input[type=checkbox]{accent-color:var(--gold)}
article,.ledger,section,.metric,form{border-radius:9px}
.desk-nav+main{padding-top:28px}
#trading-layout{display:grid;grid-template-columns:minmax(245px,315px) minmax(0,1fr);gap:16px;align-items:start}
#run-controls p{line-height:1.55}#run-controls button{width:100%;margin:4px 0}
#run-controls #symbols{font-size:13px;overflow-wrap:anywhere}
.scan-heading{display:flex;align-items:center;justify-content:space-between;gap:12px;flex-wrap:wrap}.scan-heading h2{margin:0}.scan-heading button{font-size:13px}
#scanMeta,#scanDetail{font-size:13px;line-height:1.5}#scanResults{overflow-x:auto}
#scanResults th,#scanResults td{padding:10px 8px;font-size:13px}#scanResults td:first-child{font-weight:650}
#scanResults svg{width:78px;height:23px}.scan-signal{color:var(--gold)}.scan-error{color:#e8a68f}
.trade-notice{font-size:12px;color:#c2ad81}.scan-coin{font-size:13px;padding:4px 7px}
#scanDetail{border-left:2px solid var(--gold);padding:4px 12px;margin-bottom:0}
#run-controls dl{display:grid;grid-template-columns:1fr auto;gap:6px 12px;font-size:13px}
#run-controls dt{color:#bcb9b2}#run-controls dd{margin:0;text-align:right}
@media(max-width:960px){#trading-layout{grid-template-columns:1fr}#run-controls #symbols{max-width:75ch}}
@media(max-width:550px){.desk-nav{gap:16px;padding:0 14px}.desk-nav nav{gap:12px}.desk-nav .venue{font-size:11px}.desk-nav>b{font-size:16px}.desk-nav>b:before{width:12px;height:14px}.desk-nav nav a{font-size:13px}}

#health{border-block:1px solid #57503e;background:linear-gradient(90deg,#322e26,#222325);color:#e5c98b;padding:13px 17px;margin:0 0 18px;font-size:14px}
#run-controls h2{margin-top:0}#run-controls #status{color:#dfbf7b}

#poolForm label{display:inline-grid;gap:5px;margin-right:10px;font-size:13px}#poolForm input{background:#171819;border:1px solid #55534b;color:#f1eee8;padding:8px;border-radius:5px;font:inherit}

/* Graphite and gold across the server desk. */
:root{--gold:#f0bf42;--hair:#31343a;accent-color:var(--gold)}
body:has(.desk-nav){background:#0c0d10;color:#ebedef}
.desk-nav{background:#111317;border-bottom-color:#303239}
.desk-nav>b{color:#f0c451}.desk-nav>b:before{content:"♥";display:grid;place-items:center;width:30px;height:30px;font:20px/1 system-ui;color:#f4c64e;background:#30291a;border:1px solid #645332;transform:none;border-radius:8px;box-shadow:none}
body:has(.desk-nav) main section,body:has(.desk-nav) aside,body:has(.desk-nav) .metric{background:#16181d;border-color:#303339}
body:has(.desk-nav) button.gold,body:has(.desk-nav) #start{background:#f0be37;color:#19160c;border-color:#d7aa34}
@media(max-width:620px){.desk-nav{gap:12px;padding-inline:10px}.desk-nav nav{gap:12px}.desk-nav>b{font-size:15px}.desk-nav .venue{display:none}}
#archive-trades{border-top:1px solid #373a40;margin-top:22px;padding-top:22px;scroll-margin-top:12px}
.journal-head,.review-head,.review-nav{display:flex;align-items:center;justify-content:space-between;gap:12px;flex-wrap:wrap}
.journal-head h2,.review-head h3{margin:0}.journal-filter{display:flex;gap:6px}
.journal-filter button[aria-pressed=true]{border-color:#bc963c;background:#342d1e;color:#f6ce68}
.review-head{border-top:1px solid #32353a;padding:16px 0 10px}.review-head h3{font-size:21px}.review-head span,#tradeCount,#chartInfo{font-size:13px;color:#c1bcb2}.review-head strong{font-size:22px}
.review-nav{margin:6px 0 14px}.review-nav label{display:flex;align-items:center}.review-nav select{width:auto}.review-nav button{padding:5px 13px}
.chart-scroll,.trade-table{overflow:auto}.chart-scroll{background:#101217;border:1px solid #32353a;border-radius:6px}
#archiveChart{display:block;width:100%;min-width:610px;fill:#e6e3d9;font:12px system-ui}
#tradeDetails{display:flex;flex-wrap:wrap;gap:12px 24px}#tradeDetails div{display:grid;gap:4px}#tradeDetails dt{font-size:12px}#tradeDetails dd{text-align:left;font-variant-numeric:tabular-nums}
.trade-table{max-height:300px}.trade-table table{border-collapse:collapse;width:100%;white-space:nowrap}.trade-table caption{text-align:left;padding:12px 0;color:#c6c4bc}.trade-table th,.trade-table td{text-align:left;border-bottom:1px solid #34363a;padding:8px}.trade-table th{position:sticky;top:0;background:#23252a;font-size:13px}.trade-table tr[aria-selected=true]{background:#342e20}
.trade-table tbody tr{cursor:pointer}.trade-table tbody tr:hover{background:#292b30}.trade-table button{padding:4px 8px}
#archive-trades .loss{color:#f09f90}#archive-trades .gain{color:#8cd7b8}
body .gain{color:#82dcb3}body .loss{color:#ff9c99}
@media(max-width:700px){
 body:has(.desk-nav) main{padding-left:max(12px,env(safe-area-inset-left));padding-right:max(12px,env(safe-area-inset-right));padding-bottom:max(32px,env(safe-area-inset-bottom))}
 .desk-nav a,.desk-nav button{min-height:44px}
 body:has(.desk-nav) .layout,body:has(.desk-nav) #trading-layout,body:has(.desk-nav) .main-grid{min-width:0}
 body:has(.desk-nav) main>*,body:has(.desk-nav) .layout>*,body:has(.desk-nav) #trading-layout>*{min-width:0;max-width:100%}
 body:has(.desk-nav) button,body:has(.desk-nav) select,body:has(.desk-nav) .agent .actions button{min-height:44px}
 body:has(.desk-nav) input:not([type=checkbox]),body:has(.desk-nav) select{font-size:16px}
 #manage .coins label,#coins label{min-height:44px}body:has(.desk-nav) dialog{width:calc(100vw - 24px);max-height:88dvh;padding:16px}
 .chart-scroll #archiveChart{min-width:0;min-height:155px}.trade-table,.scroll,#positions,#periods,#orders,#scanResults{max-width:100%;overflow-x:auto}
 #manage .actions,.agent .actions{flex-wrap:wrap}.agent .actions button{flex:1 1 44%}
}
#scanDetail{margin:1rem 0;padding:.75rem;min-width:0}
#scanDetail h3{margin:0 0 .7rem}#scanDetail select{max-width:100%;width:auto}
#analysisChart{width:100%;display:block;background:#14181b;margin:.6rem 0}
#analysisChart[hidden],#scanDetail[hidden]{display:none}
.scan-coin[aria-pressed=true]{border-color:var(--gold);color:var(--gold)}
#scanResults .expanded-coin td{white-space:normal;padding:4px;vertical-align:top}
#scanResults .expanded-coin #analysisChart{width:100%;height:215px;touch-action:pan-y}
#scanResults .expanded-coin #scanDetail{position:sticky;left:0;margin:.25rem 0}
.scan-tools{display:flex;flex-wrap:wrap;align-items:center;gap:.5rem}.scan-tools button{min-height:38px}
.scan-tools button[aria-pressed=true]{color:#ffe39c;border-color:#af8d43;background:#352e20}
#analysisWindow[hidden]{display:none}.scan-tools input{vertical-align:middle;max-width:115px}

.desk-nav .brand-mark{display:inline-flex;align-items:center;flex:none}.brand-mark img{display:block;border-radius:9px}
.desk-nav .page-refresh{margin:0 0 0 auto;flex:none;min-height:40px;padding:6px 12px;border:1px solid var(--hair);border-radius:10px;background:transparent;color:inherit;font:inherit;font-size:14px;cursor:pointer}
.desk-nav .venue+.page-refresh{margin-left:0}@media(max-width:760px){.desk-nav .venue{display:none}.desk-nav .venue+.page-refresh{margin-left:auto;min-height:44px}}

#scanner #scanOverview,#scanner #scanDiagnostics{display:none}
#scanner .rank-legend summary{cursor:pointer;font-size:14px;color:var(--muted)}
@media(max-width:700px){
 #scanner.combined-scan .scan-heading{margin:0 0 12px}
 #scanner.combined-scan #scanMeta:has(.scan-complete),#scanner.combined-scan .scan-table-note{display:none}
 #scanner.combined-scan #scanOverview{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));margin:0 0 10px;padding:10px 0;background:#1d2026;border-radius:10px}
 #scanner #scanOverview div{padding:0 10px}
 #scanner #scanOverview div+div{border-left:1px solid #363a41}
 #scanner #scanOverview dt{font-size:12px;color:#b4bac3}
 #scanner #scanOverview dd{margin:3px 0 0;text-align:left;font-size:19px;font-weight:650;font-variant-numeric:tabular-nums}
 #scanner.combined-scan #quoteClock{display:block;font-size:12px;line-height:1.45;color:#b4bac3}
 #scanner.combined-scan .rank-legend{margin:2px 0 0;border-bottom:1px solid #363a41}
 #scanner.combined-scan .rank-legend summary{padding:12px 0;font-size:13px}
 #scanner .rank-legend p,#scanner #scanDiagnostics{font-size:13px;line-height:1.45}
 #scanner #scanDiagnostics{display:block;margin:8px 0 14px;color:#b4bac3}
 #scanner.combined-scan #scanResults{width:100%;overflow:visible}
 #scanner.combined-scan #scanResults table,#scanner.combined-scan #scanResults tbody{display:block;width:100%;min-width:0}
 #scanner.combined-scan #scanResults tr:has(th){display:none}
 #scanner.combined-scan #scanResults tr:has(.scan-coin){
  display:grid;grid-template-columns:minmax(0,1fr) minmax(90px,auto);grid-template-areas:"coin ready" "stage distance" "agent price";
  align-items:center;gap:4px 8px;padding:8px 0 11px;border-bottom:1px solid #34373d
 }
 #scanner.combined-scan #scanResults td{display:block;padding:0;border:0;min-width:0;white-space:normal;overflow-wrap:anywhere;text-align:left}
 #scanner.combined-scan #scanResults td:nth-child(1){grid-area:coin}
 #scanner.combined-scan #scanResults td:nth-child(2){grid-area:agent;color:#aab1bb;font-size:12px}
 #scanner.combined-scan #scanResults td:nth-child(3){grid-area:ready;text-align:right;color:#f0ca6a;font-size:20px;font-weight:650;font-variant-numeric:tabular-nums}
 #scanner.combined-scan .rank-cell{justify-items:end;gap:2px}
 #scanner.combined-scan .rank-cell progress{width:56px;height:5px}
 #scanner.combined-scan #scanResults td:nth-child(4){grid-area:stage;font-size:13px}
 #scanner.combined-scan #scanResults td:nth-child(5){grid-area:distance;text-align:right;font-size:12px}
 #scanner.combined-scan #scanResults td:nth-child(5)::before{content:"До границы ";color:#aab1bb}
 #scanner.combined-scan #scanResults td:nth-child(6){grid-area:price;text-align:right;color:#aab1bb;font-size:12px}
 #scanner.combined-scan #scanResults td:nth-child(6)::after{content:" USDT"}
 #scanner.combined-scan #scanResults td:nth-child(n+7){display:none}
 #scanner.combined-scan .scan-coin{padding:0 10px;min-height:44px;font-weight:700;font-size:16px}
 #scanner.combined-scan #scanResults tr.expanded-coin{display:block;width:100%}
 #scanner.combined-scan #scanResults .expanded-coin #scanDetail{box-sizing:border-box;position:static;width:100%!important;max-width:100%;margin:0;padding:12px 6px}
 #scanner.combined-scan #scanDetail #analysisAgentLabel select{display:block;width:100%;max-width:100%}
}
@media(max-width:700px){
 #portfolioView .main-grid{grid-template-columns:minmax(0,1fr)}
 #portfolioView .titlebar{flex-wrap:wrap}
}

/* Dashboard, agent forms and shared controls */
:root{color-scheme:dark;--surface:#1a2028;--line:#404955;--muted:#bcc4d0;--gold:#f5c96b;--hair:#38424e}
body:has(.desk-nav){background:#0c1117;color:#f2f4f8}
body .desk-nav{background:#111820;border-color:#36414d;gap:clamp(10px,2vw,32px)}
body .desk-nav nav a{color:#bdc6d2;font-weight:550}
body .desk-nav nav a[aria-current=false]{color:#bdc6d2;border-color:transparent}
body .desk-nav nav a[aria-current=page]{color:#ffdb8c;border-color:#e7bd67}
body:has(.desk-nav) main :is(button:not(.near-coin,.fill-row,.plain),a.control),body .desk-nav .page-refresh,body:has(.desk-nav) dialog button{
 box-sizing:border-box;padding:8px 13px;min-height:38px;border:1px solid #515c6b;border-radius:10px;
 background:#232c37;color:#f1f4f9;line-height:1.25;font-weight:550;cursor:pointer
}
body:has(.desk-nav) :is(main,dialog) select{
 appearance:auto;min-height:38px;max-width:100%;padding:7px 9px;border:1px solid #515c6b;border-radius:9px;background:#1c2530;color:#f1f4f9;font:inherit;cursor:pointer
}
body:has(.desk-nav) :is(main,dialog) select option{color:#f3f6fb;background:#202935}
body:has(.desk-nav) :is(main,dialog) :is(button.gold,#start,button[aria-pressed=true]){
 color:#211a0a;background:#f2cd7a;border-color:#f8d992
}
body:has(.desk-nav) :is(button,select,a.control):focus-visible,body:has(.desk-nav) summary:focus-visible{outline:2px solid #ffe09b;outline-offset:3px}
@media(hover:hover){body:has(.desk-nav) :is(button,select,a.control):not(:disabled):hover{filter:brightness(1.13)}}
body:has(.desk-nav) :is(button,select):disabled{opacity:.48;cursor:default}
body:has(.desk-nav) main .pane,body:has(.desk-nav) main .metric{background:var(--surface);border:1px solid #3a4552;border-radius:17px}
body:has(.desk-nav) main .pane{padding:clamp(18px,2.15vw,32px)}
body:has(.desk-nav) main .metric{padding:18px 20px;min-width:0}
body:has(.desk-nav) main .metric small,body:has(.desk-nav) :is(.unit,.chart-note,.sub,.head p,.near-info small){color:var(--muted)}
body:has(.desk-nav) :is(main,dialog) h2{font-size:clamp(19px,1.65vw,24px);line-height:1.2;letter-spacing:-.035em}
#portfolioView #widgetBoard{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:20px;align-items:start}
#widgetBoard>[data-widget]{grid-column:1/-1;min-width:0;margin:0}
#widgetBoard>[data-widget].board-half{grid-column:span 1}
body:not(.agents-only) #widgetBoard>.board-off,.agents-only #widgetBoard>[data-widget]:not(.agents){display:none}
body.agents-only #widgetBoard>.agents{grid-column:1/-1}
#portfolioView .titlebar{align-items:center;gap:10px;flex-wrap:wrap}
#widgetBoard .titlebar h2{margin-right:auto}
#widgetBoard .metrics{gap:12px}
#widgetBoard .metric b{line-height:1.22;margin:8px 0 5px}
#widgetBoard #riskTotals{border:0;border-top:1px solid var(--line);margin-top:16px;padding:12px 0 0;line-height:1.55}
#widgetBoard #nearby{background:linear-gradient(125deg,#292a27,#1b222a 60%);border-color:#4c4b40}
#nearby.board-half #nearbyCoins{grid-template-columns:1fr;gap:6px;margin-top:14px}
#nearby .near-coin{background:#ffffff08;border:1px solid #ffffff0d;border-radius:12px;padding:12px 14px}
#nearby .near-info small{line-height:1.35}
#widgetBoard #cards .agent{border-color:#3b4653;background:#182029;padding:18px 20px}
#widgetBoard #scanner .scan-heading{margin:0 0 12px}
#scanner #scanFilters{display:flex;align-items:center;flex-wrap:wrap;gap:10px;margin-bottom:12px}
#scanner #scanFilters label{display:flex;align-items:center;gap:10px;min-width:0;color:var(--muted);font-size:14px}
#scanner #scanFilters select{min-width:0}
#scanner #scanMore{display:block;margin:16px auto 4px;color:#ffdb8c}
#scanner #scanResults tr[hidden],#scanner #scanMore[hidden]{display:none!important}
#boardDialog{width:min(540px,calc(100vw - 24px));padding:24px;border:1px solid #546172;border-radius:18px;background:#19212b;color:#f1f4f9}
#boardDialog h2{margin:0 0 8px}
#widgetList{margin:18px 0}
.widget-choice{display:grid;grid-template-columns:minmax(0,1fr) auto auto;align-items:center;gap:8px;padding:10px 0;border-top:1px solid var(--line)}
#boardDialog .widget-choice label{display:flex;align-items:center;gap:9px;margin:0;font-size:15px}
#boardDialog .widget-choice input{display:inline-block;width:18px;height:18px;margin:0;padding:0}
.widget-moves{grid-column:3;display:flex;gap:4px}
.board-actions{display:flex;justify-content:space-between;gap:8px}
@media(max-width:850px){
 #portfolioView #widgetBoard{grid-template-columns:minmax(0,1fr);gap:14px}
 #widgetBoard>[data-widget].board-half{grid-column:1/-1}
}
@media(max-width:700px){
 body:has(.desk-nav) main .pane{padding:16px;border-radius:14px}
 body:has(.desk-nav) main .metric{padding:13px 14px}
 body:has(.desk-nav) :is(main,dialog) :is(button,select,a.control){min-height:44px}
 #portfolioView .metrics{grid-template-columns:repeat(2,minmax(0,1fr));gap:8px}
 #widgetBoard .metrics .metric:last-child{grid-column:1/-1}
 #boardDialog .widget-choice{grid-template-columns:minmax(0,1fr) auto}
 #boardDialog .widget-moves{grid-column:2;grid-row:1/3}
 #boardDialog .widget-choice select{grid-row:2;grid-column:1;width:fit-content}
 #boardDialog{padding:16px}
}

/* Ricci's neutral surfaces use gold for actions and a lighter balance card. */
body:has(.desk-nav){
 --surface:#212120;--line:#43433f;--hair:#393936;--muted:#c4c2b9;--gold:#ebc785;
 background:#15171a;color:#f2f4f7;font-family:"Instrument Sans",-apple-system,BlinkMacSystemFont,"Helvetica Neue",sans-serif
}
body .desk-nav{background:#1b1e22;border-color:#383d44}
body .desk-nav nav{align-items:center;gap:4px}
body .desk-nav nav a{height:auto;min-height:36px;border:0;border-radius:20px;padding:7px 14px;color:#d0cec5}
body .desk-nav nav a[aria-current=page]{background:#38352e;color:#ffe1a5}
body:has(.desk-nav) main .pane,body:has(.desk-nav) main section,body:has(.desk-nav) main aside,
body:has(.desk-nav) main .metric,body:has(.desk-nav) dialog{
 background:#222529;border-color:#393e44;border-radius:20px
}
body:has(.desk-nav) main :is(button:not(.near-coin,.fill-row,.plain),a.control),
body .desk-nav .page-refresh,body:has(.desk-nav) dialog button,
body:has(.desk-nav) :is(main,dialog) select{
 border-radius:14px;background:#2e3237;color:#f3f6f9;border-color:#505861
}
body:has(.desk-nav) :is(main,dialog) :is(button.gold,#start,button[aria-pressed=true]){
 background:#edcf93;color:#241f17;border-color:#edcf93
}
body:has(.desk-nav) :is(main,dialog) select option{background:#262625;color:#f8f6ef}
body:has(.desk-nav) main .head{padding-block:6px 4px}
#widgetBoard .metrics{grid-template-columns:1.6fr repeat(4,minmax(0,1fr))}
#widgetBoard .metric{display:flex;flex-direction:column;justify-content:space-between;min-width:0;padding:clamp(15px,1.6vw,26px)}
#widgetBoard .metric small{color:#c9c7bf}
#widgetBoard .metric:has(#capital){
 order:-1;background:linear-gradient(118deg,#b9c0c9,#e4e8ed 50%,#c1c8d1 82%,#d2d6dc);
 border-color:transparent;color:#171b20
}
#widgetBoard .metric:has(#capital) small{color:#333c46}
#widgetBoard #capital{font-size:clamp(30px,3vw,48px);letter-spacing:-.055em}
#widgetBoard #nearby{background:#24282c;border-color:#42484e}
#widgetBoard #nearby .near-coin{background:#2b2f33;border-color:#454b52;border-radius:15px}
#widgetBoard .near-info small{color:#cac8c0}
#widgetBoard #nearby .near-ring b{background:#232421}
#widgetBoard .pane .titlebar{margin-bottom:10px}
#scanner.combined-scan #scanOverview{background:#2e302c}
body:has(.desk-nav) main :is(.sub,.unit,.chart-note){color:#c3c1b9}
body:has(.desk-nav) #boardDialog{background:#222221;color:#f8f7f0}
@media(max-width:900px){
 #widgetBoard .metrics{grid-template-columns:repeat(4,minmax(0,1fr))}
 #widgetBoard .metric:has(#capital){grid-column:1/-1}
}
@media(max-width:700px){
 body .desk-nav nav a{padding-inline:10px;min-height:44px}
 body:has(.desk-nav) main .pane{padding:18px 16px}
 #widgetBoard .metrics{grid-template-columns:repeat(2,minmax(0,1fr));gap:9px}
 #widgetBoard .metrics .metric:last-child{grid-column:auto}
 #widgetBoard .metric{padding:14px 16px;min-height:92px}
 #widgetBoard .metric:has(#capital){padding:20px;min-height:133px}
 #widgetBoard #capital{font-size:38px}
 #widgetBoard .metric b{overflow-wrap:anywhere}
}

/* Agent cards share the canvas, with contrast carried by type and controls. */
#widgetBoard > .agents{
 background:rgba(255,255,255,.012);
 border-color:rgba(197,208,221,.17)
}
#widgetBoard #cards .agent{
 background:linear-gradient(115deg,rgba(189,202,217,.065),rgba(150,163,177,.028) 72%);
 border-color:rgba(197,208,221,.24);
 border-radius:15px
}
#widgetBoard #cards .agent h3,#widgetBoard #cards .pnl:not(.positive,.negative){color:#f6f8fb}
#widgetBoard #cards .agent .sub,#widgetBoard #cards .agent small{color:#c5cbd2}
#widgetBoard #cards .agent .allocation-line{color:#e4e9ef}
#widgetBoard #cards .badgetxt{color:#cdd3da}
#widgetBoard #cards .badgetxt.live{color:#a6e3c1}
#widgetBoard #cards summary{color:#f1d292}
#widgetBoard #cards .agent-journal{border-top-color:rgba(197,208,221,.19)}
#widgetBoard #cards .agent :is(a.control,button:not(.fill-row)){
 background:rgba(255,255,255,.065);border-color:#717b88;color:#f5f7fa
}
#widgetBoard #cards .agent :is(a.control,button:not(.fill-row)):focus-visible{
 outline:2px solid #ffdc91;outline-offset:3px
}

.allocation-summary{margin:0 0 16px;padding:12px 16px;background:rgba(161,179,200,.05);border-radius:14px}.allocation-summary:empty{display:none}
.allocation-bar{display:flex;gap:2px;height:9px;overflow:hidden;border-radius:9px;margin:12px 0;background:#353941}.allocation-bar span{min-width:0}
#splitDialog{width:min(470px,calc(100vw - 32px));max-height:85dvh;overflow:auto;box-sizing:border-box}
#splitDialog output,.split-row small{display:block;color:#d2d8e0;font-variant-numeric:tabular-nums}
#splitDialog input[type=range]{width:100%;padding:0;accent-color:#e6bc64;min-height:32px;box-shadow:none}
.split-row{padding:10px 0;border-top:1px solid #444a52}.split-row strong{padding-inline-start:8px}.split-row small{margin-top:4px}

@media(max-width:760px){
 #positions table,#positions tbody{display:block;width:100%;min-width:0}
 #positions thead{position:absolute;width:1px;height:1px;overflow:hidden;clip-path:inset(50%)}
 #positions tbody tr{display:grid;grid-template-columns:minmax(0,1fr) minmax(0,1fr);gap:6px 12px;padding:12px 0;border-bottom:1px solid #414751}
 #positions td{white-space:normal;overflow-wrap:anywhere;border:0;padding:0;min-width:0}
 #positions td:nth-child(1){grid-area:1/1;font-weight:700}
 #positions td:nth-child(4){grid-area:1/2;justify-self:end;text-align:right;font-weight:700;font-variant-numeric:tabular-nums}
 #positions td:nth-child(4)::before{content:'PnL ';color:#bbc2cd;font-size:.8em;font-weight:500}
 #positions td:nth-child(2){grid-area:2/1;color:#bac1cb}
 #positions td:nth-child(3){grid-area:2/2;text-align:right}
 #positions td:nth-child(5){grid-area:3/1}
 #positions td:nth-child(6){grid-area:3/2;text-align:right}
 #positions td:nth-child(n+5)::before{content:attr(data-label) ' ';font-size:.85em;color:#b9c1cc}
}

#ddChart{display:block;width:100%;height:138px;margin-top:8px}#ddCaption{color:#c2c9d3}

body .desk-nav button.page-refresh,body main .actions :is(#boardSettings,#pinButton){display:inline-grid;place-items:center;flex:none;width:44px;height:44px;min-height:44px;padding:0;border-radius:13px}
body main .actions :is(#boardSettings,#pinButton)[hidden]{display:none}
:is(.page-refresh,#boardSettings,#pinButton) svg{width:21px;height:21px;pointer-events:none}
#pinButton .shackle-open,#pinButton[data-unlocked=true] .shackle-closed{display:none}
#pinButton[data-unlocked=true] .shackle-open{display:block}
#pinButton[data-unlocked=true]{color:#ebc978}
#positionHistory{border-top:1px solid #40454c;margin-top:20px;padding-top:16px}
#positionHistory h3{margin:0}
#positionHistory .titlebar{flex-wrap:wrap;gap:8px}
.history-pages{display:flex;align-items:center;gap:8px}
.history-pages[hidden],#positionHistory[hidden]{display:none}
#positionHistory .history-pages button{min-width:44px;min-height:44px;padding:0;font-size:22px}
#positionHistoryList{list-style:none;margin:12px 0 0;padding:0}
.closed-position{display:grid;grid-template-columns:minmax(0,1fr) auto;gap:12px;padding:10px 0;align-items:center}
.closed-position+.closed-position{border-top:1px solid #353a42}
.closed-position strong,.closed-position small{display:block;overflow-wrap:anywhere}
.closed-position small{color:#b7bec8}.closed-position b{font-variant-numeric:tabular-nums;white-space:nowrap}

.allocation-summary .allocation-total{font-size:1.15rem;font-variant-numeric:tabular-nums}.allocation-summary .sub,.allocation-active{font-size:.85rem;color:#c4ced8}
.allocation-active{margin:8px 0}.allocation-legend{display:flex;flex-wrap:wrap;gap:6px 18px;padding:0;margin:10px 0 2px;list-style:none}
.allocation-legend li{display:flex;align-items:baseline;gap:5px 7px;flex-wrap:wrap;max-width:100%;overflow-wrap:anywhere;font-size:.85rem}
.allocation-legend i{width:8px;height:8px;border-radius:50%;align-self:center}.allocation-legend small{color:#c4ced8}
.agent-capital-tools{display:flex;align-items:center;gap:8px;flex:none}#widgetBoard #cards .agent button.allocation-gear{display:grid;place-items:center;width:44px;height:44px;padding:0;background:transparent;border-color:transparent;color:#d3dbe6}
#widgetBoard #cards .agent button.allocation-gear:hover{color:#eace8e;border-color:#647080}.allocation-gear svg{width:18px;height:18px}
.split-row.split-selected{border-radius:8px;background:rgba(178,198,218,.07);outline-offset:2px}
@media(max-width:620px){.allocation-legend{display:grid}.agent .row.split>div:first-child{min-width:0;overflow-wrap:anywhere}.agent-capital-tools{gap:2px}}

/* Shared app surfaces and type, from the phone layout to the full-width desk. */
body:has(.desk-nav){
 --surface:#202428;--line:#40474f;--muted:#bac2cc;--hair:#383d44;
 background:#14171a;color:#f3f5f7
}
body:has(.desk-nav) :is(main,dialog) input:not([type=checkbox],[type=radio],[type=range]){
 background:#1a1e22;color:#f2f5f8;border:1px solid #56606a;border-radius:12px;padding:9px 11px
}
body:has(.desk-nav) main :is(.sub,.unit,.chart-note),
#widgetBoard .metric:not(:has(#capital)) small,#widgetBoard .near-info small{color:var(--muted)}
body:has(.desk-nav) dialog::backdrop{background:rgba(9,12,16,.72)}
#widgetBoard>[data-widget]{--card-pad:clamp(18px,2vw,28px);--coin-pad:12px;--widget-type:1rem}
#widgetBoard>[data-scale=small]{--card-pad:14px;--coin-pad:7px;--widget-type:.875rem}
#widgetBoard>[data-scale=large]{--card-pad:clamp(22px,3vw,40px);--coin-pad:17px;--widget-type:1.125rem}
#widgetBoard>.pane,#widgetBoard>#marketSlot>.pane{padding:var(--card-pad);font-size:var(--widget-type)}
#widgetBoard>[data-scale=small] .chart{height:175px}
#widgetBoard>[data-scale=large] .chart{height:320px}
#widgetBoard>[data-scale=small] #ddChart{height:110px}
#widgetBoard>[data-scale=large] #ddChart{height:190px}
#widgetBoard>[data-scale=small] :is(.metric,.agent){padding:12px 14px}
#widgetBoard>[data-scale=large] :is(.metric,.agent){padding:22px 24px}
#widgetBoard>#nearby #nearbyCoins{
 display:grid;grid-template-columns:repeat(auto-fit,minmax(min(100%,228px),1fr));gap:8px
}
#widgetBoard>#nearby .near-coin{padding:var(--coin-pad);background:#292e33;min-width:0}
#nearby .near-info{overflow-wrap:anywhere}
#nearbyMore{display:block;margin:14px auto 0}
#widgetBoard .widget-handle{display:inline-grid;place-items:center;flex:none;width:40px;height:40px;
 min-height:40px;padding:0;border:1px solid transparent;border-radius:50%;background:transparent;color:#bcc5ce}
#widgetBoard .widget-handle svg{width:20px;height:20px;pointer-events:none}
#widgetBoard .widget-handle:hover,#widgetBoard .widget-handle:focus-visible{background:#343a40;color:#ffe1a5}
#widgetBoard .metrics .metric:last-child{position:relative}
#widgetBoard .metrics .metric:last-child>small:first-child{padding-right:34px}
#widgetBoard .metrics .widget-handle{position:absolute;top:5px;right:5px}
.agents-only #widgetBoard .widget-handle{display:none}
#boardDialog{overflow-y:auto;max-height:85dvh}
#boardDialog .widget-density{grid-column:1/-1;justify-content:space-between}
.widget-choice>.widget-moves{grid-row:1}
@media(min-width:901px){
 body:has(.desk-nav) main{padding-inline:clamp(24px,4vw,64px)}
 body:has(.desk-nav) .desk-nav{min-height:68px;padding-inline:max(4vw,calc((100vw - 1390px)/2))}
 body:has(.desk-nav) main .head{padding-block:10px 8px}
 #widgetBoard .metrics{grid-template-columns:minmax(220px,1.4fr) repeat(2,minmax(0,1fr));gap:10px}
 #widgetBoard .metrics .metric{min-height:96px}
 #widgetBoard .metrics .metric:has(#capital){grid-column:1;grid-row:1/span 2;justify-content:center;gap:6px}
 #widgetBoard #capital{font-size:clamp(38px,3.7vw,58px);line-height:1.05}
 body:has(.desk-nav) #cfg section,body:has(.desk-nav) .layout>aside{padding:clamp(20px,2vw,30px)}
 #scanner.combined-scan #scanOverview{display:grid;grid-template-columns:repeat(3,1fr);max-width:620px;margin:12px 0;border-radius:14px;background:#2a2f34;padding:12px 4px}
 #scanner.combined-scan #scanOverview div{padding-inline:14px}
 #scanner.combined-scan #scanOverview div+div{border-left:1px solid #444b53}
 #scanner.combined-scan #scanOverview dt{font-size:13px;color:var(--muted)}
 #scanner.combined-scan #scanOverview dd{font-size:22px;font-weight:600;margin:3px 0 0}
 #scanner.combined-scan #scanMeta:has(.scan-complete){display:none}
 #scanner.combined-scan #scanDiagnostics{display:block}
}
@media(max-width:700px){
 #widgetBoard .widget-handle{width:44px;height:44px}
 #widgetBoard>.pane,#widgetBoard>#marketSlot>.pane{padding:var(--card-pad)}
 #widgetBoard .widget-choice{min-width:0}
}
#widgetBoard #scanner .widget-handle svg{width:20px;height:20px}
#widgetBoard .widget-dragging{opacity:.65}
#widgetBoard .widget-target{outline:2px dashed var(--gold);outline-offset:2px}
#widgetBoard [data-scale=large] :is(.near-info strong,#scanResults td,#positions td,.agent .sub){font-size:1.05rem}
#widgetBoard [data-scale=small] :is(#scanResults td,#positions td,.agent .sub){font-size:.84rem}
#widgetBoard>[data-scale=small] #cards .agent{padding:12px 14px}
#widgetBoard>[data-scale=large] #cards .agent{padding:22px 24px}

#widgetBoard>[data-widget]{position:relative}
#widgetBoard .widget-resize{
 position:absolute;right:1px;bottom:1px;display:grid;place-items:end;
 width:32px;height:32px;min-height:32px;padding:0 6px 6px 0;color:#a8b1bb;
 background:transparent;border:0;cursor:ns-resize;touch-action:none;user-select:none
}
#widgetBoard .widget-resize svg{width:17px;height:17px;pointer-events:none}
#widgetBoard .widget-resize:is(:hover,:focus-visible){color:var(--gold)}
body.agents-only #widgetBoard .widget-resize{display:none}
#widgetBoard>.widget-sized{min-height:var(--widget-height)}
#widgetBoard>#nearby{min-height:0}
#widgetBoard>#nearby.near-fit{
 display:flex;flex-direction:column;height:var(--near-height);min-height:240px
}
#widgetBoard>#nearby.near-fit>.titlebar,#nearby.near-fit #nearbyMore{flex:none}
#widgetBoard>#nearby.near-fit #nearbyCoins{
 flex:1 1 0;min-height:0;align-content:start;grid-auto-rows:max-content;overflow:auto
}
#widgetBoard .near-coin[hidden],#nearbyMore[hidden]{display:none}
#widgetBoard>[data-widget=pnl].widget-sized{display:flex;flex-direction:column}
#widgetBoard>[data-widget=pnl].widget-sized .chart{flex:1 0 auto}
#widgetBoard>#marketSlot.widget-sized>#scanner{min-height:var(--widget-height)}
#widgetBoard>#marketSlot.widget-sized #scanResults{max-height:max(260px,calc(var(--widget-height) - 210px));overflow:auto}
@media(pointer:coarse){#widgetBoard .widget-resize{width:44px;height:44px}}
.allocation-summary .allocation-total{margin-inline-start:auto}
#widgetBoard .allocation-summary .allocation-gear{
 display:grid;place-items:center;width:44px;height:44px;padding:0;background:transparent;border:0;color:#d8e0e9
}
#widgetBoard .allocation-summary .allocation-gear:hover{color:var(--gold)}
#splitDialog input[type=range]{width:100%;height:32px;display:block}

/* Per-agent realized results share the same journal in owner and viewer modes. */
.agent-pnl-chart{width:100%;min-width:0;margin:12px 0 24px;color:#bdc6d1}
.agent-pnl-chart svg{display:block;width:100%;height:220px;overflow:visible}
.agent-pnl-chart .agent-pnl-caption{min-height:1.5em;font-size:13px;line-height:1.5}

.year-tags:has(.agent-year-strip){display:block;min-width:0;max-width:100%;margin:18px 0}
.agent-year-strip{display:flex;flex-wrap:nowrap;gap:12px;overflow-x:auto;padding:2px 0 10px;scroll-snap-type:x proximity}
.agent-year-card{display:flex;flex:1 0 180px;flex-direction:column;gap:8px;padding:16px;border:1px solid #454c55;border-radius:16px;background:rgba(130,145,160,.055);color:inherit;text-decoration:none;scroll-snap-align:start}
.agent-year-card:hover,.agent-year-card:focus-visible{border-color:#eac66f;background:rgba(130,145,160,.12)}
.agent-year-card>b{font-size:22px}.agent-year-card>small{font-size:12px;line-height:1.5;color:#bdc6d1}
