/* Xilnex Compass — UI */

:root {
    --bg-primary: #ffffff;
    --bg-secondary: #f8f9fb;
    --bg-tertiary: #f0f2f5;
    --bg-sidebar: #111827;
    --bg-sidebar-hover: #1f2937;
    --text-primary: #111827;
    --text-secondary: #6b7280;
    --text-tertiary: #9ca3af;
    --text-sidebar: #d1d5db;
    --text-sidebar-dim: #9ca3af;
    --accent: #6F2692;
    --accent-end: #C31D8A;
    --accent-gradient: linear-gradient(135deg, #6F2692, #C31D8A);
    --accent-light: #f5ecff;
    --accent-hover: #5B1F7A;
    --border: #e5e7eb;
    --border-light: #f3f4f6;
    --success: #10b981;
    --success-bg: #ecfdf5;
    --warning: #f59e0b;
    --warning-bg: #fffbeb;
    --danger: #ef4444;
    --danger-bg: #fef2f2;
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.08);
    --shadow-lg: 0 12px 40px rgba(0,0,0,0.12);
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-full: 9999px;
}

/* ==================== Dark Mode ==================== */

:root.dark {
    --bg-primary: #0f1117;
    --bg-secondary: #1a1d27;
    --bg-tertiary: #252832;
    --bg-sidebar: #0a0c10;
    --bg-sidebar-hover: #1a1d27;
    --text-primary: #e5e7eb;
    --text-secondary: #9ca3af;
    --text-tertiary: #6b7280;
    --text-sidebar: #d1d5db;
    --text-sidebar-dim: #6b7280;
    --accent: #A64DC7;
    --accent-end: #D94DA8;
    --accent-gradient: linear-gradient(135deg, #A64DC7, #D94DA8);
    --accent-light: #2d1045;
    --accent-hover: #6F2692;
    --border: #2d3140;
    --border-light: #252832;
    --success: #34d399;
    --success-bg: #064e3b;
    --warning: #fbbf24;
    --warning-bg: #451a03;
    --danger: #f87171;
    --danger-bg: #450a0a;
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.2);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.3);
    --shadow-lg: 0 12px 40px rgba(0,0,0,0.4);
}

:root.dark .modal {
    background: var(--bg-secondary);
}

:root.dark .sidebar {
    border-right: 1px solid var(--border);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html {
    -webkit-text-size-adjust: 100%;
    -moz-text-size-adjust: 100%;
    text-size-adjust: 100%;
    overflow-x: hidden;
}

/* Smooth dark/light mode transition */
*, *::before, *::after {
    transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg-secondary);
    height: 100vh;
    height: 100dvh;
    overflow: hidden;
    overflow-x: hidden;
    color: var(--text-primary);
    -webkit-font-smoothing: antialiased;
}

/* ==================== Layout ==================== */

.app {
    display: flex;
    height: 100vh;
    height: 100dvh;
}

/* ==================== Sidebar ==================== */

.sidebar {
    width: 260px;
    background: linear-gradient(180deg, #6F2692 0%, #4A1566 50%, #2D0D3F 100%);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    transition: transform 0.3s ease;
}

.sidebar-header {
    padding: 20px;
    border-bottom: 1px solid rgba(255,255,255,0.08);
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
}

.brand-icon {
    width: 36px;
    height: 36px;
    background: transparent;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
}

.brand-icon img {
    object-fit: contain;
    border-radius: 5px;
}

.brand-name {
    font-size: 16px;
    font-weight: 600;
    color: white;
    letter-spacing: -0.01em;
}

.sidebar-content {
    flex: 1;
    padding: 16px 12px;
    overflow-y: auto;
    overflow-x: hidden;
}

.sidebar-section {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border: none;
    background: transparent;
    color: var(--text-sidebar);
    font-size: 13px;
    font-family: inherit;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all 0.35s cubic-bezier(0.16, 1, 0.3, 1);
    text-align: left;
    text-decoration: none;
    min-width: 0;
    overflow: hidden;
    width: 100%;
    border-left: 3px solid transparent;
}

.nav-link:hover {
    background: rgba(255,255,255,0.12);
    color: white;
}

.nav-link.active {
    background: rgba(255,255,255,0.08);
    color: white;
    font-weight: 600;
    border-left-color: #9B2EBF;
    padding-left: 13px;
}

.sidebar-nav {
    border-bottom: 1px solid rgba(255,255,255,0.08);
    padding-bottom: 12px;
    margin-bottom: 4px;
}

.nav-link svg {
    flex-shrink: 0;
    transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1), fill 0.3s ease, fill-opacity 0.3s ease;
}

.nav-link:not(.active):hover {
    padding-left: 14px;
}

.nav-link.active svg {
    fill: currentColor;
    fill-opacity: 0.2;
}

