:root {
    --app-bg: #f7f8fa;
    --app-surface: #ffffff;
    --app-surface-alt: #f1f3f6;
    --app-text: #1f2933;
    --app-muted: #6f7a86;
    --app-border: #cbd5e1;
    --app-border-strong: #9facbc;
    --app-primary: #2f64ad;
    --app-primary-hover: #244f8a;
    --app-primary-soft: #edf2f8;
    --app-button-bg: #526d94;
    --app-button-hover: #455d80;
    --app-danger: #c84d43;
    --app-success: #2f7d57;
    --app-warning: #d99a2b;
    --app-shadow: 0 1px 2px rgba(43, 54, 68, .10), 0 1px 3px rgba(43, 54, 68, .08);
    --app-shadow-raised: 0 8px 22px rgba(43, 54, 68, .14);
    --app-radius: 8px;
}

html[data-theme="dark"] {
    --app-bg: #171b20;
    --app-surface: #22272e;
    --app-surface-alt: #2a3038;
    --app-text: #e6e9ed;
    --app-muted: #aeb7c2;
    --app-border: #3d4652;
    --app-border-strong: #566273;
    --app-primary: #7da7e8;
    --app-primary-hover: #9abcf0;
    --app-primary-soft: #253448;
    --app-button-bg: #4d6f9a;
    --app-button-hover: #5a7daa;
    --app-danger: #df7b73;
    --app-success: #76bd91;
    --app-warning: #e2b95f;
    --app-shadow: 0 1px 2px rgba(0, 0, 0, .24);
    --app-shadow-raised: 0 10px 24px rgba(0, 0, 0, .30);
}

html {
    background: var(--app-bg);
}

body {
    background: var(--app-bg) !important;
    color: var(--app-text) !important;
    font-family: "Google Sans", "Segoe UI", Roboto, Arial, sans-serif !important;
}

form {
    margin: 0;
}

header {
    height: 64px !important;
    background: var(--app-surface) !important;
    color: var(--app-text) !important;
    border-bottom: 1px solid var(--app-border) !important;
    box-shadow: none !important;
}

.header-wrapper {
    padding: 0 18px !important;
}

.header-center,
.header-title {
    color: var(--app-text) !important;
    font-size: 20px !important;
    font-weight: 600 !important;
    letter-spacing: 0 !important;
    text-transform: none !important;
}

.header-title {
    text-decoration: none !important;
    text-transform: uppercase !important;
}

.header-center img {
    max-height: 42px !important;
    height: auto !important;
}

#menuToggle,
#menuToggleClose {
    width: 40px !important;
    height: 40px !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    border-radius: 50% !important;
    color: var(--app-muted) !important;
    background: transparent !important;
    border: 0 !important;
    font-size: 22px !important;
}

#menuToggle:hover,
#menuToggleClose:hover {
    background: var(--app-surface-alt) !important;
    color: var(--app-text) !important;
    text-decoration: none !important;
}

#sideMenu {
    width: 292px !important;
    right: -336px !important;
    background: var(--app-surface) !important;
    color: var(--app-text) !important;
    border-left: 1px solid var(--app-border) !important;
    box-shadow: var(--app-shadow-raised) !important;
    padding: 16px !important;
}

#sideMenu.open {
    right: 0 !important;
}

#sideMenuContent {
    margin-top: 20px !important;
}

#sideMenuContent p {
    color: var(--app-muted) !important;
    margin: 0 0 16px !important;
    font-size: 13px !important;
}

#sideMenuContent a {
    min-height: 40px !important;
    display: flex !important;
    align-items: center !important;
    color: var(--app-text) !important;
    text-decoration: none !important;
    margin: 4px 0 !important;
    padding: 0 12px !important;
    border-radius: 999px !important;
    font-weight: 500 !important;
}

#sideMenuContent a:hover {
    background: var(--app-primary-soft) !important;
    color: var(--app-primary) !important;
    text-decoration: none !important;
}

