/* ============================================================
   BurgerPrintsAgent - Design System
   Premium AI SaaS aesthetic (light) aligned with BurgerPrintsAgent.html
   ============================================================ */

/* ---- CSS Variables ---- */
:root {
    /* Brand Colors */
    --brand-blue: #0c51c6;
    --brand-orange: #e96d20;
    --brand-orange-light: #f08b4c;
    --brand-orange-dark: #cf5d17;

    /* Light palette */
    --bg-base: #F4F5F7;
    --bg-surface: #ffffff;
    --bg-card: #ffffff;
    --bg-card-hover: #f6f7f9;
    --bg-input: rgba(244, 245, 247, 0.60);
    --bg-sidebar: #ffffff;

    /* Soft glass */
    --glass-bg: rgba(12, 81, 198, 0.04);
    --glass-border: rgba(11, 18, 32, 0.08);
    --glass-blur: blur(14px);

    /* Text */
    --text-primary: #0b1220;
    --text-secondary: rgba(11, 18, 32, 0.70);
    --text-muted: rgba(11, 18, 32, 0.55);
    --text-orange: var(--brand-orange);

    /* Borders */
    --border-subtle: rgba(11, 18, 32, 0.08);
    --border-card: rgba(11, 18, 32, 0.10);
    --border-focus: rgba(12, 81, 198, 0.28);

    /* Status colors */
    --success: #22C55E;
    --warning: #F59E0B;
    --error: #EF4444;
    --info: #0c51c6;

    /* Badge colors */
    --badge-us: #0c51c6;
    --badge-eu: #6D28D9;
    --badge-china: #DC2626;
    --badge-dtg: #22C55E;
    --badge-sub: #F59E0B;
    --badge-fast: #10B981;
    --badge-aop: #EC4899;

    /* Spacing */
    --header-h: 60px;
    --sidebar-w: 260px;
    --radius: 12px;
    --radius-sm: 8px;
    --radius-lg: 16px;

    /* Shadows */
    --shadow-sm: 0 10px 30px rgba(11, 18, 32, 0.10);
    --shadow-md: 0 14px 50px rgba(11, 18, 32, 0.14);
    --shadow-lg: 0 20px 70px rgba(11, 18, 32, 0.18);
    --shadow-orange: 0 12px 30px rgba(233, 109, 32, 0.18);

    /* Transitions */
    --trans-fast: 150ms ease;
    --trans-base: 250ms ease;
    --trans-slow: 400ms ease;
}

/* ---- Reset & Base ---- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { font-size: 16px; scroll-behavior: smooth; }

body {
    font-family: 'Montserrat', -apple-system, BlinkMacSystemFont, sans-serif;
    background-color: var(--bg-base);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    overflow: hidden;
}

/* Background gradient */
body::before {
    content: '';
    position: fixed;
    inset: 0;
    background:
        radial-gradient(ellipse 80% 50% at 20% -10%, rgba(12, 81, 198, 0.10) 0%, transparent 60%),
        radial-gradient(ellipse 60% 40% at 80% 110%, rgba(233, 109, 32, 0.10) 0%, transparent 60%);
    pointer-events: none;
    z-index: 0;
}

#app {
    position: relative;
    z-index: 1;
    height: 100vh;
    display: flex;
    flex-direction: column;
}

.nice-scrollbar::-webkit-scrollbar { width: 10px; }
.nice-scrollbar::-webkit-scrollbar-thumb {
    background: rgba(11, 18, 32, 0.16);
    border-radius: 999px;
    border: 3px solid transparent;
    background-clip: padding-box;
}
.nice-scrollbar::-webkit-scrollbar-track { background: transparent; }

/* ---- Header ---- */
.header {
    height: var(--header-h);
    background: rgba(10,11,15,0.95);
    border-bottom: 1px solid var(--border-subtle);
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    position: sticky;
    top: 0;
    z-index: 100;
    flex-shrink: 0;
}

.header-inner {
    max-width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
}

.logo {
    display: flex;
    align-items: center;
    gap: 10px;
}

.logo-icon {
    font-size: 28px;
    filter: drop-shadow(0 0 8px rgba(255,107,44,0.5));
    animation: float 3s ease-in-out infinite;
}

@keyframes float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-4px); }
}

.logo-text {
    display: flex;
    flex-direction: column;
    line-height: 1.1;
}

