@import url('https://fonts.googleapis.com/css2?family=DM+Sans:wght@400;500;600;700&family=Manrope:wght@600;700;800&display=swap');

:root {
    --green: #00a65a;
    --green-dark: #007a43;
    --ink: #17231f;
    --muted: #6d7b75;
    --line: #dce6df;
    --surface: #fff;
    --canvas: #f3f7f5;
}

* { box-sizing: border-box; }
body { margin: 0; color: var(--ink); background: var(--canvas); font-family: 'DM Sans', system-ui, sans-serif; -webkit-font-smoothing: antialiased; }
a { color: inherit; text-decoration: none; -webkit-tap-highlight-color: transparent; }
button, input { color: inherit; font: inherit; }
svg { fill: none; stroke: currentColor; stroke-linecap: round; stroke-linejoin: round; stroke-width: 1.8; }
[hidden] { display: none !important; }
.visually-hidden { position: fixed; width: 1px; height: 1px; opacity: 0; pointer-events: none; }

.colour-library-shell { width: min(1040px, calc(100% - 48px)); min-height: 100vh; margin: 0 auto; padding-bottom: 72px; }
.colour-detail-shell { width: min(480px, calc(100% - 36px)); min-height: 100vh; margin: 0 auto; padding-bottom: 72px; }
.colour-page-header { display: flex; min-height: 92px; align-items: center; justify-content: space-between; gap: 16px; }
.colour-page-title { display: inline-flex; align-items: center; gap: 9px; }
.colour-page-title svg { width: 21px; height: 21px; color: var(--green-dark); }
.colour-page-title strong { font: 800 20px Manrope, sans-serif; letter-spacing: -.035em; }
.colour-profile { display: grid; width: 42px; height: 42px; place-items: center; border-radius: 50%; background: #dcf7ea; }
.colour-profile i { width: 7px; height: 7px; border-radius: 50%; background: var(--green); }

.photo-colour-matcher { overflow: hidden; margin: 28px 0 10px; border: 1px solid var(--line); border-radius: 22px; background: var(--surface); box-shadow: 0 14px 38px rgba(23, 51, 38, .07); }
.photo-colour-matcher > summary { display: grid; min-height: 92px; padding: 18px 21px; grid-template-columns: 48px minmax(0, 1fr) 22px; align-items: center; gap: 14px; cursor: pointer; list-style: none; }
.photo-colour-matcher > summary::-webkit-details-marker { display: none; }
.photo-matcher-icon { display: grid; width: 48px; height: 48px; place-items: center; color: #fff; border-radius: 15px; background: var(--green); }
.photo-matcher-icon svg { width: 22px; height: 22px; }
.photo-colour-matcher summary strong, .photo-colour-matcher summary small { display: block; }
.photo-colour-matcher summary strong { font: 800 16px Manrope, sans-serif; }
.photo-colour-matcher summary small { margin-top: 4px; color: var(--muted); font-size: 11px; }
.photo-matcher-chevron { width: 20px; height: 20px; color: var(--green-dark); transition: transform .18s ease; }
.photo-colour-matcher[open] .photo-matcher-chevron { transform: rotate(90deg); }
.photo-matcher-content { padding: 0 21px 23px; border-top: 1px solid #edf1ee; }
.photo-matcher-actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; padding-top: 20px; }
.photo-matcher-actions button { display: inline-flex; min-height: 46px; padding: 0 16px; align-items: center; justify-content: center; gap: 8px; color: var(--green-dark); border: 1px solid #cfe0d6; border-radius: 12px; background: #f8fbf9; cursor: pointer; font-size: 11px; font-weight: 800; }
.photo-matcher-actions button:first-child { color: #fff; border-color: var(--green); background: var(--green); }
.photo-matcher-actions svg { width: 18px; height: 18px; }
.photo-upload-hint { display: block; margin-top: 8px; color: #87948e; font-size: 9px; text-align: right; }
.photo-match-workspace { display: grid; min-height: 300px; margin-top: 16px; place-items: center; overflow: hidden; border-radius: 17px; background: #26312c; }
.photo-match-workspace.dragging { box-shadow: inset 0 0 0 4px #75c69c; }
.photo-match-placeholder { display: flex; padding: 45px 20px; flex-direction: column; align-items: center; color: #eff5f1; text-align: center; }
.photo-match-placeholder svg { width: 35px; height: 35px; color: #c5d8ce; }
.photo-match-placeholder strong { margin-top: 15px; font: 700 14px Manrope, sans-serif; }
.photo-match-placeholder span { margin-top: 5px; color: #9dafA5; font-size: 10px; }
.photo-canvas-wrap { position: relative; max-width: 100%; line-height: 0; }
.photo-canvas-wrap canvas { display: block; max-width: 100%; max-height: 520px; cursor: crosshair; touch-action: none; }
.photo-canvas-wrap canvas:focus-visible { outline: 3px solid #efbd39; outline-offset: -4px; }
.photo-sample-target { position: absolute; z-index: 2; width: 38px; height: 38px; border: 3px solid #fff; border-radius: 50%; box-shadow: 0 2px 10px rgba(0, 0, 0, .45); pointer-events: none; transform: translate(-50%, -50%); }
.photo-sample-help { position: absolute; top: 12px; left: 50%; padding: 8px 11px; color: #fff; border-radius: 99px; background: rgba(18, 39, 30, .8); font-size: 9px; font-weight: 700; line-height: 1; pointer-events: none; transform: translateX(-50%); white-space: nowrap; }
.manual-colour-match { margin-top: 17px; }
.manual-colour-match > label { display: block; margin-bottom: 7px; color: var(--muted); font-size: 10px; font-weight: 700; }
.manual-colour-match > div { display: grid; grid-template-columns: 45px minmax(0, 1fr) auto; gap: 7px; }
.manual-colour-match input, .manual-colour-match button { height: 43px; border: 1px solid var(--line); border-radius: 10px; }
.manual-colour-match input[type='color'] { width: 45px; padding: 3px; background: #fff; cursor: pointer; }
.manual-colour-match input[type='text'] { width: 100%; padding: 0 12px; outline: none; }
.manual-colour-match button { padding: 0 17px; color: #fff; border-color: var(--green-dark); background: var(--green-dark); cursor: pointer; font-size: 10px; font-weight: 800; }
.photo-match-results { margin-top: 20px; padding-top: 20px; border-top: 1px solid var(--line); }
.sampled-colour-summary { display: flex; align-items: center; gap: 11px; }
.sampled-colour-summary > span { width: 48px; height: 48px; border: 1px solid rgba(20, 35, 28, .1); border-radius: 13px; background: var(--sampled-colour); }
.sampled-colour-summary small, .sampled-colour-summary strong { display: block; }
.sampled-colour-summary small { color: var(--muted); font-size: 8px; font-weight: 700; text-transform: uppercase; }
.sampled-colour-summary strong { margin-top: 3px; font: 800 14px Manrope, sans-serif; }
.photo-match-heading { margin: 17px 0 10px; }
.photo-match-heading strong, .photo-match-heading small { display: block; }
.photo-match-heading strong { font: 800 14px Manrope, sans-serif; }
.photo-match-heading small { margin-top: 3px; color: var(--muted); font-size: 9px; }
.photo-match-list { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.photo-match-card { display: grid; grid-template-columns: 38px minmax(0, 1fr); align-items: center; gap: 8px; padding: 8px; border: 1px solid var(--line); border-radius: 11px; background: #fff; }
.photo-match-card > span { width: 38px; height: 38px; border-radius: 9px; background: var(--match-colour); }
.photo-match-card strong, .photo-match-card small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.photo-match-card strong { font-size: 9px; }
.photo-match-card small { margin-top: 2px; color: var(--muted); font-size: 8px; }
.photo-match-status { min-height: 15px; margin: 10px 0 0; color: #a44638; font-size: 9px; }

.colour-search { display: grid; grid-template-columns: minmax(0, 1fr) minmax(280px, 390px); align-items: end; gap: 22px; padding: 38px 0 20px; }
.colour-search h1 { margin: 0; font: 800 clamp(34px, 5vw, 52px)/1 Manrope, sans-serif; letter-spacing: -.05em; }
.colour-search > label { display: none; }
.colour-search-field { position: relative; }
.colour-search-field svg { position: absolute; top: 50%; left: 17px; width: 18px; height: 18px; color: #71817a; pointer-events: none; transform: translateY(-50%); }
.colour-search-field input { width: 100%; height: 52px; padding: 0 17px 0 46px; border: 1px solid var(--line); border-radius: 13px; outline: 0; background: #fbfdfc; box-shadow: 0 2px 4px rgba(24, 56, 42, .05); }
.colour-search-field input:focus { border-color: #7db69a; box-shadow: 0 0 0 3px rgba(0, 166, 90, .1); }
.colour-filters { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 9px; max-width: 620px; margin: 8px 0 34px; }
.colour-filters button { min-height: 42px; padding: 0 18px; color: #667770; border: 0; border-radius: 99px; background: #eaf0ed; cursor: pointer; font-size: 13px; font-weight: 700; }
.colour-filters button[aria-pressed='true'] { color: #fff; background: var(--green); box-shadow: 0 8px 18px rgba(0, 166, 90, .18); }
.colour-browse-all { display: inline-flex; margin: -19px 0 31px; padding: 4px 0; align-items: center; gap: 7px; color: var(--green-dark); border: 0; background: transparent; cursor: pointer; font-size: 11px; font-weight: 800; }
.colour-browse-all[aria-pressed='true'] { text-decoration: underline; text-underline-offset: 4px; }
.colour-filters button:focus-visible, .colour-browse-all:focus-visible, .colour-tile:focus-visible, .colour-page-title:focus-visible, .visualise-colour-button:focus-visible, .browse-colours-button:focus-visible { outline: 3px solid #efbd39; outline-offset: 3px; }
.colour-groups { display: grid; gap: 35px; }
.colour-group h2 { margin: 0 0 16px; font: 800 17px Manrope, sans-serif; }
.colour-grid { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 15px; }
.colour-tile { display: block; min-width: 0; }
.colour-tile-swatch { display: block; width: 100%; aspect-ratio: 1.12; border: 1px solid rgba(19, 36, 29, .06); border-radius: 16px; background: var(--paint-colour); box-shadow: inset 0 0 0 2px rgba(255, 255, 255, .12); transition: transform .16s ease, box-shadow .16s ease; }
.colour-tile:hover .colour-tile-swatch { box-shadow: inset 0 0 0 2px rgba(255, 255, 255, .18), 0 10px 24px rgba(23, 51, 38, .12); transform: translateY(-2px); }
.colour-tile-copy strong, .colour-tile-copy small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.colour-tile-copy strong { margin-top: 8px; font-size: 11px; }
.colour-tile-copy small { margin-top: 2px; color: var(--muted); font-size: 9px; }
.colour-library-empty { padding: 55px 20px; text-align: center; }
.colour-library-empty h2 { margin: 0; font: 800 21px Manrope, sans-serif; }
.colour-library-empty p { margin: 7px 0 0; color: var(--muted); font-size: 12px; }

.shade-detail { padding: 20px 0 78px; }
.shade-swatch { width: 100%; aspect-ratio: 1.2; border-radius: 28px; background: var(--paint-colour); box-shadow: inset 0 0 0 1px rgba(17, 34, 27, .05); }
.shade-detail h1 { margin: 30px 0 8px; font: 800 29px Manrope, sans-serif; letter-spacing: -.045em; }
.shade-code { color: var(--green); font-size: 14px; }
.shade-detail > p { max-width: 390px; min-height: 56px; margin: 38px 0 24px; color: var(--muted); font-size: 16px; line-height: 1.35; }
.shade-tags { display: flex; flex-wrap: wrap; gap: 11px; }
.shade-tags span { padding: 11px 16px; color: var(--green-dark); border-radius: 99px; background: #dcf7ea; font-size: 13px; font-weight: 700; }
.shade-tags span:nth-child(2) { color: #8a6414; background: #fff1ca; }
.visualise-colour-button { display: flex; min-height: 54px; margin-top: 18px; align-items: center; justify-content: center; color: #fff; border-radius: 14px; background: var(--green); box-shadow: 0 10px 23px rgba(0, 166, 90, .22); font-size: 14px; font-weight: 800; }
.visualise-colour-button:hover { background: var(--green-dark); }
.browse-colours-button { display: flex; min-height: 48px; margin-top: 10px; align-items: center; justify-content: center; color: var(--green-dark); border: 1px solid var(--line); border-radius: 14px; background: #fff; font-size: 13px; font-weight: 800; }
.browse-colours-button:hover { border-color: #92baa6; background: #f4faf7; }

@media (max-width: 820px) {
    body { background: #fff; }
    .colour-library-shell, .colour-detail-shell { width: min(100%, 480px); padding: 0 23px calc(100px + env(safe-area-inset-bottom)); }
    .colour-page-header { min-height: 86px; }
    .colour-page-title svg { width: 18px; height: 18px; }
    .colour-page-title strong { font-size: 18px; }
    .colour-profile { width: 40px; height: 40px; }
    .photo-colour-matcher { margin: 7px 0 12px; border-radius: 17px; }
    .photo-colour-matcher > summary { min-height: 78px; padding: 14px; grid-template-columns: 42px minmax(0, 1fr) 18px; gap: 11px; }
    .photo-matcher-icon { width: 42px; height: 42px; border-radius: 13px; }
    .photo-colour-matcher summary strong { font-size: 13px; }
    .photo-colour-matcher summary small { font-size: 9px; line-height: 1.4; }
    .photo-matcher-content { padding: 0 13px 16px; }
    .photo-match-workspace { min-height: 250px; }
    .photo-canvas-wrap canvas { max-height: 390px; }
    .photo-match-list { grid-template-columns: 1fr; }
    .colour-search { display: block; padding: 20px 0 13px; }
    .colour-search h1 { position: fixed; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
    .colour-search > label { display: block; margin: 0 0 9px 15px; color: #50635a; font-size: 9px; }
    .colour-search-field svg { display: none; }
    .colour-search-field input { height: 54px; padding: 0 27px; border-radius: 13px; font-size: 16px; }
    .colour-filters { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; margin: 0 0 30px; }
    .colour-filters button { min-height: 41px; font-size: 15px; text-align: left; }
    .colour-browse-all { margin: -18px 13px 27px; }
    .colour-groups { gap: 29px; }
    .colour-group h2 { margin: 0 13px 17px; font-size: 15px; }
    .colour-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 13px; }
    .colour-tile-swatch { aspect-ratio: 1.18; border-radius: 13px; }
    .colour-tile-copy { position: fixed; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
    .shade-detail { padding-top: 12px; }
    .shade-swatch { aspect-ratio: 1.21; border-radius: 24px; }
    .shade-detail h1 { margin: 29px 13px 7px; font-size: 23px; }
    .shade-code { margin-left: 13px; font-size: 13px; }
    .shade-detail > p { margin: 39px 13px 24px; font-size: 16px; }
    .shade-tags { margin: 0 0 0 0; }
    .shade-tags span { padding: 11px 15px; font-size: 14px; }
}

@media (max-width: 380px) {
    .colour-library-shell, .colour-detail-shell { padding-inline: 17px; }
    .colour-grid { gap: 10px; }
}

@media (prefers-reduced-motion: reduce) {
    * { scroll-behavior: auto !important; transition: none !important; }
}
