:root {
  --bg: #0f0f12;
  --bg-elevated: #16161b;
  --bg-secondary: rgba(255, 255, 255, 0.03);
  --bg-tertiary: rgba(0, 0, 0, 0.2);
  --surface: #1e1e24;
  --surface-hover: #25252d;
  --border: #2d2d36;
  --border-color: rgba(255, 255, 255, 0.08);
  --border-focus: #3d3d48;
  --text: #f0f0f2;
  --text-muted: #8b8b96;
  --accent: #d4a84b;
  --accent-hover: #e4b85b;
  --accent-glow: rgba(212, 168, 75, 0.2);
  --success: #22c55e;
  --success-glow: rgba(34, 197, 94, 0.35);
  --radius: 10px;
  --radius-sm: 6px;
  --shadow: 0 4px 24px rgba(0, 0, 0, 0.4);
  --shadow-accent: 0 0 20px var(--accent-glow);
}

/* Variante light mode */
[data-theme="light"] {
  --bg: #f8f7f4;
  --bg-elevated: #ffffff;
  --bg-secondary: #f0efe9;
  --bg-tertiary: #e8e6df;
  --surface: #f0efe9;
  --surface-hover: #e8e6df;
  --border: #e0ddd4;
  --border-color: #e0ddd4;
  --border-focus: #c9a227;
  --text: #1a1a1a;
  --text-muted: #5c5c5c;
  --accent: #b8860b;
  --accent-hover: #c9a227;
  --accent-glow: rgba(184, 134, 11, 0.15);
  --shadow: 0 4px 24px rgba(0, 0, 0, 0.08);
  --shadow-accent: 0 0 16px var(--accent-glow);
  --success: #15803d;
  --success-glow: rgba(21, 128, 61, 0.25);
}

/* Header right column (actions + service status) */
.header-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 6px;
  flex-shrink: 0;
}

/* Service status dots */
.service-status {
  display: flex;
  align-items: center;
  gap: 8px;
}
.service-status-label {
  font-size: 0.65rem;
  font-weight: 500;
  color: var(--text-muted);
  letter-spacing: 0.02em;
}
.service-dot {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 0.65rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  cursor: default;
}
.service-dot .dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--text-muted);
  transition: background 0.3s, box-shadow 0.3s;
}
.service-dot.ok .dot {
  background: #22c55e;
  box-shadow: 0 0 4px rgba(34, 197, 94, 0.4);
}
.service-dot.down .dot {
  background: #ef4444;
  box-shadow: 0 0 4px rgba(239, 68, 68, 0.4);
}
.service-dot.down {
  color: #ef4444;
}

* {
  box-sizing: border-box;
}

/* Scrollbar : style thème */
::-webkit-scrollbar {
  width: 12px;
  height: 12px;
}
::-webkit-scrollbar-track {
  background: var(--surface);
}
::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 6px;
  border: 3px solid var(--surface);
}
::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted);
}
::-webkit-scrollbar-button {
  display: block;
  height: 12px;
  width: 12px;
  background: var(--bg-elevated);
  border: none;
}
::-webkit-scrollbar-button:hover {
  background: var(--surface-hover);
}
/* Firefox */
* {
  scrollbar-width: thin;
  scrollbar-color: var(--border) var(--surface);
}

body {
  margin: 0;
  font-family: "Plus Jakarta Sans", system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  color-scheme: dark;
}
[data-theme="light"] {
  color-scheme: light;
}

.container {
  max-width: min(1400px, 96vw);
  margin: 0 auto;
  padding: 2rem 1.5rem;
}

.main-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 2.5rem;
}
.header-content {
  min-width: 0;
}
.header-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-shrink: 0;
}
.btn-header-icon,
.btn-theme-toggle {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2.5rem;
  height: 2.5rem;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text-muted);
  cursor: pointer;
  transition: color 0.2s, border-color 0.2s, background 0.2s;
}
.btn-header-icon:hover,
.btn-theme-toggle:hover {
  color: var(--accent);
  border-color: var(--accent);
  background: var(--surface-hover);
}
.btn-header-icon .btn-header-icon-svg {
  width: 1.25rem;
  height: 1.25rem;
}
.btn-theme-toggle .theme-icon {
  width: 1.25rem;
  height: 1.25rem;
}
.btn-theme-toggle .theme-icon-dark {
  display: none;
}
.btn-theme-toggle .theme-icon-light {
  display: block;
}
[data-theme="light"] .btn-theme-toggle .theme-icon-dark {
  display: block;
}
[data-theme="light"] .btn-theme-toggle .theme-icon-light {
  display: none;
}
[data-theme="light"] .photo-badge-ok {
  color: #15803d;
}
[data-theme="light"] .photo-badge-ok:hover {
  color: #166534;
}

h1 {
  font-size: 1.875rem;
  font-weight: 700;
  margin: 0;
  letter-spacing: -0.03em;
  background: linear-gradient(135deg, var(--text) 0%, var(--text-muted) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.subtitle {
  color: var(--text-muted);
  font-size: 0.95rem;
  margin: 0.35rem 0 0;
  font-weight: 500;
}

.search-section {
  position: relative;
  margin-bottom: 2rem;
}
.search-section-inner {
  display: flex;
  flex-direction: column;
  gap: 0;
}
.search-area {
  flex: 1;
  min-width: 0;
  position: relative;
}

/* Barre de recherche unifiée : photo | input | annuler */
.search-bar {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.5rem 0.75rem;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.search-bar:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-glow);
}
/* Étape 2 : quand on clique dans la barre (focus) pour taper, photo 600x600 à gauche, recherche à droite */
.search-bar:has(.search-replace-photos:not([hidden])) {
  flex-direction: row;
  align-items: flex-start;
  padding: 0.75rem;
  gap: 1rem;
}
.search-bar:has(.search-replace-photos:not([hidden])) .search-replace-photos {
  flex-direction: column;
  align-items: flex-start;
  flex-shrink: 0;
}
.search-bar:has(.search-replace-photos:not([hidden])) .search-replace-photos-thumbs {
  flex-direction: column;
  align-items: flex-start;
  max-width: none;
  gap: 0.5rem;
}
.search-bar:has(.search-replace-photos:not([hidden])) .search-replace-photos-thumbs img.main-thumb {
  width: 600px;
  height: 600px;
  object-fit: contain;
  flex-shrink: 0;
}
.search-bar:has(.search-replace-photos:not([hidden])) .search-replace-photos-thumbs img:not(.main-thumb) {
  width: 80px;
  height: 80px;
  object-fit: cover;
}
.search-bar:has(.search-replace-photos:not([hidden])) .search-right-col {
  flex: 1;
  min-width: 200px;
}
.search-replace-photos {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.search-replace-photos[hidden] {
  display: none !important;
}
.search-replace-photos-thumbs {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  max-width: 200px;
  overflow-x: auto;
}
.search-replace-photos-thumbs img {
  width: 56px;
  height: 56px;
  object-fit: cover;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface-hover);
  transition: width 0.3s ease, height 0.3s ease;
}
.search-replace-photos-thumbs img:hover {
  border-color: var(--accent);
}
.search-replace-photos-thumbs img.main-thumb {
  width: 72px;
  height: 72px;
  object-fit: cover;
}
.search-replace-no-photos {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-style: italic;
  padding: 0 0.25rem;
}
.search-right-col {
  flex: 1;
  min-width: 0;
  position: relative;
}
.replace-current-wine-block {
  margin-bottom: 0.75rem;
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--border);
}
.replace-current-wine-block[hidden] {
  display: none;
}
.replace-current-wine-label {
  margin: 0 0 0.35rem 0;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
}
.replace-current-wine-content .suggestion-item-current {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem;
  padding: 0.5rem 0.75rem;
  background: color-mix(in srgb, var(--accent) 10%, var(--surface));
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
}
.replace-current-wine-content .suggestion-item-current:hover {
  background: color-mix(in srgb, var(--accent) 16%, var(--surface));
  border-color: var(--accent);
}
.replace-current-wine-content .suggestion-item-current .label {
  flex: 1;
  min-width: 0;
  font-weight: 500;
}
.replace-current-wine-content .suggestion-item-current .meta {
  width: 100%;
  font-size: 0.8rem;
  color: var(--text-muted);
}
.replace-current-wine-hint {
  margin: 0.35rem 0 0 0;
  font-size: 0.8rem;
  color: var(--text-muted);
}
.replace-selected-wine-block {
  margin-bottom: 0.75rem;
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--border);
}
.replace-selected-wine-block[hidden] {
  display: none;
}
.replace-selected-wine-label {
  margin: 0 0 0.35rem 0;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
}
.replace-selected-wine-card {
  padding: 0.5rem 0.75rem;
  background: color-mix(in srgb, var(--accent) 8%, var(--surface));
  border: 1px solid var(--accent);
  border-radius: var(--radius-sm);
  margin-bottom: 0.5rem;
}
.replace-selected-wine-card .label {
  font-weight: 500;
}
.replace-selected-wine-card .meta {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 0.15rem;
}
.replace-selected-vintage {
  margin-top: 0.5rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.replace-selected-vintage label {
  font-size: 0.85rem;
  color: var(--text-muted);
}
.replace-selected-vintage select {
  padding: 0.25rem 0.5rem;
  font-size: 0.9rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
}
.btn-replace-confirm {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.4rem 0.8rem;
  font-size: 0.9rem;
  font-weight: 500;
  background: var(--accent);
  color: var(--bg);
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
}
.btn-replace-confirm:hover {
  background: color-mix(in srgb, var(--accent) 85%, black);
}
.btn-replace-confirm .btn-icon {
  width: 1rem;
  height: 1rem;
}
.search-bar .search-wrapper {
  flex: 1;
  min-width: 0;
}
.search-bar .search-wrapper #search-input {
  border: none;
  background: transparent;
  padding: 0.5rem 1rem 0.5rem 2.25rem;
  box-shadow: none;
}
.search-bar .search-wrapper #search-input:focus {
  box-shadow: none;
}
.search-bar .search-wrapper .search-icon {
  left: 0.75rem;
}
.btn-search-replace-cancel {
  flex-shrink: 0;
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-muted);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  padding: 0.4rem 0.75rem;
}
.btn-search-replace-cancel:hover {
  color: var(--accent);
  border-color: var(--accent);
  background: var(--surface-hover);
}
.btn-search-replace-cancel[hidden] {
  display: none !important;
}
.selection-table tbody tr.row-editing {
  box-shadow: inset 0 0 0 2px var(--accent);
}

