/* Connections > Always-on assistant.

   Operator, 30 Sep: "this entire assistant page is too ugly, it needs to be
   simpler, more elegant." What it was: an accent-tinted system card, a row of
   engine cards, a surfaces grid and a second explainer bar at the bottom that
   repeated the first one.

   What it is: one calm hero that says what the assistant is, with its state
   and its model on the same line, and then Channels — cards in the connector
   cards' own grammar, because a channel is a connection and the board already
   has a card for that (they share .assistant-channel / .connection-card in
   foundation.css, so the shell, the grid and the logo are literally the same
   rules). */

.assistant-hero {
  display: grid;
  gap: 14px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--card);
  box-shadow: 0 8px 20px var(--shadow-color);
}
.assistant-hero-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
}
.assistant-hero-title { display: grid; gap: 6px; flex: 1 1 260px; min-width: 0; }
.assistant-hero-title h3 { margin: 0; color: var(--txt); font-size: 15px; }
.assistant-hero-copy {
  margin: 0;
  max-width: 64ch;
  color: var(--txt-soft);
  font-size: 12px;
  line-height: 1.55;
}
/* The state reads as a status, not as a button: no action lives in it. */
.assistant-hero-state {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  flex: 0 0 auto;
  padding: 5px 11px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--card-child);
  color: var(--txt);
  font-size: 11.5px;
  font-weight: 650;
  white-space: nowrap;
}
.assistant-hero-state .connection-health { width: 8px; height: 8px; }
.assistant-hero-model {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px 10px;
  padding-top: 13px;
  border-top: 1px solid var(--line);
}
.assistant-hero-model-label {
  color: var(--dim);
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.assistant-hero .model-picker-button { max-width: 100%; }
.assistant-credits-note {
  flex: 1 0 100%;
  margin: 0;
  color: var(--warn, #b45309);
  font-size: 11.5px;
  line-height: 1.45;
}
.assistant-credits-note[hidden] { display: none; }

.assistant-channels-title { margin: 0; color: var(--txt); font-size: 13px; font-weight: 700; }
/* .assistant-channels / .assistant-channel take the connector grid and card
   shell from foundation.css; what follows is only what a channel adds. */
.assistant-channel { display: flex; flex-direction: column; gap: 12px; }
.assistant-channel-head { display: flex; align-items: center; gap: 10px; }
.assistant-channel-title { min-width: 0; }
.assistant-channel-title strong {
  display: block;
  color: var(--txt);
  font-size: 13px;
  line-height: 1.3;
}
.assistant-channel-title small { display: block; margin-top: 3px; color: var(--dim); font-size: 10.5px; }
/* A channel that is not here yet is shown, dimmed, saying so. */
.assistant-channel.is-soon { opacity: 0.62; box-shadow: none; }
.assistant-sms-mark {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  flex: 0 0 auto;
  border-radius: 8px;
  background: var(--accent-faint);
  color: var(--blue);
  font: 700 10px/1 ui-monospace, Menlo, monospace;
}
.assistant-surface-logo-slot { display: inline-flex; flex: 0 0 auto; }

.assistant-surface-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.assistant-surface-actions[hidden] { display: none; }
.assistant-channel > .assistant-surface-actions { margin-top: auto; }
.assistant-pair-error {
  margin: 0;
  padding: 8px 10px;
  border: 1px solid var(--danger-border);
  border-radius: 8px;
  color: var(--red);
  font-size: 12px;
  line-height: 1.45;
}
.assistant-pair-error[hidden] { display: none; }

/* Connect > QR + link > waiting. The QR sits above the link on a card this
   narrow, which is also how it reads on a phone. */
.assistant-pairing {
  display: grid;
  justify-items: start;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--card-child);
}
.assistant-pairing[hidden] { display: none; }
.assistant-pairing-qr {
  /* T288's sizing guard travels with the image: a QR whose payload is wrong
     (or whose data URL is something else entirely) must not be able to size
     the card. Both axes are capped, not just set. */
  width: 132px;
  height: 132px;
  max-width: 132px;
  max-height: 132px;
  padding: 6px;
  border-radius: 8px;
  background: var(--paper);
  object-fit: contain;
  image-rendering: pixelated;
}
.assistant-pairing-placeholder {
  display: grid;
  place-items: center;
  width: 132px;
  height: 132px;
  max-width: 132px;
  max-height: 132px;
  padding: 12px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  color: var(--dim);
  text-align: center;
  font-size: 10.5px;
}
.assistant-pairing-detail { display: grid; gap: 6px; min-width: 0; max-width: 100%; }
.assistant-pairing-detail a { color: var(--blue); overflow-wrap: anywhere; }

/* Connected is a state, not a second card: the channel card already names
   Telegram and shows its logo, so this is a line of text under it. Nesting a
   bordered panel here cost the card 24px of width and stacked its two
   buttons (screenshot, 30 Sep). */
.assistant-telegram-paired { display: grid; gap: 7px; }
.assistant-telegram-paired[hidden] { display: none; }
.assistant-telegram-paired-line { display: flex; align-items: center; gap: 8px; margin: 0; }
.assistant-paired-status {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: var(--green);
  font-size: 12px;
  font-weight: 650;
}
.assistant-paired-check { font-weight: 800; line-height: 1; }
.assistant-telegram-paired .assistant-surface-actions .button {
  min-height: 0;
  padding: 5px 10px;
  font-size: 11.5px;
}

/* The one status line the assistant writes to (model switches, pairing). */
.assistant-brain-status {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  max-width: 620px;
  padding: 8px 11px;
  border-radius: 10px;
  font-size: 12px;
  line-height: 1.4;
  font-weight: 600;
}
.assistant-brain-status[hidden] { display: none; }
.assistant-brain-status.is-progress {
  border: 1px solid var(--accent-border);
  background: var(--accent-soft);
  color: var(--txt);
}
.assistant-brain-status.is-success {
  border: 1px solid var(--positive-border);
  background: var(--positive-soft);
  color: var(--green);
}
.assistant-brain-status.is-error {
  border: 1px solid var(--danger-border);
  background: var(--danger-soft);
  color: var(--red);
}
.assistant-brain-status .brain-spinner {
  width: 13px;
  height: 13px;
  flex: 0 0 auto;
  border: 2px solid var(--line);
  border-top-color: var(--cyan);
  border-radius: 50%;
  animation: sdk-activity-spin 0.8s linear infinite;
}
.assistant-brain-status-mark { flex: 0 0 auto; font-weight: 800; }

@media (max-width: 640px) {
  .assistant-hero { padding: 15px; }
  .assistant-hero-head { gap: 10px; }
}
