/* ==================== */
/* Splash Screen Styles */
/* ==================== */
.splash-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--color-bg);
    z-index: 9999;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 40px;
    opacity: 1;
    transition: opacity 0.6s ease;
}

.splash-screen.fade-out {
    opacity: 0;
    pointer-events: none;
}

.splash-screen.hidden {
    display: none;
}

/* ============================= */
/* Triangle Framework Intro      */
/* ============================= */
/* Full-screen video overlay (sequential onboarding) */
.fullscreen-video-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #000;
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 1;
    transition: opacity 0.6s ease;
}
.fullscreen-video-overlay.fade-out { opacity: 0; }
.fullscreen-video-el {
    width: 100%;
    height: 100%;
    object-fit: contain;
}
.fullscreen-video-skip {
    position: absolute;
    top: 24px;
    right: 24px;
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.6);
    font-size: 14px;
    cursor: pointer;
    padding: 8px 16px;
    border-radius: 8px;
    transition: color 0.2s, background 0.2s;
    font-family: 'Inter', sans-serif;
    z-index: 2;
}
.fullscreen-video-skip:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.1);
}
.fullscreen-video-play {
    position: absolute;
    background: rgba(255, 255, 255, 0.15);
    border: none;
    border-radius: 50%;
    width: 96px;
    height: 96px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.2s;
}
.fullscreen-video-play:hover {
    background: rgba(255, 255, 255, 0.25);
}

.triangle-intro-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--color-bg, #f8f9fa);
    z-index: 9999;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    opacity: 0;
    animation: triOverlayFadeIn 0.8s ease forwards;
}

.triangle-intro-overlay.hidden {
    display: none;
}

.triangle-intro-overlay.fade-out {
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.6s ease;
}