/* Effet flash succès : bordure verte qui s’estompe après une action (5,5 s, plateau visible) */
.selection-table tbody tr.row-flash-success td {
  animation: row-flash-success-bg 2s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}
.selection-table tbody tr.row-flash-success td:first-child {
  animation: row-flash-success-bar 2s cubic-bezier(0.4, 0, 0.2, 1) forwards,
             row-flash-success-bg 2s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}
@keyframes row-flash-success-bar {
  0% { border-left: 4px solid var(--success); }
  100% { border-left: 4px solid transparent; }
}
@keyframes row-flash-success-bg {
  0% {
    background: color-mix(in srgb, var(--success) 38%, var(--surface));
  }
  12% {
    background: color-mix(in srgb, var(--success) 30%, var(--surface));
  }
  35% {
    background: color-mix(in srgb, var(--success) 20%, var(--surface));
  }
  100% {
    background: transparent;
  }
}

.search-wrapper {
  position: relative;
}

#search-input {
  width: 100%;
  padding: 0.875rem 1rem 0.875rem 2.75rem;
  font-size: 1rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}

#search-input::placeholder {
  color: var(--text-muted);
}

#search-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.search-icon {
  position: absolute;
  left: 1rem;
  top: 50%;
  transform: translateY(-50%);
  width: 1.25rem;
  height: 1.25rem;
  color: var(--text-muted);
  pointer-events: none;
}

.search-icon svg {
  width: 100%;
  height: 100%;
}

.search-block-message {
  margin: 0.5rem 0 0;
  padding: 0.5rem 0.75rem;
  font-size: 0.85rem;
  color: var(--accent);
  background: color-mix(in srgb, var(--accent) 10%, var(--surface));
  border: 1px solid color-mix(in srgb, var(--accent) 40%, var(--border));
  border-radius: var(--radius-sm);
}

.suggestions {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  margin-top: 6px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  max-height: 360px;
  flex-direction: column;
  z-index: 100;
  display: none;
  box-shadow: var(--shadow);
}

.suggestions.visible {
  display: flex;
  flex-direction: column;
}

.suggestions-list {
  overflow-y: auto;
  max-height: 280px;
  flex: 1;
  min-height: 0;
}

.suggestions.manual-form {
  max-height: 480px;
  overflow-y: auto;
}

/* En mode remplacement (photos à gauche) : formulaire à la place des résultats, barre masquée */
.search-bar.search-manual-form-mode {
  flex-direction: row;
  align-items: flex-start;
  padding: 0.75rem;
  gap: 1rem;
}
.search-bar.search-manual-form-mode .search-replace-photos {
  flex-direction: column;
  align-items: flex-start;
  flex-shrink: 0;
}
.search-bar.search-manual-form-mode .search-replace-photos-thumbs {
  flex-direction: column;
  align-items: flex-start;
  max-width: none;
  gap: 0.5rem;
}
.search-bar.search-manual-form-mode .search-replace-photos-thumbs img.main-thumb {
  width: 600px;
  height: 600px;
  object-fit: contain;
  flex-shrink: 0;
}
.search-bar.search-manual-form-mode .search-replace-photos-thumbs img:not(.main-thumb) {
  width: 80px;
  height: 80px;
  object-fit: cover;
}
.search-bar.search-manual-form-mode .search-right-col {
  flex: 1;
  min-width: 200px;
  display: flex;
  flex-direction: column;
  min-height: 0;
}
.search-bar.search-manual-form-mode .search-wrapper {
  display: none;
}
.search-bar.search-manual-form-mode .suggestions.manual-form {
  position: static;
  margin-top: 0;
  box-shadow: none;
  max-height: none;
  border: none;
  flex: 1;
  min-height: 0;
  overflow-y: auto;
}

.suggestion-item {
  padding: 0.75rem 1rem;
  cursor: pointer;
  border-bottom: 1px solid var(--border);
  transition: background 0.15s;
}

.suggestion-item:last-child {
  border-bottom: none;
}

.suggestion-item:hover,
.suggestion-item[aria-selected="true"] {
  background: var(--accent-glow);
}

.suggestion-item .label {
  font-weight: 500;
}

.suggestion-item .meta {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 0.2rem;
}

.suggestion-manual {
  flex-shrink: 0;
  padding: 0.5rem 1rem;
  border-top: 1px solid var(--border);
  background: var(--bg-elevated);
}

.suggestion-empty-msg {
  margin: 0 0 0.5rem;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.suggestion-manual .btn-manual-entry {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.5rem 0.75rem;
  font-size: 0.85rem;
  background: transparent;
  color: var(--accent);
  border: 1px dashed var(--accent);
  border-radius: var(--radius);
  cursor: pointer;
  font-weight: 500;
  transition: background 0.15s, color 0.15s;
}

.suggestion-manual .btn-manual-entry:hover {
  background: var(--accent-glow);
}

.btn-manual-entry:hover {
  opacity: 0.9;
}

.manual-entry-form {
  padding: 1rem;
  max-width: 100%;
}

.manual-entry-title {
  margin: 0 0 1rem;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text);
}

.manual-entry-form .manual-field {
  margin-bottom: 0.75rem;
}

.manual-entry-form .manual-field label {
  display: block;
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--text-muted);
  margin-bottom: 0.25rem;
}

.manual-entry-form .manual-field label .required {
  color: var(--accent);
}

.manual-entry-form .manual-field input,
.manual-entry-form .manual-field select {
  width: 100%;
  padding: 0.4rem 0.6rem;
  font-size: 0.9rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--text);
}

.manual-entry-form .manual-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 1rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border);
}

.manual-entry-form .btn-manual-ai-search {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.4rem 0.75rem;
  font-size: 0.9rem;
  background: transparent;
  color: var(--accent);
  border: 1px dashed var(--accent);
  border-radius: var(--radius);
  cursor: pointer;
  font-weight: 500;
}
.manual-entry-form .btn-manual-ai-search:hover:not(:disabled) {
  background: var(--accent-glow);
}
.manual-entry-form .btn-manual-ai-search:disabled {
  opacity: 0.7;
  cursor: not-allowed;
}
.manual-entry-form .btn-manual-ai-search .spin {
  animation: spin 0.8s linear infinite;
}
@keyframes spin {
  to { transform: rotate(360deg); }
}

