/* ==========================================================================
   MEXC Crypto — Quiet Layer
   A simplification pass over Paper & Pine: fewer boxes, fewer rules,
   fewer competing labels. One clear reading order per page.
   ========================================================================== */

html { -webkit-tap-highlight-color: transparent; }
:root,
html[data-theme="light"] {
  --mut: #5d6961;
  --dim: #647067;
  --amber: #7b570f;
}

.sr-only {
  position: absolute !important;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
.skip-link {
  position: fixed;
  top: 10px;
  left: 10px;
  z-index: 999;
  padding: 10px 14px;
  background: var(--panel);
  color: var(--tx);
  border: 1px solid var(--accent);
  border-radius: 2px;
  font-size: 13px;
  text-decoration: none;
  transform: translateY(-160%);
  transition: transform .15s ease;
}
.skip-link:focus { transform: none; }
body.login-open .skip-link { display: none; }

h1.pg {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 4px 12px;
  font-family: var(--display);
  font-size: 28px;
  font-weight: 500;
  letter-spacing: -.02em;
  line-height: 1.1;
  margin: 0 0 28px;
  color: var(--tx);
}
h1.pg .dim {
  font-family: var(--sans);
  font-size: 12px;
  font-weight: 400;
  letter-spacing: 0;
  color: var(--mut);
}
#main { scroll-margin-top: 68px; }
.view { scroll-margin-top: 68px; }
h1.pg, .home-title, .card > h3 { text-wrap: balance; }

.views {
  max-width: 1360px;
  padding: 40px 40px 88px;
}
h2.pg {
  font-size: 28px;
  border-bottom: 0;
  padding-bottom: 0;
  margin-bottom: 28px;
  gap: 12px;
}
h2.pg .dim { font-size: 12px; color: var(--mut); }
.card {
  border-top: 1px solid var(--line);
  padding: 18px 0 4px;
}
.card > h3 { color: var(--tx); margin-bottom: 12px; }
.card > h3 .r { font-family: var(--sans); font-size: 11px; }
.hint { font-size: 12px; line-height: 1.7; }

.mono, .num, .mb-fig, .vital b, .tr-px, .accountbtn .an { font-variant-numeric: tabular-nums; }
.accountbtn .an { max-width: 190px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.num { font-variant-numeric: tabular-nums; }

/* Arabic/Hebrew: keep numeric strings and signs in LTR reading order */
html[dir="rtl"] .mono,
html[dir="rtl"] .num,
html[dir="rtl"] .clock,
html[dir="rtl"] .riskpill b,
html[dir="rtl"] .side-foot .stamp,
html[dir="rtl"] .home-status,
html[dir="rtl"] .mb-fig,
html[dir="rtl"] .mb-chg,
html[dir="rtl"] .vital b,
html[dir="rtl"] .ratio-fig em,
html[dir="rtl"] .ev-time,
html[dir="rtl"] .cal-time,
html[dir="rtl"] .wallet-main > b,
html[dir="rtl"] .wallet-side b,
html[dir="rtl"] .wallet-metrics b,
html[dir="rtl"] .set-account .amt b,
html[dir="rtl"] .stat b,
html[dir="rtl"] .statcell .sv,
html[dir="rtl"] .dh-price,
html[dir="rtl"] .dh-delta,
html[dir="rtl"] .tr-px,
html[dir="rtl"] #tr-chg,
html[dir="rtl"] .tr-eq b,
html[dir="rtl"] .tr-acct-top b,
html[dir="rtl"] .tr-acct-line b,
html[dir="rtl"] .pair .px,
html[dir="rtl"] .pair .chg,
html[dir="rtl"] .tr-stats .s b,
html[dir="rtl"] .bk-row span,
html[dir="rtl"] .tk-row span,
html[dir="rtl"] .tbw .num,
html[dir="rtl"] .login-stat b,
html[dir="rtl"] .tr-levval,
html[dir="rtl"] .tr-estimates-inline b,
html[dir="rtl"] .tr-estimates-inline > div,
html[dir="rtl"] .bk-row span,
html[dir="rtl"] .login-stat .c {
  direction: ltr;
  unicode-bidi: isolate;
  text-align: start;
}
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.theme-toggle { width: 32px; height: 32px; }
.modal { overscroll-behavior: contain; }
body.modal-open { overflow: hidden; }
.accountmenu { overscroll-behavior: contain; }

.bk-row {
  width: 100%;
  border: 0;
  background: none;
  color: inherit;
  font: inherit;
  text-align: left;
  appearance: none;
}
.cal-low-toggle { padding: 6px 0; }

.dh-title .dh-h1 {
  margin: 0;
  font-family: var(--display);
  font-size: 20px;
  font-weight: 500;
  letter-spacing: -.01em;
  line-height: 1.1;
  color: var(--tx);
}

/* --------------------------------------------------------------------------
   Home: three zones — board, signals, map/agenda
   -------------------------------------------------------------------------- */

.home-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 28px;
  margin: 0 0 26px;
  padding: 0;
  border: 0;
}
.home-kicker {
  font-family: var(--sans);
  font-size: 11px;
  letter-spacing: .02em;
  color: var(--mut);
  margin-bottom: 8px;
}
.home-title {
  font-family: var(--display);
  font-size: 32px;
  font-weight: 500;
  letter-spacing: -.03em;
  line-height: 1.05;
  color: var(--tx);
}
.home-title span { display: none; }
.home-status {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: .02em;
  color: var(--mut);
  white-space: nowrap;
}

.market-board {
  border-top: 2px solid var(--tx);
  padding-top: 22px;
}
.market-quotes {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr);
  gap: 56px;
}
.mb-quote {
  display: flex;
  flex-direction: column;
  min-width: 0;
  color: inherit;
  text-decoration: none;
  padding-bottom: 6px;
}
.mb-quote:hover .mb-sym { color: var(--accent); }
.mb-top { display: flex; align-items: baseline; gap: 9px; flex-wrap: wrap; }
.mb-sym {
  font-family: var(--display);
  font-size: 13px;
  font-weight: 500;
  letter-spacing: .04em;
  color: var(--tx);
  transition: color var(--dur-hover) var(--ease);
}
.mb-name { font-size: 12px; color: var(--mut); }
.mb-ath { margin-left: auto; font-family: var(--mono); font-size: 10px; color: var(--mut); white-space: nowrap; }
.mb-ath b { font-weight: 400; color: var(--down); }
.mb-fig {
  display: flex;
  align-items: baseline;
  gap: 9px;
  margin-top: 14px;
  font-family: var(--display);
  font-size: 52px;
  font-weight: 500;
  line-height: .94;
  letter-spacing: -.035em;
  font-variant-numeric: tabular-nums;
  color: var(--tx);
}
.mb-quote.alt .mb-fig { font-size: 34px; margin-top: 12px; }
.mb-fig small { font-family: var(--mono); font-size: 10px; font-weight: 400; letter-spacing: .05em; color: var(--mut); }
.mb-chg {
  display: flex;
  align-items: baseline;
  gap: 7px;
  margin-top: 8px;
  font-family: var(--mono);
  font-size: 11px;
}
.mb-chg span:last-child { font-family: var(--sans); font-size: 10px; color: var(--mut); }
.mb-spark { height: 52px; margin: 16px 0 0; }
.mb-quote.alt .mb-spark { height: 38px; margin-top: 14px; }
.mb-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 18px;
  margin-top: 10px;
  font-family: var(--mono);
  font-size: 10px;
  color: var(--mut);
}
.mb-meta b { font-weight: 400; color: var(--tx2); }

