/* === TOKENS === */
:root {
  --red: #b42921;
  --red-hover: #9a2019;
  --red-light: #fdf4f3;
  --red-border: #e8a09b;
  --near-black: #171717;
  --grey-bg: #f4f4f4;
  --grey-mid: #e0e0e0;
  --grey-text: #6b7280;
  --white: #ffffff;
  --radius: 12px;
  --radius-sm: 8px;
  --left-w: 420px;
}

/* === RESET === */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: system-ui, -apple-system, 'Segoe UI', sans-serif;
  background: var(--grey-bg);
  color: var(--near-black);
  font-size: 14px;
  line-height: 1.5;
  height: 100vh;
  overflow: hidden;
}

/* === HEADER === */
.header {
  background: var(--near-black);
  color: #fff;
  padding: 0 20px;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
  z-index: 200;
  position: relative;
}
.header-left { display: flex; align-items: center; gap: 10px; }
.rdw-circle {
  width: 36px; height: 36px; border-radius: 50%;
  background: var(--red); color: #fff;
  font-weight: 800; font-size: 11px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.header-brand { display: flex; flex-direction: column; line-height: 1.1; }
.header-brand strong { font-size: 14px; font-weight: 700; }
.header-brand span { font-size: 11px; color: rgba(255,255,255,.55); }
.header-right { display: flex; align-items: center; gap: 10px; }
.model-pill {
  font-size: 11px; padding: 3px 10px; border-radius: 20px;
  background: rgba(255,255,255,.1); border: 1px solid rgba(255,255,255,.2);
  color: rgba(255,255,255,.75);
}
.version-pill {
  font-size: 10px; font-weight: 700; padding: 2px 8px; border-radius: 20px;
  background: var(--red); color: #fff; letter-spacing: 0.04em;
}
.btn-settings {
  background: none; border: 1px solid rgba(255,255,255,.25);
  color: rgba(255,255,255,.8); width: 34px; height: 34px;
  border-radius: 8px; cursor: pointer; font-size: 16px;
  display: flex; align-items: center; justify-content: center; transition: all .15s;
}
.btn-settings:hover { background: rgba(255,255,255,.1); color: #fff; }

/* === LAYOUT === */
.layout { display: flex; height: calc(100vh - 56px); overflow: hidden; }

/* === DRAG HANDLE === */
.split-handle {
  width: 5px; flex-shrink: 0; cursor: col-resize;
  background: transparent; transition: background .15s;
  position: relative; z-index: 10;
}
.split-handle:hover, .split-handle.dragging { background: var(--red); }
.split-handle::after {
  content: ''; position: absolute; top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  width: 3px; height: 32px; border-radius: 3px;
  background: var(--grey-mid); pointer-events: none;
}
.split-handle:hover::after, .split-handle.dragging::after { background: var(--red); }

/* === LEFT PANEL === */
.left {
  width: var(--left-w); flex-shrink: 0;
  background: var(--white);
  display: flex; flex-direction: column; overflow: hidden;
}
.left-scroll { flex: 1; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 18px; }
.section-label { font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .8px; color: var(--grey-text); margin-bottom: 8px; }

/* === SCAN WITH AI === */
.scan-banner {
  background: linear-gradient(135deg, #171717 0%, #2a2a2a 100%);
  border-radius: var(--radius-sm); padding: 14px;
  display: flex; flex-direction: column; gap: 10px;
}
.scan-title { font-size: 13px; font-weight: 700; color: #fff; display: flex; align-items: center; gap: 6px; }
.scan-sub { font-size: 11px; color: rgba(255,255,255,.5); }
.scan-textarea {
  width: 100%; padding: 9px 10px;
  background: rgba(255,255,255,.08); border: 1.5px solid rgba(255,255,255,.2);
  border-radius: 8px; color: #fff; font-size: 12px; font-family: inherit;
  line-height: 1.5; resize: none; min-height: 72px; outline: none; transition: border-color .15s;
}
.scan-textarea::placeholder { color: rgba(255,255,255,.35); }
.scan-textarea:focus { border-color: rgba(255,255,255,.5); }
.scan-or { display: flex; align-items: center; gap: 8px; color: rgba(255,255,255,.3); font-size: 11px; font-weight: 600; }
.scan-or::before, .scan-or::after { content: ''; flex: 1; height: 1px; background: rgba(255,255,255,.15); }
.scan-upload-area {
  border: 1.5px dashed rgba(255,255,255,.2); border-radius: 8px;
  padding: 11px; text-align: center; cursor: pointer; transition: border-color .15s;
  background: rgba(255,255,255,.04);
}
.scan-upload-area:hover { border-color: rgba(255,255,255,.45); background: rgba(255,255,255,.07); }
.scan-upload-area.has-image { border-style: solid; border-color: rgba(255,255,255,.3); }
.scan-upload-text { font-size: 11px; color: rgba(255,255,255,.5); }
.scan-upload-text strong { color: rgba(255,255,255,.85); }
.btn-scan {
  width: 100%; padding: 9px; background: var(--red); color: #fff;
  border: none; border-radius: 8px; font-size: 13px; font-weight: 700;
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  gap: 7px; transition: background .15s;
}
.btn-scan:hover { background: var(--red-hover); }
.btn-scan:disabled { opacity: .45; cursor: not-allowed; }
.scan-thumbnails {
  display: flex; flex-wrap: wrap; gap: 6px; padding: 4px 0; min-height: 0;
}
.scan-thumb {
  position: relative; width: 56px; height: 56px; border-radius: 6px;
  overflow: hidden; flex-shrink: 0; background: rgba(255,255,255,.1);
  display: flex; align-items: center; justify-content: center;
}
.scan-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.scan-thumb-pdf { font-size: 22px; }
.scan-thumb-remove {
  position: absolute; top: 3px; right: 3px; width: 16px; height: 16px;
  border-radius: 50%; background: rgba(0,0,0,.72); color: #fff; border: none;
  cursor: pointer; font-size: 12px; line-height: 1; padding: 0;
  display: flex; align-items: center; justify-content: center;
}
.scan-thumb-remove:hover { background: var(--red); }
.scan-thumb-add {
  width: 56px; height: 56px; border-radius: 6px; flex-shrink: 0;
  border: 1.5px dashed rgba(255,255,255,.3);
  display: flex; align-items: center; justify-content: center;
  color: rgba(255,255,255,.45); font-size: 22px; cursor: pointer;
}
.scan-thumb-add:hover { border-color: rgba(255,255,255,.6); color: rgba(255,255,255,.8); }
.scan-hint { font-size: 10px; color: rgba(255,255,255,.35); text-align: center; }

/* === TEMPLATE TABS === */
.template-tabs { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 4px; scrollbar-width: none; }
.template-tabs::-webkit-scrollbar { display: none; }
.tab {
  flex-shrink: 0; display: flex; flex-direction: column; align-items: center; gap: 4px;
  padding: 10px 14px; border: 2px solid var(--grey-mid); border-radius: 10px;
  cursor: pointer; transition: all .15s; min-width: 82px; text-align: center;
  background: #fff; position: relative;
}
.tab:hover { border-color: var(--red-border); background: var(--red-light); }
.tab.active { border-color: var(--red); background: var(--red-light); }
.tab.coming { opacity: .4; cursor: default; }
.tab.coming:hover { border-color: var(--grey-mid); background: #fff; }
.tab-icon { font-size: 18px; }
.tab-name { font-size: 11px; font-weight: 600; }
.tab-badge {
  font-size: 9px; background: var(--grey-mid); color: var(--grey-text);
  padding: 1px 5px; border-radius: 4px; position: absolute; top: -8px; right: -4px;
}

/* === FORMS === */
.form-panel { display: none; flex-direction: column; gap: 12px; }
.form-panel.active { display: flex; }
.field { display: flex; flex-direction: column; gap: 4px; }
.field label { font-size: 12px; font-weight: 600; }
.req { color: var(--red); }
.opt { font-weight: 400; color: var(--grey-text); font-size: 11px; }
.field input, .field select, .field textarea {
  width: 100%; padding: 8px 10px; border: 1.5px solid var(--grey-mid);
  border-radius: var(--radius-sm); font-size: 13px; font-family: inherit;
  color: var(--near-black); background: #fff; outline: none;
  transition: border-color .15s, background .3s;
}
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--red); }
.field textarea { resize: vertical; min-height: 80px; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.field-autofilled input, .field-autofilled textarea {
  border-color: #22c55e !important;
  background: #f0fdf4 !important;
}

/* === STYLE CHIPS === */
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  padding: 5px 11px; border-radius: 20px;
  border: 1.5px solid var(--grey-mid); font-size: 12px; font-weight: 500;
  cursor: pointer; transition: all .15s; background: #fff; user-select: none;
}
.chip:hover { border-color: var(--red-border); background: var(--red-light); }
.chip.selected { border-color: var(--red); background: var(--red-light); color: var(--red); font-weight: 600; }
.chip.chip-inserted { background: var(--red); color: #fff; border-color: var(--red); transform: scale(0.94); transition: all 0.15s; }

/* === FORMAT === */
.formats { display: flex; flex-direction: column; gap: 6px; }
.format-opt {
  display: flex; align-items: center; gap: 10px; padding: 8px 10px;
  border: 1.5px solid var(--grey-mid); border-radius: var(--radius-sm);
  cursor: pointer; transition: all .15s; background: #fff;
}
.format-opt:hover { border-color: var(--red-border); }
.format-opt.selected { border-color: var(--red); background: var(--red-light); }
.format-opt input[type=radio] { accent-color: var(--red); width: 14px; height: 14px; flex-shrink: 0; }
.format-info { flex: 1; }
.format-name { font-size: 12px; font-weight: 600; }
.format-dim { font-size: 11px; color: var(--grey-text); }
.format-star { font-size: 11px; color: var(--red); font-weight: 700; margin-left: auto; }

/* === LEFT FOOTER (generate button) === */
.left-footer { padding: 12px 16px; border-top: 1px solid var(--grey-mid); }
.btn-gen {
  width: 100%; padding: 13px; background: var(--red); color: #fff;
  border: none; border-radius: 14px; font-size: 15px; font-weight: 700;
  cursor: pointer; transition: background .15s;
}
.btn-gen:hover { background: var(--red-hover); }
.btn-gen:disabled { opacity: .5; cursor: not-allowed; }

/* === RIGHT PANEL === */
.right { flex: 1; overflow-y: auto; padding: 20px; display: flex; flex-direction: column; gap: 16px; }
.state { display: none; }
.state.visible { display: flex; }
.empty-state {
  flex-direction: column; align-items: center; justify-content: center;
  height: 100%; min-height: 400px; gap: 12px; color: var(--grey-text);
}
.empty-icon { font-size: 52px; }
.empty-title { font-size: 15px; font-weight: 600; color: var(--near-black); }
.empty-sub { font-size: 13px; }
.loading-state {
  flex-direction: column; align-items: center; justify-content: center;
  height: 100%; min-height: 400px; gap: 14px;
}
.spinner {
  width: 44px; height: 44px; border: 4px solid var(--grey-mid);
  border-top-color: var(--red); border-radius: 50%;
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.loading-title { font-weight: 600; font-size: 15px; }
.loading-elapsed { font-size: 13px; color: var(--grey-text); font-variant-numeric: tabular-nums; }
.loading-format {
  font-size: 12px; color: var(--grey-text); background: var(--grey-bg);
  padding: 4px 12px; border-radius: 20px;
}
.result-state { flex-direction: column; gap: 14px; }
.result-card { background: #fff; border-radius: var(--radius); overflow: hidden; box-shadow: 0 2px 12px rgba(0,0,0,.09); }
.result-img-wrap {
  background: #f0f0ee; display: flex; align-items: center;
  justify-content: center; min-height: 200px; padding: 20px;
}
.result-img-wrap img { max-width: 100%; max-height: 70vh; display: block; object-fit: contain; }
.result-actions {
  padding: 12px 16px; display: flex; align-items: center; gap: 8px;
  border-top: 1px solid var(--grey-mid);
}
.result-format-label { font-size: 12px; color: var(--grey-text); flex: 1; }
.btn-sec {
  padding: 7px 14px; border: 1.5px solid var(--grey-mid); background: #fff;
  color: var(--near-black); border-radius: 8px; font-size: 12px; font-weight: 600;
  cursor: pointer; transition: all .15s;
}
.btn-sec:hover { border-color: var(--red); color: var(--red); background: var(--red-light); }

/* === RESIZE ACCORDION === */
.resize-card { background: #fff; border-radius: var(--radius); border: 1px solid var(--grey-mid); overflow: hidden; }
.resize-header { padding: 12px 16px; display: flex; align-items: center; justify-content: space-between; cursor: pointer; }
.resize-header.open { border-bottom: 1px solid var(--grey-mid); }
.resize-title { font-weight: 700; font-size: 13px; }
.resize-sub { font-size: 11px; color: var(--grey-text); }
.resize-chev { font-size: 18px; color: var(--grey-text); transition: transform .2s; line-height: 1; }
.resize-body { display: none; padding: 14px 16px; flex-direction: column; gap: 10px; }
.resize-body.open { display: flex; }
.resize-opts { display: flex; flex-wrap: wrap; gap: 8px; }
.resize-opt {
  display: flex; align-items: center; gap: 7px; padding: 7px 12px;
  border: 1.5px solid var(--grey-mid); border-radius: 8px; cursor: pointer;
  transition: all .15s; background: #fff;
}
.resize-opt:hover { border-color: var(--red-border); }
.resize-opt input[type=checkbox] { accent-color: var(--red); width: 14px; height: 14px; }
.resize-opt-name { font-size: 12px; font-weight: 600; }
.resize-opt-dim { font-size: 10px; color: var(--grey-text); }
.btn-resize {
  padding: 9px 18px; background: var(--near-black); color: #fff;
  border: none; border-radius: 8px; font-size: 13px; font-weight: 700;
  cursor: pointer; align-self: flex-start; transition: background .15s;
}
.btn-resize:hover { background: #333; }
.btn-resize:disabled { opacity: .5; cursor: not-allowed; }

/* === PROMPT PREVIEW === */
.prompt-card { background: #fff; border: 1px solid var(--grey-mid); border-radius: var(--radius); overflow: hidden; }
.prompt-toggle {
  padding: 10px 16px; font-size: 12px; font-weight: 600; color: var(--grey-text);
  cursor: pointer; display: flex; align-items: center; justify-content: space-between;
}
.prompt-toggle:hover { color: var(--near-black); }
.prompt-body {
  display: none; padding: 12px 16px; border-top: 1px solid var(--grey-mid);
  font-size: 11px; line-height: 1.7; color: var(--near-black);
  white-space: pre-wrap; word-break: break-word;
  max-height: 200px; overflow-y: auto; background: #fafafa; font-family: monospace;
}
.prompt-body.open { display: block; }

/* === HISTORY === */
.history-wrap { display: flex; flex-direction: column; gap: 8px; }
.history-label { font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .8px; color: var(--grey-text); }
.history-strip { display: flex; gap: 8px; flex-wrap: wrap; }
.h-thumb { width: 60px; height: 60px; border-radius: 8px; border: 2px solid transparent; overflow: hidden; cursor: pointer; transition: border-color .15s; }
.h-thumb:hover { border-color: var(--red); }
.h-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }

/* === BRAND SETTINGS DRAWER === */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,.5);
  z-index: 400; display: none; align-items: flex-start; justify-content: flex-end;
}
.modal-overlay.open { display: flex; }
.brand-drawer {
  width: 480px; height: 100%; background: #fff;
  display: flex; flex-direction: column;
  box-shadow: -4px 0 24px rgba(0,0,0,.15);
  animation: slideIn .2s ease;
}
@keyframes slideIn { from { transform: translateX(100%); } to { transform: translateX(0); } }
.drawer-header {
  padding: 16px 20px; border-bottom: 1px solid var(--grey-mid);
  display: flex; align-items: center; justify-content: space-between; flex-shrink: 0;
}
.drawer-title { font-size: 16px; font-weight: 700; }
.drawer-sub { font-size: 11px; color: var(--grey-text); margin-top: 2px; }
.btn-close {
  background: none; border: none; font-size: 20px; cursor: pointer;
  color: var(--grey-text); width: 32px; height: 32px;
  display: flex; align-items: center; justify-content: center; border-radius: 6px;
}
.btn-close:hover { background: var(--grey-bg); color: var(--near-black); }
.drawer-body { flex: 1; overflow-y: auto; padding: 20px; display: flex; flex-direction: column; gap: 24px; }
.drawer-section { display: flex; flex-direction: column; gap: 12px; }
.drawer-section-title {
  font-size: 12px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .7px; color: var(--grey-text);
  border-bottom: 1px solid var(--grey-mid); padding-bottom: 6px;
}
.color-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.color-field {
  display: flex; align-items: center; gap: 8px; padding: 8px 10px;
  border: 1.5px solid var(--grey-mid); border-radius: var(--radius-sm); background: #fff;
}
.color-swatch { width: 28px; height: 28px; border-radius: 6px; border: 1px solid rgba(0,0,0,.1); flex-shrink: 0; }
.color-field-info { display: flex; flex-direction: column; flex: 1; min-width: 0; }
.color-label { font-size: 11px; font-weight: 600; white-space: nowrap; }
.color-hex-input {
  font-size: 12px; color: var(--grey-text); font-family: monospace;
  border: none; outline: none; padding: 0; background: transparent;
  width: 100%;
}
.color-hex-input:focus { color: var(--near-black); }
.tag-list { display: flex; flex-wrap: wrap; gap: 6px; }
.brand-tag {
  padding: 5px 10px; border-radius: 20px;
  border: 1.5px solid var(--grey-mid); font-size: 12px; font-weight: 500; background: #fff;
}
.brand-tag.positive { border-color: #22c55e; background: #f0fdf4; color: #166534; }
.rule-list { display: flex; flex-direction: column; gap: 6px; }
.rule-item { display: flex; align-items: flex-start; gap: 8px; font-size: 12px; padding: 7px 10px; border-radius: var(--radius-sm); background: var(--grey-bg); }
.rule-item-icon { font-size: 14px; flex-shrink: 0; margin-top: 1px; }
.drawer-footer {
  padding: 16px 20px; border-top: 1px solid var(--grey-mid);
  display: flex; gap: 10px; align-items: center; flex-shrink: 0;
}
.btn-save {
  flex: 1; padding: 11px; background: var(--red); color: #fff;
  border: none; border-radius: 10px; font-size: 14px; font-weight: 700;
  cursor: pointer; transition: background .15s;
}
.btn-save:hover { background: var(--red-hover); }
.btn-cancel {
  padding: 11px 18px; border: 1.5px solid var(--grey-mid); background: #fff;
  border-radius: 10px; font-size: 14px; font-weight: 600; cursor: pointer;
}
.btn-cancel:hover { border-color: var(--near-black); }
.saved-badge { font-size: 11px; color: #22c55e; font-weight: 600; display: none; align-items: center; gap: 4px; }
.saved-badge.show { display: flex; }

/* === TOAST === */
.toast {
  position: fixed; bottom: 24px; left: 50%;
  transform: translateX(-50%) translateY(80px);
  background: var(--near-black); color: #fff;
  padding: 10px 20px; border-radius: 20px; font-size: 13px; font-weight: 600;
  z-index: 500; transition: transform .3s ease;
  display: flex; align-items: center; gap: 8px;
  white-space: nowrap; pointer-events: none;
}
.toast.show { transform: translateX(-50%) translateY(0); }

/* Logo upload */
.logo-upload-wrap { display:flex; flex-direction:column; gap:8px; }
#logoPreviewImg { max-height:64px; max-width:200px; object-fit:contain; border-radius:6px; border:1px solid var(--grey-mid); background:#fff; padding:4px; }
.btn-logo-remove { font-size:11px; color:var(--grey-text); background:none; border:1px solid var(--grey-mid); border-radius:4px; padding:2px 8px; cursor:pointer; }
.btn-logo-remove:hover { color:#c0392b; border-color:#c0392b; }
.logo-upload-hint { font-size:12px; color:var(--grey-text); }
.btn-logo-upload { font-size:12px; padding:6px 14px; }
.logo-toggle-label { display:flex; align-items:center; gap:8px; font-size:13px; cursor:pointer; }
.logo-toggle-label input[type=checkbox] { width:15px; height:15px; cursor:pointer; }

/* Edit bar */
.edit-bar { display:flex; flex-direction:column; gap:8px; padding:12px 0 0; border-top:1px solid var(--grey-mid); margin-top:12px; }
.edit-textarea { width:100%; resize:vertical; font-family:inherit; font-size:13px; padding:8px 10px; border:1.5px solid var(--grey-mid); border-radius:8px; background:#fff; color:var(--near-black); min-height:56px; box-sizing:border-box; }
.edit-textarea:focus { outline:none; border-color:var(--red); }
.btn-refine { align-self:flex-end; background:var(--red); color:#fff; border:none; border-radius:8px; padding:8px 18px; font-size:13px; font-weight:600; cursor:pointer; }
.btn-refine:hover { background:var(--red-hover); }
.btn-refine:disabled { opacity:0.5; cursor:not-allowed; }
.edit-error { font-size:12px; color:#b42921; background:#fff0f0; border:1px solid #f5c2c2; border-radius:6px; padding:7px 10px; }

/* Before/after compare bar */
.compare-bar { display:flex; align-items:center; gap:8px; padding:8px 0 4px; }
.compare-label { font-size:12px; color:var(--grey-text); }
.compare-btn { font-size:12px; padding:4px 12px; border-radius:20px; border:1.5px solid var(--grey-mid); background:#fff; color:var(--grey-text); cursor:pointer; font-weight:500; transition:all .15s; }
.compare-btn.active { background:var(--near-black); color:#fff; border-color:var(--near-black); }
.compare-btn:not(.active):hover { border-color:var(--near-black); color:var(--near-black); }

/* Social Proof form */
.social-testimonial-block { border:1px solid var(--grey-mid); border-radius:8px; padding:10px 12px; background:var(--white); }

/* Carousel toggle */
.carousel-row { display:flex; align-items:center; gap:10px; padding:10px 0 0; }
.carousel-toggle-label { display:flex; align-items:center; gap:7px; font-size:13px; cursor:pointer; }
.carousel-toggle-label input[type=checkbox] { width:15px; height:15px; cursor:pointer; }
#carouselSlides { font-size:12px; border:1px solid var(--grey-mid); border-radius:6px; padding:4px 8px; background:#fff; color:var(--near-black); }
#carouselSlides:disabled { opacity:0.4; cursor:not-allowed; }

/* Slide instructions panel */
#slideInstructionsPanel { margin-top:12px; padding-top:12px; border-top:1px dashed var(--grey-mid); }
.slide-instr-header { display:flex; align-items:center; justify-content:space-between; margin-bottom:3px; }
.slide-instr-title { font-size:11px; font-weight:700; text-transform:uppercase; letter-spacing:.06em; color:var(--grey-text); }
.btn-suggest-all { font-size:11px; padding:3px 10px; border-radius:20px; border:1.5px solid var(--grey-mid); background:#fff; color:var(--grey-text); cursor:pointer; font-weight:500; transition:all .15s; }
.btn-suggest-all:hover { border-color:var(--red); color:var(--red); }
.slide-instr-hint { font-size:11px; color:var(--grey-text); margin:0 0 8px; }
.slide-instr-row { display:flex; align-items:flex-start; gap:7px; margin-bottom:6px; }
.slide-instr-badge { display:flex; flex-direction:column; align-items:center; min-width:52px; background:var(--red); color:#fff; font-size:10px; font-weight:700; border-radius:6px; padding:3px 6px; line-height:1.3; flex-shrink:0; }
.slide-instr-wine { font-size:9px; font-weight:400; opacity:.85; max-width:46px; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.slide-instr-input { flex:1; font-size:12px; font-family:inherit; border:1px solid var(--grey-mid); border-radius:6px; padding:6px 9px; color:var(--near-black); background:#fff; min-width:0; transition:border-color .15s; resize:none; overflow:hidden; line-height:1.45; min-height:36px; }
.slide-instr-input:focus { outline:none; border-color:var(--red); }
.slide-instr-input:disabled { background:var(--grey-bg); color:var(--grey-text); font-style:italic; }
.btn-slide-resuggest { background:none; border:none; font-size:14px; cursor:pointer; opacity:.5; padding:2px 4px; transition:opacity .15s, transform .15s; flex-shrink:0; }
.btn-slide-resuggest:hover:not(:disabled) { opacity:1; transform:scale(1.2); }
.btn-slide-resuggest:disabled { cursor:default; }

/* Carousel result state */
.carousel-state { flex-direction:column; gap:16px; width:100%; }
.carousel-preview-wrap { display:flex; flex-direction:column; gap:12px; align-items:center; width:100%; }
.carousel-main img { max-width:100%; max-height:480px; border-radius:10px; box-shadow:0 4px 24px rgba(0,0,0,.18); object-fit:contain; }
.carousel-strip { display:flex; gap:8px; flex-wrap:wrap; justify-content:center; }
.carousel-thumb { position:relative; cursor:pointer; border-radius:6px; overflow:hidden; border:2px solid transparent; transition:border-color .15s; }
.carousel-thumb img { width:72px; height:72px; object-fit:cover; display:block; }
.carousel-thumb.active { border-color:var(--red); }
.carousel-thumb .slide-num { position:absolute; bottom:3px; right:5px; font-size:10px; font-weight:700; color:#fff; text-shadow:0 1px 3px rgba(0,0,0,.7); }

/* Thumbnail checkbox (Option B) */
.thumb-check-wrap { position:absolute; top:4px; left:4px; z-index:5; }
.thumb-check { width:14px; height:14px; cursor:pointer; accent-color:var(--red); }
.carousel-thumb:not(:hover) .thumb-check:not(:checked) { opacity:0; }
.carousel-thumb:hover .thumb-check, .thumb-check:checked { opacity:1; }

/* Carousel slide edit bar (Option A) */
.carousel-edit-bar { width:100%; padding:10px 0 2px; border-top:1px solid var(--grey-mid); }
.carousel-edit-label { font-size:11px; font-weight:700; text-transform:uppercase; letter-spacing:.06em; color:var(--grey-text); margin-bottom:6px; }
.carousel-edit-row { display:flex; gap:8px; align-items:flex-start; }
.carousel-edit-row .edit-textarea { flex:1; }
.carousel-edit-row .btn-refine { flex-shrink:0; align-self:flex-start; }

/* Regen selected bar (Option B) */
.carousel-regen-bar { width:100%; display:flex; align-items:center; gap:10px; padding:8px 12px; background:var(--grey-bg); border-radius:8px; border:1px solid var(--grey-mid); }
.regen-count { font-size:12px; color:var(--grey-text); flex:1; }
.btn-regen-selected { font-size:12px; padding:7px 16px; background:var(--near-black); color:#fff; border:none; border-radius:8px; cursor:pointer; font-weight:600; white-space:nowrap; }
.btn-regen-selected:hover:not(:disabled) { background:#333; }
.btn-regen-selected:disabled { opacity:0.5; cursor:not-allowed; }

/* Featured wines / product list */
.product-list-header { display:flex; align-items:center; justify-content:space-between; margin-bottom:6px; }
.product-list-hint { font-size:12px; color:var(--grey-text); line-height:1.5; margin-bottom:10px; }
.btn-add-product { font-size:12px; font-weight:600; color:var(--red); background:none; border:1.5px solid var(--red); border-radius:20px; padding:3px 12px; cursor:pointer; white-space:nowrap; transition:background .15s, color .15s; flex-shrink:0; }
.btn-add-product:hover { background:var(--red); color:#fff; }
.product-list { display:flex; flex-direction:column; gap:8px; }
.product-list-empty { font-size:12px; color:var(--grey-text); background:var(--grey-bg); border:1.5px dashed var(--grey-mid); border-radius:8px; padding:14px 16px; text-align:center; line-height:1.7; }
.product-row { display:flex; align-items:center; gap:8px; }
.product-photo-slot {
  width:56px; height:56px; border-radius:8px;
  border:1.5px dashed var(--grey-mid);
  flex-shrink:0; cursor:pointer;
  display:flex; align-items:center; justify-content:center;
  position:relative; overflow:hidden;
  background:#fafafa;
  transition:border-color .15s, background .15s;
}
.product-photo-slot:hover { border-color:var(--red); background:var(--red-light); }
.product-photo-slot img { width:100%; height:100%; object-fit:cover; display:block; }
.product-photo-icon { font-size:20px; pointer-events:none; }
.product-slide-badge {
  position:absolute; bottom:0; left:0; right:0;
  background:rgba(20,20,20,.72); color:#fff;
  font-size:9px; font-weight:700; text-align:center;
  padding:2px 0; pointer-events:none; letter-spacing:.3px;
}
.product-name-wrap { position:relative; flex:1; display:flex; align-items:center; }
.product-name-input {
  flex:1; border:1px solid var(--grey-mid); border-radius:6px;
  padding:9px 36px 9px 10px; font-size:13px;
  color:var(--near-black); background:#fff;
  transition:border-color .15s;
  width:100%;
}
.product-name-input:focus { outline:none; border-color:var(--red); box-shadow:0 0 0 2px rgba(180,41,33,.1); }
.product-name-input:disabled { color:var(--grey-text); background:var(--grey-bg); }
.btn-detect {
  position:absolute; right:6px;
  background:none; border:none; cursor:pointer;
  font-size:15px; line-height:1;
  padding:4px; border-radius:4px;
  opacity:0.55; transition:opacity .15s, transform .15s;
}
.btn-detect:hover:not(:disabled) { opacity:1; transform:scale(1.15); }
.btn-detect:disabled { cursor:default; }
.btn-detect.detecting { opacity:1; }
.product-remove-btn {
  width:28px; height:28px; border-radius:50%;
  background:none; border:1px solid var(--grey-mid);
  color:var(--grey-text); cursor:pointer; flex-shrink:0;
  font-size:15px; display:flex; align-items:center; justify-content:center;
  transition:background .15s, color .15s, border-color .15s;
}
.product-remove-btn:hover { background:var(--red); color:#fff; border-color:var(--red); }
#productListSection.field-autofilled { animation:autofill-flash .6s ease; }

/* === ARCHIVE PANEL === */
.btn-archive {
  background: none; border: none; color: rgba(255,255,255,.75);
  font-size: 18px; cursor: pointer; padding: 4px 6px;
  border-radius: var(--radius-sm); transition: color .15s, background .15s;
}
.btn-archive:hover { color: #fff; background: rgba(255,255,255,.1); }

.archive-overlay {
  display: none; position: fixed; inset: 0; z-index: 500;
  background: rgba(0,0,0,.55); backdrop-filter: blur(4px);
}
.archive-overlay.open { display: flex; align-items: stretch; }

.archive-panel {
  background: #fff; width: 100%; max-width: 1100px; margin: auto;
  border-radius: var(--radius); overflow: hidden;
  display: flex; flex-direction: column;
  max-height: 90vh; box-shadow: 0 24px 64px rgba(0,0,0,.25);
}

.archive-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 20px 24px 0; flex-shrink: 0; gap: 16px;
}
.archive-header-left { display: flex; flex-direction: column; gap: 12px; }
.archive-title { font-size: 18px; font-weight: 700; }
.archive-tabs { display: flex; gap: 4px; }
.archive-tab {
  background: none; border: none; padding: 6px 14px;
  border-radius: 20px; cursor: pointer; font-size: 13px; font-weight: 600;
  color: var(--grey-text); transition: background .15s, color .15s;
}
.archive-tab.active { background: var(--near-black); color: #fff; }
.archive-tab:not(.active):hover { background: var(--grey-bg); color: var(--near-black); }

.archive-body { flex: 1; overflow-y: auto; padding: 16px 24px 24px; }

.archive-toolbar {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 16px;
}
.archive-count { font-size: 12px; color: var(--grey-text); }
.btn-sm { font-size: 12px; padding: 4px 10px; }

.archive-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 12px;
}
.archive-empty { grid-column: 1/-1; text-align: center; color: var(--grey-text); padding: 60px 0; }

.archive-thumb {
  position: relative; border-radius: var(--radius-sm); overflow: hidden;
  background: var(--grey-bg); aspect-ratio: 1; cursor: pointer;
  box-shadow: 0 2px 8px rgba(0,0,0,.08); transition: transform .15s, box-shadow .15s;
}
.archive-thumb:hover { transform: translateY(-2px); box-shadow: 0 6px 20px rgba(0,0,0,.14); }
.archive-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.archive-thumb .thumb-meta {
  position: absolute; bottom: 0; left: 0; right: 0;
  background: linear-gradient(transparent, rgba(0,0,0,.7));
  color: #fff; font-size: 10px; padding: 20px 8px 6px;
  opacity: 0; transition: opacity .15s;
}
.archive-thumb:hover .thumb-meta { opacity: 1; }
.archive-thumb .thumb-delete {
  position: absolute; top: 6px; right: 6px;
  background: rgba(0,0,0,.55); border: none; color: #fff;
  border-radius: 50%; width: 26px; height: 26px; font-size: 13px;
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  opacity: 0; transition: opacity .15s, background .15s;
}
.archive-thumb:hover .thumb-delete { opacity: 1; }
.archive-thumb .thumb-delete:hover { background: var(--red); }

/* Log list */
.log-list { display: flex; flex-direction: column; gap: 6px; }
.log-entry {
  display: flex; align-items: flex-start; gap: 12px;
  padding: 10px 14px; background: var(--grey-bg);
  border-radius: var(--radius-sm); font-size: 12px;
}
.log-action {
  font-weight: 700; color: var(--near-black);
  min-width: 140px; flex-shrink: 0;
}
.log-who { color: var(--grey-text); flex: 1; min-width: 0; word-break: break-all; }
.log-time { color: var(--grey-text); flex-shrink: 0; white-space: nowrap; }

/* Lightbox */
.lightbox {
  position: fixed; inset: 0; z-index: 600; background: rgba(0,0,0,.85);
  display: flex; align-items: center; justify-content: center; flex-direction: column; gap: 12px;
}
.lightbox-close {
  position: fixed; top: 20px; right: 24px;
  background: rgba(255,255,255,.15); border: none; color: #fff;
  border-radius: 50%; width: 36px; height: 36px; font-size: 18px;
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  transition: background .15s;
}
.lightbox-close:hover { background: rgba(255,255,255,.25); }
.lightbox-img { max-width: 90vw; max-height: 80vh; border-radius: var(--radius); object-fit: contain; }
.lightbox-meta { color: rgba(255,255,255,.6); font-size: 12px; text-align: center; max-width: 600px; }
