/* ------------------------------------------------------------------
   KIWA bot — shared styles for the slide-up widget (index) and the
   full-width /talk page. Every colour and font comes from the :root
   tokens defined on each page. No new colours.
   ------------------------------------------------------------------ */

/* ---------- chat column ---------- */
.kiwa-chat {
  background: var(--salt);
  border: 1px solid var(--pan-edge);
  display: flex;
  flex-direction: column;
  min-height: 0;
  flex: 1;
}
.kiwa-chat-top {
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--pan-edge);
  display: flex;
  align-items: center;
  gap: 0.75rem;
}
.kiwa-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--brine); flex: none; }
.kiwa-chat-top h1 { font-family: var(--display); font-weight: 800; font-size: 1rem; margin: 0; letter-spacing: -0.01em; }
.kiwa-chat-top p { margin: 0.1rem 0 0; font-size: 0.74rem; color: var(--you); font-family: var(--data); }

.kiwa-log { flex: 1; overflow-y: auto; padding: 1.5rem 1.25rem; display: flex; flex-direction: column; gap: 1rem; }

.kiwa-msg { max-width: 80%; padding: 0.75rem 1rem; font-size: 0.95rem; line-height: 1.55; white-space: pre-wrap; }
.kiwa-msg.bot { background: var(--pan); align-self: flex-start; border: 1px solid var(--pan-edge); }
.kiwa-msg.me { background: var(--brine); color: var(--salt); align-self: flex-end; }

.kiwa-typing { align-self: flex-start; display: flex; gap: 4px; padding: 0.9rem 1rem; background: var(--pan); border: 1px solid var(--pan-edge); }
.kiwa-typing i { width: 6px; height: 6px; border-radius: 50%; background: var(--you); animation: kiwa-blink 1.2s infinite; }
.kiwa-typing i:nth-child(2) { animation-delay: 0.2s; }
.kiwa-typing i:nth-child(3) { animation-delay: 0.4s; }
@keyframes kiwa-blink { 0%, 60%, 100% { opacity: 0.25; } 30% { opacity: 1; } }

.kiwa-compose { border-top: 1px solid var(--pan-edge); padding: 0.85rem; display: flex; gap: 0.6rem; }
.kiwa-compose textarea {
  flex: 1; resize: none; border: 1px solid var(--pan-edge); padding: 0.7rem 0.85rem;
  font-family: var(--body); font-size: 0.95rem; line-height: 1.4; height: 2.9rem; max-height: 8rem;
  background: var(--pan); color: var(--rock);
}
.kiwa-compose textarea:focus { border-color: var(--brine); background: var(--salt); }
.kiwa-send {
  border: 1px solid var(--brine); background: var(--brine); color: var(--salt);
  font-family: var(--body); font-weight: 600; font-size: 0.9rem; padding: 0 1.1rem; cursor: pointer;
}
.kiwa-send:hover:not(:disabled) { background: #0b4b45; }
.kiwa-send:disabled { opacity: 0.4; cursor: not-allowed; }

.kiwa-disclose { padding: 0.55rem 1.25rem; border-top: 1px solid var(--pan-edge); font-family: var(--data); font-size: 0.66rem; color: var(--you); }

/* ---------- live qualification panel ---------- */
.kiwa-panel { background: var(--salt); border: 1px solid var(--pan-edge); padding: 1.25rem; overflow-y: auto; }
.kiwa-panel h2 { font-family: var(--display); font-weight: 800; font-size: 0.95rem; margin: 0 0 0.25rem; }
.kiwa-panel .kiwa-hint { font-family: var(--data); font-size: 0.65rem; color: var(--you); margin: 0 0 1.1rem; line-height: 1.5; }

.kiwa-row { padding: 0.6rem 0; border-top: 1px dashed var(--pan-edge); }
.kiwa-row .k { font-family: var(--data); font-size: 0.62rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--you); }
.kiwa-row .v { font-size: 0.85rem; margin-top: 0.15rem; line-height: 1.4; color: var(--you); font-style: italic; }
.kiwa-row.filled .v { color: var(--rock); font-style: normal; }
.kiwa-row.filled .k { color: var(--brine); }

