/*
 * FlapPapertrade — paper, ink, and readable account records.
 * Layout only: availability, amounts, and semantic status remain app-owned.
 * Loaded after style.css; existing selectors and the V2 brand artwork are kept.
 */

/* Shared surfaces, text, and control states */
:root {
  --muted: #74674f;
  --dim: #7b6e56;
  --ui-radius: 6px;
  --ui-gutter: clamp(12px, 1.5vw, 24px);
}

html { scroll-padding-block: 20px; }
.operations-page, .projects-page { min-width: 0; }
.projects-page [data-profile-manager] { min-width: 0; }
.leaderboard-panel { padding: clamp(14px, 2.3vw, 28px); min-width: 0; }
.leaderboard-top { display: flex; gap: 16px; justify-content: space-between; align-items: center; flex-wrap: wrap; }
.leaderboard-top p { margin-top: 8px; overflow-wrap: anywhere; }
.rank-list { display: grid; gap: 12px; margin: 20px 0; min-width: 0; }
.rank-record { display: grid; grid-template-columns: 45px minmax(0, 1.1fr) minmax(0, 1fr) minmax(0, 1fr); gap: 14px; align-items: start; padding: 18px; background: var(--raised, #f6f0e0); border: 1px solid var(--line, #d8cfba); min-width: 0; }
.rank-record > * { min-width: 0; }
.rank-record strong, .rank-record small, .rank-account span { display: block; }
.rank-record strong { font-size: 14px; overflow-wrap: anywhere; }
.rank-record small { font-size: 11px; color: var(--muted); margin-bottom: 5px; }
.rank-place { font: 25px Georgia, serif; color: var(--accent); }
.rank-account span { font-size: 10px; margin-top: 5px; overflow-wrap: anywhere; }
.rank-result span { font-size: 10px; }
.rank-raw { font-family: ui-monospace, monospace; }
.rank-record details { grid-column: 2 / -1; font-size: 12px; min-width: 0; }
.rank-record pre { white-space: pre-wrap; overflow-wrap: anywhere; max-height: 280px; overflow-y: auto; font-size: 11px; padding: 12px; background: var(--surface, #fff9ec); }
.rank-coverage, .rank-personal { display: flex; gap: 10px 18px; flex-wrap: wrap; border: 1px solid var(--line); padding: 14px; font-size: 12px; margin: 14px 0; min-width: 0; }
.rank-coverage code, .rank-personal span { overflow-wrap: anywhere; max-width: 100%; }
.rank-coverage.is-stale { color: var(--muted); border-style: dashed; }
@media (max-width: 600px) {
  .rank-record { grid-template-columns: 35px minmax(0, 1fr); padding: 13px; gap: 12px; }
  .rank-record > :nth-child(3), .rank-record > :nth-child(4), .rank-record details { grid-column: 2; }
  .leaderboard-top > button { width: 100%; }
}
body { -webkit-text-size-adjust: 100%; }
main { padding: 12px var(--ui-gutter) 0; }
button, input, select, textarea { -webkit-tap-highlight-color: transparent; }
button, input, select, textarea, summary { scroll-margin-block: 16px; }
button:disabled, input:disabled, select:disabled, textarea:disabled {
  cursor: not-allowed;
}
button:disabled, .primary:disabled, select:disabled {
  opacity: 1;
  color: var(--muted);
  box-shadow: none;
}
.primary:disabled {
  background: var(--raised);
  border-color: var(--line);
}
[hidden] { display: none !important; }
:where(button, a, input, select, textarea, summary, [tabindex]):focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}
.primary, .subtle, .quiet, .account-button { min-height: 40px; }
.text-button { display: inline-flex; align-items: center; min-height: 32px; }
input:not([type="range"]):not([type="checkbox"]), select {
  min-height: 40px;
  border-radius: 4px;
}
input[type="range"] { min-height: 32px; }
.checkbox-row { min-height: 40px; gap: 9px; }
.checkbox-row input { width: 18px; height: 18px; flex-shrink: 0; }
.small-copy, .support-copy, .info-box { overflow-wrap: anywhere; }
.skip-link:focus { border-radius: 3px; }

/* Navigation remains available at every width */
.topbar {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 20px;
  min-height: 68px;
  padding: 0 var(--ui-gutter);
  background: var(--surface);
}
.brand {
  min-height: 44px;
  font-size: clamp(19px, 1.55vw, 23px);
  letter-spacing: -.8px;
  justify-self: start;
}
.brand-mark { flex-shrink: 0; width: 29px; height: 29px; }
#navigation {
  min-width: 0;
  width: auto;
  height: auto;
  justify-content: center;
  gap: 2px;
  overflow-x: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--line) transparent;
}
.nav-item {
  flex-shrink: 0;
  min-height: 44px;
  padding-inline: 11px;
  font-size: 12px;
}
.nav-item.active { font-weight: 600; }
.nav-item.active:after { bottom: 0; left: 11px; right: 11px; }
.nav-item:focus-visible { outline-offset: -3px; }
.topbar-actions { min-width: 0; gap: 10px; }
.header-action { min-height: 44px; min-width: 44px; padding: 8px 4px; }
.account-button {
  background: var(--bg);
  border-color: var(--line);
  padding-inline: 12px;
}
.modebar {
  min-height: 54px;
  gap: 10px 18px;
  flex-wrap: wrap;
  padding: 8px var(--ui-gutter);
}
.mode-switch button { min-height: 34px; }
.mode-description { min-width: 0; line-height: 1.65; overflow-wrap: anywhere; }
.profile-control { min-width: 0; max-width: 340px; }
.profile-control > span { flex-shrink: 0; }
.profile-control select {
  flex: 1;
  min-width: 0;
  min-height: 34px;
  max-width: 300px;
}
.notice, .receipt-pending {
  gap: 8px 16px;
  padding: 9px var(--ui-gutter);
  line-height: 1.7;
}
.notice > span, .receipt-pending > span { min-width: 0; overflow-wrap: anywhere; }

/* V2 home: artwork stays in place, content determines the height */
main:has(.landing-v2) { padding: 0; }
.landing-v2 { min-height: 0; }
.landing-v2 .ticker-tape { padding-block: 12px; }
.landing-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(220px, .46fr);
  gap: 40px;
  align-items: center;
  min-height: 0;
  padding: clamp(52px, 6.5vw, 94px) clamp(28px, 6vw, 96px);
}
.landing-v2 .landing-copy {
  min-width: 0;
  width: auto;
  max-width: 680px;
  padding: 0;
}
.landing-v2 .landing-wordmark {
  font-size: clamp(38px, 4.6vw, 68px);
  letter-spacing: -1.5px;
  line-height: 1.1;
  white-space: nowrap;
  margin-bottom: 24px;
}
.landing-v2 .landing-lines {
  max-width: 560px;
  margin-inline: 0;
  font-size: clamp(15px, 1.35vw, 18px);
}
.landing-v2 .landing-actions { flex-wrap: wrap; }
.landing-v2 .landing-actions button { min-height: 46px; letter-spacing: .4px; }
.landing-status { margin-top: 24px; line-height: 1.8; }
.landing-status .live-dot { margin-top: 7px; }
.landing-v2 .landing-caption { font-size: 11px; margin-bottom: 0; }
.hero-ledger {
  position: relative;
  inset: auto;
  width: 100%;
  max-width: 310px;
  justify-self: end;
  align-self: end;
  margin: 0;
}
.hero-ledger > div { padding: 11px 6px; line-height: 1.6; }
.hero-ledger strong { min-width: 0; overflow-wrap: anywhere; }
.landing-v2 .landing-bottom { padding-inline: clamp(28px, 6vw, 96px); }
.landing-v2 .landing-bottom > div { padding-block: 24px; }
.landing-bottom p { line-height: 1.8; }

