:root {
  --bg: #EDF2F0; --card: #FFFFFF; --line: #E0E7E4; --line2: #D3DCD8;
  --text: #0F1B19; --muted: #7A8784; --dim: #A7B2AF;
  --teal: #0FA39A; --teal2: #5FD4C6; --green: #16A34A; --red: #E5484D; --amber: #D98A0B;
  --mono: 'Geist Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
  --sans: 'Geist', ui-sans-serif, system-ui, sans-serif;
  --r: 12px;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); font-family: var(--mono); font-size: 12px; -webkit-font-smoothing: antialiased; }
.page { max-width: 1280px; margin: 0 auto; padding: 18px 16px 18px; display: flex; flex-direction: column; gap: 12px; }
.muted { color: var(--muted); }
.grow { flex: 1; }

.top { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.brand { display: flex; align-items: center; gap: 14px; }
.mark { width: 54px; height: 54px; border-radius: 14px; object-fit: cover; box-shadow: 0 2px 8px rgba(15,27,38,.22); }
h1 { margin: 0; font-family: var(--sans); font-size: 30px; font-weight: 700; letter-spacing: -.02em; line-height: 1; }
.sub { color: var(--muted); margin-top: 5px; }
.pf { color: var(--teal); }
.top-r { display: flex; align-items: center; gap: 12px; }
.pill { border: 1px solid var(--line2); background: var(--card); border-radius: 999px; padding: 7px 12px; display: inline-flex; align-items: center; gap: 7px; white-space: nowrap; }
.pill.best { background: #FFF8E6; border-color: #F2DC9C; color: #8A5A00; }
.pill.live i { width: 7px; height: 7px; border-radius: 50%; background: var(--dim); }
.pill.live.on i { background: var(--green); box-shadow: 0 0 0 3px rgba(22,163,74,.15); animation: pulse 2s infinite; }
@keyframes pulse { 50% { box-shadow: 0 0 0 5px rgba(22,163,74,.08); } }

.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); box-shadow: 0 1px 2px rgba(15,27,25,.04); overflow: hidden; }
.ch { display: flex; align-items: center; gap: 10px; padding: 12px 14px 8px; font-weight: 500; }