.logo-title {
    font-size: 16px;
    font-weight: 700;
    background: linear-gradient(135deg, var(--brand-orange), var(--brand-yellow));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.logo-sub {
    font-size: 11px;
    color: var(--text-muted);
    font-weight: 500;
    letter-spacing: 0.05em;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.header-graph-link {
    color: var(--text-muted);
    text-decoration: none;
    font-size: 12px;
    font-weight: 600;
    padding: 4px 12px;
    border: 1px solid var(--border-card);
    border-radius: 6px;
    transition: all var(--trans-fast);
    margin-right: 8px;
}

.header-graph-link:hover {
    border-color: var(--brand-orange);
    color: var(--brand-orange-light);
    background: rgba(255,107,44,0.08);
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--text-muted);
    transition: background var(--trans-base);
}

.status-dot.online { background: var(--success); box-shadow: 0 0 6px var(--success); }
.status-dot.warning { background: var(--warning); box-shadow: 0 0 6px rgba(245, 158, 11, 0.45); }
.status-dot.error { background: var(--error); }

.status-label {
    font-size: 12px;
    color: var(--text-muted);
}

/* ---- Main Layout ---- */
.main-layout {
    display: flex;
    flex: 1;
    overflow: hidden;
}

/* ---- Sidebar ---- */
.sidebar {
    width: var(--sidebar-w);
    background: var(--bg-sidebar);
    border-right: 1px solid var(--border-subtle);
    overflow-y: auto;
    flex-shrink: 0;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 24px;
    scrollbar-width: thin;
    scrollbar-color: var(--border-card) transparent;
}

.sidebar-section {}

.sidebar-title {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin-bottom: 10px;
}

/* Quick prompts */
.quick-prompts {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.quick-btn {
    background: var(--bg-card);
    border: 1px solid var(--border-card);
    color: var(--text-secondary);
    padding: 8px 12px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    text-align: left;
    cursor: pointer;
    transition: all var(--trans-fast);
    font-family: inherit;
    line-height: 1.4;
}

.quick-btn:hover {
    background: var(--glass-bg);
    border-color: var(--glass-border);
    color: var(--text-primary);
    transform: translateX(2px);
}

/* Filters */
.filter-group {
    margin-bottom: 12px;
}

.filter-label {
    font-size: 11px;
    color: var(--text-muted);
    font-weight: 500;
    display: block;
    margin-bottom: 6px;
}

.filter-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
}

.filter-tag {
    padding: 4px 10px;
    border-radius: 100px;
    font-size: 12px;
    font-weight: 500;
    background: var(--bg-card);
    border: 1px solid var(--border-card);
    color: var(--text-muted);
    cursor: pointer;
    transition: all var(--trans-fast);
    user-select: none;
}

.filter-tag:hover {
    border-color: var(--glass-border);
    color: var(--text-secondary);
}

.filter-tag.active {
    background: linear-gradient(135deg, var(--brand-orange), var(--brand-orange-dark));
    border-color: transparent;
    color: white;
    box-shadow: var(--shadow-orange);
}

/* Session info */
.session-info {
    display: flex;
    align-items: center;
    gap: 8px;
}

.session-id {
    font-family: 'JetBrains Mono', monospace;
    font-size: 11px;
    color: var(--text-muted);
    background: var(--bg-card);
    padding: 4px 8px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-card);
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.btn-new-chat {
    background: none;
    border: 1px solid var(--border-card);
    color: var(--text-muted);
    padding: 4px 8px;
    border-radius: var(--radius-sm);
    font-size: 11px;
    cursor: pointer;
    white-space: nowrap;
    transition: all var(--trans-fast);
    font-family: inherit;
}

.btn-new-chat:hover {
    border-color: var(--glass-border);
    color: var(--text-orange);
}

/* ---- Chat Section ---- */
.chat-section {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative;
}

/* Messages container */
.messages-container {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 20px;
    scrollbar-width: thin;
    scrollbar-color: var(--border-card) transparent;
}

/* Message groups */
.message-group {
    display: flex;
    gap: 12px;
    animation: fadeInUp var(--trans-slow) ease;
}

@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(12px); }
    to { opacity: 1; transform: translateY(0); }
}

.user-group { flex-direction: row-reverse; }

.avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    flex-shrink: 0;
    background: var(--bg-card);
    border: 1px solid var(--border-card);
}

.user-group .avatar {
    background: linear-gradient(135deg, var(--brand-orange), var(--brand-orange-dark));
    border: none;
}