/* Trading terminal: natural form height, quieter chart frame */
.terminal, body[data-execution="production"] .terminal {
  display: grid;
  grid-template-columns: minmax(0, 1fr) clamp(304px, 25vw, 360px);
  gap: 10px;
  height: auto;
  min-height: 0;
  max-height: none;
  align-items: stretch;
}
.terminal > .chart-panel, .terminal > .order-panel { height: auto; }
.chart-panel, .order-panel, .positions-panel, .panel {
  border-color: var(--line);
  border-radius: var(--ui-radius);
  background: var(--surface);
}
.chart-panel { min-height: 540px; }
.market-head {
  gap: 10px 16px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line-soft);
}
.market-picker { min-width: 0; max-width: 100%; min-height: 42px; gap: 9px; }
.pair-select { min-height: 28px; height: 28px; }
.market-price { font-size: 19px; letter-spacing: -.6px; }
.market-stats { flex-wrap: wrap; gap: 5px 0; }
.market-stat > span { letter-spacing: .2px; }
.market-stat > b { font-variant-numeric: tabular-nums; }
.chart-controls { gap: 4px; }
.interval { min-height: 34px; min-width: 36px; }
.chart-wrap { min-height: 300px; }
.chart-empty .ghost-brand { max-width: 100%; font-size: clamp(26px, 4vw, 62px); }
.chart-empty p { line-height: 1.85; }
.chart-foot { min-height: 44px; padding: 6px 14px; gap: 6px 12px; }
.chart-style-button, .price-btn { min-height: 32px; }
.chart-error-strip { overflow-wrap: anywhere; }
.order-panel { padding: 16px; }
.account-equity {
  padding: 10px 12px;
  border: 1px solid var(--line-soft);
  background: var(--bg);
  margin-bottom: 12px;
}
.equity-title { align-items: center; gap: 8px; padding-bottom: 8px; margin-bottom: 5px; }
.equity-title > span { min-width: 0; }
.equity-title small { font-size: 10px; color: var(--muted); }
.equity-title strong { font-size: 17px; letter-spacing: -.5px; overflow-wrap: anywhere; }
.account-equity .meta-row { padding-block: 1px; }
.side-switch { margin-bottom: 8px; }
.side-switch button { min-height: 40px; }
.field-head { gap: 8px; margin-block: 8px 5px; line-height: 1.65; }
.field-head > span { min-width: 0; }
.amount-controls { gap: 6px; }
.amount-controls > button, .leverage-field .mini { min-height: 40px; min-width: 40px; }
.leverage-field .mini { display: inline-flex; align-items: center; justify-content: center; }
.amount-field input, .leverage-field input, .stop-fields input { height: 40px; }
.amount-controls > .amount-field { min-width: 0; }
.order-summary { min-width: 0; }
.order-meta { padding-top: 8px; border-top: 1px solid var(--line-soft); margin-top: 12px; }
.meta-row { gap: 10px; padding-block: 3px; }
.meta-row > span, .meta-row strong { min-width: 0; overflow-wrap: anywhere; }
.order-panel > .primary { min-height: 44px; margin-top: 12px; }
.order-disclaimer { margin-top: 8px; line-height: 1.8; }
.balance-source { margin-top: 12px; padding-top: 8px; border-top: 1px solid var(--line-soft); }
.order-panel-bottom { flex-wrap: wrap; gap: 6px 12px; line-height: 1.7; }

