/* ============================================================================
   HBA-CPQ | css/scope-morph.css — Docked Collapsing Halo Title & Step-1 Omnibar
   ============================================================================ */

/* 1. Docked Collapsing Halo Title handled by HaloTitleStrip.svelte (--halo-p) */
.app .scroll { padding-top: calc(var(--halo-h) + 26px + env(safe-area-inset-top, 0px) + var(--hba-border-thin)); }

/* 2. Step-1 Omnibar: [+ Add] (left) | [By type / By facility] (center) | [Next →] (right) */
body.step-1 #backBtn { display: none; }
body:not(.step-1) #sideBtn { display: none; }
body:not(.step-1) #omnibar { display: none; }
body:not(.step-1) #next { flex: 1; min-width: 0; width: auto; border-radius: calc(var(--omni-main-h) / 2); padding: 0 18px; }

body.step-1 #next {
  flex: none; width: var(--omni-main-h); height: var(--omni-main-h); border-radius: 50%; padding: 0;
  display: grid; place-items: center;
  box-shadow: 0 6px 18px color-mix(in srgb, var(--hba-action-primary) 28%, transparent);
}
body.step-1 #next svg { width: 20px; height: 20px; transition: transform 180ms cubic-bezier(0.22, 1, 0.36, 1); }
body.step-1 #next:active svg { transform: translateX(2px); }

@media (max-width: 600px) {
  body.step-1 #next { width: 48px; height: 48px; }
  body:not(.step-1) #next { height: 48px; }
}

