.ha-pillow-panel { border: 1px solid #22d3ee; border-radius: 10px; padding: 12px; margin-bottom: 16px; background: var(--bg-glass); }
/* Superseded strategy stays sidelined even when freehand editing is paused. */
.ha-freehand-strategy #prepared-ha-cheek-pilot,
.ha-freehand-strategy #prepared-ha-region-panel,
.ha-freehand-strategy .ha-region-overlay,
.ha-freehand-strategy .ha-cheek-direct,
.ha-freehand-strategy .filler-simulation-controls { display: none !important; }
.ha-pillow-panel[hidden] { display: none !important; }
.ha-pillow-panel h3 { font-size: .9rem; }
.ha-pillow-panel p { font-size: .75rem; line-height: 1.45; margin: 10px 0; }
.ha-pillow-panel label { display: block; font-size: .8rem; margin: 12px 0; }
.ha-pillow-panel input[type=range], .ha-pillow-panel select { width: 100%; margin-top: 8px; }
.ha-pillow-panel select { background: var(--bg-glass); color: var(--color-text-primary); padding: 7px; }
.ha-pillow-panel output { color: #22d3ee; }
.ha-pillow-panel > [role=status], .ha-pillow-panel [data-save-note] { padding: 9px; border: 1px solid #22d3ee55; border-radius: 6px; }
.ha-pillow-panel textarea { width: 100%; max-width: 100%; box-sizing: border-box; color: var(--color-text-primary); background: var(--bg-glass); }
.ha-pillow-panel details { margin: 10px 0; }
.ha-pillow-panel [data-pocket-controls] { min-width: 0; border: 1px solid #22d3ee88; border-radius: 8px; padding: 10px; margin: 16px 0; }
.ha-pillow-panel [data-pocket-controls] legend { font-size: .85rem; font-weight: 600; }
.ha-pillow-panel [data-pocket-controls] :disabled { opacity: .45; }
.ha-zone-inflator { border: 1px solid #22d3ee; padding: 10px; border-radius: 8px; margin: 12px 0; }
.ha-zone-inflator h4 { font-size: .85rem; }
.ha-zone-inflator input[type=checkbox] { accent-color: #06b6d4; }
.ha-zone-inflator :disabled { opacity: .4; }
.ha-pillow-enabled .filler-simulation-controls { display: none !important; }
.ha-pillow-inflator-bank[hidden], .ha-pillow-inflator-bank label[hidden] { display: none !important; }
.ha-pillow-inflator-bank { border: 1px solid #22d3ee; padding: 12px; border-radius: 8px; }
.ha-pillow-inflator-bank h3 { font-size: .9rem; }
.ha-pillow-inflator-bank p { font-size: .75rem; line-height: 1.45; margin: 10px 0; }
.ha-pillow-inflator-bank label { display: block; margin: 14px 0; font-size: .8rem; }
.ha-pillow-inflator-bank output { float: right; color: #22d3ee; }
.ha-pillow-inflator-bank input { display: block; width: 100%; margin-top: 9px; accent-color: #06b6d4; }
.ha-pillow-inflator-bank input:disabled { opacity: .3; }
.ha-pillow-panel button[aria-pressed=true] { border-color: #22d3ee; background: #0e749033; }
.ha-pillow-canvas { position: absolute; inset: 0; width: 100%; height: 100%; z-index: 80; pointer-events: none; }
.ha-pillow-canvas.is-drawing { pointer-events: auto; touch-action: none; cursor: crosshair; }
.ha-pillow-panel [role=status] { min-height: 2em; color: var(--color-text-secondary); }
.ha-pillow-enabled #prepared-ha-region-panel,
.ha-pillow-enabled #prepared-ha-cheek-pilot,
.ha-pillow-enabled .ha-region-overlay { display: none !important; }
.ha-pillow-enabled .anatomy-animation-card > .panel-title,
.ha-pillow-enabled .anatomy-animation-card > .panel-subtitle,
.ha-pillow-enabled .anatomy-animation-card > .simulation-evidence-notice { display: none; }
/* Both modes use the same flexible center track. Canvas intrinsic width must
   never establish a minimum width for the HA workspace. */
.main-content > .center-column, .ha-region-compact-shell, #visualizer-view, #canvas-holder { min-width: 0; width: 100%; }
#canvas-holder { overflow: hidden; position: relative; }
#canvas-holder > canvas:not(.ha-pillow-canvas) { display: block; width: 100% !important; height: 100% !important; max-width: 100%; }
@media (max-width:1024px) {
  .ha-pillow-enabled .ha-region-compact-shell { position: relative; }
  .ha-pillow-enabled .visualizer-container { height: 60dvh; }
}

.ha-pillow-workspace { display: contents; }
.ha-pillow-toolbar { position:absolute; bottom:12px; left:12px; right:12px; display:flex; justify-content:center; gap:6px; flex-wrap:wrap; z-index:90; pointer-events:auto; }
.ha-pillow-toolbar[hidden] { display:none; }
.ha-pillow-panel button, .ha-pillow-toolbar button { min-height:44px; min-width:44px; padding:10px 12px; border:1px solid #4c657f; border-radius:8px; background:var(--color-bg-panel,#101827); color:var(--color-text-primary,#eff6ff); font:inherit; font-size:.85rem; cursor:pointer; touch-action:manipulation; }
.ha-pillow-panel button:disabled, .ha-pillow-toolbar button:disabled { opacity:.4; cursor:default; }
.ha-pillow-panel input:not([type=checkbox]), .ha-pillow-panel select { box-sizing:border-box; width:100%; min-height:44px; font:inherit; font-size:16px; }
.ha-pillow-panel input[type=range] { touch-action:pan-y; cursor:ew-resize; accent-color:#22d3ee; }
.ha-pillow-panel input[type=checkbox] { width:22px; height:22px; vertical-align:middle; margin:8px; }
.ha-pillow-panel label { min-height:44px; font-size:.85rem; }
.ha-pillow-panel [data-pillow-list] { display:flex; flex-direction:column; gap:6px; max-height:180px; overflow:auto; }
.ha-pillow-panel [data-pillow-list] > div { display:flex; align-items:center; gap:4px; }
.ha-pillow-panel [data-pillow-list] button { flex:1; text-align:left; }
.ha-pillow-panel details > summary { min-height:44px; display:flex; align-items:center; cursor:pointer; font-weight:600; }
.ha-pillow-panel details > summary::before { content:'▸'; margin-right:8px; }
.ha-pillow-panel details[open] > summary::before { content:'▾'; }
.ha-pillow-panel :focus-visible, .ha-pillow-toolbar :focus-visible { outline:3px solid #67e8f9; outline-offset:2px; }
.ha-pillow-panel [data-pocket-controls] { margin:12px 0; }
.ha-pillow-panel [data-save-note] { font-size:.8rem; }
.ha-pillow-panel [data-action=draw], .ha-pillow-toolbar [data-toolbar-action=draw] { border-color:#22d3ee; background:#07506c; color:#fff; }
.ha-pillow-panel [data-action=clear] { color:#ffb7b7; }

@media (max-width:1024px) {
  .ha-pillow-workspace.is-active { display:grid; grid-template-columns:minmax(0,1fr) minmax(280px,320px); height:calc(100dvh - 88px); min-height:420px; position:sticky; top:76px; gap:8px; background:var(--color-bg-primary,#080d16); z-index:3; }
  .ha-pillow-workspace.is-active .visualizer-container { height:100%; min-height:0; }
  .ha-pillow-workspace.is-active .ha-pillow-panel { overflow-y:auto; overscroll-behavior:contain; margin:0; min-height:0; padding:12px; padding-bottom:env(safe-area-inset-bottom,12px); }
  .ha-pillow-workspace.is-active[data-collapsed=true] { grid-template-columns:1fr; }
  .ha-pillow-workspace.is-active[data-collapsed=true] > .ha-pillow-panel { display:none; }
  .ha-pillow-toolbar { gap:4px; bottom:8px; left:4px; right:4px; }
  .ha-pillow-toolbar button { font-size:.75rem; padding:8px; }
}
@media (max-width:640px) {
  .ha-pillow-workspace.is-active { grid-template-columns:1fr; grid-template-rows:minmax(240px,1fr) minmax(160px,38%); height:calc(100dvh - 82px); min-height:400px; top:70px; gap:0; }
  .ha-pillow-workspace.is-active .ha-pillow-panel { border-radius:16px 16px 0 0; border-bottom:0; box-shadow:0 -6px 20px #0004; }
  .ha-pillow-workspace.is-active[data-collapsed=true] { grid-template-rows:1fr; }
  .ha-pillow-toolbar { justify-content:flex-start; flex-wrap:nowrap; overflow-x:auto; }
  .ha-pillow-toolbar button { flex-shrink:0; }
}

.ha-hollow-controls { border:1px solid #22d3ee88; border-radius:10px; padding:10px; min-width:0; margin:12px 0; }
.ha-hollow-controls legend { font-size:.85rem; font-weight:600; }
.ha-hollow-controls [data-action=hollow], .ha-pillow-toolbar [data-toolbar-action=hollow-new] { border-color:#22d3ee; background:#07506c; }
.ha-pillow-panel [data-action=hollow-accept]:not(:disabled) { background:#075047; border-color:#43d5b0; }

/* Focused area workflow: only the current step is visible, regardless of role. */
.ha-pillow-panel [hidden], .ha-pillow-toolbar [hidden] { display:none !important; }
.ha-pillow-heading h3 { margin:0; font-size:1rem; line-height:1.3; }
.ha-pillow-heading [data-save-summary] { margin:5px 0 0; font-size:.72rem; color:var(--color-text-secondary,#a8b9cc); }
.ha-pillow-heading [data-save-summary][data-issue=true] { color:#ffcc91; padding:8px; border:1px solid #8c612d; border-radius:6px; }
.ha-pillow-panel > [role=status] { padding:0; margin:12px 0; border:0; min-height:0; line-height:1.45; }
.ha-area-selection { display:flex; align-items:flex-end; gap:8px; margin:14px 0; }
.ha-area-selection label { flex:1; min-width:0; margin:0; font-size:.75rem; }
.ha-area-selection select { text-overflow:ellipsis; border:1px solid #42556b; border-radius:8px; padding:8px; }
.ha-area-selection button { flex-shrink:0; }
.ha-area-chooser { padding:8px 0; }
.ha-area-chooser h4 { font-size:.88rem; margin:0 0 12px; }
.ha-area-chooser > .ha-primary { width:100%; background:#07506c; border-color:#22d3ee; font-weight:600; }
.ha-area-choices { display:grid; grid-template-columns:1fr; gap:8px; }
.ha-area-chooser > p { margin:6px 0 12px; }
.ha-pillow-panel details { border-top:1px solid #33465a66; padding:2px 0; margin:4px 0; }
.ha-pillow-panel details > summary { font-size:.82rem; font-weight:500; }
.ha-pillow-panel details[open] > summary { margin-bottom:8px; }
.ha-pillow-panel .ha-zone-inflator { margin:12px 0; padding:12px; border-color:#22d3ee55; background:#0c749010; }
.ha-zone-inflator h4 { display:none; }
.ha-zone-inflator .ha-preview-switch { margin:0 0 6px; min-height:44px; display:flex; align-items:center; }
.ha-zone-inflator .ha-preview-switch input { margin:0 8px 0 0; }
.ha-zone-inflator [data-amount-help] { font-size:.7rem; margin-bottom:0; }
.ha-pillow-panel .ha-region-actions { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:6px; }
.ha-pillow-panel .ha-preview-caption { font-size:.7rem; color:var(--color-text-secondary,#a8b9cc); margin:14px 0 8px; }
.ha-pillow-toolbar { left:50%; right:auto; transform:translateX(-50%); width:max-content; max-width:calc(100% - 16px); padding:5px; background:#09121eee; border:1px solid #40566b88; border-radius:12px; box-sizing:border-box; flex-wrap:wrap; }
.ha-pillow-toolbar [data-toolbar-action=choose-add], .ha-pillow-toolbar [data-toolbar-action=hollow-accept] { background:#07506c; border-color:#22d3ee; }
.ha-pillow-toolbar[data-empty=true] { display:none; }
@media (max-width:640px) {
  .ha-pillow-toolbar { flex-wrap:wrap; justify-content:center; overflow:visible; gap:3px; }
  .ha-pillow-toolbar button { padding:8px 7px; font-size:.72rem; }
  .ha-pillow-workspace.is-active .ha-pillow-panel { padding-top:14px; }
}

/* Feedback stays beside the face during hollow picking; never intercepts taps. */
.ha-pillow-tap-status { position:absolute; top:52px; left:12px; right:12px; z-index:81; pointer-events:none; padding:8px 12px; border:1px solid #22d3ee66; border-radius:8px; background:#09121eee; color:#eff6ff; font-size:.8rem; line-height:1.4; }
.ha-pillow-tap-status[hidden] { display:none !important; }

/* Tablet-first primary menu. The face and controls share one stable workspace. */
.ha-pillow-panel { border-color:#40566b; padding:0; border-radius:16px; overflow:hidden; background:var(--color-bg-panel,#101827); }
/* This nested header is menu content, not the site's sticky flex banner. */
.ha-pillow-heading { display:block; position:static; top:auto; z-index:auto; min-width:0; text-align:left; background:transparent; backdrop-filter:none; -webkit-backdrop-filter:none; padding:16px 16px 12px; border-bottom:1px solid #40566b66; }
.ha-pillow-heading h3 { font-size:1.15rem; font-weight:700; }
.ha-pillow-heading [data-step-hint] { margin:6px 0; font-size:.85rem; line-height:1.45; }
.ha-pillow-heading [data-save-summary] { font-size:.72rem; }
.ha-pillow-body { padding:0 16px 16px; min-height:0; }
.ha-pillow-body > [role=status] { line-height:1.45; padding:0; min-height:0; margin:12px 0; }
.ha-pillow-panel button, .ha-pillow-toolbar button { min-height:48px; min-width:48px; border-radius:10px; font-size:.85rem; }
.ha-pillow-panel select, .ha-pillow-panel input:not([type=checkbox]) { min-height:48px; }
.ha-pillow-panel details > summary { min-height:48px; }
.ha-primary-actions { display:grid; grid-template-columns:1fr 1fr; gap:8px; margin:12px 0; }
.ha-primary-actions [data-action=redraw] { background:#07506c; border-color:#22d3ee; }
.ha-area-chooser > .ha-primary { min-height:56px; }
.ha-area-selection { gap:8px; margin:14px 0; }
.ha-area-selection label { font-size:.8rem; }
.ha-pillow-panel .ha-zone-inflator { padding:12px; margin:12px 0; border-radius:12px; }
.ha-pillow-panel .ha-zone-inflator > label:last-of-type { font-size:.95rem; }
.ha-pillow-panel .ha-zone-inflator output { float:right; font-size:1.1rem; font-variant-numeric:tabular-nums; }
.ha-pillow-panel input[type=range] { -webkit-appearance:none; appearance:none; background:transparent; }
.ha-pillow-panel input[type=range]::-webkit-slider-runnable-track { height:6px; border-radius:6px; background:#3c526b; }
.ha-pillow-panel input[type=range]::-webkit-slider-thumb { -webkit-appearance:none; height:26px; width:26px; border-radius:50%; background:#22d3ee; border:3px solid #defaff; margin-top:-10px; box-shadow:0 1px 4px #0007; }
.ha-pillow-panel input[type=range]::-moz-range-track { height:6px; border-radius:6px; background:#3c526b; }
.ha-pillow-panel input[type=range]::-moz-range-thumb { height:22px; width:22px; border-radius:50%; background:#22d3ee; border:3px solid #defaff; }
.ha-pillow-panel input[type=range]:disabled { opacity:.4; }
.ha-reset-panel { border:1px solid #7b6650; border-radius:12px; padding:12px; margin:12px 0; background:#a56d2210; }
.ha-reset-panel h4, .ha-drawing-guide h4 { margin:0 0 8px; font-size:.95rem; }
.ha-reset-options { display:grid; gap:8px; }
.ha-reset-options button { text-align:left; }
.ha-reset-panel [data-action=confirm-clear-model], .ha-reset-panel [data-action=clear] { color:#ffbdaf; border-color:#a16857; }
.ha-reset-panel [data-action=reset-close] { width:100%; margin-top:8px; }
.ha-drawing-guide { padding:16px 0; }
.ha-pillow-toolbar { flex-wrap:nowrap; width:max-content; max-width:calc(100% - 12px); gap:4px; padding:5px; bottom:8px; }
.ha-pillow-toolbar button { padding:8px 10px; flex:0 1 auto; }
/* Keep the key clear of the editing toolbar, even on a narrow face view. */
.ha-pillow-enabled .visualizer-container .legend-card { bottom:82px; }
.ha-pillow-toolbar [data-toolbar-action=restart] { border-color:#22d3ee; }
.ha-pillow-toolbar [data-toolbar-action=done], .ha-pillow-toolbar [data-toolbar-action=hollow-accept] { background:#07506c; border-color:#22d3ee; }
@media (max-width:1366px) {
  .ha-pillow-enabled .main-content, .ha-pillow-enabled .main-content.sidebar-is-hidden { grid-template-columns:minmax(0,1fr); }
  /* sidebar-drawer.css loads later. Override its hidden-sidebar placement too,
     otherwise columns 2/3 create implicit tracks beside this single track. */
  .ha-pillow-enabled .main-content > .center-column,
  .ha-pillow-enabled .main-content.sidebar-is-hidden > .center-column { grid-column:1; order:1; }
  .ha-pillow-enabled .main-content > .sidebar,
  .ha-pillow-enabled .main-content.sidebar-is-hidden > .sidebar { grid-column:1; order:2; }
  .ha-pillow-enabled .main-content > .planner-panel,
  .ha-pillow-enabled .main-content.sidebar-is-hidden > .planner-panel { grid-column:1; order:3; }
  .ha-pillow-enabled .main-content > .sidebar,
  .ha-pillow-enabled .main-content > .planner-panel { position:static; top:auto; height:auto; max-height:none; min-height:0; min-width:0; overflow:visible; }
  .ha-pillow-workspace.is-active { display:grid; grid-template-columns:minmax(0,1fr) minmax(288px,320px); grid-template-rows:minmax(0,1fr); height:calc(100dvh - 90px); min-height:400px; position:sticky; top:76px; gap:10px; z-index:3; background:var(--color-bg-primary,#080d16); }
  .ha-pillow-workspace.is-active .visualizer-container { height:100%; min-height:0; padding:8px; box-sizing:border-box; }
  .ha-pillow-workspace.is-active > .ha-pillow-panel { display:flex; flex-direction:column; margin:0; padding:0; min-height:0; max-height:100%; overflow:hidden; box-sizing:border-box; }
  .ha-pillow-workspace.is-active .ha-pillow-heading { flex:0 0 auto; }
  .ha-pillow-workspace.is-active .ha-pillow-body { flex:1 1 auto; overflow-y:auto; overscroll-behavior:contain; padding-bottom:max(16px,env(safe-area-inset-bottom)); }
  .ha-pillow-workspace.is-active[data-collapsed=true] { grid-template-columns:minmax(0,1fr); }
  .ha-pillow-workspace.is-active[data-collapsed=true] > .ha-pillow-panel { display:none; }
}
@media (max-width:700px) {
  .ha-pillow-workspace.is-active { grid-template-columns:minmax(0,1fr); grid-template-rows:minmax(220px,1fr) minmax(170px,42%); gap:0; top:70px; height:calc(100dvh - 82px); }
  .ha-pillow-workspace.is-active > .ha-pillow-panel { border-radius:16px 16px 0 0; box-shadow:0 -5px 16px #0004; }
  .ha-pillow-workspace.is-active[data-collapsed=true] { grid-template-rows:minmax(0,1fr); }
  .ha-pillow-heading { padding:10px 12px 6px; }
  .ha-pillow-heading h3 { font-size:1rem; }
  .ha-pillow-heading [data-step-hint] { margin:3px 0; font-size:.76rem; }
  .ha-pillow-body { padding:0 12px 12px; }
  .ha-pillow-toolbar { gap:3px; flex-wrap:nowrap; overflow:visible; }
  .ha-pillow-toolbar button { padding:8px 6px; font-size:.74rem; min-width:48px; }
}

/* Recovery stays with the contour review, with ordinary finger-size targets. */
.ha-hollow-recovery { display:grid; grid-template-columns:1fr; gap:8px; margin-top:12px; }
.ha-hollow-recovery p { margin:0; font-size:.72rem; color:var(--color-text-secondary); }
.ha-pillow-panel [data-action=hollow-nearby] { border-color:#22d3ee; background:#07506c; }
.ha-pillow-panel [data-ui-hollow][aria-busy=true] { border-color:#67e8f9; }
