/* Preserve readable content and usable controls across screen sizes. */
.brand, .brand-name, .main-column, .side-column,
.section-heading > div, .progress-list li > div, .document-row > div {
  min-width: 0;
}
.brand img, .header-side > button { flex-shrink: 0; }
.account-name { min-width: 0; overflow-wrap: anywhere; }
.header-side { max-width: 42%; }
.progress-list, .document-row, .retry-panel, .section-description {
  overflow-wrap: anywhere;
}
#documents .documents-empty { margin: 10px 0 0; font-size: 14px; color: #5a6270; }
.document-row a + .download-pdf, .document-row .download-pdf { margin-inline-start: 12px; }
input, button, a { scroll-margin-block: 24px; }

@media (max-width: 980px) {
  input { font-size: 16px; }
  .text-button, .outline-button, .workspace-nav a {
    min-height: 44px; min-width: 44px; display: inline-flex;
    align-items: center; justify-content: center; padding: 8px;
  }
  .workspace-nav a { padding-inline: 0; }
  .document-row a { display: inline-flex; align-items: center; min-height: 44px; padding-block: 8px; }
}

@media (min-width: 721px) and (max-width: 980px) {
  .workspace-grid { grid-template-columns: minmax(0, 1fr); }
  .side-column { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .help-card { grid-column: 1 / -1; }
  .login-layout { gap: 28px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .login-intro h1 { font-size: 31px; }
}

@media (max-width: 720px) {
  .container { width: calc(100% - 32px); }
  .brand-name { overflow-wrap: anywhere; }
  .header-side { max-width: 42%; }
  .login-layout { gap: 28px; padding-top: 24px; }
  .login-panel { order: -1; }
  .login-intro h1 { font-size: 30px; line-height: 1.25; }
  .login-intro h1 br { display: none; }
  .login-intro h1 em::before { content: " "; }
  .login-intro .lead { max-width: none; }
  .login-intro .service-hours-note { max-width: none; }
  .search-card, .progress-card, .history-card { padding: 20px 16px; }
  .section-heading { flex-wrap: wrap; align-items: flex-start; }
  .section-heading > div { flex: 1 1 160px; }
  .badge { white-space: normal; overflow-wrap: anywhere; max-width: 100%; }
  .page-heading h1 { font-size: clamp(25px, 6vw, 30px); }
  .page-heading p, .section-description, .service-hours-note,
  .service-hours-note strong, .availability-copy > span { font-size: 13px; }
  .search-card label, label { font-size: 13px; }
  input { font-size: 16px; min-height: 48px; }
  input::placeholder { font-size: 14px; }
  .input-wrap input { padding-right: 14px; letter-spacing: .04em; }
  .input-wrap > span { position: static; display: block; text-align: right; margin-top: 4px; font-size: 11px; }
  small, .field-error, .step-detail, .document-status { font-size: 12px; }
  .progress-list li { font-size: 13px; }
  .text-button, .outline-button, .workspace-nav a {
    min-height: 44px;
    min-width: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 8px;
    font-size: 13px;
  }
  .workspace-nav a { padding-inline: 0; }
  .password-label { align-items: center; }
  .password-label label { margin: 0; }
  .password-label .text-button { font-size: 13px; }
  .form-actions .primary-button { font-size: 14px; }
  .primary-button { max-width: 100%; white-space: normal; text-align: left; }
  .primary-button span { flex-shrink: 0; }
  .retry-panel button { min-height: 44px; }
  .document-row a { display: inline-flex; align-items: center; min-height: 44px; padding-block: 8px; font-size: 14px; }
  .document-row strong { font-size: 14px; }
  .document-note, .documents-card > .muted, .retry-panel { font-size: 13px; }

  /* Keep every history field on a phone, including the submission date. */
  .history-table, .history-table tbody { display: block; }
  .history-table thead {
    position: absolute; width: 1px; height: 1px; padding: 0;
    overflow: hidden; clip-path: inset(50%); white-space: nowrap;
  }
  .history-table th:nth-child(2) { display: table-cell; }
  .history-table tbody tr {
    display: grid; grid-template-columns: minmax(0, 1fr);
    border: 1px solid var(--line); border-radius: 4px;
    padding: 10px 12px; margin-bottom: 12px;
  }
  .history-table td, .history-table td:nth-child(2) {
    display: flex; align-items: baseline; gap: 12px;
    padding: 5px 0; border: 0; font-size: 13px; overflow-wrap: anywhere;
  }
  .history-table td::before {
    content: attr(data-label); flex: 0 0 76px;
    font-size: 12px; font-weight: 500; color: var(--muted);
  }
  .history-table td:last-child { align-items: center; }
  .history-table .text-button { justify-content: flex-start; padding-left: 0; }
}

@media (max-width: 480px) {
  .brand-row { flex-wrap: wrap; }
  .brand { flex: 1 1 100%; }
  .brand-name { font-size: 16px; }
  .header-side { flex-direction: row; width: 100%; max-width: none; justify-content: space-between; align-items: center; }
  .account-name { max-width: 65%; font-size: 12px; }
  .header-side:has(.private-label) { display: none; }
  .workspace-nav .container { gap: 20px; }
  .login-panel { padding-inline: 20px; }
  .panel-bottom { margin-inline: -20px; padding-inline: 20px; flex-wrap: wrap; }
}

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