/* ThaiBev Stock Count AI - Premium Chat UI */
/* Modern, Clean Design with Shadcn/Tailwind Inspiration */

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

:root {
    /* Color System */
    --primary: #2563eb;
    --primary-hover: #1d4ed8;
    --primary-light: #eff6ff;
    
    --success: #10b981;
    --success-light: #ecfdf5;
    --error: #ef4444;
    --error-light: #fef2f2;
    --warning: #f59e0b;
    --warning-light: #fffbeb;
    --info: #3b82f6;
    --info-light: #eff6ff;
    
    --bg-primary: #ffffff;
    --bg-secondary: #f8fafc;
    --bg-tertiary: #f1f5f9;
    
    --text-primary: #0f172a;
    --text-secondary: #64748b;
    --text-muted: #94a3b8;
    
    --border: #e2e8f0;
    --border-hover: #cbd5e1;
    
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.1), 0 1px 2px rgba(0, 0, 0, 0.06);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    
    --radius: 8px;
    --radius-lg: 12px;
    --sidebar-width: 300px;
    
    --transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

html, body {
    height: 100%;
    overflow: hidden;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--bg-secondary);
    color: var(--text-primary);
    display: flex;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

/* ===== SIDEBAR ===== */
.sidebar {
    width: var(--sidebar-width);
    background: var(--bg-primary);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    height: 100vh;
    position: fixed;
    left: 0;
    top: 0;
    z-index: 100;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.sidebar.collapsed {
    transform: translateX(-100%);
}

.sidebar-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(2px);
    z-index: 90;
}

.sidebar-backdrop.active {
    display: block;
}

.sidebar-header {
    padding: 16px;
    border-bottom: 1px solid var(--border);
}

.sidebar-header-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
}

.sidebar-logo {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
}

.logo-icon {
    font-size: 20px;
}

.close-sidebar-btn {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    border-radius: var(--radius);
    cursor: pointer;
    color: var(--text-secondary);
    transition: var(--transition);
}

.close-sidebar-btn:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.new-chat-btn {
    width: 100%;
    padding: 10px 16px;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: var(--radius);
    font-family: inherit;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: var(--transition);
}

.new-chat-btn:hover {
    background: var(--primary-hover);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

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

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

.sidebar-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 12px;
}

.sidebar-title svg {
    opacity: 0.7;
}

.history-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.history-item {
    padding: 12px;
    background: transparent;
    border: 1px solid transparent;
    border-radius: var(--radius);
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 8px;
}

.history-item-content {
    flex: 1;
    min-width: 0;
}

.history-item:hover {
    background: var(--bg-tertiary);
    border-color: var(--border);
}

.history-item.active {
    background: var(--primary-light);
    border-color: var(--primary);
}

.history-delete-btn {
    opacity: 0;
    padding: 6px;
    background: transparent;
    border: none;
    border-radius: var(--radius);
    color: var(--text-muted);
    cursor: pointer;
    transition: var(--transition);
    flex-shrink: 0;
}

.history-item:hover .history-delete-btn {
    opacity: 1;
}

.history-delete-btn:hover {
    background: rgba(239, 68, 68, 0.1);
    color: var(--danger);
}

.history-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 4px;
}

.history-time {
    font-size: 11px;
    color: var(--text-muted);
    font-weight: 500;
}

.history-badge {
    font-size: 10px;
    padding: 2px 8px;
    background: var(--primary-light);
    color: var(--primary);
    border-radius: 999px;
    font-weight: 600;
}

.history-badge.thaibev {
    background: var(--success-light);
    color: var(--success);
}

.history-preview {
    font-size: 13px;
    color: var(--text-primary);
    font-weight: 500;
    margin-bottom: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

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

.history-empty {
    text-align: center;
    padding: 24px 12px;
    color: var(--text-muted);
    font-size: 13px;
}

.sidebar-footer {
    padding: 16px;
    border-top: 1px solid var(--border);
    background: var(--bg-secondary);
}

.api-status {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    color: var(--text-secondary);
    margin-bottom: 12px;
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--text-muted);
}

.status-dot.online {
    background: var(--success);
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.2);
}

.model-selector label {
    display: block;
    font-size: 11px;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 6px;
}

.model-select {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg-primary);
    font-family: inherit;
    font-size: 13px;
    color: var(--text-primary);
    cursor: pointer;
    transition: var(--transition);
}

.model-select:hover {
    border-color: var(--border-hover);
}

.model-select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

/* ===== MAIN CONTENT ===== */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    margin-left: var(--sidebar-width);
    height: 100vh;
    overflow: hidden;
    transition: margin-left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.sidebar.collapsed + .main-content {
    margin-left: 0;
}

.toggle-sidebar {
    position: fixed;
    top: 16px;
    left: calc(var(--sidebar-width) + 16px);
    z-index: 101;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    cursor: pointer;
    box-shadow: var(--shadow);
    transition: left 0.3s cubic-bezier(0.4, 0, 0.2, 1), background 0.2s, box-shadow 0.2s;
}

.toggle-sidebar:hover {
    background: var(--bg-tertiary);
    box-shadow: var(--shadow-md);
}

/* When sidebar is collapsed, move toggle button to left edge */
.sidebar.collapsed ~ .main-content .toggle-sidebar {
    left: 16px;
}

/* ===== CHAT CONTAINER ===== */
.chat-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    max-width: 900px;
    width: 100%;
    margin: 0 auto;
    padding: 70px 24px 0;
    height: 100%;
    overflow: hidden;
}

/* ===== ANALYSIS TABS ===== */
.analysis-tabs-container {
    display: flex;
    gap: 16px;
    padding: 12px;
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    margin-bottom: 16px;
    flex-shrink: 0;
    flex-wrap: wrap;
}

.tab-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
    flex: 1;
    min-width: 200px;
}

.tab-group-label {
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    padding-left: 4px;
}

.thaibev-group .tab-group-label {
    color: var(--primary);
}

.tab-group-buttons {
    display: flex;
    gap: 4px;
    background: var(--bg-tertiary);
    padding: 4px;
    border-radius: var(--radius);
}

.tab-btn {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 8px 12px;
    background: transparent;
    border: none;
    border-radius: calc(var(--radius) - 2px);
    font-family: inherit;
    font-size: 12px;
    font-weight: 500;
    color: var(--text-secondary);
    cursor: pointer;
    transition: var(--transition);
    white-space: nowrap;
}

.tab-btn:hover {
    background: var(--bg-primary);
    color: var(--text-primary);
}

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

