/* Shared sizing guards: long titles, URLs and evidence must not widen a page. */
main, .panel, details, .page-top > *, .panel-heading > *, .dialog-head > * { min-width: 0; }
h1, h2, h3, .subtitle, .panel, .notice, .revision-bar, .kv, .version-list { overflow-wrap: anywhere; }
.grid2, .grid3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.panel-heading { gap: 12px; flex-wrap: wrap; }
.panel-heading h2 { margin-bottom: 0; }
.record-select { display: flex; align-items: center; gap: 8px; margin: 0; min-height: 44px; cursor: pointer; }
.record-select input { flex: none; }
@media (min-width: 701px) { .record-select { font-size: 0; } }
dialog { max-height: 90dvh; overscroll-behavior: contain; }
dialog[open] { display: flex; flex-direction: column; }
#dialog-content { min-height: 0; flex: 0 0 auto; }
.dialog-head { position: sticky; top: 0; background: white; z-index: 2; gap: 12px; }
.dialog-head h2 { overflow-wrap: anywhere; }
.dialog-head button { flex: none; min-width: 44px; min-height: 44px; }
.dialog-footer { flex-wrap: wrap; }
@media (max-width: 1050px) and (min-width: 701px) {
  .grid3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 900px) {
  header { min-height: 64px; height: auto; padding: 10px 16px; flex-wrap: wrap; gap: 8px; }
  .brand { font-size: 16px; }
  .demo-label, .side-note { display: none; }
  .header-actions button { min-height: 44px; white-space: normal; font-size: 12px; padding: 8px 10px; }
  .app-shell { display: block; }
  aside { width: 100%; padding: 8px 12px; border-right: 0; border-bottom: 1px solid var(--border); }
  #nav { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
  #nav a { min-width: 0; min-height: 48px; padding: 8px 6px; margin: 0; gap: 6px; justify-content: center; font-size: 12px; }
  .nav-number { flex: none; }
  .nav-count { display: none; }
  main { padding: 24px 20px 48px; }
  .page-top { flex-wrap: wrap; gap: 14px; }
}
@media (max-width: 700px) {
  :root { font-size: 15px; }
  header { padding: 8px 12px; }
  .brand { gap: 6px; font-size: 15px; }
  .header-actions { min-width: 0; }
  .header-actions button { max-width: 124px; }
  .live-banner { padding: 9px 14px; font-size: 12px; }
  main { padding: 22px 14px max(36px, env(safe-area-inset-bottom)); }
  h1 { font-size: 24px; line-height: 1.25; }
  .subtitle { margin-top: 9px; }
  button, button.small, button.quiet, .header-actions button { min-height: 44px; padding: 10px 12px; white-space: normal; line-height: 1.35; }
  button.small { font-size: 13px; }
  input:not([type=checkbox]):not([type=range]), select, textarea { font-size: 16px; min-height: 46px; min-width: 0; max-width: 100%; }
  textarea { min-height: 110px; }
  input[type=file] { font-size: 14px !important; }
  input[type=checkbox] { width: 24px; height: 24px; flex: none; }
  .checkrow { min-height: 44px; align-items: center; }
  .checkrow label, fieldset .checkrow label { min-height: 44px; display: flex; align-items: center; flex: 1; }
  summary { min-height: 44px; padding: 10px 0; font-size: 13px; }
  details { padding: 5px 14px; }
  .panel { padding: 16px; }
  .panel.flush { padding: 0; }
  .grid2, .grid3, .detail-grid > .side-panel { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; }
  .grid2 > *, .grid3 > * { margin-bottom: 0; }
  .page-top > .actions, .page-top > button, .selection-bar > .actions { width: 100%; }
  .actions > button { flex: 1 1 135px; min-width: 0; }
  .toolbar { display: grid; grid-template-columns: minmax(0, 1fr); gap: 10px; }
  .toolbar .search, .toolbar select { min-width: 0; width: 100% !important; max-width: none; margin: 0; }
  .selection-bar { align-items: stretch; }
  .tabs { margin: 18px 0; gap: 16px; padding: 0 2px 3px; scrollbar-width: thin; }
  .tabs a, .tabs button { min-height: 48px; display: flex; align-items: center; flex: none; font-size: 14px; }
  .breadcrumbs { gap: 6px; }
  .breadcrumbs a { max-width: 100%; white-space: normal; }
  .kv { gap: 12px; flex-wrap: wrap; }
  .kv > * { min-width: 0; max-width: 100%; }
  .kv span:last-child { text-align: left; }
  .badge { max-width: 100%; white-space: normal; }
  .side-panel .stat strong { white-space: normal; }
  .run-line { flex-wrap: wrap; }
  .version-list a, .asset-link, .back, a.button { min-height: 44px; display: inline-flex; align-items: center; }
  .version-list a { padding: 8px 10px; }
  .media-placeholder { min-height: 150px; }
  .record-table, .record-table tbody { display: block; width: 100%; }
  .record-table thead { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
  .record-table tbody tr { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; padding: 18px 16px; border-bottom: 1px solid var(--border); }
  .record-table tbody tr:last-child { border-bottom: 0; }
  .record-table td { display: block; padding: 0; border: 0; min-width: 0; overflow-wrap: anywhere; }
  .record-table td::before { content: attr(data-label); display: block; margin-bottom: 5px; font-size: 11px; font-weight: 650; color: var(--muted); text-transform: uppercase; letter-spacing: .3px; }
  .record-table td.record-title, .record-table td.record-actions, .record-table td.record-selection, .record-table td[colspan] { grid-column: 1 / -1; }
  .record-table td.record-title { font-size: 16px; }
  .record-table td.record-selection::before, .record-table td.record-actions::before, .record-table td[colspan]::before { display: none; }
  .record-table .record-actions > a { min-height: 44px; display: flex; align-items: center; justify-content: center; border: 1px solid #cdd5e1; border-radius: 5px; font-weight: 600; }
  .record-table td .secondary { font-size: 12px; }
  .record-table .empty { padding: 20px 0; }
  .table-scroll table:not(.record-table) th, .table-scroll table:not(.record-table) td { padding: 10px 8px; white-space: normal; overflow-wrap: anywhere; }
  dialog { width: calc(100% - 16px); max-width: 560px; max-height: calc(100dvh - 16px); margin: auto; }
  .dialog-head { padding: 10px 14px; }
  .dialog-body { padding: 16px 14px; }
  .dialog-footer { padding: 14px 0 max(14px, env(safe-area-inset-bottom)); gap: 8px; }
  .dialog-footer > button { flex: 1 1 120px; min-width: 0; }
  .dialog-footer > button[type=submit] { flex-grow: 2; }
  #toast { bottom: max(16px, env(safe-area-inset-bottom)); width: max-content; max-width: calc(100vw - 28px); padding: 12px 16px; }
}
@media (prefers-reduced-motion: reduce) { .running { animation: none; } }
