.agent-dock {
  --agent-keyboard: 0px;
  --agent-charcoal: #414342;
  --agent-charcoal-hover: #515452;
  --agent-on-charcoal: #f5f5f1;
  position: fixed;
  z-index: 35;
  bottom: calc(18px + env(safe-area-inset-bottom) + var(--agent-keyboard));
  left: 50%;
  transform: translateX(-50%);
  width: min(360px, calc(100vw - 24px));
  color: var(--ink);
  font-size: 14px;
  line-height: 1.6;
}
.agent-dock[hidden], .agent-dock [hidden] { display: none !important; }
.agent-dock svg { width: 21px; height: 21px; flex: 0 0 auto; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.agent-composer { position: relative; display: flex; align-items: center; gap: 5px; min-height: 54px; padding: 6px 8px; border-radius: 28px; background: var(--agent-charcoal); color: var(--agent-on-charcoal); box-shadow: 0 6px 22px rgba(26, 31, 27, .17); }
.agent-toggle, .agent-send, .agent-icon-button { display: inline-flex; align-items: center; justify-content: center; flex: 0 0 auto; width: 42px; height: 42px; padding: 0; border: 0; border-radius: 12px; color: inherit; background: transparent; transition: background .16s ease; }
.agent-toggle, .agent-send { border-radius: 50%; }
.agent-toggle:hover { background: var(--agent-charcoal-hover); }
.agent-toggle svg { width: 22px; height: 22px; }
.agent-toggle .agent-brand-logo { width: 30px; height: 22px; }
.agent-input { display: block; flex: 1; min-width: 0; min-height: 42px; max-height: 126px; padding: 10px 0; border: 0; outline: 0; resize: none; overflow-y: auto; border-radius: 0; background: transparent; color: var(--agent-on-charcoal); font-size: 14px; line-height: 22px; caret-color: var(--agent-on-charcoal); box-shadow: none; scrollbar-color: #939793 transparent; }
.agent-input::placeholder { color: #daddd8; }
.agent-input:focus-visible { outline: 0; }
.agent-composer:focus-within { outline: 2px solid #7d827d; outline-offset: 3px; }
.agent-input::selection { color: #252925; background: #e0e5de; }
.agent-dock.is-working .agent-input { -webkit-text-fill-color: #daddd8; text-align: center; }
.agent-send { color: var(--agent-on-charcoal); }
.agent-send:hover:not(:disabled) { background: var(--agent-charcoal-hover); }
.agent-send:disabled { color: #a3a8a2; cursor: default; }
.agent-dock.is-working .agent-send { color: var(--agent-on-charcoal); }
.agent-composer button:focus-visible { outline-color: var(--agent-on-charcoal); outline-offset: 1px; }
.agent-mini-progress { display: flex; align-items: center; gap: 9px; position: relative; width: calc(100% - 28px); min-height: 42px; margin: 0 auto -8px; padding: 8px 13px 14px; border: 0; border-radius: 17px 17px 0 0; background: #626662; color: #f5f6f1; text-align: left; font-size: 12px; line-height: 18px; }
.agent-mini-progress:hover { background: #585d58; }
.agent-mini-progress svg { width: 16px; height: 16px; }
.agent-mini-progress svg:last-child { width: 14px; height: 14px; }
.agent-mini-progress .agent-brand-logo { width: 21px; height: 14px; }
.agent-mini-progress:focus-visible { outline: 2px solid #aab3a8; outline-offset: 3px; }
.agent-mini-status { display: block; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.agent-panel { position: absolute; left: 50%; bottom: calc(100% + 10px); transform: translateX(-50%); width: min(690px, calc(100vw - 28px)); margin: 0; max-height: min(650px, var(--agent-available-height, calc(100dvh - 136px))); display: flex; flex-direction: column; background: var(--paper); border-radius: 16px; box-shadow: 0 16px 60px rgba(40, 65, 51, .2); overflow: hidden; animation: agentReveal .22s cubic-bezier(.16, 1, .3, 1); }
.agent-header { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 18px 20px 16px; border-bottom: 1px solid var(--line); }
.agent-heading { min-width: 0; }
.agent-heading h2 { margin: 0; font-size: 18px; font-weight: 650; letter-spacing: -.02em; }
.agent-heading p { margin: 3px 0 0; color: var(--muted); font-size: 12px; }
.agent-header-actions { display: flex; align-items: center; gap: 1px; }
.agent-icon-button { color: var(--muted); }
.agent-icon-button:hover:not(:disabled) { color: var(--accent); background: var(--sage); }
.agent-icon-button:disabled { opacity: .5; cursor: default; }
.agent-transcript { min-height: 180px; overflow: auto; overscroll-behavior: contain; scrollbar-gutter: stable; padding: 24px 22px; flex: 1; }
.agent-empty { padding: 10px 0 18px; }
.agent-empty > strong { display: block; font-size: 21px; font-weight: 600; line-height: 1.4; }
.agent-empty > p { margin: 12px 0 22px; color: var(--muted); max-width: 45ch; }
.agent-example { display: block; text-align: left; padding: 12px 14px; border: 1px solid var(--line-strong); border-radius: 10px; color: var(--accent); background: transparent; font-size: 13px; line-height: 1.6; }
.agent-example:hover { background: var(--surface-subtle); border-color: var(--accent); }
.agent-message + .agent-message { margin-top: 27px; }
.agent-message { max-width: 75ch; }
.agent-speaker { display: block; margin-bottom: 7px; color: var(--muted); font-size: 11px; font-weight: 600; }
.agent-message-user { padding: 12px 15px; border-radius: 12px; background: var(--sage); }
.agent-message-text { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.agent-message-text + .agent-message-text, .agent-message-text + .agent-table-wrap { margin-top: 12px; }
.agent-code { margin: 12px 0; padding: 12px; background: var(--surface-subtle); overflow: auto; font-size: 12px; border-radius: 8px; }
.agent-table-wrap { max-width: 100%; overflow-x: auto; margin: 12px 0; }
.agent-table { width: 100%; border-collapse: collapse; font-size: 12px; font-variant-numeric: tabular-nums; text-align: left; }
.agent-table th { color: var(--ink-2); background: var(--surface-subtle); font-weight: 600; }
.agent-table th, .agent-table td { padding: 9px 11px; min-width: 90px; max-width: 250px; vertical-align: top; border-bottom: 1px solid var(--line); overflow-wrap: anywhere; }
.agent-files { display: grid; gap: 10px; margin-top: 20px; }
.agent-file { display: flex; gap: 13px; align-items: center; width: 100%; padding: 13px 15px; text-align: left; border: 1px solid var(--line-strong); border-radius: 10px; background: transparent; color: var(--accent); }
.agent-file:hover:not(:disabled) { background: var(--surface-subtle); border-color: var(--accent); }
.agent-file:disabled { cursor: wait; opacity: .65; }
.agent-file-detail { min-width: 0; }
.agent-file strong { display: block; font-size: 13px; font-weight: 600; overflow-wrap: anywhere; }
.agent-file small { display: block; margin-top: 2px; font-size: 11px; color: var(--muted); }
.agent-feedback { padding: 0 22px 16px; flex: 0 0 auto; }
.agent-status { margin: 0; color: var(--muted); font-size: 12px; line-height: 1.6; overflow-wrap: anywhere; }
.agent-status:empty { display: none; }
.agent-feedback.is-error .agent-status { color: #924736; }
.agent-text-button { min-height: 36px; padding: 4px 0; border: 0; background: transparent; color: var(--accent); text-decoration: underline; text-underline-offset: 4px; font-size: 12px; }
.agent-authorize { display: inline-flex; gap: 8px; align-items: center; min-height: 40px; margin-top: 10px; padding: 8px 13px; border: 0; border-radius: 9px; background: var(--accent); color: var(--on-accent); font-size: 13px; }
.agent-authorize:hover:not(:disabled) { background: var(--accent-hover); }
.agent-authorize:disabled { cursor: wait; opacity: .6; }
.agent-locked { color: var(--muted); padding: 20px 0; margin: 0; }
@keyframes agentReveal { from { transform: translate(-50%, 8px); clip-path: inset(5% 0 0 round 16px); } to { transform: translate(-50%, 0); clip-path: inset(0 round 16px); } }
@media (max-width: 820px) {
  .agent-dock { bottom: calc(12px + env(safe-area-inset-bottom) + var(--agent-keyboard)); }
}
@media (max-width: 560px) {
  .agent-composer { min-height: 54px; gap: 4px; padding: 6px 7px; }
  .agent-input { font-size: 16px; }
  .agent-toggle, .agent-send, .agent-icon-button { width: 40px; height: 40px; }
  .agent-header { padding: 14px 14px 12px; gap: 5px; }
  .agent-heading h2 { font-size: 17px; }
  .agent-heading p { font-size: 11px; }
  .agent-transcript { padding: 19px 15px; min-height: 90px; }
  .agent-empty > strong { font-size: 19px; }
  .agent-feedback { padding: 0 15px 14px; }
  .agent-panel { bottom: calc(100% + 8px); }
}
@media (prefers-reduced-motion: reduce) { .agent-panel { animation: none; } .agent-dock button { transition: none; } }

/* Attachments and private operation input extend the existing dock. */
.agent-attach { display: inline-flex; align-items: center; justify-content: center; flex: 0 0 auto; width: 34px; height: 42px; padding: 0; border: 0; border-radius: 12px; color: var(--agent-on-charcoal); background: transparent; }
.agent-attach:hover:not(:disabled) { background: var(--agent-charcoal-hover); }
.agent-attach:disabled { color: #a3a8a2; cursor: default; }
.agent-attach svg { width: 19px; height: 19px; }
.agent-uploads { display: grid; gap: 5px; max-height: 136px; overflow: auto; padding: 0 22px 12px; }
.agent-upload-item { display: flex; align-items: center; gap: 8px; min-width: 0; color: var(--ink-2); background: var(--surface-subtle); border-radius: 8px; padding: 3px 8px; font-size: 12px; }
.agent-upload-item > svg { width: 16px; height: 16px; }
.agent-upload-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.agent-upload-remove { display: flex; align-items: center; justify-content: center; flex: 0 0 auto; width: 36px; height: 36px; padding: 0; border: 0; border-radius: 7px; background: transparent; color: var(--muted); }
.agent-upload-remove:hover:not(:disabled) { color: var(--ink); background: var(--sage); }
.agent-upload-remove:disabled { opacity: .5; }
.agent-secure-dialog { box-sizing: border-box; position: fixed; inset: 0; margin: auto; width: min(460px, calc(100vw - 28px)); max-height: min(740px, calc(100dvh - 32px)); overflow: auto; border: 0; padding: 24px; border-radius: 16px; color: var(--ink); background: var(--paper); box-shadow: 0 18px 64px rgba(26,31,27,.25); }
.agent-secure-dialog:not([open]) { display: none; }
.agent-secure-dialog::backdrop { background: rgba(20,29,24,.45); }
.agent-secure-form h3 { margin: 0; font-size: 18px; line-height: 1.5; overflow-wrap: anywhere; }
.agent-secure-hint { margin: 8px 0 20px; font-size: 13px; color: var(--muted); line-height: 1.6; }
.agent-secure-field { display: grid; gap: 7px; margin-top: 16px; font-size: 14px; overflow-wrap: anywhere; }
.agent-secure-input { box-sizing: border-box; width: 100%; min-width: 0; min-height: 44px; padding: 10px 12px; border: 1px solid var(--line-strong); border-radius: 8px; background: var(--paper); color: var(--ink); font: inherit; font-size: 16px; resize: vertical; }
.agent-secure-input:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.agent-secure-error { color: #924736; font-size: 13px; line-height: 1.5; }
.agent-secure-error:empty { display: none; }
.agent-secure-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 24px; }
.agent-secure-cancel, .agent-secure-submit { min-height: 42px; padding: 9px 16px; border-radius: 9px; font: inherit; font-size: 14px; }
.agent-secure-cancel { border: 1px solid var(--line-strong); background: transparent; color: var(--ink); }
.agent-secure-submit { border: 0; background: var(--accent); color: var(--on-accent); }
.agent-secure-submit:hover { background: var(--accent-hover); }
@media (max-width: 560px) { .agent-uploads { padding-inline: 15px; } .agent-secure-dialog { padding: 20px; } }
