/* ============================================================
   WOS — Ask AI side drawer styling
   ============================================================ */
.wos-asst-scrim { position: fixed; inset: 0; background: transparent; opacity: 0; visibility: hidden;
  transition: opacity .25s, visibility .25s; z-index: 90; }
.wos-asst-scrim.on { opacity: 1; visibility: visible; }

.wos-asst {
  position: fixed; right: clamp(14px, 2.4vw, 28px); bottom: clamp(14px, 2.4vw, 28px);
  width: min(400px, calc(100vw - 32px)); height: min(620px, calc(100vh - 56px));
  background: var(--surface); border: 1px solid var(--border-2); border-radius: 20px;
  box-shadow: 0 2px 8px rgba(80,65,30,0.10), 0 40px 80px -28px rgba(60,48,20,0.45);
  display: flex; flex-direction: column; z-index: 95; overflow: hidden;
  transform: translateY(16px) scale(.98); opacity: 0; visibility: hidden;
  transform-origin: bottom right;
  transition: transform .26s cubic-bezier(.2,.8,.2,1), opacity .22s ease, visibility .26s;
}
.wos-asst.on { transform: none; opacity: 1; visibility: visible; }
.wos-asst.resizing { transition: none; user-select: none; }

/* resize handle (top-left corner) */
.wa-resize { position: absolute; top: 0; left: 0; width: 22px; height: 22px; cursor: nwse-resize; z-index: 6; }
.wa-resize::before { content: ""; position: absolute; top: 7px; left: 7px; width: 9px; height: 9px;
  border-top: 2px solid var(--muted); border-left: 2px solid var(--muted); border-radius: 3px 0 0 0; opacity: .5; }
.wa-resize:hover::before { opacity: 1; border-color: var(--accent); }

