/* ============================================================
   DESIGN TOKENS — edit these to retheme the whole app
   ============================================================ */
:root {
    /* Brand */
    --c-primary:        #4f46e5;
    --c-primary-hover:  #4338ca;
    --c-primary-active: #3730a3;
    --c-primary-light:  #eef2ff;
    --c-primary-muted:  #c7d2fe;

    /* Semantic */
    --c-success:        #059669;
    --c-success-hover:  #047857;
    --c-success-light:  #d1fae5;
    --c-warning:        #d97706;
    --c-warning-light:  #fef3c7;
    --c-danger:         #dc2626;
    --c-danger-hover:   #b91c1c;
    --c-danger-light:   #fee2e2;
    --c-info:           #2563eb;
    --c-info-light:     #dbeafe;

    /* Surfaces & text */
    --c-bg:             #f1f5f9;
    --c-surface:        #ffffff;
    --c-surface-2:      #f8fafc;
    --c-border:         #e2e8f0;
    --c-border-strong:  #cbd5e1;
    --c-text:           #0f172a;
    --c-text-muted:     #64748b;
    --c-text-faint:     #94a3b8;

    /* Header */
    --c-header-bg:      #0f172a;
    --c-header-border:  #1e293b;

    /* Radii */
    --r-sm:  6px;
    --r-md:  10px;
    --r-lg:  14px;
    --r-xl:  20px;

    /* Shadows */
    --shadow-xs: 0 1px 2px rgba(0,0,0,0.05);
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.07), 0 2px 6px rgba(0,0,0,0.04);
    --shadow-md: 0 4px 14px rgba(0,0,0,0.08), 0 1px 3px rgba(0,0,0,0.04);
    --shadow-lg: 0 10px 30px rgba(0,0,0,0.10), 0 2px 6px rgba(0,0,0,0.04);

    /* Header height */
    --header-h: 60px;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    background-color: #f5f7fa;
    color: #333;
    line-height: 1.6;
}

.container {
    max-width: 1800px;
    margin: 0 auto;
    padding: 20px;
}

header {
    text-align: center;
    margin-bottom: 40px;
    padding: 20px;
}

header h1 {
    font-size: 2.5rem;
    color: #2c3e50;
    margin-bottom: 10px;
}

.subtitle {
    color: #7f8c8d;
    font-size: 1.1rem;
}

/* Header nav buttons */
.header-actions {
    position: absolute;
    top: 20px;
    right: 20px;
    display: flex;
    gap: 8px;
}

.settings-toggle {
    background: #95a5a6;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 6px;
    font-size: 0.9rem;
    cursor: pointer;
    transition: background 0.2s;
}

.settings-toggle:hover {
    background: #7f8c8d;
}

.settings-toggle.active {
    background: #3498db;
}

header {
    position: relative;
}

.version-badge {
    position: absolute;
    top: 20px;
    left: 20px;
    background: #3498db;
    color: white;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 0.8rem;
    font-weight: 500;
}

/* Service Status Bar */
.service-status-bar {
    display: flex;
    justify-content: center;
    padding: 6px 16px;
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    margin: -20px auto 20px;
    max-width: 900px;
}

.status-indicators {
    display: flex;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
    justify-content: center;
}

.status-indicator {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 0.78rem;
    color: #555;
    cursor: default;
    white-space: nowrap;
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
    flex-shrink: 0;
}

.status-dot.ok {
    background-color: #28a745;
    box-shadow: 0 0 4px rgba(40, 167, 69, 0.4);
}

.status-dot.error {
    background-color: #dc3545;
    box-shadow: 0 0 4px rgba(220, 53, 69, 0.4);
    animation: pulse-red 2s ease-in-out infinite;
}

.status-dot.unconfigured {
    background-color: #adb5bd;
}

@keyframes pulse-red {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.4; }
}

.status-loading {
    font-size: 0.78rem;
    color: #999;
    font-style: italic;
}

/* Settings Section */
.settings-section {
    background: white;
    border-radius: 12px;
    padding: 30px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.08);
    margin-bottom: 40px;
    border: 2px solid #3498db;
}

.settings-section h2 {
    margin-bottom: 20px;
    color: #2c3e50;
}

.settings-form {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.settings-group {
    background: #f8f9fa;
    border-radius: 8px;
    padding: 20px;
}

.settings-group h3 {
    color: #3498db;
    font-size: 1rem;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 1px solid #e0e0e0;
}

.settings-form .form-group small {
    color: #7f8c8d;
    font-size: 0.85rem;
    margin-top: 5px;
}

.settings-form .form-group small a {
    color: #3498db;
}

.form-group select {
    padding: 12px 16px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 1rem;
    background: white;
    cursor: pointer;
    width: 100%;
}

.form-group select:focus {
    outline: none;
    border-color: #3498db;
}

.settings-actions {
    display: flex;
    align-items: center;
    gap: 15px;
}

.btn-save {
    background: #27ae60;
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.2s;
}

.btn-save:hover {
    background: #219a52;
}

#settingsStatus {
    color: #27ae60;
    font-weight: 500;
}

#settingsStatus.error {
    color: #e74c3c;
}

/* Search Section */
.search-section {
    background: white;
    border-radius: 12px;
    padding: 30px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.08);
    margin-bottom: 40px;
}

.search-section h2 {
    margin-bottom: 20px;
    color: #2c3e50;
}

.search-form {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    align-items: end;
}

.search-form .form-group.full-width {
    grid-column: 1 / -1;
}

.search-form .form-group.full-width small {
    color: #7f8c8d;
    font-size: 0.85rem;
    margin-top: 5px;
}

.form-group {
    display: flex;
    flex-direction: column;
}

.form-group label {
    margin-bottom: 8px;
    font-weight: 500;
    color: #555;
}

.form-group input {
    padding: 12px 16px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 1rem;
    transition: border-color 0.2s;
}

.form-group input:focus {
    outline: none;
    border-color: #3498db;
}

button[type="submit"] {
    background: #3498db;
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.2s;
}

button[type="submit"]:hover {
    background: #2980b9;
}

button[type="submit"]:disabled {
    background: #95a5a6;
    cursor: not-allowed;
}

/* Search Tabs */
.search-tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    border-bottom: 2px solid #e0e0e0;
    padding-bottom: 10px;
}

.tab-btn {
    background: none;
    border: none;
    padding: 10px 20px;
    font-size: 1rem;
    cursor: pointer;
    color: #7f8c8d;
    border-radius: 6px 6px 0 0;
    transition: all 0.2s;
}

.tab-btn:hover {
    color: #3498db;
}

.tab-btn.active {
    color: #3498db;
    background: #e8f4fc;
    font-weight: 500;
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

/* CSV Upload Section */
.csv-upload-section {
    padding: 10px 0;
}

.csv-instructions {
    color: #555;
    margin-bottom: 15px;
}

.csv-template {
    margin-bottom: 20px;
}

.csv-template a {
    color: #3498db;
    text-decoration: none;
}

.csv-template a:hover {
    text-decoration: underline;
}

.file-input {
    width: 100%;
    padding: 12px;
    border: 2px dashed #e0e0e0;
    border-radius: 8px;
    cursor: pointer;
    background: #fafafa;
}

.file-input:hover {
    border-color: #3498db;
}

.csv-preview {
    margin: 20px 0;
    max-height: 300px;
    overflow-y: auto;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
}

.csv-preview h4 {
    padding: 10px 15px;
    background: #f5f5f5;
    margin: 0;
    border-bottom: 1px solid #e0e0e0;
}

#csvPreviewTable {
    width: 100%;
    border-collapse: collapse;
}

#csvPreviewTable th,
#csvPreviewTable td {
    padding: 10px 15px;
    text-align: left;
    border-bottom: 1px solid #eee;
}

#csvPreviewTable th {
    background: #f8f9fa;
    font-weight: 500;
    color: #555;
}

.process-csv-btn {
    background: #27ae60;
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.2s;
    margin-top: 15px;
}

.process-csv-btn:hover {
    background: #219a52;
}

.process-csv-btn:disabled {
    background: #95a5a6;
    cursor: not-allowed;
}

.batch-progress {
    margin-top: 20px;
}

.progress-bar {
    width: 100%;
    height: 20px;
    background: #e0e0e0;
    border-radius: 10px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: #27ae60;
    width: 0%;
    transition: width 0.3s ease;
}

.progress-text {
    text-align: center;
    margin-top: 10px;
    color: #555;
}

/* Results Section */
.results-section {
    background: white;
    border-radius: 12px;
    padding: 30px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.08);
}

.results-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 15px;
}

.results-header h2 {
    color: #2c3e50;
}

.product-count {
    font-size: 0.9rem;
    font-weight: normal;
    color: #7f8c8d;
    margin-left: 10px;
}

.product-count .filtered {
    color: #3498db;
    font-weight: 500;
}

.search-filter {
    display: flex;
    gap: 8px;
    align-items: center;
}

.search-filter input,
.search-filter select {
    padding: 10px 16px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 0.95rem;
}

.search-filter input {
    width: 250px;
}

.search-filter select {
    width: 200px;
    background: white;
    cursor: pointer;
}

.products-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 20px;
}

/* Pagination */
.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    padding: 20px 0;
    flex-wrap: wrap;
}

.pagination-btn {
    padding: 6px 12px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    background: #fff;
    color: #374151;
    cursor: pointer;
    font-size: 14px;
    min-width: 36px;
    text-align: center;
    transition: all 0.15s;
}

.pagination-btn:hover:not(:disabled):not(.active) {
    background: #f3f4f6;
    border-color: #9ca3af;
}

.pagination-btn.active {
    background: #2563eb;
    color: #fff;
    border-color: #2563eb;
    font-weight: 600;
}

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

.pagination-ellipsis {
    padding: 6px 4px;
    color: #6b7280;
}

.pagination-info {
    color: #6b7280;
    font-size: 14px;
    margin-right: 12px;
}

.pagination-per-page {
    margin-left: 16px;
    padding: 6px 8px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 14px;
    background: #fff;
    cursor: pointer;
}

/* Product Card */
.product-card {
    background: #fafafa;
    border-radius: 10px;
    padding: 20px;
    border: 1px solid #eee;
    transition: transform 0.2s, box-shadow 0.2s;
    cursor: pointer;
}

.product-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 5px 20px rgba(0,0,0,0.1);
}

.product-card h3 {
    font-size: 1.1rem;
    color: #2c3e50;
    margin-bottom: 10px;
}

.product-card .brand {
    color: #3498db;
    font-weight: 500;
    margin-bottom: 5px;
}

.product-card .meta {
    font-size: 0.85rem;
    color: #7f8c8d;
    margin-bottom: 10px;
}

.product-card .meta .subcategory-label {
    color: #3498db;
    font-style: italic;
    font-size: 0.8rem;
}

.product-card .preview-image {
    width: 100%;
    height: 150px;
    object-fit: contain;
    background: white;
    border-radius: 8px;
    margin-bottom: 10px;
}

.product-card .status {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 500;
}

.status.completed {
    background: #d4edda;
    color: #155724;
}

.status.processing {
    background: #fff3cd;
    color: #856404;
}