.message-content {
    max-width: min(820px, 78%);
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.user-group .message-content { align-items: flex-end; }

.message-bubble {
    padding: 12px 16px;
    border-radius: var(--radius-lg);
    font-size: 14px;
    line-height: 1.7;
    border: 1px solid var(--border-card);
}

.assistant-bubble {
    background: var(--bg-card);
    border-radius: 4px var(--radius-lg) var(--radius-lg) var(--radius-lg);
}

.user-bubble {
    background: linear-gradient(135deg, var(--brand-orange), var(--brand-orange-dark));
    border-color: transparent;
    color: white;
    border-radius: var(--radius-lg) 4px var(--radius-lg) var(--radius-lg);
}

.message-bubble p { margin-bottom: 8px; }
.message-bubble p:last-child { margin-bottom: 0; }
.message-bubble ul { padding-left: 18px; margin-bottom: 8px; }
.message-bubble li { margin-bottom: 4px; }
.message-bubble strong { color: var(--text-orange); }
.user-bubble strong { color: rgba(255,255,255,0.9); }

/* Table in messages */
.message-bubble table {
    width: 100%;
    border-collapse: collapse;
    margin: 8px 0;
    font-size: 13px;
}

.message-bubble th {
    background: rgba(255,107,44,0.15);
    padding: 6px 10px;
    text-align: left;
    font-weight: 600;
    color: var(--brand-orange-light);
    border: 1px solid var(--border-card);
}

.message-bubble td {
    padding: 6px 10px;
    border: 1px solid var(--border-card);
    color: var(--text-secondary);
}

.message-bubble tr:nth-child(even) td {
    background: rgba(255,255,255,0.02);
}

.message-time {
    font-size: 11px;
    color: var(--text-muted);
    padding: 0 4px;
}

.message-footer-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.user-footer-row {
    justify-content: flex-end;
}

.assistant-meta-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 6px;
    padding: 0 4px;
}

.assistant-meta-left,
.assistant-meta-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.intent-badge,
.meta-pill {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 600;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--border-card);
    color: var(--text-secondary);
}

.intent-badge {
    color: var(--brand-orange-light);
    border-color: rgba(255, 107, 44, 0.2);
    background: rgba(255, 107, 44, 0.08);
}

.icon-btn {
    background: transparent;
    color: var(--text-muted);
    border: 1px solid var(--border-card);
    border-radius: 999px;
    padding: 4px 10px;
    font-size: 11px;
    cursor: pointer;
    transition: all var(--trans-fast);
    font-family: inherit;
}

.icon-btn:hover {
    color: var(--text-primary);
    border-color: var(--glass-border);
    background: rgba(255, 255, 255, 0.04);
}

/* Typing indicator bubble */
.typing-bubble {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 14px 18px;
    background: var(--bg-card);
    border: 1px solid var(--border-card);
    border-radius: 4px var(--radius-lg) var(--radius-lg) var(--radius-lg);
    width: fit-content;
    min-width: 120px;
}

.typing-indicator {
    display: flex;
    gap: 4px;
}

.typing-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--text-muted);
    animation: typing 1.2s infinite;
}

.typing-dot:nth-child(2) { animation-delay: 0.2s; }
.typing-dot:nth-child(3) { animation-delay: 0.4s; }

@keyframes typing {
    0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
    30% { transform: translateY(-6px); opacity: 1; }
}

.typing-note {
    font-size: 12px;
    color: var(--text-muted);
    letter-spacing: 0.01em;
    animation: pulse-note 2s ease-in-out infinite;
}

@keyframes pulse-note {
    0%, 100% { opacity: 0.6; }
    50% { opacity: 1; }
}


.product-cards-area {
    background: transparent;
    padding: 0;
    max-height: none;
    overflow: visible;
    scrollbar-width: thin;
}

.bp-canvas-tab {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    border-radius: 12px;
    border: 1px solid rgba(11, 18, 32, 0.08);
    background: #ffffff;
    color: rgba(11, 18, 32, 0.72);
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    transition: all 160ms ease;
}

.bp-canvas-tab:hover {
    background: #f8fafc;
    color: var(--text-primary);
    border-color: rgba(12, 81, 198, 0.14);
}

.bp-canvas-tab.is-active {
    background: linear-gradient(180deg, rgba(12, 81, 198, 0.08), rgba(12, 81, 198, 0.03));
    border-color: rgba(12, 81, 198, 0.2);
    color: var(--brand-blue);
    box-shadow: 0 8px 20px rgba(12, 81, 198, 0.08);
}

.bp-canvas-empty-state {
    margin-top: 16px;
    padding: 18px 20px;
    border-radius: 16px;
    border: 1px dashed rgba(11, 18, 32, 0.12);
    background: linear-gradient(180deg, rgba(244, 245, 247, 0.7), rgba(255, 255, 255, 0.9));
    color: var(--text-secondary);
    font-size: 13px;
    line-height: 1.7;
}

.assistant-extras {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 10px;
}

.assistant-result-card {
    background: linear-gradient(180deg, rgba(255,107,44,0.08), rgba(255,255,255,0.02));
    border: 1px solid rgba(255, 107, 44, 0.15);
    border-radius: var(--radius);
    padding: 12px 14px;
}

.result-card-label {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--text-orange);
    margin-bottom: 4px;
}

.result-card-title {
    font-size: 14px;
    font-weight: 700;
    color: var(--text-primary);
}

