/* Touch forms: avoid automatic focus zoom without disabling pinch zoom. */
@media (pointer:coarse), (max-width:800px) {
  html { -webkit-text-size-adjust:100%; text-size-adjust:100%; scroll-behavior:auto; }
  body input:not([type=checkbox]):not([type=radio]):not([type=range]),
  body select, body textarea, body [contenteditable=true] {
    font-size:16px !important;
    min-width:0;
    max-width:100%;
    scroll-margin-block:24px;
  }
  .form-group, .form-row > * { min-width:0; }
  .form-row, .avatar-options { grid-template-columns:repeat(2,minmax(0,1fr)); }
  dialog input[type=date], dialog input[type=time], dialog input[type=datetime-local] {
    display:block;
    box-sizing:border-box;
    width:100%;
    min-width:0;
    max-width:100%;
    min-height:46px;
    -webkit-appearance:none;
    appearance:none;
  }
  dialog input::-webkit-date-and-time-value { min-width:0; text-align:left; }
  html.modal-scroll-locked { overflow:hidden; overscroll-behavior:none; }
  html.modal-scroll-locked body { overflow:hidden; overscroll-behavior:none; }
  dialog[open] {
    position:fixed;
    inset:auto;
    top:calc(var(--visible-top, 0px) + 10px);
    left:50%;
    transform:translateX(-50%);
    margin:0;
    width:min(540px, calc(100% - 20px));
    max-width:calc(100% - 20px);
    max-height:calc(var(--visible-height, 100dvh) - 20px);
    overflow-y:auto;
    overflow-x:hidden;
    overscroll-behavior:contain;
    scroll-padding-block:20px;
  }
  dialog .modal-header { padding:20px 18px 14px; }
  dialog .modal-body { padding:0 18px 20px; }
  dialog .modal-footer { flex-wrap:wrap; }
  dialog .modal-footer .button { min-height:44px; white-space:normal; }
  .calendar-controls { flex-wrap:wrap; }
  .calendar-date-label { width:auto; flex:1 1 155px; }
  .calendar-filter-label { flex:1 1 155px; }
  .auth-page { min-height:100dvh; }
}

/* Date/time controls need a full row on narrow iPhone screens. */
@media (max-width:600px) {
  dialog .form-row, dialog .avatar-options { grid-template-columns:minmax(0,1fr); gap:0; }
  dialog .modal-header > div, dialog .modal-body, dialog form { min-width:0; }
}

/* Account settings: separate, accessible rows instead of inline text links. */
.account-management { margin-block:20px; }
.account-management h2 { margin-bottom:16px; }
.account-settings-links { display:grid; }
.account-settings-link {
  display:flex; align-items:center; justify-content:space-between; gap:16px;
  min-height:48px; padding:13px 0; border-bottom:1px solid var(--line);
  font-size:14px; line-height:1.45; font-weight:550;
}
.account-settings-link > span:first-child { min-width:0; overflow-wrap:anywhere; }
.account-settings-link > span:last-child { color:var(--purple); font-size:22px; flex-shrink:0; }
.account-settings-link:hover { color:var(--purple); }
.account-legal-links { display:flex; flex-wrap:wrap; gap:0 20px; padding-block:12px; }
.account-legal-links a { display:inline-flex; align-items:center; min-height:44px; color:var(--purple); font-size:12px; text-decoration:underline; text-underline-offset:3px; }
.account-settings-delete { border-top:1px solid var(--line); }
.account-settings-danger { color:#b64952; border-bottom:0; }
.account-settings-danger > span:last-child { color:inherit; }
:root[data-theme="dark"] .account-settings-danger { color:#f497a1; }
