/* Cardigan-AI — Design System v2 (Vercel AI-inspired) */

:root {
    --bg: #ffffff;
    --bg-sidebar: #1a1a2e;
    --bg-sidebar-hover: rgba(255, 255, 255, 0.07);
    --bg-sidebar-active: rgba(51, 93, 232, 0.25);
    --bg-muted: #f5f5f5;
    --bg-user-msg: #335DE8;

    --text: #0a0a0a;
    --text-secondary: #525252;
    --text-muted: #a3a3a3;
    --text-sidebar: #e5e5e5;
    --text-sidebar-muted: #737373;

    --accent: #335DE8;
    --accent-hover: #2a4fd0;
    --accent-glow: rgba(51, 93, 232, 0.12);

    --rouge-cardigan: #F25D3B;
    --bleu-fonce: #335DE8;
    --jaune-cardigan: #FFC661;

    --success: #16a34a;
    --success-bg: #f0fdf4;
    --success-text: #15803d;
    --danger: #dc2626;
    --danger-bg: #fef2f2;
    --danger-text: #991b1b;
    --warning: #ca8a04;
    --warning-bg: #fefce8;
    --warning-text: #854d0e;
    --info: #2563eb;
    --info-bg: #eff6ff;
    --info-text: #1e40af;

    --border: #e5e5e5;
    --border-light: #f0f0f0;
    --sidebar-width: 260px;
    --radius: 8px;
    --radius-lg: 12px;
    --radius-xl: 20px;
    --radius-full: 9999px;

    --shadow-sm: 0 1px 2px rgba(0,0,0,0.04);
    --shadow: 0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
    --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.07), 0 2px 4px -1px rgba(0,0,0,0.04);

    --font: 'DM Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --font-mono: 'SF Mono', 'JetBrains Mono', 'Fira Code', monospace;
    --ease: cubic-bezier(0.4, 0, 0.2, 1);
}

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

body {
    font-family: var(--font);
    background: var(--bg);
    color: var(--text);
    height: 100vh;
    overflow: hidden;
    -webkit-font-smoothing: antialiased;
}

/* Scrollbar */
::-webkit-scrollbar { width: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(0,0,0,0.12); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: rgba(0,0,0,0.2); }
.sidebar ::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.12); }

/* ============================================
   LOGIN
   ============================================ */
.login-container {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100vh;
    background: var(--bg-sidebar);
}
.login-card {
    background: white;
    border-radius: var(--radius-xl);
    padding: 2.5rem 2rem;
    width: 380px;
    text-align: center;
    box-shadow: 0 25px 50px -12px rgba(0,0,0,0.4);
}
.login-logo {
    width: 40px;
    height: 40px;
    background: var(--rouge-cardigan);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1rem;
    font-size: 1rem;
    color: white;
    font-weight: 700;
}
.login-card h1 {
    font-size: 1.4rem;
    font-weight: 700;
    margin-bottom: 0.25rem;
    letter-spacing: -0.02em;
}
.login-card p {
    color: var(--text-secondary);
    margin-bottom: 1.75rem;
    font-size: 0.85rem;
}
.login-card input {
    width: 100%;
    padding: 0.7rem 0.85rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-family: var(--font);
    font-size: 0.9rem;
    margin-bottom: 0.75rem;
    outline: none;
    transition: border-color 0.15s;
}
.login-card input:focus {
    border-color: var(--text);
}
.login-card input::placeholder { color: var(--text-muted); }

/* ============================================
   LAYOUT
   ============================================ */
.app-layout {
    display: flex;
    flex-direction: column;
    height: 100vh;
}
.app-layout-main {
    display: flex;
    flex: 1;
    min-height: 0;
}

