:root {
  --green: #128447;
  --green-dark: #0d6f3b;
  --green-soft: #e9f6ee;
  --red: #e3272d;
  --yellow: #ffd916;
  --ink: #171b1a;
  --muted: #69726e;
  --line: #dde3e0;
  --line-strong: #cbd3cf;
  --surface: #ffffff;
  --surface-soft: #f6f8f7;
  --sidebar-width: 196px;
  --editor-width: 440px;
  --radius: 7px;
  --label-width: 105mm;
  --label-height: 30mm;
  --label-gap: 0mm;
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  color: var(--ink);
  background: #eef2f0;
  font-family: "Segoe UI", Arial, sans-serif;
  font-size: 14px;
  letter-spacing: 0;
}

button,
input,
select {
  font: inherit;
  letter-spacing: 0;
}

button {
  color: inherit;
}

button:focus-visible,
input:focus-visible,
select:focus-visible {
  outline: 2px solid rgba(18, 132, 71, 0.28);
  outline-offset: 1px;
}

.app-shell {
  display: grid;
  grid-template-columns: var(--sidebar-width) minmax(0, 1fr);
  height: 100vh;
  min-height: 100vh;
  overflow: hidden;
}

.sidebar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  flex-direction: column;
  width: var(--sidebar-width);
  height: 100vh;
  padding: 18px 10px 16px;
  border-right: 1px solid var(--line);
  background: var(--surface);
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 48px;
  padding: 2px 10px 18px;
  font-size: 19px;
  font-weight: 700;
  line-height: 0.94;
}

.brand strong {
  color: var(--green);
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  flex: 0 0 36px;
  transform: rotate(-8deg);
  border-radius: 6px 6px 6px 13px;
  background: var(--green);
  color: #fff;
  font-size: 12px;
  font-weight: 800;
}

.main-nav {
  display: grid;
  gap: 4px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 11px;
  min-height: 44px;
  padding: 0 11px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
}

.nav-item:hover {
  background: var(--surface-soft);
}

.nav-item.active {
  background: var(--green-soft);
  color: var(--green-dark);
}

.nav-icon {
  display: grid;
  place-items: center;
  width: 22px;
  font-size: 19px;
  font-weight: 400;
}

.sidebar-footer {
  display: grid;
  grid-template-columns: 10px 1fr;
  gap: 2px 7px;
  align-items: center;
  margin-top: auto;
  padding: 12px 10px 0;
  color: var(--muted);
  font-size: 12px;
}

.sidebar-footer small {
  grid-column: 2;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--green);
}

.main-area {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  min-width: 0;
  height: 100vh;
  min-height: 100vh;
  overflow: hidden;
  background: var(--surface-soft);
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  min-height: 74px;
  padding: 12px 18px 12px 22px;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}

.topbar h1 {
  margin: 0;
  font-size: 22px;
  line-height: 1.2;
}

.topbar p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.title-meta {
  display: flex;
  align-items: center;
  gap: 12px;
}

.network-address {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-height: 26px;
  margin-top: 4px;
  padding: 0 8px;
  border: 1px solid #b8dcc6;
  border-radius: 5px;
  background: var(--green-soft);
  color: var(--green-dark);
  font-size: 11px;
  cursor: pointer;
}

.network-address .status-dot {
  width: 7px;
  height: 7px;
}

.network-address strong {
  font-weight: 800;
}

.database-status {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-height: 26px;
  margin-top: 4px;
  padding: 0 8px;
  border: 1px solid #cbd6d0;
  border-radius: 5px;
  background: #f3f7f5;
  color: #34463c;
  font-size: 11px;
}

.database-status .status-dot {
  width: 7px;
  height: 7px;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.search-box {
  display: flex;
  align-items: center;
  width: min(330px, 28vw);
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  color: var(--muted);
}

.search-box span {
  padding-left: 12px;
  font-size: 22px;
  line-height: 1;
}

.search-box input {
  width: 100%;
  border: 0;
  outline: 0;
  padding: 10px 12px 10px 8px;
  background: transparent;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 42px;
  padding: 0 16px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: #fff;
  font-weight: 700;
  cursor: pointer;
  transition: background 140ms ease, border-color 140ms ease, transform 140ms ease;
}

.button:hover {
  transform: translateY(-1px);
  border-color: #aab5af;
}

.button.primary {
  border-color: var(--green);
  background: var(--green);
  color: #fff;
}

.button.primary:hover {
  background: var(--green-dark);
}

.button.secondary {
  background: #fff;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(550px, 1fr) var(--editor-width);
  min-height: 0;
  overflow: hidden;
}

.catalog-panel {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  min-width: 0;
  margin: 12px 10px 12px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  overflow: hidden;
}

.table-head-tools {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 52px;
  padding: 8px 14px;
  border-bottom: 1px solid var(--line);
}

.check-control {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}

input[type="checkbox"] {
  width: 17px;
  height: 17px;
  accent-color: var(--green);
}

.table-filters {
  display: flex;
  gap: 3px;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface-soft);
}

