/* CRYSTAL OPERATOR — the docked, context-aware, WORK-FIRST drawer (2026-09-15).
   Replaces the popup as the default surface. She is co-present beside the work, knows the exact
   entity you're on, and leads with what needs YOU — the composer is a thin line at the bottom,
   NOT a chat transcript. Desktop: a resizable right dock that shrinks the pane area. Mobile: an
   animated bottom sheet that rises. House tokens only, so it themes light/dark automatically. */
:root{ --crystal-dock:0px; }
#panes{ transition:margin-right .24s cubic-bezier(.2,.8,.2,1); margin-right:var(--crystal-dock); }

#crystal-op{
  position:fixed; top:56px; right:0; bottom:0; width:var(--crystal-dock); z-index:1200;
  display:flex; flex-direction:column; overflow:hidden; pointer-events:auto;
  background:linear-gradient(180deg, color-mix(in srgb,var(--accent) 7%, var(--glass-bg2)) 0%, var(--glass-bg2) 42%);
  border-left:1px solid color-mix(in srgb,var(--accent) 30%,var(--glass-border));
  backdrop-filter:blur(18px) saturate(160%); -webkit-backdrop-filter:blur(18px) saturate(160%);
  box-shadow:-14px 0 40px rgba(0,0,0,.34);
  transition:width .24s cubic-bezier(.2,.8,.2,1);
}
#crystal-op[hidden]{ display:none; }
#crystal-op .op-grip{ position:absolute; left:0; top:0; bottom:0; width:8px; cursor:col-resize; z-index:3; }
#crystal-op .op-grip::before{ content:""; position:absolute; inset:0 3px; border-radius:3px; background:transparent; transition:background .15s; }
#crystal-op .op-grip:hover::before{ background:var(--accent); box-shadow:0 0 10px rgba(var(--accent-rgb),.5); }

#crystal-op .op-head{ display:flex; align-items:center; gap:11px; padding:14px 16px; border-bottom:1px solid var(--glass-border); flex:none; }
#crystal-op .op-head img{ width:38px; height:38px; border-radius:50%; object-fit:cover; box-shadow:0 0 0 2px var(--success); flex:none; }
#crystal-op .op-nm{ font-weight:750; color:var(--text); font-size:15px; line-height:1.1; }
#crystal-op .op-st{ font-size:11.5px; color:var(--success); font-weight:600; display:flex; align-items:center; gap:5px; }
#crystal-op .op-st .d{ width:6px; height:6px; border-radius:50%; background:var(--success); box-shadow:0 0 6px var(--success); animation:opb 1.7s infinite; }
@keyframes opb{ 50%{ opacity:.35; } }
#crystal-op .op-hbtn{ background:none; border:1px solid var(--glass-border); color:var(--muted); border-radius:8px; cursor:pointer; width:30px; height:30px; font-size:15px; flex:none; }
#crystal-op .op-hbtn:hover{ color:var(--text); border-color:var(--accent); }

#crystal-op .op-ctx{ margin:11px 14px 0; padding:8px 12px; border-radius:9px; font-size:12px; font-weight:600; color:var(--accent);
  background:color-mix(in srgb,var(--accent) 12%,transparent); border:1px solid color-mix(in srgb,var(--accent) 32%,transparent);
  display:flex; align-items:center; gap:7px; flex:none; }
#crystal-op .op-ctx .lab{ overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }

#crystal-op .op-body{ flex:1; overflow:auto; padding:14px; }
#crystal-op .op-line{ font-size:14.5px; line-height:1.5; color:var(--text); margin:2px 4px 14px; }
#crystal-op .op-line b{ color:var(--accent); }
#crystal-op .op-sec{ font-size:10.5px; font-weight:800; letter-spacing:.07em; text-transform:uppercase; color:var(--muted2); margin:16px 4px 9px; }
#crystal-op .op-need{ display:flex; gap:11px; align-items:flex-start; padding:11px 13px; border-radius:11px; margin-bottom:8px;
  background:var(--glass-bg); border:1px solid var(--glass-border); border-left:3px solid var(--warn); cursor:pointer; transition:transform .14s, box-shadow .14s; }