/* OAuth Alert Banner */
.oauth-banner {
    width: 100%;
    background: var(--danger-bg, #fef2f2);
    border-bottom: 1px solid var(--danger, #dc2626);
    padding: 0.5rem 1rem;
    font-size: 0.85rem;
    z-index: 100;
    flex-shrink: 0;
}
.oauth-banner-inner {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--danger-text, #991b1b);
    flex-wrap: wrap;
}
.oauth-banner-inner svg { stroke: var(--danger, #dc2626); flex-shrink: 0; }
.oauth-banner-link {
    background: var(--danger, #dc2626);
    color: white;
    padding: 0.2rem 0.6rem;
    border-radius: 4px;
    font-size: 0.78rem;
    font-weight: 600;
    text-decoration: none;
    transition: opacity 0.15s;
}
.oauth-banner-link:hover { opacity: 0.85; }

/* ============================================
   SIDEBAR
   ============================================ */
.sidebar {
    width: var(--sidebar-width);
    background: var(--bg-sidebar);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
}
.sidebar-header {
    padding: 1rem 0.75rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid rgba(255,255,255,0.08);
}
.sidebar-header h2 {
    font-size: 0.9rem;
    font-weight: 600;
    color: white;
    padding-left: 0.25rem;
}
.sidebar-new-btn {
    padding: 0.35rem 0.75rem;
    background: rgba(255,255,255,0.08);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: var(--radius);
    color: var(--text-sidebar);
    font-family: var(--font);
    font-size: 0.78rem;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.15s;
}
.sidebar-new-btn:hover { background: rgba(255,255,255,0.14); }
.sidebar-sessions {
    flex: 1;
    overflow-y: auto;
    padding: 0.35rem 0.5rem;
}
.sidebar-section-label {
    padding: 0.6rem 0.5rem 0.3rem;
    font-size: 0.68rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-sidebar-muted);
}
.session-item {
    padding: 0.5rem 0.6rem;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.82rem;
    color: var(--text-sidebar-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    transition: all 0.1s;
}
.session-item:hover {
    background: var(--bg-sidebar-hover);
    color: var(--text-sidebar);
}
.session-item.active {
    background: var(--bg-sidebar-active);
    color: white;
}
.sidebar-footer {
    padding: 0.7rem 0.75rem;
    border-top: 1px solid rgba(255,255,255,0.08);
    font-size: 0.78rem;
    color: var(--text-sidebar-muted);
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.sidebar-footer .user-email {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 140px;
}
.sidebar-footer button {
    padding: 0.3rem 0.6rem;
    background: transparent;
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 6px;
    color: var(--text-sidebar-muted);
    font-family: var(--font);
    font-size: 0.72rem;
    cursor: pointer;
    transition: all 0.1s;
}
.sidebar-footer button:hover {
    background: rgba(255,255,255,0.08);
    color: var(--text-sidebar);
}

/* ============================================
   SERVICES PANEL (sidebar)
   ============================================ */
.sidebar-services {
    padding: 0.35rem 0.5rem 0.5rem;
    border-top: 1px solid rgba(255,255,255,0.08);
}
.service-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.4rem 0.5rem;
    border-radius: 6px;
}
.service-item:hover { background: var(--bg-sidebar-hover); }
.service-name {
    font-size: 0.8rem;
    color: var(--text-sidebar);
    font-weight: 500;
}
.service-status {
    display: flex;
    align-items: center;
    gap: 0.4rem;
}
.service-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--text-sidebar-muted);
}
.service-dot.connected {
    background: #22c55e;
    box-shadow: 0 0 4px rgba(34, 197, 94, 0.5);
}
.service-disconnect {
    background: none;
    border: none;
    color: var(--text-sidebar-muted);
    font-size: 0.7rem;
    cursor: pointer;
    padding: 0.1rem 0.3rem;
    border-radius: 4px;
    font-family: var(--font);
}
.service-disconnect:hover {
    color: var(--danger);
    background: rgba(255,255,255,0.06);
}
.service-connect-btn {
    font-size: 0.72rem;
    color: var(--accent);
    text-decoration: none;
    padding: 0.2rem 0.5rem;
    border: 1px solid rgba(0, 108, 255, 0.3);
    border-radius: 4px;
    font-family: var(--font);
    font-weight: 500;
    transition: all 0.15s;
}
.service-connect-btn:hover {
    background: rgba(0, 108, 255, 0.1);
    border-color: var(--accent);
}
.sidebar-footer button.active {
    background: rgba(255,255,255,0.12);
    color: var(--text-sidebar);
}

/* ============================================
   CHAT AREA
   ============================================ */
.chat-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
    background: var(--bg);
    position: relative;
}
.chat-header {
    padding: 0.7rem 1.25rem;
    border-bottom: 1px solid var(--border);
    font-weight: 600;
    font-size: 0.88rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-shrink: 0;
}
.chat-messages {
    flex: 1;
    overflow-y: auto;
    position: relative;
}
.chat-messages-inner {
    max-width: 768px;
    margin: 0 auto;
    padding: 1rem 1rem 2rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

/* ============================================
   MESSAGES — compact, Vercel AI style
   ============================================ */
.message {
    display: flex;
    flex-direction: column;
}

/* User message */
.msg-user {
    align-items: flex-end;
}
.msg-user .msg-bubble {
    background: var(--bg-user-msg);
    color: white;
    padding: 0.6rem 0.9rem;
    border-radius: var(--radius-lg) var(--radius-lg) 4px var(--radius-lg);
    max-width: min(80%, 520px);
    font-size: 0.88rem;
    line-height: 1.5;
    word-break: break-word;
}

/* Assistant message */
.msg-assistant {
    align-items: flex-start;
}
.msg-assistant .msg-content {
    max-width: min(90%, 680px);
    font-size: 0.88rem;
    line-height: 1.6;
    color: var(--text);
    word-break: break-word;
}
/* Markdown inside assistant */
.msg-assistant .msg-content > *:first-child { margin-top: 0; }
.msg-assistant .msg-content > *:last-child { margin-bottom: 0; }
.msg-assistant .msg-content p { margin: 0.35rem 0; }
.msg-assistant .msg-content h3 { font-size: 0.95rem; font-weight: 600; margin: 0.6rem 0 0.2rem; }
.msg-assistant .msg-content h4 { font-size: 0.88rem; font-weight: 600; margin: 0.5rem 0 0.15rem; }
.msg-assistant .msg-content ul,
.msg-assistant .msg-content ol { padding-left: 1.25rem; margin: 0.25rem 0; }
.msg-assistant .msg-content li { margin: 0.1rem 0; }
.msg-assistant .msg-content code {
    font-family: var(--font-mono);
    background: var(--bg-muted);
    padding: 0.1em 0.35em;
    border-radius: 4px;
    font-size: 0.82em;
}
.msg-assistant .msg-content pre {
    background: #1e1e1e;
    color: #d4d4d4;
    border-radius: var(--radius);
    padding: 0.75rem 1rem;
    overflow-x: auto;
    margin: 0.4rem 0;
    font-size: 0.8rem;
    line-height: 1.5;
}
.msg-assistant .msg-content pre code {
    background: none;
    padding: 0;
    font-size: inherit;
    color: inherit;
}
.msg-assistant .msg-content a {
    color: var(--accent);
    text-decoration: underline;
    text-underline-offset: 2px;
}

/* Message meta (sender label) */
.msg-sender {
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: 0.2rem;
    display: flex;
    align-items: center;
    gap: 0.35rem;
}
.msg-sender .sparkle {
    display: inline-flex;
}

/* Message actions (copy, feedback) */
.msg-actions {
    display: flex;
    gap: 0.15rem;
    margin-top: 0.25rem;
    opacity: 0;
    transition: opacity 0.15s;
}
.message:hover .msg-actions { opacity: 1; }
.msg-action-btn {
    background: none;
    border: none;
    padding: 0.25rem;
    cursor: pointer;
    color: var(--text-muted);
    border-radius: 4px;
    display: flex;
    align-items: center;
    transition: all 0.1s;
}
.msg-action-btn:hover {
    color: var(--text-secondary);
    background: var(--bg-muted);
}
.msg-action-btn.active-up { color: var(--success); }
.msg-action-btn.active-down { color: var(--danger); }
.msg-action-btn svg { width: 14px; height: 14px; }

/* ============================================
   WIDGETS
   ============================================ */
.widget {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1rem;
    margin: 0.5rem 0;
    max-width: 620px;
}
.widget-title {
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
    margin-bottom: 0.6rem;
}
.widget table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.82rem;
}
.widget th {
    text-align: left;
    padding: 0.4rem 0.6rem;
    border-bottom: 1px solid var(--border);
    font-weight: 600;
    font-size: 0.75rem;
    color: var(--text-secondary);
}
.widget td {
    padding: 0.4rem 0.6rem;
    border-bottom: 1px solid var(--border-light);
}
.widget tr:last-child td { border-bottom: none; }
.widget iframe {
    border-radius: var(--radius);
    border: 1px solid var(--border);
}

/* ============================================
   INPUT AREA
   ============================================ */
.chat-input-area {
    padding: 0 1rem 1rem;
    max-width: 768px;
    margin: 0 auto;
    width: 100%;
}
.chat-input-wrapper {
    display: flex;
    align-items: flex-end;
    gap: 0;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 0.35rem 0.35rem 0.35rem 0.85rem;
    transition: border-color 0.15s;
    background: var(--bg);
    box-shadow: var(--shadow-sm);
}
.chat-input-wrapper:focus-within {
    border-color: #c0c0c0;
}
.chat-input {
    flex: 1;
    padding: 0.4rem 0;
    border: none;
    font-family: var(--font);
    font-size: 0.88rem;
    outline: none;
    background: transparent;
    resize: none;
    color: var(--text);
    field-sizing: content;
    max-height: 144px;
    min-height: 24px;
    line-height: 1.5;
}
.chat-input::placeholder { color: var(--text-muted); }
.chat-send-btn {
    width: 32px;
    height: 32px;
    background: var(--rouge-cardigan);
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: opacity 0.15s;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.chat-send-btn:hover { opacity: 0.8; }
.chat-send-btn:disabled { opacity: 0.3; cursor: not-allowed; }
.chat-send-btn svg { width: 16px; height: 16px; }

/* ============================================
   BUTTONS
   ============================================ */
.btn {
    padding: 0.5rem 1rem;
    border: none;
    border-radius: var(--radius);
    font-family: var(--font);
    font-size: 0.82rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s;
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
}
.btn-primary {
    background: var(--rouge-cardigan);
    color: white;
}
.btn-primary:hover { opacity: 0.85; }
.btn-primary:disabled { opacity: 0.4; cursor: not-allowed; }
.btn-secondary {
    background: white;
    border: 1px solid var(--border);
    color: var(--text);
}
.btn-secondary:hover { background: var(--bg-muted); }
.btn-sm { padding: 0.35rem 0.7rem; font-size: 0.78rem; }
.btn-approve { background: var(--success); color: white; }
.btn-approve:hover { background: #15803d; }
.btn-danger-ghost {
    background: transparent;
    border: 1px solid #fecaca;
    color: var(--danger);
}
.btn-danger-ghost:hover { background: var(--danger-bg); }

/* ============================================
   STREAMING
   ============================================ */
.thinking-indicator {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    color: var(--text-muted);
    font-size: 0.82rem;
    padding: 0.15rem 0;
}
.thinking-dots {
    display: inline-flex;
    gap: 2px;
}
.thinking-dot {
    width: 5px;
    height: 5px;
    background: var(--text-muted);
    border-radius: 50%;
    animation: dotBounce 1.4s infinite ease-in-out both;
}
.thinking-dot:nth-child(1) { animation-delay: 0ms; }
.thinking-dot:nth-child(2) { animation-delay: 150ms; }
.thinking-dot:nth-child(3) { animation-delay: 300ms; }

@keyframes dotBounce {
    0%, 80%, 100% { transform: translateY(0); opacity: 0.4; }
    40% { transform: translateY(-4px); opacity: 1; }
}

/* Inline streaming cursor */
.streaming-cursor::after {
    content: '';
    display: inline-block;
    width: 2px;
    height: 1em;
    background: var(--text);
    margin-left: 1px;
    vertical-align: text-bottom;
    animation: blink 0.8s infinite;
}
@keyframes blink {
    0%, 50% { opacity: 1; }
    51%, 100% { opacity: 0; }
}

/* ============================================
   SCROLL TO BOTTOM
   ============================================ */
.scroll-to-bottom {
    position: absolute;
    bottom: 80px;
    left: 50%;
    transform: translateX(-50%) scale(0.9);
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-full);
    padding: 0.4rem 0.5rem;
    cursor: pointer;
    box-shadow: var(--shadow-md);
    opacity: 0;
    pointer-events: none;
    transition: all 0.2s var(--ease);
    display: flex;
    align-items: center;
    justify-content: center;
}
.scroll-to-bottom.visible {
    opacity: 1;
    pointer-events: auto;
    transform: translateX(-50%) scale(1);
}
.scroll-to-bottom svg { width: 16px; height: 16px; color: var(--text-secondary); }

/* ============================================
   BADGES
   ============================================ */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.15rem 0.5rem;
    border-radius: var(--radius-full);
    font-size: 0.7rem;
    font-weight: 600;
}
.badge-pass { background: var(--success-bg); color: var(--success-text); }
.badge-fail { background: var(--danger-bg); color: var(--danger-text); }
.badge-pending { background: var(--warning-bg); color: var(--warning-text); }
.badge-running { background: var(--info-bg); color: var(--info-text); }

/* ============================================
   EMPTY STATE
   ============================================ */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    gap: 0.4rem;
    padding: 2rem;
}
.empty-state h3 {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text);
}
.empty-state p {
    font-size: 0.85rem;
    color: var(--text-secondary);
    text-align: center;
    max-width: 340px;
}
.empty-state .hint {
    font-size: 0.78rem;
    color: var(--text-muted);
    background: var(--bg-muted);
    padding: 0.4rem 0.85rem;
    border-radius: var(--radius-full);
    margin-top: 0.35rem;
}

