:root {
    --bg: #f4f6fa;
    --surface: #ffffff;
    --surface-subtle: #f8fafc;
    --studio-bg: #f3f4f6;
    --border: #e2e8f0;
    --border-strong: #cbd5e1;
    --text: #0f172a;
    --text-muted: #64748b;
    --primary: #2563eb;
    --primary-hover: #1d4ed8;
    --primary-soft: #eff6ff;
    --success: #059669;
    --success-soft: #ecfdf5;
    --warning: #d97706;
    --warning-soft: #fffbeb;
    --danger: #dc2626;
    --danger-soft: #fef2f2;
    --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.05);
    --shadow-md: 0 8px 24px rgba(15, 23, 42, 0.08);
    --radius: 12px;
    --radius-sm: 8px;
}

* {
    box-sizing: border-box;
}

html, body {
    margin: 0;
    padding: 0;
    height: 100%;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Inter", sans-serif;
    font-size: 14px;
    color: var(--text);
    background: var(--bg);
    -webkit-font-smoothing: antialiased;
}

code {
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    font-size: 12px;
    background: #eef2f7;
    padding: 1px 5px;
    border-radius: 4px;
}

.hidden {
    display: none !important;
}

/* ==================== TOP BAR ==================== */
.topbar {
    height: 60px;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    padding: 0 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    position: sticky;
    top: 0;
    z-index: 20;
}

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

.brand-title {
    font-weight: 700;
    font-size: 15px;
    letter-spacing: -0.015em;
}

.brand-sub {
    font-size: 11px;
    color: var(--text-muted);
}

.demo-switcher {
    display: inline-flex;
    background: var(--surface-subtle);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 3px;
    gap: 4px;
}

.switcher-btn {
    border: none;
    background: transparent;
    padding: 7px 14px;
    border-radius: 7px;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: all 0.15s ease;
}

.switcher-btn.active {
    background: var(--surface);
    color: var(--primary);
    box-shadow: var(--shadow-sm);
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: 10px;
}

.lang-switcher {
    display: inline-flex;
    background: var(--surface-subtle);
    border: 1px solid var(--border);
    border-radius: 999px;
    padding: 2px;
    gap: 2px;
}

.lang-btn {
    border: none;
    background: transparent;
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.15s ease;
}

.lang-btn.active {
    background: var(--surface);
    color: var(--primary);
    box-shadow: var(--shadow-sm);
}

.mode-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 11px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
}

.mode-btn {
    cursor: pointer;
    transition: transform 0.1s ease, box-shadow 0.15s ease;
}

.mode-btn:hover {
    box-shadow: var(--shadow-sm);
    transform: translateY(-0.5px);
}

.status-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #64748b;
    display: inline-block;
}

.mode-live .status-dot {
    background: var(--success);
    box-shadow: 0 0 0 3px rgba(5, 150, 105, 0.2);
}

.badge-gear {
    opacity: 0.75;
    font-size: 11px;
}

.mode-mock {
    background: #f1f5f9;
    color: #334155;
    border: 1px solid var(--border-strong);
}

.mode-live {
    background: var(--success-soft);
    color: var(--success);
    border: 1px solid #a7f3d0;
}

/* ==================== WORKSPACE ==================== */
.workspace {
    height: calc(100vh - 60px);
    height: calc(100dvh - 60px);
    overflow: hidden;
}

.demo-view {
    display: none;
    height: 100%;
    padding: 14px 18px;
}

.demo-view.active {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* ==================== BUTTONS & INPUTS ==================== */
.btn {
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    padding: 7px 12px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s ease, border-color 0.15s ease, transform 0.1s ease;
    white-space: nowrap;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    font-family: inherit;
}

.btn:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

.btn-sm {
    padding: 5px 10px;
    font-size: 12px;
}

.btn-xs {
    padding: 3px 8px;
    font-size: 11px;
    border-radius: 6px;
}

.btn-primary {
    background: var(--primary);
    color: #fff;
}

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

.btn-secondary {
    background: var(--surface);
    color: var(--text);
    border-color: var(--border-strong);
}

.btn-secondary:hover:not(:disabled) {
    background: var(--surface-subtle);
}

.btn-ghost {
    background: transparent;
    color: var(--text-muted);
    border-color: var(--border);
}

.btn-ghost:hover:not(:disabled) {
    background: var(--surface-subtle);
    color: var(--text);
}

.btn-warning {
    background: var(--warning);
    color: #fff;
}

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

.btn-danger-outline {
    background: var(--danger-soft);
    color: var(--danger);
    border-color: #fecaca;
}

.btn-danger-outline:hover {
    background: #fee2e2;
}

.btn-success {
    background: var(--success);
    color: #fff;
}

.search-input, .select-input, .chat-composer input {
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm);
    padding: 7px 10px;
    font-size: 13px;
    background: var(--surface);
    color: var(--text);
    outline: none;
    font-family: inherit;
}

.search-input:focus, .select-input:focus, .chat-composer input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.15);
}

/* ==================== DEMO 1: STOREFRONT & RUFUS COPILOT ==================== */
.shop-layout {
    display: grid;
    grid-template-columns: 62fr 38fr;
    gap: 14px;
    height: 100%;
    min-height: 0;
}

.shop-storefront, .shop-copilot {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    display: flex;
    flex-direction: column;
    min-width: 0;
    min-height: 0;
    overflow: hidden;
}

.store-toolbar {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    gap: 10px;
    background: var(--surface);
    flex-shrink: 0;
}

.store-title-wrap {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    flex-wrap: wrap;
}

.store-brand-heading {
    display: flex;
    align-items: center;
    gap: 10px;
}

