/*
 * core/composer.css — styles for the reusable Core Composer (core/composer.js).
 *
 * Visual twin of the chat two-row composer (.composer.composer-two-row in
 * app.css) but under an isolated `.ucx-composer` namespace + class-based
 * selectors (no shared IDs), so any number of instances can live on a page
 * without colliding with the chat composer or each other. Theme-aware via the
 * app-wide CSS custom properties (--text, --muted, --line, --primary, …).
 */

.ucx-composer {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 5px;
  padding: 2px 8px 6px;
  border: var(--line);
  border-radius: var(--cradi) !important;
  -webkit-backdrop-filter: var(--backdrop-2);
  backdrop-filter: var(--backdrop-2);
  isolation: isolate;
  pointer-events: auto;
  box-sizing: border-box;
  overflow: visible;
}

.ucx-composer * { box-sizing: border-box; }

.ucx-top {
  position: relative;
  display: flex;
  align-items: stretch;
}

.ucx-input {
  width: 100%;
  min-height: 30px;
  max-height: 200px;
  padding: 8px 10px;
  border-radius: 20px;
  border: var(--line);
  background: var(--muted);
  color: var(--text);
  font: inherit;
  line-height: 1.45;
  resize: none;
  outline: none;
  overflow-y: auto;
}

.ucx-input::placeholder { color: var(--text-muted); }
.ucx-input:focus { box-shadow: var(--ring); }

.ucx-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.ucx-left,
.ucx-right {
  display: flex;
  align-items: center;
  gap: 4px;
}

.ucx-right { justify-content: flex-end; }

.ucx-btn {
  width: 28px;
  height: 28px;
  border-radius: var(--bradi);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: var(--line);
  color: var(--text);
  cursor: pointer;
  padding: 0;
}
.ucx-btn:hover { background: var(--strans); }
.ucx-btn:disabled { opacity: .5; cursor: default; }
.ucx-btn svg {width: 18px;height: 18px;fill: none;stroke: transparent;}

.ucx-send {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 28px;
  padding: 0 8px;
  border-radius: 999px;
  border: 0;
  /* --primary-faded is referenced across app.css but declared nowhere in the web app
     (only entire-admin/admin.css has it), so the bare var() left the Send button with no
     fill at all. The fallback is the admin theme's value; declaring the token app-wide
     belongs in app.css and would restyle every other rule that reads it. */
  background: var(--primary-faded, color-mix(in srgb, var(--primary) 14%, transparent));
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  flex-direction: row-reverse;
}
.ucx-send:hover { filter: brightness(1.05); }
.ucx-send:disabled { opacity: .55; cursor: default; }
.ucx-send svg {width: 16px;height: 14px;fill: none;stroke: currentColor;}

.ucx-composer.is-busy .ucx-input { opacity: .6; pointer-events: none; }

/* Attachment tray — horizontal chips, mirrors the chat attachment cards. */
.ucx-attach-tray {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 2px;
}
.ucx-attach-tray[hidden] { display: none; }