@keyframes triOverlayFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* Skip button */
.triangle-skip-btn {
    position: absolute;
    top: 24px;
    right: 24px;
    background: none;
    border: none;
    color: var(--color-text-tertiary, #94a3b8);
    font-size: 14px;
    cursor: pointer;
    padding: 8px 16px;
    border-radius: 8px;
    transition: color 0.2s, background 0.2s;
    font-family: 'Inter', sans-serif;
    z-index: 2;
}

.triangle-skip-btn:hover {
    color: var(--color-text-primary, #1e293b);
    background: var(--color-bg-hover, rgba(0, 0, 0, 0.05));
}

/* Mute button */
.triangle-mute-btn {
    position: absolute;
    top: 24px;
    left: 24px;
    background: none;
    border: none;
    color: var(--color-text-tertiary, #94a3b8);
    cursor: pointer;
    padding: 8px;
    border-radius: 8px;
    transition: color 0.2s, background 0.2s;
    z-index: 2;
}

.triangle-mute-btn:hover {
    color: var(--color-text-primary, #1e293b);
    background: var(--color-bg-hover, rgba(0, 0, 0, 0.05));
}

.triangle-mute-btn .hidden {
    display: none;
}

/* Clean SVG-based triangle layout — no image dependency */
.triangle-intro-content {
    position: relative;
    width: min(70vh, 80vw);
    aspect-ratio: 1;
    flex-shrink: 0;
}

/* Main SVG fills the square container */
.tri-diagram-svg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1;
}

/* Connector lines — blue dotted */
.tri-connector {
    stroke: var(--color-primary, #4f46e5);
    stroke-width: 2;
    stroke-dasharray: 8 6;
    stroke-linecap: round;
    opacity: 0;
    transition: opacity 0.6s ease;
}

.tri-connector.tri-line-active {
    opacity: 0.5;
}

.tri-connector.tri-line-full {
    opacity: 1;
}

/* Node circles — positioned as % of the square container */
.tri-highlight {
    position: absolute;
    width: 80px;
    height: 80px;
    border-radius: 50%;
    border: 3px solid var(--color-primary, #4f46e5);
    opacity: 0.15;
    pointer-events: none;
    transition: opacity 0.4s ease-in-out, box-shadow 0.4s ease-in-out, transform 0.4s ease-in-out, filter 0.4s ease-in-out, border-color 0.4s ease-in-out;
    box-shadow: 0 0 0 4px rgba(79, 70, 229, 0.15);
    z-index: 2;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    transform: translate(-50%, -50%);
}

/* Letter inside outer circles (C, T, A) */
.tri-node-letter {
    font-family: 'Inter', sans-serif;
    font-size: 28px;
    font-weight: 700;
    color: var(--color-primary, #4f46e5);
    line-height: 1;
}

/* Person icon inside human circle */
.tri-node-icon {
    width: 36px;
    height: 36px;
    color: #d97706;
}

/* Label below the circle */
.tri-node-label {
    position: absolute;
    bottom: -28px;
    left: 50%;
    transform: translateX(-50%);
    font-family: 'Inter', sans-serif;
    font-size: 14px;
    font-weight: 600;
    letter-spacing: 1.5px;
    color: var(--color-text-muted, #6b7280);
    white-space: nowrap;
}

/* === Active / glow states === */

.tri-highlight.active {
    opacity: 1;
    box-shadow: 0 0 12px 4px rgba(79, 70, 229, 0.4), 0 0 0 4px rgba(79, 70, 229, 0.15);
    filter: drop-shadow(0 0 8px rgba(79, 70, 229, 0.5));
}

/* Human active — amber */
.tri-highlight-4.active {
    border-color: #d97706;
    box-shadow: 0 0 12px 4px rgba(217, 119, 6, 0.4), 0 0 0 4px rgba(217, 119, 6, 0.15);
    filter: drop-shadow(0 0 8px rgba(217, 119, 6, 0.5));
}

.tri-highlight.glow-amber {
    opacity: 1;
    border-color: #f59e0b;
    box-shadow: 0 0 20px 6px rgba(245, 158, 11, 0.5), 0 0 0 4px rgba(245, 158, 11, 0.2);
    filter: drop-shadow(0 0 12px rgba(245, 158, 11, 0.6));
}
.tri-highlight-4.glow-amber {
    transform: translate(-50%, -50%) scale(1.1);
}

/* Phase 4 — strong amber glow on Human */
.tri-highlight.glow-blue-strong {
    opacity: 1;
}
.tri-highlight-4.glow-blue-strong {
    transform: translate(-50%, -50%) scale(1.15);
    border-color: #d97706;
    box-shadow: 0 0 24px 8px rgba(217, 119, 6, 0.45), 0 0 0 5px rgba(217, 119, 6, 0.2);
    filter: drop-shadow(0 0 14px rgba(217, 119, 6, 0.55));
    transition: transform 0.4s ease, box-shadow 0.4s ease, opacity 0.3s ease, filter 0.3s ease;
}

/* One-shot pulse for outer circles during Phase 4 */
@keyframes triPulseOnce {
    0% { box-shadow: 0 0 12px 4px rgba(79, 70, 229, 0.4), 0 0 0 4px rgba(79, 70, 229, 0.15); }
    50% { box-shadow: 0 0 20px 8px rgba(79, 70, 229, 0.6), 0 0 0 6px rgba(79, 70, 229, 0.25); }
    100% { box-shadow: 0 0 12px 4px rgba(79, 70, 229, 0.4), 0 0 0 4px rgba(79, 70, 229, 0.15); }
}
.tri-highlight.pulse-once {
    opacity: 1;
    animation: triPulseOnce 0.8s ease-in-out 1;
}

/* Idle pulse — Phase 5 */
@keyframes triIdlePulse {
    0%, 100% { box-shadow: 0 0 8px 3px rgba(79, 70, 229, 0.3), 0 0 0 4px rgba(79, 70, 229, 0.15); }
    50% { box-shadow: 0 0 14px 5px rgba(79, 70, 229, 0.45), 0 0 0 5px rgba(79, 70, 229, 0.2); }
}
.tri-highlight.idle-pulse {
    opacity: 1;
    animation: triIdlePulse 2.5s ease-in-out infinite;
}

@keyframes triIdlePulseAmber {
    0%, 100% { box-shadow: 0 0 12px 4px rgba(245, 158, 11, 0.35), 0 0 0 4px rgba(245, 158, 11, 0.15); }
    50% { box-shadow: 0 0 18px 6px rgba(245, 158, 11, 0.5), 0 0 0 5px rgba(245, 158, 11, 0.2); }
}
.tri-highlight.idle-pulse-amber {
    opacity: 1;
    border-color: #f59e0b;
    animation: triIdlePulseAmber 2.5s ease-in-out infinite;
}

/* === Node positions — % of square container, matching SVG viewBox 500x500 === */

/* Coworker (top center) — SVG point: 250, 50 → 50%, 10% */
.tri-highlight-1 {
    top: 10%;
    left: 50%;
}

/* Tools (bottom left) — SVG point: 107, 380 → 21.4%, 76% */
.tri-highlight-2 {
    top: 76%;
    left: 21.4%;
}

/* Agents (bottom right) — SVG point: 393, 380 → 78.6%, 76% */
.tri-highlight-3 {
    top: 76%;
    left: 78.6%;
}

/* Human (center) — SVG point: 250, 250 → 50%, 50% */
.tri-highlight-4 {
    top: 50%;
    left: 50%;
    border-color: #d97706;
    box-shadow: 0 0 0 4px rgba(217, 119, 6, 0.15);
}

.tri-highlight-4 .tri-node-icon {
    color: #d97706;
}

.tri-highlight-4 .tri-node-label {
    color: #92400e;
}

/* Edge labels — hidden (kept for JS references) */
.tri-edge-label {
    display: none;
}

/* Tagline text below diagram */
.tri-tagline {
    text-align: center;
    font-size: 16px;
    font-weight: 600;
    color: var(--color-text-primary, #1e293b);
    font-family: 'Inter', sans-serif;
    margin-top: 16px;
    opacity: 0;
    transition: opacity 0.6s ease;
    pointer-events: none;
}

.tri-tagline.tri-tagline-visible {
    opacity: 1;
}

/* Tab highlight used during triangle-to-portal transition */
.tab-btn.tri-tab-highlight {
    box-shadow: 0 0 0 2px rgba(79, 70, 229, 0.6), 0 0 12px 4px rgba(79, 70, 229, 0.3);
    border-radius: 8px;
    transition: box-shadow 0.3s ease;
}

/* Fade-in keyframe (used by continue button and labels) */
@keyframes triLabelFadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Continue button */
.triangle-continue-btn {
    margin-top: 16px;
    padding: 14px 48px;
    background: var(--color-primary, #4f46e5);
    color: #fff;
    border: none;
    border-radius: 12px;
    font-size: 16px;
    font-weight: 600;
    font-family: 'Inter', sans-serif;
    cursor: pointer;
    transition: background 0.2s, transform 0.15s;
    opacity: 0;
}

.triangle-continue-btn:not(.hidden) {
    animation: triLabelFadeIn 0.6s ease forwards;
}

.triangle-continue-btn:hover {
    background: var(--color-primary-hover, #4338ca);
    transform: scale(1.03);
}

.triangle-continue-btn.hidden {
    display: none;
}

/* ========================= */
/* Policy Acknowledgment Gate */
/* ========================= */
.policy-gate {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.75);
    z-index: 10002;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--space-4);
    box-sizing: border-box;
}

.policy-gate.hidden {
    display: none;
}

.policy-gate.fade-out {
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.4s ease;
}

.policy-gate-card {
    background: var(--color-bg);
    border-radius: var(--radius-xl);
    width: 100%;
    max-width: 680px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow-xl);
    overflow: hidden;
}

.policy-gate-header {
    padding: var(--space-8) var(--space-8) var(--space-5);
    border-bottom: 1px solid var(--color-border);
    flex-shrink: 0;
    text-align: center;
}

.policy-gate-logo-img {
    max-width: 140px;
    width: 50%;
    margin-bottom: var(--space-4);
}

.policy-gate-title {
    font-size: 20px;
    font-weight: 700;
    color: var(--color-text);
    margin: 0 0 var(--space-2);
}

.policy-gate-subtitle {
    font-size: 13px;
    color: var(--color-text-muted);
    margin: 0;
}

.policy-gate-body {
    overflow-y: auto;
    flex: 1;
    padding: var(--space-6) var(--space-8);
    scroll-behavior: smooth;
}

.policy-section {
    margin-bottom: var(--space-6);
}

.policy-section:last-child {
    margin-bottom: 0;
}

.policy-section h3 {
    font-size: 13px;
    font-weight: 700;
    color: var(--color-text);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin: 0 0 var(--space-2);
}

.policy-section p {
    font-size: 14px;
    line-height: 1.65;
    color: var(--color-text-secondary);
    margin: 0;
}

.policy-gate-footer {
    padding: var(--space-5) var(--space-8) var(--space-8);
    border-top: 1px solid var(--color-border);
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    gap: var(--space-4);
}

.policy-gate-signature {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 13px;
    color: var(--color-text-muted);
    padding: var(--space-3) var(--space-4);
    background: var(--color-bg-subtle);
    border-radius: var(--radius-md);
    border: 1px solid var(--color-border);
}

.policy-gate-sig-name {
    font-weight: 600;
    color: var(--color-text);
}

.policy-gate-sig-date {
    color: var(--color-text-muted);
}

.policy-gate-checkbox-row {
    display: flex;
    align-items: flex-start;
    gap: var(--space-3);
    font-size: 14px;
    color: var(--color-text-secondary);
    cursor: pointer;
    line-height: 1.5;
}

.policy-gate-checkbox-row input[type="checkbox"] {
    margin-top: 3px;
    width: 16px;
    height: 16px;
    flex-shrink: 0;
    accent-color: var(--color-primary);
    cursor: pointer;
}

.policy-gate-checkbox-locked {
    opacity: 0.4;
    cursor: not-allowed;
}

.policy-gate-checkbox-locked input[type="checkbox"] {
    pointer-events: none;
    cursor: not-allowed;
}

.policy-gate-scroll-hint {
    font-size: 13px;
    color: var(--color-warning);
    background: var(--color-warning-bg);
    border: 1px solid rgba(234, 179, 8, 0.2);
    border-radius: var(--radius-md);
    padding: var(--space-2) var(--space-3);
    text-align: center;
    animation: policyHintFadeIn 0.25s ease;
}

.policy-gate-scroll-hint.hidden {
    display: none;
}

@keyframes policyHintFadeIn {
    from { opacity: 0; transform: translateY(-4px); }
    to   { opacity: 1; transform: translateY(0); }
}

.policy-gate-btn {
    width: 100%;
    padding: var(--space-4);
    background: var(--color-primary);
    color: white;
    border: none;
    border-radius: var(--radius-md);
    font-size: 15px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: background 0.15s ease, opacity 0.15s ease;
}

.policy-gate-btn:hover:not(:disabled) {
    background: var(--color-primary-hover);
}

.policy-gate-btn:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

/* Policy Gate — Success Screen */
.policy-gate-success {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: var(--space-10) var(--space-8);
    gap: var(--space-4);
    flex: 1;
}

.policy-gate-success.hidden {
    display: none;
}

.policy-success-icon {
    margin-bottom: var(--space-2);
}

.policy-success-title {
    font-size: 22px;
    font-weight: 700;
    color: var(--color-text);
    margin: 0;
}

.policy-success-subtitle {
    font-size: 14px;
    color: var(--color-text-muted);
    margin: 0;
}

.policy-success-actions {
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
    width: 100%;
    max-width: 300px;
    margin-top: var(--space-4);
}

.policy-success-download-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    padding: var(--space-3) var(--space-4);
    background: transparent;
    color: var(--color-primary);
    border: 1.5px solid var(--color-primary);
    border-radius: var(--radius-lg);
    font-size: 14px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease;
}

.policy-success-download-btn:hover {
    background: var(--color-primary);
    color: white;
}

/* Policy Compliance list in General Settings */
.policy-compliance-list {
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
}

.policy-compliance-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-3) var(--space-4);
    border-radius: var(--radius-md);
    background: var(--color-bg-subtle);
    border: 1px solid var(--color-border);
    font-size: 13px;
}

.policy-compliance-name {
    font-weight: 500;
    color: var(--color-text);
}

.policy-compliance-badge {
    font-size: 12px;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: var(--radius-sm);
}

.policy-compliance-badge--acknowledged {
    background: var(--color-success-bg);
    color: var(--color-success);
}

.policy-compliance-badge--pending {
    background: var(--color-warning-bg);
    color: var(--color-warning);
}

.splash-logo {
    max-width: 320px;
    width: 60%;
    opacity: 0;
    transform: scale(0.92);
    animation: splashFadeIn 0.6s ease forwards;
}

@keyframes splashFadeIn {
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.splash-continue-btn {
    padding: 12px 48px;
    background: transparent;
    border: 1.5px solid #d1d5db;
    border-radius: 28px;
    font-size: 15px;
    font-weight: 500;
    color: var(--color-text-muted);
    cursor: pointer;
    letter-spacing: 0.02em;
    opacity: 0;
    animation: splashFadeIn 0.5s ease 0.8s forwards;
    transition: all 0.2s ease;
}

.splash-continue-btn:hover {
    border-color: var(--color-primary);
    color: #4F46E5;
    background: rgba(99, 102, 241, 0.04);
}

.splash-btn-group {
    display: flex;
    gap: 16px;
    align-items: center;
    opacity: 0;
    animation: splashFadeIn 0.5s ease 0.8s forwards;
}

.splash-btn-group .splash-continue-btn {
    opacity: 1;
    animation: none;
}

.splash-tour-btn:hover {
    border-color: var(--color-primary);
    color: #4F46E5;
    background: rgba(99, 102, 241, 0.04);
}

/* ==================== */
/* Onboarding Overlay Styles */
/* ==================== */
.onboarding-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    z-index: 9998;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 1;
    transition: opacity 0.4s ease;
    backdrop-filter: blur(4px);
}

.onboarding-overlay.hidden {
    display: none;
}

.onboarding-overlay.fade-out {
    opacity: 0;
    pointer-events: none;
}

.onboarding-close-btn {
    position: absolute;
    top: 20px;
    right: 24px;
    background: rgba(255, 255, 255, 0.15);
    border: none;
    color: #fff;
    font-size: 28px;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
    z-index: 10;
}

.onboarding-close-btn:hover {
    background: rgba(255, 255, 255, 0.3);
}

.onboarding-close-btn.hidden {
    display: none;
}

.onboarding-content {
    background: linear-gradient(180deg, #ffffff 0%, #f9fafb 100%);
    border-radius: 24px;
    padding: 48px;
    max-width: 600px;
    width: 90%;
    text-align: center;
    box-shadow:
        0 20px 60px rgba(0, 0, 0, 0.25),
        0 0 0 1px rgba(255, 255, 255, 0.1) inset;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.onboarding-title {
    font-size: 28px;
    font-weight: 600;
    color: var(--color-text);
    margin-bottom: 8px;
    transition: opacity 0.3s ease;
}

.onboarding-subtitle {
    font-size: 16px;
    color: #666;
    margin-bottom: 32px;
    transition: opacity 0.3s ease;
}

.selection-label {
    font-size: 14px;
    font-weight: 500;
    color: #333;
    margin-bottom: 16px;
    text-align: left;
}

.avatar-selection {
    margin-bottom: 32px;
}

/* Old avatar-grid overrides removed — see main .avatar-grid block below */

.avatar-option.selected {
    border-color: var(--color-primary);
    box-shadow:
        0 0 0 3px rgba(79, 70, 229, 0.2),
        0 4px 16px rgba(79, 70, 229, 0.3);
    transform: scale(1.05);
}

.name-selection {
    margin-bottom: 32px;
}

.assistant-name-input {
    width: 100%;
    padding: 14px 18px;
    font-size: 16px;
    border: 2px solid #e5e5e5;
    border-radius: 12px;
    outline: none;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    background: linear-gradient(180deg, #ffffff 0%, #f9fafb 100%);
}

.assistant-name-input:focus {
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
    background: var(--color-bg);
}

.assistant-name-input::placeholder {
    color: #aaa;
}

.onboarding-continue-btn {
    padding: 14px 48px;
    font-size: 16px;
    font-weight: 600;
    background: linear-gradient(135deg, #4f46e5 0%, #4338ca 100%);
    color: white;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow:
        0 4px 12px rgba(79, 70, 229, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.15);
}

.onboarding-continue-btn:hover:not(:disabled) {
    background: linear-gradient(135deg, #4338ca 0%, #3730a3 100%);
    transform: translateY(-2px);
    box-shadow:
        0 6px 20px rgba(79, 70, 229, 0.4),
        inset 0 1px 0 rgba(255, 255, 255, 0.15);
}

.onboarding-continue-btn:active:not(:disabled) {
    transform: translateY(0);
}

.onboarding-continue-btn:disabled {
    background: linear-gradient(135deg, #d1d5db 0%, #9ca3af 100%);
    cursor: not-allowed;
    box-shadow: none;
}

/* Tone / Personality Selection */
.tone-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
    margin-bottom: 32px;
}

.tone-option {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 20px 16px;
    border: 2px solid #e5e7eb;
    border-radius: 14px;
    cursor: pointer;
    transition: all 0.2s ease;
    background: #fff;
}

.tone-option:hover {
    border-color: rgba(79, 70, 229, 0.4);
    background: #f9f8ff;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.tone-option.selected {
    border-color: var(--color-primary);
    background: #f5f3ff;
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.15);
}

.tone-label {
    font-size: 16px;
    font-weight: 600;
    color: var(--color-text);
    margin-bottom: 4px;
}

.tone-desc {
    font-size: 13px;
    color: var(--color-text-muted);
}

/* ==================== */
/* Avatar Builder Styles */
/* ==================== */
.avatar-builder {
    max-width: 880px;
    max-height: 90vh;
    overflow-y: scroll;
    padding: 36px 40px;
}

.avatar-builder::-webkit-scrollbar {
    width: 8px;
}

.avatar-builder::-webkit-scrollbar-track {
    background: transparent;
    margin: 12px 0;
}

.avatar-builder::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.15);
    border-radius: 4px;
}

.avatar-builder::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 0, 0, 0.25);
}

.builder-progress {
    margin-bottom: 24px;
}

.progress-bar {
    height: 6px;
    background: rgba(0, 0, 0, 0.1);
    border-radius: 3px;
    overflow: hidden;
    margin-bottom: 8px;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #4f46e5 0%, #7c3aed 100%);
    border-radius: 3px;
    transition: width 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    width: 50%;
}

.progress-text {
    font-size: 12px;
    color: #888;
    font-weight: 500;
}

.builder-step {
    display: none;
    animation: stepFadeIn 0.3s ease-out;
}

.builder-step.active {
    display: block;
}

@keyframes stepFadeIn {
    from {
        opacity: 0;
        transform: translateX(20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.builder-options {
    display: flex;
    gap: 16px;
    justify-content: center;
    flex-wrap: wrap;
    margin-top: 20px;
}

.builder-options.style-options {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
}

.builder-option {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 24px 32px;
    min-width: 140px;
    background: linear-gradient(180deg, #f9fafb 0%, #f3f4f6 100%);
    border: 2px solid rgba(0, 0, 0, 0.08);
    border-radius: 16px;
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.builder-option:hover {
    border-color: rgba(79, 70, 229, 0.3);
    background: linear-gradient(180deg, #ffffff 0%, #f9fafb 100%);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(79, 70, 229, 0.15);
}

.builder-option.selected {
    border-color: var(--color-primary);
    background: linear-gradient(135deg, rgba(79, 70, 229, 0.08) 0%, rgba(79, 70, 229, 0.12) 100%);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.15);
}

.option-icon {
    font-size: 36px;
    margin-bottom: 8px;
}

.option-label {
    font-size: 15px;
    font-weight: 600;
    color: var(--color-text);
}

.option-desc {
    font-size: 12px;
    color: #888;
    margin-top: 4px;
}

.selection-hint {
    font-size: 13px;
    color: #888;
    margin-top: -8px;
    margin-bottom: 16px;
}

.builder-textarea {
    width: 100%;
    min-height: 120px;
    padding: 16px;
    font-size: 15px;
    font-family: inherit;
    border: 2px solid #e5e5e5;
    border-radius: 12px;
    resize: vertical;
    outline: none;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    background: linear-gradient(180deg, #ffffff 0%, #f9fafb 100%);
}

.builder-textarea:focus {
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
    background: var(--color-bg);
}

.builder-textarea::placeholder {
    color: #aaa;
}

/* Avatar Grid */
.avatar-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 16px;
    max-width: 780px;
    margin: 0 auto;
    padding: 10px;
    max-height: none;
    overflow-y: visible;
    transition: all 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Collapsed state — grid becomes single centered column */
.avatar-grid.avatar-chosen {
    grid-template-columns: 1fr;
    gap: 0;
    max-width: 160px;
    padding: 0;
}

.avatar-option {
    width: 140px;
    height: 172px;
    border-radius: 20px;
    overflow: hidden;
    cursor: pointer;
    border: 3px solid transparent;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    opacity: 1;
    position: relative;
}

.avatar-option img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.avatar-option:hover {
    transform: scale(1.35);
    border-color: #c7d2fe;
    box-shadow: 0 8px 24px rgba(99, 102, 241, 0.3);
    z-index: 10;
}

.avatar-option.selected {
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.3);
    transform: scale(1.08);
}

/* When grid has chosen state — hide unselected, grow selected */
.avatar-grid.avatar-chosen .avatar-option:not(.selected) {
    width: 0;
    height: 0;
    opacity: 0;
    border: 0;
    margin: 0;
    padding: 0;
    box-shadow: none;
    overflow: hidden;
    pointer-events: none;
}

.avatar-grid.avatar-chosen .avatar-option.selected {
    width: 160px;
    height: 196px;
    border-radius: 22px;
    margin: 0 auto;
    border-color: var(--color-primary);
    box-shadow: 0 8px 30px rgba(99, 102, 241, 0.25);
    transform: scale(1);
    cursor: default;
}

/* Upload Your Own — in-grid avatar slot */
.avatar-upload-option {
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px dashed #c7c7cc !important;
    background: linear-gradient(180deg, #f9fafb 0%, #f3f4f6 100%);
    box-shadow: none !important;
}

.avatar-upload-option:hover {
    border-color: var(--color-primary) !important;
    background: linear-gradient(180deg, #eef2ff 0%, #e0e7ff 100%);
}

.avatar-upload-inner {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    gap: 6px;
}

.avatar-upload-inner .upload-icon {
    font-size: 28px;
    font-weight: 300;
    color: var(--color-text-faint);
    line-height: 1;
}

.avatar-upload-inner .upload-label {
    font-size: 12px;
    color: var(--color-text-faint);
    font-weight: 500;
}

.avatar-upload-option:hover .upload-icon {
    color: #4f46e5;
}

.avatar-upload-option:hover .upload-label {
    color: #4f46e5;
}

/* Drag over state */
.avatar-upload-option.drag-over {
    border-color: var(--color-primary) !important;
    background: linear-gradient(180deg, #eef2ff 0%, #e0e7ff 100%);
    transform: scale(1.05);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2) !important;
}

/* Hide upload & none slots when grid collapses */
.avatar-grid.avatar-chosen .avatar-upload-option,
.avatar-grid.avatar-chosen .avatar-none-option:not(.selected) {
    display: none;
}

/* "None" avatar — matches upload tile dashed style */
.avatar-none-option {
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px dashed #c7c7cc !important;
    background: linear-gradient(180deg, #f9fafb 0%, #f3f4f6 100%);
    box-shadow: none !important;
}

.avatar-none-option:hover {
    border-color: var(--color-primary) !important;
    background: linear-gradient(180deg, #eef2ff 0%, #e0e7ff 100%);
}

.avatar-none-inner {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
}

.avatar-none-inner .none-label {
    font-size: 14px;
    color: var(--color-text-faint);
    font-weight: 500;
}

.avatar-none-option:hover .none-label {
    color: #4f46e5;
}

/* When None is selected and grid collapses, show a larger version */
.avatar-grid.avatar-chosen .avatar-none-option.selected {
    display: flex;
    border: 2px dashed var(--color-primary) !important;
    background: linear-gradient(180deg, #eef2ff 0%, #e0e7ff 100%);
}

.avatar-grid.avatar-chosen .avatar-none-option.selected .none-label {
    font-size: 18px;
    color: var(--color-primary);
}

/* ==================== */
/* Avatar Crop Modal    */
/* ==================== */
.avatar-crop-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    backdrop-filter: blur(4px);
}

.avatar-crop-overlay.hidden {
    display: none;
}

.avatar-crop-modal {
    background: white;
    border-radius: 20px;
    padding: 28px;
    width: 90%;
    max-width: 420px;
    box-shadow: 0 24px 80px rgba(0, 0, 0, 0.25);
    text-align: center;
}

.avatar-crop-modal h3 {
    font-size: 20px;
    font-weight: 600;
    color: var(--color-text);
    margin: 0 0 4px;
}

.crop-subtitle {
    font-size: 14px;
    color: var(--color-text-muted);
    margin: 0 0 20px;
}

.crop-viewport {
    width: 200px;
    height: 245px;
    margin: 0 auto 20px;
    border-radius: 20px;
    overflow: hidden;
    position: relative;
    background: var(--color-bg-muted);
    border: 2px solid #e5e7eb;
    cursor: grab;
}

.crop-viewport:active {
    cursor: grabbing;
}

.crop-viewport img {
    position: absolute;
    top: 50%;
    left: 50%;
    transform-origin: center center;
    user-select: none;
    -webkit-user-drag: none;
}

/* Drag hint overlay */
.crop-drag-hint {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    background: rgba(0, 0, 0, 0.35);
    z-index: 2;
    pointer-events: none;
    opacity: 1;
    transition: opacity 0.4s ease;
    border-radius: 18px;
}

.crop-drag-hint.fade-out {
    opacity: 0;
}

.crop-drag-hint svg {
    filter: drop-shadow(0 1px 3px rgba(0,0,0,0.3));
}

.crop-drag-hint span {
    font-size: 12px;
    font-weight: 600;
    color: white;
    text-shadow: 0 1px 3px rgba(0,0,0,0.4);
}

/* Hover hint — subtle move icon in corner */
.crop-viewport::after {
    content: '';
    position: absolute;
    bottom: 8px;
    right: 8px;
    width: 24px;
    height: 24px;
    background: rgba(255,255,255,0.85);
    border-radius: 6px;
    z-index: 1;
    opacity: 0;
    transition: opacity 0.2s ease;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23374151' stroke-width='2'%3E%3Cpolyline points='5 9 2 12 5 15'/%3E%3Cpolyline points='9 5 12 2 15 5'/%3E%3Cpolyline points='15 19 12 22 9 19'/%3E%3Cpolyline points='19 9 22 12 19 15'/%3E%3Cline x1='2' y1='12' x2='22' y2='12'/%3E%3Cline x1='12' y1='2' x2='12' y2='22'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: center;
    background-size: 14px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.15);
}

.crop-viewport:hover::after {
    opacity: 1;
}

.crop-viewport:active::after {
    opacity: 0;
}

.crop-controls {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 14px;
    padding: 0 10px;
}

.crop-control-label {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 13px;
    font-weight: 500;
    color: var(--color-text-muted);
    white-space: nowrap;
    min-width: 72px;
}

.crop-zoom-slider {
    flex: 1;
    -webkit-appearance: none;
    appearance: none;
    height: 6px;
    background: #e5e7eb;
    border-radius: 3px;
    outline: none;
}

.crop-zoom-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--color-primary);
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(99, 102, 241, 0.3);
}

.crop-zoom-slider::-moz-range-thumb {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--color-primary);
    cursor: pointer;
    border: none;
    box-shadow: 0 2px 6px rgba(99, 102, 241, 0.3);
}

.crop-actions {
    display: flex;
    gap: 10px;
    justify-content: center;
    margin-top: 20px;
}

.crop-cancel-btn {
    padding: 10px 24px;
    border: 1.5px solid #d1d5db;
    border-radius: 10px;
    background: white;
    color: var(--color-text-secondary);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    font-family: inherit;
    transition: background 0.15s;
}

.crop-cancel-btn:hover {
    background: var(--color-bg-muted);
}

.crop-apply-btn {
    padding: 10px 24px;
    border: none;
    border-radius: 10px;
    background: var(--color-primary);
    color: white;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    font-family: inherit;
    transition: background 0.15s;
}

.crop-apply-btn:hover {
    background: var(--color-primary-hover);
}

/* Name Reveal — animated in after avatar pick */
.name-reveal {
    max-height: 0;
    overflow: hidden;
    opacity: 0;
    transition: max-height 0.5s cubic-bezier(0.4, 0, 0.2, 1),
                opacity 0.5s ease 0.15s,
                margin-top 0.5s ease;
    margin-top: 0;
}

.name-reveal.visible {
    max-height: 220px;
    opacity: 1;
    margin-top: 24px;
}

.name-reveal-inner {
    text-align: center;
    animation: nameSlideUp 0.4s ease-out 0.15s both;
}

/* nameSlideUp animation for name reveal elements */
@keyframes nameSlideUp {
    from {
        opacity: 0;
        transform: translateY(12px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.name-reveal .assistant-name-input {
    width: auto;
    max-width: none;
    padding: 10px 16px;
    font-size: 15px;
    margin: 0 auto 14px;
    text-align: center;
    display: block;
    box-sizing: border-box;
}

.name-reveal .onboarding-continue-btn {
    display: block;
    margin: 0 auto;
}

/* Match input width to button */
.name-reveal .assistant-name-input,
.name-reveal .onboarding-continue-btn {
    width: 180px;
}

/* Skip button — shown only for "None" avatar */
.onboarding-skip-btn {
    display: block;
    margin: 8px auto 0;
    padding: 10px 48px;
    font-size: 14px;
    font-weight: 500;
    background: transparent;
    color: var(--color-text-muted, #6e7781);
    border: 1px solid var(--color-border, #d1d9e0);
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
    width: 180px;
}

.onboarding-skip-btn:hover {
    background: rgba(0, 0, 0, 0.04);
    color: var(--color-text, #1f2328);
    border-color: var(--color-text-muted, #6e7781);
}

.avatar-back-btn {
    display: block;
    margin: 14px auto 0;
    background: none;
    border: none;
    color: #888;
    font-size: 13px;
    cursor: pointer;
    padding: 4px 8px;
    transition: color 0.2s ease;
}

.avatar-back-btn:hover {
    color: #5b5fc7;
}

/* Suggestion Chips */
.suggestion-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 12px;
    justify-content: center;
}

.suggestion-chip {
    display: inline-flex;
    align-items: center;
    padding: 6px 14px;
    font-size: 13px;
    font-weight: 500;
    color: #4f46e5;
    background: linear-gradient(135deg, #eef2ff 0%, #e0e7ff 100%);
    border: 1px solid rgba(99, 102, 241, 0.2);
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.2s ease;
    user-select: none;
}

.suggestion-chip:hover {
    background: linear-gradient(135deg, #e0e7ff 0%, #c7d2fe 100%);
    border-color: rgba(99, 102, 241, 0.4);
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(99, 102, 241, 0.2);
}

.suggestion-chip:active {
    transform: translateY(0);
}

.suggestion-chip.used {
    background: linear-gradient(135deg, #dcfce7 0%, #bbf7d0 100%);
    color: #16a34a;
    border-color: rgba(22, 163, 74, 0.3);
}

.step-buttons {
    display: flex;
    gap: 12px;
    justify-content: center;
    margin-top: 24px;
}

.builder-back-btn {
    padding: 12px 24px;
    font-size: 15px;
    font-weight: 500;
    background: transparent;
    color: #666;
    border: 2px solid #e5e5e5;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.builder-back-btn:hover {
    border-color: #ccc;
    color: #333;
}

.builder-next-btn {
    padding: 12px 32px;
    font-size: 15px;
    font-weight: 600;
    background: linear-gradient(135deg, #4f46e5 0%, #4338ca 100%);
    color: white;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 4px 12px rgba(79, 70, 229, 0.3);
}

.builder-next-btn:hover {
    background: linear-gradient(135deg, #4338ca 0%, #3730a3 100%);
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(79, 70, 229, 0.4);
}

/* Avatar Preview */
.avatar-preview-container {
    margin: 24px 0;
}

.avatar-preview {
    width: 160px;
    height: 200px;
    margin: 0 auto 12px;
    border-radius: 20px;
    overflow: hidden;
    background: linear-gradient(135deg, #f3f4f6 0%, #e5e7eb 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    border: 4px solid white;
}

.avatar-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.avatar-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    color: #666;
    font-size: 13px;
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid rgba(79, 70, 229, 0.2);
    border-top-color: #4f46e5;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.refinement-info {
    text-align: center;
}

.refinement-count {
    font-size: 13px;
    color: #888;
    font-weight: 500;
}

.refinement-section {
    margin: 20px 0;
    padding: 20px;
    background: linear-gradient(180deg, #f9fafb 0%, #f3f4f6 100%);
    border-radius: 12px;
    border: 1px solid rgba(0, 0, 0, 0.06);
}

.refinement-section.disabled {
    opacity: 0.5;
    pointer-events: none;
}

.refinement-input-row {
    display: flex;
    gap: 12px;
}

.refinement-input {
    flex: 1;
    padding: 12px 16px;
    font-size: 14px;
    border: 2px solid #e5e5e5;
    border-radius: 10px;
    outline: none;
    transition: all 0.2s;
}

.refinement-input:focus {
    border-color: var(--color-primary);
}

.refinement-btn {
    padding: 12px 20px;
    font-size: 14px;
    font-weight: 600;
    background: linear-gradient(135deg, #4f46e5 0%, #4338ca 100%);
    color: white;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.25s;
}

.refinement-btn:hover {
    background: linear-gradient(135deg, #4338ca 0%, #3730a3 100%);
}

.refinement-btn:disabled {
    background: linear-gradient(135deg, #d1d5db 0%, #9ca3af 100%);
    cursor: not-allowed;
}

.no-more-refinements {
    text-align: center;
    padding: 16px;
    color: #666;
    font-size: 14px;
}

.no-more-refinements a {
    color: #4f46e5;
    text-decoration: none;
    font-weight: 500;
}

