.mobile-nav-toggle {
  display: none;
  position: relative;
  z-index: 30;
  width: 46px;
  height: 46px;
  flex: 0 0 46px;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line-bright);
  border-radius: 0;
  background: rgba(255, 255, 255, 0.035);
  color: var(--white);
  cursor: pointer;
}

.mobile-nav-toggle span {
  position: absolute;
  width: 20px;
  height: 2px;
  background: currentColor;
  transition: transform 160ms ease, opacity 160ms ease, top 160ms ease;
}

.mobile-nav-toggle span:nth-child(1) { top: 15px; }
.mobile-nav-toggle span:nth-child(2) { top: 22px; }
.mobile-nav-toggle span:nth-child(3) { top: 29px; }

.mobile-nav-toggle[aria-expanded="true"] span:nth-child(1) {
  top: 22px;
  transform: rotate(45deg);
}

.mobile-nav-toggle[aria-expanded="true"] span:nth-child(2) { opacity: 0; }

.mobile-nav-toggle[aria-expanded="true"] span:nth-child(3) {
  top: 22px;
  transform: rotate(-45deg);
}

.mobile-nav-toggle:focus-visible,
.header-actions a:focus-visible,
.header-actions button:focus-visible {
  outline: 2px solid var(--green);
  outline-offset: 3px;
}

.mobile-only-label { display: none; }

@media (max-width: 760px) {
  .contract-library-list article,
  .contract-create-form,
  .document-association-fields {
    grid-template-columns: minmax(0, 1fr);
  }

  html { scroll-padding-top: 92px; }

  body {
    overflow-x: hidden;
    -webkit-text-size-adjust: 100%;
  }

  .page-shell {
    width: min(100% - 24px, 1240px);
    min-width: 0;
  }

  .site-header {
    position: relative;
    min-height: 78px;
    gap: 14px;
  }

  .brand {
    min-width: 0;
    flex: 1 1 auto;
  }

  .brand img {
    width: min(225px, 66vw);
    max-width: 100%;
  }

  .mobile-nav-toggle { display: inline-flex; }

  .header-actions {
    display: none;
    position: absolute;
    z-index: 25;
    inset: calc(100% - 1px) 0 auto;
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
    border: 1px solid var(--line-bright);
    border-top: 2px solid var(--green);
    padding: 14px;
    background: rgba(8, 8, 8, 0.985);
    box-shadow: 0 24px 48px rgba(0, 0, 0, 0.55);
  }

  .header-actions[data-open="true"] { display: flex; }

  .header-actions .button,
  .header-actions form,
  .header-actions form .button {
    width: 100%;
  }

  .header-actions .button {
    justify-content: flex-start;
    min-height: 46px;
    padding-inline: 14px;
  }

  .header-actions .account-chip {
    display: flex;
    min-height: 42px;
    align-items: center;
    overflow-wrap: anywhere;
  }

  .mobile-only-label {
    display: inline;
    margin-right: 5px;
    color: var(--muted);
  }

  main,
  .hero-row > div,
  .workspace-grid > *,
  .admin-grid > * {
    min-width: 0;
  }

  .hero-row {
    gap: 20px;
    padding: 34px 0 22px;
  }

  .hero-row h1 {
    margin-top: 9px;
    font-size: clamp(2.15rem, 12vw, 3.2rem);
    line-height: 0.98;
    overflow-wrap: anywhere;
  }

  .section-index,
  .eyebrow {
    letter-spacing: 0.11em;
  }

  .tenant-badge {
    min-width: 0;
    width: 100%;
  }

  .metric-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  }

  .metric-card {
    min-width: 0;
    padding: 15px;
  }

  .metric-card strong { font-size: 1.75rem; }

  .workspace-grid,
  .admin-grid,
  .auth-layout {
    grid-template-columns: minmax(0, 1fr);
  }

  .auth-layout {
    gap: 28px;
    padding: 34px 0 40px;
  }

  .auth-copy h1 {
    font-size: clamp(2.25rem, 12vw, 3.3rem);
    overflow-wrap: anywhere;
  }

  .auth-panel,
  .upload-card,
  .process-card,
  .jobs-card,
  .contract-library-card,
  .onboarding-card,
  .directory-card,
  .invitation-card,
  .timezone-card {
    padding: 20px;
  }

  .card-heading-row,
  .section-heading,
  .batch-results-heading {
    align-items: flex-start;
  }

  .section-heading {
    flex-direction: column;
  }

  .section-heading > .button { width: 100%; }

  .stacked-form input[type="email"],
  .stacked-form input[type="password"],
  .stacked-form input[type="text"],
  .stacked-form select,
  .invitation-link input {
    min-height: 48px;
    font-size: 16px;
  }

  .button {
    min-height: 46px;
    touch-action: manipulation;
  }

  .button-primary { min-height: 52px; }

  .file-drop {
    padding: 20px;
  }

  .file-drop input {
    display: grid;
    gap: 10px;
    min-height: 46px;
  }

  .file-drop input::file-selector-button {
    min-height: 44px;
    margin: 0 0 10px;
    padding: 10px 13px;
  }

  .talon-upload-builder {
    padding: 15px;
  }

  .talon-upload-heading,
  .talon-document-line-heading {
    align-items: flex-start;
    flex-direction: column;
  }

  .talon-upload-counter {
    text-align: left;
  }

  .talon-document-line-fields {
    grid-template-columns: minmax(0, 1fr);
  }

  .talon-document-line-heading .button {
    width: 100%;
  }

  .talon-line-file-input input {
    display: grid;
    gap: 10px;
    min-height: 46px;
  }

  .talon-line-file-input input::file-selector-button {
    min-height: 44px;
    margin: 0 0 10px;
    padding: 10px 13px;
  }

  .process-list li {
    grid-template-columns: 34px minmax(0, 1fr);
    gap: 10px;
  }

  .table-wrap { overflow: visible; }

  .responsive-table,
  .responsive-table tbody,
  .responsive-table tr,
  .responsive-table td {
    display: block;
    width: 100%;
  }

  .responsive-table thead { display: none; }

  .responsive-table tbody {
    display: grid;
    gap: 14px;
  }

  .responsive-table tr {
    overflow: hidden;
    border: 1px solid var(--line);
    border-left: 3px solid var(--green);
    background: rgba(8, 12, 9, 0.72);
  }

  .responsive-table td,
  .responsive-table td:nth-child(3) {
    display: grid;
    grid-template-columns: minmax(88px, 0.36fr) minmax(0, 1fr);
    gap: 12px;
    align-items: start;
    border-top: 1px solid var(--line);
    padding: 13px 14px;
    text-align: left;
  }

  .responsive-table td:first-child { border-top: 0; }

  .responsive-table td::before {
    content: attr(data-label);
    color: var(--green);
    font: 800 0.58rem/1.45 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    letter-spacing: 0.1em;
    text-transform: uppercase;
  }

  .responsive-table td > * { min-width: 0; }

  .responsive-table td small {
    max-width: none;
    white-space: normal;
    overflow: visible;
    text-overflow: clip;
    overflow-wrap: anywhere;
  }

  .responsive-table td time { white-space: normal; }

  .job-actions {
    justify-content: stretch;
    flex-direction: column;
    align-items: stretch;
  }

  .job-actions .button,
  .job-actions .report-pending {
    width: 100%;
    text-align: center;
  }

  .job-actions .report-pending {
    border: 1px solid var(--line);
    padding: 10px;
  }

  .onboarding-form fieldset,
  .timezone-form {
    grid-template-columns: minmax(0, 1fr);
  }

  .onboarding-form .field-wide,
  .timezone-form > .button,
  .timezone-form > .timezone-preview {
    grid-column: auto;
  }

  .customer-list li,
  .batch-result {
    align-items: flex-start;
    flex-direction: column;
  }

  .customer-list li > .status,
  .batch-result > span {
    align-self: flex-start;
  }

  .invitation-link input { overflow-wrap: anywhere; }

  .site-footer {
    gap: 10px;
    padding-bottom: max(8px, env(safe-area-inset-bottom));
  }
}