/* ============================================
   STEP INDICATORS (in chat)
   ============================================ */
.step-tag {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    font-size: 0.78rem;
    color: var(--text-muted);
    padding: 0.15rem 0;
}
.step-tag.completed { color: var(--success); }
.step-tag.error { color: var(--danger); }

/* ============================================
   RESPONSIVE
   ============================================ */
/* ============================================
   SLASH COMMAND DROPDOWN
   ============================================ */
.slash-dropdown {
    position: absolute;
    bottom: 70px;
    left: 50%;
    transform: translateX(-50%);
    width: 100%;
    max-width: 768px;
    max-height: 320px;
    overflow-y: auto;
    background: white;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: 0 12px 40px rgba(0,0,0,0.12);
    z-index: 50;
    padding: 0.35rem;
}
.slash-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.55rem 0.75rem;
    border-radius: var(--radius);
    cursor: pointer;
    transition: background 0.1s;
    position: relative;
}
.slash-item:hover,
.slash-item.selected {
    background: var(--bg-muted);
}
.slash-item-left {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    min-width: 0;
}
.slash-item-name {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text);
    white-space: nowrap;
    font-family: var(--font-mono);
}
.slash-item-desc {
    font-size: 0.8rem;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.slash-tooltip {
    position: absolute;
    right: calc(100% + 8px);
    top: 50%;
    transform: translateY(-50%);
    width: 280px;
    background: var(--bg-sidebar);
    color: var(--text-sidebar);
    border-radius: var(--radius);
    padding: 0.75rem;
    box-shadow: 0 8px 24px rgba(0,0,0,0.2);
    z-index: 60;
    pointer-events: none;
}
.slash-tooltip-title {
    font-size: 0.82rem;
    font-weight: 700;
    font-family: var(--font-mono);
    margin-bottom: 0.35rem;
}
.slash-tooltip-body {
    font-size: 0.78rem;
    line-height: 1.45;
    color: var(--text-sidebar-muted);
}

/* ============================================
   SESSION RENAME
   ============================================ */
.session-rename-wrapper {
    padding: 0.15rem 0.25rem;
}
.session-rename-input {
    width: 100%;
    padding: 0.4rem 0.5rem;
    background: rgba(255,255,255,0.1);
    border: 1px solid rgba(255,255,255,0.25);
    border-radius: 6px;
    color: white;
    font-family: var(--font);
    font-size: 0.82rem;
    outline: none;
}
.session-rename-input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 2px rgba(0, 108, 255, 0.2);
}

