/* Πάνελ «Βοηθός» (public/chat.js). Ήρεμο, πυκνό, 14px· μόνο tokens από το app.css. */

.cp-host { flex-direction: column; min-height: 0; }
.cp { display: flex; flex-direction: column; width: 100%; height: 100%; min-height: 0; background: var(--surface); }

/* Κεφαλίδα */
.cp-head { display: flex; align-items: center; justify-content: space-between; gap: var(--s-2); min-height: var(--top-h); padding: 0 var(--s-2) 0 var(--s-4); border-bottom: 1px solid var(--line); flex: none; }
.cp-title { display: flex; align-items: center; gap: var(--s-2); min-width: 0; }
.cp-title svg { color: var(--accent-ink); }
.cp-title h2 { font-size: var(--t-14); }
.cp-actions { display: flex; align-items: center; gap: var(--s-1); }
.cp-actions .btn.ghost { color: var(--ink-2); }
.cp-actions .btn.ghost:hover { color: var(--accent-ink); }
.cp-close { display: none; }
@media (max-width: 1279.98px) { .cp-close { display: inline-grid; } }

/* Συνομιλία */
.cp-log { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: var(--s-4); display: flex; flex-direction: column; gap: var(--s-4); scroll-behavior: auto; }
.cp-log:focus-visible { outline-offset: -2px; }
.cp-msg { display: flex; flex-direction: column; gap: var(--s-1); min-width: 0; }
.cp-msg.user { align-items: flex-end; }
.cp-bubble { max-width: 88%; padding: var(--s-2) var(--s-3); border-radius: var(--r-lg) var(--r-lg) var(--r-sm) var(--r-lg); background: var(--accent-soft); border: 1px solid var(--accent-line); color: var(--ink); white-space: pre-wrap; overflow-wrap: anywhere; font-size: var(--t-14); line-height: 1.5; }
.cp-msg.bot { align-items: stretch; }
.cp-body { font-size: var(--t-14); line-height: 1.55; color: var(--ink); overflow-wrap: anywhere; }
.cp-body.md > * + * { margin-top: var(--s-2); }
.cp-body.md h2, .cp-body.md h3, .cp-body.md h4 { font-size: var(--t-14); margin-top: var(--s-4); }
.cp-body.md h2:first-child, .cp-body.md h3:first-child, .cp-body.md h4:first-child { margin-top: 0; }
.cp-body.md ul, .cp-body.md ol { padding-left: var(--s-5); }
.cp-body.md li + li { margin-top: 2px; }
.cp-body.md a { font-weight: 600; }
.cp-body.md table { font-size: var(--t-12); overflow-wrap: normal; word-break: normal; hyphens: auto; }
.cp-body.md th { white-space: nowrap; }
.cp-body.md th, .cp-body.md td { padding: var(--s-1) var(--s-2); }
.cp-stream { white-space: pre-wrap; }
.is-pending .cp-stream:empty { display: none; }
.is-pending.has-text .cp-stream::after { content: ""; display: inline-block; width: 2px; height: 1em; margin-left: 2px; vertical-align: text-bottom; background: var(--accent); animation: cp-caret 1s steps(2, start) infinite; }
@keyframes cp-caret { to { visibility: hidden; } }

/* «Κοίταξα: Ημερολόγιο, Fireflies» */
.cp-tools { display: flex; align-items: center; flex-wrap: wrap; gap: var(--s-1) var(--s-2); color: var(--ink-3); font-size: var(--t-12); font-weight: 600; min-height: 22px; }
.cp-chips { display: contents; }
.cp-chip { display: inline-flex; align-items: center; gap: var(--s-1); height: 22px; padding: 0 var(--s-2); border-radius: var(--r-full); background: var(--sunken); border: 1px solid var(--line); color: var(--ink-2); font-weight: 600; }
.cp-chip svg { color: var(--ink-3); }
.cp-chip.is-write { background: var(--ok-soft); border-color: var(--ok-line); color: var(--ok); }
.cp-chip.is-write svg { color: var(--ok); }
.cp-spin { width: 12px; height: 12px; border-radius: 50%; border: 2px solid var(--accent); border-right-color: transparent; animation: spin .7s linear infinite; flex: none; }
.is-pending .cp-chip:last-child { animation: cp-in .2s var(--ease-out); }
@keyframes cp-in { from { opacity: 0; transform: translateY(2px); } }

.cp-meta { display: flex; gap: var(--s-2); margin-top: var(--s-1); }
.cp-copy { display: inline-flex; align-items: center; gap: var(--s-1); min-height: 28px; padding: 0 var(--s-2); margin-left: calc(-1 * var(--s-2)); border: 0; border-radius: var(--r-sm); background: transparent; color: var(--ink-3); font-size: var(--t-12); font-weight: 600; cursor: pointer; opacity: .7; }
.cp-msg.bot:hover .cp-copy, .cp-copy:focus-visible { opacity: 1; }
.cp-copy:hover { background: var(--sunken); color: var(--ink); }
@media (hover: none) { .cp-copy { opacity: 1; } }
.cp-stopped { color: var(--ink-3); font-size: var(--t-12); font-style: italic; }
.cp-msg.is-stopped .cp-body > p:last-child em { color: var(--ink-3); font-size: var(--t-12); }
.cp-err { display: flex; flex-direction: column; align-items: flex-start; gap: var(--s-2); }

