:root {
  --ink: #13261f;
  --muted: #637069;
  --paper: #f6f4ee;
  --panel: #fffefa;
  --line: #d9ddd7;
  --brand: #126549;
  --brand-dark: #0b4935;
  --accent: #e9a23b;
  --warning: #8a4f00;
  --warning-bg: #fff4df;
  --shadow: 0 12px 32px rgba(24, 48, 39, 0.08);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--paper);
}

* { box-sizing: border-box; }

body { margin: 0; min-height: 100vh; }

button, input, select { font: inherit; }

button { cursor: pointer; }

.topbar {
  min-height: 84px;
  padding: 18px max(24px, calc((100vw - 1180px) / 2));
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  color: white;
  background: linear-gradient(115deg, #0c4735, #176d50 70%, #19785a);
}

.topbar h1, .topbar p { margin: 0; }
.topbar h1 { font-size: 1.3rem; letter-spacing: -0.02em; }
.brand-lockup { display: flex; align-items: center; gap: 12px; }
.brand-mark { width: 42px; height: 42px; display: grid; place-items: center; border: 1px solid rgba(255,255,255,.42); border-radius: 11px; color: white; background: rgba(0,0,0,.14); font-size: .78rem; font-weight: 900; letter-spacing: .05em; }
.eyebrow { margin-bottom: 4px !important; color: #bfe2d4; font-size: .75rem; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; }
.status-badge { padding: 8px 12px; border: 1px solid rgba(255,255,255,.3); border-radius: 999px; font-size: .8rem; background: rgba(0,0,0,.12); }
.topnav { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; }
.topnav a { padding: 8px 11px; border-radius: 999px; color: #d8eee5; font-size: .82rem; font-weight: 750; text-decoration: none; }
.topnav a[aria-current="page"] { color: white; background: rgba(0,0,0,.2); }

main { width: min(1180px, calc(100% - 32px)); margin: 34px auto 80px; }

.intro { display: grid; grid-template-columns: 1fr 340px; gap: 32px; align-items: end; margin-bottom: 28px; }
.intro h2 { margin: 5px 0 8px; font-family: Georgia, serif; font-size: clamp(2rem, 4vw, 3.4rem); font-weight: 500; line-height: 1.03; letter-spacing: -.045em; }
.intro p { max-width: 720px; margin: 0; color: var(--muted); line-height: 1.6; }
.step-label { color: var(--brand) !important; font-size: .78rem; font-weight: 850; letter-spacing: .12em; text-transform: uppercase; }
.matcher-hero { min-height: 330px; padding: clamp(28px, 5vw, 58px); display: flex; align-items: center; overflow: hidden; border-radius: 22px; background-image: linear-gradient(90deg, rgba(4,42,32,.98) 0%, rgba(4,42,32,.92) 44%, rgba(4,42,32,.3) 73%, rgba(4,42,32,.08) 100%), url("/assets/thread-colour-matcher-hero.png"); background-position: center; background-size: cover; box-shadow: var(--shadow); }
.hero-copy { max-width: 690px; color: white; }
.matcher-hero .step-label { color: #f0bd63 !important; }
.matcher-hero h2 { color: white; text-shadow: 0 2px 16px rgba(0,0,0,.28); }
.matcher-hero p { color: #d9ebe4; }
.hero-assurance { max-width: 620px; margin-top: 22px; padding: 13px 16px; display: grid; gap: 2px; border-left: 3px solid var(--accent); background: rgba(1,25,19,.55); backdrop-filter: blur(5px); }
.hero-assurance span { color: #d9ebe4; font-size: .88rem; line-height: 1.45; }

.panel { margin: 18px 0; padding: clamp(20px, 3vw, 34px); border: 1px solid var(--line); border-radius: 18px; background: var(--panel); box-shadow: var(--shadow); }
.panel-heading { display: flex; gap: 16px; align-items: flex-start; margin-bottom: 24px; }
.panel-heading h2 { margin: 0 0 4px; font-size: 1.25rem; }
.panel-heading p { margin: 0; color: var(--muted); }
.step-number { flex: 0 0 32px; height: 32px; display: grid; place-items: center; border-radius: 50%; color: white; background: var(--brand); font-weight: 800; }

.drop-zone { min-height: 165px; display: grid; place-content: center; gap: 5px; text-align: center; border: 2px dashed #9eb1a8; border-radius: 14px; background: #f7faf7; transition: .2s ease; }
.drop-zone:hover, .drop-zone.dragging { border-color: var(--brand); background: #eef8f3; }
.drop-zone input { position: absolute; inline-size: 1px; block-size: 1px; opacity: 0; }
.upload-title { color: var(--brand-dark); font-size: 1.05rem; font-weight: 800; }
.upload-subtitle { color: var(--muted); font-size: .86rem; }

.preparation { margin-top: 28px; }
.preview-grid { margin-top: 20px; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
figure { margin: 0; }
figcaption { margin: 0 0 9px; color: var(--muted); font-size: .78rem; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
.canvas-frame { min-height: 300px; display: grid; place-items: center; overflow: hidden; border: 1px solid var(--line); border-radius: 12px; }
.checkerboard { background-color: white; background-image: linear-gradient(45deg,#e7e7e7 25%,transparent 25%),linear-gradient(-45deg,#e7e7e7 25%,transparent 25%),linear-gradient(45deg,transparent 75%,#e7e7e7 75%),linear-gradient(-45deg,transparent 75%,#e7e7e7 75%); background-size: 22px 22px; background-position: 0 0,0 11px,11px -11px,-11px 0; }
canvas { display: block; max-width: 100%; max-height: 420px; object-fit: contain; }

.jpeg-controls { margin: 18px 0; padding: 18px; display: grid; grid-template-columns: 1fr minmax(220px, .7fr); gap: 14px 24px; align-items: center; border: 1px solid #ead4ad; border-radius: 12px; background: #fff9ee; }
.jpeg-controls label { font-weight: 750; }
.jpeg-controls p { margin: 4px 0 0; color: var(--muted); font-size: .87rem; }
.range-row { display: flex; align-items: center; gap: 10px; }
.range-row input { width: 100%; accent-color: var(--brand); }
.range-row output { min-width: 34px; padding: 4px 7px; text-align: center; border-radius: 5px; background: white; }
.check-row { grid-column: 1 / -1; display: flex; gap: 9px; align-items: center; }
.check-row input, .colour-check input, .review-check input { width: 18px; height: 18px; accent-color: var(--brand); }

.primary-button, .secondary-button { border: 0; border-radius: 8px; font-weight: 800; }
.primary-button { margin-top: 18px; padding: 12px 18px; color: white; background: var(--brand); box-shadow: 0 5px 12px rgba(18,101,73,.18); }
.primary-button:hover { background: var(--brand-dark); }
.secondary-button { padding: 10px 14px; color: var(--brand-dark); background: #e6f1ec; }

.sticky-logo { position: sticky; top: 10px; z-index: 20; margin: 14px 0; padding: 10px 14px; display: grid; gap: 8px; border: 1px solid #bfcac4; border-radius: 12px; background: rgba(255,254,250,.96); box-shadow: 0 8px 24px rgba(24,48,39,.14); backdrop-filter: blur(8px); }
.sticky-logo-main { display: flex; align-items: center; gap: 14px; }
.sticky-logo-main > strong { flex: 0 0 auto; color: var(--brand-dark); font-size: .78rem; text-transform: uppercase; letter-spacing: .05em; }
.sticky-logo-frame { min-width: 0; height: 92px; flex: 1; display: grid; place-items: center; overflow: hidden; border: 1px solid var(--line); border-radius: 8px; }
.sticky-logo canvas { max-width: 100%; max-height: 82px; }
.sticky-logo.round-logo .sticky-logo-frame { height: 190px; }
.sticky-logo.round-logo canvas { max-height: 178px; }
.logo-info-bar { min-height: 30px; padding: 6px 10px; display: flex; align-items: center; border-radius: 7px; color: white; background: var(--brand-dark); }
.logo-info-bar strong { font-size: .8rem; }
#colour-panel { scroll-margin-top: 126px; }

.warning-list { display: grid; gap: 8px; margin-bottom: 16px; }
.warning { padding: 10px 12px; border-left: 3px solid var(--accent); color: var(--warning); background: var(--warning-bg); font-size: .9rem; }
.colour-list { display: grid; gap: 8px; }
.colour-row { padding: 14px; display: grid; grid-template-columns: 34px minmax(110px, 1fr) auto; gap: 12px; align-items: center; border: 1px solid var(--line); border-radius: 10px; }
.colour-row.excluded { opacity: .48; background: #f0f1ef; }
.colour-swatch { width: 34px; height: 34px; border: 1px solid rgba(0,0,0,.18); border-radius: 50%; }
.colour-check { display: flex; gap: 9px; align-items: center; font-weight: 750; }
.colour-meta { color: var(--muted); font-size: .84rem; }
.thread-matches { grid-column: 1 / -1; margin-top: 4px; padding-top: 12px; border-top: 1px solid var(--line); }
.match-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 9px; font-size: .87rem; }
.clear-choice { padding: 4px 8px; border: 0; border-radius: 6px; color: var(--muted); background: #eef0ed; font-size: .77rem; }
.clear-choice:disabled { cursor: default; opacity: .72; }
.range-group { margin-top: 10px; padding: 11px; border: 1px solid var(--line); border-radius: 10px; background: #fbfbf8; }
.range-group.primary { border-color: #9fc5b2; border-left: 6px solid var(--brand); background: #edf7f2; box-shadow: 0 2px 8px rgba(11, 107, 79, .08); }
.range-group.alternative { border-color: #ccd5df; border-left: 4px solid #6b7f95; background: #f3f5f7; }
.range-heading { margin-bottom: 9px; display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.range-heading strong { font-size: .9rem; }
.range-heading span { color: var(--muted); font-size: .74rem; }
.range-heading .range-scroll-hint { margin-left: auto; font-weight: 750; }
.range-group.primary .range-heading strong { color: #064b38; font-size: .96rem; }
.range-group.primary .range-heading span:not(.range-scroll-hint) { color: #356957; font-weight: 700; }
.range-group.alternative .range-heading strong { color: #35485b; }
.candidate-grid { display: grid; grid-auto-flow: column; grid-auto-columns: calc((100% - 12px) / 2); gap: 12px; overflow-x: auto; overscroll-behavior-inline: contain; padding: 1px 2px 12px; scroll-snap-type: inline mandatory; scrollbar-color: #789486 #e4ebe7; scrollbar-width: auto; }
.candidate { min-width: 0; padding: 12px; display: grid; grid-template-columns: 22px minmax(0, 1fr); grid-template-areas: "radio details" "visual visual" "metrics metrics"; column-gap: 10px; row-gap: 9px; align-items: start; border: 1px solid var(--line); border-radius: 9px; background: #fafaf7; cursor: pointer; scroll-snap-align: start; }
.candidate.selected { border-color: var(--brand); background: #eef8f3; box-shadow: inset 0 0 0 1px var(--brand); }
.candidate input { grid-area: radio; width: 17px; height: 17px; margin-top: 3px; accent-color: var(--brand); }
.candidate-visual { grid-area: visual; width: 100%; display: grid; justify-items: center; overflow: hidden; border: 1px solid rgba(0,0,0,.18); border-radius: 8px; background: #f4f5f2; }
.candidate-screen-swatch { width: 100%; height: 82px; display: block; border-bottom: 1px solid rgba(0,0,0,.14); }
.thread-photo { width: auto; max-width: 100%; height: auto; display: block; object-fit: contain; image-rendering: auto; }
.thread-photo-placeholder { width: 100%; min-height: 72px; padding: 7px; display: grid; place-items: center; color: #7b837f; background: linear-gradient(145deg, #ecefeb, #fafbf9); text-align: center; font-size: .61rem; font-weight: 750; line-height: 1.2; text-transform: uppercase; }
.candidate-swatch { width: 36px; height: 36px; border: 1px solid rgba(0,0,0,.18); border-radius: 7px; }
.candidate-details { grid-area: details; min-width: 0; display: grid; justify-items: start; gap: 4px; }
.candidate-metrics { grid-area: metrics; min-width: 0; display: grid; justify-items: start; gap: 4px; }
.candidate-details small { color: var(--muted); font-size: .68rem; font-weight: 800; line-height: 1.2; text-transform: uppercase; }
.candidate-details strong { color: #111a16; font-size: 1rem; line-height: 1.15; }
.candidate-name { color: #33443d; font-size: .78rem; font-weight: 750; line-height: 1.2; }
.candidate-quality, .candidate-difference { color: #111a16; font-size: .84rem; font-weight: 650; line-height: 1.25; }
.candidate-hex { margin-top: 2px; color: var(--muted); font-size: .78rem; }
.candidate-metrics .stock-indicator { margin-top: 3px; padding: 4px 7px; border-radius: 5px; color: #25302b; background: #ecefeb; font-size: .69rem; font-weight: 850; line-height: 1; text-transform: uppercase; }
.candidate-metrics .stock-indicator.in_stock { color: #0c5139; background: #dcefe6; }
.candidate-metrics .stock-indicator.low_stock, .candidate-metrics .stock-indicator.to_order { color: #794300; background: #fff0d2; }
.candidate-metrics .stock-indicator.on_order { color: #294f73; background: #e3edf7; }
.range-data-warning { margin-top: 10px; padding: 9px 11px; border-left: 4px solid #b86a00; border-radius: 6px; color: #684000; background: #fff0d2; font-size: .8rem; font-weight: 750; line-height: 1.35; }
.thread-override { margin-top: 11px; padding: 12px; display: flex; align-items: center; justify-content: space-between; gap: 14px; border: 1px dashed #9eb1a8; border-radius: 9px; background: #f7faf7; }
.thread-override > div:first-child { display: grid; gap: 3px; }
.thread-override span { color: var(--muted); font-size: .76rem; }
.override-fields { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.override-fields select { width: 145px; }
.override-fields input { width: 120px; }
.override-selected { margin-top: 11px; padding: 9px 11px; display: flex; align-items: center; gap: 10px; border: 1px solid var(--brand); border-radius: 9px; color: var(--brand-dark); background: #eef8f3; font-size: .82rem; font-weight: 800; }
.override-selected .stock-indicator { margin-left: auto; font-weight: 650; }
.detected-colour-navigation { margin-bottom: 14px; display: flex; gap: 8px; overflow-x: auto; padding: 2px 2px 8px; }
.detected-colour-group { padding: 5px 6px 6px; display: grid; gap: 4px; border: 2px solid var(--accent); border-radius: 11px; background: #fff8e8; }
.detected-colour-group > span { padding-left: 3px; color: #76500b; font-size: .64rem; font-weight: 850; text-transform: uppercase; letter-spacing: .04em; }
.detected-colour-group-buttons { display: flex; gap: 5px; }
.detected-colour-group .detected-colour-button { min-width: 82px; }
.detected-colour-button { min-width: 92px; padding: 8px 10px; display: grid; grid-template-columns: 26px 1fr; grid-template-areas: "swatch number" "swatch status"; column-gap: 8px; border: 1px solid var(--line); border-radius: 9px; color: var(--ink); background: #f7f8f5; text-align: left; }
.detected-colour-button > span { grid-area: swatch; width: 26px; height: 26px; align-self: center; border: 1px solid rgba(0,0,0,.2); border-radius: 50%; }
.detected-colour-button strong { grid-area: number; font-size: .8rem; }
.detected-colour-button small { grid-area: status; color: var(--muted); font-size: .66rem; }
.detected-colour-button.active { border-color: var(--brand); color: var(--brand-dark); background: #e8f4ee; box-shadow: inset 0 0 0 1px var(--brand); }
.detected-colour-button.group-selected { border-color: var(--brand); color: var(--brand-dark); background: #dcefe6; box-shadow: inset 0 0 0 2px var(--brand); }
.detected-colour-button:disabled:not(.group-selected) { cursor: default; opacity: .45; }
.detected-colour-button.excluded { opacity: .48; }
.active-colour-header { margin-bottom: 14px; padding: 12px 14px; display: flex; align-items: center; justify-content: space-between; gap: 16px; border-radius: 10px; color: white; background: var(--brand-dark); }
.active-colour-identity { min-width: 0; display: flex; align-items: center; gap: 12px; }
.active-colour-swatch { flex: 0 0 42px; width: 42px; height: 42px; border: 2px solid rgba(255,255,255,.78); border-radius: 50%; }
.active-colour-identity > div { min-width: 0; display: grid; gap: 2px; }
.active-colour-identity small { color: #bfe2d4; font-size: .69rem; font-weight: 800; text-transform: uppercase; letter-spacing: .06em; }
.active-colour-identity strong { font-size: 1rem; }
.active-colour-identity span { color: #d8eee5; font-size: .76rem; }
.active-colour-include { display: flex; align-items: center; gap: 7px; font-size: .8rem; font-weight: 750; white-space: nowrap; }
.active-colour-include input { width: 18px; height: 18px; accent-color: var(--accent); }
.colour-grouping { margin: -4px 0 14px; padding: 11px 13px; display: flex; align-items: center; justify-content: space-between; gap: 14px; border: 1px solid #c7d8d0; border-radius: 10px; background: #f1f7f4; }
.colour-grouping.selecting { border: 2px solid var(--brand); background: #e8f4ee; box-shadow: 0 0 0 3px rgba(13, 113, 82, .08); }
.colour-grouping > div:first-child { display: grid; gap: 2px; }
.colour-grouping strong { font-size: .82rem; }
.colour-grouping span { color: var(--muted); font-size: .72rem; line-height: 1.3; }
.colour-grouping-actions { display: flex; align-items: center; justify-content: flex-end; gap: 8px; flex-wrap: wrap; }
.colour-grouping-actions b { color: var(--brand-dark); font-size: .76rem; }
.colour-grouping-actions select { min-width: 170px; }
.colour-review-workspace { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px; align-items: start; }
.colour-review-workspace.excluded { opacity: .52; }
.recommendation-focus, .colour-reference-panel { min-width: 0; padding: 15px; border: 1px solid var(--line); border-radius: 12px; background: #fafbf8; }
.recommendation-focus { border-top: 4px solid var(--brand); }
.colour-reference-panel { position: sticky; top: 12px; border-top: 4px solid var(--accent); }
.focus-heading { min-height: 38px; margin-bottom: 12px; display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.focus-heading > div:first-child { display: grid; gap: 2px; }
.focus-heading strong { font-size: .94rem; }
.focus-heading span { color: var(--muted); font-size: .73rem; line-height: 1.3; }
.range-tabs { margin-bottom: 12px; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 7px; }
.range-tab { padding: 9px 8px; border: 1px solid var(--line); border-radius: 8px; color: #415049; background: #eff1ee; font-size: .74rem; font-weight: 800; }
.range-tab.primary.active { border-color: var(--brand); color: #064b38; background: #dcefe6; }
.range-tab.alternative.active { border-color: #6b7f95; color: #35485b; background: #e5ebf1; }
.focus-candidate { padding: 14px; display: grid; gap: 12px; border: 1px solid var(--line); border-radius: 11px; background: white; }
.focus-candidate.selected { border-color: var(--brand); box-shadow: inset 0 0 0 1px var(--brand); }
.focus-candidate-heading { display: flex; justify-content: space-between; gap: 12px; }
.focus-candidate-heading > div { display: grid; gap: 3px; }
.focus-candidate-heading small { color: var(--muted); font-size: .68rem; font-weight: 850; text-transform: uppercase; }
.focus-candidate-heading strong { font-size: 1.15rem; }
.focus-candidate-heading span { color: #33443d; font-size: .8rem; font-weight: 750; }
.focus-candidate-heading > b { color: var(--muted); font-size: .72rem; white-space: nowrap; }
.focus-candidate-visual { overflow: hidden; border: 1px solid rgba(0,0,0,.18); border-radius: 9px; background: #f2f3f0; }
.focus-screen-swatch { min-height: 142px; padding: 8px 10px; display: flex; align-items: end; }
.focus-screen-swatch span { padding: 3px 6px; border-radius: 4px; color: #111; background: rgba(255,255,255,.78); font-size: .68rem; font-weight: 750; }
.focus-candidate-metrics { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: .8rem; }
.focus-candidate-metrics .stock-indicator { margin-left: auto; padding: 4px 7px; border-radius: 5px; color: #25302b; background: #ecefeb; font-size: .68rem; font-weight: 850; text-transform: uppercase; }
.focus-candidate-metrics .stock-indicator.in_stock { color: #0c5139; background: #dcefe6; }
.focus-candidate-metrics .stock-indicator.low_stock, .focus-candidate-metrics .stock-indicator.to_order { color: #794300; background: #fff0d2; }
.focus-candidate-metrics .stock-indicator.on_order { color: #294f73; background: #e3edf7; }
.candidate-order-action { padding: 11px; display: grid; gap: 8px; border: 1px solid #e4c384; border-radius: 9px; background: #fff8e8; }
.candidate-order-action > strong { color: #684000; font-size: .76rem; line-height: 1.35; }
.candidate-order-action > div { display: grid; grid-template-columns: minmax(160px, 1fr) 74px auto; gap: 7px; align-items: center; }
.candidate-order-action input { width: 100%; }
.candidate-order-action a { justify-self: end; color: var(--brand-dark); font-size: .72rem; font-weight: 800; }
.choose-thread-button { width: 100%; margin: 0; }
.selected-thread-button { width: 100%; padding: 11px 14px; border: 1px solid var(--brand); border-radius: 8px; color: var(--brand-dark); background: #dcefe6; font-weight: 850; }
.candidate-navigation { margin-top: 10px; display: flex; align-items: center; justify-content: center; gap: 14px; }
.candidate-navigation > button { width: 36px; height: 32px; border: 1px solid var(--line); border-radius: 7px; color: var(--brand-dark); background: white; font-size: 1.3rem; }
.candidate-navigation > button:disabled { cursor: default; opacity: .35; }
.candidate-dots { display: flex; gap: 8px; }
.candidate-dots button { width: 10px; height: 10px; padding: 0; border: 0; border-radius: 50%; background: #b7c0bb; }
.candidate-dots button.active { background: var(--brand); box-shadow: 0 0 0 3px #dcefe6; }
.thread-override.compact { margin-top: 12px; display: block; }
.thread-override.compact summary { cursor: pointer; color: var(--brand-dark); font-size: .8rem; font-weight: 800; }
.thread-override.compact .override-fields { margin-top: 10px; }
.reference-modes { display: flex; gap: 5px; }
.reference-modes button { padding: 6px 8px; border: 1px solid var(--line); border-radius: 6px; color: var(--muted); background: white; font-size: .7rem; font-weight: 800; }
.reference-modes button.active { border-color: var(--brand); color: var(--brand-dark); background: #e6f1ec; }
.colour-reference-frame { min-height: 430px; display: grid; place-items: center; overflow: hidden; border: 1px solid var(--line); border-radius: 10px; }
.colour-reference-frame canvas { max-width: 100%; max-height: 410px; }
.colour-reference-panel > p { margin: 10px 0 0; color: var(--muted); font-size: .72rem; line-height: 1.4; }
.colour-footer-navigation { margin-top: 14px; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.colour-footer-navigation strong { font-size: .8rem; }
.colour-step-button { padding: 9px 12px; border: 1px solid var(--line); border-radius: 8px; color: var(--brand-dark); background: white; font-size: .78rem; font-weight: 800; }
.colour-step-button:disabled { cursor: default; opacity: .35; }
.add-colour { margin-top: 20px; padding-top: 18px; border-top: 1px solid var(--line); }
.add-colour > label { display: block; margin-bottom: 8px; font-weight: 750; }
.add-colour > div, .garment-add-row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
input[type="text"] { width: 112px; padding: 9px 10px; border: 1px solid #aeb8b3; border-radius: 7px; text-transform: uppercase; }
input[type="color"] { width: 46px; height: 40px; padding: 2px; border: 1px solid #aeb8b3; border-radius: 7px; background: white; }

.garment-grid { margin-top: 20px; display: grid; grid-template-columns: repeat(auto-fit, minmax(245px, 1fr)); gap: 14px; }
.garment-card { overflow: hidden; border: 1px solid var(--line); border-radius: 12px; background: white; }
.garment-preview { min-height: 220px; display: grid; place-items: center; padding: 18px; }
.garment-preview canvas { max-height: 190px; }
.garment-details { padding: 13px; display: grid; gap: 9px; border-top: 1px solid var(--line); }
.garment-title { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-weight: 800; }
.contrast-warning { padding: 10px 12px; border-left: 4px solid #e29b22; border-radius: 7px; color: #503300; background: #fff0c9; font-size: .9rem; font-weight: 800; line-height: 1.35; }
.contrast-warning.severe { border-color: #b83928; color: #6c2017; background: #fde4df; }
.review-check { display: flex; gap: 8px; align-items: center; font-size: .87rem; }
.remove-button { padding: 5px 8px; border: 0; color: #7b2d21; background: #faece8; border-radius: 6px; }

.summary { display: grid; gap: 10px; color: var(--muted); }
.summary strong { color: var(--ink); }
.toast { position: fixed; right: 22px; bottom: 22px; max-width: 360px; padding: 13px 16px; color: white; background: #7b2d21; border-radius: 9px; box-shadow: var(--shadow); }
.toast.success { background: var(--brand-dark); }
.hidden { display: none !important; }

.admin-intro { align-items: center; }
.operator-field { display: grid; gap: 7px; padding: 16px; border: 1px solid var(--line); border-radius: 12px; background: var(--panel); font-weight: 800; }
.operator-field input, input[type="search"], input[type="number"], select { width: 100%; padding: 9px 10px; border: 1px solid #aeb8b3; border-radius: 7px; background: white; }
.metric-grid { margin: 18px 0; display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 10px; }
.metric-card { padding: 16px; display: grid; gap: 3px; border: 1px solid var(--line); border-radius: 12px; background: var(--panel); }
.metric-card strong { font-size: 1.55rem; }
.metric-card span { color: var(--muted); font-size: .78rem; }
.compact-heading { align-items: center; justify-content: space-between; }
.link-button { display: inline-block; text-decoration: none; }
.filter-row { margin-bottom: 16px; display: grid; grid-template-columns: minmax(220px, 1fr) 220px auto; gap: 12px; align-items: end; }
.filter-row label { display: grid; gap: 6px; color: var(--muted); font-size: .8rem; font-weight: 750; }
.table-wrap { max-height: 620px; overflow: auto; border: 1px solid var(--line); border-radius: 10px; }
.stock-table { width: 100%; border-collapse: collapse; }
.stock-table th { position: sticky; top: 0; z-index: 1; padding: 10px 12px; color: var(--muted); background: #f2f4f1; text-align: left; font-size: .75rem; text-transform: uppercase; }
.stock-table td { padding: 10px 12px; border-top: 1px solid var(--line); }
.stock-table tbody tr { cursor: pointer; }
.stock-table tbody tr:hover, .stock-table .selected-row { background: #edf7f2; }
.table-swatch, .selected-swatch { display: inline-block; vertical-align: middle; border: 1px solid rgba(0,0,0,.2); border-radius: 7px; }
.table-swatch { width: 28px; height: 28px; margin-right: 9px; }
.selected-swatch { flex: 0 0 42px; width: 42px; height: 42px; }
.table-swatch.stock-only,
.selected-swatch.stock-only {
  background-color: #f5f3ee;
  background-image: repeating-linear-gradient(135deg, #d8ddd9 0, #d8ddd9 6px, #f5f3ee 6px, #f5f3ee 12px);
}
.stock-status { display: inline-block; padding: 4px 7px; border-radius: 999px; color: #515b56; background: #ecefeb; font-size: .72rem; font-weight: 800; text-transform: capitalize; }
.stock-status.in_stock, .stock-status.received { color: #0c5139; background: #dcefe6; }
.stock-status.low_stock, .stock-status.to_order { color: #794300; background: #fff0d2; }
.stock-status.on_order, .stock-status.ordered, .stock-status.partly_received { color: #294f73; background: #e3edf7; }
.stock-status.cancelled { color: #6c3128; background: #f5e5e2; }
.admin-form-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.action-card { padding: 16px; display: grid; align-content: start; gap: 11px; border: 1px solid var(--line); border-radius: 11px; background: #fafbf8; }
.action-card h3 { margin: 0; font-size: 1rem; }
.action-card label { display: grid; gap: 5px; color: var(--muted); font-size: .8rem; font-weight: 750; }
.action-card .primary-button { align-self: end; }
.form-help, .empty-state { margin: 0; color: var(--muted); font-size: .82rem; }
.order-list { display: grid; gap: 12px; }
.order-card { padding: 15px; border: 1px solid var(--line); border-radius: 11px; }
.order-heading, .order-line, .order-actions { display: flex; align-items: center; gap: 9px; }
.order-heading { justify-content: space-between; margin-bottom: 10px; }
.order-line { padding: 9px 0; border-top: 1px solid var(--line); }
.order-line span { flex: 1; }
.order-line input { width: 90px; }
.order-actions { margin-top: 10px; justify-content: flex-end; }
.order-actions input { width: min(260px, 100%); text-transform: none; }
.danger-button { padding: 9px 12px; border: 0; border-radius: 8px; color: #7b2d21; background: #faece8; font-weight: 800; }
.order-context-grid { margin-bottom: 14px; display: grid; grid-template-columns: 1.4fr 1fr 1fr; gap: 12px; }
.order-context-grid label, .draft-line-form label { display: grid; gap: 5px; color: var(--muted); font-size: .8rem; font-weight: 750; }
.setup-guidance { margin-bottom: 14px; padding: 11px 13px; border-left: 4px solid var(--accent); border-radius: 7px; color: #684000; background: #fff4df; font-size: .84rem; font-weight: 750; }
.draft-line-form { margin-bottom: 14px; display: grid; grid-template-columns: 1fr 1fr 1fr 120px auto; gap: 10px; align-items: end; }
.draft-count { padding: 6px 9px; border-radius: 999px; color: var(--brand-dark); background: #dcefe6; font-size: .76rem; font-weight: 850; }
.draft-actions { margin-top: 14px; display: flex; justify-content: flex-end; gap: 9px; flex-wrap: wrap; }
.quantity-stepper { display: inline-grid; grid-template-columns: 32px 58px 32px; align-items: stretch; }
.quantity-stepper button, .quantity-stepper input { min-width: 0; border: 1px solid #aeb8b3; border-radius: 0; text-align: center; }
.quantity-stepper button { padding: 6px; color: var(--brand-dark); background: #eef4f0; font-weight: 850; }
.quantity-stepper button:first-child { border-radius: 7px 0 0 7px; }
.quantity-stepper button:last-child { border-radius: 0 7px 7px 0; }
.quantity-stepper input { width: 58px; padding: 6px 2px; border-inline: 0; }
.compact-button { padding: 6px 8px; font-size: .74rem; }

@media (max-width: 760px) {
  .topbar, .intro { align-items: flex-start; }
  .topbar { flex-direction: column; }
  .matcher-hero { min-height: 390px; padding: 28px 22px; align-items: flex-end; background-image: linear-gradient(0deg, rgba(4,42,32,.98) 0%, rgba(4,42,32,.88) 58%, rgba(4,42,32,.2) 100%), url("/assets/thread-colour-matcher-hero.png"); background-position: 68% center; }
  .intro, .preview-grid { grid-template-columns: 1fr; }
  .jpeg-controls { grid-template-columns: 1fr; }
  .colour-row { grid-template-columns: 34px 1fr; }
  .colour-meta { grid-column: 2; }
  .candidate-grid { grid-auto-columns: minmax(290px, 88%); }
  .active-colour-header { align-items: flex-start; flex-direction: column; }
  .colour-grouping { align-items: stretch; flex-direction: column; }
  .colour-grouping-actions { justify-content: flex-start; }
  .colour-review-workspace { grid-template-columns: 1fr; }
  .colour-reference-panel { position: static; }
  .colour-reference-frame { min-height: 310px; }
  .colour-reference-frame canvas { max-height: 290px; }
  .colour-footer-navigation { align-items: stretch; flex-direction: column; text-align: center; }
  .sticky-logo { top: 6px; padding: 8px; gap: 6px; }
  .sticky-logo-main { align-items: stretch; flex-direction: column; gap: 6px; }
  .sticky-logo-frame { height: 72px; }
  .sticky-logo canvas { max-height: 64px; }
  .sticky-logo.round-logo .sticky-logo-frame { height: 140px; }
  .sticky-logo.round-logo canvas { max-height: 130px; }
  #colour-panel { scroll-margin-top: 124px; }
  .canvas-frame { min-height: 230px; }
  .metric-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .filter-row, .admin-form-grid, .order-context-grid, .draft-line-form { grid-template-columns: 1fr; }
  .candidate-order-action > div { grid-template-columns: 1fr 72px; }
  .candidate-order-action > div .secondary-button { grid-column: 1 / -1; }
  .table-wrap { overflow-x: auto; }
  .stock-table { min-width: 660px; }
  .order-line { align-items: flex-start; flex-wrap: wrap; }
}