.nav-link--pop svg {
    animation: iconPop 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes iconPop {
    0%   { transform: scale(1); }
    40%  { transform: scale(1.18) rotate(-4deg); }
    100% { transform: scale(1) rotate(0deg); }
}

.sidebar-footer {
    padding: 16px 12px;
    border-top: 1px solid rgba(255,255,255,0.08);
    margin-top: auto;
}

.dark-toggle {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border: none;
    background: transparent;
    color: var(--text-sidebar);
    font-size: 13px;
    font-family: inherit;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all 0.2s;
    width: 100%;
    text-align: left;
}

.dark-toggle:hover {
    background: rgba(255,255,255,0.12);
    color: white;
}

.dark-toggle svg {
    flex-shrink: 0;
    opacity: 0.6;
}

/* ==================== Main Content ==================== */

.main {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
    background: var(--bg-primary);
    position: relative;
}

/* ==================== Top Bar ==================== */

.topbar {
    padding: 16px 24px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 16px;
    flex-shrink: 0;
    background: var(--bg-primary);
}

.menu-toggle {
    display: none;
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 4px;
}

.topbar-title {
    flex: 1;
}

.topbar-title h1 {
    font-size: 16px;
    font-weight: 600;
    letter-spacing: -0.01em;
}

.topbar-subtitle {
    font-size: 13px;
    color: var(--text-secondary);
}

.topbar-actions {
    display: flex;
    align-items: center;
    gap: 4px;
}

.topbar-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 7px 14px;
    border: 1px solid var(--border);
    background: var(--bg-primary);
    color: var(--text-secondary);
    font-size: 13px;
    font-family: inherit;
    font-weight: 500;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.topbar-btn:hover {
    background: var(--bg-secondary);
    color: var(--text-primary);
    border-color: var(--text-tertiary);
    transform: translateY(-1px);
}

.topbar-btn:active {
    transform: translateY(0);
}

.topbar-btn svg {
    flex-shrink: 0;
}

.topbar-btn.icon-only {
    padding: 7px;
    gap: 0;
}

/* ==================== Chat Area ==================== */

.chat-area {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* ==================== Welcome ==================== */

.welcome {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    flex: 1;
    padding: 40px 20px;
    max-width: 600px;
    margin: 0 auto;
    animation: welcomeFadeIn 0.6s cubic-bezier(0.16, 1, 0.3, 1) both;
}

@keyframes welcomeFadeIn {
    from { opacity: 0; transform: translateY(16px) scale(0.98); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

.welcome-icon {
    width: 100px;
    height: 100px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 24px;
    animation: welcomeFadeIn 0.6s cubic-bezier(0.16, 1, 0.3, 1) 0.1s both;
}

.welcome-icon video {
    width: 100%;
    height: 100%;
    object-fit: contain;
    border-radius: 16px;
}

:root.dark .welcome-icon video {
    mix-blend-mode: screen;
}

.welcome h2 {
    font-size: 24px;
    font-weight: 700;
    letter-spacing: -0.02em;
    margin-bottom: 8px;
}

.welcome p {
    font-size: 14px;
    color: var(--text-secondary);
    line-height: 1.6;
    margin-bottom: 28px;
}

.features-guide-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    font-weight: 500;
    color: var(--accent);
    text-decoration: none;
    padding: 6px 14px;
    border: 1px solid var(--accent);
    border-radius: var(--radius-full);
    margin-bottom: 20px;
    transition: all 0.15s;
}
.features-guide-link:hover {
    background: var(--accent-light);
}

/* Onboarding banner */
.onboarding-banner {
    width: 100%;
    background: linear-gradient(135deg, rgba(124,58,237,0.06), rgba(195,29,138,0.06));
    border: 1px solid rgba(124,58,237,0.2);
    border-radius: var(--radius-md);
    padding: 20px;
    margin-bottom: 20px;
    text-align: center;
    position: relative;
    overflow: hidden;
    animation: onboardingSlideIn 0.6s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes onboardingSlideIn {
    from { opacity: 0; transform: translateY(-20px) scale(0.96); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

.onboarding-header {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 6px;
    position: relative;
    z-index: 2;
}

.onboarding-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
}

.onboarding-icon {
    display: inline-block;
    animation: iconBounce 0.6s cubic-bezier(0.34, 1.56, 0.64, 1) 0.4s both;
}

@keyframes iconBounce {
    0% { transform: scale(0) rotate(-20deg); }
    50% { transform: scale(1.3) rotate(5deg); }
    100% { transform: scale(1) rotate(0deg); }
}

/* Confetti burst */
.onboarding-confetti {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    overflow: hidden;
    z-index: 1;
}

.confetti-piece {
    position: absolute;
    width: 6px;
    height: 6px;
    border-radius: 2px;
    opacity: 0;
    animation: confettiFall 2s cubic-bezier(0.25, 0.46, 0.45, 0.94) forwards;
}

@keyframes confettiFall {
    0% { opacity: 1; transform: translateY(0) rotate(0deg) scale(1); }
    80% { opacity: 1; }
    100% { opacity: 0; transform: translateY(120px) rotate(720deg) scale(0.3); }
}

.onboarding-dismiss {
    position: absolute;
    right: 0;
    background: none;
    border: none;
    color: var(--text-tertiary);
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    z-index: 2;
}
.onboarding-dismiss:hover { color: var(--text-primary); background: var(--bg-tertiary); }

.onboarding-desc {
    font-size: 13px;
    color: var(--text-secondary);
    margin: 0 0 12px;
    position: relative;
    z-index: 2;
}

.onboarding-topics {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    position: relative;
    z-index: 2;
}

.onboarding-btn {
    padding: 10px 14px;
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 12.5px;
    font-family: inherit;
    color: var(--text-primary);
    cursor: pointer;
    text-align: left;
    line-height: 1.4;
    transition: all 0.2s;
}
.onboarding-btn:hover {
    border-color: rgba(124,58,237,0.4);
    background: rgba(124,58,237,0.04);
}

.quick-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    width: 100%;
}

.quick-btn {
    padding: 12px 16px;
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    font-size: 13px;
    font-family: inherit;
    color: var(--text-primary);
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
    text-align: left;
    line-height: 1.4;
    opacity: 0;
    animation: quickBtnIn 0.5s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.quick-btn:nth-child(1) { animation-delay: 0.3s; }
.quick-btn:nth-child(2) { animation-delay: 0.42s; }
.quick-btn:nth-child(3) { animation-delay: 0.54s; }
.quick-btn:nth-child(4) { animation-delay: 0.66s; }

@keyframes quickBtnIn {
    from { opacity: 0; transform: translateY(12px) scale(0.95); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

.quick-btn:hover {
    border-color: var(--accent);
    background: var(--accent-light);
    color: var(--accent);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(111, 38, 146, 0.1);
}

.quick-btn:active {
    transform: translateY(0);
    box-shadow: none;
}

.quick-btn.quick-refresh {
    grid-column: 1 / -1;
    min-width: auto;
    padding: 6px 12px;
    text-align: center;
    opacity: 0;
    animation: quickBtnIn 0.5s cubic-bezier(0.16, 1, 0.3, 1) 0.78s forwards;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    font-size: 12px;
    color: var(--text-secondary);
    background: transparent;
    border: 1px solid transparent;
}

.quick-btn.quick-refresh:hover {
    color: var(--accent);
    background: var(--accent-light);
    border-color: var(--border);
}

/* ==================== Fun Facts Card Stack ==================== */

.fun-facts-stack {
    width: 100%;
    margin-top: 8px;
}

.ff-stack-wrapper {
    position: relative;
    width: 100%;
    height: 150px;
    perspective: 800px;
    animation: quickBtnIn 0.5s cubic-bezier(0.16, 1, 0.3, 1) 0.3s both;
}

.ff-stack-wrapper.ff-no-entrance {
    animation: none;
    opacity: 1;
}

.ff-stack-wrapper.ff-no-entrance .ff-refresh {
    animation: none;
    opacity: 1;
}

.ff-card {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    border-radius: var(--radius-lg, 12px);
    transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1),
                opacity 0.4s cubic-bezier(0.16, 1, 0.3, 1),
                box-shadow 0.4s ease;
    will-change: transform, opacity;
    user-select: none;
    -webkit-user-select: none;
    touch-action: pan-y;
}

.ff-card-depth-0 {
    z-index: 3;
    transform: translateY(0) scale(1);
    opacity: 1;
    cursor: grab;
}

.ff-card-depth-0:active {
    cursor: grabbing;
}

.ff-card-depth-1 {
    z-index: 2;
    transform: translateY(8px) scale(0.96);
    opacity: 0.7;
    pointer-events: none;
}

.ff-card-depth-2 {
    z-index: 1;
    transform: translateY(16px) scale(0.92);
    opacity: 0.4;
    pointer-events: none;
}

.ff-card-inner {
    padding: 16px 18px;
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-top: 3px solid transparent;
    border-radius: var(--radius-lg, 12px);
    display: flex;
    flex-direction: column;
    gap: 10px;
    position: relative;
    overflow: hidden;
    transition: border-top-color 0.3s ease, box-shadow 0.3s ease;
}

/* Accent border on the front card */
.ff-card-depth-0 .ff-card-inner {
    border-top-color: var(--accent);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.06);
}

.ff-card-depth-1 .ff-card-inner,
.ff-card-depth-2 .ff-card-inner {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.ff-card-icon {
    display: flex;
    justify-content: center;
    color: var(--accent);
}

.ff-prefix {
    font-weight: 700;
    font-size: 12px;
    color: var(--accent);
    text-align: center;
    margin-top: 2px;
}

.ff-card-content {
    font-size: 13.5px;
    line-height: 1.5;
    color: var(--text-primary);
    text-align: center;
}

.ff-body {
    color: var(--text-primary);
}

.ff-counter {
    position: absolute;
    top: 10px;
    right: 14px;
    opacity: 0.5;
    font-variant-numeric: tabular-nums;
    font-size: 11px;
    color: var(--text-tertiary);
}

.ff-card-footer {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 12px;
    width: 80%;
    margin: 2px auto 0;
}

.ff-doc {
    font-size: 10px;
    color: var(--text-tertiary);
    opacity: 0.7;
    max-width: 180px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.ff-team {
    background: var(--accent-light);
    color: var(--accent);
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 500;
}

.ff-refresh {
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 32px auto 0;
    padding: 6px 12px;
    border: 1px solid transparent;
    border-radius: var(--radius-md);
    background: transparent;
    color: var(--text-secondary);
    font-size: 12px;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.2s ease;
    opacity: 0;
    animation: quickBtnIn 0.5s cubic-bezier(0.16, 1, 0.3, 1) 0.6s forwards;
}

.ff-refresh:hover {
    color: var(--accent);
    background: var(--accent-light);
    border-color: var(--border);
}


/* ==================== Messages ==================== */

.message {
    display: flex;
    gap: 12px;
    max-width: 720px;
    animation: slideUp 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes slideUp {
    from { opacity: 0; transform: translateY(16px) scale(0.98); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

.message.user {
    align-self: flex-end;
    flex-direction: row-reverse;
}

.message.bot {
    align-self: flex-start;
}

.avatar {
    width: 32px;
    height: 32px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 14px;
    font-weight: 600;
}

.message.user .avatar {
    background: none;
    font-size: 26px;
    line-height: 1;
}

.message.bot .avatar {
    background: var(--accent-gradient);
}

.message.bot .avatar img,
.typing .avatar img {
    width: 20px;
    height: 20px;
    object-fit: contain;
    filter: brightness(0) invert(1);
}

/* Animated avatar: transparent bg, no filter, natural colors */
.message.bot .avatar.avatar-animated,
.typing .avatar.avatar-animated {
    background: transparent;
}

.message.bot .avatar img.bot-avatar-animated,
.typing .avatar img.bot-avatar-animated {
    filter: none;
    width: 28px;
    height: 28px;
    border-radius: 4px;
}

.message-content {
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: 0;
}

.message-bubble {
    padding: 12px 16px;
    font-size: 14px;
    line-height: 1.65;
    white-space: pre-wrap;
    word-break: break-word;
}

.message.user .message-bubble {
    background: var(--accent-gradient);
    color: white;
    border-radius: var(--radius-lg) var(--radius-lg) 4px var(--radius-lg);
}

.message.bot .message-bubble {
    background: var(--bg-secondary);
    color: var(--text-primary);
    border-radius: var(--radius-lg) var(--radius-lg) var(--radius-lg) 4px;
    border: 1px solid var(--border-light);
}

/* ==================== Markdown Tables ==================== */

.md-table {
    width: 100%;
    border-collapse: collapse;
    margin: 10px 0;
    font-size: 0.9em;
    line-height: 1.4;
}

.md-table th,
.md-table td {
    padding: 6px 10px;
    border: 1px solid var(--border-light, #e0e0e0);
    text-align: left;
}

.md-table th {
    background: var(--bg-tertiary, #f5f5f5);
    font-weight: 600;
    font-size: 0.88em;
    text-transform: uppercase;
    letter-spacing: 0.02em;
    color: var(--text-secondary);
}

.md-table tr:nth-child(even) {
    background: var(--bg-tertiary, rgba(0, 0, 0, 0.02));
}

.md-table tr:hover {
    background: var(--accent-light, rgba(111, 38, 146, 0.04));
}

/* ==================== Copy Button ==================== */

.message-actions {
    display: flex;
    align-self: flex-end;
    margin-bottom: 6px;
    opacity: 0.4;
    transition: opacity 0.15s ease;
}

.message:hover > .message-actions {
    opacity: 0.7;
}

.message-actions:hover {
    opacity: 1 !important;
}

.copy-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border: none;
    background: transparent;
    color: var(--text-tertiary);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all 0.15s;
    padding: 0;
}

.copy-btn:hover {
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    transform: scale(1.15);
}

.copy-btn:active {
    transform: scale(0.9);
}

.copy-btn.copied {
    color: var(--success);
}

.message-bubble.bubble-animate {
    animation: bubbleReveal 0.6s cubic-bezier(0.16, 1, 0.3, 1) both;
}

@keyframes bubbleReveal {
    from { opacity: 0; transform: translateY(12px) scale(0.97); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

/* ==================== Message Metadata ==================== */

.message-meta {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 2px 4px 0;
    flex-wrap: wrap;
    opacity: 0.5;
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.message-meta.meta-hidden {
    opacity: 0;
    transform: translateY(6px);
    pointer-events: none;
}

.message-meta.meta-reveal {
    opacity: 0.5;
    transform: translateY(0);
    animation: metaFadeIn 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes metaFadeIn {
    from { opacity: 0; transform: translateY(6px); }
    to { opacity: 0.5; transform: translateY(0); }
}

@keyframes softReveal {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

.message-content:hover .message-meta {
    opacity: 0.8;
}

.badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 8px;
    border-radius: var(--radius-full);
    font-size: 10px;
    font-weight: 500;
    letter-spacing: 0.01em;
}

.badge-high {
    background: var(--bg-tertiary);
    color: var(--text-secondary);
}

.badge-medium {
    background: var(--warning-bg);
    color: #d97706;
}

.badge-low {
    background: var(--danger-bg);
    color: #dc2626;
}

.badge-neutral {
    background: var(--bg-tertiary);
    color: var(--text-tertiary);
}

.badge-cached {
    background: var(--bg-tertiary);
    color: var(--text-tertiary);
}

.badge-team {
    background: var(--accent-light, rgba(111, 38, 146, 0.1));
    color: var(--accent, #6f2692);
}

.badge-classification {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.badge-cls-simple {
    background: rgba(34, 139, 34, 0.1);
    color: #1a8a1a;
}

.badge-cls-complex {
    background: rgba(180, 120, 0, 0.1);
    color: #9a6700;
}

.badge-cls-multi {
    background: rgba(0, 102, 204, 0.1);
    color: #0066cc;
}

.badge-beta {
    background: var(--warning-bg, rgba(245, 158, 11, 0.1));
    color: #d97706;
    font-size: 9px;
    font-weight: 600;
    letter-spacing: 0.05em;
}

.escalate-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 10px;
    border-radius: var(--radius-full);
    font-size: 11px;
    font-weight: 500;
    font-family: inherit;
    background: var(--danger-bg);
    color: var(--danger);
    border: 1px solid rgba(239, 68, 68, 0.2);
    cursor: pointer;
    transition: all 0.15s;
}

.escalate-btn:hover {
    background: var(--danger);
    color: white;
    border-color: var(--danger);
}

/* ==================== Feedback Buttons ==================== */

.feedback-buttons {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    margin-left: 4px;
}

.feedback-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    border: none;
    background: transparent;
    color: var(--text-tertiary);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    padding: 0;
}

.feedback-btn:hover {
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    transform: scale(1.15);
}

.feedback-btn:active {
    transform: scale(0.9);
}

.feedback-btn.selected {
    animation: feedbackPop 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.feedback-up.selected {
    color: var(--success);
    background: var(--success-bg);
}

.feedback-down.selected {
    color: var(--danger);
    background: var(--danger-bg);
}

.feedback-btn.dimmed {
    opacity: 0.25;
    pointer-events: none;
}

.feedback-btn:disabled {
    cursor: default;
}

.feedback-btn:disabled:hover {
    transform: none;
}

@keyframes feedbackPop {
    0% { transform: scale(1); }
    40% { transform: scale(1.35); }
    70% { transform: scale(0.95); }
    100% { transform: scale(1); }
}

/* ==================== Source Document Downloads ==================== */

.message-sources {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 4px 4px 0;
    flex-wrap: wrap;
}

.sources-label {
    font-size: 10px;
    font-weight: 500;
    color: var(--text-tertiary);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-right: 2px;
}

.source-link {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 10px;
    border-radius: var(--radius-full);
    font-size: 11px;
    font-weight: 500;
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    text-decoration: none;
    transition: all 0.15s;
    border: 1px solid transparent;
    animation: followUpBtnIn 0.35s cubic-bezier(0.16, 1, 0.3, 1) both;
}

.source-link:hover {
    background: var(--accent-light);
    color: var(--accent);
    border-color: var(--accent);
}

.source-link svg {
    flex-shrink: 0;
}

.source-no-download {
    cursor: default;
    opacity: 0.7;
}

.source-no-download:hover {
    background: var(--bg-secondary);
    color: inherit;
    border-color: transparent;
}

/* ==================== Follow-Up Suggestions ==================== */

.follow-up-suggestions {
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-width: 720px;
    align-self: flex-start;
    padding-left: 44px; /* align with message bubble (avatar 32px + gap 12px) */
}

.follow-up-label {
    font-size: 11px;
    font-weight: 500;
    color: var(--text-tertiary);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.follow-up-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.follow-up-btn {
    padding: 7px 14px;
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: 20px;
    font-size: 13px;
    font-family: inherit;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
    line-height: 1.3;
    text-align: left;
    animation: followUpBtnIn 0.35s cubic-bezier(0.16, 1, 0.3, 1) both;
}

@keyframes followUpBtnIn {
    from { opacity: 0; transform: translateY(6px) scale(0.95); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

.follow-up-btn:hover {
    border-color: var(--accent);
    color: var(--accent);
    background: var(--accent-light);
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(111, 38, 146, 0.08);
}

.follow-up-btn:active {
    transform: translateY(0);
}

/* ==================== Typing Indicator ==================== */

.typing {
    display: flex;
    align-items: center;
    gap: 12px;
    align-self: flex-start;
    animation: slideUp 0.3s ease;
}

.typing .avatar {
    background: var(--accent-gradient);
}

.typing-dots {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 14px 18px;
    background: var(--bg-secondary);
    border-radius: var(--radius-lg) var(--radius-lg) var(--radius-lg) 4px;
    border: 1px solid var(--border-light);
}

.typing-dots span {
    width: 6px;
    height: 6px;
    background: var(--text-tertiary);
    border-radius: 50%;
    animation: pulse 1.4s ease infinite;
}

.typing-dots span:nth-child(2) { animation-delay: 0.15s; }
.typing-dots span:nth-child(3) { animation-delay: 0.3s; }

@keyframes pulse {
    0%, 80%, 100% { transform: scale(0.8); opacity: 0.4; }
    40% { transform: scale(1.2); opacity: 1; }
}

.typing-bubble {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 16px;
    background: var(--bg-secondary);
    color: var(--text-secondary);
    font-size: 14px;
    line-height: 1.65;
    border-radius: var(--radius-lg) var(--radius-lg) var(--radius-lg) 4px;
    border: 1px solid var(--border-light);
    position: relative;
    overflow: hidden;
}

/* Subtle shimmer sweep across the bubble */
.typing-bubble::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(
        90deg,
        transparent,
        rgba(255, 255, 255, 0.06),
        transparent
    );
    animation: shimmer 2.5s ease-in-out infinite;
}

@keyframes shimmer {
    0%   { left: -100%; }
    100% { left: 100%; }
}

/* Inline bouncing dots after the status text */
.typing-ellipsis {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    margin-left: 2px;
}

.typing-ellipsis span {
    width: 4px;
    height: 4px;
    background: var(--text-tertiary);
    border-radius: 50%;
    animation: statusPulse 1.4s ease infinite;
}

.typing-ellipsis span:nth-child(2) { animation-delay: 0.15s; }
.typing-ellipsis span:nth-child(3) { animation-delay: 0.3s; }

@keyframes statusPulse {
    0%, 80%, 100% { opacity: 0.3; transform: scale(0.8); }
    40% { opacity: 1; transform: scale(1); }
}

/* ==================== Streaming ==================== */

.streaming-cursor {
    display: inline-block;
    width: 2px;
    height: 1.1em;
    background: var(--accent);
    border-radius: 1px;
    margin-left: 2px;
    vertical-align: text-bottom;
    animation: cursorBlink 1s step-end infinite;
}

@keyframes cursorBlink {
    0%, 50% { opacity: 1; }
    50.01%, 100% { opacity: 0; }
}

.token-new {
    animation: tokenReveal 0.35s ease both;
}

@keyframes tokenReveal {
    from { opacity: 0; filter: blur(2px); }
    to { opacity: 1; filter: blur(0); }
}

/* ==================== Scroll to Bottom Button ==================== */

.scroll-bottom-btn {
    position: absolute;
    bottom: 120px;
    left: 50%;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 1px solid var(--border);
    background: var(--bg-primary);
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow-md);
    opacity: 0;
    transform: translateX(-50%) translateY(8px);
    pointer-events: none;
    transition: opacity 0.25s ease, transform 0.25s ease, border-color 0.25s ease, box-shadow 0.25s ease;
    z-index: 10;
}

.scroll-bottom-btn.visible {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
    pointer-events: auto;
}

.scroll-bottom-btn:hover {
    background: var(--bg-secondary);
    color: var(--text-primary);
    border-color: var(--text-tertiary);
    transform: translateX(-50%) translateY(-1px);
}

.scroll-bottom-btn:active {
    transform: translateX(-50%) translateY(1px);
}

.scroll-bottom-btn.streaming {
    border-color: var(--accent);
    color: var(--accent);
    animation: streamingPulse 2s ease-in-out infinite;
}

@keyframes streamingPulse {
    0%, 100% { box-shadow: var(--shadow-md); }
    50% { box-shadow: 0 0 0 4px rgba(111, 38, 146, 0.12), var(--shadow-md); }
}

/* Scroll spacer — creates room to scroll user question to the top during streaming */
.chat-area.scroll-spacer::after {
    content: '';
    display: block;
    min-height: 100vh;
    flex-shrink: 0;
}

/* ==================== Input Area ==================== */

.input-area {
    padding: 16px 24px 20px;
    border-top: 1px solid var(--border);
    background: var(--bg-primary);
    flex-shrink: 0;
}

.input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 8px 8px 8px 18px;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.input-wrapper:focus-within {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(111, 38, 146, 0.12);
}

#questionInput {
    flex: 1;
    border: none;
    background: transparent;
    font-size: 14px;
    font-family: inherit;
    resize: none;
    max-height: 120px;
    line-height: 1.5;
    padding: 6px 0;
    outline: none;
    color: var(--text-primary);
}

/* Custom placeholder (allows inline styling of /help) */
.custom-placeholder {
    position: absolute;
    left: 18px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 14px;
    font-family: inherit;
    line-height: 1.5;
    color: var(--text-tertiary);
    pointer-events: none;
    white-space: nowrap;
    z-index: 1;
}

.custom-placeholder.hidden {
    display: none;
}

.placeholder-cmd {
    font-family: 'SF Mono', 'Fira Code', 'Consolas', monospace;
    font-weight: 600;
    font-size: 12.5px;
    color: var(--accent);
    background: rgba(111, 38, 146, 0.08);
    border: 1px solid rgba(111, 38, 146, 0.15);
    border-radius: 4px;
    padding: 0px 5px;
    opacity: 0.7;
}

@media (max-width: 768px) {
    .custom-placeholder {
        font-size: 16px;
    }
    .placeholder-cmd {
        font-size: 14px;
    }
}

/* ==================== Mic / Voice Input Button ==================== */

#micBtn {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-sm);
    border: none;
    background: transparent;
    color: var(--text-tertiary);
    cursor: pointer;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
    position: relative;
}

#micBtn:hover {
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    transform: scale(1.08);
}

#micBtn:active {
    transform: scale(0.95);
}

/* Recording — pulsing red glow */
#micBtn.recording {
    background: var(--danger-bg);
    color: var(--danger);
    animation: micPulse 1.2s ease-in-out infinite;
}

#micBtn.recording svg {
    animation: micBreath 1.2s ease-in-out infinite;
}

@keyframes micPulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.35); }
    50% { box-shadow: 0 0 0 8px rgba(239, 68, 68, 0); }
}

@keyframes micBreath {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.12); }
}

/* Transcribing — gentle accent pulse */
#micBtn.transcribing {
    background: var(--accent-light);
    color: var(--accent);
    pointer-events: none;
    animation: micTranscribing 1.5s ease-in-out infinite;
}

@keyframes micTranscribing {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

#micBtn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    transform: none;
    pointer-events: none;
}

/* Mic tooltip */
.mic-tooltip {
    position: absolute;
    bottom: calc(100% + 10px);
    left: 50%;
    transform: translateX(-50%) translateY(4px);
    background: var(--bg-sidebar);
    color: #fff;
    font-size: 12px;
    font-weight: 500;
    padding: 6px 12px;
    border-radius: var(--radius-sm);
    white-space: nowrap;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.2s ease, transform 0.2s ease;
    z-index: 20;
}

.mic-tooltip::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 5px solid transparent;
    border-top-color: var(--bg-sidebar);
}

.mic-tooltip.visible {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

#sendBtn {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-sm);
    border: none;
    background: var(--accent-gradient);
    color: white;
    cursor: pointer;
    flex-shrink: 0;
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
    display: flex;
    align-items: center;
    justify-content: center;
}

#sendBtn:hover {
    transform: scale(1.08);
    box-shadow: 0 2px 8px rgba(111, 38, 146, 0.3);
}

#sendBtn:active {
    transform: scale(0.95);
}

#sendBtn:disabled {
    background: var(--bg-tertiary);
    color: var(--text-tertiary);
    cursor: not-allowed;
    transform: none;
}

.input-hint {
    font-size: 11px;
    color: var(--text-tertiary);
    margin-top: 8px;
    text-align: center;
}

/* ==================== Modal ==================== */

.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.modal-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

.modal {
    background: white;
    border-radius: var(--radius-lg);
    padding: 0;
    width: 90%;
    max-width: 440px;
    box-shadow: var(--shadow-lg);
    transform: translateY(20px) scale(0.96);
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.modal-overlay.active .modal {
    transform: translateY(0) scale(1);
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px 0;
}

.modal-header h3 {
    font-size: 16px;
    font-weight: 600;
}

.modal-close {
    background: none;
    border: none;
    color: var(--text-tertiary);
    cursor: pointer;
    padding: 4px;
    border-radius: var(--radius-sm);
    transition: color 0.15s;
}

.modal-close:hover {
    color: var(--text-primary);
}

.modal-desc {
    padding: 8px 24px 16px;
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.5;
}

.form-group {
    padding: 0 24px;
    margin-bottom: 14px;
}

.form-group label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 6px;
}

.form-group input,
.form-group select {
    width: 100%;
    padding: 9px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-family: inherit;
    background: var(--bg-primary);
    color: var(--text-primary);
    transition: border-color 0.15s;
    outline: none;
}

.form-group input:focus,
.form-group select:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(111, 38, 146, 0.12);
}

