:root {
  color-scheme: light;
  --ink: oklch(18% 0.006 240);
  --muted: oklch(43% 0.006 240);
  --paper: oklch(98.5% 0.003 95);
  --surface: oklch(94% 0.004 95);
  --surface-bright: oklch(99% 0.003 95);
  --line: oklch(83% 0.006 90);
  --red: oklch(57% 0.235 25);
  --red-soft: oklch(95% 0.028 24);
  --similar: oklch(42% 0.09 190);
  --similar-soft: oklch(96% 0.018 190);
  --focus: oklch(62% 0.16 42);
  --shadow: 0 16px 34px oklch(20% 0.006 240 / 9%);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  min-width: 320px;
  margin: 0;
  background: var(--paper);
  color: var(--ink);
}

button, input, select { font: inherit; }

button, a { -webkit-tap-highlight-color: transparent; }

button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 3px;
}

.staff-header {
  position: sticky;
  z-index: 10;
  top: 0;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  min-height: 68px;
  padding: 12px clamp(16px, 4vw, 48px);
  border-bottom: 1px solid var(--line);
  background: oklch(98.5% 0.003 95 / 94%);
  backdrop-filter: blur(14px);
}

.brand { display: inline-flex; width: 82px; height: 38px; }
.brand img { width: 100%; height: 100%; object-fit: contain; }

.header-title { display: grid; gap: 2px; min-width: 0; }
.header-title strong { overflow: hidden; font-size: 0.92rem; line-height: 1.1; text-overflow: ellipsis; white-space: nowrap; }
.header-title span { color: var(--muted); font-size: 0.72rem; font-weight: 750; text-transform: uppercase; letter-spacing: 0.06em; }
.header-actions { display: flex; align-items: center; justify-content: end; gap: 8px; }

.header-button, .text-button, .details-button, .secondary-button {
  border: 1px solid var(--line);
  border-radius: 999px;
  cursor: pointer;
  font-weight: 800;
}

.header-button { min-height: 36px; padding: 0 13px; background: var(--surface-bright); color: var(--ink); }
.header-button:hover, .text-button:hover { border-color: var(--ink); }

.language-switch {
  display: grid;
  grid-template-columns: 1fr 1fr;
  width: 72px;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface-bright);
}

.lang-button { min-height: 28px; border: 0; border-radius: 999px; background: transparent; color: var(--muted); cursor: pointer; font-size: 0.76rem; font-weight: 850; }
.lang-button.active { background: var(--red); color: oklch(98% 0.01 78); }

.staff-app { width: min(1180px, calc(100% - 32px)); margin: 0 auto; padding: clamp(28px, 5vw, 56px) 0 72px; }

.page-intro { display: flex; align-items: end; justify-content: space-between; gap: 24px; margin-bottom: 28px; }
.page-intro > div:first-child { flex: 1 1 auto; min-width: 0; }
.eyebrow, .section-kicker { margin: 0 0 9px; color: var(--red); font-size: 0.73rem; font-weight: 950; letter-spacing: 0.1em; text-transform: uppercase; }
h1, h2, h3, p { text-wrap: pretty; }
h1 { max-width: 14ch; margin: 0; font-size: clamp(2.15rem, 5vw, 4.1rem); line-height: 0.98; letter-spacing: -0.055em; }
.intro-copy { max-width: none; margin: 14px 0 0; color: var(--muted); font-size: 1rem; font-weight: 600; line-height: 1.45; }