/* Positions, queues, and scrollable account tables */
.positions-panel { margin-top: 12px; min-height: 0; }
.panel-tabs { padding-inline: 12px; gap: 6px; min-height: 48px; }
.panel-tabs > button { min-height: 48px; padding: 12px 10px; flex-shrink: 0; }
.panel-tabs > button.active { font-weight: 600; }
.panel-tabs > button:focus-visible { outline-offset: -4px; }
.right-note { letter-spacing: .2px; }
.empty-state { min-height: 184px; padding: 28px 22px; gap: 9px; }
.empty-state > span { color: var(--text); font-size: 14px; }
.empty-state p { font-size: 12px; line-height: 1.85; }
.table-scroll {
  min-width: 0;
  max-width: 100%;
  overflow: auto;
  overscroll-behavior-x: contain;
  scrollbar-width: thin;
  scrollbar-color: var(--accent) var(--raised);
  padding-bottom: 3px;
}
.table-scroll table { min-width: 640px; font-variant-numeric: tabular-nums; }
.table-scroll table:has([data-position-id]) { min-width: 980px; }
th {
  padding: 13px 18px;
  background: var(--bg);
  border-bottom-color: var(--line);
  font-size: 11px;
  font-weight: 500;
}
td { padding: 15px 18px; line-height: 1.65; vertical-align: middle; }
td small { font-size: 11px; line-height: 1.65; }
td .row-actions { gap: 6px; }
.table-scroll th:first-child, .table-scroll td:first-child {
  position: sticky;
  left: 0;
  z-index: 1;
  border-right: 1px solid var(--line-soft);
  background: var(--surface);
}
.table-scroll th:first-child { background: var(--bg); z-index: 2; }
@media (hover: hover) {
  tbody tr:hover > td { background: var(--bg); }
}

/* Portfolio, rewards, reserve accounting, and journal pages */
.page-content { max-width: 1360px; padding: 32px 20px 48px; }
.page-heading { gap: 16px 24px; margin-bottom: 26px; }
.page-heading h1 { font-size: clamp(24px, 2.4vw, 32px); line-height: 1.3; }
.page-heading h1 small { max-width: 680px; line-height: 1.8; font-size: 12px; }
.eyebrow { font-size: 10px; letter-spacing: 1.6px; margin-bottom: 10px; }
.heading-aside { flex-wrap: wrap; justify-content: flex-end; min-width: 0; }
.heading-aside .status-line { display: inline-flex; align-items: center; }
.tag { line-height: 1.6; white-space: normal; }
.overview-strip {
  border: 1px solid var(--line);
  border-radius: var(--ui-radius);
  background: var(--surface);
  margin-bottom: 22px;
}
.overview-stat, .overview-stat:first-child { min-width: 0; padding: 20px; }
.stat-value { font-size: clamp(23px, 2.2vw, 30px); overflow-wrap: anywhere; }
.stat-sub { line-height: 1.8; }
.wide-grid { grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); gap: 20px; }
.wide-grid > *, .accounting-grid > *, .doc-grid > *, .legend-grid > * { min-width: 0; }
.pad { padding: 24px; }
.section-heading { margin-bottom: 20px; }
.section-heading h2 { font-size: 16px; line-height: 1.5; }
.section-heading p { font-size: 12px; line-height: 1.8; }
.ledger-row { align-items: flex-start; gap: 16px; padding-block: 12px; line-height: 1.8; }
.ledger-row > span, .ledger-row > strong { min-width: 0; overflow-wrap: anywhere; }
.ledger-row > span { flex: 1; }
.ledger-row > strong { max-width: 65%; font-variant-numeric: tabular-nums; }
.ledger-row.total { margin-top: 8px; font-weight: 600; }
.evidence-chip { flex-wrap: wrap; line-height: 1.8; font-size: 11px; }
.pool-hero { font-size: clamp(30px, 3vw, 42px); overflow-wrap: anywhere; }
.legend-value { overflow-wrap: anywhere; }
.legend-note, .legend-name { line-height: 1.8; }
.reward-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); background: var(--surface); }
.reward-card { min-width: 0; padding: 26px; }
.reward-card h2 { font-weight: 500; line-height: 1.7; }
.reward-card .big { font-size: 30px; overflow-wrap: anywhere; }
.reward-card p { font-size: 12px; line-height: 1.9; }
.reward-icon { display: block; }
.reward-card .button-pair { flex-wrap: wrap; }
.button-pair > * { min-width: 0; }
.accounting-grid, .doc-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 32px; }
.status-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 28px; }
.observer-notice {
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: var(--ui-radius);
  background: var(--surface);
  gap: 16px;
}
.observer-notice > div { min-width: 0; flex: 1; }
.observer-notice strong { line-height: 1.8; }
.observer-notice p { font-size: 12px; line-height: 1.85; margin-block: 7px 0; }
.observer-notice .subtle { flex-shrink: 0; }
.event-row { gap: 12px 18px; padding: 18px 22px; align-items: flex-start; }
.event-icon { padding-top: 3px; }
.event-main strong { font-size: 12px; line-height: 1.8; overflow-wrap: anywhere; }
.event-main small { font-size: 11px; line-height: 1.8; overflow-wrap: anywhere; }
.event-time { flex-shrink: 0; line-height: 1.8; }
.event-row:last-child { border-bottom: 0; }
.source-line { flex-wrap: wrap; line-height: 1.8; }
.source-line > span { min-width: 0; overflow-wrap: anywhere; }