/* 3. Liquid Glass Segmented Toggle inside Omnibar */
.omni-seg {
  position: relative; display: grid; grid-template-columns: 1fr 1fr; align-items: center;
  width: 100%; height: var(--omni-main-h); padding: 4px; box-sizing: border-box;
  border-radius: calc(var(--omni-main-h) / 2);
}
@media (max-width: 600px) { .omni-seg { height: 48px; } }
.omni-seg-thumb {
  position: absolute; top: 4px; bottom: 4px; left: 4px; width: calc(50% - 4px);
  border-radius: 999px; pointer-events: none;
  background: color-mix(in srgb, var(--hba-action-primary) 92%, #fff);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.35), 0 4px 12px color-mix(in srgb, var(--hba-action-primary) 30%, transparent);
  transition: transform 280ms cubic-bezier(0.34, 1.38, 0.64, 1);
}
.omni-seg[data-mode="use"] .omni-seg-thumb { transform: translateX(100%); }
.omni-seg-btn {
  position: relative; z-index: 1; display: inline-flex; align-items: center; justify-content: center; gap: 5px;
  height: 100%; border: 0; background: transparent; padding: 0 8px; border-radius: 999px;
  font: inherit; font-size: 12px; font-weight: 700; color: var(--hba-text-muted); cursor: pointer;
  white-space: nowrap; transition: color 180ms ease-out, transform 140ms cubic-bezier(0.22, 1, 0.36, 1);
}
.omni-seg-btn svg { width: 13px; height: 13px; flex: none; }
.omni-seg-btn.on { color: #fff; }
.omni-seg-btn:active { transform: scale(0.95); }

/* 4. Add-button morph push-out on Step 1 */
@media (prefers-reduced-motion: no-preference) {
  body.step-1 #next { transition: transform 240ms cubic-bezier(0.22, 1, 0.36, 1), opacity 180ms ease-out; }
  body.sheet-open.add-morph #next { transform: translateX(32px) scale(0.86); opacity: 0; pointer-events: none; }
  body.sheet-open.add-morph.step-1 .omni-side { transform: translateY(-6px) scale(1.06); }
}

/* 5. Symmetric 5-column Vertical Logo-Tile Grid (Zero Orphans, 32px Medallions) */
.hd-cli-grid {
  display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 6px; padding-top: 2px;
}
.hd-cli-tile {
  display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 6px 2px; border-radius: 14px;
  border: var(--hba-border-thin) solid rgba(255, 255, 255, 0.55); background: rgba(255, 255, 255, 0.36);
  cursor: pointer; min-width: 0; font: inherit;
  transition: transform 180ms cubic-bezier(0.34, 1.4, 0.64, 1), background-color 160ms ease-out, border-color 160ms ease-out, box-shadow 180ms ease-out;
  animation: hd-tile-in 200ms cubic-bezier(0.22, 1, 0.36, 1) calc(var(--ci, 0) * 28ms) both;
}
.hd-cli-tile:active { transform: scale(0.93); }
.hd-cli-tile-av {
  width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center;
  background: #fff; border: 1.5px solid rgba(22, 19, 31, 0.08); box-shadow: 0 2px 6px rgba(16, 12, 28, 0.06);
  transition: border-color 180ms ease-out, box-shadow 180ms ease-out, transform 200ms cubic-bezier(0.34, 1.4, 0.64, 1);
}
.hd-cli-tile-av img { width: 24px; height: 24px; object-fit: contain; display: block; }
.hd-cli-tile-lbl {
  font-size: 11px; font-weight: 700; color: #1d192b; line-height: 1.15; max-width: 100%;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.hd-cli-tile.on {
  background: color-mix(in srgb, var(--hba-action-primary) 10%, rgba(255, 255, 255, 0.72));
  border-color: color-mix(in srgb, var(--hba-action-primary) 45%, transparent);
}
.hd-cli-tile.on .hd-cli-tile-av {
  border: 2px solid var(--hba-action-primary); transform: scale(1.05);
  box-shadow: 0 4px 12px color-mix(in srgb, var(--hba-action-primary) 26%, transparent);
}
.hd-cli-tile.on .hd-cli-tile-lbl { color: var(--hba-action-primary); font-weight: 800; }
.hd-cli-none { grid-column: 1 / -1; font-size: 11px; color: #3d3750; padding: 6px 2px; }
@keyframes hd-tile-in { from { opacity: 0; transform: scale(0.92); } to { opacity: 1; transform: scale(1); } }
.hd-back-r { padding: 4px 6px 4px 10px; }

/* 7. Full-drawer swipe reliability + Chassis 2D footprint preview + Pax scrubber */
.sc-halo.expanded, .halo-drawer-bg.open { touch-action: pan-y; }
.hd-ch-viz {
  display: inline-flex; align-items: center; gap: 5px; margin-left: 4px;
  font-size: 10px; font-weight: 700; color: var(--hba-action-primary); text-transform: none; letter-spacing: 0;
}
.hd-ch-viz i {
  display: inline-block; border-radius: 2.5px;
  background: color-mix(in srgb, var(--hba-action-primary) 18%, transparent);
  border: 1.5px solid var(--hba-action-primary);
  transition: width 240ms cubic-bezier(0.34, 1.35, 0.64, 1), height 240ms cubic-bezier(0.34, 1.35, 0.64, 1);
}
.hd-pax-range {
  -webkit-appearance: none; appearance: none; width: 100%; height: 6px; margin: 10px 0 4px; border-radius: 999px;
  background: linear-gradient(90deg, var(--hba-action-primary) 0%, var(--hba-action-primary) var(--pax-pct, 38%), rgba(22, 19, 31, 0.11) var(--pax-pct, 38%), rgba(22, 19, 31, 0.11) 100%);
  outline: none; cursor: pointer; touch-action: pan-x;
}
.hd-pax-range::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none; width: 22px; height: 22px; border-radius: 50%;
  background: #fff; border: 2.5px solid var(--hba-action-primary);
  box-shadow: 0 2px 8px rgba(16, 12, 28, 0.22); transition: transform 140ms cubic-bezier(0.34, 1.4, 0.64, 1);
}
.hd-pax-range:active::-webkit-slider-thumb { transform: scale(1.18); }
.hd-pax-val {
  display: inline-flex; align-items: center; padding: 2px 7px; border-radius: 999px; margin-left: 4px;
  font: 700 10.5px/1.2 var(--font-sans); font-variant-numeric: tabular-nums; text-transform: none; letter-spacing: 0;
  background: color-mix(in srgb, var(--hba-action-primary) 12%, transparent); color: var(--hba-action-primary);
}
.hd-pax-val.muted { background: rgba(22, 19, 31, 0.07); color: var(--hba-text-tertiary); font-weight: 600; }
.hd-pax-val.from-cabins { background: rgba(16, 185, 129, 0.13); color: #047857; }
.hd-pax-acts { display: inline-flex; align-items: center; gap: 3px; flex-wrap: nowrap; }
.hd-pax-acts .est-mv { min-width: 28px; height: 26px; padding: 0 5px; font-size: 11px; }
.hd-pax-ticks {
  display: flex; align-items: center; justify-content: space-between; padding: 0 2px; margin-bottom: 6px;
}
.hd-pax-tick {
  border: 0; background: transparent; padding: 2px 3px; border-radius: 4px; cursor: pointer;
  font: 600 9.5px/1 var(--font-sans); font-variant-numeric: tabular-nums; color: var(--hba-text-tertiary);
  transition: color 140ms ease-out;
}
.hd-pax-tick.on, .hd-pax-tick:active { color: var(--hba-action-primary); font-weight: 700; }
.hd-pax-chips { gap: 5px; }
.hd-pax-chips .est-pill { font-size: 10.5px; padding: 4px 8px; }
.hd-scroll { touch-action: pan-y; }

/* 6. Bottom-anchored Halo identity bar + Dots/Send -> Edit morph + Left-swipe Project reveal */
.halo-dots, .halo-send {
  transition: opacity 180ms ease-out, transform 220ms cubic-bezier(0.22, 1, 0.36, 1), width 200ms ease-out, margin 200ms ease-out;
}
.sc-halo.expanded .halo-dots,
.sc-halo.expanded .halo-send { opacity: 0; transform: scale(0.65); width: 0; gap: 0; margin: 0; padding: 0; border-width: 0; overflow: hidden; pointer-events: none; }
.halo-edit {
  position: relative;
  flex: none; width: 0; height: 36px; padding: 0; border-radius: 50%; display: grid; place-items: center;
  opacity: 0; transform: scale(0.6); overflow: hidden; pointer-events: none; border: 0; cursor: pointer;
  background: color-mix(in srgb, var(--hba-surface-alt) 85%, transparent); color: var(--hba-action-primary);
  border: var(--hba-border-thin) solid var(--hba-line-decorative);
  transition: width 220ms cubic-bezier(0.22, 1, 0.36, 1), opacity 200ms ease-out 40ms, transform 240ms cubic-bezier(0.34, 1.35, 0.64, 1) 40ms, background-color 160ms ease-out;
}
.halo-edit::after { content: ''; position: absolute; inset: -4px; border-radius: 50%; }
.halo-edit svg { width: 15px; height: 15px; }
.sc-halo.expanded .halo-edit { width: 36px; opacity: 1; transform: scale(1); overflow: visible; pointer-events: auto; }
.halo-edit:active { transform: scale(0.92) !important; }
.halo-edit.on { background: var(--hba-action-primary); color: #fff; border-color: var(--hba-action-primary); }
@keyframes hd-left-in { from { opacity: 0; transform: translateX(-24px); } to { opacity: 1; transform: translateX(0); } }
.hd-anim-left-in { animation: hd-left-in 240ms cubic-bezier(0.22, 1, 0.36, 1); }

/* 7. Inline Joint/Custom Chassis Accordion + 3-Pane Spatial Feedforward Rail */
.hd-act-pill.on { background: var(--hba-action-primary); color: #fff; border-color: var(--hba-action-primary); }
.hd-ch-inline {
  margin: 4px 0 8px; padding: 9px 10px; border-radius: 14px;
  background: rgba(111, 66, 193, 0.06); border: var(--hba-border-thin) solid rgba(111, 66, 193, 0.16);
  display: flex; flex-direction: column; gap: 7px;
  animation: hd-drop-in 220ms cubic-bezier(0.22, 1, 0.36, 1);
}
@keyframes hd-drop-in { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: translateY(0); } }
.hd-ch-inline .hd-acts { margin-top: 2px; }
.hd-swipe-rail {
  display: flex; align-items: center; justify-content: space-between; gap: 6px;
  padding-top: 8px; margin-top: 4px; border-top: var(--hba-border-thin) solid rgba(22, 19, 31, 0.08);
}
.hd-rail-btn {
  display: inline-flex; align-items: center; gap: 5px; height: 30px; padding: 0 10px; border-radius: 999px;
  border: var(--hba-border-thin) solid rgba(111, 66, 193, 0.14); background: rgba(111, 66, 193, 0.055);
  color: var(--hba-text-secondary); font: 600 11px/1 var(--font-sans);
  cursor: pointer; white-space: nowrap; transition: background-color 140ms ease-out, color 140ms ease-out, border-color 140ms ease-out, transform 120ms ease-out;
}
.hd-rail-btn svg { width: 12px; height: 12px; color: var(--hba-action-primary); flex: none; }
.hd-rail-btn:hover, .hd-rail-btn:active { background: rgba(111, 66, 193, 0.12); border-color: rgba(111, 66, 193, 0.28); color: var(--hba-action-primary); }
.hd-rail-btn:active { transform: scale(0.95); }
.hd-rail-cnt {
  display: inline-flex; align-items: center; justify-content: center; padding: 2px 6px; border-radius: 999px;
  background: rgba(111, 66, 193, 0.14); color: var(--hba-action-primary);
  font: 700 10px/1 var(--font-sans); font-variant-numeric: tabular-nums;
}
.hd-rail-spacer { flex: 1; min-width: 72px; }
.hd-chev-l { display: inline-block; font-size: 13px; line-height: 1; color: var(--hba-action-primary); animation: hd-nudge-l 2.6s ease-in-out infinite; }
.hd-chev-r { display: inline-block; font-size: 13px; line-height: 1; color: var(--hba-action-primary); animation: hd-nudge-r 2.6s ease-in-out infinite; }
@keyframes hd-nudge-l { 0%, 60%, 100% { transform: translateX(0); opacity: 0.65; } 30% { transform: translateX(-2.5px); opacity: 1; } }
@keyframes hd-nudge-r { 0%, 60%, 100% { transform: translateX(0); opacity: 0.65; } 30% { transform: translateX(2.5px); opacity: 1; } }
.hd-rail-dots { display: inline-flex; align-items: center; gap: 4px; flex: none; }
.hd-rdot {
  width: 6px; height: 6px; padding: 0; border: 0; border-radius: 999px;
  background: rgba(22, 19, 31, 0.18); cursor: pointer; transition: width 180ms cubic-bezier(0.22, 1, 0.36, 1), background-color 180ms ease-out;
}
.hd-rdot.on { width: 14px; background: var(--hba-action-primary); }