.content,
.page {
    padding-top: 96px !important;
}

h2,
h3,
.panel h3,
.card h2 {
    color: var(--app-text) !important;
    letter-spacing: 0 !important;
}

a {
    color: var(--app-text);
    transition: color .16s ease, background-color .16s ease, border-color .16s ease;
}

a:hover {
    color: var(--app-primary-hover) !important;
    text-decoration: none !important;
}

input,
textarea,
select,
.search-product-input,
.preferred-site-input,
.config-inputs input,
.info-row input,
.info-row textarea,
.row input,
.row select {
    background: var(--app-surface) !important;
    color: var(--app-text) !important;
    border: 1px solid var(--app-border-strong) !important;
    border-radius: var(--app-radius) !important;
    box-shadow: none !important;
}

input:focus,
textarea:focus,
select:focus,
.search-product-input:focus,
.preferred-site-input:focus {
    border-color: var(--app-primary) !important;
    outline: 2px solid var(--app-primary-soft) !important;
    outline-offset: 1px !important;
}

input::placeholder,
textarea::placeholder {
    color: var(--app-muted) !important;
}

button,
.submit-button,
.action-button,
.row button,
.ctx-menu button,
input[type=submit],
.aspNetButton {
    border-radius: var(--app-radius) !important;
    box-shadow: none !important;
    font-weight: 600 !important;
}

.submit-button,
.action-start,
.row button,
input[type=submit],
.aspNetButton {
    background: var(--app-button-bg) !important;
    color: #fff !important;
    border: 1px solid transparent !important;
}

.submit-button:hover,
.action-start:hover,
.row button:hover,
input[type=submit]:hover,
.aspNetButton:hover {
    background: var(--app-button-hover) !important;
}

.danger,
.action-stop {
    background: var(--app-danger) !important;
    color: #fff !important;
}

.action-resume {
    background: var(--app-success) !important;
}

.action-pause {
    background: var(--app-warning) !important;
    color: #202124 !important;
}

.action-log {
    background: var(--app-surface-alt) !important;
    color: var(--app-text) !important;
    border: 1px solid var(--app-border) !important;
}

.card,
.panel,
.step-row,
.csv-block,
.search-product-block,
.search-product-result,
.search-product-dialog,
.store-block,
li {
    background: var(--app-surface) !important;
    color: var(--app-text) !important;
    border: 1px solid var(--app-border) !important;
    border-radius: var(--app-radius) !important;
    box-shadow: var(--app-shadow) !important;
}

.card:hover,
.step-row:hover {
    transform: none !important;
}

li:hover,
.tree-line:hover,
.ctx-menu button:hover {
    background: var(--app-surface-alt) !important;
}

.tree-line:hover .tree-text,
.ctx-menu button:hover,
.store-block a:hover,
.info-row a:hover {
    color: var(--app-primary-hover) !important;
}

#breadcrumbs,
#breadcrumbs a {
    color: var(--app-muted) !important;
}

.search-product-result a {
    color: var(--app-primary) !important;
}

li a,
#catalogsList a,
#subCatalogsList a,
#productsList a,
#suggestionsList a {
    color: var(--app-text) !important;
}

#catalogsList li,
#subCatalogsList li,
#productsList li,
#suggestionsList li {
    cursor: pointer;
}

.index-title {
    color: var(--app-text) !important;
    display: inline-block;
    font-size: 16px;
    font-weight: 700;
    line-height: 1.35;
    transition: color .16s ease;
}

li a:hover,
#catalogsList a:hover,
#subCatalogsList a:hover,
#productsList a:hover,
#suggestionsList a:hover,
#breadcrumbs a:hover,
.search-product-result a:hover {
    color: var(--app-primary-hover) !important;
}

#catalogsList li:hover .index-title,
#subCatalogsList li:hover .index-title,
#productsList li:hover .index-title,
#suggestionsList li:hover .index-title {
    color: var(--app-primary-hover) !important;
}

