:root {
  color-scheme: light;
  --ink: #11243b;
  --muted: #627083;
  --navy: #0b2a4a;
  --blue: #086bc0;
  --blue-dark: #07569a;
  --canvas: #f2f6fa;
  --line: #d7e0e9;
  --green: #118352;
  --green-pale: #edf9f3;
  --red: #b93638;
  --red-pale: #fff2f2;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { min-width: 320px; background: var(--canvas); }
body {
  margin: 0;
  color: var(--ink);
  background: radial-gradient(circle at 85% 7%, rgba(8, 107, 192, .11), transparent 26rem), linear-gradient(180deg, #f8fbfd 0, var(--canvas) 58%);
  font-family: Inter, "Segoe UI", Arial, sans-serif;
}
button, input { font: inherit; }
button:disabled { cursor: not-allowed; opacity: .55; transform: none !important; }
button:focus-visible, .drop-zone:focus-within { outline: 3px solid rgba(8, 107, 192, .28); outline-offset: 3px; }
.converter-shell { width: min(960px, calc(100% - 32px)); margin: 0 auto; padding: 28px 0 36px; }
.site-header { display: flex; align-items: center; gap: 12px; }
.brand-mark { display: grid; width: 44px; height: 44px; place-items: center; border-radius: 10px; color: #fff; background: var(--navy); font-weight: 900; letter-spacing: -.05em; }
.brand-name { font-size: 17px; font-weight: 850; letter-spacing: -.02em; }
.brand-caption { margin-top: 2px; color: var(--muted); font-size: 12px; }
.hero { width: min(760px, 100%); margin: 68px auto 34px; text-align: center; }
.eyebrow { margin: 0 0 14px; color: var(--blue); font-size: 12px; font-weight: 800; letter-spacing: .13em; text-transform: uppercase; }
h1 { margin: 0; font-size: clamp(34px, 6vw, 62px); line-height: 1.02; letter-spacing: -.055em; }
.hero-copy { width: min(650px, 100%); margin: 22px auto 0; color: var(--muted); font-size: clamp(16px, 2vw, 19px); line-height: 1.6; }
.workspace { overflow: hidden; border: 1px solid var(--line); border-radius: 22px; background: rgba(255, 255, 255, .92); box-shadow: 0 22px 70px rgba(22, 43, 67, .10); }
.steps { display: grid; grid-template-columns: repeat(3, 1fr); border-bottom: 1px solid var(--line); background: #f9fbfd; }
.steps div { display: flex; align-items: center; justify-content: center; gap: 9px; padding: 18px 12px; font-size: 13px; }
.steps div + div { border-left: 1px solid var(--line); }
.steps span { display: grid; width: 24px; height: 24px; place-items: center; border-radius: 50%; color: var(--blue); background: #e5f2fc; font-size: 11px; font-weight: 900; }
.drop-zone { margin: 32px; padding: 54px 24px; border: 2px dashed #b8c8d8; border-radius: 16px; text-align: center; background: #fbfdff; transition: border-color .2s, background .2s, transform .2s; }
.drop-zone.is-dragging { border-color: var(--blue); background: #eef7ff; transform: translateY(-2px); }
.drop-zone.is-working { border-style: solid; }
.drop-zone > input { position: absolute; width: 1px; height: 1px; overflow: hidden; opacity: 0; pointer-events: none; }
.document-symbol { position: relative; width: 66px; height: 80px; margin: 0 auto 20px; border: 2px solid #91a9bf; border-radius: 8px; background: #fff; }
.document-symbol::before { content: ""; position: absolute; top: -2px; right: -2px; width: 21px; height: 21px; border-bottom: 2px solid #91a9bf; border-left: 2px solid #91a9bf; background: #f2f6fa; }
.document-symbol span { position: absolute; right: 7px; bottom: 8px; left: 7px; padding: 5px 2px; border-radius: 4px; color: #fff; background: var(--red); font-size: 11px; font-weight: 900; }
.image-symbol span { background: var(--blue); }
.drop-zone h2 { margin: 0; font-size: 23px; letter-spacing: -.025em; }
.drop-zone p { margin: 8px 0 22px; color: var(--muted); font-size: 14px; }
.upload-actions { display: flex; justify-content: center; gap: 10px; }
.selection-summary { display: grid; width: min(620px, 100%); gap: 6px; margin: 22px auto 0; padding: 16px; border: 1px solid #c8d9e8; border-radius: 12px; text-align: left; background: #f0f7fd; }
.selection-summary strong { font-size: 15px; }
.selection-summary > span { overflow-wrap: anywhere; color: var(--muted); font-size: 13px; line-height: 1.45; }
.source-groups { display: grid; gap: 10px; margin-top: 10px; padding-top: 14px; border-top: 1px solid #c8d9e8; }
.source-groups h3 { margin: 0; font-size: 15px; }
.source-groups > p { margin: -5px 0 2px; color: var(--muted); font-size: 12px; line-height: 1.45; }
.source-groups label { display: grid; grid-template-columns: minmax(150px, .8fr) minmax(210px, 1.2fr); gap: 12px; align-items: center; }
.source-groups label > span { display: flex; min-width: 0; flex-direction: column; gap: 2px; }
.source-groups label strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; }
.source-groups label small { color: var(--muted); font-size: 11px; }
.source-groups input { width: 100%; min-height: 42px; border: 1px solid #aac2d8; border-radius: 8px; padding: 9px 11px; color: var(--ink); background: #fff; }
.source-groups input:focus { border-color: var(--blue); outline: 3px solid rgba(8, 107, 192, .14); }
.selection-summary > .source-warning { color: #8a5b13; font-weight: 750; }
.selection-actions { display: flex; align-items: center; gap: 12px; margin-top: 8px; }
.selection-actions .primary-button { flex: 1; }
.clear-button { border: 0; padding: 10px 4px; color: #7a2930; background: transparent; font-weight: 750; cursor: pointer; }
.clear-button:hover { text-decoration: underline; }
.primary-button, .secondary-button, .download-button { min-height: 48px; border: 0; border-radius: 10px; padding: 12px 22px; color: #fff; background: var(--blue); font-weight: 800; cursor: pointer; transition: background .2s, transform .2s; }
.secondary-button { border: 1px solid #aac2d8; color: var(--navy); background: #fff; }
.primary-button:hover, .download-button:hover { background: var(--blue-dark); transform: translateY(-1px); }
.primary-button:disabled { color: #688095; background: #d7e3ed; cursor: not-allowed; transform: none; }
.secondary-button:hover { background: #edf6fd; transform: translateY(-1px); }
.progress-track { width: min(440px, 90%); height: 9px; margin: 26px auto 0; overflow: hidden; border-radius: 99px; background: #dde7f0; }
.progress-track div { height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--blue), #18a1d7); transition: width .15s; }
.result-message, .success-panel { margin: 0 32px 32px; border-radius: 14px; }
.result-message { display: flex; flex-direction: column; gap: 5px; padding: 18px 20px; }
.error-message { border: 1px solid #efc3c4; color: #782224; background: var(--red-pale); }
.result-message span { font-size: 14px; line-height: 1.5; }
.success-panel { padding: 24px; border: 1px solid #bfe3d1; background: var(--green-pale); }
.success-heading { display: flex; align-items: center; gap: 12px; }
.success-heading div { display: flex; flex-direction: column; gap: 3px; }
.success-heading strong { font-size: 20px; }
.success-heading span { color: #557065; font-size: 13px; }
.success-check { display: grid; width: 40px; height: 40px; place-items: center; border-radius: 50%; color: #fff !important; background: var(--green); font-size: 22px !important; font-weight: 900; }
.result-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1px; overflow: hidden; margin: 22px 0 16px; border: 1px solid #cbe4d8; border-radius: 10px; background: #cbe4d8; }
.result-stats div { padding: 14px; background: #fff; }
.result-stats dt { color: var(--muted); font-size: 11px; }
.result-stats dd { margin: 5px 0 0; font-size: 24px; font-weight: 900; }
.name-warning { margin: -4px 0 16px; color: #8a5b13; font-size: 13px; font-weight: 700; }
.failed-files { display: block; max-height: 150px; overflow: auto; margin-top: 8px; padding: 10px; border-radius: 8px; white-space: pre-wrap; background: rgba(255,255,255,.6); font-size: 12px; }
.manual-recovery { display: grid; gap: 12px; margin-top: 16px; padding-top: 16px; border-top: 1px solid #e9b6b8; }
.manual-recovery[hidden] { display: none; }
.manual-recovery h3 { margin: 0; font-size: 17px; }
.manual-recovery > p { margin: -6px 0 2px; color: #8d3b3d; font-size: 13px; line-height: 1.45; }
#manual-recovery-rows { display: grid; gap: 12px; }
.manual-recovery-row { display: grid; grid-template-columns: 104px minmax(0, 1fr); gap: 12px; align-items: center; padding: 10px; border: 1px solid #efc3c4; border-radius: 10px; background: rgba(255,255,255,.68); }
.manual-recovery-row a { display: block; width: 104px; height: 78px; overflow: hidden; border-radius: 7px; background: #eef2f5; }
.manual-recovery-row img { width: 100%; height: 100%; object-fit: cover; }
.manual-recovery-row label { min-width: 0; }
.manual-recovery-row label span { display: block; overflow: hidden; margin-bottom: 6px; color: #782224; font: 600 12px/1.35 ui-monospace, SFMono-Regular, Menlo, monospace; text-overflow: ellipsis; white-space: nowrap; }
.manual-recovery-row input { width: 100%; min-height: 44px; border: 1px solid #d99b9d; border-radius: 8px; padding: 9px 11px; color: var(--ink); background: #fff; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
.manual-recovery-row input:focus { border-color: #a33a3d; outline: 3px solid rgba(163,58,61,.13); }
.manual-recovery-row label small { display: block; margin-top: 6px; color: #6e4b4c; font-size: 12px; line-height: 1.4; }
.ai-recovery-actions { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px; align-items: end; padding: 12px; border: 1px solid #e4b1b3; border-radius: 10px; background: rgba(255,255,255,.7); }
.ai-recovery-actions label span { display: block; margin-bottom: 6px; color: #782224; font-size: 12px; font-weight: 800; }
.ai-recovery-actions input { width: 100%; min-height: 44px; border: 1px solid #d99b9d; border-radius: 8px; padding: 9px 11px; color: var(--ink); background: #fff; }
.manual-ai-button { min-height: 44px; border: 1px solid #8a5b13; border-radius: 9px; padding: 0 16px; color: #fff; background: #9a6514; font-weight: 750; cursor: pointer; }
.manual-ai-button:hover { background: #7e510e; }
.manual-ai-button:disabled { opacity: .65; cursor: wait; }
.manual-add-button { justify-self: start; min-height: 44px; border: 0; border-radius: 9px; padding: 0 16px; color: #fff; background: #8b2f32; font-weight: 750; cursor: pointer; }
.manual-add-button:hover { background: #742427; }
.product-groups { margin: 18px 0; padding: 18px; border: 1px solid #cbe4d8; border-radius: 10px; background: #fff; }
.product-groups h3 { margin: 0; font-size: 16px; }
.product-groups > p { margin: 6px 0 16px; color: var(--muted); font-size: 12px; line-height: 1.5; }
.product-groups label { display: block; }
.product-groups label + label { margin-top: 14px; }
.product-groups label span { display: block; margin-bottom: 6px; color: var(--muted); font-size: 12px; }
.product-groups input { width: 100%; min-height: 44px; border: 1px solid #b8c8d8; border-radius: 8px; padding: 9px 11px; color: var(--ink); background: #fbfdff; }
.product-groups input:focus { border-color: var(--blue); outline: 3px solid rgba(8, 107, 192, .14); }
.access-code { display: block; margin: 0 0 16px; }
.access-code span, .access-code small { display: block; }
.access-code span { margin-bottom: 6px; color: var(--ink); font-size: 13px; font-weight: 800; }
.access-code input { width: 100%; min-height: 44px; border: 1px solid #b8c8d8; border-radius: 8px; padding: 9px 11px; color: var(--ink); background: #fff; }
.access-code input:focus { border-color: var(--blue); outline: 3px solid rgba(8, 107, 192, .14); }
.access-code small { margin-top: 6px; color: var(--muted); font-size: 12px; }
.gtin-line { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; color: var(--muted); font-size: 12px; }
.gtin-line code { color: var(--ink); font-family: "SFMono-Regular", Consolas, monospace; font-size: 13px; }
.download-button { width: 100%; background: var(--green); }
.download-button:hover { background: #0b6c43; }
footer { display: flex; justify-content: center; gap: 28px; padding: 24px 8px 0; color: var(--muted); font-size: 12px; }
footer span::before { content: "✓"; margin-right: 6px; color: var(--green); font-weight: 900; }
@media (max-width: 640px) {
  .converter-shell { width: min(100% - 20px, 960px); padding-top: 16px; }
  .hero { margin: 46px auto 26px; }
  .steps strong { display: none; }
  .steps div { padding: 13px; }
  .drop-zone { margin: 16px; padding: 38px 15px; }
  .upload-actions { flex-direction: column; }
  .source-groups label { grid-template-columns: 1fr; gap: 6px; }
  .selection-actions { align-items: stretch; flex-direction: column; }
  .clear-button { min-height: 42px; }
  .result-message, .success-panel { margin: 0 16px 16px; }
  .result-stats { grid-template-columns: repeat(2, 1fr); }
  .result-stats dt { min-height: 27px; }
  .result-stats dd { font-size: 20px; }
  .manual-recovery-row { grid-template-columns: 1fr; }
  .manual-recovery-row a { width: 100%; height: 150px; }
  .ai-recovery-actions { grid-template-columns: 1fr; }
  footer { flex-direction: column; align-items: center; gap: 7px; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; } }
