.ascow-fab {
    position: fixed; right: 24px; bottom: 24px;
    width: 56px; height: 56px; border-radius: 50%;
    background: var(--ascow-brand); color: #fff; border: none;
    box-shadow: 0 6px 20px rgba(0,0,0,0.18);
    cursor: pointer; z-index: 999998;
    display: flex; align-items: center; justify-content: center;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    transition: transform 0.18s ease, box-shadow 0.18s ease;
}
.ascow-fab:hover { transform: translateY(-2px); box-shadow: 0 10px 28px rgba(0,0,0,0.22); }
.ascow-fab:focus-visible { outline: 3px solid var(--ascow-brand-deep); outline-offset: 3px; }
.ascow-fab svg { width: 28px; height: 28px; fill: #fff; }
.ascow-fab[hidden] { display: none; }

/* v0.40.5: hide the FAB while the mobile responsive nav modal is open.
   WordPress's core/navigation block adds `has-modal-open` to the <html>
   element (and sometimes <body>) when the nav overlay is open. On mobile
   the nav stacks vertically and "Contact" — the last item — was being
   covered by the fixed-position FAB sitting in its corner. Hiding the
   FAB while the menu is open removes the conflict; the FAB returns the
   moment the menu closes. */
html.has-modal-open .ascow-fab,
body.has-modal-open .ascow-fab {
    display: none !important;
}

.ascow-panel {
    position: fixed; right: 24px; bottom: 96px;
    width: 360px; max-width: calc(100vw - 32px);
    height: 540px; max-height: calc(100vh - 120px);
    background: var(--ascow-bg); color: var(--ascow-ink);
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.25);
    z-index: 999999;
    display: none; flex-direction: column;
    overflow: hidden;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    animation: ascowPop 0.18s ease;
}
@keyframes ascowPop {
    from { opacity: 0; transform: translateY(8px) scale(0.98); }
    to   { opacity: 1; transform: translateY(0)   scale(1); }
}
.ascow-panel[data-open="true"] { display: flex; }

@media (max-width: 600px) {
    .ascow-panel {
        right: 8px; left: 8px; bottom: 80px;
        width: auto; height: calc(100vh - 100px);
    }
}

.ascow-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 14px 16px; background: var(--ascow-brand); color: #fff;
}
.ascow-header-title { font-weight: 600; font-size: 15px; letter-spacing: 0.01em; }
.ascow-header-actions { display: flex; gap: 8px; }
.ascow-header button {
    background: transparent; color: #fff; border: none;
    cursor: pointer; padding: 4px 8px; border-radius: 6px;
    font-size: 13px; opacity: 0.85;
}
.ascow-header button:hover { opacity: 1; background: rgba(255,255,255,0.12); }
/* v0.34.0: small "Sign in" link in the header for anon users
   who want to switch into manager mode. Hidden when already
   signed in or when no password is configured. */
.ascow-header .ascow-signin-link {
    font-size: 12px;
    text-decoration: underline;
    opacity: 0.85;
    padding: 4px 6px;
}
.ascow-header .ascow-signin-link[hidden] { display: none; }
.ascow-header .ascow-signedin-badge {
    font-size: 11px;
    background: rgba(255,255,255,0.18);
    padding: 3px 8px;
    border-radius: 999px;
    letter-spacing: 0.02em;
}
.ascow-header .ascow-signedin-badge[hidden] { display: none; }

.ascow-body { flex: 1; min-height: 0; display: flex; flex-direction: column; }

/* Login state */
.ascow-login {
    flex: 1; display: flex; flex-direction: column;
    align-items: center; justify-content: center;
    padding: 32px 24px; gap: 16px;
    background: var(--ascow-cream);
}
.ascow-login-icon {
    width: 64px; height: 64px; border-radius: 50%;
    background: var(--ascow-brand); color: #fff;
    display: flex; align-items: center; justify-content: center;
    font-size: 28px;
}
.ascow-login p { color: var(--ascow-ink-soft); text-align: center; margin: 0; line-height: 1.5; font-size: 14px; }
.ascow-login form { width: 100%; display: flex; flex-direction: column; gap: 10px; }
.ascow-login input {
    width: 100%; padding: 11px 14px;
    border: 1px solid var(--ascow-line); border-radius: 8px;
    font-size: 14px; box-sizing: border-box;
    font-family: inherit;
}
.ascow-login input:focus { outline: 2px solid var(--ascow-brand); outline-offset: 1px; border-color: var(--ascow-brand); }
.ascow-login button[type="submit"] {
    width: 100%; padding: 11px 14px;
    background: var(--ascow-brand); color: #fff; border: none;
    border-radius: 8px; cursor: pointer;
    font-weight: 600; font-size: 14px;
    font-family: inherit;
}
.ascow-login button[type="submit"]:hover { background: var(--ascow-brand-deep); }
.ascow-error {
    color: #b03a2e; font-size: 13px; text-align: center;
    background: #fde8e6; padding: 8px 12px; border-radius: 6px;
    display: none;
}
.ascow-error[data-show="true"] { display: block; }