.kiwa-verdict { margin-top: 1rem; padding: 0.75rem 0.85rem; font-size: 0.8rem; line-height: 1.45; background: var(--pan); border-left: 3px solid var(--you); }
.kiwa-verdict.good { background: var(--brine-lo); border-left-color: var(--brine); }
.kiwa-verdict.bad { background: #f3e6e2; border-left-color: #9c5b44; }

/* ---------- consent (GDPR) ---------- */
.kiwa-consent { margin-top: 1rem; padding-top: 1rem; border-top: 1px dashed var(--pan-edge); display: flex; gap: 0.6rem; align-items: flex-start; }
.kiwa-consent input { accent-color: var(--brine); width: 1.05rem; height: 1.05rem; margin: 0.15rem 0 0; flex: none; }
.kiwa-consent label { font-size: 0.72rem; line-height: 1.5; color: var(--rock-soft); }
.kiwa-consent a { color: var(--brine); }

/* ---------- widget launcher (index only) ---------- */
.kiwa-launcher {
  position: fixed; bottom: 1.25rem; right: 1.25rem; z-index: 60;
  display: inline-flex; align-items: center; gap: 0.55rem;
  border: 1px solid var(--brine); background: var(--brine); color: var(--salt);
  font-family: var(--body); font-weight: 600; font-size: 0.95rem;
  padding: 0.8rem 1.2rem; border-radius: 2px; cursor: pointer;
  box-shadow: 0 6px 20px rgba(15, 95, 87, 0.28);
  transition: background 0.15s ease, transform 0.15s ease;
}
.kiwa-launcher:hover { background: #0b4b45; }
.kiwa-launcher .kiwa-dot { background: var(--salt); }
.kiwa-launcher[hidden] { display: none; }

/* ---------- widget panel (index only) ---------- */
.kiwa-widget {
  position: fixed; bottom: 1.25rem; right: 1.25rem; z-index: 61;
  width: min(400px, calc(100vw - 2rem));
  height: min(78vh, 640px);
  display: flex; flex-direction: column;
  background: var(--salt); border: 1px solid var(--pan-edge);
  box-shadow: 0 18px 50px rgba(35, 38, 43, 0.28);
  opacity: 0; transform: translateY(12px) scale(0.99); pointer-events: none;
  transition: opacity 0.22s ease, transform 0.22s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.kiwa-widget.open { opacity: 1; transform: none; pointer-events: auto; }
.kiwa-widget-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 0.65rem 0.65rem 0.65rem 1rem; border-bottom: 1px solid var(--pan-edge);
}
.kiwa-tabs { display: flex; gap: 0.25rem; }
.kiwa-tab {
  border: 1px solid var(--pan-edge); background: transparent; color: var(--rock-soft);
  font-family: var(--data); font-size: 0.62rem; letter-spacing: 0.06em; text-transform: uppercase;
  padding: 0.4rem 0.6rem; cursor: pointer;
}
.kiwa-tab[aria-selected='true'] { background: var(--brine-lo); color: var(--brine); border-color: var(--brine); }
.kiwa-close {
  border: none; background: transparent; color: var(--rock-soft);
  font-size: 1.3rem; line-height: 1; padding: 0.25rem 0.5rem; cursor: pointer;
}
.kiwa-close:hover { color: var(--rock); }

.kiwa-widget .kiwa-panes { flex: 1; min-height: 0; display: flex; }
.kiwa-widget .kiwa-pane { flex: 1; min-height: 0; display: none; }
.kiwa-widget .kiwa-pane.active { display: flex; flex-direction: column; }
.kiwa-widget .kiwa-chat { border: none; }
.kiwa-widget .kiwa-panel { border: none; }

/* ---------- full-width /talk page ---------- */
.kiwa-page-shell { width: min(1140px, calc(100% - 2rem)); margin: 2rem auto; }
.kiwa-page-head { display: flex; align-items: baseline; gap: 0.6rem; margin-bottom: 1.25rem; }
.kiwa-page-head b { font-family: var(--display); font-weight: 800; font-size: 1.5rem; letter-spacing: -0.03em; }
.kiwa-page-head span { font-family: var(--data); font-size: 0.7rem; letter-spacing: 0.14em; text-transform: uppercase; color: var(--rock-soft); }
.kiwa-grid { display: grid; grid-template-columns: 1fr 20rem; gap: 1rem; align-items: start; }
.kiwa-page .kiwa-chat { height: min(78vh, 760px); }
.kiwa-page .kiwa-panel { position: sticky; top: 1rem; max-height: min(78vh, 760px); }
.kiwa-page .kiwa-tabs, .kiwa-page .kiwa-widget-head { display: none; }

@media (max-width: 900px) {
  .kiwa-grid { grid-template-columns: 1fr; }
  .kiwa-page .kiwa-panel { position: static; }
  .kiwa-page .kiwa-chat { height: 70vh; }
}
@media (max-width: 520px) {
  .kiwa-widget, .kiwa-launcher { bottom: 0; right: 0; }
  .kiwa-widget { width: 100vw; height: 100dvh; border: none; }
  .kiwa-launcher { border-radius: 2px 0 0 0; }
}

@media (prefers-reduced-motion: reduce) {
  .kiwa-widget, .kiwa-launcher { transition: none; }
}
