.issue-account-actions { display: contents; }
.issue-mobile-backup { display: none; text-decoration: none; }

@media screen and (max-width: 980px) {
  .issue-mobile-backup { display: inline-flex; align-items: center; }
}

@media screen and (max-width: 700px) {
  main { padding: 8px 12px 26px; }

  .mobile-brand {
    min-height: 48px;
    margin-bottom: 10px;
    border-bottom: 1px solid var(--line);
  }
  .mobile-home { display: flex; align-items: center; min-height: 44px; text-align: end; }
  .topbar {
    display: grid;
    grid-template-columns: 44px auto minmax(0, 1fr) auto;
    align-items: center;
    gap: 7px;
    margin-bottom: 12px;
  }
  .topbar > div:first-child { grid-area: 1 / 1 / 2 / -1; min-width: 0; }
  .topbar:has(.role-badge:not([hidden])) > div:first-child { grid-column-end: 4; }
  .topbar :is(.eyebrow, .subtitle) { display: none; }
  .topbar h1 { font-size: clamp(21px, 6vw, 26px); font-weight: 700; line-height: 1.2; }
  .header-actions { display: contents; }
  .header-actions [data-theme-trigger] { grid-area: 2 / 1; width: 44px; padding: 0; }
  .header-actions .theme-trigger-caption { display: none; }
  .header-actions [data-site-language] { grid-area: 2 / 2; min-width: 0; padding-inline: 7px; }
  .header-actions .role-badge { grid-area: 1 / 4; justify-self: end; padding: 4px 7px; font-size: 11px; }
  .header-actions :is(#loginButton, #logoutButton) { grid-area: 2 / 4; padding-inline: 8px; }
  #newRecordButton { grid-area: 2 / 3; padding: 5px 6px; min-width: 0; overflow-wrap: anywhere; }
  .issue-account-actions:has(> :not([hidden])) { grid-area: 3 / 1 / 4 / -1; display: flex; justify-content: flex-end; gap: 7px; flex-wrap: wrap; }

  .stats { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 5px; margin-bottom: 10px; }
  .stat-card {
    display: flex;
    min-height: 65px;
    flex-direction: column;
    justify-content: space-between;
    gap: 2px;
    padding: 8px 6px;
    border-radius: 11px;
  }
  .stat-card::after { display: none; }
  .stat-card > span { margin: 0; font-size: 11px; line-height: 1.2; overflow-wrap: anywhere; }
  .stat-card strong { gap: 2px; align-items: baseline; font-size: clamp(16px, 5vw, 22px); line-height: 1.1; }
  .stat-card small { padding: 0; font-size: 10px; }

  .records-panel { border-radius: 15px; }
  .filters { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; padding: 9px; }
  .filters input, .filters select { display: block; min-width: 0; height: 44px; font-size: 16px; }
  .record-count { grid-column: 1 / -1; justify-content: flex-start; }
  .loading-state, .empty-state { min-height: 176px; padding: 24px 12px; }

  .table-wrap { display: none !important; }
  .mobile-cards { display: grid; gap: 7px; padding: 7px; }
  .record-card {
    position: relative;
    min-width: 0;
    cursor: pointer;
    padding: 11px 12px 5px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: var(--card);
    box-shadow: none;
  }
  .record-card:focus-within { outline: 2px solid var(--blue); outline-offset: -2px; }
  .record-card-top { display: flex; align-items: start; justify-content: space-between; gap: 6px; margin-bottom: 5px; }
  .record-card-top > div { min-width: 0; }
  .record-card :is(h3, p, .record-code, .cell-subtitle) { overflow-wrap: anywhere; }
  .record-card .record-code { font-size: 11px; white-space: normal; }
  .record-card h3 { margin: 2px 0 0; font-size: 16px; line-height: 1.25; }
  .record-card .status { max-width: 47%; padding: 4px 6px; white-space: normal; font-size: 11px; }
  .record-card .status::before { flex: none; }
  .record-card p {
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    overflow: hidden;
    margin: 0 0 7px;
    color: var(--text);
    font-size: 14px;
    line-height: 1.45;
  }
  .record-card-footer {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 6px;
    min-height: 36px;
    padding: 2px 30px 2px 0;
  }
  .record-card-footer .cell-subtitle { flex: 1; min-width: 0; margin: 0; font-size: 12px; }
  .record-card-footer .thumbnail-stack { min-width: 0; }
  .record-card-footer .thumbnail-stack > * { width: 26px; height: 26px; }
  .record-card-footer .thumbnail-stack:has(.thumbnail-placeholder:only-child) { display: none; }
  .record-card-open {
    position: absolute;
    inset: 0;
    width: 100%;
    padding: 0 12px 6px 0;
    display: flex;
    justify-content: flex-end;
    align-items: flex-end;
    border-radius: inherit;
    font-size: 24px;
    line-height: 36px;
  }
  .record-card-open:focus-visible { outline: none; }
  .pagination { flex-wrap: wrap; justify-content: space-between; gap: 6px 12px; padding: 8px; }
  .page-button { min-height: 44px; padding: 6px 9px; }

  .drawer {
    width: 100% !important;
    height: 100dvh;
    box-shadow: none;
    overscroll-behavior-y: contain;
    scroll-padding-block: 88px;
  }
  .drawer-header {
    flex-wrap: wrap;
    min-height: 54px;
    gap: 4px 8px;
    padding: 5px 10px;
  }
  .drawer-kicker { display: none; }
  .drawer-actions { flex-wrap: wrap; gap: 4px; }
  .drawer-header :is(.icon-button, .close-button) { min-width: 44px; min-height: 44px; }
  .drawer-header .icon-button { padding-inline: 8px; font-size: 13px; }
  .drawer-content, .editor-form { padding: 10px; }
  .report-cover { padding: 13px; }
  .report-cover h2 { margin: 7px 0 12px; font-size: 18px; overflow-wrap: anywhere; }
  .report-meta { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .report-meta div { padding: 7px; font-size: 13px; overflow-wrap: anywhere; }
  .report-meta span { font-size: 11px; }
  .report-section { margin-top: 8px; padding: 12px; }
  .report-section h3, .report-section p { font-size: 14px; overflow-wrap: anywhere; }
  .detail-footer { flex-wrap: wrap; gap: 4px 8px; }
  .form-section { margin-bottom: 9px; padding: 12px; }
  .section-heading { margin-bottom: 11px; }
  .section-heading > span { display: none; }
  .section-heading h2 { font-size: 16px; }
  .form-grid { grid-template-columns: minmax(0, 1fr); gap: 9px; }
  .editor-form label, .modal label, .choice-field legend { min-width: 0; font-size: 14px; }
  .form-grid > label { margin: 0; }
  .editor-form label:has(> :is(b, #resolvedDateRequired)) { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 3px; }
  .editor-form label:has(> :is(b, #resolvedDateRequired)) > :is(input, textarea, select) { flex-basis: 100%; }
  .editor-form :is(input, textarea, select), .modal input { min-width: 0; font-size: 16px; }
  .editor-form :is(input:not([type="radio"]), select), .modal input { min-height: 44px; }
  .editor-form textarea { min-height: 88px; }
  .choice-field label { min-height: 44px; }
  .modal-close, .lightbox-close, .preview-remove { min-width: 44px; min-height: 44px; }
  .editor-form .upload-zone input {
    position: absolute;
    display: block;
    min-height: 0;
    width: 1px;
    height: 1px;
    padding: 0;
    clip-path: inset(50%);
  }
  .upload-zone:focus-within { outline: 2px solid var(--blue); outline-offset: 2px; }
  .form-footer {
    bottom: 0;
    gap: 5px;
    margin: 0 -10px -10px;
    padding: 6px 10px max(6px, env(safe-area-inset-bottom));
  }
  .form-footer .button { min-height: 44px; padding-inline: 8px; }
  .form-footer .button.secondary:not([hidden]) { display: inline-flex; align-items: center; }
  .form-footer .form-spacer { display: none; }
  #saveRecordButton { flex: 1; }

  @media (prefers-reduced-motion: reduce) {
    .drawer, .backdrop { transition: none; }
  }
}
