/* UNITS of Minneapolis assistant — center-stage orb.
   Based on the house orb module stylesheet (business-hub-os/orb-gemini/orb.css),
   rebranded to UNITS and extended for the framed center-stage experience:
   the corner button is the doorway; tapping it opens a centered frame with
   the mascot, the transcript, a pre-voice consent step, and controls
   (talk, mute, type instead, end). Full-screen sheet on phone widths.

   STRUCTURE (Nov 24, 2026 restructure, Anton-directed): the frame is a
   single-column GRID with one explicit row per section —
     head / mascot strip / message log / chips / consent / fallback /
     controls / composer / foot
   — so sections can never overlap each other at any viewport. The log is
   the only flexible row (minmax(0,1fr)); everything else is sized by its
   content. The mascot is a square POSTER and is always shown whole
   (object-fit:contain in a rounded-rectangle frame), never circle-cropped.
   At short viewport heights the mascot strip and foot step aside so the
   message log keeps usable height. */
:root{
  --ipm-orb-blue:#2E97DB;
  --ipm-orb-blue-dark:#1B6CA8;
  --ipm-orb-navy:#0A2239;
  --ipm-orb-ink:#14232F;
  --ipm-orb-muted:#54687A;
  --ipm-orb-line:#D9E5EE;
  --ipm-orb-panel:#FFFFFF;
}
/* ---- corner doorway ---- */
.ipm-orb-btn{
  position:fixed;right:22px;bottom:22px;z-index:9990;
  width:64px;height:64px;border-radius:20px;cursor:pointer;
  border:3px solid var(--ipm-orb-blue);
  background:#fff url("/assets/mascot.png") center/contain no-repeat;
  box-shadow:0 10px 28px rgba(10,34,57,.38),inset 0 0 0 2px rgba(255,255,255,.55);
  display:flex;align-items:center;justify-content:center;
  transition:transform .18s ease;
}
.ipm-orb-btn:hover{transform:scale(1.06)}
.ipm-orb-btn:focus-visible{outline:3px solid var(--ipm-orb-blue);outline-offset:3px}
.ipm-orb-btn::after{
  content:"";position:absolute;inset:-7px;border-radius:26px;
  border:2px solid rgba(46,151,219,.55);opacity:0;pointer-events:none;
  animation:ipm-orb-pulse 2.6s ease-out infinite;
}
.ipm-orb-btn.live::after{border-color:rgba(46,184,120,.65)}
@keyframes ipm-orb-pulse{
  0%{transform:scale(.82);opacity:.85}
  70%{transform:scale(1.12);opacity:0}
  100%{transform:scale(1.12);opacity:0}
}
.ipm-orb-label{
  position:fixed;right:98px;bottom:42px;z-index:9990;
  background:var(--ipm-orb-navy);color:#fff;font-size:13px;font-weight:600;
  padding:7px 12px;border-radius:999px;box-shadow:0 6px 18px rgba(10,34,57,.28);
  pointer-events:none;white-space:nowrap;font-family:inherit;
}
/* ---- center stage ---- */
.ipm-orb-stage{
  position:fixed;inset:0;z-index:9995;display:none;
  align-items:center;justify-content:center;
  background:rgba(6,22,38,.62);backdrop-filter:blur(3px);
  padding:22px;font-family:inherit;
}
.ipm-orb-stage.open{display:flex}
.ipm-orb-frame{
  width:min(680px,100%);max-height:min(860px,calc(100dvh - 44px));min-height:0;
  background:var(--ipm-orb-panel);border:1px solid var(--ipm-orb-line);border-radius:22px;
  box-shadow:0 30px 80px rgba(0,0,0,.45);
  display:grid;grid-template-columns:minmax(0,1fr);
  grid-template-rows:auto auto minmax(0,1fr) auto auto auto auto auto auto;
  overflow:hidden;color:var(--ipm-orb-ink);
}
.ipm-orb-frame>*{min-width:0}
/* Explicit row assignment for every section: when an optional section is
   hidden (mascot strip at short heights, consent/fallback cards), the
   remaining sections keep their rows — above all the log always stays
   in the flexible row 3 instead of shifting up into an auto row. */