.market-vitals {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 28px;
  border-top: 1px solid var(--line);
  margin-top: 24px;
  padding: 16px 0 2px;
}
.vital { min-width: 0; }
.vital span {
  display: block;
  font-size: 10px;
  color: var(--mut);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.vital b {
  display: block;
  margin-top: 5px;
  font-family: var(--display);
  font-size: 16px;
  font-weight: 500;
  letter-spacing: -.01em;
  font-variant-numeric: tabular-nums;
  color: var(--tx);
  white-space: nowrap;
}
.vital small {
  display: block;
  margin-top: 3px;
  font-family: var(--mono);
  font-size: 10px;
  color: var(--dim);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.home-row {
  display: grid;
  gap: 56px;
  border-top: 1px solid var(--line);
  margin-top: 40px;
  padding-top: 24px;
}
.home-row.two { grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr); }
.home-row.map-agenda { grid-template-columns: minmax(0, 1.6fr) minmax(280px, 1fr); align-items: start; }
.home-panel { min-width: 0; }
.row-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 12px;
}
.row-head h2 {
  font-family: var(--display);
  font-size: 13px;
  font-weight: 500;
  letter-spacing: .02em;
  color: var(--tx2);
}
.row-head span { font-family: var(--sans); font-size: 10px; color: var(--mut); }
.row-head a { font-family: var(--sans); font-size: 11px; color: var(--accent); text-decoration: none; padding: 6px 0; display: inline-block; }
.row-head a:hover { text-decoration: underline; }