/* Chat state */
.ascow-chat {
    flex: 1; display: none; flex-direction: column;
    min-height: 0;
}
.ascow-chat[data-show="true"] { display: flex; }
.ascow-messages {
    flex: 1; overflow-y: auto; padding: 16px;
    display: flex; flex-direction: column; gap: 12px;
}
.ascow-msg {
    max-width: 80%; padding: 10px 14px; border-radius: 12px;
    font-size: 14px; line-height: 1.5; word-wrap: break-word;
}
.ascow-msg-user { align-self: flex-end; background: var(--ascow-brand); color: #fff; border-bottom-right-radius: 4px; }
.ascow-msg-assistant { align-self: flex-start; background: var(--ascow-cream); color: var(--ascow-ink); border-bottom-left-radius: 4px; }
.ascow-msg-system { align-self: center; background: transparent; color: var(--ascow-ink-soft); font-size: 12px; font-style: italic; }
.ascow-msg-tool {
    align-self: stretch; background: #f6f1ec; color: var(--ascow-ink-soft);
    font-family: ui-monospace, SF Mono, Menlo, monospace; font-size: 12px;
    padding: 8px 12px; border-radius: 8px;
    border-left: 3px solid var(--ascow-brand);
}
.ascow-msg-error { align-self: stretch; background: #fde8e6; color: #b03a2e; }

.ascow-pills {
    align-self: flex-start;
    display: flex; flex-wrap: wrap; gap: 6px;
    margin: -2px 0 4px 0; max-width: 90%;
}
.ascow-pill {
    background: #fff; color: var(--ascow-brand);
    border: 1px solid var(--ascow-brand);
    padding: 6px 12px; border-radius: 14px;
    cursor: pointer;
    font: inherit; font-size: 13px; line-height: 1.2;
    transition: background 0.12s ease, color 0.12s ease;
}
.ascow-pill:hover { background: var(--ascow-brand); color: #fff; }
.ascow-pill:focus-visible {
    outline: 2px solid var(--ascow-brand-deep);
    outline-offset: 2px;
}
.ascow-pill:active { transform: translateY(1px); }

.ascow-typing {
    align-self: flex-start; padding: 10px 14px; border-radius: 12px;
    background: var(--ascow-cream); display: none;
}
.ascow-typing[data-show="true"] { display: inline-block; }
.ascow-typing span {
    display: inline-block; width: 6px; height: 6px;
    background: var(--ascow-brand); border-radius: 50%;
    margin: 0 1px; animation: ascowDot 1.2s infinite;
}
.ascow-typing span:nth-child(2) { animation-delay: 0.2s; }
.ascow-typing span:nth-child(3) { animation-delay: 0.4s; }
@keyframes ascowDot {
    0%, 60%, 100% { opacity: 0.3; }
    30% { opacity: 1; }
}

.ascow-input-row {
    border-top: 1px solid var(--ascow-line);
    padding: 10px 12px;
    display: flex; gap: 8px; align-items: flex-end;
}
.ascow-input-row textarea {
    flex: 1; resize: none; padding: 9px 12px;
    border: 1px solid var(--ascow-line); border-radius: 8px;
    font-size: 14px; max-height: 120px;
    font-family: inherit; line-height: 1.4;
}
.ascow-input-row textarea:focus { outline: 2px solid var(--ascow-brand); outline-offset: 1px; border-color: var(--ascow-brand); }
.ascow-input-row button {
    background: var(--ascow-brand); color: #fff; border: none;
    border-radius: 8px; padding: 9px 14px; cursor: pointer;
    font-weight: 600; font-size: 14px;
    font-family: inherit;
}
.ascow-input-row button:hover { background: var(--ascow-brand-deep); }
.ascow-input-row button:disabled { opacity: 0.5; cursor: not-allowed; }