.result-card-sub {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 2px;
    font-family: 'JetBrains Mono', monospace;
}

.reason-list {
    display: grid;
    gap: 8px;
}

.reason-item {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-card);
    border-radius: 10px;
    padding: 10px 12px;
    color: var(--text-secondary);
    font-size: 13px;
}

.inline-product-strip {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 10px;
}

.mini-product-card {
    background: var(--bg-card);
    border: 1px solid var(--border-card);
    border-radius: var(--radius);
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.mini-product-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.mini-rank,
.mini-score {
    font-size: 11px;
    font-weight: 700;
    color: var(--text-muted);
}

.mini-name {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
}

.mini-sku {
    font-size: 11px;
    color: var(--text-muted);
    font-family: 'JetBrains Mono', monospace;
}

.mini-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}

.mini-action {
    width: fit-content;
    border: 1px solid var(--glass-border);
    background: rgba(255, 107, 44, 0.08);
    color: var(--brand-orange-light);
    border-radius: 999px;
    padding: 6px 10px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--trans-fast);
    font-family: inherit;
}

.mini-action:hover {
    background: rgba(255, 107, 44, 0.14);
    color: var(--text-primary);
}

.follow-up-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.follow-up-chip {
    border: 1px solid var(--border-card);
    background: var(--bg-card);
    color: var(--text-secondary);
    border-radius: 999px;
    padding: 7px 12px;
    font-size: 12px;
    cursor: pointer;
    transition: all var(--trans-fast);
    font-family: inherit;
}

.follow-up-chip:hover {
    color: var(--text-primary);
    border-color: var(--glass-border);
    background: rgba(255, 255, 255, 0.04);
}

.error-chip {
    color: #FCA5A5;
    border-color: rgba(239, 68, 68, 0.2);
    background: rgba(239, 68, 68, 0.08);
}

.product-cards-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}

.product-cards-header-left {
    display: flex;
    align-items: center;
    gap: 10px;
}

.product-cards-header-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.header-toggle {
    border: 1px solid var(--border-card);
    background: var(--bg-card);
    color: var(--text-secondary);
    border-radius: 999px;
    padding: 6px 10px;
    font-size: 12px;
    cursor: pointer;
    transition: all var(--trans-fast);
    font-family: inherit;
}

.header-toggle:hover {
    color: var(--text-primary);
    border-color: var(--glass-border);
    background: rgba(255, 255, 255, 0.04);
}

.header-toggle.active {
    border-color: rgba(255,107,44,0.4);
    background: rgba(255,107,44,0.10);
    color: #FDBA74;
}

.product-cards-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
}

.product-count {
    font-size: 12px;
    color: var(--text-muted);
    background: var(--bg-card);
    padding: 2px 8px;
    border-radius: 100px;
}

.product-cards-grid {
    display: grid;
    gap: 12px;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
}

/* Product Card */
.product-card {
    background: var(--bg-card);
    border: 1px solid var(--border-card);
    border-radius: var(--radius);
    padding: 14px;
    min-width: 0;
    max-width: none;
    transition: all var(--trans-base);
    cursor: pointer;
    position: relative;
    overflow: hidden;
}