.search-bar { display: grid; gap: 8px; margin-bottom: 18px; }
.search-heading { display: flex; align-items: center; justify-content: space-between; gap: 14px; }
.search-label, .field-label, .sort-control span { color: var(--muted); font-size: 0.78rem; font-weight: 850; }
.search-control { position: relative; display: flex; align-items: center; }
.search-icon { position: absolute; left: 16px; color: var(--red); font-size: 1.45rem; line-height: 1; transform: translateY(-1px); }
.search-control input { width: 100%; min-height: 54px; border: 1px solid var(--line); border-radius: 8px; padding: 0 48px 0 45px; background: var(--surface-bright); color: var(--ink); font-size: 1rem; box-shadow: var(--shadow); }
.search-control input::-webkit-search-cancel-button { -webkit-appearance: none; appearance: none; display: none; }
.search-control input::placeholder { color: oklch(55% 0.006 240); }
.clear-search { position: absolute; right: 10px; display: grid; width: 32px; height: 32px; place-items: center; border: 0; border-radius: 50%; background: transparent; color: var(--muted); cursor: pointer; font-size: 1.35rem; line-height: 1; }
.clear-search:hover { background: var(--surface); color: var(--ink); }
.search-mode-note { margin: 1px 0 0 2px; color: var(--muted); font-size: 0.74rem; font-weight: 650; }
.search-bar.similar-mode .search-icon { color: var(--similar); }
.search-bar.similar-mode .search-control input { border-color: color-mix(in oklch, var(--similar) 65%, var(--line)); background: var(--similar-soft); box-shadow: 0 0 0 3px color-mix(in oklch, var(--similar) 14%, transparent), var(--shadow); }
.search-bar.similar-mode .search-mode-note { margin-top: 0; padding: 7px 10px; border: 1px solid color-mix(in oklch, var(--similar) 28%, var(--line)); border-radius: 7px; background: color-mix(in oklch, var(--similar) 6%, var(--paper)); color: var(--ink); font-weight: 750; }
.search-bar.clarification-mode .search-mode-note { margin-top: 0; padding: 9px 11px; border: 1px solid var(--line); border-radius: 7px; background: var(--surface); color: var(--ink); font-weight: 750; }