/* ============================================
   ONBOARDING CARD
   ============================================ */
.onboarding-card {
    max-width: 620px;
    margin: 2rem auto;
    padding: 1.5rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    background: white;
}
.onboarding-title {
    font-size: 0.95rem;
    font-weight: 700;
    margin-bottom: 0.25rem;
}
.onboarding-subtitle {
    font-size: 0.82rem;
    color: var(--text-secondary);
    margin-bottom: 1rem;
    line-height: 1.5;
}
.onboarding-subtitle kbd {
    display: inline-block;
    padding: 0.1rem 0.4rem;
    background: var(--bg-muted);
    border: 1px solid var(--border);
    border-radius: 4px;
    font-family: var(--font-mono);
    font-size: 0.78rem;
    font-weight: 600;
}
.onboarding-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem;
}
.onboarding-item {
    display: flex;
    align-items: flex-start;
    gap: 0.6rem;
    padding: 0.65rem 0.75rem;
    border: 1px solid var(--border-light);
    border-radius: var(--radius);
    cursor: pointer;
    transition: all 0.15s;
}
.onboarding-item:hover {
    border-color: var(--border);
    background: var(--bg-muted);
}
.onboarding-icon {
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-muted);
    border-radius: 6px;
    flex-shrink: 0;
    color: var(--text-secondary);
}
.onboarding-item-title {
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text);
}
.onboarding-item-desc {
    font-size: 0.75rem;
    color: var(--text-muted);
    line-height: 1.35;
    margin-top: 0.1rem;
}

