:root {
  --canvas: #e9eef2;
  --paper: #fbfcfd;
  --ink: #101c25;
  --muted: #66747e;
  --line: #cdd6dc;
  --line-strong: #aab7c0;
  --btc: #a85f25;
  --btc-soft: #f3e5d8;
  --healthy: #176d66;
  --healthy-soft: #dceeea;
  --warning: #9a6816;
  --warning-soft: #f4ead1;
  --risk: #ae3e3e;
  --risk-soft: #f5dddd;
  --shadow: 0 18px 50px rgba(26, 47, 60, .08);
  --display: "Avenir Next Condensed", "DIN Condensed", "Arial Narrow", sans-serif;
  --body: "Avenir Next", "PingFang SC", "Microsoft YaHei", sans-serif;
  --data: "SFMono-Regular", "Roboto Mono", "Consolas", monospace;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-width: 320px;
  background: var(--canvas);
  color: var(--ink);
  font-family: var(--body);
  -webkit-font-smoothing: antialiased;
}

button, input, select { font: inherit; }
button { color: inherit; }

button:focus-visible, input:focus-visible, select:focus-visible {
  outline: 3px solid rgba(168, 95, 37, .24);
  outline-offset: 2px;
}

.shell {
  width: min(1440px, calc(100% - 32px));
  margin: 16px auto 48px;
}

.topbar {
  min-height: 72px;
  display: flex;
  align-items: center;
  gap: 24px;
  padding: 0 20px;
  border: 1px solid var(--line);
  background: rgba(251, 252, 253, .96);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 250px;
  color: inherit;
  text-decoration: none;
}

.brand-mark {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border: 1px solid var(--btc);
  color: var(--btc);
  font: 700 23px/1 var(--data);
}

.brand strong {
  display: block;
  font: 650 18px/1.1 var(--display);
  letter-spacing: .04em;
}

.brand small {
  display: block;
  margin-top: 5px;
  color: var(--muted);
  font: 600 10px/1 var(--data);
  letter-spacing: .11em;
}

.task-switcher {
  display: grid;
  grid-template-columns: auto minmax(190px, 320px);
  align-items: center;
  gap: 9px;
  min-width: 0;
}

.task-switcher > span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
}

.task-switcher select {
  width: 100%;
  min-height: 38px;
  border: 1px solid var(--line-strong);
  background: var(--paper);
  padding: 0 34px 0 11px;
  color: var(--ink);
  font: 650 12px/1.2 var(--data);
  text-overflow: ellipsis;
}

.task-switcher select:disabled { color: var(--muted); }

.system-state {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-left: auto;
  color: var(--muted);
  font-size: 13px;
}

.pulse {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--healthy);
  box-shadow: 0 0 0 4px var(--healthy-soft);
}

.system-state.warning .pulse { background: var(--warning); box-shadow: 0 0 0 4px var(--warning-soft); }
.system-state.action .pulse { background: var(--risk); box-shadow: 0 0 0 4px var(--risk-soft); }

.button {
  min-height: 40px;
  border: 1px solid var(--line-strong);
  background: var(--paper);
  padding: 0 16px;
  cursor: pointer;
  font-weight: 650;
  transition: border-color .16s ease, background .16s ease, transform .16s ease;
}

.button:hover { border-color: var(--ink); }
.button:active { transform: translateY(1px); }
.button.primary { border-color: var(--ink); background: var(--ink); color: white; }
.button.btc { border-color: var(--btc); background: var(--btc); color: white; }
.button.quiet { background: transparent; }
.button.danger { border-color: var(--risk); color: var(--risk); }
.button.small { min-height: 34px; padding: 0 12px; font-size: 13px; }
.button:disabled { opacity: .45; cursor: not-allowed; }

.view-tabs {
  display: flex;
  gap: 24px;
  padding: 0 8px;
  border-bottom: 1px solid var(--line-strong);
  overflow-x: auto;
}

.view-tab {
  border: 0;
  border-bottom: 3px solid transparent;
  background: transparent;
  padding: 16px 3px 12px;
  color: var(--muted);
  cursor: pointer;
  font-weight: 650;
}

.view-tab.active { border-color: var(--btc); color: var(--ink); }

#app { padding-top: 16px; }

.loading-state, .empty-state {
  min-height: 420px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  background: var(--paper);
  color: var(--muted);
}

