/* Private AI product visuals: a full-height chat with a fixed composer. Only the conversation scrolls. */
/* --pai-top is the measured offset of the app below the site header (set by entry.js). */
.pai-app {
  --pai-top: 120px;
  display: flex; flex-direction: column; min-width: 0;
  height: calc(100dvh - var(--pai-top)); min-height: 360px; overflow: hidden;
  padding-bottom: env(safe-area-inset-bottom, 0px);
}
.pai-bar { display: flex; align-items: center; justify-content: flex-end; gap: 8px; padding: 2px 4px; flex: 0 0 auto; }
.pai-title { margin: 0; font-weight: 600; font-size: 1rem; }
.pai-bar-actions { display: flex; gap: 4px; }
.pai-icon-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 40px; height: 40px; min-width: 40px; border-radius: 999px; padding: 0;
  border: 1px solid transparent; background: transparent; color: inherit; cursor: pointer;
}
.pai-icon-btn svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.pai-icon-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.pai-icon-btn:disabled { opacity: .4; cursor: default; }
.pai-send, .pai-stop { background: var(--accent); color: var(--on-accent, #fff); }
.pai-send:disabled { opacity: .35; }
.pai-status { margin: 0; font-size: .85rem; opacity: .75; min-height: 0; flex: 0 0 auto; }
.pai-status:empty { display: none; }
.pai-chat { display: flex; flex-direction: column; flex: 1 1 auto; min-height: 0; }
.pai-log {
  flex: 1 1 auto; min-height: 0; overflow-y: auto; overscroll-behavior: contain;
  display: flex; flex-direction: column; gap: 14px; padding: 8px 4px; -webkit-overflow-scrolling: touch;
}
.pai-msg { display: grid; gap: 4px; max-width: 100%; }
.pai-who { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.pai-user { justify-items: end; }
.pai-user .pai-body { background: var(--surface-2, rgba(127,127,127,.12)); border-radius: 18px; padding: 9px 14px; max-width: 85%; white-space: pre-wrap; overflow-wrap: anywhere; }
.pai-assistant .pai-body { max-width: 100%; overflow-wrap: anywhere; }
.pai-markdown pre { overflow-x: auto; max-width: 100%; }
.pai-markdown table { display: block; overflow-x: auto; max-width: 100%; }
.pai-error { color: var(--danger, #b00020); }
.pai-sources details { font-size: .9rem; }
.pai-sources summary { cursor: pointer; opacity: .8; }
.pai-sources ol { padding-left: 1.2em; display: grid; gap: 4px; }
.pai-sources a { overflow-wrap: anywhere; }
.pai-composer { flex: 0 0 auto; display: grid; gap: 4px; padding: 6px 0 4px; }
.pai-composer-row { display: flex; align-items: flex-end; gap: 6px; border: 1px solid var(--border, rgba(127,127,127,.3)); border-radius: 24px; padding: 4px 6px; }
.pai-input {
  flex: 1 1 auto; min-width: 0; resize: none; max-height: 40vh; min-height: 40px;
  border: 0; background: transparent; color: inherit; font: inherit; line-height: 1.4; padding: 9px 4px; outline: none;
}
.pai-attach { position: relative; overflow: hidden; cursor: pointer; }
.pai-attach input[type="file"] { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.pai-doc { margin: 0; font-size: .85rem; opacity: .75; }
.pai-doc:empty { display: none; }
.pai-link { justify-self: start; border: 0; background: none; color: inherit; text-decoration: underline; font-size: .85rem; padding: 0; cursor: pointer; }
.pai-sheet { width: min(560px, calc(100vw - 16px)); max-height: 85dvh; padding: 0; border-radius: 16px; border: 1px solid var(--border, rgba(127,127,127,.3)); }
.pai-sheet::backdrop { background: rgba(0,0,0,.45); }
.pai-sheet-head { display: flex; align-items: center; justify-content: space-between; padding: 12px 14px 4px; }
.pai-sheet-panel { display: grid; gap: 10px; padding: 10px 14px 16px; }
.pai-tabs { display: flex; gap: 6px; flex-wrap: wrap; padding: 0 14px; }
.pai-tab { border: 1px solid var(--border, rgba(127,127,127,.3)); background: transparent; color: inherit; border-radius: 999px; padding: 6px 12px; cursor: pointer; font: inherit; font-size: .9rem; }
.pai-tab[aria-selected="true"] { border-color: var(--accent); color: var(--accent); }
.pai-chat-list, .pai-models { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
.pai-chat-list li { display: flex; gap: 8px; align-items: center; }
.pai-chat-list li .btn-secondary { flex: 1; justify-content: flex-start; text-align: left; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.pai-model { display: grid; gap: 4px; padding: 10px 12px; border: 1px solid var(--border, rgba(127,127,127,.3)); border-radius: 12px; }
.pai-model.is-selected { border-color: var(--accent); }
.pai-model .hint { margin: 0; }