.thaibev-group .tab-btn.active {
    background: linear-gradient(135deg, #059669 0%, #10b981 100%);
}

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

/* ===== CHAT MESSAGES ===== */
.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px 0;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

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

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

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

.chat-messages::-webkit-scrollbar-thumb:hover {
    background: var(--border-hover);
}

/* ===== WELCOME SCREEN ===== */
.welcome-screen {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 40px 20px;
    flex: 1;
}

.welcome-icon {
    width: 64px;
    height: 64px;
    background: linear-gradient(135deg, var(--primary) 0%, #3b82f6 100%);
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    margin-bottom: 24px;
    box-shadow: var(--shadow-lg);
}

.welcome-screen h1 {
    font-size: 28px;
    font-weight: 700;
    margin-bottom: 12px;
    color: var(--text-primary);
}

.welcome-screen > p {
    font-size: 15px;
    color: var(--text-secondary);
    max-width: 500px;
    line-height: 1.6;
    margin-bottom: 32px;
}

.features {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
    max-width: 500px;
    width: 100%;
}

.feature {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 16px;
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    text-align: left;
    transition: var(--transition);
}

.feature:hover {
    border-color: var(--primary);
    box-shadow: var(--shadow);
}

.feature-icon {
    width: 40px;
    height: 40px;
    background: var(--primary-light);
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--primary);
    flex-shrink: 0;
}

.feature-text {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.feature-text strong {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
}

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

/* ===== MESSAGE ===== */
.message {
    display: flex;
    gap: 12px;
    padding: 20px;
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    animation: fadeIn 0.3s ease;
}

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

.message-avatar {
    width: 36px;
    height: 36px;
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-weight: 600;
    font-size: 14px;
    background: var(--primary);
    color: white;
}

.message-content {
    flex: 1;
    min-width: 0;
}

.message-header {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 8px;
}

/* ===== RESULTS DISPLAY ===== */
.results-container,
.batch-results-container {
    margin-top: 16px;
}

.results-section {
    margin-bottom: 20px;
}

.results-section h4 {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.results-section h4::before {
    content: '';
    width: 4px;
    height: 16px;
    background: var(--primary);
    border-radius: 2px;
}

/* Summary Text */
.summary-text {
    padding: 16px;
    background: var(--bg-secondary);
    border-radius: var(--radius);
    color: var(--text-secondary);
    font-size: 14px;
    line-height: 1.6;
    border-left: 3px solid var(--primary);
}

/* No Results */
.no-results {
    padding: 32px;
    text-align: center;
    background: var(--bg-secondary);
    border-radius: var(--radius);
    color: var(--text-secondary);
}

.no-results p {
    margin: 0;
}

.no-results .hint {
    margin-top: 8px;
    font-size: 13px;
    color: var(--text-muted);
}

/* Image Grid in Results */
.result-images-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 12px;
    padding: 16px;
    background: var(--bg-secondary);
    border-radius: var(--radius);
    margin-bottom: 16px;
}

.result-image-item {
    position: relative;
    border-radius: var(--radius);
    overflow: hidden;
    background: var(--bg-primary);
    border: 1px solid var(--border);
}

.result-image-item img {
    width: 100%;
    height: 100px;
    object-fit: cover;
    display: block;
}

.result-image-number {
    position: absolute;
    top: 8px;
    left: 8px;
    width: 24px;
    height: 24px;
    background: var(--primary);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 600;
}

/* Results Table */
.results-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
}

.results-table th,
.results-table td {
    padding: 12px 16px;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

.results-table th {
    background: var(--bg-tertiary);
    font-weight: 600;
    color: var(--text-primary);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.results-table tbody tr:hover {
    background: var(--bg-secondary);
}

.results-table tbody tr:last-child td {
    border-bottom: none;
}

.quantity-cell {
    font-weight: 600;
    color: var(--primary);
    font-variant-numeric: tabular-nums;
}

.total-row {
    background: var(--bg-tertiary) !important;
}

.total-row td {
    border-top: 2px solid var(--border);
    font-weight: 600;
}

/* Badges */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.badge-box {
    background: var(--info-light);
    color: var(--info);
}

.badge-can {
    background: var(--success-light);
    color: var(--success);
}

.badge-tray {
    background: var(--warning-light);
    color: var(--warning);
}

.image-badge {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    background: var(--primary-light);
    color: var(--primary);
    border-radius: 999px;
    font-size: 11px;
    font-weight: 600;
    margin: 2px;
}

/* Observations */
.observations-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.observation-category {
    background: var(--bg-secondary);
    border-radius: var(--radius);
    padding: 16px;
    border: 1px solid var(--border);
}

.category-title {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 10px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border);
}

.observation-item {
    font-size: 13px;
    color: var(--text-primary);
    line-height: 1.6;
    padding: 8px 0;
    border-bottom: 1px solid var(--border);
}

.observation-item:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.formula {
    display: inline-block;
    padding: 2px 8px;
    background: var(--primary-light);
    color: var(--primary);
    border-radius: 4px;
    font-family: 'SF Mono', Monaco, monospace;
    font-size: 12px;
    font-weight: 600;
}

/* Duplicate Warning */
.duplicate-image-alert {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 16px;
    background: var(--error-light);
    border: 1px solid rgba(239, 68, 68, 0.3);
    border-radius: var(--radius);
    margin-bottom: 16px;
}

.alert-icon {
    font-size: 20px;
    flex-shrink: 0;
}

.alert-content {
    flex: 1;
}

.alert-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--error);
    margin-bottom: 4px;
}

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

/* Similarity Analysis */
.similarity-analysis-section {
    background: var(--info-light);
    border: 1px solid rgba(59, 130, 246, 0.3);
    border-radius: var(--radius);
    padding: 16px;
    margin-bottom: 16px;
}

.similarity-analysis-section h4 {
    color: var(--info);
    margin-bottom: 12px;
}

.similarity-insights {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.similarity-insight-item {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    padding: 10px;
    background: var(--bg-primary);
    border-radius: var(--radius);
    font-size: 13px;
}

.insight-label {
    font-weight: 600;
    color: var(--info);
    flex-shrink: 0;
}

.insight-text {
    color: var(--text-secondary);
}

/* Duplicate Warning */
.duplicate-warning-alert {
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.15), rgba(220, 38, 38, 0.1));
    border: 1px solid rgba(239, 68, 68, 0.4);
    border-radius: var(--radius);
    padding: 16px;
    margin-bottom: 16px;
}

.duplicate-warning-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
}

.duplicate-warning-icon {
    font-size: 24px;
}

.duplicate-warning-title {
    font-size: 15px;
    font-weight: 600;
    color: var(--danger);
}

.duplicate-warning-details {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding-left: 34px;
    font-size: 13px;
    color: var(--text-secondary);
}

.duplicate-warning-details .duplicate-pair {
    background: rgba(239, 68, 68, 0.1);
    padding: 8px 12px;
    border-radius: var(--radius);
    border-left: 3px solid var(--danger);
}