.ipm-orb-head{grid-row:1}
.ipm-orb-mascot{grid-row:2}
.ipm-orb-log{grid-row:3}
.ipm-orb-chips{grid-row:4}
.ipm-orb-consent{grid-row:5}
.ipm-orb-fallback{grid-row:6}
.ipm-orb-controls{grid-row:7}
.ipm-orb-composer{grid-row:8}
.ipm-orb-foot{grid-row:9}
.ipm-orb-head{
  display:flex;align-items:center;gap:10px;padding:14px 16px;
  background:linear-gradient(120deg,var(--ipm-orb-navy),#134a75);
  color:#fff;
}
.ipm-orb-head img{width:36px;height:36px;border-radius:9px;object-fit:contain;background:#fff;border:2px solid rgba(255,255,255,.6);flex:0 0 auto}
.ipm-orb-dot{width:10px;height:10px;border-radius:50%;background:#8FB8DE;flex:0 0 auto}
.ipm-orb-dot.connecting{background:#F5C15C}
.ipm-orb-dot.live{background:#2EB878}
.ipm-orb-dot.fallback{background:#E0655F}
.ipm-orb-title{font-weight:700;font-size:16px;line-height:1.2}
.ipm-orb-status{font-size:12px;color:#C7DAF2;line-height:1.3}
.ipm-orb-close{
  margin-left:auto;background:rgba(255,255,255,.14);border:none;color:#fff;
  width:32px;height:32px;border-radius:50%;cursor:pointer;font-size:17px;line-height:1;flex:0 0 auto;
}
.ipm-orb-close:hover{background:rgba(255,255,255,.28)}
/* mascot strip: the poster, whole, in its own framed band beside its
   caption. Normal flow only — the caption is a flexible text column
   (min-width:0) and can never run under the poster. */
.ipm-orb-mascot{
  display:flex;flex-direction:row;align-items:center;gap:12px;
  padding:12px 16px;background:linear-gradient(180deg,#F2F8FD,#FFFFFF);
  border-bottom:1px solid var(--ipm-orb-line);
}
.ipm-orb-mascot img{
  width:76px;height:76px;flex:0 0 auto;
  border-radius:14px;object-fit:contain;object-position:center;
  background:#fff;
  border:3px solid var(--ipm-orb-blue);
  box-shadow:0 8px 20px rgba(10,34,57,.18);
}
.ipm-orb-mascot.live img{animation:ipm-orb-bob 2.2s ease-in-out infinite}
@keyframes ipm-orb-bob{0%,100%{transform:translateY(0)}50%{transform:translateY(-4px)}}
.ipm-orb-mascot .cap{flex:1 1 auto;min-width:0;font-size:13.5px;line-height:1.45;color:var(--ipm-orb-muted);text-align:left}
.ipm-orb-log{
  min-height:0;overflow-y:auto;overscroll-behavior:contain;
  padding:14px 16px;display:flex;flex-direction:column;gap:10px;
  background:#F6F9FC;
}
.ipm-orb-msg{max-width:88%;padding:10px 13px;border-radius:14px;font-size:14.5px;line-height:1.5;white-space:pre-wrap;word-wrap:break-word}
.ipm-orb-msg.agent{align-self:flex-start;background:#fff;border:1px solid var(--ipm-orb-line);border-bottom-left-radius:4px}
.ipm-orb-msg.user{align-self:flex-end;background:var(--ipm-orb-blue-dark);color:#fff;border-bottom-right-radius:4px}
.ipm-orb-msg a{color:var(--ipm-orb-blue-dark);font-weight:600}
.ipm-orb-msg.user a{color:#DCEEFF}
.ipm-orb-hint{font-size:13px;color:var(--ipm-orb-muted);text-align:center;padding:2px 8px}
/* consent card */
.ipm-orb-consent{
  margin:12px 16px 0;padding:16px;border:1.5px solid var(--ipm-orb-blue);background:#EFF7FE;
  border-radius:14px;font-size:14.5px;line-height:1.55;color:var(--ipm-orb-ink);display:none;
}
.ipm-orb-consent.show{display:block}
.ipm-orb-consent .ttl{font-weight:800;color:var(--ipm-orb-navy);margin-bottom:6px}
.ipm-orb-consent .btnrow{display:flex;gap:8px;flex-wrap:wrap;margin-top:12px}
.ipm-orb-consent button{
  border:none;cursor:pointer;font:inherit;font-weight:700;font-size:14px;
  padding:10px 18px;border-radius:999px;background:var(--ipm-orb-blue);color:#fff;
}
.ipm-orb-consent button.ghost{background:#fff;color:var(--ipm-orb-blue-dark);border:1.5px solid var(--ipm-orb-blue-dark)}
/* voice notice (honest fallback) */
.ipm-orb-fallback{
  margin:12px 16px 0;padding:14px;border:1px solid #F3D9C8;background:#FFF8F1;
  border-radius:14px;font-size:14px;line-height:1.55;color:var(--ipm-orb-ink);display:none;
}
.ipm-orb-fallback.show{display:block}
.ipm-orb-fallback .btnrow{display:flex;gap:8px;flex-wrap:wrap;margin-top:10px}
.ipm-orb-fallback a.fbtn{
  display:inline-block;background:var(--ipm-orb-blue-dark);color:#fff;text-decoration:none;
  font-weight:700;font-size:13.5px;padding:9px 16px;border-radius:999px;
}
.ipm-orb-fallback a.fbtn.ghost{background:#fff;color:var(--ipm-orb-blue-dark);border:1.5px solid var(--ipm-orb-blue-dark)}
/* quick chips: always their own single row under the log, separated by a
   rule; long sets scroll sideways instead of wrapping over messages. */
.ipm-orb-chips{display:flex;flex-wrap:nowrap;gap:8px;padding:10px 16px;overflow-x:auto;background:#F6F9FC;border-top:1px solid var(--ipm-orb-line);scrollbar-width:thin;box-sizing:border-box;min-height:52px}
.ipm-orb-chips button{
  flex:0 0 auto;
  background:#E5F3FC;color:var(--ipm-orb-blue-dark);border:0;border-radius:999px;
  padding:7px 13px;font:inherit;font-size:13.5px;font-weight:600;cursor:pointer;
}
.ipm-orb-chips button:hover{background:#CFE9FA}
/* controls */
.ipm-orb-controls{
  display:flex;gap:8px;align-items:center;flex-wrap:wrap;
  padding:10px 16px 0;background:#fff;
}
.ipm-orb-controls button{
  display:inline-flex;align-items:center;gap:7px;border-radius:999px;cursor:pointer;
  font:inherit;font-size:13.5px;font-weight:700;padding:9px 15px;
  border:1.5px solid var(--ipm-orb-line);background:#fff;color:var(--ipm-orb-navy);
}
.ipm-orb-controls button svg{width:16px;height:16px;display:block}
.ipm-orb-controls button.primary{background:var(--ipm-orb-blue);border-color:var(--ipm-orb-blue);color:#fff}
.ipm-orb-controls button.primary.on{background:#D93B3B;border-color:#D93B3B}
.ipm-orb-controls button[aria-pressed="true"]{background:var(--ipm-orb-navy);color:#fff;border-color:var(--ipm-orb-navy)}
.ipm-orb-controls button:disabled{opacity:.45;cursor:default}
/* composer */
.ipm-orb-composer{
  display:flex;gap:8px;align-items:center;padding:12px 16px;
  background:#fff;
}
.ipm-orb-input{
  flex:1 1 auto;min-width:0;border:1.5px solid var(--ipm-orb-line);border-radius:999px;
  padding:11px 15px;font-size:14.5px;font-family:inherit;color:var(--ipm-orb-ink);background:#fff;
}
.ipm-orb-input:focus{outline:none;border-color:var(--ipm-orb-blue)}
.ipm-orb-send{
  flex:0 0 auto;width:42px;height:42px;border-radius:50%;border:none;cursor:pointer;
  display:flex;align-items:center;justify-content:center;background:var(--ipm-orb-blue-dark);color:#fff;
}
.ipm-orb-send svg{width:19px;height:19px;display:block}
.ipm-orb-foot{padding:0 16px 12px;font-size:11.5px;color:var(--ipm-orb-muted);background:#fff;text-align:center}
@media (max-width:640px){
  .ipm-orb-stage{padding:0}
  .ipm-orb-frame{width:100%;height:100dvh;max-height:100dvh;border-radius:0;border:none}
  .ipm-orb-mascot{padding:10px 12px}
  .ipm-orb-mascot img{width:64px;height:64px}
  .ipm-orb-chips{padding:8px 12px;min-height:48px}
  .ipm-orb-controls{padding:8px 12px 0}
  .ipm-orb-controls button{padding:8px 12px;font-size:13px}
  .ipm-orb-composer{padding:10px 12px}
  .ipm-orb-consent,.ipm-orb-fallback{margin:10px 12px 0}
  .ipm-orb-btn{right:16px;bottom:16px}
  .ipm-orb-label{display:none}
}
@media (max-width:340px){
  .ipm-orb-head{padding:10px 12px}
  .ipm-orb-title{font-size:14.5px}
  .ipm-orb-status{font-size:11.5px}
  .ipm-orb-controls{gap:6px}
  .ipm-orb-controls button{padding:7px 9px;font-size:12px}
  .ipm-orb-composer{padding:8px 12px}
  .ipm-orb-input{padding:9px 12px;font-size:13.5px}
  .ipm-orb-send{width:38px;height:38px}
  .ipm-orb-chips{padding:6px 12px;min-height:44px}
  .ipm-orb-mascot .cap{font-size:12.5px}
}
/* Short viewports (small laptops, zoomed browsers): compress the fixed
   chrome so the message log keeps real height and nothing is clipped. */
@media (max-height:760px){
  .ipm-orb-head{padding:10px 16px}
  .ipm-orb-mascot{padding:8px 16px}
  .ipm-orb-mascot img{width:60px;height:60px}
  .ipm-orb-log{padding:10px 16px}
}
@media (max-height:620px){
  /* Short viewports: the mascot strip steps aside entirely — the header
     still carries the poster thumb and title — so the message log keeps
     real height and the greeting stays readable. */
  .ipm-orb-mascot{display:none}
  .ipm-orb-consent,.ipm-orb-fallback{margin:8px 12px 0;padding:10px 12px;max-height:30dvh;overflow-y:auto}
  .ipm-orb-controls{padding-top:6px}
  .ipm-orb-composer{padding:8px 16px}
  .ipm-orb-foot{padding-bottom:8px}
}
/* Very short viewports (~200% zoom, landscape phones): the foot line
   also steps aside so the log, controls, and composer keep the room
   and everything stays reachable. */
@media (max-height:520px){
  .ipm-orb-foot{display:none}
}
/* Extreme heights (~200% zoom on a phone): the quick chips — shortcuts
   for questions that can also be typed — step aside too. The greeting,
   the notice card, the controls, and the composer all outrank them. */
@media (max-height:460px){
  .ipm-orb-chips{display:none}
}