.ratio-fig {
  display: flex;
  align-items: baseline;
  gap: 12px;
  font-family: var(--display);
  font-size: 30px;
  font-weight: 500;
  letter-spacing: -.025em;
  font-variant-numeric: tabular-nums;
  color: var(--tx);
}
.ratio-fig em { font-family: var(--mono); font-style: normal; font-size: 11px; }
.ratio-spark { height: 64px; margin: 10px 0 0; }
.ratio-hint { margin-top: 8px; font-size: 11px; color: var(--mut); line-height: 1.7; }

.brief p { font-size: 13px; line-height: 1.85; color: var(--tx2); }
.brief-facts {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  border-top: 1px solid var(--line);
  margin-top: 18px;
  padding-top: 12px;
}
.brief-fact span { display: block; font-size: 10px; color: var(--mut); }
.brief-fact b { display: block; margin-top: 4px; font-family: var(--mono); font-size: 12px; font-weight: 400; color: var(--tx2); }

.heat-frame { border: 0; border-top: 1px solid var(--line); background: var(--bg); }
.heat-legend { margin-top: 8px; font-size: 10px; }
.heat-legend .heat-scale { width: 110px; height: 5px; }
#heatmap-note { margin-top: 6px; font-size: 10px; }

.agenda-list { display: flex; flex-direction: column; }
.ev-item {
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr) 26px;
  gap: 12px;
  align-items: baseline;
  width: 100%;
  padding: 11px 0;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: none;
  color: inherit;
  text-align: left;
  cursor: pointer;
}
.ev-item:hover { background: var(--accent-soft); }
.ev-time { font-family: var(--mono); font-size: 10px; color: var(--mut); }
.ev-body { min-width: 0; }
.ev-title { display: block; font-size: 12px; line-height: 1.45; color: var(--tx); }
.ev-meta { display: block; margin-top: 2px; font-family: var(--mono); font-size: 10px; color: var(--mut); }
.ev-impact { font-family: var(--sans); font-size: 10px; text-align: right; color: var(--mut); }
.ev-impact.high { color: var(--down); }
.ev-impact.mid { color: var(--amber); }

/* --------------------------------------------------------------------------
   Account: fewer rules, no duplicated balance
   -------------------------------------------------------------------------- */

