.v2-card{min-width:0;overflow-wrap:anywhere}.v2-card h3{margin:18px 0 10px}.v2-card .card h3{margin:0 0 8px}.v2-card button{min-height:44px;max-width:100%;border:1px solid var(--line);border-radius:11px;background:var(--card);padding:10px 12px;color:var(--ink);font:inherit}.v2-card .primary{background:var(--brand);color:white}.v2-card .v2-device{text-align:left;width:100%}.v2-device .meta{display:block}.v2-card input,.v2-card select,.v2-card textarea{min-width:0;max-width:100%;font-size:16px}.v2-card label{font-size:14px}.v2-card dt{color:var(--muted);font-size:14px;margin-top:9px}.v2-card dd{margin:2px 0 0;white-space:pre-wrap}.v2-card p{white-space:pre-wrap}.v2-card fieldset{border:1px solid var(--line);border-radius:14px;margin:12px 0;padding:12px;min-width:0}.v2-card .v2-check{display:flex;align-items:center;gap:10px;min-height:48px}.v2-check input{width:22px;height:22px}.v2-card [data-error]{color:var(--danger);margin-top:12px}.v2-card .modal-actions{min-width:0}

.p5-interval{display:grid;grid-template-columns:minmax(0,1fr) minmax(0,1fr);gap:8px;margin:8px 0 14px}.p5-interval button{grid-column:1/-1}.v2-card input[type=file]{padding:10px 0}.v2-card [hidden]{display:none!important}

