/* OasisInvoice — "Ed", the help buddy (bottom-right helper on the main page). */

.buddy { position: fixed; right: 20px; bottom: 20px; z-index: 70; display: flex; flex-direction: column; align-items: flex-end; gap: 12px; pointer-events: none; }
.buddy > * { pointer-events: auto; }

.buddy-launch { position: relative; width: 64px; height: 64px; border-radius: 50%; border: 0; padding: 0; cursor: pointer; background: var(--grad); box-shadow: 0 12px 30px -8px var(--a1), 0 0 0 4px color-mix(in srgb, var(--bg) 70%, transparent); transition: transform .2s; }
.buddy-launch:hover { transform: translateY(-2px) scale(1.04); }
.buddy-launch svg { width: 100%; height: 100%; display: block; border-radius: 50%; }
.buddy-launch .b-dot { position: absolute; top: 2px; right: 2px; width: 14px; height: 14px; border-radius: 50%; background: var(--ok); border: 2px solid var(--bg); }
.buddy-launch .b-close { position: absolute; inset: 0; display: none; place-items: center; color: #fff; font-size: 26px; line-height: 1; background: var(--grad); border-radius: 50%; }
.buddy.open .buddy-launch .b-close { display: grid; }
.buddy.open .buddy-launch .b-dot { display: none; }

.buddy-tip { max-width: 250px; background: var(--card-solid); border: 1px solid var(--line2); border-radius: 16px 16px 4px 16px; padding: 12px 34px 12px 14px; font-size: 14px; box-shadow: var(--shadow); position: relative; cursor: pointer; animation: b-pop .35s ease; }
.buddy-tip b { display: block; font-family: "Space Grotesk", sans-serif; margin-bottom: 2px; }
.buddy-tip .x { position: absolute; top: 6px; right: 6px; width: 24px; height: 24px; border: 0; background: transparent; color: var(--muted); cursor: pointer; border-radius: 6px; font-size: 16px; }
.buddy-tip .x:hover { color: var(--text); background: var(--line); }

.buddy-panel { width: min(380px, calc(100vw - 32px)); height: min(560px, calc(100vh - 120px)); display: flex; flex-direction: column; background: var(--card-solid); border: 1px solid var(--line2); border-radius: 20px; box-shadow: 0 24px 60px -20px rgba(0, 0, 0, .55); overflow: hidden; animation: b-pop .25s ease; transform-origin: bottom right; }
.buddy-head { display: flex; align-items: center; gap: 12px; padding: 14px 16px; background: linear-gradient(120deg, color-mix(in srgb, var(--a1) 22%, transparent), color-mix(in srgb, var(--a2) 18%, transparent)); border-bottom: 1px solid var(--line); }
.buddy-head .b-av { width: 44px; height: 44px; border-radius: 50%; background: var(--grad); flex: none; overflow: hidden; }
.buddy-head .b-av svg { width: 100%; height: 100%; display: block; }
.buddy-head h2 { font-size: 16px; margin: 0; }
.buddy-head p { margin: 2px 0 0; font-size: 12px; color: var(--muted); display: flex; align-items: center; gap: 6px; }
.buddy-head p::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--ok); }
.buddy-head .b-x { margin-left: auto; width: 34px; height: 34px; border-radius: 10px; border: 1px solid var(--line2); background: transparent; color: var(--text); cursor: pointer; font-size: 18px; }
.buddy-head .b-x:hover { border-color: var(--a1); }

.buddy-log { flex: 1; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 10px; scroll-behavior: smooth; }
.b-msg { max-width: 88%; padding: 10px 13px; border-radius: 14px; font-size: 14px; line-height: 1.5; overflow-wrap: anywhere; }
.b-msg p { margin: 0; }
.b-msg p + p, .b-msg ul { margin-top: 6px; }
.b-msg ul { padding-left: 18px; margin-bottom: 0; }
.b-msg a { color: var(--a2); }
.b-bot { align-self: flex-start; background: var(--field); border: 1px solid var(--line); border-bottom-left-radius: 4px; }
.b-me { align-self: flex-end; background: var(--grad); color: #fff; border-bottom-right-radius: 4px; }
.b-acts { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.b-act { border: 1px solid var(--a1); background: transparent; color: var(--text); border-radius: 999px; padding: 5px 11px; font-size: 12.5px; font-weight: 600; cursor: pointer; text-decoration: none; }
.b-act:hover { background: color-mix(in srgb, var(--a1) 18%, transparent); }
.b-typing { display: inline-flex; gap: 4px; padding: 13px 14px; }
.b-typing i { width: 6px; height: 6px; border-radius: 50%; background: var(--muted); animation: b-blink 1s infinite; }
.b-typing i:nth-child(2) { animation-delay: .15s; }
.b-typing i:nth-child(3) { animation-delay: .3s; }

.buddy-chips { display: flex; gap: 6px; padding: 0 16px 10px; overflow-x: auto; scrollbar-width: none; flex: none; }
.buddy-chips::-webkit-scrollbar { display: none; }
.buddy-chips button { flex: none; border: 1px solid var(--line2); background: var(--card); color: var(--text); border-radius: 999px; padding: 6px 11px; font-size: 12.5px; cursor: pointer; white-space: nowrap; }
.buddy-chips button:hover { border-color: var(--a1); }

.buddy-form { display: flex; gap: 8px; padding: 12px; border-top: 1px solid var(--line); flex: none; }
.buddy-form input { flex: 1; min-width: 0; background: var(--field); border: 1px solid var(--line2); border-radius: 12px; padding: 10px 12px; font-size: 14px; }
.buddy-form input:focus { outline: none; border-color: var(--a1); box-shadow: var(--focus); }
.buddy-form button { width: 42px; border: 0; border-radius: 12px; background: var(--grad); color: #fff; cursor: pointer; display: grid; place-items: center; }
.buddy-form button svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

@keyframes b-pop { from { opacity: 0; transform: translateY(10px) scale(.96); } }
@keyframes b-blink { 50% { opacity: .25; } }
@media (prefers-reduced-motion: reduce) { .buddy-tip, .buddy-panel, .b-typing i { animation: none; } }

@media (max-width: 720px) {
  .buddy { right: 14px; bottom: 14px; }
  .buddy-launch { width: 56px; height: 56px; }
  .buddy-panel { height: min(540px, calc(100vh - 100px)); }
}
@media print { .buddy { display: none !important; } }