.set-account { border: 0; padding-bottom: 6px; }
.wallet-hero { border-top: 2px solid var(--tx); padding: 18px 0 22px; }
.wallet-side { gap: 32px; }
.wallet-side > div { border-left: 0; padding: 0; }
.acct-split {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(280px, .65fr);
  border-top: 2px solid var(--tx);
  background: var(--panel);
}
.acct-main, .acct-fund { padding: 22px 24px; min-width: 0; }
.acct-fund { border-left: 1px solid var(--line); }
.acct-k { font-size: 11px; color: var(--mut); }
.acct-v {
  margin-top: 4px;
  font-family: var(--display);
  font-size: 34px;
  line-height: 1.1;
  font-weight: 500;
  letter-spacing: -.02em;
  font-variant-numeric: tabular-nums;
}
.acct-v em { font-family: var(--mono); font-size: 10px; font-style: normal; font-weight: 400; letter-spacing: 0; color: var(--mut); }
.acct-v.small { font-size: 24px; }
.acct-note { margin-top: 5px; font-size: 11px; color: var(--mut); }
.acct-chips {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}
.acct-chips span, .acct-fund-stats span { display: block; margin-bottom: 3px; font-size: 10px; color: var(--mut); }
.acct-chips b { font: 400 13px var(--mono); color: var(--tx); font-variant-numeric: tabular-nums; }
.acct-fund-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}
.acct-fund-stats b { display: block; font: 400 12px var(--mono); color: var(--tx2); white-space: nowrap; }
.acct-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
.acct-actions .btn { height: 32px; }
.acct-sep-note { margin: 10px 0 18px; }
.wallet-metrics {
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 24px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  padding: 16px 0;
  margin: 0 0 8px;
}
.wallet-metrics .card {
  border: 0;
  padding: 0;
}
.wallet-metrics b { font-size: 16px; }
.wallet-metrics small { font-size: 10px; }
.grid2 { gap: 44px; }
.empty-line {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 10px;
  border-top: 1px solid var(--line);
  margin-top: 30px;
  padding-top: 14px;
  font-size: 11px;
  color: var(--mut);
}
.empty-line b { font-weight: 500; color: var(--tx2); }
.empty-line a { color: var(--accent); text-decoration: none; }
.empty-line a:hover { text-decoration: underline; }

/* --------------------------------------------------------------------------
   Trade: one right-hand panel, advanced details collapsed
   -------------------------------------------------------------------------- */

.trade-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  flex-wrap: wrap;
  margin-bottom: 24px;
}
.trade-head h2.pg { margin-bottom: 0; }
.pair-switch { display: flex; gap: 8px; flex-wrap: wrap; }
.pair-switch .pair { padding: 7px 12px; gap: 10px; }
.pair-switch .pair .px { font-size: 14px; }
.tr-grid { gap: 30px; }
.tr-form > .card:first-child { border-top: 0; padding-top: 0; }
#tr-formcard { border-top: 1px solid var(--line); padding: 18px; }
.tr-acct {
  border-bottom: 1px solid var(--line);
  padding-bottom: 12px;
  margin-bottom: 14px;
}
.tr-acct-top { display: flex; align-items: baseline; gap: 8px; }
.tr-acct-top > span { font-size: 10px; color: var(--mut); }
.tr-acct-top > b {
  margin-left: auto;
  font-family: var(--display);
  font-size: 24px;
  font-weight: 500;
  letter-spacing: -.02em;
  font-variant-numeric: tabular-nums;
}
.tr-acct-top > em { font-family: var(--mono); font-style: normal; font-size: 9px; color: var(--mut); }
.tr-acct-line { display: flex; justify-content: space-between; gap: 12px; margin-top: 7px; font-size: 11px; color: var(--mut); }
.tr-acct-line b { font-family: var(--mono); font-weight: 400; color: var(--tx2); }
.tr-acct-more, .tr-advanced { margin-top: 10px; }
.tr-acct-more summary, .tr-advanced summary {
  cursor: pointer;
  list-style: none;
  font-size: 11px;
  color: var(--mut);
  padding: 4px 0;
}
.tr-acct-more summary::-webkit-details-marker, .tr-advanced summary::-webkit-details-marker { display: none; }
.tr-acct-more summary::after, .tr-advanced summary::after { content: " +"; color: var(--mut); }
.tr-acct-more[open] summary::after, .tr-advanced[open] summary::after { content: " −"; }
.tr-acct-more[open] summary, .tr-advanced[open] summary { color: var(--tx2); }
.tr-acct-more .kv { padding: 6px 0; font-size: 11px; }
.tr-acct-more .bar { margin-top: 8px; }
.tr-advanced .tr-estimates { margin-top: 6px; }
.tr-advanced .tr-tpsl { margin-top: 12px; }
.tr-form .card + .card { margin-top: 0; }
.tr-bookcol .card { padding-top: 16px; }
.tr-panel { margin-top: 24px; }