/* Similarity Matrix Grid */
.similarity-matrix-section {
    margin: 16px 0;
}

.similarity-matrix-section h5 {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.similarity-matrix-grid {
    display: flex;
    flex-direction: column;
    gap: 4px;
    background: var(--bg-primary);
    border-radius: var(--radius);
    padding: 12px;
}

.similarity-matrix-row {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
}

.similarity-matrix-row .row-label {
    font-weight: 600;
    color: var(--text-primary);
    min-width: 70px;
}

.similarity-cells {
    display: flex;
    gap: 4px;
    flex-wrap: wrap;
}

.similarity-cell {
    padding: 6px 10px;
    border-radius: var(--radius);
    font-weight: 500;
    font-size: 11px;
    min-width: 60px;
    text-align: center;
}

.similarity-cell.high {
    background: rgba(239, 68, 68, 0.2);
    color: #dc2626;
    border: 1px solid rgba(239, 68, 68, 0.3);
}

.similarity-cell.medium {
    background: rgba(245, 158, 11, 0.2);
    color: #d97706;
    border: 1px solid rgba(245, 158, 11, 0.3);
}

.similarity-cell.low {
    background: rgba(34, 197, 94, 0.15);
    color: #16a34a;
    border: 1px solid rgba(34, 197, 94, 0.3);
}

/* Aggregated Count Section */
.aggregated-count-section {
    background: linear-gradient(135deg, rgba(34, 197, 94, 0.1), rgba(16, 185, 129, 0.08));
    border: 1px solid rgba(34, 197, 94, 0.3);
    border-radius: var(--radius);
    padding: 16px;
    margin-top: 16px;
}

.aggregated-count-section h5 {
    font-size: 14px;
    font-weight: 600;
    color: var(--success);
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.aggregated-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 12px;
}

.agg-stat {
    background: var(--bg-primary);
    padding: 12px;
    border-radius: var(--radius);
    text-align: center;
}

.agg-stat-value {
    font-size: 24px;
    font-weight: 700;
    color: var(--primary);
}

.agg-stat-label {
    font-size: 11px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-top: 4px;
}

/* Per-Image Similarity */
.per-image-similarity {
    margin-top: 16px;
}

.per-image-similarity h5 {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 10px;
}

.image-similarity-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px;
    background: var(--bg-primary);
    border-radius: var(--radius);
    margin-bottom: 8px;
    font-size: 13px;
}

.image-similarity-item .img-badge {
    background: var(--primary);
    color: white;
    padding: 4px 10px;
    border-radius: var(--radius);
    font-weight: 600;
    font-size: 12px;
}

.image-similarity-item .similarity-value {
    font-weight: 600;
    padding: 4px 8px;
    border-radius: var(--radius);
}

.image-similarity-item .similarity-value.high {
    background: rgba(239, 68, 68, 0.2);
    color: #dc2626;
}

.image-similarity-item .similarity-value.medium {
    background: rgba(245, 158, 11, 0.2);
    color: #d97706;
}

.image-similarity-item .similarity-value.low {
    background: rgba(34, 197, 94, 0.15);
    color: #16a34a;
}

.image-similarity-item .similarity-reason {
    color: var(--text-secondary);
    flex: 1;
}

/* ===== CHAT INPUT ===== */
.chat-input-container {
    padding: 20px 0;
    flex-shrink: 0;
}

.image-preview {
    display: flex;
    gap: 8px;
    padding: 12px;
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    margin-bottom: 12px;
    overflow-x: auto;
}

.image-preview.hidden {
    display: none;
}

.preview-image-wrapper {
    position: relative;
    flex-shrink: 0;
}

.preview-image-wrapper img {
    width: 80px;
    height: 80px;
    object-fit: cover;
    border-radius: var(--radius);
    border: 1px solid var(--border);
}

.remove-image {
    position: absolute;
    top: -6px;
    right: -6px;
    width: 22px;
    height: 22px;
    background: var(--error);
    color: white;
    border: 2px solid white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 14px;
    font-weight: bold;
    transition: var(--transition);
}

.remove-image:hover {
    background: #dc2626;
    transform: scale(1.1);
}

.chat-input-wrapper {
    display: flex;
    gap: 10px;
    padding: 12px;
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    transition: var(--transition);
}