.empty-inner { width: min(560px, calc(100% - 40px)); text-align: center; }
.empty-symbol { font: 500 72px/1 var(--display); color: var(--btc); }
.empty-inner h1 { margin: 16px 0 8px; font: 650 38px/1.05 var(--display); }
.empty-inner p { color: var(--muted); line-height: 1.7; }

.page-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 330px;
  gap: 16px;
}

.ledger-sheet, .action-column > section, .full-sheet {
  border: 1px solid var(--line);
  background: var(--paper);
}

.sheet-head {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  padding: 22px 24px;
  border-bottom: 1px solid var(--line);
}

.eyebrow {
  display: block;
  color: var(--btc);
  font: 700 10px/1 var(--data);
  letter-spacing: .13em;
  text-transform: uppercase;
}

.sheet-head h1, .sheet-head h2, .dialog-head h2 {
  margin: 8px 0 0;
  font: 650 31px/1 var(--display);
  letter-spacing: .01em;
}

.group-mode {
  align-self: flex-start;
  padding: 6px 9px;
  border: 1px solid var(--line);
  color: var(--muted);
  font-size: 12px;
}

.balance-hero {
  display: grid;
  grid-template-columns: 1.35fr 1fr 1fr;
  border-bottom: 1px solid var(--line);
}

.hero-cell { min-height: 164px; padding: 24px; border-right: 1px solid var(--line); }
.hero-cell:last-child { border-right: 0; }
.hero-cell label { display: block; color: var(--muted); font-size: 12px; }
.hero-value {
  display: block;
  margin-top: 16px;
  font: 600 clamp(29px, 3vw, 46px)/1 var(--display);
  letter-spacing: -.02em;
}
.hero-value small { margin-left: 5px; color: var(--muted); font: 600 11px/1 var(--data); }
.hero-note { display: block; margin-top: 14px; color: var(--muted); font-size: 12px; }
.positive { color: var(--healthy) !important; }
.negative { color: var(--risk) !important; }

.capital-flow {
  padding: 20px 24px 22px;
  border-bottom: 1px solid var(--line);
}

.section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 15px;
}
.section-title h3 { margin: 0; font: 650 20px/1 var(--display); }
.section-title small { color: var(--muted); }