@media (max-width: 420px) {
  .page-shell { width: min(100% - 18px, 1240px); }

  .site-header { min-height: 72px; }

  .brand img { width: min(205px, 64vw); }

  .mobile-nav-toggle {
    width: 44px;
    height: 44px;
    flex-basis: 44px;
  }

  .metric-grid {
    grid-template-columns: minmax(0, 1fr) !important;
  }

  .metric-card {
    display: grid;
    grid-template-columns: 1fr auto;
    align-items: center;
    gap: 2px 12px;
  }

  .metric-card strong {
    grid-column: 2;
    grid-row: 1 / span 2;
    margin: 0;
  }

  .metric-card small { grid-column: 1; }

  .responsive-table td,
  .responsive-table td:nth-child(3) {
    grid-template-columns: minmax(0, 1fr);
    gap: 7px;
  }

  .auth-panel,
  .upload-card,
  .process-card,
  .jobs-card,
  .onboarding-card,
  .directory-card,
  .invitation-card,
  .timezone-card {
    padding: 17px;
  }

  .card-icon {
    width: 38px;
    height: 38px;
    flex: 0 0 38px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .mobile-nav-toggle span,
  .button,
  .file-drop {
    transition: none;
  }

  .status-processing i,
  .status-awaiting_msa i,
  .status-awaiting_sow i {
    animation: none;
  }
}