/* Snapshot history hooks: neutral presentation, no logic or status assumptions */
.history-panel, .session-journal { min-width: 0; }
.history-panel {
  border: 1px solid var(--line);
  border-radius: var(--ui-radius);
  background: var(--surface);
}
.history-toolbar, .history-pagination {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 16px;
  padding: 14px 18px;
}
.history-toolbar { border-bottom: 1px solid var(--line-soft); }
.history-toolbar > .subtle { margin-left: auto; }
.history-pagination { border-top: 1px solid var(--line-soft); justify-content: flex-end; }
.history-toolbar > *, .history-pagination > * { min-width: 0; }
.history-toolbar button, .history-pagination button { min-height: 40px; }
.history-pagination > span { font-size: 12px; line-height: 1.8; color: var(--muted); }
.history-filter {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 7px 10px;
  min-width: 0;
  max-width: 100%;
  font-size: 12px;
}
.history-filter select, .history-filter input { width: auto; min-width: 0; max-width: 100%; }
.history-filter > button {
  padding: 8px 12px;
  border: 1px solid transparent;
  border-radius: 4px;
  color: var(--muted);
}
.history-filter > button.active, .history-filter > button[aria-pressed="true"] {
  color: var(--text);
  background: var(--bg);
  border-color: var(--line);
  font-weight: 600;
}
select.history-filter, input.history-filter { width: auto; min-width: 120px; }
.coverage-note, .history-status {
  padding: 12px 18px;
  font-size: 12px;
  line-height: 1.85;
  overflow-wrap: anywhere;
}
.coverage-note { border-left: 2px solid var(--line); background: var(--bg); color: var(--muted); }
.history-status { color: var(--muted); }
.session-journal { margin-top: 22px; }
details.session-journal {
  border: 1px solid var(--line);
  border-radius: var(--ui-radius);
  background: var(--surface);
}
.session-journal > h2, .session-journal > h3 { font-size: 15px; font-weight: 500; }
.history-panel details, .session-journal details, .event-row details,
.table-scroll details, .dialog-body details {
  min-width: 0;
  max-width: 100%;
  margin-block: 8px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--bg);
  white-space: normal;
}
details summary {
  min-height: 40px;
  padding: 10px 12px;
  cursor: pointer;
  color: var(--accent);
  line-height: 1.7;
  overflow-wrap: anywhere;
}
details[open] > summary { border-bottom: 1px solid var(--line-soft); }
details > p.small-copy { margin: 0; padding: 0 14px 14px; }
.history-panel pre, .session-journal pre, .event-row pre,
.table-scroll pre, .dialog-body pre {
  max-width: 100%;
  max-height: 360px;
  overflow: auto;
  overscroll-behavior: contain;
  margin: 0;
  padding: 14px;
  font: 11px/1.8 var(--mono);
  color: var(--text);
  background: var(--bg);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  tab-size: 2;
}
.table-scroll details { min-width: 180px; max-width: 420px; }

/* Dialogs and secondary content */
dialog { border-radius: 8px; max-height: calc(100dvh - 32px); }
.dialog-head { padding: 16px 20px; }
.dialog-close { min-width: 44px; min-height: 44px; }
.dialog-body { padding: 22px; overflow-wrap: anywhere; }
.dialog-body .meta-row strong { overflow-wrap: anywhere; }
.address-row { gap: 10px; }
.address-row button { min-height: 40px; min-width: 44px; }
#toast { max-width: calc(100vw - 32px); overflow-wrap: anywhere; }
footer {
  padding: 16px var(--ui-gutter);
  margin-top: 16px;
  flex-wrap: wrap;
  font-size: 11px;
  line-height: 1.8;
}
footer > span { min-width: 0; overflow-wrap: anywhere; }
body:has(.landing-v2) footer { margin-top: 0; }

/* Tablet: give navigation its own row before it can collide with actions */
@media (min-width: 901px) {
  main:has(.landing-v2) { display: flex; flex-direction: column; }
  .landing-v2, .landing-v2 .landing-hero { flex: 1; }
}

