/* =============================================================================
   MUSE · Components — bubbles, loaders, tiles, panel, toasts, modal, flyout
   ========================================================================== */

/* ── Message bubbles (US-007) ───────────────────────────────────────────── */
.msg { display: flex; max-width: 100%; }
/* Only freshly-arrived rows animate in — history stays put across re-renders. */
.msg.is-enter, .sysline.is-enter { animation: msg-in var(--dur-base) var(--ease-out) both; }
@keyframes msg-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

.msg__body { min-width: 0; flex: 1; }
.msg__role { font: 600 12px/1 var(--font-ui); color: var(--ink-2); margin: 4px 0 6px; }
.msg__role em { font-style: normal; color: var(--ink-low); font-weight: 400; margin-left: 8px; }
.msg__text { font-size: 15px; line-height: 1.62; color: var(--ink); }
.msg__text p + p { margin-top: 12px; }
.msg__text strong { font-weight: 600; }

/* Opposite sides: the user writes on the right, Muse replies on the left. */
.msg--user { flex-direction: row-reverse; }
.msg--user .msg__body { display: flex; flex-direction: column; align-items: flex-end; }

/* user bubble sits in a soft card on the right; AI text is open on the canvas */
.msg--user .msg__text {
  background: var(--surface); border-radius: var(--r-md) var(--r-md) 6px var(--r-md);
  padding: 12px 16px; box-shadow: var(--sh-xs), inset 0 0 0 1px var(--line-soft);
  max-width: 82%; text-align: left;
}

/* streaming caret */
.msg__text .caret { display: inline-block; width: 7px; height: 1.05em; transform: translateY(2px);
  margin-left: 2px; background: var(--accent); border-radius: 2px; animation: caret-blink 1s steps(2) infinite; }
@keyframes caret-blink { 50% { opacity: 0; } }

/* system line */
.sysline { display: flex; align-items: center; gap: 10px; color: var(--ink-low); font-size: 12px; padding: 2px 0; }
.sysline::before, .sysline::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.sysline span { display: inline-flex; align-items: center; gap: 6px; }

/* stopped-by-you mark: same quiet line, the stop glyph a touch smaller */
.sysline--stop .icon { width: 12px; height: 12px; }
.sysline__more { color: var(--ink-faint); }