.flow-line {
  display: grid;
  grid-template-columns: 1fr 45px 1fr 45px 1fr;
  align-items: center;
}
.flow-arrow { color: var(--btc); text-align: center; font: 24px/1 var(--display); }
.flow-box { min-height: 92px; padding: 14px; border: 1px solid var(--line); background: #f5f7f8; }
.flow-box strong, .flow-box span { display: block; }
.flow-box strong { margin-top: 8px; font: 600 20px/1 var(--display); }
.flow-box span { color: var(--muted); font-size: 11px; }

.cost-section { padding: 22px 24px 26px; }
.cost-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.cost-item { min-height: 82px; padding: 13px; border: 1px solid var(--line); }
.cost-item span { display: block; color: var(--muted); font-size: 11px; }
.cost-item strong { display: block; margin-top: 10px; font: 600 19px/1 var(--display); }

.action-column { display: flex; flex-direction: column; gap: 16px; }
.action-column > section { padding: 20px; }
.status-card { border-top: 4px solid var(--healthy) !important; }
.status-card.warning { border-top-color: var(--warning) !important; }
.status-card.action { border-top-color: var(--risk) !important; }
.status-label { color: var(--muted); font-size: 11px; }
.status-card h2 { margin: 10px 0 8px; font: 650 27px/1 var(--display); }
.status-card p { min-height: 40px; margin: 0 0 18px; color: var(--muted); font-size: 13px; line-height: 1.55; }
.button-stack { display: grid; gap: 8px; }

.master-card dl { margin: 0; }
.master-card div { display: flex; justify-content: space-between; gap: 16px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.master-card dt { color: var(--muted); font-size: 12px; }
.master-card dd { margin: 0; text-align: right; font: 600 12px/1.2 var(--data); word-break: break-all; }

.event-list { display: grid; }
.event-row { display: grid; grid-template-columns: 10px minmax(0, 1fr) auto; gap: 12px; padding: 13px 0; border-bottom: 1px solid var(--line); }
.event-row:last-child { border-bottom: 0; }
.event-dot { width: 8px; height: 8px; margin-top: 5px; border-radius: 50%; background: var(--healthy); }
.event-row.warning .event-dot { background: var(--warning); }
.event-row.action .event-dot { background: var(--risk); }
.event-copy strong, .event-copy span { display: block; }
.event-copy strong { font-size: 13px; }
.event-copy span { margin-top: 5px; color: var(--muted); font-size: 12px; line-height: 1.45; }
.event-time { color: var(--muted); font: 10px/1.3 var(--data); }

.full-sheet { padding: 24px; }
.full-sheet .sheet-head { margin: -24px -24px 0; }
.account-table { width: 100%; border-collapse: collapse; margin-top: 18px; }
.account-table th, .account-table td { padding: 13px 10px; border-bottom: 1px solid var(--line); text-align: left; }
.account-table th { color: var(--muted); font-size: 11px; font-weight: 600; }
.account-table td { font-size: 13px; }
.account-table .number { text-align: right; font-family: var(--data); }

dialog {
  width: min(570px, calc(100% - 28px));
  padding: 0;
  border: 0;
  background: transparent;
}
dialog::backdrop { background: rgba(16, 28, 37, .48); backdrop-filter: blur(2px); }
.dialog-card { border: 1px solid var(--line-strong); background: var(--paper); box-shadow: var(--shadow); }
.dialog-head { display: flex; justify-content: space-between; padding: 22px 24px; border-bottom: 1px solid var(--line); }
.icon-button { width: 34px; height: 34px; border: 1px solid var(--line); background: transparent; cursor: pointer; font-size: 22px; }
#modalBody { display: grid; gap: 16px; padding: 22px 24px; }
.field { display: grid; gap: 7px; }
.field label { color: var(--muted); font-size: 12px; }
.field input, .field select {
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--line-strong);
  background: white;
  padding: 0 12px;
  color: var(--ink);
}
.field small { color: var(--muted); line-height: 1.45; }
.mode-picker { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.mode-option { position: relative; }
.mode-option input { position: absolute; opacity: 0; }
.mode-option span { display: block; min-height: 84px; padding: 12px; border: 1px solid var(--line); cursor: pointer; }
.mode-option strong, .mode-option small { display: block; }
.mode-option small { margin-top: 7px; color: var(--muted); line-height: 1.35; }
.mode-option input:checked + span { border-color: var(--btc); box-shadow: inset 0 -4px 0 var(--btc); }
.preview-box { padding: 14px; border: 1px solid var(--btc); background: var(--btc-soft); }
.preview-box dl { display: grid; grid-template-columns: 1fr auto; gap: 9px; margin: 0; }
.preview-box dt { color: var(--muted); font-size: 12px; }
.preview-box dd { margin: 0; font: 600 12px/1 var(--data); }
.form-error { min-height: 18px; margin: 0; padding: 0 24px; color: var(--risk); font-size: 12px; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 9px; padding: 18px 24px 22px; }

.toast {
  position: fixed;
  right: 24px;
  bottom: 24px;
  max-width: 380px;
  padding: 13px 16px;
  background: var(--ink);
  color: white;
  box-shadow: var(--shadow);
  transform: translateY(20px);
  opacity: 0;
  pointer-events: none;
  transition: .2s ease;
}
.toast.show { transform: translateY(0); opacity: 1; }

.head-actions {
  display: flex;
  align-items: flex-start;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}

.workspace-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 330px;
  gap: 16px;
}

.workspace-main, .command-dock > section {
  border: 1px solid var(--line);
  background: var(--paper);
}

.status-strip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 18px 24px;
  border-bottom: 1px solid var(--line);
  border-left: 4px solid var(--healthy);
}

.status-strip.paused_risk, .status-strip.paused_data, .status-strip.paused_budget,
.status-strip.paused_funding, .status-strip.degraded { border-left-color: var(--warning); }
.status-strip.recovery_required { border-left-color: var(--risk); }

.recovery-panel {
  margin: 14px 0;
  padding: 16px 18px;
  border: 1px solid color-mix(in srgb, var(--risk) 45%, transparent);
  background: color-mix(in srgb, var(--risk) 8%, var(--panel));
  border-radius: 12px;
}

