/* The operations assistant on the dashboard (CMS-L83): Theo's avatar floating
   at the bottom centre, and the chat box that opens in its place — where the
   builder keeps its own layer, by the user's decision (2026-11-07). Every
   rule is nested under .cms-operator* and drawn from the shell's tokens, so
   light and dark come for free and nothing here reaches the screen beneath.

   Physical left/translate for the centring on purpose: "the middle of the
   screen" is the same place in both reading directions. */

.cms-operator-launcher,
.cms-operator {
  position: fixed;
  left: 50%;
  bottom: calc(16rem / 14);
  translate: -50% 0;
  z-index: 10000;
  box-sizing: border-box;
  font-size: calc(13rem / 14);

  /* Elevation (light). A shadow is always black, never a mix of the text
     colour: in the dark scheme the text is near-white, and a shadow mixed
     from it lit the box with a pale glow instead of lifting it. Two layers —
     a tight one that seats the edge, a soft one that gives the height — and a
     hairline ring so the edge holds on a white page. */
  --cms-op-ring: rgb(0 0 0 / 0.06);
  --cms-op-rim: transparent;
  --cms-op-near: rgb(0 0 0 / 0.06);
  --cms-op-far: rgb(0 0 0 / 0.12);
}

/* Elevation (dark). On a dark page a black shadow barely reads, so the depth
   is carried by more of it, and the edge by a faint light rim along the top —
   light catching the lip of the card, as the shell's glass dialog does —
   rather than by anything that glows outward. */
:root[data-haya-scheme='dark'] :is(.cms-operator-launcher, .cms-operator) {
  --cms-op-ring: rgb(0 0 0 / 0.5);
  --cms-op-rim: rgb(255 255 255 / 0.06);
  --cms-op-near: rgb(0 0 0 / 0.35);
  --cms-op-far: rgb(0 0 0 / 0.55);
}

/* ---- the avatar ---- */

.cms-operator-launcher {
  display: grid;
  place-items: center;
  inline-size: calc(60rem / 14);
  block-size: calc(60rem / 14);
  padding: 0;
  border: 1px solid color-mix(in srgb, var(--haya-border) 70%, transparent);
  border-radius: 50%;
  background: color-mix(in srgb, var(--haya-surface) 82%, transparent);
  -webkit-backdrop-filter: blur(18px) saturate(160%);
  backdrop-filter: blur(18px) saturate(160%);
  box-shadow:
    0 0 0 1px var(--cms-op-ring),
    inset 0 1px 0 var(--cms-op-rim),
    0 2px 6px -1px var(--cms-op-near),
    0 10px 24px -6px var(--cms-op-far);
  cursor: grab;
  touch-action: none;
  user-select: none;
  transition: transform .25s ease, box-shadow .25s ease;
}

/* Dragged somewhere: the remembered place wins over the bottom-centre default. */
.cms-operator-launcher.is-placed {
  bottom: auto;
  translate: none;
}

.cms-operator-launcher.is-dragging {
  cursor: grabbing;
  transition: none;
}

.cms-operator-launcher:hover {
  transform: translateY(-2px);
  box-shadow:
    0 0 0 1px var(--cms-op-ring),
    inset 0 1px 0 var(--cms-op-rim),
    0 3px 8px -1px var(--cms-op-near),
    0 16px 32px -8px var(--cms-op-far);
}

.cms-operator-launcher:focus-visible {
  outline: 2px solid var(--haya-brand);
  outline-offset: 3px;
}

.cms-operator-launcher__bot {
  pointer-events: none;
}

/* The seller's own character picture (CMS-L4-28), round-cropped where Theo's
   avatar floats and in the box's badge. */
.cms-operator-avatar {
  display: block;
  pointer-events: none;
  border-radius: 50%;
  object-fit: cover;
  object-position: center;
}

/* ---- the chat box ---- */

.cms-operator {
  display: flex;
  flex-direction: column;
  inline-size: min(38rem, 100vw - 2rem);
  max-block-size: min(44rem, 100vh - 2rem);
  border: 1px solid var(--haya-border);
  border-radius: calc(22rem / 14);
  background: var(--haya-surface);
  color: var(--haya-text);
  box-shadow:
    0 0 0 1px var(--cms-op-ring),
    inset 0 1px 0 var(--cms-op-rim),
    0 4px 10px -2px var(--cms-op-near),
    0 24px 48px -16px var(--cms-op-far);
  overflow: hidden;
}