.form-group input:disabled,
.form-group select:disabled {
    opacity: 0.55;
    cursor: not-allowed;
    background: var(--bg-secondary);
}

.form-group select:disabled {
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
}

.escalate-channels {
    display: flex;
    gap: 12px;
}

.escalate-teams-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.channel-option {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 13px;
    color: var(--text-primary);
    transition: all 0.15s;
    flex: 1;
}

.channel-option:has(input:checked) {
    border-color: var(--accent);
    background: rgba(111, 38, 146, 0.08);
}

.channel-option:has(#escalateGitlab:checked) {
    border-color: #e24329;
    background: rgba(226, 67, 41, 0.08);
}

.channel-option:has(#escalateGitlab:checked) svg {
    color: #e24329;
}

.channel-option:has(#escalateLark:checked) {
    border-color: #3370ff;
    background: rgba(51, 112, 255, 0.08);
}


.channel-option input[type="checkbox"] {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
    margin: 0;
    pointer-events: none;
}

.channel-option svg {
    flex-shrink: 0;
    vertical-align: middle;
    color: var(--text-secondary);
}

.channel-option:has(input:checked) svg {
    color: var(--accent);
}

/* Feedback reason radio options */
.feedback-reason-options {
    padding: 0 24px 8px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.reason-option {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    border-radius: var(--radius-md);
    cursor: pointer;
    font-size: 13px;
    color: var(--text-secondary);
    transition: background 0.15s;
}

.reason-option:hover {
    background: var(--bg-secondary);
}

.reason-option input[type="radio"] {
    accent-color: var(--accent);
}

.reason-option:has(input:checked) {
    color: var(--text-primary);
    background: var(--accent-light);
}

.other-reason-input {
    padding: 4px 12px 0 36px;
}

.other-reason-input input {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    font-size: 13px;
    background: var(--bg-primary);
    color: var(--text-primary);
    outline: none;
    transition: border-color 0.15s;
}

.other-reason-input input:focus {
    border-color: var(--accent);
}

.modal-footer {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
    padding: 16px 24px 20px;
}

.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 9px 18px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-weight: 500;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.15s;
    border: none;
}

