/**
 * maya-hq.css — Maya's HQ (P7 rework, UI-BRIEF.md).
 *
 * The whole sheet answers one brief: a dead copy of the Claude chat feel —
 * whisper header, assistant text with no bubble, one quiet composer card,
 * one restrained accent, and NOTHING squishes. Layout rule: every row is a
 * flex with exactly one flexible member; fixed elements never share a row
 * with text they could crush.
 */

#page-maya-hq { padding: 0; }

#mhq-shell {
  display: flex; flex-direction: column;
  height: calc(100dvh - 118px); /* app shell header + paddings; tuned on dev */
  max-width: 760px; margin: 0 auto; width: 100%;
  background: var(--surface, #fff);
  font-size: 16px; line-height: 1.6; color: var(--text, #1a1a18);
}

/* ── Header: a whisper ──────────────────────────────────────────────────── */
.mhq-head {
  display: flex; align-items: center; justify-content: space-between;
  min-height: 52px; padding: 0 14px;
  border-bottom: 1px solid var(--border, #ececea);
  flex: none;
}
.mhq-title { font-size: 15px; font-weight: 600; letter-spacing: .01em; }
.mhq-head-actions { display: flex; gap: 2px; flex: none; }
.mhq-hbtn {
  width: 38px; height: 38px; border: 0; background: none; border-radius: 10px;
  color: var(--text-3, #8a8a86); font-size: 15px; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
}
.mhq-hbtn:hover { background: var(--surface-2, #f5f5f3); color: var(--text, #1a1a18); }

/* ── History drop ───────────────────────────────────────────────────────── */
.mhq-history {
  border-bottom: 1px solid var(--border, #ececea);
  max-height: 40dvh; overflow-y: auto; flex: none;
}
.mhq-hist-row {
  display: block; width: 100%; text-align: left; padding: 11px 16px;
  border: 0; background: none; cursor: pointer; font: inherit; font-size: 14px;
  color: var(--text-2, #4a4a46);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.mhq-hist-row:hover { background: var(--surface-2, #f5f5f3); }
.mhq-hist-empty { padding: 14px 16px; font-size: 13.5px; color: var(--text-3, #8a8a86); }

/* ── The plan (R5) ───────────────────────────────────────────────────────
   It used to be a full-width bar between the header and the conversation.
   Alex: "We need to keep it simple. Maybe the chat should come up as the first
   thing." So it is a chip in the header row that opens the plan as a sheet —
   the same slide-in this screen already uses for artifacts. */
.mhq-plan-chip {
  display: inline-flex; align-items: center; gap: 6px; flex: none;
  height: 28px; padding: 0 10px; margin-right: 4px;
  border: 1px solid var(--border, #ececea); border-radius: 999px;
  background: none; cursor: pointer; font: inherit;
  font-size: 12px; color: var(--text-3, #8a8a86);
  font-variant-numeric: tabular-nums;
}
.mhq-plan-chip:hover { background: var(--surface-2, #f5f5f3); color: var(--text-2, #4a4a46); }
.mhq-plan-chip i { font-size: 11px; }

/* The sheet leads with the one next thing, so opening it still answers
   "what do I do" in its first line (the next-thing-first rule from UI-BRIEF,
   which the collapsed bar used to carry). */
.mhq-plan-next {
  padding: 14px 16px 10px; font-size: 15px; line-height: 1.45;
  color: var(--text, #1a1a18); border-bottom: 1px solid var(--border, #ececea);
}
.mhq-pn-label {
  display: inline-block; margin-right: 6px;
  font-size: 11px; font-weight: 600; letter-spacing: .06em;
  text-transform: uppercase; color: var(--text-3, #8a8a86);
}
.mhq-plan-scroll { flex: 1; min-height: 0; overflow-y: auto; }
.mhq-plan-body { flex: none; }
.mhq-plan-strategy { padding: 12px 16px 6px; font-size: 13.5px; color: var(--text-2, #4a4a46); line-height: 1.55; }
.mhq-plan-item {
  display: flex; align-items: flex-start; gap: 10px; width: 100%; text-align: left;
  padding: 9px 16px; border: 0; background: none; cursor: pointer; font: inherit;
  font-size: 14px; color: var(--text, #1a1a18);
}
.mhq-plan-item:hover { background: var(--surface-2, #f5f5f3); }
.mhq-plan-item .mhq-pi-tick { flex: none; color: var(--text-3, #c9c9c5); margin-top: 2px; }
.mhq-plan-item.done .mhq-pi-tick { color: var(--good, #2f9e6e); }
.mhq-plan-item.done .mhq-pi-title { text-decoration: line-through; color: var(--text-3, #8a8a86); }

/* ── Thread: type does the work ─────────────────────────────────────────── */
.mhq-thread { flex: 1; overflow-y: auto; padding: 20px 16px 12px; }
.mhq-welcome { padding: 18dvh 8px 0; text-align: center; }
.mhq-w-title { font-size: 21px; font-weight: 600; margin-bottom: 6px; }
.mhq-w-sub { font-size: 14.5px; color: var(--text-3, #8a8a86); }

.mhq-msg { margin: 0 0 18px; display: flex; }
.mhq-msg.user { justify-content: flex-end; }
/* Maya's mark sits beside her words (R4). Aligned to the FIRST LINE rather
   than centred, so a long reply does not leave the badge floating in the
   middle of a paragraph. */
.mhq-msg .mhq-av { flex: none; margin-right: 10px; margin-top: 1px; }
.mhq-ubub {
  max-width: 85%; background: var(--surface-2, #f5f5f3);
  border-radius: 16px; padding: 10px 14px;
  font-size: 15.5px; line-height: 1.55; white-space: pre-wrap; word-break: break-word;
}
.mhq-atext {
  max-width: 100%; font-size: 16px; line-height: 1.65;
  white-space: pre-wrap; word-break: break-word;
}
.mhq-thinking::after { content: '·'; animation: mhqPulse 1s infinite; color: var(--text-3, #8a8a86); }
@keyframes mhqPulse { 0% { opacity: .2 } 50% { opacity: 1 } 100% { opacity: .2 } }
.mhq-atext.mhq-working { color: var(--text-3, #8a8a86); font-size: 14.5px; }

/* Queued-approval chip: a quiet, factual line — not an alarm. */
.mhq-queued-chip {
  align-self: flex-start; margin: -8px 0 18px; padding: 7px 12px;
  font-size: 13px; line-height: 1.5; border-radius: 10px;
  color: var(--warn-text, #7a5b1e); background: var(--warn-bg, #faf6ec);
  border: 1px solid var(--warn-border, #eee4c8);
}

/* ── Attach chips (only while pending) ──────────────────────────────────── */
.mhq-attach-chips { display: flex; flex-wrap: wrap; gap: 6px; padding: 0 16px 6px; flex: none; }
.mhq-chip {
  display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px;
  background: var(--surface-2, #f5f5f3); border: 1px solid var(--border, #ececea);
  border-radius: 999px; padding: 4px 10px; color: var(--text-2, #4a4a46);
  max-width: 75vw; overflow: hidden;
}
.mhq-chip-x { border: 0; background: none; cursor: pointer; font-size: 14px; color: var(--text-3, #8a8a86); padding: 0 2px; }
.mhq-chip-err { color: var(--warn-text, #7a5b1e); background: var(--warn-bg, #faf6ec); border-color: var(--warn-border, #eee4c8); }

/* ── Composer: one quiet card ───────────────────────────────────────────── */
.mhq-composer {
  display: flex; align-items: flex-end; gap: 4px;
  margin: 4px 12px 6px; padding: 6px;
  border: 1px solid var(--border, #dcdcd8); border-radius: 22px;
  background: var(--surface, #fff);
  box-shadow: 0 1px 4px rgba(0,0,0,.04);
  flex: none;
}
.mhq-composer textarea {
  flex: 1; min-width: 0; border: 0; outline: none; resize: none; background: none;
  font: inherit; font-size: 15.5px; line-height: 1.5;
  padding: 8px 4px; max-height: 160px;
}
.mhq-cbtn {
  flex: none; width: 36px; height: 36px; border: 0; border-radius: 50%;
  background: none; color: var(--text-3, #8a8a86); font-size: 15px; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
}
.mhq-cbtn:hover { background: var(--surface-2, #f5f5f3); }
/* The clip is an inline SVG now (R3, matching the courses composer), so it
   sizes from the box rather than a font-size. */
.mhq-cbtn svg { width: 17px; height: 17px; }

/* ── First-use attach explainer (R3) ──────────────────────────────────────
   "We can't just dump them in there" — said once, before the file picker,
   with a permanent opt-out. Same contract as the courses panel's card. */
.mhq-explain {
  position: fixed; inset: 0; z-index: 200;
  background: rgba(20, 20, 18, .38);
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
}
.mhq-explain-card {
  background: var(--surface, #fff); color: var(--text, #1a1a18);
  border: 1px solid var(--border, #e6e4df); border-radius: 16px;
  max-width: 460px; width: 100%; max-height: 86vh; overflow-y: auto;
  padding: 22px 22px 18px;
  box-shadow: 0 18px 48px rgba(20, 20, 18, .18);
}
.mhq-explain-card h3 { margin: 0 0 10px; font-size: 17px; font-weight: 600; }
.mhq-explain-card p { margin: 0 0 12px; font-size: 14px; line-height: 1.55; color: var(--text-2, #46463f); }
.mhq-explain-card ul { margin: 0 0 14px; padding-left: 18px; }
.mhq-explain-card li { font-size: 13.5px; line-height: 1.55; color: var(--text-2, #46463f); margin-bottom: 6px; }
.mhq-explain-again {
  display: flex; align-items: center; gap: 8px;
  font-size: 13px; color: var(--text-3, #8a8a86); margin-bottom: 16px; cursor: pointer;
}
.mhq-explain-acts { display: flex; gap: 10px; justify-content: flex-end; }
.mhq-explain-no, .mhq-explain-go {
  border-radius: 10px; padding: 9px 16px; font-size: 14px; cursor: pointer;
  border: 1px solid var(--border, #e6e4df);
}
.mhq-explain-no { background: none; color: var(--text-2, #46463f); }
.mhq-explain-no:hover { background: var(--surface-2, #f5f5f3); }
.mhq-explain-go { background: var(--text, #1a1a18); color: var(--surface, #fff); border-color: var(--text, #1a1a18); }
.mhq-explain-go:hover { opacity: .9; }
.mhq-send {
  flex: none; width: 36px; height: 36px; border: 0; border-radius: 50%;
  background: var(--text, #1a1a18); color: var(--surface, #fff); font-size: 14px;
  cursor: pointer; display: inline-flex; align-items: center; justify-content: center;
}
.mhq-send:hover { opacity: .85; }

/* Dictation mount (the platform's one VoiceInput row) + the meter. */
#mhq-voice-mount { padding: 0 16px; flex: none; }
.mhq-meter {
  text-align: center; font-size: 11px; color: var(--text-3, #b3b3af);
  padding: 2px 12px 8px; min-height: 12px; font-variant-numeric: tabular-nums; flex: none;
}

/* ── Connect sheet ──────────────────────────────────────────────────────── */
.mhq-modal-overlay {
  position: fixed; inset: 0; z-index: 1200; background: rgba(20, 20, 18, .4);
  display: flex; align-items: center; justify-content: center; padding: 16px;
}
.mhq-modal-card {
  position: relative; background: var(--surface, #fff); border-radius: 16px;
  max-width: 430px; width: 100%; padding: 24px; box-shadow: 0 18px 50px rgba(0,0,0,.18);
}
.mhq-modal-title { font-size: 17px; font-weight: 600; margin-bottom: 6px; }
.mhq-modal-state { font-size: 12.5px; color: var(--text-3, #8a8a86); margin-bottom: 10px; }
.mhq-modal-p { font-size: 14px; line-height: 1.6; color: var(--text-2, #4a4a46); }
.mhq-connect-url {
  display: flex; gap: 8px; align-items: center; margin: 14px 0;
  background: var(--surface-2, #f5f5f3); border: 1px solid var(--border, #ececea);
  border-radius: 10px; padding: 8px 10px;
}
.mhq-connect-url code { flex: 1; min-width: 0; font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mhq-modal-steps { margin: 10px 0 16px 18px; font-size: 13.5px; line-height: 1.65; color: var(--text-2, #4a4a46); }
.mhq-modal-manage { border: 0; background: none; color: var(--text, #1a1a18); text-decoration: underline; font: inherit; font-size: 13.5px; cursor: pointer; padding: 0; }
.mhq-modal-close {
  position: absolute; top: 12px; right: 14px; border: 0; background: none;
  font-size: 20px; line-height: 1; color: var(--text-3, #8a8a86); cursor: pointer;
}

/* ── The artifact handoff card + slide-in panel (7.2, UI-BRIEF §2) ─────── */
.mhq-artifact {
  display: flex; align-items: center; gap: 12px; width: 100%; max-width: 420px;
  margin: -8px 0 18px; padding: 12px 14px;
  border: 1px solid var(--border, #ececea); border-radius: 12px;
  background: var(--surface, #fff); cursor: pointer; font: inherit; text-align: left;
}
.mhq-artifact:hover { background: var(--surface-2, #f5f5f3); }
.mhq-art-ic {
  flex: none; width: 34px; height: 34px; border-radius: 8px;
  background: var(--surface-2, #f5f5f3); color: var(--text-2, #4a4a46);
  display: inline-flex; align-items: center; justify-content: center; font-size: 14px;
}
.mhq-art-txt { min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.mhq-art-title { font-size: 14px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mhq-art-sub { font-size: 12px; color: var(--text-3, #8a8a86); }

#mhq-panel .mhq-panel-backdrop {
  position: fixed; inset: 0; z-index: 1300;
  background: rgba(20, 20, 18, 0); transition: background .22s ease;
}
#mhq-panel.open .mhq-panel-backdrop { background: rgba(20, 20, 18, .35); }
.mhq-panel-sheet {
  position: fixed; z-index: 1301; left: 0; right: 0; bottom: 0; height: 92dvh;
  background: var(--surface, #fff); border-radius: 16px 16px 0 0;
  box-shadow: 0 -10px 40px rgba(0,0,0,.18);
  transform: translateY(100%); transition: transform .22s ease;
  display: flex; flex-direction: column;
}
#mhq-panel.open .mhq-panel-sheet { transform: translateY(0); }
/* The plan sheet (R5) reuses the same furniture. Listed alongside rather than
   given its own copy — one slide-in on this screen, not two that drift. */
#mhq-plan-sheet .mhq-panel-backdrop {
  position: fixed; inset: 0; z-index: 1300;
  background: rgba(20, 20, 18, 0); transition: background .22s ease;
}
#mhq-plan-sheet.open .mhq-panel-backdrop { background: rgba(20, 20, 18, .35); }
#mhq-plan-sheet.open .mhq-panel-sheet { transform: translateY(0); }
/* Shorter than an artifact preview — a list of five things does not need 92dvh. */
#mhq-plan-sheet .mhq-panel-sheet { height: auto; max-height: 78dvh; }
.mhq-panel-head {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  min-height: 48px; padding: 0 8px 0 16px;
  border-bottom: 1px solid var(--border, #ececea); flex: none;
}
.mhq-panel-title {
  flex: 1; min-width: 0; font-size: 14px; font-weight: 600;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.mhq-panel-actions { display: flex; align-items: center; gap: 2px; flex: none; }
.mhq-panel-newtab, .mhq-panel-close {
  width: 38px; height: 38px; border: 0; background: none; border-radius: 10px;
  color: var(--text-3, #8a8a86); cursor: pointer; text-decoration: none;
  display: inline-flex; align-items: center; justify-content: center; font-size: 15px;
}
.mhq-panel-close { font-size: 20px; }
.mhq-panel-newtab:hover, .mhq-panel-close:hover { background: var(--surface-2, #f5f5f3); color: var(--text, #1a1a18); }
.mhq-panel-frame { flex: 1; width: 100%; border: 0; }

/* Desktop: the split pane — chat stays visible and usable on the left. */
@media (min-width: 900px) {
  .mhq-panel-sheet {
    left: auto; top: 0; bottom: 0; right: 0; width: 55%; height: 100dvh;
    border-radius: 0; border-left: 1px solid var(--border, #ececea);
    box-shadow: -8px 0 30px rgba(0,0,0,.08);
    transform: translateX(100%);
  }
  #mhq-panel.open .mhq-panel-sheet { transform: translateX(0); }
  #mhq-panel .mhq-panel-backdrop { background: transparent !important; pointer-events: none; }
}

@media (prefers-reduced-motion: reduce) {
  .mhq-panel-sheet, #mhq-panel .mhq-panel-backdrop { transition: none; }
}

/* ── Maya's mark (R4) ─────────────────────────────────────────────────────
   The figure, knocked out of a filled accent disc. Alex asked for it to
   "really pop out"; the disc is what does that, which is why the figure
   itself is not scaled up here the way it is in the nav rail. */
.maya-badge {
  display: inline-flex; align-items: center; justify-content: center;
  flex: none; border-radius: 50%;
  background: var(--accent, #6b5bd6); color: #fff;
}
.maya-badge svg { width: 66%; height: 66%; fill: currentColor; }
/* In the nav rail the mark inherits the row's colour like every other icon. */
.hamburger-ico { display: inline-flex; width: 18px; height: 18px; vertical-align: -3px; }
.hamburger-ico svg { width: 100%; height: 100%; fill: currentColor; }
