:root {
  --bg: #0f172a;
  --panel: rgba(255, 255, 255, 0.92);
  --panel-strong: #ffffff;
  --line: rgba(15, 23, 42, 0.08);
  --text: #0f172a;
  --muted: #475569;
  --primary: #2563eb;
  --primary-2: #1d4ed8;
  --danger: #dc2626;
  --shadow: 0 18px 60px rgba(15, 23, 42, 0.18);
  --radius: 22px;
  --print-columns: 2;
  --print-col-width: 50mm;
  --print-row-height: 30mm;
  --print-gap-x: 3mm;
  --print-gap-y: 2.8mm;
  --print-page-width: 103mm;
}

* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
  font-family: Inter, Segoe UI, Arial, sans-serif;
  background:
    radial-gradient(circle at top left, rgba(37, 99, 235, 0.35), transparent 28%),
    radial-gradient(circle at top right, rgba(14, 165, 233, 0.22), transparent 26%),
    linear-gradient(135deg, #020617, #0f172a 55%, #111827);
  color: var(--text);
}

body {
  min-height: 100vh;
}

.app-shell {
  display: grid;
  grid-template-columns: 380px 1fr;
  gap: 24px;
  padding: 24px;
}

.sidebar,
.content {
  min-width: 0;
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 18px;
  color: #fff;
}

.brand h1 {
  margin: 0;
  font-size: 1.5rem;
}

.brand p {
  margin: 4px 0 0;
  color: rgba(255,255,255,0.78);
}

.card {
  background: var(--panel);
  backdrop-filter: blur(14px);
  border: 1px solid rgba(255,255,255,0.35);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
  margin-bottom: 18px;
}

.card h2 {
  margin-top: 0;
  margin-bottom: 16px;
  font-size: 1.1rem;
}

.card p,
.card li {
  color: var(--muted);
  line-height: 1.45;
}

.field {
  margin-bottom: 14px;
}

.field label {
  display: block;
  font-size: 0.92rem;
  font-weight: 700;
  margin-bottom: 8px;
}

.field input,
.field textarea,
.field select {
  width: 100%;
  border: 1px solid #cbd5e1;
  border-radius: 14px;
  padding: 12px 14px;
  font-size: 0.98rem;
  background: #fff;
  outline: none;
  transition: 0.2s ease;
}

.field input:focus,
.field textarea:focus,
.field select:focus {
  border-color: #60a5fa;
  box-shadow: 0 0 0 4px rgba(96, 165, 250, 0.18);
}

.inline-field {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.actions,
.toolbar-actions,
.modal-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.btn {
  border: 0;
  border-radius: 14px;
  padding: 12px 16px;
  font-size: 0.96rem;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease, opacity 0.15s ease;
}

.btn:hover {
  transform: translateY(-1px);
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary), var(--primary-2));
  color: #fff;
  box-shadow: 0 12px 24px rgba(37, 99, 235, 0.25);
}

.btn-secondary {
  background: #e2e8f0;
  color: #0f172a;
}

.btn-danger {
  background: linear-gradient(135deg, #ef4444, var(--danger));
  color: #fff;
}

.content {
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 28px;
  padding: 22px;
  backdrop-filter: blur(10px);
}

.toolbar {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
  margin-bottom: 20px;
  color: #fff;
}

.toolbar h2 {
  margin: 0;
}

.toolbar p {
  margin: 6px 0 0;
  color: rgba(255,255,255,0.78);
}


.queue-tabs {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin: 0 0 16px;
}

.queue-tab {
  border: 1px solid rgba(255,255,255,0.16);
  background: rgba(255,255,255,0.08);
  color: rgba(255,255,255,0.88);
  border-radius: 999px;
  padding: 10px 14px;
  font-size: 0.92rem;
  font-weight: 700;
  cursor: pointer;
  transition: 0.2s ease;
}

.queue-tab:hover {
  background: rgba(255,255,255,0.14);
}

.queue-tab.active {
  background: linear-gradient(135deg, var(--primary), var(--primary-2));
  border-color: transparent;
  color: #fff;
  box-shadow: 0 12px 24px rgba(37, 99, 235, 0.22);
}

.queue-tab-count {
  opacity: 0.9;
  margin-left: 6px;
}

.labels-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 14px;
  align-items: start;
}