.chat-input-wrapper:focus-within {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.upload-btn,
.send-btn {
    width: 42px;
    height: 42px;
    border: none;
    border-radius: var(--radius);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: var(--transition);
}

.upload-btn {
    background: var(--bg-tertiary);
    color: var(--text-secondary);
}

.upload-btn:hover {
    background: var(--border);
    color: var(--text-primary);
}

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

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

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

.message-input {
    flex: 1;
    border: none;
    background: transparent;
    font-family: inherit;
    font-size: 14px;
    color: var(--text-primary);
    resize: none;
    outline: none;
    min-height: 42px;
    max-height: 120px;
    padding: 10px 0;
}

.message-input::placeholder {
    color: var(--text-muted);
}

.input-hint {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    margin-top: 10px;
    font-size: 12px;
    color: var(--text-muted);
}

.hint-icon {
    font-size: 14px;
}

/* ===== LOADING MODAL ===== */
.modal {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal.hidden {
    display: none;
}

.modal-content {
    background: var(--bg-primary);
    padding: 32px 48px;
    border-radius: var(--radius-lg);
    text-align: center;
    box-shadow: var(--shadow-xl);
}

.spinner {
    width: 48px;
    height: 48px;
    border: 3px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 16px;
}

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

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

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

/* ===== TOAST ===== */
.toast {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 12px 20px;
    border-radius: var(--radius);
    color: white;
    font-size: 14px;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 10px;
    box-shadow: var(--shadow-lg);
    z-index: 1001;
    animation: slideIn 0.3s ease;
    transition: var(--transition);
}

.toast.success { background: var(--success); }
.toast.error { background: var(--error); }
.toast.warning { background: var(--warning); }
.toast.info { background: var(--primary); }

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

.hidden {
    display: none !important;
}

/* ===== ROW/COLUMN/LAYER ANALYSIS ===== */
.row-analysis-card,
.column-analysis-card,
.layer-analysis-card {
    padding: 16px;
    background: var(--bg-secondary);
    border-radius: var(--radius);
    border-left: 3px solid var(--primary);
}

.analysis-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 12px;
    margin-bottom: 12px;
}

.stat-item {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.stat-label {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stat-value {
    font-size: 18px;
    font-weight: 700;
    color: var(--text-primary);
}

.stat-value.badge-uniform {
    color: var(--success);
}

.stat-value.badge-varied {
    color: var(--warning);
}

.stat-value.badge-irregular {
    color: var(--error);
}

.items-per-row,
.items-per-column,
.items-per-layer {
    padding: 12px;
    background: var(--bg-primary);
    border-radius: var(--radius);
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.calculation-formula {
    padding: 12px;
    background: var(--primary-light);
    border-radius: var(--radius);
    font-size: 13px;
    color: var(--primary);
    font-family: 'Courier New', monospace;
}

/* ===== PARTIAL VISIBILITY ANALYSIS ===== */
.partial-visibility-card {
    padding: 16px;
    background: var(--bg-secondary);
    border-radius: var(--radius);
}

.visibility-breakdown {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 16px;
}

.visibility-item {
    display: grid;
    grid-template-columns: 40px 1fr auto auto;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background: var(--bg-primary);
    border-radius: var(--radius);
    border-left: 3px solid var(--border);
}

.visibility-item.high {
    border-left-color: var(--success);
}

.visibility-item.medium-high {
    border-left-color: #10b981;
}

.visibility-item.medium {
    border-left-color: var(--warning);
}

.visibility-item.low {
    border-left-color: #f59e0b;
}

.visibility-item.very-low {
    border-left-color: var(--error);
}

.visibility-icon {
    font-size: 20px;
    text-align: center;
}

.visibility-label {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-primary);
}

.visibility-count {
    font-size: 16px;
    font-weight: 700;
    color: var(--text-primary);
}

.visibility-percent {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
    padding: 4px 8px;
    background: var(--bg-tertiary);
    border-radius: 999px;
}

.overall-confidence {
    padding: 12px;
    background: var(--bg-primary);
    border-radius: var(--radius);
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
}

.overall-confidence.confidence-high {
    border-left: 3px solid var(--success);
}

.overall-confidence.confidence-medium {
    border-left: 3px solid var(--warning);
}

.overall-confidence.confidence-low {
    border-left: 3px solid var(--error);
}

.obstruction-types {
    padding: 12px;
    background: var(--warning-light);
    border-radius: var(--radius);
    margin-bottom: 12px;
}

.obstruction-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 8px;
}

.obstruction-tag {
    padding: 4px 12px;
    background: var(--bg-primary);
    border: 1px solid var(--warning);
    border-radius: 999px;
    font-size: 12px;
    font-weight: 500;
    color: var(--warning);
}

.visibility-map {
    padding: 12px;
    background: var(--bg-primary);
    border-radius: var(--radius);
}

.visibility-map-items {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 12px;
    margin-top: 12px;
}

.visibility-map-item {
    padding: 12px;
    background: var(--bg-secondary);
    border-radius: var(--radius);
    border: 1px solid var(--border);
}

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

.map-item-brand {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
}

.map-item-confidence {
    font-size: 12px;
    font-weight: 700;
    color: var(--primary);
}

.map-item-category {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 600;
    margin-bottom: 8px;
}

.map-item-category.badge-fully-visible {
    background: var(--success-light);
    color: var(--success);
}

.map-item-category.badge-mostly-visible {
    background: #d1fae5;
    color: #059669;
}

.map-item-category.badge-partially-visible {
    background: var(--warning-light);
    color: var(--warning);
}

.map-item-category.badge-barely-visible {
    background: #fed7aa;
    color: #ea580c;
}

.map-item-category.badge-hidden-inferred {
    background: var(--error-light);
    color: var(--error);
}

.map-item-obstruction {
    font-size: 12px;
    color: var(--text-muted);
    font-style: italic;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 1024px) {
    .sidebar {
        box-shadow: var(--shadow-xl);
    }
    
    .main-content {
        margin-left: 0 !important;
    }
    
    .toggle-sidebar {
        left: 16px !important;
    }
    
    .sidebar:not(.collapsed) ~ .sidebar-backdrop {
        display: block;
    }
}

@media (max-width: 768px) {
    .chat-container {
        padding: 60px 16px 0;
    }
    
    .analysis-tabs-container {
        padding: 8px;
        gap: 8px;
    }
    
    .tab-group {
        min-width: 100%;
    }
    
    .tab-group-buttons {
        padding: 3px;
    }
    
    .tab-btn {
        padding: 6px 8px;
        font-size: 11px;
    }
    
    .tab-btn span {
        display: none;
    }
    
    .message {
        padding: 16px;
    }
    
    .features {
        grid-template-columns: 1fr;
    }
    
    .welcome-screen h1 {
        font-size: 22px;
    }
    
    .result-images-grid {
        grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    }
    
    .summary-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .depth-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .pallet-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 480px) {
    .chat-container {
        padding: 60px 12px 0;
    }
    
    .chat-input-wrapper {
        padding: 8px;
        gap: 8px;
    }
    
    .upload-btn,
    .send-btn {
        width: 38px;
        height: 38px;
    }
    
    .preview-image-wrapper img {
        width: 60px;
        height: 60px;
    }
}

/* ===== DEBUG & ANALYSIS STYLES ===== */

/* Summary Cards */
.summary-cards {
    margin-bottom: 20px;
}

.summary-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
}

.summary-card {
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px;
    text-align: center;
}

.summary-card.success {
    background: linear-gradient(135deg, #ecfdf5 0%, #d1fae5 100%);
    border-color: #a7f3d0;
}

.summary-card.primary {
    background: linear-gradient(135deg, #eff6ff 0%, #dbeafe 100%);
    border-color: #bfdbfe;
}

.summary-card.purple {
    background: linear-gradient(135deg, #f5f3ff 0%, #ede9fe 100%);
    border-color: #ddd6fe;
}

.summary-card.orange {
    background: linear-gradient(135deg, #fffbeb 0%, #fef3c7 100%);
    border-color: #fde68a;
}

.summary-value {
    font-size: 28px;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.2;
}

.summary-card.success .summary-value { color: #16a34a; }
.summary-card.primary .summary-value { color: #2563eb; }
.summary-card.purple .summary-value { color: #7c3aed; }
.summary-card.orange .summary-value { color: #d97706; font-size: 14px; }

.summary-label {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-top: 4px;
}

/* Analysis Method Badge */
.analysis-method-badge {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin-top: 16px;
    padding: 12px 20px;
    background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
    border: 2px solid #f59e0b;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
}

.analysis-method-badge .method-icon {
    font-size: 24px;
}

.analysis-method-badge .method-label {
    font-size: 16px;
    font-weight: 700;
    color: #92400e;
}

.analysis-method-badge .method-description {
    font-size: 13px;
    color: #b45309;
    padding-left: 10px;
    border-left: 2px solid #f59e0b;
}

/* Debug Table */
.table-wrapper {
    overflow-x: auto;
    border-radius: var(--radius);
    border: 1px solid var(--border);
}

.debug-table {
    font-size: 13px;
}

.debug-table th {
    background: var(--bg-tertiary);
    font-size: 11px;
    padding: 10px 12px;
}

.debug-table td {
    padding: 12px;
    vertical-align: top;
}

.debug-table .row-num {
    color: var(--text-muted);
    font-weight: 500;
    width: 30px;
}

.debug-table .brand-cell {
    min-width: 140px;
}

.debug-table .brand-cell .sku {
    color: var(--text-muted);
    font-size: 11px;
}

.debug-table .location-cell {
    color: var(--text-secondary);
    font-size: 12px;
}

.debug-table .location-cell small {
    color: var(--text-muted);
}

.debug-table .method-cell {
    font-size: 12px;
    color: var(--info);
}

.debug-table .method-cell .confidence {
    color: var(--success);
    font-weight: 500;
}

.debug-table .images-cell {
    white-space: nowrap;
}

/* Debug Grid */
.debug-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 12px;
}

.debug-card {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
}

.debug-card-icon {
    font-size: 24px;
    flex-shrink: 0;
}

.debug-card-content {
    flex: 1;
    min-width: 0;
}

.debug-card-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
}

.debug-card-desc {
    font-size: 11px;
    color: var(--text-secondary);
    margin-top: 2px;
}

.debug-card-check {
    color: var(--success);
    font-weight: bold;
    font-size: 16px;
}

/* Pallet Analysis */
.pallet-analysis {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px;
}

.pallet-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    margin-bottom: 16px;
}

.pallet-section {
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px;
    text-align: center;
}

.pallet-section.left {
    border-left: 4px solid #f59e0b;
}

.pallet-section.center {
    border-left: 4px solid #2563eb;
}

.pallet-section.right {
    border-left: 4px solid #10b981;
}

.pallet-header {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.pallet-count {
    font-size: 32px;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1;
}

.pallet-products {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 8px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.pallet-info {
    display: flex;
    gap: 24px;
    padding-top: 16px;
    border-top: 1px solid var(--border);
}

.info-item {
    display: flex;
    align-items: center;
    gap: 8px;
}

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

.info-value {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-primary);
    background: var(--bg-tertiary);
    padding: 4px 10px;
    border-radius: 999px;
}

/* Depth Analysis */
.depth-analysis {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px;
}

.depth-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
    margin-bottom: 16px;
}

.depth-card {
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px;
    text-align: center;
}

.depth-card.highlight {
    background: linear-gradient(135deg, #eff6ff 0%, #dbeafe 100%);
    border-color: var(--primary);
}

.depth-label {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.depth-value {
    font-size: 36px;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.2;
    margin: 4px 0;
}

.depth-card.highlight .depth-value {
    color: var(--primary);
}

.depth-unit {
    font-size: 10px;
    color: var(--text-muted);
}

.formula-box {
    background: var(--bg-primary);
    border: 2px dashed var(--primary);
    border-radius: var(--radius);
    padding: 16px;
    margin-bottom: 12px;
    text-align: center;
}

.formula-label {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.formula-value {
    font-size: 20px;
    font-weight: 700;
    color: var(--primary);
    font-family: 'SF Mono', Monaco, monospace;
}

.method-box {
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px;
}

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

.method-value {
    font-size: 14px;
    font-weight: 600;
    color: var(--info);
    margin-bottom: 8px;
}

.method-desc {
    font-size: 12px;
    color: var(--text-muted);
    line-height: 1.5;
}

/* 3D Calculation Cards */
.calculations-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.calc-card {
    background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 100%);
    border: 1px solid rgba(37, 99, 235, 0.2);
    border-radius: var(--radius-lg);
    padding: 16px 20px;
}

.calc-brand {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 10px;
}

.calc-formula {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.calc-dim {
    background: white;
    padding: 8px 14px;
    border-radius: var(--radius);
    font-size: 14px;
    color: var(--text-secondary);
    border: 1px solid var(--border);
}

.calc-dim strong {
    color: var(--primary);
    font-size: 18px;
    margin-right: 4px;
}

.calc-op {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-muted);
}

.calc-total {
    background: var(--primary);
    color: white;
    padding: 10px 18px;
    border-radius: var(--radius);
    font-size: 14px;
}

.calc-total strong {
    font-size: 20px;
}

.calc-raw {
    font-size: 13px;
    color: var(--text-secondary);
    font-family: 'SF Mono', Monaco, monospace;
}

/* Calculation Notes */
.calc-notes {
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px dashed var(--border);
    font-size: 12px;
    color: var(--text-muted);
    font-style: italic;
}

.calc-card.structured {
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
    border: 1px solid var(--border);
}

/* Detection Methods List */
.detection-methods-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.detection-method-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 13px;
}

.detection-method-item .method-check {
    color: var(--success);
    font-size: 16px;
    font-weight: bold;
}

.detection-method-item .method-text {
    color: var(--text-secondary);
}

/* Depth Estimation Card */
.depth-estimation-card {
    background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
    border: 1px solid rgba(217, 119, 6, 0.3);
    border-radius: var(--radius-lg);
    padding: 20px;
}

.depth-method-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 12px;
}

.depth-method-name {
    font-size: 16px;
    font-weight: 600;
    color: #92400e;
}

.confidence-badge {
    padding: 6px 12px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
}

.confidence-badge.high {
    background: rgba(34, 197, 94, 0.2);
    color: #15803d;
}

.confidence-badge.medium {
    background: rgba(245, 158, 11, 0.2);
    color: #b45309;
}

.confidence-badge.low {
    background: rgba(239, 68, 68, 0.2);
    color: #b91c1c;
}

.depth-method-desc {
    font-size: 14px;
    color: #78350f;
    line-height: 1.5;
}

/* Visual Cues List */
.visual-cues-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.visual-cue-item {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 999px;
    font-size: 12px;
}

.visual-cue-item .cue-icon {
    font-size: 14px;
}

.visual-cue-item .cue-text {
    color: var(--text-secondary);
}

/* Simplified Observations */
.observations-simple {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.obs-item {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 12px 14px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 13px;
}

.obs-icon {
    font-size: 16px;
    flex-shrink: 0;
}

.obs-text {
    color: var(--text-secondary);
    line-height: 1.5;
}

/* Debug Data Section */
.results-section.collapsible h4 {
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px;
    background: var(--bg-tertiary);
    border-radius: var(--radius);
    margin-bottom: 0;
    transition: var(--transition);
}

.results-section.collapsible h4:hover {
    background: var(--border);
}

.results-section.collapsible h4::after {
    content: '▶';
    font-size: 10px;
    margin-left: auto;
    transition: transform 0.2s;
}

.results-section.collapsible h4.expanded::after {
    transform: rotate(90deg);
}

.debug-data {
    margin-top: 12px;
    background: #1e293b;
    border-radius: var(--radius);
    padding: 16px;
    overflow-x: auto;
}

.debug-data pre {
    color: #e2e8f0;
    font-size: 11px;
    font-family: 'SF Mono', Monaco, Consolas, monospace;
    line-height: 1.5;
    margin: 0;
    white-space: pre-wrap;
    word-break: break-all;
}

/* Badge Types Extended */
.badge-tray {
    background: #fef3c7;
    color: #d97706;
}

.badge-can {
    background: #ecfdf5;
    color: #059669;
}

.badge-bottle {
    background: #f0f9ff;
    color: #0284c7;
}

.badge-pack {
    background: #fce7f3;
    color: #db2777;
}

.badge-carton {
    background: #f5f3ff;
    color: #7c3aed;
}

.badge-pallet {
    background: #fef2f2;
    color: #dc2626;
}

/* Brand Table Styles */
.brand-cell {
    min-width: 160px;
}

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

.brand-sku {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 2px;
}

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

.detail-item {
    padding: 2px 0;
}

.detail-item.confidence {
    color: var(--success);
    font-weight: 500;
}

/* Brand Summary Cards */
.brand-cards {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 12px;
}

.brand-card {
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px;
    transition: var(--transition);
}

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

.brand-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}

.brand-card-name {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 120px;
}

.brand-card-count {
    font-size: 32px;
    font-weight: 700;
    color: var(--primary);
    line-height: 1;
    margin-bottom: 12px;
}

.brand-card-bar {
    height: 6px;
    background: var(--bg-tertiary);
    border-radius: 3px;
    overflow: hidden;
    margin-bottom: 8px;
}

.brand-card-progress {
    height: 100%;
    background: linear-gradient(90deg, var(--primary), #3b82f6);
    border-radius: 3px;
    transition: width 0.5s ease;
}

.brand-card-percentage {
    font-size: 11px;
    color: var(--text-muted);
    text-align: right;
}

/* Responsive Brand Cards */
@media (max-width: 768px) {
    .brand-cards {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .brand-card-count {
        font-size: 24px;
    }
}

@media (max-width: 480px) {
    .brand-cards {
        grid-template-columns: 1fr;
    }
}

/* ============================================
   Scene Analysis Styles (NEW)
   ============================================ */

.scene-analysis-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
    margin-bottom: 16px;
}

.scene-item {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 12px;
    text-align: center;
}

.scene-label {
    display: block;
    font-size: 11px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 6px;
}

.scene-value {
    display: block;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
}

.scene-value.quality-clear {
    color: var(--success);
}

.scene-value.quality-moderate {
    color: var(--warning);
}

.scene-value.quality-blurry {
    color: var(--error);
}

.occlusions-list {
    background: #fef3c7;
    border: 1px solid #fcd34d;
    border-radius: var(--radius);
    padding: 12px 16px;
    font-size: 13px;
    color: #92400e;
}

.occlusions-list ul {
    margin: 8px 0 0 20px;
}

.occlusions-list li {
    margin: 4px 0;
}

/* ============================================
   Per-Item Detection Styles (NEW)
   ============================================ */

.per-item-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.per-item-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 16px;
    transition: var(--transition);
}

.per-item-card:hover {
    border-color: var(--primary);
    box-shadow: var(--shadow-md);
}

.per-item-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border);
}

.per-item-brand {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
}

.confidence-score {
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
}

.confidence-score.score-high {
    background: #dcfce7;
    color: #166534;
}

.confidence-score.score-medium {
    background: #fef9c3;
    color: #854d0e;
}

.confidence-score.score-low {
    background: #fee2e2;
    color: #991b1b;
}

.per-item-details {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    margin-bottom: 12px;
}

.detail-row {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

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

.detail-value {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
}

.detail-value.visibility-fully-visible {
    color: var(--success);
}

.detail-value.visibility-partially-obscured {
    color: var(--warning);
}

.detail-value.visibility-mostly-hidden {
    color: var(--error);
}

.identifying-features {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px dashed var(--border);
}

.identifying-features strong {
    display: block;
    font-size: 12px;
    color: var(--success);
    margin-bottom: 8px;
}

.features-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.feature-tag {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    background: #dcfce7;
    border: 1px solid #bbf7d0;
    border-radius: 999px;
    font-size: 11px;
    color: #166534;
}

.potential-errors {
    margin-top: 12px;
    padding: 10px 12px;
    background: #fef2f2;
    border: 1px solid #fecaca;
    border-radius: var(--radius);
}

.potential-errors strong {
    display: block;
    font-size: 12px;
    color: #991b1b;
    margin-bottom: 6px;
}

.potential-errors ul {
    margin: 0 0 0 16px;
    padding: 0;
}

.potential-errors li {
    font-size: 12px;
    color: #b91c1c;
    margin: 4px 0;
}

/* Responsive Scene Analysis */
@media (max-width: 768px) {
    .scene-analysis-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .per-item-details {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 480px) {
    .scene-analysis-grid {
        grid-template-columns: 1fr;
    }
}

/* ============================================
   History Placeholder Images
   ============================================ */

.result-image-item.placeholder-image {
    position: relative;
    opacity: 0.85;
}

.result-image-item.placeholder-image img {
    border: 2px dashed var(--border);
    background: var(--bg-tertiary);
}

.placeholder-badge {
    position: absolute;
    bottom: 8px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.6);
    color: white;
    font-size: 9px;
    padding: 2px 8px;
    border-radius: 10px;
    white-space: nowrap;
}

.history-images-note {
    font-size: 12px;
    color: var(--text-muted);
    padding: 8px 12px;
    background: var(--bg-tertiary);
    border-radius: var(--radius);
    margin-bottom: 12px;
    border-left: 3px solid var(--info);
}

.stored-images-note {
    font-size: 12px;
    color: var(--success);
    padding: 8px 12px;
    background: var(--success-light);
    border-radius: var(--radius);
    margin-bottom: 12px;
    border-left: 3px solid var(--success);
}

.result-image-item.stored-image img {
    border: 2px solid var(--success);
}

.stored-badge {
    position: absolute;
    bottom: 8px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--success);
    color: white;
    font-size: 9px;
    padding: 2px 8px;
    border-radius: 10px;
    white-space: nowrap;
}

/* ===== SIMPLIFIED DETECTION ANALYSIS STYLES ===== */

/* Detection Grid */
.detection-grid {
    display: flex;
    flex-direction: column;
    gap: 20px;
    margin-top: 12px;
}

/* Position Detection */
.position-detection h5,
.calculation-detection h5,
.structure-detection h5 {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 12px;
}

.position-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 12px;
}

.position-card {
    padding: 16px;
    background: var(--bg-secondary);
    border: 2px solid var(--border);
    border-radius: var(--radius);
    text-align: center;
    transition: var(--transition);
}

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

.position-card.left {
    border-left-color: #3b82f6;
}

.position-card.center {
    border-left-color: #10b981;
}

.position-card.right {
    border-left-color: #f59e0b;
}

.position-label {
    font-size: 12px;
    color: var(--text-secondary);
    margin-bottom: 8px;
    font-weight: 500;
}

.position-count {
    font-size: 28px;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 8px;
}

.position-brands {
    font-size: 11px;
    color: var(--text-muted);
    line-height: 1.4;
}

/* 3D Calculation Detection */
.calc-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.calc-item {
    padding: 12px 16px;
    background: var(--bg-secondary);
    border-left: 3px solid var(--primary);
    border-radius: var(--radius);
}

.calc-brand {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 6px;
}

.calc-formula {
    font-size: 14px;
    color: var(--text-secondary);
    font-family: 'Courier New', monospace;
}

.calc-value {
    color: var(--primary);
    font-weight: 600;
}

.calc-result {
    color: var(--success);
    font-size: 16px;
}

/* Structure Detection */
.structure-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 12px;
}

.structure-item {
    padding: 12px;
    background: var(--bg-secondary);
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    gap: 8px;
}

.structure-icon {
    font-size: 20px;
}

.structure-label {
    font-size: 12px;
    color: var(--text-secondary);
    margin-right: auto;
}

.structure-value {
    font-size: 18px;
    font-weight: 700;
    color: var(--primary);
}

/* Depth Analysis Card */
.depth-card {
    padding: 16px;
    background: var(--bg-secondary);
    border-radius: var(--radius);
    border-left: 3px solid var(--warning);
}

.depth-method,
.depth-confidence {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
}

.depth-label {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    min-width: 100px;
}

.depth-value {
    font-size: 14px;
    color: var(--text-primary);
    font-weight: 500;
}

.depth-description {
    padding: 12px;
    background: var(--bg-primary);
    border-radius: var(--radius);
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.6;
    margin-top: 12px;
}

/* Observations Simple */
.observations-simple {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.obs-item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 12px;
    background: var(--bg-secondary);
    border-radius: var(--radius);
    transition: var(--transition);
}

.obs-item:hover {
    background: var(--bg-tertiary);
}

.obs-icon {
    font-size: 18px;
    flex-shrink: 0;
    margin-top: 2px;
}

.obs-text {
    flex: 1;
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.5;
}

/* Confidence Badges */
.confidence-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 12px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
}

.confidence-badge.high {
    background: var(--success-light);
    color: var(--success);
}

.confidence-badge.medium {
    background: var(--warning-light);
    color: var(--warning);
}

.confidence-badge.low {
    background: var(--error-light);
    color: var(--error);
}

/* ===== DETAILED CALCULATION BREAKDOWN STYLES ===== */

.calc-list-detailed {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.calc-area-card {
    background: var(--bg-primary);
    border: 2px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    transition: var(--transition);
}

.calc-area-card:hover {
    border-color: var(--primary);
    box-shadow: var(--shadow-md);
}

.calc-area-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border);
}