.ucx-attach-card {
  display: flex;
  align-items: center;
  gap: 8px;
  max-width: 220px;
  padding: 5px 8px;
  border: var(--line);
  border-radius: 12px;
  background: var(--muted);
}
.ucx-attach-thumb {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  overflow: hidden;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  background: var(--strans);
}
.ucx-attach-thumb img { width: 100%; height: 100%; object-fit: cover; }
.ucx-attach-thumb svg { width: 16px; height: 16px; fill: none; stroke: currentColor; }
.ucx-attach-meta { display: flex; flex-direction: column; min-width: 0; }
.ucx-attach-name { font-size: 12px; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ucx-attach-size { font-size: 11px; color: var(--text-muted); }
.ucx-attach-remove {
  flex: 0 0 auto;
  width: 20px;
  height: 20px;
  border-radius: 999px;
  border: 0;
  background: var(--strans);
  color: var(--text);
  cursor: pointer;
  line-height: 1;
}
.ucx-attach-remove:hover { background: var(--line); }

/* Per-card actions cluster (inline toggle + remove). */
.ucx-attach-acts { flex: 0 0 auto; display: flex; align-items: center; gap: 4px; }
.ucx-attach-inline {
  flex: 0 0 auto;
  width: 22px;
  height: 20px;
  display: inline-grid;
  place-items: center;
  border-radius: 999px;
  border: 0;
  background: var(--strans);
  color: var(--text);
  cursor: pointer;
  line-height: 1;
}
.ucx-attach-inline:hover { background: var(--line); }
.ucx-attach-inline svg { width: 14px; height: 14px; fill: none; stroke: currentColor; }
.ucx-attach-inline.is-on { background: var(--primary); color: #fff; }
.ucx-attach-card.is-inline { outline: 1px solid var(--primary); }
.ucx-attach-badge {
  display: inline-block;
  margin-left: 6px;
  padding: 0 6px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .02em;
  background: var(--primary);
  color: #fff;
  vertical-align: middle;
}

/* Drag-&-drop affordance. */
.ucx-composer.is-dragover {
  outline: 2px dashed var(--primary);
  outline-offset: -3px;
  background: var(--muted);
}

/* Code-mode: subtle monospace hint while the caret sits in a ``` fence. */
.ucx-composer.code-mode .ucx-input {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 13px;
}

/* Active toolbar button (e.g. recording). */
.ucx-btn.is-active { background: var(--primary); color: #fff; }
.ucx-btn.is-active svg { stroke: #fff; }

/* ── Voice-note recording bar ─────────────────────────────────────────── */
.ucx-record {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border-radius: 14px;
  background: var(--muted);
  border: var(--line);
}
.ucx-record[hidden] { display: none; }
.ucx-record-dot {
  width: 9px; height: 9px; border-radius: 999px;
  background: #e5484d; flex: 0 0 auto;
  animation: ucx-rec-pulse 1s ease-in-out infinite;
}
@keyframes ucx-rec-pulse { 0%,100% { opacity: 1; } 50% { opacity: .3; } }
.ucx-record-time { font-variant-numeric: tabular-nums; font-weight: 600; color: var(--text); font-size: 13px; }
.ucx-record-label { color: var(--text-muted); font-size: 12px; }
.ucx-voice-wave { display: block; height: 26px; flex: 1; max-width: 160px; }
.ucx-voice-player {
  display: flex; align-items: center; gap: 8px; flex: 1; min-width: 0;
}
.ucx-vp-play, .ucx-record-resume {
  width: 28px; height: 28px; border-radius: 999px; border: 0; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--primary); color: #fff; flex: 0 0 auto;
}
.ucx-vp-bar {
  flex: 1; height: 6px; border-radius: 999px; background: var(--strans);
  position: relative; cursor: pointer; overflow: hidden;
}
.ucx-vp-fill {
  height: 100%; width: 0%; background: var(--primary); border-radius: 999px;
  transition: width .1s linear;
}
.ucx-vp-time { font-size: 11.5px; font-weight: 600; color: var(--text-muted); font-variant-numeric: tabular-nums; }
.ucx-record-transcribe {
  padding: 4px 10px; border-radius: 999px; border: var(--line);
  background: var(--strans); color: var(--primary); font-size: 11.5px; font-weight: 600;
  cursor: pointer; display: inline-flex; align-items: center; gap: 4px; transition: all .15s ease;
  /* This pill only started rendering once /api/ai/transcribe existed, and the narrowest
     bar it lands in is Donna's 370px flyout. Hold its width: without these the label
     wraps to a second line when it grows to "Transcribing…", and the bar jumps taller
     mid-request. The seek bar is the flexible element here, not this. */
  flex: 0 0 auto; white-space: nowrap;
}
.ucx-record-transcribe:hover { background: var(--primary); color: #fff; }
.ucx-record-transcribe:disabled { opacity: .6; cursor: wait; }
.ucx-record-actions { margin-left: auto; display: flex; gap: 4px; }
.ucx-record-actions button {
  width: 28px; height: 28px; border-radius: 999px; border: 0; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--strans); color: var(--text);
}
/* Keep (primary) vs discard (destructive) — the two ends of the record bar. */
.ucx-record-actions .ucx-record-stop { background: var(--primary); color: #fff; }
.ucx-record-actions .ucx-record-cancel { color: #e5484d; }
.ucx-record-actions .ucx-record-cancel:hover { background: color-mix(in oklab, #e5484d 18%, transparent); }
.ucx-record-actions button svg { width: 15px; height: 15px; fill: none; stroke: currentColor; }
.ucx-record-actions button i { font-size: 14px; }

/* ── Popover (format toolbar / more menu / link form) ─────────────────── */
.ucx-pop {
  position: fixed;
  z-index: 10000;
  border: var(--line);
  border-radius: var(--cradi);
  box-shadow: 0 12px 34px rgba(0, 0, 0, .28);
  padding: 6px;
  -webkit-backdrop-filter: var(--backdrop-2);
  backdrop-filter: var(--backdrop-2);
  animation: ucx-pop-in .12s ease;
}
@keyframes ucx-pop-in { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

.ucx-format-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(120px, 1fr));
  gap: 2px;
}
.ucx-format-btn {
  display: flex; align-items: center; gap: 8px;
  padding: 7px 10px; border: 0; border-radius: 8px;
  background: transparent; color: var(--text); cursor: pointer;
  font: inherit; font-size: 13px; text-align: left;
}
.ucx-format-btn:hover { background: var(--muted); }
.ucx-format-btn i { width: 16px; text-align: center; color: var(--text-muted); }
.ucx-format-ic { display: inline-flex; width: 18px; justify-content: center; color: var(--text-muted); }
.ucx-format-ic svg { width: 18px; height: 18px; fill: none; stroke: currentColor; }

/* More menu. */
.ucx-menu { display: flex; flex-direction: column; min-width: 180px; }
.ucx-menu-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border: 0;
  border-radius: var(--bradi);
  background: transparent;
  color: var(--text);
  cursor: pointer;
  font: inherit;
  font-size: 13px;
  text-align: left;
}
.ucx-menu-item:hover {background: var(--strans);}
.ucx-menu-item.is-danger { color: #e5484d; }
.ucx-menu-ic { display: inline-flex; width: 18px; justify-content: center; color: var(--text-muted); }
.ucx-menu-item.is-danger .ucx-menu-ic { color: inherit; }
.ucx-menu-ic svg { width: 16px; height: 16px; fill: none; stroke: currentColor; }
.ucx-menu-sep { height: 1px; margin: 4px 6px; background: var(--line-color, rgba(128,128,128,.2)); }

/* Slash-snippet menu. */
.ucx-snip-menu { min-width: 220px; }
.ucx-snip-trigger { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 12px; color: var(--primary); font-weight: 600; }
.ucx-snip-label { color: var(--text-muted); font-size: 12px; }

/* Selection toolbar (inline AI chips) — floats just above the textarea. */
.ucx-sel-bar {
  position: absolute;
  top: 0;
  right: 8px;
  transform: translateY(-100%) translateY(-6px);
  z-index: 20;
  display: flex;
  gap: 4px;
  padding: 4px;
  border-radius: 12px;
  background: var(--panel, var(--bg, #fff));
  border: var(--line);
  box-shadow: 0 8px 22px rgba(0, 0, 0, .22);
  animation: ucx-pop-in .12s ease;
}
.ucx-sel-bar[hidden] { display: none; }
.ucx-sel-chip {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 5px 9px; border: 0; border-radius: 8px; cursor: pointer;
  background: transparent; color: var(--text); font: inherit; font-size: 12px; white-space: nowrap;
}
.ucx-sel-chip:hover { background: var(--muted); }
.ucx-sel-ic { display: inline-flex; color: var(--text-muted); }
.ucx-sel-ic svg { width: 15px; height: 15px; fill: none; stroke: currentColor; }

/* Link insert form. */
.ucx-link-form { display: flex; flex-direction: column; gap: 8px; width: 260px; padding: 4px; }
.ucx-link-form label { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--text-muted); }
.ucx-link-form input {
  padding: 7px 9px; border-radius: 9px; border: var(--line);
  background: var(--muted); color: var(--text); font: inherit; outline: none;
}
.ucx-link-form input:focus { box-shadow: var(--ring); }
.ucx-link-actions { display: flex; justify-content: flex-end; gap: 6px; margin-top: 2px; }
.ucx-link-actions button { padding: 6px 12px; border-radius: 999px; border: 0; cursor: pointer; font: inherit; font-weight: 600; }
.ucx-link-cancel { background: var(--strans); color: var(--text); }
.ucx-link-insert { background: var(--primary); color: #fff; }

/* ── Send-options (schedule / disappearing / view-once / silent / draft) ─── */
/* Split Send button: main action + caret that opens the options sheet. */
.ucx-send-wrap { display: inline-flex; align-items: stretch; }
.ucx-send-wrap .ucx-send { border-top-right-radius: 0; border-bottom-right-radius: 0; }
.ucx-send-caret {
  display: inline-flex; align-items: center; justify-content: center;
  width: 26px; padding: 0; cursor: pointer;
  border: 0; border-left: 1px solid rgba(255,255,255,.25);
  border-radius: 0 999px 999px 0;
  background: var(--primary-faded, color-mix(in srgb, var(--primary) 14%, transparent)); color: #fff;
}
.ucx-send-caret:hover { filter: brightness(1.05); }
.ucx-send-caret svg { width: 13px; height: 13px; fill: none; stroke: currentColor; }
.ucx-composer.has-send-mode .ucx-send,
.ucx-composer.has-send-mode .ucx-send-caret { background: var(--primary); }
.ucx-send-caret.is-active { background: var(--primary); }

/* Active-mode banner above the action row. */
.ucx-sendmode-banner {
  display: flex; align-items: center; gap: 10px;
  padding: 7px 10px; margin-bottom: 6px;
  border-radius: 12px; border: var(--line); background: var(--muted);
}
.ucx-sendmode-banner[hidden] { display: none; }
.ucx-sendmode-ic { display: inline-flex; color: var(--primary); }
.ucx-sendmode-ic svg { width: 15px; height: 15px; fill: none; stroke: currentColor; }
.ucx-sendmode-ic i { color: var(--primary); }
.ucx-sendmode-copy { display: flex; flex-direction: column; min-width: 0; line-height: 1.25; }
.ucx-sendmode-copy strong { font-size: 12.5px; color: var(--text); }
.ucx-sendmode-copy span { font-size: 11px; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ucx-sendmode-acts { margin-left: auto; display: flex; gap: 4px; }
.ucx-sendmode-acts button {
  padding: 4px 10px; border: 0; border-radius: 999px; cursor: pointer;
  font: inherit; font-size: 12px; font-weight: 600;
  background: var(--strans); color: var(--text);
}
.ucx-sendmode-acts button:hover { background: var(--line); }

/* Options sheet (inside .ucx-pop). */
.ucx-sendmode-sheet { min-width: 268px; display: flex; flex-direction: column; gap: 8px; padding: 4px; }
.ucx-sendmode-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; padding: 4px 6px 2px; }
.ucx-sendmode-title { font-size: 13px; font-weight: 700; color: var(--text); }
.ucx-sendmode-sub { font-size: 11.5px; color: var(--text-muted); margin-top: 2px; }
.ucx-sendmode-clearlink {
  border: 0; background: transparent; cursor: pointer; padding: 2px 4px;
  font: inherit; font-size: 12px; font-weight: 600; color: var(--primary);
}
.ucx-mode-list, .ucx-flag-list { display: flex; flex-direction: column; gap: 4px; }
.ucx-flag-list { border-top: 1px solid var(--line-color, rgba(128,128,128,.2)); padding-top: 6px; }
.ucx-mode-card, .ucx-mode-flag {
  display: flex; align-items: center; gap: 10px; width: 100%;
  padding: 9px 10px; border: 1px solid transparent; border-radius: 10px;
  background: transparent; color: var(--text); cursor: pointer; text-align: left; font: inherit;
}
.ucx-mode-card:hover, .ucx-mode-flag:hover { background: var(--muted); }
.ucx-mode-card.is-active { border-color: var(--primary); background: color-mix(in srgb, var(--primary) 10%, transparent); }
.ucx-mode-ic { flex: 0 0 auto; display: inline-flex; width: 20px; justify-content: center; color: var(--text-muted); }
.ucx-mode-card.is-active .ucx-mode-ic, .ucx-mode-flag.is-on .ucx-mode-ic { color: var(--primary); }
.ucx-mode-ic svg { width: 17px; height: 17px; fill: none; stroke: currentColor; }
.ucx-mode-body { display: flex; flex-direction: column; min-width: 0; line-height: 1.25; }
.ucx-mode-body strong { font-size: 13px; }
.ucx-mode-body span { font-size: 11px; color: var(--text-muted); }
.ucx-mode-badge {
  margin-left: auto; flex: 0 0 auto; font-size: 11px; font-weight: 600; color: var(--primary);
  padding: 2px 8px; border-radius: 999px; background: color-mix(in srgb, var(--primary) 14%, transparent); white-space: nowrap;
}
/* Flag toggle switch. */
.ucx-mode-switch {
  margin-left: auto; flex: 0 0 auto; position: relative;
  width: 34px; height: 20px; border-radius: 999px; background: var(--strans); transition: background .15s ease;
}
.ucx-mode-switch::after {
  content: ''; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px;
  border-radius: 999px; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.3); transition: transform .15s ease;
}
.ucx-mode-flag.is-on .ucx-mode-switch { background: var(--primary); }
.ucx-mode-flag.is-on .ucx-mode-switch::after { transform: translateX(14px); }

/* Disappearing preset tiles. */
.ucx-tile-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 6px; padding: 2px; }
.ucx-mode-tile {
  display: flex; flex-direction: column; align-items: flex-start; gap: 2px;
  padding: 9px 11px; border: var(--line); border-radius: 10px; cursor: pointer;
  background: var(--muted); color: var(--text); font: inherit; font-size: 13px; text-align: left;
}
.ucx-mode-tile:hover { border-color: var(--primary); }
.ucx-mode-tile.is-active { border-color: var(--primary); background: color-mix(in srgb, var(--primary) 12%, transparent); }
.ucx-mode-tile.is-custom { grid-column: 1 / -1; }
.ucx-mode-tile span { font-size: 11px; color: var(--text-muted); }

/* Attach menu (emoji-led item rows reuse .ucx-menu). */
.ucx-attach-menu .ucx-menu-ic { font-size: 15px; }

/* Fallback datetime picker (when window.Utilities.pickDateTime is absent). */
.ucx-dt-form { display: flex; flex-direction: column; gap: 10px; width: 268px; padding: 4px; }
.ucx-dt-title { font-size: 13px; font-weight: 700; color: var(--text); }
.ucx-dt-input { padding: 8px 10px; border-radius: 10px; border: var(--line); background: var(--muted); color: var(--text); font: inherit; outline: none; }
.ucx-dt-input:focus { box-shadow: var(--ring); }
.ucx-dt-quick { display: grid; grid-template-columns: repeat(2, 1fr); gap: 6px; }
.ucx-dt-chip {
  display: flex; flex-direction: column; gap: 1px; padding: 7px 9px;
  border: var(--line); border-radius: 9px; cursor: pointer; background: transparent; color: var(--text); font: inherit; text-align: left;
}
.ucx-dt-chip:hover { border-color: var(--primary); }
.ucx-dt-chip strong { font-size: 12px; }
.ucx-dt-chip span { font-size: 10.5px; color: var(--text-muted); }
.ucx-dt-actions { display: flex; justify-content: flex-end; gap: 6px; }
.ucx-dt-actions button { padding: 7px 14px; border: 0; border-radius: 999px; cursor: pointer; font: inherit; font-weight: 600; }
.ucx-dt-cancel { background: var(--strans); color: var(--text); }
.ucx-dt-ok { background: var(--primary); color: #fff; }

/* Donna AI modes row & token usage pill */
.ucx-donna-modes {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 6px;
  scrollbar-width: none;
}
.ucx-donna-modes::-webkit-scrollbar { display: none; }
.ucx-mode-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border-radius: 999px;
  border: var(--line);
  background: var(--muted);
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  transition: all .15s ease;
}
.ucx-mode-pill:hover { background: var(--strans); color: var(--text); }

/* Every active pill used to take the same --primary fill, so Assistance (reads only) and
   Tool (creates, sends, changes) were the same chip in the same colour — the single most
   important distinction Donna has, invisible. Each mode now supplies its own `--mode-accent`
   (core/donna/modes.js), and the fixed mode is deliberately the quiet one: Assistance is
   the resting state, a specialized mode is a temporary elevation and looks like it. */
.ucx-mode-pill.active {
  --mode-accent: var(--primary);
  background: color-mix(in srgb, var(--mode-accent) 15%, transparent);
  border-color: color-mix(in srgb, var(--mode-accent) 62%, transparent);
  color: var(--mode-accent);
  font-weight: 600;
}
.ucx-mode-pill.active i { color: var(--mode-accent); }

/* Always on, never a control: no ring, no hover, and a flatter treatment so the eye goes
   to whatever specialized mode sits beside it. */
.ucx-mode-pill.fixed {
  cursor: default;
  border-style: dashed;
  border-color: color-mix(in srgb, var(--mode-accent, var(--text-muted)) 34%, transparent);
  background: transparent;
  font-weight: 500;
}
.ucx-mode-pill.fixed:hover { background: transparent; color: var(--mode-accent, var(--text-muted)); }

/* A specialized mode is temporary, so it says how to leave. The pill has always been
   clickable to turn the mode off; nothing on screen said so. */
.ucx-mode-pill:not(.fixed).active {
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--mode-accent) 22%, transparent),
              0 2px 10px color-mix(in srgb, var(--mode-accent) 20%, transparent);
}
.ucx-mode-pill .ucx-mode-off { font-size: 13px; margin: 0 -3px 0 1px; opacity: .55; }
.ucx-mode-pill:not(.fixed):hover .ucx-mode-off,
.ucx-mode-pill:not(.fixed):focus-visible .ucx-mode-off { opacity: 1; }
.ucx-mode-pill:not(.fixed):focus-visible {
  outline: 2px solid color-mix(in srgb, var(--mode-accent) 70%, transparent);
  outline-offset: 2px;
}

/* What actually changes while the mode is on. One line, in the mode's own colour, only
   while a specialized mode is active — the resting state needs no caption. */
.ucx-donna-mode-note {
  padding: 0 10px 5px;
  font-size: 11px;
  line-height: 1.4;
  color: color-mix(in srgb, var(--mode-accent, var(--primary)) 78%, var(--text));
  opacity: .95;
}

@media (prefers-reduced-motion: reduce) { .ucx-mode-pill { transition: none; } }

.ucx-donna-token-pill {
  margin-left: auto;
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: 999px;
  border: var(--line);
  background: var(--strans);
  color: var(--text);
  font-size: 11.5px;
  font-weight: 600;
  cursor: pointer;
  overflow: visible;
}
.ucx-donna-token-pill .dtp-bar {
  width: 36px;
  height: 5px;
  border-radius: 999px;
  background: var(--strans);
  overflow: hidden;
  display: inline-block;
}
.ucx-donna-token-pill .dtp-fill {
  display: block;
  height: 100%;
  background: var(--primary);
  border-radius: 999px;
  transition: width .3s ease;
}
.ucx-donna-token-pill.is-warn .dtp-fill { background: #f59e0b; }
.ucx-donna-token-pill.is-over .dtp-fill { background: #ef4444; }

.ucx-donna-token-pill .dtp-tip {
  display: none;
  position: absolute;
  bottom: calc(100% + 14px);
  right: 0;
  width: 220px;
  padding: 10px 12px;
  border: var(--line);
  background: var(--bg);
  border-radius: var(--cradi);
  box-shadow: 0 8px 24px rgba(0,0,0,.35);
  font-size: 11px;
  color: var(--text);
  z-index: 100;
  text-align: left;
  line-height: 1.5;
}
.ucx-donna-token-pill:hover .dtp-tip { display: block; }
.ucx-donna-token-pill .dtp-tip b { display: block; font-size: 12px; font-weight: 700; color: var(--text); margin-bottom: 2px; }
.ucx-donna-token-pill .dtp-tip span { display: block; color: var(--text-muted); }

/* ── Core Multi-Cloud Tabbed Picker Modal ───────────────────────────────── */
.ucx-cloud-modal-overlay {
  position: fixed; top: 0; left: 0; right: 0; bottom: 0;
  z-index: 9999; background: rgba(0, 0, 0, .55);
  -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px);
  display: grid; place-items: center; padding: 16px;
  animation: ucx-cloud-fade .15s ease;
}
@keyframes ucx-cloud-fade { from { opacity: 0; } to { opacity: 1; } }

.ucx-cloud-modal {
  width: min(680px, 100%); max-height: 85vh;
  background: var(--panel, var(--bg, #1e1e2d));
  border: var(--line); border-radius: 18px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, .4);
  display: flex; flex-direction: column; overflow: hidden;
}
.ucx-cloud-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 18px; border-bottom: var(--line);
}
.ucx-cloud-title { font-weight: 700; font-size: 15px; color: var(--text); }
.ucx-cloud-close {
  background: none; border: 0; font-size: 20px; color: var(--text-muted);
  cursor: pointer; padding: 0 4px; border-radius: 6px;
}
.ucx-cloud-close:hover { color: var(--text); }

.ucx-cloud-tabs {
  display: flex; gap: 6px; padding: 10px 18px 0;
  border-bottom: var(--line); background: var(--strans);
}
.ucx-cloud-tab {
  padding: 8px 14px; border: 0; background: none; border-radius: 10px 10px 0 0;
  font-size: 12.5px; font-weight: 600; color: var(--text-muted); cursor: pointer;
  display: inline-flex; align-items: center; gap: 6px; transition: all .15s ease;
}
.ucx-cloud-tab:hover { color: var(--text); }
.ucx-cloud-tab.active {
  background: var(--panel, var(--bg, #1e1e2d)); color: var(--primary);
  box-shadow: 0 -2px 0 var(--primary) inset;
}

.ucx-cloud-body { padding: 16px; flex: 1; min-height: 0; display: flex; flex-direction: column; gap: 12px; }
.ucx-cloud-search {
  width: 100%; padding: 8px 12px; border-radius: 10px;
  border: var(--line); background: var(--muted); color: var(--text); font-size: 13px;
}
.ucx-cloud-search:focus { outline: 0; border-color: var(--primary); }

.ucx-cloud-list {
  flex: 1; min-height: 220px; max-height: 340px; overflow-y: auto;
  border: var(--line); border-radius: 12px; background: var(--muted); padding: 6px;
  display: flex; flex-direction: column; gap: 2px;
}
.ucx-cloud-item {
  display: flex; align-items: center; gap: 10px; padding: 8px 10px;
  border-radius: 8px; cursor: pointer; transition: background .1s ease;
}
.ucx-cloud-item:hover { background: var(--strans); }
.ucx-cloud-thumb { width: 26px; height: 26px; border-radius: 6px; object-fit: cover; }
.ucx-cloud-ic { font-size: 18px; color: var(--primary); }
.ucx-cloud-name { flex: 1; font-size: 13px; font-weight: 500; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ucx-cloud-size { font-size: 11px; color: var(--text-muted); }
.ucx-cloud-loading, .ucx-cloud-empty { padding: 30px; text-align: center; color: var(--text-muted); font-size: 13px; }

.ucx-cloud-subrow { display: flex; align-items: center; justify-content: space-between; font-size: 12px; color: var(--text-muted); }
.ucx-cloud-foot {
  display: flex; align-items: center; justify-content: flex-end; gap: 10px;
  padding: 12px 18px; border-top: var(--line); background: var(--strans);
}
.ucx-cloud-cancel {
  padding: 8px 16px; border-radius: 10px; border: var(--line);
  background: var(--muted); color: var(--text); font-size: 13px; font-weight: 600; cursor: pointer;
}
.ucx-cloud-attach {
  padding: 8px 18px; border-radius: 10px; border: 0;
  background: var(--primary); color: #fff; font-size: 13px; font-weight: 600; cursor: pointer;
}
.ucx-cloud-attach:disabled { opacity: .5; cursor: not-allowed; }

/* ── Mentions & Channels Autocomplete Popover ───────────────────────────── */
.ucx-pop-mention { z-index: 3500; min-width: 240px; }
.ucx-mention-menu { display: flex; flex-direction: column; gap: 2px; max-height: 260px; overflow-y: auto; }
.ucx-mention-item {
  display: flex; align-items: center; gap: 10px; padding: 6px 10px; border-radius: 8px;
  width: 100%; border: 0; background: none; text-align: left; cursor: pointer; color: var(--text);
}
.ucx-mention-item:hover, .ucx-mention-item.is-focused { background: var(--strans); }
.ucx-mention-avatar { width: 28px; height: 28px; border-radius: 999px; object-fit: cover; }
.ucx-mention-avatar-ph {
  width: 28px; height: 28px; border-radius: 999px; background: var(--primary); color: #fff;
  display: grid; place-items: center; font-weight: 700; font-size: 12px;
}
.ucx-mention-meta { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.ucx-mention-name { font-size: 12.5px; font-weight: 600; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ucx-mention-handle { font-size: 11px; color: var(--text-muted); font-weight: 400; }
.ucx-mention-role { font-size: 10px; color: var(--primary); font-weight: 600; }

/* ── Quoted Reply Target Preview Bar ───────────────────────────────────── */
.ucx-reply-target {
  padding: 8px 12px; border-radius: 12px; background: var(--strans);
  border-left: 3px solid var(--primary); margin-bottom: 8px;
  animation: ucx-reply-fade .12s ease;
}
@keyframes ucx-reply-fade { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }

.ucx-reply-bar-inner { display: flex; align-items: center; gap: 10px; }
.ucx-reply-avatar { width: 26px; height: 26px; border-radius: 999px; object-fit: cover; }
.ucx-reply-avatar-ph {
  width: 26px; height: 26px; border-radius: 999px; background: var(--primary); color: #fff;
  display: grid; place-items: center; font-size: 13px;
}
.ucx-reply-meta { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.ucx-reply-author { font-size: 11.5px; font-weight: 700; color: var(--primary); }
.ucx-reply-snippet { font-size: 12px; color: var(--text-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ucx-reply-close {
  background: none; border: 0; font-size: 18px; color: var(--text-muted);
  cursor: pointer; padding: 0 4px; border-radius: 6px;
}
.ucx-reply-close:hover { color: var(--text); }

/* ── Quick Reply Chips Bar ──────────────────────────────────────────────── */
.ucx-quick-replies {
  display: flex; gap: 6px; overflow-x: auto; padding: 4px 2px 8px;
  scroll-behavior: smooth; -webkit-overflow-scrolling: touch;
}
.ucx-quick-replies::-webkit-scrollbar { display: none; }
.ucx-qr-chip {
  padding: 5px 12px; border-radius: 999px; border: var(--line);
  background: var(--strans); color: var(--text); font-size: 12px; font-weight: 500;
  cursor: pointer; flex: 0 0 auto; display: inline-flex; align-items: center; gap: 6px;
  transition: all .15s ease; white-space: nowrap;
}
.ucx-qr-chip:hover { background: var(--primary); color: #fff; border-color: var(--primary); }
