/* Context-menu assistant: "Assistant ▸" and its chat flyout, a compact view of the SAME
   conversation as the chat panel, re-sizing its chat-* classes. On coarse pointers the entry
   is plain (.ctx-assist-plain) and opens the panel instead. */
.ctx-assist-sub { padding: 6px 0; }
.ctx-assist-plain .ctx-arrow { display: none; }
.ctx-assist-plain > .ctx-sub { display: none !important; }
.ctx-assist {
    /* Wide enough for the panel's action row next to a usable composer. */
    width: 316px;
    max-width: calc(100vw - 40px);
    box-sizing: border-box;
    padding: 2px 12px 4px;
    /* A fixed tall height; the transcript flexes into what the composer and chips leave, else it
       sits at its floor. */
    display: flex;
    flex-direction: column;
    height: min(72vh, 600px);
    /* The menu is user-select:none; chat text (and the input) must be selectable. */
    user-select: text;
}
.ctx-assist-transcript {
    display: flex;
    flex-direction: column;
    gap: 6px;
    /* Never under 300px; flex-basis 0 so the composer and chips are subtracted, not squeezed. */
    flex: 1 1 0;
    min-height: 300px;
    max-height: min(60vh, 520px);
    overflow-y: auto;
    overscroll-behavior: contain;
}
.ctx-assist .chat-msg { font-size: 13px; max-width: 92%; }
.ctx-assist .chat-empty { padding: 2px 0 0; gap: 4px; }
.ctx-assist .chat-suggest { font-size: 12px; padding: 4px 9px; }
.ctx-assist .chat-results { gap: 6px; }
.ctx-assist .chat-result { padding: 4px 5px; gap: 4px; }
.ctx-assist .chat-result-thumb { width: 34px; height: 34px; }
.ctx-assist .chat-result-label { max-width: 78px; }
.ctx-assist .chat-attached { gap: 4px; }
.ctx-assist .chat-attached-thumb { width: 44px; height: 44px; }
.ctx-assist .chat-config-cta, .ctx-assist .chat-retry-cta,
.ctx-assist .chat-reconnect-cta { font-size: 12px; padding: 3px 8px; }
/* display:flex, NOT none: the renderer hides the row with an inline display:none and shows it
   by clearing that value, which must fall back to a visible one. */
.ctx-assist-attachments { display: flex; flex-wrap: wrap; gap: 5px; --chip-gap: 5px; padding: 6px 0 0; }
.ctx-assist-attachments .chat-attach-name { max-width: 108px; }
.ctx-assist-sizer { flex: 0 0 auto; height: 8px; position: relative; cursor: ns-resize; touch-action: none; user-select: none; }
/* The handle sits above the input only, so its pill centres on the textarea. */
.ctx-assist-inputcol { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; }
.ctx-assist-row { display: flex; align-items: flex-end; gap: 6px; padding-top: 2px; }
.ctx-assist-actions {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    flex: 0 0 auto;
    flex-wrap: nowrap;
    align-self: flex-end;
    padding-bottom: 2px;
}
#ctx-assist-input {
    flex: 1 1 auto;
    min-width: 0;
    resize: none;
    /* Two rows minimum for the placeholder. A percentage cap would resolve against the
       content-sized row and pin the input to ~60% of the drag. */
    min-height: 44px;
    max-height: 200px;
    padding: 6px 8px;
    font-family: inherit;
    font-size: 13px;
    line-height: 1.35;
    border: 1px solid var(--border-main);
    border-radius: 6px;
    background-color: var(--input-bg);   /* not the shorthand — keeps the hover sweep sizing */
    color: var(--input-text);
    transition: border-color 0.18s ease, box-shadow 0.18s ease;
}
#ctx-assist-input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 25%, transparent);
}

/* Hotkey hint shown on a ctx item: a fixed-width flex item, so it and a trailing arrow share one right edge. */
.ctx-hotkey {
    flex: 0 0 auto;
    font-size: 11px;
    color: var(--text-shortcut);
    white-space: nowrap;
    padding-left: 10px;
}
/* One shake per hover (no `infinite`), key by key; `>` scopes it to the row's own hotkey. */
.ctx-item:hover > .ctx-hotkey .tip-key, .ctx-item.ctx-kb > .ctx-hotkey .tip-key, .accent-dd-opt:hover > .ctx-hotkey .tip-key {
    animation: keycapShake 0.32s cubic-bezier(0.36, 0.07, 0.19, 0.97) both;
}
@media (prefers-reduced-motion: reduce) {
    .ctx-item:hover > .ctx-hotkey .tip-key, .ctx-item.ctx-kb > .ctx-hotkey .tip-key, .accent-dd-opt:hover > .ctx-hotkey .tip-key { animation: none; }
}