.manual-ai-result {
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}
.manual-ai-match {
  padding: 0.75rem;
  background: color-mix(in srgb, var(--accent) 8%, var(--surface));
  border: 1px solid color-mix(in srgb, var(--accent) 30%, var(--border));
  border-radius: var(--radius-sm);
}
.manual-ai-match-wine {
  margin: 0 0 0.25rem;
  font-weight: 600;
  font-size: 0.95rem;
}
.manual-ai-match-meta {
  margin: 0 0 0.5rem;
  font-size: 0.8rem;
  color: var(--text-muted);
}
.manual-ai-match-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
}
.manual-ai-match-conf {
  font-size: 0.75rem;
  color: var(--text-muted);
}
.manual-ai-match-actions .btn-manual-ai-use {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.35rem 0.6rem;
  font-size: 0.85rem;
  background: var(--accent);
  color: var(--bg);
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-weight: 500;
}
.manual-ai-match-actions .btn-manual-ai-use:hover {
  background: var(--accent-hover);
}
.manual-ai-match-actions .btn-manual-ai-skip {
  padding: 0.35rem 0.6rem;
  font-size: 0.85rem;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  color: var(--text-muted);
}
.manual-ai-match-actions .btn-manual-ai-skip:hover {
  color: var(--text);
  border-color: var(--text-muted);
}
.manual-ai-empty {
  margin: 0;
  font-size: 0.9rem;
  color: var(--text-muted);
}
.manual-ai-notes {
  margin: 0.5rem 0 0;
  font-size: 0.8rem;
  color: var(--text-muted);
  font-style: italic;
}

.manual-entry-form .btn-cancel-manual {
  padding: 0.4rem 0.75rem;
  font-size: 0.9rem;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-muted);
  cursor: pointer;
}

.manual-entry-form .btn-submit-manual {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.4rem 0.75rem;
  font-size: 0.9rem;
  background: var(--accent);
  color: var(--bg);
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  font-weight: 500;
}

.detail-section h2,
.selection-section h2 {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
  margin: 0 0 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.detail-content {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  box-shadow: var(--shadow);
}

.detail-content.product-card {
  padding: 1.25rem 1.5rem;
}

.detail-content.simple {
  padding: 1rem 1.5rem;
}

.detail-content .placeholder {
  color: var(--text-muted);
  margin: 0;
}

/* Product card layout: titre + millésime + bouton sur une ligne, meta en dessous */
.detail-content.product-card .product-card-header {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.5rem 1.5rem;
  width: 100%;
}

.detail-content.product-card .product-card-title-block {
  flex: 1;
  min-width: 0;
}

.detail-content.product-card .product-card-actions {
  display: flex;
  align-items: flex-end;
  gap: 0.75rem;
  flex-shrink: 0;
}

.detail-content.product-card .product-card-vintage {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.detail-content.product-card .product-card-vintage-inner {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.detail-content.product-card .product-card-vintage label {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.detail-content.product-card .product-card-vintage .input-vintage {
  padding: 0.5rem 0.7rem;
  font-size: 0.9rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  min-width: 5rem;
  cursor: pointer;
  height: 2.5rem;
  box-sizing: border-box;
}

.detail-content.product-card .product-card-vintage .input-vintage:focus {
  outline: none;
  border-color: var(--accent);
}

/* Millésime et bouton : même hauteur, alignés en bas */
.detail-content.product-card .btn-add-selection {
  height: 2.5rem;
  padding-top: 0.5rem;
  padding-bottom: 0.5rem;
  box-sizing: border-box;
  flex-shrink: 0;
}

.detail-content.product-card .product-card-vintage .row-inline-alert {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  font-size: 0.7rem;
  color: var(--accent);
  min-height: 0;
}

.detail-content.product-card .product-card-vintage .row-inline-alert:empty {
  display: none;
}

.detail-content.product-card .product-card-vintage.cell-alert .input-vintage {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px rgba(212, 168, 75, 0.3);
}

.detail-content .wine-line1 {
  font-size: 1.1rem;
  font-weight: 600;
  margin: 0 0 0.2rem;
}

.detail-content.product-card .wine-line1 {
  font-size: 1.2rem;
  font-weight: 600;
  margin: 0;
  line-height: 1.3;
}

.detail-content.simple .wine-line1 {
  font-size: 1rem;
  margin-bottom: 0.15rem;
}

.detail-content .product-card-meta,
.detail-content .wine-line2 {
  font-size: 0.95rem;
  color: var(--text-muted);
}

.detail-content.product-card .product-card-meta {
  font-size: 0.9rem;
  margin: 0.25rem 0 0;
  line-height: 1.4;
}

.detail-content .wine-line2 {
  margin: 0 0 1rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--border);
}

.detail-content.simple .wine-line2 {
  font-size: 0.85rem;
  margin: 0 0 0.5rem;
  padding-bottom: 0;
  border-bottom: none;
}

.detail-content.simple .wine-meta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1rem;
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 0.35rem;
}

.detail-content.product-card .wine-meta-row {
  margin-top: 0.4rem;
}

.detail-content.simple .wine-meta-item {
  display: inline-flex;
  align-items: center;
}

.detail-content.simple .wine-meta-item:not(:last-child)::after {
  content: "·";
  margin-left: 0.5rem;
  color: var(--text-muted);
  opacity: 0.7;
}

.detail-content.simple .wine-meta-colour {
  color: var(--accent);
  font-weight: 500;
}

.detail-grid {
  display: grid;
  gap: 0.5rem 1.5rem;
  grid-template-columns: auto 1fr;
}

.detail-grid dt {
  color: var(--text-muted);
  font-size: 0.85rem;
  margin: 0;
}

.detail-grid dd {
  margin: 0;
  font-size: 0.95rem;
}

.detail-grid dd.empty {
  color: var(--text-muted);
  font-style: italic;
}

.detail-grid dd.prominent {
  font-weight: 600;
  color: var(--accent);
}

/* Session / Imports */
.session-section {
  margin-bottom: 1.5rem;
}
.selection-header-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem 1.5rem;
  margin-bottom: 0.5rem;
}
.selection-header-row h2 {
  margin: 0;
}
.session-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem 0.75rem;
  font-size: 0.85rem;
  color: var(--text-muted);
}
.session-bar-label {
  color: var(--text-muted);
}
.session-bar .session-name-input {
  width: 140px;
  min-width: 100px;
  padding: 0.25rem 0.4rem;
  font-size: 0.85rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
}
.session-bar .session-name-input:focus {
  outline: none;
  border-color: var(--accent);
}
.session-bar .session-name-input:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}
.session-bar .session-name-input::placeholder {
  color: var(--text-muted);
  opacity: 0.8;
}
.btn-freeze-session {
  padding: 0.25rem 0.5rem;
  font-size: 0.8rem;
  background: transparent;
  color: var(--text-muted);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
}
.btn-freeze-session:hover:not(:disabled) {
  color: var(--text);
  border-color: var(--text-muted);
}
.btn-freeze-session:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
.link-imports {
  font-size: 0.82rem;
  color: var(--text-muted);
  text-decoration: none;
}
.link-imports:hover {
  color: var(--accent);
  text-decoration: underline;
}
.imports-list-panel {
  margin-top: 1rem;
  padding: 1rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.imports-list-panel h3 {
  font-size: 1rem;
  margin: 0 0 0.75rem;
  color: var(--text-muted);
}
#imports-list-content {
  margin-bottom: 0.75rem;
}
.import-item {
  padding: 0.5rem 0.75rem;
  margin-bottom: 0.35rem;
  background: var(--bg);
  border-radius: var(--radius-sm);
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.import-item.validated {
  border-left: 3px solid var(--accent);
}
.import-item-actions {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}
.import-number {
  font-size: 0.85em;
  color: var(--text-muted);
}
.btn-delete-import {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.25rem 0.35rem;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s, background 0.15s;
}
.btn-delete-import:hover {
  color: #e57373;
  border-color: #e57373;
  background: rgba(229, 115, 115, 0.1);
}
.btn-delete-import .btn-icon {
  width: 0.9rem;
  height: 0.9rem;
}
.btn-close-imports,
.btn-close-import-detail {
  padding: 0.35rem 0.6rem;
  font-size: 0.85rem;
  background: transparent;
  color: var(--text-muted);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
}
.btn-close-imports:hover {
  color: var(--text);
  border-color: var(--text-muted);
}
.import-detail-panel {
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}
.import-detail-title {
  font-size: 0.95rem;
  font-weight: 600;
  margin: 0 0 0.75rem;
  color: var(--text-muted);
}
.import-detail-table-wrapper {
  overflow-x: auto;
  margin-bottom: 0.75rem;
}
.import-detail-table-wrapper table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}
.import-detail-table-wrapper th,
.import-detail-table-wrapper td {
  padding: 0.4rem 0.6rem;
  text-align: left;
  border-bottom: 1px solid var(--border);
}
.import-detail-table-wrapper th {
  color: var(--text-muted);
  font-weight: 500;
}
.import-detail-wine {
  font-weight: 500;
}
.import-detail-meta {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 0.15rem;
}
.import-detail-empty {
  margin: 0;
  font-size: 0.9rem;
  color: var(--text-muted);
}

