﻿:root {
  --sidebar-width: 460px;
  --line: #d8dce4;
  --text: #2d3543;
  --muted: #677489;
  --panel: rgba(255, 255, 255, 0.9);
  --panel-line: rgba(64, 88, 128, 0.12);
  --accent: #11a4df;
  --accent-deep: #3f6eb5;
  --paper: #ffffff;
  --page-shadow: 0 28px 60px rgba(38, 58, 89, 0.14);
  --radius-lg: 26px;
  --radius-md: 18px;
  --radius-sm: 12px;
  --input-bg: #f8fbff;
  --input-line: rgba(96, 123, 168, 0.18);
  --input-line-focus: rgba(63, 110, 181, 0.48);
  --soft-shadow: 0 10px 24px rgba(53, 81, 122, 0.08);
  font-family: "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  min-height: 100vh;
  scrollbar-color: #7f9fcf #eaf1fb;
  scrollbar-width: thin;
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(63, 110, 181, 0.14), transparent 22%),
    radial-gradient(circle at bottom right, rgba(17, 164, 223, 0.16), transparent 18%),
    linear-gradient(180deg, #edf4fb 0%, #e5edf7 100%);
}

.page-shell {
  display: grid;
  grid-template-columns: minmax(320px, var(--sidebar-width)) 1fr;
  gap: 22px;
  padding: 20px;
  height: 100vh;
  overflow: hidden;
}

.sidebar,
.preview-shell {
  min-height: 0;
  height: calc(100vh - 40px);
  border-radius: var(--radius-lg);
  border: 1px solid var(--panel-line);
  background: var(--panel);
  backdrop-filter: blur(12px);
  box-shadow: 0 20px 50px rgba(40, 62, 96, 0.1);
}

.sidebar {
  padding: 24px 20px 28px;
  overflow-y: auto;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.96) 0%, rgba(247, 251, 255, 0.94) 100%),
    radial-gradient(circle at top left, rgba(17, 164, 223, 0.08), transparent 28%);
}
.preview-shell {
  display: flex;
  flex-direction: column;
  padding: 22px;
  overflow: hidden;
}
.sidebar,
.preview-shell,
.rows-list,
.editor-list {
  scrollbar-color: #7f9fcf #edf3fb;
  scrollbar-width: thin;
}

body::-webkit-scrollbar,
.sidebar::-webkit-scrollbar,
.preview-shell::-webkit-scrollbar,
.rows-list::-webkit-scrollbar,
.editor-list::-webkit-scrollbar {
  width: 12px;
  height: 12px;
}

body::-webkit-scrollbar-track,
.sidebar::-webkit-scrollbar-track,
.preview-shell::-webkit-scrollbar-track,
.rows-list::-webkit-scrollbar-track,
.editor-list::-webkit-scrollbar-track {
  background: linear-gradient(180deg, #f5f8fd 0%, #e8eff9 100%);
  border-radius: 999px;
}

body::-webkit-scrollbar-thumb,
.sidebar::-webkit-scrollbar-thumb,
.preview-shell::-webkit-scrollbar-thumb,
.rows-list::-webkit-scrollbar-thumb,
.editor-list::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, #9db8df 0%, #6f92c9 100%);
  border: 2px solid #edf3fb;
  border-radius: 999px;
}

body::-webkit-scrollbar-thumb:hover,
.sidebar::-webkit-scrollbar-thumb:hover,
.preview-shell::-webkit-scrollbar-thumb:hover,
.rows-list::-webkit-scrollbar-thumb:hover,
.editor-list::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(180deg, #7f9fcf 0%, #567cb8 100%);
}
.brand-block {
  padding: 10px 10px 18px;
  margin-bottom: 14px;
  border-radius: 24px;
  border: 1px solid rgba(88, 119, 171, 0.12);
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.98) 0%, rgba(241, 247, 255, 0.94) 100%);
  box-shadow: var(--soft-shadow);
}
.eyebrow {
  margin: 0 0 10px;
  color: var(--accent-deep);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

h1, h2, h3, h4, p { margin-top: 0; }
h1 { margin-bottom: 12px; font-size: 34px; line-height: 1.05; letter-spacing: -0.03em; }
.intro { color: var(--muted); line-height: 1.55; }

.panel {
  margin-bottom: 16px;
  padding: 18px;
  border-radius: 22px;
  border: 1px solid rgba(85, 114, 164, 0.12);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.98) 0%, rgba(247, 250, 255, 0.95) 100%);
  box-shadow: var(--soft-shadow);
}