.filter-button {
  min-height: 30px;
  padding: 0 10px;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}

.filter-button.active {
  background: #fff;
  color: var(--ink);
  box-shadow: 0 1px 3px rgba(23, 27, 26, 0.12);
}

.table-scroll {
  min-height: 0;
  overflow: auto;
}

.product-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}

.product-table th {
  position: sticky;
  top: 0;
  z-index: 2;
  height: 42px;
  padding: 8px 10px;
  border-bottom: 1px solid var(--line);
  background: #fafbfa;
  color: #4f5954;
  font-size: 11px;
  font-weight: 700;
  text-align: left;
  white-space: nowrap;
}

.product-table td {
  height: 58px;
  padding: 7px 10px;
  border-bottom: 1px solid #e8ecea;
  vertical-align: middle;
}

.product-table tbody tr {
  cursor: pointer;
}

.product-table tbody tr:hover {
  background: #fafcfb;
}

.product-table tbody tr.current {
  box-shadow: inset 3px 0 var(--green);
}

.product-table tbody tr.selected {
  background: #f1f9f4;
}

.select-column {
  width: 38px;
}

.action-column {
  width: 58px;
  text-align: center !important;
}

.product-name-cell {
  min-width: 165px;
  max-width: 240px;
}

.product-name-cell strong,
.product-name-cell span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.product-name-cell strong {
  font-size: 12px;
}

.product-name-cell span {
  margin-top: 3px;
  color: var(--muted);
  font-size: 10px;
}

.price-offer {
  color: var(--red);
  font-weight: 700;
}

.status-tag {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0 8px;
  border-radius: 4px;
  background: var(--green-soft);
  color: var(--green-dark);
  font-size: 10px;
  font-weight: 700;
}

.status-tag.offer {
  background: #fff0a8;
  color: #5d4c00;
}

.row-stepper,
.stepper {
  display: inline-grid;
  grid-template-columns: 32px 42px 32px;
  height: 34px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: #fff;
}

.row-stepper {
  grid-template-columns: 25px 31px 25px;
  height: 29px;
}

.row-stepper button,
.stepper button {
  border: 0;
  background: transparent;
  cursor: pointer;
}

.row-stepper button:hover,
.stepper button:hover {
  background: var(--surface-soft);
}

.row-stepper input,
.stepper input {
  min-width: 0;
  border: 0;
  border-right: 1px solid var(--line);
  border-left: 1px solid var(--line);
  outline: 0;
  text-align: center;
  appearance: textfield;
}

.row-stepper input::-webkit-inner-spin-button,
.stepper input::-webkit-inner-spin-button {
  appearance: none;
}

.row-action {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  margin: auto;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: #fff;
  cursor: pointer;
}

.empty-catalog {
  display: grid;
  place-items: center;
  align-content: center;
  gap: 6px;
  min-height: 260px;
  color: var(--muted);
}

.empty-catalog strong {
  color: var(--ink);
}

.editor-panel {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  min-width: 0;
  border-left: 1px solid var(--line);
  background: var(--surface);
}

.editor-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  min-height: 48px;
  border-bottom: 1px solid var(--line);
}

.editor-tab {
  position: relative;
  border: 0;
  background: #fff;
  color: var(--muted);
  font-weight: 700;
  cursor: pointer;
}

.editor-tab.active {
  color: var(--green-dark);
}

.editor-tab.active::after {
  position: absolute;
  right: 0;
  bottom: -1px;
  left: 0;
  height: 2px;
  background: var(--green);
  content: "";
}

.editor-section {
  min-height: 0;
  padding: 14px;
  overflow-y: auto;
}

.field-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.field-grid.three {
  grid-template-columns: repeat(3, 1fr);
}

.field {
  display: grid;
  gap: 5px;
  margin-bottom: 10px;
}

.field > span,
.model-heading > span,
.preview-heading > span {
  color: #56605b;
  font-size: 11px;
  font-weight: 700;
}

.field input,
.field select,
.short-input {
  width: 100%;
  height: 38px;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 5px;
  padding: 0 10px;
  background: #fff;
  color: var(--ink);
}

.field input:focus,
.field select:focus,
.short-input:focus {
  border-color: var(--green);
}

.model-heading,
.preview-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin: 4px 0 8px;
}

.preview-heading {
  margin-top: 12px;
}

.preview-heading small {
  color: var(--muted);
}

.text-button {
  min-height: 30px;
  border: 0;
  background: transparent;
  color: var(--green-dark);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}

.model-list {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 7px;
}

.model-option {
  position: relative;
  display: grid;
  grid-template-rows: 50px auto;
  gap: 5px;
  min-width: 0;
  padding: 5px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: #fff;
  cursor: pointer;
}

.model-option:hover {
  border-color: #9db0a6;
}

.model-option.active {
  border: 2px solid var(--green);
  padding: 4px;
}