.btn-ghost {
    background: transparent;
    color: var(--text-secondary);
    border: 1px solid var(--border);
}

.btn-ghost:hover {
    background: var(--bg-secondary);
}

.btn-danger {
    background: var(--danger);
    color: white;
}

.btn-danger:hover {
    background: #dc2626;
}

/* ==================== Responsive ==================== */

@media (max-width: 768px) {
    .sidebar {
        position: fixed;
        left: 0;
        top: 0;
        bottom: 0;
        z-index: 50;
        transform: translateX(-100%);
    }

    .sidebar.open {
        transform: translateX(0);
    }

    .sidebar-overlay {
        display: none;
        position: fixed;
        inset: 0;
        background: rgba(0, 0, 0, 0.4);
        z-index: 49;
    }

    .sidebar-overlay.visible {
        display: block;
    }

    .menu-toggle {
        display: flex;
    }

    .quick-actions {
        grid-template-columns: 1fr;
    }

    .ff-stack-wrapper {
        height: 160px;
    }

    .ff-card-inner {
        padding: 14px 14px;
    }

    .ff-card-content {
        font-size: 13px;
    }

    .chat-area {
        padding: 16px;
    }

    .input-area {
        padding: 12px 16px 16px;
    }

    .topbar-btn span {
        display: none;
    }

    .topbar-btn {
        padding: 7px;
    }

    .follow-up-suggestions {
        padding-left: 0;
    }

    .scroll-bottom-btn {
        bottom: 100px;
    }

    .desktop-only {
        display: none !important;
    }

    /* Prevent iOS auto-zoom on input focus (requires >= 16px) */
    #questionInput {
        font-size: 16px;
    }

    .form-group input,
    .form-group select {
        font-size: 16px;
    }
}

