/* Shared Cally identity: a glowing agent orb with responsive state motion. */
.ai-companion-toggle::before,.ai-companion-toggle::after { content:none; }
.ai-companion-toggle .cally-agent-core { width:58px;height:58px; }
.cally-agent-core img,.cally-avatar img,.cally-welcome-orb img,.cally-msg-avatar img { width:100%;height:100%;display:block; }
.cally-avatar,.cally-welcome-orb,.cally-msg-avatar { background:none;animation:none;border-radius:50%!important;box-shadow:none; }
.ai-companion-toggle { filter:drop-shadow(0 5px 10px color-mix(in srgb, var(--ds-primary) 24%, transparent)); }
.ai-companion-toggle:hover { transform:translateY(-2px); }
.ai-companion-toggle .ai-badge { border-radius:50%!important; }
.cally-setup-overlay { position:fixed;inset:0;z-index:9999;background:rgba(71, 85, 105,.58);backdrop-filter:blur(8px);display:flex;align-items:center;justify-content:center;padding:24px; }
.cally-setup { width:100%;max-width:740px;max-height:92dvh;overflow:auto;border-radius:24px!important;background:var(--bg-primary,#fff);color:var(--text-primary,#475569);border:1px solid rgba(139,122,255,.3);box-shadow:0 32px 100px rgba(71, 85, 105,.35); }
.cally-setup-header { display:flex;gap:16px;align-items:center;padding:28px 32px 24px;background:linear-gradient(110deg,rgba(111,91,244,.10),rgba(36,204,219,.05)); }
.cally-eyebrow { font-size:10px;font-weight:750;letter-spacing:.14em;color:var(--primary-color,#6255ee); }
.cally-setup-header h2 { margin:5px 0 7px;font-size:24px;line-height:1.2;letter-spacing:-.5px; }
.cally-setup-header p { display:flex;align-items:center;gap:6px;margin:0;font-size:12px;color:var(--text-secondary,#627087); }
.cally-ready-dot { width:6px;height:6px;border-radius:50%!important;background:#14b8a6; }
.cally-setup-progress { margin:0;padding:16px 32px;display:flex;gap:22px;list-style:none;border-bottom:1px solid var(--border-color,#e5e7ef); }
.cally-setup-progress li { display:flex;gap:7px;align-items:center;font-size:11px;color:var(--text-secondary,#627087); }
.cally-setup-progress li[aria-current] { color:var(--primary-color,#6255ee);font-weight:750; }
.cally-setup-body { padding:24px 32px; }
.cally-dialogue { display:flex;gap:10px;align-items:flex-start;margin-bottom:24px; }
.cally-dialogue img { flex-shrink:0; }
.cally-dialogue p { background:rgba(111,91,244,.065);border:1px solid rgba(111,91,244,.12);border-radius:0 14px 14px 14px!important;padding:13px 16px;margin:0;font-size:14px;line-height:1.6; }
.cally-setup .form-control { border-radius:10px!important; }
.cally-setup .btn { border-radius:10px!important; }
.cally-field-hint { font-size:12px;line-height:1.6;color:var(--text-secondary,#627087);font-weight:400; }
.cally-setup section[hidden] { display:none!important; }
.cally-setup section h3 { font-size:18px;margin:0 0 16px; }
.cally-setup-actions { display:flex;align-items:center;justify-content:space-between;gap:12px;margin-top:26px; }
.cally-setup-actions>span { font-size:11px;color:var(--text-secondary,#627087); }
.cally-industry-grid { display:grid;grid-template-columns:1fr 1fr;gap:10px; }
.cally-industry-grid .industry-card-btn { display:flex;gap:10px;align-items:center;text-align:left;border:1px solid var(--border-color,#e5e7ef);background:var(--bg-secondary,#f8f9fc);color:var(--text-primary,#475569);border-radius:12px!important;padding:14px;cursor:pointer; }
.cally-industry-grid .industry-card-btn span:first-of-type { flex:1;font-size:12px;font-weight:600; }
.cally-industry-grid .industry-card-btn svg { color:#7663ef;flex-shrink:0; }
.cally-industry-grid .industry-card-btn:hover { border-color:#7663ef;background:rgba(111,91,244,.08); }
.cally-pipeline-heading { display:flex;justify-content:space-between;gap:12px;align-items:start; }
.cally-pipeline-heading h3 { margin-bottom:4px!important; }
.cally-pipeline-heading p { margin:0;font-size:12px;color:var(--text-secondary,#627087); }
.cally-suggestion-tag { font-size:10px;color:#6255ee;background:rgba(111,91,244,.10);padding:5px 8px;border-radius:20px!important;white-space:nowrap; }
.cally-stage-list { display:grid;gap:10px;margin:18px 0 14px; }
.cally-stage-row { display:flex;align-items:flex-start;gap:10px;padding:12px;border:1px solid var(--border-color,#e5e7ef);border-radius:12px!important;background:var(--bg-secondary,#f8f9fc); }
.cally-stage-number { flex:0 0 22px;height:34px;display:grid;place-items:center;color:#7663ef;font-size:12px;font-weight:700; }
.cally-stage-fields { flex:1;min-width:0; }
.cally-stage-fields input { padding:8px 10px!important;min-height:36px;font-size:13px; }
.cally-stage-fields details { margin-top:6px;font-size:11px;color:var(--text-secondary,#627087); }
.cally-stage-fields summary { cursor:pointer; }
.cally-stage-fields textarea { margin-top:8px;font-size:12px; }
.cally-stage-actions { display:flex;gap:3px;padding-top:3px; }
.cally-stage-actions button { border:0;background:transparent;color:var(--text-secondary,#627087);cursor:pointer;width:27px;height:30px;font-size:18px;border-radius:6px!important; }
.cally-stage-actions button:hover:not(:disabled) { background:rgba(111,91,244,.1);color:#6255ee; }
.cally-stage-actions button:disabled { opacity:.25;cursor:default; }
.cally-setup-error { color:var(--color-danger,#dc2626);font-size:12px; }
.cally-setup-footer { padding:14px 28px;text-align:center;font-size:11px;color:var(--text-secondary,#627087);border-top:1px solid var(--border-color,#e5e7ef); }
.cally-setup :focus-visible { outline:2px solid #7663ef;outline-offset:3px; }
@media(max-width:600px) { .cally-setup-overlay{padding:10px}.cally-setup{border-radius:18px!important;max-height:96dvh}.cally-setup-header{padding:20px;gap:10px}.cally-setup-header h2{font-size:20px}.cally-setup-header img{width:46px;height:46px}.cally-setup-body{padding:18px}.cally-setup-progress{padding:14px 18px;gap:15px}.cally-setup-progress li{font-size:10px;gap:4px}.cally-industry-grid{grid-template-columns:1fr}.cally-setup-actions{flex-wrap:wrap}.cally-setup-actions>span{display:none}.cally-stage-row{padding:8px;gap:5px}.cally-stage-actions{flex-direction:column}.cally-stage-actions button{height:24px}.cally-pipeline-heading{flex-wrap:wrap}.cally-stage-number{flex-basis:18px} }
@media(prefers-reduced-motion:reduce) { .ai-companion-toggle-glow{animation:none}.ai-companion-toggle{transition:none} }

/* Cally's agent mark uses state-aware light and a soft, responsive field. */
:root {
    --cally-electric: var(--ds-assistant-blue);
    --cally-cyan: var(--ds-assistant-cyan);
    --cally-violet: var(--ds-assistant-violet);
    --cally-listen: var(--cally-electric);
}

@keyframes cally-idle-breathe {
    0%, 100% { transform: translateY(0) scale(1); }
    50% { transform: translateY(-1px) scale(1.035); }
}
@keyframes cally-agent-ready {
    0%, 100% { transform: scale(1); opacity: .52; }
    50% { transform: scale(1.13); opacity: .95; }
}
@keyframes cally-agent-speak {
    0%, 100% { transform: translateY(0) scale(1); }
    50% { transform: translateY(-1.5px) scale(1.07); }
}
@keyframes cally-state-pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.075); }
}
@keyframes cally-soft-glow {
    0%, 100% { opacity: .32; transform: scale(.95); }
    50% { opacity: .64; transform: scale(1.06); }
}
@keyframes cally-notification-pulse {
    0%, 88%, 100% { transform: scale(1); }
    94% { transform: scale(1.12); }
}
@keyframes cally-ready-pulse {
    0%, 100% { opacity: .82; transform: scale(1); }
    50% { opacity: 1; transform: scale(1.22); }
}

/* Use restrained light so the profile stays crisp and professional. */
.ai-companion-toggle {
    isolation: isolate;
    filter: drop-shadow(0 4px 12px color-mix(in srgb, var(--cally-cyan) 28%, transparent));
    transition: transform .2s ease, filter .2s ease;
}
.ai-companion-toggle::before,
.ai-companion-toggle::after { content: none; }
.ai-companion-toggle-glow {
    inset: -14px;
    z-index: -2;
    border-radius: 50%;
    background: radial-gradient(ellipse, color-mix(in srgb, var(--cally-cyan) 26%, transparent), color-mix(in srgb, var(--cally-violet) 12%, transparent) 42%, transparent 76%);
    animation: cally-agent-ready 5s ease-in-out infinite;
    pointer-events: none;
}
.ai-companion-toggle .cally-agent-core {
    position: relative;
    z-index: 1;
    display: grid;
    place-items: center;
    width: 58px;
    height: 58px;
    animation: cally-idle-breathe 3.2s ease-in-out infinite;
}
/* Match the closed idle launcher to the ready pulse used by the panel avatar. */
.ai-companion-toggle:not(.panel-open)[data-cally-state="idle"] .cally-agent-core {
    animation: cally-ready-pulse 3.2s ease-in-out infinite;
}
.ai-companion-toggle .cally-agent-core img {
    display: block;
    width: 58px;
    height: 58px;
    filter: drop-shadow(0 1px 3px color-mix(in srgb, var(--cally-electric) 14%, transparent));
}
.ai-companion-toggle:hover {
    transform: translateY(-2px) scale(1.07);
    filter: drop-shadow(0 6px 15px color-mix(in srgb, var(--cally-cyan) 40%, transparent));
}
.ai-companion-toggle:hover .cally-agent-core { animation-duration: 2.2s; }
.ai-companion-toggle:hover .ai-companion-toggle-glow { opacity: .72; }
.ai-companion-toggle:focus-visible { outline-offset: 5px; }
.ai-companion-toggle.panel-open .cally-agent-core { animation-duration: 4.2s; }
.ai-companion-toggle.panel-open .ai-companion-toggle-glow { animation-duration: 3.2s; opacity: .58; }
.ai-companion-toggle.has-notification .ai-badge { animation: cally-notification-pulse 4s ease-in-out infinite; }

.ai-companion-toggle[data-cally-state="listening"] .cally-agent-core {
    animation: cally-agent-speak .85s ease-in-out infinite;
    scale: var(--cally-audio-scale, 1);
    transition: scale 80ms linear;
}
.ai-companion-toggle[data-cally-state="listening"] .ai-companion-toggle-glow { animation-duration: 1s; opacity: .76; }
.ai-companion-toggle[data-cally-state="thinking"] .cally-agent-core { animation: cally-agent-ready 1.15s ease-in-out infinite; }
.ai-companion-toggle[data-cally-state="thinking"] .ai-companion-toggle-glow { animation-duration: .9s; opacity: .72; }
.ai-companion-toggle[data-cally-state="speaking"] .cally-agent-core { animation: cally-agent-speak .72s ease-in-out infinite; }
.ai-companion-toggle[data-cally-state="speaking"] .ai-companion-toggle-glow { animation-duration: .85s; opacity: .78; }
.ai-companion-toggle[data-cally-state="offline"] { filter: grayscale(.84) opacity(.58); }
.ai-companion-toggle[data-cally-state="offline"] .ai-companion-toggle-glow { opacity: .12; animation: none; }
.ai-companion-toggle[data-cally-state="error"] .ai-companion-toggle-glow { filter: drop-shadow(0 0 5px var(--ds-warning)); animation: none; }

/* Keep the Cally orb mark crisp wherever it appears. */
.cally-avatar,
.cally-welcome-orb,
.cally-msg-avatar { position: relative; isolation: isolate; overflow: visible; }
.cally-avatar::before,
.cally-welcome-orb::before,
.cally-msg-avatar::before { content: none; }
.cally-avatar img { position: relative; z-index: 1; width: 34px; height: 34px; }
.cally-avatar { animation: cally-ready-pulse 3.2s ease-in-out infinite; }
.cally-welcome-orb { animation: cally-idle-breathe 3.4s ease-in-out infinite; }
.cally-welcome-orb img { position: relative; z-index: 1; width: 46px; height: 46px; }
.cally-msg-avatar img { position: relative; z-index: 1; width: 20px; height: 20px; }
.cally-status-dot:not(.thinking):not(.listening):not(.speaking):not(.offline):not(.error) {
    animation: cally-ready-pulse 2.4s ease-in-out infinite;
    box-shadow: 0 0 7px color-mix(in srgb, var(--cally-cyan) 72%, transparent);
}

/* One shared identity for voice mode; only the two outer rings move. */
.cally-voice-glow {
    background: radial-gradient(circle, color-mix(in srgb, var(--cally-electric) 25%, transparent), color-mix(in srgb, var(--cally-violet) 8%, transparent) 46%, transparent 74%);
    animation: cally-soft-glow 4s ease-in-out infinite;
}
.cally-voice-ring-outer {
    border-top-color: color-mix(in srgb, var(--cally-cyan) 80%, transparent);
    border-right-color: color-mix(in srgb, var(--cally-electric) 76%, transparent);
    opacity: .48;
    animation-duration: 12s;
}
.cally-voice-ring-inner {
    border-bottom-color: color-mix(in srgb, var(--cally-violet) 68%, transparent);
    border-left-color: color-mix(in srgb, var(--cally-cyan) 65%, transparent);
    opacity: .34;
    animation-duration: 16s;
}
.cally-voice-orb {
    display: grid;
    place-items: center;
    border: 0;
    border-radius: 50%;
    background: none;
    box-shadow: 0 0 24px color-mix(in srgb, var(--cally-electric) 18%, transparent);
    animation: cally-idle-breathe 4s ease-in-out infinite;
    scale: var(--cally-audio-scale, 1);
    transition: scale 80ms linear;
}
.cally-voice-orb img {
    position: relative;
    z-index: 1;
    display: block;
    width: 82px;
    height: 82px;
}
.cally-voice-orb::before,
.cally-voice-orb::after { content: none; }
.cally-voice-overlay.listening .cally-voice-orb img { animation: cally-state-pulse 1.05s ease-in-out infinite; }
.cally-voice-overlay.listening .cally-voice-ring-outer { animation-duration: 3.2s; opacity: .78; }
.cally-voice-overlay.listening .cally-voice-ring-inner { animation-duration: 2.4s; opacity: .55; }
.cally-voice-overlay.listening .cally-voice-glow { animation-duration: 1.4s; }
.cally-voice-overlay.thinking .cally-voice-orb img { animation: cally-soft-glow 1.2s ease-in-out infinite; }
.cally-voice-overlay.thinking .cally-voice-ring-outer { animation-duration: 2.4s; opacity: .72; }
.cally-voice-overlay.thinking .cally-voice-ring-inner { animation-duration: 1.8s; opacity: .54; }
.cally-voice-overlay.speaking .cally-voice-orb img { animation: cally-state-pulse .8s ease-in-out infinite; }
.cally-voice-overlay.speaking .cally-voice-ring-outer { animation-duration: 4s; opacity: .68; }
.cally-voice-overlay.speaking .cally-voice-ring-inner { animation-duration: 3s; opacity: .48; }
.cally-voice-overlay.offline .cally-voice-orb { filter: grayscale(.7); opacity: .58; }
.cally-voice-overlay.error .cally-voice-ring-outer { border-color: var(--ds-warning); opacity: .8; }
.cally-status-dot.thinking { background: var(--cally-violet); }
.cally-status-dot.listening { background: var(--cally-electric); }
.cally-status-dot.speaking { background: var(--cally-cyan); }
.cally-status-dot.offline { background: var(--ds-subtle); }
.cally-status-dot.error { background: var(--ds-warning); }

@media (prefers-reduced-motion: reduce) {
    .ai-companion-toggle,
    .ai-companion-toggle::before,
    .ai-companion-toggle::after,
    .ai-companion-toggle-glow,
    .ai-companion-toggle .cally-agent-core,
    .ai-companion-toggle.has-notification .ai-badge,
    .ai-companion-toggle:hover,
    .ai-companion-toggle[data-cally-state="listening"] .cally-agent-core,
    .cally-avatar,
    .cally-welcome-orb,
    .cally-status-dot,
    .cally-voice-orb,
    .cally-voice-orb img,
    .cally-voice-ring,
    .cally-voice-glow {
        animation: none !important;
        transition: none !important;
    }
    .ai-companion-toggle:hover { transform: none !important; filter: none !important; }
    .ai-companion-toggle[data-cally-state="listening"] .cally-agent-core { scale: 1 !important; }
    .cally-voice-orb { scale: 1 !important; }
}

/* Keep all four setup steps visible on narrow screens. */
.cally-setup-progress { flex-wrap:wrap; }
.cally-industry-grid .industry-card-btn[aria-pressed="true"] { border-color:var(--primary-color);background:color-mix(in srgb,var(--primary-color) 10%,transparent); }
#onboard-step-industry > .form-label { display:block;margin-top:16px; }

.cally-signup-page{margin:0;min-height:100dvh;background:var(--bg-secondary);display:flex;align-items:center;justify-content:center;padding:24px;box-sizing:border-box}
.cally-verification{max-width:580px;max-height:none}
.cally-verification h1{font-size:24px;margin:0}
.cally-verification form .btn{margin-top:12px}

/* Conversational presentation, with no artificial delay before fields are usable. */
.cally-message-typing::after{content:'▍';color:var(--ds-primary);animation:cally-cursor .8s steps(2,end) infinite}
@keyframes cally-cursor{50%{opacity:0}}
.cally-processing{display:flex;align-items:center;gap:10px;margin:14px 0;padding:12px;background:var(--bg-secondary);border-radius:12px;color:var(--text-secondary);font-size:13px}
.cally-processing[hidden]{display:none}
.cally-typing-dots{display:flex;gap:4px}.cally-typing-dots i{width:5px;height:5px;border-radius:50%;background:var(--ds-primary);animation:cally-dot 1s ease-in-out infinite}.cally-typing-dots i:nth-child(2){animation-delay:.15s}.cally-typing-dots i:nth-child(3){animation-delay:.3s}
@keyframes cally-dot{50%{transform:translateY(-3px);opacity:.4}}
.cally-optional-details{margin-top:14px}.cally-optional-details summary{cursor:pointer;font-size:13px;color:var(--text-secondary)}
.cally-landing-launch{position:fixed;right:22px;bottom:22px;z-index:900;display:flex;align-items:center;gap:8px;padding:12px 18px;border:1px solid var(--ds-primary);border-radius:32px;background:var(--bg-primary);color:var(--text-primary);font:600 14px system-ui;box-shadow:0 8px 24px color-mix(in srgb,var(--text-primary) 16%,transparent);cursor:pointer}
.cally-landing-dialog{padding:0;border:1px solid var(--border-color);max-width:520px}.cally-landing-dialog::backdrop{background:color-mix(in srgb,var(--text-primary) 50%,transparent);backdrop-filter:blur(4px)}.cally-landing-dialog h2{flex:1;font-size:24px;margin:0}.cally-landing-dialog .form-label{display:block;margin-bottom:8px}.cally-landing-dialog form>.btn{margin-top:16px}.cally-landing-message{min-height:72px;line-height:1.6}
@media(prefers-reduced-motion:reduce){.cally-message-typing::after,.cally-typing-dots i{animation:none}}

#cally-setup-message{flex:1;box-sizing:border-box}
/* sign-up progress steps (comp_progress_steps) above the verify-email card header */
.cally-verification > .ds-steps { margin: 0; padding: var(--ds-space-5) var(--ds-space-6) var(--ds-space-4); }
