/* Shared responsive layout. Keep controls inside their cards, not hidden by overflow. */
.showing-row>*,.row-actions,.nav-brand-group,.toolbar-brand,.public-nav-actions,
.login-wrap>*,.login-card,.contract-flow>*,.visit-stop>div,.detail-properties strong,
.document-agent,.agreement-banner>div{min-width:0}
.showing-row .client,.showing-row .property-line,.document-agent,
.client-header-identity,.visit-stop strong{overflow-wrap:anywhere}
.btn,.share-btn{text-align:center}
.close{flex-shrink:0}
body:has(.modal-backdrop){overflow:hidden}
.report-table th:nth-child(1){width:17%}
.report-table th:nth-child(2){width:23%}
.report-table th:nth-child(3){width:30%}
.report-table th:nth-child(4),.report-table th:nth-child(5){width:15%}

@media screen and (max-width:780px){
  .schedule-modal .schedule-client-actions{grid-template-columns:repeat(2,minmax(0,1fr));width:100%;margin-left:0;gap:8px}
  .schedule-modal .schedule-client-actions>.btn{min-width:0;padding:10px 8px;font-size:.85rem;white-space:normal;overflow-wrap:anywhere}
  /* Welcome and login: the video must shrink with the panel. */
  .login-wrap{grid-template-columns:minmax(0,1fr)}
  .login-panel{padding:32px 22px}
  .login-card{width:min(410px,100%)}
  .client-entry-panel .animated-logo-link{width:min(400px,100%)}
  .client-entry-panel .brand{top:0;margin:0 0 32px}
  .login-art{padding:28px 22px;min-height:260px}
  .client-entry-art h1{font-size:clamp(2rem,8vw,3rem)}

  /* Dashboard cards: identity, address, then a full-width action row. */
  .showing-row{grid-template-columns:64px minmax(0,1fr);gap:12px 14px;padding:16px;border-radius:18px}
  .showing-row .date-tile{grid-column:1;grid-row:1;padding:10px 6px;align-self:start}
  .showing-row .client{grid-column:2;grid-row:1}
  .showing-row .client strong{line-height:1.35}
  .showing-row .client span{display:block;margin-top:4px}
  .showing-row .property-line{grid-column:2;grid-row:2;line-height:1.45}
  .showing-row .row-actions{grid-column:1/-1;grid-row:3;justify-content:space-between;gap:10px;padding-top:12px;border-top:1px solid var(--line)}
  .showing-row .row-actions .btn{min-height:44px;max-width:100%;padding:10px 12px;white-space:normal}
  .showing-row .status{flex:0 0 auto}
  .calendar-head{align-items:start;gap:8px;flex-wrap:wrap}
  .calendar-head h2{font-size:1.6rem}
  .calendar-head>div:last-child{margin-left:auto}
  .calendar-day{min-width:0;min-height:52px;padding:5px 0 20px}
  .calendar-day small{right:3px;bottom:3px;min-width:18px;width:auto;padding:0 4px}

  /* Touch targets and Safari form zoom. */
  input:not([type=checkbox]):not([type=radio]),select,textarea{font-size:16px!important}
  .btn,.back-link,.share-btn,.close,.language-switch button,.status-filters button,
  .visit-management select,.password-eye{min-height:44px}
  .close,.password-eye{width:44px;height:44px}
  .password-reveal input{padding-right:54px!important}
  .language-switch button{padding:9px 12px}
  .status-filters button{padding:8px 5px}
  .search-box{min-width:0}.search-box input{min-width:0}

  /* Footer settings are a full-width, equal-size grid. */
  .dashboard-footer{grid-template-columns:minmax(0,1fr);justify-content:stretch;justify-items:stretch;gap:16px}
  .dashboard-footer .footer-identity{text-align:center;justify-items:center}
  .dashboard-footer .footer-settings{width:100%;min-width:0;grid-template-columns:repeat(2,minmax(0,1fr));gap:10px;align-items:stretch}
  .dashboard-footer .footer-settings>.btn{width:100%;min-width:0;height:52px;min-height:52px;padding:8px 10px;font-size:.82rem;line-height:1.3;display:flex;align-items:center;justify-content:center;white-space:normal}

  /* Dialogs use the available screen and preserve scrolling above the keyboard. */
  .modal-backdrop{padding:8px;padding-top:max(8px,env(safe-area-inset-top));padding-bottom:max(8px,env(safe-area-inset-bottom))}
  .modal{max-height:calc(100dvh - 16px);padding:20px 16px;border-radius:18px;overscroll-behavior:contain;-webkit-overflow-scrolling:touch;scroll-padding:20px}
  .modal-head{gap:12px}.modal-head h2{font-size:1.65rem;line-height:1.15}
  .modal-actions{gap:10px}.modal-actions>.btn{min-width:0}
  .detail-properties>div.dated-property{grid-template-columns:30px minmax(0,1fr);gap:8px 10px;padding:14px 12px}
  .dated-property small{grid-column:2;font-size:.85rem;line-height:1.45}
  .dated-property .visit-management{grid-column:2;min-width:0;gap:8px}
  .visit-management select{width:auto;min-width:0;flex:0 1 auto;max-width:100%}
  .visit-history{font-size:.85rem;line-height:1.5}.visit-history summary{padding:12px 0}
  .schedule-drag-handle{top:12px;left:0;transform:none;width:44px;height:44px}
  .detail-actions .btn{min-width:0;width:100%}
  .schedule-modal .share-section{padding:16px 12px}
  .schedule-modal .share-actions{grid-template-columns:repeat(2,minmax(0,1fr))}
  .share-actions>:last-child:nth-child(odd){grid-column:1/-1}
  .property-address{grid-template-columns:28px minmax(0,1fr)}
  .property-address .fixed-location{grid-row:auto}
  .property-address .remove-property{width:44px;height:44px}
  .edit-schedule-row{grid-template-columns:28px minmax(0,1fr)}

  /* Client navigation and agreement reader. */
  .public-nav,.document-toolbar{gap:16px}
  .public-nav .nav-brand-group,.document-toolbar>.toolbar-brand{width:100%;gap:12px;align-items:center}
  .public-nav .back-link{white-space:nowrap;flex:0 0 auto;padding:10px}
  .document-agent{white-space:normal}
  .public-nav .public-nav-actions,.document-toolbar>.public-nav-actions{width:100%;display:flex;flex-direction:row;align-items:center;justify-content:flex-start;gap:8px;flex-wrap:wrap}
  .document-toolbar .public-nav-actions>a{max-width:none;flex:1 1 140px;height:auto;min-height:48px}
  .document-toolbar .status{height:auto;min-height:44px;white-space:normal}
  .document-toolbar .back-link,.document-toolbar .page-exit{min-height:44px;height:auto}
  /* One shared grid keeps Back and Exit level, with a truly centered identity. */
  .document-toolbar{display:grid;grid-template-columns:64px minmax(0,1fr) 64px;align-items:center;gap:12px 8px}
  .document-toolbar>.toolbar-brand,.document-toolbar>.public-nav-actions{display:contents}
  .document-toolbar .back-link,.document-toolbar .page-exit{width:64px;min-width:0;height:44px;min-height:44px;padding:8px 6px;font-size:.78rem;margin:0;align-self:center}
  .document-toolbar .back-link{grid-column:1;grid-row:1}
  .document-toolbar .public-nav-actions>.page-exit{grid-column:3;grid-row:1;justify-self:end}
  .document-toolbar .document-agent{grid-column:2;grid-row:1;text-align:center;justify-items:center;gap:4px}
  .document-toolbar .document-agent strong{font-size:clamp(.85rem,4vw,1rem);line-height:1.25}
  .document-toolbar .document-agent small{font-size:clamp(.64rem,3vw,.72rem);line-height:1.35}
  .document-toolbar .public-nav-actions>.status{grid-column:1/-1;grid-row:2;justify-self:center;min-height:36px;padding:8px 14px}
  .document-toolbar .public-nav-actions>a{grid-column:1/-1;grid-row:auto;width:100%;max-width:none;min-height:44px}
  .confirmation-page .public-nav .public-nav-actions{display:grid;grid-template-columns:minmax(0,1fr) auto;align-items:center;justify-content:stretch}
  .confirmation-page .public-nav-actions>.page-exit{grid-column:2;grid-row:1}
  .confirmation-page .public-nav-actions>.status{grid-column:1;grid-row:1;justify-self:start}
  .confirmation-page .client-header-identity{margin-left:0;gap:8px}
  .confirmation-page .client-header-identity img{width:44px;height:44px;flex-basis:44px}
  .confirmation-hero{padding:26px 20px;gap:18px}
  .confirmation-hero h1{font-size:clamp(1.9rem,8vw,2.8rem);overflow-wrap:anywhere}
  .visit-card,.confirmation-card{padding:24px 16px}
  .visit-card h2,.confirmation-card h2{padding-right:34px;font-size:1.75rem}
  .section-number{font-size:2rem;right:16px}
  .visit-stop{grid-template-columns:26px minmax(0,1fr);gap:10px;padding:14px 12px}
  .agreement-banner{display:grid;grid-template-columns:38px minmax(0,1fr);gap:8px;padding:10px}
  .agreement-banner img{width:38px;height:34px}
  .agreement-banner a{grid-column:1/-1;justify-self:stretch;text-align:center;border:1px solid var(--line);border-radius:8px;padding:11px;min-height:44px;margin:0}
  .agreement-banner strong{font-size:.9rem}.agreement-banner small{font-size:.78rem}
  .agreement-reader{height:clamp(300px,60svh,480px);overscroll-behavior-y:contain}
  .pdf-pages{padding:5px;gap:8px}
  .signature-pad-head{gap:12px;margin-bottom:8px}
  .signature-pad-wrap canvas{height:170px}
  .check,.confirmation-consent,.admin-attestation{line-height:1.55}
  .doc-section,.doc-signature,.doc-audit{padding:22px 16px}
  .doc-summary>div{border-right:0;border-bottom:1px solid var(--line)}
  .toast{left:12px;right:12px;bottom:max(12px,env(safe-area-inset-bottom));text-align:center}
}

