:root {
  color-scheme: dark;
  font-family: ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 16px;
  --page: #09090b;
  --surface: #161619;
  --input: #09090b;
  --text: #f5f5f5;
  --muted: #b5b5ba;
  --line: #747478;
  --selected: #eeeeef;
  --selected-text: #121214;
  --preview: #232326;
  --preview-text: #f5f5f5;
  --preview-muted: #b8b8be;
  --incoming: #1b1b1e;
  --incoming-muted: #c4c4ca;
  --focus: #d2d2d8;
  --warning: #ffd39c;
  --disabled: #45454a;
  --disabled-text: #eeeef0;
  background: var(--page);
  color: var(--text);
}
:root[data-theme="light"] {
  color-scheme: light;
  --page: #f5f5f5;
  --surface: #ffffff;
  --input: #ffffff;
  --text: #171719;
  --muted: #58585e;
  --line: #7a7a80;
  --selected: #242427;
  --selected-text: #ffffff;
  --preview: #e9e9ec;
  --preview-text: #171719;
  --preview-muted: #58585e;
  --incoming: #ededf0;
  --incoming-muted: #525258;
  --focus: #3a3a40;
  --warning: #824400;
  --disabled: #dedee2;
  --disabled-text: #4b4b51;
}
* { box-sizing: border-box; }
html, body { width: 100%; height: 100%; margin: 0; overflow: hidden; overscroll-behavior: none; }
button, input, select, textarea { font: inherit; -webkit-tap-highlight-color: transparent; }
button { cursor: pointer; }
button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.app {
  position: fixed; top: var(--app-top, 0px); left: 50%; transform: translateX(-50%);
  width: min(100%, 570px); height: var(--app-height, 100dvh); min-height: 0;
  display: flex; flex-direction: column; gap: 5px; overflow: hidden;
  padding: max(8px, env(safe-area-inset-top)) 14px max(8px, env(safe-area-inset-bottom));
}
.app > * { flex-shrink: 0; min-width: 0; }
#compose-area { display:flex;flex-direction:column;gap:inherit;flex:1 1 auto;min-height:0;overflow-y:auto;overscroll-behavior:contain;scrollbar-width:thin;scroll-padding:4px; }
#compose-area > * { flex-shrink:0;min-width:0; }
#compose-area > .message-panel { flex:1 0 100px; }
.header-tools { display:flex;align-items:center;gap:4px;flex-shrink:0; }
.info-button { width:28px;height:32px;padding:0;border:0;border-radius:999px;background:var(--surface);color:var(--muted);font-size:17px;font-weight:600; }
.app-header h1 { min-width:0; }
.app-header { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 30px; }
h1 { font-size: 22px; line-height: 1.15; letter-spacing: -.6px; margin: 0; font-weight: 650; }
.theme-toggle { border: 1px solid var(--line); border-radius: 999px; padding: 5px 9px; min-height: 30px; color: var(--muted); background: var(--surface); font-size: 11px; }
.workflow-switch, #compact-view { display: flex; gap: 4px; padding: 2px; border-radius: 10px; background: var(--surface); }
.workflow-switch button, #compact-view button { flex: 1; min-height: 30px; border: 0; border-radius: 8px; padding: 5px 8px; font-size: 12px; color: var(--muted); background: transparent; }
.workflow-switch button[aria-pressed="true"], #compact-view button[aria-pressed="true"] { background: var(--selected); color: var(--selected-text); font-weight: 650; }
#compact-view { display: none; }
.modes { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 4px; }
.modes > button { min-height: 32px; padding: 5px 3px; border: 1px solid var(--line); border-radius: 8px; font-size: 12px; line-height: 1.2; white-space: normal; color: var(--muted); background: var(--surface); }
.modes > button[aria-pressed="true"] { background: var(--selected); color: var(--selected-text); border-color: var(--selected); font-weight: 650; }
#details-form { background: var(--surface); border-radius: 12px; padding: 7px 9px; min-height: 0; }
#details-form:has(.fields:empty):has(#confirmation:empty) { display: none; }
#field-tabs { gap: 4px; margin-bottom: 5px; }
#field-tabs button { flex: 1 1 0; min-width: 0; min-height: 28px; padding: 4px 3px; font-size: 11px; line-height: 1.2; border-radius: 7px; white-space: normal; }
.fields { min-height: 0; }
.field { min-width: 0; }
.field-heading { display: flex; align-items: center; justify-content: space-between; min-height: 24px; margin-bottom: 3px; gap: 7px; }
.field-heading label, .field > label, legend { color: var(--muted); font-size: 12px; line-height: 1.3; }
.field-heading .subtle { min-height: 24px; padding: 3px 0; font-size: 11px; }
.presets { display: flex; flex-wrap: wrap; gap: 4px; }
.preset { flex: 1 1 auto; min-height: 32px; border: 1px solid var(--line); border-radius: 8px; padding: 5px 7px; background: var(--input); color: var(--text); font-size: 12px; line-height: 1.25; white-space: nowrap; }
.preset[aria-pressed="true"] { background: var(--selected); color: var(--selected-text); border-color: var(--selected); font-weight: 600; }
.presets[aria-labelledby="label-service"] { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); }
.presets[aria-labelledby="label-service"] .preset { padding-inline: 3px; white-space: normal; }
input:not([type="checkbox"], [type="radio"]), .field textarea, #incoming {
  display: block; width: 100%; min-width: 0; max-width: 100%; min-height: 38px;
  border: 1px solid var(--line); border-radius: 9px; padding: 7px 9px;
  color: var(--text); background: var(--input); font-size: 16px;
}
.field input:not([type="checkbox"]), .field textarea { margin-top: 3px; }
input::placeholder, textarea::placeholder { color: var(--muted); opacity: 1; }
input[type="date"], input[type="time"] { -webkit-appearance: none; appearance: none; padding-right: 8px; }
input[type="date"]::-webkit-date-and-time-value, input[type="time"]::-webkit-date-and-time-value { text-align: left; min-height: 1.2em; }
.field textarea { resize: none; line-height: 1.4; height: 66px; min-height: 0; }
input[aria-invalid="true"], textarea[aria-invalid="true"] { border-color: var(--warning); }
fieldset { padding: 0; margin: 0; border: 0; min-width: 0; }
legend { padding: 0; width: 100%; }
input[type="checkbox"], input[type="radio"] { width: 20px; height: 20px; margin: 0; accent-color: var(--selected); flex-shrink: 0; }
.confirmation { display: flex; gap: 9px; align-items: flex-start; padding: 7px 0; font-size: 13px; line-height: 1.4; color: var(--muted); }
.date-value { display: flex; align-items: center; gap: 7px; font-size: 11px; color: var(--muted); min-height: 23px; margin-left: auto; }
.date-value .subtle { min-height: 24px; padding: 2px; font-size: 10px; }
.subtle { background: none; border: 0; color: var(--muted); font-size: 12px; min-height: 28px; padding: 4px 0; text-decoration: underline; text-underline-offset: 3px; }
.preview-tools { display: flex; gap: 10px; align-items: center; }
.reply-panel { background: var(--incoming); padding: 7px 9px; border-radius: 12px; }
.reply-panel > label { display: block; font-size: 12px; font-weight: 600; color: var(--incoming-muted); margin-bottom: 4px; }
#incoming { resize: none; height: 60px; min-height: 0; max-height: 100%; line-height: 1.4; }
#edit-incoming { color: var(--incoming-muted); min-height: 26px; padding: 3px 0; }
.customer-message { background:var(--incoming);padding:7px 9px;border-radius:16px;box-shadow:inset 0 0 0 1px var(--soft-line); }
.customer-message-heading { display:flex;align-items:center;justify-content:space-between;min-height:24px;gap:8px;margin-bottom:3px; }
.customer-message-heading label { font-size:12px;font-weight:600;color:var(--incoming-muted); }
.customer-message[data-reference="true"] #incoming { background:transparent;border-color:transparent;border-radius:0;padding:0;height:45px;font-size:14px;line-height:1.55;overflow-y:auto; }
.customer-message #edit-incoming { min-height:24px;padding:2px 4px;font-size:11px; }
.recognition { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 26px; color: var(--incoming-muted); font-size: 11px; }
.recognition .subtle { color: var(--incoming-muted); }
#reply-types { margin-top: 3px; }
#reply-actions { margin-top: 3px; }
#reply-types .preset, #reply-actions .preset { white-space: normal; }
#suggest-service { margin-top: 3px; max-width: 100%; white-space: normal; }
.message-panel { display: flex; flex-direction: column; flex: 1 1 0; min-height: 92px; background: var(--preview); border-radius: 12px; padding: 7px 11px; }
.preview-heading { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 24px; flex-shrink: 0; }
.preview-heading label { color: var(--preview-muted); font-size: 10px; letter-spacing: .6px; text-transform: uppercase; }
.preview-heading .subtle { color: var(--preview-muted); min-height: 24px; padding-block: 3px; }
#message { display: block; flex: 1 1 0; width: 100%; min-height: 0; max-height: none; overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; resize: none; background: transparent; border: 0; border-radius: 4px; padding: 4px 0; color: var(--preview-text); line-height: 1.45; font-size: 16px; overflow-wrap: anywhere; }
.copy-button { width: 100%; display: flex; align-items: center; justify-content: center; gap: 9px; border: 0; background: var(--selected); color: var(--selected-text); border-radius: 11px; min-height: 44px; padding: 9px 14px; font-size: 16px; font-weight: 650; margin-top: auto; }
.copy-button svg { width: 21px; height: 21px; fill: none; stroke: currentColor; stroke-width: 1.8; }
.copy-button[aria-disabled="true"] { background: var(--disabled); color: var(--disabled-text); cursor: not-allowed; }
.copy-meta { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 24px; }
.copy-meta p { font-size: 11px; color: var(--muted); line-height: 1.3; margin: 0; }
.copy-meta button { margin-left: auto; white-space: nowrap; min-height: 24px; font-size: 11px; }
.checks { font-size: 11px; color: var(--warning); line-height: 1.35; }
.checks:empty { display: none; }
.checks p { margin: 0; }
.pending { padding: 7px 9px; border: 1px solid var(--warning); border-radius: 10px; background: var(--surface); }
.pending p { font-size: 12px; line-height: 1.3; margin: 0 0 5px; }
.actions { display: flex; gap: 7px; flex-wrap: wrap; }
.actions button { border: 1px solid var(--line); border-radius: 8px; background: var(--input); color: var(--text); min-height: 32px; font-size: 12px; padding: 6px 9px; }
.fallback { font-size: 12px; line-height: 1.4; color: var(--muted); margin: 0; }
dialog { background: var(--surface); color: var(--text); border: 1px solid var(--line); border-radius: 14px; width: calc(100% - 24px); max-width: 420px; max-height: calc(var(--app-height, 100dvh) - 20px); padding: 16px; }
dialog h2 { font-size: 19px; margin: 0 0 12px; }
dialog::backdrop { background: #000a; }
.decision-dialog { border-color:var(--soft-line,var(--line));border-radius:22px;padding:20px; }
.decision-dialog h2 { font-size:20px;line-height:1.2;margin-bottom:10px; }
.decision-dialog h2:focus { outline:none; }
.decision-dialog p { color:var(--muted);font-size:14px;line-height:1.45;margin:0 0 20px; }
.decision-dialog .actions { display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:8px;margin-top:18px; }
.decision-dialog .actions button { min-height:44px;min-width:0;border-radius:999px;font-size:14px;font-weight:600;padding:10px 8px;background:var(--chip,var(--input));border-color:var(--soft-line,var(--line)); }
.decision-dialog .actions .primary-action { background:var(--selected);color:var(--selected-text); }
.waste-options { display:grid;grid-template-columns:repeat(2,minmax(0,1fr)); }
.waste-price-row { display:flex;align-items:stretch;gap:7px; }
.waste-price-row input { flex:1;min-width:0; }
.waste-price-row .preset { flex:0 0 auto; }
#copy-dialog { overflow: hidden; }
#copy-text { width: 100%; height: min(200px, 40dvh); min-height: 48px; resize: none; overflow: auto; color: var(--text); background: var(--input); border: 1px solid var(--line); border-radius: 8px; font-size: 16px; line-height: 1.4; padding: 8px; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
[hidden] { display: none !important; }
@media (max-width: 359px) { .app { padding-inline: 10px; gap: 4px; } h1 { font-size: 20px; } .theme-toggle { padding-inline: 7px; font-size: 10px; } .modes > button, .preset { font-size: 11px; } .preset { padding-inline: 5px; } #details-form { padding-inline: 8px; } }
/* A short viewport changes panels instead of squeezing or scrolling the page. */
@media (max-height: 659px) {
  #compact-view { display: flex; }
  .app[data-view="details"] .message-panel { display: none; }
  .app[data-view="message"] :is(#modes, #reply-panel, #details-form) { display: none; }
}
:root[data-short="true"] #compact-view, .app[data-short="true"] #compact-view { display: flex; }
:root[data-short="true"] .app[data-view="details"] .message-panel, .app[data-short="true"][data-view="details"] .message-panel { display: none; }
:root[data-short="true"] .app[data-view="message"] :is(#modes, #reply-panel, #details-form), .app[data-short="true"][data-view="message"] :is(#modes, #reply-panel, #details-form) { display: none; }
/* VisualViewport-driven keyboard mode keeps only the active editing surface. */
:root[data-keyboard="true"] :is(.app-header, .workflow-switch, #compact-view, #modes), .app[data-keyboard="true"] :is(.app-header, .workflow-switch, #compact-view, #modes) { display: none; }
:root[data-keyboard="true"][data-editing="incoming"] .app :is(#details-form, .message-panel), .app[data-keyboard="true"][data-editing="incoming"] :is(#details-form, .message-panel) { display: none; }
:root[data-keyboard="true"][data-editing="field"] .app :is(#reply-panel, .message-panel), .app[data-keyboard="true"][data-editing="field"] :is(#reply-panel, .message-panel) { display: none; }
:root[data-keyboard="true"][data-editing="message"] .app :is(#reply-panel, #details-form), .app[data-keyboard="true"][data-editing="message"] :is(#reply-panel, #details-form) { display: none; }
:root[data-keyboard="true"][data-editing="message"] .message-panel, .app[data-keyboard="true"][data-editing="message"] .message-panel { display: flex; min-height: 60px; }
@media (max-height: 419px) { .app { gap: 3px; padding-top: 5px; padding-bottom: 5px; } h1 { font-size: 18px; } .app-header { min-height: 26px; } .theme-toggle { min-height: 26px; } .workflow-switch button, #compact-view button { min-height: 26px; } .modes { grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 3px; } .modes > button { min-height: 28px; font-size: 10px; padding: 3px 2px; } .preset { min-height: 28px; font-size: 11px; } #field-tabs button { min-height: 25px; } .field-heading { min-height: 22px; } .copy-meta { min-height: 22px; } .copy-button { min-height: 38px; padding-block: 7px; } }
@media (prefers-reduced-motion: reduce) { * { scroll-behavior: auto !important; } }

#choose-purpose,#keyboard-done{display:none}
.custom-value{display:block;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;max-width:100%;font-size:12px;color:var(--muted);margin-top:4px}
.app[data-short="true"][data-view="details"] #pending{display:none}
@media(max-height:659px){.app[data-view="details"] #pending{display:none}}
@media(max-height:479px){
 .app{gap:2px}
 .copy-meta{position:absolute;width:1px;height:1px;min-height:0;overflow:hidden;clip-path:inset(50%)}
 .copy-meta button{display:none}
 .app:has(#reply-panel:not([hidden])[data-collapsed="false"]) #details-form,.app:has(#reply-types:not([hidden])) #details-form{display:none}
 #reply-panel[data-collapsed="true"][data-has-action="true"] :is(.recognition,#reply-actions,#suggest-service){display:none}
 #reply-panel:has(#reply-types:not([hidden])) .recognition{display:flex}
 .app[data-view="details"] #choose-purpose{display:block;text-align:left;min-height:24px}
 .app:not([data-mode-picker="true"]) #modes{display:none}
 .app[data-mode-picker="true"] #details-form{display:none}
 .app[data-view="message"] #choose-purpose{display:none}
}
.app[data-keyboard="true"] #choose-purpose{display:none}
.app[data-keyboard="true"] #keyboard-done{display:block;min-height:24px}
.app[data-keyboard="true"] #pending{display:none}
.app[data-keyboard="true"][data-editing="incoming"] :is(.recognition,#reply-types,#reply-actions,#suggest-service){display:none}
@media(max-height:419px){
 #incoming{height:48px}
 .app-header{position:absolute;top:5px;right:10px;min-height:0}
 .app-header h1{display:none}
 .workflow-switch{margin-right:48px}
}

/* Refined neutral surfaces. Geometry remains stable during interactions. */
:root{--soft-line:#ffffff12;--chip:#202023;--hover:#2b2b2f;--shadow:#00000024}
:root[data-theme="light"]{--soft-line:#0000000d;--chip:#f0f0f2;--hover:#e1e1e5;--shadow:#00000009}
body{background:radial-gradient(ellipse at 50% 0%,var(--surface),var(--page) 70%)}
h1{display:flex;align-items:center;gap:9px;font-weight:600;letter-spacing:-.8px}
.app-symbol{width:24px;height:24px;flex-shrink:0;fill:none;stroke:currentColor;stroke-width:1.5;stroke-linecap:round;stroke-linejoin:round}
.theme-toggle{display:grid;place-items:center;width:32px;height:32px;min-width:32px;padding:6px;border-color:transparent;background:var(--surface)}
.theme-toggle svg{grid-area:1/1;width:18px;height:18px;fill:none;stroke:currentColor;stroke-width:1.6;stroke-linecap:round;stroke-linejoin:round}
.theme-moon{display:none}
:root[data-theme="light"] .theme-sun{display:none}
:root[data-theme="light"] .theme-moon{display:block}
.workflow-switch,#compact-view{border-radius:999px;box-shadow:inset 0 0 0 1px var(--soft-line)}
.workflow-switch button,#compact-view button{border-radius:999px;font-weight:500}
.workflow-switch button[aria-pressed="true"],#compact-view button[aria-pressed="true"]{box-shadow:0 2px 6px var(--shadow)}
.modes{gap:5px}
.modes>button{border-color:transparent;border-radius:999px;letter-spacing:-.1px}
.modes>button[aria-pressed="true"]{box-shadow:0 2px 8px var(--shadow)}
#details-form,.reply-panel{border-radius:20px;box-shadow:inset 0 0 0 1px var(--soft-line)}
#field-tabs{border-bottom:1px solid var(--soft-line);gap:2px;padding-bottom:3px}
#field-tabs button{position:relative;border-color:transparent;background:transparent;color:var(--muted);border-radius:9px;font-weight:500}
#field-tabs button[aria-pressed="true"]{color:var(--text);font-weight:650}
#field-tabs button[aria-pressed="true"]::after{content:"";position:absolute;height:2px;width:16px;background:currentColor;bottom:0;left:calc(50% - 8px);border-radius:2px}
.preset{border-radius:999px;background:var(--chip);border-color:transparent}
.preset[aria-pressed="true"]{background:var(--selected);border-color:transparent;color:var(--selected-text)}
input:not([type="checkbox"],[type="radio"]),.field textarea,#incoming{border-radius:13px}
.subtle{text-decoration:none;font-weight:500}
.subtle:hover{text-decoration:underline;text-underline-offset:3px}
.message-panel{position:relative;border-radius:24px;background:linear-gradient(145deg,var(--chip),var(--preview));box-shadow:inset 0 0 0 1px var(--soft-line),0 8px 24px var(--shadow)}
.preview-heading label{text-transform:none;letter-spacing:0;font-size:12px;font-weight:500}
.preview-tools .subtle{padding-inline:7px;border-radius:999px;background:var(--soft-line)}
.copy-button{border-radius:999px;letter-spacing:-.2px;box-shadow:0 3px 12px var(--shadow)}
.copy-button[aria-disabled="true"]{box-shadow:none}
button{transition:background-color 160ms ease,color 160ms ease,box-shadow 160ms ease,transform 160ms cubic-bezier(.2,.8,.2,1)}
button:active:not(:disabled):not([aria-disabled="true"]){transform:scale(.97)}
button:focus-visible{outline-offset:2px}
@media(hover:hover){.modes>button:not([aria-pressed="true"]):hover,.preset:not([aria-pressed="true"]):hover,.theme-toggle:hover{background:var(--hover);color:var(--text)}}
@media(min-height:660px){
 .app{gap:8px;padding-top:max(14px,env(safe-area-inset-top));padding-bottom:max(10px,env(safe-area-inset-bottom))}
 .app-header{min-height:36px}
 .workflow-switch button{min-height:34px}
 .modes>button{min-height:34px}
 #details-form,.reply-panel{padding:9px 11px}
 .message-panel{padding:11px 15px}
 #message{font-size:17px;line-height:1.55;padding-top:8px}
 .copy-button{min-height:48px}
}
@media(min-width:761px) and (min-height:840px){.app{max-height:820px;top:max(var(--app-top,0px),calc((100dvh - 820px)/2))}}
@media(max-width:359px){h1{font-size:19px;gap:7px}.app-symbol{width:21px;height:21px}}
@media(max-height:479px){#field-tabs{padding-bottom:0}.modes{gap:3px}}
@media(prefers-reduced-motion:reduce){button{transition:none}button:active:not(:disabled):not([aria-disabled="true"]){transform:none}}

/* Names are optional, explicitly saved shortcuts, never a contact directory. */
.saved-name-heading{display:flex;align-items:center;justify-content:space-between;gap:8px;font-size:10px;color:var(--muted);margin-top:4px}
.saved-name-heading .subtle{font-size:10px;min-height:24px;padding:3px 0}
#saved-name-list{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:4px}
#saved-name-list .preset{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
#save-name:disabled{opacity:.65;cursor:default}
.name-notice{font-size:11px;line-height:1.3;color:var(--muted);margin:4px 0 0}
#open-saved-names{display:none}
@media(max-height:479px){
 #open-saved-names{display:block;margin-left:auto}
 #details-form:not([data-name-picker="true"]) #saved-names{display:none}
 #details-form[data-name-picker="true"]:has(.field[data-key="name"]:not([hidden])) #field-tabs,
 #details-form[data-name-picker="true"] .field[data-key="name"] :is(#field-name,#save-name,#name-notice){display:none}
}

/* Use the existing detail tabs as the completion strip. */
#field-tabs button[data-complete="true"]{color:var(--text)}
.checks[data-state="progress"],.checks[data-state="ready"]{color:var(--muted);font-size:11px}
.checks[data-state="ready"]{font-weight:600}
.presets[aria-labelledby="label-date"]{display:grid;grid-template-columns:repeat(4,minmax(0,1fr))}
.presets[aria-labelledby="label-date"] .preset{padding-inline:3px;white-space:normal}
.choose-date{box-shadow:inset 0 0 0 1px var(--line)}
.accept-choice{font-weight:650!important}
.accept-choice:disabled{opacity:.5;cursor:default}
/* Detected work is one explicit choice, with alternatives one tap away. */
#suggest-service{width:100%;display:flex;align-items:center;justify-content:space-between;gap:12px;min-height:42px;text-align:left;padding:9px 12px;margin:0;border-radius:14px;background:var(--selected);color:var(--selected-text);text-decoration:none;font-size:14px;line-height:1.3}
.suggestion-work{font-weight:600;min-width:0;overflow-wrap:anywhere}
.suggestion-use{font-size:12px;white-space:nowrap;font-weight:650}
#home{display:flex;align-items:center;gap:9px;border:0;padding:0;background:none;color:inherit;font:inherit;letter-spacing:inherit;text-align:left;border-radius:8px}
.copy-actions{display:flex;align-items:stretch;gap:7px;margin-top:auto;min-width:0}
.copy-actions .copy-button{flex:1;min-width:0;margin-top:0;padding-inline:9px}
.utility-button{display:flex;flex-direction:column;align-items:center;justify-content:center;gap:2px;width:44px;flex-shrink:0;border:1px solid var(--soft-line);border-radius:15px;background:var(--surface);color:var(--text);font-size:10px;line-height:1.1;padding:5px 3px}
.utility-button svg{width:18px;height:18px;fill:none;stroke:currentColor;stroke-width:1.7;stroke-linecap:round;stroke-linejoin:round}
.utility-button:disabled{color:var(--muted);opacity:.6;cursor:default}
#new-message[data-finish="true"]{width:60px;background:var(--selected);color:var(--selected-text);border-color:var(--selected);font-weight:650}
.checks-action{display:block;width:100%;min-height:28px;padding:5px 9px;border:1px solid var(--line);border-radius:10px;color:var(--text);background:var(--surface);font-size:11px;line-height:1.3;text-align:left}
#recent-dialog[open]{display:flex;flex-direction:column;gap:7px;height:min(420px,calc(var(--app-height,100dvh) - 24px));overflow-y:auto;overscroll-behavior:contain;padding:12px}
.recent-heading,.recent-nav{display:flex;align-items:center;justify-content:space-between;gap:10px;flex-shrink:0}
.recent-heading h2{font-size:18px;margin:0}
.recent-note,#recent-status{font-size:11px;color:var(--muted);line-height:1.3;margin:0;flex-shrink:0}
#recent-status:empty{display:none}
.recent-nav button{min-width:32px;min-height:28px;border:1px solid var(--line);border-radius:999px;color:var(--text);background:var(--input)}
.recent-nav button:disabled{opacity:.4}
#recent-position,#recent-label{font-size:12px;color:var(--muted)}
#recent-label{white-space:nowrap;overflow:hidden;text-overflow:ellipsis;flex-shrink:0}
.history-tabs{display:flex;gap:4px;flex-shrink:0;padding:3px;border-radius:999px;background:var(--surface)}
.history-tabs button{flex:1;min-height:36px;padding:6px;border:0;border-radius:999px;background:transparent;color:var(--muted);font-size:13px}
.history-tabs button[aria-pressed="true"]{background:var(--selected);color:var(--selected-text);font-weight:600}
#recent-date:empty,#finish-status:empty,#archive-delete-status:empty{display:none}
#clear-archive{align-self:flex-end;min-height:36px;font-size:12px}
#recent-text{width:100%;min-height:44px;flex:1;resize:none;border:1px solid var(--line);border-radius:12px;padding:9px;color:var(--text);background:var(--input);font-size:16px;line-height:1.45;overflow:auto}
.recent-actions{flex-shrink:0;gap:5px;flex-wrap:nowrap}
.recent-actions button{padding-inline:7px;font-size:11px}
#copy-recent[aria-disabled="true"]{opacity:.6;cursor:default}
#copy-recent{background:var(--selected);color:var(--selected-text);border-color:var(--selected)}
@media(max-width:359px){#home{gap:7px}.copy-actions{gap:5px}.copy-actions .copy-button{font-size:14px;gap:6px}.copy-actions .copy-button svg{width:18px;height:18px}.utility-button{width:40px}}
@media(max-height:419px){.checks-action{min-height:24px;padding-block:3px}.utility-button{padding-block:3px}.utility-button svg{width:16px;height:16px}}

/* Unclassified replies reuse the quick-message choices in the same panel. */
#quick-replies{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:4px;margin-top:4px}
#quick-replies .preset{display:flex;align-items:center;justify-content:flex-start;gap:5px;min-width:0;min-height:32px;padding:5px 7px;font-size:11px;white-space:normal;text-align:left;line-height:1.15;border-radius:11px}
#quick-replies svg{width:16px;height:16px;flex-shrink:0;fill:none;stroke:currentColor;stroke-width:1.6;stroke-linecap:round;stroke-linejoin:round}
.quick-reply-other,#quick-reply-summary{display:flex;align-items:center;justify-content:space-between;gap:8px;min-height:26px}
.quick-reply-other .subtle,#quick-reply-summary .subtle{font-size:11px;min-height:26px;padding:3px 0}
#quick-reply-label{font-size:12px;font-weight:600}
.app[data-quick-picker="true"][data-view="details"] :is(#details-form,.message-panel){display:none}
.app[data-quick-picker="true"][data-view="message"] #reply-panel{display:none}
.app[data-keyboard="true"][data-editing="incoming"] :is(#quick-reply-panel,#quick-reply-summary){display:none}
@media(max-height:659px){#reply-panel[data-collapsed="false"] #quick-reply-panel{display:none}}
@media(max-height:479px){
 #reply-panel[data-quick-picker="true"] .recognition{display:none}
 #reply-panel:has(#reply-types:not([hidden])) .recognition{display:flex}
 #quick-replies .preset{min-height:30px;font-size:10px;padding:4px 5px;gap:4px}
 #quick-replies svg{width:14px;height:14px}
}
.app:has(#reply-types:not([hidden])) #details-form{display:none}
@media(max-height:419px){.field textarea{height:56px;padding-block:5px;line-height:1.3}}
/* Keep the original available even while the response panels are staged. */
.app[data-keyboard="true"][data-editing="incoming"] #reply-panel{display:none}
@media(max-height:419px){
 .customer-message{padding:4px 8px;border-radius:12px}
 .customer-message-heading{min-height:20px;margin-bottom:2px}
 .customer-message[data-reference="true"] #incoming{height:34px;line-height:1.4}
}
#info-dialog { padding:16px;overflow:hidden;border-radius:22px; }
#info-dialog[open] { display:flex;flex-direction:column; }
.info-heading { display:flex;justify-content:space-between;align-items:center;gap:12px;flex-shrink:0; }
.info-heading h2 { margin:0;font-size:19px; }
.info-heading h2:focus { outline:none; }
.info-heading button { min-height:40px;padding:8px; }
.info-body { min-height:0;overflow-y:auto;font-size:14px;line-height:1.5;overscroll-behavior:contain; }
.info-body:focus-visible { outline:2px solid var(--focus);outline-offset:-2px; }
.info-body h3 { font-size:14px;margin:18px 0 4px; }
.info-body p { margin:8px 0;color:var(--muted); }
.info-body a { color:var(--text);text-underline-offset:3px; }
.info-body a:focus-visible { outline:2px solid var(--focus);outline-offset:3px; }
.info-version { font-size:11px; }
@media(max-width:389px){.app-header h1{font-size:17px}.app-header .app-symbol{width:19px;height:19px}#home{gap:5px}}
@media(max-height:419px){.workflow-switch{margin-right:78px}}

/* A small trade shortcut keeps setup out of the composing workflow. */
.brand-block{min-width:0;display:flex;flex-direction:column;align-items:flex-start}
.setup-opener{max-width:calc(100% - 25px);min-height:28px;border:0;border-radius:999px;padding:3px 8px;margin-left:25px;background:var(--surface);color:var(--muted);font-size:11px;line-height:1.2;overflow:hidden;white-space:nowrap;text-overflow:ellipsis}
.app-header{align-items:flex-start}
.header-tools{padding-top:2px}
.setup-dialog{--setup-accent:#4cc4a5;background:var(--page);border-color:var(--soft-line,var(--line));border-radius:24px;padding:22px;max-width:480px;overflow-y:auto;overscroll-behavior:contain;scroll-padding:20px}
:root[data-theme="light"] .setup-dialog{--setup-accent:#176b57}
.setup-top{display:flex;justify-content:space-between;gap:12px;color:var(--muted);font-size:12px;line-height:1.3}
.setup-progress{display:flex;gap:5px;margin:15px 0 22px}
.setup-progress span{height:4px;flex:1;border-radius:999px;background:var(--chip)}
.setup-progress span[data-complete="true"]{background:var(--setup-accent)}
.setup-dialog h2{font-size:25px;line-height:1.15;letter-spacing:-.5px;margin:0 0 10px}
.setup-dialog h2:focus{outline:none}
.setup-description{color:var(--muted);font-size:14px;line-height:1.45;margin:0 0 20px}
.setup-trades{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:8px}
.setup-trade{display:flex;align-items:center;justify-content:space-between;gap:7px;min-width:0;min-height:52px;padding:11px 12px;border:1px solid var(--line);border-radius:15px;background:var(--input);color:var(--text);font-size:14px;line-height:1.2;text-align:left;overflow-wrap:anywhere}
.setup-trade[aria-pressed="true"]{border-color:var(--setup-accent);box-shadow:inset 0 0 0 1px var(--setup-accent);background:var(--surface);font-weight:650}
.setup-check{color:var(--setup-accent);font-size:18px;flex-shrink:0;visibility:hidden}
.setup-trade[aria-pressed="true"] .setup-check{visibility:visible}
.setup-field{margin:16px 0}
.setup-field label{display:block;margin-bottom:7px;color:var(--text);font-size:14px}
.setup-field input{min-height:44px!important;border-radius:999px!important;padding:10px 14px!important}
.setup-summary{display:flex;flex-direction:column;gap:10px;margin:18px 0;padding:17px;border-radius:18px;background:var(--preview);color:var(--text);font-size:14px;line-height:1.35;overflow-wrap:anywhere}
.setup-caption{font-size:11px;color:var(--muted)}
.setup-summary>strong{font-size:17px}
.setup-summary-row{display:grid;grid-template-columns:75px minmax(0,1fr);gap:10px}
.setup-summary-row dt{color:var(--muted)}
.setup-summary-row dd{margin:0;text-align:right;font-weight:550}
.setup-ready-check{display:grid;place-items:center;margin:0 auto 18px;width:44px;height:44px;border:2px solid var(--setup-accent);border-radius:50%;color:var(--setup-accent);font-size:28px}
.setup-dialog:has(.setup-ready-check) h2,.setup-dialog:has(.setup-ready-check) .setup-description{text-align:center}
.setup-note{color:var(--muted);font-size:12px;line-height:1.4;margin:12px 0}
.setup-status{color:var(--warning);font-size:13px;line-height:1.4;margin:12px 0}
.setup-status:empty{display:none}
.setup-status:focus{outline:2px solid var(--focus);outline-offset:3px;border-radius:4px}
.setup-actions{display:flex;gap:8px;margin-top:22px}
.setup-actions button,.setup-session{min-width:0;min-height:44px;padding:10px 15px;border:1px solid var(--line);border-radius:999px;font-size:15px;line-height:1.2;background:var(--input);color:var(--text)}
.setup-actions .setup-primary{flex:1;background:var(--selected);color:var(--selected-text);border-color:var(--selected);font-weight:650}
.setup-back{flex:0 0 auto}
.setup-skip{display:block;margin:7px auto -5px;min-height:44px;padding:8px 14px;border:0;border-radius:999px;background:transparent;color:var(--muted);font-size:13px}
.setup-session{width:100%;font-size:14px}
@media(max-width:359px){.setup-dialog{padding:17px}.setup-dialog h2{font-size:23px}.setup-progress{margin-bottom:18px}.setup-trades{gap:7px}.setup-trade{font-size:13px;padding:10px;gap:4px}.setup-description{margin-bottom:16px}.setup-opener{margin-left:24px;max-width:calc(100% - 24px)}}
@media(max-height:659px){.setup-dialog{padding-block:16px}.setup-progress{margin:10px 0 16px}.setup-description{margin-bottom:14px}.setup-trade{min-height:44px;padding-block:9px}.setup-actions{margin-top:16px}}
@media(max-height:419px){.app-header{position:static;min-height:28px;align-items:center}.app-header .brand-block{min-width:0}.setup-opener{margin-left:0;max-width:180px}.header-tools{padding-top:0}.workflow-switch{margin-right:0}}
.presets[aria-labelledby="label-service"] .preset{min-width:0;overflow-wrap:anywhere}
.presets[aria-labelledby="label-service"] .preset:only-child{grid-column:1/-1}
/* At phone heights, keep choices and actions, trim decorative spacing. */
@media(max-height:600px){
 .setup-dialog{padding-block:12px}
 .setup-progress{margin:8px 0 12px}
 .setup-description{display:none}
 .setup-actions{margin-top:12px}
 .setup-skip{min-height:32px;margin-top:5px}
 .setup-ready-check{margin-bottom:12px}
}

/* Detailed Quote is staged, never a long scrolling form. */
.workflow-switch:has(:where(#detailed-mode)) button{min-width:0;padding-inline:5px;font-size:12px}
.app[data-workflow="detailed"] #compose-area{overflow:hidden}
#detailed-panel{display:flex;flex-direction:column;gap:8px;min-width:0;min-height:0;padding:9px 11px;border-radius:20px;background:var(--surface);box-shadow:inset 0 0 0 1px var(--soft-line);overflow:hidden}
#compose-area>#detailed-panel{flex:0 1 auto}
.dq-stages{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:3px;border-bottom:1px solid var(--soft-line);padding-bottom:3px;flex-shrink:0}
.dq-stage{min-width:0;min-height:40px;padding:5px 2px;border:0;border-radius:10px;background:transparent;color:var(--muted);font-size:12px}
.dq-stage[aria-pressed="true"]{background:var(--chip);color:var(--text);font-weight:650}
.dq-body{display:flex;flex-direction:column;gap:8px;min-width:0;min-height:0}
.dq-heading{display:flex;align-items:center;justify-content:space-between;gap:8px;min-width:0;flex-shrink:0}
.dq-heading h2{margin:0;font-size:15px;line-height:1.25;letter-spacing:-.2px}
.dq-heading h2:focus{outline:none}
.dq-link{min-height:32px;padding:4px 7px;border:0;border-radius:10px;background:transparent;color:var(--muted);font-size:12px;line-height:1.2}
.dq-link:hover{text-decoration:underline}
.dq-choices{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:6px;min-width:0;flex-shrink:0}
.dq-choice{min-height:44px;min-width:0;padding:7px 8px;border:1px solid transparent;border-radius:15px;background:var(--chip);color:var(--text);font-size:13px;line-height:1.2;overflow-wrap:anywhere}
.dq-choice[aria-pressed="true"]{background:var(--selected);color:var(--selected-text);font-weight:600}
.dq-segmented{border:0;padding:0;margin:0;min-width:0;flex-shrink:0}
.dq-segmented legend{padding:0 0 5px;color:var(--muted);font-size:12px}
.dq-segmented-track{position:relative;display:grid;grid-template-columns:repeat(2,minmax(0,1fr));padding:3px;isolation:isolate;border:1px solid var(--line);border-radius:999px;background:var(--input)}
.dq-segmented-track::before{content:"";position:absolute;z-index:-1;top:3px;bottom:3px;left:3px;width:calc((100% - 6px)/2);border-radius:999px;background:var(--selected);transition:transform .18s ease}
.dq-segmented-track[data-selected="1"]::before{transform:translateX(100%)}
.dq-segmented-track[data-selected="-1"]::before{display:none}
.dq-segmented-option{position:relative;display:flex;align-items:center;justify-content:center;min-width:0;min-height:44px;border-radius:999px;cursor:pointer}
.dq-segmented-option input{position:absolute;inset:0;opacity:0;width:100%;height:100%;margin:0;cursor:pointer}
.dq-segmented-option span{position:relative;pointer-events:none;padding:7px 4px;color:var(--muted);font-size:13px;line-height:1.2;text-align:center}
.dq-segmented-option input:checked+span{color:var(--selected-text);font-weight:650}
.dq-segmented-option:has(input:focus-visible){outline:3px solid var(--focus);outline-offset:2px}
@media(prefers-reduced-motion:reduce){.dq-segmented-track::before{transition:none}}
/* Keep both labelled choices available on very short screens without stacking
   two tall rails. Native radio targets remain at least 44px high. */
.app[data-compact-options="true"] .dq-body:has(.dq-segmented){display:grid;grid-template-columns:repeat(2,minmax(0,1fr));align-content:start;gap:6px}
.app[data-compact-options="true"] .dq-body:has(.dq-segmented)>.dq-heading{grid-column:1/-1}
.app[data-compact-options="true"] .dq-segmented{margin:0;align-self:start}
.app[data-compact-options="true"] .dq-segmented-option span{font-size:12px;padding-inline:2px}
.dq-services{grid-template-columns:repeat(3,minmax(0,1fr))}
.dq-services>.dq-choice:only-child{grid-column:1/-1}
.dq-saved-name{white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.dq-describe,.dq-format{min-width:0;min-height:36px;padding:7px 10px;border:1px solid var(--line);border-radius:999px;background:transparent;color:var(--text);font-size:12px;line-height:1.3;text-align:left;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;flex-shrink:0}
.dq-format{text-align:center}
.dq-footer{display:flex;align-items:center;gap:8px;margin-top:2px;flex-shrink:0}
.dq-next{flex:1;min-width:0;min-height:40px;border:0;border-radius:999px;padding:8px 12px;background:var(--chip);color:var(--text);font-size:13px;font-weight:600}
.dq-field{min-width:0;min-height:0}
.dq-field label{display:block;margin-bottom:5px;font-size:12px;line-height:1.25;color:var(--muted)}
.dq-field input,.dq-field textarea{width:100%;min-width:0;min-height:44px;border:1px solid var(--line);border-radius:13px;padding:8px 10px;background:var(--input);color:var(--text);font-size:16px;line-height:1.35}
.dq-field textarea{display:block;height:82px;resize:none;overflow:auto}
.dq-field input[aria-invalid="true"],.dq-field textarea[aria-invalid="true"]{border-color:var(--warning)}
.dq-cost-fields{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:7px}
.dq-cost-fields input{padding-inline:7px}
.dq-cost-fields input::placeholder{font-size:12px}
.dq-hint{margin:0;color:var(--muted);font-size:11px;line-height:1.3;flex-shrink:0}
.dq-total{display:flex;align-items:center;justify-content:space-between;gap:8px;min-width:0;padding:10px 12px;border-radius:14px;background:var(--preview);color:var(--text);font-size:13px;flex-shrink:0}
.dq-total output{min-width:0;font-size:20px;font-weight:650;text-align:right;overflow-wrap:anywhere}
.dq-dates,.dq-rates{grid-template-columns:repeat(4,minmax(0,1fr))}
.dq-dates .dq-choice,.dq-rates .dq-choice{padding-inline:3px;font-size:12px}
.dq-booking-choices{grid-template-columns:repeat(3,minmax(0,1fr))}
.dq-booking-choices .dq-choice{min-height:52px;padding-inline:5px}
@media(max-height:739px){
 .app[data-workflow="detailed"] #compact-view{display:flex}
 .app[data-workflow="detailed"][data-view="details"] .message-panel{display:none}
 .app[data-workflow="detailed"][data-view="message"] #detailed-panel{display:none}
 .app[data-workflow="detailed"][data-view="details"] #pending{display:none}
 .app[data-workflow="detailed"] #compose-area>#detailed-panel{flex:1 1 0}
 .app[data-workflow="detailed"] .dq-body{flex:1 1 0}
 .app[data-workflow="detailed"] .dq-footer{margin-top:auto}
}
.app[data-workflow="detailed"][data-short="true"][data-view="message"] #detailed-panel{display:none}
.app[data-workflow="detailed"][data-detailed-split="true"] #compact-view{display:flex}
.app[data-workflow="detailed"][data-detailed-split="true"][data-view="details"] .message-panel{display:none}
.app[data-workflow="detailed"][data-detailed-split="true"][data-view="message"] #detailed-panel{display:none}
.app[data-workflow="detailed"][data-detailed-split="true"][data-view="details"] #pending{display:none}
.app[data-workflow="detailed"][data-detailed-split="true"] #compose-area>#detailed-panel{flex:1 1 0}
.app[data-workflow="detailed"][data-detailed-split="true"] .dq-body{flex:1 1 0}
.app[data-workflow="detailed"][data-detailed-split="true"] .dq-footer{margin-top:auto}
.app[data-workflow="detailed"][data-keyboard="true"][data-editing="message"] #detailed-panel{display:none}
.app[data-workflow="detailed"][data-keyboard="true"][data-editing="field"] #compose-area>#detailed-panel{flex:1 1 0}
.app[data-workflow="detailed"][data-keyboard="true"][data-editing="field"] :is(.dq-describe,.dq-format,.dq-hint,.dq-choices,.dq-presets-back){display:none}
.app[data-workflow="detailed"][data-keyboard="true"][data-editing="field"] .dq-body>.dq-link{display:none}
.app[data-workflow="detailed"][data-keyboard="true"][data-editing="field"] .dq-body{flex:1 1 0;gap:5px}
.app[data-workflow="detailed"][data-keyboard="true"][data-editing="field"] .dq-field textarea{height:70px;min-height:44px}
@media(max-width:359px){.workflow-switch:has(:where(#detailed-mode)) button{font-size:11px;padding-inline:3px}#detailed-panel{padding-inline:8px}.dq-choice{font-size:12px;padding-inline:5px}.dq-total output{font-size:18px}.dq-cost-fields{gap:5px}}
@media(max-height:479px){
 #detailed-panel{gap:5px;padding-block:6px}
 .dq-body{gap:5px}
 .dq-stage{min-height:32px;font-size:11px}
 .dq-heading h2{font-size:14px}
 .dq-next{min-height:34px;padding-block:6px}
 .dq-field textarea{height:65px}
 .dq-total{padding-block:7px}
 .dq-describe,.dq-format{min-height:30px;padding-block:5px}
}
/* The forward action remains available at every viewport height. */
#detailed-panel[data-compact="true"]{gap:5px;padding-block:6px}
#detailed-panel[data-compact="true"] .dq-body{gap:5px}
#detailed-panel[data-compact="true"] .dq-stage{min-height:32px}

#detailed-panel[data-compact="true"] .dq-total{padding-block:7px}
#detailed-panel[data-compact="true"] .dq-heading h2{font-size:14px}

/* Keep the quote's place and progress above the native keyboard. These selectors
   intentionally override the older global keyboard hide rule, including its IDs. */
.dq-keyboard-done{display:none}
.dq-stage[data-complete="true"]{color:var(--text)}
.app[data-workflow="detailed"][data-keyboard="true"][data-editing="field"] > :is(.app-header,.workflow-switch,#compact-view){display:flex}
.app[data-workflow="detailed"][data-keyboard="true"][data-editing="field"] > :is(#compact-view,#keyboard-done,.copy-meta){display:none}
.app[data-workflow="detailed"][data-keyboard="true"][data-editing="field"] .app-header{position:static;min-height:28px;align-items:center}
.app[data-workflow="detailed"][data-keyboard="true"][data-editing="field"] .app-header h1{display:block;font-size:16px;letter-spacing:-.4px}
.app[data-workflow="detailed"][data-keyboard="true"][data-editing="field"] .app-symbol{width:19px;height:19px}
.app[data-workflow="detailed"][data-keyboard="true"][data-editing="field"] .setup-opener{display:none}
.app[data-workflow="detailed"][data-keyboard="true"][data-editing="field"] .header-tools{padding-top:0}
.app[data-workflow="detailed"][data-keyboard="true"][data-editing="field"] .workflow-switch button{min-height:28px;padding-block:4px}
.app[data-workflow="detailed"][data-keyboard="true"][data-editing="field"] #detailed-panel{padding-block:6px;gap:5px;border-color:var(--line)}
.app[data-workflow="detailed"][data-keyboard="true"][data-editing="field"] .dq-stages{display:grid;flex-shrink:0}
.app[data-workflow="detailed"][data-keyboard="true"][data-editing="field"] .dq-stage{min-height:32px;font-size:11px}
.app[data-workflow="detailed"][data-keyboard="true"][data-editing="field"] .dq-heading{min-height:28px}
.app[data-workflow="detailed"][data-keyboard="true"][data-editing="field"] .dq-heading h2{font-size:14px}
.app[data-workflow="detailed"][data-keyboard="true"][data-editing="field"] .dq-heading>.dq-link:not(.dq-keyboard-done){display:none}
.app[data-workflow="detailed"][data-keyboard="true"][data-editing="field"] .dq-keyboard-done{display:block;min-height:28px;font-weight:650;color:var(--text)}
.app[data-workflow="detailed"][data-keyboard="true"][data-editing="field"] #detailed-panel[data-panel="charge"] .dq-keyboard-done{display:none}
.app[data-workflow="detailed"][data-keyboard="true"][data-editing="field"] .dq-total{padding-block:6px}
.app[data-workflow="detailed"][data-keyboard="true"][data-editing="field"] .dq-total output{font-size:18px}
.app[data-workflow="detailed"][data-keyboard="true"][data-editing="field"] .copy-button{min-height:40px;padding-block:7px}
.app[data-workflow="detailed"][data-keyboard="true"][data-editing="field"][data-tight-keyboard="true"] .dq-total{display:none}
.app[data-workflow="detailed"][data-keyboard="true"][data-editing="field"][data-tight-keyboard="true"] .dq-field textarea{height:48px}
.app[data-workflow="detailed"][data-keyboard="true"][data-editing="field"][data-tight-keyboard="true"] > :is(.app-header,.workflow-switch,#compact-view,.copy-actions){display:none}

/* Continuous preview, with page chrome and Copy outside the scroll surface. */
.app[data-view="message"] #compose-area > .message-panel { flex:1 1 100px;min-height:60px; }
.app[data-workflow="detailed"][data-view="message"] #compose-area { overflow-y:auto; }
#message { touch-action:pan-y;scrollbar-color:var(--line) transparent; }
.app-symbol { object-fit:contain;border-radius:7px; }
/* Customer-name actions belong to the same neutral control family. */
:root { --name-accent:#303034;--name-ink:#f5f5f5; }
:root[data-theme="light"] { --name-accent:#e3e3e8;--name-ink:#171719; }
#add-name,.name-action { display:inline-flex;align-items:center;justify-content:center;min-height:36px;max-width:140px;margin:0;padding:6px 11px;border:1px solid var(--soft-line);border-radius:999px;background:var(--name-accent);color:var(--name-ink);font-size:12px;font-weight:600;line-height:1.2;text-decoration:none;white-space:nowrap; }
.detail-navigation { display:flex;align-items:stretch;gap:7px;margin-top:8px; }
.detail-navigation button { min-width:0;min-height:40px;border:1px solid var(--line);border-radius:999px;padding:8px 12px;font-size:13px;font-weight:600;line-height:1.2;background:var(--input);color:var(--text); }
#detail-forward { flex:1;background:var(--selected);color:var(--selected-text);border-color:var(--selected); }
#detail-forward[aria-disabled="true"] { background:var(--chip);color:var(--muted);border-color:var(--line); }
.dq-footer { display:flex; }
.dq-next { background:var(--selected);color:var(--selected-text); }
/* Trim decoration, never the way forward. The body can recover at enlarged text. */
.dq-body { overflow-y:auto;overscroll-behavior:contain;scrollbar-width:thin;scroll-padding:6px;padding:6px; }
.dq-body > * { flex-shrink:0; }
.dq-footer { background:var(--surface);padding:4px 6px 0; }
.app[data-keyboard="true"][data-editing="field"] .detail-navigation { margin-top:6px; }
.app[data-keyboard="true"][data-editing="field"] .detail-navigation button { min-height:36px;padding-block:6px; }
.app[data-workflow="detailed"][data-keyboard="true"][data-editing="field"] .dq-footer { display:flex;margin-top:4px; }
.app[data-workflow="detailed"][data-keyboard="true"][data-editing="field"] .dq-footer>.dq-link { display:none; }
.app[data-workflow="detailed"][data-keyboard="true"][data-editing="field"] .dq-footer .dq-next { min-height:36px;padding-block:6px; }
@media(max-height:659px) {
 .app[data-workflow="quick"][data-view="details"]:not([data-mode-picker="true"]) #modes { display:none; }
 .app[data-workflow="quick"][data-view="details"]:not([data-mode-picker="true"]) #choose-purpose { display:block;text-align:left;min-height:28px; }
 .app[data-workflow="quick"][data-mode-picker="true"] #details-form { display:none; }
}
.app[data-workflow="quick"][data-keyboard="true"] #choose-purpose { display:none; }
@media(max-height:479px) { .detail-navigation { margin-top:5px; }.detail-navigation button { min-height:36px;padding-block:6px; } }

/* A clean title row and the approved standalone speech-bubble mark. */
.app-header { align-items:center; }
.header-tools { padding-top:0; }
.app-header .app-symbol { width:43px;height:32px;object-fit:contain;border-radius:0;filter:brightness(0) invert(1); }
:root[data-theme="light"] .app-header .app-symbol { filter:none; }
#edit-setup[aria-expanded="true"] { background:var(--selected);color:var(--selected-text);font-weight:650; }
.setup-dialog[open] { display:flex;flex-direction:column;position:fixed;top:calc(var(--app-top,0px) + 12px);bottom:auto;margin:0 auto;max-height:calc(var(--app-height,100dvh) - 24px);overflow:hidden; }
.setup-dialog > :not(.setup-body) { flex-shrink:0; }
.setup-body { min-height:0;overflow-y:auto;overscroll-behavior:contain;scrollbar-width:thin;scroll-padding:6px;padding:3px; }
.setup-body .setup-field:first-child { margin-top:5px; }
.setup-footer { padding-top:2px; }
.profile-tabs { display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:4px;padding:3px;margin:4px 0 12px;background:var(--surface);border-radius:999px; }
.profile-tabs button { min-height:44px;border:0;border-radius:999px;background:transparent;color:var(--muted);font-size:14px; }
.profile-tabs button[aria-selected="true"] { background:var(--selected);color:var(--selected-text);font-weight:650; }
.profile-signature-note { margin:6px 0 12px; }
.profile-storage-note { margin:10px 0 0; }
.setup-footer .setup-actions { margin-top:12px; }
@media(max-width:389px) {
 .app-header .app-symbol { width:31px;height:23px; }
}
@media(max-height:600px) {
 .setup-dialog { padding:14px 16px; }
 .setup-trades { gap:6px; }
 .setup-dialog h2 { font-size:22px; }
 .setup-field { margin:10px 0; }
 .setup-field label { margin-bottom:5px; }
 .setup-summary { margin:8px 0;padding:12px; }
 .setup-footer .setup-actions { margin-top:8px; }
 .profile-tabs { margin-bottom:8px; }
}
@media(max-height:419px) {
 .setup-dialog { padding:10px 14px; }
 .setup-top,.setup-progress { display:none; }
 .setup-dialog h2 { font-size:18px;margin-bottom:6px; }
 .profile-tabs { margin-block:0 5px; }
 .profile-tabs button { min-height:36px; }
 .setup-footer .profile-storage-note { display:none; }
 .setup-footer .setup-actions { margin-top:5px; }
 .setup-footer .setup-skip { margin-block:0; }
}
/* iOS can shrink only visualViewport; layout-height media queries then stay tall. */
.setup-dialog[data-keyboard="true"] { padding:10px 14px; }
.setup-dialog[data-keyboard="true"] :is(.setup-top,.setup-progress,.profile-tabs,.profile-storage-note) { display:none; }
.setup-dialog[data-keyboard="true"] h2 { font-size:18px;margin-bottom:6px; }
.setup-dialog[data-keyboard="true"] .setup-field { margin:6px 0; }
.setup-dialog[data-keyboard="true"] .setup-field label { margin-bottom:4px; }
.setup-dialog[data-keyboard="true"] .setup-footer .setup-actions { margin-top:5px; }
.setup-dialog[data-keyboard="true"] .setup-skip { min-height:32px;margin-block:0; }

/* One header menu for saved details, appearance and help. */
.menu-toggle { display:flex;align-items:center;justify-content:center;gap:6px;min-height:44px;padding:8px 11px;border:1px solid var(--soft-line,var(--line));border-radius:999px;background:var(--surface);color:var(--text);font-size:12px; }
.menu-toggle svg { width:18px;height:18px;fill:none;stroke:currentColor;stroke-width:1.8;stroke-linecap:round; }
#app-menu { position:fixed;top:calc(var(--app-top,0px) + 12px);bottom:auto;margin:0 auto;width:calc(100% - 24px);max-width:360px;max-height:calc(var(--app-height,100dvh) - 24px);padding:14px;border:1px solid var(--soft-line,var(--line));border-radius:22px;background:var(--page);overflow-y:auto;overscroll-behavior:contain; }
.menu-heading { display:flex;align-items:center;justify-content:space-between;gap:12px;margin-bottom:8px; }
.menu-heading h2 { margin:0;font-size:20px; }
.menu-heading button { min-height:44px;padding:8px;font-size:13px; }
.menu-options { display:flex;flex-direction:column;gap:6px; }
.menu-option { display:flex;align-items:center;gap:12px;width:100%;min-height:52px;padding:12px;border:0;border-radius:14px;background:var(--surface);color:var(--text);font-size:15px;text-align:left; }
.menu-option>svg { width:21px;height:21px;flex-shrink:0;fill:none;stroke:currentColor;stroke-width:1.7;stroke-linecap:round;stroke-linejoin:round; }
.menu-chevron { margin-left:auto;font-size:23px;color:var(--muted); }
.theme-switch-track { display:flex;align-items:center;width:38px;height:24px;padding:3px;margin-left:auto;border:1px solid var(--line);border-radius:999px;background:var(--input); }
.theme-switch-track>span { width:16px;height:16px;border-radius:50%;background:var(--muted);transition:transform 150ms ease; }
#theme-toggle[aria-checked="true"] .theme-switch-track { background:var(--selected);border-color:var(--selected); }
#theme-toggle[aria-checked="true"] .theme-switch-track>span { background:var(--selected-text);transform:translateX(14px); }
@media(max-width:359px) { .menu-toggle { padding-inline:9px;gap:4px; }.menu-toggle svg { width:16px; } }
@media(prefers-reduced-motion:reduce) { .theme-switch-track>span { transition:none; } }

/* Neutral tonal layers connect the tool rail with its quick-message choices.
   Paint only: preserve the compact, keyboard-aware layout and panel hierarchy. */
:root {
 --tool-surface:#1b1b1e;--purpose-surface:#242427;--purpose-hover:#2c2c30;
 --purpose-selected:#d9d9de;--purpose-ink:#202024;
}
:root[data-theme="light"] {
 --tool-surface:#e9e9ec;--purpose-surface:#f4f4f5;--purpose-hover:#dfdfe3;
 --purpose-selected:#d9d9df;--purpose-ink:#202024;
}
#message-tools { background:var(--tool-surface); }
#modes { background:var(--tool-surface);border-radius:22px;box-shadow:inset 0 0 0 1px var(--soft-line); }
#modes > button { background:var(--purpose-surface); }
#modes > button[aria-pressed="true"] { background:var(--purpose-selected);color:var(--purpose-ink);border-color:var(--purpose-selected); }
@media(hover:hover) {
 #modes > button:not([aria-pressed="true"]):hover { background:var(--purpose-hover);color:var(--text); }
}
.setup-primary:disabled { background:var(--chip);color:var(--muted);border-color:var(--soft-line);box-shadow:none;cursor:default; }

/* The menu heading receives opening focus; keyboard controls keep their rings. */
#menu-title:focus { outline:none; }
.profile-field-heading { display:flex;align-items:center;justify-content:space-between;gap:10px;margin-bottom:5px; }
.profile-field-heading label { margin:0; }
.profile-show-switch { display:inline-flex;align-items:center;gap:7px;min-height:44px;padding:3px 0 3px 8px;border:0;background:transparent;color:var(--muted);font-size:12px; }
.profile-switch-track { display:flex;align-items:center;width:34px;height:22px;padding:3px;border:1px solid var(--line);border-radius:999px;background:var(--input); }
.profile-switch-track > span { width:14px;height:14px;border-radius:50%;background:var(--muted);transition:transform 150ms ease; }
.profile-show-switch[aria-checked="true"] .profile-switch-track { background:var(--selected);border-color:var(--selected); }
.profile-show-switch[aria-checked="true"] .profile-switch-track > span { transform:translateX(12px);background:var(--selected-text); }
.dq-inline-actions { display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:6px; }
.dq-inline-actions > :only-child { grid-column:1/-1; }
.dq-inline-actions button { min-width:0;white-space:normal; }
.dq-charge-list { display:flex;flex-direction:column;gap:6px; }
.dq-charge-list button { display:flex;justify-content:space-between;gap:10px;min-width:0;text-align:left; }
.dq-charge-label { min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap; }
.dq-charge-value { flex-shrink:0; }
.dq-footer > .dq-link { min-height:40px;border:1px solid var(--soft-line);padding-inline:10px; }
@media(prefers-reduced-motion:reduce) { .profile-switch-track > span { transition:none; } }
