/* Read-only books use the available width without reducing type or hiding rows.
   Product forms, signed confirmations and wallet passbooks retain their layout. */
@media (min-width: 1100px) {

  .tour-page main { grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: start; }
  .tour-page main > :is(.tour-intro, .tour-route, .tour-stops, .tour-return) { grid-column: 1 / -1; }
  /* The desk directory (tallest) takes the right column beside the two short notes stacked on the left, so no half row stands empty. */
  .tour-page main > .tour-detail:has(> .tour-directory) { grid-column: 2; grid-row: span 2; }
  .tour-page .tour-detail { padding: 20px; }
  .tour-page .tour-detail .tour-directory { grid-template-columns: minmax(0, 1fr); gap: 10px; }
  .tour-page .tour-detail .tour-directory > div { display: grid; grid-template-columns: 128px minmax(0, 1fr); gap: 8px 14px; }
  .tour-page .tour-detail .tour-directory dd { grid-column: 2; }

  .credit-page main { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr); gap: 16px; align-items: start; align-content: start; }
  .credit-page main > :is(.desk-head, .credit-entrance, .stage-line, .credit-book, #notice) { grid-column: 1 / -1; }
  .credit-page main > .window { margin-block: 0; }
  .credit-page main > :is(.credit-market-plans, .window:has(#credit-flow-title)) { grid-column: 1 / -1; }
  .credit-page .credit-market-plans { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px 20px; }
  .credit-page .credit-market-plans > :is(h2, p) { grid-column: 1 / -1; }
  .credit-page .credit-market-plan:last-child { border-bottom: 0; }
  .credit-page .credit-plan-body { padding-left: 0; }
  .credit-page .credit-entrance { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, .9fr); gap: 8px 28px; }
  .credit-page .credit-entrance > :is(h2, #credit-devnet-entry, #credit-own-claim) { grid-column: 1 / -1; }
  .credit-page .credit-entrance > .ledger { grid-column: 2; grid-row: 3 / span 2; margin: 0; align-self: start; }
  .credit-page .credit-entrance > #credit-apr-note { grid-column: 1; margin-top: 0; }
  .credit-page .credit-entrance > .actions { grid-column: 1; margin: 4px 0; }
  .credit-page .credit-entrance > p:not([id]) { grid-column: 2; margin: 0; }
}

/* Long observation books need breathing room around words, not repeated padding. */
.health-page .h-grid { gap: 12px; padding: 12px; align-items: start; grid-template-columns: repeat(auto-fit, minmax(min(100%, 340px), 1fr)); }
.health-page .h-card .h-detail { max-width: 65ch; }
.health-page .h-card { padding: 14px 16px; gap: 7px; }
.health-page .h-fields > div { padding-block: 5px; }
.reports-page.paper-page .key-figures > div { padding-block: 12px; gap: 5px; }
.reports-page.paper-page .two-figures { padding-block: 16px; }
.reports-page.paper-page .report-pair { margin-top: 18px; }
.reports-page.paper-page .report-table td { padding-block: 10px; }
.reports-page.paper-page .acts > div { padding-block: 10px; }
.reports-page .two-figures > .board > dt { min-height: 37px; }
.reports-page .paper-dateline > span:last-child { margin-left: auto; }
.health-page .desk-head > .desk-line { padding-inline: 12px; }
.reserve-page .desk-head .ledger > div { align-content: start; }
.reserve-page .desk-head .ledger > .g-off:nth-child(3) { border-right: 0; }

/* Restore the existing vignette only on the wallet-free introductory card. */
.portfolio-page:not(:has(#connect[data-owner])) #portfolio-empty {
  background-color: var(--washi-hi);
  background-image: linear-gradient(90deg, var(--paper) 35%, #fbf6eab3), var(--vignette, none);
  background-position: 0 0, right bottom;
  background-size: auto, auto 100%;
  background-repeat: no-repeat;
}
.portfolio-page:not(:has(#connect[data-owner])) #portfolio-empty .pb-connect { display: inline-flex; align-items: center; gap: 10px; }

@media (min-width: 900px) {
  .reserve-page .desk-head { padding-top: 26px; }
  .reserve-page .desk-head .desk-line { margin-bottom: 18px; }
  .reserve-page .desk-head .ledger > div { padding-block: 14px; }
}
@media (max-width: 560px) {
  .health-page .h-grid { padding: 10px 8px; }
  .health-page .h-card { padding: 14px; }
}
@media (max-width: 899px) {
  .reserve-page:not(:has(#connect[data-owner])) .desk-body > .action-card { order: -1; }
}


@media (min-width: 900px) { .tour-page:lang(ja) .tour-stops .tour-links { min-height: 44px; } }

/* Round 2: short reading links keep the same 44px touch target as primary links. */
.home-page .hero-copy .borrowing-link,
.tour-page .tour-links a, .tour-page .tour-directory dd a { display: inline-flex; align-items: center; min-height: 44px; }
.tour-page .tour-primary { padding-block: 10px; }
.tour-page .tour-intro > .journey-link { display: inline-flex; align-items: center; min-height: 44px; justify-self: start; }
.tour-page .tour-observations a, .tour-page .tour-primary { min-height: 44px; }
@media (max-width: 560px) {
  .home-page .site-foot .foot-links { flex-wrap: wrap; column-gap: 6px; }
  .home-page .site-foot .foot-links a:has(.foot-icon) { justify-content: center; min-width: 44px; min-height: 44px; }
}

/* Round 2: token names and compound numeric labels keep their original case. */
.dashboard-page.paper-page #d-peg, .reports-page #r-runway { word-break: keep-all; }
.dashboard-page.paper-page .report-table th { text-transform: none; }
.credit-page.desk-closed .credit-book { display: none; }
.health-page.desk-sample .desk-head .ledger::before { grid-column: 1 / -1; }
@media (max-width: 560px) {
  /* The settings seal remains above these tabs, so it needs no empty fifth column. */
  .reserve-page .action-card:has(.desk-tools) .reserve-tabs { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

/* Round 3: preview metadata precedes the existing three observation cells. */
.health-page.desk-sample .desk-head .ledger { grid-auto-flow: row; grid-template-columns: repeat(3, minmax(0, 1fr)); }
.health-page.desk-sample .desk-head .ledger::before { grid-column: 1 / -1; grid-row: 1; }
.health-page.desk-sample .desk-head .ledger > div:nth-child(1) { grid-column: 1; grid-row: 2; }
.health-page.desk-sample .desk-head .ledger > div:nth-child(2) { grid-column: 2; grid-row: 2; }
.health-page.desk-sample .desk-head .ledger > div:nth-child(3) { grid-column: 3; grid-row: 2; }
.credit-page:is(.desk-sample,.desk-closed) .credit-entrance { grid-template-columns: minmax(0, 1fr); }
.credit-page:is(.desk-sample,.desk-closed) .credit-entrance > * { grid-column: 1 / -1; }
:is(.dashboard-page,.reports-page) dd.def { text-wrap: pretty; }
:is(.dashboard-page,.reports-page):lang(ja) dd.def { word-break: auto-phrase; }
:is(.dashboard-page,.reports-page) .chart-tags { display: flex; flex-wrap: wrap; gap: 4px 8px; }
:is(.dashboard-page,.reports-page) :is(.chart-tags button, .chart-figures > summary) { min-height: 44px; }
.reports-page #r-show-empty { display: inline-flex; align-items: center; min-height: 44px; }
@media (max-width: 899px) {
  .credit-page .ledger > div { display: grid; grid-template-rows: 1fr auto; }
}
@media (max-width: 560px) {
  .portfolio-page .desk-head > .desk-line { padding-inline: 0; }
  .health-page.desk-sample .desk-head .ledger { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .health-page.desk-sample .desk-head .ledger > div:nth-child(2) { grid-column: 1 / -1; grid-row: 3; }
  .health-page.desk-sample .desk-head .ledger > div:nth-child(3) { grid-column: 2; grid-row: 2; }
}
/* Match the paragraph selector's specificity so the preview creates no implicit second column. */
.credit-page:is(.desk-sample,.desk-closed) .credit-entrance > p:not([id]) { grid-column: 1 / -1; }

/* Keep each reserve role and action sentence on its own reading line. */
.reserve-page .desk-line > :is(.reserve-role, .reserve-actions-intro) > span { display: block; text-wrap: pretty; }

/* Section headings inherit the ledger bar, including when the English title wraps. */
.portfolio-page :is(.portfolio-next, .management-desks) .window-bar { padding-block: 8px; }
.portfolio-page :is(.portfolio-next, .management-desks) .window-bar > h2 { margin: 0; min-width: 0; flex-shrink: 1; white-space: normal; font: inherit; line-height: 1.5; text-wrap: pretty; }
