* { box-sizing: border-box; }

    body {
      margin: 0;
      font-family: 'Rubik', Arial, Helvetica, sans-serif;
      background: #eef3f8;
      color: #102033;
    }

    header {
      background: #12385c;
      color: white;
      padding: 24px 20px;
      border-bottom: 4px solid #0b2239;
    }

    header h1 {
      margin: 0 0 6px 0;
      font-size: 24px;
      text-align: center;
    }

    header h2 {
        margin: 0;
        font-size: 14px;
        opacity: 0.85;
        text-align: center;
      }

    header p {
      margin: 0;
      font-size: 14px;
      opacity: 0.85;
      text-align: center;
    }

    header a {
      color: white;
      font-weight: bold;
    }

    main {
      max-width: 1540px;
      margin: 0 auto;
      padding: 20px;
    }

    .controls {
      display: flex;
      gap: 10px;
      flex-wrap: wrap;
      align-items: center;
      margin-bottom: 20px;
    }

    button {
      border: 1px solid #0b2239;
      border-radius: 0;
      padding: 10px 14px;
      font-size: 14px;
      cursor: pointer;
      background: #12385c;
      color: white;
      font-weight: 600;
    }

    button:hover {
      background: #0b2239;
    }

    button.secondary {
      background: #eef3f8;
      color: #12385c;
      border: 1px solid #8aa6bf;
    }

    button.secondary:hover {
      background: #dbe7f1;
    }

    .layout-choice {
      display: inline-flex;
      align-items: center;
      gap: 8px;
      background: white;
      border: 1px solid #cbd5e1;
      border-radius: 0;
      padding: 8px 10px;
      font-size: 14px;
    }

    .layout-choice select {
      border: 1px solid #cbd5e1;
      border-radius: 0;
      padding: 7px;
      font-size: 14px;
      background: white;
    }

    .print-option {
      display: inline-flex;
      align-items: center;
      gap: 8px;
      background: white;
      border: 1px solid #cbd5e1;
      border-radius: 0;
      padding: 8px 10px;
      font-size: 14px;
    }

    .print-option input {
      width: auto;
    }

    .copy-button {
      width: 34px;
      height: 34px;
      padding: 0;
      border-radius: 0;
      background: #e5e7eb;
      color: #102033;
      border: 1px solid #cbd5e1;
      display: inline-flex;
      align-items: center;
      justify-content: center;
    }

    .copy-button svg {
      width: 16px;
      height: 16px;
      display: block;
      stroke: currentColor;
      fill: none;
      stroke-width: 1.8;
      stroke-linecap: round;
      stroke-linejoin: round;
    }

    .copy-button:hover {
      background: #d1d5db;
    }

    .copy-button.disabled,
    .copy-button:disabled {
      background: #f3f4f6;
      color: #aaa;
      cursor: default;
    }

    .layout {
      display: grid;
      grid-template-columns: minmax(560px, 1fr) 830px;
      gap: 20px;
      align-items: start;
      margin-bottom: 30px;
    }

    .input-panel,
    .preview-panel {
      background: white;
      border: 1px solid #c4d2df;
      border-top: 4px solid #12385c;
      border-radius: 0;
      padding: 16px;
      box-shadow: none;
    }

    .input-panel h2,
    .preview-panel h2 {
      margin-top: 0;
      font-size: 18px;
    }

    .input-header,
    .preview-header {
      display: flex;
      align-items: center;
      flex-wrap: wrap;
      gap: 10px;
      margin: 0 0 12px 0;
    }

    .input-header h2,
    .preview-header h2 {
      margin: 0;
    }

    .preview-options {
      display: flex;
      align-items: center;
      flex-wrap: wrap;
      gap: 12px;
      border: 1px solid #8aa6bf;
      background: #f7fafc;
      padding: 6px 8px;
    }

    .preview-header .layout-choice,
    .preview-header .print-option {
      border: 0;
      background: transparent;
      padding: 0;
      font-size: 13px;
    }

    .preview-header .layout-choice select {
      padding: 6px;
      font-size: 13px;
    }

    .layout-status {
      display: inline-flex;
      align-items: center;
      min-height: 31px;
      border: 1px solid #c4d2df;
      background: #f7fafc;
      color: #34495e;
      padding: 6px 8px;
      font-size: 13px;
      font-weight: 500;
    }

    .layout-status:empty {
      display: none;
    }

    .rows {
      display: grid;
      gap: 8px;
    }

    .row {
      display: grid;
      grid-template-columns: 42px 32px 1.4fr 0.7fr 1fr 1fr;
      gap: 8px;
      align-items: center;
    }

    .row.header-row {
      font-weight: bold;
      font-size: 12px;
      color: #555;
    }

    .row-number {
      text-align: center;
      font-size: 13px;
      color: #555;
    }

    .row.hidden {
      display: none;
    }

    input {
      width: 100%;
      border: 1px solid #cbd5e1;
      border-radius: 0;
      padding: 8px;
      font-size: 13px;
    }

    .hint,
    .status {
      margin-top: 12px;
      font-size: 14px;
      color: #555;
      line-height: 1.4;
    }

    .top-status {
      margin: 0 0 12px 0;
    }

    .top-status:empty {
      display: none;
    }

    .intro-card,
    .faq {
      background: white;
      border: 1px solid #c4d2df;
      border-left: 4px solid #12385c;
      border-radius: 0;
      padding: 18px;
      box-shadow: none;
      margin-bottom: 20px;
      line-height: 1.5;
    }

    .intro-card h2,
    .faq h2 {
      margin-top: 0;
      font-size: 20px;
    }

    .intro-card p,
    .faq p {
      margin: 8px 0 0 0;
    }

    .faq h3 {
      margin: 18px 0 4px 0;
      font-size: 16px;
    }

    .intro-card a,
    .faq a {
      color: #12385c;
      font-weight: bold;
    }

    .site-footer {
      margin: 20px auto 0 auto;
      max-width: 1500px;
      padding: 16px 20px 30px 20px;
      text-align: center;
      font-size: 13px;
      color: #555;
    }

    .site-footer a {
      color: #12385c;
      font-weight: bold;
    }

    #labelSheet {
      width: 794px;
      height: 1123px;
      background: white;
      padding: 0;
      display: grid;
      grid-template-columns: repeat(2, 1fr);
      grid-template-rows: repeat(var(--label-rows, 8), 1fr);
      gap: 0;
      border: 1px solid #ddd;
      overflow: hidden;
    }

    .preview-panel {
      overflow: auto;
    }

    .price-label {
      border: 1px dashed #999;
      padding: 3mm 5mm 5mm 5mm;
      position: relative;
      display: grid;
      grid-template-columns: 1fr 122px;
      grid-template-rows: min-content min-content min-content;
      column-gap: 12px;
      align-items: start;
      align-content: start;
      text-align: left;
      overflow: hidden;
      page-break-inside: avoid;
      min-height: 0;
    }

    .price-label.empty-label {
      border: 1px dashed #ddd;
      background: white;
    }

    .price-label.empty-label * {
      display: none;
    }

    .product-name {
      grid-column: 1;
      grid-row: 1;
      font-size: 17px;
      font-weight: 600;
      line-height: 1.15;
      word-break: break-word;
      align-self: start;
    }

    .price {
      grid-column: 1;
      grid-row: 2;
      font-size: 28px;
      font-weight: 600;
      line-height: 1.05;
      margin: 2px 0;
    }

    .seller {
      grid-column: 1;
      grid-row: 3;
      font-size: 12px;
      line-height: 1.25;
      color: #333;
      margin-top: 1px;
    }

    .qr-wrap {
      grid-column: 2;
      grid-row: 1 / 4;
      display: grid;
      grid-template-columns: 24px 86px;
      grid-template-rows: 86px auto;
      column-gap: 4px;
      align-items: center;
      justify-content: center;
      justify-self: center;
      align-self: center;
      min-width: 114px;
      padding-left: 4mm;
      padding-right: 4mm;
    }
    .swish-logo {
      width: 70px;
      max-height: 24px;
      object-fit: contain;
      display: block;
      transform: rotate(270deg);
      transform-origin: center;
    }

    .swish-logo-wrap {
      width: 24px;
      height: 86px;
      display: flex;
      align-items: center;
      justify-content: center;
      overflow: visible;
    }

    .qr {
      width: 86px;
      height: 86px;
      display: flex;
      align-items: center;
      justify-content: center;
      font-size: 11px;
      color: #777;
      text-align: center;
    }

    .qr img,
    .qr canvas {
      width: 86px !important;
      height: 86px !important;
    }

    .phone {
      font-size: 11px;
      color: #333;
      margin-top: 3px;
      text-align: center;
    }

    .qr-wrap .phone {
      grid-column: 2;
      grid-row: 2;
      text-align: center;
      justify-self: center;
      width: 86px;
    }

    .label-id {
      position: absolute;
      left: 4mm;
      bottom: 3mm;
      font-size: 9px;
      color: #555;
      line-height: 1.2;
      letter-spacing: 0.2px;
    }

    .service-link {
      position: absolute;
      left: 50%;
      bottom: 3mm;
      transform: translateX(-50%);
      font-size: 8px;
      color: #777;
      line-height: 1.2;
      letter-spacing: 0.1px;
      white-space: nowrap;
      text-align: center;
      pointer-events: none;
    }


    .controls {
      border: 1px solid #c4d2df;
      background: white;
      padding: 12px;
    }

    .layout-choice,
    .print-option {
      border-color: #8aa6bf;
      color: #102033;
    }

    .input-panel h2,
    .preview-panel h2,
    .intro-card h2,
    .faq h2 {
      color: #12385c;
      letter-spacing: 0.1px;
    }

    .row.header-row {
      color: #12385c;
      border-bottom: 1px solid #c4d2df;
      padding-bottom: 4px;
    }

    input,
    .layout-choice select {
      border-color: #8aa6bf;
      background: #fbfdff;
    }

    input:focus,
    .layout-choice select:focus {
      outline: 2px solid #9fc3e0;
      outline-offset: 0;
      background: white;
    }

    .hint {
      border-left: 4px solid #8aa6bf;
      padding-left: 10px;
      color: #34495e;
    }


    @page {
      size: A4 portrait;
      margin: 0;
    }

    @media print {
      html,
      body {
        width: 210mm;
        height: 297mm;
        margin: 0 !important;
        padding: 0 !important;
        overflow: hidden !important;
        background: white;
      }

      header,
      .input-panel,
      .controls,
      .preview-header,
      .hint,
      .status,
      .intro-card,
      .faq,
      .site-footer {
        display: none !important;
      }

      main {
        width: 210mm;
        height: 297mm;
        padding: 0;
        margin: 0;
        max-width: none;
        overflow: hidden;
      }

      .layout { display: block; }

      .preview-panel {
        box-shadow: none;
        padding: 0;
        border-radius: 0;
      }

      #labelSheet {
        width: 209mm;
        height: 296mm;
        min-height: 0;
        border: 0;
        padding: 0;
        gap: 0;
        overflow: hidden;
      }

      .price-label {
        min-height: 0;
        padding: 3mm 5mm 5mm 5mm;
        border: none;
      }

      .price-label.empty-label {
        border: none;
      }

      body.print-cut-lines .price-label {
        border: 1px dashed #999;
      }

      body.print-cut-lines .price-label.empty-label {
        border: 1px dashed #ddd;
      }
    }

    @media (max-width: 1260px) {
      .layout { grid-template-columns: 1fr; }
      .preview-panel { overflow-x: auto; }
    }