.kpis { display: grid; grid-template-columns: 1fr 1.05fr 1.2fr 0.95fr; gap: 12px; }
.kpi { padding: 12px 16px 12px; min-height: 92px; position: relative; }
.kpi .lab { color: var(--muted); margin-bottom: 6px; }
.kpi b { display: block; font-family: var(--sans); font-size: 26px; font-weight: 600; letter-spacing: -.01em; font-variant-numeric: tabular-nums; }
.kpi.accent { border-left: 3px solid var(--green); }
.kpi.accent.neg { border-left-color: var(--red); }
.kpi .up { color: var(--green); } .kpi .dn { color: var(--red); }
.kpi.row { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.kpi.row canvas#gauge { width: 120px; height: 66px; }
.kpi.row canvas#ring { width: 60px; height: 60px; }
.kpi.row:last-child { justify-content: flex-start; }
.amber { color: var(--amber); }
.wl { display: flex; gap: 10px; font-weight: 600; font-size: 13px; margin: 2px 0 4px; }
.wl .g { color: var(--green); } .wl .r { color: var(--amber); }

.water canvas { display: block; width: 100%; height: 112px; }
.legend { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); }
.legend i { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-left: 8px; }
.lg-dot { background: #C8D3CF; } .lg-shark { background: #4F7CF7; } .lg-us { border: 2px solid var(--teal); background: transparent; width: 10px !important; height: 10px !important; }

.main { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.main .card { height: 372px; display: flex; flex-direction: column; }
#hist { flex: 1; width: 100%; min-height: 0; display: block; }
.log { flex: 1; overflow: hidden; padding: 2px 14px 10px; line-height: 1.72; position: relative; }
.log::after { content: ''; position: absolute; left: 0; right: 0; bottom: 0; height: 40px; background: linear-gradient(transparent, #fff); pointer-events: none; }
.log .l { display: grid; grid-template-columns: 62px 1fr; gap: 6px; white-space: nowrap; }
.log .l.new { animation: in .35s ease-out; }
.log .l span:last-child { overflow: hidden; text-overflow: ellipsis; color: #2B3A37; }
@keyframes in { from { opacity: 0; transform: translateY(-4px); } }
.tag { font-weight: 600; }
.t-TRACK { color: #4F7CF7; } .t-COPY { color: #7A5CF0; } .t-FILL { color: var(--teal); } .t-EXIT { color: #E07B2E; }
.t-SKIP { color: #C99A0A; } .t-SYNC { color: var(--dim); } .t-SOLD { color: var(--green); } .t-SOLD.neg { color: var(--red); }
.t-ATTACH { color: var(--teal); } .t-DETACH { color: var(--muted); }
.v-pos { color: var(--green); } .v-neg { color: var(--red); }

.target { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 14px; padding: 0 2px; }
.target b { color: var(--text); font-weight: 500; }
.track { height: 6px; background: #DCE4E1; border-radius: 3px; overflow: hidden; }
.track i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--teal), var(--green) 70%, #E5B53A); border-radius: 3px; transition: width .6s; }

.sharks { display: grid; grid-template-columns: repeat(8, 1fr); gap: 8px; }
.shark { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 10px 10px 8px; display: flex; flex-direction: column; gap: 5px; position: relative; transition: border-color .3s, box-shadow .3s; min-height: 112px; }
.shark.copying { border-color: #8FB4FF; box-shadow: 0 0 0 2px rgba(79,124,247,.14); }
.shark .hd { display: flex; align-items: center; gap: 8px; }
.shark .av { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; color: #fff; font-family: var(--sans); font-weight: 700; font-size: 12px; flex: none; }
.shark .rk { position: absolute; top: 8px; right: 10px; color: var(--dim); }
.shark .nm { padding-right: 18px; font-weight: 600; font-family: var(--sans); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.shark .ad { color: var(--muted); font-size: 11px; }
.shark .cp { display: flex; justify-content: space-between; align-items: baseline; margin-top: auto; }
.shark .cp span { color: var(--muted); font-size: 11px; }
.shark .cp b { font-weight: 600; }
.shark .bar { height: 4px; border-radius: 2px; background: #EEF2F0; overflow: hidden; }
.shark .bar i { display: block; height: 100%; }
.shark .badge { position: absolute; top: 8px; right: 8px; background: var(--teal); color: #fff; font-size: 9.5px; padding: 2px 6px; border-radius: 4px; font-weight: 600; letter-spacing: .02em; }
.shark.empty { color: var(--dim); align-items: center; justify-content: center; border-style: dashed; background: transparent; }

.foot { display: flex; justify-content: space-between; color: var(--muted); padding: 4px 2px; gap: 16px; }
#mode { white-space: nowrap; }

@media (max-width: 1100px) {
  .sharks { grid-template-columns: repeat(4, 1fr); }
  .kpis { grid-template-columns: 1fr 1fr; }
  .kpi.row canvas#gauge { width: 140px; height: 77px; }
}
@media (max-width: 760px) {
  .page { padding: 12px 10px; }
  .top { flex-direction: column; align-items: flex-start; }
  .top-r { flex-wrap: wrap; }
  #hdr { display: none; }
  .kpis { grid-template-columns: 1fr 1fr; gap: 8px; }
  .kpi b { font-size: 20px; }
  .kpi.row canvas#gauge { display: none; }
  .main { grid-template-columns: 1fr; }
  .main .card { height: 300px; }
  .sharks { grid-template-columns: 1fr 1fr; }
  .legend { display: none; }
  .foot { flex-direction: column; }
}
.shark.copying .nm { padding-right: 60px; }

/* ── live copying (real SOL, approved in the visitor's wallet) ─────────────────────────────── */
[hidden] { display: none !important; }
.pill.armed { background: var(--teal); border-color: var(--teal); color: #fff; font-weight: 600; letter-spacing: .06em; }
.pill.armed i { width: 7px; height: 7px; border-radius: 50%; background: #fff; animation: armed 1.6s infinite; }
@keyframes armed { 50% { opacity: .35; } }

.btn { font: inherit; color: var(--text); background: var(--card); border: 1px solid var(--line2); border-radius: 999px; padding: 7px 12px; cursor: pointer; display: inline-flex; align-items: center; gap: 7px; white-space: nowrap; transition: border-color .15s, background .15s; }
.btn:hover { border-color: #B9C6C1; background: #FAFCFB; }
.btn:focus-visible, .sw:focus-visible, .desk input:focus-visible { outline: 2px solid var(--teal); outline-offset: 2px; }
.btn:disabled { opacity: .45; cursor: default; }
.btn.go { background: var(--teal); border-color: var(--teal); color: #fff; font-weight: 600; }
.btn.go:hover:not(:disabled) { background: #0C8F87; }
.btn svg { width: 14px; height: 14px; fill: var(--card); stroke: var(--muted); stroke-width: 1.4; stroke-linecap: round; }

.desk { transition: border-color .3s, box-shadow .3s; overflow: visible; }
.desk.on { border-color: var(--teal2); box-shadow: 0 0 0 2px rgba(15,163,154,.14); }
.desk-hd { display: flex; align-items: center; gap: 14px; padding: 12px 14px; }
.desk-t { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.desk-t b { font-weight: 600; }
.desk-t .st { color: var(--dim); margin-left: 4px; }
.desk-t .st.on { color: var(--teal); font-weight: 600; }
.desk-t .muted { line-height: 1.45; }
.desk-t .err { color: var(--red); }
.desk-nums { display: flex; gap: 18px; }
.desk-nums div { display: flex; flex-direction: column; gap: 2px; align-items: flex-end; }
.desk-nums b { font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }

.sw { flex: none; width: 40px; height: 22px; border-radius: 11px; border: 0; padding: 0; background: #D3DCD8; position: relative; cursor: pointer; transition: background .2s; }
.sw i { position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(15,27,25,.25); transition: transform .2s; }
.sw.on { background: var(--teal); }
.sw.on i { transform: translateX(18px); }

.walw { position: relative; }
.wal img { width: 16px; height: 16px; border-radius: 4px; }
.wal b { font-weight: 500; color: var(--muted); }
.wal:not(.connected) { background: var(--text); border-color: var(--text); color: #fff; }
.wal:not(.connected):hover { background: #22312E; }
.menu { position: absolute; right: 0; top: calc(100% + 6px); z-index: 20; min-width: 230px; background: var(--card); border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 8px 28px rgba(15,27,25,.14); padding: 6px; display: flex; flex-direction: column; }
.menu button, .menu a { font: inherit; color: var(--text); background: none; border: 0; border-radius: 6px; padding: 8px 10px; text-align: left; cursor: pointer; display: flex; align-items: center; gap: 9px; text-decoration: none; }
.menu button:hover, .menu a:hover { background: var(--bg); }
.menu img { width: 20px; height: 20px; border-radius: 5px; }
.menu a { color: var(--teal); font-weight: 600; }
.menu .mt { padding: 8px 10px 4px; }
.menu .mh { display: flex; gap: 9px; align-items: center; padding: 8px 10px 10px; border-bottom: 1px solid var(--line); margin-bottom: 4px; }
.menu .mh img { width: 26px; height: 26px; }
.menu .danger { color: var(--red); }

.desk-set { display: grid; grid-template-columns: repeat(5, 1fr); gap: 12px; padding: 12px 14px 14px; border-top: 1px solid var(--line); }
.fld { display: flex; flex-direction: column; gap: 5px; color: var(--muted); }
.fld .in { display: flex; align-items: center; border: 1px solid var(--line2); border-radius: 8px; background: #FAFCFB; padding: 0 10px; transition: border-color .15s; }
.fld .in:focus-within { border-color: var(--teal); background: #fff; }
.fld input { font: inherit; font-size: 13px; color: var(--text); border: 0; background: none; padding: 7px 0; width: 100%; min-width: 0; outline: none; font-variant-numeric: tabular-nums; -moz-appearance: textfield; }
.fld input::-webkit-inner-spin-button, .fld input::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
.fld em { font-style: normal; color: var(--dim); }
.fld small { color: var(--dim); font-size: 10.5px; }
.fld .in.clamped { animation: clamp .9s; }
@keyframes clamp { 0%, 40% { border-color: var(--amber); background: #FFF8E6; } }

.desk-body { display: grid; grid-template-columns: 1fr 1fr; border-top: 1px solid var(--line); }
.desk-col { min-width: 0; }
.desk-col + .desk-col { border-left: 1px solid var(--line); }
.rows { padding: 0 14px 10px; max-height: 196px; overflow-y: auto; }
.rows .none { padding: 6px 0 4px; }
.pr { display: grid; grid-template-columns: minmax(64px, 1fr) 64px 92px minmax(120px, 1.3fr) auto; align-items: center; gap: 10px; padding: 5px 0; border-bottom: 1px solid #F1F4F3; white-space: nowrap; }
.pr:last-child { border-bottom: 0; }
.pr .sym { color: var(--text); font-weight: 600; text-decoration: none; overflow: hidden; text-overflow: ellipsis; }
.pr .sym:hover { color: var(--teal); }
.sell { font: inherit; font-size: 11px; font-weight: 600; color: var(--red); background: #fff; border: 1px solid #F3C4C6; border-radius: 6px; padding: 3px 9px; cursor: pointer; }
.sell:hover:not(:disabled) { background: #FFF1F1; }
.sell:disabled { color: var(--dim); border-color: var(--line2); cursor: default; }
.tr { display: grid; grid-template-columns: 34px 52px 1fr auto; gap: 6px; padding: 4px 0; line-height: 1.5; align-items: baseline; }
.tr .tx { min-width: 0; }
.tr .tx b { font-weight: 600; }
.tr .why { display: block; font-size: 11px; overflow-wrap: anywhere; }
.tr .s { text-align: right; white-space: nowrap; color: var(--muted); }
.tr .s a { color: var(--teal); text-decoration: none; }
.s-done { color: var(--green) !important; } .s-failed { color: var(--red) !important; } .s-rejected { color: var(--amber) !important; }
.s-skipped { color: var(--dim) !important; } .s-signing, .s-confirming, .s-building { color: var(--teal) !important; font-weight: 600; }

.approve { position: fixed; left: 50%; bottom: 18px; transform: translateX(-50%); z-index: 30; width: max-content; max-width: min(620px, calc(100vw - 24px)); display: flex; align-items: flex-start; gap: 12px; padding: 12px 16px; border-radius: 12px; background: var(--text); color: #fff; box-shadow: 0 10px 34px rgba(15,27,25,.28); animation: up .25s ease-out; line-height: 1.5; }
.approve b { font-weight: 600; }
.approve .muted { color: #9DB0AB; }
.approve a { color: var(--teal2); text-decoration: none; white-space: nowrap; }
.approve .stale { color: #F2C14E; font-weight: 600; margin-top: 2px; }
.approve .dot { flex: none; width: 9px; height: 9px; margin-top: 4px; border-radius: 50%; background: var(--teal2); }
.approve.a-signing { box-shadow: 0 0 0 2px var(--teal), 0 10px 34px rgba(15,27,25,.32); }
.approve.a-signing .dot, .approve.a-building .dot, .approve.a-confirming .dot { animation: armed 1s infinite; }
.approve.a-done .dot { background: #4ADE80; } .approve.a-failed .dot { background: var(--red); } .approve.a-rejected .dot, .approve.a-skipped .dot { background: #F2C14E; }
@keyframes up { from { opacity: 0; transform: translate(-50%, 8px); } }

.scrim { position: fixed; inset: 0; z-index: 40; background: rgba(15,27,25,.38); backdrop-filter: blur(3px); display: grid; place-items: center; padding: 16px; }
.dialog { background: var(--card); border-radius: 14px; border: 1px solid var(--line); box-shadow: 0 20px 60px rgba(15,27,25,.25); max-width: 520px; width: 100%; padding: 22px 22px 18px; max-height: calc(100vh - 32px); overflow-y: auto; }
.dialog h2 { font-family: var(--sans); font-size: 19px; font-weight: 700; letter-spacing: -.01em; margin: 0 0 12px; line-height: 1.25; }
.dialog ul { margin: 0 0 16px; padding-left: 18px; color: #2B3A37; line-height: 1.6; display: flex; flex-direction: column; gap: 6px; }
.dialog .chk { display: flex; align-items: center; gap: 9px; padding: 11px 12px; border: 1px solid var(--line2); border-radius: 8px; cursor: pointer; font-weight: 500; }
.dialog .chk input { width: 16px; height: 16px; accent-color: var(--teal); margin: 0; }
.dialog .acts { display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px; }

@media (max-width: 1100px) {
  .desk-hd { flex-wrap: wrap; }
  .desk-t { flex-basis: calc(100% - 60px); }
  .desk-nums { margin-right: auto; }
  .desk-nums div { align-items: flex-start; }
  .desk-set { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 760px) {
  .desk-hd { gap: 10px 12px; }
  .desk-nums { order: 3; width: 100%; justify-content: flex-start; }
  .desk-nums div { align-items: flex-start; }
  .gear span { display: none; }
  .gear { order: 4; }
  .walw { order: 5; margin-left: auto; }
  .desk-set { grid-template-columns: 1fr 1fr; }
  .desk-body { grid-template-columns: 1fr; }
  .desk-col + .desk-col { border-left: 0; border-top: 1px solid var(--line); }
  .pr { grid-template-columns: 1fr auto auto; gap: 4px 10px; }
  .pr > span:nth-of-type(1) { display: none; }
  .pr > span:nth-of-type(3) { grid-column: 1 / -1; order: 5; }
  .approve { bottom: 12px; width: calc(100vw - 24px); }
  .menu { right: 0; }
}