/* ── Loading state with rotating copy (US-007) ──────────────────────────── */
.thinking { display: flex; gap: 12px; animation: msg-in var(--dur-base) var(--ease-out) both; }
.thinking__avatar { width: 30px; height: 30px; border-radius: 9px; flex: none; margin-top: 2px;
  background: var(--surface); box-shadow: inset 0 0 0 1px var(--line); display: grid; place-items: center; color: #E74141; }
/* Muse bolt (red), gently pulsing while a message loads */
.thinking__bolt { width: auto; height: 17px; animation: thinking-pulse 1.3s ease-in-out infinite; }
@keyframes thinking-pulse { 0%,100% { opacity: .5; transform: scale(.9); } 50% { opacity: 1; transform: scale(1.06); } }
.thinking__copy { display: flex; flex-direction: column; justify-content: center; min-height: 30px; }
.thinking__line { font-size: 14.5px; color: var(--ink-mid); }
.thinking__line .word { display: inline-block; }
.thinking__shimmer {
  background: linear-gradient(90deg, var(--ink-low) 20%, var(--ink) 40%, var(--ink) 60%, var(--ink-low) 80%);
  background-size: 200% 100%; -webkit-background-clip: text; background-clip: text; color: transparent;
  animation: shimmer 2.4s linear infinite;
}
@keyframes shimmer { to { background-position: -200% 0; } }
.thinking__dots { margin-top: 7px; display: flex; gap: 5px; }
.thinking__dots i { width: 5px; height: 5px; border-radius: 50%; background: var(--ink-faint); animation: bob 1.2s var(--ease-in-out) infinite; }
.thinking__dots i:nth-child(2) { animation-delay: 0.15s; }
.thinking__dots i:nth-child(3) { animation-delay: 0.3s; }
@keyframes bob { 0%,100% { transform: translateY(0); opacity: .5; } 50% { transform: translateY(-4px); opacity: 1; } }

/* ── Long-running task card (US-008) ────────────────────────────────────── */
.longtask {
  display: flex; gap: 14px; align-items: flex-start;
  background: var(--surface); border-radius: var(--r-lg);
  box-shadow: var(--sh-sm), inset 0 0 0 1px var(--line-soft);
  padding: 16px 18px; animation: msg-in var(--dur-base) var(--ease-out) both;
}
.longtask__ring { width: 34px; height: 34px; flex: none; position: relative; }
/* Indeterminate spinner: the whole ring spins steadily while the coral arc
   grows and shrinks (the classic pattern). Both transforms pivot on the ring's
   own centre (transform-box) so the arc never leaves the frame. r=15 gives a
   94.2 circumference; the dash math below stays inside that. */
.longtask__ring svg { transform-box: fill-box; transform-origin: center; animation: ringSpin 1.4s linear infinite; }
.longtask__ring .track { stroke: var(--sunken); }
.longtask__ring .prog { stroke: var(--accent); stroke-linecap: round; transform-box: fill-box; transform-origin: center;
  stroke-dasharray: 94.2; animation: ringArc 1.6s var(--ease-in-out) infinite; }
@keyframes ringSpin { to { transform: rotate(360deg); } }
@keyframes ringArc {
  0%   { stroke-dashoffset: 86; transform: rotate(0deg); }     /* short arc (~8px) */
  50%  { stroke-dashoffset: 24; transform: rotate(45deg); }    /* long arc (~70px) */
  100% { stroke-dashoffset: 86; transform: rotate(360deg); }   /* back to short, one lap ahead */
}
@media (prefers-reduced-motion: reduce) {
  .longtask__ring svg, .longtask__ring .prog { animation: none; }
  .longtask__ring .prog { stroke-dashoffset: 30; }             /* a static two-thirds arc */
}
.longtask__body { flex: 1; min-width: 0; }
.longtask__title { font: 600 14px/1.3 var(--font-ui); display: flex; align-items: center; gap: 8px; }
.longtask__title .chip { height: 20px; font-size: 10px; }
.longtask__desc { font-size: 13px; color: var(--ink-mid); margin-top: 4px; line-height: 1.5; }
.longtask__actions { margin-top: 12px; display: flex; gap: 8px; }

/* ── Artifact being generated — clear placeholder (type + name + progress) ── */
.gening {
  max-width: 440px; background: var(--surface); border-radius: var(--r-md);
  box-shadow: var(--sh-sm), inset 0 0 0 1px var(--line-soft);
  padding: 14px 16px; animation: msg-in var(--dur-base) var(--ease-out) both;
}
.gening__row { display: flex; align-items: center; gap: 12px; }
.gening__thumb { width: 40px; height: 40px; border-radius: 11px; flex: none; }
.gening__thumb .icon { width: 20px; height: 20px; }
.gening__id { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.gening__name { font: 600 14px/1.3 var(--font-ui); color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
/* While generating, the real name is hidden behind a shimmering skeleton bar. */
.gening__skel { display: block; height: 13px; width: 60%; border-radius: var(--r-pill);
  background: var(--sunken); position: relative; overflow: hidden; }
.gening__skel::after { content: ""; position: absolute; inset: 0; transform: translateX(-100%);
  background: linear-gradient(100deg, transparent 20%, color-mix(in srgb, var(--ink) 13%, transparent) 50%, transparent 80%);
  animation: gening-shimmer 1.45s var(--ease-in-out) infinite; }
@keyframes gening-shimmer { to { transform: translateX(100%); } }
.gening__meta { font: 400 12px/1.3 var(--font-ui); color: var(--ink-low); }
.gening__mark { flex: none; display: grid; place-items: center; width: 22px; }
.gening__bolt { height: 18px; width: auto; color: #E74141; display: block; animation: thinking-pulse 1.3s ease-in-out infinite; }
.gening__bar { height: 4px; border-radius: var(--r-pill); background: var(--sunken); overflow: hidden; margin-top: 13px; position: relative; }
.gening__bar i { position: absolute; top: 0; bottom: 0; left: -40%; width: 40%; border-radius: var(--r-pill);
  background: var(--accent-grad); animation: gening-bar 1.15s var(--ease-in-out) infinite; }
@keyframes gening-bar { to { left: 100%; } }
.gening__actions { margin-top: 12px; display: flex; gap: 8px; }

/* ── Rating a reply ────────────────────────────────────────────────────────
   Always there. Revealing them on hover made them feel like decoration you had
   found by accident, and left them unreachable on touch. Present but faint is
   the right register: findable without looking for them, and never arguing
   with the text above. */
.rate { display: flex; gap: 2px; margin-top: 8px; margin-left: -6px; }
.rate__btn { width: 28px; height: 28px; display: grid; place-items: center; border: 0; cursor: pointer;
  border-radius: var(--r-xs); background: transparent; color: var(--ink-faint);
  transition: background var(--dur-fast) var(--ease-out), color var(--dur-fast) var(--ease-out); }
.rate__btn:hover { background: var(--hover); color: var(--ink-2); }
/* On is the glyph turning coral, nothing more. A filled pill around a 15px
   icon reads as a badge announcing itself, and this is a mark you left for
   yourself, not a status the page needs to broadcast. */
.rate__btn.is-on { color: var(--accent); }
.rate__btn.is-on:hover { background: var(--hover); }
.rate__btn .icon { width: 15px; height: 15px; }
/* the thumb that is down should look like it went down */
.rate__btn:last-child .icon { transform: translateY(1px); }

/* One line, and answering it is optional. No ready-made reasons: those quietly
   promised that picking one would change the answer, which needs a capability
   the backend may not have. A typed sentence only needs somewhere to be kept. */
.rate-ask { margin: 6px 0 0; animation: rateAsk 200ms var(--ease-out); }
@keyframes rateAsk { from { opacity: 0; } to { opacity: 1; } }
.rate-ask__field { width: min(420px, 100%); box-sizing: border-box; border: 0; background: transparent;
  padding: 4px 2px; font: 400 12.5px/1.4 var(--font-ui); color: var(--ink);
  border-bottom: 1px solid var(--line); transition: border-color var(--dur-fast) var(--ease-out); }
.rate-ask__field::placeholder { color: var(--ink-faint); }
.rate-ask__field:focus { outline: none; border-bottom-color: var(--accent); }

/* what you wrote, kept where you wrote it, so the line is a record not a form */
.rate-said { margin: 6px 0 0; max-width: min(560px, 100%); cursor: text;
  font: 400 12.5px/1.45 var(--font-ui); font-style: italic; color: var(--ink-low); }
.rate-said:hover { color: var(--ink-mid); }
@media (prefers-reduced-motion: reduce) { .rate-ask { animation: none; } }

/* ── Artifact tile in chat (US-010) ─────────────────────────────────────── */
.artifact-tile {
  display: flex; align-items: center; gap: 13px; width: 100%; max-width: 440px;
  padding: 13px 15px; border-radius: var(--r-md);
  background: var(--surface); box-shadow: var(--sh-sm), inset 0 0 0 1px var(--line-soft);
  text-align: left; cursor: pointer;
  transition: transform var(--dur-fast) var(--ease-out), box-shadow var(--dur-fast) var(--ease-out);
}
.artifact-tile:hover { transform: translateY(-2px); box-shadow: var(--sh-md), inset 0 0 0 1px var(--line); }
.artifact-tile.is-open { box-shadow: var(--sh-sm), inset 0 0 0 1.5px var(--accent-tint); }
/* Monochrome line icons — a neutral recessed tile, no color fills or gradients.
   Type is conveyed by the glyph itself (code / file / image), not by color. */
.artifact-tile__thumb {
  width: 44px; height: 44px; border-radius: var(--r-sm); flex: none;
  display: grid; place-items: center;
  background: var(--sunken); color: var(--ink-2);
  box-shadow: inset 0 0 0 1px var(--line-soft);
}
.artifact-tile__thumb .icon { width: 22px; height: 22px; }
.artifact-tile__text { flex: 1; min-width: 0; }
.artifact-tile__name { font: 600 13.5px/1.3 var(--font-ui); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.artifact-tile__meta { font: 400 11.5px/1.3 var(--font-ui); color: var(--ink-low); margin-top: 2px;
  display: flex; align-items: center; gap: 7px; }
.artifact-tile__meta .badge-new { color: var(--accent); font-weight: 600;
  background: var(--accent-soft); padding: 1px 6px; border-radius: var(--r-pill); font-size: 10px; }
.artifact-tile__open { color: var(--ink-low); }
.artifact-tile:hover .artifact-tile__open { color: var(--accent); }

/* uploaded-file component, inline (US-016) */
.filechip {
  display: inline-flex; align-items: center; gap: 9px;
  padding: 7px 11px 7px 8px; border-radius: var(--r-sm);
  background: var(--sunken); max-width: 240px;
}
.filechip__ico { width: 28px; height: 28px; border-radius: 7px; flex: none; display: grid; place-items: center;
  background: var(--surface); color: var(--accent); box-shadow: var(--sh-xs); }
.filechip__ico .icon { width: 16px; height: 16px; }
.filechip__text { min-width: 0; }
.filechip__name { font: 500 12.5px/1.2 var(--font-ui); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.filechip__meta { font: 400 11px/1.2 var(--font-mono); color: var(--ink-low); }
.filechip__x { color: var(--ink-low); margin-left: 2px; }
.filechip__x:hover { color: var(--ink); }
.filechip--done .filechip__ico { color: var(--ok); }

/* ── Artifact side panel (US-011, US-012, US-013) ───────────────────────── */
.panel {
  position: fixed; top: 0; right: 0; bottom: 0; z-index: var(--z-panel);
  width: var(--panel-w); max-width: 100vw;
  background: var(--surface); border-left: 1px solid var(--line);
  box-shadow: var(--sh-lg);
  display: flex; flex-direction: column;
  transform: translateX(100%); visibility: hidden;
  transition: transform var(--dur-base) var(--ease-out), visibility var(--dur-base);
}
.panel.is-open { transform: none; visibility: visible; }
.panel__head { flex: none; display: flex; align-items: center; gap: 10px;
  padding: 12px 12px 12px 18px; border-bottom: 1px solid var(--line); }
.panel__id { flex: 1; min-width: 0; }
.panel__name { font: 600 14.5px/1.25 var(--font-display); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.panel__meta { font: 400 11px/1.2 var(--font-ui); color: var(--ink-low); display: flex; align-items: center; gap: 7px; margin-top: 1px; }
.panel__mode { font-family: var(--font-mono); text-transform: uppercase; letter-spacing: 0.05em;
  background: var(--sunken); padding: 1px 6px; border-radius: var(--r-pill); font-size: 9.5px; }
.panel__actions { display: flex; align-items: center; gap: 2px; }
.panel__stage { flex: 1; min-height: 0; position: relative; background: var(--canvas); }
.panel__frame { width: 100%; height: 100%; border: 0; background: #fff; }

/* loading / error overlays inside the iframe stage */
.panel__overlay { position: absolute; inset: 0; display: grid; place-items: center; gap: 12px;
  background: var(--surface); }
.panel__overlay .icon { width: 26px; height: 26px; color: var(--ink-low); }
.panel__overlay span { font-size: 13px; color: var(--ink-mid); }
.panel__overlay.is-err .icon { color: var(--danger); }

/* ── Account flyout (US-002, US-018) ────────────────────────────────────── */
.flyout {
  position: fixed; z-index: var(--z-flyout);
  width: 250px; background: var(--glass-strong);
  backdrop-filter: blur(22px) saturate(170%); -webkit-backdrop-filter: blur(22px) saturate(170%);
  border-radius: var(--r-lg); box-shadow: var(--sh-lg), inset 0 0 0 1px var(--glass-edge);
  padding: 7px; transform-origin: bottom left;       /* entrance: Motion springIn */
}
@keyframes flyout-in { from { opacity: 0; transform: scale(0.94) translateY(6px); } to { opacity: 1; transform: none; } }
.flyout__head { display: flex; align-items: center; gap: 11px; padding: 9px 10px 11px; }
.flyout__avatar { width: 36px; height: 36px; border-radius: 50%; background: var(--muse-grad); color: #fff;
  display: grid; place-items: center; font: 600 14px/1 var(--font-ui); flex: none; }
.flyout__name { font: 600 13.5px/1.2 var(--font-ui); }
.flyout__mail { font: 400 11.5px/1.2 var(--font-ui); color: var(--ink-low); }
.flyout__sep { height: 1px; background: var(--line); margin: 4px 6px; }
.flyout__item {
  display: flex; align-items: center; gap: 11px; width: 100%;
  padding: 9px 10px; border-radius: var(--r-sm); color: var(--ink-2); font-size: 13.5px; font-weight: 500;
  transition: background var(--dur-fast) var(--ease-out);
}
.flyout__item:hover { background: var(--hover); }
.flyout__item .icon { color: var(--ink-low); }
.flyout__item--danger { color: var(--danger); }
.flyout__item--danger .icon { color: var(--danger); }
.flyout__item--disabled { color: var(--ink-faint); cursor: default; }
.flyout__item--disabled:hover { background: transparent; }
.flyout__item--disabled .icon { color: var(--ink-faint); }
.flyout__item .soon { margin-left: auto; font: 500 9.5px/1 var(--font-ui); letter-spacing: 0.06em;
  text-transform: uppercase; color: var(--ink-low); background: var(--sunken); padding: 3px 6px; border-radius: var(--r-pill); }

/* ── Context menu (meatball, US-005) ────────────────────────────────────── */
.menu {
  position: fixed; z-index: var(--z-flyout);
  min-width: 184px; background: var(--glass-strong);
  backdrop-filter: blur(22px) saturate(170%); -webkit-backdrop-filter: blur(22px) saturate(170%);
  border-radius: var(--r-md); box-shadow: var(--sh-lg), inset 0 0 0 1px var(--glass-edge);
  padding: 6px;       /* entrance: Motion springIn */
}
.menu__item { display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 10px;
  border-radius: var(--r-sm); font-size: 13px; font-weight: 500; color: var(--ink-2);
  transition: background var(--dur-fast) var(--ease-out); }
.menu__item:hover { background: var(--hover); }
.menu__item .icon { color: var(--ink-low); width: 16px; height: 16px; }
.menu__item--danger { color: var(--danger); }
.menu__item--danger .icon { color: var(--danger); }
.menu__item--disabled { color: var(--ink-faint); cursor: default; }
.menu__item--disabled:hover { background: transparent; }
.menu__item .soon { margin-left: auto; font-size: 9.5px; text-transform: uppercase; letter-spacing: 0.05em; color: var(--ink-low); }

/* ── Files popover (a conversation's artifacts, Claude-style) ────────────── */
.files {
  position: fixed; z-index: var(--z-flyout);
  width: 330px; max-width: calc(100vw - 16px);
  background: var(--glass-strong);
  backdrop-filter: blur(22px) saturate(170%); -webkit-backdrop-filter: blur(22px) saturate(170%);
  border-radius: var(--r-lg); box-shadow: var(--sh-lg), inset 0 0 0 1px var(--glass-edge);
  padding: 8px; transform-origin: top right;
}
.files__head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 6px 6px 10px 10px; }
.files__title { font: 600 14px/1.2 var(--font-display); letter-spacing: -0.01em; }
.files__all { display: inline-flex; align-items: center; gap: 6px; padding: 6px 10px; border-radius: var(--r-pill);
  font: 500 11.5px/1 var(--font-ui); color: var(--ink-mid); background: transparent;
  transition: background var(--dur-fast) var(--ease-out), color var(--dur-fast) var(--ease-out); }
.files__all:hover { background: var(--hover); color: var(--ink); }
.files__all .icon { width: 13px; height: 13px; }
.files__list { display: flex; flex-direction: column; max-height: 380px; overflow-y: auto; }
.files__sec { display: flex; flex-direction: column; gap: 2px; }
.files__sec + .files__sec { margin-top: 6px; }
.files__sectitle { font: 600 10.5px/1 var(--font-ui); letter-spacing: 0.06em; text-transform: uppercase;
  color: var(--ink-low); padding: 9px 8px 6px; }
.files__item { display: flex; align-items: center; gap: 2px; border-radius: var(--r-md);
  transition: background var(--dur-fast) var(--ease-out); }
.files__item:hover { background: var(--hover); }
.files__open { flex: 1; min-width: 0; display: flex; align-items: center; gap: 11px; padding: 9px 6px 9px 8px; text-align: left; }
.files__thumb { width: 36px; height: 36px; flex: none; }
.files__thumb .icon { width: 18px; height: 18px; }
.files__id { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.files__name { font: 600 13px/1.3 var(--font-ui); color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.files__meta { font: 400 11.5px/1.2 var(--font-ui); color: var(--ink-low); }
.files__dl { flex: none; width: 32px; height: 32px; display: grid; place-items: center; border-radius: var(--r-sm);
  color: var(--ink-low); margin-right: 4px;
  transition: background var(--dur-fast) var(--ease-out), color var(--dur-fast) var(--ease-out); }
.files__dl:hover { background: var(--surface-2); color: var(--accent); }

/* ── Modal / destructive confirm (US-021) ───────────────────────────────── */
.scrim {
  position: fixed; inset: 0; z-index: var(--z-modal);
  background: var(--scrim); display: grid; place-items: center; padding: var(--s-5);   /* fade: Motion */
}
.modal {
  width: min(440px, 100%); background: var(--surface);
  border-radius: var(--r-xl); box-shadow: var(--sh-lg);
  padding: 26px 26px 22px;       /* entrance: Motion springIn */
}
@keyframes modal-in { from { opacity: 0; transform: scale(0.94) translateY(10px); } to { opacity: 1; transform: none; } }
.modal__ico { width: 46px; height: 46px; border-radius: 14px; display: grid; place-items: center;
  background: var(--danger-soft); margin-bottom: 16px; }
.modal__ico .icon { width: 24px; height: 24px; color: var(--danger); }
.modal__title { font: 600 19px/1.25 var(--font-display); margin-bottom: 8px; letter-spacing: -0.01em; }
.modal__text { font-size: 14px; line-height: 1.55; color: var(--ink-mid); }
.modal__text b { color: var(--ink-2); font-weight: 600; }
.modal__callout {
  display: flex; gap: 10px; align-items: flex-start; margin-top: 16px;
  background: var(--sunken); border-radius: var(--r-md); padding: 12px 14px;
  box-shadow: inset 0 0 0 1px var(--line-soft);
  font-size: 12.5px; line-height: 1.5; color: var(--ink-mid);
}
.modal__callout .icon { width: 17px; height: 17px; color: var(--ink-low); flex: none; margin-top: 1px; }
.modal__actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 22px; }

/* ── Toasts (US-009) ────────────────────────────────────────────────────── */
.toaster { position: fixed; right: 22px; bottom: 22px; z-index: var(--z-toast);
  display: flex; flex-direction: column; gap: 10px; align-items: flex-end; pointer-events: none; }
.toast {
  pointer-events: auto; width: 340px; max-width: calc(100vw - 44px);
  background: var(--glass-strong); backdrop-filter: blur(22px) saturate(170%);
  -webkit-backdrop-filter: blur(22px) saturate(170%);
  border-radius: var(--r-lg); box-shadow: var(--sh-lg), inset 0 0 0 1px var(--glass-edge);
  padding: 14px 14px 14px 16px; display: flex; gap: 12px; align-items: flex-start;   /* entrance/exit: Motion */
}
.toast__ico { width: 34px; height: 34px; border-radius: 10px; flex: none; display: grid; place-items: center;
  background: var(--ok-soft); color: var(--ok); }
/* error tone: the same toast, only the icon box changes; it stays while it offers a way out */
.toast--error .toast__ico { background: var(--danger-soft); color: var(--danger); }
.toast__body { flex: 1; min-width: 0; }
.toast__title { font: 600 13.5px/1.3 var(--font-ui); }
.toast__sub { font-size: 12px; color: var(--ink-mid); margin-top: 2px; line-height: 1.4; }
.toast__cta { margin-top: 9px; }
.toast__cta .btn { height: 30px; font-size: 12px; padding: 0 14px; }
.toast__x { color: var(--ink-low); }
.toast__x:hover { color: var(--ink); }

/* Artifacts now live in a full gallery (styles/gallery.css) + the in-main
   workspace (styles/workspace.css) — the old slide-out menu/preview is gone. */

/* ── Settings modal (theme switch) ──────────────────────────────────────── */
.settings {
  width: min(500px, 100%); background: var(--surface);
  border-radius: var(--r-xl); box-shadow: var(--sh-lg); overflow: hidden;   /* entrance: Motion springIn */
}
.settings__head { display: flex; align-items: center; gap: 12px;
  padding: 18px 16px 18px 24px; border-bottom: 1px solid var(--line); }
.settings__title { flex: 1; font: 600 19px/1 var(--font-display); letter-spacing: -0.01em; }
.settings__body { padding: 4px 24px 22px; max-height: 70vh; overflow-y: auto; }
.settings__section { padding: 18px 0; border-bottom: 1px solid var(--line-soft); }
.settings__section:last-child { border-bottom: 0; padding-bottom: 4px; }
.settings__legend { margin-bottom: 12px; }
.set-row { display: flex; align-items: center; justify-content: space-between; gap: 18px; padding: 7px 0; }
.set-row__text { min-width: 0; }
.set-row__text strong { display: block; font: 500 13.5px/1.3 var(--font-ui); color: var(--ink); }
.set-row__text em { font: 400 12px/1.4 var(--font-ui); font-style: normal; color: var(--ink-low); }
.set-acct { display: flex; align-items: center; gap: 12px; }
.set-acct__avatar { width: 40px; height: 40px; border-radius: 50%; flex: none; background: var(--muse-grad);
  color: #fff; display: grid; place-items: center; font: 600 15px/1 var(--font-ui); }

/* segmented control (Light / Dark / System) */
.seg { display: inline-flex; padding: 3px; gap: 2px; background: var(--sunken); border-radius: var(--r-pill); }
.seg__opt {
  display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 13px;
  border-radius: var(--r-pill); font: 500 12.5px/1 var(--font-ui); color: var(--ink-mid);
  transition: color var(--dur-fast) var(--ease-out), background var(--dur-fast) var(--ease-out);
}
.seg__opt .icon { width: 15px; height: 15px; }
.seg__opt:hover { color: var(--ink); }
.seg__opt[aria-pressed="true"] {
  color: var(--ink); background: var(--surface);
  box-shadow: var(--sh-xs), inset 0 0 0 1px var(--line-soft);
}

/* ── Error / connection banner (US-001 escalation, resilience) ──────────── */
.banner {
  display: flex; gap: 11px; align-items: center; margin: 0 auto 14px; max-width: var(--thread-max);
  background: var(--danger-soft); border-radius: var(--r-md); padding: 11px 14px;
}
.banner .icon { color: var(--danger); flex: none; }
.banner__text { flex: 1; font-size: 12.5px; line-height: 1.4; }
.banner__text b { color: var(--danger-ink); }
.banner__text em { font-style: normal; color: var(--ink-mid); display: block; }
