/* Kavvi Files - the file card in chat, and the "New" badge on the skill chip (2026-10-06).
   Colours come from the app's --kv-* tokens (light and dark); the green is Kavvi's. */
/* The card says it all: the message's text line ("Your file is ready...", kept for copy and
   search) and the thinking dots are hidden, live and after a reload alike - as for answer cards. */
.message-body:has(> .kv-file-slot) > .message-content,
.message-body:has(.kv-file-slot) .kavvi-thinking-indicator { display: none !important; }
.kv-file-slot { display: block; margin: 10px 0 4px; max-width: 560px; }
.kvf {
  --kvf-green: #2f9e74; --kvf-deep: #11392d; --kvf-mint: #7de3b8;
  display: flex; gap: 16px; align-items: stretch; padding: 14px; border-radius: 20px;
  background: var(--kv-card, #fff); color: var(--kv-text, #0d2a21);
  border: 1px solid var(--kv-line, rgba(13, 42, 33, .12));
  box-shadow: 0 10px 30px -18px rgba(8, 40, 30, .45);
}
.kvf__body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 5px; justify-content: center; }
.kvf__eyebrow { display: inline-flex; align-items: center; gap: 6px; color: var(--kvf-green); font-size: 12px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; }
:lang(ar) .kvf__eyebrow, .kvf:lang(ar) .kvf__eyebrow { letter-spacing: 0; text-transform: none; font-size: 13px; }
.kvf__title { font-size: 17px; line-height: 1.3; font-weight: 800; overflow-wrap: anywhere; }
.kvf__sub { color: var(--kv-text-muted, #5b6f66); font-size: 13.5px; line-height: 1.45; }
.kvf__facts { color: var(--kv-text-muted, #5b6f66); font-size: 12.5px; font-weight: 600; }

/* the page-one preview, on a little stack of paper */
.kvf__thumb { position: relative; flex: none; align-self: center; width: 112px; height: auto; aspect-ratio: 210 / 297; display: block; margin: 4px 6px 4px 2px; }
.kvf__thumb img, .kvf__sheet { position: absolute; inset: 0; border-radius: 6px; background: #fff; box-shadow: 0 1px 2px rgba(0,0,0,.12), 0 8px 18px -10px rgba(8, 40, 30, .45); }
.kvf__thumb img { width: 100%; height: 100%; object-fit: cover; object-position: top; border: 1px solid rgba(13, 42, 33, .1); transition: transform .25s ease; }
.kvf__sheet--2 { transform: rotate(3.5deg) translate(4px, 2px); background: #f3f7f5; }
.kvf__sheet--3 { transform: rotate(-3deg) translate(-3px, 3px); background: #e8f1ec; }
.kvf__thumb:hover img { transform: translateY(-3px) rotate(-1deg); }
.kvf__thumb.no-img img { visibility: hidden; }
.kvf__thumb.no-img::after { content: 'PDF'; position: absolute; inset: 0; display: grid; place-items: center; color: var(--kvf-green); font-weight: 800; letter-spacing: .08em; }

.kvf__actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.kvf__btn {
  display: inline-flex; align-items: center; gap: 7px; min-height: 38px; padding: 0 14px; border-radius: 999px;
  border: 1px solid var(--kv-line, rgba(13, 42, 33, .16)); background: transparent; color: inherit;
  font: inherit; font-size: 14px; font-weight: 700; text-decoration: none; cursor: pointer;
}
.kvf__btn:hover { border-color: var(--kvf-green); color: var(--kvf-green); }
.kvf__btn--main { background: var(--kvf-deep); border-color: var(--kvf-deep); color: #fff; }
.kvf__btn--main svg { color: var(--kvf-mint); }
.kvf__btn--main:hover { background: #15473a; color: #fff; }
.kvf__btn:disabled { opacity: .6; cursor: progress; }
.kvf__quota { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; margin-top: 6px; color: var(--kv-text-muted, #5b6f66); font-size: 12.5px; }
.kvf__trust { margin-top: 8px; padding: 8px 10px; border-radius: 12px; font-size: 13px; line-height: 1.45; }
.kvf__trust--ok { background: rgba(47, 158, 116, .1); color: #1f7a54; font-weight: 700; }
.kvf__trust--warn { background: rgba(201, 130, 31, .12); color: var(--kv-text, #0d2a21); }
.kvf__trust--warn b { color: #a0650f; }
.kvf__trust .kvf__pro { margin-top: 4px; }
.kvf__pro { display: inline-flex; align-items: center; gap: 5px; color: var(--kvf-green); font-weight: 700; text-decoration: none; }

/* building: a sheet that writes itself */
.kvf--pending { align-items: center; }
.kvf__paper { position: relative; flex: none; align-self: center; width: 64px; aspect-ratio: 210 / 297; border-radius: 6px; background: #fff; border: 1px solid rgba(13, 42, 33, .12); box-shadow: 0 8px 18px -10px rgba(8, 40, 30, .45); overflow: hidden; padding: 9px 7px; display: flex; flex-direction: column; gap: 6px; }
.kvf__paper b { height: 7px; width: 70%; border-radius: 3px; background: var(--kvf-deep); order: -1; }
.kvf__paper i { height: 4px; border-radius: 2px; background: #cfe7da; transform-origin: left; animation: kvf-write 2.4s ease-in-out infinite; }
.kvf:lang(ar) .kvf__paper i, :lang(ar) .kvf__paper i { transform-origin: right; }
.kvf__paper i:nth-child(2) { animation-delay: .35s; width: 86%; }
.kvf__paper i:nth-child(3) { animation-delay: .7s; }
.kvf__paper i:nth-child(4) { animation-delay: 1.05s; width: 62%; }
@keyframes kvf-write { 0% { transform: scaleX(0); opacity: .4; } 45%, 100% { transform: scaleX(1); opacity: 1; } }
.kvf__stage { font-size: 15.5px; font-weight: 800; }
.kvf__bar { position: relative; height: 5px; border-radius: 99px; background: var(--kv-line, rgba(13, 42, 33, .1)); overflow: hidden; margin: 4px 0 2px; }
.kvf__bar > span { position: absolute; inset-block: 0; inset-inline-start: 0; width: 8%; border-radius: inherit; background: linear-gradient(90deg, var(--kvf-green), var(--kvf-mint)); transition: width 1s linear; }
.kvf__hint { color: var(--kv-text-muted, #5b6f66); font-size: 12.5px; }

/* the moment it lands */
.kvf.is-new { animation: kvf-land .55s cubic-bezier(.2, .9, .3, 1.25) both; }
.kvf.is-new .kvf__thumb img { animation: kvf-lift .9s .15s ease-out both; }
@keyframes kvf-land { from { transform: translateY(8px) scale(.98); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes kvf-lift { from { transform: translateY(14px) rotate(4deg); opacity: 0; } to { transform: none; opacity: 1; } }

.kvf--limit { background: linear-gradient(160deg, rgba(125, 227, 184, .12), transparent 60%), var(--kv-card, #fff); }

/* the "New" pill on the Make a file chip */
.kv-chip-new { margin-inline-start: 6px; padding: 1px 7px; border-radius: 99px; background: #2f9e74; color: #fff; font-size: 10.5px; font-weight: 800; letter-spacing: .03em; line-height: 1.6; }

@media (max-width: 480px) {
  .kvf { gap: 12px; padding: 12px; }
  .kvf__thumb { width: 88px; }
  .kvf__title { font-size: 16px; }
  .kvf__btn { min-height: 36px; padding: 0 12px; font-size: 13.5px; }
}
@media (prefers-reduced-motion: reduce) {
  .kvf__paper i, .kvf.is-new, .kvf.is-new .kvf__thumb img { animation: none; }
}

/* ---------- editor-20261010: Edit on the card, and the editor panel ---------- */
.kvf__thumb { position: relative; }
.kvf__edit-hint {
  position: absolute; inset-inline-end: 6px; bottom: 6px; z-index: 2; display: inline-flex; align-items: center; gap: 4px;
  padding: 4px 8px; border-radius: 99px; background: rgba(13, 42, 33, .82); color: #fff; font-size: 11.5px; font-weight: 700;
  opacity: 0; transform: translateY(3px); transition: opacity .15s, transform .15s; pointer-events: none;
}
.kvf__edit-hint svg { width: 13px; height: 13px; }
.kvf__thumb:hover .kvf__edit-hint, .kvf__thumb:focus-visible .kvf__edit-hint { opacity: 1; transform: none; }
@media (hover: none) { .kvf__edit-hint { opacity: 1; transform: none; } }
.kvf__btn--edit svg { width: 15px; height: 15px; }

:root { --kvfe-w: clamp(520px, 46vw, 860px); }   /* the panel's width, also read by the chat column beside it */
.kvfe {
  position: fixed; inset: 0; z-index: 10040; background: #eef2f0;
  animation: kvfe-in .2s ease-out;
}
html[data-theme='dark'] .kvfe { background: #0f1715; }
.kvfe__frame { display: block; width: 100%; height: 100%; border: 0; }
.kvfe.is-leaving { animation: kvfe-out .18s ease-in forwards; }
@keyframes kvfe-in { from { transform: translateY(16px); opacity: 0; } }
@keyframes kvfe-out { to { transform: translateY(16px); opacity: 0; } }
/* Wide screens: docked on the right, the chat stays usable beside it. */
@media (min-width: 1100px) {
  .kvfe { inset: 0 0 0 auto; width: var(--kvfe-w); box-shadow: -10px 0 40px rgba(0, 0, 0, .14); border-inline-start: 1px solid rgba(0, 0, 0, .08); }
  [dir='rtl'] .kvfe { inset: 0 auto 0 0; box-shadow: 10px 0 40px rgba(0, 0, 0, .14); }
  @keyframes kvfe-in { from { transform: translateX(24px); opacity: 0; } }
  @keyframes kvfe-out { to { transform: translateX(24px); opacity: 0; } }
  html.kv-editor-open .kv-main { margin-inline-end: var(--kvfe-w); transition: margin .2s ease-out; }
}
@media (max-width: 1099px) { html.kv-editor-open, html.kv-editor-open body { overflow: hidden; } }
@media (prefers-reduced-motion: reduce) { .kvfe, .kvfe.is-leaving { animation: none; } }
