/* ---------------------------------------------------------------------------
   App-level overrides — loaded AFTER the designer's clauseagree.css (style.css).
   Keeping these separate means style.css stays byte-identical to the handoff,
   so a future design update can be dropped in without losing these fixes.
   Each block maps to a finding from the mobile audit.
   --------------------------------------------------------------------------- */

/* 1. Auth cards must not touch the screen edges on small phones (was 0px gutter). */
.ca-auth { padding: 0 16px; }

/* 2. iOS Safari zooms the page when a focused field is under 16px. */
@media (max-width: 640px) {
  .ca-field__input { font-size: 16px; }
}

/* 3. Minimum tap size for inline text links — WCAG 2.2 AA (2.5.8) wants 24x24px.
      "Log out", "Log in", "Register" and the back links were 17-20px. */
.ca-topbar a { min-height: 44px; display: inline-flex; align-items: center; }
a.ca-small { min-height: 24px; }
.ca-auth p a { display: inline-block; padding: 4px 2px; }

/* 4. Comfortable thumb-sized targets on phones and tablets (44px guideline). */
@media (max-width: 900px) {
  .ca-btn, .ca-btn--sm, .ca-btn--ghost { min-height: 44px; }
  .ca-clause-item { min-height: 44px; align-items: center; }
  .ca-sidebar__back { min-height: 44px; }
}

/* 5. Never let a long unbroken string (pasted clause refs, URLs) widen the page. */
.ca-proposal__text,
.ca-position__row,
.ca-base-wording,
.ca-lock__meta { overflow-wrap: anywhere; }

/* 6. Let the top bar wrap instead of crowding when names are long. */
@media (max-width: 480px) {
  .ca-topbar { flex-wrap: wrap; gap: 8px; }
}

/* ---------------------------------------------------------------------------
   Overflow menu ("⋯") for the clause header. Built on <details>/<summary> so it
   works with no JavaScript. Styled only with the designer's own tokens.
   --------------------------------------------------------------------------- */
.ca-menu { position: relative; flex: none; }
.ca-menu > summary {
  list-style: none; cursor: pointer;
  width: 36px; height: 36px;
  display: flex; align-items: center; justify-content: center;
  border-radius: var(--ca-radius-md); color: var(--ca-text-secondary);
}
.ca-menu > summary::-webkit-details-marker { display: none; }
.ca-menu > summary:hover { background: var(--ca-surface-alt); color: var(--ca-text); }
.ca-menu[open] > summary { background: var(--ca-surface-alt); color: var(--ca-text); }
.ca-menu__panel {
  position: absolute; right: 0; top: calc(100% + 6px); z-index: 30; min-width: 190px;
  background: var(--ca-surface); border: 1px solid var(--ca-border);
  border-radius: var(--ca-radius-md); box-shadow: var(--ca-shadow-lg); padding: 6px;
}
.ca-menu__item {
  display: flex; align-items: center; gap: 8px; width: 100%; text-align: left;
  padding: 9px 10px; border: none; background: none; border-radius: var(--ca-radius-sm);
  font-size: 13.5px; font-weight: 600; color: var(--ca-text); cursor: pointer;
}
.ca-menu__item:hover { background: var(--ca-surface-alt); text-decoration: none; }
.ca-menu__item--danger { color: var(--ca-danger); }
.ca-menu__item--danger:hover { background: var(--ca-danger-tint); }
.ca-menu__note { padding: 8px 10px; font-size: 12px; color: var(--ca-text-secondary); }

@media (max-width: 900px) {
  .ca-menu__item { min-height: 44px; }
}