.calc-area-number {
    width: 32px;
    height: 32px;
    background: var(--primary);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 14px;
    flex-shrink: 0;
}

.calc-area-info {
    flex: 1;
    min-width: 0;
}

.calc-area-title {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 2px;
}

.calc-area-location {
    font-size: 12px;
    color: var(--text-secondary);
}

.calc-area-total {
    font-size: 32px;
    font-weight: 700;
    color: var(--success);
    flex-shrink: 0;
}

.calc-area-body {
    padding: 16px;
}

.calc-dimensions {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 12px;
    margin-bottom: 16px;
}

.calc-dim-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px;
    background: var(--bg-secondary);
    border-radius: var(--radius);
}

.calc-dim-icon {
    font-size: 20px;
    flex-shrink: 0;
}

.calc-dim-label {
    flex: 1;
    font-size: 12px;
    color: var(--text-secondary);
    font-weight: 500;
}

.calc-dim-value {
    font-size: 20px;
    font-weight: 700;
    color: var(--primary);
    flex-shrink: 0;
}

.calc-formula-display {
    padding: 12px 16px;
    background: var(--bg-tertiary);
    border-radius: var(--radius);
    text-align: center;
    font-size: 16px;
    font-family: 'Courier New', monospace;
    color: var(--text-secondary);
    margin-bottom: 12px;
}