/* Sélection pour import */
.selection-section {
  margin-bottom: 2rem;
}

.selection-table-wrapper {
  overflow-x: auto;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.selection-table {
  width: 100%;
  table-layout: fixed;
  border-collapse: collapse;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.selection-table col.col-id { width: 9rem; }
.selection-table col.col-wine { width: 36%; }
.selection-table col.col-format { width: 4.5rem; }
.selection-table col.col-vintage { width: 5rem; }
.selection-table col.col-qty { width: 4.5rem; }
.selection-table col.col-price { width: 5rem; }
.selection-table col.col-price-ttc { width: 5rem; }
.selection-table col.col-condition { width: 5rem; }
.selection-table col.col-actions { width: 6.5rem; }

.selection-table td.col-id {
  overflow: hidden;
}

.selection-table td.col-wine {
  min-width: 0;
  overflow: hidden;
}


.selection-table th,
.selection-table td {
  padding: 0.5rem 0.5rem;
  text-align: left;
  vertical-align: top;
  border-bottom: 1px solid var(--border);
  line-height: 1.4;
}

.selection-table th {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.selection-table tbody tr:last-child td {
  border-bottom: none;
}

.selection-table .col-id {
  font-family: monospace;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.selection-hint {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin: -0.5rem 0 0.75rem;
}

.auto-refresh-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--text-muted);
  margin-left: 0.5rem;
}
.auto-refresh-badge .auto-refresh-icon {
  width: 0.9rem;
  height: 0.9rem;
  opacity: 0.8;
}

.selection-actions {
  margin-bottom: 1rem;
}

.btn-export {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.5rem 1rem;
  font-size: 0.9rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  text-decoration: none;
  transition: border-color 0.2s, background 0.2s;
}

.btn-export:hover {
  background: var(--surface-hover);
  border-color: var(--accent);
}

.wine-title-cell {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  min-height: 2rem;
  cursor: pointer;
}
.wine-title-cell.wine-title-unidentified {
  cursor: pointer;
}
.wine-title-cell.wine-title-unidentified .input-wine-title {
  color: var(--accent);
  border-style: dashed;
  cursor: pointer;
}
.wine-title-cell.wine-title-unidentified:hover .input-wine-title {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 8%, var(--surface));
}
.wine-title-cell:not(.wine-title-unidentified):hover .input-wine-title {
  border-color: var(--border);
  background: var(--surface-hover);
}

/* Badges source : IA, Recherche, Manuel — icônes + couleurs harmonisées (informatifs, non cliquables) */
.source-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.2rem;
  flex-shrink: 0;
  min-height: 1.5rem;
  cursor: default;
}
.source-badge .source-badge-icon,
.source-badge svg {
  width: 1rem;
  height: 1rem;
  flex-shrink: 0;
}
.source-badge .ai-badge-pct {
  font-size: 0.7rem;
  font-weight: 600;
  line-height: 1;
}
/* IA : vert / orange / jaune selon confiance */
.source-badge-ia.ai-badge-high {
  color: var(--success, #22c55e);
}
.source-badge-ia.ai-badge-mid {
  color: #f59e0b;
}
.source-badge-ia.ai-badge-low {
  color: #eab308;
}
[data-theme="light"] .source-badge-ia.ai-badge-high {
  color: var(--success, #15803d);
}
[data-theme="light"] .source-badge-ia.ai-badge-mid {
  color: #d97706;
}
[data-theme="light"] .source-badge-ia.ai-badge-low {
  color: #ca8a04;
}
/* Recherche : bleu — trouvé dans la base */
.source-badge-search {
  color: #0ea5e9;
}
[data-theme="light"] .source-badge-search {
  color: #0284c7;
}
/* Manuel : teinte chaude — saisie custom */
.source-badge-manual {
  color: #a78bfa;
}
[data-theme="light"] .source-badge-manual {
  color: #7c3aed;
}
/* Rétrocompat : ai-badge-inline (import-photos, etc.) */
.ai-badge-inline {
  display: inline-flex;
  align-items: center;
  gap: 0.2rem;
  flex-shrink: 0;
  min-height: 1.5rem;
}
.ai-badge-inline .ai-badge-icon,
.ai-badge-inline svg {
  width: 1rem;
  height: 1rem;
}
.ai-badge-inline .ai-badge-pct {
  font-size: 0.7rem;
  font-weight: 600;
  line-height: 1;
}
.ai-badge-inline.ai-badge-high {
  color: var(--success, #22c55e);
}
.ai-badge-inline.ai-badge-mid {
  color: #f59e0b;
}
.ai-badge-inline.ai-badge-low {
  color: #eab308;
}
[data-theme="light"] .ai-badge-inline.ai-badge-high {
  color: var(--success, #15803d);
}
[data-theme="light"] .ai-badge-inline.ai-badge-mid {
  color: #d97706;
}
[data-theme="light"] .ai-badge-inline.ai-badge-low {
  color: #ca8a04;
}

/* Ancien badge % (gardé pour import-photos-pending-status) */
.ai-confidence-badge {
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--accent);
  background: color-mix(in srgb, var(--accent) 12%, var(--surface));
  padding: 0.15rem 0.4rem;
  border-radius: 4px;
  white-space: nowrap;
}

.input-wine-title {
  flex: 1;
  min-width: 0;
  min-height: 2rem;
  padding: 0.25rem 0.35rem;
  font-size: inherit;
  font-weight: 500;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 4px;
  color: inherit;
  line-height: 1.25;
  box-sizing: border-box;
}

.input-wine-title:hover {
  border-color: var(--border);
}

.input-wine-title:focus {
  outline: none;
  border-color: var(--accent);
  background: var(--surface);
}

.btn-search-title {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.2rem;
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  border-radius: 4px;
}
.btn-search-title:hover {
  color: var(--accent);
}
.btn-search-title .btn-icon,
.btn-search-title svg {
  width: 1rem;
  height: 1rem;
}

.btn-edit-manual {
  flex-shrink: 0;
  padding: 0.2rem;
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  border-radius: 4px;
}
.btn-edit-manual:hover {
  color: var(--accent);
}
.btn-edit-manual .btn-icon {
  width: 0.9rem;
  height: 0.9rem;
}

.btn-reset-title {
  flex-shrink: 0;
  padding: 0.2rem;
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  border-radius: 4px;
}

.btn-reset-title:hover {
  color: var(--accent);
}

.selection-table .col-wine .wine-meta {
  font-size: 0.8rem;
  color: var(--text-muted);
  line-height: 1.2;
  padding-left: 0.25rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.selection-table .col-wine .wine-meta:empty {
  display: none;
}

.selection-table .col-format {
  min-width: 0;
}

.selection-table .col-format select,
.selection-table .col-vintage select {
  width: 100%;
  min-height: 2rem;
  padding: 0.25rem 0.5rem;
  font-size: 0.85rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  cursor: pointer;
  box-sizing: border-box;
}

.selection-table .col-condition {
  min-width: 0;
}

.selection-table .condition-trigger {
  display: inline-block;
  padding: 0.2rem 0.35rem;
  font-size: 0.85rem;
  text-align: left;
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  color: var(--text);
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}

.selection-table .condition-trigger:hover {
  background: var(--surface-hover);
  border-color: var(--border);
}

.selection-table .condition-summary.condition-empty {
  color: var(--text-muted);
}

.selection-table .condition-cell-inner {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
}

.selection-table .btn-clear-condition {
  flex-shrink: 0;
  padding: 0.15rem;
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  border-radius: 4px;
  opacity: 0.6;
}

.selection-table .btn-clear-condition:hover {
  color: var(--accent);
  opacity: 1;
  background: transparent;
}

.selection-table .btn-clear-condition .btn-icon {
  width: 0.7rem;
  height: 0.7rem;
}

.selection-table .btn-clear-condition-inner {
  margin-top: 0.5rem;
  padding: 0.35rem 0.75rem;
  font-size: 0.8rem;
  background: var(--surface-hover);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  cursor: pointer;
}

.selection-table .btn-clear-condition-inner:hover {
  color: var(--text);
  border-color: var(--accent);
}

.selection-table .cell-condition {
  position: relative;
}

.selection-table .condition-popover {
  position: fixed;
  z-index: 1000;
  min-width: 220px;
  max-width: 280px;
  padding: 0.75rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.selection-table .condition-popover-inner {
  max-height: 280px;
  overflow-y: auto;
}

.selection-table .condition-field {
  margin-bottom: 0.5rem;
}

.selection-table .condition-field:last-child {
  margin-bottom: 0;
}

.selection-table .condition-field label {
  display: block;
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
  margin-bottom: 0.2rem;
}

.selection-table .condition-field select {
  width: 100%;
  padding: 0.35rem 0.5rem;
  font-size: 0.85rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--text);
}

.selection-table .col-qty input,
.selection-table .col-price input,
.selection-table .col-price-ttc input {
  width: 100%;
  min-width: 60px;
  min-height: 2rem;
  padding: 0.25rem 0.5rem;
  font-size: 0.9rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  box-sizing: border-box;
}

.selection-table .col-qty input:focus,
.selection-table .col-price input:focus,
.selection-table .col-price-ttc input:focus {
  outline: none;
  border-color: var(--border-focus);
}

.selection-table .col-qty .input-number-wrap {
  width: 4rem;
}
.selection-table .col-qty .input-number-wrap input {
  width: 100%;
}

.selection-table .col-price .input-number-wrap,
.selection-table .col-price-ttc .input-number-wrap {
  width: 5rem;
}
.selection-table .col-price .input-number-wrap input,
.selection-table .col-price-ttc .input-number-wrap input {
  width: 100%;
}

.selection-table .price-cell {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.selection-table .price-cell .input-number-wrap {
  flex-shrink: 0;
}

.selection-table .price-hint {
  display: none;
  font-size: 0.7rem;
  line-height: 1.2;
  color: var(--accent);
}

.selection-table .price-hint.visible {
  display: block;
}

/* Masquer les flèches des inputs number (saisie manuelle) */
.input-no-spinner::-webkit-outer-spin-button,
.input-no-spinner::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
  opacity: 0;
  height: 0;
  width: 0;
  pointer-events: none;
}
.input-no-spinner {
  -moz-appearance: textfield;
  appearance: textfield;
}

/* Flèches personnalisées pour inputs number */
.input-number-wrap {
  position: relative;
  display: inline-flex;
  align-items: stretch;
}
.selection-table .input-number-wrap input {
  padding-right: 1.75rem;
  border-radius: var(--radius-sm) 0 0 var(--radius-sm);
}
.input-number-wrap input::-webkit-outer-spin-button,
.input-number-wrap input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
.input-number-wrap input {
  -moz-appearance: textfield;
  appearance: textfield;
}
.input-number-btns {
  position: absolute;
  right: 0;
  top: 0;
  bottom: 0;
  width: 1.5rem;
  display: flex;
  flex-direction: column;
  border-left: 1px solid var(--border);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  overflow: hidden;
}
.btn-spin {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  margin: 0;
  border: none;
  background: var(--bg-elevated);
  color: var(--text-muted);
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
  min-height: 0;
}
.btn-spin:hover {
  background: var(--surface-hover);
  color: var(--accent);
}
.btn-spin i,
.btn-spin svg {
  width: 0.75rem;
  height: 0.75rem;
}
.btn-spin-up {
  border-bottom: 1px solid var(--border);
}

.selection-table .col-id-inner {
  display: flex;
  align-items: center;
  gap: 0.2rem;
  min-height: 100%;
  min-width: 0;
}

.selection-table .col-id .col-id-value {
  font-family: monospace;
  font-size: 0.75em;
  flex-shrink: 0;
  min-width: 1.8rem;
}

.selection-table .col-id .col-id-check {
  display: flex;
  align-items: center;
  gap: 0.2rem;
  flex-shrink: 0;
}

/* Bouton copier ID visible uniquement après clic sur "Copier le titre" (Actions) */
.selection-table .btn-copy-id.btn-copy-id-hidden {
  display: none !important;
}

.selection-table .col-id .btn-copy-id {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.15rem;
  width: 1.25rem;
  height: 1.25rem;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s, background 0.15s;
}
.selection-table .btn-copy,
.selection-table .btn-delete {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.25rem 0.35rem;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s, background 0.15s;
}

.selection-table .col-id .btn-copy-id:hover,
.selection-table .btn-copy:hover {
  color: var(--accent);
  border-color: var(--accent);
  background: var(--surface-hover);
}

.selection-table .btn-delete:hover {
  color: #e57373;
  border-color: #e57373;
  background: rgba(229, 115, 115, 0.1);
}

.selection-table .col-actions-inner {
  display: flex;
  align-items: flex-start;
  justify-content: flex-end;
  gap: 0.2rem;
  min-height: 100%;
  white-space: nowrap;
}

.selection-table .btn-copy .btn-icon,
.selection-table .btn-delete .btn-icon,
.selection-table .col-id .btn-copy-id .btn-icon {
  width: 0.75rem;
  height: 0.75rem;
}

.selection-table .col-id .wine-info-badge {
  display: inline-flex;
  align-items: center;
  color: var(--success, #22c55e);
}
.selection-table .col-id .wine-info-badge .wine-info-icon {
  width: 0.85rem;
  height: 0.85rem;
}
.selection-table .col-id .wine-info-badge-mismatch {
  color: var(--accent);
  font-size: 0.75rem;
}
.selection-table .col-id .wine-info-badge-mismatch .wine-info-mismatch-label {
  margin-left: 0.2rem;
}
.selection-table .col-id .wine-info-badge-mismatch .wine-info-icon {
  width: 0.85rem;
  height: 0.85rem;
}

.selection-table .col-id .btn-wine-info {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.2rem;
  background: transparent;
  border: none;
  cursor: pointer;
  color: var(--text-muted);
  border-radius: var(--radius-sm);
}
.selection-table .col-id .btn-wine-info:hover {
  color: var(--accent);
  background: var(--surface-hover);
}
.selection-table .col-id .btn-wine-info .wine-info-chevron {
  width: 1rem;
  height: 1rem;
}

.wine-info-details-row td {
  padding: 0.5rem 0.75rem !important;
  background: var(--bg-secondary, rgba(255, 255, 255, 0.03));
  border-bottom: 1px solid var(--border-color, rgba(255, 255, 255, 0.08));
  vertical-align: top;
}
.wine-info-content {
  font-size: 0.85rem;
}
.wine-info-table {
  width: 100%;
  max-width: 400px;
  border-collapse: collapse;
}
.wine-info-table td {
  padding: 0.25rem 0.5rem 0.25rem 0;
  border: none;
}
.wine-info-source {
  color: var(--text-muted);
}
.wine-info-score {
  font-weight: 500;
  text-align: right;
}
.wine-info-loading,
.wine-info-empty,
.wine-info-error {
  color: var(--text-muted);
  font-style: italic;
}

/* Colonnes fixes : image | scrap | vintage | chevron — alignement vertical comme Actions */
.col-id-check-unified {
  display: grid;
  grid-template-columns: 1.25rem 1.25rem 1.25rem 1.25rem;
  gap: 0;
  align-items: center;
  justify-items: center;
  flex-shrink: 0;
  min-width: 0;
}
.col-id-slot {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 1.25rem;
  height: 1.25rem;
  min-width: 1.25rem;
  flex-shrink: 0;
}
.col-id-check-unified .wine-info-badge,
.col-id-check-unified .wine-info-badge-btn,
.col-id-check-unified .photo-badge-btn,
.col-id-check-unified .btn-wine-info {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin: 0;
  padding: 0.15rem;
  width: 1.25rem;
  height: 1.25rem;
  min-width: 1.25rem;
  min-height: 1.25rem;
  flex-shrink: 0;
  border: none;
  background: transparent;
  cursor: pointer;
  border-radius: var(--radius-sm);
  transition: color 0.15s, background 0.15s;
}
.col-id-check-unified .btn-wine-info {
  color: var(--text-muted);
}
.col-id-check-unified .wine-info-badge:hover,
.col-id-check-unified .wine-info-badge-btn:hover,
.col-id-check-unified .photo-badge-btn:hover,
.col-id-check-unified .btn-wine-info:hover {
  color: var(--accent);
  background: var(--surface-hover);
}
.col-id-check-unified .wine-info-badge {
  color: var(--success, #22c55e);
  padding: 0.2rem;
  cursor: default;
}
.col-id-check-unified .wine-info-badge:hover {
  background: transparent;
}
.col-id-check-unified .wine-info-badge-btn.wine-info-badge-scrap {
  color: var(--success, #22c55e);
}
.col-id-check-unified .wine-info-badge.wine-info-badge-mismatch {
  color: var(--accent);
}
.col-id-check-unified .photo-badge-btn {
  color: var(--text-muted);
}
.col-id-check-unified .photo-badge-btn.photo-badge-ok {
  color: var(--success, #22c55e);
}
.col-id-check-unified .photo-badge-btn.photo-badge-warning {
  color: var(--accent);
}
.col-id-check-unified .photo-badge-btn .wine-info-icon,
.col-id-check-unified .btn-wine-info .wine-info-chevron,
.col-id-check-unified .wine-info-badge .wine-info-icon,
.col-id-check-unified .wine-info-badge-btn .wine-info-icon {
  width: 0.85rem !important;
  height: 0.85rem !important;
  min-width: 0.85rem;
  min-height: 0.85rem;
  flex-shrink: 0;
}
.col-id-check-unified .wine-info-icon svg,
.col-id-check-unified .wine-info-chevron svg {
  width: 0.85rem !important;
  height: 0.85rem !important;
}

.wine-info-content-unified {
  display: block;
}

.wine-info-panel {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.wine-info-columns {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  gap: 0;
  align-items: flex-start;
}

.wine-info-col {
  display: flex;
  flex-direction: column;
  min-width: 8rem;
  max-width: 18rem;
  flex: 0 1 auto;
  padding: 0 1.25rem;
  border-right: 1px solid var(--border-color);
}
.wine-info-col:last-child {
  border-right: none;
  padding-right: 0;
}
.wine-info-col:first-child {
  padding-left: 0;
}

.wine-info-col .wine-info-header {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  margin-bottom: 0.35rem;
}

.wine-info-col-body {
  min-width: 0;
  overflow-wrap: break-word;
}

.btn-wine-info-action {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.25rem 0.5rem;
  font-size: 0.75rem;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s, background 0.15s;
}
.btn-wine-info-action:hover {
  color: var(--accent);
  border-color: var(--accent);
  background: var(--surface-hover);
}
.btn-wine-info-action .btn-icon {
  width: 0.85rem;
  height: 0.85rem;
}
.btn-wine-info-col-action {
  display: flex;
  width: fit-content;
  margin-top: 0.5rem;
}

.btn-delete-scrap:hover {
  color: #ef4444;
  border-color: #ef4444;
  background: color-mix(in srgb, #ef4444 10%, transparent);
}

.btn-wine-info-action-warning {
  color: var(--accent);
  border-color: var(--accent);
}
.btn-wine-info-action-warning:hover {
  color: var(--accent-hover);
  border-color: var(--accent-hover);
  background: var(--accent-glow);
}
.btn-delete-scrap.btn-wine-info-action-warning:hover {
  color: var(--accent-hover);
  border-color: var(--accent-hover);
  background: var(--accent-glow);
}

.wine-info-ai-meta {
  margin: 0 0 0.5rem 0;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.wine-info-scrap-summary {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  margin-bottom: 0.5rem;
}

.wine-info-scrap-vintage,
.wine-info-scrap-notes-label {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.wine-info-scrap-alert-block {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  font-size: 0.75rem;
  color: var(--accent);
  margin-bottom: 0.5rem;
}
.wine-info-scrap-alert-block .wine-info-icon {
  width: 0.9rem;
  height: 0.9rem;
  flex-shrink: 0;
}

.wine-info-photos-row {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 0.5rem;
}

.wine-info-photo-thumb {
  display: block;
  padding: 0;
  border: 1px solid var(--border-color, rgba(255, 255, 255, 0.12));
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: var(--bg-tertiary, rgba(0, 0, 0, 0.2));
  cursor: pointer;
  transition: border-color 0.15s, transform 0.15s;
}
.wine-info-photo-thumb:hover {
  border-color: var(--accent);
  transform: scale(1.02);
}
.wine-info-photo-thumb img {
  display: block;
  width: 48px;
  height: 48px;
  object-fit: cover;
}


.selection-empty {
  color: var(--text-muted);
  font-style: italic;
  margin: 0;
  padding: 1rem;
}

.btn-add-selection {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 1rem;
  padding: 0.5rem 1.25rem;
  font-size: 0.9rem;
  font-weight: 600;
  background: var(--accent);
  color: var(--bg);
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  transition: background 0.15s, box-shadow 0.15s;
}

.btn-add-selection:hover {
  background: var(--accent-hover);
  box-shadow: var(--shadow-accent);
}

.btn-add-selection .btn-icon {
  width: 1.125rem;
  height: 1.125rem;
}

.detail-content.product-card .detail-grid-wrapper {
  margin-top: 1.25rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--border);
}

/* Legacy add-selection-row (manual entry form) */
.add-selection-row {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}

.add-selection-row label {
  font-size: 0.9rem;
  color: var(--text-muted);
}

.add-selection-row .input-vintage {
  padding: 0.4rem 0.6rem;
  font-size: 0.9rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--text);
  min-width: 5rem;
}

.selection-table .col-vintage select {
  min-width: 4.5rem;
  font-size: 0.9rem;
}

/* Alerte intégrée dans la ligne */
.selection-table .col-format,
.selection-table .col-vintage {
  position: relative;
}
.selection-table .col-format .format-cell-inner,
.selection-table .col-vintage .vintage-cell-inner {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}
.selection-table .col-format .row-inline-alert,
.selection-table .col-vintage .row-inline-alert {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  font-size: 0.7rem;
  color: var(--accent);
  padding: 0.2rem 0 0;
  cursor: pointer;
  min-height: 0;
}
.selection-table .col-format .row-inline-alert .row-alert-icon,
.selection-table .col-vintage .row-inline-alert .row-alert-icon {
  width: 0.75rem;
  height: 0.75rem;
  flex-shrink: 0;
}
.selection-table .col-format .row-inline-alert:empty,
.selection-table .col-vintage .row-inline-alert:empty {
  display: none;
}

.vintage-change-confirm {
  margin-top: 0.4rem;
  font-size: 0.75rem;
  color: var(--text-muted);
}
.vintage-confirm-label {
  display: block;
  margin-bottom: 0.3rem;
}
.vintage-confirm-btns {
  display: flex;
  gap: 0.4rem;
}
.vintage-change-confirm .btn-vintage-continue,
.vintage-change-confirm .btn-vintage-cancel {
  padding: 0.3rem 0.5rem;
  font-size: 0.75rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
}
.vintage-change-confirm .btn-vintage-continue:hover {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 12%, var(--surface));
}
.vintage-change-confirm .btn-vintage-cancel:hover {
  border-color: var(--text-muted);
}
.selection-table .col-format.cell-alert select,
.selection-table .col-vintage.cell-alert select {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent);
}
@keyframes cell-alert-pulse {
  0% { opacity: 1; }
  50% { opacity: 0.7; }
  100% { opacity: 1; }
}

/* Toast et modal de confirmation */
.toast-container {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  pointer-events: none;
}
.toast {
  padding: 0.6rem 1rem;
  font-size: 0.9rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  box-shadow: var(--shadow);
  pointer-events: auto;
  animation: toast-in 0.2s ease;
}
.toast.error {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 15%, var(--surface));
}
@keyframes toast-in {
  from { opacity: 0; transform: translateY(0.5rem); }
  to { opacity: 1; transform: translateY(0); }
}
.confirm-overlay {
  position: fixed;
  inset: 0;
  z-index: 1150;
  background: rgba(0, 0, 0, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  pointer-events: auto;
}
.confirm-overlay[hidden] {
  display: none !important;
}
.confirm-modal {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  max-width: 360px;
  box-shadow: var(--shadow);
}
.confirm-message {
  margin: 0 0 1rem;
  font-size: 0.95rem;
  line-height: 1.5;
}
.confirm-btns {
  display: flex;
  gap: 0.5rem;
  justify-content: flex-end;
}
.btn-confirm-cancel,
.btn-confirm-ok {
  padding: 0.5rem 1rem;
  font-size: 0.9rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
}
.btn-confirm-cancel:hover,
.btn-confirm-ok:hover {
  background: var(--surface-hover);
}
.btn-confirm-ok {
  background: var(--accent);
  color: var(--bg);
  border-color: var(--accent);
}
.btn-confirm-ok:hover {
  background: var(--accent-hover);
}

/* Photos overlay */
.photos-overlay {
  position: fixed;
  inset: 0;
  z-index: 1100;
  background: rgba(0, 0, 0, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  pointer-events: auto;
}
.photos-overlay[hidden] {
  display: none !important;
}
.photos-modal {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  max-width: 520px;
  width: 100%;
  box-shadow: var(--shadow);
}
.photos-modal-title {
  margin: 0 0 1rem;
  font-size: 1rem;
  font-weight: 600;
}
.photos-drop-zone {
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 2rem;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
  margin-bottom: 1rem;
}
.photos-drop-zone:hover,
.photos-drop-zone.photos-drop-active {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 8%, var(--surface));
}
.photos-drop-text {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.9rem;
}
.photos-preview-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-bottom: 1rem;
  max-height: 200px;
  overflow-y: auto;
}
.photos-preview-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.25rem;
  position: relative;
}
.photos-preview-img {
  width: 64px;
  height: 64px;
  object-fit: cover;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}
.photos-type-select {
  font-size: 0.75rem;
  padding: 0.2rem 0.4rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  max-width: 100px;
}
.btn-photos-remove {
  position: absolute;
  top: -4px;
  right: -4px;
  width: 20px;
  height: 20px;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: var(--surface-hover);
  color: var(--text);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}
.btn-photos-remove:hover {
  background: #c44;
  color: #fff;
}
.btn-photos-remove .btn-icon {
  width: 12px;
  height: 12px;
}
.photos-modal-btns {
  display: flex;
  gap: 0.5rem;
  justify-content: flex-end;
}
.btn-photos-cancel,
.btn-photos-save {
  padding: 0.5rem 1rem;
  font-size: 0.9rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
}
.btn-photos-cancel:hover,
.btn-photos-save:hover {
  background: var(--surface-hover);
}
.btn-photos-save {
  background: var(--accent);
  color: var(--bg);
  border-color: var(--accent);
}
.btn-photos-save:hover {
  background: var(--accent-hover);
}
.photos-validation-message {
  margin: 0.5rem 0 0;
  padding: 0.5rem 0.75rem;
  font-size: 0.85rem;
  color: var(--accent);
  background: color-mix(in srgb, var(--accent) 10%, var(--surface));
  border: 1px solid color-mix(in srgb, var(--accent) 40%, var(--border));
  border-radius: var(--radius-sm);
}
.photos-type-select.photos-type-missing {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 8%, var(--surface));
}
.photos-existing-section {
  margin-bottom: 1rem;
}
.photos-section-title {
  margin: 0 0 0.5rem;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
}
.photos-existing-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-bottom: 1rem;
}
.photos-existing-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.25rem;
  position: relative;
}
.photos-existing-img {
  width: 80px;
  height: 80px;
  object-fit: cover;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  cursor: pointer;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.photos-existing-img:hover {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-glow);
}
.photos-existing-label {
  font-size: 0.75rem;
  color: var(--text-muted);
}
.photos-existing-type-select {
  font-size: 0.75rem;
  padding: 0.2rem 0.4rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  max-width: 110px;
}
.btn-photos-delete {
  position: absolute;
  top: -4px;
  right: -4px;
  width: 22px;
  height: 22px;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: var(--surface-hover);
  color: var(--text);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}
.btn-photos-delete:hover {
  background: #c44;
  color: #fff;
}
.btn-photos-delete .btn-icon {
  width: 12px;
  height: 12px;
}

/* Import photos overlay */
.import-photos-overlay {
  position: fixed;
  inset: 0;
  z-index: 1100;
  background: rgba(0, 0, 0, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  pointer-events: auto;
}
.import-photos-overlay[hidden] {
  display: none !important;
}
.import-photos-modal {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  max-width: 560px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow);
}
.import-photos-title {
  margin: 0 0 0.5rem;
  font-size: 1.1rem;
  font-weight: 600;
}
.import-photos-hint {
  margin: 0 0 1rem;
  font-size: 0.85rem;
  color: var(--text-muted);
}
.import-photos-drop-zone {
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 2rem;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
  margin-bottom: 1rem;
}
.import-photos-drop-zone:hover,
.import-photos-drop-zone.import-photos-drop-active {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 8%, var(--surface));
}
.import-photos-drop-text {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.9rem;
}
.import-photos-preview-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-bottom: 1rem;
  max-height: 180px;
  overflow-y: auto;
}
.import-photos-preview-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.25rem;
  position: relative;
}
.import-photos-preview-img {
  width: 64px;
  height: 64px;
  object-fit: cover;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}