@media (max-width: 1180px) {
  .topbar { grid-template-columns: minmax(0, 1fr) auto; gap: 4px 16px; padding-top: 8px; }
  #navigation {
    grid-column: 1 / -1;
    grid-row: 2;
    order: initial;
    width: 100%;
    height: 46px;
    margin: 0;
    justify-content: flex-start;
  }
  .nav-item:first-child { padding-left: 11px; }
  .nav-item:first-child:after { left: 11px; }
  .mode-description { flex: 1 1 220px; }
  .market-stats { order: 3; width: 100%; }
  .chart-controls { margin-left: auto; }
}

@media (max-width: 900px) {
  .landing-hero { grid-template-columns: minmax(0, 1fr); padding: 44px 6vw 30px; gap: 28px; }
  .landing-v2 .landing-copy { width: 100%; padding: 0; }
  .landing-v2 .landing-wordmark { font-size: clamp(26px, 7.8vw, 52px); letter-spacing: -1px; }
  .hero-ledger { max-width: none; width: 100%; inset: auto; }
  .hero-ledger > div { grid-template-columns: 100px minmax(0, 1fr); }
  .landing-v2 .landing-bottom { padding-inline: 6vw; }
  .wide-grid { gap: 16px; }
  .reward-card { padding: 20px; }
  .overview-stat, .overview-stat:first-child { padding: 17px; }
  .pad { padding: 20px; }
}

@media (max-width: 800px) {
  .terminal, body[data-execution="production"] .terminal { grid-template-columns: minmax(0, 1fr); }
  .terminal > .chart-panel { height: 420px; min-height: 0; }
  .chart-wrap { min-height: 180px; }
  .order-panel { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 22px; }
  .order-panel > * { grid-column: 1 / -1; min-width: 0; }
  .order-controls { grid-column: 1; }
  .order-summary { grid-column: 2; align-self: start; }
  .account-equity { display: block; }
  .order-summary .order-meta { margin-top: 12px; }
  .wide-grid, .accounting-grid, .doc-grid { grid-template-columns: minmax(0, 1fr); gap: 20px; }
  .overview-strip { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .overview-stat:nth-child(2) { border-right: 0; }
  .overview-stat:nth-child(n+3) { border-top: 1px solid var(--line-soft); }
  .reward-grid { grid-template-columns: minmax(0, 1fr); }
  .reward-card, .reward-card:last-child { border-right: 0; border-bottom: 1px solid var(--line); }
  .reward-card:last-child { border-bottom: 0; }
  .reward-icon { display: block; margin-bottom: 12px; }
  .reward-card h2 { margin-top: 0; }
  .reward-card .big { font-size: 28px; }
  .observer-notice { flex-wrap: wrap; }
  .observer-notice .subtle { margin-left: 46px; }
}

/* Phones: readable controls and content flow without artificial empty space */
@media (max-width: 640px) {
  main { padding-top: 10px; }
  .primary, .subtle, .quiet, .text-button, .account-button,
  .amount-controls > button, .leverage-field .mini, .side-switch button,
  .interval, .chart-style-button, .price-btn, .history-toolbar button,
  .history-pagination button, .address-row button, details summary {
    min-height: 44px;
    min-width: 44px;
  }
  input:not([type="range"]):not([type="checkbox"]), select,
  .dialog-body input, .dialog-body select {
    min-height: 44px;
    font-size: 16px;
  }
  input[type="range"], .checkbox-row { min-height: 44px; }
  .mode-switch button { min-height: 44px; }
  .profile-control { flex: 1 1 220px; width: 100%; max-width: none; margin-left: 0; order: 2; }
  .profile-control select { max-width: none; width: 100%; min-height: 44px; font-size: 13px; }
  .mode-description { order: 3; width: 100%; flex-basis: 100%; font-size: 11px; }
  .modebar { gap: 6px 12px; }
  .notice, .receipt-pending { flex-wrap: wrap; font-size: 12px; }
  .notice .text-button { font-size: 12px; }
  .landing-hero { padding: 32px 22px 24px; gap: 24px; }
  .landing-v2 .landing-copy .eyebrow { font-size: 9px; letter-spacing: .8px; margin-bottom: 18px; }
  .landing-v2 .landing-wordmark { margin-bottom: 18px; }
  .landing-v2 .landing-lines { font-size: 14px; line-height: 1.9; margin-bottom: 22px; }
  .landing-v2 .landing-actions { gap: 8px; }
  .landing-v2 .landing-actions button { font-size: 11px; padding: 10px 7px; }
  .landing-status { font-size: 11px; margin-top: 20px; }
  .landing-v2 .landing-caption { font-size: 11px; line-height: 1.8; }
  .hero-ledger > div { font-size: 10px; padding: 9px 4px; grid-template-columns: 86px minmax(0, 1fr); }
  .landing-v2 .landing-bottom { padding: 0 22px; }
  .landing-v2 .landing-bottom > div { padding: 18px 0; }
  .terminal > .chart-panel { height: 410px; }
  .market-head { padding: 12px; gap: 8px; }
  .market-picker { gap: 7px; padding: 4px 8px; }
  .pair-select { font-size: 14px; min-height: 44px; width: 61px; }
  .market-price { font-size: 16px; }
  .market-change { font-size: 10px; }
  .market-stats { gap: 6px 0; }
  .market-stat { padding-inline: 8px; }
  .market-stat > b { font-size: 11px; }
  .chart-foot { padding: 5px 12px; }
  .chart-foot > span { font-size: 10px; }
  .chart-error-strip { right: 12px; left: 12px; }
  .order-panel { padding: 16px; gap: 0 16px; }
  .order-summary .meta-row, .account-equity .meta-row, .field-head { font-size: 12px; }
  .amount-controls { flex-wrap: wrap; }
  .amount-controls > .amount-field { flex-basis: 100%; order: -1; }
  .amount-controls > button { flex: 1; }
  .amount-field input { height: 44px; }
  .balance-source { font-size: 11px; }
  .order-disclaimer { font-size: 12px; }
  .order-panel-bottom { font-size: 11px; }
  .page-content { padding: 22px 2px 30px; }
  .page-heading { flex-wrap: wrap; margin-bottom: 20px; }
  .heading-aside { justify-content: flex-start; }
  .page-heading h1 small { font-size: 12px; }
  .panel-tabs { padding-inline: 8px; }
  .panel-tabs > button { font-size: 12px; }
  .right-note { font-size: 10px; }
  .empty-state { min-height: 184px; padding: 26px 18px; }
  th, td { padding: 12px 14px; }
  .table-scroll .quiet { padding-inline: 10px; }
  .overview-stat, .overview-stat:first-child { padding: 16px 12px; }
  .stat-label, .stat-sub { font-size: 11px; }
  .stat-value { font-size: 23px; }
  .pad, .reward-card { padding: 18px; }
  .ledger-row, .ledger-row strong { font-size: 12px; }
  .legend-grid { gap: 10px; }
  .legend-value { font-size: 23px; }
  .status-grid { grid-template-columns: minmax(0, 1fr); padding: 12px 16px; }
  .status-grid .ledger-row, .status-grid .ledger-row strong { font-size: 12px; }
  .observer-notice { padding: 16px; gap: 12px; }
  .observer-notice strong, .observer-notice p { font-size: 12px; }
  .observer-notice .subtle { margin-left: 0; width: 100%; }
  .event-row { padding: 16px; gap: 8px 12px; flex-wrap: wrap; }
  .event-main { flex-basis: calc(100% - 86px); }
  .event-time { font-size: 11px; }
  .event-row .text-button { font-size: 12px; }
  .history-toolbar, .history-pagination { gap: 8px 12px; padding: 12px; }
  .history-toolbar .history-filter { flex: 1 1 100%; }
  .history-toolbar > .subtle { margin-left: 0; width: 100%; }
  .history-filter select, .history-filter input { flex: 1; width: 100%; }
  .history-pagination { justify-content: flex-start; }
  .history-pagination > span { flex-basis: 100%; }
  .coverage-note, .history-status { padding: 12px; }
  .history-panel .event-row, .session-journal .event-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
  }
  .history-panel .event-row > .text-button, .session-journal .event-row > .text-button {
    justify-self: start;
  }
  .dialog-body { padding: 18px; }
  .dialog-head { padding: 12px 14px; }
  .form-grid { grid-template-columns: minmax(0, 1fr); }
  footer { font-size: 10px; gap: 6px; }
  #footer-status { font-size: 10px; text-align: left; }
}

