/* Shared responsive layout. Do not hide overflowing content or approval controls. */
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
[hidden] { display: none !important; }
body { overflow-wrap: anywhere; }
main, main section, main article, form, fieldset, details, .topline > *, .split > * { min-width: 0; }
img, video, iframe { max-width: 100%; }
img { height: auto; }
input, select, textarea { min-width: 0; max-width: 100%; }
pre { max-width: 100%; overflow: auto; white-space: pre-wrap; word-break: break-word; }
button, .button, summary { touch-action: manipulation; }
.mobile-menu-toggle { display: none; }
.table-scroll { width: 100%; max-width: 100%; overflow-x: auto; overscroll-behavior-x: contain; }
.table-scroll table { margin-bottom: 0; }
.table-scroll-hint { margin: 8px 0; font-size: .85rem; color: #666; }
.cell-label { display: none; }
.filter-panel > summary { font-weight: 700; margin-bottom: 12px; }
.mobile-action-bar { margin-top: 16px; }
.mobile-action-bar button { width: 100%; }
.comparison-nav { margin: 16px 0; }
.editorial-version { scroll-margin-top: 20px; }
.site-nav-hint { display: none; }

@media screen {
  /* Constrain the scroll container, not the table's columns. This also applies
     to narrow side-by-side article previews on desktop, regardless of thead,
     column count or merged headers. Keep these minimums out of print layouts. */
  .table-scroll > table { display: table; table-layout: auto; max-width: none; overflow: visible; }
  .table-scroll th, .table-scroll td, .editorial-document th, .editorial-document td {
    min-width: 8rem; overflow-wrap: break-word; word-break: normal;
  }
  /* Longer article prose needs more space. The table's existing block/overflow
     style provides the same readable-column fallback when JS is unavailable. */
  .editorial-document th, .editorial-document td { min-width: 14rem; }
  .editorial-document th:first-child, .editorial-document td:first-child { min-width: 10rem; }
  .table-scroll :is(th, td) p, .editorial-document :is(th, td) p { overflow-wrap: break-word; }
  .table-scroll :is(th, td) :is(a, code), .editorial-document :is(th, td) :is(a, code) { overflow-wrap: anywhere; }
}

@media screen and (max-width: 720px) {
  header { padding: 12px max(16px, env(safe-area-inset-right)) 12px max(16px, env(safe-area-inset-left)); gap: 10px; align-items: center; }
  .header-left { flex: 1; min-width: 0; }
  .brand { font-size: 1rem; }
  .mobile-menu-toggle { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-width: 84px; min-height: 44px; border: 1px solid #777; }
  .mobile-menu-toggle::before { content: '☰'; font-size: 1.1rem; }
  .mobile-menu-toggle[aria-expanded="true"]::before { content: '×'; }
  .mobile-menu-toggle:not([hidden])[aria-expanded="false"] ~ .account { display: none; }
  .account { width: 100%; justify-content: space-between; padding-top: 6px; }
  .account form { margin-left: auto; }
  #global-navigation { display: grid; grid-template-columns: minmax(0, 1fr); padding: 8px 16px 14px; }
  #global-navigation a { min-height: 44px; display: flex; align-items: center; }
  main { margin: 18px auto 0; padding: 0 max(16px, env(safe-area-inset-right)) calc(32px + env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left)); }
  h1 { font-size: clamp(1.65rem, 7vw, 2rem); line-height: 1.18; }
  h2 { font-size: 1.35rem; line-height: 1.25; }
  h3 { font-size: 1.15rem; line-height: 1.3; }
  .section { margin-top: 24px; }
  .card { padding: 16px; border-radius: 12px; }
  .grid, .split, .score-hero { grid-template-columns: minmax(0, 1fr); }
  .grid.stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .tag { white-space: normal; max-width: 100%; line-height: 1.4; }
  .metric { font-size: 1.75rem; }
  .topline { flex-direction: column; gap: 10px; }
  .topline .status-row { margin: 4px 0; }
  .site-nav { flex-wrap: nowrap; overflow-x: auto; gap: 4px; padding: 6px; margin-bottom: 6px; overscroll-behavior-x: contain; }
  .site-nav .nav-context { display: none; }
  .site-nav a { flex-shrink: 0; white-space: nowrap; min-height: 44px; display: flex; align-items: center; }
  .site-nav-hint { display: block; margin: 0 0 20px; font-size: .78rem; color: #666; }
  .actions { align-items: stretch; gap: 10px; }
  .actions > * { flex: 1 1 100%; min-width: 0; }
  .actions button, .actions .button { width: 100%; }
  button, a.button, .button, input[type="submit"] { min-height: 44px; max-width: 100%; white-space: normal; text-align: center; line-height: 1.4; }
  form > button { width: 100%; margin-top: 8px; }
  .account form > button { margin-top: 0; }
  input, select, textarea { font-size: 16px; }
  textarea { min-height: 140px; }
  fieldset { margin: 0; max-width: 100%; }
  label:has(input[type="checkbox"]), label:has(input[type="radio"]) { display: flex; align-items: flex-start; gap: 10px; min-height: 44px; padding: 10px 0; cursor: pointer; }
  label:has(input[type="checkbox"]) + br, label:has(input[type="radio"]) + br { display: none; }
  input[type="checkbox"], input[type="radio"] { width: 22px; height: 22px; margin: 1px 0 0; }
  input[type="checkbox"] + span, input[type="radio"] + span { margin-left: 0; }
  summary { min-height: 44px; padding: 10px 0; }
  ul, ol { padding-left: 22px; }
  blockquote { margin-left: 0; margin-right: 0; }
  .steps { gap: 6px; }
  .step { flex: 1 1 auto; text-align: center; }
  table { max-width: 100%; }
  th, td { padding: 10px; }
  .mobile-cards { display: block; width: 100%; border: 0; background: transparent; overflow: visible; }
  .mobile-cards > thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
  .mobile-cards > tbody { display: block; }
  .mobile-cards > tbody > tr { display: block; border: 1px solid #deddd8; border-radius: 12px; padding: 12px; margin-bottom: 12px; background: #fff; }
  .mobile-cards > tbody > tr > td, .mobile-cards > tbody > tr > th { display: block; width: 100%; padding: 8px 0; border: 0; }
  .mobile-cards .cell-label { display: block; font-size: .75rem; font-weight: 700; color: #666; margin-bottom: 4px; }
  .mobile-cards .selection-cell { min-height: 44px; }
  .mobile-cards > tbody > tr > td.selection-cell:empty { display: none; }
  .mobile-cards .selection-cell label { padding: 4px 0; align-items: center; }
  .mobile-action-bar { position: sticky; bottom: 0; z-index: 5; background: #fff; padding: 12px 0 max(12px, env(safe-area-inset-bottom)); border-top: 1px solid #deddd8; }
  .mobile-action-bar p { margin: 0 0 8px; }
  body:has(textarea:focus, input:not([type="checkbox"]):not([type="radio"]):focus) .mobile-action-bar { position: static; }
  .editorial-comparison { grid-template-columns: minmax(0, 1fr); gap: 16px; }
  .editorial-version { padding: 14px; }
  .editorial-document { font-size: 1rem; line-height: 1.7; }
  .editorial-document h1 { font-size: 1.6rem; }
  .editorial-document h2 { font-size: 1.3rem; }
  .editorial-document h3 { font-size: 1.12rem; }
  .editorial-full > summary { font-size: 1rem; }
  .comparison-nav { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .comparison-nav > * { min-width: 0; }
  /* Public sales reports have a separate shell but use the same responsive rules. */
  .wrap { padding: 18px 16px 40px; }
  .topbar, .section-head, .category-top { flex-wrap: wrap; }
  .topmeta { text-align: left; }
  .hero { border-radius: 16px; padding: 24px 18px; }
  .hero h1 { font-size: 2rem; line-height: 1.1; }
  .scope-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media print {
  .mobile-menu-toggle, .site-nav-hint, .table-scroll-hint, .comparison-nav, .mobile-action-bar { display: none !important; }
  .table-scroll { overflow: visible; }
}
