* { box-sizing: border-box; }
body { margin: 0; font-family: system-ui, -apple-system, sans-serif; background: #f5f5f5; color: #1a1a1a; }
.layout { max-width: 1400px; margin: 0 auto; padding: 0 1rem; min-height: 100vh; display: flex; flex-direction: column; }

.header { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; padding: 1rem 0; border-bottom: 1px solid #e0e0e0; background: #fff; margin: 0 -1rem 1rem -1rem; padding: 1rem; }
.header h1 { margin: 0; font-size: 1.25rem; }
.nav { display: flex; gap: 0.5rem; }
.nav-link { padding: 0.5rem 0.75rem; text-decoration: none; color: #555; border-radius: 6px; }
.nav-link:hover { background: #eee; color: #1a1a1a; }
.nav-link.active { background: #1a1a1a; color: #fff; }
.header-actions { margin-left: auto; }

.btn { padding: 0.5rem 1rem; border: 1px solid #ccc; border-radius: 6px; background: #fff; cursor: pointer; font-size: 0.9rem; }
.btn:hover { background: #f0f0f0; }
.btn-primary { background: #1a1a1a; color: #fff; border-color: #1a1a1a; }
.btn-primary:hover { background: #333; }
.btn-secondary { background: #e8e8e8; }

.main { flex: 1; }
.section { display: none; padding-bottom: 2rem; }
.section.active { display: block; }

.section-toolbar { margin-bottom: 1rem; display: flex; gap: 0.5rem; flex-wrap: wrap; }
.table-wrap { overflow-x: auto; background: #fff; border-radius: 8px; box-shadow: 0 1px 3px rgba(0,0,0,0.08); }
#tablePricelist { min-width: 1040px; }
.table .markup-inline { font-size: 0.8em; color: #666; }
.table .cell-two-lines .markup-line { display: block; margin-top: 0.15em; }
.table th .th-line2 { font-size: 0.85em; font-weight: 500; color: #666; }
#tablePricelist .th-exclude { background: #f8f8f8; padding: 0.5rem 0.75rem; border-bottom: 1px solid #eee; min-width: 4rem; text-align: center; }
#tablePricelist .td-exclude { padding: 0.5rem 0.75rem; border-bottom: 1px solid #eee; min-width: 4rem; text-align: center; }
#tablePricelist tbody tr:hover .td-exclude { background: #fafafa; }
.table { width: 100%; border-collapse: collapse; font-size: 0.85rem; }
.table th, .table td { padding: 0.5rem 0.75rem; text-align: left; border-bottom: 1px solid #eee; }
.table th { background: #f8f8f8; font-weight: 600; white-space: nowrap; }
.table th.th-sort { cursor: pointer; user-select: none; }
.table th.th-sort:hover { background: #eee; }
.table th .sort-icon { opacity: 0.3; font-size: 0.75em; }
.table th.sort-asc .sort-icon::after { content: ' ▲'; opacity: 1; }
.table th.sort-desc .sort-icon::after { content: ' ▼'; opacity: 1; }
.table th.th-resize { position: relative; padding-right: 14px; }
.table th .resize-handle { position: absolute; top: 0; right: 0; width: 8px; height: 100%; cursor: col-resize; }
.table th .resize-handle:hover { background: rgba(0,0,0,0.08); }
.table.table-resizable { table-layout: fixed; }
.table tbody tr:hover { background: #fafafa; }
.table input.input-sale-price { width: 100%; min-width: 60px; max-width: 120px; padding: 0.25rem; border: 1px solid #ddd; border-radius: 4px; }
.table input.input-sale-price-edit { width: 100%; min-width: 80px; max-width: 140px; padding: 0.25rem; border: 1px solid #1a1a1a; border-radius: 4px; font-size: inherit; }
.table .sale-price-text { cursor: pointer; text-decoration: underline; text-decoration-style: dotted; }
.table .sale-price-text:hover { color: #1a1a1a; }
.table .btn-article { display: inline-block; padding: 0.25rem 0.5rem; border: 1px solid #ccc; border-radius: 6px; background: #fff; cursor: pointer; font-size: inherit; font-family: inherit; color: inherit; }
.table .btn-article:hover { background: #f0f0f0; border-color: #999; }
.table input[type="number"], .table input[type="text"] { width: 90px; padding: 0.25rem; border: 1px solid #ddd; border-radius: 4px; }
.table .excluded { background: #fff0f0; }
.table .cost-purchase-above { background: #ffebee; }
.table .cost-purchase-below { background: #e8f5e9; }
.table tr.excluded.cost-purchase-above { background: #ffcdd2; }
.table tr.excluded.cost-purchase-below { background: #c8e6c9; }
.table tr.uncovered { background: #fff4e6; }
.table .num { text-align: right; white-space: nowrap; }

#tableNewProducts .new-products-group-header td { background: #e8e8e8; font-weight: 600; padding: 0.5rem 0.75rem; border-bottom: 1px solid #ddd; }
#tableNewProducts .new-products-row td:first-child { color: #999; }

.form-panel { background: #fff; padding: 1.5rem; border-radius: 8px; box-shadow: 0 1px 3px rgba(0,0,0,0.08); max-width: 480px; }
.form-panel h3 { margin: 0 0 1rem; font-size: 1.1rem; }
.form-panel h4 { margin: 1.25rem 0 0.5rem; font-size: 0.95rem; color: #555; }
.form-panel .form-hint { margin: 0 0 0.75rem; font-size: 0.85rem; color: #666; }
.form-row { margin-bottom: 0.75rem; }
.form-row label { display: block; margin-bottom: 0.25rem; font-size: 0.9rem; color: #555; }
.form-row input, .form-row select { width: 100%; padding: 0.5rem; border: 1px solid #ddd; border-radius: 6px; font-size: 0.9rem; }
.markup-scope-checkboxes { max-height: 200px; overflow-y: auto; border: 1px solid #ddd; border-radius: 6px; padding: 0.5rem; background: #fafafa; }
.markup-coverage-block { margin-bottom: 1rem; }
.markup-coverage-block h4 { margin: 0 0 0.25rem; font-size: 0.95rem; }
.markup-coverage-block .table-wrap-coverage { max-height: 240px; overflow-y: auto; min-height: 120px; }
.markup-scope-checkboxes label { display: block; padding: 0.25rem 0; cursor: pointer; font-size: 0.9rem; }
.markup-scope-checkboxes input { width: auto; margin-right: 0.5rem; }
.form-actions { margin-top: 1rem; display: flex; gap: 0.5rem; }
.settings-blocks { display: flex; flex-wrap: wrap; gap: 1.5rem; margin-bottom: 1.5rem; }
.settings-blocks .settings-block { flex: 1; min-width: 280px; }
.settings-fix-prices .form-hint-block { display: block; margin-bottom: 1rem; }
.label-checkbox { display: inline-flex; align-items: center; gap: 0.5rem; cursor: pointer; font-weight: normal; }
.settings-view .setting-view-row { margin-bottom: 0.6rem; font-size: 0.9rem; }
.settings-view .setting-view-label { display: inline-block; color: #555; margin-right: 0.5rem; }
.settings-view .setting-view-value { color: #1a1a1a; }
.settings-view .setting-view-secret { color: #888; }
.form-actions-settings { margin-top: 0; }

.toast { position: fixed; bottom: 1.5rem; right: 1.5rem; padding: 0.75rem 1.25rem; border-radius: 8px; background: #1a1a1a; color: #fff; font-size: 0.9rem; box-shadow: 0 4px 12px rgba(0,0,0,0.2); opacity: 0; transform: translateY(10px); transition: opacity 0.2s, transform 0.2s; z-index: 1000; }
.toast.show { opacity: 1; transform: translateY(0); }
.toast.error { background: #c00; }

.progress-panel { background: #fff; padding: 1rem 1.25rem; border-radius: 8px; box-shadow: 0 1px 3px rgba(0,0,0,0.08); margin-bottom: 1rem; border: 1px solid #e0e0e0; }
.progress-title { font-weight: 600; margin-bottom: 0.75rem; }
.progress-steps { display: flex; flex-direction: column; gap: 0.5rem; }
.progress-step { display: flex; align-items: center; gap: 0.5rem; padding: 0.4rem 0; font-size: 0.9rem; color: #666; }
.progress-step-num { display: inline-flex; align-items: center; justify-content: center; width: 1.5rem; height: 1.5rem; border-radius: 50%; background: #e0e0e0; color: #666; font-size: 0.8rem; font-weight: 600; flex-shrink: 0; }
.progress-step.running { color: #1a1a1a; font-weight: 500; }
.progress-step.running .progress-step-num { background: #1a1a1a; color: #fff; }
.progress-step.done { color: #0a6b0a; }
.progress-step.done .progress-step-num { background: #0a6b0a; color: #fff; }
.progress-step.error { color: #c00; }
.progress-step.error .progress-step-num { background: #c00; color: #fff; }
.progress-step .progress-step-msg { margin-left: 0.25rem; font-size: 0.85em; opacity: 0.9; }
.data-age-bar { font-size: 0.85rem; color: #666; padding: 0.5rem 0; margin-bottom: 0.5rem; }
.data-age-bar .data-age-bar-export { margin-top: 0.25rem; font-size: 0.8rem; color: #555; }

.modal { position: fixed; inset: 0; z-index: 2000; display: flex; align-items: center; justify-content: center; padding: 1rem; }
.modal[hidden] { display: none !important; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(0,0,0,0.4); }
.modal-panel { position: relative; background: #fff; border-radius: 12px; box-shadow: 0 8px 32px rgba(0,0,0,0.2); padding: 1.5rem; min-width: 320px; max-width: 420px; }
.export-progress-panel h3 { margin: 0 0 1rem; font-size: 1.1rem; }
.export-progress-text { margin: 0 0 1rem; font-size: 0.95rem; color: #333; }
.export-progress-steps { display: flex; flex-direction: column; gap: 0.35rem; font-size: 0.85rem; color: #666; }
.export-progress-steps .step-done { color: #0a6b0a; }
.export-progress-steps .step-current { color: #1a1a1a; font-weight: 500; }

.section-title { margin: 0 0 0.5rem; font-size: 1.15rem; }
#section-history .form-hint { margin-bottom: 1rem; }
.history-status-ok { color: #0a6b0a; font-weight: 500; }
.history-status-error { color: #c00; font-weight: 500; }
.history-empty { padding: 1.5rem; color: #666; font-size: 0.95rem; }
.history-error { padding: 1rem; color: #c00; font-size: 0.9rem; background: #fff0f0; border-radius: 8px; }
