﻿```css
:root {
    --primary: #2563eb;
    --primary-hover: #1d4ed8;
    --secondary: #475569;
    --bg-color: #f8fafc;
    --border: #e2e8f0;
    --text-main: #0f172a;
    --text-muted: #64748b;
    --danger: #ef4444;
    --success: #10b981;
    --font-stack: system-ui, -apple-system, sans-serif;
}

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

body {
    font-family: var(--font-stack);
    background: var(--bg-color);
    color: var(--text-main);
}

/* MAIN LAYOUT */

.app-container {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.controls-panel {
    width: 100%;
    max-width: 450px;
    background: #fff;
    border-right: 1px solid var(--border);
    overflow-y: auto;
    padding: 1.25rem;
    box-shadow: 2px 0 10px rgba(0,0,0,0.05);
    z-index: 10;
}

@media (min-width: 768px) {
    .app-container {
        flex-direction: row;
        height: 100vh;
        overflow: hidden;
    }

    .controls-panel {
        flex-shrink: 0;
        height: 100%;
    }
}

.app-header h1 {
    font-size: 1.3rem;
    margin-bottom: 0.25rem;
}

.app-header p {
    font-size: 0.875rem;
    color: var(--text-muted);
    margin-bottom: 1.5rem;
}

/* CONTROL GROUPS */

.control-group {
    background: #fdfdfd;
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 1rem;
    margin-bottom: 1.25rem;
}

.control-group h2 {
    font-size: 1rem;
    margin-bottom: 1rem;
    color: var(--primary);
    border-bottom: 1px solid var(--border);
    padding-bottom: 0.5rem;
}

/* FORMS */

.form-group {
    margin-bottom: 0.85rem;
}

.form-group label {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    margin-bottom: 0.3rem;
}

.form-group input,
.form-group textarea,
.form-group select,
.category-adder input,
.product-filters input,
.product-filters select {
    width: 100%;
    padding: 0.65rem;
    border: 1px solid var(--border);
    border-radius: 5px;
    font-family: inherit;
    font-size: 0.9rem;
    background: #fff;
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--primary);
}

.text-muted {
    color: var(--text-muted);
    font-size: 0.75rem;
}

.text-center {
    text-align: center;
}

/* BUTTONS */

.btn {
    display: inline-block;
    padding: 0.6rem 1rem;
    border-radius: 5px;
    border: none;
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    text-align: center;
    transition: 0.2s;
    font-family: inherit;
}

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

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

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

.btn.outline {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-main);
}

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

.btn.small {
    padding: 0.35rem 0.6rem;
    font-size: 0.75rem;
}

.button-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.full-width {
    width: 100%;
}

.mt-2 {
    margin-top: 0.75rem;
}

.upload-btn {
    cursor: pointer;
    display: block;
    text-align: center;
}

.status-message {
    font-size: 0.85rem;
    margin-top: 0.5rem;
    text-align: center;
    padding: 0.5rem;
    border-radius: 4px;
    display: none;
}

.status-message.success {
    background: #d1fae5;
    color: #065f46;
    display: block;
}

.status-message.error {
    background: #fee2e2;
    color: #991b1b;
    display: block;
}

.status-message.warning {
    background: #fef3c7;
    color: #92400e;
    display: block;
}

/* LISTS */

.category-adder {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}

.category-adder input {
    flex: 1;
}

.item-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    max-height: 300px;
    overflow-y: auto;
}

.item-li {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem;
    border: 1px solid var(--border);
    border-radius: 5px;
    background: #fff;
}

.item-li-info {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex: 1;
    min-width: 0;
}

.item-li-thumb {
    width: 40px;
    height: 40px;
    object-fit: cover;
    border-radius: 4px;
    background: #eee;
    flex-shrink: 0;
}

.item-li-title {
    font-size: 0.85rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.item-actions {
    display: flex;
    gap: 0.25rem;
    flex-shrink: 0;
}

.product-filters {
    display: flex;
    gap: 0.5rem;
}

.product-filters input,
.product-filters select {
    flex: 1;
    min-width: 0;
}

/* IMAGE PREVIEW */

.img-preview {
    margin-top: 0.5rem;
    width: 100px;
    height: 100px;
    border-radius: 5px;
    overflow: hidden;
    background: #eee;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--border);
}

.img-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.hidden {
    display: none !important;
}

/* MODAL */

.modal {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.55);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 100;
    padding: 1rem;
}

.modal.hidden {
    display: none;
}

.modal-content {
    background: #fff;
    padding: 1.5rem;
    border-radius: 10px;
    width: 100%;
    max-width: 450px;
    max-height: 90vh;
    overflow-y: auto;
}

.modal-content h2 {
    margin-bottom: 1rem;
    font-size: 1.25rem;
}

.modal-actions {
    display: flex;
    gap: 0.5rem;
    margin-top: 1rem;
}

.modal-actions button {
    flex: 1;
}

/* LIVE PREVIEW PANEL */

.preview-panel {
    flex: 1;
    min-width: 0;
    background: #e2e8f0;
    display: flex;
    flex-direction: column;
    padding: 1rem;
    min-height: 600px;
}

.preview-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.preview-header h2 {
    font-size: 1.1rem;
}

.preview-badge {
    background: var(--success);
    color: #fff;
    padding: 0.25rem 0.75rem;
    border-radius: 99px;
    font-size: 0.75rem;
    font-weight: bold;
}

.preview-frame-container {
    flex: 1;
    min-height: 500px;
    background: #fff;
    border-radius: 8px;
    border: 1px solid #cbd5e1;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
    overflow-y: auto;
    position: relative;
}

#catalog-preview {
    min-height: 100%;
    padding: 2rem;
}

/* CATALOG HEADER */

.ct-empty-state {
    text-align: center;
    color: #888;
    padding: 3rem 1rem;
    font-style: italic;
}

.ct-header {
    text-align: center;
    margin-bottom: 2rem;
    padding-bottom: 1.5rem;
}

.ct-logo {
    max-height: 100px;
    max-width: 200px;
    margin-bottom: 1rem;
    border-radius: 8px;
    object-fit: contain;
}

.ct-shop-name {
    font-size: 2rem;
    margin-bottom: 0.5rem;
    word-break: break-word;
}

.ct-contact-info {
    font-size: 0.9rem;
    color: #555;
    margin-bottom: 1rem;
}

.ct-title {
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
    font-weight: bold;
    word-break: break-word;
}

.ct-desc {
    font-size: 1rem;
    color: #666;
    max-width: 600px;
    margin: 0 auto;
    white-space: pre-line;
    word-break: break-word;
}

/* PRODUCT GRID */

.ct-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 1.5rem;
}

.ct-card {
    background: #fff;
    border-radius: 8px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.ct-card-img {
    width: 100%;
    height: 200px;
    object-fit: cover;
    background: #f9f9f9;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #aaa;
}

.ct-card-body {
    padding: 1rem;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.ct-badge {
    font-size: 0.7rem;
    text-transform: uppercase;
    background: #eee;
    padding: 2px 6px;
    border-radius: 4px;
    width: fit-content;
    margin-bottom: 0.5rem;
}

.ct-card-title {
    font-size: 1.1rem;
    margin-bottom: 0.25rem;
    font-weight: 600;
    word-break: break-word;
}

.ct-card-code {
    font-size: 0.75rem;
    color: #888;
    margin-bottom: 0.5rem;
}

.ct-card-desc {
    font-size: 0.85rem;
    color: #666;
    flex: 1;
    margin-bottom: 1rem;
    white-space: pre-line;
    word-break: break-word;
}

.ct-card-bottom {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: auto;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.ct-price {
    font-size: 1.2rem;
    font-weight: bold;
    color: #111;
}

/* CUSTOMER ORDER BUTTONS */

.ct-order-actions {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-top: 0.75rem;
}

.ct-wa-btn,
.ct-cart-add-btn,
.ct-checkout-btn {
    display: inline-flex;
    justify-content: center;
    align-items: center;
    text-decoration: none;
    border: none;
    border-radius: 5px;
    padding: 0.65rem 0.8rem;
    font-size: 0.85rem;
    font-weight: 700;
    text-align: center;
    cursor: pointer;
    width: 100%;
    font-family: inherit;
}

.ct-wa-btn {
    background: #25D366;
    color: #fff;
}

.ct-wa-btn:hover {
    background: #20b858;
}

.ct-cart-add-btn {
    background: #2563eb;
    color: #fff;
}

.ct-cart-add-btn:hover {
    background: #1d4ed8;
}

/* CART BAR */

.ct-cart-bar {
    position: sticky;
    top: 0;
    z-index: 20;
    background: #0f172a;
    color: #fff;
    padding: 0.85rem 1rem;
    border-radius: 8px;
    margin-bottom: 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.ct-cart-info {
    font-size: 0.9rem;
    font-weight: 600;
}

.ct-cart-open-btn {
    background: #25D366;
    color: #fff;
    border: none;
    border-radius: 5px;
    padding: 0.6rem 1rem;
    font-weight: 700;
    cursor: pointer;
}

/* CART PANEL */

.ct-cart-panel {
    position: fixed;
    inset: 0;
    z-index: 9999;
    background: rgba(0,0,0,0.6);
    display: flex;
    justify-content: flex-end;
}

.ct-cart-panel[hidden] {
    display: none !important;
}

.ct-cart-content {
    width: 100%;
    max-width: 440px;
    height: 100%;
    background: #fff;
    display: flex;
    flex-direction: column;
    padding: 1rem;
    overflow: hidden;
}

.ct-cart-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    border-bottom: 1px solid #ddd;
    padding-bottom: 1rem;
}

.ct-cart-close {
    border: none;
    background: #eee;
    padding: 0.5rem 0.75rem;
    border-radius: 5px;
    cursor: pointer;
}

.ct-cart-items {
    flex: 1;
    overflow-y: auto;
    padding: 1rem 0;
}

.ct-cart-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 0;
    border-bottom: 1px solid #eee;
}

.ct-cart-item img {
    width: 65px;
    height: 65px;
    object-fit: cover;
    border-radius: 5px;
    background: #eee;
    flex-shrink: 0;
}

.ct-cart-item-details {
    flex: 1;
    min-width: 0;
}

.ct-cart-item-name {
    font-weight: 700;
    font-size: 0.9rem;
    word-break: break-word;
}

.ct-cart-item-price {
    color: #64748b;
    font-size: 0.8rem;
    margin-top: 0.2rem;
}

.ct-quantity-controls {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

.ct-quantity-controls button {
    width: 30px;
    height: 30px;
    border: 1px solid #ddd;
    background: #f8fafc;
    border-radius: 4px;
    cursor: pointer;
    font-size: 1rem;
}

.ct-quantity-controls span {
    min-width: 20px;
    text-align: center;
    font-weight: 700;
}

.ct-remove-item {
    border: none;
    background: transparent;
    color: #ef4444;
    cursor: pointer;
    font-size: 0.8rem;
    padding: 0.4rem;
}

.ct-cart-footer {
    border-top: 1px solid #ddd;
    padding-top: 1rem;
}

.ct-cart-total {
    display: flex;
    justify-content: space-between;
    font-size: 1.15rem;
    font-weight: 800;
    margin-bottom: 1rem;
}

.ct-checkout-btn {
    background: #25D366;
    color: #fff;
    padding: 0.9rem;
    font-size: 1rem;
}

.ct-checkout-btn:hover {
    background: #20b858;
}

.ct-cart-empty {
    text-align: center;
    color: #64748b;
    padding: 2rem 1rem;
}

/* THEME: MODERN */

.theme-modern .ct-header {
    border-bottom: 1px solid #eee;
}

.theme-modern .ct-card {
    box-shadow: 0 4px 15px rgba(0,0,0,0.05);
    border: 1px solid #f1f5f9;
    transition: transform 0.2s;
}

.theme-modern .ct-card:hover {
    transform: translateY(-3px);
}

.theme-modern .ct-badge {
    background: #e0f2fe;
    color: #0284c7;
}

/* THEME: CLASSIC */

.theme-classic {
    font-family: Georgia, serif;
    background: #faf9f6;
}

.theme-classic .ct-header {
    border-bottom: 2px double #ccc;
}

.theme-classic .ct-card {
    border: 1px solid #ddd;
    border-radius: 0;
    box-shadow: none;
}

.theme-classic .ct-card-img {
    border-bottom: 1px solid #ddd;
}

.theme-classic .ct-badge {
    background: #ddd;
    color: #333;
    border-radius: 0;
}

.theme-classic .ct-wa-btn {
    border-radius: 0;
}

/* THEME: MINIMAL */

.theme-minimal {
    background: #fff;
}

.theme-minimal .ct-header {
    border-bottom: none;
}

.theme-minimal .ct-card {
    border: none;
    border-bottom: 1px solid #eee;
    border-radius: 0;
    box-shadow: none;
    flex-direction: row;
    gap: 1rem;
}

.theme-minimal .ct-card-img {
    width: 120px;
    height: 120px;
    border-radius: 8px;
    flex-shrink: 0;
}

.theme-minimal .ct-card-body {
    padding: 0;
    justify-content: center;
}

.theme-minimal .ct-wa-btn {
    background: #111;
    color: #fff;
}

/* RESPONSIVE */

@media (max-width: 767px) {
    .controls-panel {
        max-width: none;
        width: 100%;
    }

    .preview-panel {
        min-height: 650px;
    }

    #catalog-preview {
        padding: 1rem;
    }

    .ct-shop-name {
        font-size: 1.6rem;
    }

    .ct-grid {
        grid-template-columns: repeat(auto-fill, minmax(145px, 1fr));
        gap: 0.75rem;
    }

    .ct-card-img {
        height: 150px;
    }

    .ct-card-body {
        padding: 0.75rem;
    }

    .ct-card-title {
        font-size: 1rem;
    }

    .ct-card-bottom {
        align-items: flex-start;
        flex-direction: column;
    }

    .ct-cart-bar {
        padding: 0.7rem;
    }
}

@media (max-width: 600px) {
    .theme-minimal .ct-card {
        flex-direction: column;
    }

    .theme-minimal .ct-card-img {
        width: 100%;
        height: auto;
        aspect-ratio: 1;
    }

    .ct-cart-content {
        max-width: none;
    }
}
```
/* Fix: Backup and Import buttons visibility */
.button-group .btn.secondary {
    background-color: #475569 !important;
    color: #ffffff !important;
    border: 1px solid #475569 !important;
    opacity: 1 !important;
}