.wa-head { display: flex; align-items: center; gap: 11px; padding: 15px 16px; border-bottom: 1px solid var(--border); }
.wa-av { width: 34px; height: 34px; border-radius: 10px; background: #fff; border: 1px solid rgba(0,0,0,.07); display: grid; place-items: center; flex: none; }
.wa-av .wa-av-logo { width: 28px; height: 28px; object-fit: contain; display: block; }
.wa-av svg { width: 18px; height: 18px; }
.wa-id .nm { font-size: 14.5px; font-weight: 600; display: flex; align-items: center; gap: 8px; }
.wa-id .live { font-size: 10.5px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: #3d7a52;
  background: rgba(63,130,90,0.12); border-radius: 6px; padding: 2px 7px; }
.wa-id .sub { font-size: 12px; color: var(--muted); margin-top: 2px; }
.wa-x { margin-left: auto; border: 0; background: none; color: var(--muted); font-size: 24px; line-height: 1; cursor: pointer;
  width: 32px; height: 32px; border-radius: 8px; }
.wa-x:hover { background: var(--surface-2); color: var(--text); }

.wa-body { flex: 1; overflow-y: auto; padding: 18px; display: flex; flex-direction: column; gap: 14px; }
.wa-msg { display: flex; gap: 10px; align-items: flex-start; }
.wa-msg .ic { width: 28px; height: 28px; border-radius: 8px; flex: none; display: grid; place-items: center; }
.wa-msg.bot .ic { background: var(--accent-soft); color: var(--accent); }
.wa-msg.bot .ic svg { width: 15px; height: 15px; }
.wa-msg.me .ic { background: var(--surface-2); color: var(--text-2); }
.wa-msg.me .ic svg { width: 15px; height: 15px; }
.wa-msg .b { font-size: 14px; line-height: 1.55; color: var(--text); background: var(--bg-2); border: 1px solid var(--border);
  border-radius: 12px; padding: 10px 13px; max-width: 80%; }
[data-lang="ko"] .wa-msg .b { word-break: keep-all; }
.wa-msg.me { flex-direction: row-reverse; }
.wa-msg.me .b { background: var(--ink); color: #F1ECDF; border-color: var(--ink); }

.wa-typing { display: inline-flex; gap: 4px; }
.wa-typing i { width: 6px; height: 6px; border-radius: 50%; background: var(--muted); animation: waBlink 1.2s infinite both; }
.wa-typing i:nth-child(2) { animation-delay: .2s; } .wa-typing i:nth-child(3) { animation-delay: .4s; }
@keyframes waBlink { 0%, 80%, 100% { opacity: .25; } 40% { opacity: 1; } }

.wa-sugg { display: flex; flex-wrap: wrap; gap: 8px; padding: 0 18px 12px; }
.wa-chip { border: 1px solid var(--border-2); background: var(--surface); color: var(--text-2); font: inherit; font-size: 12.5px;
  font-weight: 500; padding: 7px 12px; border-radius: 999px; cursor: pointer; transition: all .15s; }
.wa-chip:hover { border-color: var(--accent); color: var(--accent); }

.wa-keygate { padding: 0 14px 12px; }
.wa-key-row { display: flex; gap: 11px; align-items: flex-start; padding: 12px 14px; background: var(--accent-soft);
  border: 1px solid color-mix(in srgb, var(--accent) 26%, transparent); border-radius: 12px 12px 0 0; }
.wa-key-row .k { width: 18px; height: 18px; color: var(--accent); flex: none; margin-top: 1px; }
.wa-key-row .kt { display: flex; flex-direction: column; gap: 2px; }
.wa-key-row .kt b { font-size: 13px; font-weight: 600; color: var(--text); }
.wa-key-row .kt span { font-size: 11.5px; color: var(--text-2); }
[data-lang="ko"] .wa-key-row .kt span { word-break: keep-all; }
.wa-key-input { display: flex; gap: 8px; padding: 10px 14px; border: 1px solid var(--border-2); border-top: 0; border-radius: 0 0 12px 12px; }
.wa-key-input input { flex: 1; font: inherit; font-size: 13px; font-family: "JetBrains Mono", monospace; color: var(--text);
  background: var(--bg-2); border: 1px solid var(--border-2); border-radius: 9px; padding: 9px 11px; }
.wa-key-input input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.wa-key-input input.err { border-color: #c0573e; box-shadow: 0 0 0 3px rgba(192,87,62,0.12); }
.wa-key-btn { flex: none; border: 0; background: var(--ink); color: #F1ECDF; font: inherit; font-size: 13px; font-weight: 600;
  padding: 0 16px; border-radius: 9px; cursor: pointer; transition: background .15s; }
.wa-key-btn:hover { background: var(--accent-btn-h); }

.wa-input { display: flex; gap: 8px; padding: 12px 14px; border-top: 1px solid var(--border); align-items: flex-end; }
.wa-input textarea { flex: 1; resize: none; font: inherit; font-size: 14px; color: var(--text); background: var(--bg-2);
  border: 1px solid var(--border-2); border-radius: 11px; padding: 11px 13px; max-height: 120px; line-height: 1.4; }
.wa-input textarea:disabled { opacity: .55; cursor: not-allowed; }
.wa-input textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.wa-send { flex: none; width: 40px; height: 40px; border: 0; border-radius: 11px; background: var(--ink); color: #F1ECDF;
  cursor: pointer; display: grid; place-items: center; transition: background .15s; }
.wa-send:hover { background: var(--accent-btn-h); }
.wa-send:disabled { opacity: .5; cursor: default; }
.wa-send svg { width: 17px; height: 17px; }

.wa-foot { display: flex; justify-content: space-between; align-items: center; padding: 0 18px 14px; font-size: 11.5px; color: var(--muted); }
.wa-turns b { color: var(--text-2); }

/* key-rejected warning bubble (yellow) + re-connect button */
.key-warn { display: flex; align-items: flex-start; gap: 9px; flex-wrap: wrap;
  background: #b0822514; border: 1px solid #b0822544; border-radius: 10px;
  padding: 10px 12px; color: #8a6d1f; font-size: 13.5px; line-height: 1.5; }
.key-warn .kw-i { width: 17px; height: 17px; flex: none; margin-top: 1px; color: #b08225; }
.key-warn > span { flex: 1 1 60%; min-width: 160px; }
.key-warn .kw-reconnect { display: inline-flex; align-items: center; gap: 6px; cursor: pointer;
  border: 1px solid #b0822566; background: #b0822512; color: #8a6d1f; border-radius: 8px;
  padding: 5px 10px; font-size: 12.5px; font-weight: 600; font-family: inherit; }
.key-warn .kw-reconnect:hover { background: #b0822522; }
.key-warn .kw-reconnect svg { width: 13px; height: 13px; }

/* ---- minimized launcher (rounded-square logo FAB) ---- */
.wos-asst-launcher {
  position: fixed; right: 24px; bottom: 24px; z-index: 60;
  width: 58px; height: 58px; border-radius: 19px;
  display: none; align-items: center; justify-content: center;
  background: #fff; color: #3466a3; border: 1px solid rgba(0,0,0,.08); cursor: pointer;
  box-shadow: 0 8px 24px rgba(0,0,0,.30);
  transition: transform .16s ease, box-shadow .16s ease, background .16s ease;
}
.wos-asst-launcher.on { display: flex; }
.wos-asst-launcher:hover { transform: translateY(-2px) scale(1.05); box-shadow: 0 12px 30px rgba(0,0,0,.34); background: #fff; }
.wos-asst-launcher svg { width: 27px; height: 27px; }
.wos-asst-launcher .wal-dot {
  position: absolute; top: 10px; right: 10px;
  width: 8px; height: 8px; border-radius: 50%;
  background: #57d27e; box-shadow: 0 0 0 2px #fff;
}
.wos-asst-launcher .wal-logo { width: 38px; height: 38px; display: block; }
@media (max-width: 600px) {
  .wos-asst-launcher { right: 16px; bottom: 16px; width: 52px; height: 52px; border-radius: 17px; }
}

/* keep chat scrolling from chaining into the page behind the drawer */
.wa-body { overscroll-behavior: contain; }
.wos-asst, .wos-asst-scrim { overscroll-behavior: contain; }

/* bot message avatar = logo */
.wa-msg.bot .ic { background: #fff; border: 1px solid rgba(0,0,0,.06); }
.wa-msg .ic .ic-logo { width: 20px; height: 20px; object-fit: contain; display: block; }

/* key-warning banner above the drawer input bar */
.wa-warn { margin: 0 14px 8px; }
.wa-warn.hidden { display: none; }

/* connected-key bar: which model + masked key + change/disconnect */
.wa-keybar { display: flex; align-items: center; gap: 7px; margin: 0 14px 8px; padding: 7px 11px;
  border: 1px solid var(--border); border-radius: 10px; background: var(--bg-2);
  font-size: 11.5px; color: var(--muted); }
.wa-keybar.hidden { display: none; }
.wa-keybar .ok { color: #5fb87a; font-size: 9px; }
.wa-keybar .wa-kb-model { color: var(--text); font-weight: 600; max-width: 130px; overflow: hidden;
  text-overflow: ellipsis; white-space: nowrap; }
.wa-keybar .wa-kb-sep { opacity: .5; }
.wa-keybar .km { font-family: "JetBrains Mono", ui-monospace, monospace; color: var(--text-2); }
.wa-keybar .wa-kb-btn { margin-left: auto; background: none; border: 1px solid var(--border-2);
  color: var(--text-2); border-radius: 7px; padding: 3px 8px; font: inherit; font-size: 11px;
  cursor: pointer; transition: all .16s; }
.wa-keybar .wa-kb-btn + .wa-kb-btn { margin-left: 6px; }
.wa-keybar .wa-kb-btn:hover { border-color: var(--accent); color: var(--text); }
.wa-keybar .wa-kb-btn.off:hover { border-color: #d4694a; color: #d4694a; }

/* Haus download card — a file chip + one-click download of the LLM spec. */
.wa-dl { border: 1px solid var(--border-2); border-radius: 12px; overflow: hidden; max-width: 280px; }
.wa-dl-file { display: flex; align-items: center; gap: 7px; padding: 10px 12px;
  font-family: "JetBrains Mono", ui-monospace, monospace; font-size: 12.5px; color: var(--text);
  background: var(--surface-2, rgba(0,0,0,.03)); }
.wa-dl-doc { opacity: .6; }
.wa-dl-sz { color: var(--text-2); }
.wa-dl-btn { display: flex; align-items: center; justify-content: center; gap: 7px; width: 100%;
  padding: 9px 12px; border: 0; border-top: 1px solid var(--border-2); background: var(--ink);
  color: #fff; font: inherit; font-size: 13px; font-weight: 600; cursor: pointer; transition: filter .16s; }
.wa-dl-btn:hover { filter: brightness(1.12); }
.wa-dl-btn svg { width: 15px; height: 15px; }