li span,
.muted,
.file-status,
.search-product-result-meta,
.info-row strong {
    color: var(--app-muted) !important;
}

#suggestionsList,
.ctx-menu {
    background: var(--app-surface) !important;
    border: 1px solid var(--app-border) !important;
    box-shadow: var(--app-shadow-raised) !important;
}

.tree-line.selected {
    background: var(--app-primary-soft) !important;
    outline: 1px solid var(--app-primary) !important;
}

.tree-toggle {
    background: var(--app-surface) !important;
    border-color: var(--app-border) !important;
    color: var(--app-primary) !important;
}

.tree-text,
.search-product-result-title,
.search-product-dialog-title,
.login-container h2 {
    color: var(--app-text) !important;
}

.step-title {
    color: var(--app-text) !important;
    font-weight: 700 !important;
}

.badge {
    background: var(--app-primary-soft) !important;
    color: var(--app-primary) !important;
}

.status-label,
.status {
    color: var(--app-text) !important;
}

.status-label {
    color: var(--app-success) !important;
}

.file-status.loaded {
    color: var(--app-success) !important;
}

.search-product-body,
.search-product-modal {
    color: var(--app-text) !important;
}

.inactive,
.cancelled {
    background: var(--app-surface-alt) !important;
    color: var(--app-muted) !important;
    border: 1px solid var(--app-border) !important;
}

.running,
.paused {
    background: rgba(217, 154, 43, .18) !important;
    color: var(--app-warning) !important;
    border: 1px solid rgba(217, 154, 43, .35) !important;
}

.done {
    background: rgba(47, 125, 87, .16) !important;
    color: var(--app-success) !important;
    border: 1px solid rgba(47, 125, 87, .32) !important;
}

.error {
    background: rgba(200, 77, 67, .16) !important;
    color: var(--app-danger) !important;
    border: 1px solid rgba(200, 77, 67, .32) !important;
}

.theme-option {
    margin-top: 18px;
    padding: 12px;
    border-top: 1px solid var(--app-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.theme-option-label {
    color: var(--app-text);
    font-size: 14px;
    font-weight: 600;
}

.theme-switch {
    position: relative;
    display: inline-block;
    width: 48px;
    height: 28px;
    flex: 0 0 auto;
}

.theme-switch input {
    width: 0 !important;
    height: 0 !important;
    opacity: 0;
}

.theme-slider {
    position: absolute;
    inset: 0;
    cursor: pointer;
    border-radius: 999px;
    background: var(--app-border-strong);
    transition: background .18s ease;
}

.theme-slider:before {
    content: "";
    position: absolute;
    width: 22px;
    height: 22px;
    left: 3px;
    top: 3px;
    border-radius: 50%;
    background: var(--app-surface);
    box-shadow: 0 1px 2px rgba(0, 0, 0, .25);
    transition: transform .18s ease;
}

.theme-switch input:checked + .theme-slider {
    background: var(--app-primary);
}

.theme-switch input:checked + .theme-slider:before {
    transform: translateX(20px);
}

.login-container {
    background: var(--app-surface) !important;
    color: var(--app-text) !important;
    border: 1px solid var(--app-border) !important;
    border-radius: var(--app-radius) !important;
    box-shadow: var(--app-shadow-raised) !important;
}

@media (max-width: 720px) {
    #sideMenu {
        width: min(86vw, 292px) !important;
    }

    .content,
    .page {
        padding-left: 12px !important;
        padding-right: 12px !important;
    }
}
/* Product media is only rendered when a saved image URL exists. */
.product-image { margin: 0 0 20px; }
.product-image[hidden] { display: none !important; }
.product-image img { display: block; max-width: 100%; width: 320px; max-height: 320px; object-fit: contain; object-position: left center; }
.product-thumbnail { float: left; width: 64px; height: 64px; margin: 0 14px 6px 0; object-fit: contain; border-radius: 6px; }
#productsList li::after, #suggestionsList li::after { content: ''; display: block; clear: both; }