.button-group .btn.secondary:hover {
    background-color: #334155 !important;
    color: #ffffff !important;
}
/* Fix Bulk Image Upload visibility */
.upload-btn,
label[for="bulk-upload"] {
    background-color: #2563eb !important;
    color: #ffffff !important;
    border: 1px solid #2563eb !important;
    cursor: pointer;
}

.upload-btn:hover,
label[for="bulk-upload"]:hover {
    background-color: #1d4ed8 !important;
    color: #ffffff !important;
}
/* Fix Save Product button visibility */
#btn-save-product {
    background-color: #2563eb !important;
    color: #ffffff !important;
    border: 1px solid #2563eb !important;
    opacity: 1 !important;
}

#btn-save-product:hover {
    background-color: #1d4ed8 !important;
    color: #ffffff !important;
}
/* Always visible: Data & Backups section */
#btn-export-html,
#btn-export-json,
label[for="import-json"] {
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
    color: #ffffff !important;
}

#btn-export-html {
    background: #2563eb !important;
    border: 1px solid #2563eb !important;
}

#btn-export-json,
label[for="import-json"] {
    background: #475569 !important;
    border: 1px solid #475569 !important;
}

#btn-export-html:hover {
    background: #1d4ed8 !important;
}

#btn-export-json:hover,
label[for="import-json"]:hover {
    background: #334155 !important;
}

#status-message {
    color: #0f172a !important;
}