#crystal-op .op-need:hover{ transform:translateX(2px); box-shadow:0 6px 16px rgba(0,0,0,.28); }
#crystal-op .op-need.danger{ border-left-color:var(--danger); }
#crystal-op .op-need .tag{ font-size:9.5px; font-weight:800; letter-spacing:.05em; }
#crystal-op .op-need.danger .tag{ color:var(--danger); } #crystal-op .op-need.warn .tag{ color:var(--warn); }
#crystal-op .op-need .t{ color:var(--text); font-weight:650; font-size:13.5px; line-height:1.35; margin-top:2px; }
#crystal-op .op-need .w{ color:var(--muted); font-size:11.5px; margin-top:2px; font-family:var(--font-mono); }
#crystal-op .op-clear{ font-size:13px; color:var(--muted); padding:10px 4px; display:flex; gap:8px; align-items:center; }
#crystal-op .op-clear .ok{ color:var(--success); font-size:15px; }
#crystal-op .op-pbar{ height:7px; border-radius:4px; background:color-mix(in srgb,var(--text) 10%,transparent); overflow:hidden; margin:4px 4px 2px; }
#crystal-op .op-pbar i{ display:block; height:100%; border-radius:4px; background:linear-gradient(90deg,var(--accent),var(--cyan)); box-shadow:0 0 10px rgba(var(--accent-rgb),.5); transition:width .5s cubic-bezier(.2,.7,.3,1); }

#crystal-op .op-comp{ border-top:1px solid var(--glass-border); padding:12px 14px; flex:none; }
#crystal-op .op-comp .box{ display:flex; gap:8px; align-items:center; background:var(--glass-bg); border:1px solid var(--glass-border); border-radius:12px; padding:9px 12px; }
#crystal-op .op-comp input{ flex:1; background:none; border:none; outline:none; color:var(--text); font-size:13.5px; font-family:var(--font); }
#crystal-op .op-comp .send{ background:var(--accent); border:none; border-radius:9px; width:32px; height:32px; color:#fff; cursor:pointer; font-size:15px; flex:none; }
#crystal-op .op-comp .more{ margin-top:8px; text-align:center; }
#crystal-op .op-comp .more a{ font-size:11.5px; color:var(--muted); cursor:pointer; text-decoration:none; border-bottom:1px dashed var(--glass-border-hi); }

/* MOBILE — an animated bottom sheet that rises, not a side dock. */
@media (max-width:820px){
  #panes{ margin-right:0 !important; }
  /* FULL HEIGHT under the 56px header (owner, 2026-10-12: "on a phone if it can cover the screen then
     we can"). It was min(78vh,640px): the sheet stopped mid-page and sliced the dashboard behind it. */
  #crystal-op{ top:56px; left:0; right:0; bottom:0; width:auto !important;
    height:auto; border-left:none; border-top:1px solid color-mix(in srgb,var(--accent) 34%,var(--glass-border));
    border-radius:20px 20px 0 0; box-shadow:0 -16px 44px rgba(0,0,0,.5);
    transform:translateY(100%); transition:transform .34s cubic-bezier(.2,.9,.2,1); }
  #crystal-op.op-up{ transform:translateY(0); }
  #crystal-op .op-grip{ left:0; right:0; top:0; bottom:auto; width:auto; height:16px; cursor:row-resize; }
  #crystal-op .op-grip::before{ inset:6px 42% 0; height:4px; }
}
/* the mobile launcher pill — a calm presence that rises the sheet */
#crystal-op-fab{ display:none; }
@media (max-width:820px){
  #crystal-op-fab{ position:fixed; right:16px; bottom:18px; z-index:1150; display:flex; align-items:center; gap:8px;
    padding:9px 14px 9px 9px; border-radius:26px; background:var(--glass-bg2); backdrop-filter:blur(14px);
    border:1px solid color-mix(in srgb,var(--accent) 40%,var(--glass-border)); box-shadow:0 8px 26px rgba(0,0,0,.45); cursor:pointer; }
  #crystal-op-fab img{ width:30px; height:30px; border-radius:50%; }
  #crystal-op-fab b{ font-size:13px; color:var(--text); font-weight:700; }
  #crystal-op-fab .n{ background:var(--warn); color:#3a2600; font-size:10px; font-weight:800; border-radius:9px; padding:1px 6px; }
}

/* The exchange — the RESPONSE to what you asked, shown in place. Deliberately not a history rail:
   it's the tail of one conversation under her work, not a transcript you scroll. */
#crystal-op #op-thread{ margin-top:18px; }
#crystal-op .op-you{ margin:12px 0 7px 26px; padding:9px 12px; border-radius:13px 13px 4px 13px;
  background:color-mix(in srgb,var(--accent) 16%,transparent); border:1px solid color-mix(in srgb,var(--accent) 34%,transparent);
  color:var(--text); font-size:13.5px; line-height:1.45; }
#crystal-op .op-her{ margin:0 26px 14px 0; padding:10px 13px; border-radius:13px 13px 13px 4px;
  background:var(--glass-bg); border:1px solid var(--glass-border); color:var(--text);
  font-size:13.5px; line-height:1.55; white-space:pre-wrap; }

