/* Big Board terminal shell: a navigation rail, a context bar, edge-to-edge panes
   divided by hairlines and a status bar. Loaded after every page stylesheet. */

html { background: var(--ground-fill); }
body {
  background: var(--ground-fill); color: var(--text); font-family: var(--font-sans);
  -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale;
}
::selection { background: var(--selection); color: #fff; }
input, textarea { caret-color: var(--positive); }
* { scrollbar-width: thin; scrollbar-color: var(--rule-strong) transparent; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--rule-strong); border: 3px solid transparent; border-radius: 10px; background-clip: padding-box; }
:is(button, a, summary, input, select, textarea):focus-visible { outline-color: var(--focus); }
.market-stat-value, .balance-value, .orderbook-table, .activity-log, .lb-num { font-variant-numeric: tabular-nums slashed-zero; }
.lb-num { font-family: var(--fontfam-term); }

/* ---------- Controls ---------- */
.btn, .btn.small-btn, .btn.ghost-btn { border-radius: 4px; border-color: var(--rule-strong); color: var(--text); }
.btn.ghost-btn { color: var(--text-soft); border-color: var(--terminal-rule); }
.btn.primary-btn { border-color: var(--rule-bright); }
.btn:focus-visible:not(:disabled) { border-color: var(--focus); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.form-input-wrapper { border-radius: 4px; border-color: var(--rule-strong); background: var(--terminal-control); }
.form-input-wrapper:hover { border-color: var(--rule-bright); }
.form-input-wrapper:focus-within { border-color: var(--positive); }
input::placeholder, textarea::placeholder { color: var(--text-muted); opacity: 1; }
:is(input:not([type="checkbox"]):not([type="radio"]), select, textarea):focus-visible { border-color: var(--positive); }
input[type="range"] { accent-color: var(--positive); }

/* Mint is the single filled call to action. */
#connect-wallet-btn { background: var(--positive); border-color: var(--positive); color: var(--on-positive); font-weight: 600; }
#connect-wallet-btn:hover:not(:disabled) { background: var(--positive-soft); border-color: var(--positive-soft); color: var(--on-positive); }
#connect-wallet-btn .connect-wallet-btn__logo-wrap { display: none; }
#connect-wallet-btn[data-connected="true"], #connect-wallet-btn.is-connected { background: transparent; border-color: var(--rule-strong); color: var(--text); }
.btn.wallet-connect-action:hover:not(:disabled), .aera-review-actions .primary-btn:hover,
.ad-root .ad-primary:hover:not(:disabled), .pf-workspace .pf-primary:hover:not(:disabled),
.moc-page .moc-primary:hover:not(:disabled), .trading-dialog .primary-btn:hover:not(:disabled) {
  background: var(--positive-soft); border-color: var(--positive-soft); color: var(--on-positive);
}

/* ---------- Context bar ---------- */
.aera-sticky-header { background: var(--ground-fill); }
.site-header { background: var(--ground-fill); border-bottom: 1px solid var(--terminal-rule); }
.logo-img { height: 26px; width: auto; }
.env-tag {
  border: 1px solid rgb(245 176 86 / .45); border-radius: 3px; background: rgb(245 176 86 / .06);
  color: var(--network-label); font-family: var(--fontfam-term); font-size: .6875rem; font-weight: 500; letter-spacing: 0;
}
.landing-launch { display: none !important; }

/* ---------- Panes ---------- */
.panel { border-radius: 0; }
.main-layout:not(.main-layout--page) {
  grid-template-columns: 320px minmax(0, 1fr) 360px;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 1px; padding: 0; min-height: calc(100dvh - var(--aera-sticky-height, 56px) - var(--status-h));
  background: var(--terminal-rule); align-items: stretch;
}
@media (min-width: 1400px) {
  .main-layout:not(.main-layout--page):has(.has-note-apr) { grid-template-columns: 420px minmax(0, 1fr) 380px; }
}
.main-layout:not(.main-layout--page) > * { background: var(--ground-fill); }
.main-layout:not(.main-layout--page) > .market-stack { grid-column: 1; grid-row: 2; max-width: none; }
.main-layout:not(.main-layout--page) > .orders-panel { grid-column: 2; grid-row: 2; padding: 20px 24px; }
.main-layout:not(.main-layout--page) > .trade-panel { grid-column: 3; grid-row: 2; background: var(--ground-fill); }
.main-layout:not(.main-layout--page) .orderbook-panel { padding: 16px 16px 24px; background: transparent; }
.main-layout:not(.main-layout--page) .order-form { padding: 20px; border-radius: 0; background: transparent; }
.main-layout:not(.main-layout--page) .trade-panel > * + * { border-top: 1px solid var(--terminal-rule); }
@media (max-width: 1320px) {
  .main-layout:not(.main-layout--page) { grid-template-columns: 340px minmax(0, 1fr); grid-template-rows: auto auto auto; }
  .main-layout:not(.main-layout--page) > .market-stack { grid-column: 1; grid-row: 2; }
  .main-layout:not(.main-layout--page) > .trade-panel { grid-column: 2; grid-row: 2; }
  .main-layout:not(.main-layout--page) > .orders-panel { grid-column: 1 / -1; grid-row: 3; }
}

/* The market header is a board row: one huge figure, then its context. */
.trading-top { grid-column: 1 / -1; grid-row: 1; min-width: 0; background: var(--ground-fill); }
.main-layout--page .trading-top { display: none; }
.trading-market-bar { grid-column: 1 / -1; grid-row: 1; gap: 20px 28px; padding: 12px 24px 26px; border-bottom: 0; background: var(--ground-fill); }
/* Name and address share one line so the bar stays a single compact row. */
.trading-market-bar .market-panel-heading { display: flex; flex-wrap: wrap; align-items: baseline; column-gap: 14px; row-gap: 0; }
.trading-market-bar .panel-subtitle { min-height: 0; margin: 0; }
/* Desktop: the status line sits beside Daily stats instead of below the bar, so the bar is one 8px-padded row. */
@media (min-width: 1280px) {
  .trading-market-bar { padding: 8px 24px; }
  .trading-market-bar .market-statistics-footer { display: flex; align-items: center; gap: 14px; }
  .trading-market-bar .market-header-status { position: static; white-space: nowrap; }
}
.trading-tape { border-top: 1px solid var(--terminal-rule); border-bottom: 0; height: 40px; }
.trading-tape .lb-tick[aria-current="page"] { color: var(--text); }
.trading-tape .lb-tick[aria-current="page"] .lb-tick-pair { color: var(--positive); }
.trading-market-bar h1, .trading-market-bar #market-title { font-family: var(--font-display); font-stretch: 100%; font-weight: 650; font-size: 1.375rem; letter-spacing: -.01em; }
.trading-market-bar .market-stats { gap: 28px; margin-left: 8px; align-items: flex-start; }
.trading-market-bar .market-stat:first-child .market-stat-value {
  font-family: var(--font-display); font-stretch: 72%; font-weight: 600; font-size: 2.75rem; line-height: .95; letter-spacing: -.01em;
}
.trading-market-bar .market-stat-label { color: var(--text-muted); }
@media (max-width: 768px) {
  .trading-market-bar { padding: 16px; }
  .trading-market-bar .market-stat:first-child .market-stat-value { font-size: 2.25rem; }
}

/* Workspace pages sit in the same hairline frame. */
.main-layout.main-layout--page { gap: 1px; padding: 0; background: var(--terminal-rule); min-height: calc(100dvh - var(--aera-sticky-height, 56px) - var(--status-h)); align-items: stretch; }
.main-layout.main-layout--page > * { background: var(--ground-fill); }
.main-layout.main-layout--page.main-layout--no-rail { background: var(--ground-fill); }
.page-shell h1, .sn-page-title { font-family: var(--font-display); font-stretch: 100%; font-weight: 650; letter-spacing: -.015em; }
.ad-workspace-heading h1, .moc-page h1, .pf-workspace h1 { font-size: clamp(1.75rem, 2.4vw, 2.5rem); line-height: 1.05; }

/* Local tabs: underline marker, no fills. */
.aera-page-nav-link { position: relative; color: var(--text-soft); border-radius: 4px; text-decoration: none; }
.aera-page-nav-link:is(:hover, :focus-visible) { background: var(--terminal-control); color: var(--text); }
.aera-page-nav-link:is([aria-pressed="true"], [aria-current="page"]) { background: transparent; color: var(--text); }
.aera-page-nav-link:is([aria-pressed="true"], [aria-current="page"]):hover { background: var(--terminal-control); }
.aera-page-nav-link:is([aria-pressed="true"], [aria-current="page"])::before { background: var(--positive); }
.aera-page-nav-link:is([aria-pressed="true"], [aria-current="page"]) svg { color: var(--positive); }
/* The underline stays out of flow in every state so a tab keeps its width when it becomes current. */
.aera-page-nav-link::after, .aera-page-nav-link:is([aria-pressed="true"], [aria-current="page"])::after {
  visibility: hidden; position: absolute; left: 12px; right: 12px; bottom: 0; top: auto;
  width: auto; height: 2px; margin: 0; border: 0; transform: none; background: transparent;
}
.aera-page-nav-link:is([aria-pressed="true"], [aria-current="page"])::after { visibility: visible; background: var(--positive); }
.aera-page-nav-link:focus-visible { outline: 2px solid var(--focus); outline-offset: -2px; }

/* Governance keeps its full-width prominence in the shell palette. */
.aera-governance-notice {
  --governance-attention: #0b1712; --governance-ink: var(--text); --governance-rule: rgb(var(--positive-rgb) / .22);
  background: var(--governance-attention); color: var(--text); border-bottom-color: var(--governance-rule);
}
.aera-governance-icon { color: var(--positive); }
#aera-governance-open { min-height: 34px; border-radius: 4px; background: var(--positive); border-color: var(--positive); color: var(--on-positive); font-weight: 600; }
#aera-governance-open:is(:hover, :focus-visible):not(:disabled) { background: var(--positive-soft); border-color: var(--positive-soft); color: var(--on-positive); }
#aera-governance-open:focus-visible { outline-color: var(--focus); }
#aera-governance-dismiss { border-radius: 4px; color: var(--text-soft); }
#aera-governance-dismiss:hover { background: var(--terminal-control); color: var(--text); }
.aera-grant-notice { background: var(--ground-fill); }

/* Dialogs. */
.modal, .market-overlay-content { border: 1px solid var(--rule-strong); border-radius: 6px; box-shadow: 0 24px 64px rgb(0 0 0 / .6); }
.modal-backdrop, .wallet-overlay-backdrop, .market-overlay-backdrop { background: rgb(2 4 3 / .82); }


/* ---------- Landing shell ---------- */
body.is-home { padding-left: 0; padding-bottom: 0; }
body.is-home .aera-sticky-header { margin-left: 0; }
body.is-home .landing-launch { display: inline-flex !important; }
body.is-home :is(.header-menu, #header-menu-toggle, #connect-wallet-btn, #gateway-status, .aera-statusbar) { display: none !important; }
body.is-home :is(#aera-governance-notice, #aera-grant-notice, #mobile-trading-nav) { display: none !important; }
body.is-home .activity-console:not(:has(#activity-transactions:not([hidden]))):not([data-level="warn"]):not([data-level="error"]) { display: none; }
body.is-home:has(.activity-console:is([data-level="warn"], [data-level="error"])),
body.is-home:has(#activity-transactions:not([hidden])) { padding-bottom: var(--activity-clearance, 80px); }
.landing-launch {
  align-items: center; gap: 8px; min-height: 40px; padding: 8px 14px 8px 16px;
  background: var(--positive); border: 1px solid var(--positive); border-radius: 4px; color: var(--on-positive);
  font-size: .875rem; font-weight: 600; text-decoration: none;
}
.landing-launch:hover { background: var(--positive-soft) !important; border-color: var(--positive-soft) !important; color: var(--on-positive) !important; text-decoration: none; }
.landing-launch:focus-visible { outline: 2px solid var(--focus); outline-offset: 3px; }
#connect-wallet-btn.is-connected:hover:not(:disabled) { background: var(--terminal-raised); border-color: var(--rule-bright); color: var(--text); }

/* ---------- Board figures across the workspaces ---------- */
/* Key amounts use the landing board's condensed display numerals. */
.sn-value-number, .ad-stake-summary dd, .ad-dao-overview .ad-dao-ledger > div:first-child dd, .pf-amount,
.sn-oracle-quote > strong, .moc-oracle strong {
  font-family: var(--font-display); font-stretch: 72%; font-weight: 600; font-feature-settings: "tnum" 1, "lnum" 1; letter-spacing: -.005em;
}
.sn-value-number { font-size: 2.5rem; line-height: 1.05; }
.ad-root .ad-stake-summary dd, .ad-root .ad-stake-summary .ad-stake-owned dd { font-size: 2.75rem; line-height: 1.05; }
.ad-stake-summary dd > span, .sn-value-unit { font-family: var(--fontfam-term); font-stretch: 100%; font-weight: 400; font-size: .8125rem; letter-spacing: 0; }
.ad-dao-overview .ad-dao-ledger > div:first-child dd { font-size: 2.5rem; line-height: 1; }
.pf-amount { font-size: 1.75rem; line-height: 1.1; }
/* Amount inputs type in the same mono voice as the Trading order amount field. */
.sn-amount-control input, .pf-action input[name=amount], .moc-amount input { min-height: 48px; font: 400 1rem/1.5 var(--fontfam-term); font-stretch: 100%; letter-spacing: 0; font-variant-numeric: tabular-nums slashed-zero; }
.sn-oracle-quote > strong, .moc-oracle strong { font-size: 1.75rem; line-height: 1.1; color: var(--positive); }
@media (max-width: 760px) {
  .sn-value-number, .ad-dao-overview .ad-dao-ledger > div:first-child dd { font-size: 2rem; }
  .ad-stake-summary dd { font-size: 2.25rem; }
}

/* Workspace pages fill the frame: no centred column, no floating cards. */
.moc-workspace, .ad-root > *, .pf-layout { max-width: none; }
.pf-layout { gap: 0; }
.pf-layout > :last-child { padding-left: 32px; border-left: 1px solid var(--terminal-rule); }
.main-layout--page :is(.ad-dao-overview .ad-dao-columns > section, .ad-holdings, .pf-holdings, .sn-balances-workspace, .moc-ticket, .sl-ticket, .sr-primary, .sr-analysis, .ad-staking-page .ad-staking-manage, .ad-proposals-page #ad-proposal-detail, .ad-admin-page .ad-guided-form, .moc-order-ticket, .sn-catalog) {
  border: 0; border-radius: 0; background: transparent; box-shadow: none; padding-inline: 0;
}
@media (max-width: 960px) { .pf-layout > :last-child { padding-left: 0; border-left: 0; } }
.trading-market-bar .market-stat:first-child { flex: 0 0 auto; min-width: max-content; max-width: none; }
.trading-market-bar .market-stat:first-child .market-stat-value { overflow: visible; text-overflow: clip; white-space: nowrap; max-width: none; }

/* Review fixes. */
@media (max-width: 1199px) {
  .trading-market-bar .market-stats { gap: 18px 20px; margin-left: 0; }
  .trading-market-bar .market-stat { min-width: 0; }
}
.main-layout:not(.main-layout--page) > .orders-panel { padding-inline: 20px; }
/* Disabled primaries read as unavailable, not as a faded call to action. */
:is(.ad-root .ad-primary, .pf-workspace .pf-primary, .trading-dialog .primary-btn, .aera-review-actions .primary-btn, .btn.wallet-connect-action, #submit-order-btn, #connect-wallet-btn):disabled {
  background: var(--terminal-control); border-color: var(--rule-strong); color: var(--text-muted); opacity: 1;
}
@media (min-width: 381px) and (max-width: 840px) {
  .site-header .logo-area { flex-direction: row; align-items: center; gap: 10px; }
  .aera-sticky-header .site-header { min-height: 60px; }
}
@media (max-width: 760px) {
  .aera-page-nav { padding-right: 36px; -webkit-mask: linear-gradient(to right, #000 calc(100% - 36px), transparent); mask: linear-gradient(to right, #000 calc(100% - 36px), transparent); }
}
@media (min-width: 769px) and (max-width: 1199px) {
  .trading-market-bar .market-stats { display: grid; grid-template-columns: max-content repeat(4, minmax(0, 1fr)); gap: 16px 20px; width: 100%; }
  .trading-market-bar .market-stat { width: auto; min-width: 0; }
}

/* Review round 2. */
/* Filled mint primaries always carry dark ink. */
:is(.ad-root .ad-primary, .pf-workspace .pf-primary, .moc-page .moc-primary, .trading-dialog .primary-btn, .aera-review-actions .primary-btn, .btn.wallet-connect-action):not(:disabled) { color: var(--on-positive); }
/* Side-by-side workspace columns are divided panes. */
@media (min-width: 1001px) {
  .moc-new-grid { gap: 0; grid-template-columns: minmax(0, 640px) minmax(280px, 1fr); }
  .moc-new-grid > :first-child { padding-right: 40px; }
  .moc-new-grid > :last-child { padding-left: 40px; border-left: 1px solid var(--terminal-rule); min-width: 0; }
}
.moc-new-grid .aera-balances, .moc-new-grid aside, .moc-new-grid > :last-child > * { max-width: none; width: 100%; }
@media (min-width: 901px) {
  .ad-dao-overview .ad-dao-columns { column-gap: 0; }
  .ad-dao-overview .ad-dao-columns > section:nth-child(odd) { padding-right: 32px; }
  .ad-dao-overview .ad-dao-columns > section:nth-child(even) { padding-left: 32px; border-left: 1px solid var(--terminal-rule); }
}
@media (min-width: 1024px) {
  .sn-account-layout { column-gap: 0; }
  .sn-account-layout > :first-child { padding-right: 32px; }
  .sn-account-layout > :last-child { padding-left: 32px; border-left: 1px solid var(--terminal-rule); }
}
.pf-layout > :first-child { padding-right: 32px; }
@media (max-width: 960px) { .pf-layout > :first-child { padding-right: 0; } }
@media (max-width: 760px) {
  .aera-page-nav { padding-right: 0; -webkit-mask: linear-gradient(to right, #000 calc(100% - 20px), rgb(0 0 0 / .35)); mask: linear-gradient(to right, #000 calc(100% - 20px), rgb(0 0 0 / .35)); }
}

/* ---------- Trading: price chart pane ---------- */
.main-layout:not(.main-layout--page) { grid-template-rows: auto auto minmax(0, 1fr); }
.main-layout:not(.main-layout--page) > .market-stack { grid-row: 2 / span 2; }
.main-layout:not(.main-layout--page) > .trade-panel { grid-row: 2 / span 2; }
.main-layout:not(.main-layout--page) > .trade-chart-panel { grid-column: 2; grid-row: 2; }
.main-layout:not(.main-layout--page) > .orders-panel { grid-column: 2; grid-row: 3; }
@media (min-width: 1101px) and (max-width: 1320px) {
  .main-layout:not(.main-layout--page) { grid-template-columns: 290px minmax(0, 1fr) 330px; grid-template-rows: auto auto minmax(0, 1fr); }
  .main-layout:not(.main-layout--page) > .market-stack { grid-column: 1; grid-row: 2 / span 2; }
  .main-layout:not(.main-layout--page) > .trade-panel { grid-column: 3; grid-row: 2 / span 2; }
  .main-layout:not(.main-layout--page) > .trade-chart-panel { grid-column: 2; grid-row: 2; }
  .main-layout:not(.main-layout--page) > .orders-panel { grid-column: 2; grid-row: 3; }
}
@media (max-width: 1100px) {
  .main-layout:not(.main-layout--page) { grid-template-columns: 320px minmax(0, 1fr); grid-template-rows: auto auto auto auto; }
  .main-layout:not(.main-layout--page) > :is(.market-stack, .trade-panel) { grid-row: 2; }
  .main-layout:not(.main-layout--page) > .trade-chart-panel { grid-column: 1 / -1; grid-row: 3; }
  .main-layout:not(.main-layout--page) > .orders-panel { grid-column: 1 / -1; grid-row: 4; }
}
.trade-chart-panel { padding: 16px 20px 12px; background: var(--ground-fill); min-width: 0; }
.trade-chart-panel[hidden] { display: none; }

/* Order side reads at a glance: the MoC toggle, a recessed track with a mint or pink wash on the chosen side. */
.main-layout:not(.main-layout--page) #side-toggle { background: var(--terminal-inset); border: 0; border-radius: 4px; padding: 4px; gap: 4px; }
.main-layout:not(.main-layout--page) #side-toggle .toggle-btn { min-height: 40px; border: 1px solid transparent; border-radius: 3px; font-weight: 500; letter-spacing: .01em; color: var(--text-muted); transition: color 150ms ease-out, background-color 150ms ease-out, border-color 150ms ease-out; }
.main-layout:not(.main-layout--page) #side-toggle .toggle-btn:not(.active):hover { background: transparent; color: var(--text); }
.main-layout:not(.main-layout--page) #side-toggle .buy.active { background: rgb(var(--positive-rgb) / .12); border-color: rgb(var(--positive-rgb) / .5); color: var(--focus); }
.main-layout:not(.main-layout--page) #side-toggle .sell.active { background: rgb(var(--danger-soft-rgb) / .09); border-color: #934653; color: var(--danger-soft); }
.main-layout:not(.main-layout--page) #side-toggle .toggle-btn:focus-visible { outline: 2px solid var(--focus); outline-offset: -2px; }

/* Mid-width desktops keep the market name and statistics on one row. */
@media (min-width: 1000px) and (max-width: 1199px) {
  .trading-market-bar { display: flex; flex-wrap: nowrap; align-items: center; }
  .trading-market-bar .market-stats { display: grid; grid-template-columns: repeat(5, max-content); gap: 12px 22px; width: auto; margin-left: auto; }
  .trading-market-bar .market-stat:first-child .market-stat-value { font-size: 2.25rem; }
}
.trading-book-tabs :is(button, a) { white-space: nowrap; }
@media (min-width: 1000px) and (max-width: 1199px) {
  .trading-market-bar .market-header-actions { order: 2; }
}

/* ---------- Trading: open orders and recent fills ---------- */
.main-layout:not(.main-layout--page) .orders-panel { display: grid; gap: 0; align-content: start; }
.main-layout:not(.main-layout--page) :is(.orders-main, .fills-panel) { padding: 0; }
.main-layout:not(.main-layout--page) .fills-panel { margin-top: 28px; padding-top: 20px; border-top: 1px solid var(--terminal-rule); }
.main-layout:not(.main-layout--page) :is(.orders-main-header, .fills-card-header) { align-items: center; margin-bottom: 12px; }
:is(.orders-main-header, .fills-card-header) > div:first-child { display: flex; align-items: center; gap: 8px; }
.pane-count {
  display: inline-flex; align-items: center; justify-content: center; min-width: 22px; height: 20px; padding: 0 6px;
  border-radius: 3px; background: var(--terminal-raised); color: var(--text); font: 500 .6875rem/1 var(--fontfam-term);
}
.pane-count[hidden] { display: none; }

/* Table chrome: quiet sticky header, ruled rows, hover lift. */
.main-layout:not(.main-layout--page) .orders-table { border-collapse: separate; border-spacing: 0; }
.main-layout:not(.main-layout--page) .orders-table thead th {
  position: sticky; top: 0; z-index: 1; padding-block: 0 10px; background: var(--ground-fill);
  border-bottom: 1px solid var(--rule-strong); color: var(--text-muted); font-weight: 500; text-align: left;
}
.main-layout:not(.main-layout--page) .orders-table .table-sort-btn { color: inherit; font: inherit; }
.main-layout:not(.main-layout--page) .orders-table .table-sort-btn:hover { color: var(--text); }
.main-layout:not(.main-layout--page) .orders-table th[aria-sort] .table-sort-btn { color: var(--text-soft); }
.main-layout:not(.main-layout--page) .orders-table tbody td { height: 52px; padding-block: 8px; border-bottom: 1px solid var(--terminal-rule); vertical-align: middle; }
.main-layout:not(.main-layout--page) .orders-table tbody tr:is(.orders-row, .fill-row) { transition: background-color 140ms ease-out; }
.main-layout:not(.main-layout--page) .orders-table tbody tr:is(.orders-row, .fill-row):hover > td { background: var(--terminal-control); }
.main-layout:not(.main-layout--page) .orders-table :is(.orders-price, .fill-price, .orders-qty, .orders-filled, .fill-amount, .orders-id) { font-family: var(--fontfam-term); font-variant-numeric: tabular-nums; }
.main-layout:not(.main-layout--page) .orders-table :is(.orders-price, .fill-price) { color: var(--text); font-weight: 500; }
.main-layout:not(.main-layout--page) .orders-table .orders-id { color: var(--text-muted); }
.main-layout:not(.main-layout--page) .orders-table .orders-total { color: var(--text-muted); }

/* Side marker: a coloured dot and label, mint to buy and coral to sell. */
.main-layout:not(.main-layout--page) .orders-table td.orders-side { font: 600 .6875rem/1 var(--fontfam-term); letter-spacing: .02em; white-space: nowrap; }
.main-layout:not(.main-layout--page) .orders-table td.orders-side.buy { color: var(--positive); }
.main-layout:not(.main-layout--page) .orders-table td.orders-side.sell { color: var(--danger-soft); }

/* Fill progress sits under each open order's remaining/total. */
.orders-progress { display: block; width: 100%; max-width: 160px; height: 3px; margin-top: 7px; border-radius: 2px; background: var(--rule-strong); overflow: hidden; }
.orders-progress i { display: block; width: 100%; height: 100%; background: var(--positive); border-radius: inherit; transform-origin: left center; transition: transform 320ms cubic-bezier(.2, .8, .2, 1); }
.orders-row:has(.orders-side.sell) .orders-progress i { background: var(--danger-soft); }

/* Status: a state dot with its label. */
.main-layout:not(.main-layout--page) .orders-table td.orders-status { font: 500 .6875rem/1.3 var(--fontfam-term); color: var(--text-soft); white-space: nowrap; }
@keyframes orders-pulse { 50% { opacity: .35; } }
@media (prefers-reduced-motion: reduce) { .main-layout:not(.main-layout--page) .orders-table td.orders-status::before { animation: none; } }

/* Empty panes: a centred, quiet message with the wallet action when disconnected. */
.main-layout:not(.main-layout--page) .orders-table td.orders-empty { height: auto; padding: 36px 0 28px; border-bottom: 0; text-align: center; color: var(--text-muted); font-size: .8125rem; }
.main-layout:not(.main-layout--page) .orders-table td.orders-empty::before {
  content: ''; display: block; width: 22px; height: 22px; margin: 0 auto 12px; background: var(--rule-bright);
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='4' y='4' width='16' height='16' rx='2'/%3E%3Cpath d='M4 9h16M9 9v11'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='4' y='4' width='16' height='16' rx='2'/%3E%3Cpath d='M4 9h16M9 9v11'/%3E%3C/svg%3E") center / contain no-repeat;
}
.orders-connect { display: none; flex-direction: column; align-items: center; gap: 10px; padding: 0 0 16px; color: var(--text-muted); font-size: .75rem; }
body:not(:has(#connect-wallet-btn.is-connected)) .orders-main:has(#orders-table.is-empty) .orders-connect { display: flex; }
.orders-connect-btn { min-height: 36px; padding-inline: 16px; border-color: rgb(var(--positive-rgb) / .55); color: var(--text); }
.orders-connect-btn:hover:not(:disabled) { background: rgb(var(--positive-rgb) / .1); border-color: var(--positive); }
.trading-market-bar #market-stats { column-gap: 28px; row-gap: 12px; }
@media (min-width: 1000px) and (max-width: 1199px) { .trading-market-bar #market-stats { column-gap: 20px; } }
.main-layout:not(.main-layout--page) .orders-panel > *, .main-layout:not(.main-layout--page) .orders-panel :is(.orders-main, .fills-card) { min-width: 0; }
.main-layout:not(.main-layout--page) > :is(.orders-panel, .trade-chart-panel, .market-stack, .trade-panel) { min-width: 0; }
.main-layout:not(.main-layout--page) .orders-table td.orders-side { text-align: left; }

/* Table-layout markers; the mobile cards use ::before for their field labels. */
@media (min-width: 761px) {
  .main-layout:not(.main-layout--page) .orders-table td.orders-status::before { content: ''; display: inline-block; width: 6px; height: 6px; margin-right: 7px; border-radius: 50%; background: var(--positive); vertical-align: 1px; }
  .main-layout:not(.main-layout--page) .orders-table td.orders-status:is(.pending, .orders-status--canceling, .orders-status--replacing)::before { background: var(--network-label); animation: orders-pulse 1.6s ease-in-out infinite; }
}
@media (max-width: 760px) {
  .trading-market-bar #market-stats { row-gap: 2px; column-gap: 16px; }
  .trading-market-bar .market-stat:first-child .market-stat-value { font-size: 2rem; }
}

/* "Last" matches the other market statistics, set in bold. */
.trading-market-bar #market-stats .market-stat:first-child .market-stat-value {
  font-family: var(--fontfam-term); font-stretch: 100%; font-size: 1rem; font-weight: 700; line-height: 1.5; letter-spacing: 0; color: var(--text);
}

/* ---------- Order book: live depth ---------- */
@property --depth-width { syntax: '<percentage>'; inherits: false; initial-value: 0%; }
.main-layout:not(.main-layout--page) .orderbook-table :is(.bid-row, .ask-row) {
  /* Depth bars glide to their new size; a brighter leading edge marks the bar end. */
  --book-edge: rgb(var(--positive-rgb) / .55);
  background-image: linear-gradient(to left, var(--book-depth-color) var(--depth-width, 0%), var(--book-edge) var(--depth-width, 0%), var(--book-edge) calc(var(--depth-width, 0%) + 1px), transparent calc(var(--depth-width, 0%) + 1px));
  transition: --depth-width 200ms cubic-bezier(.2, .8, .2, 1), background-color 120ms ease-out;
}
.main-layout:not(.main-layout--page) .orderbook-table .ask-row { --book-edge: rgb(var(--danger-soft-rgb) / .55); }
.main-layout:not(.main-layout--page) .orderbook-table :is(.bid-row, .ask-row).book-empty-band { --book-edge: transparent; }
.main-layout:not(.main-layout--page) .orderbook-table :is(.bid-row, .ask-row):hover { background-color: var(--terminal-control); }
.main-layout:not(.main-layout--page) .orderbook-table :is(.bid-row, .ask-row) td { height: 30px; font-variant-numeric: tabular-nums slashed-zero; }
.main-layout:not(.main-layout--page) .orderbook-table .trading-price { font-weight: 500; }
.main-layout:not(.main-layout--page) .orderbook-table .ob-amount-cell { color: var(--text); }
/* A changed level flashes in its side's colour and fades in under half a second. */
.main-layout:not(.main-layout--page) .orderbook-table .bid-row.book-flash { animation: book-flash-bid 420ms ease-out; }
.main-layout:not(.main-layout--page) .orderbook-table .ask-row.book-flash { animation: book-flash-ask 420ms ease-out; }
@keyframes book-flash-bid { from { background-color: rgb(var(--positive-rgb) / .28); } to { background-color: transparent; } }
@keyframes book-flash-ask { from { background-color: rgb(var(--danger-soft-rgb) / .28); } to { background-color: transparent; } }
/* The mid row reads as the spread between the two sides. */
.main-layout:not(.main-layout--page) .orderbook-table .mid-row td { height: 44px; background: var(--terminal-control); }
.main-layout:not(.main-layout--page) .orderbook-table .mid-price-cell { font-size: 1.0625rem; font-weight: 600; }
.main-layout:not(.main-layout--page) .orderbook-table .mid-spread-cell { color: var(--text-muted); font: 400 .6875rem/1.3 var(--fontfam-term); text-align: center; white-space: nowrap; }
@media (prefers-reduced-motion: reduce) {
  .main-layout:not(.main-layout--page) .orderbook-table :is(.bid-row, .ask-row) { transition: none; }
  .main-layout:not(.main-layout--page) .orderbook-table .book-flash { animation: none; }
}

/* ---------- Order book: the wallet's own orders ---------- */
/* A level holding one of the wallet's orders carries a brighter band over the depth bar
   sized to the wallet's share; that band is the only marker (the former dot and rail were
   removed at the owner's request, 2026-09-26). A pending placement shows a hatched band
   until the order feed reports it. Orders beyond the visible levels are counted in a small
   tag on the outermost row, as the chart pins them to its edge. */
.main-layout:not(.main-layout--page) .orderbook-table :is(.book-own, .book-own-beyond) { --own-color: var(--positive); --own-rgb: var(--positive-rgb); --own-band: .3; }
.main-layout:not(.main-layout--page) .orderbook-table .ask-row:is(.book-own, .book-own-beyond) { --own-color: var(--danger-soft); --own-rgb: var(--danger-soft-rgb); }
.main-layout:not(.main-layout--page) .orderbook-table :is(.bid-row, .ask-row).book-own {
  background-image:
    linear-gradient(to left, rgb(var(--own-rgb) / var(--own-band)) var(--own-width, 0%), transparent var(--own-width, 0%)),
    linear-gradient(to left, var(--book-depth-color) var(--depth-width, 0%), var(--book-edge) var(--depth-width, 0%), var(--book-edge) calc(var(--depth-width, 0%) + 1px), transparent calc(var(--depth-width, 0%) + 1px));
}
.main-layout:not(.main-layout--page) .orderbook-table :is(.bid-row, .ask-row).book-own--pending {
  background-image:
    repeating-linear-gradient(-45deg, rgb(var(--own-rgb) / var(--own-band)) 0 3px, transparent 3px 6px),
    linear-gradient(to left, var(--book-depth-color) var(--depth-width, 0%), var(--book-edge) var(--depth-width, 0%), var(--book-edge) calc(var(--depth-width, 0%) + 1px), transparent calc(var(--depth-width, 0%) + 1px));
  background-size: max(var(--own-width, 0%), 12px) 100%, 100% 100%; background-position: right, right; background-repeat: no-repeat;
}
/* The tag shares the price cell, so that row's price button gives up its reserved width. */
.main-layout:not(.main-layout--page) .orderbook-table .book-own-beyond .trading-price { min-width: 0; }
.book-beyond {
  display: inline-block; margin-left: 6px; padding: 1px 4px; border: 1px solid rgb(var(--own-rgb) / .45); border-radius: 3px; vertical-align: 1px;
  font: 500 .625rem/1.2 var(--fontfam-term); letter-spacing: 0; color: var(--own-color); opacity: .8; white-space: nowrap;
  transition: background-color 140ms ease-out, opacity 140ms ease-out;
}
/* Hovering or focusing an order in Open orders lights its level and quiets the others. */
.main-layout:not(.main-layout--page) .orderbook-table :is(.bid-row, .ask-row).book-own-focus,
.main-layout:not(.main-layout--page) .orderbook-table :is(.bid-row, .ask-row).book-own-focus:hover { --own-band: .5; background-color: rgb(var(--own-rgb) / .16); }
.main-layout:not(.main-layout--page) .orderbook-table .book-own-focus .trading-price { color: var(--text); font-weight: 600; }
.main-layout:not(.main-layout--page) .orderbook-table .book-own-beyond-focus .book-beyond { background: rgb(var(--own-rgb) / .2); border-color: var(--own-color); opacity: 1; }
.main-layout:not(.main-layout--page) .orderbook-table.has-own-focus .book-own:not(.book-own-focus) { --own-band: .16; }
.main-layout:not(.main-layout--page) .orderbook-table.has-own-focus .book-own-beyond:not(.book-own-beyond-focus) .book-beyond { opacity: .35; }
/* The reverse link: an Open orders row whose level is hovered in the book. */
.main-layout:not(.main-layout--page) .orders-row.orders-row--linked { --order-row-fill: color-mix(in srgb, var(--control-foreground) 6%, var(--terminal-panel)); }
@media (prefers-reduced-motion: reduce) {
  .book-beyond { transition: none; }
}

/* ---------- Orders and fills: finish ---------- */
/* Side reads as the shared tinted chip (board.css). */

@media (min-width: 761px) {
  /* Amounts and prices align on their decimal side. */
  .main-layout:not(.main-layout--page) .orders-table :is(td.orders-price, td.orders-qty, td.orders-filled, td.fill-price, td.fill-apr, td.fill-amount),
  .main-layout:not(.main-layout--page) .orders-table th:has([data-sort-key="price"], [data-sort-key="remaining"], [data-sort-key="filled"], [data-sort-key="amount"], [data-sort-key="apr"]) { text-align: right; }
  .main-layout:not(.main-layout--page) .orders-table th:has([data-sort-key="price"], [data-sort-key="remaining"], [data-sort-key="filled"], [data-sort-key="amount"], [data-sort-key="apr"]) .table-sort-btn { justify-content: flex-end; margin-left: auto; }
  .main-layout:not(.main-layout--page) .orders-table td.orders-qty .orders-progress { margin-left: auto; }
  .main-layout:not(.main-layout--page) .orders-table :is(td.orders-price, td.fill-price) { padding-right: 20px; }
  /* Row actions stay available but quiet until the row is in use. */
  .main-layout:not(.main-layout--page) .orders-table tr:is(.orders-row, .fill-row) .orders-row-actions { opacity: .55; transition: opacity 140ms ease-out; }
  .main-layout:not(.main-layout--page) .orders-table tr:is(.orders-row, .fill-row):is(:hover, :focus-within) .orders-row-actions { opacity: 1; }
}
@media (pointer: coarse) { .main-layout:not(.main-layout--page) .orders-table .orders-row-actions { opacity: 1 !important; } }
.main-layout:not(.main-layout--page) .orders-table tr.orders-row:hover > td:first-child,
.main-layout:not(.main-layout--page) .orders-table tr.fill-row:hover > td:first-child { box-shadow: inset 2px 0 0 var(--rule-bright); }
.main-layout:not(.main-layout--page) .orders-table .orders-filled { color: var(--text-soft); }

/* A new row slides in; an updated row flashes its side's colour. Both finish in about half a second. */
.main-layout:not(.main-layout--page) .orders-table tr.row-enter > td { animation: row-enter 520ms cubic-bezier(.2, .8, .2, 1); }
.main-layout:not(.main-layout--page) .orders-table tr.row-flash > td { animation: row-flash 520ms ease-out; }
.main-layout:not(.main-layout--page) .orders-table tr.row-flash:has(.sell) > td, .main-layout:not(.main-layout--page) .orders-table tr.row-enter:has(.sell) > td { --row-flash: rgb(var(--danger-soft-rgb) / .2); }
/* Flashes are an inset overlay, so the pinned action cell keeps its opaque ground. */
@keyframes row-enter { from { opacity: 0; transform: translateY(-6px); box-shadow: inset 0 0 0 999px var(--row-flash, rgb(var(--positive-rgb) / .2)); } 40% { opacity: 1; transform: none; } to { box-shadow: inset 0 0 0 999px transparent; } }
@keyframes row-flash { from { box-shadow: inset 0 0 0 999px var(--row-flash, rgb(var(--positive-rgb) / .2)); } to { box-shadow: inset 0 0 0 999px transparent; } }
@media (prefers-reduced-motion: reduce) {
  .main-layout:not(.main-layout--page) .orders-table tr:is(.row-enter, .row-flash) > td { animation: none; }
  .orders-progress i { transition: none; }
}

/* A removed order or fill fades and slides out from where it was. */
.main-layout:not(.main-layout--page) .orders-table-wrap { position: relative; }
.main-layout:not(.main-layout--page) .orders-table.row-ghost {
  position: absolute; z-index: 2; min-width: 0; table-layout: fixed; pointer-events: none;
  animation: row-leave 240ms cubic-bezier(.4, 0, .6, 1) forwards;
}
.main-layout:not(.main-layout--page) .orders-table.row-ghost td { background: var(--ground-fill); box-shadow: inset 0 0 0 999px rgb(var(--danger-soft-rgb) / .08); }
@keyframes row-leave { from { opacity: 1; transform: none; } to { opacity: 0; transform: translateX(18px); } }

/* Pending placements share the open-order row; their status tracks the placement. */
.main-layout:not(.main-layout--page) .orders-table td.orders-id--pending { white-space: nowrap; }
.main-layout:not(.main-layout--page) .orders-table td.orders-id--pending .orders-id-value { margin-right: 6px; }
.main-layout:not(.main-layout--page) .orders-table td.orders-id--pending .pending-order-link { display: inline-flex; vertical-align: middle; color: var(--text-muted); }
.main-layout:not(.main-layout--page) .orders-table td.orders-id--pending .pending-order-link:hover { color: var(--text); }
.main-layout:not(.main-layout--page) .orders-table td.orders-status.orders-status--syncing { color: var(--text); }
@media (min-width: 761px) {
  .main-layout:not(.main-layout--page) .orders-table td.orders-status.orders-status--syncing::before { background: var(--positive); }
  .main-layout:not(.main-layout--page) .orders-table td.orders-status.orders-status--unresolved::before { background: var(--network-label); animation: none; }
}

/* Text columns read from the left; numeric columns stay right-aligned. */
@media (min-width: 761px) {
  .main-layout:not(.main-layout--page) .orders-table :is(td.orders-updated, td.orders-id, td.orders-side, td.orders-status, td.fill-time, td.fill-side-cell),
  .main-layout:not(.main-layout--page) .orders-table th:has([data-sort-key="updated"], [data-sort-key="order"], [data-sort-key="side"], [data-sort-key="status"], [data-sort-key="time"]) { text-align: left; }
  .main-layout:not(.main-layout--page) .orders-table th:has([data-sort-key="updated"], [data-sort-key="order"], [data-sort-key="side"], [data-sort-key="status"], [data-sort-key="time"]) .table-sort-btn { justify-content: flex-start; margin-left: 0; }
  .main-layout:not(.main-layout--page) .orders-table td.orders-status { padding-left: 24px; }
  .main-layout:not(.main-layout--page) .orders-table th:has([data-sort-key="status"]) { padding-left: 24px; }
}
@media (min-width: 761px) {
  .main-layout:not(.main-layout--page) .orders-table th:has([data-sort-key="updated"], [data-sort-key="order"], [data-sort-key="side"], [data-sort-key="status"], [data-sort-key="time"]) .table-sort-btn { padding-left: 0; }
  .main-layout:not(.main-layout--page) .orders-table th:has([data-sort-key="price"]) { padding-right: 20px; }
  .main-layout:not(.main-layout--page) .orders-table th:has([data-sort-key="price"], [data-sort-key="remaining"], [data-sort-key="filled"], [data-sort-key="amount"], [data-sort-key="apr"]) .table-sort-btn { padding-right: 0; }
}
@media (min-width: 761px) {
  /* Left-aligned headers keep their sort marker after the label so the text lines up with the column. */
  .main-layout:not(.main-layout--page) .orders-table th:has([data-sort-key="updated"], [data-sort-key="order"], [data-sort-key="side"], [data-sort-key="status"], [data-sort-key="time"]) .table-sort-btn { flex-direction: row; }
}