.import-photos-type-select {
  font-size: 0.75rem;
  padding: 0.2rem 0.4rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  max-width: 100px;
}
.import-photos-type-select.import-photos-type-missing {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 8%, var(--surface));
}
.btn-import-photos-remove {
  position: absolute;
  top: -4px;
  right: -4px;
  width: 20px;
  height: 20px;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: var(--surface-hover);
  color: var(--text);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}
.btn-import-photos-remove:hover {
  background: #c44;
  color: #fff;
}
.import-photos-validation-msg {
  margin: 0.5rem 0;
  font-size: 0.85rem;
  color: var(--accent);
}
.import-photos-auto-mode {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin: 0.75rem 0;
  font-size: 0.9rem;
  color: var(--text-muted);
  cursor: pointer;
}
.import-photos-auto-mode input {
  accent-color: var(--accent);
}
.import-photos-auto-mode:hover {
  color: var(--text);
}
.import-photos-pending-panel {
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}
.import-photos-pending-panel h4 {
  margin: 0 0 0.5rem;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-muted);
}
.import-photos-pending-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0;
  font-size: 0.85rem;
  border-bottom: 1px solid var(--border);
}
.import-photos-pending-item:last-child {
  border-bottom: none;
}
.import-photos-pending-status {
  color: var(--text-muted);
  min-width: 100px;
}
.import-photos-btns {
  display: flex;
  gap: 0.5rem;
  justify-content: flex-end;
  margin-top: 1rem;
}
.btn-import-photos-validate {
  padding: 0.5rem 1rem;
  font-size: 0.9rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  border: 1px solid var(--accent);
  background: var(--accent);
  color: var(--bg);
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}
.btn-import-photos-validate:hover:not(:disabled) {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
}
.btn-import-photos-validate:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
.btn-import-photos-close {
  padding: 0.5rem 1rem;
  font-size: 0.9rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
}