/* ==================== Scrollbar ==================== */

.chat-area::-webkit-scrollbar {
    width: 6px;
}

.chat-area::-webkit-scrollbar-track {
    background: transparent;
}

.chat-area::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 3px;
}

.chat-area::-webkit-scrollbar-thumb:hover {
    background: var(--text-tertiary);
}

/* --- Slash Ghost (inline autocomplete preview) --- */

.slash-ghost {
    position: absolute;
    left: 18px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 14px;
    font-family: inherit;
    line-height: 1.5;
    pointer-events: none;
    white-space: nowrap;
    z-index: 0;
    display: flex;
    align-items: center;
}

/* Invisible spacer — matches the width of what the user already typed */
.slash-ghost-typed {
    visibility: hidden;
}

/* The autocomplete remainder, styled as an inline chip */
.slash-ghost-completion {
    font-family: 'SF Mono', 'Fira Code', 'Consolas', monospace;
    font-weight: 600;
    font-size: 12.5px;
    color: var(--accent);
    background: rgba(111, 38, 146, 0.08);
    border: 1px solid rgba(111, 38, 146, 0.18);
    border-radius: 4px;
    padding: 1px 5px;
    opacity: 0.55;
}

@media (max-width: 768px) {
    .slash-ghost {
        font-size: 16px;
    }
    .slash-ghost-completion {
        font-size: 14px;
    }
}