.card-partners {
    font-size: 12px;
    color: var(--text-secondary);
    margin-top: 8px;
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

.card-actions {
    margin-top: 10px;
    display: flex;
    gap: 8px;
}

.card-action-btn {
    border: 1px solid var(--border-card);
    background: rgba(255, 255, 255, 0.03);
    color: var(--text-secondary);
    border-radius: 10px;
    padding: 6px 10px;
    font-size: 12px;
    cursor: pointer;
    transition: all var(--trans-fast);
    font-family: inherit;
}

.card-action-btn:hover {
    color: var(--text-primary);
    border-color: var(--glass-border);
    background: rgba(255, 255, 255, 0.06);
}

.partner-colors-panel {
    margin-top: 10px;
    border-top: 1px solid var(--border-card);
    padding-top: 10px;
    display: none;
}

.partner-colors-panel.open {
    display: block;
}

.partner-row {
    margin-bottom: 10px;
}

.partner-row:last-child {
    margin-bottom: 0;
}

.partner-row-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 12px;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

.partner-row-title {
    font-weight: 600;
    color: var(--text-primary);
    max-width: 150px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.partner-row-count {
    font-size: 11px;
    color: var(--text-muted);
}

.swatch-row {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.color-swatch {
    width: 18px;
    height: 18px;
    border-radius: 999px;
    border: 1px solid rgba(255,255,255,0.18);
    cursor: pointer;
    position: relative;
    padding: 0;
    outline: none;
    background: transparent;
}

.color-swatch:hover {
    border-color: rgba(255,255,255,0.35);
}

.color-swatch:hover::after {
    content: attr(data-hex);
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    top: -28px;
    background: rgba(0,0,0,0.85);
    border: 1px solid rgba(255,255,255,0.12);
    color: rgba(255,255,255,0.92);
    font-size: 11px;
    padding: 3px 6px;
    border-radius: 8px;
    white-space: nowrap;
    pointer-events: none;
    z-index: 20;
}

.color-swatch[data-hex="#ffffff"], .color-swatch[data-hex="#FFFFFF"] {
    border-color: rgba(255,255,255,0.35);
}

.partner-colors-hidden .partner-colors-panel,
.partner-colors-hidden .card-action-btn[data-card-action="toggle-partner-colors"] {
    display: none !important;
}

/* Partner colors modal */
.partner-colors-card {
    width: min(820px, calc(100vw - 32px));
    max-height: min(78vh, 720px);
    overflow: auto;
    background: var(--bg-card);
    border: 1px solid var(--border-card);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    padding: 14px;
}

.partner-colors-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 10px;
}

.partner-colors-title {
    font-weight: 800;
    color: var(--text-primary);
    max-width: 680px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.partner-colors-body {
    padding-top: 6px;
}

/* Color preview modal */
.color-preview-card {
    width: min(420px, calc(100vw - 32px));
    background: var(--bg-card);
    border: 1px solid var(--border-card);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    padding: 14px;
}

.color-preview-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 14px;
}

.color-preview-title {
    font-weight: 700;
    color: var(--text-primary);
}

.color-preview-body {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    padding: 10px 0 4px;
}

.color-preview-swatch {
    width: 140px;
    height: 140px;
    border-radius: 999px;
    border: 1px solid rgba(255,255,255,0.16);
    background: #111827;
}

.color-preview-hex {
    font-family: 'JetBrains Mono', monospace;
    font-size: 13px;
    color: var(--text-secondary);
    background: rgba(255,255,255,0.04);
    border: 1px solid var(--border-card);
    border-radius: 12px;
    padding: 6px 10px;
}

.product-card::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, transparent, rgba(255,107,44,0.03));
    opacity: 0;
    transition: opacity var(--trans-base);
}

.product-card:hover {
    border-color: var(--glass-border);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md), var(--shadow-orange);
}

.product-card:hover::before { opacity: 1; }

.card-rank {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--brand-orange), var(--brand-orange-dark));
    color: white;
    font-size: 11px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
}

.card-name {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 4px;
    padding-right: 28px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.card-sku {
    font-size: 11px;
    color: var(--text-muted);
    font-family: 'JetBrains Mono', monospace;
    margin-bottom: 10px;
}

.card-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-bottom: 10px;
}

.badge {
    padding: 2px 8px;
    border-radius: 100px;
    font-size: 11px;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 3px;
}