.label-item {
  width: var(--label-width, 50mm);
  height: var(--label-height, 30mm);
  background: var(--panel-strong);
  border: 1px dashed rgba(15, 23, 42, 0.22);
  border-radius: 8px;
  padding: 3.2mm 3.4mm 2.6mm;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  overflow: hidden;
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.14);
  font-size: calc(11.5pt * var(--font-scale, 1));
}

.label-item-wide {
  width: min(100%, 100mm);
  justify-self: start;
}

.label-line {
  display: flex;
  align-items: flex-start;
  gap: 1.2mm;
  color: #0f172a;
  line-height: 1.14;
  margin-bottom: 0.9mm;
}

.label-line-strong {
  font-weight: 800;
}

.label-prefix {
  flex: 0 0 auto;
  white-space: nowrap;
}

.lab-number,
.weight,
.observation {
  overflow: hidden;
  text-overflow: ellipsis;
}

.lab-number,
.weight {
  white-space: nowrap;
}

.lab-number {
  max-width: 24mm;
}

.weight {
  max-width: none;
  flex: 1 1 auto;
  white-space: nowrap;
}

.observation {
  display: inline;
  white-space: normal;
  word-break: break-word;
  overflow: visible;
  text-overflow: unset;
  margin-left: 0;
}

.label-item-fertilizante,
.label-item-petrobio {
  padding: 0;
  font-size: calc(8.1pt * var(--font-scale, 1));
}

.label-item-matrix-simple {
  padding: 0;
  font-size: calc(8.7pt * var(--font-scale, 1));
}

.matrix-simple-title {
  text-align: center;
  padding: 1.1mm 2mm 0.9mm;
  font-weight: 800;
  border-bottom: 0.3mm solid #111827;
  font-size: 1.05em;
}

.matrix-simple-body {
  height: calc(100% - 7mm);
  padding: 1.6mm 3mm 1.2mm;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 1mm;
}

.matrix-simple-row {
  display: flex;
  gap: 1.2mm;
  line-height: 1.15;
  word-break: break-word;
}

.matrix-simple-row strong {
  white-space: nowrap;
}

.matrix-simple-row-main {
  font-size: 1.08em;
  font-weight: 800;
}


.fert-header {
  display: grid;
  grid-template-columns: 20mm 1fr;
  min-height: 8.6mm;
  border-bottom: 0.3mm solid #111827;
}

.fert-header-left {
  display: grid;
  place-items: center;
  border-right: 0.3mm solid #111827;
  padding: 1mm;
}

.fert-logo {
  width: 17mm;
  max-height: 6.2mm;
  object-fit: contain;
}

.fert-header-right {
  padding: 1mm 2mm 0.8mm;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 0.2mm;
}

.fert-brand {
  font-weight: 800;
  letter-spacing: 0.03em;
}

.fert-brand-sub {
  font-size: 0.92em;
}

.fert-title {
  text-align: center;
  padding: 1mm 2mm 0.8mm;
  font-weight: 700;
  border-bottom: 0.3mm solid #111827;
}

.fert-body {
  padding: 1.2mm 2.2mm;
  display: flex;
  flex-direction: column;
  gap: 0.8mm;
}

.fert-row {
  display: flex;
  gap: 1mm;
  line-height: 1.15;
  word-break: break-word;
}

.pet-header {
  border-bottom: 0.3mm solid #111827;
  padding: 0.9mm 1.6mm 0.8mm;
  display: grid;
  grid-template-columns: 16mm 1fr;
  align-items: center;
  gap: 1.2mm;
}

.pet-header-compact {
  padding-top: 0.6mm;
  padding-bottom: 0.5mm;
  grid-template-columns: 14mm 1fr;
  gap: 0.8mm;
}

.pet-header-logo-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
}

.pet-logo {
  width: 11mm;
  max-height: 6mm;
  object-fit: contain;
}

.pet-header-text {
  text-align: center;
}

.pet-header-top {
  font-size: 0.72em;
  font-weight: 700;
  line-height: 1.05;
}

.pet-header-brand {
  margin-top: 0.25mm;
  font-size: 0.80em;
  font-weight: 700;
}

.pet-title {
  text-align: center;
  border-bottom: 0.3mm solid #111827;
  padding: 0.8mm 1.5mm;
  font-weight: 800;
  font-size: 0.82em;
  line-height: 1.05;
}

.pet-grid-top {
  display: grid;
  grid-template-columns: 1fr 1fr;
  border-bottom: 0.3mm solid #111827;
}

.pet-cell {
  min-height: 5.4mm;
  padding: 0.65mm 1.2mm;
  display: flex;
  flex-direction: column;
  gap: 0.35mm;
}