/* order ticket: side switch, stop/tif, options */
.tr-side {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  margin: 4px 0 12px;
}
.tr-side-btn {
  height: 34px;
  border: 1px solid var(--line2);
  background: transparent;
  color: var(--mut);
  font: 500 12px/1 var(--sans);
  cursor: pointer;
  border-radius: 0;
}
.tr-side-btn.long.on { border-color: rgba(29, 91, 69, .7); background: rgba(29, 91, 69, .14); color: var(--up); font-weight: 500; }
.tr-side-btn.short.on { border-color: rgba(162, 62, 42, .65); background: rgba(162, 62, 42, .12); color: var(--down); font-weight: 500; }
.tr-mode-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 10px; }
.tr-mode-row .tr-seg { display: grid; grid-template-columns: 1fr 1fr; width: 168px; }
.tr-levval { font-family: var(--mono); font-size: 12px; font-weight: 400; color: var(--tx); }
.tr-type-tabs { margin-top: 12px; }
.tr-qtyrow { display: flex; align-items: center; gap: 8px; margin-top: 8px; }
.tr-qtyrow .pct-row { flex: 1; margin-top: 0; }
.pct-row button.on { color: var(--tx); border-color: var(--accent); background: var(--accent-soft); }
.tr-max {
  min-height: 28px;
  border: 1px solid var(--line2);
  background: transparent;
  color: var(--mut);
  height: 26px;
  padding: 0 9px;
  font: 11px var(--sans);
  cursor: pointer;
}
.tr-opt { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin-top: 10px; font-size: 11px; color: var(--mut); }
.tr-opt label { display: inline-flex; align-items: center; gap: 5px; min-height: 24px; cursor: pointer; }
.tr-opt input { width: 13px; height: 13px; accent-color: var(--accent); margin: 0; }
.tr-opt input:disabled + * { opacity: .5; }
.tr-estimates-inline {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-top: 12px;
  padding-top: 11px;
  border-top: 1px solid var(--line);
}
.tr-estimates-inline > div { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; min-width: 0; }
.tr-estimates-inline span { font-size: 10px; color: var(--mut); white-space: nowrap; }
.tr-estimates-inline b { font-family: var(--mono); font-size: 11px; font-weight: 400; color: var(--tx2); font-variant-numeric: tabular-nums; white-space: nowrap; text-align: right; }
.tr-submit-row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 16px; }
.tr-submit-row .tr-submit {
  width: auto;
  margin-top: 0;
  height: 40px;
  justify-content: center;
  font-size: 13px;
}
.tr-btn.tr-submit.long { background: var(--accent); color: #f8fbf6; }
.tr-btn.tr-submit.short { background: var(--down); color: #fffaf5; }
.tr-feehint { margin-top: 8px; font-size: 11px; }
.tr-pricehint { display: inline-flex; align-items: center; gap: 7px; }
.tr-bbo { height: 24px; padding: 0 6px; border: 1px solid var(--line2); background: none; color: var(--mut); font: 10px var(--mono); cursor: pointer; }
.tr-bbo:hover { color: var(--tx); border-color: var(--mut); }
.tr-pct-range { width: 100%; height: 22px; margin: 6px 0 0; }
.tr-panel-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; font-size: 11px; }
.tr-card-actions { display: flex; gap: 8px; margin-top: 10px; }
.tr-card-actions .btn { flex: 1; }
.tr-pctbtns { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-top: 14px; }

/* chart timeframe */
.tr-periods { display: inline-flex; align-items: center; gap: 2px; margin-right: 10px; }
.tr-periods button {
  min-height: 26px;
  border: 0;
  background: none;
  color: var(--mut);
  font: 11px var(--mono);
  padding: 3px 5px;
  cursor: pointer;
  border-bottom: 1px solid transparent;
}
.tr-periods button.on { color: var(--tx); border-bottom-color: var(--accent); }

/* live tick */
@keyframes trFlashUp { 0% { color: var(--up); background: rgba(29, 91, 69, .12); } 100% { background: transparent; } }
@keyframes trFlashDown { 0% { color: var(--down); background: rgba(162, 62, 42, .1); } 100% { background: transparent; } }
.tr-px.flash-up { animation: trFlashUp .7s ease-out; }
.tr-px.flash-down { animation: trFlashDown .7s ease-out; }
@keyframes trFresh { 0% { background: rgba(29, 91, 69, .09); } 100% { background: transparent; } }
.tk-row.fresh { animation: trFresh .55s ease-out; }

/* depth ladder: price / size / cumulative */
.bk-row, .bk-head { grid-template-columns: 1.15fr .9fr .9fr; }
.bk-head span:nth-child(3) { text-align: right; }
.bk-row { height: 24px; font-size: 11px; }
.bk-row span:nth-child(3) { text-align: right; font-size: 10px; }
.bk-row i { z-index: 0; }
.bk-row span { position: relative; z-index: 1; }

@media (max-width: 760px) {
  .bk-row { height: 26px; font-size: 12px; }
}

html[data-theme="dark"] .tr-btn.long { color: #0b1510; }
html[data-theme="dark"] .tr-btn.short { color: #1a0d09; }

@media (max-width: 1480px) {
  .tr-grid {
    grid-template-columns: minmax(0, 1fr) 336px;
    grid-template-areas: "main form" "book book";
  }
  .tr-bookcol {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 30px;
    align-items: start;
  }
}
@media (max-width: 1080px) {
  .tr-grid { grid-template-columns: minmax(0, 1fr); grid-template-areas: "main" "form" "book"; }
  .tr-bookcol { grid-template-columns: minmax(0, 1fr); }
}

/* --------------------------------------------------------------------------
   Calendar: list by day is the default
   -------------------------------------------------------------------------- */

.cal-toolbar {
  display: flex;
  align-items: center;
  gap: 22px;
  flex-wrap: wrap;
  margin-bottom: 22px;
}
.cal-toolbar .tf { gap: 14px; }
.cal-toolbar .tf button {
  border: 0;
  background: none;
  padding: 0;
  height: 28px;
  font-size: 12px;
  color: var(--mut);
  border-bottom: 1px solid transparent;
}
.cal-toolbar .tf button.on { color: var(--tx); border-bottom-color: var(--accent); }
.cal-summary { font-family: var(--mono); font-size: 10px; color: var(--mut); }
.cal-low-toggle {
  border: 0;
  background: none;
  padding: 0;
  font-size: 11px;
  color: var(--accent);
  cursor: pointer;
}
.cal-low-toggle:hover { text-decoration: underline; }
.cal-toolbar .legend { margin-left: auto; }
.cal-agenda { border-top: 1px solid var(--line2); }
.cal-day { border-bottom: 1px solid var(--line2); padding: 0; }
.cal-day > summary {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 0;
  cursor: pointer;
  list-style: none;
}
.cal-day > summary::-webkit-details-marker { display: none; }
.cal-day > summary::after { content: "+"; color: var(--mut); font-size: 14px; line-height: 1; margin-left: 8px; }
.cal-day[open] > summary::after { content: "−"; }
.cal-day > summary b {
  font-family: var(--display);
  font-size: 13px;
  font-weight: 500;
  color: var(--tx);
  letter-spacing: .01em;
}
.cal-day > summary span { margin-left: auto; font-family: var(--mono); font-size: 10px; color: var(--mut); }
.cal-day[open] > summary { padding-bottom: 6px; }
.cal-row { border-top: 1px solid var(--line); }
.cal-row {
  display: grid;
  grid-template-columns: 52px minmax(0, 1fr) 30px;
  gap: 14px;
  align-items: baseline;
  width: 100%;
  padding: 9px 0;
  border: 0;
  border-top: 1px solid var(--line);
  background: none;
  color: inherit;
  text-align: left;
  cursor: pointer;
}
.cal-row:hover { background: var(--accent-soft); }
.cal-time { font-family: var(--mono); font-size: 10px; color: var(--mut); }
.cal-body { min-width: 0; }
.cal-title { display: block; font-size: 12px; line-height: 1.45; color: var(--tx); }
.cal-meta { display: block; margin-top: 2px; font-family: var(--mono); font-size: 10px; color: var(--mut); }
.cal-impact { font-size: 10px; text-align: right; color: var(--mut); }
.cal-impact.high { color: var(--down); }
.cal-impact.mid { color: var(--amber); }
.cal-foot { margin-top: 16px; font-size: 11px; color: var(--mut); line-height: 1.7; }
.cal-month-nav { display: flex; align-items: center; gap: 10px; margin-bottom: 18px; }
.cal-month-nav .m { font-family: var(--display); font-size: 16px; font-weight: 500; min-width: 120px; }
.cal-month-nav .calnav { display: flex; gap: 4px; }
.cal-month-nav .calnav button { height: 30px; padding: 0 10px; border: 1px solid var(--line2); border-radius: 2px; background: none; color: var(--tx2); font-size: 11px; }

/* --------------------------------------------------------------------------
   Responsive
   -------------------------------------------------------------------------- */

@media (max-width: 1100px) {
  .views { padding: 34px 28px 76px; }
  .market-quotes { gap: 36px; }
  .market-vitals { gap: 20px; }
  .home-row { gap: 36px; }
  .home-row.map-agenda { grid-template-columns: minmax(0, 1fr); }
  .wallet-metrics { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; }
}
@media (max-width: 900px) {
  .home-row.two { grid-template-columns: minmax(0, 1fr); gap: 28px; }
  .market-quotes { grid-template-columns: minmax(0, 1fr); gap: 24px; }
  .mb-quote.alt { border-top: 1px solid var(--line); padding-top: 18px; }
  .mb-quote.alt .mb-fig { font-size: 30px; }
  .market-vitals { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px 24px; }
  .trade-head { align-items: flex-start; }
}
@media (max-width: 760px) {
  .views { padding: 22px 16px 88px; }
  h1.pg { font-size: 23px; margin-bottom: 20px; }
  .home-head { flex-direction: column; align-items: flex-start; gap: 8px; }
  .home-title { font-size: 27px; }
  .home-status { display: none; }
  .market-board { padding-top: 18px; }
  .mb-fig { font-size: 42px; }
  .mb-quote.alt .mb-fig { font-size: 28px; }
  .market-vitals { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
  .home-row { margin-top: 30px; padding-top: 20px; }
  .brief-facts { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ev-item { grid-template-columns: 36px minmax(0, 1fr) 24px; }
  .wallet-metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 18px; }
  .wallet-side { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
  .wallet-side > div { padding: 0; }
  .wallet-side b { font-size: 13px; }
  .grid2 { gap: 28px; }
  .trade-head { flex-direction: column; align-items: stretch; gap: 14px; }
  .pair-switch { display: grid; grid-template-columns: minmax(0, 1fr); gap: 8px; width: 100%; }
  .pair-switch .pair { width: 100%; flex: none; }
  .cal-toolbar { gap: 12px; }
  .cal-toolbar .legend { display: none; }
  .cal-row { grid-template-columns: 44px minmax(0, 1fr) 28px; gap: 10px; }
  .cal-impact { grid-column: 3; grid-row: 1; }
}

@media (pointer: coarse) {
  .theme-toggle { width: 40px; height: 40px; }
  .accountbtn { height: 36px; }
  .row-head a, .cal-low-toggle { padding: 10px 0; }
}

/* Market panel: tabbed order book / latest trades, shared column grid */
.tr-bookcol { display: block; }
.tr-market { padding-top: 14px; }
.tr-market-head {
  display: flex;
  padding: 0 6px;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  border-bottom: 1px solid var(--line);
}
.tr-mktabs { display: flex; align-items: center; gap: 24px; }
.tr-mktabs button {
  height: 36px;
  padding: 0 1px;
  border: 0;
  border-bottom: 1px solid transparent;
  background: none;
  color: var(--mut);
  font: 12px/1 var(--sans);
  cursor: pointer;
}
.tr-mktabs button.on { color: var(--tx); border-bottom-color: var(--tx); }
.tr-mktabs button:hover { color: var(--tx); }
.tr-market-body {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 240px;
  gap: 26px;
  align-items: start;
  padding-top: 8px;
}
.tr-market-main { min-width: 0; min-height: 520px; }
.tr-market-side {
  min-width: 0;
  border-left: 1px solid var(--line);
  padding: 8px 6px 0 22px;
}
.tr-ms-title { font-size: 10px; color: var(--mut); margin-bottom: 8px; }
.tr-ms-row { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; padding: 5px 0; font-size: 11px; color: var(--mut); }
.tr-ms-row b { font: 400 11px var(--mono); color: var(--tx2); font-variant-numeric: tabular-nums; white-space: nowrap; }
.tr-market-side .bar { margin: 5px 0 7px; }

.tr-market .bk-head,
.tr-market .bk-row,
.tr-market .tk-row {
  display: grid;
  grid-template-columns: 1.2fr .9fr .9fr;
  column-gap: 10px;
  align-items: center;
  padding-left: 6px;
  padding-right: 6px;
}
.tr-market .bk-head { border-bottom: 1px solid var(--line); margin-bottom: 2px; }
.tr-market .bk-row, .tr-market .tk-row { border-bottom: 1px solid var(--line); }
.tr-market .bk-head > span:nth-of-type(2),
.tr-market .bk-head > span:nth-of-type(3),
.tr-market .bk-row > span:nth-of-type(2),
.tr-market .bk-row > span:nth-of-type(3),
.tr-market .tk-row > span:nth-of-type(2),
.tr-market .tk-row > span:nth-of-type(3) { text-align: right; }
.tr-market .bk-row > span:nth-of-type(1) { text-align: left; }
.tr-market .tk-row { height: 24px; padding-top: 2px; padding-bottom: 2px; }
.tr-market .tk-row span:nth-child(3) { color: var(--mut); font-size: 10px; }
.tr-market .bk-row { height: 24px; padding-top: 2px; padding-bottom: 2px; }
.tr-market .bk-row span:nth-child(3) { font-size: 10px; }

@media (min-width: 1481px) {
  .tr-market-body { grid-template-columns: minmax(0, 1fr); }
  .tr-market-side { display: none; }
}
@media (max-width: 760px) {
  .tr-market-body { grid-template-columns: minmax(0, 1fr); gap: 0; }
  .tr-market-side { display: none; }
  .tr-market-main { min-height: 390px; }
  .tr-mktabs { gap: 18px; }
  .tr-market .bk-row, .tr-market .tk-row { height: 26px; font-size: 12px; }
}

@media (max-width: 760px) {
  .acct-split { grid-template-columns: minmax(0, 1fr); }
  .acct-main, .acct-fund { padding: 18px; }
  .acct-fund { border-left: 0; border-top: 1px solid var(--line); }
  .acct-v { font-size: 28px; }
  .acct-v.small { font-size: 22px; }
  .acct-chips, .acct-fund-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
}

@media (max-width: 1250px) {
  .acct-split { grid-template-columns: minmax(0, 1fr); }
  .acct-fund { border-left: 0; border-top: 1px solid var(--line); }
}