.panel h2 {
  margin-bottom: 16px;
  font-size: 20px;
  line-height: 1.1;
  letter-spacing: -0.02em;
}
.field, .field-grid { display: grid; gap: 8px; }
.field { margin-bottom: 14px; }
.field-full { grid-column: 1 / -1; }
.field-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.editor-card-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.icon-btn {
  min-width: 36px;
  padding: 0 10px;
  font-size: 18px;
  font-weight: 800;
  line-height: 1;
}
.mapping-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.compact-mapping-grid { grid-template-columns: 78px minmax(0, 1fr) 170px; }
.compact-mapping-grid-two { grid-template-columns: minmax(0, 1fr) 170px; }
.field-toggle {
  align-content: end;
  justify-items: center;
  gap: 10px;
  min-height: 100%;
}
.field-toggle span {
  font-size: 12px;
  font-weight: 700;
  color: #4f79b7;
  letter-spacing: 0.02em;
}
.compact-mapping-grid .field {
  margin-bottom: 10px;
}
.compact-mapping-grid .field:not(.field-toggle) {
  padding: 12px;
  border-radius: 18px;
  border: 1px solid rgba(101, 128, 173, 0.12);
  background: linear-gradient(180deg, rgba(250, 252, 255, 0.96) 0%, rgba(242, 247, 255, 0.92) 100%);
}
.compact-mapping-grid .field:not(.field-toggle) span {
  color: #59709a;
  font-size: 13px;
}
.compact-mapping-grid .field:nth-child(3n + 2) span {
  color: #2f66b3;
  font-weight: 800;
}
.compact-mapping-grid .field:nth-child(3n) span {
  color: #0b8e9f;
  font-weight: 700;
}
.compact-mapping-grid-two .field {
  margin-bottom: 10px;
  padding: 12px;
  border-radius: 18px;
  border: 1px solid rgba(101, 128, 173, 0.12);
  background: linear-gradient(180deg, rgba(250, 252, 255, 0.96) 0%, rgba(242, 247, 255, 0.92) 100%);
}
.compact-mapping-grid-two .field span {
  font-size: 13px;
}
.compact-mapping-grid-two .field:nth-child(4n + 1) span {
  color: #2f66b3;
  font-weight: 800;
}
.compact-mapping-grid-two .field:nth-child(4n + 2) span {
  color: #0b8e9f;
  font-weight: 700;
}
.compact-mapping-grid-two .field:nth-child(4n + 3) span {
  color: #2f66b3;
  font-weight: 800;
}
.compact-mapping-grid-two .field:nth-child(4n) span {
  color: #0b8e9f;
  font-weight: 700;
}
.field-toggle input[type="checkbox"] {
  appearance: none;
  -webkit-appearance: none;
  width: 26px;
  height: 26px;
  border-radius: 9px;
  border: 1px solid rgba(79, 121, 183, 0.24);
  background: linear-gradient(180deg, #f8fbff 0%, #e9f1fd 100%);
  box-shadow: 0 6px 14px rgba(72, 105, 158, 0.14);
  position: relative;
  cursor: pointer;
}
.field-toggle input[type="checkbox"]::after {
  content: "";
  position: absolute;
  inset: 6px;
  border-radius: 5px;
  background: transparent;
  transition: background 140ms ease, transform 140ms ease;
}
.field-toggle input[type="checkbox"]:checked {
  border-color: rgba(33, 137, 199, 0.4);
  background: linear-gradient(180deg, #2ca8df 0%, #3f6eb5 100%);
}
.field-toggle input[type="checkbox"]:checked::after {
  background: #ffffff;
  transform: scale(0.92);
}
.field-toggle input[type="checkbox"]:focus {
  box-shadow: 0 0 0 4px rgba(17, 164, 223, 0.12), 0 6px 14px rgba(72, 105, 158, 0.14);
}
.inline-fields { display: grid; grid-template-columns: 1fr auto; gap: 12px; align-items: end; }
.small { margin-bottom: 0; }
.selection-actions, .action-panel { display: grid; gap: 10px; }
.action-panel {
  position: sticky;
  bottom: 0;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.98) 0%, rgba(241, 247, 255, 0.98) 100%);
  border-color: rgba(82, 116, 175, 0.16);
}
.action-panel-buttons {
  display: grid;
  gap: 10px;
}
.field span, .hint, .status {
  color: var(--muted);
  font-size: 14px;
  line-height: 1.45;
}
.field span {
  font-weight: 600;
  color: #66748a;
}
.hint {
  margin-bottom: 12px;
  padding: 10px 12px;
  border-radius: 14px;
  background: rgba(236, 244, 255, 0.78);
}

.pdf-columns-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 12px;
}

.pdf-columns-grid label {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 52px;
  padding: 10px 12px;
  border-radius: 16px;
  border: 1px solid rgba(87, 114, 156, 0.14);
  background: rgba(248, 251, 255, 0.96);
  font-size: 14px;
  color: var(--text);
  font-weight: 600;
}

input, select, textarea, button {
  width: 100%;
  border-radius: 14px;
  border: 1px solid var(--input-line);
  background: var(--input-bg);
  color: var(--text);
  font: inherit;
}

