* { box-sizing: border-box; }
:root {
  color-scheme: light;
  --text: #172033;
  --muted: #667085;
  --line: #dfe5ed;
  --surface: #fff;
  --canvas: #f4f6fa;
  --primary: #2859c5;
  --primary-dark: #1f469c;
  --danger: #a52b30;
  --danger-bg: #fff0f0;
  --radius: 14px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
body { margin: 0; background: var(--canvas); color: var(--text); font-size: 14px; line-height: 1.5; }
button, input, select { font: inherit; }
button { cursor: pointer; }
button:disabled { opacity: .5; cursor: not-allowed; }
.app-header {
  background: var(--surface); border-bottom: 1px solid var(--line); padding: 22px clamp(16px, 3vw, 40px);
  display: flex; justify-content: space-between; align-items: flex-start; gap: 24px; flex-wrap: wrap;
}
.brand-block { min-width: 240px; }
.eyebrow { color: var(--primary); text-transform: uppercase; font-weight: 800; font-size: 11px; letter-spacing: .09em; }
h1 { margin: 4px 0; font-size: clamp(23px, 2.2vw, 30px); line-height: 1.25; letter-spacing: -.025em; }
.brand-block p { margin: 6px 0 0; color: var(--muted); }
.header-actions { display: flex; justify-content: flex-end; align-items: center; flex-wrap: wrap; gap: 8px; max-width: 950px; }
.button {
  display: inline-flex; align-items: center; justify-content: center; min-height: 38px; padding: 9px 13px;
  border: 1px solid transparent; border-radius: 9px; font-weight: 700; text-align: center; transition: background .15s, border-color .15s;
}
.button-primary { background: var(--primary); color: #fff; }
.button-primary:hover:not(:disabled) { background: var(--primary-dark); }
.button-secondary { background: #fff; border-color: var(--line); color: #26334b; }
.button-secondary:hover:not(:disabled) { background: #f8fafc; border-color: #bdc8d8; }
.button-danger { background: #bd343a; color: #fff; }
.button-danger:hover:not(:disabled) { background: #9f262b; }
.button-danger-soft { background: var(--danger-bg); border-color: #ffd7d7; color: var(--danger); }
.button-danger-soft:hover:not(:disabled) { background: #ffe2e2; }
.page { max-width: 1800px; padding: 20px clamp(14px, 2.3vw, 32px) 56px; margin: 0 auto; }
.status, .notice { margin-bottom: 14px; padding: 12px 15px; border: 1px solid var(--line); border-radius: 11px; background: #fff; white-space: pre-wrap; overflow-wrap: anywhere; }
.status-info { border-color: #b9cdf7; color: #244b99; background: #f0f5ff; }
.status-success { border-color: #b9e6ce; color: #176644; background: #effaf4; }
.status-warning, .notice-warning { border-color: #edc46b; color: #80530b; background: #fff8e7; }
.status-error { border-color: #f3b8b8; color: #942a2a; background: #fff1f1; }
.error-report { margin: 12px 0 16px; padding: 13px 15px; border: 1px solid #f0b5b5; border-radius: 11px; background: #fff8f8; color: #7e2424; }
.error-report pre { white-space: pre-wrap; overflow-wrap: anywhere; max-height: 360px; overflow: auto; margin: 8px 0 0; font-size: 12px; }
.toolbar {
  display: grid; grid-template-columns: minmax(240px, 2fr) repeat(3, minmax(160px, 1fr)) minmax(190px, 1.2fr) minmax(170px, 1fr);
  gap: 13px; align-items: end; padding: 18px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface);
  box-shadow: 0 4px 14px rgba(19, 33, 58, .035);
}
.filter-field, .filter-search { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.filter-field label, .filter-search label { font-weight: 750; color: #3c475a; font-size: 12px; }
.filter-field select, .filter-search input {
  width: 100%; height: 42px; padding: 0 11px; border: 1px solid #cfd7e3; border-radius: 9px; color: var(--text); background: #fff; min-width: 0;
}
.filter-field select:focus, .filter-search input:focus { outline: 3px solid rgba(40, 89, 197, .13); border-color: #7f9fe7; }
.stock-filter { display: flex; gap: 9px; align-items: center; min-height: 42px; color: #3c475a; font-weight: 650; }
.stock-filter input { width: 17px; height: 17px; accent-color: var(--primary); }
.summary-row { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin: 22px 2px 14px; flex-wrap: wrap; }
.summary-row strong { font-size: 15px; }
.muted { color: var(--muted); }
.quality-summary { color: var(--muted); font-size: 12px; }
.product-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(255px, 1fr)); gap: 15px; align-items: stretch; }
.product-card { min-width: 0; overflow: hidden; display: flex; flex-direction: column; background: #fff; border: 1px solid var(--line); border-radius: 14px; transition: transform .12s, box-shadow .12s; }
.product-card:hover { transform: translateY(-1px); box-shadow: 0 8px 24px rgba(17, 33, 61, .08); }
.product-photo { position: relative; display: flex; justify-content: center; align-items: center; height: 190px; background: #f8f9fb; border-bottom: 1px solid #eef1f5; }
.product-photo img { width: 100%; height: 100%; object-fit: contain; padding: 10px; }
.photo-placeholder { display: flex; align-items: center; justify-content: center; width: 100%; height: 100%; color: #9aa4b2; background: repeating-linear-gradient(135deg, #f6f8fb, #f6f8fb 12px, #f1f4f8 12px, #f1f4f8 24px); font-size: 12px; }
.photo-placeholder-large { min-height: 240px; border-radius: 10px; }
.photo-step { position: absolute; top: 50%; transform: translateY(-50%); border: 0; border-radius: 50%; width: 30px; height: 30px; background: rgba(23, 32, 51, .75); color: #fff; font-size: 22px; line-height: 1; }
.photo-prev { left: 8px; } .photo-next { right: 8px; }
.photo-counter { position: absolute; right: 8px; bottom: 8px; border-radius: 20px; background: rgba(23,32,51,.78); color: #fff; font-size: 10px; padding: 2px 7px; }
.product-card-body { display: flex; flex-direction: column; align-items: flex-start; gap: 8px; padding: 14px; height: 100%; }
.card-meta { display: flex; justify-content: space-between; align-items: flex-start; flex-wrap: wrap; gap: 6px; width: 100%; }
.supplier-label { padding: 3px 7px; border-radius: 20px; color: #244b99; background: #edf3ff; font-size: 10px; letter-spacing: .03em; font-weight: 800; text-transform: uppercase; }
.sku { color: #727e90; font-size: 11px; overflow-wrap: anywhere; }
.product-card h2 { margin: 0; font-size: 15px; line-height: 1.35; overflow-wrap: anywhere; }
.product-category { color: #657185; font-size: 11px; }
.product-brand { color: #424f63; font-size: 12px; font-weight: 650; }
.product-price { font-size: 19px; line-height: 1.25; font-weight: 850; color: #182740; margin-top: 2px; }
.chip { display: inline-flex; align-items: center; padding: 3px 8px; border-radius: 20px; font-size: 11px; font-weight: 750; }
.chip-positive { background: #e6f7ed; color: #187044; }
.chip-negative { background: #fff0f0; color: #a12d32; }
.chip-muted { background: #f0f2f5; color: #667085; }
.product-description { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; color: #566276; font-size: 12px; margin: 0; }
.spec-preview-list { display: grid; width: 100%; gap: 4px; margin: 3px 0 6px; }
.spec-preview { display: grid; grid-template-columns: minmax(0, .8fr) minmax(0, 1fr); gap: 7px; font-size: 11px; }
.spec-preview span { color: #7a8494; overflow-wrap: anywhere; }
.spec-preview b { font-weight: 650; overflow-wrap: anywhere; }
.button-card { width: 100%; margin-top: auto; background: #f2f5fa; color: #263b61; border-color: #e2e8f0; }
.button-card:hover { background: #e8eef7; }
.empty-state { grid-column: 1 / -1; padding: 72px 18px; text-align: center; border: 1px dashed #ccd5e2; border-radius: var(--radius); background: #fff; color: var(--muted); }
.empty-state h2 { margin: 10px 0 4px; color: var(--text); font-size: 18px; }
.empty-state p { margin: 0; }
.empty-icon { font-size: 35px; color: #aab6c7; }
.error-state h2 { color: var(--danger); }
.pager { display: flex; justify-content: center; align-items: center; flex-wrap: wrap; gap: 6px; margin: 24px 0; }
.pager button { min-width: 38px; height: 36px; padding: 0 10px; border: 1px solid var(--line); border-radius: 8px; background: #fff; color: #354158; font-weight: 700; }
.pager button.current { border-color: var(--primary); background: var(--primary); color: #fff; }
.pager button:disabled { opacity: .4; cursor: not-allowed; }
.pager-ellipsis { color: var(--muted); padding: 0 3px; }
.modal { position: fixed; inset: 0; display: none; align-items: center; justify-content: center; padding: 22px; z-index: 1000; background: rgba(12, 20, 36, .58); }
.modal.open { display: flex; }
.modal-panel { position: relative; max-width: 1120px; width: 100%; max-height: 92vh; overflow: auto; border-radius: 16px; background: #fff; box-shadow: 0 24px 80px rgba(0,0,0,.25); }
.modal-close { position: sticky; top: 10px; float: right; z-index: 2; margin: 10px 12px -40px 0; width: 34px; height: 34px; border: 1px solid var(--line); border-radius: 50%; background: #fff; color: #3d485a; font-size: 24px; line-height: 1; }
.modal-content { padding: 27px; }
.detail-head { display: flex; gap: 20px; justify-content: space-between; align-items: flex-start; padding-right: 35px; border-bottom: 1px solid var(--line); padding-bottom: 18px; }
.detail-head h2 { font-size: 24px; line-height: 1.3; margin: 4px 0; }
.detail-price { font-size: 22px; font-weight: 850; white-space: nowrap; }
.detail-layout { display: grid; grid-template-columns: minmax(290px, 42%) minmax(0, 1fr); gap: 22px; padding-top: 20px; }
.detail-gallery { min-width: 0; }
.detail-gallery > img { display: block; width: 100%; height: 300px; object-fit: contain; background: #f8f9fb; border: 1px solid #eef1f5; border-radius: 10px; }
.gallery-tools { display: flex; align-items: center; justify-content: center; gap: 14px; margin: 9px 0; }
.gallery-thumbs { display: flex; gap: 7px; overflow-x: auto; padding: 3px 0 8px; }
.gallery-thumb { flex: 0 0 64px; height: 55px; padding: 2px; border: 1px solid var(--line); border-radius: 7px; background: #fff; }
.gallery-thumb.active { border: 2px solid var(--primary); }
.gallery-thumb img { width: 100%; height: 100%; object-fit: contain; }
.detail-info h3, .detail-section h3 { font-size: 14px; margin: 14px 0 9px; }
.detail-list { margin: 0; }
.detail-list > div { display: grid; grid-template-columns: minmax(105px, .75fr) minmax(0, 1.25fr); gap: 12px; padding: 9px 0; border-bottom: 1px solid #edf0f4; }
.detail-list dt { color: var(--muted); }
.detail-list dd { margin: 0; font-weight: 650; overflow-wrap: anywhere; }
.detail-description { white-space: normal; overflow-wrap: anywhere; }
.detail-section { grid-column: 1 / -1; border: 1px solid var(--line); border-radius: 11px; padding: 13px; min-width: 0; }
.detail-section h3 { margin-top: 0; }
.table-scroll { max-height: 430px; overflow: auto; }
.spec-table { width: 100%; border-collapse: collapse; }
.spec-table th, .spec-table td { text-align: left; vertical-align: top; border-bottom: 1px solid #edf0f4; padding: 8px 9px; overflow-wrap: anywhere; }
.spec-table th { width: 35%; color: #647086; font-weight: 650; background: #fbfcfe; }
.link-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 8px; }
.link-list a { color: var(--primary); text-decoration: none; overflow-wrap: anywhere; }
.link-list a:hover { text-decoration: underline; }
.raw-json { max-height: 480px; overflow: auto; white-space: pre-wrap; overflow-wrap: anywhere; font-size: 11px; background: #f7f8fa; padding: 12px; border-radius: 8px; }
details summary { cursor: pointer; font-weight: 750; }
@media (max-width: 1250px) {
  .toolbar { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .filter-search { grid-column: span 2; }
}
@media (max-width: 820px) {
  .toolbar { grid-template-columns: repeat(2, minmax(0, 1fr)); padding: 13px; }
  .filter-search { grid-column: 1 / -1; }
  .header-actions { justify-content: flex-start; }
  .detail-layout { grid-template-columns: 1fr; }
  .detail-section { grid-column: auto; }
  .detail-head { flex-direction: column; }
}
@media (max-width: 520px) {
  .app-header { padding: 16px; }
  .header-actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); width: 100%; }
  .header-actions .button { font-size: 12px; padding: 8px; }
  .page { padding: 13px 10px 40px; }
  .toolbar { grid-template-columns: 1fr; }
  .filter-search { grid-column: auto; }
  .product-grid { grid-template-columns: 1fr; }
  .product-photo { height: 220px; }
  .modal { padding: 0; }
  .modal-panel { max-height: 100vh; height: 100%; border-radius: 0; }
  .modal-content { padding: 21px 14px; }
  .detail-head h2 { font-size: 20px; }
  .detail-gallery > img { height: 230px; }
  .detail-list > div { grid-template-columns: 1fr; gap: 2px; }
}
@media print {
  body { background: #fff; }
  .app-header, .toolbar, .pager, .status, .notice, .no-print, .button-card, .photo-step { display: none !important; }
  .page { max-width: none; padding: 0; }
  .product-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 7px; }
  .product-card { break-inside: avoid; box-shadow: none; border-color: #bbb; }
  .product-photo { height: 120px; }
  .product-description { display: block; max-height: 45px; }
  .modal { display: none !important; }
}



.config-panel{margin:0 0 14px;padding:14px 16px;border:1px solid var(--line);border-radius:var(--radius);background:#fff;box-shadow:0 4px 14px rgba(19,33,58,.035)}.config-panel>summary{cursor:pointer;font-weight:800;font-size:15px}.config-panel p{max-width:1200px}.config-panel textarea{display:block;width:100%;min-height:160px;margin:12px 0;padding:12px;border:1px solid #cfd7e3;border-radius:9px;background:#fbfcfe;color:#172033;font:12px/1.5 ui-monospace,SFMono-Regular,Consolas,monospace;resize:vertical}.config-actions,.smart-group-actions{display:flex;flex-wrap:wrap;align-items:end;gap:9px}.smart-group-actions{margin-top:14px}.smart-group-actions label{display:flex;flex-direction:column;gap:5px;font-weight:700;font-size:12px;min-width:145px}.smart-group-actions input,.smart-group-actions select{min-height:38px;border:1px solid #cfd7e3;border-radius:8px;padding:7px 9px;max-width:220px}.config-panel .muted{font-size:12px;white-space:pre-wrap;overflow-wrap:anywhere}