/* --- Slash Command Autocomplete --- */

.slash-dropdown {
    position: absolute;
    bottom: 100%;
    left: 0;
    right: 0;
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: 12px 12px 0 0;
    box-shadow: 0 -4px 16px rgba(0, 0, 0, 0.08);
    max-height: 320px;
    overflow-y: auto;
    z-index: 100;
}

.slash-dropdown-header {
    padding: 8px 14px 4px;
    font-size: 11px;
    font-weight: 600;
    color: var(--text-tertiary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.slash-dropdown-item {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 6px;
    padding: 8px 14px;
    cursor: pointer;
    transition: background 0.1s;
}

.slash-dropdown-item:hover,
.slash-dropdown-item.selected {
    background: var(--bg-secondary);
}

.slash-cmd-name {
    font-family: 'SF Mono', 'Fira Code', monospace;
    font-size: 13px;
    font-weight: 600;
    color: var(--brand, #6F2692);
}

.slash-cmd-arg {
    font-size: 12px;
    color: var(--text-tertiary);
    font-style: italic;
}

.slash-cmd-hint {
    font-size: 12px;
    color: var(--text-secondary);
    flex-basis: 100%;
    padding-left: 2px;
}

/* --- Slash Chip (in input) --- */

.slash-chip {
    display: inline-flex;
    align-items: center;
    font-family: 'SF Mono', 'Fira Code', 'Consolas', monospace;
    font-size: 13px;
    font-weight: 700;
    color: var(--brand, #6F2692);
    background: rgba(111, 38, 146, 0.1);
    border: 1px solid rgba(111, 38, 146, 0.25);
    border-radius: 6px;
    padding: 2px 8px;
    margin-right: 6px;
    white-space: nowrap;
    flex-shrink: 0;
}

.input-wrapper.has-slash-chip {
    display: flex;
    align-items: center;
}

.input-wrapper.has-slash-chip textarea {
    flex: 1;
}

/* Slash chip rendered inside user chat bubble */
.slash-chip-inline {
    display: inline;
    font-family: 'SF Mono', 'Fira Code', 'Consolas', monospace;
    font-size: 0.9em;
    font-weight: 700;
    color: var(--brand, #6F2692);
    background: rgba(111, 38, 146, 0.12);
    border-radius: 4px;
    padding: 1px 6px;
}

/* --- Slash Help Card --- */

.slash-help {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.slash-help-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 4px;
}

.slash-help-item {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 6px;
    padding: 6px 10px;
    border-radius: 8px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
}

.slash-help-cmd {
    font-family: 'SF Mono', 'Fira Code', 'Consolas', monospace;
    font-size: 13px;
    font-weight: 700;
    color: var(--brand, #6F2692);
    background: rgba(111, 38, 146, 0.08);
    padding: 1px 6px;
    border-radius: 4px;
}

.slash-help-arg {
    font-size: 12px;
    color: var(--text-tertiary);
    font-style: italic;
}

.slash-help-hint {
    flex-basis: 100%;
    font-size: 12px;
    color: var(--text-secondary);
    margin-top: 2px;
}

/* /which-team */
.wt-card {
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.wt-header {
    display: flex;
    align-items: center;
    gap: 10px;
}
.wt-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    background: var(--accent-light);
    color: var(--accent);
    flex-shrink: 0;
}
.wt-title {
    font-size: 14px;
    color: var(--text-primary);
}
.wt-title strong {
    color: var(--accent);
}
.wt-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.wt-row {
    display: flex;
    flex-direction: column;
    padding: 8px 12px;
    border-radius: 8px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
}
.wt-row:hover {
    border-color: var(--accent);
}
.wt-row-primary {
}
.wt-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--text-tertiary);
    flex-shrink: 0;
}
.wt-row-primary .wt-dot {
    background: var(--accent);
}
.wt-team-name {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
}
.wt-badge-primary {
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 1px 6px;
    margin-left: 2px;
    border-radius: 4px;
    background: var(--accent-gradient);
    color: #fff;
}
.wt-lark-link {
    margin-left: auto;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 11px;
    font-weight: 500;
    color: var(--accent);
    text-decoration: none;
    padding: 3px 10px;
    border-radius: 6px;
    background: var(--accent-light);
    transition: opacity 0.15s;
}
.wt-row-primary .wt-lark-link {
    background: var(--accent-light);
}
.wt-lark-link:hover {
    opacity: 0.8;
}
.wt-row-top {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
}
.wt-members {
    display: flex;
    align-items: center;
    gap: 0;
    margin-top: 6px;
    padding-left: 16px;
}
.wt-member-avatar,
.wt-member-placeholder {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    border: 2px solid var(--bg-secondary);
    margin-left: -6px;
    flex-shrink: 0;
}
.wt-member-avatar:first-child,
.wt-member-placeholder:first-child {
    margin-left: 0;
}
.wt-member-avatar {
    object-fit: cover;
}
.wt-member-placeholder {
    background: var(--accent-light);
    color: var(--accent);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 8px;
    font-weight: 600;
}
.wt-row-primary .wt-member-avatar,
.wt-row-primary .wt-member-placeholder {
    border-color: var(--bg-secondary);
}
.wt-member-more {
    margin-left: 4px;
    font-size: 10px;
    color: var(--text-tertiary);
    font-weight: 500;
}
.wt-hint {
    font-size: 11px;
    color: var(--text-secondary);
    text-align: center;
    margin-top: 2px;
    opacity: 0.5;
}

/* /who — person highlight */
.who-people {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 10px;
}

.who-person {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-left: 3px solid var(--accent);
    border-radius: var(--radius-md);
}

.who-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
}

.who-avatar-ph {
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--accent-gradient);
    color: #fff;
    font-size: 14px;
    font-weight: 600;
}

.who-info {
    display: flex;
    flex-direction: column;
    gap: 3px;
    min-width: 0;
    flex: 1;
}

.who-name-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

.who-name {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
}

.who-meta {
    display: flex;
    align-items: center;
    gap: 8px;
}

.who-team {
    font-size: 12px;
    color: var(--text-secondary);
}

.who-manages {
    font-size: 11px;
    font-weight: 500;
    color: var(--accent);
    background: var(--accent-light);
    padding: 1px 8px;
    border-radius: var(--radius-full);
}

.who-lark {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--accent-light);
    color: var(--accent);
    flex-shrink: 0;
    transition: background 0.2s, color 0.2s;
    text-decoration: none;
}

.who-lark:hover {
    background: var(--accent);
    color: white;
}

.who-self {
    font-size: 11px;
    font-weight: 500;
    padding: 2px 10px;
    border-radius: var(--radius-full);
    background: var(--bg-tertiary);
    color: var(--text-tertiary);
    flex-shrink: 0;
}

@media (max-width: 768px) {
    .who-person {
        padding: 10px 12px;
        gap: 10px;
    }
    .who-avatar {
        width: 34px;
        height: 34px;
    }
    .who-name {
        font-size: 14px;
    }
    .who-manages {
        font-size: 10px;
        padding: 1px 6px;
    }
    .who-lark, .who-self {
        width: 28px;
        height: 28px;
        font-size: 10px;
    }
}

/* Team member modal */
.wt-modal {
    max-height: 70vh;
    display: flex;
    flex-direction: column;
}
.wt-modal-subtitle {
    font-size: 12px;
    color: var(--text-tertiary);
    padding: 4px 24px 12px;
}
.wt-modal-list {
    overflow-y: auto;
    padding: 0 24px 20px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.wt-modal-member {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    border-radius: 8px;
    background: var(--bg-secondary);
}
.wt-modal-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
}
.wt-modal-avatar-ph {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--accent-light);
    color: var(--accent);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 600;
    flex-shrink: 0;
}
.wt-modal-name {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-primary);
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.wt-modal-role {
    font-size: 10px;
    font-weight: 500;
    padding: 2px 6px;
    border-radius: 4px;
    flex-shrink: 0;
}
.wt-modal-role-admin {
    background: rgba(111, 38, 146, 0.1);
    color: var(--accent);
}
.wt-modal-role-mod {
    background: rgba(16, 185, 129, 0.1);
    color: var(--success);
}
.wt-modal-role-viewer {
    background: var(--bg-tertiary);
    color: var(--text-tertiary);
}
.wt-modal-lark {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--accent-light);
    color: var(--accent);
    flex-shrink: 0;
    transition: background 0.2s, color 0.2s;
    text-decoration: none;
}
.wt-modal-lark:hover {
    background: var(--accent);
    color: white;
}
.wt-modal-manager {
    margin: 0 16px 8px;
    padding: 10px 12px;
    background: var(--accent-light);
    border-radius: 10px;
}
.wt-modal-manager-label {
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--accent);
    margin-bottom: 6px;
}
.wt-modal-manager .wt-modal-member {
    background: transparent;
    padding: 0;
}
.wt-modal-contact-btn {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 12px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 500;
    text-decoration: none;
    background: var(--accent);
    color: white;
    flex-shrink: 0;
    margin-left: auto;
    transition: opacity 0.2s;
}
.wt-modal-contact-btn:hover {
    opacity: 0.85;
}
.wt-modal-self-badge {
    font-size: 10px;
    font-weight: 500;
    padding: 2px 10px;
    border-radius: 999px;
    background: var(--bg-secondary);
    color: var(--text-tertiary);
    margin-left: auto;
    flex-shrink: 0;
}
.wt-modal-empty {
    text-align: center;
    padding: 20px;
    font-size: 13px;
    color: var(--text-tertiary);
}