/* Κενή / ανενεργή κατάσταση με προτάσεις */
.cp-empty { margin-top: auto; display: flex; flex-direction: column; align-items: flex-start; gap: var(--s-2); padding: var(--s-2) 0; color: var(--ink-2); }
.cp-empty > svg { width: 24px; height: 24px; color: var(--accent-ink); }
.cp-empty h3 { font-size: var(--t-16); }
.cp-empty p { color: var(--ink-3); max-width: 44ch; }
.cp-empty .btn { margin-top: var(--s-1); }
.cp-small { font-size: var(--t-12); }
.cp-suggest { list-style: none; margin: var(--s-2) 0 0; padding: 0; display: flex; flex-direction: column; gap: var(--s-2); width: 100%; }
.cp-sugg { width: 100%; text-align: left; min-height: 40px; padding: var(--s-2) var(--s-3); border: 1px solid var(--line-strong); border-radius: var(--r); background: var(--surface); color: var(--ink); font-weight: 600; font-size: var(--t-14); cursor: pointer; transition: background-color .15s var(--ease-out), border-color .15s var(--ease-out); }
.cp-sugg:hover { background: var(--accent-soft); border-color: var(--accent-line); color: var(--accent-ink); }
.cp-undo { display: flex; align-items: center; justify-content: space-between; gap: var(--s-2); padding: var(--s-1) var(--s-1) var(--s-1) var(--s-3); border-radius: var(--r); background: var(--sunken); color: var(--ink-2); font-size: var(--t-12); font-weight: 600; }
.cp-skel { display: flex; flex-direction: column; gap: var(--s-3); }

/* Φόρμα */
.cp-form { flex: none; padding: var(--s-3) var(--s-4) var(--s-2); border-top: 1px solid var(--line); background: var(--surface); }
.cp-box { display: flex; align-items: flex-end; gap: var(--s-2); padding: var(--s-1); border: 1px solid var(--line-strong); border-radius: var(--r-lg); background: var(--surface); }
.cp-box:focus-within { outline: 2px solid var(--accent); outline-offset: -1px; border-color: var(--accent); }
.cp-box textarea { flex: 1; min-height: 36px; max-height: 168px; padding: var(--s-2); border: 0; background: transparent; resize: none; line-height: 1.4; }
.cp-box textarea:focus { outline: none; }
.cp-box textarea[disabled] { background: transparent; cursor: not-allowed; }
.cp-send { width: 40px; min-height: 40px; padding: 0; flex: none; }
.cp-stop { flex: none; }
.cp-hint { margin-top: var(--s-1); color: var(--ink-3); font-size: var(--t-12); }
.cp.is-busy .cp-box { border-color: var(--accent-line); }

/* Κινητό / συρτάρι: μεγαλύτεροι στόχοι, 16px στο πεδίο (όχι zoom στο iOS) */
@media (max-width: 860px) {
  .cp-head { padding-left: var(--s-4); }
  .cp-actions .icon-btn { width: 44px; height: 44px; }
  .cp-actions .btn.sm { min-height: 44px; }
  .cp-send { width: 44px; min-height: 44px; }
  .cp-stop { min-height: 44px; }
  .cp-sugg { min-height: 44px; }
  .cp-hint { display: none; }
  .cp-form { padding-bottom: calc(var(--s-3) + env(safe-area-inset-bottom)); }
  .cp-expand { display: none; }
}

/* Πλήρης σελίδα /chat: δεν χρειάζεται το πλαϊνό πάνελ ούτε το κουμπί του */
.chat-page { max-width: 840px; }
.chat-full { display: flex; height: calc(100dvh - var(--top-h) - 176px); min-height: 440px; overflow: hidden; }
.chat-full .cp { border-radius: var(--r-lg); }
.chat-full .cp-head { min-height: 48px; }
.app:has([data-chat-full]) .chat-toggle { display: none; }
.app:has([data-chat-full]) > .chat-panel { display: none !important; }
.app:has([data-chat-full]).chat-open { grid-template-columns: var(--side-w) minmax(0, 1fr); }
.app:has([data-chat-full]).chat-open::after { display: none; }
@media (max-width: 860px) {
  .app:has([data-chat-full]).chat-open { grid-template-columns: minmax(0, 1fr); }
  .chat-full { height: calc(100dvh - var(--top-h) - 220px - env(safe-area-inset-bottom)); min-height: 360px; }
}

@media (prefers-reduced-motion: reduce) {
  .is-pending.has-text .cp-stream::after { animation: none; }
}