.recovery-panel strong,
.recovery-panel small { display: block; }
.recovery-panel small { margin-top: 4px; color: var(--muted); }
.recovery-panel ul { margin: 12px 0 0; padding-left: 20px; }
.recovery-panel li + li { margin-top: 6px; }
.status-strip div > span, .status-strip div > small { display: block; color: var(--muted); font-size: 12px; }
.status-strip div > strong { display: block; margin: 5px 0; font: 650 23px/1 var(--display); }

.metric-line {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  border-bottom: 1px solid var(--line);
}

.metric-line > div { min-height: 118px; padding: 19px 20px; border-right: 1px solid var(--line); }
.metric-line > div:last-child { border-right: 0; }
.metric-line span, .metric-line small { display: block; color: var(--muted); font-size: 11px; }
.metric-line strong { display: block; margin: 13px 0 10px; font: 600 25px/1 var(--display); }

.operating-section { padding: 20px 24px; border-bottom: 1px solid var(--line); }
.operating-section:last-child { border-bottom: 0; }

.check-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.check-item {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 66px;
  padding: 11px;
  border: 1px solid var(--line);
}
.check-item > span {
  width: 24px; height: 24px; display: grid; place-items: center;
  border-radius: 50%; background: var(--healthy-soft); color: var(--healthy); font-weight: 800;
}
.check-item.missing > span { background: var(--warning-soft); color: var(--warning); }
.check-item strong, .check-item small { display: block; }
.check-item strong { font-size: 12px; }
.check-item small { margin-top: 4px; color: var(--muted); font-size: 10px; }

.setup-progress { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.setup-step { display: flex; gap: 9px; align-items: center; padding: 11px; border: 1px solid var(--line); background: #f7f8f9; }
.setup-step > span { display: grid; place-items: center; width: 25px; height: 25px; flex: 0 0 25px; border-radius: 50%; background: #e4e8eb; color: var(--muted); font: 700 10px/1 var(--data); }
.setup-step.done > span { background: var(--healthy-soft); color: var(--healthy); }
.setup-step strong, .setup-step small { display: block; }
.setup-step strong { font-size: 11px; }
.setup-step small { margin-top: 3px; color: var(--muted); font-size: 9px; }

.command-dock { display: flex; flex-direction: column; gap: 16px; }
.command-dock > section { padding: 20px; }
.command-dock h2 { margin: 10px 0 8px; font: 650 25px/1.05 var(--display); }
.command-dock p { margin: 0 0 18px; color: var(--muted); font-size: 13px; line-height: 1.55; }

.service-list { display: grid; gap: 8px; }
.service-list > div { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 7px; }
.service-list strong, .service-list small { font-size: 10px; }
.service-list small { color: var(--muted); }
.service-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--risk); }
.service-dot.online { background: var(--healthy); box-shadow: 0 0 0 3px var(--healthy-soft); }

.summary-list { margin: 0; }
.summary-list > div { display: flex; justify-content: space-between; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.summary-list dt { color: var(--muted); font-size: 12px; }
.summary-list dd { margin: 0; font: 600 12px/1.2 var(--data); }

.text-button {
  border: 0; background: transparent; padding: 0; color: var(--btc); cursor: pointer; font-size: 12px;
}

.inline-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  margin: 0 -24px;
  border-bottom: 1px solid var(--line);
}
.inline-stats > div { min-height: 96px; padding: 18px 24px; border-right: 1px solid var(--line); }
.inline-stats > div:last-child { border-right: 0; }
.inline-stats span, .inline-stats strong { display: block; }
.inline-stats span { color: var(--muted); font-size: 11px; }
.inline-stats strong { margin-top: 11px; font: 600 25px/1 var(--display); }

.table-title { margin: 24px 0 10px; }
.table-scroll { overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; }
.data-table th, .data-table td {
  padding: 12px 10px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  font-size: 12px;
  white-space: nowrap;
}
.data-table th { color: var(--muted); font-size: 10px; font-weight: 650; letter-spacing: .03em; }
.data-table .number { text-align: right; font-family: var(--data); }
.data-table .principal-cell { max-width: 340px; overflow-wrap: anywhere; font-family: var(--data); }
.data-table.compact th, .data-table.compact td { padding: 10px 8px; font-size: 10px; }
.mono { font-family: var(--data); font-size: 10px; color: var(--muted); }
.side { display: inline-block; min-width: 38px; padding: 4px 6px; text-align: center; font-weight: 700; }
.side.buy { background: var(--healthy-soft); color: var(--healthy); }
.side.sell { background: var(--risk-soft); color: var(--risk); }

.guided-empty {
  display: grid;
  justify-items: center;
  gap: 6px;
  padding: 28px;
  color: var(--muted);
  text-align: center;
  white-space: normal;
}
.guided-empty strong { color: var(--ink); font-size: 14px; }
.guided-empty span { max-width: 520px; line-height: 1.5; }

.wallet-master {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) minmax(40px, 1fr) minmax(210px, 1fr) auto;
  align-items: center;
  gap: 18px;
  margin: 0 -24px;
  padding: 22px 24px;
  border-bottom: 1px solid var(--line);
}
.wallet-master span, .wallet-master strong, .wallet-master small { display: block; }
.wallet-master span, .wallet-master small { color: var(--muted); font-size: 11px; }
.wallet-master strong { margin: 9px 0; font: 600 25px/1 var(--display); }
.master-wallet-detail { min-width: 0; }
.flow-rule { height: 2px; background: var(--btc); opacity: .65; }