/* Shared confirm dialog */
.xc-confirm-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.4);
    z-index: 200;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.2s;
}
.xc-confirm-overlay.active { opacity: 1; }
.xc-confirm-dialog {
    background: var(--bg-primary);
    border-radius: var(--radius-md, 12px);
    padding: 24px;
    width: 360px;
    max-width: 90vw;
    box-shadow: 0 16px 48px rgba(0,0,0,0.2);
    transform: scale(0.95);
    transition: transform 0.2s;
}
.xc-confirm-overlay.active .xc-confirm-dialog { transform: scale(1); }
.xc-confirm-icon {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 14px;
}
.xc-confirm-icon.danger { background: var(--danger-bg); color: var(--danger); }
.xc-confirm-icon.warning { background: var(--warning-bg); color: var(--warning); }
.xc-confirm-icon.info { background: var(--accent-light); color: var(--accent); }
.xc-confirm-title {
    font-size: 15px;
    font-weight: 600;
    text-align: center;
    margin-bottom: 4px;
}
.xc-confirm-message {
    font-size: 13px;
    color: var(--text-secondary);
    text-align: center;
    margin-bottom: 20px;
    line-height: 1.5;
}
.xc-confirm-actions {
    display: flex;
    gap: 8px;
}
.xc-confirm-btn {
    flex: 1;
    padding: 9px 12px;
    border-radius: var(--radius-sm, 8px);
    font-size: 13px;
    font-family: inherit;
    font-weight: 500;
    cursor: pointer;
    transition: opacity 0.15s, border-color 0.15s;
    text-align: center;
}
.xc-confirm-btn.cancel {
    border: 1px solid var(--border);
    background: var(--bg-primary);
    color: var(--text-secondary);
}
.xc-confirm-btn.cancel:hover { border-color: var(--text-tertiary); }
.xc-confirm-btn.primary {
    border: none;
    background: var(--accent-gradient);
    color: white;
}
.xc-confirm-btn.primary:hover { opacity: 0.9; }
.xc-confirm-btn.danger {
    border: none;
    background: var(--danger);
    color: white;
}
.xc-confirm-btn.danger:hover { opacity: 0.9; }