/* The arrival: a transition from a starting style, which always lands on the
   computed style even when the tab is in the background (the builder's
   lesson); never a keyframe. */
@starting-style {
  .cms-operator,
  .cms-operator-launcher {
    opacity: 0;
    transform: translateY(14px);
  }
}

.cms-operator {
  transition: opacity .3s ease, transform .3s ease;
}

.cms-operator__head {
  display: flex;
  align-items: center;
  gap: calc(8rem / 14);
  padding: calc(8rem / 14) calc(12rem / 14);
  border-block-end: 1px solid var(--haya-border);
}

.cms-operator__badge {
  display: inline-grid;
  place-items: center;
  inline-size: calc(32rem / 14);
  block-size: calc(32rem / 14);
  border-radius: 50%;
  background: color-mix(in srgb, var(--haya-brand) 10%, transparent);
}

.cms-operator__title {
  margin: 0;
  font-size: calc(14rem / 14);
  font-weight: 600;
}

.cms-operator__notice,
.cms-operator__intro {
  margin: calc(16rem / 14);
  padding: calc(12rem / 14);
  border-radius: var(--haya-radius);
  background: var(--haya-surface-muted);
  color: var(--haya-text-muted);
  text-align: center;
  line-height: 1.7;
}

.cms-operator__intro {
  margin-block: 0;
}

/* Newest at the bottom, pinned there while a reply streams, with no scroll
   script: a column-reverse container starts scrolled at its end. The list is
   rendered newest-first to match. */
.cms-operator__thread {
  display: flex;
  flex-direction: column-reverse;
  flex: 1 1 auto;
  min-block-size: calc(120rem / 14);
  max-block-size: min(30rem, 60vh);
  overflow-y: auto;
  padding: calc(12rem / 14);
  gap: calc(10rem / 14);
}

.cms-operator__line {
  display: flex;
  flex-direction: column;
  gap: calc(6rem / 14);
  max-inline-size: 88%;
}

.cms-operator__line.is-user {
  align-self: flex-start;
}

.cms-operator__line.is-assistant {
  align-self: stretch;
  max-inline-size: 100%;
}