.pet-cell:first-child {
  border-right: 0.3mm solid #111827;
}

.pet-cell-label,
.pet-section-title {
  font-size: 0.71em;
  font-weight: 800;
  letter-spacing: 0.015em;
}

.pet-cell-value,
.pet-footer-value {
  font-size: 0.9em;
  line-height: 1.05;
}

.pet-products-block {
  border-bottom: 0.3mm solid #111827;
  padding: 0.6mm 1.2mm;
}

.pet-products-list {
  display: flex;
  gap: 0.9mm;
  margin-top: 0.45mm;
  flex-wrap: wrap;
}

.pet-product-row {
  display: flex;
  align-items: center;
  gap: 0.55mm;
  line-height: 1;
  font-size: 0.82em;
}

.pet-product-row.is-selected {
  font-weight: 800;
}

.pet-check {
  font-size: 1.05em;
  width: 2.1mm;
  text-align: center;
}

.pet-footer {
  padding: 0.65mm 1.2mm;
  display: flex;
  flex-direction: column;
  gap: 0.4mm;
}

.empty-state {
  grid-column: 1 / -1;
  background: rgba(255,255,255,0.9);
  border: 1px dashed rgba(15, 23, 42, 0.15);
  color: var(--muted);
  border-radius: 18px;
  padding: 28px;
  text-align: center;
}

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(2, 6, 23, 0.66);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 1000;
}

.modal-overlay.hidden {
  display: none;
}

.modal-card {
  width: min(720px, 100%);
  background: #ffffff;
  color: #0f172a;
  border-radius: 24px;
  box-shadow: 0 30px 80px rgba(15, 23, 42, 0.35);
  overflow: hidden;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 22px 24px 16px;
  border-bottom: 1px solid rgba(15, 23, 42, 0.08);
}

.modal-header h3 {
  margin: 0;
  font-size: 1.3rem;
}

.modal-header p {
  margin: 6px 0 0;
  color: var(--muted);
}

.modal-close {
  width: 40px;
  height: 40px;
  border: 0;
  border-radius: 12px;
  background: #e2e8f0;
  color: #0f172a;
  font-size: 1.6rem;
  cursor: pointer;
}

.modal-body {
  padding: 20px 24px;
  display: grid;
  gap: 18px;
}

.modal-section {
  border: 1px solid rgba(15, 23, 42, 0.08);
  border-radius: 18px;
  padding: 18px;
}

.modal-section h4 {
  margin: 0 0 8px;
  font-size: 1rem;
}

.modal-section p,
.modal-help {
  margin: 0 0 12px;
  color: var(--muted);
  line-height: 1.45;
}

.import-feedback {
  min-height: 22px;
  font-size: 0.92rem;
  color: #1d4ed8;
  font-weight: 600;
}

.modal-actions {
  padding: 0 24px 24px;
  justify-content: flex-end;
}

@page {
  size: auto;
  margin: 0;
}

