/* ─────────────────────────────────────────────────────────────────────────────
   AI Agent — floating panel (bottom right). Same glass look as the start page's
   todo window, with its own colour variables since it floats over the light app.
   ───────────────────────────────────────────────────────────────────────── */

.ag-panel {
  --ag-ink: 255, 255, 255;   /* text colour, as an rgb triple */
  --ag-wash: 255, 255, 255;  /* tint used for hovers, bubbles and fields */
  --ag-fg: rgb(var(--ag-ink));
  --ag-fg-soft: rgba(var(--ag-ink), 0.7);
  --ag-btn-bg: #fff;
  --ag-btn-fg: #1b2147;
  --ag-ok: #6ee7b7;
  --ag-stopped: rgba(255, 190, 190, 0.75);
  --ag-accent: #8b8bff;
  --ag-side: rgba(255, 255, 255, 0.035);
  --ag-glass: rgba(14, 18, 38, 0.8);
  --ag-glass-hover: rgba(14, 18, 38, 0.88);
  --ag-border: rgba(255, 255, 255, 0.2);
  --ag-ease: cubic-bezier(.2, .8, .2, 1);

  position: fixed; right: 24px; bottom: 24px; z-index: 55;
  width: min(380px, calc(100vw - 32px));
  display: flex; flex-direction: column;
  border-radius: 20px; overflow: hidden;
  color: var(--ag-fg);
  background: var(--ag-glass); border: 1px solid var(--ag-border);
  backdrop-filter: blur(22px) saturate(1.5); -webkit-backdrop-filter: blur(22px) saturate(1.5);
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.28);
  transition: background 250ms ease;
  will-change: transform, opacity;
}
.ag-panel:hover, .ag-panel:focus-within { background: var(--ag-glass-hover); }
/* Grows out of the element that opened it (transform-origin is set from JS). */
.ag-panel.opening { animation: agOpen 520ms cubic-bezier(.2, .9, .25, 1.04) both; }
.ag-panel.opening .ag-head, .ag-panel.opening .ag-body-inner { animation: agContent 420ms 150ms var(--ag-ease) both; }
.ag-panel.closing { animation: agClose 300ms cubic-bezier(.5, 0, .75, .3) both; pointer-events: none; }

.ag-head { display: flex; align-items: center; }
.ag-head-main {
  flex: 1; min-width: 0; display: flex; align-items: center; gap: 10px; padding: 12px 6px 12px 14px;
  font-size: 12px; font-weight: 600; letter-spacing: 0.1em; text-transform: uppercase; text-align: left;
  color: var(--ag-fg);
}
.ag-head-orb { display: inline-flex; filter: drop-shadow(0 0 8px rgba(120, 100, 255, 0.55)); }
.ag-panel.working .ag-head-orb { filter: drop-shadow(0 0 10px rgba(255, 130, 170, 0.7)); }
.ag-title { opacity: 0.9; }
.ag-pill {
  padding: 2px 8px; border-radius: 999px; font-size: 10px; letter-spacing: 0.08em;
  background: rgba(var(--ag-wash), 0.16); color: var(--ag-fg-soft);
}
.ag-hbtn, .ag-close {
  width: 30px; height: 30px; flex: none; border-radius: 10px; display: grid; place-items: center;
  color: var(--ag-fg); opacity: 0.6; transition: opacity 200ms ease, background 200ms ease;
}
.ag-close { margin-right: 10px; }
.ag-hbtn:hover, .ag-close:hover, .ag-hbtn.active { opacity: 1; background: rgba(var(--ag-wash), 0.14); }
.ag-head { cursor: grab; }
.ag-hbtn, .ag-close { cursor: pointer; }
.ag-hbtn:focus-visible, .ag-close:focus-visible, .ag-chip:focus-visible, .ag-send:focus-visible { outline: 2px solid var(--ag-fg); outline-offset: 2px; }

.ag-body { display: grid; grid-template-rows: 1fr; }
.ag-body-inner { min-height: 0; overflow: hidden; display: flex; flex-direction: column; }

.ag-chatview { display: flex; flex-direction: column; flex: 1; min-height: 0; }
.ag-scroll { max-height: min(380px, 52vh); overflow-y: auto; padding: 4px 14px 10px; scrollbar-width: thin; scrollbar-color: rgba(var(--ag-wash), 0.25) transparent; }
.ag-feed { display: flex; flex-direction: column; gap: 14px; }