.wallet-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.wallet-tile { padding: 15px; border: 1px solid var(--line); background: #f6f8f9; }
.wallet-tile > div:first-child { display: flex; justify-content: space-between; }
.wallet-number { font: 700 13px/1 var(--data); color: var(--btc); }
.state-pill { padding: 3px 6px; background: var(--healthy-soft); color: var(--healthy); font-size: 10px; }
.wallet-tile > strong { display: block; margin: 20px 0; font: 600 23px/1 var(--display); }
.wallet-identity { min-width: 0; margin: 0 0 14px; padding: 9px 10px; border: 1px solid var(--line); background: #fff; }
.wallet-identity.unbound { color: var(--muted); }
.wallet-identity.unbound span, .wallet-identity.unbound small { display: block; }
.wallet-identity small { margin-top: 5px; overflow-wrap: anywhere; color: var(--muted); font: 500 9px/1.35 var(--data); }
.address-line { display: flex; align-items: flex-start; gap: 8px; min-width: 0; }
.deposit-panel { display: grid; grid-template-columns: 112px 1fr; gap: 14px; align-items: center; margin: 10px 0 14px; padding: 12px; border: 1px solid var(--line-strong); background: #fffaf0; }
.deposit-panel img { display: block; width: 112px; height: 112px; background: white; }
.deposit-panel strong { display: block; margin-bottom: 7px; }
.deposit-panel p { margin: 0; color: var(--muted); font-size: 11px; line-height: 1.55; }
.address-line code { min-width: 0; overflow-wrap: anywhere; color: var(--ink); font: 600 10px/1.35 var(--data); }
.copy-address { flex: 0 0 auto; margin-left: auto; padding: 3px 6px; border: 1px solid var(--line-strong); background: transparent; color: var(--muted); cursor: pointer; font-size: 9px; }
.copy-address:hover { border-color: var(--btc); color: var(--btc); }
.principal-block { margin-top: 8px; padding-top: 7px; border-top: 1px dashed var(--line); }
.principal-block > small { display: block; margin: 0 0 4px; }
.wallet-login-row { display: flex; align-items: center; gap: 7px; margin-top: 8px; padding-top: 8px; border-top: 1px solid var(--line); }
.wallet-login-row small { margin: 0; min-width: 0; max-height: 2.7em; overflow: hidden; }
.login-pill { flex: 0 0 auto; padding: 3px 6px; font: 700 9px/1 var(--data); background: #e9edf0; color: var(--muted); }
.login-pill.authenticated { background: var(--healthy-soft); color: var(--healthy); }
.login-pill.checking, .login-pill.expiring { background: var(--btc-soft); color: #8a5a00; }
.login-pill.error { background: var(--risk-soft); color: var(--risk); }
.wallet-health-summary { display: grid; grid-template-columns: repeat(3, minmax(100px, 140px)) 1fr; gap: 10px; align-items: center; margin: 0 -24px 18px; padding: 14px 24px; border-bottom: 1px solid var(--line); background: #f7f8f9; }
.wallet-health-summary > div { padding-right: 12px; border-right: 1px solid var(--line); }
.wallet-health-summary span, .wallet-health-summary strong { display: block; }
.wallet-health-summary span { color: var(--muted); font-size: 9px; }
.wallet-health-summary strong { margin-top: 4px; font: 700 16px/1 var(--data); }
.wallet-health-summary .has-error strong { color: var(--risk); }
.wallet-health-summary p { margin: 0; color: var(--muted); font-size: 10px; line-height: 1.5; }
.wallet-tile dl { margin: 0; }
.wallet-tile dl div { display: flex; justify-content: space-between; gap: 10px; padding: 7px 0; border-top: 1px solid var(--line); }
.wallet-tile dt { color: var(--muted); font-size: 10px; }
.wallet-tile dd { margin: 0; font: 600 10px/1.2 var(--data); }

.token-strip { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 -24px; padding: 18px 24px; border-bottom: 1px solid var(--line); }
.token-chip { display: flex; align-items: center; gap: 24px; min-width: 160px; padding: 10px 12px; border: 1px solid var(--line); }
.token-chip strong, .token-chip small { display: block; }
.token-chip small { margin-top: 3px; color: var(--muted); font-size: 10px; }
.icon-text { margin-left: auto; border: 0; background: transparent; color: var(--risk); cursor: pointer; font-size: 11px; }
.icon-text.disabled { color: var(--muted); cursor: not-allowed; }

.cost-breakdown { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; margin-top: 20px; }
.cost-breakdown > div { padding: 12px; border: 1px solid var(--line); }
.cost-breakdown span, .cost-breakdown strong { display: block; }
.cost-breakdown span { color: var(--muted); font-size: 10px; }
.cost-breakdown strong { margin-top: 9px; font: 600 13px/1 var(--data); }

.event-list.expanded { margin-top: 12px; }
.statistics-range {
  margin: 0 -24px;
  padding: 9px 24px;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  font: 500 10px/1.2 var(--data);
}
.period-switch { display: flex; border: 1px solid var(--line-strong); }
.period-button {
  min-width: 58px; padding: 8px 12px; border: 0; border-right: 1px solid var(--line);
  background: transparent; color: var(--muted); cursor: pointer; font-weight: 650;
}
.period-button:last-child { border-right: 0; }
.period-button.active { background: var(--ink); color: white; }
.statistics-kpis {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  margin: 0 -24px;
  border-bottom: 1px solid var(--line);
}
.statistics-kpis > div { min-height: 112px; padding: 17px 16px; border-right: 1px solid var(--line); }
.statistics-kpis > div:last-child { border-right: 0; }
.statistics-kpis span, .statistics-kpis small { display: block; color: var(--muted); font-size: 10px; }
.statistics-kpis strong { display: block; margin: 14px 0 10px; font: 600 20px/1 var(--display); }
.result-bridge {
  display: grid;
  grid-template-columns: 1fr auto 1fr auto 1.15fr;
  align-items: center;
  gap: 16px;
  margin: 22px 0;
  padding: 18px 20px;
  border: 1px solid var(--line-strong);
  border-left: 5px solid var(--btc);
  background: #f7f8f9;
}
.result-bridge > div span, .result-bridge > div strong { display: block; }
.result-bridge > div span { color: var(--muted); font-size: 10px; }
.result-bridge > div strong { margin-top: 8px; font: 650 18px/1 var(--data); }
.result-bridge > b { color: var(--muted); font-size: 20px; }
.result-bridge .result-total strong { font-size: 23px; }
.result-bridge p { grid-column: 1 / -1; margin: 0; padding-top: 12px; border-top: 1px solid var(--line); color: var(--muted); font-size: 11px; }
.statistics-columns { display: grid; grid-template-columns: .8fr 1.2fr; gap: 20px; }
.statistics-columns > section, .statistics-section { border-top: 1px solid var(--line); padding-top: 16px; }
.statistics-list { margin: 0; columns: 2; column-gap: 24px; }
.statistics-list > div {
  display: flex; justify-content: space-between; gap: 12px; break-inside: avoid;
  padding: 9px 0; border-bottom: 1px solid var(--line);
}
.statistics-list dt { color: var(--muted); font-size: 10px; }
.statistics-list dd { margin: 0; font: 600 10px/1.2 var(--data); text-align: right; }
.statistics-section { margin-top: 24px; }
.timeline-ledger { display: grid; gap: 3px; }
.timeline-row {
  display: grid; grid-template-columns: 126px minmax(100px, 1fr) 50px 110px 90px;
  align-items: center; gap: 10px; min-height: 32px; font: 500 10px/1 var(--data);
}
.timeline-row time { color: var(--muted); }
.timeline-track { height: 8px; background: #e6e9eb; overflow: hidden; }
.timeline-track i { display: block; height: 100%; background: var(--btc); }
.timeline-row span, .timeline-row strong, .timeline-row em { text-align: right; font-style: normal; }
.statistics-footnote {
  margin: 22px -24px -24px; padding: 12px 24px; border-top: 1px solid var(--line);
  color: var(--muted); font: 500 10px/1.4 var(--data);
}
.confirmation-copy {
  margin: 0; padding: 12px; background: #f3f6f7; color: var(--muted); font-size: 12px; line-height: 1.55;
}

@media (max-width: 980px) {
  .page-grid { grid-template-columns: 1fr; }
  .action-column { display: grid; grid-template-columns: repeat(2, 1fr); }
  .action-column > section:last-child { grid-column: 1 / -1; }
  .workspace-grid { grid-template-columns: 1fr; }
  .command-dock { display: grid; grid-template-columns: repeat(2, 1fr); }
  .command-dock > section:last-child { grid-column: 1 / -1; }
  .metric-line, .check-grid, .setup-progress { grid-template-columns: repeat(2, 1fr); }
  .wallet-grid { grid-template-columns: repeat(2, 1fr); }
  .cost-breakdown { grid-template-columns: repeat(3, 1fr); }
  .statistics-kpis { grid-template-columns: repeat(3, 1fr); }
  .statistics-columns { grid-template-columns: 1fr; }
}

@media (max-width: 720px) {
  .shell { width: 100%; margin-top: 0; }
  .topbar { border-left: 0; border-right: 0; }
  .brand { min-width: 0; }
  .brand small, .system-state span:last-child { display: none; }
  .task-switcher { grid-template-columns: 1fr; gap: 3px; flex: 1; }
  .task-switcher > span { display: none; }
  .view-tabs { padding-left: 16px; }
  .view-tab { flex: 0 0 auto; }
  #app { padding: 12px; }
  .balance-hero { grid-template-columns: 1fr; }
  .hero-cell { min-height: 120px; border-right: 0; border-bottom: 1px solid var(--line); }
  .flow-line { grid-template-columns: 1fr; gap: 7px; }
  .flow-arrow { transform: rotate(90deg); }
  .cost-grid, .action-column, .mode-picker { grid-template-columns: 1fr 1fr; }
  .wallet-master { grid-template-columns: 1fr; }
  .wallet-health-summary { grid-template-columns: repeat(3, 1fr); }
  .wallet-health-summary p { grid-column: 1 / -1; }
  .flow-rule { width: 2px; height: 30px; margin-left: 18px; }
  .inline-stats { grid-template-columns: repeat(2, 1fr); }
  .cost-breakdown { grid-template-columns: repeat(2, 1fr); }
  .timeline-row { grid-template-columns: 105px minmax(80px, 1fr) 42px 90px; }
  .timeline-row em { display: none; }
}

@media (max-width: 480px) {
  .topbar { gap: 8px; padding: 0 12px; }
  .brand { flex: 0 0 38px; }
  .brand > span:last-child { display: none; }
  .topbar .button { padding: 0 10px; font-size: 12px; }
  .task-switcher select { min-width: 0; padding-left: 9px; padding-right: 24px; }
  .cost-grid, .action-column, .mode-picker { grid-template-columns: 1fr; }
  .command-dock, .metric-line, .check-grid, .wallet-grid, .setup-progress, .wallet-health-summary { grid-template-columns: 1fr; }
  .statistics-kpis { grid-template-columns: repeat(2, 1fr); }
  .result-bridge { grid-template-columns: 1fr auto 1fr; }
  .result-bridge .result-total { grid-column: 1 / -1; }
  .result-bridge > b:nth-of-type(2) { display: none; }
  .statistics-list { columns: 1; }
  .timeline-row { grid-template-columns: 94px 1fr 72px; }
  .timeline-row span { display: none; }
  .wallet-health-summary p { grid-column: auto; }
  .action-column > section:last-child { grid-column: auto; }
  .sheet-head { padding: 18px; }
  .capital-flow, .cost-section { padding-left: 18px; padding-right: 18px; }
}

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