.photo-lightbox {
  position: fixed;
  inset: 0;
  z-index: 1200;
  background: rgba(0, 0, 0, 0.9);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
}
.photo-lightbox[hidden] {
  display: none !important;
}
.photo-lightbox img {
  max-width: 100%;
  max-height: 90vh;
  object-fit: contain;
}
.photo-lightbox-close {
  position: absolute;
  top: 1rem;
  right: 1rem;
  width: 40px;
  height: 40px;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}
.photo-lightbox-close:hover {
  background: var(--surface-hover);
}
.photo-badge-btn {
  display: inline-flex;
  align-items: center;
  padding: 0.2rem;
  border: none;
  background: transparent;
  color: var(--accent);
  cursor: pointer;
  border-radius: var(--radius-sm);
  margin-left: 0.15rem;
}
.photo-badge-btn:hover {
  background: var(--surface-hover);
}
.photo-badge-btn .wine-info-icon {
  width: 0.9rem;
  height: 0.9rem;
}
.photo-badge-ok {
  color: #4ade80;
}
.photo-badge-ok:hover {
  color: #86efac;
}
.photo-badge-warning {
  color: var(--accent);
}
.btn-photos {
  padding: 0.2rem;
  border: none;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  border-radius: var(--radius-sm);
  margin-left: 0.15rem;
}
.btn-photos:hover {
  color: var(--accent);
  background: var(--surface-hover);
}
.btn-photos .btn-icon {
  width: 1rem;
  height: 1rem;
}