/* While dragging the split, nothing may animate — a transition here means the panel lags behind
   the cursor, which is what made the first resizer feel broken. */
body.op-dragging #crystal-op, body.op-dragging #panes { transition: none !important; }
body.op-dragging { user-select: none; cursor: col-resize; }
#crystal-op .op-move{ text-align:center; font-size:11px; color:var(--muted2); margin:10px 0 6px;
  letter-spacing:.03em; text-transform:uppercase; font-weight:700; }
#crystal-op .op-facts{ margin:10px 4px 0; border:1px solid var(--glass-border); border-radius:11px; overflow:hidden; }
#crystal-op .op-fact{ display:flex; justify-content:space-between; gap:12px; padding:8px 12px; font-size:12.5px;
  border-bottom:1px solid var(--glass-border); }
#crystal-op .op-fact:last-child{ border-bottom:none; }
#crystal-op .op-fact span{ color:var(--muted); text-transform:capitalize; }
#crystal-op .op-fact b{ color:var(--text); text-align:right; }
#crystal-op .op-her b{ color:var(--text); font-weight:750; }
#crystal-op .op-her code{ font-family:var(--font-mono); font-size:12px; background:color-mix(in srgb,var(--text) 10%,transparent); padding:1px 5px; border-radius:5px; }
#crystal-op .op-her pre{ font-family:var(--font-mono); font-size:11.5px; background:color-mix(in srgb,var(--text) 8%,transparent); padding:9px 11px; border-radius:8px; overflow-x:auto; margin:8px 0; white-space:pre; }
#crystal-op .op-her .op-li{ display:block; padding-left:14px; position:relative; }
#crystal-op .op-her .op-li::before{ content:"•"; position:absolute; left:2px; color:var(--accent); }

/* ── WATCH HER WORK — the live activity trail ──────────────────────────────
   Each step is one real tool round: the current one pulses, finished ones tick
   and dim. When she's done the trail folds into a small "✓ … +N" header the
   reply sits under; click it to see every step. She is never a black box. */
#crystal-op .op-working{ background:color-mix(in srgb,var(--accent) 7%,transparent);
  border:1px solid color-mix(in srgb,var(--accent) 22%,transparent); }
#crystal-op .op-trailwrap{ padding:0; margin-bottom:6px; background:none; border:none; }
#crystal-op .op-trail{ display:flex; flex-direction:column; gap:3px; font-size:12.5px; }
#crystal-op .op-step{ display:flex; align-items:center; gap:8px; color:var(--muted2);
  line-height:1.5; transition:color .2s, opacity .2s; }
#crystal-op .op-step .op-dot{ width:7px; height:7px; border-radius:50%; flex:0 0 auto;
  background:color-mix(in srgb,var(--text) 30%,transparent); }
#crystal-op .op-step.was{ color:var(--muted); opacity:.72; }
#crystal-op .op-step.was .op-dot{ background:var(--accent); opacity:.55; }
#crystal-op .op-step.on{ color:var(--text); }
#crystal-op .op-step.on .op-dot{ background:var(--accent);
  box-shadow:0 0 0 0 color-mix(in srgb,var(--accent) 60%,transparent);
  animation:op-pulse 1.15s ease-out infinite; }
@keyframes op-pulse{ 70%{ box-shadow:0 0 0 6px color-mix(in srgb,var(--accent) 0%,transparent); }
  100%{ box-shadow:0 0 0 0 color-mix(in srgb,var(--accent) 0%,transparent); } }
@media (prefers-reduced-motion:reduce){ #crystal-op .op-step.on .op-dot{ animation:none; } }
/* collapsed summary header + expandable list */
#crystal-op .op-trail.done{ gap:0; }
#crystal-op .op-trail-h{ display:flex; align-items:center; gap:7px; width:100%; text-align:left;
  background:none; border:none; cursor:pointer; padding:2px 0; color:var(--muted);
  font:inherit; font-size:12px; }
#crystal-op .op-trail-h .op-tick{ color:var(--accent); font-style:normal; font-weight:800; }
#crystal-op .op-trail-h .op-caret{ margin-left:auto; font-style:normal; color:var(--muted2);
  transition:transform .18s; }
#crystal-op .op-trail.done.open .op-trail-h .op-caret{ transform:rotate(90deg); }
#crystal-op .op-trail-list{ display:none; margin:5px 0 2px 3px; padding-left:9px; gap:3px;
  border-left:2px solid color-mix(in srgb,var(--accent) 25%,transparent); }
#crystal-op .op-trail.done.open .op-trail-list{ display:flex; flex-direction:column; }
