:root {
  --ink: #17251e;
  --muted: #68756e;
  --line: #dce5df;
  --surface: #fff;
  --canvas: #f1f5f1;
  --green: #1e6b46;
  --green-dark: #145036;
  --green-pale: #e6f3ea;
  --danger: #b42318;
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--canvas);
  font-synthesis: none;
}

* { box-sizing: border-box; }
body { margin: 0; min-width: 320px; min-height: 100vh; background: radial-gradient(circle at 8% 0%, rgba(73,145,99,.11), transparent 30rem), var(--canvas); }
button, input, select, textarea { font: inherit; }
button { color: inherit; }

.app-shell { width: min(1380px, calc(100% - 40px)); margin: 0 auto; padding: 50px 0 30px; }
.site-nav { display: flex; align-items: center; justify-content: space-between; gap: 22px; margin-bottom: 34px; padding: 12px 16px; border: 1px solid var(--line); border-radius: 14px; background: rgba(255,255,255,.84); box-shadow: 0 8px 25px rgba(37,65,49,.045); }
.site-nav a { color: var(--ink); text-decoration: none; }
.site-nav a:hover { color: var(--green); }
.site-nav__brand { display: inline-flex; align-items: center; gap: 9px; font-weight: 800; letter-spacing: -.02em; white-space: nowrap; }
.site-nav__brand::before { width: 26px; height: 26px; flex: 0 0 26px; border-radius: 7px; background: url('/favicon.svg') center / contain no-repeat; content: ''; }
.site-nav__links { display: flex; align-items: center; justify-content: flex-end; gap: 20px; font-size: 12px; font-weight: 700; }
.hero { display: flex; align-items: flex-start; gap: 22px; max-width: 900px; margin-bottom: 30px; }
.brand-mark { width: 62px; height: 62px; flex: 0 0 auto; display: flex; justify-content: center; align-items: center; gap: 3px; border-radius: 18px; color: #fff; background: var(--green); box-shadow: 0 12px 30px rgba(30,107,70,.22); }
.brand-mark span { width: 2px; height: 28px; border-radius: 2px; background: currentColor; }
.brand-mark span:nth-child(2) { width: 5px; }
.brand-mark span:nth-child(3) { height: 34px; }
.brand-mark span:nth-child(4) { width: 3px; }
.eyebrow { margin: 2px 0 7px; color: var(--green); font-size: 12px; font-weight: 760; letter-spacing: .12em; text-transform: uppercase; }
h1, h2, h3, p { margin-top: 0; }
h1 { margin-bottom: 12px; font-size: clamp(32px, 5vw, 50px); line-height: 1.04; letter-spacing: -.045em; }
h1 em { color: var(--green); font-style: normal; }
.hero-copy { margin-bottom: 0; color: var(--muted); font-size: 17px; line-height: 1.6; }

.panel { margin-bottom: 18px; overflow: hidden; border: 1px solid var(--line); border-radius: 22px; background: var(--surface); box-shadow: 0 14px 45px rgba(37,65,49,.065); }
.settings-panel, .products-panel, .preview-panel { padding: 30px; }
.section-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 24px; margin-bottom: 23px; }
.section-heading h2 { margin-bottom: 5px; font-size: 24px; letter-spacing: -.03em; }
.section-description { margin-bottom: 0; color: var(--muted); font-size: 13px; line-height: 1.45; }
.text-button { border: 0; padding: 5px; color: var(--green); background: transparent; font-size: 12px; font-weight: 700; cursor: pointer; }