.status.error {
    background: #f8d7da;
    color: #721c24;
}

.no-data-badge {
    display: inline-block;
    background: #fff3cd;
    color: #856404;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 500;
    margin-left: 8px;
}

.exported-badge {
    display: inline-block;
    background: #d4edda;
    color: #155724;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 500;
    margin-left: 8px;
    cursor: help;
}

.exported-badge.stale-badge {
    background: #fff3cd;
    color: #856404;
}

.erp-badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 500;
    margin-left: 8px;
    cursor: help;
}

.erp-badge.erp-ready {
    background: #d4edda;
    color: #155724;
}

.erp-badge.erp-incomplete {
    background: #f8d7da;
    color: #721c24;
}

/* Quality scoring badges */
.quality-badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    margin-left: 8px;
    cursor: help;
}
.quality-badge.quality-excellent { background: #d4edda; color: #155724; }
.quality-badge.quality-good { background: #fff3cd; color: #856404; }
.quality-badge.quality-needs-work { background: #f8d7da; color: #721c24; }

/* Quality stat cards */
.stat-card-quality .stat-value { color: #27ae60; }
.stat-card-quality.active { border-left-color: #27ae60; background: #eafaf1; }

/* Quality section in product detail */
.quality-section { margin-bottom: 20px; }
.quality-header {
    display: flex; align-items: center; justify-content: space-between;
    cursor: pointer; padding: 8px 0;
}
.quality-header h3 { margin: 0; display: flex; align-items: center; gap: 8px; }
.quality-body { padding: 8px 0; }
.quality-section.collapsed .quality-body { display: none; }
.quality-bar-bg { background: #e9ecef; border-radius: 4px; overflow: hidden; height: 6px; flex: 1; }
.quality-bar-fill { height: 100%; border-radius: 4px; transition: width 0.3s; }
.quality-breakdown-table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
.quality-breakdown-table td { padding: 6px 8px; border-bottom: 1px solid #f0f0f0; }
.quality-breakdown-table td:first-child { font-weight: 500; width: 120px; }
.quality-breakdown-table td:nth-child(2) { width: 50px; text-align: center; color: #666; }
.quality-breakdown-table td:nth-child(3) { width: auto; }
.btn-recalculate {
    padding: 4px 12px; font-size: 0.8rem; background: #3498db; color: white;
    border: none; border-radius: 4px; cursor: pointer;
}
.btn-recalculate:hover { background: #2980b9; }

/* Export templates */
.export-templates-list { display: flex; flex-direction: column; gap: 8px; margin-bottom: 12px; }
.export-template-item {
    display: flex; align-items: center; justify-content: space-between;
    padding: 10px 14px; background: #f8f9fa; border-radius: 8px; border: 1px solid #e9ecef;
}
.template-info { display: flex; flex-direction: column; gap: 2px; }
.template-desc { font-size: 0.85rem; color: #666; }
.template-actions { display: flex; gap: 6px; }
.btn-add-template { padding: 8px 16px; background: #3498db; color: white; border: none; border-radius: 6px; cursor: pointer; }
.btn-add-template:hover { background: #2980b9; }
.btn-add-template-field { padding: 6px 12px; background: #eee; border: 1px solid #ddd; border-radius: 4px; cursor: pointer; margin-top: 8px; }
.btn-add-template-field:hover { background: #ddd; }
.template-field-mappings { display: flex; flex-direction: column; gap: 6px; }
.template-mapping-row {
    display: grid; grid-template-columns: 1fr 1fr 140px 30px; gap: 8px; align-items: center;
}
.template-mapping-row select, .template-mapping-row input {
    padding: 6px 8px; border: 1px solid #ddd; border-radius: 4px; font-size: 0.9rem;
}
.btn-remove-mapping {
    width: 28px; height: 28px; background: #e74c3c; color: white; border: none;
    border-radius: 4px; cursor: pointer; font-size: 1rem; line-height: 1;
}
.btn-remove-mapping:hover { background: #c0392b; }
.export-csv-group { display: inline-flex; align-items: center; gap: 4px; }
.export-template-select { padding: 6px 8px; border: 1px solid #ddd; border-radius: 4px; font-size: 0.85rem; max-width: 160px; }
.btn-small { padding: 4px 10px; font-size: 0.8rem; border: 1px solid #ddd; border-radius: 4px; cursor: pointer; background: #f8f9fa; }
.btn-small:hover { background: #e9ecef; }
.btn-small.btn-danger { color: #e74c3c; border-color: #e74c3c; }
.btn-small.btn-danger:hover { background: #fdf2f2; }

/* Category suggestions */
.category-suggestions-panel { margin-top: 20px; border-top: 1px solid #e9ecef; padding-top: 16px; }
.suggestions-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.suggestions-header h4 { margin: 0; }
.suggestions-actions { display: flex; gap: 8px; }
.btn-analyze, .btn-backfill {
    padding: 6px 14px; font-size: 0.85rem; border: 1px solid #ddd; border-radius: 6px; cursor: pointer; background: #f8f9fa;
}
.btn-analyze:hover { background: #3498db; color: white; border-color: #3498db; }
.btn-backfill:hover { background: #e9ecef; }
.suggestions-list { display: flex; flex-direction: column; gap: 8px; }
.suggestions-empty { color: #999; font-style: italic; font-size: 0.9rem; }
.suggestion-card {
    display: flex; align-items: center; justify-content: space-between;
    padding: 12px 16px; border-radius: 8px; border: 1px solid #e9ecef;
}
.suggestion-new-category { background: #eaf4fd; border-color: #b8d9f5; }
.suggestion-new-field { background: #fef5ec; border-color: #fad7a0; }
.suggestion-info { flex: 1; }
.suggestion-meta { font-size: 0.85rem; color: #666; margin-top: 2px; }
.suggestion-fields { font-size: 0.85rem; color: #555; margin-top: 4px; }
.suggestion-actions { display: flex; gap: 6px; margin-left: 12px; }
.btn-accept { padding: 4px 12px; background: #27ae60; color: white; border: none; border-radius: 4px; cursor: pointer; font-size: 0.85rem; }
.btn-accept:hover { background: #219a52; }
.btn-dismiss { padding: 4px 12px; background: #95a5a6; color: white; border: none; border-radius: 4px; cursor: pointer; font-size: 0.85rem; }
.btn-dismiss:hover { background: #7f8c8d; }
.suggestion-count-badge {
    display: inline-block; background: #e74c3c; color: white; font-size: 0.75rem;
    padding: 2px 8px; border-radius: 10px; margin-left: 8px; font-weight: 600;
}

.no-data-warning {
    background: #fff3cd;
    color: #856404;
    padding: 12px 16px;
    border-radius: 8px;
    margin-bottom: 20px;
    font-size: 0.95rem;
    border: 1px solid #ffc107;
}

.product-price {
    font-size: 1.1rem;
    font-weight: 600;
    color: #27ae60;
    margin: 8px 0;
}

.product-price.no-price {
    color: #95a5a6;
    font-weight: 400;
    font-size: 0.9rem;
}

.product-card .delete-btn {
    background: #e74c3c;
    color: white;
    border: none;
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 0.8rem;
    cursor: pointer;
    margin-top: 10px;
}

.product-card .delete-btn:hover {
    background: #c0392b;
}

/* Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    padding: 20px;
}

.modal-content {
    background: white;
    border-radius: 12px;
    max-width: 900px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
    padding: 30px;
}

.modal-close {
    position: absolute;
    top: 15px;
    right: 20px;
    background: none;
    border: none;
    font-size: 2rem;
    cursor: pointer;
    color: #7f8c8d;
}

.modal-close:hover {
    color: #333;
}

/* Modal Content Styles */
.product-detail h2 {
    color: #2c3e50;
    margin-bottom: 20px;
    padding-right: 40px;
}

.product-detail .images-section {
    margin-bottom: 25px;
}

.product-detail .images-gallery {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
    flex-wrap: wrap;
    align-items: flex-start;
}

.product-detail .images-gallery .image-container {
    position: relative;
    display: flex;
    flex-direction: column;
}

.product-detail .images-gallery img {
    width: 200px;
    height: 200px;
    object-fit: contain;
    background: #f5f5f5;
    border-radius: 8px;
}

.product-detail .images-gallery .delete-image-btn {
    position: absolute;
    top: 5px;
    right: 5px;
    width: 24px;
    height: 24px;
    border: none;
    border-radius: 50%;
    background: rgba(231, 76, 60, 0.9);
    color: white;
    font-size: 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.2s;
}

.product-detail .images-gallery .image-container:hover .delete-image-btn {
    opacity: 1;
}

.product-detail .images-gallery .delete-image-btn:hover {
    background: #c0392b;
}

.product-detail .images-gallery .no-images {
    color: #7f8c8d;
    font-style: italic;
}

.product-detail .image-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.product-detail .btn-search-images,
.product-detail .btn-upload-image {
    padding: 8px 16px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: background 0.2s;
}

.product-detail .btn-search-images {
    background: #3498db;
    color: white;
}

.product-detail .btn-search-images:hover {
    background: #2980b9;
}

.product-detail .btn-search-images:disabled {
    background: #95a5a6;
    cursor: not-allowed;
}

.product-detail .btn-upload-image {
    background: #27ae60;
    color: white;
}

.product-detail .btn-upload-image:hover {
    background: #219a52;
}

.product-detail section {
    margin-bottom: 25px;
}

.product-detail section h3 {
    color: #3498db;
    margin-bottom: 10px;
    font-size: 1.1rem;
}

.product-detail .description {
    color: #555;
    white-space: pre-line;
}

.product-detail .translation-header {
    color: #7f8c8d;
    font-size: 0.95rem;
    margin-top: 15px;
    margin-bottom: 8px;
    font-weight: 500;
}

.product-detail .description.translated {
    color: #666;
    background: #f8f9fa;
    padding: 12px;
    border-radius: 6px;
    border-left: 3px solid #3498db;
}

.product-detail .specs-table {
    width: 100%;
    border-collapse: collapse;
}

.product-detail .specs-table tr {
    border-bottom: 1px solid #eee;
}

.product-detail .specs-table td {
    padding: 10px;
}

.product-detail .specs-table td:first-child {
    font-weight: 500;
    color: #555;
    width: 40%;
}

.product-detail .meta-info {
    font-size: 0.85rem;
    color: #7f8c8d;
}

.product-detail .meta-info .separator {
    margin: 0 10px;
    color: #bdc3c7;
}

/* Pricing Section */
.pricing-section {
    background: #f8f9fa;
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 20px;
}

.price-inputs {
    display: flex;
    gap: 15px;
    align-items: flex-end;
    flex-wrap: wrap;
}

.price-field {
    display: flex;
    flex-direction: column;
}

.price-field label {
    font-size: 0.9rem;
    color: #555;
    margin-bottom: 5px;
}

.price-field input {
    padding: 10px 12px;
    border: 2px solid #e0e0e0;
    border-radius: 6px;
    font-size: 1rem;
    width: 120px;
}

.price-field input:focus {
    outline: none;
    border-color: #3498db;
}

.btn-save-price {
    background: #27ae60;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.95rem;
    transition: background 0.2s;
}

.btn-save-price:hover {
    background: #219a52;
}

/* Inventory Section */
.inventory-section {
    margin: 20px 0;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 8px;
}

.inventory-section h3 {
    margin-bottom: 15px;
    color: #2c3e50;
}

.inventory-inputs {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 15px;
    margin-bottom: 15px;
}

.inventory-field {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.inventory-field label {
    font-weight: 500;
    color: #555;
    font-size: 0.9rem;
}

.inventory-field input {
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 1rem;
}

.btn-save-inventory {
    background: #3498db;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.95rem;
    transition: background 0.2s;
}

.btn-save-inventory:hover {
    background: #2980b9;
}

.no-locations {
    color: #7f8c8d;
    font-style: italic;
}

/* Export Info Section */
.export-info {
    margin: 20px 0;
    padding: 15px;
    background: #e8f4fd;
    border-radius: 8px;
    border-left: 4px solid #3498db;
}

.export-info h3 {
    margin-bottom: 10px;
    color: #2c3e50;
}

.export-info p {
    margin: 5px 0;
    color: #555;
}

/* Results header with import button */
.results-actions {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
}

.btn-import-prices {
    background: #9b59b6;
    color: white;
    padding: 8px 14px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.85rem;
    transition: background 0.2s;
}

.btn-import-prices:hover {
    background: #8e44ad;
}

/* Category actions dropdown */
.category-actions-dropdown {
    position: relative;
    display: inline-block;
}

.category-actions-content {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    background: white;
    min-width: 220px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    border-radius: 8px;
    z-index: 100;
    padding: 6px 0;
    margin-top: 4px;
}

.category-actions-content.show {
    display: block;
}

.category-actions-content button {
    display: block;
    width: 100%;
    text-align: left;
    padding: 8px 16px;
    border: none;
    background: none;
    cursor: pointer;
    font-size: 0.85rem;
    color: #2c3e50;
    white-space: nowrap;
}

.category-actions-content button:hover {
    background: #f0f0f0;
}

.category-actions-content .dropdown-divider {
    height: 1px;
    background: #e0e0e0;
    margin: 4px 0;
}

.btn-standardize {
    background: #17a2b8;
    color: white;
    border: none;
    padding: 8px 14px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.85rem;
    transition: background 0.2s;
}

.btn-standardize:hover {
    background: #138496;
}

.btn-standardize:disabled {
    background: #6c757d;
    cursor: not-allowed;
}

.btn-find-all-specs {
    background: #9b59b6;
    color: white;
    border: none;
    padding: 8px 14px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.85rem;
    transition: background 0.2s;
}

.btn-find-all-specs:hover {
    background: #8e44ad;
}

.btn-find-all-specs:disabled {
    background: #6c757d;
    cursor: not-allowed;
}

/* Loading State */
.loading {
    text-align: center;
    padding: 40px;
    color: #7f8c8d;
}

.no-products {
    text-align: center;
    padding: 60px 20px;
    color: #7f8c8d;
}

/* Product Selection */
.product-checkbox {
    position: absolute;
    top: 10px;
    left: 10px;
    z-index: 10;
}

.product-checkbox input[type="checkbox"] {
    width: 20px;
    height: 20px;
    cursor: pointer;
    accent-color: #3498db;
}

.product-card {
    position: relative;
}

.product-card.selected {
    border: 2px solid #3498db;
    background: #e8f4fc;
}

/* Selection Action Bar */
.selection-action-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: #2c3e50;
    color: white;
    padding: 15px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 -2px 10px rgba(0,0,0,0.2);
    z-index: 1000;
}

.selection-count {
    font-size: 1.1rem;
    font-weight: 500;
}

.selection-actions {
    display: flex;
    gap: 10px;
}

.btn-select-all,
.btn-deselect {
    background: #7f8c8d;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.95rem;
    transition: background 0.2s;
}

.btn-select-all:hover,
.btn-deselect:hover {
    background: #95a5a6;
}

.btn-csv {
    background: #3498db;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.95rem;
    font-weight: 500;
    transition: background 0.2s;
}

.btn-csv:hover {
    background: #2980b9;
}

.btn-shopify {
    background: #96bf48;
    color: white;
    border: none;
    padding: 10px 24px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.95rem;
    font-weight: 500;
    transition: background 0.2s;
}

.btn-shopify:hover {
    background: #7aa03c;
}

.btn-shopify:disabled {
    background: #95a5a6;
    cursor: not-allowed;
}

/* Shopify Status */
.shopify-status {
    padding: 10px;
    margin-bottom: 15px;
    border-radius: 6px;
    background: #f8f9fa;
    text-align: center;
}

.shopify-status.connected {
    background: #d4edda;
}

.status-connected {
    color: #155724;
    font-weight: 500;
}

.status-disconnected {
    color: #856404;
}

/* Metafield Status */
.metafield-status {
    margin-top: 10px;
    padding: 10px;
    border-radius: 6px;
    background: #f8f9fa;
    font-size: 0.9rem;
}

.metafield-status.success {
    background: #d4edda;
    color: #155724;
}

.metafield-status.warning {
    background: #fff3cd;
    color: #856404;
}

.metafield-status.error {
    background: #f8d7da;
    color: #721c24;
}

.btn-secondary {
    background: #6c757d;
    color: white;
    border: none;
    padding: 10px 16px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: background 0.2s;
}

.btn-secondary:hover {
    background: #5a6268;
}

.btn-secondary:disabled {
    background: #adb5bd;
    cursor: not-allowed;
}

/* Responsive */
@media (max-width: 600px) {
    .search-form {
        grid-template-columns: 1fr;
    }

    .search-filter {
        flex-wrap: wrap;
        width: 100%;
    }

    .search-filter input,
    .search-filter select {
        width: 100%;
    }

    .products-grid {
        grid-template-columns: 1fr;
    }

    .selection-action-bar {
        flex-direction: column;
        gap: 10px;
        padding: 15px;
    }

    .selection-actions {
        flex-wrap: wrap;
        justify-content: center;
    }
}

/* Export Progress Modal */
.export-progress-modal {
    max-width: 500px;
    text-align: center;
}

.export-progress-modal h2 {
    margin-bottom: 20px;
    color: #2c3e50;
}

.export-progress-container {
    padding: 20px 0;
}

.export-progress-bar {
    width: 100%;
    height: 24px;
    background: #e0e0e0;
    border-radius: 12px;
    overflow: hidden;
    margin-bottom: 15px;
}

.export-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #3498db, #2ecc71);
    border-radius: 12px;
    transition: width 0.3s ease;
}

.export-progress-stats {
    display: flex;
    justify-content: space-between;
    font-size: 1rem;
    color: #555;
    margin-bottom: 10px;
}

.export-progress-details {
    font-size: 0.9rem;
    color: #777;
    margin-bottom: 15px;
    min-height: 24px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.export-progress-counts {
    display: flex;
    justify-content: center;
    gap: 30px;
    font-size: 1rem;
    margin-bottom: 10px;
}

.export-progress-counts .success-count {
    color: #27ae60;
}

.export-progress-counts .error-count {
    color: #e74c3c;
}

.export-progress-eta {
    font-size: 0.85rem;
    color: #888;
}

.export-complete {
    padding-top: 20px;
    border-top: 1px solid #eee;
    margin-top: 20px;
}

.export-complete p {
    font-size: 1.1rem;
    margin-bottom: 15px;
}

.btn-close-export {
    background: #3498db;
    color: white;
    border: none;
    padding: 10px 30px;
    border-radius: 6px;
    font-size: 1rem;
    cursor: pointer;
    transition: background 0.2s;
}

.btn-close-export:hover {
    background: #2980b9;
}

.btn-stop-operation {
    background: #e74c3c;
    color: white;
    border: none;
    padding: 8px 24px;
    border-radius: 6px;
    font-size: 0.9rem;
    cursor: pointer;
    transition: background 0.2s;
    margin-top: 10px;
}

.btn-stop-operation:hover {
    background: #c0392b;
}

.btn-stop-operation:disabled {
    background: #95a5a6;
    cursor: not-allowed;
}

/* Specs Section Styling */
.specs-section .specs-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    flex-wrap: wrap;
    gap: 10px;
}

.specs-section .specs-header h3 {
    margin: 0;
}

.specs-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

.spec-completion-badge {
    font-size: 0.8rem;
    padding: 4px 10px;
    border-radius: 12px;
    font-weight: 500;
}

.spec-completion-badge.complete {
    background: #d4edda;
    color: #155724;
}

.spec-completion-badge.partial {
    background: #fff3cd;
    color: #856404;
}

.spec-completion-badge.low {
    background: #f8d7da;
    color: #721c24;
}

.btn-find-specs {
    background: #9b59b6;
    color: white;
    border: none;
    padding: 6px 14px;
    border-radius: 6px;
    font-size: 0.85rem;
    cursor: pointer;
    transition: background 0.2s;
}

.btn-find-specs:hover {
    background: #8e44ad;
}

.btn-find-specs:disabled {
    background: #ccc;
    cursor: not-allowed;
}

/* Missing Specs Info */
.missing-specs-info {
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    padding: 12px;
    margin-bottom: 15px;
}

.missing-specs-header {
    margin-bottom: 8px;
    color: #495057;
}

.missing-specs-list {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.missing-spec-tag {
    background: #fee;
    color: #c00;
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 0.8rem;
    border: 1px solid #fcc;
}

.all-specs-complete {
    color: #28a745;
    font-weight: 500;
}

/* Spec Table Rows */
.specs-table tr.standardized-spec td:first-child {
    background: #f0f7ff;
}

.spec-badge.standardized {
    color: #f39c12;
    font-size: 0.75rem;
    margin-left: 5px;
    vertical-align: super;
}

.spec-key {
    font-weight: 500;
}

/* Spec Verification Badges */
.specs-table tr.flagged-spec {
    background: #fff8e1;
    border-left: 3px solid #f39c12;
}

.spec-badge.flagged {
    color: #e67e22;
    font-size: 0.85rem;
    margin-left: 5px;
    cursor: help;
    vertical-align: super;
}

.spec-badge.verified {
    color: #27ae60;
    font-size: 0.75rem;
    margin-left: 5px;
    vertical-align: super;
}

.spec-flag-label {
    font-size: 0.7rem;
    color: #e67e22;
    font-style: italic;
    margin-left: 8px;
}

.spec-legend {
    display: flex;
    gap: 16px;
    padding: 6px 12px;
    margin-bottom: 8px;
    background: #f8f9fa;
    border-radius: 6px;
    font-size: 0.75rem;
    color: #666;
}

.spec-legend-item {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.spec-flagged-badge {
    display: inline-block;
    background: #fff3cd;
    color: #856404;
    font-size: 0.7rem;
    padding: 2px 8px;
    border-radius: 10px;
    border: 1px solid #ffc107;
    font-weight: 500;
}

/* Spec Edit Mode */
.btn-edit-specs {
    background: #6c757d;
    color: white;
    border: none;
    padding: 6px 14px;
    border-radius: 6px;
    font-size: 0.85rem;
    cursor: pointer;
    transition: background 0.2s;
}

.btn-edit-specs:hover {
    background: #5a6268;
}

/* Validate vs Catalog button */
.btn-validate-specs {
    background: #2980b9;
    color: white;
    border: none;
    padding: 6px 14px;
    border-radius: 6px;
    font-size: 0.85rem;
    cursor: pointer;
    transition: background 0.2s;
}

.btn-validate-specs:hover {
    background: #1a6da0;
}

.btn-validate-specs:disabled {
    background: #ccc;
    cursor: not-allowed;
}

/* Validate Modal */
.validate-modal-content {
    max-width: 750px;
}

.validate-modal-content h2 {
    margin-bottom: 4px;
}

.validate-brand {
    color: #666;
    margin-bottom: 16px;
    font-size: 0.95rem;
}

.validate-no-data {
    padding: 24px;
    text-align: center;
    color: #666;
    font-size: 1.1rem;
}

.validate-summary {
    display: flex;
    gap: 12px;
    align-items: center;
    flex-wrap: wrap;
    margin-bottom: 16px;
}

.validate-stat {
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
}

.validate-match {
    background: #d4edda;
    color: #155724;
}

.validate-mismatch {
    background: #f8d7da;
    color: #721c24;
}

.validate-missing {
    background: #fff3cd;
    color: #856404;
}

.validate-bar-container {
    flex: 1;
    min-width: 100px;
    height: 8px;
    background: #e9ecef;
    border-radius: 4px;
    overflow: hidden;
}

.validate-bar {
    height: 100%;
    border-radius: 4px;
    transition: width 0.3s;
}

.validate-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
    margin-bottom: 12px;
}

.validate-table th {
    background: #f8f9fa;
    text-align: left;
    padding: 8px 10px;
    border-bottom: 2px solid #dee2e6;
    font-weight: 600;
}

.validate-table td {
    padding: 6px 10px;
    border-bottom: 1px solid #eee;
}

.validate-row-match {
    background: #f0faf0;
}

.validate-row-mismatch {
    background: #fef0f0;
}

.validate-row-missing {
    background: #fffbf0;
}

.validate-status-cell {
    font-weight: 600;
    font-size: 0.8rem;
    white-space: nowrap;
}

.validate-row-match .validate-status-cell { color: #27ae60; }
.validate-row-mismatch .validate-status-cell { color: #e74c3c; }
.validate-row-missing .validate-status-cell { color: #f39c12; }

.validate-empty {
    color: #ccc;
}

.validate-footer {
    text-align: right;
    color: #999;
    font-size: 0.8rem;
    padding-top: 8px;
}

.spec-edit-row {
    display: flex;
    gap: 10px;
    align-items: center;
}

.spec-edit-row input {
    flex: 1;
    padding: 8px 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 0.9rem;
}

.spec-edit-row input.spec-key-input {
    flex: 0.8;
}

.spec-edit-row input.spec-value-input {
    flex: 1.2;
}

.btn-delete-spec {
    background: #dc3545;
    color: white;
    border: none;
    width: 28px;
    height: 28px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
    flex-shrink: 0;
}

.btn-delete-spec:hover {
    background: #c82333;
}

.spec-edit-actions {
    display: flex;
    gap: 10px;
    margin-top: 15px;
    justify-content: flex-end;
}

.btn-add-spec {
    background: #28a745;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 6px;
    font-size: 0.85rem;
    cursor: pointer;
    transition: background 0.2s;
}

.btn-add-spec:hover {
    background: #218838;
}

.btn-save-specs {
    background: #007bff;
    color: white;
    border: none;
    padding: 8px 20px;
    border-radius: 6px;
    font-size: 0.9rem;
    cursor: pointer;
    transition: background 0.2s;
}

.btn-save-specs:hover {
    background: #0069d9;
}

.btn-cancel-specs {
    background: #6c757d;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 6px;
    font-size: 0.9rem;
    cursor: pointer;
    transition: background 0.2s;
}

.btn-cancel-specs:hover {
    background: #5a6268;
}

/* Description Edit Mode */
.description-section {
    position: relative;
}

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

.description-header h3 {
    margin: 0;
}

.btn-edit-desc {
    background: #6c757d;
    color: white;
    border: none;
    padding: 5px 12px;
    border-radius: 4px;
    font-size: 0.8rem;
    cursor: pointer;
    transition: background 0.2s;
}

.btn-edit-desc:hover {
    background: #5a6268;
}

.desc-textarea {
    width: 100%;
    min-height: 150px;
    padding: 12px;
    border: 2px solid #3498db;
    border-radius: 6px;
    font-family: inherit;
    font-size: 0.95rem;
    line-height: 1.6;
    resize: vertical;
    background: #fff;
}

.desc-textarea:focus {
    outline: none;
    border-color: #2980b9;
}

.desc-edit-actions {
    display: flex;
    gap: 10px;
    margin-top: 10px;
    justify-content: flex-end;
}

.btn-save-desc {
    background: #007bff;
    color: white;
    border: none;
    padding: 8px 20px;
    border-radius: 6px;
    font-size: 0.9rem;
    cursor: pointer;
    transition: background 0.2s;
}

.btn-save-desc:hover {
    background: #0069d9;
}

.btn-cancel-desc {
    background: #6c757d;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 6px;
    font-size: 0.9rem;
    cursor: pointer;
    transition: background 0.2s;
}

/* Category Management */
#categoriesManager {
    border: 1px solid #ddd;
    border-radius: 8px;
    overflow: hidden;
}

.categories-tabs {
    display: flex;
    align-items: center;
    background: #f5f5f5;
    border-bottom: 1px solid #ddd;
    padding: 10px;
    gap: 8px;
    flex-wrap: wrap;
}

.category-tabs-list {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.category-tab {
    padding: 8px 16px;
    border: 1px solid #ddd;
    background: white;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.2s;
}

.category-tab:hover {
    background: #e9ecef;
}

.category-tab.active {
    background: #3498db;
    color: white;
    border-color: #3498db;
}

.btn-add-category {
    padding: 8px 16px;
    background: #28a745;
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: background 0.2s;
}

.btn-add-category:hover {
    background: #218838;
}

.category-fields-editor {
    padding: 20px;
    min-height: 200px;
}

.no-category-selected {
    color: #888;
    text-align: center;
    padding: 40px;
}

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

.category-header h4 {
    margin: 0;
    color: #333;
}

.btn-delete-category {
    background: #dc3545;
    color: white;
    border: none;
    padding: 6px 12px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.85rem;
}

.btn-delete-category:hover {
    background: #c82333;
}

.fields-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 20px;
}

.field-chip {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background: #e8f4fd;
    border: 1px solid #b8daff;
    border-radius: 20px;
    font-size: 0.9rem;
}

.field-chip.inactive {
    background: #f8f9fa;
    border-color: #dee2e6;
    color: #6c757d;
}

.field-chip .remove-field {
    background: none;
    border: none;
    color: #dc3545;
    cursor: pointer;
    padding: 0;
    font-size: 1.1rem;
    line-height: 1;
}

.field-chip .remove-field:hover {
    color: #a71d2a;
}

.add-field-section {
    border-top: 1px solid #eee;
    padding-top: 15px;
    margin-top: 15px;
}

.add-field-section h5 {
    margin: 0 0 10px 0;
    font-size: 0.95rem;
    color: #555;
}

.available-fields {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 15px;
}

.available-field {
    padding: 5px 12px;
    background: #f8f9fa;
    border: 1px dashed #ced4da;
    border-radius: 15px;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s;
}

.available-field:hover {
    background: #e8f4fd;
    border-color: #3498db;
    border-style: solid;
}

.available-field.added {
    background: #d4edda;
    border-color: #28a745;
    border-style: solid;
    cursor: default;
}

.new-field-form {
    display: flex;
    gap: 10px;
    align-items: center;
}

.new-field-form input {
    flex: 1;
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 0.9rem;
}

.new-field-form button {
    padding: 8px 16px;
    background: #6c757d;
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9rem;
}

.new-field-form button:hover {
    background: #5a6268;
}

/* Sub-Categories Section */
.subcategories-section {
    border-top: 1px solid #eee;
    padding-top: 20px;
    margin-top: 20px;
}

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

.subcategories-header h5 {
    margin: 0;
    font-size: 1rem;
    color: #333;
}

.btn-add-subcategory {
    padding: 5px 12px;
    background: #17a2b8;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.85rem;
}

.btn-add-subcategory:hover {
    background: #138496;
}

.subcategories-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.no-subcategories {
    color: #888;
    font-size: 0.9rem;
    font-style: italic;
}

.subcategory-card {
    border: 1px solid #dee2e6;
    border-radius: 6px;
    padding: 12px;
    background: #f8f9fa;
}

.subcategory-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
}

.subcategory-header strong {
    font-size: 0.95rem;
}

.subcategory-key {
    font-size: 0.8rem;
    color: #6c757d;
    background: #e9ecef;
    padding: 2px 6px;
    border-radius: 3px;
    font-family: monospace;
}

.btn-delete-sm {
    margin-left: auto;
    background: none;
    border: none;
    color: #dc3545;
    cursor: pointer;
    font-size: 1.2rem;
    line-height: 1;
    padding: 0 4px;
}

.btn-delete-sm:hover {
    color: #a71d2a;
}

.subcategory-keywords {
    margin-bottom: 8px;
}

.subcategory-keywords label {
    font-size: 0.85rem;
    color: #555;
    display: block;
    margin-bottom: 3px;
}

.subcategory-keywords input {
    width: 100%;
    padding: 5px 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 0.85rem;
}

.subcategory-extra-fields label {
    font-size: 0.85rem;
    color: #555;
    display: block;
    margin-bottom: 3px;
}

.extra-fields-list {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-bottom: 6px;
}

.subcategory-extra-field {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 8px;
    background: #d4edda;
    border: 1px solid #c3e6cb;
    border-radius: 12px;
    font-size: 0.8rem;
}

.remove-field-sm {
    background: none;
    border: none;
    color: #dc3545;
    cursor: pointer;
    padding: 0;
    font-size: 0.9rem;
    line-height: 1;
}

.no-extra-fields {
    color: #888;
    font-size: 0.8rem;
    font-style: italic;
}

.subcategory-extra-fields select {
    padding: 4px 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 0.8rem;
    background: white;
}

/* Add Category Modal */
.add-category-modal {
    max-width: 500px;
}

.add-category-modal h2 {
    margin-bottom: 20px;
}

.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 20px;
}

.form-actions .btn-cancel {
    background: #6c757d;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 6px;
    cursor: pointer;
}

.form-actions .btn-save {
    background: #28a745;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 6px;
    cursor: pointer;
}

/* Product Category Selector in Modal */
.product-category-section {
    margin-bottom: 20px;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 8px;
}

.product-category-section label {
    font-weight: 600;
    margin-bottom: 8px;
    display: block;
}

.product-category-section select {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 0.95rem;
}

.category-auto-detected {
    font-size: 0.85rem;
    color: #666;
    margin-top: 5px;
}

/* Image Lightbox */
.lightbox {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.95);
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.lightbox img {
    max-width: 90%;
    max-height: 90%;
    object-fit: contain;
    border-radius: 4px;
    box-shadow: 0 0 30px rgba(0, 0, 0, 0.5);
}

.lightbox-close {
    position: absolute;
    top: 20px;
    right: 30px;
    background: none;
    border: none;
    color: white;
    font-size: 40px;
    cursor: pointer;
    z-index: 2001;
    transition: color 0.2s;
}

.lightbox-close:hover {
    color: #e74c3c;
}

.lightbox-prev,
.lightbox-next {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: white;
    font-size: 30px;
    padding: 20px 15px;
    cursor: pointer;
    transition: background 0.2s;
    border-radius: 4px;
}

.lightbox-prev:hover,
.lightbox-next:hover {
    background: rgba(255, 255, 255, 0.25);
}

.lightbox-prev {
    left: 20px;
}

.lightbox-next {
    right: 20px;
}

.lightbox-counter {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    color: white;
    font-size: 14px;
    background: rgba(0, 0, 0, 0.5);
    padding: 8px 16px;
    border-radius: 20px;
}

/* Make gallery images clickable */
.images-gallery .image-container img {
    cursor: zoom-in;
    transition: transform 0.2s, box-shadow 0.2s;
}

.images-gallery .image-container img:hover {
    transform: scale(1.02);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

/* ================================================
   Dashboard Section
   ================================================ */
.dashboard-toggle {
    background: #3498db;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 6px;
    font-size: 0.9rem;
    cursor: pointer;
    transition: background 0.2s;
}

.dashboard-toggle:hover {
    background: #2980b9;
}

.dashboard-toggle.active {
    background: #2c3e50;
}

.dashboard-section {
    background: white;
    border-radius: 12px;
    padding: 25px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.08);
    margin-bottom: 30px;
    border: 2px solid #3498db;
}

.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 20px;
    margin-bottom: 25px;
}

.stat-card {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 10px;
    border: 1px solid #e9ecef;
    border-left: 4px solid transparent;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s, border-color 0.2s, background 0.2s;
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
}

.stat-card.active {
    border-left-color: #3498db;
    background: #eaf4fd;
}

.stat-card-info {
    cursor: default;
}

.stat-card-action .stat-value {
    color: #e67e22;
}

.stat-card-action.active {
    border-left-color: #e67e22;
    background: #fef5ec;
}

.stat-action-btn {
    position: absolute;
    top: 6px;
    right: 6px;
    padding: 2px 8px;
    font-size: 11px;
    background: #27ae60;
    color: white;
    border: none;
    border-radius: 3px;
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.2s;
}

.stat-card:hover .stat-action-btn {
    opacity: 1;
}

.stat-action-btn:hover {
    background: #219a52;
}

.stat-card {
    position: relative;
}

.dashboard-grid-actions {
    margin-top: -10px;
}

.stat-icon {
    font-size: 2rem;
}

.stat-content {
    display: flex;
    flex-direction: column;
}

.stat-value {
    font-size: 1.8rem;
    font-weight: 700;
    color: #2c3e50;
    line-height: 1.2;
}

.stat-label {
    font-size: 0.85rem;
    color: #7f8c8d;
    margin-top: 2px;
}

.dashboard-charts {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
}

.chart-card {
    background: #f8f9fa;
    border-radius: 10px;
    padding: 20px;
    border: 1px solid #e9ecef;
}

.chart-card h3 {
    margin: 0 0 15px 0;
    font-size: 1rem;
    color: #555;
}

.mini-chart {
    min-height: 150px;
}

.chart-bar {
    display: flex;
    align-items: center;
    margin-bottom: 10px;
}

.chart-bar-clickable {
    cursor: pointer;
    border-radius: 6px;
    padding: 3px 6px;
    margin-left: -6px;
    margin-right: -6px;
    transition: background 0.15s;
}

.chart-bar-clickable:hover {
    background: rgba(52, 152, 219, 0.08);
}

.chart-bar-label {
    width: 110px;
    font-size: 0.85rem;
    color: #555;
    text-transform: capitalize;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.chart-bar-fill {
    flex: 1;
    height: 24px;
    background: #e9ecef;
    border-radius: 4px;
    overflow: hidden;
    margin-right: 10px;
}

.chart-bar-value {
    height: 100%;
    background: linear-gradient(90deg, #3498db, #2ecc71);
    border-radius: 4px;
    transition: width 0.5s ease;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    min-width: fit-content;
}

.chart-bar-pct {
    font-size: 0.7rem;
    color: white;
    padding: 0 6px;
    font-weight: 600;
    text-shadow: 0 1px 1px rgba(0,0,0,0.2);
}

.chart-bar-count {
    font-size: 0.85rem;
    font-weight: 600;
    color: #333;
    min-width: 35px;
    text-align: right;
}

/* ================================================
   Bulk Actions Dropdown
   ================================================ */
.bulk-dropdown {
    position: relative;
    display: inline-block;
}

.btn-bulk-actions {
    background: #6c757d;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.95rem;
    transition: background 0.2s;
}

.btn-bulk-actions:hover {
    background: #5a6268;
}

.bulk-dropdown-content {
    display: none;
    position: absolute;
    bottom: 100%;
    left: 0;
    background: white;
    min-width: 180px;
    box-shadow: 0 -4px 15px rgba(0,0,0,0.15);
    border-radius: 8px;
    z-index: 1001;
    margin-bottom: 5px;
    overflow: hidden;
}

.bulk-dropdown-content.open {
    display: block;
}

.bulk-dropdown-content button {
    display: block;
    width: 100%;
    padding: 12px 16px;
    text-align: left;
    background: none;
    border: none;
    cursor: pointer;
    font-size: 0.9rem;
    color: #333;
    transition: background 0.2s;
}

.bulk-dropdown-content button:hover {
    background: #f8f9fa;
}

.bulk-dropdown-content button.danger {
    color: #dc3545;
}

.bulk-dropdown-content button.danger:hover {
    background: #ffeef0;
}

.bulk-dropdown-content hr {
    margin: 0;
    border: none;
    border-top: 1px solid #eee;
}

/* ================================================
   Supplier Import Button & Modal
   ================================================ */
.btn-import-supplier {
    background: #17a2b8;
    color: white;
    border: none;
    padding: 8px 14px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.85rem;
    transition: background 0.2s;
}

.btn-import-supplier:hover {
    background: #138496;
}

.supplier-import-modal {
    max-width: 700px;
}

.supplier-import-modal h2 {
    margin-bottom: 20px;
    color: #2c3e50;
}

.column-mapping {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 15px;
    margin-bottom: 20px;
}

.mapping-row {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.mapping-row label {
    font-weight: 500;
    color: #555;
    font-size: 0.9rem;
}

.mapping-row select {
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 0.9rem;
}

.supplier-preview-table-container {
    max-height: 200px;
    overflow: auto;
    border: 1px solid #e9ecef;
    border-radius: 6px;
    margin-bottom: 15px;
}

.supplier-preview-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
}

.supplier-preview-table th,
.supplier-preview-table td {
    padding: 8px 12px;
    text-align: left;
    border-bottom: 1px solid #eee;
    white-space: nowrap;
}

.supplier-preview-table th {
    background: #f8f9fa;
    font-weight: 600;
    position: sticky;
    top: 0;
}

/* Bulk Category Modal */
.bulk-category-modal {
    max-width: 400px;
}

.bulk-category-modal h2 {
    margin-bottom: 20px;
}

.bulk-category-modal select {
    width: 100%;
    padding: 12px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 1rem;
    margin-bottom: 15px;
}

/* ================================================
   Drag-and-Drop Image Reordering
   ================================================ */
.images-gallery.sortable .image-container {
    cursor: grab;
    transition: transform 0.2s;
}

.images-gallery.sortable .image-container:active {
    cursor: grabbing;
}

.images-gallery .image-container.dragging {
    opacity: 0.5;
    transform: scale(0.95);
}

.images-gallery .image-container.drag-over {
    border: 2px dashed #3498db;
    border-radius: 8px;
}

.image-drag-handle {
    position: absolute;
    top: 5px;
    left: 5px;
    background: rgba(0,0,0,0.6);
    color: white;
    width: 24px;
    height: 24px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    cursor: grab;
    opacity: 0;
    transition: opacity 0.2s;
}

.images-gallery.sortable .image-container:hover .image-drag-handle {
    opacity: 1;
}

.btn-reorder-images {
    background: #6c757d;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 6px;
    font-size: 0.9rem;
    cursor: pointer;
    transition: background 0.2s;
}

.btn-reorder-images:hover {
    background: #5a6268;
}

.btn-reorder-images.active {
    background: #3498db;
}

.image-score-badge {
    position: absolute;
    bottom: 5px;
    left: 5px;
    background: rgba(0,0,0,0.7);
    color: white;
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 500;
}

.image-score-badge.high {
    background: rgba(39, 174, 96, 0.9);
}

.image-score-badge.medium {
    background: rgba(243, 156, 18, 0.9);
}

.image-score-badge.low {
    background: rgba(231, 76, 60, 0.9);
}

/* ================================================
   Enhanced Mobile Responsive
   ================================================ */
@media (max-width: 768px) {
    .container {
        padding: 10px;
    }

    header {
        padding: 10px 14px;
        margin-bottom: 20px;
        flex-direction: row;
        flex-wrap: wrap;
        align-items: center;
        height: auto;
        row-gap: 6px;
    }

    /* Brand row: title natural width, badge sits inline beside it */
    header h1 {
        font-size: 1.2rem;
        flex: 0 0 auto;
    }

    .version-badge {
        position: static;
        font-size: 0.68rem;
        padding: 2px 7px;
        margin-left: 8px;
        flex: 0 0 auto;
    }

    /* Nav buttons: own full-width row, horizontally scrollable */
    .header-actions {
        position: static;
        margin-left: 0;
        flex: 0 0 100%;
        width: 100%;
        overflow-x: auto;
        overflow-y: hidden;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        gap: 6px;
        padding-bottom: 2px;
    }

    .header-actions::-webkit-scrollbar {
        display: none;
    }

    /* Ensure buttons meet 44px tap target */
    .settings-toggle,
    .dashboard-toggle,
    .activity-log-toggle {
        flex-shrink: 0;
        min-height: 44px;
        padding: 0 14px;
        font-size: 0.82rem;
        white-space: nowrap;
    }

    .dashboard-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }

    .stat-card {
        padding: 12px;
        flex-direction: column;
        text-align: center;
        gap: 8px;
    }

    .stat-icon {
        font-size: 1.5rem;
    }

    .stat-value {
        font-size: 1.4rem;
    }

    .stat-label {
        font-size: 0.75rem;
    }

    .dashboard-charts {
        grid-template-columns: 1fr;
    }

    .search-section,
    .results-section,
    .settings-section,
    .dashboard-section {
        padding: 15px;
        border-radius: 8px;
        margin-bottom: 20px;
    }

    .results-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .results-actions {
        flex-wrap: wrap;
        gap: 8px;
        width: 100%;
    }

    .results-actions button,
    .results-actions label {
        font-size: 0.8rem;
        padding: 8px 12px;
    }

    .search-filter {
        flex-wrap: wrap;
        width: 100%;
    }

    .search-filter input,
    .search-filter select {
        width: 100%;
    }

    .products-grid {
        grid-template-columns: 1fr;
        gap: 15px;
    }

    .modal-content {
        padding: 20px;
        margin: 10px;
        max-height: 95vh;
    }

    .product-detail .images-gallery img {
        width: 100%;
        height: auto;
        max-height: 200px;
    }

    .price-inputs {
        flex-direction: column;
        align-items: stretch;
    }

    .price-field input {
        width: 100%;
    }

    .selection-action-bar {
        flex-direction: column;
        gap: 12px;
        padding: 12px;
    }

    .selection-actions {
        flex-wrap: wrap;
        justify-content: center;
        gap: 8px;
    }

    .selection-actions button {
        padding: 8px 14px;
        font-size: 0.85rem;
    }

    .bulk-dropdown-content {
        position: fixed;
        bottom: 80px;
        left: 50%;
        transform: translateX(-50%);
        width: 90%;
        max-width: 300px;
    }

    .lightbox-prev,
    .lightbox-next {
        padding: 15px 10px;
        font-size: 24px;
    }

    .lightbox-close {
        top: 10px;
        right: 15px;
        font-size: 30px;
    }

    .column-mapping {
        grid-template-columns: 1fr;
    }

    .supplier-import-modal {
        max-width: 100%;
    }
}

@media (max-width: 480px) {
    header h1 {
        font-size: 1.5rem;
    }

    .subtitle {
        font-size: 0.9rem;
    }

    .dashboard-grid {
        grid-template-columns: 1fr;
    }

    .stat-card {
        flex-direction: row;
        text-align: left;
    }

    .search-tabs {
        flex-direction: column;
    }

    .tab-btn {
        width: 100%;
        text-align: center;
    }

    .settings-group {
        padding: 12px;
    }

    .btn-import-supplier,
    .btn-import-prices,
    .btn-standardize,
    .btn-find-all-specs {
        width: 100%;
        text-align: center;
    }

    .category-actions-dropdown {
        width: 100%;
    }

    .category-actions-content {
        width: 100%;
        position: relative;
    }
}

/* ============================================================================
   MANUFACTURER WEBSITES
   ============================================================================ */

.settings-hint {
    font-size: 0.85rem;
    color: #6c757d;
    margin-bottom: 12px;
}

.rag-upload-area {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.rag-upload-area .file-name-display {
    color: #6c757d;
    font-size: 0.9rem;
    flex: 1;
    min-width: 100px;
}

.rag-documents-list {
    max-height: 200px;
    overflow-y: auto;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    padding: 8px;
    font-size: 0.85rem;
    background: #fafafa;
}

.rag-documents-list .rag-doc-item {
    padding: 4px 0;
    border-bottom: 1px solid #eee;
    display: flex;
    align-items: center;
    gap: 6px;
}

.rag-documents-list .rag-doc-item:last-child {
    border-bottom: none;
}

.rag-documents-list .rag-doc-icon {
    color: #28a745;
    font-size: 0.8rem;
}

.manufacturer-websites-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 10px;
}

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

.manufacturer-row .mfr-brand,
.manufacturer-row .mfr-domain {
    flex: 1;
    padding: 8px 12px;
    border: 2px solid #e0e0e0;
    border-radius: 6px;
    font-size: 0.9rem;
    transition: border-color 0.2s;
}

.manufacturer-row .mfr-brand:focus,
.manufacturer-row .mfr-domain:focus {
    outline: none;
    border-color: #3498db;
}

.btn-remove-manufacturer {
    background: #dc3545;
    color: white;
    border: none;
    width: 32px;
    height: 32px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 1.1rem;
    line-height: 1;
    transition: background 0.2s;
    flex-shrink: 0;
}

.btn-remove-manufacturer:hover {
    background: #c82333;
}

.btn-add-manufacturer {
    background: #28a745;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 6px;
    font-size: 0.85rem;
    cursor: pointer;
    transition: background 0.2s;
}

.btn-add-manufacturer:hover {
    background: #218838;
}

.supplier-status-dot {
    font-size: 1rem;
    flex-shrink: 0;
    cursor: default;
    user-select: none;
}

.btn-detect-supplier {
    background: #6c757d;
    color: white;
    border: none;
    padding: 6px 10px;
    border-radius: 6px;
    font-size: 0.8rem;
    cursor: pointer;
    white-space: nowrap;
    flex-shrink: 0;
    transition: background 0.2s;
}

.btn-detect-supplier:hover {
    background: #5a6268;
}

.btn-detect-supplier:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.manufacturer-row .mfr-search-url {
    flex: 2;
    padding: 8px 12px;
    border: 2px solid #f0ad4e;
    border-radius: 6px;
    font-size: 0.85rem;
    font-family: monospace;
    transition: border-color 0.2s;
}

.manufacturer-row .mfr-search-url:focus {
    outline: none;
    border-color: #e6930a;
}

.no-items-hint {
    font-size: 0.85rem;
    color: #999;
    font-style: italic;
    padding: 8px 0;
}

/* ============================================================================
   SEO SECTION
   ============================================================================ */

.seo-section {
    margin-top: 20px;
    border-top: 1px solid #eee;
    padding-top: 15px;
}

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

.seo-header h3 {
    margin: 0;
}

.btn-generate-seo {
    background: #8e44ad;
    color: white;
    border: none;
    padding: 6px 14px;
    border-radius: 6px;
    font-size: 0.85rem;
    cursor: pointer;
    transition: background 0.2s;
}

.btn-generate-seo:hover {
    background: #7d3c98;
}

.btn-generate-seo:disabled {
    background: #bbb;
    cursor: not-allowed;
}

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

.seo-field label {
    font-size: 0.8rem;
    font-weight: 600;
    color: #666;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 4px;
    display: block;
}

.seo-preview {
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 6px;
    padding: 10px 12px;
    font-size: 0.9rem;
    line-height: 1.4;
}

.seo-title {
    color: #1a0dab;
    font-size: 1.05rem;
}

.seo-description {
    color: #545454;
    font-size: 0.85rem;
}

.seo-keywords {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.seo-keyword-tag {
    background: #e8f4fd;
    color: #2980b9;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 0.8rem;
    border: 1px solid #b8daff;
}

.seo-lang-label {
    margin-top: 8px;
}

.seo-lang-badge {
    display: inline-block;
    background: #3498db;
    color: white;
    padding: 1px 6px;
    border-radius: 3px;
    font-size: 0.65rem;
    font-weight: 700;
    letter-spacing: 0.5px;
    vertical-align: middle;
    margin-left: 4px;
}

.seo-preview.seo-translated {
    background: #f0f7ff;
    border-color: #b8daff;
    border-left: 3px solid #3498db;
}

.seo-keyword-tag.seo-keyword-fr {
    background: #e8f0fe;
    color: #1a73e8;
    border-color: #a8c7fa;
}

.no-seo-hint {
    font-size: 0.85rem;
    color: #999;
    font-style: italic;
    padding: 8px 0;
}

/* ============================================================================
   ACTIVITY LOG
   ============================================================================ */

.activity-log-toggle {
    background: #3498db;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 6px;
    font-size: 0.9rem;
    cursor: pointer;
    transition: background 0.2s;
}

.activity-log-toggle:hover {
    background: #2980b9;
}

.activity-log-toggle.active {
    background: #2c3e50;
}

.activity-log-section {
    background: white;
    border-radius: 12px;
    padding: 25px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.08);
    margin-bottom: 30px;
    border: 2px solid #3498db;
}

.activity-log-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    flex-wrap: wrap;
    gap: 10px;
}

.activity-log-header h2 {
    margin: 0;
}

.activity-log-controls {
    display: flex;
    gap: 8px;
    align-items: center;
}

.activity-log-controls select {
    padding: 6px 12px;
    border: 2px solid #e0e0e0;
    border-radius: 6px;
    font-size: 0.85rem;
    background: white;
    cursor: pointer;
}

.activity-log-controls select:focus {
    outline: none;
    border-color: #3498db;
}

.btn-refresh-activity {
    background: #6c757d;
    color: white;
    border: none;
    padding: 6px 14px;
    border-radius: 6px;
    font-size: 0.85rem;
    cursor: pointer;
    transition: background 0.2s;
}

.btn-refresh-activity:hover {
    background: #5a6268;
}

.activity-log-list {
    max-height: 600px;
    overflow-y: auto;
}

.activity-entry {
    padding: 10px 14px;
    border-radius: 8px;
    margin-bottom: 6px;
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    transition: background 0.15s;
}

.activity-entry:hover {
    background: #f0f1f3;
}

.activity-entry.activity-error {
    background: #fff5f5;
    border-color: #f5c6cb;
}

.activity-entry.activity-search {
    border-left: 3px solid #28a745;
}

.activity-entry.activity-ai {
    border-left: 3px solid #ffc107;
}

.activity-entry.activity-images {
    border-left: 3px solid #17a2b8;
}

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

.activity-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

.badge-search {
    background: #d4edda;
    color: #155724;
}

.badge-success {
    background: #c3e6cb;
    color: #155724;
}

.badge-ai {
    background: #fff3cd;
    color: #856404;
}

.badge-images {
    background: #d1ecf1;
    color: #0c5460;
}

.badge-error {
    background: #f8d7da;
    color: #721c24;
}

.badge-default {
    background: #e2e3e5;
    color: #383d41;
}

.activity-time {
    font-size: 0.75rem;
    color: #999;
}

.activity-username {
    font-size: 0.7rem;
    font-weight: 600;
    color: #555;
    background: #e8e8e8;
    padding: 1px 6px;
    border-radius: 3px;
    margin-left: 4px;
}

.activity-details {
    font-size: 0.85rem;
    color: #555;
    line-height: 1.4;
}

.activity-details strong {
    color: #333;
}

.activity-expandable .activity-entry-header {
    cursor: pointer;
    user-select: none;
}

.activity-expand-icon {
    font-size: 0.65rem;
    color: #aaa;
    margin-left: auto;
    padding-left: 8px;
    flex-shrink: 0;
}

.activity-expanded {
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid #e0e0e0;
    font-size: 0.82rem;
    color: #444;
}

.activity-detail-section {
    margin-bottom: 10px;
}

.activity-detail-section strong {
    display: block;
    margin-bottom: 4px;
    color: #333;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.activity-detail-section ul {
    margin: 0;
    padding-left: 16px;
    list-style: disc;
}

.activity-detail-section ul li {
    margin-bottom: 2px;
    word-break: break-all;
}

.activity-detail-section a {
    color: #0066cc;
    text-decoration: none;
}

.activity-detail-section a:hover {
    text-decoration: underline;
}

.activity-detail-rag {
    color: #8e44ad;
    font-style: italic;
}

.activity-specs-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.8rem;
}

.activity-specs-table td {
    padding: 3px 6px;
    border-bottom: 1px solid #eee;
    vertical-align: top;
}

.activity-specs-table td:first-child {
    color: #666;
    white-space: nowrap;
    width: 40%;
    font-weight: 500;
}

.btn-load-more {
    display: block;
    width: 100%;
    padding: 10px;
    margin-top: 10px;
    background: #f8f9fa;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s;
    color: #555;
}

.btn-load-more:hover {
    background: #e9ecef;
    border-color: #3498db;
    color: #3498db;
}

.no-activity {
    text-align: center;
    color: #999;
    padding: 20px;
    font-style: italic;
}

.error-text {
    text-align: center;
    color: #dc3545;
    padding: 10px;
}

/* Per-product activity in modal */
.product-activity-section {
    margin-top: 20px;
    border-top: 1px solid #eee;
    padding-top: 15px;
}

.product-activity-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    padding: 6px 0;
    user-select: none;
}

.product-activity-header h3 {
    margin: 0;
    font-size: 1rem;
    color: #555;
}

.toggle-arrow {
    font-size: 0.8rem;
    color: #999;
    transition: transform 0.2s;
}

.product-activity-list {
    max-height: 300px;
    overflow-y: auto;
    margin-top: 10px;
}

.product-activity-list .activity-entry {
    padding: 8px 12px;
    margin-bottom: 4px;
    font-size: 0.85rem;
}

/* =============================================================================
   FEATURE 1: DUPLICATE IMAGE DETECTION
   ============================================================================= */

.btn-find-duplicates {
    background: #8e44ad;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.85rem;
}

.btn-find-duplicates:hover {
    background: #7d3c98;
}

.duplicate-images-modal {
    max-width: 900px;
    max-height: 85vh;
    overflow-y: auto;
}

.duplicate-summary {
    margin-bottom: 20px;
    color: #555;
}

.no-duplicates {
    text-align: center;
    color: #27ae60;
    padding: 40px;
    font-size: 1.1rem;
}

.duplicate-group {
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 16px;
    margin-bottom: 16px;
    background: #fafafa;
}

.duplicate-group h4 {
    margin-bottom: 12px;
    color: #333;
    font-size: 0.95rem;
}

.duplicate-images-row {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
}

.duplicate-image-item {
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    padding: 8px;
    text-align: center;
    width: 160px;
}

.duplicate-image-item.keep {
    border-color: #27ae60;
    background: #eafaf1;
}

.duplicate-image-item.removable {
    border-color: #e74c3c;
    background: #fdf2f2;
}

.duplicate-image-item img {
    width: 140px;
    height: 140px;
    object-fit: contain;
    border-radius: 4px;
    background: white;
}

.duplicate-image-info {
    margin-top: 8px;
    font-size: 0.8rem;
}

.duplicate-product-name {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    margin-bottom: 4px;
}

.keep-badge {
    background: #27ae60;
    color: white;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 0.75rem;
}

.duplicate-group-hint {
    font-size: 0.85rem;
    color: #666;
    margin-bottom: 8px;
}

.duplicate-image-item label {
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 0.8rem;
}

.dup-keep-radio:checked + .duplicate-image-item,
.duplicate-image-item:has(.dup-keep-radio:checked) {
    border-color: #27ae60;
    box-shadow: 0 0 0 2px rgba(39, 174, 96, 0.3);
}

/* =============================================================================
   FEATURE 2: BULK EDIT MODAL
   ============================================================================= */

.bulk-edit-modal {
    max-width: 700px;
}

.bulk-edit-hint {
    color: #666;
    margin-bottom: 16px;
    font-size: 0.9rem;
}

.bulk-edit-fields {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-bottom: 20px;
}

.bulk-edit-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.bulk-edit-field.full-width {
    grid-column: 1 / -1;
}

.bulk-edit-field label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
}

.bulk-edit-field input[type="text"],
.bulk-edit-field input[type="number"],
.bulk-edit-field select,
.bulk-edit-field textarea {
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 0.9rem;
}

.bulk-edit-field input:disabled,
.bulk-edit-field select:disabled,
.bulk-edit-field textarea:disabled {
    background: #f5f5f5;
    color: #999;
}

.bulk-edit-progress {
    margin: 16px 0;
    text-align: center;
}

/* =============================================================================
   FEATURE 3: EXPORT RETRY
   ============================================================================= */

.btn-retry-export {
    background: #e67e22;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.95rem;
    font-weight: 500;
}

.btn-retry-export:hover {
    background: #d35400;
}

/* =============================================================================
   FEATURE 5: SPEC EXTRACTION FROM IMAGES
   ============================================================================= */

.extract-specs-btn {
    position: absolute;
    bottom: 4px;
    left: 4px;
    background: rgba(52, 152, 219, 0.9);
    color: white;
    border: none;
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 0.7rem;
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.2s;
}

.image-container:hover .extract-specs-btn {
    opacity: 1;
}

.extract-specs-btn:hover {
    background: rgba(41, 128, 185, 1);
}

.image-source-link {
    display: block;
    text-align: center;
    font-size: 0.72rem;
    font-weight: 600;
    color: #fff;
    background: rgba(44, 62, 80, 0.75);
    text-decoration: none;
    padding: 3px 8px;
    border-radius: 0 0 6px 6px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 200px;
    letter-spacing: 0.01em;
    transition: background 0.2s;
}

.image-source-link:hover {
    background: rgba(52, 152, 219, 0.9);
    text-decoration: none;
}

.image-source-unknown {
    background: rgba(150, 150, 150, 0.5);
    cursor: default;
}

.extracted-specs-review {
    background: #f8f9fa;
    border: 2px solid #3498db;
    border-radius: 8px;
    padding: 16px;
    margin: 16px 0;
}

.extracted-specs-review h4 {
    color: #2980b9;
    margin-bottom: 8px;
}

.specs-review-table {
    width: 100%;
    border-collapse: collapse;
    margin: 12px 0;
}

.specs-review-table th,
.specs-review-table td {
    padding: 6px 10px;
    border: 1px solid #ddd;
    text-align: left;
}

.specs-review-table th {
    background: #ecf0f1;
    font-size: 0.85rem;
}

.specs-review-table input[type="text"] {
    width: 100%;
    padding: 4px 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 0.85rem;
}

.specs-review-table input[type="checkbox"] {
    width: 16px;
    height: 16px;
}

/* =============================================================================
   SUPPLIER CATALOGS
   ============================================================================= */

.catalogs-list {
    margin-bottom: 15px;
}

.no-catalogs {
    color: #95a5a6;
    font-size: 0.9rem;
    font-style: italic;
}

.catalog-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 12px;
    background: white;
    border-radius: 6px;
    margin-bottom: 6px;
    border: 1px solid #e9ecef;
}

.catalog-info strong {
    display: block;
    font-size: 0.95rem;
}

.catalog-meta {
    font-size: 0.8rem;
    color: #7f8c8d;
}

.catalog-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.catalog-status {
    font-size: 0.75rem;
    padding: 2px 8px;
    border-radius: 10px;
    font-weight: 600;
    text-transform: uppercase;
}

.catalog-ready { background: #d4edda; color: #155724; }
.catalog-error { background: #f8d7da; color: #721c24; }
.catalog-processing { background: #fff3cd; color: #856404; }

.btn-view-catalog, .btn-delete-catalog {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1rem;
    padding: 2px 4px;
    border-radius: 4px;
}

.btn-view-catalog:hover { background: #e3f2fd; }
.btn-delete-catalog:hover { background: #fce4ec; }

.catalog-upload-form {
    margin-top: 10px;
}

.catalog-upload-fields {
    display: flex;
    gap: 8px;
    margin-bottom: 8px;
    flex-wrap: wrap;
}

.catalog-input {
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 5px;
    font-size: 0.9rem;
    flex: 1;
    min-width: 150px;
}

.catalog-file-input {
    font-size: 0.9rem;
    flex: 1;
    min-width: 200px;
}

.catalog-upload-progress {
    margin-top: 10px;
    padding: 10px;
    background: #f8f9fa;
    border-radius: 6px;
}

.catalog-progress-bar-bg {
    background: #e9ecef;
    border-radius: 4px;
    height: 8px;
    overflow: hidden;
    margin-bottom: 6px;
}

.catalog-progress-bar-fill {
    background: #3498db;
    height: 100%;
    border-radius: 4px;
    transition: width 0.3s ease;
}

.catalog-progress-text {
    font-size: 0.85rem;
    color: #555;
}

/* Catalog products modal */
.catalog-products-modal {
    max-width: 1000px;
    max-height: 80vh;
    overflow-y: auto;
}

.catalog-products-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
    margin-top: 10px;
}

.catalog-products-table th,
.catalog-products-table td {
    padding: 6px 10px;
    border-bottom: 1px solid #eee;
    text-align: left;
}

.catalog-products-table th {
    background: #f8f9fa;
    font-weight: 600;
    position: sticky;
    top: 0;
}

.catalog-products-table tr:hover {
    background: #f0f7ff;
}

.catalog-more {
    text-align: center;
    color: #7f8c8d;
    font-size: 0.85rem;
    margin-top: 10px;
}

.catalog-row-matched {
    background: #f0fff4;
}

.catalog-match-badge {
    display: inline-block;
    background: #27ae60;
    color: white;
    font-size: 0.7rem;
    padding: 1px 6px;
    border-radius: 8px;
    margin-left: 4px;
}

.btn-reprocess-one {
    background: #3498db;
    color: white;
    border: none;
    border-radius: 4px;
    padding: 3px 8px;
    cursor: pointer;
    font-size: 0.8rem;
}
.btn-reprocess-one:hover { background: #2980b9; }
.btn-reprocess-one:disabled { opacity: 0.6; cursor: not-allowed; }
.btn-reprocess-one.btn-success { background: #27ae60; }
.btn-reprocess-one.btn-error { background: #e74c3c; }

.btn-reprocess-matched {
    background: #3498db;
    color: white;
    border: none;
    border-radius: 6px;
    padding: 8px 16px;
    cursor: pointer;
    font-size: 0.9rem;
    margin: 10px 0;
}
.btn-reprocess-matched:hover { background: #2980b9; }
.btn-reprocess-matched:disabled { opacity: 0.6; cursor: not-allowed; }

/* ============================================================
   MODERN DESIGN OVERRIDES
   All rules below use design tokens and override/upgrade the
   legacy flat styles above without removing them.
   ============================================================ */

/* --- Global ------------------------------------------------- */
body {
    background-color: var(--c-bg);
    color: var(--c-text);
    font-family: -apple-system, BlinkMacSystemFont, 'Inter', 'Segoe UI', Roboto, sans-serif;
}

/* --- Header / Navbar --------------------------------------- */
header {
    position: sticky;
    top: 0;
    z-index: 200;
    background: var(--c-header-bg);
    color: #e2e8f0;
    display: flex;
    align-items: center;
    padding: 0 24px;
    height: var(--header-h);
    margin-bottom: 0;
    text-align: left;
    box-shadow: 0 2px 10px rgba(0,0,0,0.30);
    border-bottom: 1px solid var(--c-header-border);
}

header h1 {
    font-size: 1.2rem;
    color: #f1f5f9;
    margin-bottom: 0;
    font-weight: 700;
    letter-spacing: -0.01em;
    flex-shrink: 0;
}

.subtitle {
    display: none; /* hide in navbar — shown on small screens via the search section */
}

.version-badge {
    position: static;
    background: rgba(99,102,241,0.30);
    color: #c7d2fe;
    border: 1px solid rgba(99,102,241,0.40);
    padding: 2px 8px;
    border-radius: 20px;
    font-size: 0.72rem;
    font-weight: 600;
    margin-left: 10px;
    letter-spacing: 0.02em;
    flex-shrink: 0;
}

/* Push nav buttons to the far right */
.header-actions {
    position: static;
    margin-left: auto;
    display: flex;
    gap: 6px;
    align-items: center;
}

/* Nav toggle buttons — unified pill style */
.settings-toggle,
.dashboard-toggle,
.activity-log-toggle {
    background: transparent;
    color: #94a3b8;
    border: 1px solid #334155;
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 0.82rem;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.settings-toggle:hover,
.dashboard-toggle:hover,
.activity-log-toggle:hover {
    background: #1e293b;
    color: #e2e8f0;
    border-color: #475569;
}

.settings-toggle.active {
    background: var(--c-primary);
    color: #fff;
    border-color: var(--c-primary);
}

.dashboard-toggle.active,
.activity-log-toggle.active {
    background: #1e40af;
    color: #fff;
    border-color: #1e40af;
}

/* Container top-padding compensates for sticky header */
.container {
    padding-top: 24px;
}

/* --- Service Status Bar ------------------------------------- */
.service-status-bar {
    margin: 0 0 20px;
    background: var(--c-surface);
    border: 1px solid var(--c-border);
    border-radius: var(--r-lg);
    box-shadow: var(--shadow-xs);
    padding: 8px 20px;
}

/* --- Section cards (search, results, settings, dashboard, activity) */
.search-section,
.results-section,
.settings-section,
.dashboard-section,
.activity-log-section {
    border-radius: var(--r-lg);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--c-border);
}

/* Override the heavy blue section borders */
.settings-section,
.dashboard-section,
.activity-log-section {
    border: 1px solid var(--c-border);
}

.search-section h2,
.results-section h2,
.settings-section h2,
.dashboard-section h2,
.activity-log-section h2 {
    color: var(--c-text);
    font-size: 1.05rem;
    font-weight: 700;
}

/* --- Primary action button ---------------------------------- */
button[type="submit"],
.btn-primary {
    background: var(--c-primary);
    border-radius: var(--r-md);
    font-weight: 600;
    letter-spacing: 0.01em;
    transition: background 0.15s, transform 0.1s, box-shadow 0.15s;
    box-shadow: 0 1px 4px rgba(79,70,229,0.25);
}

button[type="submit"]:hover:not(:disabled),
.btn-primary:hover:not(:disabled) {
    background: var(--c-primary-hover);
    box-shadow: 0 3px 10px rgba(79,70,229,0.30);
}

button[type="submit"]:active:not(:disabled) {
    transform: scale(0.98);
}

/* --- Save / success buttons --------------------------------- */
.btn-save,
.process-csv-btn {
    background: var(--c-success);
    border-radius: var(--r-md);
    font-weight: 600;
    transition: background 0.15s;
}

.btn-save:hover,
.process-csv-btn:hover:not(:disabled) {
    background: var(--c-success-hover);
}

/* --- Stat cards -------------------------------------------- */
.stat-card {
    background: var(--c-surface);
    border: 1px solid var(--c-border);
    border-left-width: 4px;
    border-radius: var(--r-md);
    box-shadow: var(--shadow-xs);
    gap: 14px;
    transition: transform 0.15s, box-shadow 0.15s, border-color 0.15s, background 0.15s;
}

.stat-card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

/* default neutral left-border accent */
.stat-card {
    border-left-color: var(--c-border-strong);
}

/* primary/info stat */
.stat-card[data-stat="total"],
.stat-card[data-stat="exported"],
.stat-card[data-stat="categories"],
.stat-card[data-stat="added_week"] {
    border-left-color: var(--c-primary);
}

.stat-card[data-stat="total"]:hover,
.stat-card[data-stat="exported"]:hover,
.stat-card[data-stat="added_week"]:hover {
    background: var(--c-primary-light);
}

.stat-card[data-stat="total"].active,
.stat-card[data-stat="exported"].active,
.stat-card[data-stat="added_week"].active {
    background: var(--c-primary-light);
    border-left-color: var(--c-primary);
}

/* action stat cards — amber accent */
.stat-card-action {
    border-left-color: var(--c-warning) !important;
}

.stat-card-action:hover {
    background: var(--c-warning-light) !important;
}

.stat-card-action.active {
    background: var(--c-warning-light) !important;
    border-left-color: var(--c-warning) !important;
}

/* quality stat cards — green accent */
.stat-card-quality {
    border-left-color: var(--c-success) !important;
}

.stat-card-quality:hover {
    background: var(--c-success-light) !important;
}

.stat-card-quality.active {
    background: var(--c-success-light) !important;
    border-left-color: var(--c-success) !important;
}

.stat-icon {
    font-size: 1.7rem;
    line-height: 1;
    opacity: 0.85;
}

.stat-value {
    font-size: 1.65rem;
    font-weight: 800;
    color: var(--c-text);
    line-height: 1;
    letter-spacing: -0.02em;
}

.stat-card-action .stat-value {
    color: var(--c-warning);
}

.stat-card-quality .stat-value {
    color: var(--c-success);
}

.stat-label {
    font-size: 0.78rem;
    color: var(--c-text-muted);
    font-weight: 500;
    margin-top: 3px;
    letter-spacing: 0.01em;
}

/* --- Product cards ----------------------------------------- */
.product-card {
    background: var(--c-surface);
    border: 1px solid var(--c-border);
    border-radius: var(--r-md);
    box-shadow: var(--shadow-xs);
    transition: transform 0.15s, box-shadow 0.15s, border-color 0.15s;
}

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

.product-card h3 {
    color: var(--c-text);
    font-size: 0.95rem;
    font-weight: 600;
    line-height: 1.4;
}

.product-card .brand {
    color: var(--c-primary);
    font-weight: 600;
    font-size: 0.82rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.product-card .meta {
    color: var(--c-text-muted);
    font-size: 0.8rem;
}

.product-card .preview-image {
    border-radius: var(--r-sm);
    background: var(--c-surface-2);
    border: 1px solid var(--c-border);
}

/* --- Status & quality badges -------------------------------- */
.status.completed {
    background: var(--c-success-light);
    color: var(--c-success);
    font-weight: 600;
}

.status.processing {
    background: var(--c-warning-light);
    color: var(--c-warning);
    font-weight: 600;
}

.status.error {
    background: var(--c-danger-light);
    color: var(--c-danger);
    font-weight: 600;
}

.quality-badge.quality-excellent {
    background: var(--c-success-light);
    color: var(--c-success);
    font-weight: 700;
}

.quality-badge.quality-good {
    background: var(--c-warning-light);
    color: var(--c-warning);
    font-weight: 700;
}

.quality-badge.quality-needs-work {
    background: var(--c-danger-light);
    color: var(--c-danger);
    font-weight: 700;
}

/* --- Inputs & selects --------------------------------------- */
.form-group input,
.form-group select,
.search-filter input,
.search-filter select {
    border-color: var(--c-border);
    border-radius: var(--r-sm);
    background: var(--c-surface);
    color: var(--c-text);
    transition: border-color 0.15s, box-shadow 0.15s;
}

.form-group input:focus,
.form-group select:focus,
.search-filter input:focus,
.search-filter select:focus {
    border-color: var(--c-primary);
    box-shadow: 0 0 0 3px rgba(79,70,229,0.12);
    outline: none;
}

/* --- Settings groups ---------------------------------------- */
.settings-group {
    background: var(--c-surface-2);
    border: 1px solid var(--c-border);
    border-radius: var(--r-md);
}

.settings-group h3 {
    color: var(--c-primary);
    font-size: 0.88rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-bottom-color: var(--c-border);
}

/* --- Pagination -------------------------------------------- */
.pagination-btn.active {
    background: var(--c-primary);
    border-color: var(--c-primary);
}

.pagination-btn:hover:not(:disabled):not(.active) {
    border-color: var(--c-primary-muted);
    color: var(--c-primary);
}

/* --- Search section tabs ------------------------------------ */
.tab-btn.active {
    color: var(--c-primary);
    background: var(--c-primary-light);
    font-weight: 600;
}

.tab-btn:hover {
    color: var(--c-primary);
}

/* --- Progress bar ------------------------------------------ */
.progress-fill {
    background: var(--c-primary);
}

/* --- Chart cards ------------------------------------------- */
.chart-card {
    background: var(--c-surface);
    border: 1px solid var(--c-border);
    border-radius: var(--r-md);
    box-shadow: var(--shadow-xs);
}

/* --- Modal -------------------------------------------------- */
.modal-content {
    border-radius: var(--r-lg);
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--c-border);
}

/* --- No-data warning ---------------------------------------- */
.no-data-warning {
    background: var(--c-warning-light);
    color: var(--c-warning);
    border-color: #fbbf24;
    border-radius: var(--r-md);
}

/* --- Product price ------------------------------------------ */
.product-price {
    color: var(--c-success);
    font-weight: 700;
}

/* --- Scrollbar polish (webkit) ----------------------------- */
::-webkit-scrollbar { width: 7px; height: 7px; }
::-webkit-scrollbar-track { background: var(--c-surface-2); }
::-webkit-scrollbar-thumb { background: var(--c-border-strong); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--c-text-faint); }

/* ============================================================
   Mobile header overrides (dark navbar theme)
   These come after the theme overrides so they take effect.
   ============================================================ */
@media (max-width: 768px) {
    /* Stack header: brand row + nav row using wrap */
    header {
        flex-direction: row;
        flex-wrap: wrap;
        align-items: center;
        height: auto;
        padding: 10px 14px;
        gap: 0;
        row-gap: 6px;
    }

    /* h1: natural width so badge can sit beside it */
    header h1 {
        font-size: 1.1rem;
        flex: 0 0 auto;
    }

    /* Badge inline with h1 on the same row */
    .version-badge {
        position: static;
        margin-left: 8px;
        flex: 0 0 auto;
    }

    /* Nav buttons: pushed to their own full-width row, horizontally scrollable */
    .header-actions {
        position: static;
        margin-left: 0;
        flex: 0 0 100%;
        width: 100%;
        overflow-x: auto;
        overflow-y: hidden;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        flex-wrap: nowrap;
        padding-bottom: 2px;
        padding-top: 2px;
    }

    .header-actions::-webkit-scrollbar {
        display: none;
    }

    /* 44px tap targets for nav buttons */
    .settings-toggle,
    .dashboard-toggle,
    .activity-log-toggle {
        flex-shrink: 0;
        min-height: 44px;
        padding: 0 14px;
        white-space: nowrap;
    }

    /* Status bar: horizontally scrollable, single row */
    .service-status-bar {
        padding: 4px 12px;
        border-radius: 6px;
    }

    .status-indicators {
        flex-wrap: nowrap;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        justify-content: flex-start;
        gap: 12px;
        padding-bottom: 2px;
    }

    .status-indicators::-webkit-scrollbar {
        display: none;
    }

    .status-indicator {
        flex-shrink: 0;
        font-size: 0.72rem;
        min-height: 28px;
    }
}