/* ============================================
   SIDEBAR NAVIGATION
   ============================================ */
.sidebar-nav {
    padding: 0.5rem 0.5rem 0;
    border-bottom: 1px solid rgba(255,255,255,0.08);
    padding-bottom: 0.5rem;
}
.sidebar-nav-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.4rem 0.6rem;
    border-radius: 6px;
    font-size: 0.8rem;
    color: var(--text-sidebar-muted);
    cursor: pointer;
    transition: all 0.15s var(--ease);
}
.sidebar-nav-item:hover {
    background: var(--bg-sidebar-hover);
    color: var(--text-sidebar);
}
.sidebar-nav-item.active {
    background: var(--bg-sidebar-active);
    color: white;
    font-weight: 500;
}
a.sidebar-link {
    text-decoration: none;
    color: var(--text-sidebar-muted);
}
a.sidebar-link:hover {
    color: var(--text-sidebar);
}

/* ============================================
   VIEW PANELS (Calendar, Merge)
   ============================================ */
.view-panel {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    padding: 0;
}
.view-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
    gap: 1rem;
    flex-wrap: wrap;
}
.view-header h2 {
    font-size: 1.1rem;
    font-weight: 600;
    letter-spacing: -0.02em;
}
.view-controls {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    flex-wrap: wrap;
}
.view-controls select,
.view-controls input[type="date"] {
    padding: 0.35rem 0.6rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-family: var(--font);
    font-size: 0.8rem;
    background: var(--bg);
    color: var(--text);
    outline: none;
}
.view-controls select:focus,
.view-controls input[type="date"]:focus {
    border-color: var(--accent);
}
.view-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    flex: 1;
    gap: 0.75rem;
    padding: 3rem;
    text-align: center;
}
.view-empty h3 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text);
}
.view-empty p {
    font-size: 0.85rem;
    color: var(--text-muted);
    max-width: 400px;
}

