:root {
  color-scheme: light;
  --bg: #f2f1ec;
  --surface: #faf9f5;
  --surface-alt: #eeece5;
  --ink: #252b29;
  --muted: #626b66;
  --line: #d4d5ce;
  --teal: #13786e;
  --teal-dark: #0b5d55;
  --warning: #8d4b24;
  --warning-bg: #f6ecdf;
  --ready: #27664d;
  --ready-bg: #e5eee7;
  font-family: Inter, "Avenir Next", Avenir, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--ink);
}
* { box-sizing: border-box; }
body { margin: 0; min-width: 320px; background: var(--bg); }
button, select, textarea { font: inherit; }
.app-header { min-height: 64px; padding: 0 max(22px, calc((100% - 1280px) / 2)); display: flex; align-items: center; justify-content: space-between; gap: 18px; border-bottom: 1px solid var(--line); background: var(--surface); }
.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--ink); text-decoration: none; font-size: 13px; font-weight: 680; letter-spacing: .025em; }
.brand i { color: var(--teal); font-style: normal; margin: 0 2px; }
.brand-mark { width: 29px; height: 29px; display: grid; place-items: center; border: 1px solid var(--teal); color: var(--teal); font: italic 18px Georgia, serif; }
.local-state { display: inline-flex; align-items: center; gap: 8px; color: var(--muted); font-size: 10px; }
.local-state i { width: 7px; height: 7px; border-radius: 50%; background: #4b9277; }
main { max-width: 1280px; margin: 0 auto; padding: 0 28px; }
.page-heading { display: flex; justify-content: space-between; align-items: end; gap: 40px; padding: 49px 0 32px; }
.kicker { margin: 0 0 9px; color: var(--teal-dark); font-size: 9px; font-weight: 650; letter-spacing: .15em; text-transform: uppercase; }
h1 { margin: 0; font: 400 clamp(30px, 3.2vw, 43px)/1.13 Georgia, "Times New Roman", serif; letter-spacing: -.035em; }
h1 span { color: var(--muted); font-size: .76em; }
.heading-note { max-width: 290px; margin: 0 0 5px; color: var(--muted); font-size: 12px; line-height: 1.65; }
.workflow-bar { display: flex; align-items: center; gap: 13px; padding: 15px 17px; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); color: var(--muted); font-size: 10px; }
.workflow-bar b { color: var(--teal); margin-right: 6px; font-size: 9px; }
.workflow-line { width: 35px; height: 1px; background: var(--line); }
.source-section, .results-section, .export-section { padding-top: 39px; }
.section-heading { display: flex; justify-content: space-between; align-items: end; gap: 25px; margin-bottom: 17px; }
h2 { margin: 0; font: 400 25px/1.15 Georgia, "Times New Roman", serif; letter-spacing: -.02em; }
.section-heading > p { max-width: 480px; margin: 0; color: var(--muted); font-size: 11px; line-height: 1.65; }
.source-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.local-import { margin: 0 0 15px; padding: 17px; display: grid; grid-template-columns: minmax(220px, .72fr) minmax(0, 1.28fr); gap: 9px 24px; border: 1px solid var(--line); background: var(--surface-alt); }
.import-copy h3 { margin: 0 0 5px; font: 500 16px/1.25 Georgia, "Times New Roman", serif; }
.import-copy p, .import-help, .file-message { margin: 0; color: var(--muted); font-size: 11px; line-height: 1.5; }
.import-controls { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.file-label, .delimiter-label { color: var(--ink); font-size: 11px; font-weight: 600; }
#local-csv-file { min-width: 160px; max-width: 100%; color: var(--ink); font-family: inherit; font-size: 11px; line-height: 1.4; }
#local-delimiter { min-height: 39px; padding: 0 9px; border: 1px solid var(--line); background: white; color: var(--ink); font-size: 11px; }
.import-controls .primary-button { min-height: 39px; }
.text-button { min-height: 39px; padding: 0 10px; border: 0; background: transparent; color: var(--teal-dark); cursor: pointer; font-size: 11px; text-decoration: underline; text-underline-offset: 3px; }
.import-help { grid-column: 1 / -1; }
.file-message { grid-column: 1 / -1; color: var(--teal-dark); }
.file-message.has-warning { color: var(--warning); }
.source-card { min-width: 0; border: 1px solid var(--line); background: var(--surface); }
.source-card-head { display: flex; justify-content: space-between; align-items: start; gap: 12px; padding: 15px 17px; border-bottom: 1px solid var(--line); }
.source-card-head h3 { margin: 0; font-size: 13px; font-weight: 650; }
.source-card-head p { margin: 4px 0 0; color: var(--muted); font-size: 9px; }
.source-count { flex: 0 0 auto; padding: 5px 7px; background: var(--surface-alt); color: var(--muted); font-size: 9px; }
.source-card-content { padding: 15px 17px 17px; }
.mapping-title, .sample-title { margin: 0 0 9px; color: var(--muted); font-size: 9px; font-weight: 650; letter-spacing: .08em; text-transform: uppercase; }
.mapping-list { display: grid; gap: 7px; }
.mapping-row { display: grid; grid-template-columns: 115px minmax(0, 1fr); gap: 10px; align-items: center; }
.mapping-row label { color: var(--ink); font-size: 10px; }
.mapping-row label span { color: var(--muted); }
.mapping-row select { width: 100%; min-width: 0; height: 32px; padding: 0 9px; border: 1px solid var(--line); border-radius: 0; background: #fff; color: var(--ink); font-size: 10px; }
select:focus-visible, button:focus-visible, textarea:focus-visible { outline: 2px solid #126a60; outline-offset: 2px; }
.sample-preview { margin-top: 16px; }
.sample-table-wrap { overflow-x: auto; border: 1px solid var(--line); }
.sample-table { width: 100%; border-collapse: collapse; white-space: nowrap; }
.sample-table th, .sample-table td { padding: 7px 8px; border-bottom: 1px solid #e3e2dc; text-align: left; font-size: 9px; }
.sample-table th { background: #f1f0ea; color: var(--muted); font-weight: 550; }
.sample-table td { max-width: 145px; overflow: hidden; text-overflow: ellipsis; }
.map-actions { display: flex; justify-content: space-between; align-items: center; gap: 20px; margin-top: 13px; }
.map-actions p { min-height: 16px; margin: 0; color: var(--muted); font-size: 10px; }
.primary-button, .secondary-button { min-height: 39px; padding: 0 14px; display: inline-flex; align-items: center; justify-content: center; gap: 14px; border: 1px solid var(--teal); background: var(--teal); color: white; cursor: pointer; font-size: 10px; transition: background .15s; }
.primary-button:hover:not(:disabled) { background: var(--teal-dark); }
.primary-button:disabled, .secondary-button:disabled { opacity: .48; cursor: not-allowed; }
.results-section { border-top: 1px solid var(--line); margin-top: 37px; }
.results-title { align-items: center; }
.result-count { color: var(--muted); font-size: 10px; }
.summary-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 9px; margin-bottom: 14px; }
.summary-card { min-height: 73px; padding: 12px 14px; border: 1px solid var(--line); background: var(--surface); }
.summary-card span { display: block; color: var(--muted); font-size: 9px; }
.summary-card strong { display: block; margin-top: 7px; font: 400 22px Georgia, serif; }
.ready-card { border-left: 3px solid var(--ready); }
.ready-card strong { color: var(--ready); }
.review-card { border-left: 3px solid #bb7b41; }
.review-card strong { color: var(--warning); }
.records-panel { border: 1px solid var(--line); background: var(--surface); }
.record-tabs { display: flex; gap: 3px; padding: 8px 10px 0; border-bottom: 1px solid var(--line); }
.record-tabs button { position: relative; min-height: 36px; padding: 0 11px; border: 0; background: transparent; color: var(--muted); cursor: pointer; font-size: 10px; }
.record-tabs button[aria-pressed="true"] { color: var(--teal-dark); font-weight: 650; }
.record-tabs button[aria-pressed="true"]::after { position: absolute; right: 9px; bottom: -1px; left: 9px; height: 2px; background: var(--teal); content: ""; }
.record-tabs span { margin-left: 5px; font-size: 9px; }
.table-wrap { max-height: 340px; overflow: auto; }
.record-table, #records-table { width: 100%; min-width: 760px; border-collapse: collapse; }
#records-table th, #records-table td { padding: 10px 12px; border-bottom: 1px solid #e4e3dd; text-align: left; vertical-align: top; font-size: 10px; }
#records-table th { position: sticky; top: 0; z-index: 1; background: #f1f0ea; color: var(--muted); font-size: 9px; font-weight: 600; }
#records-table td:nth-child(1), #records-table td:nth-child(3), #records-table td:nth-child(4), #records-table td:nth-child(5) { white-space: nowrap; font-variant-numeric: tabular-nums; }
.sku-cell { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; letter-spacing: .025em; }
.status-ready { color: var(--ready); }
.status-review { max-width: 280px; color: var(--warning); line-height: 1.45; }
.empty-table, .loading { padding: 20px !important; color: var(--muted); text-align: center !important; }
.export-section { border-top: 1px solid var(--line); margin-top: 38px; }
.export-panel { border: 1px solid var(--line); background: var(--surface); }
.export-toolbar { min-height: 45px; padding: 7px 12px; display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 8px 12px; border-bottom: 1px solid var(--line); color: var(--muted); font-size: 10px; }
.export-actions { display: flex; flex-wrap: wrap; gap: 7px; }
.secondary-button { min-height: 30px; padding: 0 10px; background: transparent; color: var(--teal-dark); font-size: 9px; }
.secondary-button:hover:not(:disabled) { background: #e8efea; }
#csv-preview { display: block; width: 100%; min-height: 220px; padding: 13px; resize: vertical; border: 0; background: #fbfaf7; color: #28312e; font: 10px/1.55 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; white-space: pre; overflow: auto; }
.copy-message { min-height: 28px; margin: 0; padding: 6px 13px; border-top: 1px solid #e4e3dd; color: var(--muted); font-size: 9px; }
.scope-note { margin: 11px 0 0; color: var(--muted); font-size: 11px; line-height: 1.65; }
.scope-note strong { color: var(--ink); }
footer { margin-top: 40px; padding: 14px 0 21px; display: flex; justify-content: space-between; gap: 18px; border-top: 1px solid var(--line); color: var(--muted); font-size: 9px; }
footer span:first-child { color: var(--ink); font-weight: 650; letter-spacing: .08em; }
.visually-hidden { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
@media (max-width: 860px) {
  main { padding-inline: 22px; }
  .app-header { padding-inline: 22px; }
  .source-grid { grid-template-columns: 1fr; }
  .local-import { grid-template-columns: 1fr; }
  .import-help, .file-message { grid-column: auto; }
  .page-heading { align-items: start; flex-direction: column; gap: 13px; }
  .heading-note { max-width: 520px; }
}
@media (max-width: 560px) {
  .app-header { min-height: 58px; padding-inline: 15px; }
  .brand { font-size: 11px; gap: 7px; }
  .brand-mark { width: 25px; height: 25px; }
  .local-state { max-width: 112px; font-size: 8px; line-height: 1.3; }
  main { padding-inline: 15px; }
  .page-heading { padding-top: 34px; }
  h1 { font-size: 31px; }
  h1 span { font-size: .72em; }
  .workflow-bar { gap: 7px; padding-inline: 9px; font-size: 8px; }
  .workflow-bar b { margin-right: 3px; font-size: 8px; }
  .workflow-line { width: 13px; }
  .source-section, .results-section, .export-section { padding-top: 30px; }
  .section-heading { align-items: start; flex-direction: column; gap: 9px; }
  .section-heading > p { font-size: 10px; }
  .mapping-row { grid-template-columns: 95px minmax(0, 1fr); gap: 7px; }
  .source-card-content { padding: 13px 11px; }
  .source-card-head { padding-inline: 12px; }
  .import-controls { align-items: stretch; }
  #local-csv-file { flex: 1 0 100%; min-height: 38px; }
  #local-delimiter { flex: 1; }
  .import-controls .primary-button, .text-button { flex: 1 1 auto; width: 100%; }
  .map-actions { align-items: stretch; flex-direction: column; gap: 10px; }
  .primary-button { width: 100%; }
  .summary-grid { grid-template-columns: 1fr 1fr; }
  .results-title { flex-direction: row; align-items: end; }
  .result-count { max-width: 112px; text-align: right; line-height: 1.4; }
  .export-toolbar { align-items: stretch; padding: 8px; }
  .export-actions { width: 100%; }
  .export-actions .secondary-button { flex: 1 1 100%; width: 100%; min-height: 38px; font-size: 10px; }
  #csv-preview { min-height: 240px; font-size: 9px; }
  footer { flex-direction: column; gap: 7px; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; } }