input, select, textarea {
  padding: 13px 14px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.65);
  transition: border-color 140ms ease, box-shadow 140ms ease, background 140ms ease;
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--input-line-focus);
  background: #ffffff;
  box-shadow: 0 0 0 4px rgba(17, 164, 223, 0.12);
}
input[type="checkbox"] {
  width: 18px;
  height: 18px;
  border-radius: 6px;
  box-shadow: none;
}
textarea { resize: vertical; min-height: 84px; }
button {
  padding: 13px 16px;
  font-weight: 700;
  cursor: pointer;
  transition: transform 140ms ease, box-shadow 140ms ease;
}
button:hover:not(:disabled) { transform: translateY(-1px); }
button:disabled { opacity: 0.45; cursor: not-allowed; }

.primary-btn {
  color: #fff;
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-deep) 100%);
  box-shadow: 0 14px 28px rgba(34, 88, 171, 0.2);
}
.secondary-btn {
  background: linear-gradient(135deg, #eef5ff 0%, #dce9fd 100%);
  border-color: rgba(97, 132, 188, 0.24);
}
.ghost-btn {
  background: rgba(255, 255, 255, 0.82);
  border-color: rgba(98, 126, 172, 0.16);
}
.reset-btn { max-width: 120px; justify-self: end; }

.rows-list,
.editor-list {
  display: grid;
  gap: 10px;
  max-height: 320px;
  overflow-y: auto;
  padding-right: 4px;
}
.rows-list.empty,
.editor-list.empty { display: none; }

.row-chip,
.editor-card {
  border-radius: 16px;
  border: 1px solid rgba(96, 123, 168, 0.12);
  background: linear-gradient(180deg, rgba(247, 250, 255, 0.96) 0%, rgba(240, 246, 255, 0.92) 100%);
}

.row-chip {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 10px;
  align-items: start;
  padding: 12px;
}
.row-chip strong { display: block; margin-bottom: 4px; }
.row-chip p { margin: 0; color: var(--muted); font-size: 14px; }

.editor-card { padding: 14px; }
.editor-card-header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  margin-bottom: 10px;
}
.editor-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }
.editor-style-group {
  padding: 12px;
  border-radius: 16px;
  border: 1px solid rgba(96, 123, 168, 0.14);
  background: linear-gradient(180deg, rgba(251, 253, 255, 0.98) 0%, rgba(242, 247, 255, 0.94) 100%);
}
.editor-style-title {
  margin-bottom: 10px;
  font-size: 13px;
  font-weight: 800;
  color: #46689f;
}
.editor-style-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.action-panel-preview {
  position: static;
  min-width: 240px;
  max-width: 240px;
  margin: 0;
  padding: 10px;
  border-radius: 16px;
  box-shadow: 0 8px 18px rgba(39, 63, 101, 0.06);
  align-self: flex-end;
  background: transparent;
  border-color: transparent;
}
.action-panel-preview .status {
  margin: 0;
  max-width: 240px;
  font-size: 12px;
}
.action-panel-preview-bottom {
  position: fixed;
  right: 18px;
  bottom: 18px;
  margin-top: 0;
  margin-left: auto;
  z-index: 20;
}
.action-panel-preview .action-panel-buttons {
  gap: 8px;
}
.action-panel-preview .primary-btn,
.action-panel-preview .secondary-btn,
.action-panel-preview .ghost-btn {
  padding: 10px 12px;
  border-radius: 14px;
  font-size: 14px;
}
.layout-ribbon {
  position: sticky;
  top: 0;
  z-index: 5;
  margin-bottom: 10px;
  padding: 10px 14px;
  border-radius: 18px;
  border: 1px solid rgba(88, 118, 170, 0.14);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.98) 0%, rgba(244, 249, 255, 0.96) 100%);
  box-shadow: 0 10px 22px rgba(39, 63, 101, 0.08);
  overflow: visible;
}
.layout-ribbon.is-open {
  z-index: 30;
}
.layout-ribbon:has(#layoutRibbonBody[hidden]) {
  padding: 10px 14px;
  border-radius: 16px;
}
.layout-ribbon__title {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 0;
  flex-wrap: wrap;
  cursor: pointer;
}
.layout-ribbon:has(#layoutRibbonBody[hidden]) .layout-ribbon__title {
  align-items: center;
  margin-bottom: 0;
}
.layout-ribbon:has(#layoutRibbonBody[hidden]) .eyebrow {
  margin-bottom: 0;
  font-size: 11px;
}
.layout-ribbon__title h3 {
  margin: 0;
  font-size: 16px;
  line-height: 1.1;
  letter-spacing: -0.02em;
}
.layout-ribbon:has(#layoutRibbonBody[hidden]) .layout-ribbon__title h3 {
  font-size: 15px;
}
.layout-ribbon__toggle {
  width: 30px;
  min-width: 30px;
  height: 30px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border-radius: 999px;
  border: 1px solid rgba(97, 126, 172, 0.16);
  background: rgba(255, 255, 255, 0.82);
  font-size: 16px;
  font-weight: 800;
  text-align: center;
  transition: transform 0.18s ease, background-color 0.18s ease;
}
.layout-ribbon:has(#layoutRibbonBody[hidden]) .layout-ribbon__toggle {
  transform: rotate(0deg);
}
.layout-ribbon.is-open .layout-ribbon__toggle {
  transform: rotate(90deg);
}
.layout-ribbon__grid {
  position: absolute;
  top: calc(100% + 10px);
  left: 0;
  right: 0;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  max-height: 360px;
  overflow: auto;
  padding: 14px;
  border-radius: 18px;
  border: 1px solid rgba(88, 118, 170, 0.14);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.99) 0%, rgba(244, 249, 255, 0.98) 100%);
  box-shadow: 0 22px 48px rgba(27, 45, 78, 0.16);
  backdrop-filter: blur(14px);
}
.layout-ribbon__grid[hidden] {
  display: none !important;
}
.layout-group {
  display: grid;
  gap: 10px;
  padding: 12px;
  border-radius: 18px;
  border: 1px solid rgba(92, 120, 171, 0.12);
  background: linear-gradient(180deg, rgba(251, 253, 255, 0.98) 0%, rgba(241, 246, 255, 0.94) 100%);
}
.layout-group__title {
  margin: 0;
  font-size: 13px;
  line-height: 1.1;
  color: #41699f;
  letter-spacing: 0.01em;
}
.layout-group__fields {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px 10px;
}
.layout-ribbon .field {
  margin-bottom: 0;
  padding: 6px 8px;
  border-radius: 12px;
  border: 1px solid rgba(92, 120, 171, 0.1);
  background: rgba(255, 255, 255, 0.78);
}
.layout-ribbon .field span {
  font-size: 11px;
  font-weight: 700;
  color: #4f6f9a;
}
.layout-ribbon .field input,
.layout-ribbon .field select {
  padding: 7px 9px;
  min-height: 34px;
  border-radius: 10px;
}
.preview-meta {
  display: none;
}
.preview-root {
  display: grid;
  gap: 24px;
  flex: 1 1 auto;
  min-height: 0;
  max-height: calc(100vh - 180px);
  overflow-y: auto;
  overflow-x: auto;
  padding-right: 10px;
}

