/* Platform-wide AAA AI helper. Standalone: included by _workspace_rail.html
   and injected into pages that do not render the rail.

   The widget owns its palette instead of borrowing the page's --n-* tokens:
   some dark product pages (e.g. the scheduling cockpit) force a dark surface
   with platform-monochrome.css but never set html[data-theme="dark"], so the
   native tokens still resolve to the light set and the panel used to render
   white-on-dark. assistant-widget.js detects the rendered surface and writes
   html[data-pc-theme]; the defaults below are the dark palette. */
:root {
  --pc-paper: #0c0c0e;
  --pc-surface: #111114;
  --pc-raised: #17171b;
  --pc-mist: #242428;
  --pc-text: #f4f4f1;
  --pc-text-2: #a3a3a8;
  --pc-text-3: #8f8f95;
  --pc-border: rgba(255,255,255,.14);
  --pc-border-strong: rgba(255,255,255,.26);
  --pc-action: #f4f4f1;
  --pc-on-action: #111114;
  --pc-ok: #cfcfcf;
  --pc-danger: #9a9a9a;
  --pc-badge: #f4f4f1;
  /* Floating launcher: one 64px circle with the sparkle mark on every surface.
     The size, ring, palette and icon match the aaaai.me website copilot
     (pitch-site/copilot.css + copilot.js), so both products show the same
     button. Keep the two definitions in sync. */
  --pc-fab-size: 64px;
  --pc-fab-gap: 12px;
  --pc-fab-bg: #111114;
  --pc-fab-bg-hover: #1c1c20;
  --pc-fab-text: #ffffff;
  --pc-fab-border: rgba(255,255,255,.28);
  --pc-fab-border-hover: #ffffff;
  --pc-fab-shadow: 0 14px 45px rgba(0,0,0,.5), 0 0 0 1px rgba(255,255,255,.04) inset;
  --pc-shadow: 0 24px 70px rgba(0,0,0,.55);
}
html[data-pc-theme="light"],
html[data-theme="light"]:not([data-pc-theme]) {
  --pc-paper: #f7f7f4;
  --pc-surface: #ffffff;
  --pc-raised: #f2f2f7;
  --pc-mist: #e5e5ea;
  --pc-text: #111114;
  --pc-text-2: #5f5f66;
  --pc-text-3: #7a7a82;
  --pc-border: rgba(0,0,0,.12);
  --pc-border-strong: rgba(0,0,0,.24);
  --pc-action: #111114;
  --pc-on-action: #ffffff;
  --pc-ok: #2f2f2f;
  --pc-danger: #5a5a5a;
  --pc-badge: #111114;
  --pc-fab-bg: #f7f7f4;
  --pc-fab-bg-hover: #ffffff;
  --pc-fab-text: #111114;
  --pc-fab-border: rgba(0,0,0,.28);
  --pc-fab-border-hover: #111114;
  --pc-fab-shadow: 0 14px 40px rgba(0,0,0,.16), 0 0 0 1px rgba(0,0,0,.02) inset;
  --pc-shadow: 0 24px 70px rgba(0,0,0,.18);
}
.pc-fab {
  position: fixed; right: 22px; bottom: 22px; z-index: 1100;
  display: inline-flex; align-items: center; justify-content: center;
  width: var(--pc-fab-size); height: var(--pc-fab-size);
  min-width: var(--pc-fab-size); padding: 0; border-radius: 50%;
  border: 1px solid var(--pc-fab-border) !important;
  background: var(--pc-fab-bg) !important;
  color: var(--pc-fab-text) !important;
  font: inherit; cursor: pointer;
  box-shadow: var(--pc-fab-shadow);
  transition-property: background-color, border-color, transform;
  transition-duration: .16s;
  transition-timing-function: cubic-bezier(.2,.8,.2,1);
}
.pc-fab:hover {
  background: var(--pc-fab-bg-hover) !important;
  border-color: var(--pc-fab-border-hover) !important;
  transform: translateY(-1px);
}
.pc-fab:active { transform: translateY(0); }
.pc-fab-icon { width: 28px; height: 28px; display: block; fill: currentColor; }
.pc-panel {
  position: fixed; right: 22px; bottom: calc(22px + var(--pc-fab-size) + var(--pc-fab-gap)); z-index: 1110;
  display: flex; flex-direction: column; box-sizing: border-box;
  width: min(420px, calc(100vw - 32px));
  max-height: min(680px, calc(100vh - 140px));
  max-height: min(680px, calc(100dvh - 140px));
  border: 1px solid var(--pc-border);
  border-radius: 18px; background: var(--pc-surface);
  color: var(--pc-text); color-scheme: dark;
  box-shadow: var(--pc-shadow); overflow: hidden;
}
html[data-pc-theme="light"] .pc-panel,
html[data-theme="light"]:not([data-pc-theme]) .pc-panel {
  color-scheme: light;
}
.pc-panel[hidden] { display: none; }
.pc-head {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 12px;
  padding: 14px 16px; border-bottom: 1px solid var(--pc-border);
  background: var(--pc-raised);
}
.pc-head strong { display: block; font-size: 14px; letter-spacing: .01em; }
.pc-head small { display: block; margin-top: 2px; color: var(--pc-text-2); font-size: 11px; }
.pc-icon { border: 0; background: transparent !important; color: inherit !important; font-size: 22px; cursor: pointer; line-height: 1; }
.pc-messages {
  flex: 1 1 auto; min-height: 170px; overflow-y: auto;
  padding: 14px 14px 6px; display: flex; flex-direction: column; gap: 10px;
}
.pc-msg {
  max-width: 92%; padding: 9px 11px; border-radius: 12px;
  font-size: 12.5px; line-height: 1.5; white-space: pre-wrap; overflow-wrap: anywhere;
}
.pc-msg.user { align-self: flex-end; background: var(--pc-text); color: var(--pc-surface); border-bottom-right-radius: 4px; }
.pc-msg.assistant { align-self: flex-start; background: var(--pc-raised); border: 1px solid var(--pc-border); }
.pc-msg.note { align-self: flex-start; color: var(--pc-text-2); font-size: 11px; padding: 0 2px; background: transparent; }
.pc-actions { margin-top: 6px; display: grid; gap: 5px; }
.pc-action { font-size: 11px; color: var(--pc-text-2); }
.pc-action.ok { color: var(--pc-ok); }
.pc-action.error { color: var(--pc-danger); }
.pc-proposal { margin-top: 8px; padding: 10px; border: 1px solid var(--pc-border); border-radius: 10px; background: var(--pc-raised); }
.pc-proposal strong { display: block; font-size: 12px; }
.pc-proposal p { margin: 3px 0 8px; color: var(--pc-text-2); font-size: 11.5px; }
.pc-proposal .pc-btn { font-size: 11px; padding: 6px 10px; }
.pc-quick { display: flex; flex-wrap: wrap; gap: 6px; padding: 2px 14px 10px; }
.pc-quick button {
  border: 1px solid var(--pc-border) !important; background: transparent !important;
  color: var(--pc-text-2) !important; border-radius: 999px; padding: 5px 9px;
  font: inherit; font-size: 11px; cursor: pointer;
}
.pc-quick button:hover { color: var(--pc-text) !important; border-color: var(--pc-border-strong) !important; }
.pc-form { border-top: 1px solid var(--pc-border); padding: 10px 14px 12px; }
.pc-form textarea {
  width: 100%; box-sizing: border-box; resize: vertical; min-height: 44px; max-height: 130px;
  padding: 9px 10px; border-radius: 10px !important;
  /* native.css styles every textarea with !important, including this one. */
  border: 1px solid var(--pc-border) !important;
  background: var(--pc-paper) !important; color: var(--pc-text) !important;
  font: inherit; font-size: 12.5px;
}
.pc-form textarea::placeholder { color: var(--pc-text-3) !important; opacity: 1; }
.pc-form textarea:focus { border-color: var(--pc-text-3) !important; outline: none !important; }
.pc-form-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 7px; }
.pc-hint { color: var(--pc-text-3); font-size: 10.5px; line-height: 1.35; }
.pc-btn {
  border: 1px solid var(--pc-border) !important; background: transparent !important;
  color: var(--pc-text) !important; border-radius: 9px; padding: 7px 11px;
  font: inherit; font-size: 12px; cursor: pointer;
}
.pc-btn-primary { background: var(--pc-action) !important; color: var(--pc-on-action) !important; border-color: transparent !important; }
.pc-btn:disabled { opacity: .55; cursor: default; }
.pc-open { margin-top: 6px; }
.pc-thinking { display: inline-flex; gap: 4px; align-items: center; color: var(--pc-text-2); font-size: 11px; }
.pc-thinking i { width: 4px; height: 4px; border-radius: 50%; background: currentColor; animation: pcPulse 1.2s infinite; }
.pc-thinking i:nth-child(2) { animation-delay: .15s; }
.pc-thinking i:nth-child(3) { animation-delay: .3s; }
@keyframes pcPulse { 0%, 100% { opacity: .25; } 50% { opacity: 1; } }
@media (max-width: 760px) {
  :root { --pc-fab-size: 60px; }
  .pc-fab-icon { width: 26px; height: 26px; }
}
@media (max-width: 640px) {
  .pc-fab { right: 14px; bottom: 14px; }
  .pc-notice { right: 14px; }
  .pc-panel {
    right: 8px; left: 8px; width: auto;
    bottom: calc(14px + var(--pc-fab-size) + var(--pc-fab-gap));
    max-height: calc(100vh - 110px); max-height: calc(100dvh - 110px);
  }
}
.pc-fab:focus-visible {
  outline: 2px solid var(--pc-fab-border-hover); outline-offset: 4px;
}
.pc-icon:focus-visible,
.pc-btn:focus-visible,
.pc-quick button:focus-visible {
  outline: 2px solid var(--pc-text); outline-offset: 2px;
}