.site-footer p {
  margin: 4px 0;
}


.inventory-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}

.inventory-panel {
  display: none;
}

.inventory-panel h3 {
  margin: 0 0 6px 0;
  color: #12385c;
  font-size: 16px;
}

.inventory-note,
.inventory-empty {
  margin: 0 0 8px 0;
  font-size: 13px;
  color: #555;
}

.inventory-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
  background: white;
}

.inventory-table th,
.inventory-table td {
  border: 1px solid #c4d2df;
  padding: 6px;
  text-align: left;
  vertical-align: top;
}

.inventory-table th {
  background: #eef3f8;
  color: #12385c;
  font-weight: 600;
}

@media print {
  body.print-inventory {
    width: auto;
    height: auto;
    overflow: visible !important;
  }

  body.print-inventory header,
  body.print-inventory .controls,
  body.print-inventory .preview-panel,
  body.print-inventory .intro-card,
  body.print-inventory .faq,
  body.print-inventory .site-footer,
  body.print-inventory .status,
  body.print-inventory .input-header,
  body.print-inventory .rows,
  body.print-inventory .hint,
  body.print-inventory .inventory-actions,
  body.print-inventory .print-history-panel,
  body.print-inventory .input-clear-row,
  body.print-inventory .input-actions,
  body.print-inventory .input-panel > h2 {
    display: none !important;
  }

  body.print-inventory main {
    width: auto;
    height: auto;
    padding: 12mm;
    margin: 0;
    overflow: visible;
  }

  body.print-inventory .layout {
    display: block;
  }

  body.print-inventory .input-panel {
    display: block !important;
    border: none;
    padding: 0;
    box-shadow: none;
  }

  body.print-inventory .inventory-panel {
    display: block !important;
    margin: 0;
    padding: 0;
    border: none;
  }

  body.print-inventory .inventory-panel h3 {
    font-size: 18px;
    margin-bottom: 8px;
  }

  body.print-inventory .inventory-note {
    display: none;
  }

  body.print-inventory .inventory-table {
    font-size: 11px;
  }

  body.print-inventory .inventory-table th,
  body.print-inventory .inventory-table td {
    border: 1px solid #444;
    padding: 5px;
  }
}


