/* Base styles shared by the login and trade pages: tokens, header, popovers, chips, forms, toast.
   Design: a single blue accent (#284cf9), cool grey-blue neutrals, the Manrope face, spacing in 4px steps, browser scrolling. */
@font-face{font-family:Manrope;src:url('/static/fonts/manrope-400.woff2') format('woff2');font-weight:400;font-style:normal;font-display:swap}
@font-face{font-family:Manrope;src:url('/static/fonts/manrope-600.woff2') format('woff2');font-weight:500 600;font-style:normal;font-display:swap}
@font-face{font-family:Manrope;src:url('/static/fonts/manrope-800.woff2') format('woff2');font-weight:700 800;font-style:normal;font-display:swap}

:root{
  --blue:#284cf9;--blue-hover:#1339e3;--blue-soft:#eff2ff;--blue-line:#cfd8ff;--blue-on:#dfe5ff;
  --ink:#141a2a;--ink-2:#2a3247;--muted:#5a6377;--faint:#6f7890;
  --ground:#f4f6fc;--card:#fff;--line:#e2e6f2;--line-2:#edf0f7;
  --neg:#c4323b;--neg-soft:#fdeeee;--warn:#9a5b00;--warn-soft:#fff5e5;
  --r-card:16px;--r-ctl:10px;--r-in:12px;
  --ease:cubic-bezier(.23,1,.32,1);--ease-io:cubic-bezier(.77,0,.175,1);--ease-sheet:cubic-bezier(.32,.72,0,1);
  --content:1320px;
  font-family:Manrope,Arial,sans-serif;color:var(--ink);font-size:16px;line-height:1.5;font-synthesis:none;
  -webkit-font-smoothing:antialiased;text-rendering:optimizeLegibility;
}
*,*::before,*::after{box-sizing:border-box}
[hidden]{display:none!important}
html{background:var(--ground);scrollbar-color:#c3cbe0 transparent}
body{margin:0;min-height:100vh;background:var(--ground)}
::selection{background:#cdd6ff;color:var(--ink)}
h1,h2,h3,h4,p{margin:0}
h1,h2,h3{text-wrap:balance;letter-spacing:-.025em;font-weight:600}
a{color:var(--blue);text-underline-offset:3px}
button,input,select{font:inherit;color:inherit}
button{cursor:pointer}
img,svg{display:block}
.num,.tnum,table{font-variant-numeric:tabular-nums}
:focus-visible{outline:2px solid var(--blue);outline-offset:2px;border-radius:6px}
.skip-link{position:absolute;left:16px;top:-48px;z-index:100;background:var(--ink);color:#fff;padding:10px 14px;border-radius:8px;font-weight:600;text-decoration:none}
.skip-link:focus{top:12px}
.vh{position:absolute!important;width:1px;height:1px;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap}
.wrap{width:min(100% - 48px,var(--content));margin-inline:auto}
@media(max-width:760px){.wrap{width:calc(100% - 32px)}}

/* ---------- Buttons ---------- */
.btn{display:inline-flex;align-items:center;justify-content:center;gap:8px;min-height:44px;padding:0 18px;border-radius:var(--r-ctl);border:1px solid transparent;font-size:14px;font-weight:600;line-height:1;text-decoration:none;white-space:nowrap;transition:background-color .18s ease,border-color .18s ease,color .18s ease,transform .16s var(--ease)}
.btn:active{transform:scale(.97)}
.btn svg{width:16px;height:16px;flex:none;stroke:currentColor;fill:none;stroke-width:1.9;stroke-linecap:round;stroke-linejoin:round}
.btn-blue{background:var(--blue);color:#fff}


.btn-ghost{background:transparent;color:var(--ink)}


.btn-sm{min-height:36px;padding:0 12px;font-size:13px;border-radius:9px}
.btn-block{width:100%}
.btn[disabled],.btn[aria-disabled="true"]{opacity:.5;cursor:not-allowed;transform:none}
@media(hover:hover) and (pointer:fine){
  .btn-blue:hover{background:var(--blue-hover)}
  
  
  .btn-ghost:hover{background:#e9edf8}
  
  
}
.btn .spin{width:16px;height:16px;border-radius:50%;border:2px solid currentColor;border-right-color:transparent;animation:spin .6s linear infinite;display:none}
.btn.is-loading .spin{display:block}
.btn.is-loading .btn-label{opacity:.7}
@keyframes spin{to{transform:rotate(360deg)}}
.icon-btn{position:relative;display:inline-flex;align-items:center;justify-content:center;width:40px;height:40px;border-radius:10px;border:1px solid transparent;background:transparent;color:var(--ink);transition:background-color .18s ease,transform .16s var(--ease)}
.icon-btn:active{transform:scale(.95)}
.icon-btn svg{width:20px;height:20px;stroke:currentColor;fill:none;stroke-width:1.7;stroke-linecap:round;stroke-linejoin:round}
@media(hover:hover) and (pointer:fine){.icon-btn:hover{background:#eef1f9}}
.icon-btn .dot{position:absolute;top:8px;right:9px;width:8px;height:8px;border-radius:50%;background:var(--blue);box-shadow:0 0 0 2px #fff}
.text-btn{background:none;border:0;padding:0;color:var(--blue);font-weight:600;font-size:14px;text-decoration:underline;text-decoration-color:#284cf966;text-underline-offset:3px}
.text-btn:hover{text-decoration-color:currentColor}
















/* ---------- Top bar ---------- */
.app-head{position:sticky;top:0;z-index:50;background:#ffffffeb;backdrop-filter:saturate(1.4) blur(12px);-webkit-backdrop-filter:saturate(1.4) blur(12px);border-bottom:1px solid var(--line)}
.app-head-in{display:flex;align-items:center;gap:20px;height:64px}
.app-brand{display:block;width:132px;flex:none}
.app-brand img{width:100%;height:auto}
.app-nav{display:flex;gap:4px;margin-left:12px}
.app-nav a{display:inline-flex;align-items:center;height:36px;padding:0 12px;border-radius:9px;color:var(--muted);font-size:14px;font-weight:600;text-decoration:none;transition:background-color .18s ease,color .18s ease}
.app-nav a[aria-current="page"]{color:var(--ink);background:#eef1f9}
@media(hover:hover) and (pointer:fine){.app-nav a:hover{color:var(--ink)}}
.app-tools{display:flex;align-items:center;gap:6px;margin-left:auto}
.app-tools .btn-blue{margin-inline:6px 4px}
.avatar{width:32px;height:32px;border-radius:50%;background:var(--ink);color:#fff;display:inline-flex;align-items:center;justify-content:center;font-size:12px;font-weight:700;letter-spacing:0}













/* Popovers */
.pop{position:absolute;top:calc(100% + 8px);z-index:60;background:#fff;border-radius:14px;box-shadow:0 0 0 1px #141a2a14,0 12px 32px -8px #141a2a33,0 2px 6px #141a2a0f;opacity:0;transform:translateY(-4px) scale(.98);transform-origin:top left;pointer-events:none;transition:opacity .16s ease,transform .2s var(--ease);visibility:hidden}
.pop.is-right{right:0;transform-origin:top right}
.pop.is-open{opacity:1;transform:none;pointer-events:auto;visibility:visible}

.pop-head{display:flex;align-items:center;justify-content:space-between;padding:8px 10px 10px;font-size:13px;font-weight:600}
.pop-head span{color:var(--muted);font-weight:500}







.pop-notes{width:380px;padding:6px}
.note-item{display:grid;grid-template-columns:10px 1fr;gap:10px;padding:12px 10px;border-radius:10px;text-decoration:none;color:inherit;transition:background-color .15s ease}
@media(hover:hover) and (pointer:fine){.note-item:hover{background:#f2f4fa}}
.note-item i{width:8px;height:8px;border-radius:50%;margin-top:6px;background:transparent}
.note-item.is-unread i{background:var(--blue)}
.note-item b{display:block;font-size:13.5px;font-weight:600;line-height:1.35}
.note-item p{font-size:12.5px;color:var(--muted);margin-top:3px;line-height:1.45}
.note-item time{display:block;font-size:11.5px;color:var(--faint);margin-top:4px}
.pop-menu{width:260px;padding:6px}
.pop-menu .who{padding:10px 10px 12px;border-bottom:1px solid var(--line-2);margin-bottom:4px}
.pop-menu .who b{display:block;font-size:14px;font-weight:600}
.pop-menu .who span{display:block;font-size:12.5px;color:var(--muted);overflow:hidden;text-overflow:ellipsis}
.menu-item{display:flex;align-items:center;gap:10px;width:100%;padding:10px;border:0;border-radius:9px;background:transparent;font-size:14px;font-weight:500;color:var(--ink);text-decoration:none;text-align:left}
.menu-item svg{width:18px;height:18px;stroke:var(--muted);fill:none;stroke-width:1.7;stroke-linecap:round;stroke-linejoin:round}
@media(hover:hover) and (pointer:fine){.menu-item:hover{background:#f2f4fa}}
.menu-item.is-danger{color:var(--neg)}
.menu-item.is-danger svg{stroke:var(--neg)}

/* Segmented control */
.seg{display:inline-flex;padding:3px;border-radius:9px;background:#eef1f8;gap:2px}
.seg a,.seg button{display:inline-flex;align-items:center;height:26px;padding:0 10px;border:0;border-radius:7px;background:transparent;color:var(--muted);font-size:12.5px;font-weight:600;text-decoration:none;transition:background-color .15s ease,color .15s ease}
.seg [aria-current="true"],.seg [aria-selected="true"]{background:#fff;color:var(--ink);box-shadow:0 1px 2px #141a2a1f}












































.legend{display:flex;flex-wrap:wrap;gap:6px 16px;font-size:12.5px;color:var(--muted);font-weight:500;margin-bottom:8px}
.legend span{display:inline-flex;align-items:center;gap:8px}
.legend i{width:14px;height:2px;border-radius:2px;background:var(--blue)}
.legend i.is-bal{background:var(--ink);opacity:.55}
.legend i.is-floor{background:repeating-linear-gradient(90deg,var(--neg) 0 4px,transparent 4px 7px)}
.legend i.is-target{background:repeating-linear-gradient(90deg,var(--ink) 0 4px,transparent 4px 7px)}
.chart{position:relative;height:300px;margin-inline:-4px;touch-action:pan-y}
.chart svg{width:100%;height:100%;overflow:visible}
.chart .grid line{stroke:#edf0f7;stroke-width:1}









.chart .area{fill:url(#eqFill)}
.chart .cross{stroke:#141a2a40;stroke-width:1;opacity:0;transition:opacity .12s ease}

.chart.is-hover .cross{opacity:1}






/* Range filter */
.range{display:inline-flex;padding:3px;border-radius:10px;background:#eef1f8;gap:2px;flex:none}
.range button{height:30px;padding:0 12px;border:0;border-radius:8px;background:transparent;color:var(--muted);font-size:13px;font-weight:600;transition:background-color .15s ease,color .15s ease}
.range button[aria-pressed="true"]{background:#fff;color:var(--ink);box-shadow:0 1px 2px #141a2a1f}


.obj{display:grid;grid-template-columns:minmax(0,1fr) auto;gap:6px 24px;padding:18px 0;border-top:1px solid var(--line-2)}
.obj:first-child{border-top:0;padding-top:0}
.obj h3{font-size:15px;font-weight:600;letter-spacing:-.01em}











/* Tabs */
.tabs{display:flex;gap:4px;border-bottom:1px solid var(--line);margin:-4px -24px 0;padding:0 16px;overflow-x:auto;scrollbar-width:none}
.tabs::-webkit-scrollbar{display:none}
.tabs button{position:relative;height:44px;padding:0 10px;border:0;background:transparent;color:var(--muted);font-size:14px;font-weight:600;white-space:nowrap;transition:color .15s ease}
.tabs button[aria-selected="true"]{color:var(--ink)}
.tabs button[aria-selected="true"]::after{content:"";position:absolute;left:10px;right:10px;bottom:-1px;height:2px;border-radius:2px;background:var(--blue)}
.tabs .count{display:inline-flex;align-items:center;justify-content:center;min-width:20px;height:20px;padding:0 6px;margin-left:6px;border-radius:10px;background:#eef1f8;color:var(--muted);font-size:11.5px}











.side{font-weight:600}
.side.is-long{color:var(--blue)}
.side.is-short{color:var(--ink)}
.pos{color:var(--blue);font-weight:600}



/* Empty states */
.empty{display:flex;flex-direction:column;align-items:center;text-align:center;padding:40px 16px;gap:8px}


.empty h3{font-size:16px}
.empty p{font-size:13.5px;color:var(--muted);max-width:340px;line-height:1.55}
.empty .btn{margin-top:10px}

/* Notices and table tools */
.notice{display:grid;grid-template-columns:20px 1fr;gap:10px;padding:14px 16px;border-radius:12px;background:var(--blue-soft);font-size:13px;line-height:1.55;color:var(--ink-2)}
.notice svg{width:18px;height:18px;stroke:var(--blue);fill:none;stroke-width:1.8;margin-top:1px}
.notice b{color:var(--ink);font-weight:600}
.notice .text-btn{font-size:13px;margin-top:6px;display:inline-block}
.notice.is-warn{background:var(--warn-soft)}
.notice.is-warn svg{stroke:var(--warn)}

















.buy-opt{display:grid;grid-template-columns:1fr auto;align-items:center;gap:12px;padding:14px;border-radius:12px;border:1px solid var(--line);text-decoration:none;color:inherit;transition:border-color .18s ease,background-color .18s ease,transform .16s var(--ease)}
.buy-opt:active{transform:scale(.98)}
@media(hover:hover) and (pointer:fine){.buy-opt:hover{border-color:var(--blue-line);background:#fafbff}.buy-opt:hover .arr{transform:translateX(2px);stroke:var(--blue)}}
.buy-opt b{display:block;font-size:14.5px;font-weight:600}
.buy-opt small{display:block;font-size:12.5px;color:var(--muted);margin-top:2px}
.buy-opt .arr{width:18px;height:18px;stroke:var(--faint);fill:none;stroke-width:1.9;transition:transform .18s var(--ease),stroke .18s ease}














/* Footer */
.app-foot{border-top:1px solid var(--line);background:#fff;padding-block:28px 32px}
.app-foot .wrap{display:grid;gap:16px}
.app-foot p{font-size:12.5px;line-height:1.65;color:var(--muted);max-width:920px}
.app-foot strong{color:var(--ink);font-weight:600}
.app-foot nav{display:flex;flex-wrap:wrap;gap:8px 20px;font-size:13px;font-weight:600}
.app-foot nav a{color:var(--ink-2);text-decoration:none}
.app-foot nav a:hover{color:var(--blue)}



@starting-style{dialog.modal[open]{opacity:0;transform:scale(.96)}}


@starting-style{dialog.modal[open]::backdrop{background:#141a2a00}}




@media(max-width:760px){
  
  @starting-style{dialog.modal[open]{opacity:0;transform:translateY(24px)}}
  
}

/* Forms */
.field{display:grid;gap:6px}
.field label,.field .label{font-size:13px;font-weight:600;color:var(--ink)}
.field .hint{font-size:12.5px;color:var(--muted);line-height:1.5}
.input,.select{width:100%;height:48px;padding:0 14px;border-radius:var(--r-in);border:1px solid #d3d9e8;background:#fff;font-size:15px;transition:border-color .15s ease,box-shadow .15s ease;outline:none}
.input::placeholder{color:#8790a6}
.input:focus,.select:focus{border-color:var(--blue);box-shadow:0 0 0 3px #284cf926}
.input[aria-invalid="true"]{border-color:var(--neg);box-shadow:0 0 0 3px #c4323b1f}
.input[readonly]{background:#f6f7fb;color:var(--ink-2)}




.select{appearance:none;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='%235a6377' stroke-width='2' stroke-linecap='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");background-repeat:no-repeat;background-position:right 14px center;padding-right:40px}
.err{font-size:13px;color:var(--neg);font-weight:500;min-height:0}
.check{display:grid;grid-template-columns:20px 1fr;gap:10px;align-items:start;font-size:13px;line-height:1.55;color:var(--ink-2)}
.check input{width:18px;height:18px;margin:1px 0 0;accent-color:var(--blue)}

/* Switch */
.switch{position:relative;width:44px;height:26px;flex:none}
.switch input{position:absolute;inset:0;opacity:0;margin:0;cursor:pointer;z-index:1}
.switch i{position:absolute;inset:0;border-radius:999px;background:#cfd5e3;transition:background-color .2s ease}
.switch i::after{content:"";position:absolute;top:3px;left:3px;width:20px;height:20px;border-radius:50%;background:#fff;box-shadow:0 1px 3px #141a2a33;transition:transform .22s var(--ease)}
.switch input:checked+i{background:var(--blue)}
.switch input:checked+i::after{transform:translateX(18px)}
.switch input:focus-visible+i{outline:2px solid var(--blue);outline-offset:2px}
.switch input:disabled{cursor:not-allowed}
.switch input:disabled+i{opacity:.55}

/* Toast */
.toast{position:fixed;left:50%;bottom:24px;z-index:90;display:flex;align-items:center;gap:10px;max-width:min(440px,calc(100% - 32px));padding:12px 16px;border-radius:12px;background:var(--ink);color:#fff;font-size:13.5px;font-weight:500;box-shadow:0 12px 32px -8px #141a2a59;transform:translate(-50%,16px);opacity:0;transition:opacity .2s ease,transform .26s var(--ease);pointer-events:none}
.toast.is-on{opacity:1;transform:translate(-50%,0)}
.toast svg{width:16px;height:16px;stroke:#9fb0ff;fill:none;stroke-width:2.2;flex:none}

/* Mobile tab bar */
.tabbar{display:none}
@media(max-width:760px){
  .app-head-in{height:60px;gap:8px}
  .app-brand{width:112px}
  .app-nav,.app-tools .btn-blue{display:none}
  
  
  
  
  
  .pop-notes,.pop-menu{position:fixed;left:12px!important;right:12px!important;top:auto;bottom:calc(76px + env(safe-area-inset-bottom));width:auto;max-height:70dvh;overflow:auto;transform:translateY(12px);transform-origin:bottom center}
  
  
  
  
  
  
  .tabs{margin-inline:-20px;padding-inline:12px}
  
  
  .chart{height:240px}
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  .tabbar{display:grid;grid-template-columns:repeat(2,1fr);position:fixed;left:0;right:0;bottom:0;z-index:55;background:#ffffffef;backdrop-filter:saturate(1.4) blur(12px);-webkit-backdrop-filter:saturate(1.4) blur(12px);border-top:1px solid var(--line);padding:6px 8px calc(6px + env(safe-area-inset-bottom))}
  .tabbar .tab-me{appearance:none;border:0;background:none;font-family:inherit;cursor:pointer;padding:0}
  .tabbar a,.tabbar .tab-me{display:flex;flex-direction:column;align-items:center;justify-content:center;gap:4px;height:52px;border-radius:12px;color:var(--faint);font-size:11.5px;font-weight:600;text-decoration:none;transition:color .15s ease,transform .16s var(--ease)}
  .tabbar a:active,.tabbar .tab-me:active{transform:scale(.95)}
  .tabbar svg{width:22px;height:22px;stroke:currentColor;fill:none;stroke-width:1.7;stroke-linecap:round;stroke-linejoin:round}
  .tabbar a[aria-current="true"],.tabbar .tab-me[aria-current="true"],.tabbar .tab-me[aria-expanded="true"]{color:var(--blue)}
  .toast{bottom:calc(84px + env(safe-area-inset-bottom))}
  .app-foot{padding-bottom:calc(96px + env(safe-area-inset-bottom))}
}
@media(min-width:761px) and (max-width:1100px){
  
  
  
  .app-nav{display:none}
}
@media(prefers-reduced-motion:reduce){
  /* Reduced motion: no movement, but colour and fade changes stay */
  .btn:active,.icon-btn:active,.buy-opt:active,.tabbar a:active{transform:none}
  .pop,.pop.is-open{transform:none!important}
  .toast,.toast.is-on{transform:translateX(-50%)!important}
  .btn .spin{animation-duration:1.2s}
  html{scroll-behavior:auto}
}
.pop-anchor{position:relative}


@media(max-width:1180px) and (min-width:761px){.app-tools .btn-blue .btn-label{display:none}.app-tools .btn-blue{padding:0 10px}}

.seg a,.seg button{white-space:nowrap}
.hint{font-size:12.5px;color:var(--muted);line-height:1.5}
.toast{width:max-content}
[data-po-result]{display:grid;gap:20px}

/* Popovers anchor to their trigger on every size so the bell and switcher never float to the page top or bottom */
.pop-anchor{position:relative}
@media(max-width:760px){
  .pop-notes,.pop-menu{bottom:auto;transform:translateY(-4px) scale(.98);transform-origin:top center;max-height:calc(100dvh - var(--head-bottom,60px) - 96px);overflow:auto}
  .pop-notes,.pop-menu{position:fixed;top:calc(var(--head-bottom,60px) + 8px);left:12px!important;right:12px!important;width:auto}
  
}




/* backdrop-filter turns the sticky header into the containing block. On small screens the alerts and
   profile panels therefore sit relative to the header, spanning its width just below it. */
@media(max-width:760px){
  .app-head .pop-anchor{position:static}
  .app-head .pop-notes,.app-head .pop-menu{position:absolute;top:calc(100% + 8px);left:12px!important;right:12px!important;max-height:calc(100dvh - 200px)}
}