.route-selection{font-weight:700;color:var(--ink)}

@media screen and (max-width:600px){
  /* Reports are labeled cards on phones; no sideways scrolling to find the status. */
  .report-table-wrap{overflow:visible;border:0;border-radius:0}
  .report-table,.report-table tbody{display:block;min-width:0;width:100%}
  .report-table thead{position:absolute;width:1px;height:1px;overflow:hidden;clip-path:inset(50%)}
  .report-table tr{display:block;border:1px solid var(--line);border-radius:12px;margin-bottom:12px;padding:6px 12px;background:#fff}
  .report-table td{display:grid;grid-template-columns:90px minmax(0,1fr);gap:4px 12px;padding:10px 0;width:auto}
  .report-table td::before{content:attr(data-label);font-size:.76rem;color:var(--muted);font-weight:700;grid-column:1;grid-row:1/3}
  .report-table td small{grid-column:2;margin-top:0}
  .report-table td:last-child{border-bottom:0}
  .report-inclusions{gap:4px 16px;margin:12px 0}
  .report-inclusions .report-archive{min-height:44px;flex:1 1 240px}
  .report-table td.report-message-text{min-width:0;max-width:none;display:block;white-space:pre-wrap;overflow-wrap:anywhere}
  .report-table td.report-message-text::before{display:block;margin-bottom:6px}
  .visit-message-button{max-width:100%;white-space:normal;overflow-wrap:anywhere;min-height:44px}
  .visit-message-modal .modal{min-width:0;width:min(100%,640px)}
  .visit-message-modal .message-address{overflow-wrap:anywhere}
  .report-downloads{display:grid;grid-template-columns:1fr 1fr}
  .report-summary{gap:8px}.report-summary span{font-size:.82rem}
}
@media screen and (max-width:360px){
  .container{width:calc(100% - 20px)}
  .showing-row{grid-template-columns:52px minmax(0,1fr);gap:10px;padding:14px}
  .showing-row .property-line{grid-column:1/-1}
  .public-nav .nav-brand-group,.document-toolbar>.toolbar-brand{flex-wrap:wrap}
  .calendar-card{padding:16px 8px}.calendar-weekdays,.calendar-grid{gap:2px}
  .stat span{font-size:.7rem}
}