@media (max-width: 560px) {
  .topbar { grid-template-columns: minmax(0, 1fr); gap: 3px; }
  .brand { font-size: 22px; }
  .brand-mark { width: 28px; height: 28px; }
  .topbar-actions {
    grid-row: 2;
    width: 100%;
    margin: 0;
    gap: 12px;
  }
  .header-action { font-size: 12px; }
  .header-action span { display: inline; font-size: 10px; }
  .account-button { margin-left: auto; font-size: 12px; max-width: 175px; }
  #navigation { grid-row: 3; justify-content: flex-start; height: 48px; }
  .nav-item, .nav-item:first-child { font-size: 11px; padding-inline: 8px; }
  .mode-switch { width: max-content; }
}

@media (max-width: 480px) {
  .order-panel { display: flex; flex-direction: column; }
  .account-equity { display: block; }
  .order-controls, .order-summary { width: 100%; }
  .order-summary .order-meta { margin-top: 16px; }
  .market-picker { flex-wrap: wrap; }
  .chart-controls { margin-left: 0; }
  .terminal > .chart-panel { height: 430px; }
}

@media (max-width: 360px) {
  .nav-item, .nav-item:first-child { padding-inline: 4px; }
  .topbar-actions { gap: 8px; }
  .header-action span { display: none; }
  .landing-v2 .landing-actions { grid-template-columns: minmax(0, 1fr); }
  .market-stat { padding-inline: 6px; }
  .landing-v2 .landing-wordmark { font-size: 26px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; }
}

