/* Rails adaptation layer: links styled like the prototype's buttons, forms from
   button_to, Active Storage uploads, validation errors, and the sign-in screen. */

a.nav, a.btn, a.link, a.workspace, a.profile, a.thread, a.lead-card, a.stage-overview,
a.activity-row, a.notification, a.cellbtn, a.icon-btn, a.cal-event, a.task-text,
.tabs a, .search-results a, .support a {
  text-decoration: none;
  color: inherit;
}
a.link { color: #50847f; }
a.cal-event, a.lead-card, a.stage-overview, a.notification { display: block; }
a.lead-card { cursor: pointer; }
a.icon-btn { display: inline-flex; align-items: center; justify-content: center; }
.support a { display: inline-flex; align-items: center; gap: 6px; }
.tabs a { display: inline-block; }
.cal-day.today b { color: #1caaa9; }
.thread.unread b { font-weight: 750; }
.thread.unread .body small { color: #1caaa9; font-weight: 650; }

.inline-form, .button_to { display: contents; }
button.toggle { border: 0; cursor: pointer; }
span.toggle[aria-disabled="true"] { opacity: .55; }

turbo-frame#modal { display: contents; }
turbo-frame.board { display: grid; }

.visually-hidden {
  position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}
.checkbox-field { display: flex !important; flex-direction: row !important; align-items: center; gap: 10px; }
.checkbox-field input { width: auto !important; }

.form-errors { margin-bottom: 18px; border-color: #ecc8bf !important; background: #fdf3f0 !important; color: var(--red); }
.form-errors ul { margin: 8px 0 0; padding-left: 18px; }

.doc-row > span:nth-of-type(1) { display: flex; flex-direction: column; gap: 3px; }
.doc-link { color: inherit; font-weight: 600; }
.doc-meta { font-size: 13px; }
.doc-row .pill { margin-left: 0; }
.doc-row > span:nth-of-type(1), .doc-upload { flex: 1; }
.doc-upload { display: flex; justify-content: flex-end; }
.doc-upload-label { cursor: pointer; font-weight: 600; position: relative; }
.doc-upload-label:focus-within { outline: 2px solid #1caaa9; outline-offset: 3px; border-radius: 3px; }
.doc-remove { font-size: 14px; color: var(--red); }

.voicemail + .voicemail { margin-top: 24px; padding-top: 24px; border-top: 1px solid var(--line); }

/* Sign in */
body.auth-page {
  min-height: 100vh;
  background: #e6f7f3 url("/assets/tropical-water-e7c8073f.svg") center bottom / cover no-repeat;
}
.auth-shell {
  min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 32px 16px;
}
.auth-card { width: 100%; max-width: 410px; padding: 34px 32px; }
.auth-brand { display: flex; flex-direction: column; align-items: center; gap: 8px; margin-bottom: 26px; }
.auth-brand .official-logo { width: 170px; height: auto; }
.auth-title { font-size: 24px; text-align: center; }
.auth-sub { text-align: center; margin: 8px 0 24px; }
.auth-form { display: grid; gap: 16px; }
.auth-form .btn { margin-top: 6px; min-height: 42px; }
.auth-links { text-align: center; margin-top: 18px; }
.auth-alert { margin-bottom: 18px; color: var(--red); }
.auth-dev { margin-top: 22px; font-size: 14px; line-height: 1.7; }
.auth-footnote { margin-top: 22px; font-size: 14.5px; color: #4f7f7a; }

/* Larger type: keep short labels on one line */
.card-head h2, .card-head .date-small, .tabs a, .tabs button, .pill, .badge { white-space: nowrap; }
.tabs { overflow-x: auto; scrollbar-width: none; }
@media (max-width: 700px) {
  .tabs > span.small { display: none; }
}
.card-head { flex-wrap: wrap; row-gap: 6px; }

/* Zoom Phone setup */
.zoom-status { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0; margin-bottom: 22px; }
.zoom-status-item { display: flex; gap: 12px; align-items: flex-start; padding: 18px 20px; border-right: 1px solid var(--line); }
.zoom-status-item:last-child { border-right: 0; }
.zoom-status-item p { font-size: 13px; color: var(--muted); margin-top: 3px; }
.status-dot { width: 10px; height: 10px; border-radius: 50%; background: #c8d9d5; margin-top: 6px; flex-shrink: 0; }
.status-dot.on { background: #1caaa9; box-shadow: 0 0 0 4px #1caaa922; }
.status-dot.error { background: var(--red); box-shadow: 0 0 0 4px #ae625422; }
.setup-steps { display: grid; gap: 18px; }
.setup-step { padding: 24px 26px; scroll-margin-top: 20px; }
.step-head { display: flex; gap: 14px; align-items: flex-start; margin-bottom: 18px; }
.step-head p { color: var(--muted); margin-top: 5px; line-height: 1.55; }
.step-num { width: 30px; height: 30px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0;
  background: #e4f6f3; color: #187f7b; font-weight: 700; font-family: Manrope, sans-serif; }
.step-num.done { background: #1caaa9; color: #fff; }
.step-num svg { width: 16px; height: 16px; stroke-width: 2.4; }
.instructions { margin: 0; padding-left: 20px; display: grid; gap: 12px; line-height: 1.65; }
.instructions a { color: #187f7b; font-weight: 600; }
.copy-list { list-style: none; padding: 0; margin: 10px 0 4px; display: grid; gap: 8px; }
.copy-list li { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; }
.copy-field { display: inline-flex; align-items: center; max-width: 100%; border: 1px solid #d8e6e4; border-radius: 6px; background: #f7fbfb; overflow: hidden; vertical-align: middle; }
.copy-field code { padding: 6px 10px; font-size: 13px; overflow-wrap: anywhere; color: #23504b; }
.copy-btn { border-left: 1px solid #d8e6e4 !important; padding: 6px 11px; font-size: 12.5px; font-weight: 600; color: #187f7b; background: #fff !important; align-self: stretch; }
.copy-btn:hover { background: #eaf7f5 !important; }
.notice.warn { margin: 10px 0; background: #fdf7ea; border-color: #ecd9ae; color: #7a5a1f; }
.notice code, .instructions code { font-size: 13px; background: #ffffff99; padding: 1px 5px; border-radius: 4px; }
.zoom-form fieldset, .setup-step fieldset { border: 0; padding: 0; margin: 0; min-width: 0; }
.step-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 18px; }
.scope-checks { list-style: none; padding: 0; margin: 16px 0 0; display: grid; gap: 8px; }
.scope-checks li { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.scope-checks li span { color: var(--muted); font-size: 13px; }
.scope-checks .ok svg { color: #1caaa9; stroke-width: 2.4; }
.scope-checks .missing svg, .scope-checks .missing span { color: var(--red); }
.events-table { margin-top: 18px; border: 1px solid var(--line); border-radius: 8px; }
.events-table code { font-size: 12.5px; }
.zoom-user-select { min-width: 260px; max-width: 100%; padding: 9px 10px; border: 1px solid #d8e6e4; border-radius: 6px; background: #fff; }
.setup-step .person { display: flex; gap: 10px; align-items: center; }
.setup-step .person p { font-size: 13px; color: var(--muted); }
.danger-zone .step-head { margin-bottom: 0; }
.row-actions { display: flex; gap: 8px; justify-content: flex-end; }
@media (max-width: 900px) {
  .zoom-status { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .zoom-status-item:nth-child(2) { border-right: 0; }
  .zoom-status-item:nth-child(-n+2) { border-bottom: 1px solid var(--line); }
}
@media (max-width: 700px) {
  .setup-step { padding: 20px 16px; }
  .setup-step .setting-row { flex-wrap: wrap; gap: 12px; }
  .zoom-user-select { min-width: 0; width: 100%; }
}

/* Docked Zoom Phone dialer */
.zoom-dock { position: fixed; right: 22px; bottom: 22px; z-index: 40; display: flex; flex-direction: column; align-items: flex-end; gap: 10px; }
.zoom-dock-toggle { display: inline-flex; align-items: center; gap: 8px; padding: 12px 18px; border-radius: 30px; background: #0a222e !important;
  color: #fff !important; font-weight: 650; box-shadow: 0 10px 30px #0a222e40; }
.zoom-dock-toggle svg { width: 17px; height: 17px; }
.zoom-dock-panel { width: 360px; background: #fff; border-radius: 12px; box-shadow: 0 20px 60px #15372c40; overflow: hidden;
  position: absolute; right: 0; bottom: 60px; visibility: hidden; opacity: 0; transform: translateY(12px); transition: opacity .15s, transform .15s; }
.zoom-dock-panel.open { visibility: visible; opacity: 1; transform: none; }
.zoom-dock-head { display: flex; justify-content: space-between; align-items: center; padding: 8px 10px 8px 16px; border-bottom: 1px solid var(--line); font-weight: 650; }
.zoom-dock-panel iframe { display: block; width: 360px; height: 600px; border: 0; }
.zoom-pop { background: #0a222e; color: #fff; padding: 12px 16px; display: grid; gap: 3px; }
.zoom-pop[hidden] { display: none; }
.zoom-pop span { color: #b7e3df; font-size: 13px; }
.zoom-pop a { color: #7fe0da; font-weight: 650; margin-top: 4px; }
@media (max-width: 700px) {
  .zoom-dock { right: 12px; bottom: 12px; }
  .zoom-dock-panel, .zoom-dock-panel iframe { width: calc(100vw - 24px); }
  .zoom-dock-panel iframe { height: min(600px, calc(100vh - 150px)); }
}

/* Conversations tab & recordings */
.convo-call { display: flex; gap: 12px; padding: 14px 0; border-bottom: 1px solid var(--line); }
.convo-call:last-child { border-bottom: 0; }
.convo-call .activity-icon { flex-shrink: 0; }
.convo-call-body { flex: 1; min-width: 0; display: grid; gap: 6px; }
.convo-call-top { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.convo-transcript { margin: 4px 0 0; font-size: 13.5px; }
.convo-texts { display: grid; gap: 4px; }
.convo-texts .bubble { max-width: 85%; }
.convo-texts .bubble.sent { justify-self: end; }
.recording { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-top: 4px; }
.recording audio { height: 36px; flex: 1; min-width: 200px; max-width: 360px; }
td .recording { margin-top: 8px; }
td .recording audio { min-width: 220px; }
.recording-status { display: inline-block; font-size: 12.5px; color: var(--muted); margin-top: 4px; }
.recording-status.failed { color: var(--red); }

/* Pagination */
.pagination { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  padding: 14px 20px; border-top: 1px solid var(--line); background: #fbfdfd; font-size: 13.5px; color: #6f8a87; }
.pagination-summary b { color: var(--ink); font-weight: 600; }
.pagination-links { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.page-link { min-width: 34px; height: 34px; padding: 0 10px; display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid #d8e6e4; border-radius: 6px; background: #fff; color: #2c645e; text-decoration: none; font-weight: 550; }
a.page-link:hover { background: #eaf7f5; }
.page-link.current { background: #1caaa9; border-color: #1caaa9; color: #fff; }
.page-link.disabled { color: #b5c6c3; background: #f7fbfb; }
.page-gap { padding: 0 4px; color: #9ab0ad; }
.events-table + .pagination, .card > .pagination:last-child { border-radius: 0 0 9px 9px; }

/* Wide family profile */
.drawer { width: clamp(640px, 55vw, 1180px); max-width: 100vw; }
.drawer .modal-body { padding-left: 32px; padding-right: 32px; }
.drawer-columns { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); gap: 0 40px; align-items: start; }
.drawer-columns > div > .client-section:first-child { margin-top: 0; }
.drawer-columns .client-section { margin-top: 26px; }
.section-link { float: right; font-size: 13px; font-weight: 500; }
.mini-row { display: flex; gap: 10px; align-items: flex-start; padding: 10px 0; border-bottom: 1px solid var(--line); }
.mini-row:last-child { border-bottom: 0; }
.mini-row svg { color: #50847f; margin-top: 2px; }
.mini-row p { font-size: 13px; color: var(--muted); margin-top: 2px; }
.note-preview { white-space: pre-wrap; line-height: 1.6; color: #50665f; }
@media (max-width: 1000px) {
  .drawer-columns { grid-template-columns: minmax(0, 1fr); }
  .drawer-columns > div + div > .client-section:first-child { margin-top: 26px; }
}
@media (max-width: 700px) {
  .drawer { width: 100vw; }
  .drawer .modal-body { padding-left: 18px; padding-right: 18px; }
}

/* Intake drag and drop */
.lane-cards { min-height: 80px; display: grid; align-content: start; }
.lane-empty[hidden] { display: none; }
.lead-card { cursor: grab; user-select: none; -webkit-user-drag: none; }
.lead-card:active { cursor: grabbing; }
.lead-card-ghost { opacity: .35; outline: 2px dashed #1caaa9; outline-offset: -2px; }
.lead-card-chosen { box-shadow: 0 12px 30px #15372c30; }

/* S3 setup */
.copy-block { position: relative; margin: 10px 0 12px; border: 1px solid #d8e6e4; border-radius: 8px; background: #f7fbfb; }
.copy-block pre { margin: 0; padding: 14px 16px; font-size: 12.5px; line-height: 1.55; overflow-x: auto; color: #23504b; }
.copy-block .copy-btn { position: absolute; top: 8px; right: 8px; border: 1px solid #d8e6e4 !important; border-radius: 6px; }
.scope-checks .info svg { color: #7b9ca0; }
.scope-checks .info span { color: var(--muted); }
.two-cols + .drawer-columns { margin-top: 28px; }

/* Manual calling & texting without Zoom */
.dial-link { margin: 18px auto 0; }
.composer-off { display: grid; gap: 12px; justify-items: start; padding: 20px 24px; background: #f7fbfb; }
.composer-off p { line-height: 1.6; }

/* Settings: collapsible sections */
.settings-sections { display: grid; gap: 14px; }
.settings-section { background: #fff; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; scroll-margin-top: 20px; }
.settings-section > summary { display: flex; align-items: center; gap: 16px; padding: 20px 24px; cursor: pointer; list-style: none; }
.settings-section > summary::-webkit-details-marker { display: none; }
.settings-section > summary:hover { background: #f7fbfb; }
.settings-section > summary:focus-visible { outline: 2px solid #1caaa9; outline-offset: -2px; }
.section-icon { width: 42px; height: 42px; border-radius: 10px; background: #e4f6f3; color: #187f7b; display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; }
.section-title { display: grid; gap: 3px; flex: 1; min-width: 0; }
.section-title b { font-family: Manrope, sans-serif; font-size: 17px; font-weight: 700; color: var(--ink); }
.section-title span { color: var(--muted); font-size: 14px; line-height: 1.45; }
.section-status { flex-shrink: 0; }
.section-chevron { color: #7b9c99; transition: transform .2s; flex-shrink: 0; }
.settings-section[open] > summary { border-bottom: 1px solid var(--line); background: #fbfdfd; }
.settings-section[open] .section-chevron { transform: rotate(180deg); }
.section-body { padding: 22px 24px 26px; }
.section-body .zoom-status { margin-bottom: 18px; }
.section-body .setup-steps { gap: 0; }
.section-body .setup-step { border: 0; border-top: 1px solid var(--line); border-radius: 0; box-shadow: none; padding: 24px 0; background: transparent; }
.section-body .setup-steps > .setup-step:first-child { border-top: 0; padding-top: 4px; }
.section-body .setup-step:last-child { padding-bottom: 0; }
.team-meta { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; justify-content: flex-end; }
.roles-list { margin-top: 18px; }
@media (max-width: 700px) {
  .settings-section > summary { padding: 16px; gap: 12px; flex-wrap: wrap; }
  .section-icon { width: 36px; height: 36px; }
  .section-title { flex-basis: calc(100% - 100px); }
  .section-status { order: 3; margin-left: 48px; }
  .section-body { padding: 18px 16px 22px; }
}
.section-body fieldset { border: 0; padding: 0; margin: 0; min-width: 0; }
@media (max-width: 560px) {
  .zoom-status { grid-template-columns: minmax(0, 1fr); }
  .zoom-status-item { border-right: 0 !important; border-bottom: 1px solid var(--line); }
  .zoom-status-item:last-child { border-bottom: 0; }
}

/* Upload progress & locking */
.doc-row { flex-wrap: wrap; }
.doc-row.is-uploading .doc-upload, .doc-row.is-uploading .pill { display: none; }
.upload-progress { flex-basis: 100%; display: grid; gap: 6px; padding: 4px 0 2px 29px; font-size: 13px; color: #2c645e; font-weight: 550; }
.upload-progress progress { width: 100%; height: 8px; appearance: none; border: 0; border-radius: 6px; background: #e4f1ef; overflow: hidden; }
.upload-progress progress::-webkit-progress-bar { background: #e4f1ef; border-radius: 6px; }
.upload-progress progress::-webkit-progress-value { background: #1caaa9; border-radius: 6px; transition: width .2s; }
.upload-progress progress::-moz-progress-bar { background: #1caaa9; border-radius: 6px; }
.upload-progress progress:indeterminate { background: linear-gradient(90deg, #e4f1ef 0%, #9fdcd6 50%, #e4f1ef 100%) 0 0 / 200% 100%; animation: upload-shimmer 1.2s linear infinite; }
.upload-progress progress:indeterminate::-webkit-progress-bar { background: transparent; }
@keyframes upload-shimmer { to { background-position: -200% 0; } }
.drawer.is-busy .tabs, .drawer.is-busy .head-actions, .drawer.is-busy .modal-head .icon-btn,
.drawer.is-busy .doc-row:not(.is-uploading) .doc-upload-label, .drawer.is-busy .doc-row:not(.is-uploading) .doc-remove,
.drawer.is-busy .doc-row:not(.is-uploading) .doc-link { pointer-events: none; opacity: .45; }
input:disabled + * , label:has(input:disabled) { cursor: not-allowed; }

/* PandaDoc settings */
.form-template-list { display: grid; grid-template-columns: minmax(0, 1fr); gap: 10px; margin-bottom: 18px; }
.form-template-list > * { min-width: 0; }
.form-template-row fieldset { display: grid; grid-template-columns: minmax(180px, 1.3fr) minmax(140px, 1fr) minmax(170px, 1fr) auto auto; gap: 14px; align-items: end;
  padding: 14px 16px; border: 1px solid var(--line) !important; border-radius: 8px; background: #fbfdfd; }
.form-template-name { display: flex; gap: 10px; align-items: center; align-self: center; }
.form-template-name svg { color: #50847f; }
.form-template-row .checkbox-field { padding-bottom: 10px; white-space: nowrap; }
.form-template-row .doc-remove { padding-bottom: 10px; }
.template-picker { display: grid; gap: 8px; }
.template-search { max-width: 420px; margin-bottom: 6px; }
.template-option { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.template-option > span:first-child { display: flex; align-items: center; gap: 8px; }
.token-list { grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.template-setup { margin: -4px 0 4px; border: 1px solid var(--line); border-top: 0; border-radius: 0 0 8px 8px; padding: 10px 16px; }
.template-setup > summary { display: flex; gap: 8px; align-items: center; cursor: pointer; flex-wrap: wrap; }
.template-setup-body { padding-top: 14px; }
.template-setup .form-section-title { margin: 14px 0 10px; }
.token-map td { vertical-align: middle; }
.token-map select { width: 100%; max-width: 420px; }
.token-map select.needs-match { border-color: #d97757; }
.field-setup td { vertical-align: middle; }
.field-setup td:first-child { min-width: 180px; }
.field-setup input[type=text], .field-setup select { width: 100%; min-width: 150px; }
.field-setup .checkbox-field { white-space: nowrap; }
.move-stage p { margin: 0 0 16px; }
.move-stage .stage-chip { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.move-next-form .move-next { width: 100%; justify-content: center; gap: 8px; padding: 12px; }
.move-pick { display: flex; gap: 10px; align-items: end; margin-top: 16px; }
.move-pick .field { flex: 1; margin: 0; }
.fill-from-picker { display: block; margin-top: 6px; width: 100%; font-size: 13px; color: var(--muted, #5f7470); }
.prefill-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 10px 16px; }
.prefill-field { align-self: end; }
.send-prefill { margin-top: 14px; border: 1px solid var(--line); border-radius: 8px; padding: 10px 14px; }
.send-prefill > summary { cursor: pointer; font-weight: 600; }
.send-prefill .prefill-grid { margin-top: 12px; }
.send-prefill .notice { margin-top: 10px; }
@media (max-width: 900px) { .form-template-row fieldset { grid-template-columns: 1fr 1fr; } .form-template-name { grid-column: 1 / -1; } }

/* Intake forms on the family profile */
.intake-forms { margin-bottom: 26px; }
.section-btn { float: right; min-height: 32px; padding: 6px 12px; font-size: 13px; }
.form-request .button_to .link { font-size: 13px; }
.form-request-error { display: block; color: var(--red); font-size: 12.5px; margin-top: 3px; }
.checkbox-list { border: 0; padding: 0; margin: 0; display: grid; gap: 10px; }
.checkbox-list legend { margin-bottom: 8px; padding: 0; }
.checkbox-list .checkbox-field { padding: 12px 14px; border: 1px solid var(--line); border-radius: 8px; }
.instructions + form, .instructions + .notice { margin-top: 16px; }

/* Required documents settings */
.section-intro { line-height: 1.6; margin-bottom: 16px; }
.doc-type-list { display: grid; gap: 8px; }
.doc-type-row { display: flex; align-items: center; gap: 12px; padding: 10px 14px; border: 1px solid var(--line); border-radius: 8px; background: #fff; }
.doc-type-row.archived { justify-content: space-between; background: #fbfdfd; margin-top: 8px; }
.drag-handle { cursor: grab; color: #9bb5b2; font-size: 16px; letter-spacing: -3px; padding: 4px 2px; user-select: none; }
.doc-type-form { flex: 1; min-width: 0; }
.doc-type-form fieldset { display: grid; grid-template-columns: minmax(160px, 1fr) minmax(160px, 1.3fr) auto; gap: 12px; align-items: center; }
.doc-type-form .field input { margin: 0; }
.required-toggle { white-space: nowrap; }
.doc-type-count { white-space: nowrap; min-width: 52px; text-align: right; }
.doc-type-add { display: grid; grid-template-columns: minmax(180px, 1fr) minmax(180px, 1.3fr) auto auto; gap: 12px; align-items: end; margin-top: 18px;
  padding-top: 18px; border-top: 1px solid var(--line); }
.doc-type-add .checkbox-field { padding-bottom: 10px; white-space: nowrap; }
.archived-docs-head { margin: 26px 0 6px; font-size: 15px; }
@media (max-width: 900px) {
  .doc-type-row { flex-wrap: wrap; }
  .doc-type-form fieldset, .doc-type-add { grid-template-columns: 1fr; }
}
.doc-download { min-height: 32px; padding: 6px 12px; font-size: 13px; }
.managed-pill { white-space: nowrap; }

/* Intake form */
.form-section-title { font-size: 15px; margin: 22px 0 12px; padding-top: 18px; border-top: 1px solid var(--line); }
.modal-body > .form-section-title:first-of-type, .form-errors + .form-section-title { margin-top: 0; padding-top: 0; border-top: 0; }
.form-grid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.field-hint { display: block; font-size: 12px; color: var(--muted); margin-top: 4px; font-weight: 400; }
.new-facility[hidden] { display: none; }
.pill.teal { background: #def3f2; color: #13706e; }
.pill.rose { background: #fbe9e7; color: #9a4a42; }
@media (max-width: 700px) { .form-grid.three { grid-template-columns: 1fr; } }
.detail-list .span-2 { grid-column: 1 / -1; }
.pre-line { white-space: pre-line; }
.insurance-list { margin-bottom: 4px; }

/* Intake stages & option lists */
.stage-swatch { display: inline-block; width: 12px; height: 12px; border-radius: 50%; background: var(--stage); flex-shrink: 0; }
.stage-form fieldset { grid-template-columns: minmax(140px, 1fr) minmax(180px, 1.4fr) 110px 120px; }
.stage-form input, .stage-form select, .option-form input, .option-add input, .doc-type-form input {
  width: 100%; padding: 9px 11px; border: 1px solid #d8e6e4; border-radius: 6px; background: #fff; }
.stage-add { grid-template-columns: minmax(150px, 1fr) minmax(170px, 1.3fr) 120px 130px auto; }
.option-form fieldset { grid-template-columns: 1fr; }
.option-list + .option-list { margin-top: 28px; padding-top: 24px; border-top: 1px solid var(--line); }
.option-list-title { font-size: 16px; margin-bottom: 4px; }
.option-list > p { margin-bottom: 12px; }
.option-add { display: flex; gap: 10px; margin-top: 10px; max-width: 520px; }
.option-add input { flex: 1; }
.doc-type-row .button_to button[disabled] { opacity: .4; cursor: not-allowed; }
@media (max-width: 900px) { .stage-form fieldset, .stage-add { grid-template-columns: 1fr 1fr; } }

/* Family profile — clearer structure */
.drawer .modal-head { gap: 14px; justify-content: flex-start; }
.drawer .modal-head .modal-title { flex: 1; min-width: 0; }
.drawer .modal-head .modal-title h2 { font-size: 22px; }
.drawer .modal-head > .avatar { width: 48px; height: 48px; font-size: 16px; flex-shrink: 0; }
.family-profile { padding-top: 18px; }
.profile-bar { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap;
  padding-bottom: 18px; border-bottom: 1px solid var(--line); }
.profile-pickers { display: flex; gap: 12px; flex-wrap: wrap; }
.picker label { display: grid; gap: 5px; font-size: 12px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .4px; }
.picker select { min-width: 180px; padding: 9px 34px 9px 12px; border: 1px solid #d8e6e4; border-radius: 8px; background-color: #fff;
  font-size: 14.5px; font-weight: 600; color: var(--ink); text-transform: none; letter-spacing: 0; }
.picker select[name="client[intake_stage_id]"] { border-left: 4px solid var(--stage); }
.profile-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.status-tiles { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin: 18px 0 6px; }
.status-tile { display: grid; gap: 4px; align-content: start; padding: 14px 16px; border: 1px solid var(--line); border-radius: 10px;
  background: #fbfdfd; text-decoration: none; color: var(--ink); transition: border-color .15s, background .15s; }
.status-tile:hover { border-color: #b9dcd8; background: #f2faf8; }
.status-tile.attention { background: #fffbf3; border-color: #f0e2c4; }
.status-label { font-size: 12px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .4px; }
.status-tile b { font-family: Manrope, sans-serif; font-size: 17px; }
.status-sub { font-size: 13px; color: var(--muted); line-height: 1.4; }
.step-dots { display: flex; gap: 5px; margin-top: 4px; }
.step-dots i { width: 22px; height: 6px; border-radius: 4px; background: #e2ecea; }
.step-dots i.done { background: var(--stage); }
.profile-tabs { margin-top: 16px; }
.info-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.info-card { border: 1px solid var(--line); border-radius: 10px; padding: 16px 18px; background: #fff; }
.info-card.wide { grid-column: 1 / -1; }
.info-card header { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; margin-bottom: 10px; }
.info-card header h3 { font-size: 15.5px; }
.info-card header .link { font-size: 13px; }
.card-links { display: flex; gap: 14px; }
.info-card dl { margin: 0; display: grid; gap: 10px; }
.info-card dl > div { display: grid; grid-template-columns: 130px minmax(0, 1fr); gap: 10px; align-items: baseline; }
.info-card dt { font-size: 13px; color: var(--muted); }
.info-card dd { margin: 0; font-size: 14.5px; color: var(--ink); overflow-wrap: anywhere; }
.consent-line { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.consent-line .link { font-size: 13px; }
.info-card .mini-row:first-of-type { padding-top: 0; }
@media (max-width: 1000px) { .info-grid { grid-template-columns: 1fr; } }
@media (max-width: 700px) {
  .status-tiles { grid-template-columns: 1fr; }
  .profile-bar { align-items: stretch; }
  .picker select { min-width: 0; width: 100%; }
  .info-card dl > div { grid-template-columns: 1fr; gap: 2px; }
}

/* Stage checklists — settings */
.stage-block + .stage-block { margin-top: 8px; }
.stage-checklist { margin: 6px 0 0 42px; }
.stage-checklist > summary { cursor: pointer; font-size: 13.5px; color: #3d7f78; font-weight: 600; padding: 4px 0; list-style-position: inside; }
.stage-checklist[open] > summary { margin-bottom: 8px; }
.checklist-editor { display: grid; gap: 6px; }
.checklist-item-row { display: flex; align-items: center; gap: 10px; padding: 8px 12px; border: 1px dashed #d8e6e4; border-radius: 8px; background: #fbfdfd; }
.checklist-item-form { flex: 1; min-width: 0; }
.checklist-item-form fieldset { border: 0; padding: 0; margin: 0; display: grid; grid-template-columns: minmax(180px, 1.4fr) minmax(200px, 1fr) auto; gap: 10px; }
.checklist-item-form input, .checklist-item-form select, .checklist-item-add input, .checklist-item-add select {
  width: 100%; padding: 8px 10px; border: 1px solid #d8e6e4; border-radius: 6px; background: #fff; font-size: 14px; }
.checklist-item-add { display: grid; grid-template-columns: minmax(200px, 1.4fr) minmax(190px, 1fr) minmax(170px, 1fr) auto; gap: 10px; margin: 10px 0 6px; }
@media (max-width: 900px) {
  .stage-checklist { margin-left: 0; }
  .checklist-item-form fieldset, .checklist-item-add { grid-template-columns: 1fr; }
}

/* Stage checklists — family profile & board */
.checklist { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.checklist-step { display: flex; align-items: flex-start; gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.checklist-step:last-child { border-bottom: 0; }
.checklist-step .button_to { display: contents; }
.check-box { width: 24px; height: 24px; flex-shrink: 0; border-radius: 6px; border: 2px solid #b9cfcc !important; background: #fff !important;
  display: inline-flex; align-items: center; justify-content: center; cursor: pointer; padding: 0; color: #fff; }
.check-box:hover { border-color: #1caaa9 !important; }
.check-box.checked, .check-box.auto { background: #1caaa9 !important; border-color: #1caaa9 !important; }
.check-box.auto { background: #7fcdc7 !important; border-color: #7fcdc7 !important; cursor: default; }
.check-box svg { width: 15px; height: 15px; stroke-width: 3; }
.step-text { display: grid; gap: 2px; padding-top: 2px; }
.step-name { font-size: 14.5px; }
.checklist-step.done .step-name { color: #6f8a87; }
.step-text small { font-size: 12.5px; color: var(--muted); }
.checklist.compact .checklist-step { padding: 5px 0; }
.checklist.compact .check-box { width: 20px; height: 20px; }
.all-stages { margin-top: 12px; border-top: 1px solid var(--line); padding-top: 10px; }
.all-stages > summary { cursor: pointer; font-size: 13.5px; color: #3d7f78; font-weight: 600; }
.stage-steps { margin-top: 12px; }
.stage-steps h4 { display: flex; align-items: center; gap: 8px; font-size: 14px; margin-bottom: 4px; }
.stage-steps.current h4 { color: #13706e; }
.lead-checklist { display: inline-flex; align-items: center; gap: 3px; color: #8aa3a0; font-size: 12px; }
.lead-checklist svg { width: 13px; height: 13px; }
.lead-checklist.complete { color: #1caaa9; font-weight: 600; }

/* Intake lane cards — just the essentials */
.lead-card .lead-name { display: block; font-size: 15px; font-weight: 650; color: var(--ink); margin-bottom: 8px; line-height: 1.3; }
.lead-details { margin: 0; display: grid; gap: 5px; }
.lead-details > div { display: grid; grid-template-columns: 46px minmax(0, 1fr); gap: 4px; align-items: baseline; }
.lead-details dt { font-size: 10.5px; color: #8aa3a0; text-transform: uppercase; letter-spacing: .2px; }
.lead-details dd { margin: 0; font-size: 13.5px; color: #3c5552; overflow-wrap: break-word; }
.lead-details dd.nowrap { white-space: nowrap; font-variant-numeric: tabular-nums; }
.lead-details > div:last-child { grid-template-columns: 1fr; gap: 1px; margin-top: 2px; }
.sortable-fallback { opacity: .9 !important; box-shadow: 0 16px 36px #15372c33; transform: rotate(1.5deg); }

/* Team directory */
.team-table td { vertical-align: middle; }
.team-table .person small { display: block; }
.team-table .pill + .pill { margin-left: 6px; }
.team-table tr.is-deactivated td { color: #8aa3a0; }
.team-table tr.is-deactivated .avatar { opacity: .5; }
.team-table .actions-cell { text-align: right; }
.team-table .row-actions { display: inline-flex; align-items: center; white-space: nowrap; gap: 14px; }
.team-table .row-actions .link { font-size: 13px; }
.actions-col { width: 1%; }
.roles-details { margin-top: 18px; }
.roles-details > summary { cursor: pointer; font-weight: 600; color: #3d7f78; }
.roles-details .detail-list { margin-top: 10px; }

/* Sign in with Google */
.google-button { display: flex; align-items: center; justify-content: center; gap: 10px; background: #fff; border: 1px solid #d5e3e0; color: #1f1f1f; font-weight: 600; min-height: 46px; }
.google-button:hover { background: #f6faf9; border-color: #b9cfcb; }
form.button_to:has(.google-button) { margin: 6px 0 0; }
.auth-divider { display: flex; align-items: center; gap: 12px; margin: 22px 0 6px; color: #7f9895; font-size: 13px; }
.auth-divider::before, .auth-divider::after { content: ""; flex: 1; height: 1px; background: #dfe9e7; }

.zoom-dock-hint { margin: 0; padding: 6px 14px; font-size: 12px; color: #5f7a77; background: #f4f9f8; border-bottom: 1px solid #e3eeec; }
.zoom-dock-hint a { color: #2d8a80; font-weight: 600; }

/* Call recordings */
.recording-filters { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px; }
.recording-filters .searchfield { flex: 1 1 260px; }
.field.compact { font-size: 12.5px; gap: 4px; min-width: 140px; }
.recordings-table td { vertical-align: middle; }
.recordings-table small { color: #6e8b89; font-size: 12.5px; }
.recordings-table small.block, .recordings-table .when small { display: block; }
.recordings-table .call-parties { display: grid; gap: 2px; margin-top: 6px; font-size: 13.5px; }
.recordings-table .player { display: flex; align-items: center; gap: 6px; min-width: 330px; }
.recordings-table audio { height: 36px; width: 280px; }
.empty-card { padding: 28px; display: grid; gap: 10px; justify-items: start; }

/* Wider intake lanes so card details aren't crammed; the board scrolls sideways when they don't all fit */
.board { grid-template-columns: repeat(var(--lanes, 5), minmax(320px, 1fr)); gap: 16px; scroll-snap-type: x proximity; scroll-padding-left: 2px; }
.lane { scroll-snap-align: start; padding: 14px; }

/* The board fits the screen; each lane scrolls on its own instead of the page growing */
.board { height: max(440px, calc(100dvh - 385px)); min-height: 0; align-items: stretch; }
.board .lane { display: flex; flex-direction: column; min-height: 0; align-self: stretch; }
/* Lanes only scroll vertically, so sideways scrolling over a lane moves the board to other lanes */
.board .lane-cards { flex: 1; min-height: 0; overflow-x: hidden; overflow-y: auto; overscroll-behavior-x: auto; overscroll-behavior-y: contain; margin: 0 -6px; padding: 0 6px 4px; scrollbar-width: thin; }
.board .lane > .link.full-button { flex: none; }
.lead-details > div { grid-template-columns: 64px minmax(0, 1fr); gap: 8px; }
.lead-details dd { font-size: 14px; }
@media (max-width: 700px) {
  .board { grid-template-columns: repeat(var(--lanes, 5), 270px); }
}

/* Texts tab: live SMS thread + direct composer */
.sms-panel h3 .pill { margin-left: 6px; vertical-align: middle; }
.sms-thread { display: flex; flex-direction: column; gap: 2px; max-height: min(52vh, 520px); min-height: 220px; overflow-y: auto; padding: 14px 4px 10px; margin-bottom: 12px; background: #f7fbfa; border: 1px solid #e3eeec; border-radius: 10px; }
.sms-thread:has(.message-row) .thread-empty { display: none; }
.message-row { display: flex; flex-direction: column; align-items: flex-start; padding: 0 10px; }
.message-row.sent { align-items: flex-end; }
.message-row .bubble { max-width: 78%; white-space: pre-wrap; overflow-wrap: anywhere; }
.message-row .message-time { margin-bottom: 8px; }
.sms-panel .composer textarea { width: 100%; resize: vertical; min-height: 76px; }
.unread-badge { background: #2fb3a5; color: #fff; }
.call-log .convo-call + .convo-call { border-top: 1px solid #e8f0ee; padding-top: 12px; margin-top: 12px; }

/* State workspace switcher (sidebar) */
.state-switcher { position: relative; margin-bottom: 4px; }
.state-switcher > summary { list-style: none; cursor: pointer; }
.state-switcher > summary::-webkit-details-marker { display: none; }
.state-switcher[open] > summary svg:last-child { transform: rotate(180deg); }
.state-switcher > summary .avatar { font-weight: 700; font-size: 12.5px; letter-spacing: .3px; }
.state-menu { position: absolute; z-index: 40; left: 0; right: 0; top: calc(100% + 6px); background: #fff; border: 1px solid #dbe8e5; border-radius: 12px; box-shadow: 0 16px 40px #0f2a2626; padding: 8px; max-height: 70vh; overflow-y: auto; }
.state-menu-label { font-size: 11.5px; text-transform: uppercase; letter-spacing: .5px; color: #7f9895; padding: 6px 10px 8px; margin: 0; }
.state-menu form.button_to { margin: 0; }
.state-option { display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 10px; border: 0; border-radius: 8px; background: transparent; text-align: left; cursor: pointer; color: var(--ink); font: inherit; }
.state-option:hover, .state-option:focus-visible { background: #eef7f5; }
.state-option.current { background: #e3f4f0; }
.state-option > span:nth-child(2) { flex: 1; display: grid; }
.state-option small { color: #6e8b89; font-size: 12px; }
.state-code { display: inline-grid; place-items: center; min-width: 34px; height: 30px; padding: 0 6px; border-radius: 8px; background: #dff3eb; color: #1f6f66; font-weight: 700; font-size: 12.5px; letter-spacing: .3px; }
.state-code.all svg { width: 16px; height: 16px; }
.state-check { width: 16px; height: 16px; color: #2fb3a5; }
.state-manage { display: flex; align-items: center; gap: 8px; margin-top: 6px; padding: 10px; border-top: 1px solid #e8f0ee; color: #3d7f78; font-weight: 600; font-size: 13.5px; text-decoration: none; }
.state-manage svg { width: 16px; height: 16px; }
.setting-row.is-archived { opacity: .6; }
.inline-add { display: flex; gap: 10px; margin-top: 14px; align-items: center; }
.inline-add select { max-width: 280px; }

/* Address autocomplete */
.address-field { position: relative; display: grid; gap: 6px; }
.address-suggestions { position: absolute; z-index: 30; left: 0; right: 0; top: 100%; margin: 4px 0 0; padding: 6px; list-style: none; background: #fff; border: 1px solid #d5e3e0; border-radius: 10px; box-shadow: 0 12px 30px #0f2a2622; }
.address-suggestions li { display: grid; padding: 8px 10px; border-radius: 7px; cursor: pointer; }
.address-suggestions li b { font-weight: 600; color: var(--ink); }
.address-suggestions li span { font-size: 12.5px; color: #6e8b89; }
.address-suggestions li:hover, .address-suggestions li.active { background: #eef7f5; }

/* Roles & permissions matrix */
.permissions-table td, .permissions-table th { vertical-align: middle; }
.permissions-table td small, .permissions-table th small { display: block; color: #6e8b89; font-size: 12.5px; font-weight: 400; margin-top: 2px; }
.permissions-table .role-col { text-align: center; width: 150px; }
.perm-check { display: inline-grid; place-items: center; width: 30px; height: 30px; border-radius: 8px; border: 1px solid #d5e3e0; background: #fff; color: #a7b8b5; padding: 0; cursor: pointer; }
.perm-check svg { width: 16px; height: 16px; }
.perm-check.on { background: #2fb3a5; border-color: #2fb3a5; color: #fff; }
.perm-check.locked { background: #dff3eb; border-color: #dff3eb; color: #1f6f66; cursor: default; }
span.perm-check { cursor: default; }

/* Fax inbox */
.fax-layout { display: grid; grid-template-columns: minmax(260px, 340px) 1fr; gap: 16px; align-items: start; }
.fax-list-card { padding: 6px; }
.fax-row { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border-radius: 9px; text-decoration: none; color: var(--ink); }
.fax-row:hover { background: #f1f8f6; }
.fax-row.selected { background: #e3f4f0; }
.fax-row.unread b::after { content: ""; display: inline-block; width: 7px; height: 7px; margin-left: 7px; border-radius: 50%; background: #2fb3a5; vertical-align: middle; }
.fax-row-body { display: grid; gap: 1px; }
.fax-row-body small { color: #6e8b89; font-size: 12.5px; }
.fax-row-body .fax-filed { color: #2d8a80; }
.fax-icon { display: inline-grid; place-items: center; width: 32px; height: 32px; border-radius: 8px; background: #eef6f4; color: #3d7f78; flex: none; }
.fax-icon svg { width: 16px; height: 16px; }
.fax-viewer { padding: 18px; }
.fax-viewer-head { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; margin-bottom: 12px; }
.fax-frame { width: 100%; height: min(70vh, 760px); border: 1px solid #e3eeec; border-radius: 8px; background: #f7fbfa; }
.fax-details { white-space: pre-wrap; font-size: 13px; background: #f7fbfa; padding: 12px; border-radius: 8px; max-height: 300px; overflow: auto; }
.fax-file-form { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 14px; padding-top: 14px; border-top: 1px solid #e8f0ee; }
.fax-file-form .full { grid-column: 1 / -1; }
@media (max-width: 900px) { .fax-layout { grid-template-columns: 1fr; } .fax-file-form { grid-template-columns: 1fr; } }
.fax-access-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 8px 16px; border: 0; padding: 0; margin: 0; }
.fax-access-list .checkbox-field { display: flex; align-items: center; gap: 8px; }
.fax-intake { display: flex; justify-content: space-between; align-items: center; gap: 14px; margin-top: 14px; padding: 14px; border-radius: 10px; background: #eef7f5; }
.fax-intake p { margin: 2px 0 0; }
.fax-source { display: flex; gap: 8px; align-items: flex-start; margin-bottom: 14px; }
.fax-source svg { width: 16px; height: 16px; flex: none; margin-top: 2px; }

/* Roles & permissions */
.role-list { display: grid; gap: 12px; }
.role-card { border: 1px solid #e3eeec; border-radius: 10px; padding: 14px 16px; background: #fff; }
.role-card-head { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; }
.role-card-head p { margin: 3px 0 0; }
.role-card-actions { display: inline-flex; gap: 12px; align-items: center; white-space: nowrap; }
.role-perms { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.perm-chip { font-size: 12px; padding: 3px 9px; border-radius: 999px; background: #f2f6f5; color: #9aaeab; text-decoration: line-through; }
.perm-chip.on { background: #e3f6ef; color: #237a6d; text-decoration: none; }
.perm-options { display: grid; gap: 8px; }
.perm-option { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border: 1px solid #e3eeec; border-radius: 9px; cursor: pointer; }
.perm-option:has(input:checked) { border-color: #9fd9cf; background: #f2faf8; }
.perm-option input { margin-top: 3px; }
.perm-option span { display: grid; gap: 2px; }
.perm-option small { color: #6e8b89; font-size: 12.5px; }

/* Facility fax numbers */
.fax-facility-form { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-bottom: 12px; padding: 12px 14px; border-radius: 10px; background: #fbf6ea; border: 1px solid #f0e2bf; }
.fax-facility-form > .small { flex: 1 1 100%; }
.fax-facility-form select, .fax-facility-form input[type=text] { max-width: 260px; }
.facility-fax-numbers { flex-basis: 100%; display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: 6px 0 2px 26px; }
.fax-number-chip { display: inline-flex; align-items: center; gap: 4px; padding: 3px 4px 3px 9px; border-radius: 999px; background: #eef6f4; color: #2c645e; font-size: 12.5px; font-variant-numeric: tabular-nums; }
.fax-number-chip svg { width: 12px; height: 12px; }
.fax-number-chip form { margin: 0; }
.chip-remove { border: 0; background: transparent; color: #7f9895; cursor: pointer; padding: 0 5px; font-size: 14px; line-height: 1; }
.chip-remove:hover { color: #ae6b5d; }
.fax-number-add { display: inline-flex; gap: 6px; align-items: center; }
.fax-number-add input { width: 150px; padding: 4px 8px; font-size: 12.5px; }
.doc-type-row:has(.facility-fax-numbers) { flex-wrap: wrap; }

/* Audit log */
.audit-table td { vertical-align: top; }
.audit-table small.block { display: block; color: #6e8b89; font-size: 12px; }
.audit-table .nowrap { white-space: nowrap; }

/* Split dialog: a fax beside the intake form */
.modal.modal-split { width: min(1560px, 97vw); height: 94vh; max-height: 94vh; overflow: hidden; display: flex; flex-direction: column; }
.modal-split > .modal-head { flex: none; padding: 16px 24px; }
.split-dialog { flex: 1; min-height: 0; display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(460px, 1fr); }
.split-fax { display: flex; flex-direction: column; min-height: 0; background: #eef3f2; border-right: 1px solid var(--line); }
.split-fax-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 10px 16px; background: #fff; border-bottom: 1px solid var(--line); font-size: 14px; }
.split-fax-head svg { width: 16px; height: 16px; vertical-align: -3px; }
.split-fax-head small { color: #6e8b89; margin-left: 6px; }
.split-fax iframe { flex: 1; width: 100%; min-height: 0; border: 0; background: #e6ecea; }
.split-form { min-height: 0; overflow-y: auto; display: flex; flex-direction: column; }
.split-form > form { display: flex; flex-direction: column; flex: 1; }
.split-form .modal-body { flex: 1; }
.modal-split .modal-footer { position: sticky; bottom: 0; background: #fff; z-index: 2; box-shadow: 0 -6px 14px #0f2a260d; }
@media (max-width: 960px) {
  .modal.modal-split { height: auto; max-height: 96vh; overflow-y: auto; }
  .split-dialog { display: block; }
  .split-fax { height: 55vh; border-right: 0; border-bottom: 1px solid var(--line); }
  .split-form { overflow: visible; }
}

/* ---- Family profile: centered popup (zooms in over a blurred page), or a full page ---- */
.drawer-scrim { justify-content: center; align-items: center; padding: 3vh 3vw; background: #0f2a2470; backdrop-filter: blur(10px) saturate(120%); -webkit-backdrop-filter: blur(10px) saturate(120%); animation: scrim-in .18s ease-out; }
.drawer-scrim .drawer { width: min(1120px, 94vw); height: min(92vh, 1060px); max-height: 92vh; border-radius: 22px; overflow: auto;
  box-shadow: 0 30px 90px #0f2a2440, 0 0 0 1px #ffffff40; animation: profile-zoom-in .22s cubic-bezier(.2, .9, .3, 1.15); }
.drawer .modal-head { position: sticky; top: 0; z-index: 3; background: #fffffff2; backdrop-filter: blur(6px); }
.drawer .modal-head .icon-btn + .icon-btn { margin-left: -6px; }
@keyframes profile-zoom-in { from { opacity: 0; transform: scale(.94) translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes scrim-in { from { opacity: 0; } to { opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .drawer-scrim, .drawer-scrim .drawer { animation: none; } }
/* Once the popup has opened, new content in it (another tab, a redraw after saving) doesn't replay the zoom. */
.modal-settled .drawer-scrim, .modal-settled .drawer-scrim .drawer { animation: none; }
@media (max-width: 700px) { .drawer-scrim { padding: 0; } .drawer-scrim .drawer { width: 100vw; height: 100vh; max-height: 100vh; border-radius: 0; } }
.profile-page-wrap { max-width: 1200px; margin: 0 auto; padding: 8px 0 40px; }
.drawer.as-page { width: 100%; height: auto; max-height: none; overflow: visible; border-radius: 18px; box-shadow: 0 1px 3px #0f2a2414, 0 0 0 1px var(--line); }
.drawer.as-page .modal-head { top: 0; border-radius: 18px 18px 0 0; }

/* ---- Texts: a narrow reading column; the thread scrolls instead of growing the page ---- */
.sms-panel { max-width: 760px; margin-left: auto; margin-right: auto; }
.sms-thread { max-height: min(56vh, 560px); }
.messages { max-height: min(60vh, 560px); }
.messages > *, .messages .message-row { max-width: 760px; margin-left: auto; margin-right: auto; }
.message-row .bubble { max-width: min(75%, 520px); }

/* ---- "Intake forms not sent yet" banner on the family profile ---- */
.next-step-banner { display: flex; align-items: center; gap: 14px; margin: 0 0 18px; padding: 14px 16px; border-radius: 12px;
  background: linear-gradient(90deg, #fff7e8, #fffbf3); border: 1px solid #f1d9a6; }
.next-step-banner > svg { width: 22px; height: 22px; color: #b9822b; flex-shrink: 0; }
.next-step-banner .btn.primary { background: #149c98; border-color: #149c98; color: #fff; }
.next-step-banner .btn.primary:hover { background: #0f8783; border-color: #0f8783; color: #fff; }
.next-step-banner .btn.primary svg { color: #fff; }
.next-step-banner div { flex: 1; min-width: 0; }
.next-step-banner b { display: block; color: #5d4316; }
.next-step-banner p { margin: 2px 0 0; font-size: 13.5px; color: #7d6334; }
.next-step-banner.failed { background: #fff2f0; border-color: #f0c4bc; }
.next-step-banner.failed > svg, .next-step-banner.failed b { color: #9c3b2c; }
.docs-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 0 0 14px; }
.docs-head h3 { margin: 0; }
.doc-row .pandadoc-actions { display: inline-flex; align-items: center; gap: 12px; }

/* ---- Settings: categories | settings | setup guide ---- */
.settings-shell { display: grid; grid-template-columns: 250px minmax(0, 1fr); gap: 22px; align-items: start; }
.settings-shell.has-guide { grid-template-columns: 250px minmax(0, 1fr) minmax(300px, 380px); }
.settings-nav { position: sticky; top: 16px; max-height: calc(100vh - 32px); overflow-y: auto; background: #fff; border: 1px solid var(--line);
  border-radius: 14px; padding: 10px; }
.settings-nav-group { margin: 12px 10px 6px; font-size: 11.5px; font-weight: 650; letter-spacing: .06em; text-transform: uppercase; color: #8aa2a0; }
.settings-nav-group:first-child { margin-top: 4px; }
.settings-nav-item { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 9px; color: inherit; text-decoration: none; font-size: 14.5px; }
.settings-nav-item:hover { background: #f3f9f8; }
.settings-nav-item.active { background: #e6f5f3; color: #0a5d59; font-weight: 600; }
.settings-nav-item .section-icon { width: 30px; height: 30px; flex-shrink: 0; }
.settings-nav-item .nav-title { flex: 1; min-width: 0; }
.status-dot-sm { width: 8px; height: 8px; border-radius: 50%; background: #c9d6d4; flex-shrink: 0; }
.status-dot-sm.green { background: #2dc1bd; } .status-dot-sm.red { background: #e0705e; } .status-dot-sm.blue { background: #72a8d6; } .status-dot-sm.amber { background: #dfb45e; }
.settings-pane { background: #fff; border: 1px solid var(--line); border-radius: 14px; overflow: hidden; min-width: 0; }
.settings-pane[hidden] { display: none; }
.pane-head { display: flex; align-items: center; gap: 14px; padding: 20px 24px; border-bottom: 1px solid var(--line); background: #fbfdfd; }
.pane-head > div { flex: 1; min-width: 0; }
.pane-head h2 { font-size: 19px; margin: 0; }
.pane-head p { margin: 4px 0 0; font-size: 14px; color: #6e8b88; }
.settings-guide { position: sticky; top: 16px; max-height: calc(100vh - 32px); overflow-y: auto; background: #f7fbfa; border: 1px solid #e0ecea;
  border-radius: 14px; padding: 16px 18px; font-size: 14px; }
.settings-guide[hidden] { display: none; }
.guide-eyebrow { display: flex; align-items: center; gap: 6px; margin: 0 0 6px; font-size: 11.5px; font-weight: 650; letter-spacing: .06em; text-transform: uppercase; color: #5f8c87; }
.guide-eyebrow svg { width: 14px; height: 14px; }
.guide-step { padding: 12px 0; border-top: 1px solid #e0ecea; }
.guide-step:first-of-type { border-top: 0; }
.guide-step h4 { margin: 0 0 8px; font-size: 14.5px; }
.guide-step .instructions { margin: 0; padding-left: 18px; }
.guide-step .instructions li { margin-bottom: 8px; line-height: 1.5; }
.guide-step .notice { margin-bottom: 10px; }
.guide-step pre, .guide-step code { white-space: pre-wrap; word-break: break-word; }
.guide-pointer { display: flex; align-items: center; gap: 6px; margin: 4px 0 0; font-size: 13px; color: #5f8c87; }
.guide-pointer svg { width: 14px; height: 14px; }
.settings-shell:not(.has-guide) .guide-pointer { display: none; }
@media (max-width: 1250px) {
  .settings-shell.has-guide { grid-template-columns: 230px minmax(0, 1fr); }
  .settings-shell.has-guide .settings-guide { grid-column: 2; position: static; max-height: none; }
}
@media (max-width: 860px) {
  .settings-shell, .settings-shell.has-guide { grid-template-columns: minmax(0, 1fr); }
  .settings-nav { position: static; max-height: none; display: flex; gap: 6px; overflow-x: auto; padding: 8px; }
  .settings-nav-group { display: none; }
  .settings-nav-item { flex-shrink: 0; }
  .settings-shell.has-guide .settings-guide { grid-column: 1; }
}

/* ---- Account menu (name icon, top right) ---- */
.user-menu { position: relative; }
.user-menu > summary { list-style: none; cursor: pointer; display: flex; align-items: center; gap: 4px; border-radius: 999px; padding: 2px 4px 2px 2px; }
.user-menu > summary::-webkit-details-marker { display: none; }
.user-menu > summary:hover, .user-menu[open] > summary { background: #eef7f5; }
.user-menu > summary svg { width: 16px; height: 16px; color: #6e8b89; transition: transform .15s; }
.user-menu[open] > summary svg { transform: rotate(180deg); }
.user-menu-panel { position: absolute; z-index: 60; right: 0; top: calc(100% + 8px); width: 240px; background: #fff; border: 1px solid #dbe8e5;
  border-radius: 12px; box-shadow: 0 16px 40px #0f2a2626; padding: 6px; }
.user-menu-head { display: flex; align-items: center; gap: 10px; padding: 8px 10px 12px; margin-bottom: 4px; border-bottom: 1px solid #e8f0ee; }
.user-menu-head > span { display: grid; min-width: 0; }
.user-menu-head b { font-size: 14px; color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-menu-head small { color: #6e8b89; font-size: 12.5px; }
.user-menu form.button_to { margin: 0; }
.user-menu-item { display: flex; align-items: center; gap: 10px; width: 100%; padding: 9px 10px; border: 0; border-radius: 8px; background: transparent;
  color: var(--ink); font: inherit; font-size: 14px; text-align: left; text-decoration: none; cursor: pointer; }
.user-menu-item svg { width: 17px; height: 17px; color: #5c8a85; }
.user-menu-item:hover, .user-menu-item:focus-visible { background: #eef7f5; }
.user-menu-item.current { background: #e3f4f0; }