.badge-us { background: rgba(59,130,246,0.15); color: #60A5FA; border: 1px solid rgba(59,130,246,0.3); }
.badge-eu { background: rgba(139,92,246,0.15); color: #A78BFA; border: 1px solid rgba(139,92,246,0.3); }
.badge-china { background: rgba(239,68,68,0.15); color: #F87171; border: 1px solid rgba(239,68,68,0.3); }
.badge-dtg { background: rgba(34,197,94,0.15); color: #4ADE80; border: 1px solid rgba(34,197,94,0.3); }
.badge-sub { background: rgba(245,158,11,0.15); color: #FCD34D; border: 1px solid rgba(245,158,11,0.3); }
.badge-aop { background: rgba(236,72,153,0.15); color: #F472B6; border: 1px solid rgba(236,72,153,0.3); }
.badge-fast { background: rgba(16,185,129,0.15); color: #34D399; border: 1px solid rgba(16,185,129,0.3); }
.badge-slow { background: rgba(107,114,128,0.15); color: #9CA3AF; border: 1px solid rgba(107,114,128,0.3); }
.badge-default { background: rgba(255,255,255,0.05); color: var(--text-muted); border: 1px solid var(--border-card); }
.badge-inventory-available { background: rgba(16,185,129,0.15); color: #34D399; border: 1px solid rgba(16,185,129,0.3); }
.badge-inventory-oos { background: rgba(239,68,68,0.15); color: #F87171; border: 1px solid rgba(239,68,68,0.3); }
.badge-inventory-unknown { background: rgba(148,163,184,0.15); color: #CBD5E1; border: 1px solid rgba(148,163,184,0.3); }

.card-score-bar {
    height: 4px;
    background: var(--border-card);
    border-radius: 100px;
    overflow: hidden;
    margin-top: 8px;
}

.card-score-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--brand-orange), var(--brand-yellow));
    border-radius: 100px;
    transition: width var(--trans-slow);
}

.card-score-label {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 4px;
    text-align: right;
}

/* ---- Chat Input ---- */
.chat-input-area {
    padding: 16px 24px 20px;
    background: var(--bg-surface);
    border-top: 1px solid var(--border-subtle);
    flex-shrink: 0;
}

.composer-suggestions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 12px;
}

.composer-chip {
    background: var(--bg-card);
    border: 1px solid var(--border-card);
    color: var(--text-secondary);
    padding: 7px 12px;
    border-radius: 999px;
    font-size: 12px;
    cursor: pointer;
    transition: all var(--trans-fast);
    font-family: inherit;
}

.composer-chip:hover {
    color: var(--text-primary);
    border-color: var(--glass-border);
    background: rgba(255, 255, 255, 0.04);
}

.input-wrapper {
    display: flex;
    align-items: flex-end;
    gap: 10px;
    background: var(--bg-input);
    border: 1px solid var(--border-card);
    border-radius: var(--radius-lg);
    padding: 10px 14px;
    transition: border-color var(--trans-fast);
}

.input-wrapper:focus-within {
    border-color: var(--border-focus);
    box-shadow: 0 0 0 3px rgba(255, 107, 44, 0.08);
}

.chat-input {
    flex: 1;
    background: none;
    border: none;
    outline: none;
    color: var(--text-primary);
    font-family: inherit;
    font-size: 14px;
    line-height: 1.5;
    resize: none;
    min-height: 24px;
    max-height: 120px;
    overflow-y: auto;
    scrollbar-width: thin;
}

.chat-input::placeholder { color: var(--text-muted); }

.input-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.char-count {
    font-size: 11px;
    color: var(--text-muted);
}

.send-btn {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: linear-gradient(135deg, var(--brand-orange), var(--brand-orange-dark));
    border: none;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--trans-fast);
    flex-shrink: 0;
}

.send-btn:hover {
    transform: scale(1.05);
    box-shadow: var(--shadow-orange);
}

.send-btn:active { transform: scale(0.97); }

.send-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    transform: none;
}

.input-hint {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 6px;
    text-align: center;
}

/* ---- Loading Overlay ---- */
.loading-overlay {
    position: fixed;
    inset: 0;
    background: rgba(10, 11, 15, 0.7);
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.loading-card {
    background: var(--bg-card);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
    padding: 32px 40px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    box-shadow: var(--shadow-lg), var(--shadow-orange);
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 3px solid var(--border-card);
    border-top-color: var(--brand-orange);
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.loading-text {
    font-size: 14px;
    color: var(--text-secondary);
}

/* ---- Toast ---- */
.toast {
    position: fixed;
    bottom: 24px;
    right: 24px;
    background: var(--bg-card);
    border: 1px solid var(--border-card);
    border-radius: var(--radius);
    padding: 12px 20px;
    font-size: 13px;
    color: var(--text-primary);
    z-index: 2000;
    box-shadow: var(--shadow-lg);
    transform: translateY(20px);
    opacity: 0;
    transition: all var(--trans-base);
    pointer-events: none;
}

.toast.show {
    transform: translateY(0);
    opacity: 1;
}

.toast.success { border-left: 3px solid var(--success); }
.toast.error { border-left: 3px solid var(--error); }
.toast.info { border-left: 3px solid var(--info); }

/* ---- Scrollbar styling ---- */
::-webkit-scrollbar { width: 4px; height: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-card); border-radius: 100px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* ---- Markdown-style content ---- */
.md-content h1, .md-content h2, .md-content h3 {
    color: var(--text-primary);
    margin: 12px 0 6px;
}

.md-content p {
    margin: 0 0 10px;
}

.md-content p:last-child {
    margin-bottom: 0;
}

.md-content ul,
.md-content ol {
    margin: 10px 0 14px 20px;
}

.md-content li + li {
    margin-top: 6px;
}

.md-content code {
    font-family: 'JetBrains Mono', monospace;
    background: rgba(255,255,255,0.05);
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 12px;
    color: var(--brand-orange-light);
}

.md-content pre {
    background: #0E1018;
    border: 1px solid var(--border-card);
    border-radius: var(--radius);
    padding: 12px 14px;
    overflow-x: auto;
    margin: 12px 0;
}

.md-content pre code {
    background: transparent;
    padding: 0;
    color: var(--text-primary);
}

.md-content blockquote {
    border-left: 3px solid rgba(255, 107, 44, 0.35);
    margin: 12px 0;
    padding: 6px 0 6px 12px;
    color: var(--text-secondary);
}

.table-wrap {
    overflow-x: auto;
    margin: 12px 0;
}

/* ---- Markdown Tables ---- */
.md-content table {
    width: 100%;
    border-collapse: collapse;
    margin: 16px 0;
    font-size: 13px;
    background: var(--bg-surface);
    border-radius: var(--radius);
    overflow: hidden;
}

.md-content th, .md-content td {
    padding: 10px 14px;
    border: 1px solid var(--border-subtle);
    text-align: left;
}

.md-content th {
    background: var(--bg-card);
    font-weight: 600;
    color: var(--text-primary);
}

.md-content tr:hover td {
    background: rgba(255, 255, 255, 0.02);
}

.assistant-report-content {
    color: var(--text-primary);
    font-weight: 400;
}

.assistant-report-content h2 {
    font-size: 1.16rem;
    line-height: 1.45;
    font-weight: 700;
    margin: 4px 0 14px;
    letter-spacing: -0.01em;
}

.assistant-report-content h3 {
    font-size: 0.98rem;
    line-height: 1.55;
    font-weight: 650;
    margin: 18px 0 10px;
    padding-top: 14px;
    border-top: 1px solid var(--border-subtle);
}

.assistant-report-content h4 {
    font-size: 0.96rem;
    line-height: 1.55;
    font-weight: 650;
    margin: 14px 0 8px;
    padding: 10px 12px;
    background: linear-gradient(180deg, rgba(12, 81, 198, 0.035), rgba(12, 81, 198, 0.015));
    border: 1px solid rgba(12, 81, 198, 0.08);
    border-radius: 12px;
}

.assistant-report-content p {
    font-size: 0.95rem;
    line-height: 1.78;
    color: var(--text-secondary);
    margin-bottom: 12px;
}

.assistant-report-content ul {
    list-style: none;
    margin: 10px 0 16px;
    padding: 0;
}

.assistant-report-content li {
    position: relative;
    margin: 0 0 10px;
    padding: 11px 14px 11px 16px;
    background: #f8fafc;
    border: 1px solid rgba(11, 18, 32, 0.08);
    border-radius: 12px;
    color: var(--text-secondary);
}

.assistant-report-content li::before {
    content: '';
    position: absolute;
    left: 0;
    top: 10px;
    bottom: 10px;
    width: 3px;
    border-radius: 999px;
    background: linear-gradient(180deg, var(--brand-blue), var(--brand-orange));
}

.assistant-report-content strong {
    color: var(--text-primary);
    font-weight: 600;
}

.assistant-report-content,
.assistant-report-content p,
.assistant-report-content li,
.assistant-report-content h2,
.assistant-report-content h3,
.assistant-report-content h4 {
    overflow-wrap: anywhere;
    word-break: break-word;
}

.assistant-report-content p {
    line-height: 1.75;
}

.assistant-report-content .table-wrap {
    border: 1px solid var(--border-subtle);
    border-radius: 14px;
    background: white;
    box-shadow: var(--shadow-sm);
}

.assistant-report-content table {
    margin: 0;
}

.assistant-report-content blockquote {
    background: rgba(12, 81, 198, 0.04);
    border-left-color: rgba(12, 81, 198, 0.35);
    padding: 10px 14px;
    border-radius: 0 12px 12px 0;
}

/* ---- Apply Filter Button ---- */
.btn-apply-filter {
    width: 100%;
    margin-top: 8px;
    background: linear-gradient(135deg, var(--brand-orange), var(--brand-orange-dark));
    border: none;
    color: white;
    padding: 8px 16px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
    transition: all var(--trans-fast);
}

.btn-apply-filter:hover {
    opacity: 0.9;
    transform: translateY(-1px);
    box-shadow: var(--shadow-orange);
}

/* ---- Cache info ---- */
.cache-info {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.cache-label {
    font-size: 12px;
    color: var(--text-muted);
}

.btn-clear-cache {
    background: none;
    border: 1px solid var(--border-card);
    color: var(--text-muted);
    padding: 4px 8px;
    border-radius: var(--radius-sm);
    font-size: 11px;
    cursor: pointer;
    transition: all var(--trans-fast);
    font-family: inherit;
}

.btn-clear-cache:hover {
    border-color: var(--glass-border);
    color: var(--text-orange);
}

/* ---- Product Card Thumbnail ---- */
.card-thumb {
    width: 100%;
    height: 80px;
    object-fit: cover;
    border-radius: var(--radius-sm);
    margin-bottom: 8px;
    background: var(--bg-surface);
}

.card-thumb-placeholder {
    width: 100%;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    background: rgba(255,107,44,0.05);
    border-radius: var(--radius-sm);
    margin-bottom: 8px;
    border: 1px solid var(--border-card);
}

.card-price {
    font-size: 12px;
    font-weight: 600;
    color: var(--brand-orange-light);
    margin-bottom: 4px;
}

.card-profit {
    font-size: 11px;
    color: var(--success);
    margin-bottom: 6px;
}

/* ---- Mini Product Card Thumbnail ---- */
.mini-thumb {
    width: 100%;
    height: 60px;
    object-fit: cover;
    border-radius: var(--radius-sm);
    margin-bottom: 6px;
    background: var(--bg-surface);
}

.mini-price {
    font-size: 11px;
    font-weight: 600;
    color: var(--brand-orange-light);
    margin-bottom: 4px;
}

.mini-partners-text {
    font-size: 11px;
    color: var(--text-muted);
    margin: 4px 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ---- Result card badges ---- */
.result-card-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}

/* ---- Order Modal ---- */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: 3000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.modal-card {
    background: var(--bg-card);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 560px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow-lg), 0 0 40px rgba(255,107,44,0.15);
    animation: slideUp 0.25s ease;
}

@keyframes slideUp {
    from { transform: translateY(20px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-subtle);
}

.modal-title {
    font-size: 18px;
    font-weight: 700;
    color: var(--text-primary);
}

.modal-close {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 18px;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 6px;
    transition: all var(--trans-fast);
    font-family: inherit;
}

.modal-close:hover {
    background: rgba(255,255,255,0.06);
    color: var(--text-primary);
}

.modal-body {
    padding: 20px 24px;
    overflow-y: auto;
    flex: 1;
    scrollbar-width: thin;
}

.modal-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 24px;
    border-top: 1px solid var(--border-subtle);
    gap: 12px;
}

.step-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--brand-orange-light);
    margin-bottom: 16px;
}

.form-group {
    margin-bottom: 14px;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.form-label {
    font-size: 12px;
    font-weight: 500;
    color: var(--text-secondary);
    display: block;
    margin-bottom: 6px;
}

.form-input {
    width: 100%;
    background: var(--bg-input);
    border: 1px solid var(--border-card);
    color: var(--text-primary);
    padding: 8px 12px;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-family: inherit;
    transition: border-color var(--trans-fast);
    outline: none;
}

.form-input:focus {
    border-color: var(--border-focus);
    box-shadow: 0 0 0 2px rgba(255, 107, 44, 0.1);
}

.form-input::placeholder {
    color: var(--text-muted);
}

.btn-primary {
    background: linear-gradient(135deg, var(--brand-orange), var(--brand-orange-dark));
    border: none;
    color: white;
    padding: 10px 20px;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
    transition: all var(--trans-fast);
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.btn-primary:hover {
    opacity: 0.9;
    box-shadow: var(--shadow-orange);
}

.btn-secondary {
    background: none;
    border: 1px solid var(--border-card);
    color: var(--text-secondary);
    padding: 10px 20px;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
    transition: all var(--trans-fast);
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.btn-secondary:hover {
    border-color: var(--glass-border);
    color: var(--text-primary);
}

.order-preview {
    background: var(--bg-surface);
    border: 1px solid var(--border-card);
    border-radius: var(--radius);
    padding: 16px;
}

.order-preview-section {
    margin-bottom: 16px;
}

.order-preview-section h4 {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-orange);
    margin-bottom: 8px;
}

.preview-table {
    width: 100%;
    border-collapse: collapse;
}

.preview-table td {
    padding: 4px 8px;
    font-size: 13px;
}

.preview-table td:first-child {
    color: var(--text-muted);
    width: 80px;
}

.preview-table td:last-child {
    color: var(--text-primary);
}

.preview-note {
    font-size: 12px;
    color: var(--warning);
    margin-top: 12px;
    padding: 8px 12px;
    background: rgba(245,158,11,0.08);
    border-radius: var(--radius-sm);
    border: 1px solid rgba(245,158,11,0.2);
}

/* ---- Responsive ---- */
@media (max-width: 768px) {
    .sidebar { display: none; }
    .messages-container { padding: 16px; }
    .chat-input-area { padding: 12px 16px 16px; }
    .product-cards-area { padding: 0; }
    .message-content { max-width: 100%; }
    .composer-suggestions { overflow-x: auto; flex-wrap: nowrap; padding-bottom: 2px; }
    .inline-product-strip { grid-template-columns: 1fr; }
    .modal-card { max-width: 100%; margin: 0; border-radius: var(--radius) var(--radius) 0 0; }
    .form-row { grid-template-columns: 1fr; }
    .product-cards-grid { grid-template-columns: 1fr; }
}

.bp-compact-pane #bp-chat-scroll {
    padding-left: 16px !important;
    padding-right: 16px !important;
    padding-top: 16px !important;
    padding-bottom: 16px !important;
}

.bp-compact-pane #bp-canvas-content {
    padding: 16px !important;
}

.bp-compact-grid {
    grid-template-columns: 1fr !important;
}