.clear-saved-link {
  margin-top: 4px;
  padding: 7px 10px;
  font-size: 13px;
}

.inventory-top-action {
  white-space: nowrap;
}



.input-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 14px 0 10px 0;
  padding: 10px;
  border: 1px solid #c4d2df;
  background: #f7fafc;
}

.print-history-panel {
  margin-top: 14px;
  border: 1px solid #c4d2df;
  border-left: 4px solid #12385c;
  background: #f7fafc;
  padding: 12px;
}

.print-history-panel h3 {
  margin: 0 0 6px 0;
  color: #12385c;
  font-size: 15px;
}

.print-history-panel p,
.history-empty {
  margin: 6px 0 0 0;
  font-size: 13px;
  color: #34495e;
  line-height: 1.4;
}

.history-list {
  display: grid;
  gap: 8px;
  margin-top: 10px;
}

.history-item {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  align-items: center;
  border-top: 1px solid #c4d2df;
  padding-top: 8px;
  font-size: 13px;
}

.history-buttons {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.clear-history-button {
  margin-top: 10px;
}


.history-ids {
  display: inline-block;
  margin-top: 3px;
  color: #555;
  font-size: 12px;
  overflow-wrap: anywhere;
}


.input-clear-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-start;
  margin: 14px 0 8px 0;
}
