/* Responsive adjustments only. The original desktop stylesheet stays intact. */
@media (max-width: 850px) {
  .public { grid-template-columns:minmax(0,1fr) minmax(0,1.17fr); gap:28px; }
  .public>*,.dashboard>*,.editor-grid>*,.grid>*,.stats>* { min-width:0; }
  .journey-detail { width:min(680px,100%); }
}
@media (max-width: 620px) {
  html { -webkit-text-size-adjust:100%; }
  body { overflow-wrap:break-word; }
  header { height:auto; min-height:74px; padding:16px 18px; gap:14px; flex-wrap:wrap; }
  .brand { min-width:0; }
  .churchlogo { width:155px; max-width:100%; height:auto; }
  .adminlink { font-size:11px; gap:5px; }
  .adminlink svg { width:16px; }
  .headeractions { width:100%; gap:10px 16px; justify-content:flex-start; align-items:center; flex-wrap:wrap; }
  .headeractions>a:first-child { max-width:none; }
  .headeractions a,.headeractions button { min-height:36px; font-size:12px; }
  .headeractions form { margin:0 0 0 auto; }
  .public { display:grid; grid-template-columns:minmax(0,1fr); padding:28px 18px 36px; gap:24px; }
  .public h1 { font-size:38px; line-height:1.18; letter-spacing:-1.8px; }
  .public .intro { font-size:14px; }
  .formcard { padding:24px 18px; }
  .formheading h2 { font-size:23px; line-height:1.3; }
  .public .grid,.editor-grid { grid-template-columns:minmax(0,1fr); gap:18px; }
  .public .field { grid-column:1 / -1; }
  .public .sectionlabel { margin-top:18px; }
  input,select,textarea { font-size:16px; max-width:100%; min-width:0; min-height:46px; }
  input[type=date] { -webkit-appearance:none; appearance:none; }
  input::placeholder,textarea::placeholder { font-size:13px; }
  label { font-size:13px; }
  button.primary,.primary { min-height:46px; }
  .privacy { font-size:11px; line-height:1.7; }
  .privacy svg { min-width:19px; }
  .dashboard { padding:28px 16px 38px; width:100%; }
  .dashintro { gap:16px; }
  .dashintro h1 { font-size:30px; line-height:1.25; }
  .dashintro p { font-size:13px; }
  .eyebrow { letter-spacing:1.3px; font-size:9px; line-height:1.7; }
  .account-role { overflow-wrap:anywhere; }
  .month-heading { gap:14px; align-items:stretch; }
  .month-heading label { width:100%; min-width:0; }
  .month-heading select { width:100%; }
  .stats { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:10px; }
  .stat { padding:16px 12px; }
  .stat span { display:block; font-size:11px; line-height:1.5; }
  .stat strong { font-size:30px; margin-top:8px; }
  .month-comparison { font-size:10px; line-height:1.6; overflow-wrap:anywhere; }
  .month-note { font-size:11px; }
  .journey-guide { grid-template-columns:minmax(0,1fr); padding:16px; }
  .recordsheading { padding:20px 16px 16px; gap:12px; flex-wrap:wrap; }
  .recordsheading h2 { font-size:19px; line-height:1.35; }
  .recordsheading p { font-size:12px; line-height:1.6; }
  .toolbar { padding:0 16px 20px; gap:12px; }
  .toolbar .search,.toolbar select { width:100%; min-width:0; max-width:none; }
  .search input { font-size:16px; }
  /* The same stage cards are stacked under each visitor on a narrow screen. */
  .journey-dashboard .tablewrap { overflow:visible; padding:0 12px 12px; }
  .journey-table { display:block; min-width:0; width:100%; table-layout:auto; }
  .journey-table thead { position:absolute; width:1px; height:1px; overflow:hidden; clip-path:inset(50%); }
  .journey-table tbody { display:block; }
  .journey-table tbody tr { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:10px; padding:14px; margin:0 0 14px; border:1px solid var(--line); border-radius:12px; background:#fff; }
  .journey-table tbody tr:nth-child(even),.journey-table tbody tr:hover { background:#fff; }
  .journey-table td { display:block; width:auto; min-width:0; padding:0; border:0; white-space:normal; }
  .journey-table td:first-child,.journey-table tbody tr:nth-child(even) td:first-child { position:static; left:auto; z-index:auto; box-shadow:none; background:transparent; padding:0 0 12px; grid-column:1 / -1; border-bottom:1px solid var(--line); }
  .journey-table .person { gap:10px; min-height:44px; }
  .journey-table .person strong { font-size:14px; }
  .journey-table .person small { font-size:11px; }
  .journey-table .avatar { width:34px; height:34px; font-size:13px; }
  .visitor-progress { margin:10px 0 0 44px; }
  .journey-table td[data-stage]::before { content:attr(data-stage); display:block; font-size:11px; font-weight:600; line-height:1.4; margin:2px 0 7px; color:var(--ink); }
  .journey-table .stage-cell { width:100%; min-width:0; min-height:132px; padding:12px 10px; }
  .stage-status { align-items:flex-start; font-size:11px; line-height:1.5; }
  .stage-status svg { flex-shrink:0; margin-top:2px; }
  .stage-cell .cell-owner strong,.stage-deadline,.cell-turma { overflow-wrap:anywhere; }
  .journey-table td:last-child { grid-column:1 / -1; display:flex; flex-wrap:wrap; align-items:center; gap:10px 16px; padding-top:12px; border-top:1px solid var(--line); }
  .journey-table td:last-child a,.journey-table td:last-child button { min-height:44px; margin:0; }
  .journey-table .whatsapp { white-space:normal; }
  .delete-contact[hidden],.savebar[hidden] { display:none!important; }
  .overlay { padding:0; }
  .journey-detail { width:100%; max-width:100%; height:100vh; height:100dvh; padding:28px 18px max(24px,env(safe-area-inset-bottom)); overscroll-behavior:contain; }
  .journey-detail h2 { font-size:25px; padding-right:38px; overflow-wrap:anywhere; }
  .journey-detail>.eyebrow { padding-right:40px; }
  .close.secondary { min-width:40px; min-height:40px; top:16px; right:16px; justify-content:center; }
  .stage-tabs { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); overflow:visible; gap:5px; padding:5px; }
  .stage-tabs button { min-width:0; min-height:46px; padding:9px 4px; font-size:10px; white-space:normal; flex-shrink:1; }
  .stage-tabs button svg { flex-shrink:0; }
  .stage-editor-heading { flex-direction:column; align-items:flex-start; }
  .stage-editor-heading h3 { font-size:20px; line-height:1.4; }
  .editor-grid label { font-size:13px; }
  .journey-detail .visitor-data dl { grid-template-columns:minmax(0,1fr); }
  .due-summary { align-items:flex-start; line-height:1.6; }
  .due-summary svg { flex-shrink:0; margin-top:3px; }
  .savebar { position:static; margin-top:20px; padding-bottom:12px; }
  .savebar .primary { width:100%; }
  .save-feedback { line-height:1.6; }
  .loginpage { padding:28px 18px; min-height:100vh; min-height:100dvh; }
  .logincard { padding:28px 20px; }
  .loginbrand .churchlogo { width:220px; max-width:100%; }
  .password-input button { min-width:44px; min-height:44px; }
  .users-page .tablewrap { padding:0 16px 16px; overflow:visible; }
  .users-page table,.users-page tbody { display:block; width:100%; min-width:0; }
  .users-page thead { position:absolute; width:1px; height:1px; overflow:hidden; clip-path:inset(50%); }
  .users-page tbody tr { display:grid; grid-template-columns:minmax(0,1fr); gap:14px; padding:16px; margin-bottom:12px; border:1px solid var(--line); border-radius:10px; }
  .users-page td { display:block; border:0; padding:0; white-space:normal; overflow-wrap:anywhere; }
  .users-page td select { width:100%; }
  .users-page .user-actions { gap:10px; }
  .user-actions button { min-height:44px; }
  .user-overlay { padding:16px; }
  .user-form-card { padding:28px 20px; max-height:calc(100dvh - 32px); overflow-y:auto; }
  .user-form-card h2 { padding-right:28px; }
  .thanks { margin:7vh auto; padding:28px 18px; }
  footer { margin:0 18px; line-height:1.6; }
}
@media (max-width: 360px) {
  .churchlogo { width:140px; }
  .adminlink { font-size:10px; }
  .public h1 { font-size:34px; }
  .journey-table tbody tr { grid-template-columns:minmax(0,1fr); }
  .journey-table .stage-cell { min-height:0; }
  .stage-tabs button { flex-direction:column; gap:5px; font-size:10px; }
}