/* Vision OCR modal */
.btn-vision {
  padding: 0.2rem;
  border: none;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  border-radius: var(--radius-sm);
  margin-left: 0.15rem;
}
.btn-vision:hover {
  color: var(--accent);
  background: var(--surface-hover);
}
.btn-vision .btn-icon,
.btn-vision-auto .btn-icon {
  width: 1rem;
  height: 1rem;
}
.btn-vision-auto {
  padding: 0.2rem;
  border: none;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  border-radius: var(--radius-sm);
}
.btn-vision-auto:hover:not(:disabled) {
  color: var(--accent);
  background: var(--surface-hover);
}
.btn-vision-auto:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
.btn-vision-auto.loading {
  color: var(--accent);
}
.btn-vision-auto.not_found {
  color: var(--accent);
}
.btn-vision-auto.not_found .btn-icon {
  color: var(--accent);
}
.btn-vision-auto.error {
  color: var(--text-muted);
}
.icon-spin {
  animation: icon-spin 0.8s linear infinite;
}
@keyframes icon-spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}
/* Replace wine modal */
.replace-wine-overlay {
  position: fixed;
  inset: 0;
  z-index: 1100;
  background: rgba(0, 0, 0, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}
.replace-wine-overlay[hidden] {
  display: none !important;
}
.replace-wine-modal {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  max-width: 720px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow);
}
.replace-wine-title {
  margin: 0 0 1rem;
  font-size: 1rem;
}
.replace-wine-content {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) minmax(280px, 1.5fr);
  gap: 1.5rem;
  align-items: start;
}
.replace-wine-photos {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.replace-wine-photo-main {
  aspect-ratio: 3/4;
  max-height: 280px;
  background: var(--bg);
  border-radius: var(--radius-sm);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}
.replace-wine-photo-main img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}
.replace-wine-no-photo {
  color: var(--text-muted);
  font-size: 0.85rem;
}
.replace-wine-photo-thumbs {
  display: flex;
  gap: 0.25rem;
  flex-wrap: wrap;
}
.replace-wine-photo-thumbs img {
  width: 48px;
  height: 48px;
  object-fit: cover;
  border-radius: 4px;
  cursor: pointer;
  border: 2px solid transparent;
}
.replace-wine-photo-thumbs img:hover {
  border-color: var(--accent);
}
.replace-wine-search {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  min-width: 0;
}
.replace-wine-hint {
  margin: 0;
  font-size: 0.9rem;
  color: var(--text-muted);
}
.replace-wine-search-wrapper {
  position: relative;
}
.replace-wine-search-wrapper input {
  width: 100%;
  padding: 0.5rem 2rem 0.5rem 0.75rem;
  font-size: 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
}
.replace-wine-search-wrapper input:focus {
  outline: none;
  border-color: var(--accent);
}
.replace-wine-search-icon {
  position: absolute;
  right: 0.75rem;
  top: 50%;
  transform: translateY(-50%);
  width: 1rem;
  height: 1rem;
  color: var(--text-muted);
  pointer-events: none;
}
.replace-wine-suggestions {
  max-height: 280px;
  overflow-y: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg);
}
.replace-wine-suggestions .suggestion-item {
  padding: 0.5rem 0.75rem;
  cursor: pointer;
  border-bottom: 1px solid var(--border);
}
.replace-wine-suggestions .suggestion-item:last-child {
  border-bottom: none;
}
.replace-wine-suggestions .suggestion-item:hover {
  background: var(--surface-hover);
}
.replace-wine-suggestions .suggestion-manual {
  padding: 0.5rem 0.75rem;
  border-top: 1px solid var(--border);
}
.replace-wine-btns {
  margin-top: 1rem;
  display: flex;
  justify-content: flex-end;
}
.btn-replace-wine-cancel {
  padding: 0.4rem 0.8rem;
  font-size: 0.9rem;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  border-radius: var(--radius-sm);
  cursor: pointer;
}
.btn-replace-wine-cancel:hover {
  background: var(--surface-hover);
}
@media (max-width: 600px) {
  .replace-wine-content {
    grid-template-columns: 1fr;
  }
}