/* External source link (for GitLab/Zoho clickable badges) */
.source-external {
    cursor: pointer;
    text-decoration: none;
}
.source-external:hover {
    background: var(--bg-tertiary, var(--bg-secondary));
    color: var(--brand, #6F2692);
}

/* ==================== Customer Profile Card (/customer) ==================== */

.cp-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 18px;
    max-width: 560px;
    font-size: 13px;
}
.cp-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding-bottom: 14px;
    margin-bottom: 14px;
    border-bottom: 1px solid var(--border);
}
.cp-avatar {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    background: var(--accent-gradient);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 700;
    color: #fff;
    flex-shrink: 0;
}
.cp-header-info { flex: 1; }
.cp-name {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
}
.cp-tags {
    font-size: 12px;
    color: var(--text-tertiary);
    margin-top: 2px;
}
.cp-section-title {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-tertiary);
    text-transform: uppercase;
    letter-spacing: 0.03em;
    margin: 14px 0 8px;
}
.cp-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12px;
}
.cp-table th {
    text-align: left;
    font-weight: 600;
    color: var(--text-secondary);
    padding: 4px 8px;
    border-bottom: 1px solid var(--border);
    font-size: 11px;
}
.cp-table td {
    padding: 5px 8px;
    color: var(--text-primary);
    border-bottom: 1px solid var(--bg-tertiary);
}
.cp-table tr:last-child td { border-bottom: none; }
.cp-mono {
    font-family: 'SF Mono', 'Fira Code', monospace;
    font-size: 11px;
}
.cp-pills {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}
.cp-pill {
    font-size: 11px;
    font-weight: 500;
    padding: 3px 10px;
    border-radius: 99px;
    background: var(--accent-light);
    color: var(--accent);
}
.cp-access {
    font-size: 12px;
    color: var(--text-secondary);
    line-height: 1.7;
}
.cp-access code {
    font-family: 'SF Mono', 'Fira Code', monospace;
    font-size: 11px;
    background: var(--bg-tertiary);
    padding: 1px 6px;
    border-radius: 4px;
    color: var(--text-primary);
}
.cp-details {
    font-size: 12px;
    color: var(--text-secondary);
    margin-top: 14px;
    padding-top: 12px;
    border-top: 1px solid var(--border);
    line-height: 1.6;
}
.cp-details strong {
    color: var(--text-primary);
    font-weight: 600;
}
.cp-no-issues {
    font-size: 12px;
    color: var(--text-tertiary);
    font-style: italic;
    margin-top: 8px;
}
.cp-source {
    display: inline-block;
    margin-top: 14px;
    font-size: 12px;
    color: var(--accent);
    text-decoration: none;
    font-weight: 500;
}
.cp-source:hover { text-decoration: underline; }

/* ==================== Resolve Zoho Card (/resolve-zoho) ==================== */

.rz-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 18px;
    max-width: 560px;
    font-size: 13px;
}
.rz-header {
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 14px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border);
}
.rz-header strong {
    color: var(--text-primary);
}
.rz-fields {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 16px;
}
.rz-field {
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.rz-label {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: var(--accent);
}
.rz-value {
    font-size: 13px;
    color: var(--text-primary);
    line-height: 1.5;
}
.rz-actions {
    display: flex;
    align-items: center;
    gap: 12px;
    padding-top: 14px;
    border-top: 1px solid var(--border);
}
.rz-copy-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    border-radius: 8px;
    border: 1px solid var(--accent);
    background: var(--accent-light);
    color: var(--accent);
    font-size: 12px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.2s;
}
.rz-copy-btn:hover {
    background: var(--accent);
    color: #fff;
}
.rz-zoho-link {
    font-size: 12px;
    color: var(--text-tertiary);
    text-decoration: none;
    font-weight: 500;
}
.rz-zoho-link:hover { color: var(--accent); }
.rz-cached {
    font-size: 11px;
    color: var(--text-tertiary);
    font-style: italic;
    margin-top: 8px;
}
