/* One persistent AI conversation above each Control Center workspace. */
.assistant-widget {
  --assistant-viewport-height: 100dvh;
  --assistant-keyboard-offset: 0px;
  position: fixed;
  right: max(20px, env(safe-area-inset-right));
  bottom: calc(max(18px, env(safe-area-inset-bottom)) + var(--assistant-keyboard-offset));
  z-index: 12000;
  color: #eef3fb;
  font: 14px/1.45 Inter, "Segoe UI", Arial, sans-serif;
  text-align: left;
}
.assistant-widget[hidden], .assistant-widget [hidden] { display: none !important; }
.assistant-widget button, .assistant-widget textarea { font: inherit; }
.assistant-widget button { cursor: pointer; }
.assistant-widget button:disabled { cursor: wait; opacity: .5; }
.assistant-widget button:focus-visible, .assistant-widget textarea:focus-visible { outline: 2px solid #90baff; outline-offset: 3px; }
.assistant-launcher {
  position: relative; display: flex; align-items: center; gap: 11px;
  min-height: 60px; padding: 6px 18px 6px 6px; border: 1px solid #3b4e6d;
  border-radius: 34px; background: linear-gradient(125deg, #18253b, #101722);
  color: #fff; box-shadow: 0 10px 35px #0006, 0 0 0 4px #10182355;
  transition: border-color .16s, box-shadow .16s;
}
.assistant-launcher:hover { border-color: #6e97d7; box-shadow: 0 12px 40px #0008, 0 0 0 4px #27477b44; }
.assistant-launcher-copy { display: grid; gap: 2px; }
.assistant-launcher-copy strong { font-size: 13px; font-weight: 650; }
.assistant-launcher-copy small { color: #a5b9d6; font-size: 11px; }
.assistant-mascot { display: block; width: 46px; height: 46px; border-radius: 50%; object-fit: cover; background: #090b12; flex: 0 0 auto; border: 1px solid #43516a; }
.assistant-unread { position: absolute; right: 7px; top: 3px; width: 12px; height: 12px; border-radius: 50%; background: #78b3ff; border: 2px solid #101722; }
.assistant-widget-panel {
  position: absolute; right: 0; bottom: calc(100% + 12px);
  display: grid; grid-template-rows: auto auto minmax(0, 1fr) auto;
  width: min(430px, calc(100vw - 32px));
  height: min(620px, calc(var(--assistant-viewport-height) - 112px));
  max-height: calc(var(--assistant-viewport-height) - 112px);
  min-height: 0; overflow: hidden;
  border: 1px solid #35455e; border-radius: 22px; background: #10151e;
  box-shadow: 0 28px 85px #0009, 0 0 0 1px #89b7ff0c;
  animation: assistant-reveal .16s ease-out;
}
.assistant-widget-head { display: flex; align-items: center; gap: 11px; padding: 16px; border-bottom: 1px solid #273347; background: linear-gradient(125deg, #1c2b44, #131c2a 78%); }
.assistant-widget-head .assistant-mascot { width: 42px; height: 42px; }
.assistant-heading { flex: 1; min-width: 0; }
.assistant-heading h3 { margin: 0; font-size: 16px; line-height: 1.35; font-weight: 650; }
.assistant-runtime { display: block; margin-top: 4px; color: #adbdd3; font-size: 11px; overflow-wrap: anywhere; }
.assistant-runtime[data-state="online"] { color: #92dbb4; }
.assistant-runtime[data-state="busy"] { color: #a9caff; }
.assistant-runtime[data-state="error"] { color: #edc489; }
.assistant-icon-button { display: grid; place-items: center; width: 38px; height: 38px; flex: 0 0 auto; border: 1px solid #40506a; border-radius: 12px; color: #cfdef2; background: #ffffff06; }
.assistant-icon-button:hover { background: #ffffff10; color: #fff; }
.assistant-widget svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.assistant-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 9px 14px; border-bottom: 1px solid #242e3e; }
.assistant-toolbar button { display: inline-flex; align-items: center; justify-content: center; gap: 7px; min-height: 34px; border: 1px solid transparent; border-radius: 9px; padding: 6px 9px; background: transparent; color: #b2c4df; font-size: 12px; }
.assistant-toolbar button:hover, .assistant-toolbar button.active { color: #e7f0ff; background: #1c2b43; border-color: #324967; }
.assistant-content { min-height: 0; overflow: hidden; display: flex; flex-direction: column; }
.assistant-widget .chat-messages { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 18px 16px; gap: 14px; scrollbar-width: thin; scrollbar-color: #3a4b66 transparent; }
.assistant-widget .message { max-width: 94%; border-radius: 15px; padding: 12px 14px; font-size: 13px; line-height: 1.65; white-space: pre-wrap; overflow-wrap: anywhere; }
.assistant-widget .message.assistant { align-self: flex-start; background: #1a2331; color: #e0e9f7; border: 1px solid #2a384c; border-bottom-left-radius: 5px; }
.assistant-widget .message.user { align-self: flex-end; color: #fff; background: #285baa; border: 1px solid #4179cc; border-bottom-right-radius: 5px; }
.assistant-thinking { padding: 0 3px; color: #9aaeca; font-size: 12px; }
.assistant-history { display: flex; flex-direction: column; min-height: 0; height: 100%; overflow: hidden; padding: 12px 8px; }
.assistant-history h4 { margin: 0; padding: 4px 10px 9px; font-size: 12px; color: #a7b7cc; font-weight: 500; }
.assistant-widget .chat-thread-list { display: flex; flex-direction: column; gap: 6px; overflow: auto; min-height: 0; max-height: none; padding: 2px 4px; overscroll-behavior: contain; }
.assistant-widget .chat-thread-item { padding: 12px; border-radius: 12px; flex: 0 0 auto; }
.assistant-widget .chat-thread-item strong { font-size: 13px; }
.assistant-widget .chat-thread-item small { font-size: 11px; color: #9caec8; }
.assistant-widget .chat-thread-empty { font-size: 13px; color: #a1b1c8; }
.assistant-compose { padding: 12px 14px 10px; border-top: 1px solid #29364a; background: #111a27; }
.assistant-compose-row { display: grid; grid-template-columns: minmax(0, 1fr) 42px; align-items: end; gap: 8px; }
.assistant-widget textarea { width: 100%; min-width: 0; min-height: 66px; max-height: 130px; margin: 0; padding: 11px 12px; resize: vertical; border: 1px solid #3d4e67; border-radius: 12px; background: #0d1420; color: #f0f5ff; line-height: 1.45; }
.assistant-widget textarea::placeholder { color: #97a7c0; }
.assistant-send { width: 42px; height: 42px; margin-bottom: 1px; border: 1px solid #6799e7; border-radius: 12px; background: #2d69c5; color: #fff; display: grid; place-items: center; }
.assistant-send:hover { background: #397adb; }
.assistant-compose-hint { margin: 7px 0 0; font-size: 10px; color: #96a6bf; }
.assistant-notice { margin: 0 0 8px; color: #efd1a3; font-size: 12px; line-height: 1.45; }
.assistant-retry { border: 0; border-radius: 6px; padding: 0 0 9px; color: #a8cfff; background: none; font-size: 12px !important; text-decoration: underline; text-underline-offset: 3px; }
.assistant-visually-hidden { position: absolute !important; width: 1px !important; height: 1px !important; padding: 0 !important; margin: -1px !important; overflow: hidden !important; clip-path: inset(50%); white-space: nowrap; border: 0 !important; }
@keyframes assistant-reveal { from { opacity: 0; translate: 0 8px; } to { opacity: 1; translate: 0 0; } }
@media (max-width: 560px) {
  .assistant-widget { right: max(12px, env(safe-area-inset-right)); bottom: calc(max(12px, env(safe-area-inset-bottom)) + var(--assistant-keyboard-offset)); }
  .assistant-launcher { min-height: 58px; padding: 5px; }
  .assistant-launcher-copy { display: none; }
  .assistant-widget-panel { width: calc(100vw - 24px); height: min(620px, calc(var(--assistant-viewport-height) - 94px)); max-height: calc(var(--assistant-viewport-height) - 94px); border-radius: 18px; bottom: calc(100% + 10px); }
  .assistant-widget-head { padding: 12px 14px; }
  .assistant-widget textarea { font-size: 16px; min-height: 60px; }
  .assistant-compose-hint { font-size: 10px; }
}
@media (max-height: 520px) {
  .assistant-widget-head { padding-top: 9px; padding-bottom: 9px; }
  .assistant-toolbar { padding-top: 4px; padding-bottom: 4px; }
  .assistant-compose { padding-top: 8px; padding-bottom: 8px; }
  .assistant-widget textarea { min-height: 48px; max-height: 70px; }
  .assistant-compose-hint { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  .assistant-widget-panel { animation: none; }
  .assistant-launcher { transition: none; }
}

@media (min-width: 561px) {
  .assistant-widget-head { cursor: grab; user-select: none; touch-action: none; }
  .assistant-widget.is-dragging .assistant-widget-head { cursor: grabbing; }
  .assistant-widget.is-dragging .assistant-widget-panel { animation: none; box-shadow: 0 34px 95px #000b, 0 0 0 1px #89b7ff22; }
}
