@font-face { font-family: "Vazirmatn"; src: url("/static/fonts/Vazirmatn-wght.woff2") format("woff2"); font-weight: 100 900; font-display: swap; }
:root { --bg:#060812; --p:#0A0E1C; --p2:#0D1224; --line:#18203A; --line2:#222B4A; --text:#D9E1F5; --mute:#6E79A6; --acc:#F5C451; --pos:#3BE38F; --neg:#FF5470; --cy:#59C7FF;
  --safe-b: env(safe-area-inset-bottom, 0px); --tab: 64px; }
* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
html, body { background: var(--bg); color: var(--text); height: 100%; }
body { font: 400 13px/1.7 "Vazirmatn", system-ui, sans-serif; font-feature-settings: "tnum" 1; -webkit-font-smoothing: antialiased; overscroll-behavior-y: none; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
[hidden] { display: none !important; }
.lat, .en { unicode-bidi: isolate; }
.en { direction: ltr; text-align: left; display: block; font-size: 12px; line-height: 1.7; color: #b8c2e2; }
.ltr { direction: ltr; unicode-bidi: isolate; display: inline-block; }
.pos { color: var(--pos); } .neg { color: var(--neg); } .mu { color: var(--mute); } .acc { color: var(--acc); }
.sm { font-size: 11px; } .xs { font-size: 10.5px; } .pad { padding: 6px 12px; }
:focus-visible { outline: 2px solid var(--acc); outline-offset: 2px; border-radius: 6px; }

/* login */
.login { position: fixed; inset: 0; display: grid; place-items: center; padding: 24px; background: radial-gradient(70% 50% at 50% 35%, #141b36, var(--bg)); }
.lbox { width: min(360px, 100%); text-align: center; display: grid; gap: 12px; }
.lcore { height: 200px; position: relative; } .lcore canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
.lbox h1 { font-size: 26px; font-weight: 850; } .lbox p { color: var(--mute); margin-top: -8px; }
.lbox input { height: 52px; border-radius: 14px; border: 1px solid var(--line2); background: var(--p); color: var(--text); font: inherit; font-size: 16px; padding: 0 16px; text-align: center; }
.lbox button { height: 52px; border-radius: 14px; background: var(--acc); color: #1a1200; font-weight: 800; font-size: 16px; transition: transform .2s cubic-bezier(.2,.8,.2,1); }
.lbox button:active { transform: scale(.97); }
.lerr { color: var(--neg); min-height: 22px; }

/* shell */
.app { min-height: 100%; display: flex; flex-direction: column; }
.top { display: flex; align-items: center; gap: 16px; padding: 10px 16px; border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 20; background: rgba(6,8,18,.86); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px); }
.brand { display: flex; gap: 10px; align-items: center; font-size: 15px; font-weight: 800; white-space: nowrap; }
.brand i { width: 22px; height: 22px; border-radius: 50%; background: radial-gradient(circle at 50% 50%, transparent 38%, var(--acc) 40%, var(--acc) 58%, transparent 60%); box-shadow: 0 0 14px rgba(245,196,81,.35); }
.nav { display: flex; gap: 2px; margin-inline-start: 18px; }
.nav button { padding: 6px 12px; border-radius: 8px; color: var(--mute); font-weight: 600; }
.nav button.on { color: var(--acc); background: rgba(245,196,81,.08); }
.fresh { margin-inline-start: auto; display: flex; gap: 12px; font-size: 11px; color: var(--mute); white-space: nowrap; }
.fresh span i { display: inline-block; width: 6px; height: 6px; border-radius: 50%; margin-inline-end: 5px; vertical-align: 1px; background: var(--pos); }
.fresh span i.old { background: var(--acc); } .fresh span i.dead { background: var(--neg); }
.tape { display: flex; direction: ltr; overflow-x: auto; white-space: nowrap; border-bottom: 1px solid var(--line); font-size: 11px; scrollbar-width: none; }
.tape::-webkit-scrollbar { display: none; }
.tape div { padding: 7px 14px; border-right: 1px solid var(--line); flex: none; }
.tape b { color: var(--mute); font-weight: 600; margin-right: 6px; }
main { flex: 1; min-height: 0; }
.view { display: none; } .view.on { display: block; }
.ph { padding: 9px 12px; border-bottom: 1px solid var(--line); font-size: 11px; color: var(--mute); display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.ph b { color: var(--acc); font-weight: 700; }
.ph.big { font-size: 13px; padding: 14px 0 10px; border: 0; } .ph.big > span:first-child { font-size: 22px; font-weight: 850; color: var(--text); }
.lnk { color: var(--acc); font-size: 11px; }

/* today grid */
.today.on { display: grid; grid-template-columns: 290px 1fr 320px; grid-template-rows: minmax(480px, 1fr) 230px; height: calc(100vh - 87px); min-height: 680px; }
.col { border-inline-start: 1px solid var(--line); min-height: 0; overflow: auto; scrollbar-width: thin; scrollbar-color: var(--line2) transparent; position: relative; }
.c-agents { grid-row: 1 / 3; grid-column: 1; border: 0; }
.c-core { grid-row: 1; grid-column: 2; overflow: hidden; }
.c-side { grid-row: 1; grid-column: 3; }
.c-ledger { grid-row: 2; grid-column: 2; border-top: 1px solid var(--line); overflow: hidden; display: flex; flex-direction: column; }
.c-ledger canvas { flex: 1; width: 100%; min-height: 0; }
.c-log { grid-row: 2; grid-column: 3; border-top: 1px solid var(--line); }

.ag { width: 100%; text-align: start; padding: 10px 12px; border-bottom: 1px solid var(--line); display: grid; grid-template-columns: 1fr auto; gap: 1px 8px; transition: background .2s; }
.ag:hover { background: rgba(255,255,255,.02); }
.ag:active { background: rgba(245,196,81,.06); }
.ag .n { font-weight: 750; font-size: 13.5px; display: flex; gap: 7px; align-items: center; }
.ag .n i { width: 7px; height: 7px; border-radius: 2px; background: var(--mute); flex: none; }
.ag .n i.live { background: var(--pos); box-shadow: 0 0 8px var(--pos); }
.ag .n i.paused { background: var(--acc); }
.ag .n i.dead { background: transparent; border: 1px solid var(--mute); }
.ag .v { font-weight: 800; font-size: 15px; text-align: end; }
.ag .s { font-size: 10.5px; color: var(--mute); }
.ag .s.e { text-align: end; }
.ag .ask { font-size: 10px; font-weight: 800; color: #1a1200; background: var(--acc); border-radius: 5px; padding: 0 6px; }
.ag .pz { font-size: 10px; font-weight: 800; color: var(--acc); border: 1px solid var(--acc); border-radius: 5px; padding: 0 5px; }
.ag svg { grid-column: 1 / -1; width: 100%; height: 22px; margin-top: 3px; }

.c-core canvas#core { position: absolute; inset: 0; width: 100%; height: 100%; touch-action: pan-y; cursor: grab; }
.clbl { position: absolute; top: 10px; inset-inline: 14px; display: flex; justify-content: space-between; font-size: 10.5px; color: var(--mute); pointer-events: none; }
.leg { display: flex; gap: 12px; } .leg i { display: inline-block; width: 7px; height: 7px; border-radius: 50%; margin-inline-end: 4px; }
.leg i.pos { background: var(--pos); } .leg i.neg { background: var(--neg); } .leg i.neu { background: #5d6895; }
.chips { position: absolute; top: 34px; inset-inline: 10px; display: flex; gap: 6px; flex-wrap: wrap; }
.chips.flat { position: static; padding: 8px 0; }
.chip { padding: 3px 10px; border-radius: 999px; border: 1px solid var(--line2); font-size: 11px; color: var(--mute); background: rgba(6,8,18,.6); transition: all .2s; }
.chip.on { color: #1a1200; background: var(--acc); border-color: var(--acc); font-weight: 700; }
.cread { position: absolute; bottom: 14px; inset-inline: 16px; display: flex; justify-content: space-between; align-items: flex-end; gap: 20px; pointer-events: none; }
.regime { font-size: 26px; font-weight: 850; color: var(--acc); line-height: 1.3; }
.note { font-size: 12.5px; line-height: 1.85; color: #b9c3e0; max-width: 430px; }
.tipbox { position: absolute; z-index: 5; max-width: 300px; background: rgba(13,18,36,.96); border: 1px solid var(--line2); border-radius: 10px; padding: 8px 10px; font-size: 12px; pointer-events: none; box-shadow: 0 10px 30px rgba(0,0,0,.4); }
.tipbox .en { font-size: 12px; color: var(--text); }
.tipbox .m { font-size: 10.5px; color: var(--mute); margin-top: 4px; display: flex; justify-content: space-between; gap: 10px; }

.row { display: grid; grid-template-columns: 52px 1fr auto; gap: 8px; padding: 7px 12px; border-bottom: 1px solid var(--line); font-size: 11.5px; align-items: center; }
.row .m { color: var(--mute); font-size: 11px; }
.cot { height: 5px; background: var(--line); border-radius: 2px; position: relative; } .cot i { position: absolute; inset-inline-start: 0; top: 0; bottom: 0; background: var(--cy); border-radius: 2px; }
.cot.hi i { background: var(--acc); }
.askrow { display: block; width: 100%; text-align: start; padding: 8px 12px; border-bottom: 1px solid var(--line); }
.askrow b { font-size: 12px; } .askrow .en { margin-top: 2px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.lg { display: grid; grid-template-columns: 58px 62px 1fr; gap: 8px; padding: 6px 12px; border-bottom: 1px solid var(--line); font-size: 11.5px; align-items: start; }
.lg .k { color: var(--acc); font-weight: 700; } .lg .k.neg { color: var(--neg); } .lg .k.pos { color: var(--pos); } .lg .k.cy { color: var(--cy); }

/* pages */
.page { max-width: 1180px; margin: 0 auto; padding: 8px 20px 40px; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; margin-top: 18px; }
.two > div { border: 1px solid var(--line); border-radius: 14px; overflow: hidden; background: var(--p); }
.drivers { display: grid; gap: 6px; margin-bottom: 14px; }
.drivers .d { border: 1px solid var(--line); border-radius: 12px; background: var(--p); padding: 10px 14px; }
.symgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 10px; }
.sym { border: 1px solid var(--line); border-radius: 14px; background: var(--p); padding: 12px 14px; display: grid; gap: 6px; }
.sym .h { display: flex; justify-content: space-between; align-items: baseline; }
.sym .h b { font-size: 14px; } .sym .px { font-size: 15px; font-weight: 750; }
.sym .bias { display: grid; grid-template-columns: 1fr auto; gap: 8px; align-items: center; font-size: 11px; }
.bbar { height: 6px; border-radius: 3px; background: var(--line); position: relative; }
.bbar:after { content: ""; position: absolute; left: 50%; top: -2px; bottom: -2px; width: 1px; background: var(--line2); }
.bbar i { position: absolute; top: 0; bottom: 0; border-radius: 3px; }
.sym .why { font-size: 11.5px; color: #b8c2e2; }
.sym .meta { display: flex; flex-wrap: wrap; gap: 4px 12px; font-size: 10.5px; color: var(--mute); }
.nw { display: block; padding: 8px 12px; border-bottom: 1px solid var(--line); }
.nw .m { display: flex; gap: 8px; font-size: 10.5px; color: var(--mute); margin-top: 2px; }
.sdot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-inline-end: 4px; vertical-align: 0; }
.kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.kpi { border: 1px solid var(--line); border-radius: 14px; background: var(--p); padding: 12px 14px; }
.kpi .k { font-size: 11px; color: var(--mute); } .kpi .v { font-size: 22px; font-weight: 850; margin-top: 2px; } .kpi .s { font-size: 10.5px; color: var(--mute); }
.bigcurve { height: 320px; border: 1px solid var(--line); border-radius: 14px; margin-top: 12px; background: var(--p); position: relative; }
.bigcurve canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
.tr { display: grid; grid-template-columns: 1fr 50px 60px 56px; gap: 8px; padding: 7px 12px; border-bottom: 1px solid var(--line); font-size: 11.5px; align-items: center; }
.tr.h { color: var(--mute); font-size: 10.5px; }
.ev { border: 1px solid var(--line); border-radius: 14px; background: var(--p); padding: 12px 14px; margin-bottom: 8px; display: grid; grid-template-columns: 90px 1fr; gap: 12px; }
.ev .d { font-size: 11px; color: var(--mute); } .ev .d b { display: block; font-size: 12.5px; color: var(--text); }
.ev .t { font-weight: 700; margin-bottom: 2px; }
.ev .tag { display: inline-block; font-size: 10px; font-weight: 800; border-radius: 5px; padding: 0 6px; margin-inline-end: 6px; }
.tag.promo { background: rgba(59,227,143,.12); color: var(--pos); } .tag.rej { background: rgba(255,84,112,.1); color: var(--neg); } .tag.note { background: var(--line); color: var(--mute); } .tag.pass { background: rgba(245,196,81,.12); color: var(--acc); }
.limits { margin-top: 18px; border: 1px dashed var(--line2); border-radius: 14px; padding: 12px 14px; color: var(--mute); font-size: 12px; line-height: 1.9; }
.ghost { margin-top: 18px; border: 1px solid var(--line2); border-radius: 12px; padding: 10px 16px; color: var(--mute); }
.empty { padding: 18px 12px; color: var(--mute); font-size: 12px; }

/* sheet (agent detail) */
.scrim { position: fixed; inset: 0; background: rgba(2,3,8,.6); opacity: 0; pointer-events: none; z-index: 40; }
.sheet { position: fixed; z-index: 41; background: var(--p2); border: 1px solid var(--line2); display: flex; flex-direction: column; will-change: transform; }
@media (min-width: 1000px) {
  .sheet { top: 0; bottom: 0; inset-inline-end: 0; width: 460px; border-radius: 18px 0 0 18px; border-inline-end: 0; transform: translateX(-110%); }
  .grab { display: none; }
}
.shbody { overflow: auto; padding: 18px 18px 28px; flex: 1; overscroll-behavior: contain; }
.grab { padding: 10px 0 2px; display: flex; justify-content: center; touch-action: none; cursor: grab; } .grab i { width: 40px; height: 5px; border-radius: 3px; background: var(--line2); }
.sh-h { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.sh-h h2 { font-size: 24px; font-weight: 850; line-height: 1.3; }
.sh-h .x { width: 36px; height: 36px; border-radius: 50%; background: var(--line); font-size: 18px; color: var(--mute); flex: none; }
.sh-m { color: var(--mute); font-size: 12px; margin-top: 2px; }
.state { display: inline-block; font-size: 11px; font-weight: 800; border-radius: 6px; padding: 1px 8px; background: var(--line); color: var(--text); }
.state.live { background: rgba(59,227,143,.14); color: var(--pos); } .state.rejected { background: rgba(255,84,112,.1); color: var(--neg); } .state.paused { background: rgba(245,196,81,.14); color: var(--acc); }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); border: 1px solid var(--line); border-radius: 14px; margin: 14px 0; }
.stats > div { padding: 10px 12px; } .stats > div + div { border-inline-start: 1px solid var(--line); }
.stats .k { font-size: 10.5px; color: var(--mute); } .stats .v { font-size: 20px; font-weight: 850; } .stats .s { font-size: 10px; color: var(--mute); }
.box { border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px; margin-bottom: 10px; background: var(--p); }
.box h3 { font-size: 12px; color: var(--mute); font-weight: 600; margin-bottom: 8px; display: flex; justify-content: space-between; }
.seg { display: flex; background: var(--bg); border: 1px solid var(--line); border-radius: 12px; padding: 3px; position: relative; }
.seg button { flex: 1; padding: 10px 0; border-radius: 9px; font-weight: 750; color: var(--mute); position: relative; z-index: 1; transition: color .25s; min-height: 44px; }
.seg button.on { color: #03140a; }
.seg button.on.stop { color: #1a1200; }
.seg .pill { position: absolute; top: 3px; bottom: 3px; width: calc(50% - 3px); border-radius: 9px; background: var(--pos); z-index: 0; will-change: transform; }
.seg .pill.stop { background: var(--acc); }
.steps { display: flex; gap: 6px; }
.steps button { flex: 1; min-height: 44px; border: 1px solid var(--line2); border-radius: 10px; font-weight: 800; color: var(--mute); transition: all .2s; }
.steps button.on { border-color: var(--acc); color: var(--acc); background: rgba(245,196,81,.1); }
.steps button.over { opacity: .45; }
.confirm { display: flex; gap: 8px; margin-top: 10px; align-items: center; justify-content: space-between; font-size: 12px; background: rgba(245,196,81,.07); border: 1px solid rgba(245,196,81,.35); border-radius: 12px; padding: 8px 10px; }
.confirm button { padding: 8px 14px; border-radius: 9px; font-weight: 800; min-height: 40px; }
.confirm .yes { background: var(--acc); color: #1a1200; } .confirm .no { color: var(--mute); }
.kv { display: grid; grid-template-columns: 110px 1fr; gap: 4px 10px; font-size: 12px; } .kv .k { color: var(--mute); }
.mini { font-size: 11.5px; padding: 6px 0; border-top: 1px solid var(--line); } .mini:first-of-type { border: 0; }
.toast { position: fixed; z-index: 60; left: 50%; bottom: calc(var(--tab) + 18px + var(--safe-b)); transform: translate(-50%, 30px); opacity: 0; background: #1a2140; border: 1px solid var(--line2); border-radius: 12px; padding: 10px 16px; font-size: 13px; pointer-events: none; max-width: 90vw; }
.tabbar { display: none; }

/* phone and tablet */
@media (max-width: 999px) {
  .nav { display: none; }
  .top { padding: 10px 14px; padding-top: calc(10px + env(safe-area-inset-top, 0px)); }
  .fresh { gap: 8px; font-size: 10.5px; }
  .fresh .lbl { display: none; }
  main { padding-bottom: calc(var(--tab) + var(--safe-b) + 12px); }
  .today.on { display: flex; flex-direction: column; height: auto; min-height: 0; }
  .col { border: 0; overflow: visible; }
  .c-core { order: 1; height: auto; padding-top: 310px; flex: none; border-bottom: 1px solid var(--line); }
  .c-core canvas#core { height: 310px; bottom: auto; }
  .c-agents { order: 2; } .c-side { order: 3; } .c-ledger { order: 4; height: 220px; flex: none; } .c-log { order: 5; }
  .cread { position: static; flex-direction: column; align-items: flex-start; gap: 2px; padding: 0 16px 14px; pointer-events: auto; }
  .chips { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; inset-inline: 0; padding: 0 10px; } .chips::-webkit-scrollbar { display: none; } .chip { flex: none; }
  .regime { font-size: 22px; } .note { font-size: 12px; }
  .chips { top: 32px; }
  .ag { padding: 12px 14px; min-height: 64px; }
  .page { padding: 4px 14px 24px; }
  .ph.big { flex-direction: column; align-items: flex-start; gap: 2px; }
  .two { grid-template-columns: 1fr; gap: 14px; }
  .kpis { grid-template-columns: 1fr 1fr; }
  .bigcurve { height: 240px; }
  .ev { grid-template-columns: 1fr; gap: 4px; }
  .tabbar { display: flex; position: fixed; z-index: 30; bottom: 0; inset-inline: 0; height: calc(var(--tab) + var(--safe-b)); padding-bottom: var(--safe-b); background: rgba(6,8,18,.9); backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px); border-top: 1px solid var(--line); }
  .tabbar button { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; font-size: 10.5px; color: var(--mute); }
  .tabbar button svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
  .tabbar button.on { color: var(--acc); }
  .sheet { left: 0; right: 0; bottom: 0; max-height: 92vh; border-radius: 22px 22px 0 0; border-bottom: 0; transform: translateY(105%); padding-bottom: var(--safe-b); }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }

button.busy { opacity: .7; cursor: progress; animation: busy 1s ease-in-out infinite alternate; }
@keyframes busy { to { opacity: .45; } }
@media (prefers-reduced-motion: reduce) { button.busy { animation: none; } }