/* ============================================
   GANTT CHART
   ============================================ */
.gantt-backup-info {
    padding: 0.5rem 1.5rem;
    font-size: 0.8rem;
    color: var(--text-muted);
}
.gantt-stats {
    display: flex;
    gap: 0.75rem;
    padding: 0.5rem 1.5rem;
    flex-wrap: wrap;
}
.gantt-st {
    background: var(--bg-muted);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 0.5rem 0.85rem;
}
.gantt-sv {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text);
}
.gantt-sl {
    font-size: 0.7rem;
    color: var(--text-muted);
    margin-top: 1px;
}
.gantt-legend {
    display: flex;
    gap: 0.85rem;
    padding: 0.35rem 1.5rem;
    flex-wrap: wrap;
}
.gantt-legend-item {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 0.7rem;
    color: var(--text-secondary);
}
.gantt-legend-sw {
    width: 10px;
    height: 10px;
    border-radius: 3px;
    display: inline-block;
}
.gantt-zone-title {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text);
    margin: 1rem 1.5rem 0.5rem;
    padding: 0.3rem 0.75rem;
    border-left: 3px solid var(--accent);
}
.gantt-wrapper {
    overflow-x: auto;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg);
    position: relative;
    margin: 0 1.5rem 1rem;
}
.gantt-table {
    border-collapse: collapse;
    width: max-content;
}
.gantt-table thead th {
    position: sticky;
    top: 0;
    background: var(--bg-muted);
    border-bottom: 2px solid var(--border);
    padding: 4px 0;
    font-size: 9px;
    color: var(--text-muted);
    font-weight: 600;
    text-align: center;
    z-index: 2;
}
.gantt-table thead th.gantt-mh {
    border-bottom: 1px solid var(--border);
    font-size: 11px;
    color: var(--accent);
}
.gantt-table thead th.gantt-lbl {
    text-align: left;
    padding-left: 10px;
    min-width: 300px;
    position: sticky;
    left: 0;
    z-index: 3;
    background: var(--bg-muted);
}
.gantt-table tbody td {
    border-bottom: 1px solid var(--border-light);
    padding: 0;
    height: 28px;
    position: relative;
}
.gantt-lc {
    padding: 2px 10px !important;
    font-size: 0.72rem;
    white-space: nowrap;
    position: sticky;
    left: 0;
    background: var(--bg);
    z-index: 1;
    border-right: 1px solid var(--border);
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 300px;
}
.gantt-pb {
    display: inline-block;
    background: var(--bg-muted);
    color: var(--text-muted);
    font-size: 8px;
    padding: 1px 4px;
    border-radius: 3px;
    margin-right: 4px;
    font-family: var(--font-mono);
}
.gantt-tb {
    display: inline-block;
    font-size: 8px;
    padding: 1px 5px;
    border-radius: 3px;
    margin-right: 4px;
    color: #fff;
}
.gantt-tb-sec { background: #16a34a; }
.gantt-tb-hpb { background: #2563eb; }
.gantt-tb-under { background: #7c3aed; }
.gantt-tb-car { background: #ca8a04; }
.gantt-tb-ct { background: #ea580c; }
.gantt-tb-hb { background: #dc2626; }
.gantt-tb-clp { background: #ca8a04; }
.gantt-tb-promo { background: #16a34a; }
.gantt-tb-other { background: #737373; }
.gantt-tb-added { background: #16a34a; }
.gantt-tb-updated { background: #2563eb; }
.gantt-tb-unchanged { background: #a3a3a3; }
.gantt-dc {
    border-left: 1px solid var(--border-light);
}
.gantt-we {
    background: rgba(0,0,0,0.015);
}
.gantt-bar {
    position: absolute;
    top: 3px;
    height: 22px;
    border-radius: 3px;
    font-size: 8px;
    color: #fff;
    display: flex;
    align-items: center;
    padding: 0 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    cursor: pointer;
    min-width: 3px;
    z-index: 1;
}
.gantt-bar:hover {
    opacity: 0.85;
    z-index: 10;
    box-shadow: 0 0 6px rgba(0,0,0,0.15);
}
.gantt-oe { border-right: 3px dashed rgba(255,255,255,0.5); }
.gantt-ns { border-left: 3px dashed rgba(255,255,255,0.5); }
.gantt-gh td {
    background: var(--bg-muted) !important;
    padding: 4px 10px !important;
    font-size: 0.72rem;
    font-weight: 700;
    border-bottom: 1px solid var(--border);
}
.gantt-gs td {
    height: 4px !important;
    background: var(--border-light) !important;
    border: none !important;
}
.gantt-tm {
    position: absolute;
    top: 0;
    bottom: 0;
    width: 2px;
    background: #dc2626;
    z-index: 5;
    pointer-events: none;
}
.gantt-tm span {
    position: absolute;
    top: 2px;
    font-size: 8px;
    color: #dc2626;
    white-space: nowrap;
    transform: translateX(-50%);
    font-weight: 700;
}
.gantt-tip {
    display: none;
    position: fixed;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 0.6rem 0.85rem;
    font-size: 0.75rem;
    z-index: 100;
    max-width: 400px;
    box-shadow: var(--shadow-md);
    line-height: 1.6;
}
.gantt-tip b { color: var(--text); }
.gantt-tip-d { color: var(--text-muted); }

/* ============================================
   MERGE VIEW
   ============================================ */
.merge-controls {
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--border-light);
}
.merge-brand-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
}
.merge-brand-row label {
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text-secondary);
}
.merge-brand-row select {
    padding: 0.35rem 0.6rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-family: var(--font);
    font-size: 0.8rem;
    background: var(--bg);
    color: var(--text);
    outline: none;
}
.merge-xml-title {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 0.4rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.merge-xml-list {
    margin-top: 0.25rem;
}
.merge-xml-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.4rem 0.6rem;
    border-radius: var(--radius);
    cursor: pointer;
    transition: background 0.12s;
    font-size: 0.8rem;
}
.merge-xml-item:hover {
    background: var(--bg-muted);
}
.merge-xml-item.checked {
    background: var(--accent-glow);
}
.merge-xml-item input[type="checkbox"] {
    accent-color: var(--accent);
}
.merge-xml-name {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    color: var(--text);
}
.merge-xml-date {
    font-size: 0.7rem;
    color: var(--text-muted);
    margin-left: auto;
}
.merge-preview-btn {
    margin-top: 0.75rem;
}
.merge-backup-label {
    font-family: var(--font-mono);
}

/* Merge Results */
.merge-results {
    padding: 1rem 1.5rem;
}
.merge-summary {
    display: flex;
    gap: 0.75rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}
.merge-card {
    background: var(--bg-muted);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 0.6rem 1rem;
    min-width: 100px;
    text-align: center;
}
.merge-card-value {
    font-size: 1.5rem;
    font-weight: 700;
}
.merge-card-label {
    font-size: 0.7rem;
    color: var(--text-muted);
    margin-top: 1px;
}
.merge-verdict {
    padding: 0.6rem 1rem;
    border-radius: var(--radius);
    font-size: 0.85rem;
    font-weight: 600;
    margin-bottom: 1rem;
}
.merge-verdict.verdict-pass {
    background: var(--success-bg);
    color: var(--success-text);
    border: 1px solid var(--success);
}
.merge-verdict.verdict-fail {
    background: var(--danger-bg);
    color: var(--danger-text);
    border: 1px solid var(--danger);
}
.merge-section {
    margin-bottom: 1.25rem;
}
.merge-section-title {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 0.5rem;
    padding: 0.3rem 0;
    border-bottom: 1px solid var(--border-light);
}
.merge-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.75rem;
}
.merge-table th {
    text-align: left;
    padding: 0.4rem 0.6rem;
    background: var(--bg-muted);
    border-bottom: 1px solid var(--border);
    font-weight: 600;
    color: var(--text-secondary);
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}
.merge-table td {
    padding: 0.4rem 0.6rem;
    border-bottom: 1px solid var(--border-light);
    vertical-align: top;
}
.merge-table .mono {
    font-family: var(--font-mono);
    font-size: 0.7rem;
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.merge-table .issue-error td { background: rgba(220,38,38,0.04); }
.merge-table .issue-warning td { background: rgba(202,138,4,0.04); }
.merge-diff {
    display: flex;
    align-items: baseline;
    gap: 0.3rem;
    font-size: 0.7rem;
    margin-bottom: 0.2rem;
    flex-wrap: wrap;
}
.merge-diff-field {
    font-weight: 600;
    color: var(--text-secondary);
    font-family: var(--font-mono);
}
.merge-diff-old {
    color: var(--danger);
    text-decoration: line-through;
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.merge-diff-arrow {
    color: var(--text-muted);
}
.merge-diff-new {
    color: var(--success);
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.merge-timeline-controls {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}
.merge-timeline-controls input[type="date"] {
    padding: 0.3rem 0.5rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 0.75rem;
    font-family: var(--font);
    background: var(--bg);
    color: var(--text);
}

/* ============================================
   RESPONSIVE
   ============================================ */
@media (max-width: 768px) {
    .sidebar { display: none; }
    .chat-messages-inner { padding: 0.75rem; }
    .chat-input-area { padding: 0 0.75rem 0.75rem; }
    .onboarding-grid { grid-template-columns: 1fr; }
    .slash-tooltip { display: none; }
    .view-header { flex-direction: column; align-items: flex-start; }
    .gantt-wrapper { margin: 0 0.5rem 1rem; }
    .merge-results { padding: 1rem; }
}