.filter-shell { padding: 22px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); }
.filter-heading, .results-toolbar, .wine-card-top, .wine-card-footer, .glossary-heading { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.filter-heading { align-items: center; margin-bottom: 18px; }
.filter-heading-actions { display: flex; align-items: center; gap: 10px; }
.filter-result-count { display: inline-flex; align-items: center; min-height: 34px; border: 1px solid var(--line); border-radius: 999px; padding: 0 12px; background: var(--surface-bright); color: var(--muted); font-size: 0.77rem; font-weight: 750; }
.filter-result-count strong { margin-right: 4px; color: var(--ink); font-size: 0.88rem; }
.filter-heading h2, .results-toolbar h2 { margin: 0; font-size: 1.26rem; line-height: 1.1; letter-spacing: -0.02em; }
.text-button { min-height: 34px; padding: 0 12px; background: transparent; color: var(--ink); font-size: 0.77rem; }
.filter-grid { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 20px 22px; }
.filter-group { min-width: 0; margin: 0; padding: 0; border: 0; grid-column: span 6; }
.filter-group-wide { grid-column: span 12; }
.filter-group legend, .field-label { display: block; margin-bottom: 9px; color: var(--ink); font-size: 0.8rem; font-weight: 900; }
.chip-row { display: flex; flex-wrap: wrap; gap: 8px; }
.filter-chip { min-height: 36px; border: 1px solid var(--line); border-radius: 999px; padding: 0 13px; background: var(--surface-bright); color: var(--ink); cursor: pointer; font-size: 0.82rem; font-weight: 750; }
.filter-chip:hover { border-color: var(--ink); }
.filter-chip.active { border-color: var(--ink); background: var(--ink); color: var(--paper); }
.select-group select, .sort-control select { min-height: 42px; border: 1px solid var(--line); border-radius: 6px; padding: 0 34px 0 12px; background: var(--surface-bright); color: var(--ink); cursor: pointer; font-size: 0.84rem; font-weight: 700; }
.select-group select:disabled { cursor: not-allowed; opacity: 0.58; }
.select-group select { width: 100%; }

.results-section { padding-top: 44px; }
.results-toolbar { align-items: end; }
.results-toolbar .section-kicker { margin-bottom: 8px; }
.sort-control { display: grid; align-items: center; grid-template-columns: auto minmax(156px, auto); gap: 10px; }
.active-filters { display: flex; flex-wrap: wrap; gap: 8px; min-height: 28px; margin: 18px 0; }
.active-filter { display: inline-flex; align-items: center; gap: 8px; min-height: 28px; border: 1px solid oklch(76% 0.018 25); border-radius: 999px; padding: 0 9px 0 11px; background: var(--red-soft); color: var(--red); cursor: pointer; font-size: 0.76rem; font-weight: 800; }
.active-filter.inferred { border-color: oklch(78% 0.018 78); background: oklch(96% 0.012 78); color: var(--ink); cursor: default; }
.active-filter b { font-size: 1.05rem; font-weight: 500; line-height: 0; }

.results-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.result-notice { display: grid; grid-column: 1 / -1; grid-template-columns: 36px minmax(0, 1fr); align-items: center; gap: 12px; min-height: 68px; padding: 13px 16px; border: 1px solid oklch(76% 0.12 25); border-radius: 10px; background: var(--red-soft); }
.result-notice-icon { display: block; width: 34px; height: 34px; overflow: visible; fill: var(--red); }
.result-notice-icon circle { stroke: var(--red); stroke-width: 1.5; }
.result-notice-icon path { fill: none; stroke: var(--paper); stroke-linecap: round; stroke-linejoin: round; stroke-width: 2.5; }
.result-notice-copy { display: grid; gap: 3px; }
.result-notice strong { color: var(--ink); font-size: 1rem; font-weight: 900; line-height: 1.25; }
.result-notice span { color: var(--ink); font-size: 0.8rem; line-height: 1.35; }
.selection-notice { display: block; border-color: var(--line); background: var(--surface); }
.wine-card { display: grid; grid-template-columns: 138px minmax(0, 1fr); min-width: 0; overflow: hidden; border: 1px solid var(--line); border-radius: 8px; background: var(--surface-bright); transition: border-color 180ms ease, transform 180ms ease, box-shadow 180ms ease; }
.alternative-card { border-color: oklch(78% 0.018 78); }
.wine-card:hover { border-color: oklch(57% 0.025 240); box-shadow: var(--shadow); transform: translateY(-2px); }
.wine-image { min-height: 230px; background: oklch(93% 0.012 78); }
.image-button { display: block; width: 100%; padding: 0; border: 0; border-radius: 0; color: inherit; cursor: pointer; }
.image-button:hover { background: oklch(90% 0.014 78); }
.image-button:focus-visible { outline: 3px solid var(--red); outline-offset: -3px; }
.wine-image img { display: block; width: 100%; height: 100%; min-height: 230px; object-fit: contain; padding: 12px; mix-blend-mode: multiply; }
.wine-card-body { display: flex; min-width: 0; flex-direction: column; padding: 15px 16px 13px; }
.wine-card-top { align-items: start; margin-bottom: 13px; }
.wine-type { color: var(--red); font-size: 0.72rem; font-weight: 950; letter-spacing: 0.06em; text-transform: uppercase; }
.wine-card-top strong { white-space: nowrap; font-size: 1.05rem; }
.wine-card h3 { display: -webkit-box; overflow: hidden; min-height: 3.15em; margin: 0; color: var(--ink); font-size: 1.02rem; line-height: 1.05; letter-spacing: -0.02em; -webkit-box-orient: vertical; -webkit-line-clamp: 3; }
.wine-origin { display: -webkit-box; overflow: hidden; min-height: 2.8em; margin: 9px 0 12px; color: var(--muted); font-size: 0.78rem; font-weight: 650; line-height: 1.35; -webkit-box-orient: vertical; -webkit-line-clamp: 2; }
.wine-facts, .wine-styles, .profile-meta, .profile-chips { display: flex; flex-wrap: wrap; gap: 5px; }
.wine-facts span, .wine-styles span, .profile-meta span, .profile-chips span { display: inline-flex; align-items: center; min-height: 24px; border-radius: 4px; padding: 0 7px; background: var(--surface); color: var(--muted); font-size: 0.7rem; font-weight: 750; }
.wine-styles { margin-top: 8px; }
.wine-styles span { background: var(--red-soft); color: var(--red); }
.vivino-badge { display: inline-flex; align-items: center; align-self: flex-start; gap: 6px; min-height: 24px; margin-top: 8px; border-radius: 999px; padding: 0 8px; background: oklch(97% 0.012 78); color: var(--ink); font-size: 0.68rem; font-weight: 800; }
.vivino-stars { display: inline-flex; gap: 1px; color: var(--red); font-size: 0.9rem; line-height: 1; }
.vivino-star.empty { color: oklch(78% 0.01 78); }
.vivino-star.partial { background: linear-gradient(90deg, var(--red) 50%, oklch(78% 0.01 78) 50%); background-clip: text; -webkit-background-clip: text; color: transparent; }
.match-reasons { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 8px; }
.match-reasons span { display: inline-flex; min-height: 22px; align-items: center; border-radius: 4px; padding: 0 6px; background: oklch(95% 0.012 78); color: var(--muted); font-size: 0.66rem; font-weight: 750; }
.wine-card-footer { margin-top: auto; padding-top: 16px; }
.wine-sku { color: var(--muted); font-size: 0.68rem; font-weight: 800; }
.details-button { min-height: 32px; padding: 0 11px; background: var(--ink); color: var(--paper); font-size: 0.72rem; }
.details-button:hover { background: var(--red); }

.empty-results { display: grid; grid-column: 1 / -1; gap: 8px; padding: 40px 20px; border: 1px dashed var(--line); border-radius: 8px; text-align: center; }
.empty-results strong { font-size: 1.1rem; }
.empty-results span { color: var(--muted); font-size: 0.86rem; }
.clarification-results { border-style: solid; background: var(--surface); }
.clarification-results span { max-width: 58ch; justify-self: center; line-height: 1.45; }
.secondary-button { justify-self: center; min-height: 38px; margin-top: 10px; padding: 0 14px; background: var(--red); color: var(--paper); }
.load-more { display: grid; grid-column: 1 / -1; justify-items: center; gap: 7px; padding: 10px 0 2px; }
.load-more span { color: var(--muted); font-size: 0.76rem; font-weight: 700; }

.site-footer { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 20px clamp(16px, 4vw, 48px) 30px; border-top: 1px solid var(--line); color: var(--muted); font-size: 0.74rem; font-weight: 650; }
.footer-links { display: flex; align-items: center; gap: 14px; }
.footer-link { min-height: 36px; border: 0; padding: 0; background: transparent; color: var(--ink); cursor: pointer; font-size: inherit; font-weight: 850; }
.footer-link:hover, .site-footer a:hover { color: var(--red); }
.site-footer a { color: var(--ink); font-weight: 850; text-decoration: none; }

.profile-dialog, .glossary-dialog, .grape-dialog { width: min(720px, calc(100% - 28px)); max-height: calc(100% - 28px); overflow: auto; padding: 0; border: 0; border-radius: 10px; background: var(--surface-bright); color: var(--ink); box-shadow: 0 24px 80px oklch(20% 0.006 240 / 24%); }
.profile-dialog::backdrop, .glossary-dialog::backdrop, .grape-dialog::backdrop { background: oklch(18% 0.006 240 / 42%); }
.profile-shell { position: relative; display: grid; grid-template-columns: 190px minmax(0, 1fr); min-height: 360px; }
.profile-media { background: oklch(93% 0.012 78); }
.profile-media img { display: block; width: 100%; height: 100%; min-height: 360px; object-fit: contain; padding: 18px; mix-blend-mode: multiply; }
.profile-content { overflow: auto; padding: 30px; }
.profile-content h2 { max-width: 18ch; margin: 0; font-size: 1.7rem; line-height: 1.04; letter-spacing: -0.04em; }
.profile-price { margin: 14px 0; font-size: 1.45rem; font-weight: 900; }
.profile-meta { margin-bottom: 26px; }
.profile-section { padding-top: 18px; border-top: 1px solid var(--line); }
.profile-section + .profile-section { margin-top: 18px; }
.profile-section h3 { margin: 0 0 10px; font-size: 0.82rem; letter-spacing: 0.04em; text-transform: uppercase; }
.profile-copy { margin: 0; color: var(--muted); font-size: 0.86rem; line-height: 1.55; }
.profile-facts { display: grid; grid-template-columns: minmax(92px, 0.4fr) minmax(0, 1fr); gap: 8px 14px; margin: 0; font-size: 0.82rem; }
.profile-facts dt { color: var(--muted); font-weight: 750; }
.profile-facts dd { margin: 0; font-weight: 780; overflow-wrap: anywhere; }
.profile-close { position: absolute; z-index: 1; top: 13px; right: 13px; display: grid; width: 34px; height: 34px; place-items: center; border: 1px solid var(--line); border-radius: 50%; background: var(--surface-bright); color: var(--ink); cursor: pointer; font-size: 1.35rem; line-height: 1; }
.profile-close:hover { border-color: var(--ink); }

.glossary-dialog { width: min(600px, calc(100% - 28px)); }
.glossary-shell { position: relative; padding: 28px; }
.glossary-heading { align-items: start; padding-right: 34px; }
.glossary-heading h2 { margin: 0; font-size: 1.8rem; letter-spacing: -0.04em; }
.glossary-list { display: grid; gap: 0; margin-top: 22px; border-top: 1px solid var(--line); }
.glossary-section + .glossary-section { margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--line); }
.glossary-section h3 { margin: 0 0 8px; color: var(--red); font-size: 0.68rem; font-weight: 950; letter-spacing: 0.09em; text-transform: uppercase; }
.glossary-section-list { border-top: 1px solid var(--line); }
.glossary-row { display: grid; grid-template-columns: 150px minmax(0, 1fr); gap: 20px; padding: 14px 0; border-bottom: 1px solid var(--line); }
.glossary-row strong { font-size: 0.85rem; }
.glossary-row span { color: var(--muted); font-size: 0.84rem; line-height: 1.45; }
.grape-dialog { width: min(820px, calc(100% - 28px)); }
.grape-shell { position: relative; padding: 22px 24px 24px; }
.grape-intro { margin: 6px 0 0; color: var(--muted); font-size: 0.78rem; line-height: 1.35; }
.grape-glossary { display: grid; gap: 0; margin-top: 14px; border-top: 1px solid var(--line); }
.grape-glossary-row { display: grid; grid-template-columns: 1.05fr 0.9fr 2.2fr 1.25fr; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--line); color: var(--muted); font-size: 0.72rem; line-height: 1.25; }
.grape-glossary-row > strong { color: var(--ink); font-size: 0.82rem; }
.grape-glossary-row > div { min-width: 0; }
.glossary-label { display: block; margin-bottom: 3px; color: var(--red); font-size: 0.63rem; font-weight: 950; letter-spacing: 0.08em; text-transform: uppercase; }