@media print {
  html,
  body {
    background: #fff !important;
    margin: 0 !important;
    padding: 0 !important;
  }

  .app-signature {
    display: none !important;
  }

  .no-print,
  .modal-overlay {
    display: none !important;
  }

  .app-shell,
  .content {
    display: block;
    padding: 0;
    margin: 0;
    background: transparent;
    border: 0;
    box-shadow: none;
  }

  .labels-grid {
    display: grid;
    grid-template-columns: repeat(var(--print-columns), var(--print-col-width));
    column-gap: var(--print-gap-x);
    row-gap: var(--print-gap-y);
    justify-content: start;
    align-content: start;
    width: var(--print-page-width);
    padding: 1.2mm 0 0 1.2mm;
    margin: 0;
  }

  .label-item {
    width: var(--label-width, var(--print-col-width));
    height: var(--label-height, var(--print-row-height));
    margin: 0;
    padding: 4mm 3.6mm 3mm;
    break-inside: avoid;
    page-break-inside: avoid;
    box-shadow: none;
    border: 0;
    border-radius: 0;
    justify-content: flex-start;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  .label-item-fertilizante,
  .label-item-petrobio {
    padding: 0;
  }

  .label-line {
    line-height: 1.08;
    margin-bottom: 1mm;
  }

  .label-line-strong,
  .label-prefix {
    font-weight: 800;
  }

  .lab-number,
  .weight {
    max-width: none;
    flex: 1 1 auto;
    white-space: nowrap;
    overflow: visible;
    text-overflow: unset;
  }

  .observation {
    -webkit-line-clamp: 2;
  }

  .empty-state {
    display: none !important;
  }
}

@media (max-width: 1100px) {
  .app-shell {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 720px) {
  .inline-field,
  .toolbar {
    grid-template-columns: 1fr;
    display: grid;
  }

  .toolbar-actions,
  .actions,
  .modal-actions {
    width: 100%;
  }

  .btn {
    width: 100%;
  }

  .label-item-wide {
    width: 100%;
    height: auto;
    min-height: 30mm;
  }
}

.brand-custom {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 10px;
  padding: 10px 0 5px;
}

.brand-logo-full {
  width: 100%;
  max-width: 240px;
  height: auto;
  object-fit: contain;
}

.brand-subtitle {
  font-size: 14px;
  color: #cbd5e1;
  font-weight: 500;
}

.sidebar {
  padding-top: 0 !important;
}

.brand {
  margin-top: 0 !important;
  padding-top: 0 !important;
}

.app-signature {
  position: fixed;
  right: 16px;
  bottom: 10px;
  color: rgba(255,255,255,0.65);
  font-size: 12px;
}

.label-item-solo {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}

.solo-number {
  width: 100%;
  text-align: center;
  font-weight: 800;
  font-size: var(--solo-number-size, 3.4em);
  line-height: 1;
  letter-spacing: 0.005em;
  white-space: nowrap;
  padding: 0 1.1mm;
  box-sizing: border-box;
}

.label-item-petrobio-pmqbio {
  padding: 0;
  font-size: calc(7.1pt * var(--font-scale, 1));
}

.petq-header {
  display: grid;
  grid-template-columns: 14mm 1fr;
  align-items: center;
  gap: 1mm;
  padding: 0.6mm 1.2mm 0.45mm;
  border-bottom: 0.3mm solid #111827;
}

.petq-logo-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
}

.petq-logo {
  width: 9.5mm;
  max-height: 6mm;
  object-fit: contain;
}

.petq-header-text {
  text-align: center;
}

.petq-header-top {
  font-size: 0.72em;
  font-weight: 800;
  line-height: 1.02;
}

.petq-header-brand {
  margin-top: 0.2mm;
  font-size: 0.8em;
  font-weight: 800;
  line-height: 1.03;
}

.petq-title {
  text-align: center;
  border-bottom: 0.3mm solid #111827;
  padding: 0.42mm 1.1mm 0.36mm;
  font-weight: 800;
  font-size: 0.83em;
  line-height: 1.01;
}

.petq-grid-top {
  display: grid;
  grid-template-columns: 18mm 19mm 1fr;
  border-bottom: 0.3mm solid #111827;
}

.petq-cell {
  min-height: 7.2mm;
  padding: 0.45mm 0.8mm;
  display: flex;
  flex-direction: column;
  gap: 0.3mm;
}
.petq-cell-visit,
.petq-cell-date {
  padding-left: 0.6mm;
  padding-right: 0.6mm;
}
.petq-cell-collector {
  padding-left: 0.8mm;
  padding-right: 0.8mm;
}

.petq-cell + .petq-cell {
  border-left: 0.3mm solid #111827;
}

.petq-cell-label,
.petq-section-title {
  font-size: 0.72em;
  font-weight: 800;
  line-height: 1.02;
}

.petq-cell-value {
  font-size: 0.94em;
  line-height: 1.04;
  word-break: break-word;
}
.petq-cell-collector .petq-cell-value {
  font-size: 0.9em;
}
.petq-cell-visit .petq-cell-value,
.petq-cell-date .petq-cell-value {
  font-size: 0.98em;
  white-space: nowrap;
}

.petq-products-block {
  padding: 0.45mm 0.85mm 0.4mm;
}

.petq-products-line {
  display: flex;
  align-items: center;
  flex-wrap: nowrap;
  gap: 2.2mm;
  margin-top: 0.45mm;
}

.petq-product-item {
  display: flex;
  align-items: center;
  gap: 0.9mm;
  font-size: 1.22em;
  line-height: 1.02;
  white-space: nowrap;
}

.petq-product-item.is-selected {
  font-weight: 800;
}

.petq-check {
  width: 3.9mm;
  text-align: center;
  font-size: 1.7em;
  line-height: 1;
  font-weight: 700;
}

@media print {
  .label-item-petrobio-pmqbio,
  .label-item-solo {
    padding: 0;
  }
}


.petq-product-name {
  display: inline-block;
  font-size: 1em;
  line-height: 1;
}