.availability-grid{display:grid;grid-template-columns:repeat(7,minmax(0,1fr));gap:4px;margin:16px 0;text-align:center}.availability-grid .availability-day{min-width:0;min-height:52px;padding:4px 0;border-radius:9px;display:flex;flex-direction:column;align-items:center;justify-content:center}.availability-day small{font-size:12px;overflow-wrap:anywhere;max-width:100%}.availability-day.working{background:#d5f2e8;color:#075448}.availability-day.off{background:#edf0ef;color:#4b5753}.availability-day.vacation,.availability-day.blocked{background:#fff0c2;color:#704900}.availability-day.is-today{outline:2px solid #00776a}.availability-day[aria-pressed=true]{box-shadow:inset 0 0 0 3px #005c50}.availability-day:disabled{opacity:.4}.availability-grid+details input{min-width:0}

.service-choices{margin:16px 0;border:1px solid var(--line);padding:12px;border-radius:14px}.service-choices summary{font-weight:700;min-height:44px;padding:10px 0}.service-choice-list{max-height:260px;overflow-y:auto;overscroll-behavior:contain}.service-choice-list .v2-check{font-weight:400;min-height:44px;margin:0;padding:6px 0}.service-choice-list input{flex:0 0 22px}

.directional-view input[type=checkbox]{min-width:22px;min-height:22px}.directional-view .actions{flex-wrap:wrap}.directional-view button{min-height:44px}.direction-toolbar{position:sticky;top:0;background:var(--card,#fff);padding:12px;z-index:2;display:flex;gap:12px;flex-wrap:wrap}.direction-reason{white-space:pre-wrap;overflow-wrap:anywhere}.directional-view [data-places]{display:grid;gap:8px}.direction-entry{margin:8px 0;width:100%}

/* Thumb-friendly visit actions and compact month overview. */
.visit-detail button,.visit-detail a,.direction-confirm button{min-height:44px;min-width:44px;white-space:normal;overflow-wrap:anywhere}
.visit-detail .actions{display:grid;grid-template-columns:1fr;gap:12px;margin:12px 0}
.visit-detail>button{display:block;width:100%;margin:12px 0}
.visit-danger{margin-top:24px;padding-top:16px;border-top:2px solid #dba9a9}
.visit-danger button{color:#9b2323;width:100%;margin-bottom:12px}
.month-nav{display:flex;align-items:center;gap:8px;flex-wrap:wrap;margin:12px 0}
.month-nav button{min-height:44px;min-width:44px;touch-action:manipulation}.month-nav strong{flex:1}
.visit-month-grid{display:grid;grid-template-columns:repeat(7,minmax(0,1fr));gap:3px;max-width:100%}
.visit-month-grid>span{text-align:center;font-size:12px}.visit-month-grid button{min-width:0;min-height:70px;padding:5px 2px;overflow-wrap:anywhere;display:flex;flex-direction:column;align-items:center;gap:3px}
.visit-month-grid small{font-size:10px;line-height:1.2;max-width:100%}
.visit-month-grid .is-today{outline:2px solid #207b74;outline-offset:-3px}.visit-month-grid .is-selected{background:#d1eee8;color:#113e37}
.direction-confirm{max-width:calc(100vw - 40px)}.direction-confirm button{display:block;width:100%;margin-top:12px}
.confirmation-state{overflow-wrap:anywhere}#calendarList .row{flex-wrap:wrap}

/* Shared work-action and dialog system, including dynamically created confirmations. */
button,.btn,a.route-link,.sms-actions a{box-sizing:border-box;min-height:44px;min-width:44px;border-radius:12px;padding:10px 14px;font:inherit;font-weight:600;line-height:1.3;white-space:normal;overflow-wrap:anywhere;max-width:100%;cursor:pointer}
.btn,a.route-link,.sms-actions a{display:inline-flex;align-items:center;justify-content:center;text-decoration:none;border:1px solid #bccbc8;background:#f0f5f3;color:#173e36}
button.secondary,.btn.secondary{background:#edf4f1;color:#173e36;border:1px solid #bccbc8}
button.primary,.btn.primary{background:#0b574c;color:white;border:1px solid #0b574c}
button.neutral,.btn.neutral{background:#fff;color:#334b45;border:1px solid #b7c5c1}
button.danger,.btn.destructive{background:#fff0ef;color:#992720;border:2px solid #b43c31}
button:focus-visible,.btn:focus-visible{outline:3px solid #1668bc;outline-offset:3px}
button:disabled,.btn[aria-disabled="true"]{opacity:.55;cursor:not-allowed}
[hidden]{display:none!important}
dialog{box-sizing:border-box;width:min(620px,calc(100vw - 24px));max-width:calc(100vw - 24px);max-height:calc(100dvh - 24px);padding:16px;overflow-y:auto;overflow-x:hidden;white-space:normal;overflow-wrap:anywhere}
dialog *,dialog *::before,dialog *::after{box-sizing:border-box;min-width:0}
dialog form,dialog fieldset,dialog input:not([type="checkbox"]):not([type="radio"]),dialog select,dialog textarea{max-width:100%;width:100%;min-width:0}
dialog fieldset{margin:12px 0;padding:12px}dialog p,dialog h2,dialog label,dialog summary{white-space:normal;overflow-wrap:anywhere}
dialog .actions,dialog .modal-actions,.sms-actions{display:flex;gap:10px;flex-wrap:wrap}
.confirmation-state{display:block;width:fit-content;max-width:100%;padding:8px 12px;border:2px solid #856015;border-radius:10px;background:#fff4d5;color:#583e08;font-weight:750;overflow-wrap:anywhere}
.confirmation-state.confirmed{background:#dff4e8;color:#174b30;border-color:#2c7650}
.visit-danger{margin-top:24px;padding-top:20px;border-top:2px solid #e8c7c3}.visit-danger>button{width:100%}
#toast{bottom:calc(88px + env(safe-area-inset-bottom));max-width:calc(100vw - 24px);white-space:normal;overflow-wrap:anywhere;pointer-events:none;display:flex;gap:12px;align-items:center;z-index:10000}
#toast button{pointer-events:auto;flex:0 0 44px}#toast:not(.show){pointer-events:none;visibility:hidden}
@media(max-width:440px){dialog .actions,dialog .modal-actions,.sms-actions{flex-direction:column}dialog .actions>* ,dialog .modal-actions>*,.sms-actions>*{width:100%}dialog .p5-interval{display:flex;flex-direction:column}dialog input,dialog select,dialog textarea{font-size:16px}}
/* Seven day columns retain 44px targets even on the 320px phone. */
@media(max-width:440px){dialog:not(.confirm-dialog){width:100vw;max-width:100vw;padding:6px}dialog form{padding:0}.availability-grid{gap:0}.availability-grid .availability-day{min-width:44px}.visit-month-grid{gap:0}.visit-month-grid button{min-width:44px}.screen{padding-left:6px;padding-right:6px}}
button,.v2-card button,.actions button{border-radius:12px;border:1px solid #bccbc8;background:#edf4f1;color:#173e36;font:inherit;font-weight:600;min-height:44px}
button.primary,.v2-card button.primary,.actions button.primary{background:#0b574c;color:#fff;border-color:#0b574c}
button.neutral,.v2-card button.neutral{background:#fff;color:#334b45}
button.danger,.v2-card button.danger,.actions button.danger{background:#fff0ef;color:#992720;border:2px solid #b43c31}
dialog button,dialog .btn{min-width:44px;min-height:44px}.modal-head>.icon-btn{flex:0 0 44px;width:44px;height:44px;padding:8px}
/* One scrolling surface within the safe areas in Safari and standalone. */
:root{--sp-safe-top:env(safe-area-inset-top,0px);--sp-safe-bottom:env(safe-area-inset-bottom,0px)}
dialog{position:fixed;top:calc(var(--sp-safe-top) + 12px);bottom:calc(var(--sp-safe-bottom) + 12px);margin:auto;max-height:calc(100dvh - var(--sp-safe-top) - var(--sp-safe-bottom) - 24px);width:min(620px,calc(100vw - env(safe-area-inset-left,0px) - env(safe-area-inset-right,0px) - 24px));overscroll-behavior:contain}
dialog form{max-height:none;overflow:visible}#modal>form{padding:0}.modal-head{position:sticky;top:-16px;z-index:2;gap:12px;align-items:flex-start;background:#fff;padding:12px 0;margin:0 0 12px}.modal-head h2{min-width:0;overflow-wrap:anywhere;line-height:1.25}.modal-head>.icon-btn{flex:0 0 44px;margin:3px;outline-offset:2px}.exposed-actions>button{width:100%;min-height:44px}

/* All tabs share one content scroller. Navigation is a separate layout row. */
.app-shell{position:fixed;top:var(--sp-frame-top,0px);left:0;right:0;height:var(--sp-frame-height,100dvh);min-height:0;padding-bottom:0;display:flex;flex-direction:column;overflow:hidden}
.app-shell>.topbar{position:relative;flex:none}
.app-shell>main{flex:1;min-height:0;overflow:auto;overscroll-behavior-y:contain}
.app-shell>.bottom-nav{position:relative;inset:auto;transform:none;flex:none;width:100%;backdrop-filter:none;background:#fff}

/* Safari's large vh must not create a second page below the dynamic app viewport. */
body:has(.app-shell:not([hidden])){height:var(--sp-frame-height,100dvh);min-height:0;overflow:hidden}
.app-shell[hidden]{display:none}

html:has(.app-shell:not([hidden])){overflow:hidden}
.sp-keyboard-open .app-shell>.bottom-nav{display:none}

/* Phone work screens fill the available app frame; confirmations remain compact. */
@media(max-width:767px),(pointer:coarse) and (max-height:500px){
 dialog:not(.confirm-dialog){top:var(--sp-frame-top,0px);bottom:auto;left:0;right:0;margin:0;width:100%;max-width:100%;height:var(--sp-frame-height,100dvh);max-height:var(--sp-frame-height,100dvh);border-radius:0;padding:calc(var(--sp-safe-top) + 12px) 12px calc(var(--sp-safe-bottom) + 16px);scroll-padding-top:calc(var(--sp-safe-top) + 80px)}
 #modal{padding:0}
 #modal .modal-head{top:0;margin:0;padding:calc(var(--sp-safe-top) + 12px) 12px 12px;background:#fff}
 #modal #modalBody{padding:0 12px calc(var(--sp-safe-bottom) + 16px)}
 .sp-keyboard-open dialog:not(.confirm-dialog){padding-bottom:16px}
 .sp-keyboard-open #modal #modalBody{padding-bottom:16px}
}

/* SMS template library and editor: scoped presentation only. */
.sms-templates,.sms-template-editor{display:grid;gap:16px;min-width:0}
.sms-templates>p{margin:0}
.sms-template-list{display:grid;gap:12px}
.sms-template-card{display:grid;gap:8px;width:100%;text-align:left;padding:18px;background:#fff;min-width:0}
.sms-template-heading{display:flex;align-items:center;justify-content:space-between;gap:12px}
.sms-template-heading strong{font-size:17px;line-height:1.4}
.sms-template-excerpt{display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:2;overflow:hidden;overflow-wrap:anywhere;font-size:14px;line-height:1.5;font-weight:400;color:#526760}
.sms-template-section,.sms-template-preview{padding:16px;border:1px solid #d7e3df;border-radius:16px;min-width:0}
.sms-template-section textarea{margin-top:8px;font-size:16px;line-height:1.6;min-height:190px}
.sms-template-tokens{margin-top:16px;font-size:14px}
.sms-template-tokens summary{cursor:pointer;padding:8px 0;font-weight:600}
.sms-template-tokens>div{display:flex;flex-wrap:wrap;gap:8px;margin-top:8px}
.sms-template-tokens code{background:#edf4f1;padding:5px 8px;border-radius:6px}
.sms-template-preview{background:#f0f7f4}
.sms-template-preview h3,.sms-template-preview .meta{margin:0 0 8px}
.sms-template-preview [data-template-preview]{white-space:pre-wrap;overflow-wrap:anywhere;line-height:1.6;margin:12px 0 0}
.sms-template-editor .modal-actions{display:grid;gap:10px;margin:0}
.sms-template-footer{padding-top:4px}
