/* Native local SMS editing and the same exact-text surface for prepared/original results. */
.sms-workspace { max-width:960px; }
.sms-workspace:has(.sms-surface.is-recipient-workspace) { max-width:1280px; }
.sms-review:not([hidden]), .sms-group-results:not([hidden]) { animation:interface-arrive var(--motion-quick) var(--ease-standard) both; }
.sms-surface[tabindex="-1"], .sms-review[tabindex="-1"] { outline:none; }
.sms-sender { padding:16px var(--surface-gutter); display:flex; align-items:baseline; flex-wrap:wrap; gap:10px 16px; border-bottom:1px solid var(--line); }
.sms-sender > span { min-width:58px; color:var(--muted); font-size:14px; }
.sms-sender strong { font-size:16px; font-weight:400; }

/* Recipient editing remains the same native table; simple audiences read as people, not a spreadsheet. */
.sms-recipients { border-bottom:1px solid var(--line); }
.sms-recipients > summary { display:flex; align-items:center; gap:16px; padding:14px var(--surface-gutter); min-height:56px; list-style:none; cursor:pointer; }
.sms-recipients > summary::-webkit-details-marker { display:none; }
.sms-recipients > summary .envelope-label { min-width:58px; }
.sms-recipient-selection { display:flex; align-items:baseline; flex-wrap:wrap; gap:4px 18px; min-width:0; flex:1; }
.sms-recipient-selection strong { min-width:0; overflow-wrap:anywhere; font-size:16px; font-weight:400; white-space:nowrap; }
#smsRecipientSource { min-width:0; color:var(--muted); font-size:14px; overflow-wrap:anywhere; }
.sms-recipient-editor { padding:0 var(--surface-gutter) 18px; min-width:0; }
.sms-recipient-toolbar { margin-bottom:0; }
.sms-recipient-entry-actions { flex-wrap:nowrap; min-height:38px; }
.sms-recipient-entry-actions > .text-action { white-space:nowrap; }
.sms-add-several { flex-shrink:0; }
.sms-add-several > summary { display:inline-flex; align-items:center; gap:6px; min-height:38px; padding:8px 0; color:var(--accent-strong); }
.sms-add-several > .disclosure-menu { min-width:190px; }
.sms-recipient-destination { flex-basis:260px; }
.sms-recipient-destination .field-caption, .sms-table-label { display:flex; align-items:center; gap:6px; }
.sms-recipient-destination .field-caption { position:relative; }
.sms-recipient-destination .sms-phone-help { position:static; }
.sms-phone-help > summary { width:24px; min-height:24px; padding:2px; }
.sms-phone-help > .disclosure-menu { left:0; right:auto; width:min(300px,calc(100vw - 64px)); }
.sms-phone-issue { margin:10px 0 0; color:var(--danger); }
.sms-recipient-table-shell { scroll-padding:42px 220px 12px 0; max-height:360px; min-width:0; overflow:auto; border:1px solid var(--line); overscroll-behavior:contain; }
.sms-recipient-table { border-collapse:collapse; width:100%; }
.sms-recipient-table th { padding:8px 10px; font-size:14px; font-weight:400; text-align:left; background:var(--surface-soft); position:sticky; top:0; z-index:1; }
.sms-recipient-table td { vertical-align:top; padding:0; border-top:1px solid var(--line); }
.sms-cell { display:block; width:100%; min-width:170px; min-height:40px; max-height:80px; padding:7px 10px; border:0; border-radius:0; font-size:14px; line-height:1.5; resize:none; overflow-wrap:anywhere; overflow-y:auto; scrollbar-width:thin; }
.sms-cell[aria-invalid="true"] { box-shadow:inset 2px 0 var(--danger); }
.sms-cell:focus { outline-offset:-2px; }
.sms-cell-label { display:none; }
.sms-recipient-table .sms-remove-cell { width:248px; min-width:220px; padding:6px 10px; background:var(--surface); position:sticky; right:0; z-index:3; }
.sms-recipient-table tr[data-participation="excluded"] .sms-cell { color:var(--muted-secondary); background:var(--surface-softer); }
.sms-recipient-table th.sms-remove-cell { background:var(--surface-soft); z-index:5; }
.sms-recipient-table :is(th,td).recipient-identity-column { position:sticky; left:0; background:var(--surface); box-shadow:1px 0 var(--line); z-index:2; }
.sms-recipient-table th.recipient-identity-column { background:var(--surface-soft); z-index:3; }
.sms-recipient-table-shell.is-people { border:0; overflow:visible; max-height:none; }
.sms-recipient-table-shell.is-people thead { display:none; }
.sms-recipient-table-shell.is-people tbody { display:grid; gap:16px; }
.sms-recipient-table-shell.is-people tr { display:flex; align-items:flex-start; gap:12px; }
.sms-recipient-table-shell.is-people td { display:block; flex:1 1 0; min-width:0; border:0; }
.sms-recipient-table-shell.is-people .sms-remove-cell { flex:0 0 100px; width:auto; min-width:0; position:static; padding:29px 0 0; }
.sms-recipient-table-shell.is-people .sms-cell { min-width:0; min-height:var(--control-height); border:1px solid var(--line); background:var(--surface-softer); }
.sms-recipient-table-shell.is-people .sms-cell:focus { background:var(--surface); }
.sms-recipient-table-shell.is-people .recipient-identity-column { position:static; box-shadow:none; }
.sms-recipient-table-shell.is-people .sms-cell-label { display:flex; align-items:center; gap:6px; min-height:24px; font-size:var(--type-caption); color:var(--muted); margin-bottom:5px; }
.sms-recipient-footer { display:flex; align-items:center; flex-wrap:wrap; justify-content:space-between; gap:6px 14px; min-height:34px; margin-top:5px; }
#smsClearRecipients { color:var(--danger); }
.sms-surface.is-recipient-workspace #smsMessagePanel,
.sms-surface.is-recipient-workspace #smsTaskFooter { display:none; }
.sms-surface.is-recipient-workspace .sms-recipients { border-bottom:0; }
.sms-surface.is-recipient-workspace .sms-recipient-selection strong { font-size:20px; font-weight:400; }
.sms-surface.is-recipient-workspace .sms-recipient-editor {
  display:flex;
  flex-direction:column;
  height:calc(100dvh - 180px);
  min-height:420px;
  padding-top:10px;
}
.sms-surface.is-recipient-workspace .sms-recipient-table-shell { flex:1; min-height:320px; max-height:none; }
.sms-surface.is-recipient-workspace :is(.recipient-workspace-head,#smsAudienceStatus,.recipient-group-context,.sms-recipient-footer,
  #smsRecipientFilterNote,.recipient-undo,#smsImportError,#smsPhoneIssue) { flex-shrink:0; }


/* One narrow SMS object: exact labels, a restrained frame and one native message editor. */
.sms-message-panel, .sms-preview-device {
  --sms-message-width:min(92%,382px);
  --sms-frame-radius:4px;
  --sms-message-radius:3px;
  width:min(460px,calc(100% - 2 * var(--surface-gutter)));
  margin:28px auto;
  overflow:hidden;
  border:1px solid var(--line-strong);
  border-radius:var(--sms-frame-radius);
  background:var(--surface);
  box-shadow:none;
}
.sms-device-bar { display:flex; align-items:center; gap:16px; min-height:48px; padding:11px 18px; border-bottom:1px solid var(--line); background:var(--surface); }
.sms-device-bar > span { color:var(--muted); font-size:12px; line-height:1.3; letter-spacing:.09em; text-transform:uppercase; }
.sms-device-bar > strong { min-width:0; margin-left:auto; overflow:hidden; color:var(--ink-soft); font-size:14px; font-weight:400; text-overflow:ellipsis; white-space:nowrap; }
.sms-message-status { margin:0; padding:7px 18px; border-bottom:1px solid var(--line); background:var(--danger-soft); color:var(--danger); font-size:13px; line-height:1.4; }
.sms-message-screen { display:flex; min-height:198px; align-items:flex-end; padding:22px 18px 16px; background:var(--surface-softer); }
.sms-message-bubble, .sms-preview-body {
  width:var(--sms-message-width);
  margin-left:auto;
  border:1px solid var(--line);
  border-radius:var(--sms-message-radius);
  background:var(--surface);
  box-shadow:none;
}
.sms-message-bubble { overflow:hidden; transition:border-color var(--motion-quick) var(--ease-standard); }
.sms-message-bubble:focus-within { border-color:var(--accent); box-shadow:0 0 0 2px var(--accent-line); }
.sms-body-input { display:block; width:100%; min-height:88px; max-height:252px; padding:16px 17px 10px; resize:none; border:0; border-radius:0; background:transparent; caret-color:var(--ink); font-size:17px; font-weight:350; line-height:1.58; overflow-y:hidden; overscroll-behavior:contain; scrollbar-gutter:stable; }
.sms-body-input:focus, .sms-body-input:focus-visible { background:var(--surface); outline:none; }
.sms-message-tools { display:grid; min-height:44px; grid-template-columns:max-content max-content minmax(0,1fr); align-items:center; gap:6px 14px; padding:6px 14px 8px; border-top:1px solid var(--line); background:var(--surface); }
.sms-message-tools > .sms-template-action { grid-column:1; grid-row:1; white-space:nowrap; }
.sms-message-tools > .sms-template-action:disabled { color:var(--muted); cursor:default; text-decoration:none; opacity:.82; }
.sms-message-tools > .field-picker { grid-column:2; grid-row:1; min-width:0; }
.sms-message-tools > .sms-message-measure { z-index:1; grid-column:3; grid-row:1; align-self:start; justify-self:end; min-width:0; margin-top:6px; color:var(--muted); font-size:12px; line-height:1.35; text-align:right; overflow-wrap:anywhere; pointer-events:none; }

.sms-action-bar { display:grid; grid-template-columns:minmax(0,1fr) auto; grid-template-areas:"context primary" "secondary primary"; align-items:center; gap:7px 24px; }
.sms-task-context { grid-area:context; display:grid; gap:3px; min-width:0; }
.sms-task-context > [hidden] { display:none; }
.sms-task-context:not(:has(> :not([hidden]))), .sms-send-actions:not(:has(> :not([hidden]))) { display:none; }
.sms-task-feedback, .sms-task-scope, .sms-task-cost { min-width:0; margin:0; line-height:1.5; overflow-wrap:anywhere; }
.sms-task-feedback { color:var(--ink-soft); font-size:14px; }
.sms-task-feedback[data-tone="error"], .sms-task-scope[data-tone="error"] { color:var(--danger); }
.sms-task-feedback[data-tone="warning"] { color:var(--warning); }
.sms-task-feedback[data-tone="success"] { color:var(--success); }
.sms-task-scope, .sms-task-cost { color:var(--muted); font-size:13px; }
.sms-task-scope > p { margin:0; }
.sms-task-scope > p + p { margin-top:3px; }
.sms-task-secondary-actions { grid-area:secondary; display:flex; align-items:center; flex-wrap:wrap; gap:8px 22px; min-width:0; }
.sms-result-actions { display:flex; align-items:center; flex-wrap:wrap; gap:8px 18px; }
.sms-send-actions { grid-area:primary; align-self:center; margin-left:0; }
.sms-action-bar:not(:has(.sms-task-context > :not([hidden]))) { grid-template-areas:"secondary primary"; }
.sms-action-bar:not(:has(.sms-send-actions > :not([hidden]))) { grid-template-columns:minmax(0,1fr); grid-template-areas:"context" "secondary"; }
.sms-action-bar:not(:has(.sms-task-context > :not([hidden]))):not(:has(.sms-send-actions > :not([hidden]))) { grid-template-areas:"secondary"; }
.sms-preview-device { margin-block:24px; }
.sms-preview-meta { display:grid; grid-template-columns:minmax(60px,max-content) minmax(0,1fr); gap:9px 16px; align-items:baseline; padding:12px 18px; border-bottom:1px solid var(--line); background:var(--surface); }
.sms-preview-meta > span { color:var(--muted); font-size:13px; }
.sms-preview-meta > strong { overflow-wrap:anywhere; font-size:15px; font-weight:400; }
.sms-preview-screen { min-height:188px; padding-block:20px 16px; }
.sms-preview-body { min-height:84px; max-height:55dvh; overflow:auto; padding:16px 17px; font-size:17px; line-height:1.58; overflow-wrap:anywhere; white-space:pre-wrap; }
.sms-preview-body:focus { outline-offset:-3px; }
.sms-review-summary { border-top:1px solid var(--line); padding:14px var(--surface-gutter); }
.sms-review-summary > p { margin:0; }
.sms-review-summary > p + p { margin-top:6px; }
.sms-estimate-notes { margin-top:10px; color:var(--muted); font-size:13px; line-height:1.5; }
.sms-estimate-notes > summary { cursor:pointer; width:fit-content; }
.sms-estimate-notes > p { margin:10px 0 0; }
.sms-submission-status { padding:16px var(--surface-gutter); border-bottom:1px solid var(--line); }
.sms-submission-status > strong { font-size:18px; font-weight:450; }
.sms-submission-status > p { margin:6px 0 0; font-size:14px; line-height:1.55; color:var(--muted); }
.sms-submission-status[data-tone="error"] > strong { color:var(--danger); }
.sms-submission-status[data-tone="warning"] > strong { color:var(--warning); }
.sms-submission-status[data-tone="success"] > strong { color:var(--success); }
.sms-delivery-details { display:grid; grid-template-columns:minmax(0,max-content) minmax(0,1fr); gap:6px 18px; margin:12px 0 0; font-size:14px; line-height:1.55; }
.sms-delivery-details dt, .sms-delivery-details dd { margin:0; overflow-wrap:anywhere; }
.sms-delivery-details dt { color:var(--muted); }
.sms-allowance { display:flex; flex-wrap:wrap; gap:10px var(--surface-gutter); margin-bottom:8px; font-size:14px; color:var(--muted); }
.sms-allowance strong { margin-left:8px; font-size:16px; font-weight:400; color:var(--ink); white-space:nowrap; }
.sms-review-summary > .sms-quote-basis { margin:0 0 8px; color:var(--muted); font-size:13px; line-height:1.5; }
.sms-rate-details { display:grid; grid-template-columns:minmax(0,max-content) minmax(0,1fr); gap:8px 18px; margin:14px 0 0; }
.sms-rate-details dt, .sms-rate-details dd { margin:0; overflow-wrap:anywhere; }
.sms-rate-details dd { color:var(--ink); }
.sms-recent { padding:14px var(--surface-gutter); display:flex; flex-wrap:wrap; align-items:center; gap:10px 18px; border-bottom:1px solid var(--line); font-size:14px; }
.sms-recent select { flex:1 1 240px; width:0; min-width:0; }

@media (max-width:760px) {
  .sms-sender, .sms-recipients > summary, .sms-review-summary,
  .sms-submission-status, .sms-recent { padding-inline:16px; }
  .sms-recipient-editor { padding-inline:16px; }
  .sms-message-panel, .sms-preview-device { width:min(460px,calc(100% - 24px)); margin-block:18px; border-radius:var(--sms-frame-radius); }
  .sms-device-bar, .sms-preview-meta { padding-inline:15px; }
  .sms-message-screen { min-height:190px; padding:18px 12px 13px; }
  .sms-message-bubble, .sms-preview-body { width:100%; max-width:none; }
  .sms-body-input { min-height:94px; max-height:238px; padding:15px 15px 9px; }
  .sms-message-tools { grid-template-columns:max-content minmax(0,1fr); padding-inline:12px; }
  .sms-message-tools > .sms-template-action { grid-column:1; grid-row:1; }
  .sms-message-tools > .field-picker { grid-column:2; grid-row:1; justify-self:start; }
  .sms-message-tools > .sms-message-measure { grid-column:1 / -1; grid-row:2; max-width:none; margin-top:0; }
  .sms-preview-screen { min-height:180px; }
  .sms-preview-body { min-height:90px; padding:15px; }
  .sms-action-bar { grid-template-columns:minmax(0,1fr); grid-template-areas:"context" "primary" "secondary"; align-items:stretch; gap:12px; }
  .sms-task-secondary-actions { justify-content:space-between; gap:8px 16px; }
  .sms-send-actions { width:100%; justify-content:flex-end; }
  .sms-action-bar:not(:has(.sms-task-context > :not([hidden]))) { grid-template-areas:"primary" "secondary"; }
  .sms-action-bar:not(:has(.sms-send-actions > :not([hidden]))) { grid-template-areas:"context" "secondary"; }
  .sms-action-bar:not(:has(.sms-task-context > :not([hidden]))):not(:has(.sms-send-actions > :not([hidden]))) { grid-template-areas:"secondary"; }
  .sms-recipient-table-shell.is-people tr { display:grid; grid-template-columns:minmax(0,1fr) 100px; gap:10px; }
  .sms-recipient-table-shell.is-people td { grid-column:1; }
  .sms-recipient-table-shell.is-people .sms-remove-cell { grid-column:2; grid-row:1; }
  .sms-review .preview-toolbar { padding-inline:16px; flex-wrap:wrap; gap:10px; }
  .sms-review .preview-navigation { width:100%; }
  .sms-review .preview-navigation select { flex:1; width:0; }
}

@media (max-width:380px) {
  .sms-recipients > summary { gap:10px; }
  .sms-recipients > summary .envelope-label { min-width:32px; }
  .sms-device-bar { gap:10px; }
  .sms-device-bar > span { letter-spacing:.055em; }
  .sms-device-bar > strong { max-width:58%; }
  .sms-message-screen { padding-inline:10px; }
  .sms-message-tools { column-gap:10px; }
  .sms-message-tools > .sms-message-measure { max-width:none; }
  .sms-preview-meta { grid-template-columns:minmax(52px,max-content) minmax(0,1fr); gap-inline:10px; }
}

.sms-group-results { padding:18px var(--surface-gutter); border-bottom:1px solid var(--line); }
.sms-group-results h3 { margin:0 0 12px; font-size:20px; font-weight:450; }
.sms-group-header { display:flex; flex-wrap:wrap; align-items:center; justify-content:space-between; gap:8px 16px; margin-bottom:12px; }
.sms-group-header h3 { margin:0; }
.sms-group-actions { display:flex; align-items:center; gap:8px; margin-left:auto; }
.sms-group-actions > button { min-height:38px; }
.sms-group-counts { display:flex; flex-wrap:wrap; gap:10px 22px; margin:0 0 14px; }
.sms-group-counts > div { display:flex; gap:8px; align-items:baseline; }
.sms-group-counts dt { color:var(--muted); font-size:13px; }
.sms-group-counts dd { margin:0; font-size:20px; font-weight:450; }
.sms-group-members { display:grid; gap:4px; list-style:none; margin:0 0 12px; padding:0; }
.sms-group-members button { display:grid; grid-template-columns:minmax(0,1fr) minmax(0,1fr); gap:2px 12px; width:100%; text-align:left; border:1px solid transparent; border-radius:var(--control-radius); background:transparent; padding:9px 10px; color:inherit; font:inherit; cursor:pointer; overflow-wrap:anywhere; }
.sms-group-members button[aria-current="true"] { border-color:var(--line); background:var(--surface); }
.sms-group-members button > strong { font-size:14px; font-weight:450; }
.sms-group-members button > small { grid-column:1 / -1; color:var(--muted); font-size:12px; }
.sms-group-members [data-category="needs_attention"] > strong { color:var(--danger); }
.sms-group-members [data-category="unavailable"] > strong { color:var(--warning); }
.sms-group-members [data-category="delivered"] > strong { color:var(--success); }
@media (max-width:560px) {
  .sms-group-results { padding-inline:16px; }
  .sms-group-members button { grid-template-columns:minmax(0,1fr); }
}

.sms-surface.has-issue-completion.is-recipient-workspace .sms-recipient-editor { height:auto; min-height:0; }