/* v0.6: independently funded epochs, confirmed credits and effective stake time. */
.economics-inventory .overview-strip, .economics-account .overview-strip,
.stake-maturity .overview-strip { margin: 18px 0; border-block: 1px solid var(--line); }
.economics-account .stat-value { font-size: clamp(17px, 1.7vw, 25px); }
.stake-maturity .stat-value { font-size: clamp(15px, 1.35vw, 21px); line-height: 1.65; }
.economics-inventory .stat-value { font-size: clamp(21px, 2vw, 30px); }
.economics-inventory .overview-stat, .stake-maturity .overview-stat,
.economics-account .overview-stat { min-width: 0; overflow-wrap: anywhere; }
.epoch-coverage {
  padding: 12px 14px;
  border-left: 3px solid var(--accent);
  background: var(--raised);
  color: var(--muted);
  font-size: 12px;
  line-height: 1.8;
}
.epoch-coverage p { margin: 6px 0; }
.epoch-lookup {
  display: grid;
  grid-template-columns: auto minmax(80px, 180px) auto;
  justify-content: start;
  align-items: center;
  gap: 12px;
  margin: 20px 0;
}
.epoch-lookup label { margin: 0; font-size: 12px; }
.epoch-lookup input { min-width: 0; width: 100%; }
.epoch-list { display: grid; gap: 16px; }
.epoch-card {
  min-width: 0;
  padding: clamp(14px, 2vw, 22px);
  border: 1px solid var(--line);
  border-radius: var(--ui-radius);
  background: var(--bg);
}
.epoch-card .section-heading { gap: 14px; align-items: start; flex-wrap: wrap; }
.epoch-card h3 { margin: 0; font-size: 17px; }
.epoch-card .section-heading p { font-size: 11px; margin-top: 6px; line-height: 1.8; }
.epoch-card .tag { white-space: normal; }
.epoch-values {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 20px;
  margin-block: 20px;
}
.epoch-values > div { min-width: 0; display: grid; align-content: start; gap: 7px; }
.epoch-values span, .epoch-values small { font-size: 11px; line-height: 1.7; color: var(--muted); }
.epoch-values strong { font-family: Consolas, monospace; font-size: 17px; overflow-wrap: anywhere; }
.epoch-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.epoch-actions button { min-height: 40px; font-size: 12px; }
.epoch-actions button:disabled { background: transparent; border-style: dashed; }
.epoch-lookup-result { padding: 14px; border: 1px solid var(--accent); margin-bottom: 20px; border-radius: 6px; }
.epoch-lookup-result > .eyebrow { margin-bottom: 12px; }
.epoch-checkpoint { display: flex; gap: 14px; justify-content: space-between; align-items: center; margin-top: 18px; }
.epoch-checkpoint button { flex-shrink: 0; }
.economics-raw { margin-top: 14px; min-width: 0; }
.economics-raw summary { cursor: pointer; font-size: 12px; color: var(--muted); min-height: 32px; }
.economics-raw pre { white-space: pre-wrap; overflow-wrap: anywhere; font-size: 11px; line-height: 1.7; max-height: 320px; overflow: auto; }
.stake-lots { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 12px; }
.stake-lot { padding: 14px; border: 1px solid var(--line); border-radius: 4px; min-width: 0; font-size: 12px; line-height: 1.8; }
.stake-lot > div { display: flex; justify-content: space-between; gap: 8px; }
.stake-lot p { color: var(--muted); margin: 8px 0; }
.dialog-body .economics-account .overview-strip { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.dialog-body .economics-account { padding: 14px; }
.epoch-lab { border-top: 1px solid var(--line); }

/* v0.7: the index is a separate, read-only paper ledger. */
.index-entry {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  border-block: 1px solid var(--line); padding: 18px 0; margin-block: 24px;
}
.index-entry > span { font-size: 12px; letter-spacing: .08em; }
.index-entry small { display: block; color: var(--muted); letter-spacing: 0; margin-top: 6px; }
.index-journal {
  padding: clamp(16px, 3vw, 34px); overflow: hidden;
  background: linear-gradient(125deg, rgba(255,255,255,.28), transparent 65%), var(--surface);
  border-top: 3px solid var(--text, #302b20);
}
.index-heading { display: flex; justify-content: space-between; align-items: start; gap: 20px; }
.index-heading > div { min-width: 0; }
.index-heading h2 { font-size: clamp(23px, 2.5vw, 32px); margin: 14px 0 20px; letter-spacing: -.04em; }
.index-heading h2 span { display: block; font-size: 12px; font-weight: 400; color: var(--muted); margin-top: 10px; letter-spacing: 0; }
.index-stamp {
  display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid currentColor; box-shadow: inset 0 0 0 3px var(--surface);
  padding: 9px 13px; color: #3d603e; background: #e3e7cc;
  font-size: 12px; font-weight: 700; white-space: nowrap; border-radius: 2px;
}
.index-warning { color: #854223; background: #eee0c5; }
.index-context { display: flex; justify-content: space-between; gap: 12px; font: 11px/1.8 Consolas, monospace; color: var(--muted); padding-bottom: 14px; }
.index-context > span { min-width: 0; overflow-wrap: anywhere; }
.index-metrics { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); margin: 0; border-block: 1px solid var(--line); }
.index-metrics > div { padding: 20px 16px; min-width: 0; border-right: 1px solid var(--line); }
.index-metrics > div:first-child { padding-left: 0; }
.index-metrics > div:last-child { border-right: 0; }
.index-metrics dt { color: var(--muted); font-size: 12px; }
.index-metrics dd { margin: 12px 0 8px; font: 23px/1.3 Consolas, monospace; overflow-wrap: anywhere; }
.index-metrics small { display: block; font-size: 11px; color: var(--muted); line-height: 1.8; }
.index-coverage { display: flex; gap: 12px; margin: 17px 0 22px; align-items: stretch; }
.index-rule { display: block; width: 3px; flex-shrink: 0; background: var(--accent); }
.index-coverage p { margin: 0; color: var(--muted); font-size: 12px; line-height: 1.9; }
.index-alert { border: 1px dashed #aa7849; background: #eee0c5; color: #784426; padding: 12px 15px; font-size: 12px; line-height: 1.9; margin-block: 12px; overflow-wrap: anywhere; }
.index-account { display: flex; justify-content: space-between; gap: 18px; align-items: end; margin-top: 28px; margin-bottom: 16px; }
.index-account > div { min-width: 0; }
.index-account h3 { margin: 8px 0; font-size: 19px; }
.index-account code, .index-account > span { color: var(--muted); font-size: 11px; overflow-wrap: anywhere; }
.index-account > span { flex-shrink: 0; }
.index-anchor { padding: 12px 14px; background: var(--raised); font: 12px/1.8 Consolas, monospace; overflow-wrap: anywhere; }
.index-anchor code, .index-anchor span { display: block; font-size: 11px; color: var(--muted); }
.index-events { border-top: 1px solid var(--line); margin-top: 16px; }
.index-event { padding: 18px 0; border-bottom: 1px solid var(--line); min-width: 0; }
.index-event-top { display: flex; justify-content: space-between; gap: 12px; align-items: start; }
.index-event-top strong { font-size: 14px; overflow-wrap: anywhere; }
.index-scope { flex-shrink: 0; color: var(--muted); border: 1px solid var(--line); padding: 3px 6px; font: 10px/1.5 Consolas, monospace; }
.index-event-meta { display: flex; flex-wrap: wrap; gap: 6px 18px; margin-top: 10px; color: var(--muted); font: 11px/1.8 Consolas, monospace; }
.index-event > code { display: block; font: 11px/1.8 Consolas, monospace; overflow-wrap: anywhere; margin-top: 5px; }
.index-event details { margin-top: 10px; }
.index-journal summary { font-size: 12px; color: var(--muted); cursor: pointer; padding-block: 6px; min-height: 32px; line-height: 1.6; }
.index-journal pre { white-space: pre-wrap; overflow-wrap: anywhere; max-height: 340px; overflow: auto; font: 11px/1.8 Consolas, monospace; background: var(--raised); padding: 12px; border: 1px solid var(--line); }
.index-event details p { font-size: 11px; line-height: 1.8; color: var(--muted); }
.index-empty { text-align: center; display: grid; justify-items: center; gap: 12px; padding: 30px 12px; }
.index-empty svg { width: 30px; height: 30px; color: var(--muted); }
.index-empty strong { font-size: 14px; }
.index-empty p { margin: 0; max-width: 420px; font-size: 12px; color: var(--muted); line-height: 1.8; }
.index-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; margin-block: 20px; }
.index-actions small { margin-left: auto; font: 11px/1.8 Consolas, monospace; color: var(--muted); }
.index-snapshots { border-top: 1px dashed var(--line); padding-top: 12px; }
.index-footnote { font-size: 11px; line-height: 1.9; color: var(--muted); margin: 12px 0 0; }
@media (max-width: 800px) {
  .index-metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .index-metrics > div { padding: 16px 12px; }
  .index-metrics > div:nth-child(2) { border-right: 0; }
  .index-metrics > div:nth-child(3) { padding-left: 0; }
  .index-metrics > div:nth-child(n+3) { border-top: 1px solid var(--line); }
}
@media (max-width: 560px) {
  .index-heading, .index-account, .index-entry { flex-direction: column; align-items: start; gap: 12px; }
  .index-heading h2 { margin-block: 12px; }
  .index-stamp { margin-bottom: 16px; }
  .index-context { flex-direction: column; gap: 3px; }
  .index-metrics dd { font-size: 19px; }
  .index-event-top { flex-direction: column; gap: 8px; }
  .index-actions { display: grid; grid-template-columns: minmax(0, 1fr); }
  .index-actions > button { min-width: 0; white-space: normal; }
  .index-actions small { margin-left: 0; }
  .index-heading .eyebrow { font-size: 9px; letter-spacing: .06em; }
}
@media (max-width: 1000px) {
  .epoch-values { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .economics-inventory .overview-strip, .stake-maturity .overview-strip,
  .economics-account .overview-strip { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 560px) {
  .epoch-lookup { grid-template-columns: minmax(0, 1fr) auto; gap: 8px; }
  .epoch-lookup label { grid-column: 1 / -1; }
  .epoch-values { gap: 18px 12px; }
  .epoch-values strong { font-size: 14px; }
  .epoch-card .section-heading { display: grid; }
  .epoch-card .tag { justify-self: start; }
  .epoch-actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .epoch-actions button { min-width: 0; padding: 8px; white-space: normal; line-height: 1.6; }
  .epoch-checkpoint { display: block; }
  .epoch-checkpoint button { width: 100%; }
  .epoch-lookup-result { padding: 10px; }
  .stake-lots { grid-template-columns: minmax(0, 1fr); }
}