.preview-root::-webkit-scrollbar {
  width: 14px;
  height: 14px;
}

.preview-root::-webkit-scrollbar-track {
  background: linear-gradient(180deg, #eff4fc 0%, #e1eaf7 100%);
  border-radius: 999px;
}

.preview-root::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, #8fb0dc 0%, #6287c4 100%);
  border: 2px solid #eff4fc;
  border-radius: 999px;
}

.preview-root::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(180deg, #7699cd 0%, #4f75b2 100%);
}
.empty-preview {
  padding: 44px;
  text-align: center;
  border-radius: var(--radius-lg);
  border: 1px dashed rgba(63, 110, 181, 0.24);
  background: rgba(255, 255, 255, 0.6);
}

.catalog-page {
      width: 210mm;
      min-height: 297mm;
      margin: 0 auto;
      background: var(--paper);
      box-shadow: var(--page-shadow);
      position: relative;
    overflow: hidden;
    zoom: var(--page-scale, 1);
    content-visibility: auto;
    contain-intrinsic-size: 210mm 297mm;
    }

.cover-page {
  padding: 17mm 16mm 15mm 11mm;
  background: #ffffff;
}
.cover-layout {
  height: 100%;
  display: grid;
  grid-template-columns: 14mm 1fr;
  gap: 10mm;
}
.cover-side {
  position: relative;
  background: linear-gradient(180deg, #4c627f 0%, #556f92 100%);
}
.cover-side::before,
.cover-side::after {
  content: "";
  position: absolute;
  left: 50%;
  width: 2px;
  background: #435978;
  transform-origin: top;
}
.cover-side::before { bottom: 38mm; height: 74mm; transform: rotate(-8deg); }
.cover-side::after { bottom: 18mm; height: 56mm; transform: rotate(12deg); }
.cover-title {
  margin-top: var(--cover-title-top, 14mm);
  margin-bottom: 26mm;
  color: #5787d9;
  text-align: center;
  font-size: 23px;
  font-weight: 300;
  letter-spacing: 0.03em;
}
.cover-ribbon {
  display: inline-block;
  position: relative;
  margin-top: var(--cover-ribbon-top, 0mm);
  padding: 8px 34px 8px 26px;
  color: #fff;
  background: #4d78c7;
  font-size: 10.5px;
}
.cover-ribbon::after {
  content: "";
  position: absolute;
  right: -18px;
  top: 0;
  border-top: 18px solid transparent;
  border-bottom: 18px solid transparent;
  border-left: 16px solid #4d78c7;
}
.cover-brand {
  margin-top: var(--cover-brand-top, 106mm);
  margin-left: auto;
  margin-right: auto;
  width: 98mm;
  padding: 7px 10px;
  border: 1px solid #79a5ea;
  color: #12a6e8;
  font-size: 29px;
  text-align: center;
  font-weight: 300;
}
.cover-minimal,
.cover-poster,
.cover-custom {
  height: 100%;
}
.cover-minimal {
  display: grid;
  align-content: space-between;
  padding: 10mm 8mm 20mm;
  background:
    radial-gradient(circle at top right, color-mix(in srgb, var(--cover-secondary, #11a4df) 20%, transparent) 0%, transparent 35%),
    linear-gradient(180deg, #ffffff 0%, #f7fbff 100%);
}
.cover-minimal-top {
  justify-self: end;
  padding: 4mm 6mm;
  border-radius: 999px;
  background: color-mix(in srgb, var(--cover-secondary, #11a4df) 16%, #ffffff);
  color: var(--cover-primary, #3f6eb5);
  font-size: 11px;
  font-weight: 700;
}
.cover-minimal-title {
  align-self: center;
  margin: 0;
  color: var(--cover-primary, #3f6eb5);
  font-size: 34px;
  line-height: 1.08;
  text-transform: uppercase;
}
.cover-minimal-brand {
  align-self: end;
  justify-self: start;
  color: var(--cover-secondary, #11a4df);
  font-size: 30px;
  font-weight: 300;
  border-bottom: 2px solid color-mix(in srgb, var(--cover-secondary, #11a4df) 45%, transparent);
}
.cover-poster {
  position: relative;
  overflow: hidden;
  background: linear-gradient(135deg, var(--cover-primary, #3f6eb5) 0%, var(--cover-secondary, #11a4df) 100%);
  color: #fff;
}
.cover-poster-band {
  position: absolute;
  inset: auto -40mm 35mm -40mm;
  height: 24mm;
  background: rgba(255, 255, 255, 0.12);
  transform: rotate(-8deg);
}
.cover-poster-content {
  position: relative;
  z-index: 1;
  display: grid;
  align-content: center;
  gap: 10mm;
  height: 100%;
  padding: 18mm;
}
.cover-poster-subtitle {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.18em;
}
.cover-poster-title {
  margin: 0;
  font-size: 36px;
  line-height: 1.02;
  text-transform: uppercase;
}
.cover-poster-brand {
  justify-self: start;
  padding: 4mm 7mm;
  border: 1px solid rgba(255, 255, 255, 0.42);
  font-size: 18px;
  letter-spacing: 0.12em;
}
.cover-custom {
  display: grid;
  align-content: space-between;
  padding: 16mm;
  background:
    linear-gradient(160deg, color-mix(in srgb, var(--cover-primary, #3f6eb5) 18%, #ffffff) 0%, #ffffff 48%, color-mix(in srgb, var(--cover-secondary, #11a4df) 18%, #ffffff) 100%);
}
.cover-custom-mark {
  justify-self: end;
  color: var(--cover-secondary, #11a4df);
  font-size: 16px;
  font-weight: 700;
  text-transform: uppercase;
}
.cover-custom-title {
  margin: 0;
  color: var(--cover-primary, #3f6eb5);
  font-size: 32px;
  line-height: 1.05;
}
.cover-custom-note {
  max-width: 120mm;
  padding: 5mm 6mm;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.72);
  color: #51627d;
  font-size: 15px;
  line-height: 1.45;
}
.cover-custom-subtitle {
  color: #6f82a0;
  font-size: 14px;
}

.table-page,
.cards-page {
  padding: 10mm 8mm 8mm;
}
.section-title {
    background: var(--accent);
    color: #fff;
    text-align: center;
    font-size: 8.8px;
    font-weight: 700;
    padding: calc((var(--section-header-height, 8.4mm) - 2.8mm) / 2) 2mm;
    min-height: var(--section-header-height, 8.4mm);
    border: var(--table-border-width, 0mm) solid #1b6fa6;
    border-bottom: none;
    text-transform: uppercase;
  }
.section-title-hidden {
  width: 100%;
  background: linear-gradient(180deg, rgba(17, 164, 223, 0.12) 0%, rgba(17, 164, 223, 0.06) 100%);
  color: #0b5f8f;
  border-style: dashed;
  border-bottom: 1px dashed #1b6fa6;
}
.catalog-row,
.catalog-card {
  position: relative;
}
.table-code-wrap {
  position: relative;
  min-height: 28px;
  padding-bottom: 12px;
  overflow: visible;
}
.preview-row-actions {
  position: absolute;
  left: 50%;
  bottom: -14px;
  display: flex;
  flex-direction: row;
  flex-wrap: nowrap;
  writing-mode: horizontal-tb;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-width: 76px;
  padding: 4px 8px;
  border: 1px solid rgba(17, 164, 223, 0.16);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.14);
  transform: translateX(-50%) translateY(6px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.16s ease, transform 0.16s ease;
  z-index: 3;
  backdrop-filter: blur(10px);
  white-space: nowrap;
}
.catalog-row:hover .preview-row-actions,
.catalog-row td:hover .preview-row-actions,
.catalog-card:hover .preview-row-actions,
.catalog-card-media:hover .preview-row-actions,
.catalog-card-body:hover .preview-row-actions {
  opacity: 1;
  pointer-events: auto;
  transform: translateX(-50%) translateY(0);
}
.card-row-actions {
  left: 50%;
  right: auto;
  bottom: 12px;
}
.row-action-btn {
  width: 28px;
  height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  writing-mode: horizontal-tb;
  border: 1px solid rgba(17, 164, 223, 0.12);
  border-radius: 999px;
  background: linear-gradient(180deg, #ffffff 0%, #eef8ff 100%);
  color: #0b74aa;
  font-size: 15px;
  font-weight: 800;
  line-height: 1;
  text-align: center;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.08);
}
.catalog-card .catalog-card-body {
  padding-bottom: 44px;
}
.row-action-btn-delete {
  color: #c2410c;
  border-color: rgba(194, 65, 12, 0.14);
}
.row-action-btn:hover {
  background: linear-gradient(180deg, #f9fdff 0%, #dff3ff 100%);
  transform: translateY(-1px);
}

.catalog-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
  font-size: 7.6px;
}
.catalog-table td,
.catalog-table th {
  border: var(--table-border-width, 0mm) solid #2e2e2e;
  vertical-align: middle;
  padding: 1mm 0.9mm;
}
.catalog-table .code-col { width: 6%; text-align: center; }
.catalog-table .photo-col { width: 19%; }
.catalog-table .title-col { width: 24%; }
.catalog-table .qty-col,
.catalog-table .price-col { width: 5.5%; text-align: center; }
.catalog-table .box-col { width: 7%; text-align: center; }
.catalog-table .barcode-col { width: 18%; }
.catalog-row { height: 31mm; }
.code-cell {
  writing-mode: vertical-rl;
  transform: rotate(180deg);
  text-align: center;
  font-size: 7.6px;
  color: #3f4c60;
}
.photo-cell {
    position: relative;
    text-align: center;
    background: var(--photo-background, #fff);
  }
.product-image {
    display: block;
    width: min(calc(var(--photo-width-percent, 100%) * var(--photo-scale, 1)), 100%);
    max-width: 100%;
    max-height: calc(var(--photo-height-mm, 26mm) * var(--photo-scale, 1));
    object-fit: contain;
    margin: 0 auto;
  }
.photo-placeholder {
    display: grid;
    place-items: center;
    height: calc(var(--photo-height-mm, 26mm) * var(--photo-scale, 1));
    color: #91a1ba;
    font-size: 7px;
    border: 1px dashed #cad6e5;
    background: var(--photo-background, transparent);
  }
.badge {
  position: absolute;
  top: 1.3mm;
  left: 1.1mm;
  width: 11.5mm;
  min-height: 11mm;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0.8mm 0.6mm;
  border: 0.5px solid rgba(255, 255, 255, 0.9);
  background: linear-gradient(180deg, #ff2323 0%, #e31313 100%);
  color: #fff;
  font-size: 4.9px;
  font-weight: 800;
  text-transform: uppercase;
  line-height: 1.02;
  letter-spacing: 0.03em;
  text-align: center;
  box-shadow: 0 1.2mm 2.8mm rgba(167, 21, 21, 0.22);
  transform: rotate(-7deg);
}
.badge::before {
  content: "ХИТ";
  position: absolute;
  left: 50%;
  top: 0.7mm;
  transform: translateX(-50%);
  font-size: 4.4px;
  line-height: 1;
  font-weight: 900;
  letter-spacing: 0.05em;
}
.badge::after {
  content: "ПРОДАЖ";
  position: absolute;
  left: 50%;
  top: 4.1mm;
  transform: translateX(-50%);
  font-size: 2.8px;
  line-height: 1;
  font-weight: 800;
  letter-spacing: 0.08em;
}
.name-cell {
  text-align: var(--value-text-align, center);
  font-size: var(--value-font-size, 11px);
  line-height: 1.12;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--value-text-color, #111111);
}
.name-main { color: inherit; }
.name-sub { color: #16a34a; font-size: 7.4px; }
.name-debug {
  margin-top: 4px;
  color: #c97a10;
  font-size: 10px;
  font-weight: 700;
}
.name-note { color: #11a4df; font-size: 7px; }
.metric-cell {
  text-align: var(--value-text-align, center);
  color: var(--value-text-color, #1842ff);
  font-size: var(--value-font-size, 11px);
  font-weight: 700;
}
.metric-label {
  display: block;
  margin-bottom: 0.8mm;
  color: #111;
  font-size: 7px;
}
.metric-inline-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 14px;
    margin-right: 4px;
  }
.barcode-cell {
  text-align: var(--value-text-align, center);
  color: var(--value-text-color, #111111);
}
.barcode-box {
  display: grid;
  place-items: center;
  gap: 1mm;
}
.barcode-box-empty {
  min-height: 18mm;
}
.barcode-empty {
  width: 100%;
  height: 15mm;
  border: 1px dashed #d2dceb;
  background: #fff;
}
.barcode-svg {
  display: block;
  width: 100%;
  min-height: 14mm;
  background: #fff;
}
.barcode-text {
  font-size: 5.6px;
  letter-spacing: 0.08em;
  color: var(--value-text-color, #111111);
}
.barcode-fallback {
  width: 100%;
  height: 15mm;
  background: repeating-linear-gradient(90deg,#111 0,#111 1px,transparent 1px,transparent 2px,#111 2px,#111 4px,transparent 4px,transparent 5px);
}
.extra-cell {
  text-align: var(--value-text-align, center);
  font-size: var(--value-font-size, 11px);
  color: var(--value-text-color, #111111);
  vertical-align: top;
}
.extra-title {
  font-size: 8px;
  color: var(--muted);
  margin-bottom: 4px;
}

.cards-layout {
  display: grid;
  gap: 12px;
  padding-top: 10px;
  min-height: 235mm;
  align-content: stretch;
}
.cards-layout.vertical {
  grid-template-columns: repeat(var(--card-columns, 2), minmax(0, 1fr));
  grid-template-rows: repeat(var(--card-rows, 1), minmax(0, 1fr));
}
.cards-layout.horizontal {
  grid-template-columns: repeat(var(--card-columns, 1), minmax(0, 1fr));
  grid-template-rows: repeat(var(--card-rows, 1), minmax(0, 1fr));
}
.catalog-card {
  display: grid;
  gap: 10px;
  border: 1px solid #d6deea;
  border-radius: 16px;
  overflow: hidden;
  background: #fff;
  min-height: 0;
}
.catalog-card.vertical.with-photo { grid-template-rows: 160px 1fr; }
.catalog-card.horizontal { grid-template-columns: 130px 1fr; }
.catalog-card.without-photo { padding-top: 0; }
.catalog-card-media {
    position: relative;
    padding: 12px;
    background: var(--photo-background, linear-gradient(180deg, #f3f8ff 0%, #ffffff 100%));
  }
.catalog-card-media .product-image {
  width: min(calc(var(--photo-width-percent, 100%) * var(--photo-scale, 1)), 100%);
  max-height: calc(var(--photo-height-mm, 26mm) * var(--photo-scale, 1));
}
.catalog-card-media .photo-placeholder {
  height: calc(var(--photo-height-mm, 26mm) * var(--photo-scale, 1));
}
.catalog-card-body {
  display: grid;
  gap: 10px;
  padding: 14px;
  min-height: 0;
  align-content: start;
  overflow: hidden;
  text-align: var(--value-text-align, center);
  color: var(--value-text-color, #111111);
}
.catalog-card-topline {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
}
.chip {
  display: inline-flex;
  padding: 4px 10px;
  border-radius: 999px;
  background: #eef4ff;
  color: #3f6eb5;
  font-size: 12px;
  font-weight: 700;
}
.chip-accent {
  background: #ffe7e7;
  color: #d02222;
}
.catalog-card h3 {
  margin-bottom: 0;
  font-size: 18px;
  line-height: 1.2;
  color: inherit;
}
.card-subtitle {
  margin-bottom: 0;
  color: #2f7d3c;
  font-weight: 700;
}
.card-debug {
  margin: 6px 0 0;
  color: #c97a10;
  font-size: 12px;
  font-weight: 700;
}
.preview-editable {
  cursor: pointer;
  transition: background-color 0.18s ease, box-shadow 0.18s ease;
}
.preview-editable:hover {
  background: rgba(17, 164, 223, 0.08);
  box-shadow: inset 0 0 0 1px rgba(17, 164, 223, 0.18);
}
.image-editor-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
}
.image-editor-row .ghost-btn {
  white-space: nowrap;
}
.edit-modal[hidden] {
  display: none;
}
.edit-modal {
  position: fixed;
  inset: 0;
  z-index: 1200;
}
.edit-modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.42);
  backdrop-filter: blur(6px);
}
.edit-modal__dialog {
  position: relative;
  z-index: 1;
  width: min(520px, calc(100vw - 32px));
  margin: 8vh auto 0;
  padding: 20px;
  border-radius: 24px;
  background: linear-gradient(180deg, #ffffff 0%, #f4fbff 100%);
  box-shadow: 0 24px 60px rgba(15, 23, 42, 0.22);
}
.edit-modal__header,
.edit-modal__footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.edit-modal__header h3 {
  margin: 0;
}
.edit-modal__body {
  padding: 16px 0 8px;
}
.edit-modal__body .field + .field {
  margin-top: 10px;
}
.title-rich-editor {
  display: grid;
  gap: 10px;
}
.title-rich-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  padding: 8px;
  border: 1px solid rgba(92, 120, 171, 0.16);
  border-radius: 14px;
  background: linear-gradient(180deg, #f8fbff 0%, #edf5ff 100%);
}
.format-btn,
.format-control {
  min-height: 36px;
  border: 1px solid rgba(80, 112, 164, 0.18);
  border-radius: 11px;
  background: #ffffff;
}
.format-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 38px;
  padding: 0 12px;
  color: #25466f;
  font-weight: 800;
  cursor: pointer;
}
.format-btn-wide {
  min-width: 92px;
}
.format-btn-light {
  color: #65758e;
  background: #f7f9fc;
}
.format-control {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 8px;
  color: #4f6f9a;
  font-size: 11px;
  font-weight: 800;
}
.format-control input[type="color"] {
  width: 30px;
  height: 24px;
  padding: 0;
  border: 0;
  background: transparent;
}
.format-control input[type="number"] {
  width: 56px;
  min-height: 26px;
  padding: 2px 6px;
  border-radius: 8px;
}
.title-rich-surface {
  min-height: 96px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
  color: #111;
  font-weight: 700;
  line-height: 1.35;
  outline: none;
}
.title-rich-surface:focus {
  border-color: #8fc7ee;
  box-shadow: 0 0 0 4px rgba(17, 164, 223, 0.12);
}
.title-rich-hint {
  margin: 0;
  color: #70809a;
  font-size: 12px;
}
.modal-checkbox {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 8px;
  color: #3d5374;
  font-weight: 600;
}

body.export-mode .preview-row-actions,
body.export-mode .edit-modal,
body.export-mode .layout-ribbon__grid {
    display: none !important;
  }
  body.export-mode .catalog-page {
    content-visibility: auto !important;
    zoom: 1 !important;
    transform: none !important;
    box-shadow: none !important;
  }
  body.export-mode .catalog-page.capture-page {
    content-visibility: visible !important;
  }
body.export-mode .cover-side {
  background: linear-gradient(180deg, var(--cover-primary, #495c7a) 0%, #b8c7dc 100%) !important;
}
body.export-mode .cover-minimal {
  background:
    radial-gradient(circle at top right, rgba(17, 164, 223, 0.12) 0%, transparent 35%),
    linear-gradient(180deg, #ffffff 0%, #f7fbff 100%) !important;
}
body.export-mode .cover-minimal-top {
  background: #edf7ff !important;
}
body.export-mode .cover-minimal-brand {
  border-bottom: 2px solid rgba(17, 164, 223, 0.3) !important;
}
body.export-mode .cover-custom {
  background: linear-gradient(160deg, #eef5ff 0%, #ffffff 48%, #eefaff 100%) !important;
}
.card-description {
  margin-bottom: 0;
  color: var(--muted);
  line-height: 1.45;
  display: -webkit-box;
  -webkit-line-clamp: 4;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.catalog-card-metrics {
    display: grid;
    gap: 6px;
    color: var(--value-text-color, #111111);
    font-size: var(--value-font-size, 11px);
  }
.catalog-card-metrics span {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.catalog-card-metrics strong { color: inherit; }
.catalog-card-extra {
  display: grid;
  gap: 6px;
  padding-top: 4px;
  border-top: 1px solid #e1e8f3;
}
.card-extra-row {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  font-size: var(--value-font-size, 11px);
  color: var(--value-text-color, #111111);
}
.card-extra-row strong {
  color: inherit;
  text-align: right;
}
.barcode-inline .barcode-box { justify-items: start; }
.barcode-inline .barcode-svg,
.barcode-inline .barcode-fallback { max-width: 220px; }

.page-footer {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin-top: 5mm;
  color: #667a97;
  font-size: 8px;
  text-transform: uppercase;
}

@media (max-width: 1200px) {
  .page-shell {
    grid-template-columns: 1fr;
    height: auto;
    overflow: visible;
  }
  .sidebar,
    .preview-shell {
      min-height: auto;
      height: auto;
    }
    .preview-root { max-height: none; }
    .layout-ribbon {
      position: static;
    }
    .layout-ribbon__grid {
      position: static;
      grid-template-columns: 1fr;
      max-height: none;
      margin-top: 10px;
    }
    .layout-group__fields { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  }
  
  @media (max-width: 900px) {
    .page-shell { padding: 14px; gap: 14px; }
    .sidebar, .preview-shell { padding: 16px; }
    .field-grid, .mapping-grid, .compact-mapping-grid, .inline-fields, .editor-grid, .editor-style-grid { grid-template-columns: 1fr; }
    .action-panel-preview { min-width: 0; max-width: none; width: 100%; }
    .action-panel-preview-bottom { position: static; width: 100%; }
    .layout-ribbon__grid { grid-template-columns: 1fr; }
    .layout-group__fields { grid-template-columns: 1fr; }
    .catalog-page { width: 100%; min-height: auto; }
    .cover-page, .table-page, .cards-page { padding: 18px; }
  .cover-layout { grid-template-columns: 1fr; }
  .cover-side { min-height: 100px; }
  .cover-brand { width: 100%; margin-top: 40px; font-size: 28px; }
  .catalog-table { font-size: 8px; }
  .cards-layout.vertical { grid-template-columns: 1fr; }
  .catalog-card.horizontal { grid-template-columns: 1fr; }
}