.calc-notes {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    padding: 12px;
    background: var(--info-light);
    border-left: 3px solid var(--info);
    border-radius: var(--radius);
}

.calc-notes-icon {
    font-size: 16px;
    flex-shrink: 0;
    margin-top: 2px;
}

.calc-notes-text {
    flex: 1;
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.5;
}

/* ===== VISIBILITY ANALYSIS STYLES ===== */

.visibility-breakdown-simple {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 16px;
}

.visibility-stat {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background: var(--bg-secondary);
    border-radius: var(--radius);
    border-left: 3px solid var(--border);
}

.visibility-stat:has(.visibility-icon:contains("✓")) {
    border-left-color: var(--success);
}

.visibility-icon {
    font-size: 20px;
    width: 24px;
    text-align: center;
    flex-shrink: 0;
}

.visibility-label {
    flex: 1;
    font-size: 14px;
    color: var(--text-secondary);
    font-weight: 500;
}

.visibility-count {
    font-size: 20px;
    font-weight: 700;
    color: var(--primary);
    min-width: 50px;
    text-align: right;
}

.visibility-percent {
    font-size: 13px;
    color: var(--text-muted);
    min-width: 50px;
    text-align: right;
}

.visibility-confidence {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background: var(--bg-tertiary);
    border-radius: var(--radius);
}