.model-option span {
  overflow: hidden;
  font-size: 9px;
  line-height: 1.15;
  text-align: center;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.model-thumb {
  display: grid;
  place-items: center;
  overflow: hidden;
  border: 1px solid #d5dad7;
  background: #fff;
  color: #111;
  font-size: 10px;
  font-weight: 900;
}

.model-thumb.yellow {
  border-color: #f2c900;
  background: var(--yellow);
}

.model-thumb.red {
  border: 3px solid var(--red);
  background: #fff5c8;
  color: var(--red);
}

.model-thumb.barcode {
  background: repeating-linear-gradient(90deg, #111 0 1px, #fff 1px 3px);
}

.preview-stage {
  display: grid;
  place-items: center;
  min-height: 148px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #f4f6f5;
  overflow: hidden;
}

.label-preview,
.print-label {
  position: relative;
  width: 100%;
  aspect-ratio: 3.5 / 1;
  overflow: hidden;
  border: 1px solid #c8cecb;
  border-radius: 5px;
  background: #fff;
  color: #111;
}

.label-preview.template-normal,
.print-label.template-normal {
  display: grid;
  grid-template-columns: 1fr 0.9fr;
  grid-template-rows: auto 1fr;
  padding: 8px 11px;
  background: #fff;
}

.label-preview.template-normal .promo-title,
.print-label.template-normal .promo-title {
  display: grid;
  height: 1.9em;
  place-items: center;
  grid-column: 1 / -1;
  color: var(--green-dark);
  font-size: 20px;
}

.label-preview.template-promotion,
.print-label.template-promotion {
  padding: 7px 12px 8px;
  border: 2px solid #ef3036;
  background: var(--yellow);
}

.label-preview.template-promotion_red,
.print-label.template-promotion_red {
  padding: 7px 12px 8px;
  border: 8px solid var(--red);
  background: #fff6c9;
}

.label-preview.template-economy,
.print-label.template-economy {
  display: grid;
  grid-template-columns: 1.2fr 0.8fr;
  padding: 10px 13px;
  background: #fff;
}

.label-preview.template-barcode,
.print-label.template-barcode {
  display: grid;
  grid-template-columns: 1.1fr 1fr;
  gap: 10px;
  align-items: center;
  padding: 9px 13px;
  background: #fff;
}

.promo-title {
  overflow: hidden;
  color: var(--red);
  font-size: 29px;
  font-weight: 950;
  line-height: 0.92;
  text-align: center;
  white-space: normal;
}

.promo-name {
  display: grid;
  height: 2em;
  place-items: center;
  overflow: hidden;
  margin-top: 3px;
  font-size: 13px;
  font-weight: 850;
  line-height: 1;
  text-align: center;
  white-space: normal;
}

.promo-prices {
  display: grid;
  grid-template-columns: 0.8fr 1.2fr;
  align-items: end;
  gap: 12px;
  margin-top: 4px;
}

.promo-price-block {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: end;
  column-gap: 4px;
  min-width: 0;
}

.promo-price-block small {
  align-self: center;
  font-size: 10px;
  font-weight: 800;
}

.promo-price-block strong {
  display: block;
  min-width: 0;
  overflow: hidden;
  font-size: 27px;
  font-weight: 950;
  line-height: 0.8;
}

.promo-price-block.offer strong {
  font-size: 45px;
}

.promo-price-block.regular strong {
  text-decoration: line-through;
  text-decoration-thickness: 2px;
}

.promo-note {
  position: absolute;
  right: 8px;
  bottom: 3px;
  left: 8px;
  overflow: hidden;
  height: 8px;
  font-size: 6px;
  font-weight: 600;
  line-height: 1;
  text-align: center;
  white-space: nowrap;
}

.normal-price {
  align-self: center;
  min-width: 0;
  overflow: hidden;
  font-size: 37px;
  font-weight: 950;
}

.preview-barcode {
  display: grid;
  align-items: center;
  min-width: 0;
}

.preview-barcode svg {
  width: 100%;
  height: 50px;
}

.economy-copy {
  display: grid;
  align-content: center;
  overflow: hidden;
}

.economy-copy strong {
  display: block;
  height: 2.1em;
  overflow: hidden;
  font-size: 14px;
  line-height: 1.05;
  white-space: normal;
}

.economy-copy span {
  margin-top: 6px;
  color: var(--muted);
  font-size: 10px;
}

.economy-price {
  display: grid;
  min-width: 0;
  place-items: center;
  overflow: hidden;
  border-left: 1px solid var(--line-strong);
  font-size: 34px;
  font-weight: 950;
}

.barcode-copy strong,
.barcode-copy span {
  display: block;
  overflow: hidden;
}

.barcode-copy strong {
  height: 2.1em;
  font-size: 14px;
  line-height: 1.05;
  white-space: normal;
}

.barcode-copy span {
  margin-top: 6px;
  font-size: 27px;
  font-weight: 950;
  white-space: nowrap;
}

[data-fit-text] {
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
}

.form-actions {
  display: flex;
  gap: 9px;
  margin-top: 12px;
}

.grow {
  flex: 1;
}

.icon-button {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  cursor: pointer;
}

.icon-button.danger {
  color: #b4232c;
}

.setting-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 62px;
  border-bottom: 1px solid var(--line);
}

.setting-row strong,
.setting-row small {
  display: block;
}

.setting-row strong {
  font-size: 12px;
}

.setting-row small {
  margin-top: 3px;
  color: var(--muted);
  font-size: 10px;
}

.stepper.compact {
  grid-template-columns: 30px 48px 30px;
  flex: 0 0 auto;
}

.short-input {
  width: 96px;
}

.print-summary {
  display: grid;
  gap: 4px;
  margin-top: 16px;
  padding: 13px;
  border-left: 3px solid var(--green);
  background: var(--green-soft);
}

.print-summary span {
  color: var(--muted);
  font-size: 11px;
}

.editor-footer {
  display: grid;
  grid-template-columns: 1fr 0.8fr;
  gap: 10px;
  padding: 12px 14px;
  border-top: 1px solid var(--line);
  background: #fff;
}

.selection-bar {
  display: flex;
  align-items: center;
  gap: 18px;
  min-height: 56px;
  padding: 8px 18px;
  border-top: 1px solid var(--line);
  background: var(--surface);
  font-size: 12px;
}

.selection-total {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-left: auto;
}

.selection-total strong {
  color: var(--green-dark);
  font-size: 21px;
}

.app-status {
  min-width: 180px;
  color: var(--muted);
  text-align: right;
}

.toast {
  position: fixed;
  z-index: 100;
  right: 18px;
  bottom: 72px;
  max-width: 360px;
  padding: 12px 15px;
  border-radius: 6px;
  background: #17201b;
  color: #fff;
  box-shadow: 0 10px 28px rgba(23, 32, 27, 0.25);
  opacity: 0;
  pointer-events: none;
  transform: translateY(8px);
  transition: opacity 160ms ease, transform 160ms ease;
}

.toast.visible {
  opacity: 1;
  transform: translateY(0);
}

.hidden {
  display: none !important;
}

.print-root {
  display: none;
}

.print-root.measuring {
  position: fixed;
  left: -100000px;
  display: grid;
  grid-template-columns: repeat(var(--print-columns, 1), var(--label-width));
  gap: var(--label-gap);
  visibility: hidden;
}

.print-root.measuring .print-label {
  width: var(--label-width);
  height: var(--label-height);
}

@media (max-width: 1180px) {
  :root {
    --sidebar-width: 72px;
    --editor-width: 390px;
  }

  .brand {
    justify-content: center;
    padding-inline: 0;
  }

  .brand > span:last-child,
  .nav-item > span:last-child,
  .sidebar-footer span:not(.status-dot),
  .sidebar-footer small {
    display: none;
  }

  .nav-item {
    justify-content: center;
    padding: 0;
  }

  .sidebar-footer {
    display: flex;
    justify-content: center;
  }

  .product-table th:nth-child(3),
  .product-table td:nth-child(3) {
    display: none;
  }
}

@media (max-width: 900px) {
  :root {
    --sidebar-width: 100%;
  }

  .app-shell {
    display: block;
    height: auto;
    overflow: visible;
  }

  .sidebar {
    position: static;
    width: 100%;
    height: auto;
    padding: 8px 12px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .brand,
  .sidebar-footer {
    display: none;
  }

  .main-nav {
    display: flex;
    overflow-x: auto;
  }

  .nav-item {
    flex: 0 0 auto;
    justify-content: flex-start;
    padding: 0 12px;
  }

  .nav-item > span:last-child {
    display: inline;
  }

  .main-area {
    height: auto;
    min-height: calc(100vh - 61px);
    overflow: visible;
  }

  .topbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .title-meta {
    align-items: flex-start;
    flex-direction: column;
    gap: 3px;
  }

  .topbar-actions,
  .search-box {
    width: 100%;
  }

  .workspace {
    grid-template-columns: 1fr;
    overflow: visible;
  }

  .catalog-panel {
    height: 58vh;
    min-height: 440px;
    max-height: 620px;
  }

  .editor-panel {
    border-top: 1px solid var(--line);
    border-left: 0;
  }

  .editor-section {
    max-height: none;
  }
}

@media (max-width: 620px) {
  .topbar-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .search-box {
    grid-column: 1 / -1;
  }

  .button {
    padding-inline: 10px;
  }

  .catalog-panel {
    margin: 8px;
  }

  .table-head-tools {
    align-items: flex-start;
    flex-direction: column;
  }

  .product-table th:nth-child(4),
  .product-table td:nth-child(4),
  .product-table th:nth-child(7),
  .product-table td:nth-child(7) {
    display: none;
  }

  .model-list {
    grid-template-columns: repeat(3, 1fr);
  }

  .field-grid,
  .field-grid.three {
    grid-template-columns: 1fr;
  }

  .selection-bar {
    flex-wrap: wrap;
  }

  .app-status {
    display: none;
  }
}

@media print {
  @page {
    margin: 0;
  }

  body {
    background: #fff;
  }

  .no-print,
  .toast {
    display: none !important;
  }

  .app-shell {
    display: none;
  }

  .print-root {
    display: grid;
    grid-template-columns: repeat(var(--print-columns, 1), var(--label-width));
    gap: var(--label-gap);
    align-content: start;
    padding: var(--print-margin, 0mm);
  }

  .print-label {
    width: var(--label-width);
    height: var(--label-height);
    border-radius: 0;
    break-inside: avoid;
    page-break-inside: avoid;
  }
}
/* Interface v4: catálogo legível, edição segura e impressão com paginação real. */
@media screen {
  :root { --sidebar-width: 180px; --editor-width: 410px; --radius: 10px; --ink: #19352a; --muted: #62766c; --surface-soft: #f3f6f4; }
  .sidebar { background: #103d2c; color: #e7f3eb; border: 0; padding-top: 26px; }
  .brand { line-height: 1.04; padding-bottom: 30px; }
  .brand strong { color: #94d8ad; }
  .brand-mark { background: #b5ecc9; color: #103d2c; transform: none; border-radius: 10px; }
  .main-nav { gap: 7px; }
  .nav-item { min-height: 47px; color: #c4d9cd; font-size: 13px; }
  .nav-item:hover { background: #1c503c; }
  .nav-item.active { color: #143d2b; background: #c2ebd0; }
  .sidebar-footer { color: #adccba; }
  .sidebar-footer .status-dot { background: #91d8ac; }
  .topbar { flex-wrap: wrap; gap: 12px 22px; padding: 18px 22px; }
  .topbar > div:first-child { flex: 1 1 340px; }
  .topbar h1 { font-size: 24px; font-weight: 720; letter-spacing: -.6px; }
  .title-meta { flex-wrap: wrap; gap: 4px 10px; }
  .topbar-actions { flex: 1 1 590px; }
  .search-box { flex: 1; min-width: 210px; width: auto; background: #f7faf8; }
  .search-box input { font-size: 12px; }
  .template-download { white-space: nowrap; font-size: 11px; }
  .button { border-radius: 8px; font-size: 12px; min-height: 41px; white-space: nowrap; }
  .button:disabled, button:disabled { cursor: default; opacity: .45; transform: none; }
  button:focus-visible, input:focus-visible, select:focus-visible, a:focus-visible, tr:focus-visible { outline: 3px solid #76be92; outline-offset: 2px; }
  .workspace { grid-template-columns: minmax(0, 1fr) var(--editor-width); gap: 0; }
  .catalog-panel { grid-template-rows: auto auto minmax(0,1fr) auto; margin: 18px 16px 18px 20px; box-shadow: 0 2px 8px #143d2b05; }
  .catalog-panel:has(.connection-banner:not(.hidden)) { grid-template-rows: auto auto auto minmax(0,1fr) auto; }
  .table-head-tools { padding: 12px 16px; }
  .catalog-controls { display:flex; gap: 12px; align-items:end; padding: 12px 16px; border-bottom: 1px solid var(--line); background: #fbfcfb; }
  .compact-field { display:grid; gap:5px; min-width:0; }
  .compact-field span { font-size:10px; font-weight:650; color:var(--muted); }
  .compact-field select { max-width:230px; min-width:135px; height:34px; border:1px solid var(--line); border-radius:6px; color:var(--ink); background:white; padding:0 8px; font-size:11px; }
  .result-count { margin-left:auto; color:var(--muted); font-size:10px; white-space:nowrap; padding-bottom:10px; }
  .product-table { font-variant-numeric:tabular-nums; }
  .product-table td { height:64px; }
  .product-table td:nth-child(4), .product-table td:nth-child(5) { white-space:nowrap; }
  .product-table th { font-size:10px; text-transform:uppercase; letter-spacing:.35px; color:#708077; }
  .product-name-cell strong { font-size:12px; font-weight:650; }
  .product-name-cell span { font-size:10px; }
  .row-stepper { grid-template-columns:23px 33px 23px; }
  .product-table tr.current { background:#f6fbf8; }
  .catalog-pagination { display:flex; align-items:center; gap:12px; padding:10px 14px; border-top:1px solid var(--line); background:white; min-height:56px; }
  .catalog-pagination > span { margin-left:auto; color:var(--muted); font-size:10px; text-align:right; }
  .catalog-pagination .text-button { font-size:11px; }
  .page-buttons { display:flex; gap:5px; }
  .page-buttons .icon-button { width:30px; height:30px; font-size:20px; }
  .editor-panel { margin:18px 18px 18px 0; border:1px solid var(--line); border-radius:var(--radius); overflow:hidden; box-shadow:0 2px 8px #143d2b05; }
  .editor-tabs { min-height:46px; }
  .editor-tab { font-size:12px; }
  .editor-intro { display:flex; align-items:center; justify-content:space-between; gap:8px; margin-bottom:16px; }
  .editor-intro h2 { font-size:16px; margin:0; letter-spacing:-.2px; }
  .draft-status { color:#3c7355; font-size:10px; background:#edf7f0; padding:5px 8px; border-radius:5px; white-space:nowrap; }
  .draft-status.unsaved { color:#8d5a10; background:#fff3d9; }
  .editor-section { padding:17px; }
  .field { gap:6px; margin-bottom:13px; }
  .field > span { font-size:11px; font-weight:650; }
  .field input, .field select { height:39px; font-size:12px; border-radius:6px; }
  .field input[aria-invalid=true] { border-color:#c84639; background:#fff9f8; }
  .form-message { padding:10px 12px; background:#fff1e8; color:#9a3d19; border:1px solid #f0cdbb; border-radius:7px; font-size:12px; line-height:1.5; }
  .model-heading { margin-top:10px; }
  .model-option { border-radius:7px; }
  .preview-stage { border-radius:8px; background:#f0f4f1; }
  .editor-footer { gap:9px; padding:13px 16px; background:#fafcfb; }
  .output-summary { grid-column:1/-1; margin:0 0 3px; font-size:11px; line-height:1.5; color:var(--muted); overflow-wrap:anywhere; }
  .pdf-result { grid-column:1/-1; color:var(--green-dark); font-weight:650; font-size:12px; margin-bottom:5px; }
  .selection-bar { min-height:59px; font-size:11px; padding-inline:22px; }
  .selection-total { border-left:1px solid var(--line); padding-left:18px; }
  .selection-total strong { font-variant-numeric:tabular-nums; }
  .app-status { min-width:150px; font-size:11px; }
  .connection-banner { padding:10px 14px; background:#fff3e5; color:#8a5310; font-size:11px; display:flex; align-items:center; justify-content:space-between; gap:10px; }
  .database-status.offline { background:#fff3e5; color:#8a5310; border-color:#e8cc9c; }
  .database-status.offline .status-dot { background:#bd7a22; }
  .empty-catalog { padding:20px; text-align:center; }
  .empty-catalog .button { margin-top:10px; }
  .print-summary small { font-size:11px; line-height:1.5; color:#426650; margin-top:7px; }
  dialog { width:min(680px, calc(100vw - 32px)); max-height:85vh; overflow:auto; border:1px solid var(--line); border-radius:14px; padding:26px; color:var(--ink); box-shadow:0 24px 80px #142b2340; }
  dialog::backdrop { background:#102c2266; backdrop-filter:blur(3px); }
  .eyebrow { color:var(--green-dark); font-size:10px; letter-spacing:1.2px; font-weight:750; }
  .dialog-heading h2 { margin:8px 0 0; font-size:24px; letter-spacing:-.6px; }
  #import-summary { color:var(--muted); line-height:1.5; font-size:13px; }
  #import-errors { white-space:pre-wrap; font-family:inherit; }
  .import-table-scroll { overflow:auto; max-height:280px; border:1px solid var(--line); border-radius:8px; }
  .import-table { width:100%; border-collapse:collapse; font-size:12px; }
  .import-table td,.import-table th { padding:12px; text-align:left; border-bottom:1px solid var(--line); }
  .import-table th { background:#f4f8f5; }
  .dialog-note { font-size:11px; line-height:1.6; color:var(--muted); }
  .dialog-actions { display:flex; justify-content:flex-end; gap:10px; margin-top:22px; }
  @media(max-width:1300px) { :root {--sidebar-width:72px;--editor-width:380px;} .brand>span:last-child,.nav-item>span:last-child,.sidebar-footer span:not(.status-dot),.sidebar-footer small {display:none;} .brand,.nav-item {justify-content:center;padding-inline:0;} .sidebar-footer {display:flex;justify-content:center;} .table-filters {gap:0;} .filter-button {padding-inline:8px;} }
  @media(max-width:1000px) { .catalog-controls {flex-wrap:wrap;} .result-count {display:none;} .catalog-panel {margin:12px;} .editor-panel {margin:12px 12px 12px 0;} .catalog-pagination {flex-wrap:wrap;gap:8px;} .catalog-pagination > span {order:3;flex-basis:100%;text-align:left;} .page-buttons {margin-left:auto;} }
  @media(max-width:900px) {
    .app-shell,.main-area {height:auto;overflow:visible;}
    .sidebar {padding:6px 10px;} .nav-item {min-height:42px;} .nav-item>span:last-child {display:inline;} .nav-item {justify-content:flex-start;padding-inline:10px;} .brand,.sidebar-footer {display:none;}
    .topbar {display:block;padding:20px 16px;} .topbar-actions {margin-top:16px;gap:8px;} .title-meta {flex-direction:row;align-items:center;gap:5px 10px;}
    .workspace {grid-template-columns:1fr;} .catalog-panel {height:60vh;min-height:440px;max-height:620px;margin:12px;} .editor-panel {margin:0 12px 16px;} .editor-section {max-height:none;}
    .catalog-pagination > span {order:initial;flex-basis:auto;text-align:right;} .catalog-controls {flex-wrap:nowrap;} .result-count {display:block;}
    .selection-bar {position:sticky;bottom:0;z-index:5;flex-wrap:wrap;gap:8px 14px;padding:10px 16px;box-shadow:0 -4px 15px #19352a08;} .app-status {display:none;}
  }
  @media(max-width:620px) {
    .main-nav {gap:4px;} .nav-item {font-size:11px;gap:5px;} .nav-icon {font-size:17px;width:19px;}
    .topbar-actions {display:grid;grid-template-columns:1fr 1fr;} .search-box {grid-column:1/-1;min-width:0;} .template-download {grid-column:1/-1;justify-self:start;order:5;min-height:26px;} .topbar h1 {font-size:23px;}
    .table-head-tools {flex-direction:row;align-items:center;padding:10px;gap:7px;} .check-control {font-size:10px;gap:5px;} .filter-button {padding-inline:6px;font-size:10px;}
    .catalog-controls {gap:8px;padding:10px;} .compact-field {flex:1;} .compact-field select {width:100%;max-width:100%;min-width:0;font-size:10px;} .result-count {display:none;}
    .product-table th,.product-table td {padding-inline:6px;} .product-name-cell {min-width:125px;max-width:150px;} .product-name-cell strong {font-size:11px;} .row-stepper {grid-template-columns:20px 30px 20px;} .action-column {width:35px;}
    .catalog-pagination {padding:8px 10px;} .catalog-pagination > span {order:3;flex-basis:100%;text-align:left;} .page-buttons {margin-left:auto;} .field-grid,.field-grid.three {grid-template-columns:1fr 1fr;} .field-grid.three .field:last-child {grid-column:1/-1;} .editor-intro {margin-top:2px;} .selection-total {padding-left:12px;} .selection-bar {font-size:10px;} dialog {padding:20px;}
  }
  @media(prefers-reduced-motion:reduce) { *,*::before,*::after {scroll-behavior:auto!important;transition:none!important;} }
}
.print-root.measuring { display:block; width:var(--page-width); }
.print-page { width:var(--page-width); height:var(--page-height); padding:var(--print-margin,0mm); box-sizing:border-box; }
.print-grid { display:grid; grid-template-columns:repeat(var(--print-columns,1),var(--label-width)); grid-auto-rows:var(--label-height); gap:var(--label-gap); align-content:start; }
@media print {
  html,body {margin:0;padding:0;min-height:0;background:white;}
  dialog {display:none!important;}
  .print-root {display:block; padding:0; gap:0;}
  .print-page {break-after:page;page-break-after:always;overflow:hidden;}
  .print-page:last-child {break-after:auto;page-break-after:auto;}
  .print-label {print-color-adjust:exact;-webkit-print-color-adjust:exact;}
}


@media screen {
  .editor-panel {grid-template-rows:auto minmax(0,1fr) auto auto;}
  .editor-panel:has([data-panel="print"]:not(.hidden)) {grid-template-rows:auto minmax(0,1fr) auto;}
  .preview-dock {padding:10px 16px 12px;border-top:1px solid var(--line);background:white;}
  .preview-dock .preview-heading {margin:0 0 7px;}
  .preview-dock .preview-stage {min-height:0;padding:8px;}
  .preview-dock .form-actions {margin-top:9px;}
  .model-option {grid-template-rows:30px auto;}
  .model-option span:last-child {white-space:normal;min-height:2.3em;display:grid;align-content:center;}
  .search-box input {min-width:0;}
  @media(max-width:900px) {.editor-panel{grid-template-rows:auto auto auto auto;} .editor-panel:has([data-panel="print"]:not(.hidden)){grid-template-rows:auto auto auto;} .preview-dock{padding:16px;}}
}
.label-preview,.print-label {container-type:size;}
.label-preview.template-promotion,.print-label.template-promotion,.label-preview.template-promotion_red,.print-label.template-promotion_red {display:grid;grid-template-rows:20% 24% 44% 12%;padding:3px 7px;}
.label-preview.template-promotion_red,.print-label.template-promotion_red {border-width:3px;}
.promo-title {min-height:0;font-size:min(24cqh,9cqw);line-height:1.05;display:grid;place-items:center;}
.promo-name {height:auto;min-height:0;line-height:1.05;font-size:min(12cqh,3.8cqw);margin:0;}
.promo-prices {margin:0;min-height:0;align-items:center;gap:6px;}
.promo-price-block {align-items:center;gap:3px;}
.promo-price-block small {font-size:min(10cqh,3cqw);line-height:1.1;}
.promo-price-block strong {font-size:min(25cqh,10cqw);line-height:1.05;}
.promo-price-block.offer strong {font-size:min(40cqh,15cqw);}
.promo-prices.single-price {grid-template-columns:1fr;}
.promo-prices.single-price .promo-price-block {grid-template-columns:auto auto;justify-content:center;gap:8px;}
.promo-note {position:static;height:auto;min-height:0;font-size:min(5.5cqh,2cqw);line-height:1.2;align-self:end;}
.label-preview.template-normal,.print-label.template-normal {grid-template-rows:35% 65%;padding:3px 7px;}
.label-preview.template-normal .promo-title,.print-label.template-normal .promo-title {height:auto;min-height:0;font-size:min(16cqh,6cqw);}
.normal-price,.economy-price {font-size:min(40cqh,14cqw);line-height:1.05;}
.preview-barcode {min-height:0;}
.preview-barcode svg {height:100%;max-height:100%;}
.economy-copy strong,.barcode-copy strong {height:auto;max-height:2.2em;font-size:min(18cqh,4.5cqw);}
.barcode-copy span {font-size:min(32cqh,8cqw);}

@media screen {
  #olist-dialog {width:min(780px,calc(100vw - 28px));}
  .olist-dialog-heading,.olist-sync-heading {display:flex;align-items:center;justify-content:space-between;gap:16px;}
  .olist-dialog-heading h2 {margin:7px 0 0;font-size:25px;letter-spacing:-.6px;}
  .olist-connection-status {padding:12px 14px;border-radius:8px;background:#f1f4f2;border:1px solid var(--line);font-size:12px;margin:18px 0;}
  .olist-connection-status.connected {color:#176039;background:#edf8f0;border-color:#b4d9c2;}
  #olist-setup {border:1px solid var(--line);border-radius:9px;padding:15px;}
  #olist-setup summary {font-size:13px;font-weight:700;cursor:pointer;}
  #olist-setup .dialog-note {margin:12px 0;}
  #olist-redirect {font-family:Consolas,monospace;font-size:11px;background:#f7faf8;}
  .olist-setup-actions {display:flex;gap:10px;flex-wrap:wrap;align-items:center;}
  .olist-setup-actions a.button {text-decoration:none;}
  .olist-setup-actions .text-button {font-size:11px;display:flex;align-items:center;}
  .olist-sync-section {margin-top:22px;padding-top:18px;border-top:1px solid var(--line);}
  .olist-sync-heading h3 {margin:0;font-size:16px;}
  .olist-sync-heading .dialog-note {margin:5px 0 0;}
  .olist-progress {font-size:12px;line-height:1.6;color:var(--green-dark);}
  #olist-dialog .dialog-actions {justify-content:space-between;}
  #olist-dialog .danger {color:#ad3434;}
  @media(max-width:620px){#olist-dialog{padding:18px;} .olist-sync-heading{align-items:flex-start;flex-direction:column;} .olist-dialog-heading h2{font-size:22px;} #olist-setup .field-grid{grid-template-columns:1fr;} .olist-setup-actions .button{flex:1;} #olist-dialog .dialog-actions{flex-wrap:wrap;} #olist-import{width:100%;}}
}

/* v5: accessible controls and canonical print preview. */
.form-message:empty{display:none}
.sidebar-footer{display:flex;flex-wrap:wrap;gap:6px;align-items:center}
.sidebar-footer small{width:100%;padding-left:16px}
.sidebar-footer #logout{margin-left:auto}
:focus-visible{outline:3px solid #146c43!important;outline-offset:3px!important}
.skip-link{position:fixed;left:12px;top:-80px;background:#fff;padding:12px;z-index:10000;color:#104832}
.skip-link:focus{top:12px}
.canonical-preview{padding:0!important;display:flex!important;align-items:center;justify-content:center;background:#fff!important;border:1px solid #d0dbd5;overflow:hidden}
.canonical-preview img{display:block;width:100%;height:100%;object-fit:contain}
.canonical-preview.preview-error{padding:12px!important;color:#9c2833;font-size:13px;line-height:1.4;aspect-ratio:auto!important;min-height:90px}
#login-dialog,#admin-dialog{width:min(680px,calc(100vw - 28px));max-height:90vh;padding:28px;border:1px solid #d5e3da;border-radius:14px;color:#17352a;background:#fff;overflow:auto}
#login-dialog{max-width:450px}
dialog::backdrop{background:rgba(13,42,29,.55)}
#login-form .field,#user-form .field{margin-bottom:14px}
#login-submit{width:100%}
.admin-list{font:12px/1.7 "Segoe UI",Arial,sans-serif;white-space:pre-wrap;max-height:180px;overflow:auto;background:#f5f8f6;padding:12px;border-radius:8px}
#user-form{padding:16px;background:#f5f8f6;border-radius:8px}
#user-save{margin-left:18px}
#logout{color:#c7e8d5;padding:4px;font-size:12px}
body[data-role="viewer"] #save-product,body[data-role="viewer"] #delete-product,body[data-role="viewer"] #new-button,body[data-role="viewer"] #import-button,body[data-role="viewer"] [data-action="new"],body[data-role="viewer"] [data-action="import"]{display:none!important}
body[data-role="operator"] #delete-product{display:none!important}
@media(max-width:620px){
 .sidebar .main-nav{overflow-x:auto;scrollbar-width:thin;min-height:54px}
 .sidebar .nav-item{min-width:100px;min-height:44px}
 .table-scroll{overflow:auto;touch-action:pan-x pan-y}
 .row-stepper button,.row-action{min-width:32px;min-height:36px}
 .editor-footer .button{min-height:44px;font-size:12px}
 #user-form .field-grid{grid-template-columns:1fr}
}