.primary-settings { display: grid; grid-template-columns: repeat(7, minmax(135px, 1fr)); gap: 18px; align-items: end; }
.field-group label { display: block; min-height: 16px; margin-bottom: 8px; font-size: 12px; font-weight: 720; }
.field-group.control-disabled { opacity: .48; }
input[type="text"], input[type="number"], select, textarea { width: 100%; border: 1px solid #cbd6cf; border-radius: 10px; outline: none; background: #fff; transition: border-color .2s, box-shadow .2s; }
input[type="text"], input[type="number"], select { height: 46px; padding: 0 12px; }
textarea { min-height: 46px; padding: 10px 12px; resize: vertical; }
input:focus, select:focus, textarea:focus { border-color: var(--green); box-shadow: 0 0 0 3px rgba(30,107,70,.12); }
input.invalid { border-color: var(--danger); background: #fff8f7; box-shadow: 0 0 0 3px rgba(180,35,24,.08); }
.range-field { min-width: 135px; }
.range-row { display: flex; align-items: center; gap: 9px; height: 46px; }
.auto-check { display: flex !important; min-height: 0 !important; align-items: flex-start; gap: 6px; margin: 4px 0 0 !important; color: var(--muted); font-size: 9px !important; font-weight: 600 !important; line-height: 1.2; cursor: pointer; }
.auto-check input { width: 14px; height: 14px; margin: -1px 0 0; flex: 0 0 auto; accent-color: var(--green); }
input[type="range"] { width: 100%; accent-color: var(--green); cursor: pointer; }
output { min-width: 43px; padding: 6px 5px; border: 1px solid var(--line); border-radius: 8px; background: #f7f9f7; text-align: center; font-size: 11px; font-weight: 720; }
.toggle-row { display: flex; min-height: 46px; align-items: center; justify-content: space-between; gap: 12px; cursor: pointer; }
.toggle-row strong, .toggle-row small { display: block; }
.toggle-row strong { margin-bottom: 2px; font-size: 12px; }
.toggle-row small { color: var(--muted); font-size: 10px; line-height: 1.25; }
.switch { position: relative; width: 42px; height: 24px; flex: 0 0 auto; }
.switch input { position: absolute; opacity: 0; pointer-events: none; }
.switch span { position: absolute; inset: 0; border-radius: 20px; background: #aeb9b2; transition: .2s; }
.switch span::after { content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; box-shadow: 0 1px 4px rgba(0,0,0,.2); transition: .2s; }
.switch input:checked + span { background: var(--green); }
.switch input:checked + span::after { transform: translateX(18px); }

.optional-fields { display: grid; grid-template-columns: 300px 1fr; gap: 26px; margin: 28px -30px -30px; padding: 23px 30px 25px; border-top: 1px solid #d5e0ef; background: #edf3ff; }
.optional-copy h3 { margin-bottom: 6px; font-size: 16px; }
.optional-copy p { margin: 0; color: #617087; font-size: 12px; line-height: 1.45; }
.checkbox-grid { display: grid; grid-template-columns: repeat(2, minmax(230px, 1fr)); gap: 11px 32px; }
.checkbox-grid label { display: flex; gap: 8px; align-items: flex-start; font-size: 13px; line-height: 1.35; cursor: pointer; }
.checkbox-grid input { width: 16px; height: 16px; margin: 1px 0 0; flex: 0 0 auto; accent-color: var(--green); }

.button { min-height: 44px; border: 1px solid #cbd6cf; border-radius: 10px; padding: 9px 15px; background: #fff; font-size: 12px; font-weight: 750; cursor: pointer; transition: transform .15s, box-shadow .15s, background .15s; }
.button:hover:not(:disabled) { transform: translateY(-1px); box-shadow: 0 6px 15px rgba(28,60,42,.10); }
.button-primary { border-color: var(--green); color: #fff; background: var(--green); }
.button-primary:hover:not(:disabled) { background: var(--green-dark); }
.button:disabled { opacity: .42; cursor: not-allowed; }
.add-row-button { white-space: nowrap; }

.table-scroll { overflow-x: auto; padding-bottom: 3px; }
.products-table { width: 100%; min-width: 1160px; border-collapse: separate; border-spacing: 0; }
.products-table th { padding: 0 7px 9px; border-bottom: 2px solid #26362e; color: #536058; text-align: left; font-size: 11px; font-weight: 720; white-space: nowrap; }
.products-table td { padding: 10px 7px 0; vertical-align: top; }
.products-table th:first-child, .products-table td:first-child { padding-left: 0; }
.products-table th:last-child, .products-table td:last-child { padding-right: 0; }
.products-table input[type="text"], .products-table input[type="number"] { height: 40px; min-width: 110px; font-size: 12px; }
.products-table [data-field="barcode"] { min-width: 165px; font-family: "SFMono-Regular", Consolas, monospace; }
.products-table [data-field="productName"], .products-table [data-field="seller"] { min-width: 180px; }
.products-table [data-field="quantity"] { min-width: 72px; width: 72px; }
.products-table .boolean-cell { min-width: 140px; height: 40px; display: flex; align-items: center; gap: 7px; color: var(--muted); font-size: 11px; }
.products-table .boolean-cell input { width: 17px; height: 17px; accent-color: var(--green); }
.product-extra-row td { padding: 0 0 16px !important; }
.row-extra-panel { margin-top: 10px; padding: 14px 16px 16px; border: 1px solid #d6e1da; border-radius: 11px; background: #f4f8f5; }
.row-extra-title { margin-bottom: 11px; color: var(--green); font-size: 10px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
.row-extra-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 12px 16px; }
.row-extra-field { display: block; min-width: 0; }
.row-extra-field > span:first-child { display: block; margin-bottom: 6px; color: #536058; font-size: 10px; font-weight: 720; }
.row-extra-field .boolean-cell { min-width: 0; }
.delete-row { width: 40px; height: 40px; border: 0; border-radius: 9px; color: #fff; background: #d9534f; font-size: 17px; cursor: pointer; }
.delete-row:hover { background: #bd3f3b; }
.table-hint { margin: 12px 0 0; color: var(--muted); font-size: 10px; }

.preview-toolbar { align-items: center; }
.actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 9px; }
.notice { margin: -3px 0 18px; padding: 11px 14px; border-radius: 9px; font-size: 12px; }
.error-notice { color: var(--danger); background: #feefed; }
.labels-preview { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, max-content)); gap: 18px; min-height: 160px; padding: 24px; overflow: auto; border: 1px dashed #c8d3cb; border-radius: 15px; background: #f8faf8; background-image: linear-gradient(45deg,#f1f4f1 25%,transparent 25%),linear-gradient(-45deg,#f1f4f1 25%,transparent 25%),linear-gradient(45deg,transparent 75%,#f1f4f1 75%),linear-gradient(-45deg,transparent 75%,#f1f4f1 75%); background-size: 18px 18px; background-position: 0 0,0 9px,9px -9px,-9px 0; }
.empty-preview { grid-column: 1 / -1; align-self: center; color: var(--muted); text-align: center; font-size: 13px; }
.label-card { position: relative; display: flex; flex-direction: column; overflow: hidden; border: 1px solid #c5cdc8; border-radius: 3px; color: #101713; background: #fff; box-shadow: 0 5px 14px rgba(0,0,0,.09); container-type: size; }
.label-card > svg { display: block; width: 100%; height: 100%; flex: 1 1 auto; }
.invalid-message { display: grid; height: 100%; place-items: center; padding: 12px; color: var(--danger); background: #fff1ef; font-size: 12px; text-align: center; }
.label-card.invalid-label { border-color: var(--danger); }
.label-inner { display: flex; height: 100%; flex-direction: column; padding: 3.6%; font-size: var(--label-font, 11px); line-height: 1.15; }
.label-product { overflow: hidden; margin-top: 1%; font-size: 1.08em; font-weight: 750; text-align: left; white-space: normal; overflow-wrap: anywhere; }
.barcode-zone { display: flex; min-height: 20px; flex: 0 0 var(--barcode-height, 52%); align-items: stretch; justify-content: center; overflow: hidden; }
.barcode-zone svg { display: block; width: 78%; height: 100%; }
.barcode-number { min-height: 1.1em; overflow: hidden; margin-top: .7%; font-family: "SFMono-Regular", Consolas, monospace; font-size: .92em; line-height: 1; letter-spacing: .04em; text-align: center; white-space: nowrap; }
.label-seller { min-height: 1.1em; overflow: hidden; margin-top: .5%; font-size: .95em; font-weight: 650; line-height: 1.05; text-align: center; white-space: normal; overflow-wrap: anywhere; }
.label-details { display: block; margin-top: 1%; overflow: hidden; font-size: .9em; line-height: 1.08; }
.label-detail { min-width: 0; overflow: hidden; margin-top: .5%; white-space: normal; overflow-wrap: anywhere; }
.label-detail strong { font-weight: 700; }
.label-eac { font-size: 1.45em; font-weight: 900; letter-spacing: -.08em; }
.label-cert { font-size: .72em; white-space: normal; }
.invalid-label .barcode-zone { align-items: center; padding: 8px; color: var(--danger); background: #fff1ef; font-size: .8em; text-align: center; }
.copy-badge { position: absolute; top: 4px; right: 5px; z-index: 2; padding: 2px 5px; border-radius: 999px; color: #355342; background: rgba(230,243,234,.9); font-size: 8px; font-weight: 750; }
.preview-limit { margin: 12px 0 0; color: var(--muted); font-size: 11px; }

.print-sheet { display: none; }
footer { display: flex; justify-content: space-between; gap: 20px; padding: 7px 5px 0; color: var(--muted); font-size: 11px; }
footer p { margin: 0; }
footer span { white-space: nowrap; }
footer a { color: inherit; }

.guide-index { display: grid; grid-template-columns: minmax(250px, .68fr) 1.32fr; gap: 34px; margin: 30px 0 22px; padding: 30px; border: 1px solid var(--line); border-radius: 22px; background: #f8fbf8; }
.guide-index__intro h2 { margin-bottom: 10px; font-size: 25px; letter-spacing: -.03em; }
.guide-index__intro > p:last-child { margin: 0; color: var(--muted); font-size: 14px; line-height: 1.6; }
.guide-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.guide-grid a { display: block; min-width: 0; padding: 15px; border: 1px solid var(--line); border-radius: 12px; color: var(--ink); background: #fff; text-decoration: none; transition: border-color .15s, transform .15s; }
.guide-grid a:hover { transform: translateY(-1px); border-color: #98b9a5; }
.guide-grid strong, .guide-grid span { display: block; }
.guide-grid strong { margin-bottom: 5px; font-size: 13px; }
.guide-grid span { color: var(--muted); font-size: 11px; line-height: 1.4; }

.content-shell { width: min(1040px, calc(100% - 40px)); margin: 0 auto; padding: 38px 0 30px; }
.breadcrumbs { margin: 0 0 22px; color: var(--muted); font-size: 12px; }
.breadcrumbs a { color: var(--green); }
.article-hero { margin-bottom: 18px; padding: 38px; border: 1px solid var(--line); border-radius: 22px; background: linear-gradient(135deg, #fff 0%, #eef6f0 100%); box-shadow: 0 14px 45px rgba(37,65,49,.055); }
.article-hero h1 { max-width: 830px; }
.article-hero .hero-copy { max-width: 780px; }
.article-layout { display: grid; grid-template-columns: minmax(0, 1fr) 260px; gap: 18px; align-items: start; }
.article { padding: 34px 38px; border: 1px solid var(--line); border-radius: 22px; background: #fff; box-shadow: 0 14px 45px rgba(37,65,49,.05); }
.article h2 { margin: 36px 0 12px; font-size: 24px; letter-spacing: -.025em; }
.article h2:first-child { margin-top: 0; }
.article h3 { margin: 24px 0 8px; font-size: 17px; }
.article p, .article li { color: #46544c; font-size: 15px; line-height: 1.72; }
.article ul, .article ol { padding-left: 21px; }
.article li + li { margin-top: 7px; }
.article a { color: var(--green); }
.article table { width: 100%; margin: 18px 0 24px; border-collapse: collapse; font-size: 13px; }
.article th, .article td { padding: 12px; border: 1px solid var(--line); text-align: left; vertical-align: top; }
.article th { background: #eef6f0; }
.callout { margin: 22px 0; padding: 16px 18px; border-left: 4px solid var(--green); border-radius: 0 10px 10px 0; background: var(--green-pale); color: #294638; font-size: 14px; line-height: 1.6; }
.article-cta { margin-top: 34px; padding: 24px; border-radius: 16px; color: #fff; background: var(--green); }
.article-cta h2 { margin: 0 0 8px; color: #fff; }
.article-cta p { margin-bottom: 18px; color: rgba(255,255,255,.82); }
.article-cta .button { display: inline-flex; align-items: center; color: var(--green-dark); background: #fff; text-decoration: none; }
.side-nav { position: sticky; top: 18px; padding: 20px; border: 1px solid var(--line); border-radius: 18px; background: #fff; }
.side-nav strong { display: block; margin-bottom: 12px; font-size: 13px; }
.side-nav a { display: block; padding: 7px 0; color: var(--muted); font-size: 12px; line-height: 1.35; text-decoration: none; }
.side-nav a:hover, .side-nav a[aria-current="page"] { color: var(--green); }
.faq-list details { border-top: 1px solid var(--line); padding: 15px 0; }
.faq-list details:last-child { border-bottom: 1px solid var(--line); }
.faq-list summary { cursor: pointer; font-weight: 750; line-height: 1.45; }
.faq-list details p { margin: 10px 0 0; }

@media (max-width: 1120px) {
  .primary-settings { grid-template-columns: repeat(3, 1fr); }
}

@media (max-width: 760px) {
  .app-shell { width: min(650px, calc(100% - 24px)); padding-top: 28px; }
  .hero { gap: 14px; }
  .brand-mark { width: 50px; height: 50px; border-radius: 14px; }
  h1 { font-size: 30px; }
  .hero-copy { font-size: 14px; }
  .settings-panel, .products-panel, .preview-panel { padding: 22px 18px; }
  .primary-settings { grid-template-columns: 1fr 1fr; }
  .optional-fields { grid-template-columns: 1fr; gap: 14px; margin: 24px -18px -22px; padding: 20px 18px; }
  .checkbox-grid { grid-template-columns: 1fr; gap: 9px; }
  .section-heading, .preview-toolbar { align-items: stretch; flex-direction: column; gap: 13px; }
  .add-row-button { align-self: flex-start; }
  .actions { display: grid; grid-template-columns: 1fr 1fr; }
  .actions .button-primary { grid-column: 1 / -1; grid-row: 1; }
  .actions .pdf-button { grid-column: 1 / -1; grid-row: 2; }
  .labels-preview { grid-template-columns: 1fr; justify-items: center; padding: 16px; }
  footer { display: block; line-height: 1.5; }
  footer span { display: block; margin-top: 6px; }
  .site-nav { align-items: flex-start; flex-direction: column; margin-bottom: 24px; }
  .site-nav__links { width: 100%; justify-content: flex-start; gap: 8px 15px; overflow-x: auto; padding-bottom: 2px; }
  .guide-index { grid-template-columns: 1fr; gap: 20px; padding: 22px 18px; }
  .guide-grid { grid-template-columns: 1fr; }
  .content-shell { width: min(650px, calc(100% - 24px)); padding-top: 24px; }
  .article-hero { padding: 26px 20px; }
  .article-layout { grid-template-columns: 1fr; }
  .article { padding: 26px 20px; }
  .side-nav { position: static; }
  .article table { display: block; overflow-x: auto; }
}

@media (max-width: 460px) {
  .primary-settings { grid-template-columns: 1fr; }
}

@media print {
  @page { margin: 0; }
  body { background: #fff; }
  body > * { display: none !important; }
  .print-sheet { display: flex !important; align-content: flex-start; flex-wrap: wrap; gap: 0; }
  .print-sheet .label-card { break-inside: avoid; border: 0; border-radius: 0; box-shadow: none; page-break-inside: avoid; }
  .print-sheet .copy-badge { display: none; }
}