/* Messages */
.ag-msg { display: flex; gap: 10px; animation: agMsg 380ms var(--ag-ease) both; }
.ag-user { justify-content: flex-end; }
.ag-bubble {
  max-width: 85%; padding: 8px 12px; border-radius: 14px 14px 4px 14px; font-size: 13px; line-height: 1.4;
  background: rgba(var(--ag-wash), 0.18); overflow-wrap: anywhere;
}
.ag-avatar { flex: none; display: inline-flex; margin-top: 1px; filter: drop-shadow(0 0 6px rgba(120, 100, 255, 0.45)); }
.ag-agent-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 8px; }
.ag-text { font-size: 13px; line-height: 1.5; color: rgba(var(--ag-ink), 0.92); overflow-wrap: anywhere; }
.ag-text:empty { display: none; }
.ag-error { margin-top: 6px; padding: 7px 10px; border-radius: 10px; font-size: 12.5px; color: #ffb4b4; background: rgba(239, 68, 68, 0.16); }

/* Markdown in answers */
.ag-text > :first-child { margin-top: 0; } .ag-text > :last-child { margin-bottom: 0; }
.ag-text p { margin: 0 0 8px; }
.ag-text ul, .ag-text ol { margin: 0 0 8px; padding-left: 20px; }
.ag-text li { margin: 2px 0; }
.ag-text a { color: inherit; text-decoration: underline; text-underline-offset: 2px; }
.ag-text code { padding: 1px 5px; border-radius: 6px; font: 12px/1.4 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; background: rgba(var(--ag-wash), 0.16); }
.ag-md-code { margin: 0 0 8px; padding: 9px 11px; border-radius: 10px; overflow-x: auto; font: 12px/1.45 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; background: rgba(var(--ag-wash), 0.14); white-space: pre; }
.ag-md-h { margin: 10px 0 4px; }
.ag-text blockquote { margin: 0 0 8px; padding: 2px 0 2px 10px; border-left: 3px solid rgba(var(--ag-wash), 0.4); color: rgba(var(--ag-ink), 0.8); }

/* Tool-call steps */
.ag-steps { display: flex; flex-direction: column; gap: 5px; }
.ag-steps:empty { display: none; }
.ag-step { font-size: 12.5px; color: var(--ag-fg-soft); animation: agMsg 300ms var(--ag-ease) both; }
.ag-step-head { display: flex; align-items: center; gap: 8px; }
.ag-step-label { min-width: 0; overflow-wrap: anywhere; }
.ag-step-tag { flex: none; padding: 1px 8px; border-radius: 999px; font-size: 10.5px; font-weight: 600; letter-spacing: 0.03em; background: rgba(var(--ag-wash), 0.16); color: var(--ag-fg-soft); }
.ag-step-tag[hidden] { display: none; }
.ag-step.awaiting { color: rgb(var(--ag-ink)); }
.ag-step.awaiting .ag-step-tag { background: #f5a524; color: #3b2600; }
.ag-step-extra { margin: 5px 0 2px 24px; display: flex; flex-direction: column; gap: 6px; }
.ag-step-extra:empty { display: none; }
.ag-mono { font: 11.5px/1.45 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.ag-step-detail { color: var(--ag-fg-soft); overflow-wrap: anywhere; }
.ag-step-out { margin: 0; padding: 8px 10px; max-height: 180px; overflow: auto; border-radius: 9px; white-space: pre-wrap; overflow-wrap: anywhere; color: rgba(var(--ag-ink), 0.8); background: rgba(var(--ag-wash), 0.12); scrollbar-width: thin; }
.ag-step-error { color: var(--ag-stopped); }
.ag-approval { padding: 10px 12px; border-radius: 12px; border: 1px solid rgba(245, 165, 36, 0.55); background: rgba(245, 165, 36, 0.1); color: rgb(var(--ag-ink)); }
.ag-approval.danger { border-color: rgba(239, 68, 68, 0.65); background: rgba(239, 68, 68, 0.1); }
.ag-approval-title { font-weight: 600; font-size: 12.5px; overflow-wrap: anywhere; }
.ag-approval-body { margin: 7px 0 0; padding: 8px 10px; max-height: 170px; overflow: auto; border-radius: 9px; white-space: pre-wrap; overflow-wrap: anywhere; font: 11.5px/1.45 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; background: rgba(var(--ag-wash), 0.14); scrollbar-width: thin; }
.ag-prompt { opacity: 0.55; }
.ag-approval-actions { display: flex; gap: 8px; margin-top: 9px; }
.ag-approve, .ag-deny { display: inline-flex; align-items: center; gap: 5px; padding: 5px 12px; border-radius: 999px; font-size: 12px; font-weight: 600; cursor: pointer; transition: transform 160ms ease, opacity 160ms ease; }
.ag-approve { background: var(--ag-btn-bg); color: var(--ag-btn-fg); }
.ag-deny { background: rgba(var(--ag-wash), 0.16); color: var(--ag-fg); border: 1px solid var(--ag-border); }
.ag-approve:hover:not(:disabled), .ag-deny:hover:not(:disabled) { transform: translateY(-1px); }
.ag-approve:disabled, .ag-deny:disabled { opacity: 0.5; cursor: default; }

.ag-step-ic { width: 16px; height: 16px; flex: none; display: grid; place-items: center; }
.ag-step.running .ag-step-label {
  background: linear-gradient(100deg, rgba(var(--ag-ink), 0.55) 30%, rgb(var(--ag-ink)) 50%, rgba(var(--ag-ink), 0.55) 70%) 0 0 / 220% 100%;
  -webkit-background-clip: text; background-clip: text; color: transparent;
  animation: agShimmer 1.6s linear infinite;
}
.ag-step.done { color: rgba(var(--ag-ink), 0.5); }
.ag-step.stopped, .ag-step.error, .ag-step.denied { color: var(--ag-stopped); }
.ag-ic { display: inline-flex; }
.ag-ic svg { overflow: visible; }
.ag-ic-ok { color: var(--ag-ok); animation: agPop 360ms var(--ag-ease) both; }

/* Subtle animated step icons */
.ag-ic .a { transform-box: fill-box; transform-origin: center; }
.ag-ic-mail { animation: agBob 1.8s ease-in-out infinite; }
.ag-ic-mail .a { stroke-dasharray: 26; animation: agDraw 1.8s ease-in-out infinite; }
.ag-ic-todo .a { stroke-dasharray: 16; animation: agDraw 1.6s ease-in-out infinite; }
.ag-ic-files .a { animation: agScan 1.4s ease-in-out infinite; }
.ag-ic-server .a { animation: agBlink 1s steps(1) infinite; }
.ag-ic-brief .a { stroke-dasharray: 12; animation: agDraw 1.6s ease-in-out infinite; }
.ag-ic-think .a { animation: agDot 1.1s ease-in-out infinite; }
.ag-ic-think .d2 { animation-delay: 0.15s; }
.ag-ic-think .d3 { animation-delay: 0.3s; }

/* Chat history */
.ag-history { display: none; flex-direction: column; gap: 8px; height: 420px; max-height: 60vh; overflow-y: auto; padding: 4px 12px 12px; scrollbar-width: thin; scrollbar-color: rgba(var(--ag-wash), 0.25) transparent; }
.ag-panel.show-history .ag-chatview { display: none; }
.ag-panel.show-history .ag-history { display: flex; }
.ag-hist-new {
  display: flex; align-items: center; justify-content: center; gap: 8px; padding: 9px 12px; border-radius: 12px; flex: none;
  font-size: 13px; font-weight: 500; color: var(--ag-fg); background: rgba(var(--ag-wash), 0.14); border: 1px solid var(--ag-border);
  transition: background 200ms ease;
}
.ag-hist-new:hover { background: rgba(var(--ag-wash), 0.22); }
.ag-hist-list { display: flex; flex-direction: column; gap: 4px; }
.ag-hist-group { padding: 10px 12px 4px; font-size: 11px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ag-fg-soft); opacity: 0.8; }
.ag-hist-list > .ag-hist-group:first-child { padding-top: 4px; }
.ag-hist-item { display: flex; align-items: center; gap: 4px; border-radius: 12px; transition: background 200ms ease; animation: agMsg 300ms var(--ag-ease) both; }
.ag-hist-item:hover { background: rgba(var(--ag-wash), 0.1); }
.ag-hist-item.current { background: rgba(var(--ag-wash), 0.14); }
.ag-hist-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; padding: 9px 4px 9px 12px; text-align: left; color: var(--ag-fg); }
.ag-hist-title { font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ag-hist-meta { font-size: 11.5px; color: var(--ag-fg-soft); }
.ag-hist-del {
  flex: none; min-width: 30px; height: 30px; margin-right: 6px; padding: 0 6px; border-radius: 9px; display: grid; place-items: center;
  font-size: 11.5px; font-weight: 600; color: var(--ag-fg-soft); opacity: 0; transition: opacity 150ms ease, background 150ms ease, color 150ms ease;
}
.ag-hist-item:hover .ag-hist-del, .ag-hist-del:focus-visible, .ag-hist-del.armed { opacity: 1; }
.ag-hist-del:hover { background: rgba(var(--ag-wash), 0.14); color: var(--ag-fg); }
.ag-hist-del.armed { background: rgba(239, 68, 68, 0.85); color: #fff; }
.ag-hist-empty { padding: 28px 14px; text-align: center; font-size: 13px; line-height: 1.5; color: var(--ag-fg-soft); }
.ag-hist-main:focus-visible, .ag-hist-new:focus-visible { outline: 2px solid var(--ag-fg); outline-offset: -2px; }

/* Chats that work or wait for approval */
.ag-hist-item.running .ag-hist-meta { color: var(--ag-accent); }
.ag-hist-item.awaiting .ag-hist-meta { color: #f5a524; font-weight: 600; }

/* Briefings view */
.ag-briefs { display: none; flex-direction: column; gap: 8px; height: 420px; max-height: 60vh; overflow-y: auto; padding: 4px 12px 12px; scrollbar-width: thin; scrollbar-color: rgba(var(--ag-wash), 0.25) transparent; }
.ag-panel.show-briefs .ag-chatview, .ag-panel.show-briefs .ag-history { display: none; }
.ag-panel.show-briefs .ag-briefs { display: flex; }
.ag-briefs-intro { padding: 2px 4px 4px; font-size: 12px; line-height: 1.5; color: var(--ag-fg-soft); }
.ag-brief { padding: 10px 12px; border-radius: 12px; background: rgba(var(--ag-wash), 0.1); border: 1px solid var(--ag-border); animation: agMsg 300ms var(--ag-ease) both; }
.ag-brief-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.ag-brief-name { font-weight: 600; font-size: 13px; }
.ag-brief-meta { flex: none; font-size: 11px; color: var(--ag-fg-soft); }
.ag-brief-projects { margin-top: 2px; font-size: 11.5px; color: var(--ag-fg-soft); }
.ag-brief-text { margin-top: 6px; font-size: 12.5px; line-height: 1.5; color: rgba(var(--ag-ink), 0.9); overflow-wrap: anywhere; }

/* Suggestions */
.ag-chips { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; padding-left: 30px; animation: agMsg 500ms 120ms var(--ag-ease) both; }
.ag-chip {
  display: inline-flex; align-items: center; gap: 8px; padding: 6px 12px 6px 10px; border-radius: 999px;
  font-size: 12.5px; color: var(--ag-fg); background: rgba(var(--ag-wash), 0.1); border: 1px solid var(--ag-border);
  transition: background 200ms ease, transform 250ms var(--ag-ease);
}
.ag-chip:hover { background: rgba(var(--ag-wash), 0.2); transform: translateX(2px); }
.ag-chip .ag-ic { opacity: 0.8; animation: none; }
.ag-chip .ag-ic .a { animation: none; }
.ag-chip:hover .ag-ic-mail, .ag-chip:hover .ag-ic-mail .a, .ag-chip:hover .ag-ic-todo .a,
.ag-chip:hover .ag-ic-files .a, .ag-chip:hover .ag-ic-server .a, .ag-chip:hover .ag-ic-brief .a { animation-play-state: running; }

/* Composer */
.ag-compose { display: flex; align-items: center; gap: 8px; margin: 0 12px 12px; padding: 5px 5px 5px 14px; border-radius: 999px; background: rgba(var(--ag-wash), 0.12); border: 1px solid var(--ag-border); transition: background 200ms ease; }
.ag-compose:focus-within { background: rgba(var(--ag-wash), 0.2); }
.ag-input { flex: 1; min-width: 0; background: none; border: 0; outline: 0; color: var(--ag-fg); font-size: 13px; padding: 6px 0; }
.ag-input::placeholder { color: var(--ag-fg-soft); }
.ag-send { width: 28px; height: 28px; flex: none; border-radius: 50%; display: grid; place-items: center; background: var(--ag-btn-bg); color: var(--ag-btn-fg); transition: transform 200ms var(--ag-ease); }
.ag-send:hover { transform: scale(1.08); }
.ag-send.stop { opacity: 0.9; }
.ag-stop { width: 9px; height: 9px; border-radius: 2px; background: var(--ag-btn-fg); }

.ag-orb { display: block; }

/* Desktop: a dragged / resized panel is positioned from JS-set variables instead of the corner */
.ag-rz { position: absolute; z-index: 3; }
.ag-rz-n, .ag-rz-s { left: 22px; right: 22px; height: 7px; cursor: ns-resize; }
.ag-rz-e, .ag-rz-w { top: 22px; bottom: 22px; width: 7px; cursor: ew-resize; }
.ag-rz-n { top: 0; } .ag-rz-s { bottom: 0; } .ag-rz-e { right: 0; } .ag-rz-w { left: 0; }
.ag-rz-ne, .ag-rz-nw, .ag-rz-se, .ag-rz-sw { width: 24px; height: 24px; }
.ag-rz-ne { top: 0; right: 0; cursor: nesw-resize; } .ag-rz-sw { bottom: 0; left: 0; cursor: nesw-resize; }
.ag-rz-nw { top: 0; left: 0; cursor: nwse-resize; } .ag-rz-se { bottom: 0; right: 0; cursor: nwse-resize; }
.ag-panel.closing .ag-rz { display: none; }
.ag-panel.dragging, .ag-panel.dragging * { user-select: none; -webkit-user-select: none; }
.ag-panel.dragging { transition: none; }
.ag-panel.dragging .ag-head, .ag-panel.dragging .ag-rz { cursor: grabbing; }
@media (min-width: 721px) {
  .ag-panel.placed { left: var(--ag-x); top: var(--ag-y); right: auto; bottom: auto; width: var(--ag-w); height: var(--ag-ph); }
  .ag-panel.placed .ag-body { flex: 1; min-height: 0; }
  .ag-panel.placed .ag-body-inner { height: 100%; }
  .ag-panel.placed .ag-scroll { flex: 1; max-height: none; }
  .ag-panel.placed .ag-history, .ag-panel.placed .ag-briefs { flex: 1; height: auto; max-height: none; }

  /* Fullscreen: the whole window, with the saved chats as a sidebar on the left */
  .ag-panel.full, .ag-panel.full.placed {
    /* Soft pastel light theme: lavender, sky and blush washes on a pale base */
    --ag-ink: 52, 58, 104;
    --ag-wash: 112, 122, 205;
    --ag-border: rgba(112, 122, 205, 0.2);
    --ag-btn-bg: #7b83dc;
    --ag-btn-fg: #fff;
    --ag-ok: #3aa383;
    --ag-stopped: #c4636b;
    --ag-accent: #9aa1ee;
    --ag-side: rgba(255, 255, 255, 0.55);
    left: 0; top: 0; right: 0; bottom: 0; width: auto; height: auto; border: 0; border-radius: 0;
    backdrop-filter: none; -webkit-backdrop-filter: none; box-shadow: none;
  }
  .ag-panel.full, .ag-panel.full:hover, .ag-panel.full:focus-within {
    background:
      radial-gradient(900px 560px at 0% 0%, #e7e3ff 0%, transparent 62%),
      radial-gradient(820px 560px at 100% 0%, #dcecff 0%, transparent 60%),
      radial-gradient(900px 600px at 100% 100%, #ffe5ef 0%, transparent 62%),
      radial-gradient(700px 500px at 0% 100%, #e3f5ee 0%, transparent 60%),
      #f7f6fd;
  }
  .ag-panel.full .ag-compose { background: rgba(255, 255, 255, 0.78); box-shadow: 0 6px 24px rgba(112, 122, 205, 0.12); }
  .ag-panel.full .ag-compose:focus-within { background: #fff; }
  .ag-panel.full .ag-chip { background: rgba(255, 255, 255, 0.6); }
  .ag-panel.full .ag-chip:hover { background: #fff; }
  .ag-panel.full .ag-bubble { background: rgba(255, 255, 255, 0.72); box-shadow: 0 2px 10px rgba(112, 122, 205, 0.1); }
  .ag-panel.full .ag-hist-new { background: rgba(255, 255, 255, 0.75); }
  .ag-panel.full .ag-hist-new:hover { background: #fff; }
  .ag-panel.full .ag-hist-item.current { background: rgba(255, 255, 255, 0.8); }
  .ag-panel.full .ag-pill { background: rgba(255, 255, 255, 0.7); }
  .ag-panel.full .ag-head-orb { filter: drop-shadow(0 0 6px rgba(120, 100, 255, 0.3)); }
  .ag-panel.full { scrollbar-color: rgba(112, 122, 205, 0.35) transparent; }
  .ag-panel.full .ag-head { cursor: default; border-bottom: 1px solid var(--ag-border); }
  .ag-panel.full .ag-head-main { cursor: default; padding: 14px 6px 14px 18px; }
  .ag-panel.full .ag-rz { display: none; }
  .ag-panel.full .ag-historybtn { display: none; }
  .ag-panel.full .ag-body { flex: 1; min-height: 0; grid-template-rows: 1fr; }
  .ag-panel.full .ag-body-inner { height: 100%; flex-direction: row; }
  .ag-panel.full .ag-history, .ag-panel.full.show-history .ag-history {
    display: flex; order: -1; flex: none; width: 280px; height: auto; max-height: none; padding: 14px 12px;
    border-right: 1px solid var(--ag-border); background: var(--ag-side);
  }
  .ag-panel.full .ag-chatview, .ag-panel.full.show-history .ag-chatview { display: flex; flex: 1; min-width: 0; }
  .ag-panel.full.show-briefs .ag-chatview { display: none; }
  .ag-panel.full.show-briefs .ag-history { display: flex; }
  .ag-panel.full .ag-briefs, .ag-panel.full.show-briefs .ag-briefs { height: auto; max-height: none; flex: 1; min-width: 0; padding: 24px 28px; }
  .ag-panel.full .ag-briefs { display: none; }
  .ag-panel.full.show-briefs .ag-briefs { display: flex; }
  .ag-panel.full .ag-briefs > * { width: 100%; max-width: 760px; margin-left: auto; margin-right: auto; }
  .ag-panel.full .ag-brief { background: rgba(255, 255, 255, 0.7); }
  .ag-panel.full .ag-error { color: #b4343a; background: rgba(239, 68, 68, 0.1); }
  .ag-panel.full .ag-scroll { flex: 1; max-height: none; padding: 24px 28px 12px; }
  .ag-panel.full .ag-feed { max-width: 760px; margin: 0 auto; gap: 18px; }
  .ag-panel.full .ag-text, .ag-panel.full .ag-bubble { font-size: 14.5px; }
  .ag-panel.full .ag-step { font-size: 13.5px; }
  .ag-panel.full .ag-compose { align-self: center; width: calc(100% - 56px); max-width: 760px; margin: 0 0 22px; padding: 7px 7px 7px 18px; }
  .ag-panel.full .ag-input { font-size: 14.5px; }
  .ag-panel.full .ag-send { width: 34px; height: 34px; }
  .ag-panel.full .ag-chips { padding-left: 30px; }
}
@media (max-width: 720px) { .ag-rz { display: none; } .ag-head { cursor: default; } }

/* Dock: the orb floating in the corner on every tab */
.ag-dock {
  position: fixed; right: 24px; bottom: 24px; z-index: 54;
  width: 56px; height: 56px; border-radius: 50%; display: grid; place-items: center;
  opacity: 0; transform: scale(0.3); visibility: hidden; pointer-events: none;
  filter: drop-shadow(0 4px 14px rgba(70, 80, 220, 0.45));
  transition: opacity 260ms ease, transform 420ms cubic-bezier(.3, 1.4, .4, 1), visibility 0s 420ms;
}
.ag-dock.on {
  opacity: 1; transform: none; visibility: visible; pointer-events: auto;
  transition: opacity 260ms 120ms ease, transform 520ms 120ms cubic-bezier(.3, 1.4, .4, 1), visibility 0s;
}
.ag-dock.on .ag-orb { animation: agFloat 4.5s ease-in-out infinite; }
.ag-dock.on:hover { transform: scale(1.12); transition-delay: 0s; }
.ag-dock.on:active { transform: scale(0.94); }
/* Live status on the dock: the current tool-call icon in the middle, and a dot when a reply is waiting */
.ag-dock-ic {
  position: absolute; inset: 0; display: grid; place-items: center; pointer-events: none; color: #fff;
  opacity: 0; transform: scale(0.5); transition: opacity 220ms ease, transform 320ms cubic-bezier(.3, 1.5, .4, 1);
  filter: drop-shadow(0 1px 2px rgba(10, 14, 50, 0.85)) drop-shadow(0 0 7px rgba(10, 14, 50, 0.45));
}
.ag-dock.busy .ag-dock-ic { opacity: 1; transform: none; }
.ag-dock-ic .ag-ic svg { width: 21px; height: 21px; stroke-width: 2.2; animation: agDockSwap 320ms cubic-bezier(.3, 1.4, .4, 1) both; }
.ag-dock-dot {
  position: absolute; top: 4px; right: 4px; width: 14px; height: 14px; border-radius: 50%; pointer-events: none;
  background: #ff4d6d; border: 2px solid #fff; box-shadow: 0 1px 5px rgba(20, 20, 60, 0.4);
  transform: scale(0); transition: transform 320ms cubic-bezier(.3, 1.7, .4, 1);
}
.ag-dock-dot::after { content: ''; position: absolute; inset: -2px; border-radius: 50%; border: 2px solid #ff4d6d; opacity: 0; }
.ag-dock.unread .ag-dock-dot, .ag-dock.attention .ag-dock-dot { transform: scale(1); }
.ag-dock.attention .ag-dock-dot { background: #f5a524; }
.ag-dock.attention .ag-dock-dot::after { border-color: #f5a524; }
.ag-dock.unread .ag-dock-dot::after, .ag-dock.attention .ag-dock-dot::after { animation: agPing 1.8s ease-out infinite; }
@keyframes agDockSwap { from { opacity: 0; transform: scale(0.4) rotate(-20deg); } to { opacity: 1; transform: none; } }
@keyframes agPing { 0% { opacity: 0.8; transform: scale(1); } 100% { opacity: 0; transform: scale(2.4); } }
.ag-dock:focus-visible { outline: 2px solid var(--accent, #6366f1); outline-offset: 3px; }

@keyframes agOpen { from { opacity: 0; transform: scale(0.12); border-radius: 40px; } 35% { opacity: 1; } to { opacity: 1; transform: none; border-radius: 20px; } }
@keyframes agClose { from { opacity: 1; transform: none; } to { opacity: 0; transform: scale(0.12); border-radius: 40px; } }
@keyframes agContent { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes agFloat { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-3px); } }
@keyframes agMsg { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@keyframes agPop { from { opacity: 0; transform: scale(0.5); } to { opacity: 1; transform: none; } }
@keyframes agShimmer { to { background-position: -220% 0; } }
@keyframes agBob { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-1.5px); } }
@keyframes agDraw { 0% { stroke-dashoffset: 26; } 55%, 100% { stroke-dashoffset: 0; } }
@keyframes agScan { 0%, 100% { transform: translateY(-2.5px); } 50% { transform: translateY(2.5px); } }
@keyframes agBlink { 0%, 55% { opacity: 1; } 56%, 100% { opacity: 0; } }
@keyframes agDot { 0%, 100% { opacity: 0.3; transform: translateY(0); } 40% { opacity: 1; transform: translateY(-2px); } }

html.ag-lock, html.ag-lock body { overflow: hidden; overscroll-behavior: none; }

/* Phones: full-screen chat. JS sets --ag-h / --ag-top from the visual viewport so the keyboard never covers the composer. */
@media (max-width: 720px) {
  .ag-panel {
    --ag-glass: rgb(14, 18, 38);
    --ag-glass-hover: rgb(14, 18, 38);
    left: 0; right: 0; bottom: auto; width: auto; border: 0; border-radius: 0;
    top: var(--ag-top, 0px); height: var(--ag-h, 100dvh);
    backdrop-filter: none; -webkit-backdrop-filter: none; box-shadow: none;
    padding-top: env(safe-area-inset-top);
  }
  .ag-panel.opening { animation-name: agOpenFull; }
  .ag-panel.closing { animation-name: agCloseFull; }
  .ag-head { flex: none; border-bottom: 1px solid var(--ag-border); }
  .ag-head-main { padding: 14px 6px 14px 16px; }
  .ag-close { width: 40px; height: 40px; margin-right: 8px; border-radius: 12px; opacity: 0.85; }
  .ag-hbtn { width: 40px; height: 40px; border-radius: 12px; opacity: 0.85; }
  .ag-history, .ag-briefs { flex: 1; height: auto; max-height: none; padding: 12px 16px 16px; }
  .ag-hist-main { padding: 12px 4px 12px 14px; }
  .ag-hist-title { font-size: 14.5px; }
  .ag-body { flex: 1; min-height: 0; grid-template-rows: 1fr; }
  .ag-body-inner { height: 100%; }
  .ag-scroll { flex: 1; max-height: none; padding: 14px 16px; overscroll-behavior: contain; }
  .ag-text, .ag-bubble { font-size: 14.5px; }
  .ag-step { font-size: 13.5px; }
  .ag-chip { font-size: 13.5px; padding: 8px 14px 8px 12px; }
  .ag-compose { flex: none; margin: 0 12px calc(12px + env(safe-area-inset-bottom)); padding: 6px 6px 6px 16px; }
  .ag-panel.kb .ag-compose { margin-bottom: 10px; }
  /* 16px stops iOS from zooming the page when the field is focused. */
  .ag-input { font-size: 16px; }
  .ag-send { width: 36px; height: 36px; }
  .ag-dock { right: 14px; bottom: calc(14px + env(safe-area-inset-bottom)); }
}
@media (max-width: 720px) { .ag-fullbtn { display: none; } }
@media (max-width: 480px) { .ag-pill { display: none; } }
@media (hover: none) { .ag-hist-del { opacity: 0.7; } }
@keyframes agOpenFull { from { opacity: 0; transform: scale(0.1); border-radius: 60px; } 35% { opacity: 1; } to { opacity: 1; transform: none; border-radius: 0; } }
@keyframes agCloseFull { from { opacity: 1; transform: none; border-radius: 0; } to { opacity: 0; transform: scale(0.1); border-radius: 60px; } }
@media (prefers-reduced-motion: reduce) {
  .ag-dock, .ag-dock *, .ag-panel, .ag-panel * { animation-duration: 1ms !important; animation-iteration-count: 1 !important; transition-duration: 1ms !important; }
}

/* ── Voice messages ─────────────────────────────────────────────────────── */
.ag-compose.has-voice { position: relative; }
.ag-mic { width: 28px; height: 28px; flex: none; border-radius: 50%; display: grid; place-items: center; color: var(--ag-fg-soft); touch-action: none; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; transition: color 200ms ease, background 200ms ease; }
.ag-mic:hover { color: var(--ag-fg); }
.ag-mic[hidden], .ag-send[hidden] { display: none; }
.ag-mic:disabled { opacity: 0.4; }
.ag-mic.active { color: #fff; background: #ff4d6d; transform: scale(1.5); }
.ag-mic:focus-visible { outline: 2px solid var(--ag-fg); outline-offset: 2px; }
.ag-panel.full .ag-mic { width: 34px; height: 34px; }
.ag-rec { position: absolute; inset: 0; right: 0; display: none; align-items: center; gap: 10px; padding: 0 48px 0 16px; border-radius: inherit; color: var(--ag-fg); font-size: 14px; pointer-events: none; }
.ag-compose.recording .ag-rec, .ag-compose.transcribing .ag-rec { display: flex; }
.ag-rec-dot { width: 10px; height: 10px; border-radius: 50%; background: #ff4d6d; animation: agRecPulse 1s ease-in-out infinite; }
.ag-rec-time { font-variant-numeric: tabular-nums; min-width: 34px; }
.ag-rec-hint { flex: 1; color: var(--ag-fg-soft); display: inline-flex; align-items: center; justify-content: center; white-space: nowrap; transform: translateX(var(--ag-slide, 0px)); opacity: calc(1 + var(--ag-slide, 0px) / 120px); }
.ag-rec-hint svg { transform: rotate(90deg); }
.ag-rec-btn { display: none; width: 32px; height: 32px; border-radius: 50%; place-items: center; color: var(--ag-fg-soft); pointer-events: auto; }
.ag-rec-btn.send { background: var(--ag-btn-bg); color: var(--ag-btn-fg); }
.ag-rec.locked .ag-rec-btn { display: grid; }
.ag-rec.locked .ag-rec-hint { visibility: hidden; }
.ag-compose.transcribing .ag-rec-dot { animation: none; background: var(--ag-fg-soft); }
.ag-compose.transcribing .ag-rec-time, .ag-compose.transcribing .ag-rec-btn { display: none; }
.ag-compose.transcribing .ag-rec-hint { visibility: visible; transform: none; opacity: 1; justify-content: flex-start; }
.ag-compose.transcribing .ag-rec-hint svg { display: none; }
.ag-compose.recording .ag-mic { position: relative; z-index: 2; }
.ag-compose.recording .ag-input, .ag-compose.transcribing .ag-input, .ag-compose.transcribing .ag-mic { visibility: hidden; }
@keyframes agRecPulse { 50% { opacity: 0.25; } }
@media (max-width: 720px) { .ag-mic { width: 36px; height: 36px; } .ag-rec-btn { width: 36px; height: 36px; } }