.store-brand-mark {
    width: 30px;
    height: 30px;
    border-radius: 8px;
    background: #0f172a;
    color: #fff;
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.04em;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.store-title-wrap h2, .copilot-header h3, .col-header h3 {
    margin: 0;
    font-size: 15px;
    font-weight: 700;
    letter-spacing: -0.015em;
}

.store-brand-meta {
    font-size: 11px;
    color: var(--text-muted);
}

.highlight-banner {
    font-size: 12px;
    background: #fef3c7;
    color: #92400e;
    border: 1px solid #fde68a;
    padding: 4px 10px;
    border-radius: 999px;
    font-weight: 600;
}

.store-controls {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
}

.category-pills {
    display: flex;
    gap: 4px;
}

.pill-btn {
    border: 1px solid var(--border);
    background: var(--surface-subtle);
    color: var(--text-muted);
    padding: 5px 11px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s ease;
}

.pill-btn:hover {
    border-color: var(--border-strong);
    color: var(--text);
}

.pill-btn.active {
    background: #0f172a;
    border-color: #0f172a;
    color: #ffffff;
}

.store-search-wrap {
    flex: 1 1 160px;
    min-width: 140px;
}

.store-search-wrap .search-input {
    width: 100%;
}

.store-action-buttons {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

.shop-storefront-scroll {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    background: #fafbfc;
}

/* Editorial Storefront Hero Banner */
.shop-hero {
    position: relative;
    margin: 14px 16px 2px;
    padding: 14px 36px 14px 18px;
    border-radius: var(--radius);
    background: linear-gradient(120deg, #0f172a 0%, #1e293b 55%, #1e3a8a 100%);
    color: #f8fafc;
    box-shadow: var(--shadow-sm);
    overflow: hidden;
    flex-shrink: 0;
}

.shop-hero::after {
    content: "";
    position: absolute;
    right: -30px;
    top: -40px;
    width: 190px;
    height: 190px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(56, 189, 248, 0.25) 0%, transparent 70%);
    pointer-events: none;
}

.shop-hero-content {
    display: flex;
    flex-direction: column;
    gap: 8px;
    position: relative;
    z-index: 1;
}

.shop-hero-kicker-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    flex-wrap: wrap;
}

.shop-hero-kicker {
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: #93c5fd;
    background: rgba(147, 197, 253, 0.12);
    border: 1px solid rgba(147, 197, 253, 0.28);
    padding: 2px 8px;
    border-radius: 999px;
}

.shop-hero-trust {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.hero-trust-pill {
    font-size: 11px;
    color: #cbd5e1;
    font-weight: 500;
}

.shop-hero-main {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    flex-wrap: wrap;
}

.shop-hero-title {
    margin: 0;
    font-size: 17px;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: #ffffff;
}

.shop-hero-sub {
    margin: 3px 0 0;
    font-size: 12px;
    color: #cbd5e1;
    line-height: 1.4;
}

.shop-hero-ctas {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.btn-hero-primary {
    background: #ffffff;
    color: #0f172a;
    border-color: #ffffff;
}

.btn-hero-primary:hover {
    background: #f1f5f9;
}

.btn-hero-secondary {
    background: rgba(255, 255, 255, 0.12);
    color: #ffffff;
    border-color: rgba(255, 255, 255, 0.25);
}

.btn-hero-secondary:hover {
    background: rgba(255, 255, 255, 0.2);
}

.hero-dismiss-btn {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 24px;
    height: 24px;
    border: none;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.12);
    color: #cbd5e1;
    font-size: 12px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    z-index: 2;
}

.hero-dismiss-btn:hover {
    background: rgba(255, 255, 255, 0.24);
    color: #ffffff;
}

/* Drawers & Comparison Panel */
.drawer-panel, .comparison-panel {
    background: var(--surface-subtle);
    border-bottom: 1px solid var(--border);
    padding: 12px 16px;
    max-height: 280px;
    overflow-y: auto;
    flex-shrink: 0;
}

.drawer-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
    gap: 8px;
}

.compare-header-left {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.drawer-actions {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.cart-items-list, .orders-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.cart-row {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 8px 10px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.cart-item-left {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
    flex: 1;
}

.cart-thumb {
    width: 48px;
    height: 48px;
    border-radius: 8px;
    background: var(--studio-bg);
    object-fit: cover;
    flex-shrink: 0;
    border: 1px solid var(--border);
}

.cart-item-info {
    min-width: 0;
}

.cart-item-title {
    font-weight: 600;
    font-size: 13px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.cart-item-right {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}

.qty-stepper {
    display: inline-flex;
    align-items: center;
    border: 1px solid var(--border-strong);
    border-radius: 7px;
    background: var(--surface);
    overflow: hidden;
}

.qty-stepper-btn {
    border: none;
    background: transparent;
    width: 26px;
    height: 26px;
    font-size: 14px;
    font-weight: 700;
    color: var(--text);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.qty-stepper-btn:hover {
    background: var(--surface-subtle);
}

.qty-stepper-val {
    min-width: 24px;
    text-align: center;
    font-size: 12px;
    font-weight: 700;
    border-left: 1px solid var(--border);
    border-right: 1px solid var(--border);
    line-height: 26px;
}

.cart-line-subtotal {
    font-weight: 700;
    font-size: 13px;
    min-width: 62px;
    text-align: right;
}

.cart-summary {
    margin-top: 10px;
    padding: 10px 12px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    display: flex;
    flex-direction: column;
    gap: 4px;
    font-size: 12px;
}

.cart-summary-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.cart-summary-total {
    border-top: 1px solid var(--border);
    padding-top: 6px;
    margin-top: 2px;
    font-size: 13.5px;
    font-weight: 700;
}

/* Confirmed Order Cards */
.order-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 10px 12px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.order-card-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
}

.order-timeline {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 11px;
    color: var(--text-muted);
    flex-wrap: wrap;
}

.order-step-done {
    color: var(--success);
    font-weight: 600;
}

.order-step-active {
    color: var(--primary);
    font-weight: 600;
}

.order-item-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.order-item-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: var(--surface-subtle);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 3px 8px 3px 4px;
    font-size: 11.5px;
}

.order-item-pill img {
    width: 24px;
    height: 24px;
    border-radius: 4px;
    object-fit: cover;
    background: var(--studio-bg);
}

/* Authentic Product Grid & Cards */
.catalog-grid {
    padding: 14px 16px 20px;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 14px;
}

.product-card {
    position: relative;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}

.product-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
    border-color: var(--border-strong);
}

.product-card.highlighted {
    border-color: #f59e0b;
    box-shadow: 0 10px 26px rgba(245, 158, 11, 0.2);
    transform: translateY(-2px);
}

.product-img-wrap {
    position: relative;
    aspect-ratio: 4 / 3;
    background: var(--studio-bg);
    overflow: hidden;
    cursor: pointer;
    border-bottom: 1px solid #eceff3;
}

.product-img-wrap img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.3s ease;
}

.product-card:hover .product-img-wrap img {
    transform: scale(1.04);
}

.product-badge-stack {
    position: absolute;
    top: 10px;
    left: 10px;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
    pointer-events: none;
}

.merch-badge {
    font-size: 10.5px;
    font-weight: 700;
    padding: 3px 8px;
    border-radius: 999px;
    background: rgba(15, 23, 42, 0.86);
    color: #ffffff;
    backdrop-filter: blur(4px);
    letter-spacing: 0.01em;
}

.savings-badge {
    font-size: 10.5px;
    font-weight: 700;
    padding: 2px 7px;
    border-radius: 999px;
    background: #fef2f2;
    color: #dc2626;
    border: 1px solid #fecaca;
}

.copilot-pick-badge {
    font-size: 10.5px;
    font-weight: 700;
    padding: 3px 8px;
    border-radius: 999px;
    background: linear-gradient(90deg, #f59e0b, #d97706);
    color: #ffffff;
    box-shadow: 0 2px 8px rgba(245, 158, 11, 0.35);
}

.compare-pill-float {
    position: absolute;
    top: 10px;
    right: 10px;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(4px);
    border: 1px solid var(--border);
    padding: 3px 8px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 600;
    color: #334155;
    cursor: pointer;
    box-shadow: var(--shadow-sm);
}

.compare-pill-float input {
    margin: 0;
    cursor: pointer;
}

.product-card-body {
    padding: 12px 13px 13px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    flex: 1;
}

.product-brand-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 6px;
}

.product-brand-line {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.product-cat-tag {
    font-size: 10.5px;
    color: var(--text-muted);
    font-weight: 500;
    flex-shrink: 0;
}

.product-title {
    font-weight: 700;
    font-size: 14.5px;
    line-height: 1.3;
    color: var(--text);
    cursor: pointer;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.product-title:hover {
    color: var(--primary);
}

.product-rating-row {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 12px;
}

.stars-visual {
    color: #f59e0b;
    letter-spacing: 0.5px;
    font-size: 12px;
}

.rating-num {
    font-weight: 700;
    color: var(--text);
}

.rating-count {
    color: var(--text-muted);
    font-size: 11.5px;
}

.product-swatches {
    display: flex;
    align-items: center;
    gap: 5px;
    margin-top: 1px;
}

.swatch-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    border: 1px solid rgba(15, 23, 42, 0.22);
    display: inline-block;
}

.swatch-label {
    font-size: 11px;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.product-desc {
    font-size: 12px;
    color: var(--text-muted);
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.product-price-stock {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 8px;
    margin-top: 2px;
}

.price-group {
    display: flex;
    align-items: baseline;
    gap: 6px;
}

.product-price {
    font-size: 17px;
    font-weight: 800;
    letter-spacing: -0.02em;
    color: var(--text);
}

.product-orig-price {
    font-size: 12px;
    color: var(--text-muted);
    text-decoration: line-through;
}

.stock-pill {
    font-size: 11px;
    font-weight: 600;
}

.stock-ok {
    color: var(--success);
}

.stock-low {
    color: var(--warning);
}

.product-actions {
    display: grid;
    grid-template-columns: 1fr auto auto;
    align-items: center;
    gap: 6px;
    margin-top: auto;
    padding-top: 6px;
}

/* Comparison Table */
.comparison-table-wrap {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border-radius: var(--radius-sm);
}

.compare-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12px;
    background: var(--surface);
    border-radius: var(--radius-sm);
    overflow: hidden;
}

.compare-table th, .compare-table td {
    border: 1px solid var(--border);
    padding: 7px 9px;
    text-align: left;
    vertical-align: middle;
}

.compare-table th {
    background: #f1f5f9;
    font-weight: 700;
}

.compare-prod-cell {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 150px;
}

.compare-prod-cell img {
    width: 40px;
    height: 40px;
    border-radius: 6px;
    object-fit: cover;
    background: var(--studio-bg);
    flex-shrink: 0;
}

.compare-prod-link {
    background: none;
    border: none;
    padding: 0;
    font: inherit;
    font-weight: 700;
    color: var(--primary);
    cursor: pointer;
    text-align: left;
}

.compare-prod-link:hover {
    text-decoration: underline;
}

.winner-box {
    margin-top: 8px;
    padding: 8px 10px;
    border-radius: var(--radius-sm);
    background: var(--success-soft);
    border: 1px solid #a7f3d0;
    color: #065f46;
    font-size: 12px;
}

/* ==================== COPILOT & CHAT ==================== */
.copilot-header, .col-header {
    padding: 12px 14px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    flex-shrink: 0;
}

.copilot-title-group {
    display: flex;
    align-items: center;
    gap: 9px;
    min-width: 0;
}

.copilot-avatar {
    width: 30px;
    height: 30px;
    border-radius: 9px;
    background: linear-gradient(135deg, #2563eb, #7c3aed);
    color: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    flex-shrink: 0;
}

.copilot-sub {
    font-size: 11px;
    color: var(--text-muted);
}

.prompt-chips {
    padding: 8px 12px;
    border-bottom: 1px solid var(--border);
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    background: var(--surface-subtle);
    flex-shrink: 0;
}

.chip-btn {
    border: 1px solid var(--border-strong);
    background: var(--surface);
    color: var(--text);
    border-radius: 999px;
    padding: 4px 10px;
    font-size: 12px;
    cursor: pointer;
    transition: border-color 0.15s ease, color 0.15s ease;
}

.chip-btn:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.chat-stream {
    flex: 1;
    overflow-y: auto;
    padding: 12px 14px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    min-height: 0;
}

.msg-bubble {
    border-radius: 12px;
    padding: 10px 13px;
    font-size: 13px;
    line-height: 1.55;
    max-width: 94%;
    min-width: 0;
    word-wrap: break-word;
    overflow-wrap: anywhere;
}

.msg-user {
    align-self: flex-end;
    background: var(--primary);
    color: #fff;
    border-bottom-right-radius: 4px;
}

.msg-assistant {
    align-self: flex-start;
    background: var(--surface-subtle);
    border: 1px solid var(--border);
    color: var(--text);
    width: 100%;
    border-bottom-left-radius: 4px;
}

/* Realistic Customer & Fin Agent Rows (Demo 2) */
.chat-row {
    display: flex;
    flex-direction: column;
    gap: 4px;
    max-width: 100%;
}

.chat-row.chat-row-user {
    align-items: flex-end;
}

.chat-row.chat-row-assistant {
    align-items: flex-start;
}

.chat-meta-line {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 11px;
    color: var(--text-muted);
}

.chat-avatar-sm {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.chat-sender-name {
    font-weight: 700;
    color: var(--text);
}

.verified-agent-badge {
    font-size: 10px;
    font-weight: 600;
    padding: 1px 6px;
    border-radius: 999px;
    background: var(--tenant-soft, var(--primary-soft));
    color: var(--tenant-accent, var(--primary));
    border: 1px solid var(--tenant-border, #bfdbfe);
}

.msg-system-note {
    align-self: center;
    font-size: 12px;
    color: var(--text-muted);
    background: #f1f5f9;
    padding: 4px 10px;
    border-radius: 999px;
    margin-bottom: 4px;
}

/* Sleek Collapsible Tool Trace Disclosure */
.tool-trace-disclosure {
    margin-bottom: 8px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--surface);
    overflow: hidden;
}

.tool-trace-summary {
    list-style: none;
    padding: 5px 9px;
    font-size: 11.5px;
    font-weight: 600;
    color: var(--text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 6px;
    user-select: none;
}

.tool-trace-summary::-webkit-details-marker {
    display: none;
}

.tool-trace-summary:hover {
    color: var(--text);
    background: var(--surface-subtle);
}

.tool-trace-chevron {
    font-size: 10px;
    transition: transform 0.15s ease;
}

.tool-trace-disclosure[open] .tool-trace-chevron {
    transform: rotate(90deg);
}

.tool-chips-wrap {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    padding: 6px 9px 8px;
    border-top: 1px solid var(--border);
    background: var(--surface-subtle);
}

.tool-chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 11px;
    padding: 2px 7px;
    border-radius: 6px;
    background: #eef2ff;
    color: #3730a3;
    border: 1px solid #c7d2fe;
}

.tool-chip.done {
    background: var(--success-soft);
    color: #065f46;
    border-color: #a7f3d0;
}

.tool-chip.error {
    background: var(--danger-soft);
    color: var(--danger);
    border-color: #fecaca;
}

.tool-progress-note {
    font-size: 11px;
    color: var(--text-muted);
    margin: 2px 0 6px;
}

/* Rufus-Style Inline Product Recommendation Cards in Copilot Chat */
.rufus-cards-wrap {
    margin-top: 10px;
    padding-top: 8px;
    border-top: 1px dashed var(--border-strong);
}

.rufus-cards-label {
    font-size: 10.5px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
    margin-bottom: 6px;
}

.rufus-cards-row {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding-bottom: 4px;
    -webkit-overflow-scrolling: touch;
}

.rufus-mini-card {
    flex: 0 0 178px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 8px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    box-shadow: var(--shadow-sm);
}

.rufus-mini-head {
    display: flex;
    gap: 8px;
    align-items: center;
}

.rufus-mini-head img {
    width: 48px;
    height: 48px;
    border-radius: 7px;
    object-fit: cover;
    background: var(--studio-bg);
    flex-shrink: 0;
}

.rufus-mini-title {
    font-size: 12px;
    font-weight: 700;
    line-height: 1.25;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.rufus-mini-meta {
    font-size: 11px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    color: var(--text-muted);
}

.rufus-mini-price {
    font-weight: 800;
    color: var(--text);
    font-size: 12.5px;
}

.rufus-mini-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 5px;
    margin-top: auto;
}

.hitl-card {
    border: 1px solid #fcd34d;
    background: #fffbeb;
    border-radius: var(--radius-sm);
    padding: 10px 12px;
    margin: 6px 0;
}

.hitl-card-title {
    font-weight: 700;
    color: #92400e;
    margin-bottom: 4px;
    font-size: 13px;
}

.hitl-kv-list {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 3px 10px;
    font-size: 12px;
    background: rgba(255, 255, 255, 0.8);
    border: 1px solid #fde68a;
    border-radius: 6px;
    padding: 7px 9px;
    margin: 6px 0;
}

.hitl-kv-key {
    font-weight: 600;
    color: #78350f;
}

.hitl-kv-val {
    color: var(--text);
    word-break: break-word;
}

.hitl-args {
    font-family: ui-monospace, monospace;
    font-size: 11px;
    background: rgba(255, 255, 255, 0.7);
    padding: 6px;
    border-radius: 6px;
    margin: 6px 0;
    overflow-x: auto;
}

.hitl-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 6px;
}

.steer-bar {
    background: #fffbeb;
    border-top: 1px solid #fde68a;
    padding: 8px 12px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    flex-shrink: 0;
}

.steer-status {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    font-weight: 600;
    color: #92400e;
}

.steer-actions {
    display: flex;
    gap: 6px;
}

.pulse-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #f59e0b;
    display: inline-block;
    animation: pulse 1s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.3; }
}

.chat-composer {
    padding: 10px 12px;
    border-top: 1px solid var(--border);
    display: flex;
    gap: 8px;
    background: var(--surface);
    flex-shrink: 0;
}

.chat-composer input {
    flex: 1;
    min-width: 0;
}

/* ==================== PRODUCT DETAIL PAGE MODAL (PDP) ==================== */
.pdp-modal-card {
    max-width: 940px;
    width: 100%;
    max-height: 90vh;
    max-height: 90dvh;
}

.pdp-modal-header {
    align-items: center;
    padding: 11px 18px;
}

.pdp-header-breadcrumb {
    display: flex;
    align-items: center;
    gap: 8px;
}

.pdp-modal-body {
    padding: 18px 20px 24px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.pdp-hero-grid {
    display: grid;
    grid-template-columns: 1fr 1.15fr;
    gap: 22px;
    align-items: start;
}

.pdp-media-col {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.pdp-image-frame {
    position: relative;
    aspect-ratio: 1 / 1;
    background: var(--studio-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
}

.pdp-image-frame img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.pdp-trust-strip {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

.pdp-trust-box {
    background: var(--surface-subtle);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 8px 10px;
    font-size: 11.5px;
    color: #334155;
    line-height: 1.35;
}

.pdp-info-col {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.pdp-brand-sku {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.pdp-title {
    margin: 0;
    font-size: 22px;
    font-weight: 800;
    letter-spacing: -0.02em;
    line-height: 1.2;
}

.pdp-price-bar {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.pdp-price {
    font-size: 24px;
    font-weight: 800;
    color: var(--text);
}

.pdp-orig-price {
    font-size: 15px;
    color: var(--text-muted);
    text-decoration: line-through;
}

.pdp-desc {
    margin: 0;
    font-size: 13.5px;
    color: #334155;
    line-height: 1.55;
}

.pdp-option-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.pdp-option-label {
    font-size: 12px;
    font-weight: 700;
    color: var(--text);
}

.pdp-option-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.pdp-pill {
    border: 1px solid var(--border-strong);
    background: var(--surface);
    color: var(--text);
    border-radius: 8px;
    padding: 6px 11px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.12s ease;
}

.pdp-pill:hover {
    border-color: #0f172a;
}

.pdp-pill.active {
    background: #0f172a;
    color: #fff;
    border-color: #0f172a;
}

.pdp-purchase-row {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    margin-top: 4px;
}

.pdp-add-btn {
    flex: 1 1 180px;
    min-height: 40px;
}

.pdp-secondary-row {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.pdp-sections-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    border-top: 1px solid var(--border);
    padding-top: 16px;
}

.pdp-section-box {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.pdp-section-title {
    margin: 0;
    font-size: 14px;
    font-weight: 700;
}

.pdp-highlights-list {
    margin: 0;
    padding: 0;
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 7px;
}

.pdp-highlights-list li {
    font-size: 12.5px;
    line-height: 1.45;
    color: #334155;
    padding-left: 20px;
    position: relative;
}

.pdp-highlights-list li::before {
    content: "✓";
    position: absolute;
    left: 0;
    color: var(--success);
    font-weight: 800;
}

.spec-zebra-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    overflow: hidden;
}

.spec-zebra-table tr:nth-child(odd) {
    background: var(--surface-subtle);
}

.spec-zebra-table th, .spec-zebra-table td {
    padding: 7px 10px;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

.spec-zebra-table th {
    width: 40%;
    color: var(--text-muted);
    font-weight: 600;
}

.spec-zebra-table td {
    font-weight: 600;
    color: var(--text);
}

.pdp-reviews-section {
    border-top: 1px solid var(--border);
    padding-top: 16px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.pdp-reviews-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    flex-wrap: wrap;
}

.pdp-reviews-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 10px;
}

.review-card {
    background: var(--surface-subtle);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 10px 12px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.review-card-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.review-author-wrap {
    display: flex;
    align-items: center;
    gap: 7px;
}

.review-avatar {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: #0f172a;
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.review-title {
    font-weight: 700;
    font-size: 12.5px;
}

.review-comment {
    font-size: 12px;
    color: #334155;
    line-height: 1.45;
}

.pdp-related-section {
    border-top: 1px solid var(--border);
    padding-top: 16px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.pdp-related-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
}

.related-card {
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 8px;
    background: var(--surface);
    display: flex;
    align-items: center;
    gap: 9px;
    cursor: pointer;
    text-align: left;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.related-card:hover {
    border-color: var(--primary);
    box-shadow: var(--shadow-sm);
}

.related-card img {
    width: 50px;
    height: 50px;
    border-radius: 7px;
    object-fit: cover;
    background: var(--studio-bg);
    flex-shrink: 0;
}

/* ==================== DEMO 2: ENTERPRISE SUPPORT WORKSPACE ==================== */
#demo-support[data-tenant="nimbus-cloud"] {
    --tenant-accent: #2563eb;
    --tenant-accent-hover: #1d4ed8;
    --tenant-soft: #eff6ff;
    --tenant-border: #bfdbfe;
}

#demo-support[data-tenant="trail-peak"] {
    --tenant-accent: #059669;
    --tenant-accent-hover: #047857;
    --tenant-soft: #ecfdf5;
    --tenant-border: #a7f3d0;
}

#demo-support .btn-primary {
    background: var(--tenant-accent);
}

#demo-support .btn-primary:hover:not(:disabled) {
    background: var(--tenant-accent-hover);
}

.support-subbar {
    background: var(--surface);
    border: 1px solid var(--border);
    border-top: 3px solid var(--tenant-accent, var(--primary));
    border-radius: var(--radius);
    padding: 9px 14px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 10px;
    flex-shrink: 0;
}

.support-brand-controls, .support-security-controls {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.support-brand-emblem {
    width: 28px;
    height: 28px;
    border-radius: 8px;
    background: var(--tenant-accent, var(--primary));
    color: #fff;
    font-size: 11px;
    font-weight: 800;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.domain-pill {
    font-family: ui-monospace, monospace;
    font-size: 11px;
    background: var(--tenant-soft);
    color: var(--tenant-accent);
    border: 1px solid var(--tenant-border);
    padding: 3px 8px;
    border-radius: 999px;
    font-weight: 600;
}

.isolation-badge {
    font-size: 11px;
    font-weight: 600;
    background: var(--success-soft);
    color: var(--success);
    border: 1px solid #a7f3d0;
    padding: 3px 8px;
    border-radius: 999px;
}

.subbar-label {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
}

.segmented-sm {
    display: inline-flex;
    background: var(--surface-subtle);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 2px;
    gap: 2px;
}

.tenant-btn {
    border: none;
    background: transparent;
    padding: 5px 10px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
    cursor: pointer;
}

.tenant-btn.active {
    background: var(--surface);
    color: var(--tenant-accent, var(--primary));
    box-shadow: var(--shadow-sm);
}

.thread-pill {
    font-family: ui-monospace, monospace;
    font-size: 11px;
    background: var(--surface-subtle);
    border: 1px solid var(--border);
    padding: 4px 8px;
    border-radius: 6px;
    color: var(--text-muted);
}

.probe-banner {
    background: #fef2f2;
    border: 1px solid #fecaca;
    color: #991b1b;
    border-radius: var(--radius-sm);
    padding: 10px 14px;
    font-size: 12px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    flex-shrink: 0;
}

.support-grid {
    display: grid;
    grid-template-columns: 24fr 42fr 34fr;
    gap: 12px;
    flex: 1;
    min-height: 0;
}

.support-kb-col, .support-chat-col, .support-ops-col {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    display: flex;
    flex-direction: column;
    min-width: 0;
    min-height: 0;
    overflow: hidden;
}

/* Support Left Rail: Inbox & Policy SOPs */
.left-rail-tabs {
    display: grid;
    grid-template-columns: 1fr 1fr;
    border-bottom: 1px solid var(--border);
    background: var(--surface-subtle);
    flex-shrink: 0;
}

.left-rail-tab {
    border: none;
    background: transparent;
    padding: 10px 8px;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
    cursor: pointer;
    border-bottom: 2px solid transparent;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
}

.left-rail-tab.active {
    color: var(--tenant-accent, var(--primary));
    background: var(--surface);
    border-bottom-color: var(--tenant-accent, var(--primary));
}

.left-rail-pane {
    display: none;
    flex-direction: column;
    flex: 1;
    min-height: 0;
}

.left-rail-pane.active {
    display: flex;
}

.rail-subhead {
    padding: 8px 12px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 12px;
    font-weight: 700;
    color: var(--text-muted);
    flex-shrink: 0;
}

.ticket-list {
    padding: 10px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.ticket-card {
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 10px 11px;
    background: var(--surface);
    cursor: pointer;
    text-align: left;
    display: flex;
    flex-direction: column;
    gap: 5px;
    transition: border-color 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
}

.ticket-card:hover {
    border-color: var(--border-strong);
    background: var(--surface-subtle);
}

.ticket-card.active {
    border-color: var(--tenant-accent, var(--primary));
    background: var(--tenant-soft, var(--primary-soft));
    box-shadow: 0 0 0 1px var(--tenant-accent, var(--primary));
}

.ticket-card-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 6px;
}

.ticket-id-group {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-family: ui-monospace, monospace;
    font-size: 11px;
    font-weight: 700;
    color: var(--text);
}

.priority-pill {
    font-size: 10px;
    font-weight: 800;
    padding: 1px 6px;
    border-radius: 4px;
}

.priority-p1 { background: #fee2e2; color: #b91c1c; }
.priority-p2 { background: #fef3c7; color: #b45309; }
.priority-p3 { background: #e2e8f0; color: #475569; }

.ticket-subject {
    font-size: 12.5px;
    font-weight: 700;
    color: var(--text);
    line-height: 1.35;
}

.ticket-card-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 6px;
    font-size: 11px;
    color: var(--text-muted);
    flex-wrap: wrap;
}

.channel-pill {
    background: var(--surface-subtle);
    border: 1px solid var(--border);
    border-radius: 999px;
    padding: 1px 7px;
    font-size: 10.5px;
    font-weight: 600;
    color: #334155;
}

/* Support Chat Header & Active Ticket Context Strip */
.support-chat-head-left {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

.fin-avatar {
    width: 30px;
    height: 30px;
    border-radius: 9px;
    background: var(--tenant-accent, var(--primary));
    color: #fff;
    font-size: 12px;
    font-weight: 800;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.ticket-context-strip {
    padding: 8px 14px;
    background: var(--tenant-soft, var(--surface-subtle));
    border-bottom: 1px solid var(--tenant-border, var(--border));
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    flex-wrap: wrap;
    font-size: 12px;
    flex-shrink: 0;
}

.ticket-context-info {
    display: flex;
    align-items: center;
    gap: 7px;
    flex-wrap: wrap;
    min-width: 0;
}

.ticket-context-subject {
    font-weight: 700;
    color: var(--text);
}

/* KB Viewer & Clean Markdown Tables */
.kb-viewer {
    padding: 10px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.kb-card {
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 10px;
    background: var(--surface-subtle);
}

.kb-card.active-citation {
    border-color: var(--tenant-accent, var(--primary));
    background: var(--tenant-soft, var(--primary-soft));
    box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.12);
}

.kb-card-title {
    font-weight: 700;
    font-size: 12.5px;
    margin-bottom: 4px;
}

.md-doc {
    font-size: 12px;
    line-height: 1.5;
    color: #334155;
    margin-top: 6px;
}

.md-doc h1, .md-doc h2, .md-doc h3, .md-doc h4 {
    margin: 8px 0 4px;
    font-size: 12.5px;
    font-weight: 700;
    color: var(--text);
}

.md-doc p {
    margin: 4px 0;
}

.md-doc ul, .md-doc ol {
    margin: 4px 0;
    padding-left: 18px;
}

.md-doc li {
    margin: 2px 0;
}

.md-table-wrap {
    overflow-x: auto;
    margin: 6px 0;
    border-radius: 6px;
    border: 1px solid var(--border);
}

.md-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 11px;
    background: var(--surface);
}

.md-table th, .md-table td {
    border-bottom: 1px solid var(--border);
    border-right: 1px solid var(--border);
    padding: 5px 7px;
    text-align: left;
}

.md-table th:last-child, .md-table td:last-child {
    border-right: none;
}

.md-table th {
    background: #f1f5f9;
    font-weight: 700;
    color: var(--text);
}

.cite-pill {
    display: inline-block;
    background: var(--tenant-soft, var(--primary-soft));
    color: var(--tenant-accent, var(--primary));
    border: 1px solid var(--tenant-border, #bfdbfe);
    border-radius: 999px;
    padding: 1px 7px;
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
}

/* Support Right Ops Panel */
.ops-tabs {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    border-bottom: 1px solid var(--border);
    background: var(--surface-subtle);
    flex-shrink: 0;
}

.ops-tabs.ops-tabs-5 {
    grid-template-columns: repeat(5, 1fr);
}

.ops-tab {
    border: none;
    background: transparent;
    padding: 10px 4px;
    font-size: 11.5px;
    font-weight: 600;
    color: var(--text-muted);
    cursor: pointer;
    border-bottom: 2px solid transparent;
    white-space: nowrap;
}

.ops-tab.active {
    color: var(--tenant-accent, var(--primary));
    background: var(--surface);
    border-bottom-color: var(--tenant-accent, var(--primary));
}

.count-badge {
    display: inline-block;
    min-width: 18px;
    padding: 0 5px;
    border-radius: 999px;
    background: #e2e8f0;
    color: var(--text);
    font-size: 11px;
    text-align: center;
}

.ops-body {
    flex: 1;
    min-height: 0;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.ops-pane {
    display: none;
    flex-direction: column;
    height: 100%;
    min-height: 0;
}

.ops-pane.active {
    display: flex;
}

.ops-pane-bar {
    padding: 8px 12px;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.ops-content {
    padding: 12px;
    overflow-y: auto;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

/* Customer 360 CRM & Order/Invoice Cards */
.crm-profile-card {
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 12px;
    background: var(--surface);
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.crm-head {
    display: flex;
    align-items: center;
    gap: 10px;
}

.crm-avatar {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    color: #fff;
    font-size: 13px;
    font-weight: 800;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.crm-name-row {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

.crm-name {
    font-weight: 700;
    font-size: 14px;
}

.crm-meta-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    padding-top: 8px;
    border-top: 1px solid var(--border);
}

.crm-kv-label {
    font-size: 10.5px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.crm-kv-val {
    font-size: 12px;
    font-weight: 600;
    color: var(--text);
    margin-top: 1px;
    word-break: break-word;
}

.crm-orders-title {
    font-size: 11.5px;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-top: 2px;
}

.crm-order-card {
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 10px;
    background: var(--surface-subtle);
    display: flex;
    flex-direction: column;
    gap: 7px;
}

.crm-order-top {
    display: flex;
    align-items: flex-start;
    gap: 10px;
}

.crm-order-thumb {
    width: 58px;
    height: 58px;
    border-radius: 8px;
    background: var(--studio-bg);
    border: 1px solid var(--border);
    object-fit: cover;
    flex-shrink: 0;
}

.crm-invoice-badge {
    width: 48px;
    height: 48px;
    border-radius: 8px;
    background: var(--tenant-soft);
    color: var(--tenant-accent);
    border: 1px solid var(--tenant-border);
    font-size: 11px;
    font-weight: 800;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    text-align: center;
}

.crm-order-info {
    flex: 1;
    min-width: 0;
}

.crm-order-id-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 6px;
    flex-wrap: wrap;
}

.crm-order-item {
    font-size: 12.5px;
    font-weight: 700;
    margin-top: 2px;
}

.crm-order-foot {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    font-size: 11.5px;
    color: var(--text-muted);
    border-top: 1px dashed var(--border);
    padding-top: 6px;
}

.muted-text {
    font-size: 12px;
    color: var(--text-muted);
}

.tag {
    display: inline-block;
    font-size: 11px;
    font-weight: 600;
    padding: 2px 7px;
    border-radius: 999px;
}

.tag-info { background: var(--primary-soft); color: var(--primary); }
.tag-neutral { background: #f1f5f9; color: #475569; }
.tag-success { background: var(--success-soft); color: var(--success); }
.tag-warning { background: var(--warning-soft); color: var(--warning); }
.tag-danger { background: var(--danger-soft); color: var(--danger); }

.status-pill {
    font-size: 11px;
    font-weight: 700;
    background: var(--warning-soft);
    color: var(--warning);
    border: 1px solid #fde68a;
    padding: 3px 9px;
    border-radius: 999px;
}

.triage-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

.metric-box {
    border: 1px solid var(--border);
    background: var(--surface-subtle);
    border-radius: var(--radius-sm);
    padding: 8px 10px;
}

.metric-label {
    font-size: 11px;
    color: var(--text-muted);
}

.metric-val {
    font-size: 14px;
    font-weight: 700;
    margin-top: 2px;
}

.confidence-track {
    height: 6px;
    border-radius: 999px;
    background: #e2e8f0;
    margin-top: 5px;
    overflow: hidden;
}

.confidence-fill {
    height: 100%;
    border-radius: 999px;
    background: var(--success);
}

/* OTel Waterfall */
.span-row {
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 8px 10px;
    background: var(--surface-subtle);
    font-size: 12px;
    margin-top: 5px;
}

.span-row.child {
    margin-left: 16px;
    background: var(--surface);
}

.span-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
    font-weight: 600;
}

.span-bar-track {
    height: 6px;
    background: #e2e8f0;
    border-radius: 999px;
    margin: 6px 0 2px;
    position: relative;
    overflow: hidden;
}

.span-bar-fill {
    height: 100%;
    border-radius: 999px;
    background: var(--tenant-accent, var(--primary));
    position: absolute;
}

.span-bar-fill.chat { background: #0ea5e9; }
.span-bar-fill.tool { background: #10b981; }

/* ==================== MODALS (BYOK + PDP) ==================== */
.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.5);
    backdrop-filter: blur(3px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    z-index: 100;
}

.modal-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: 0 20px 45px rgba(15, 23, 42, 0.24);
    width: 100%;
    max-width: 540px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.modal-card.pdp-modal-card {
    max-width: 940px;
}

.modal-header {
    padding: 14px 18px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    flex-shrink: 0;
}

.modal-header h3 {
    margin: 0 0 2px;
    font-size: 16px;
}

.modal-body {
    padding: 16px 18px;
    display: flex;
    flex-direction: column;
    gap: 14px;
    max-height: 75vh;
    overflow-y: auto;
}

.modal-footer {
    padding: 12px 18px;
    border-top: 1px solid var(--border);
    background: var(--surface-subtle);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    flex-shrink: 0;
}

.modal-footer-right {
    display: flex;
    gap: 8px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 5px;
    flex: 1;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

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

.full-width {
    width: 100%;
}

.segmented-mode {
    display: grid;
    grid-template-columns: 1fr 1fr;
    background: var(--surface-subtle);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 3px;
    gap: 4px;
}

.mode-opt-btn {
    border: none;
    background: transparent;
    padding: 7px 10px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
    cursor: pointer;
}

.mode-opt-btn.active {
    background: var(--surface);
    color: var(--primary);
    box-shadow: var(--shadow-sm);
}

.byok-fields {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.input-with-btn {
    display: flex;
    gap: 6px;
    align-items: center;
}

.info-banner {
    background: var(--surface-subtle);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 10px 12px;
    font-size: 12px;
    color: var(--text-muted);
    line-height: 1.5;
}

.privacy-note {
    background: var(--primary-soft);
    border: 1px solid #bfdbfe;
    color: #1e40af;
    border-radius: var(--radius-sm);
    padding: 8px 10px;
    font-size: 12px;
    line-height: 1.4;
}

.test-row {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.test-result {
    font-size: 12px;
    padding: 5px 10px;
    border-radius: 6px;
    flex: 1;
    word-break: break-word;
}

.test-result.ok {
    background: var(--success-soft);
    color: #065f46;
    border: 1px solid #a7f3d0;
}

.test-result.err {
    background: var(--danger-soft);
    color: var(--danger);
    border: 1px solid #fecaca;
}

.test-result.pending {
    background: #f1f5f9;
    color: #334155;
    border: 1px solid var(--border);
}

/* ==================== DESKTOP DEFAULTS FOR MOBILE ELEMENTS ==================== */
.nav-label-short {
    display: none;
}

.mobile-pane-bar {
    display: none;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 3px;
    gap: 4px;
    box-shadow: var(--shadow-sm);
    flex-shrink: 0;
}

.mobile-pane-tab {
    border: none;
    background: transparent;
    padding: 7px 10px;
    border-radius: 7px;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-muted);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    min-width: 0;
    min-height: 40px;
    transition: background 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
}

.mobile-pane-tab.active {
    background: var(--primary-soft);
    color: var(--primary);
    box-shadow: var(--shadow-sm);
}

.mobile-activity-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--primary);
    display: inline-block;
    flex-shrink: 0;
    animation: pulse 1s infinite;
}

.mobile-activity-dot.attention {
    background: #f59e0b;
    box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.25);
}

.count-badge.has-pending {
    background: var(--warning-soft);
    color: var(--warning);
    border: 1px solid #fcd34d;
    animation: pulse 1.2s infinite;
}

.mobile-pane-tab.has-pending {
    color: var(--warning);
}

.mobile-jump-banner {
    background: #fffbeb;
    border-bottom: 1px solid #fde68a;
    color: #92400e;
    padding: 8px 12px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    font-size: 12px;
    font-weight: 600;
    flex-shrink: 0;
}

.status-pill-btn {
    cursor: pointer;
    font-family: inherit;
    transition: transform 0.1s ease, box-shadow 0.15s ease;
}

.status-pill-btn:hover {
    box-shadow: var(--shadow-sm);
}

/* ==================== MOBILE & TABLET (<= 960px) ==================== */
@media (max-width: 960px) {
    html, body {
        height: 100vh;
        height: 100dvh;
        overflow: hidden;
        overflow-x: hidden;
        max-width: 100%;
    }

    body {
        display: flex;
        flex-direction: column;
    }

    .topbar {
        flex-shrink: 0;
    }

    .workspace {
        flex: 1 1 auto;
        min-height: 0;
        height: auto;
        overflow: hidden;
    }

    .demo-view.active {
        height: 100%;
        min-height: 0;
        padding: 8px 10px;
        gap: 8px;
        overflow: hidden;
    }

    .mobile-pane-bar {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .mobile-pane-bar.mobile-pane-bar-3 {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .shop-layout,
    .support-grid {
        display: flex;
        flex-direction: column;
        flex: 1 1 auto;
        min-height: 0;
        height: auto;
        gap: 0;
    }

    .shop-storefront,
    .shop-copilot,
    .support-kb-col,
    .support-chat-col,
    .support-ops-col {
        display: none;
    }

    .shop-storefront.mobile-pane-active,
    .shop-copilot.mobile-pane-active,
    .support-kb-col.mobile-pane-active,
    .support-chat-col.mobile-pane-active,
    .support-ops-col.mobile-pane-active {
        display: flex;
        flex: 1 1 auto;
        min-height: 0;
    }

    .store-toolbar {
        padding: 10px 12px;
        gap: 8px;
    }

    .store-controls {
        gap: 6px;
    }

    .category-pills {
        width: 100%;
        flex-wrap: nowrap;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        padding-bottom: 2px;
    }

    .category-pills::-webkit-scrollbar,
    .prompt-chips::-webkit-scrollbar,
    .rufus-cards-row::-webkit-scrollbar {
        display: none;
    }

    .pill-btn {
        flex-shrink: 0;
        white-space: nowrap;
        min-height: 34px;
        display: inline-flex;
        align-items: center;
    }

    .store-search-wrap {
        flex: 1 1 140px;
        min-width: 0;
    }

    .shop-hero {
        margin: 10px 10px 2px;
        padding: 12px 32px 12px 14px;
    }

    .shop-hero-trust {
        display: none;
    }

    .shop-hero-title {
        font-size: 15px;
    }

    .prompt-chips {
        flex-wrap: nowrap;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        padding: 8px 10px;
        flex-shrink: 0;
    }

    .chip-btn {
        flex-shrink: 0;
        white-space: nowrap;
        min-height: 36px;
        display: inline-flex;
        align-items: center;
    }

    .catalog-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 10px;
        padding: 10px;
        padding-bottom: max(12px, env(safe-area-inset-bottom));
    }

    .product-card-body {
        padding: 10px;
    }

    .product-title {
        font-size: 13px;
    }

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

    .product-actions .btn-ask-sm {
        grid-column: 1 / -1;
    }

    .drawer-panel,
    .comparison-panel {
        max-height: 44dvh;
        padding: 10px 12px;
        flex-shrink: 0;
    }

    .drawer-header {
        flex-wrap: wrap;
        gap: 6px;
    }

    .cart-row {
        flex-wrap: wrap;
    }

    .cart-item-right {
        width: 100%;
        justify-content: space-between;
    }

    .compare-table {
        min-width: 480px;
    }

    .chat-stream {
        padding: 10px 12px;
        -webkit-overflow-scrolling: touch;
    }

    .msg-bubble {
        max-width: 100%;
    }

    .chat-composer {
        padding: 8px 10px;
        padding-bottom: max(10px, env(safe-area-inset-bottom));
        flex-shrink: 0;
    }

    .steer-bar {
        flex-wrap: wrap;
        padding: 8px 10px;
        gap: 6px;
    }

    .steer-actions {
        width: 100%;
        justify-content: flex-end;
    }

    .kb-viewer,
    .ops-content,
    .ticket-list {
        -webkit-overflow-scrolling: touch;
        padding-bottom: max(12px, env(safe-area-inset-bottom));
    }

    .col-header > div {
        min-width: 0;
    }

    #support-chat-subtitle {
        overflow-wrap: anywhere;
    }

    .btn,
    .ops-tab,
    .tenant-btn {
        min-height: 36px;
    }

    .chat-composer .btn,
    .chat-composer input {
        min-height: 42px;
    }

    .pdp-hero-grid,
    .pdp-sections-grid {
        grid-template-columns: 1fr;
    }

    .pdp-related-grid {
        grid-template-columns: 1fr;
    }
}

/* ==================== COMPACT TABLET & PHONE TOPBAR (<= 768px) ==================== */
@media (max-width: 768px) {
    .topbar {
        height: auto;
        flex-wrap: wrap;
        padding: 8px 12px;
        padding-top: max(8px, env(safe-area-inset-top));
        gap: 8px;
    }

    .topbar-brand {
        order: 1;
        flex: 1 1 auto;
        min-width: 0;
        gap: 8px;
    }

    .brand-title {
        font-size: 14px;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .brand-sub {
        display: none;
    }

    .topbar-right {
        order: 2;
        flex-shrink: 0;
        gap: 6px;
        min-width: 0;
    }

    .mode-badge {
        max-width: 145px;
        min-width: 0;
        padding: 5px 9px;
    }

    #llm-mode-label {
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
        min-width: 0;
    }

    .status-dot,
    .badge-gear {
        flex-shrink: 0;
    }

    .demo-switcher {
        order: 3;
        width: 100%;
        display: flex;
    }

    .switcher-btn {
        flex: 1;
        justify-content: center;
        min-height: 38px;
        min-width: 0;
        padding: 6px 8px;
        font-size: 12.5px;
    }

    /* Prevent iOS Safari auto-zoom on input/select focus */
    input:not([type="checkbox"]):not([type="radio"]),
    select,
    textarea,
    .search-input,
    .select-input,
    .chat-composer input {
        font-size: 16px;
    }

    .support-subbar {
        padding: 8px 10px;
        gap: 6px;
    }

    .support-brand-controls,
    .support-security-controls {
        width: 100%;
        gap: 6px;
    }

    .domain-pill,
    .isolation-badge {
        display: none;
    }

    .probe-banner {
        padding: 8px 10px;
        font-size: 11.5px;
        max-height: 110px;
        overflow-y: auto;
        overflow-wrap: anywhere;
        word-break: break-word;
    }

    .hitl-args {
        word-break: break-word;
    }

    .pdp-modal-body {
        padding: 14px;
    }

    .pdp-title {
        font-size: 19px;
    }
}

/* ==================== SMALL PHONES & MODAL (<= 640px) ==================== */
@media (max-width: 640px) {
    .subbar-label,
    #support-thread-pill {
        display: none;
    }

    #support-tenant-switcher {
        width: 100%;
        display: grid;
        grid-template-columns: 1fr 1fr;
    }

    .tenant-btn {
        text-align: center;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        padding: 5px 6px;
    }

    #support-customer-select {
        flex: 1 1 150px;
        min-width: 0;
        max-width: 100%;
    }

    .support-security-controls {
        justify-content: flex-end;
    }

    #btn-probe-403 {
        width: 100%;
        text-align: center;
    }

    .ops-pane-bar {
        flex-wrap: wrap;
        gap: 6px;
    }

    .ops-tabs.ops-tabs-5 {
        grid-template-columns: repeat(5, minmax(0, 1fr));
    }

    .ops-tab {
        font-size: 10.5px;
        padding: 9px 2px;
    }

    .modal-backdrop {
        padding: 10px;
    }

    .modal-card {
        width: calc(100vw - 20px);
        max-height: 92vh;
        max-height: 92dvh;
        overflow-y: auto;
    }

    .modal-card.pdp-modal-card {
        overflow: hidden;
    }

    .modal-body {
        max-height: none;
        overflow-y: visible;
    }

    .form-row {
        grid-template-columns: 1fr;
    }

    .modal-footer {
        flex-direction: column-reverse;
        align-items: stretch;
        gap: 8px;
    }

    .modal-footer-right {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 8px;
    }

    .crm-meta-grid {
        grid-template-columns: 1fr;
    }
}

/* ==================== NARROW PHONES (<= 480px) ==================== */
@media (max-width: 480px) {
    .nav-label-full {
        display: none;
    }

    .nav-label-short {
        display: inline;
    }

    .topbar {
        padding: 8px 10px;
        padding-top: max(8px, env(safe-area-inset-top));
        gap: 6px;
    }

    .lang-btn {
        padding: 4px 7px;
        font-size: 11px;
    }

    .mode-badge {
        max-width: 116px;
        padding: 4px 8px;
        font-size: 11px;
    }

    .mobile-pane-tab {
        padding: 6px 4px;
        font-size: 11.5px;
        gap: 4px;
    }
}

/* ==================== SINGLE-COLUMN CATALOG (< 420px) ==================== */
@media (max-width: 419px) {
    .catalog-grid {
        grid-template-columns: 1fr;
    }
}