/* The chat shell owns the bottom edge of the viewport. Keep the helper above
   the composer there so it never covers the send button or voice controls. */
body[data-softnav-page="chat"] .pc-fab { bottom: 104px; }
body[data-softnav-page="chat"] .pc-notice { bottom: calc(104px + var(--pc-fab-size) + 8px); }
body[data-softnav-page="chat"] .pc-panel {
  bottom: calc(104px + var(--pc-fab-size) + var(--pc-fab-gap));
  max-height: min(680px, calc(100vh - 220px));
  max-height: min(680px, calc(100dvh - 220px));
}
@media (max-width: 640px) {
  body[data-softnav-page="chat"] .pc-fab { bottom: 96px; }
  body[data-softnav-page="chat"] .pc-notice { bottom: calc(96px + var(--pc-fab-size) + 8px); }
  body[data-softnav-page="chat"] .pc-panel {
    bottom: calc(96px + var(--pc-fab-size) + var(--pc-fab-gap));
    max-height: calc(100vh - 200px);
    max-height: calc(100dvh - 200px);
  }
}

.pc-fab.has-unread::after {
  content: ''; position: absolute; top: 3px; right: 3px;
  width: 12px; height: 12px; border-radius: 50%;
  background: var(--pc-badge); border: 2px solid var(--pc-fab-bg);
  box-shadow: 0 0 0 3px rgba(128,128,128,.16);
}
.pc-notice {
  position: fixed; right: 22px; bottom: calc(22px + var(--pc-fab-size) + 10px); z-index: 1105;
  padding: 8px 12px; border-radius: 10px;
  border: 1px solid var(--pc-border);
  background: var(--pc-raised); color: var(--pc-text);
  font-size: 11.5px; box-shadow: 0 12px 34px rgba(0,0,0,.4);
  max-width: 280px;
}
.pc-notice[hidden] { display: none; }

@media (prefers-reduced-motion: reduce) {
  .pc-fab { transition: none; }
  .pc-fab:hover, .pc-fab:active { transform: none; }
}
@media print {
  .pc-fab, .pc-panel, .pc-notice { display: none !important; }
}