.visibility-conf-label {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
}

/* ===== NEW SIMPLIFIED RESULTS DISPLAY ===== */

/* Results Header - Total Count Display */
.results-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    padding: 24px;
    background: linear-gradient(135deg, #f0fdf4 0%, #dcfce7 100%);
    border: 2px solid #86efac;
    border-radius: var(--radius-lg);
    margin-bottom: 24px;
    flex-wrap: wrap;
}

.total-count-display {
    text-align: center;
}

.total-count-value {
    font-size: 56px;
    font-weight: 800;
    color: #16a34a;
    line-height: 1;
    margin-bottom: 8px;
}

.total-count-label {
    font-size: 14px;
    font-weight: 600;
    color: #166534;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.confidence-display {
    text-align: center;
    padding: 16px 24px;
    background: white;
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
}

.confidence-display.high {
    border: 2px solid #22c55e;
}

.confidence-display.medium {
    border: 2px solid #f59e0b;
}

.confidence-display.low {
    border: 2px solid #ef4444;
}

.confidence-value {
    font-size: 32px;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1;
    margin-bottom: 4px;
}

.confidence-display.high .confidence-value { color: #22c55e; }
.confidence-display.medium .confidence-value { color: #f59e0b; }
.confidence-display.low .confidence-value { color: #ef4444; }

.confidence-label {
    font-size: 11px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 4px;
}

.confidence-level {
    font-size: 12px;
    font-weight: 700;
    padding: 4px 12px;
    border-radius: 999px;
}

.confidence-display.high .confidence-level {
    background: #dcfce7;
    color: #16a34a;
}

.confidence-display.medium .confidence-level {
    background: #fef3c7;
    color: #d97706;
}

.confidence-display.low .confidence-level {
    background: #fee2e2;
    color: #dc2626;
}

.analysis-badge {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 20px;
    background: white;
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
}

.badge-icon {
    font-size: 24px;
}

.badge-text {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
}

/* Summary Box */
.summary-box {
    padding: 16px 20px;
    background: var(--bg-secondary);
    border-left: 4px solid var(--primary);
    border-radius: var(--radius);
    font-size: 14px;
    line-height: 1.6;
    color: var(--text-secondary);
}

/* Brand Table */
.brand-table {
    width: 100%;
}

.brand-table th {
    background: var(--bg-tertiary);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.brand-table .count-cell {
    font-size: 18px;
    font-weight: 700;
    color: var(--primary);
}

.type-badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
}

.type-badge.box {
    background: #dbeafe;
    color: #2563eb;
}

.type-badge.tray {
    background: #fef3c7;
    color: #d97706;
}

.type-badge.can {
    background: #dcfce7;
    color: #16a34a;
}

.type-badge.bottle {
    background: #e0e7ff;
    color: #4f46e5;
}

.position-badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 600;
}

.position-badge.left {
    background: #fef3c7;
    color: #d97706;
}

.position-badge.right {
    background: #dbeafe;
    color: #2563eb;
}

.position-badge.center {
    background: #dcfce7;
    color: #16a34a;
}

.position-badge.full {
    background: #e0e7ff;
    color: #4f46e5;
}

/* Stack Cards Grid */
.stacks-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 16px;
    margin-bottom: 20px;
}

.stack-card {
    background: var(--bg-primary);
    border: 2px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    transition: var(--transition);
}

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

.stack-card.left {
    border-top-color: #f59e0b;
}

.stack-card.right {
    border-top-color: #2563eb;
}

.stack-card.center {
    border-top-color: #10b981;
}

.stack-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border);
}