@media (max-width: 860px) {
  .results-grid { grid-template-columns: 1fr; }
}

@media (max-width: 640px) {
  .staff-header { grid-template-columns: auto minmax(0, 1fr) auto; gap: 8px; min-height: 60px; padding-top: 8px; padding-bottom: 8px; }
  .header-actions { grid-column: auto; justify-content: end; order: initial; }
  .header-title { align-self: center; }
  .staff-app { width: min(100% - 24px, 560px); padding-top: 20px; }
  .page-intro { display: grid; gap: 14px; margin-bottom: 18px; }
  h1 { font-size: 2.65rem; }
  .search-heading { align-items: start; display: grid; gap: 8px; }
  .filter-shell { padding: 15px 13px; }
  .filter-heading { align-items: start; display: grid; gap: 10px; }
  .filter-heading-actions { justify-content: space-between; width: 100%; }
  .filter-grid { display: grid; grid-template-columns: 1fr; gap: 14px; }
  .filter-group, .filter-group-wide { grid-column: auto; }
  .header-button, .lang-button, .clear-search, .text-button, .filter-chip, .details-button, .secondary-button, .profile-close { min-height: 44px; }
  .lang-button, .clear-search, .profile-close { min-width: 44px; }
  .brand { height: 44px; }
  .active-filter { min-height: 44px; }
  .language-switch { width: 96px; }
  .select-group select, .sort-control select { min-height: 44px; }
  .site-footer a { display: inline-flex; min-height: 44px; align-items: center; }
  .results-section { padding-top: 26px; }
  .result-notice { grid-template-columns: 40px minmax(0, 1fr); gap: 10px; min-height: 72px; padding: 12px; }
  .result-notice-icon { width: 38px; height: 38px; }
  .result-notice strong { font-size: 0.98rem; }
  .result-notice span { font-size: 0.78rem; }
  .results-toolbar { align-items: start; display: grid; gap: 14px; }
  .sort-control { grid-template-columns: auto minmax(0, 1fr); width: 100%; }
  .sort-control select { width: 100%; }
  .wine-card { grid-template-columns: 102px minmax(0, 1fr); }
  .wine-image, .wine-image img { min-height: 180px; }
  .wine-image img { padding: 8px; }
  .wine-card-body { padding: 11px 12px 10px; }
  .wine-card-top { margin-bottom: 10px; }
  .wine-card-top strong { font-size: 0.95rem; }
  .wine-card h3 { font-size: 0.95rem; }
  .wine-origin { min-height: 2.4em; margin: 7px 0 9px; font-size: 0.73rem; }
  .site-footer { align-items: start; display: grid; gap: 12px; }
  .footer-links { flex-wrap: wrap; gap: 12px 18px; }
  .profile-shell { grid-template-columns: 1fr; }
  .profile-media, .profile-media img { min-height: 190px; height: 190px; }
  .profile-content { padding: 24px 20px; }
  .glossary-shell { padding: 24px 20px; }
  .grape-shell { padding: 20px 16px; }
  .glossary-row { grid-template-columns: 1fr; gap: 4px; }
  .grape-glossary-row { grid-template-columns: 1fr 1fr; gap: 11px 14px; }
  .grape-glossary-row > strong { grid-column: 1 / -1; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: 0.01ms !important; }
}
