:root {
  --bg: #08090b;
  --bg-2: #0e1013;
  --panel: #101216;
  --panel-2: #14171c;
  --line: #1e232b;
  --line-2: #272d37;
  --txt: #e7ebf0;
  --txt-dim: #8b939f;
  --txt-faint: #5a626d;
  --grn: #37d99a;
  --grn-dim: #1c7d5c;
  --amb: #f4b740;
  --red: #ff5d62;
  --blu: #5b9dff;
  --mono: ui-monospace, "SF Mono", "JetBrains Mono", "Cascadia Code", Menlo, monospace;
  --sans: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --radius: 12px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  background: var(--bg);
  color: var(--txt);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.4;
  -webkit-font-smoothing: antialiased;
}
body {
  background-image:
    radial-gradient(1200px 600px at 80% -10%, rgba(55, 217, 154, 0.06), transparent 60%),
    radial-gradient(900px 500px at 0% 0%, rgba(91, 157, 255, 0.05), transparent 55%);
  min-height: 100vh;
}

.app { max-width: 1360px; margin: 0 auto; padding: 20px 22px 60px; }

/* ---- top bar ---- */
.topbar {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 20px;
  padding: 8px 4px 20px;
}
.brand { display: flex; align-items: center; gap: 12px; }
.brand-mark { display: flex; filter: drop-shadow(0 2px 8px rgba(55,217,154,.15)); }
.brand-name { font-weight: 650; letter-spacing: -0.01em; font-size: 17px; }
.brand-sub { color: var(--txt-faint); font-size: 12px; letter-spacing: 0.02em; }