.stack-position {
    display: flex;
    align-items: center;
    gap: 8px;
}

.position-icon {
    font-size: 20px;
}

.position-text {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
}

.stack-visibility {
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 600;
}

.stack-visibility.full {
    background: #dcfce7;
    color: #16a34a;
}

.stack-visibility.partial {
    background: #fef3c7;
    color: #d97706;
}

.stack-brand {
    padding: 12px 16px;
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
    text-align: center;
    background: var(--bg-tertiary);
}

.stack-dimensions {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1px;
    background: var(--border);
    margin: 16px;
    border-radius: var(--radius);
    overflow: hidden;
}

.dimension {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 12px 8px;
    background: var(--bg-primary);
}

.dim-icon {
    font-size: 16px;
    margin-bottom: 4px;
}

.dim-label {
    font-size: 10px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.dim-value {
    font-size: 24px;
    font-weight: 700;
    color: var(--primary);
}

.stack-formula {
    text-align: center;
    padding: 8px 16px;
    background: var(--bg-tertiary);
    margin: 0 16px;
    border-radius: var(--radius);
    font-family: 'Courier New', monospace;
    font-size: 14px;
    color: var(--text-secondary);
}

.stack-total {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 16px;
    margin-top: 16px;
    background: linear-gradient(135deg, #f0fdf4 0%, #dcfce7 100%);
}

.total-label {
    font-size: 14px;
    font-weight: 600;
    color: #166534;
}

.total-value {
    font-size: 32px;
    font-weight: 800;
    color: #16a34a;
}

.stack-confidence {
    position: relative;
    height: 8px;
    background: var(--bg-tertiary);
    overflow: hidden;
}

.conf-bar {
    position: absolute;
    left: 0;
    top: 0;
    height: 100%;
    transition: width 0.5s ease;
}

.stack-confidence.high .conf-bar {
    background: linear-gradient(90deg, #22c55e, #16a34a);
}

.stack-confidence.medium .conf-bar {
    background: linear-gradient(90deg, #fbbf24, #f59e0b);
}

.stack-confidence.low .conf-bar {
    background: linear-gradient(90deg, #f87171, #ef4444);
}

.conf-text {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 10px;
    font-weight: 600;
    color: white;
    text-shadow: 0 1px 2px rgba(0,0,0,0.3);
    white-space: nowrap;
}

.stack-notes {
    padding: 12px 16px;
    font-size: 12px;
    color: var(--text-muted);
    background: var(--bg-secondary);
    border-top: 1px dashed var(--border);
    font-style: italic;
}

/* Depth Info */
.depth-info {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px;
    background: var(--bg-secondary);
    border-radius: var(--radius);
    font-size: 14px;
}

.depth-method {
    font-weight: 500;
    color: var(--text-primary);
}

.depth-confidence {
    padding: 4px 12px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
}

.depth-confidence.high {
    background: #dcfce7;
    color: #16a34a;
}

.depth-confidence.medium {
    background: #fef3c7;
    color: #d97706;
}

.depth-confidence.low {
    background: #fee2e2;
    color: #dc2626;
}

/* Confidence Details */
.confidence-details {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 12px;
    margin-bottom: 16px;
}

.conf-stat {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 16px;
    background: var(--bg-secondary);
    border-radius: var(--radius);
}

.conf-stat.overall {
    background: linear-gradient(135deg, #eff6ff 0%, #dbeafe 100%);
    border: 1px solid #93c5fd;
}

.conf-icon {
    font-size: 24px;
}

.conf-label {
    flex: 1;
    font-size: 12px;
    color: var(--text-secondary);
}

.conf-value {
    font-size: 20px;
    font-weight: 700;
    color: var(--primary);
}

.confidence-notes {
    padding: 12px 16px;
    background: var(--bg-tertiary);
    border-radius: var(--radius);
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.6;
}

/* Observations List */
.observations-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.observations-list li {
    padding: 12px 16px;
    background: var(--bg-secondary);
    border-radius: var(--radius);
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.5;
    border-left: 3px solid var(--border);
}

.observations-list li:hover {
    border-left-color: var(--primary);
    background: var(--bg-tertiary);
}

/* Responsive */
@media (max-width: 768px) {
    .results-header {
        flex-direction: column;
        text-align: center;
    }
    
    .total-count-value {
        font-size: 42px;
    }
    
    .stacks-grid {
        grid-template-columns: 1fr;
    }
    
    .stack-dimensions {
        grid-template-columns: repeat(3, 1fr);
    }
    
    .confidence-details {
        grid-template-columns: 1fr;
    }
}