.cms-operator__bubble {
  margin: 0;
  padding: calc(8rem / 14) calc(12rem / 14);
  border-radius: calc(14rem / 14);
  line-height: 1.75;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.cms-operator__line.is-user .cms-operator__bubble {
  background: var(--haya-brand);
  color: #fff;
  border-start-start-radius: calc(4rem / 14);
}

.cms-operator__answer {
  white-space: normal;
  background: var(--haya-surface-muted);
}

.cms-operator__answer :is(p, ul, ol) {
  margin-block: 0 calc(6rem / 14);
}

.cms-operator__answer :is(p, ul, ol):last-child {
  margin-block-end: 0;
}

.cms-operator__answer :is(ul, ol) {
  padding-inline-start: 1.25em;
}

.cms-operator__links {
  display: flex;
  flex-wrap: wrap;
  gap: calc(6rem / 14);
  margin: 0;
  padding: 0;
  list-style: none;
}

.cms-operator__link {
  display: inline-flex;
  align-items: center;
  gap: calc(6rem / 14);
  padding: calc(4rem / 14) calc(10rem / 14);
  border: 1px solid var(--haya-border);
  border-radius: 999px;
  color: var(--haya-brand);
  text-decoration: none;
  font-weight: 500;
}

.cms-operator__link:hover {
  border-color: var(--haya-brand);
  background: color-mix(in srgb, var(--haya-brand) 8%, transparent);
}

/* Cards: the things a step found or made, each a door to its page.
   One card is wide; several are a row the person scrolls, snapping card by
   card, with two buttons the script drives (a wheel or a swipe works too). */
.cms-operator__cards {
  position: relative;
  min-inline-size: 0;
}

.cms-operator__cards-track {
  display: flex;
  gap: calc(8rem / 14);
  margin: 0;
  padding: 0;
  list-style: none;
}

.cms-operator__cards.is-row .cms-operator__cards-track {
  overflow-x: auto;
  scroll-snap-type: inline mandatory;
  scroll-behavior: smooth;
  scrollbar-width: none;
  padding-block: 2px;
  padding-inline: calc(28rem / 14);
}

.cms-operator__cards.is-row .cms-operator__cards-track::-webkit-scrollbar {
  display: none;
}

.cms-operator__card-item {
  flex: 0 0 auto;
  scroll-snap-align: start;
  min-inline-size: 0;
}

.cms-operator__cards.is-single .cms-operator__card-item {
  flex: 1 1 auto;
}

.cms-operator__cards.is-row .cms-operator__card-item {
  inline-size: min(calc(220rem / 14), 70%);
}

.cms-operator__card {
  display: flex;
  align-items: center;
  gap: calc(10rem / 14);
  padding: calc(8rem / 14);
  border: 1px solid var(--haya-border);
  border-radius: var(--haya-radius);
  background: var(--haya-surface, transparent);
  color: inherit;
  text-decoration: none;
  min-inline-size: 0;
  transition: border-color 120ms ease, box-shadow 120ms ease, translate 120ms ease;
}

.cms-operator__card:hover,
.cms-operator__card:focus-visible {
  border-color: var(--haya-brand);
  box-shadow: 0 2px 10px color-mix(in srgb, var(--haya-brand) 14%, transparent);
  translate: 0 -1px;
  outline: none;
}

.cms-operator__card-image,
.cms-operator__card-icon {
  flex: 0 0 auto;
  inline-size: calc(44rem / 14);
  block-size: calc(44rem / 14);
  border-radius: calc(var(--haya-radius) - 2px);
  object-fit: cover;
  background: color-mix(in srgb, var(--haya-brand) 8%, transparent);
}

.cms-operator__card-icon {
  display: grid;
  place-items: center;
  color: var(--haya-brand);
}

.cms-operator__card-icon .cms-lucide {
  inline-size: calc(20rem / 14);
  block-size: calc(20rem / 14);
}

.cms-operator__card-body {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-inline-size: 0;
  flex: 1 1 auto;
}

.cms-operator__card-title {
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cms-operator__card-subtitle {
  font-size: calc(12rem / 14);
  color: var(--haya-text-muted, color-mix(in srgb, currentColor 65%, transparent));
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cms-operator__card-badge {
  flex: 0 0 auto;
  font-size: calc(11rem / 14);
  padding: 2px calc(6rem / 14);
  border-radius: 999px;
  background: color-mix(in srgb, var(--haya-brand) 10%, transparent);
  color: var(--haya-brand);
  white-space: nowrap;
}

.cms-operator__card-open {
  flex: 0 0 auto;
  color: var(--haya-text-muted, color-mix(in srgb, currentColor 55%, transparent));
}

.cms-operator__card-open .cms-lucide {
  inline-size: calc(14rem / 14);
  block-size: calc(14rem / 14);
}

.cms-operator__cards-nav {
  position: absolute;
  inset-block-start: 50%;
  translate: 0 -50%;
  inline-size: calc(24rem / 14);
  block-size: calc(24rem / 14);
  display: grid;
  place-items: center;
  padding: 0;
  border: 1px solid var(--haya-border);
  border-radius: 999px;
  background: var(--haya-surface, #fff);
  color: inherit;
  cursor: pointer;
  z-index: 1;
}

.cms-operator__cards-nav.is-back {
  inset-inline-start: 0;
}

.cms-operator__cards-nav.is-forward {
  inset-inline-end: 0;
}

/* The arrows point along the reading direction: back is towards the start. */
[dir="rtl"] .cms-operator__cards-nav .cms-lucide {
  scale: -1 1;
}

.cms-operator__cards-nav:hover {
  border-color: var(--haya-brand);
  color: var(--haya-brand);
}

.cms-operator__failure,
.cms-operator__error {
  margin: 0;
  padding: calc(8rem / 14) calc(12rem / 14);
  border-radius: var(--haya-radius);
  background: color-mix(in srgb, var(--haya-danger, #c0392b) 10%, transparent);
  color: var(--haya-danger, #c0392b);
}

.cms-operator__working {
  display: flex;
  align-items: center;
  gap: calc(8rem / 14);
  margin: 0;
  color: var(--haya-text-muted);
}

.cms-operator__dots {
  display: inline-flex;
  gap: 3px;
}

.cms-operator__dots i {
  inline-size: 6px;
  block-size: 6px;
  border-radius: 50%;
  background: currentColor;
  animation: cms-operator-dot 1.2s infinite ease-in-out;
}

.cms-operator__dots i:nth-child(2) { animation-delay: .15s; }
.cms-operator__dots i:nth-child(3) { animation-delay: .3s; }

@keyframes cms-operator-dot {
  0%, 80%, 100% { opacity: .25; transform: translateY(0); }
  40% { opacity: 1; transform: translateY(-3px); }
}

/* A question or a card: the run is waiting on the person. */
.cms-operator__ask,
.cms-operator__approval {
  display: flex;
  flex-direction: column;
  gap: calc(8rem / 14);
  padding: calc(12rem / 14);
  border: 1px solid var(--haya-border);
  border-radius: var(--haya-radius);
  background: var(--haya-surface);
}

.cms-operator__ask-text,
.cms-operator__approval-title {
  margin: 0;
  font-weight: 600;
}

.cms-operator__ask-sub {
  margin: calc(4rem / 14) 0 0;
  color: var(--haya-text-muted);
}

.cms-operator__chips {
  display: flex;
  flex-wrap: wrap;
  gap: calc(6rem / 14);
}

.cms-operator__chip {
  padding: calc(5rem / 14) calc(12rem / 14);
  border: 1px solid var(--haya-border);
  border-radius: 999px;
  background: var(--haya-surface);
  color: var(--haya-text);
  font: inherit;
  cursor: pointer;
}

.cms-operator__chip:hover,
.cms-operator__chip.is-picked {
  border-color: var(--haya-brand);
  color: var(--haya-brand);
  background: color-mix(in srgb, var(--haya-brand) 8%, transparent);
}

.cms-operator__ask-send {
  align-self: flex-start;
}

.cms-operator__approval--delete {
  border-color: color-mix(in srgb, var(--haya-danger, #c0392b) 50%, var(--haya-border));
}

.cms-operator .haya-btn--danger {
  background: var(--haya-danger, #c0392b);
  border-color: var(--haya-danger, #c0392b);
  color: #fff;
}

.cms-operator__approval-name {
  margin: 0;
  font-size: calc(15rem / 14);
  font-weight: 600;
}

.cms-operator__approval-summary,
.cms-operator__approval-path {
  margin: 0;
  color: var(--haya-text-muted);
}

.cms-operator__approval-actions {
  display: flex;
  gap: calc(8rem / 14);
}

/* ---- the composer ----
   One box, two rows, the builder's arrangement in the dashboard's own tokens:
   the message on top with the whole width to itself, and under it the tools —
   "+" and the credit at the start of the reading direction, send at the end,
   so the eye reaches send last. Files wait above the text; the record the
   message is about sits at the start of it. */

.cms-operator__composer {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: calc(8rem / 14);
  padding: calc(10rem / 14) calc(12rem / 14) calc(12rem / 14);
  border-block-start: 1px solid var(--haya-border);
}

.cms-operator__box {
  display: flex;
  flex-direction: column;
  gap: calc(6rem / 14);
  padding: calc(8rem / 14);
  border: 1px solid var(--haya-border);
  border-radius: calc(16rem / 14);
  background: var(--haya-surface);
  transition: border-color 120ms ease, box-shadow 120ms ease;
}

.cms-operator__box:focus-within {
  border-color: var(--haya-brand);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--haya-brand) 14%, transparent);
}

.cms-operator__box.is-busy {
  background: var(--haya-surface-muted);
}

.cms-operator__text {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: calc(6rem / 14);
  padding-inline: calc(4rem / 14);
}

.cms-operator__input {
  flex: 1 1 calc(160rem / 14);
  min-inline-size: 0;
  resize: none;
  padding: calc(4rem / 14) 0;
  border: 0;
  background: transparent;
  color: var(--haya-text);
  font: inherit;
  line-height: 1.7;
  /* Grows with the text up to eight lines, then scrolls. */
  field-sizing: content;
  min-block-size: 1.7em;
  max-block-size: calc(1.7em * 8);
}

@supports not (field-sizing: content) {
  .cms-operator__input {
    min-block-size: calc(1.7em * 2);
  }
}

.cms-operator__input:focus,
.cms-operator__input:focus-visible {
  outline: none;
  box-shadow: none;
}

.cms-operator__input::placeholder {
  color: var(--haya-text-muted);
}

/* What the message is about: the record open on the page. */
.cms-operator__scope {
  display: inline-flex;
  align-items: center;
  gap: calc(4rem / 14);
  margin-block-start: calc(2rem / 14);
  padding-block: calc(2rem / 14);
  padding-inline: calc(8rem / 14) calc(4rem / 14);
  border-radius: 999px;
  background: color-mix(in srgb, var(--haya-brand) 10%, transparent);
  color: var(--haya-brand);
  font-size: calc(12rem / 14);
  font-weight: 500;
  white-space: nowrap;
}

.cms-operator__scope .cms-lucide {
  inline-size: calc(13rem / 14);
  block-size: calc(13rem / 14);
}

.cms-operator__scope button {
  display: grid;
  place-items: center;
  inline-size: calc(18rem / 14);
  block-size: calc(18rem / 14);
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: inherit;
  cursor: pointer;
}

.cms-operator__scope button:hover {
  background: color-mix(in srgb, var(--haya-brand) 16%, transparent);
}

.cms-operator__tools {
  display: flex;
  align-items: center;
  gap: calc(4rem / 14);
}

.cms-operator__anchor {
  position: relative;
  display: inline-flex;
}

.cms-operator__tool,
.cms-operator__send {
  position: relative;
  display: grid;
  place-items: center;
  inline-size: calc(32rem / 14);
  block-size: calc(32rem / 14);
  padding: 0;
  border: 1px solid transparent;
  border-radius: 50%;
  background: transparent;
  color: var(--haya-text-muted);
  cursor: pointer;
  transition: background-color 120ms ease, color 120ms ease, border-color 120ms ease;
}

.cms-operator__tool:hover:not(:disabled),
.cms-operator__tool[aria-expanded="true"] {
  background: var(--haya-surface-muted);
  color: var(--haya-text);
}

.cms-operator__tool:disabled,
.cms-operator__send:disabled {
  opacity: .45;
  cursor: default;
}

.cms-operator__tool:focus-visible,
.cms-operator__send:focus-visible {
  outline: 2px solid var(--haya-brand);
  outline-offset: 2px;
}

.cms-operator__send {
  background: var(--haya-brand);
  color: #fff;
}

.cms-operator__send:hover:not(:disabled) {
  background: color-mix(in srgb, var(--haya-brand) 88%, #000);
}

.cms-operator__send.is-stop {
  background: var(--haya-text);
  color: var(--haya-surface);
}

.cms-operator__send .cms-lucide {
  inline-size: calc(16rem / 14);
  block-size: calc(16rem / 14);
}

.cms-operator__send.is-stop .cms-lucide {
  inline-size: calc(11rem / 14);
  block-size: calc(11rem / 14);
}

/* The credit: a colour that means something, the number one press away. */
.cms-operator__credit.is-ok {
  color: var(--haya-text-muted);
}

.cms-operator__credit.is-low,
.cms-operator__credit-pop.is-low .cms-operator__credit-state {
  color: var(--haya-warning, #b7791f);
}

.cms-operator__credit.is-empty,
.cms-operator__credit-pop.is-empty .cms-operator__credit-state {
  color: var(--haya-danger, #c0392b);
}

.cms-operator__credit-dot {
  position: absolute;
  inset-block-start: calc(5rem / 14);
  inset-inline-end: calc(5rem / 14);
  inline-size: 7px;
  block-size: 7px;
  border: 1.5px solid var(--haya-surface);
  border-radius: 50%;
  background: currentColor;
}

/* The two menus open upward from their button, over the thread. */
.cms-operator__menu {
  position: absolute;
  inset-block-end: calc(100% + (8rem / 14));
  inset-inline-start: 0;
  z-index: 2;
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-inline-size: calc(220rem / 14);
  padding: calc(6rem / 14);
  border: 1px solid var(--haya-border);
  border-radius: var(--haya-radius);
  background: var(--haya-surface);
  box-shadow:
    0 0 0 1px var(--cms-op-ring),
    0 4px 10px -2px var(--cms-op-near),
    0 16px 32px -12px var(--cms-op-far);
}

.cms-operator__menu-item {
  display: flex;
  align-items: center;
  gap: calc(8rem / 14);
  padding: calc(8rem / 14) calc(10rem / 14);
  border: 0;
  border-radius: calc(var(--haya-radius) - 2px);
  background: transparent;
  color: var(--haya-text);
  font: inherit;
  text-align: start;
  white-space: nowrap;
  cursor: pointer;
}

.cms-operator__menu-item:hover,
.cms-operator__menu-item:focus-visible {
  background: var(--haya-surface-muted);
  outline: none;
}

.cms-operator__menu-item .cms-lucide {
  color: var(--haya-text-muted);
}

.cms-operator__menu-hint {
  margin: calc(2rem / 14) 0 0;
  padding: calc(6rem / 14) calc(10rem / 14) calc(2rem / 14);
  border-block-start: 1px solid var(--haya-border);
  color: var(--haya-text-muted);
  font-size: calc(12rem / 14);
}

.cms-operator__credit-pop {
  gap: calc(2rem / 14);
  padding: calc(12rem / 14);
}

.cms-operator__credit-label {
  color: var(--haya-text-muted);
  font-size: calc(12rem / 14);
}

.cms-operator__credit-value {
  font-size: calc(22rem / 14);
  font-weight: 700;
  line-height: 1.3;
}

.cms-operator__credit-state {
  color: var(--haya-text-muted);
}

.cms-operator__credit-link {
  display: inline-flex;
  align-items: center;
  gap: calc(6rem / 14);
  margin-block-start: calc(8rem / 14);
  color: var(--haya-brand);
  font-weight: 500;
  text-decoration: none;
}

.cms-operator__credit-link:hover {
  text-decoration: underline;
}

.cms-operator__credit-link .cms-lucide {
  inline-size: calc(14rem / 14);
  block-size: calc(14rem / 14);
}

/* Files on their way into the message. */
.cms-operator__files,
.cms-operator__sent {
  display: flex;
  flex-wrap: wrap;
  gap: calc(6rem / 14);
  margin: 0;
  padding: 0;
  list-style: none;
}

.cms-operator__file {
  position: relative;
  display: flex;
  align-items: center;
  gap: calc(6rem / 14);
  max-inline-size: calc(220rem / 14);
  padding: calc(4rem / 14);
  border: 1px solid var(--haya-border);
  border-radius: calc(10rem / 14);
  background: var(--haya-surface-muted);
  overflow: hidden;
}

.cms-operator__file.is-failed {
  border-color: color-mix(in srgb, var(--haya-danger, #c0392b) 55%, var(--haya-border));
  background: color-mix(in srgb, var(--haya-danger, #c0392b) 8%, transparent);
}

.cms-operator__file-thumb {
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  inline-size: calc(32rem / 14);
  block-size: calc(32rem / 14);
  border-radius: calc(7rem / 14);
  background: var(--haya-surface);
  color: var(--haya-text-muted);
  object-fit: cover;
}

.cms-operator__file-name {
  min-inline-size: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: calc(12rem / 14);
}

.cms-operator__file-act {
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  inline-size: calc(22rem / 14);
  block-size: calc(22rem / 14);
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--haya-text-muted);
  cursor: pointer;
}

.cms-operator__file-act:hover:not(:disabled) {
  background: color-mix(in srgb, currentColor 14%, transparent);
  color: var(--haya-text);
}

.cms-operator__file-act .cms-lucide {
  inline-size: calc(13rem / 14);
  block-size: calc(13rem / 14);
}

/* How far the file has come, along the chip's bottom edge. */
.cms-operator__file-bar {
  position: absolute;
  inset-inline: 0;
  inset-block-end: 0;
  block-size: 2px;
  background: color-mix(in srgb, var(--haya-brand) 18%, transparent);
}

.cms-operator__file-bar::after {
  content: "";
  position: absolute;
  inset-block: 0;
  inset-inline-start: 0;
  inline-size: var(--upload, 0%);
  background: var(--haya-brand);
  transition: inline-size 150ms linear;
}

.cms-operator__file-notice {
  display: flex;
  align-items: center;
  gap: calc(8rem / 14);
  margin: 0;
  padding: calc(6rem / 14) calc(10rem / 14);
  border-radius: var(--haya-radius);
  background: color-mix(in srgb, var(--haya-danger, #c0392b) 10%, transparent);
  color: var(--haya-danger, #c0392b);
}

.cms-operator__file-notice span:not(.cms-lucide) {
  flex: 1 1 auto;
}

.cms-operator__file-notice button {
  display: grid;
  place-items: center;
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  cursor: pointer;
}

/* The files that went with a sent line, above its bubble. */
.cms-operator__sent-file {
  display: inline-flex;
  align-items: center;
  gap: calc(6rem / 14);
  max-inline-size: calc(200rem / 14);
  padding: calc(4rem / 14) calc(8rem / 14);
  border: 1px solid var(--haya-border);
  border-radius: calc(10rem / 14);
  background: var(--haya-surface);
  font-size: calc(12rem / 14);
  overflow: hidden;
}

.cms-operator__sent-file:has(img) {
  padding: 0;
}

.cms-operator__sent-file img {
  display: block;
  inline-size: calc(64rem / 14);
  block-size: calc(64rem / 14);
  object-fit: cover;
}

.cms-operator__sent-file bdi {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* A file held over the box: the whole box says where it will land. */
.cms-operator__drop {
  position: absolute;
  inset: 0;
  z-index: 3;
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: calc(8rem / 14);
  border: 2px dashed var(--haya-brand);
  border-radius: inherit;
  background: color-mix(in srgb, var(--haya-surface) 88%, var(--haya-brand));
  color: var(--haya-brand);
  font-weight: 600;
  pointer-events: none;
}

.cms-operator.is-dropping .cms-operator__drop {
  display: flex;
}

.cms-operator__drop .cms-lucide {
  inline-size: calc(28rem / 14);
  block-size: calc(28rem / 14);
}

/* ---- the empty conversation ---- */

.cms-operator__start {
  display: flex;
  flex-direction: column;
  gap: calc(10rem / 14);
}

.cms-operator__start .cms-operator__intro {
  margin: 0;
}

.cms-operator__start-title,
.cms-operator__history-title {
  margin: 0;
  color: var(--haya-text-muted);
  font-size: calc(12rem / 14);
  font-weight: 600;
}

.cms-operator__suggestions {
  display: flex;
  flex-direction: column;
  gap: calc(6rem / 14);
}

.cms-operator__suggestion {
  padding: calc(8rem / 14) calc(12rem / 14);
  border: 1px solid var(--haya-border);
  border-radius: var(--haya-radius);
  background: var(--haya-surface);
  color: var(--haya-text);
  font: inherit;
  text-align: start;
  cursor: pointer;
  transition: border-color 120ms ease, background-color 120ms ease;
}

.cms-operator__suggestion:hover,
.cms-operator__suggestion:focus-visible {
  border-color: var(--haya-brand);
  background: color-mix(in srgb, var(--haya-brand) 6%, transparent);
  outline: none;
}

/* ---- past conversations ---- */

.cms-operator__history {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  gap: calc(8rem / 14);
  min-block-size: calc(180rem / 14);
  max-block-size: min(30rem, 60vh);
  overflow-y: auto;
  padding: calc(12rem / 14);
}

.cms-operator__history-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.cms-operator__history-row {
  display: flex;
  align-items: baseline;
  gap: calc(12rem / 14);
  inline-size: 100%;
  padding: calc(8rem / 14) calc(10rem / 14);
  border: 0;
  border-radius: var(--haya-radius);
  background: transparent;
  color: var(--haya-text);
  font: inherit;
  text-align: start;
  cursor: pointer;
}

.cms-operator__history-row:hover,
.cms-operator__history-row:focus-visible {
  background: var(--haya-surface-muted);
  outline: none;
}

.cms-operator__history-row.is-current {
  background: color-mix(in srgb, var(--haya-brand) 8%, transparent);
}

.cms-operator__history-name {
  flex: 1 1 auto;
  min-inline-size: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  text-align: start;
}

.cms-operator__history-when {
  flex: 0 0 auto;
  color: var(--haya-text-muted);
  font-size: calc(12rem / 14);
}

.cms-operator__history-empty {
  margin: 0;
  padding: calc(16rem / 14);
  color: var(--haya-text-muted);
  text-align: center;
}

.cms-operator__head .haya-btn.is-on {
  background: var(--haya-surface-muted);
  color: var(--haya-brand);
}

@media (max-width: 640px) {
  .cms-operator {
    inline-size: calc(100vw - 1rem);
    bottom: calc(8rem / 14);
  }
}