.verdict {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 18px; border-radius: 999px;
  background: var(--panel); border: 1px solid var(--line);
  justify-self: center;
}
.verdict-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--txt-faint); box-shadow: 0 0 0 0 rgba(0,0,0,0); }
.verdict-label { font-weight: 600; font-size: 13px; letter-spacing: 0.06em; text-transform: uppercase; }
.verdict.ok .verdict-dot { background: var(--grn); box-shadow: 0 0 12px 1px rgba(55,217,154,.55); animation: breathe 2.4s ease-in-out infinite; }
.verdict.ok .verdict-label { color: var(--grn); }
.verdict.warn .verdict-dot { background: var(--amb); box-shadow: 0 0 12px 1px rgba(244,183,64,.5); }
.verdict.warn .verdict-label { color: var(--amb); }
.verdict.down .verdict-dot { background: var(--red); box-shadow: 0 0 12px 1px rgba(255,93,98,.5); }
.verdict.down .verdict-label { color: var(--red); }
.verdict-why { color: var(--txt-dim); font-size: 11.5px; font-weight: 400; max-width: 340px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.verdict-why[hidden] { display: none; }
.tile .t-sub { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.topmeta { display: flex; gap: 22px; justify-content: flex-end; }
.topmeta-item { display: flex; flex-direction: column; align-items: flex-end; gap: 1px; }
.topmeta-item .k { color: var(--txt-faint); font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.08em; }
.topmeta-item .v { font-family: var(--mono); font-size: 13.5px; font-variant-numeric: tabular-nums; display: flex; align-items: center; gap: 6px; }
.pulse { width: 6px; height: 6px; border-radius: 50%; background: var(--grn); display: inline-block; }
.pulse.stale { background: var(--amb); }
.pulse.dead { background: var(--red); }

/* ---- banner ---- */
.banner {
  border-radius: 10px; padding: 11px 16px; margin-bottom: 16px;
  font-size: 13.5px; font-weight: 500;
  border: 1px solid var(--red); background: rgba(255,93,98,.08); color: #ffb9bb;
}
.banner.warn { border-color: var(--amb); background: rgba(244,183,64,.08); color: #ffe0a3; }

/* ---- tiles ---- */
.tiles {
  display: grid; grid-template-columns: repeat(7, 1fr); gap: 12px; margin-bottom: 18px;
}
.tile {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 13px 15px; position: relative; overflow: hidden;
}
.tile .t-label { color: var(--txt-faint); font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.07em; }
.tile .t-value { font-family: var(--mono); font-size: 22px; font-variant-numeric: tabular-nums; margin-top: 4px; letter-spacing: -0.02em; }
.tile .t-value small { font-size: 13px; color: var(--txt-dim); }
.tile .t-sub { color: var(--txt-dim); font-size: 11.5px; margin-top: 2px; font-family: var(--mono); }
.tile.good .t-value { color: var(--grn); }
.tile.warn .t-value { color: var(--amb); }
.tile.bad .t-value { color: var(--red); }
.tile .bar { height: 4px; border-radius: 3px; background: var(--line-2); margin-top: 9px; overflow: hidden; }
.tile .bar > i { display: block; height: 100%; background: var(--grn); border-radius: 3px; transition: width .4s ease; }
.tile .bar > i.warn { background: var(--amb); }
.tile .bar > i.bad { background: var(--red); }

/* ---- layout ---- */
.grid-main { display: grid; grid-template-columns: 2fr 1fr; gap: 16px; }
.panel {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px 17px 18px;
}
.span-2 { grid-column: span 2; }
.panel-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.panel-head h2 { font-size: 13px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.09em; color: var(--txt-dim); }
.panel-note { color: var(--txt-faint); font-size: 11.5px; }

/* ---- fleet grid (latency + resyncs + freshness, no prices) ---- */
.fleet { overflow-x: auto; }
.fleet-grid { display: grid; gap: 7px; min-width: max-content; }
.fleet .fh { color: var(--txt-faint); font-size: 11px; text-transform: uppercase; letter-spacing: 0.05em; padding: 2px 4px; align-self: center; }
.fleet .fh.ven { display: flex; align-items: center; justify-content: center; gap: 6px; font-size: 12px; text-transform: capitalize; letter-spacing: 0; color: var(--txt-dim); font-weight: 600; }
.fleet .rowlabel { display: flex; align-items: center; gap: 7px; font-weight: 600; font-size: 13px; padding-right: 4px; }
.fleet .rowlabel.sym-row { font-family: var(--mono); font-size: 12.5px; color: var(--txt); }
.fleet .rl-dot { width: 8px; height: 8px; border-radius: 50%; flex: none; }
.fleet .rl-dot.up { background: var(--grn); box-shadow: 0 0 7px rgba(55,217,154,.5); }
.fleet .rl-dot.warn { background: var(--amb); } .fleet .rl-dot.down { background: var(--red); }
.fcell { border: 1px solid var(--line-2); border-radius: 9px; padding: 9px 10px; background: var(--panel-2); position: relative; min-height: 58px; display: flex; flex-direction: column; justify-content: space-between; }
.fcell.ok { border-color: rgba(55,217,154,.26); }
.fcell.warn { border-color: rgba(244,183,64,.32); }
.fcell.bad, .fcell.down { border-color: rgba(255,93,98,.36); background: rgba(255,93,98,.05); }
.fc-top { display: flex; align-items: center; gap: 7px; }
.fc-top .dot { width: 7px; height: 7px; border-radius: 50%; flex: none; }
.fc-top .dot.ok { background: var(--grn); } .fc-top .dot.warn { background: var(--amb); } .fc-top .dot.bad { background: var(--red); } .fc-top .dot.dim { background: var(--txt-faint); }
.fc-lat { font-family: var(--mono); font-size: 16px; font-variant-numeric: tabular-nums; letter-spacing: -0.02em; }
.fc-lat small { font-size: 10px; color: var(--txt-faint); margin-left: 1px; }
.fc-state { font-family: var(--mono); font-size: 11px; color: var(--red); text-transform: uppercase; letter-spacing: 0.04em; }
.fc-resync { margin-left: auto; font-family: var(--mono); font-size: 10px; color: var(--amb); }
.fc-resync.bad { color: var(--red); }
.fcell .fresh { display: flex; align-items: center; gap: 6px; }
.fcell .fresh-track { flex: 1; height: 4px; border-radius: 3px; background: var(--line-2); overflow: hidden; }
.fcell .fresh-track > i { display: block; height: 100%; border-radius: 3px; transition: width .4s ease; }
.fcell .fresh-track > i.band-ok { background: var(--grn); }
.fcell .fresh-track > i.band-warn { background: var(--amb); }
.fcell .fresh-track > i.band-bad { background: var(--red); }
.fcell .fresh-val { font-family: var(--mono); font-size: 9px; color: var(--txt-faint); white-space: nowrap; }
.fcell .fresh-val .flag { color: var(--red); }
.cell {
  border: 1px solid var(--line-2); border-radius: 9px; padding: 9px 10px; background: var(--panel-2);
  position: relative; min-height: 62px; transition: border-color .3s;
}
.cell .c-top { display: flex; align-items: center; gap: 6px; }
.cell .dot { width: 7px; height: 7px; border-radius: 50%; flex: none; }
.cell .c-state { font-size: 10px; text-transform: uppercase; letter-spacing: 0.05em; color: var(--txt-dim); }
.cell .c-bbo { font-family: var(--mono); font-size: 12.5px; font-variant-numeric: tabular-nums; margin-top: 7px;
  display: grid; grid-template-columns: auto 1fr; gap: 1px 7px; align-items: baseline; }
.cell .c-bbo .lab { color: var(--txt-faint); font-size: 9px; text-transform: uppercase; letter-spacing: 0.04em; }
.cell .c-bbo .bid { color: var(--grn); }
.cell .c-bbo .ask { color: var(--red); }
/* freshness meter — current age vs its own recent distribution */
.cell .fresh { margin-top: 8px; display: flex; align-items: center; gap: 7px; }
.cell .fresh-track { flex: 1; height: 4px; border-radius: 3px; background: var(--line-2); overflow: hidden; }
.cell .fresh-track > i { display: block; height: 100%; border-radius: 3px; transition: width .4s ease; }
.cell .fresh-track > i.band-ok { background: var(--grn); }
.cell .fresh-track > i.band-warn { background: var(--amb); }
.cell .fresh-track > i.band-bad { background: var(--red); }
.cell .fresh-track > i.band-dim { background: var(--txt-faint); }
.cell .fresh-val { font-family: var(--mono); font-size: 9.5px; color: var(--txt-faint); white-space: nowrap; }
.cell .fresh-val .flag { color: var(--red); }
.cell.ok { border-color: rgba(55,217,154,.28); } .cell .dot.ok { background: var(--grn); box-shadow: 0 0 8px rgba(55,217,154,.5); }
.cell.warn { border-color: rgba(244,183,64,.3); } .cell .dot.warn { background: var(--amb); }
.cell.bad { border-color: rgba(255,93,98,.35); background: rgba(255,93,98,.05); } .cell .dot.bad { background: var(--red); }
.cell.dim { opacity: .5; } .cell .dot.dim { background: var(--txt-faint); }
.cell .badge { font-size: 9px; font-family: var(--mono); color: var(--amb); margin-left: auto; }
.cell .badge.bad { color: var(--red); }
/* fleet legend */
.legend { display: flex; flex-wrap: wrap; gap: 14px; margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--line); }
.legend .lg { display: flex; align-items: center; gap: 6px; color: var(--txt-faint); font-size: 11px; }
.legend .lg .dot { width: 7px; height: 7px; border-radius: 50%; }
.legend .lg .dot.ok { background: var(--grn); } .legend .lg .dot.warn { background: var(--amb); } .legend .lg .dot.bad { background: var(--red); }
.legend .lg-badge { font-family: var(--mono); color: var(--amb); font-style: normal; }

/* ---- arb panel ---- */
.arb { display: flex; flex-direction: column; gap: 10px; }
.arb-row { border: 1px solid var(--line-2); border-radius: 10px; padding: 12px 13px; background: var(--panel-2); }
.arb-row .ar-sym { font-family: var(--mono); font-weight: 600; font-size: 13px; }
.arb-row .ar-net { float: right; font-family: var(--mono); font-size: 18px; font-variant-numeric: tabular-nums; letter-spacing: -0.02em; }
.arb-row .ar-net.pos { color: var(--grn); } .arb-row .ar-net.neg { color: var(--red); }
.arb-row .ar-route { color: var(--txt-dim); font-size: 11.5px; margin-top: 9px; font-family: var(--mono); }
.arb-row .ar-route b { color: var(--txt); font-weight: 600; }
.arb-row .ar-detail { color: var(--txt-faint); font-size: 11px; margin-top: 4px; font-family: var(--mono); }

/* ---- windows ---- */
.windows { display: flex; flex-direction: column; gap: 0; }
.win-empty { color: var(--txt-faint); font-size: 13px; padding: 18px 4px; text-align: center; }
.win-row { display: grid; grid-template-columns: 96px 84px 84px 56px 116px 74px 78px 66px 54px 44px; gap: 8px; align-items: center; padding: 9px 6px; border-bottom: 1px solid var(--line); font-family: var(--mono); font-size: 12.5px; font-variant-numeric: tabular-nums; }
.win-row:last-child { border-bottom: none; }
.win-row .w-sym { font-weight: 600; }
.win-row .w-sell, .win-head .w-sell-h { color: #ff8a8d; font-weight: 600; }
.win-row .w-buy, .win-head .w-buy-h { color: #58d9a3; font-weight: 600; }
.win-row .w-sub-tick { color: var(--txt-faint); text-align: right; }
.win-row.ep-sub .w-sell, .win-row.ep-sub .w-buy { font-weight: 500; opacity: .85; }
.win-row .r { text-align: right; }
.win-row .muted { color: var(--txt-faint); }
.win-row .pos { color: var(--grn); } .win-row .neg { color: var(--red); }
.win-row small { color: var(--txt-faint); }
.win-head { color: var(--txt-faint); font-size: 10px; text-transform: uppercase; letter-spacing: 0.06em; border-bottom: 1px solid var(--line-2); }
.win-head .w-sell-h, .win-head .w-buy-h { opacity: .8; }
.win-row.win-total { border-bottom: none; border-top: 2px solid var(--line-2); margin-top: 2px; padding-top: 11px; font-weight: 600; }
.win-row.win-total .w-total-lbl { color: var(--txt-dim); text-transform: uppercase; letter-spacing: 0.06em; font-size: 11px; }
.win-row.win-total .pos { color: var(--grn); }
.win-row.expandable { cursor: pointer; }
.win-row.expandable:hover { background: var(--panel-2); }
.win-row .chip { font-size: 9.5px; color: var(--blu); background: rgba(91,157,255,.1); border-radius: 5px; padding: 1px 6px; margin-left: 6px; }
.win-row.ep-sub { border-bottom: none; padding: 2px 6px; font-size: 11.5px; opacity: .75; }
.win-row.ep-sub .w-route { color: var(--txt-faint); }

/* ---- book ---- */
.seg { display: flex; gap: 3px; background: var(--panel-2); border-radius: 8px; padding: 3px; }
.seg button { background: none; border: none; color: var(--txt-dim); font-family: var(--mono); font-size: 11px; padding: 4px 9px; border-radius: 6px; cursor: pointer; }
.seg button.on { background: var(--line-2); color: var(--txt); }
/* consolidated cross-venue order book ladder — centred, no horizontal scroll */
.book { overflow-x: hidden; }
/* MID column = 44px (half = 22px), left 5 cols == right 5 cols so the centre
   gutter sits at exactly 50% and the whole ladder is symmetric. */
.obook { font-family: var(--mono); font-size: 12px; font-variant-numeric: tabular-nums; width: max-content; max-width: 100%; margin: 2px auto 0; }
.ob-row { display: grid; grid-template-columns: 44px 54px 92px 54px 92px 44px 92px 54px 54px 92px 44px; align-items: center; position: relative; }
.ob-center { background: var(--panel-2); border-top: 1px solid var(--line-2); border-bottom: 1px solid var(--line-2); }
.ob-center .mid { color: var(--txt); font-weight: 700; }
.ob-row > span { padding: 2.5px 6px; position: relative; z-index: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ob-row .r { text-align: right; }
.ob-head { color: var(--txt-faint); font-size: 9.5px; text-transform: uppercase; letter-spacing: 0.05em; border-bottom: 1px solid var(--line-2); padding-bottom: 6px; margin-bottom: 4px; }
.ob-row .c-ex { color: var(--txt-faint); font-size: 10px; }
.ob-row .muted { color: var(--txt-dim); }
.ob-row .bidpx { color: var(--grn); font-weight: 600; text-align: right; }
.ob-row .askpx { color: var(--red); font-weight: 600; }
.ob-row .mid { text-align: center; color: var(--txt-faint); font-size: 10px; }
.ob-head .mid { color: var(--txt-dim); }
/* depth bars: each confined to its own half, anchored at the centre gutter,
   so they always sit under their side's data and never overrun. */
.ob-row .depth { position: absolute; top: 1px; bottom: 1px; z-index: 0; border-radius: 3px; opacity: 0.14; }
.ob-row .depth.bid { right: calc(50% + 22px); background: var(--grn); color: var(--grn); }
.ob-row .depth.ask { left: calc(50% + 22px); background: var(--red); color: var(--red); }
/* "break" cap when a bar fills its half (max cumulative depth shown) */
.ob-row .depth.maxed::after { content: ""; position: absolute; top: 0; bottom: 0; width: 7px; opacity: 0.85; background: repeating-linear-gradient(135deg, transparent 0 1.5px, currentColor 1.5px 3px); }
.ob-row .depth.bid.maxed::after { left: 0; }
.ob-row .depth.ask.maxed::after { right: 0; }

/* ---- footer ---- */
.foot { margin-top: 26px; color: var(--txt-faint); font-size: 11.5px; display: flex; gap: 8px; align-items: center; font-family: var(--mono); }
.foot-sep { opacity: .5; }

/* ---- gate ---- */
.gate { position: fixed; inset: 0; display: flex; align-items: center; justify-content: center; background: var(--bg); z-index: 50; }
.gate[hidden] { display: none; }
.gate-card { background: var(--panel); border: 1px solid var(--line); border-radius: 16px; padding: 34px 30px; width: 340px; display: flex; flex-direction: column; align-items: center; gap: 6px; }
.gate-mark { margin-bottom: 6px; }
.gate-card h1 { font-size: 17px; font-weight: 650; }
.gate-card p { color: var(--txt-faint); font-size: 12.5px; margin-bottom: 12px; }
.gate-card input { width: 100%; background: var(--bg-2); border: 1px solid var(--line-2); border-radius: 9px; padding: 11px 13px; color: var(--txt); font-family: var(--mono); font-size: 14px; }
.gate-card input:focus { outline: none; border-color: var(--grn-dim); }
.gate-card button { width: 100%; margin-top: 10px; background: var(--grn); color: #06231a; border: none; border-radius: 9px; padding: 11px; font-weight: 650; font-size: 14px; cursor: pointer; }
.gate-card button:hover { filter: brightness(1.06); }
.gate-err { color: var(--red); font-size: 12px; margin-top: 8px; }

/* ---- engine control ---- */
.ctrl-panel { border-color: var(--line-2); }
#control { display: flex; flex-direction: column; gap: 16px; }
.ctrl-engine { display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap; padding-bottom: 14px; border-bottom: 1px solid var(--line); }
.ctrl-eng-state { display: flex; align-items: center; gap: 10px; }
.ctrl-eng-dot { width: 11px; height: 11px; border-radius: 50%; background: var(--txt-faint); }
.ctrl-eng-dot.up { background: var(--grn); box-shadow: 0 0 10px 1px rgba(55,217,154,.5); animation: breathe 2.4s ease-in-out infinite; }
.ctrl-eng-dot.down { background: var(--red); box-shadow: 0 0 10px 1px rgba(255,93,98,.4); }
.ctrl-eng-label { font-family: var(--mono); font-weight: 650; font-size: 15px; letter-spacing: 0.05em; }
.ctrl-eng-btns { display: flex; gap: 8px; }
.btn-go, .btn-stop, .btn-apply, .btn-ghost, .btn-danger { font-family: var(--sans); font-size: 13px; font-weight: 600; border: none; border-radius: 8px; padding: 8px 15px; cursor: pointer; transition: filter .15s, opacity .15s; }
.btn-go { background: var(--grn); color: #06231a; }
.btn-stop { background: rgba(255,93,98,.14); color: var(--red); border: 1px solid rgba(255,93,98,.4); }
.btn-apply { background: var(--blu); color: #051327; }
.btn-danger { background: var(--red); color: #2a0708; }
.btn-ghost { background: var(--panel-2); color: var(--txt-dim); border: 1px solid var(--line-2); }
.btn-go:hover, .btn-stop:hover, .btn-apply:hover, .btn-ghost:hover, .btn-danger:hover { filter: brightness(1.1); }
.btn-go:disabled, .btn-stop:disabled, .btn-apply:disabled { opacity: .4; cursor: not-allowed; filter: none; }
.ctrl-block { display: flex; flex-direction: column; gap: 9px; }
.ctrl-lbl { font-size: 12px; text-transform: uppercase; letter-spacing: 0.07em; color: var(--txt-dim); font-weight: 600; }
.ctrl-hint { text-transform: none; letter-spacing: 0; color: var(--txt-faint); font-weight: 400; font-size: 11px; margin-left: 6px; }
.ctrl-venues { display: flex; flex-wrap: wrap; gap: 8px; }
.vpill { display: flex; align-items: center; gap: 7px; background: var(--panel-2); border: 1px solid var(--line-2); border-radius: 999px; padding: 7px 14px; color: var(--txt-faint); font-family: var(--sans); font-size: 13px; font-weight: 500; text-transform: capitalize; cursor: pointer; transition: all .15s; }
.vpill.on { border-color: rgba(55,217,154,.4); background: rgba(55,217,154,.08); color: var(--txt); }
.vpill:hover { border-color: var(--line-2); filter: brightness(1.15); }
.vp-dot { width: 7px; height: 7px; border-radius: 50%; }
.vp-dot.up { background: var(--grn); } .vp-dot.down { background: var(--txt-faint); }
.ctrl-coins { display: flex; flex-wrap: wrap; gap: 7px; min-height: 30px; align-items: center; }
.ctrl-empty { color: var(--txt-faint); font-size: 12px; }
.ccoin { display: inline-flex; align-items: center; gap: 6px; background: var(--panel-2); border: 1px solid var(--line-2); border-radius: 7px; padding: 5px 6px 5px 10px; font-family: var(--mono); font-size: 12.5px; font-weight: 600; }
.cc-x { color: var(--txt-faint); cursor: pointer; font-size: 15px; line-height: 1; padding: 0 3px; border-radius: 4px; }
.cc-x:hover { color: var(--red); background: rgba(255,93,98,.1); }
.ctrl-coin-add { display: flex; gap: 9px; align-items: flex-start; }
.ctrl-search-wrap { position: relative; flex: 1; max-width: 420px; }
#ctrl-coin-search { width: 100%; background: var(--bg-2); border: 1px solid var(--line-2); border-radius: 8px; padding: 9px 12px; color: var(--txt); font-family: var(--mono); font-size: 13px; }
#ctrl-coin-search:focus { outline: none; border-color: var(--blu); }
.ctrl-drop { position: absolute; top: calc(100% + 4px); left: 0; right: 0; max-height: 240px; overflow-y: auto; background: var(--panel); border: 1px solid var(--line-2); border-radius: 8px; z-index: 20; box-shadow: 0 8px 24px rgba(0,0,0,.4); }
.ctrl-drop[hidden] { display: none; }
.ctrl-drop-item { padding: 7px 12px; font-family: var(--mono); font-size: 13px; cursor: pointer; }
.ctrl-drop-item:hover { background: var(--panel-2); color: var(--grn); }
.ctrl-drop-empty { padding: 10px 12px; color: var(--txt-faint); font-size: 12px; }
.ctrl-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding-top: 14px; border-top: 1px solid var(--line); }
.ctrl-diff { font-size: 12.5px; color: var(--txt-dim); font-family: var(--mono); }
.ctrl-diff .d-add { color: var(--grn); } .ctrl-diff .d-rem { color: var(--red); }
.ctrl-pending { color: var(--amb); font-weight: 600; }
.ctrl-clean { color: var(--txt-faint); }
.ctrl-warn { color: var(--amb); }
.ctrl-foot-btns { display: flex; align-items: center; gap: 10px; }
.ctrl-msg { font-size: 12px; font-family: var(--mono); }
.ctrl-msg.ok { color: var(--grn); } .ctrl-msg.bad { color: var(--red); }
/* ---- modal ---- */
.modal { position: fixed; inset: 0; background: rgba(4,5,7,.72); display: flex; align-items: center; justify-content: center; z-index: 60; padding: 20px; }
.modal[hidden] { display: none; }
.modal-card { background: var(--panel); border: 1px solid var(--line-2); border-radius: 14px; padding: 22px 24px; width: 440px; max-width: 100%; }
.modal-card h3 { font-size: 16px; font-weight: 650; margin-bottom: 12px; }
.modal-body { color: var(--txt-dim); font-size: 13.5px; line-height: 1.5; }
.modal-list { list-style: none; margin: 0 0 12px; padding: 0; }
.modal-list li { padding: 4px 0; border-bottom: 1px solid var(--line); }
.modal-list li:last-child { border-bottom: none; }
.modal-list b { color: var(--txt); }
.modal-warn { color: var(--amb); margin-top: 10px; font-size: 12.5px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 18px; }

@keyframes breathe { 0%,100% { opacity: 1; } 50% { opacity: .45; } }

/* ---- responsive ---- */
@media (max-width: 1080px) {
  .tiles { grid-template-columns: repeat(4, 1fr); }
  .grid-main { grid-template-columns: 1fr; }
  .span-2 { grid-column: span 1; }
  .topbar { grid-template-columns: 1fr auto; }
  .topmeta { display: none; }
}
@media (max-width: 620px) {
  .tiles { grid-template-columns: repeat(2, 1fr); }
  .fcell { padding: 7px 7px; min-height: 52px; }
  .fc-lat { font-size: 14px; }
  /* keep sym, sell, buy, return $ on narrow screens */
  .win-row { grid-template-columns: 52px 1fr 1fr 78px; gap: 7px; font-size: 11.5px; }
  .win-row > :nth-child(4), .win-row > :nth-child(5), .win-row > :nth-child(6),
  .win-row > :nth-child(8), .win-row > :nth-child(9), .win-row > :nth-child(10) { display: none; }
}
/* keep the order book fitting (no scroll) as the panel narrows; MID stays 44px
   so the depth-bar centre offset (22px) remains correct. */
@media (max-width: 820px) {
  .obook { font-size: 10.5px; }
  .ob-row { grid-template-columns: 34px 44px 74px 44px 74px 44px 74px 44px 44px 74px 34px; }
  .ob-row > span { padding: 2.5px 4px; }
}