.vision-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 1rem;
}
.vision-overlay[hidden] {
  display: none !important;
}
.vision-modal {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  max-width: 480px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
}
.vision-modal-title {
  margin: 0 0 1rem;
  font-size: 1rem;
}
.vision-preview-section {
  margin-bottom: 1rem;
}
.vision-step-badge {
  display: inline-block;
  margin: 0 0 0.5rem;
  padding: 0.15rem 0.5rem;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--bg);
  background: var(--accent);
  border-radius: 4px;
}
.vision-step-badge.vision-step-2 {
  margin-top: 1rem;
  margin-bottom: 0.5rem;
}
.vision-preview-hint {
  margin: 0 0 0.5rem;
  font-size: 0.85rem;
  color: var(--text-muted);
}
.vision-preview-img {
  max-width: 100%;
  max-height: 280px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}
.vision-result-section {
  margin-bottom: 1rem;
}
.vision-result-meta {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
}
.vision-result-label {
  display: block;
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 0.25rem;
}
.vision-result-text {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.75rem;
  font-size: 0.9rem;
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 200px;
  overflow-y: auto;
  margin: 0 0 0.5rem;
}
.btn-vision-copy {
  padding: 0.35rem 0.75rem;
  font-size: 0.85rem;
  background: var(--surface-hover);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}
.btn-vision-copy:hover {
  background: var(--border);
}
.btn-vision-toggle-bounds {
  margin-top: 0.5rem;
  padding: 0.35rem 0.75rem;
  font-size: 0.85rem;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}
.btn-vision-toggle-bounds:hover {
  color: var(--text);
  background: var(--surface-hover);
}
.btn-vision-match {
  margin-top: 0.75rem;
  padding: 0.5rem 1rem;
  font-size: 0.9rem;
  background: var(--accent);
  color: var(--bg);
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}
.btn-vision-match:hover {
  background: var(--accent-hover);
}
.btn-vision-match:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}
.vision-match-section {
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}
.vision-match-loading {
  color: var(--text-muted);
  font-style: italic;
}
.vision-match-summary {
  margin-bottom: 0.75rem;
  font-size: 0.95rem;
}
.vision-match-details {
  margin-bottom: 0.75rem;
  font-size: 0.85rem;
  color: var(--text-muted);
}
.vision-match-details summary {
  cursor: pointer;
}
.vision-match-details ul {
  margin: 0.25rem 0 0 1rem;
  padding-left: 0.5rem;
}
.vision-match-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-top: 0.5rem;
}
.vision-match-extracted,
.vision-match-corrections {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin: 0 0 0.5rem;
}
.vision-match-notes {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin: 0.25rem 0 0;
}
.vision-match-proposal {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.75rem;
  margin-top: 0.5rem;
}
.vision-match-wine {
  font-weight: 600;
  margin: 0 0 0.25rem;
}
.vision-match-meta {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin: 0 0 0.25rem;
}
.vision-match-reason {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin: 0 0 0.5rem;
  font-style: italic;
}
.vision-match-conf {
  font-size: 0.8rem;
  color: var(--accent);
  margin-right: 0.5rem;
}
.btn-vision-add-match {
  padding: 0.35rem 0.75rem;
  font-size: 0.85rem;
  background: var(--accent);
  color: var(--bg);
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  margin-top: 0.25rem;
}
.btn-vision-add-match:hover {
  background: var(--accent-hover);
}
.vision-match-empty,
.vision-match-error {
  color: var(--text-muted);
  margin: 0.5rem 0 0;
}
.vision-match-error {
  color: #e88;
}
.vision-match-candidates {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin: 0.25rem 0 0;
}
.vision-bounds-section {
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}
.vision-bounds-content {
  max-height: 180px;
  overflow-y: auto;
  font-size: 0.85rem;
}
.vision-bound-item {
  padding: 0.25rem 0;
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
  flex-wrap: wrap;
}
.vision-bound-num {
  color: var(--text-muted);
  min-width: 1.5rem;
}
.vision-bound-text {
  flex: 1;
  word-break: break-word;
}
.vision-bound-pos {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-family: monospace;
}
.vision-bound-more {
  padding: 0.25rem 0;
  font-size: 0.8rem;
  color: var(--text-muted);
}
.vision-error-section {
  margin-bottom: 1rem;
  padding: 1rem;
  background: rgba(200, 80, 80, 0.15);
  border: 1px solid rgba(200, 80, 80, 0.4);
  border-radius: var(--radius-sm);
}
.vision-error-label {
  margin: 0 0 0.5rem;
  font-size: 0.9rem;
  font-weight: 600;
  color: #e88;
}
.vision-error-text {
  margin: 0 0 0.75rem;
  font-size: 0.85rem;
  color: var(--text);
  white-space: pre-wrap;
  word-break: break-word;
}
.btn-vision-retry {
  padding: 0.35rem 0.75rem;
  font-size: 0.85rem;
  background: var(--surface-hover);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}
.btn-vision-retry:hover {
  background: var(--border);
}
.vision-loading {
  padding: 2rem;
  text-align: center;
  color: var(--text-muted);
  min-height: 4rem;
  display: flex;
  align-items: center;
  justify-content: center;
}
.vision-modal-btns {
  display: flex;
  gap: 0.5rem;
  justify-content: flex-end;
}
.vision-modal-btns button[hidden] {
  display: none !important;
}
.btn-vision-reset {
  margin-right: auto;
  color: var(--text-muted);
}
.btn-vision-reset:hover {
  color: var(--text);
}
.btn-vision-cancel,
.btn-vision-send {
  padding: 0.5rem 1rem;
  font-size: 0.9rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}
.btn-vision-cancel:hover,
.btn-vision-send:hover {
  background: var(--surface-hover);
}
.btn-vision-send {
  background: var(--accent);
  color: var(--bg);
  border-color: var(--accent);
}
.btn-vision-send:hover {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
}
.btn-vision-send:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}
