/* Design tokens (STP UI–aligned structure, Andalus green primary). Component chrome: stp-ui-chrome.css */
:root {
  color-scheme: light;
  --font-size-xs: 0.75rem;
  --font-size-sm: 0.875rem;
  --font-size-md: 1rem;
  --font-size-lg: 1.125rem;
  --font-weight-medium: 500;
  --font-weight-semibold: 600;
  --font-weight-bold: 700;
  --line-height-tight: 1.25;
  --line-height-normal: 1.5;
  --space-xs: 4px;
  --space-sm: 8px;
  --space-md: 12px;
  --space-lg: 16px;
  --space-xl: 24px;
  --space-2xl: 32px;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-full: 999px;
  --shadow-sm: 0 1px 2px rgba(16, 24, 40, 0.05);
  --shadow-md: 0 2px 8px rgba(16, 24, 40, 0.06);
  --shadow-lg: 0 8px 24px rgba(16, 24, 40, 0.1);
  --transition-fast: 160ms cubic-bezier(0.2, 0.8, 0.2, 1);
  --transition-normal: 220ms cubic-bezier(0.2, 0.8, 0.2, 1);
  --transition-slow: 280ms cubic-bezier(0.2, 0.8, 0.2, 1);
  --z-sticky: 20;
  --z-modal: 120;
  --z-toast: 130;
  --bg: #f4f5f7;
  --surface: #ffffff;
  --surface-raised: #ffffff;
  --surface-muted: #eef0f3;
  --surface-hover: #e8ebef;
  --border: #e3e6eb;
  --border-strong: #cfd4dc;
  --text: #1a1d23;
  --text-secondary: #4a5563;
  --text-muted: #5c6570;
  --primary: #1f6b4a;
  --primary-hover: #18563b;
  --primary-soft: #e7f4ee;
  --success: #1f7a45;
  --success-soft: #e7f6ee;
  --warning: #9a6700;
  --warning-soft: #fff6e5;
  --error: #b42318;
  --error-soft: #fdeceb;
  --error-hover: #912018;
  --input: #ffffff;
  --focus: #1f6b4a;
  --focus-ring: color-mix(in srgb, var(--primary) 24%, transparent);
  --shadow: var(--shadow-sm);
  --shadow-raised: var(--shadow-lg);
  --radius: var(--radius-md);
  --radius-pill: var(--radius-full);
  --space-1: var(--space-xs);
  --space-2: var(--space-sm);
  --space-3: var(--space-md);
  --space-4: var(--space-lg);
  --space-5: 20px;
  --space-6: var(--space-xl);
  --space-7: var(--space-2xl);
  --space-8: 40px;
  --space-9: 48px;
  --space-10: 64px;
  --space: var(--space-2);
  --text-page: 28px;
  --text-section: 18px;
  --text-card: 16px;
  --text-body: 15px;
  --text-secondary-size: 14px;
  --text-label: 13px;
  --text-caption: 12px;
  --control-h: 44px;
  --control-h-md: 48px;
  --control-h-lg: 52px;
  --btn-h: var(--control-h);
  --input-h: var(--control-h);
  --icon-16: 16px;
  --icon-20: 20px;
  --icon-24: 24px;
  --icon-32: 32px;
  --duration-fast: var(--transition-fast);
  --duration-normal: var(--transition-normal);
  --duration-medium: var(--transition-normal);
  --duration-slow: var(--transition-slow);
  --ease-standard: cubic-bezier(0.2, 0.8, 0.2, 1);
  --ease-emphasized: cubic-bezier(0.2, 0.8, 0.2, 1);
  --ease-enter: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-exit: cubic-bezier(0.4, 0, 1, 1);
  --motion-press: transform var(--duration-fast) var(--ease-emphasized);
  --motion-fade: opacity var(--duration-normal) var(--ease-standard);
  --motion-enter: opacity var(--duration-medium) var(--ease-enter), transform var(--duration-medium) var(--ease-enter);
  --motion-exit: opacity var(--duration-fast) var(--ease-exit), transform var(--duration-fast) var(--ease-exit);
  --font: "Segoe UI", ui-sans-serif, system-ui, Helvetica, Arial, sans-serif;
  --arabic: "Noto Naskh Arabic", "Segoe UI", Tahoma, sans-serif;
}

html[data-theme="dark"] {
  color-scheme: dark;
  --bg: #101214;
  --surface: #181b20;
  --surface-raised: #20242a;
  --surface-muted: #24282e;
  --border: #323842;
  --text: #f3f5f7;
  --text-secondary: #a8b0ba;
  --primary: #3d9a6e;
  --primary-hover: #57b083;
  --primary-soft: #163226;
  --success: #3dbe78;
  --success-soft: #143224;
  --warning: #e0aa3e;
  --warning-soft: #33260f;
  --error: #f07167;
  --error-soft: #3a1c1a;
  --input: #12151a;
  --focus: #57b083;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow-raised: 0 8px 24px rgba(0, 0, 0, 0.35);
}

*,
*::before,
*::after { box-sizing: border-box; }

[hidden] { display: none !important; }

html { overflow-x: clip; }

body {
  margin: 0;
  min-height: 100dvh;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: var(--text-body);
  line-height: 1.5;
}

body.header-menu-open,
body.store-sheet-open {
  overflow: hidden;
}

/* The sticky topbar is its own stacking context (z-index 20), so the fixed menu inside it
   can never rise above the body-level backdrop (z-index 24). Lift the whole topbar above
   the backdrop while the menu is open; the backdrop still dims everything below. */
body.header-menu-open .topbar {
  z-index: 30;
}

.save-scope-layer {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: var(--space-3) var(--space-3) calc(var(--space-3) + env(safe-area-inset-bottom, 0px));
  background: color-mix(in srgb, var(--text) 28%, transparent);
}

.save-scope-pop {
  width: min(340px, 100%);
  display: grid;
  gap: var(--space-2);
  padding: var(--space-3);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface);
  box-shadow: var(--shadow-md);
}

.save-scope-title {
  margin: 0 0 var(--space-1);
  font-weight: 650;
}

.save-scope-pop .btn {
  width: 100%;
  justify-content: center;
}

@media (min-width: 721px) {
  .save-scope-layer { align-items: center; }
}

.icon-sprite {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
}

.icon {
  width: var(--icon-20);
  height: var(--icon-20);
  display: block;
  flex: none;
}

.icon-16 { width: var(--icon-16); height: var(--icon-16); }
.icon-20 { width: var(--icon-20); height: var(--icon-20); }
.icon-24 { width: var(--icon-24); height: var(--icon-24); }
.icon-32 { width: var(--icon-32); height: var(--icon-32); }

button:disabled,
input:disabled,
select:disabled,
textarea:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

html[dir="rtl"] body { font-family: var(--arabic); }

button, input, textarea, select { font: inherit; color: inherit; }

:focus:not(:focus-visible) {
  outline: none;
  box-shadow: none;
}

:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
  box-shadow: 0 0 0 4px var(--focus-ring);
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.skip {
  position: absolute;
  inset-inline-start: 12px;
  top: -40px;
  background: var(--surface);
  color: var(--text);
  padding: 8px 12px;
  z-index: 80;
}

.skip:focus { top: 8px; }

html {
  scroll-padding-top: calc(56px + env(safe-area-inset-top, 0px));
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding-top: env(safe-area-inset-top);
}

.topbar-inner {
  width: min(1180px, 100%);
  margin: 0 auto;
  padding: var(--space-3) var(--space-4);
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  min-width: 0;
}

.brand-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
  width: auto;
  min-height: var(--control-h);
  flex: none;
}

.brand-row {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 10px 16px;
  min-width: 0;
  flex: 1 1 auto;
}

.brand {
  color: var(--text);
  font-weight: 700;
  font-size: 18px;
  text-decoration: none;
  letter-spacing: -0.02em;
}

.nav {
  display: flex;
  flex-wrap: nowrap;
  gap: 2px;
}

.nav-btn span {
  white-space: nowrap;
}

.nav-btn {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  min-height: var(--control-h);
  padding: 0 var(--space-3);
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
}

.nav-btn.is-active {
  background: var(--surface-muted);
  color: var(--text);
}

.header-tools {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 8px 10px;
  margin-inline-start: auto;
  flex: 0 1 auto;
  min-width: 0;
  justify-content: flex-end;
}

.header-menu-portal {
  position: relative;
  z-index: 21;
}

.header-menu .btn {
  width: 100%;
  justify-content: flex-start;
  white-space: nowrap;
}

.header-menu-backdrop {
  position: fixed;
  inset: 0;
  z-index: 24;
  border: 0;
  padding: 0;
  background: color-mix(in srgb, var(--text) 32%, transparent);
  cursor: default;
}

.header-menu-btn {
  display: inline-flex;
  gap: var(--space-2);
  min-height: var(--control-h);
  padding-inline: var(--space-3);
  flex: none;
}

.header-menu-btn.is-active {
  background: var(--surface-muted);
  color: var(--text);
}

.header-menu-label {
  font-size: var(--text-label);
  font-weight: 650;
}

#header-open-settings.is-active {
  border-color: var(--primary);
  background: var(--primary-soft);
  color: var(--text);
}

.header-logout { min-height: var(--control-h); }

.store-switch {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  margin: 0;
}

.store-switch select {
  min-height: var(--control-h);
  min-width: 0;
}

.sync-line {
  margin: 0;
  font-size: var(--text-caption);
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
  max-width: 8.5rem;
}

.header-menu {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: var(--space-2);
}

.header-menu[hidden] {
  display: none !important;
}

.product.is-detail .editor-store {
  gap: var(--space-2);
  align-content: start;
}

.product.is-detail .editor-store > .section-title {
  margin-top: 0;
}

.product.is-detail .editor-store .check-field {
  min-height: auto;
  padding-block: 2px;
}

.product.is-detail .editor-store .check-group {
  gap: 6px;
}

.product.is-detail .editor-store .store-inline-actions {
  gap: var(--space-2);
}

.product.is-detail .editor-store .save-state:empty {
  display: none;
}

.sandbox-preview-slot:empty {
  display: none;
}

.btn-label-short { display: none; }

@media (max-width: 720px) {
  .btn-label-long { display: none; }
  .btn-label-short { display: inline; }
}

.install-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2);
  flex: none;
}

.catalog-toolbar {
  display: grid;
  gap: var(--space-3);
}

@media (min-width: 721px) {
  .catalog-toolbar {
    grid-template-columns: minmax(0, 1.4fr) minmax(160px, 0.6fr);
    align-items: end;
  }
}

.catalog-search-field input[type="search"] {
  min-height: var(--input-h);
  width: 100%;
}

.back-link {
  min-height: var(--control-h);
  padding-inline: var(--space-4);
  justify-self: start;
}

.back-link:not(.btn-secondary) {
  padding-inline: var(--space-4);
}

.drop-target.is-dragover {
  outline: 2px dashed var(--primary);
  outline-offset: 2px;
  background: var(--primary-soft);
}

textarea.auto-grow {
  min-height: var(--control-h);
  resize: none;
  overflow: hidden;
  field-sizing: content;
}

.editor-store .price-field {
  max-width: 12rem;
  width: 100%;
}

.store-inline-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-3);
}

.btn-link-style {
  min-height: auto;
  padding: var(--space-1) 0;
  font-weight: 600;
  color: var(--primary);
  background: transparent;
  border: 0;
}

details.field-group > :not(summary) > .field:first-of-type {
  margin-top: var(--space-3);
}

.sandbox-preview-thumb { margin-top: var(--space-2); }

.sandbox-preview-thumb-btn {
  position: relative;
  display: inline-block;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
  background: var(--surface-muted);
  cursor: pointer;
}

.sandbox-preview-thumb-btn img {
  display: block;
  width: 96px;
  height: 96px;
  object-fit: cover;
}

.sandbox-preview-badge {
  position: absolute;
  inset-inline: 0;
  bottom: 0;
  padding: 2px 4px;
  background: color-mix(in srgb, var(--text) 82%, transparent);
  color: #fff;
  font-size: 10px;
  font-weight: 650;
  text-align: center;
  line-height: 1.25;
}

.catalog-no-matches { margin: var(--space-3) 0 0; }

.auth-loading {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: none;
  place-items: center;
  background: var(--surface);
}

body.is-auth-pending .auth-loading { display: grid; }

body.is-auth-pending .login-screen,
body.is-auth-pending .topbar,
body.is-auth-pending .shell,
body.is-auth-pending .tabbar { display: none; }

.editor-store .check-field {
  min-height: var(--control-h);
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.form-section.danger-zone {
  margin-top: var(--space-6);
  padding-top: var(--space-4);
  border-top: 1px solid var(--border);
  display: grid;
  gap: var(--space-3);
}

.map-dormant iframe {
  pointer-events: none;
  touch-action: pan-y;
}

.store-map.is-interactive iframe {
  pointer-events: auto;
}

.store-map .map-hint {
  font-size: var(--text-caption);
}

.store-detail { display: grid; gap: var(--space-4); }

.store-detail-head {
  display: grid;
  gap: var(--space-3);
}

.store-detail-tools {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2) var(--space-3);
}

.store-stammdaten-hint { margin: 0; }

.btn-compact {
  min-height: var(--control-h);
  gap: var(--space-2);
}

.store-stammdaten-card {
  max-width: min(640px, 100%);
  max-height: min(92dvh, 920px);
  overflow: auto;
}

#store-detail.is-product-record .store-product-filters,
#store-detail.is-product-record .catalog-toolbar,
#store-detail.is-product-record #store-products-wrap,
#store-detail.is-product-record #store-products-empty,
#store-detail.is-product-record #store-products-loading,
#store-detail.is-product-record .store-detail-head {
  display: none;
}

#stores.is-record #stores-page-head { display: none; }

#stores.is-record .store-layout {
  grid-template-columns: minmax(0, 1fr);
}

.sync-line,
.count,
.lede,
.meta {
  margin: 0;
  color: var(--text-secondary);
  font-size: var(--text-label);
}

.note {
  margin: 0;
  color: var(--text-muted);
  font-size: var(--text-secondary-size);
  line-height: var(--line-height-normal);
}

.segment {
  display: inline-flex;
  padding: var(--space-1);
  gap: var(--space-1);
  background: var(--surface-muted);
  border-radius: var(--radius);
}

.filter {
  min-height: var(--control-h);
  padding: 0 var(--space-3);
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
}

.filter.is-active {
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow);
}

.theme-switch,
.store-switch {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  color: var(--text-secondary);
  font-size: var(--text-label);
}

.store-switch select {
  width: min(220px, 100%);
  max-width: 100%;
}

select {
  min-height: var(--input-h);
  padding: 0 32px 0 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background-color: var(--input);
  color: var(--text);
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%235c6570' stroke-width='1.75' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-position: right var(--space-3) center;
  background-size: var(--icon-16) var(--icon-16);
  background-repeat: no-repeat;
  transition: border-color var(--duration-fast) var(--ease-standard);
}

html[dir="rtl"] select {
  padding: 0 var(--space-3) 0 var(--space-7);
  background-position: left var(--space-3) center;
}

html[data-theme="dark"] select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23a8b0ba' stroke-width='1.75' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
}

.icon-btn {
  width: var(--control-h);
  height: var(--control-h);
  display: grid;
  place-items: center;
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  font-size: 18px;
  line-height: 1;
}

.shell {
  position: relative;
  z-index: 0;
  isolation: isolate;
  width: min(1180px, 100%);
  margin: 0 auto;
  padding: 28px 20px calc(40px + env(safe-area-inset-bottom));
}

.panel { display: grid; gap: var(--space-6); }

h1, h2, h3, h4, p { margin: 0; }

h1 { font-size: var(--text-page); letter-spacing: -0.03em; line-height: 1.2; }

h2, .section-title { font-size: var(--text-section); font-weight: 650; }

h3, h4.section-title { font-size: var(--text-card); font-weight: 650; }

.eyebrow {
  margin: 0;
  color: var(--text-secondary);
  font-size: var(--text-label);
  font-weight: 600;
}

.page-head,
.store-bar,
.action-row,
.form-actions,
.export-actions,
.actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-3);
}

.page-head { justify-content: space-between; align-items: flex-start; }

.catalog-head-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
  justify-content: flex-end;
}

.empty .btn { margin-top: var(--space-3); }

.master-picker-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: min(52vh, 480px);
  overflow: auto;
  padding: 4px 0;
}

.master-picker-row {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: var(--surface-muted);
  text-align: left;
  cursor: pointer;
  min-height: 48px;
  font: inherit;
  color: inherit;
}

.master-picker-row:hover { border-color: var(--primary); }

.master-picker-row.is-selected {
  border-color: var(--primary);
  box-shadow: 0 0 0 1px var(--primary);
}

.master-picker-row .picker-check {
  flex-shrink: 0;
  width: 22px;
  height: 22px;
  margin-top: 2px;
  accent-color: var(--primary);
}

.master-picker-row .picker-copy { flex: 1; min-width: 0; }

.master-picker-row .picker-title {
  display: block;
  font-weight: 600;
}

.master-picker-row .picker-meta {
  display: block;
  margin-top: 4px;
  font-size: var(--text-small);
  color: var(--text-secondary);
}

.quick-card.master-picker-card {
  width: min(560px, 100%);
}

@media (max-width: 720px) {
  #master-picker-sheet,
  #assign-stores-sheet {
    align-items: stretch;
  }

  .quick-card.master-picker-card {
    width: 100%;
    min-height: 100vh;
    min-height: 100dvh;
    border-radius: 0;
    align-content: start;
  }

  .master-picker-list {
    max-height: none;
    flex: 1;
  }

  .page-head .catalog-head-actions { width: 100%; justify-content: stretch; }
  .page-head .catalog-head-actions .btn { flex: 1; }
}

.btn {
  min-height: var(--btn-h);
  padding: 0 14px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  color: var(--text);
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
}

/* Flat fills for capture / intake flows only — admin buttons use stp-ui-chrome.css layers */
.scanner .btn,
.photo-capture .btn,
#intake .btn {
  background: var(--surface-muted);
}

.scanner .btn:hover,
.photo-capture .btn:hover,
#intake .btn:hover { background: var(--border); }

.scanner .btn-primary,
.photo-capture .btn-primary,
#intake .btn-primary { background: var(--primary); color: #fff; }

.scanner .btn-primary:hover,
.photo-capture .btn-primary:hover,
#intake .btn-primary:hover { background: var(--primary-hover); }

.scanner .btn-secondary,
.photo-capture .btn-secondary,
#intake .btn-secondary {
  background: var(--surface);
  border-color: var(--border);
}

.scanner .btn-quiet,
.scanner .btn-ghost,
.photo-capture .btn-quiet,
.photo-capture .btn-ghost,
#intake .btn-quiet,
#intake .btn-ghost { background: transparent; color: var(--text-secondary); }

.scanner .btn-quiet:hover,
.scanner .btn-ghost:hover,
.photo-capture .btn-quiet:hover,
.photo-capture .btn-ghost:hover,
#intake .btn-quiet:hover,
#intake .btn-ghost:hover { background: var(--surface-muted); color: var(--text); }

.scanner .btn-danger,
.photo-capture .btn-danger,
#intake .btn-danger {
  background: var(--error-soft);
  color: var(--error);
  border-color: transparent;
}

.scanner .btn-danger:hover,
.photo-capture .btn-danger:hover,
#intake .btn-danger:hover { background: var(--error-soft); color: var(--error-hover); }

.stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.stat {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: var(--space-3);
  display: grid;
  gap: 2px;
}

.stat-tile {
  width: 100%;
  text-align: start;
  cursor: pointer;
  font: inherit;
  color: inherit;
}

.stat-tile:hover {
  border-color: var(--primary);
  background: var(--primary-soft);
}

.stat strong { font-size: 22px; letter-spacing: -0.03em; }
.stat span { color: var(--text-secondary); font-size: var(--text-label); }

.sheet,
.lookup-card,
.revision-notice {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: var(--space-5);
  display: grid;
  gap: var(--space-4);
}

.choice-list { display: grid; gap: var(--space-3); }

.choice {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  min-height: 52px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  font-weight: 600;
  text-align: start;
  cursor: pointer;
  position: relative;
}

.choice:hover { border-color: var(--primary); }

.choice.is-primary {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

.choice.is-primary:hover { background: var(--primary-hover); color: #fff; }

.choice input {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
}

.field,
.field-group {
  display: grid;
  gap: var(--space-2);
}

.field-group { gap: var(--space-4); }

.field-group + .field-group { margin-top: var(--space-2); }

.manual-form,
.editor-master,
.editor-store {
  display: grid;
  gap: var(--space-4);
}

details.field-group {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: var(--space-4);
}

details.field-group > summary {
  cursor: pointer;
}

details.field-group > summary::-webkit-details-marker { display: none; }

.store-profile > .section-title,
.editor-master > .section-title,
.editor-store > .section-title { margin-top: var(--space-6); }

.store-profile > .section-title:first-of-type { margin-top: var(--space-4); }

.field-error { margin: 4px 0 0; color: var(--error); font-size: var(--text-label); }

.form-actions { justify-content: flex-end; margin-top: var(--space-2); }

.form-actions.pair {
  display: grid;
  grid-template-columns: 1fr 1fr;
  width: 100%;
}

.form-actions.pair .btn { width: 100%; min-height: 44px; }

.capture-hub,
.capture-target { display: grid; gap: var(--space-4); min-width: 0; }

.capture-target,
.capture-count { margin: 0; }

@media (max-width: 720px) {
  .action-row,
  .choice-list,
  .form-actions,
  .scanner-bar,
  .photo-actions {
    display: grid;
    grid-template-columns: 1fr;
    width: 100%;
  }

  .action-row .btn,
  .choice,
  .form-actions .btn,
  .scanner-bar .btn,
  .photo-actions .btn,
  .export-actions .btn {
    width: 100%;
    min-height: 44px;
    justify-content: center;
  }

  .form-actions.pair { grid-template-columns: 1fr 1fr; }
}

.field-label { font-size: var(--text-label); font-weight: 600; }

input:focus-visible,
textarea:focus-visible,
select:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 1px;
  border-color: var(--focus);
}

input[type="text"],
input[type="search"],
input[type="tel"],
input[type="email"],
input[type="url"],
input[type="time"],
textarea,
.field input,
.field textarea {
  width: 100%;
  min-height: var(--input-h);
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--input);
  color: var(--text);
  transition: border-color var(--duration-fast) var(--ease-standard);
}

input[aria-invalid="true"],
textarea[aria-invalid="true"] {
  border-color: var(--error);
}

textarea { min-height: 88px; resize: vertical; }

input[aria-invalid="true"],
textarea[aria-invalid="true"] { border-color: var(--error); }

.segment { margin-top: 4px; }

.catalog-list,
.store-list,
.preview-list,
.recent-list,
.local-drafts { display: grid; }

.product {
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}

.product:first-child { border-top: 1px solid var(--border); }

.product.is-fresh { background: var(--primary-soft); }

.product-summary {
  width: 100%;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: var(--space-2);
  align-items: center;
  min-height: 64px;
  padding: 10px 4px;
  background: transparent;
  color: inherit;
}

.product-open-btn {
  display: grid;
  grid-template-columns: 44px minmax(0, 1.5fr) minmax(5.5rem, 0.8fr) auto;
  gap: var(--space-2) var(--space-3);
  align-items: center;
  width: 100%;
  min-height: 44px;
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  text-align: start;
  cursor: pointer;
}

.product.is-selected .product-summary { background: var(--primary-soft); border-radius: var(--radius-md); }

.summary-badges {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2);
  max-width: 100%;
}

.recent-product-row {
  border-bottom: 1px solid var(--border);
}

.product-select-field {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 44px;
  min-height: 44px;
  padding-inline: 4px;
  flex-shrink: 0;
}

.product-select-field input { width: 20px; height: 20px; accent-color: var(--primary); }

.product-selection-bar {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  padding-bottom: calc(var(--space-3) + env(safe-area-inset-bottom, 0px));
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface);
  box-shadow: var(--shadow-raised);
  position: fixed;
  left: var(--space-4);
  right: var(--space-4);
  bottom: calc(64px + env(safe-area-inset-bottom, 0px));
  z-index: 35;
}

.product-selection-count { margin: 0; font-weight: 650; white-space: nowrap; }

.product-selection-actions {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: var(--space-2);
  min-width: 0;
}

.product-selection-actions .product-selection-primary {
  flex-shrink: 0;
  white-space: nowrap;
}

.product-selection-more {
  position: relative;
  flex-shrink: 0;
}

.product-selection-more summary {
  list-style: none;
  cursor: pointer;
}

.product-selection-more summary::-webkit-details-marker {
  display: none;
}

.product-selection-more-menu {
  position: absolute;
  right: 0;
  bottom: calc(100% + var(--space-2));
  display: grid;
  gap: var(--space-1);
  min-width: 12rem;
  padding: var(--space-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface);
  box-shadow: var(--shadow-raised);
}

.product-selection-more:not([open]) .product-selection-more-menu {
  display: none;
}

@media (min-width: 721px) {
  .product-selection-bar {
    position: sticky;
    top: var(--space-2);
    bottom: auto;
    left: auto;
    right: auto;
    margin-block: var(--space-3);
    box-shadow: none;
    padding-bottom: var(--space-3);
  }

  .product-selection-more {
    display: none;
  }

  .product-selection-secondary {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--space-2);
  }
}

@media (max-width: 720px) {
  .product-selection-secondary {
    display: none;
  }

  .product-selection-more-menu .btn {
    width: 100%;
    justify-content: flex-start;
  }
}

.photoroom-dialog-card progress {
  width: 100%;
  height: 8px;
  border-radius: 4px;
  overflow: hidden;
}

.photoroom-compare {
  display: grid;
  gap: var(--space-3);
  max-height: min(52dvh, 480px);
  overflow: auto;
}

.photoroom-compare-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-2);
  align-items: start;
}

@media (max-width: 640px) {
  .photoroom-compare-row {
    grid-template-columns: 1fr;
  }
}

.photoroom-compare-row figcaption {
  font-size: var(--text-label);
  color: var(--text-secondary);
  margin-top: var(--space-1);
}

.photoroom-compare-row img {
  width: 100%;
  max-height: 180px;
  object-fit: contain;
  border-radius: var(--radius-sm);
  background: var(--surface-muted);
}

.photoroom-job-row {
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr) auto;
  gap: var(--space-3);
  align-items: center;
  padding: var(--space-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-raised);
}

.photoroom-job-thumb {
  width: 48px;
  height: 48px;
  object-fit: cover;
  border-radius: var(--radius-sm);
  background: var(--surface-muted);
}

.photoroom-job-copy {
  display: grid;
  gap: var(--space-1);
  min-width: 0;
}

.photoroom-job-copy strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.photoroom-job-status {
  font-size: var(--text-label);
  color: var(--text-secondary);
}

.photoroom-job-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-1);
  justify-content: flex-end;
}

#product-bulk-delete {
  margin-inline-start: var(--space-2);
}

.check-group {
  display: grid;
  gap: var(--space-2);
}

.product-save-bar {
  display: grid;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-3);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface);
}

.product-save-actions {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: var(--space-2);
}

.product-save-actions .btn {
  width: auto;
  min-width: 112px;
}

.save-scope {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2);
  margin: 0;
  padding: 0;
  border: 0;
}

.save-scope legend {
  font-size: var(--text-label);
  font-weight: 650;
  margin-inline-end: var(--space-2);
}

.save-scope-option {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  min-height: var(--control-h);
  padding: var(--space-1) var(--space-3);
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  cursor: pointer;
}

.save-scope-option:has(input:checked) {
  border-color: var(--primary);
  background: var(--primary-soft);
}

.product-danger-zone .btn-danger + .note {
  margin-top: var(--space-4);
}

.product-danger-zone .delete-product {
  margin-bottom: var(--space-2);
}

.assign-stores-link {
  justify-self: start;
}

.photoroom-banner {
  padding: 0.65rem 0.75rem;
  border-radius: var(--radius-sm);
  background: #fff3cd;
  color: #664d03;
}

.photoroom-meta {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  justify-content: space-between;
}

.photoroom-review {
  display: grid;
  gap: var(--space-2);
}

.photoroom-review-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2);
}

.photoroom-compare-panes {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-2);
  align-items: stretch;
}

@media (max-width: 720px) {
  .photoroom-compare-panes {
    grid-template-columns: 1fr;
  }
}

.photoroom-pane {
  margin: 0;
  display: grid;
  gap: var(--space-1);
}

.photoroom-viewport {
  position: relative;
  overflow: hidden;
  height: min(38dvh, 360px);
  border-radius: var(--radius-sm);
  background: var(--surface-muted);
  touch-action: none;
  cursor: grab;
}

.photoroom-viewport img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  transform-origin: center center;
  user-select: none;
  pointer-events: none;
}

.photoroom-review-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}

.photoroom-retry-panel {
  display: grid;
  gap: var(--space-2);
  margin-top: var(--space-2);
  padding-top: var(--space-2);
  border-top: 1px solid var(--border-subtle);
}

.photo-check-chip {
  display: inline-flex;
  align-items: center;
  padding: 0.1rem 0.45rem;
  margin-right: 0.35rem;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 600;
  background: var(--warning-soft, #fff4d6);
  color: var(--warning, #9a6700);
}

.photo-check-badge {
  display: inline-block;
  padding: 0.25rem 0.5rem;
  margin-right: 0.5rem;
  border-radius: 0.35rem;
  font-size: 0.85rem;
  background: var(--warning-soft, #fff4d6);
  color: var(--warning, #9a6700);
}

.photo-check-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  align-items: center;
  margin-top: 0.35rem;
}

.photoroom-retry-panel .warning {
  color: #8f2d2d;
}

.recent-row {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  width: 100%;
}

.recent-row .recent-open {
  flex: 1;
  min-width: 0;
  text-align: start;
}

.summary-photo {
  width: 44px;
  height: 44px;
  border-radius: 8px;
  background: var(--surface-muted);
  color: var(--text-secondary);
  display: grid;
  place-items: center;
  overflow: hidden;
  font-size: 11px;
}

.summary-photo img { width: 100%; height: 100%; object-fit: cover; }

.summary-copy,
.summary-codes { display: grid; min-width: 0; }

.summary-codes {
  justify-items: end;
  text-align: end;
  font-variant-numeric: tabular-nums;
}

.summary-copy strong,
.summary-codes span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.summary-meta,
.summary-codes { color: var(--text-secondary); font-size: var(--text-label); }

.summary-side {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: var(--space-2);
  min-width: 0;
}

.chevron {
  color: var(--text-secondary);
  display: grid;
  place-items: center;
  transition: var(--motion-press);
}

.product.is-open .chevron { transform: rotate(90deg); }

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  min-height: var(--space-7);
  padding: 0 var(--space-2);
  border-radius: var(--radius-pill);
  background: var(--surface-muted);
  color: var(--text);
  font-size: var(--text-label);
  font-weight: 600;
  white-space: nowrap;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--text-secondary);
}

.status-confirmed { background: var(--success-soft); color: var(--success); }
.status-confirmed .status-dot { background: var(--success); }
.status-review { background: var(--warning-soft); color: var(--warning); }
.status-review .status-dot { background: var(--warning); }
.status-incomplete { background: var(--error-soft); color: var(--error); }
.status-incomplete .status-dot { background: var(--error); }

.status-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  color: var(--text-secondary);
  font-size: var(--text-label);
}

.system-status-banner,
.backup-status-banner {
  margin: 0 0 1rem;
  padding: 0.65rem 0.85rem;
  border-radius: 0.5rem;
  border: 1px solid #c45c26;
  background: #fff4ec;
  color: #7a3410;
}

.ai-status-banner {
  margin: 0 0 var(--space-4);
  padding: 0.65rem 0.85rem;
  border-radius: var(--radius-md);
  background: #fff3cd;
  border: 1px solid #e0c46a;
  color: #5c4a12;
  font-size: var(--text-label);
}

.product-details {
  display: none;
  grid-template-columns: 1fr;
  gap: var(--space-7);
  padding: var(--space-1) 0 var(--space-4);
}

.product.is-open .product-details {
  display: grid;
  animation: motion-in var(--duration-normal) var(--ease-enter);
}

.editor-master,
.editor-store {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: var(--space-4);
  background: var(--surface-raised);
}

.photo-cell {
  width: 96px;
  height: 96px;
  margin-bottom: 12px;
  border-radius: 8px;
  background: var(--surface-muted);
  overflow: hidden;
}

.photo-cell.is-gallery {
  width: auto;
  height: auto;
  overflow: visible;
  background: transparent;
}

.product .photo-gallery {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 10px;
  width: 100%;
  max-width: min(100%, 420px);
}

.photo-gallery-main-wrap {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  width: 100%;
}

.photo-gallery-nav {
  flex-shrink: 0;
  min-width: 44px;
  min-height: 44px;
  padding: 8px;
  border-radius: 999px;
}

.photo-gallery-main {
  position: relative;
  width: 100%;
  aspect-ratio: 1;
  max-height: min(72vw, 360px);
  border-radius: var(--radius-md);
  overflow: hidden;
  background: var(--surface-muted);
  touch-action: pan-y;
}

.photo-gallery-main img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.photo-gallery-counter {
  margin: 0;
  font-size: var(--text-label);
  font-variant-numeric: tabular-nums;
  color: var(--text-secondary);
  text-align: center;
}

.photo-gallery-filmstrip {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
}

.photo-gallery-thumb {
  display: block;
  padding: 0;
  margin: 0;
  border: 2px solid transparent;
  border-radius: 8px;
  overflow: hidden;
  cursor: pointer;
  background: transparent;
  line-height: 0;
}

.photo-gallery-thumb img {
  width: 56px;
  height: 56px;
  object-fit: cover;
  display: block;
}

.photo-gallery-thumb.is-active {
  border-color: var(--primary);
  box-shadow: 0 0 0 1px var(--primary);
}

.photo-gallery-delete {
  align-self: center;
}

.photo-cell:not(.is-gallery) img { width: 96px; height: 96px; object-fit: cover; border-radius: 8px; }

.btn input[type="file"] { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

body.is-guest .topbar,
body.is-guest .shell,
body.is-guest .tabbar,
body.is-guest .install-bar { display: none; }

body.is-authenticated .login-screen,
body.is-auth-pending .login-screen { display: none; }

.login-screen {
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-4);
}

.login-card {
  width: min(420px, 100%);
  padding: var(--space-8);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
}

.login-card .btn-primary { width: 100%; }

.password-row {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.password-row input { flex: 1; min-width: 0; }

.check-field {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 36px;
}

.image-meta { display: grid; gap: 4px; font-size: var(--text-label); color: var(--text-secondary); }

.save-state { min-height: 1.2em; font-size: var(--text-label); color: var(--warning); }

.store-row,
.preview-card,
.recent-row,
.draft-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px 16px;
  padding: 16px 0;
  border-bottom: 1px solid var(--border);
  background: transparent;
  color: inherit;
  text-align: start;
}

.store-layout {
  display: grid;
  gap: 20px;
  align-items: start;
}

.store-list { display: grid; align-content: start; }

.store-copy { display: grid; }
.store-actions { display: flex; flex-wrap: wrap; gap: 8px; }

.store-row.is-selected { background: var(--surface-muted); border-radius: 8px; padding-inline: 8px; }

.store-profile { align-content: start; }

.store-photo-block { display: grid; gap: 12px; }

.store-photo {
  width: min(100%, 420px);
  max-height: 220px;
  object-fit: cover;
  border-radius: var(--radius);
  background: var(--surface-muted);
}

.pair {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(0, 1fr);
  gap: 12px;
}

.pair-place { grid-template-columns: minmax(0, 1fr) minmax(0, 2fr); }

.hours { display: grid; gap: 10px; }

.hours-row {
  display: grid;
  grid-template-columns: 5.5rem 2.5rem minmax(0, 1fr) 2.5rem minmax(0, 1fr) auto;
  gap: var(--space-2);
  align-items: center;
}

.hours-label {
  color: var(--text-secondary);
  font-size: var(--text-caption);
}

.hours-row input[data-open],
.hours-row input[data-close] {
  min-height: var(--input-h);
  font-variant-numeric: tabular-nums;
}

.store-map {
  display: grid;
  gap: 8px;
}

.store-map iframe {
  width: 100%;
  height: 180px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-muted);
}

.store-map a { color: var(--primary); }

.recent-row {
  width: 100%;
  border-left: 0;
  border-right: 0;
  border-top: 0;
  cursor: pointer;
  font-weight: 600;
}

.preview-card img {
  width: 64px;
  height: 64px;
  object-fit: cover;
  border-radius: 8px;
  background: var(--surface-muted);
}

.photo-preview {
  width: min(240px, 100%);
  border-radius: var(--radius);
  background: var(--surface-muted);
}

.photo-flow,
#photo-suggestion {
  min-width: 0;
  max-width: 100%;
}

.candidate-card,
.photo-conflict {
  overflow-wrap: anywhere;
}

.candidate-photo {
  width: 72px;
  height: 72px;
  object-fit: cover;
  border-radius: var(--radius-sm);
}

.photo-conflict {
  white-space: pre-line;
  margin: 0;
}

.alert,
.toast {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  margin: 0 0 16px;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  line-height: 1.45;
}

.alert {
  background: var(--error-soft);
  color: var(--error);
}

.toast {
  justify-content: flex-start;
  background: var(--success-soft);
  color: var(--success);
}

.toast::before {
  content: "";
  width: var(--icon-16);
  height: var(--icon-16);
  flex: none;
  background: currentColor;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m5 12 5 5L20 7'/%3E%3C/svg%3E") center / contain no-repeat;
}

.empty {
  padding: 24px 0;
  color: var(--text-secondary);
}

.empty-title { color: var(--text); font-weight: 650; margin-bottom: 4px; }

.camera-stage,
.scanner,
.photo-capture {
  position: fixed;
  inset: 0;
  z-index: 80;
  width: 100%;
  height: 100dvh;
  min-height: 100dvh;
  overflow: hidden;
  background: #000;
  color: #f5f7f8;
}

.camera-stage video,
.camera-stage .photo-shot,
.photo-capture video,
.photo-capture .photo-shot {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #000;
}

.camera-stage.is-scan video {
  object-fit: cover;
}

.camera-live-focus-overlay {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 1;
}

.camera-mode-toggle {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.camera-mode-toggle .btn[aria-pressed="true"] {
  border-color: rgba(255, 255, 255, 0.7);
  background: rgba(255, 255, 255, 0.18);
}

.photo-actions {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  width: 100%;
}

.photo-actions .btn {
  min-height: 48px;
  width: min(100%, 280px);
}

.camera-full-quality-btn {
  font-weight: 600;
  border-color: rgba(255, 255, 255, 0.55);
  width: min(100%, 320px);
}

.camera-quality-prompt {
  width: min(100%, 420px);
  padding: 10px 12px;
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.55);
  border: 1px solid rgba(255, 200, 80, 0.45);
}

.camera-quality-prompt .form-actions {
  margin-top: 8px;
}

.camera-shutter-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: center;
  column-gap: 12px;
  width: min(100%, 420px);
}

.camera-shutter-row .photo-shutter {
  justify-self: center;
}

.camera-no-ean[hidden] {
  display: none;
}

.scanner-bar .camera-shutter-row .camera-manual-ean,
.camera-shutter-row .camera-manual-ean,
.scanner-bar .camera-shutter-row .camera-no-ean,
.camera-shutter-row .camera-no-ean {
  width: auto;
  max-width: 10.5rem;
  min-height: var(--control-h);
  padding: var(--space-2) var(--space-3);
  font-size: var(--text-label);
  line-height: 1.2;
  white-space: normal;
  text-align: start;
}

.camera-item-chips {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-1);
}

.camera-error-box {
  display: grid;
  gap: var(--space-3);
  width: min(100%, 420px);
}

.camera-error-box[hidden] { display: none; }

@media (min-width: 721px) {
  .camera-stage .scanner-ui {
    left: 50%;
    right: auto;
    width: min(720px, 100%);
    transform: translateX(-50%);
    border-radius: var(--radius-lg);
    overflow: hidden;
  }

  .scanner-bar {
    flex: 0 0 auto;
    position: sticky;
    bottom: 0;
    max-height: 50dvh;
    overflow: auto;
    overscroll-behavior: contain;
  }
}

body.has-product-selection #catalog .catalog-list,
body.has-product-selection #catalog .table-wrap {
  padding-bottom: calc(108px + env(safe-area-inset-bottom, 0px));
}

@media (min-width: 721px) {
  body.has-product-selection #catalog .catalog-list,
  body.has-product-selection #catalog .table-wrap {
    padding-bottom: var(--space-4);
  }
}

.camera-shutter-row .camera-manual-ean {
  justify-self: start;
}

.camera-shutter-row .camera-no-ean {
  justify-self: end;
}

.camera-photo-count {
  margin: 0;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.72);
  color: #f5f7f8;
  font-size: 14px;
  font-weight: 650;
  font-variant-numeric: tabular-nums;
  line-height: 1.2;
  white-space: nowrap;
}

.camera-photo-count-above {
  align-self: center;
}

.camera-photo-count[hidden] {
  display: none;
}

.camera-photo-count.is-full {
  background: rgba(92, 48, 16, 0.92);
  color: #ffe7c2;
}

#camera-photo-panel.is-manual-only .photo-shutter,
#camera-photo-panel.is-manual-only #photo-use,
#camera-photo-panel.is-manual-only #photo-retake,
#camera-photo-panel.is-manual-only .camera-photo-count {
  display: none;
}

#camera-photo-panel.is-manual-only .camera-shutter-row {
  display: flex;
  justify-content: flex-start;
}

.camera-stage.is-thumb-retake .camera-manual-ean,
.camera-stage.is-thumb-retake .camera-photo-count {
  visibility: hidden;
}

.photo-shutter {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  border: 4px solid #fff;
  background: transparent;
  box-shadow: inset 0 0 0 6px #000;
}

.camera-stage .btn-secondary,
.camera-stage .btn-primary,
.photo-capture .btn-secondary,
.photo-capture .btn-primary { min-height: 48px; }

body.camera-open .tabbar,
body.photo-open .tabbar,
body.scanner-open .tabbar { display: none; }

.camera-stage .btn-quiet,
.camera-stage .btn-secondary,
.camera-stage .btn-primary,
.scanner .btn-quiet,
.scanner .btn-secondary { color: #f5f7f8; border-color: rgba(255, 255, 255, 0.35); background: rgba(0, 0, 0, 0.62); }

.camera-stage .btn-primary {
  background: rgba(26, 92, 58, 0.88);
  border-color: rgba(255, 255, 255, 0.35);
  color: #f5f7f8;
}

.camera-stage .btn-quiet {
  background: rgba(0, 0, 0, 0.48);
  border-color: rgba(255, 255, 255, 0.2);
}

.scanner video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  background: #000;
}

.scanner-ui {
  position: absolute;
  inset: 0;
  z-index: 1;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  pointer-events: none;
  padding-top: max(16px, env(safe-area-inset-top));
  padding-right: max(16px, env(safe-area-inset-right));
  padding-bottom: max(16px, env(safe-area-inset-bottom));
  padding-left: max(16px, env(safe-area-inset-left));
}

.scanner-head,
.scanner-bar,
.scanner-top,
.camera-session-thumbs {
  pointer-events: auto;
}

.scanner-top {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-width: 0;
}

.scanner-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.camera-session-thumbs {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-x: contain;
  touch-action: pan-x;
  scroll-snap-type: x proximity;
  padding: 2px 2px 4px;
  max-width: 100%;
  scrollbar-width: thin;
}

/* Shop-floor phones: keep 5+ thumbs reachable without eating the preview. */
@media (max-width: 720px) {
  .camera-session-thumbs {
    gap: 5px;
    padding-bottom: 2px;
  }

  .camera-session-thumb {
    width: 44px;
    height: 44px;
  }

  .scanner-bar {
    gap: 10px;
    max-height: 42dvh;
  }

  .camera-stage .photo-actions {
    gap: 10px;
  }

  .camera-stage .photo-shutter {
    width: 68px;
    height: 68px;
  }
}

.camera-session-thumbs[hidden] {
  display: none;
}

.camera-session-thumb {
  position: relative;
  flex: 0 0 auto;
  width: 48px;
  height: 48px;
  padding: 0;
  border: 2px solid rgba(255, 255, 255, 0.35);
  border-radius: 8px;
  overflow: hidden;
  background: rgba(0, 0, 0, 0.45);
  scroll-snap-align: start;
  cursor: pointer;
}

.camera-session-thumb img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.camera-session-thumb-ean {
  position: absolute;
  left: 2px;
  right: 2px;
  bottom: 2px;
  padding: 1px 3px;
  border-radius: 4px;
  background: rgba(0, 0, 0, 0.72);
  color: #b7f0c2;
  font-size: 8px;
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: 0.01em;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.camera-session-thumb.is-active {
  border-color: rgba(183, 240, 194, 0.95);
  box-shadow: 0 0 0 1px rgba(183, 240, 194, 0.45);
}

.camera-thumb-preview {
  position: absolute;
  inset: 0;
  z-index: 3;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.92);
  pointer-events: none;
}

.camera-thumb-preview[hidden] {
  display: none;
}

.camera-thumb-preview-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #000;
}

.camera-thumb-inspect {
  display: grid;
  gap: 10px;
}

.camera-thumb-inspect[hidden] {
  display: none;
}

.camera-thumb-inspect-label {
  margin: 0;
  text-align: center;
  font-size: 14px;
  line-height: 1.35;
  color: rgba(245, 247, 248, 0.92);
}

.camera-stage.is-thumb-inspect .scan-frame,
.camera-stage.is-thumb-retake:not(.is-photo-ready) .scan-frame {
  display: none;
}

.camera-stage.is-thumb-inspect #camera-video,
.camera-stage.is-thumb-inspect .photo-shot {
  visibility: hidden;
}

.scanner-head-main {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
  min-width: 0;
}

.camera-item-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.camera-item-chips[hidden] {
  display: none;
}

.camera-chip {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.28);
  background: rgba(0, 0, 0, 0.4);
  color: rgba(245, 247, 248, 0.78);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.camera-chip[data-ready="true"] {
  border-color: rgba(183, 240, 194, 0.65);
  background: rgba(40, 110, 60, 0.45);
  color: #b7f0c2;
}

.scanner-close {
  width: 44px;
  height: 44px;
  border-color: transparent;
  background: transparent;
  color: #f5f7f8;
  font-size: 28px;
}

.scanner-bar {
  display: grid;
  gap: 12px;
  max-height: 46dvh;
  overflow: auto;
}

.scanner-bar .btn { width: 100%; min-height: 44px; }

#scan-status {
  margin: 0;
  text-align: center;
  font-size: 14px;
  line-height: 1.4;
}

#scan-status[data-scan-state="listening"] {
  color: rgba(245, 247, 248, 0.92);
}

#scan-status[data-scan-state="locked"] {
  color: #b7f0c2;
  font-weight: 650;
}

.camera-lookup-tip {
  margin: 0;
  text-align: center;
  font-size: 12px;
  line-height: 1.35;
  color: rgba(245, 247, 248, 0.72);
  max-width: 22rem;
  margin-inline: auto;
}

.camera-lookup-tip[hidden] {
  display: none;
}

.camera-stage.is-failed #scan-status,
.scanner.is-failed #scan-status { display: none; }

.camera-stage.is-photo:not(.is-scan) .scan-frame,
.camera-stage.is-photo:not(.is-scan) #camera-scan-frame {
  display: none !important;
}

.camera-stage.is-live-ean.is-photo .scan-frame {
  top: 18%;
  height: 18%;
  box-shadow: 0 0 0 100vmax rgba(0, 0, 0, 0.18);
}

.camera-barcode-pick {
  display: grid;
  gap: 8px;
  padding: 12px;
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.55);
  border: 1px solid rgba(255, 255, 255, 0.18);
}

.camera-barcode-pick[hidden] {
  display: none;
}

.camera-barcode-pick-title {
  margin: 0;
  text-align: center;
  font-size: 14px;
}

.camera-barcode-pick .btn {
  width: 100%;
}

.scan-frame {
  position: absolute;
  left: 12%;
  right: 12%;
  top: 28%;
  height: 22%;
  border: 2px solid rgba(255, 255, 255, 0.92);
  border-radius: 12px;
  box-shadow: 0 0 0 100vmax rgba(0, 0, 0, 0.28);
  pointer-events: none;
  transition: border-color var(--duration-fast) var(--ease-standard);
}

.camera-stage.is-failed video,
.camera-stage.is-failed .scan-frame,
.scanner.is-failed video,
.scanner.is-failed .scan-frame { display: none; }

.scan-error {
  margin: 0;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 10px;
  padding: 16px;
  text-align: center;
  background: rgba(0, 0, 0, 0.45);
}

.scan-error p { margin: 0; }

.camera-fallback-file {
  margin-top: var(--space-3);
  text-align: center;
}

.preview-loading {
  padding: var(--space-6);
  text-align: center;
}

#camera-session-next[aria-disabled="true"] {
  opacity: 0.72;
}

.quick-sheet {
  position: fixed;
  inset: 0;
  z-index: var(--z-modal);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  background: transparent;
  touch-action: manipulation;
}

.quick-sheet::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 0;
  background: rgba(16, 24, 40, 0.4);
  opacity: 0;
  transition: opacity var(--duration-normal) var(--ease-enter);
}

.quick-sheet.is-open::before { opacity: 1; }

.quick-sheet.is-closing {
  pointer-events: auto;
}

.quick-sheet.is-closing::before {
  transition-duration: var(--duration-fast);
  transition-timing-function: var(--ease-exit);
}

.quick-card {
  position: relative;
  z-index: 1;
  width: min(480px, 100%);
  display: grid;
  gap: 12px;
  padding: 20px 16px calc(16px + env(safe-area-inset-bottom));
  border-radius: 16px 16px 0 0;
  background: var(--surface);
  color: var(--text);
  opacity: 0;
  transform: translateY(8px) scale(0.98);
  transition: var(--motion-enter);
  touch-action: manipulation;
}

.quick-sheet.is-open .quick-card {
  opacity: 1;
  transform: none;
}

.quick-sheet.is-closing .quick-card {
  transition: var(--motion-exit);
}

.tabbar {
  display: none;
}

.scan-error ul { margin: var(--space-2) 0 0; padding-inline-start: var(--space-5); }

.install-bar {
  display: flex;
  justify-content: space-between;
  gap: var(--space-3);
  align-items: center;
  padding: var(--space-4);
  margin-bottom: var(--space-4);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

.install-bar p {
  margin: 0;
  flex: 1 1 auto;
}

@media (max-width: 720px) {
  .install-bar {
    flex-direction: column;
    align-items: stretch;
  }

  .install-actions {
    flex-direction: column;
    align-items: stretch;
    width: 100%;
  }

  .install-actions .btn {
    width: 100%;
    justify-content: center;
  }
}

@media (max-width: 720px) {
  h1 { font-size: 24px; }
  .nav { display: none; }
  .brand-row { display: none; }
  .topbar-inner {
    padding: var(--space-2) var(--space-3);
    gap: var(--space-2);
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto auto;
    align-items: center;
  }
  .brand-line {
    grid-column: 1;
    min-height: var(--control-h);
  }
  .header-tools {
    grid-column: 2 / -1;
    width: auto;
    justify-content: flex-end;
    gap: var(--space-1);
  }
  .sync-line { display: none; }
  .header-menu-portal { position: static; z-index: auto; }
  .store-detail-head .back-link { justify-self: start; }
  .shell { padding-bottom: calc(96px + env(safe-area-inset-bottom)); }
  .stats { grid-template-columns: 1fr 1fr; }
  .product-summary {
    grid-template-columns: auto minmax(0, 1fr);
    align-items: start;
    padding-block: var(--space-2);
  }

  .product-open-btn {
    grid-template-columns: 44px minmax(0, 1fr);
    grid-template-rows: auto auto;
    align-items: start;
  }

  .product-select-field {
    grid-row: 1 / 3;
    align-self: center;
  }

  .summary-photo {
    grid-row: 1 / 3;
    align-self: center;
  }

  .summary-copy {
    grid-column: 2;
    grid-row: 1;
  }

  .summary-copy strong {
    white-space: normal;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    overflow: hidden;
  }

  .summary-meta {
    display: none;
  }

  .summary-side {
    grid-column: 2;
    grid-row: 2;
    justify-content: flex-start;
    width: 100%;
    gap: var(--space-2);
  }

  .summary-side .summary-codes {
    display: inline-flex;
    gap: var(--space-2);
    min-width: 0;
    color: var(--text-secondary);
    font-size: var(--text-label);
  }

  .summary-side .summary-codes span {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 9rem;
  }

  .product.is-detail .product-save-bar {
    position: sticky;
    bottom: calc(64px + env(safe-area-inset-bottom, 0px));
    z-index: 20;
    margin-top: var(--space-4);
    box-shadow: var(--shadow-raised);
  }
  .btn, .choice, .nav-btn, .icon-btn { min-height: var(--control-h); }
  .page-head .btn-primary { width: 100%; }
  .pair, .pair-place { grid-template-columns: 1fr 1fr; }
  .hours-row {
    grid-template-columns: 1fr 1fr;
    gap: var(--space-2);
  }
  .hours-row > span:first-child,
  .hours-row .check-field { grid-column: 1 / -1; }
  #store-edit-actions {
    position: sticky;
    bottom: calc(64px + env(safe-area-inset-bottom, 0px));
    z-index: var(--z-sticky);
    margin-top: var(--space-4);
    padding-block: var(--space-3);
    background: var(--surface);
    box-shadow: var(--shadow-raised);
  }
  .tabbar {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 40;
    display: grid;
    grid-template-columns: 1fr 1fr auto 1fr 1fr;
    align-items: end;
    gap: 2px;
    padding: 6px 6px calc(8px + env(safe-area-inset-bottom));
    border-top: 1px solid var(--border);
    background: var(--surface);
  }
  :root { --control-h: 48px; }
  .tab-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: var(--space-1);
    min-height: 48px;
    padding: var(--space-1) var(--space-1);
    border: 0;
    background: transparent;
    color: var(--text-secondary);
    font-size: var(--text-caption);
    line-height: 1.2;
  }
  .tab-btn.is-active { color: var(--text); font-weight: 650; }
  .tab-add {
    width: 52px;
    height: 52px;
    margin-top: calc(var(--space-4) * -1);
    border: 0;
    border-radius: var(--radius-pill);
    background: var(--primary);
    display: grid;
    place-items: center;
    color: #fff;
    box-shadow: var(--shadow-raised);
  }
  body.camera-open .tabbar,
  body.scanner-open .tabbar,
  body.photo-open .tabbar { display: none; }
  #intake:has(#manual-form:not([hidden])) {
    position: fixed;
    inset: 0;
    z-index: 60;
    width: 100%;
    height: 100dvh;
    max-height: 100dvh;
    overflow: auto;
    border-radius: 0;
    padding:
      max(16px, env(safe-area-inset-top))
      16px
      calc(16px + env(safe-area-inset-bottom));
  }
  #intake:has(#manual-form:not([hidden])) .form-actions {
    position: sticky;
    bottom: 0;
    padding-top: 12px;
    background: var(--surface);
  }
}

@media (max-width: 900px) {
  .header-menu-portal { position: static; z-index: auto; }
  .header-menu {
    position: fixed;
    top: calc(var(--control-h) + var(--space-4) + env(safe-area-inset-top, 0px));
    right: var(--space-3);
    left: var(--space-3);
    z-index: 26;
    width: auto;
    max-width: min(360px, calc(100% - var(--space-3) * 2));
    margin-inline-start: auto;
    padding: var(--space-3);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: var(--surface);
    box-shadow: var(--shadow-md);
  }
  .header-menu .btn { justify-content: center; min-height: var(--control-h); }
  .header-logout { justify-content: center; }
}

@media (min-width: 721px) {
  .quick-sheet { align-items: center; padding: 24px; }
  .quick-card {
    border-radius: 16px;
    padding-bottom: 20px;
    box-shadow: var(--shadow-raised);
  }
}

@media (min-width: 901px) {
  .header-menu-portal {
    position: relative;
    z-index: 21;
    flex: none;
  }
  .header-menu {
    position: absolute;
    top: calc(100% + var(--space-1));
    right: 0;
    z-index: 26;
    min-width: min(280px, calc(100vw - var(--space-4) * 2));
    max-width: 320px;
    padding: var(--space-2);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: var(--surface);
    box-shadow: var(--shadow-md);
  }
  .sync-line { max-width: 11rem; }
  .nav-btn { padding-inline: var(--space-2); }
}

@media (min-width: 900px) {
  .product.is-open .product-details { grid-template-columns: 1.2fr 0.8fr; }
  .store-layout { grid-template-columns: minmax(220px, 280px) minmax(0, 1fr); }
}

/* Motion. New interaction uses these tokens and the shared rules below. */
.btn,
.icon-btn,
.choice,
.nav-btn,
.tab-btn,
.tab-add,
.filter,
.product-open-btn,
.recent-row {
  transition:
    var(--motion-press),
    opacity var(--duration-fast) var(--ease-standard),
    background-color var(--duration-fast) var(--ease-standard),
    color var(--duration-fast) var(--ease-standard),
    border-color var(--duration-fast) var(--ease-standard);
}

.btn:active:not(:disabled),
.icon-btn:active:not(:disabled),
.choice:active:not(:disabled),
.nav-btn:active,
.tab-btn:active,
.filter:active,
.product-open-btn:active,
.recent-row:active {
  transform: scale(0.98);
}

.tab-add:active {
  transform: scale(0.96);
}

.btn:disabled,
.icon-btn:disabled,
.choice:disabled {
  transform: none;
}

.tab-btn { position: relative; }

.tab-btn::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: 2px;
  width: 16px;
  height: 2px;
  border-radius: var(--radius-pill);
  background: currentColor;
  opacity: 0;
  transform: translateX(-50%) scaleX(0.4);
  transition: var(--motion-fade), var(--motion-press);
}

.tab-btn.is-active::after {
  opacity: 1;
  transform: translateX(-50%) scaleX(1);
}

.quick-sheet .choice {
  opacity: 0;
  transform: translateY(8px);
}

.quick-sheet.is-open .choice {
  opacity: 1;
  transform: none;
  transition-duration: var(--duration-normal);
  transition-timing-function: var(--ease-enter);
}

.quick-sheet.is-open .choice:nth-of-type(1) { transition-delay: 40ms; }
.quick-sheet.is-open .choice:nth-of-type(2) { transition-delay: 80ms; }
.quick-sheet.is-open .choice:nth-of-type(3) { transition-delay: 120ms; }

.quick-sheet.is-open .choice:active:not(:disabled) {
  transform: scale(0.98);
  transition-delay: 0ms;
  transition-duration: var(--duration-fast);
}

.quick-sheet.is-closing .choice {
  opacity: 0;
  transform: translateY(6px);
  transition: var(--motion-exit);
  transition-delay: 0ms;
}

.panel:not([hidden]) {
  animation: motion-in var(--duration-normal) var(--ease-enter);
}

.toast,
.alert {
  opacity: 0;
  transform: translateY(6px);
  transition: var(--motion-enter);
}

.toast.is-open,
.alert.is-open {
  opacity: 1;
  transform: none;
}

.toast.is-closing,
.alert.is-closing {
  transition: var(--motion-exit);
  transform: none;
}

.toast.is-open::before {
  animation: motion-pop var(--duration-normal) var(--ease-enter);
}

.field-error:not([hidden]) {
  animation: motion-in var(--duration-fast) var(--ease-enter);
}

.btn.is-loading {
  pointer-events: none;
}

.btn.is-loading:disabled { opacity: 1; }

.btn.is-loading::after {
  content: "";
  width: var(--icon-16);
  height: var(--icon-16);
  margin-inline-start: var(--space-2);
  border: 2px solid currentColor;
  border-inline-end-color: transparent;
  border-radius: 50%;
  animation: motion-spin 0.7s linear infinite;
}

.btn.is-success {
  background: var(--success);
  color: #fff;
  border-color: transparent;
}

#catalog-list,
#dash-counts,
#store-list,
#preview-list {
  transition: var(--motion-fade);
}

body.is-store-loading #catalog-list,
body.is-store-loading #dash-counts,
body.is-store-loading #store-list,
body.is-store-loading #preview-list {
  opacity: 0.45;
}

.camera-stage:not([hidden]) .scanner-top,
.camera-stage:not([hidden]) .scanner-head,
.camera-stage:not([hidden]) .scanner-bar,
.scanner:not([hidden]) .scanner-head,
.scanner:not([hidden]) .scanner-bar,
#barcode-manual-box:not([hidden]) {
  animation: motion-in var(--duration-normal) var(--ease-enter);
}

.camera-stage video,
.scanner video,
.scan-frame { animation: none; }

.camera-stage.is-hit .scan-frame,
.scanner.is-hit .scan-frame { border-color: var(--success); }

.camera-feedback-flash {
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  opacity: 0;
  border: 0 solid transparent;
  box-shadow: none;
  background: transparent;
}

.camera-feedback-flash.is-on.is-lock {
  border-width: 5px;
  border-color: rgba(90, 210, 130, 0.95);
  box-shadow: inset 0 0 0 100vmax rgba(45, 160, 90, 0.2);
  animation: camera-lock-flash 300ms ease-out forwards;
}

.camera-feedback-flash.is-on.is-shutter {
  background: rgba(255, 255, 255, 0.32);
  animation: camera-shutter-flash 160ms ease-out forwards;
}

.camera-stage.is-lock-flash .scan-frame {
  border-color: rgba(90, 210, 130, 0.95);
}

@keyframes camera-lock-flash {
  0% { opacity: 1; }
  70% { opacity: 0.85; }
  100% { opacity: 0; }
}

@keyframes camera-shutter-flash {
  0% { opacity: 1; }
  100% { opacity: 0; }
}

.motion-in {
  animation: motion-in var(--duration-normal) var(--ease-enter);
}

.store-photo.motion-out,
.photo-preview.motion-out {
  opacity: 0;
  transition: var(--motion-exit);
}

details.field-group[open] > :not(summary) {
  animation: motion-in var(--duration-normal) var(--ease-enter);
}

@media (hover: hover) {
  .nav-btn:hover,
  .product-open-btn:hover,
  .recent-row:hover,
  .store-row:hover {
    background: var(--surface-muted);
  }
}

@keyframes motion-in {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: none; }
}

@keyframes motion-pop {
  from { opacity: 0; transform: scale(0.92); }
  to { opacity: 1; transform: none; }
}

@keyframes motion-spin {
  to { transform: rotate(360deg); }
}

body.preview-open .topbar,
body.preview-open .tabbar,
body.preview-open .install-bar {
  display: none;
}

body.preview-open .shell {
  width: 100%;
  max-width: none;
  padding: 0;
}

body.preview-open {
  overflow: hidden;
}

.preview-panel {
  gap: 0;
  height: 100dvh;
  max-height: 100dvh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.preview-admin {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  padding-top: calc(var(--space-3) + env(safe-area-inset-top, 0px));
  background: var(--surface);
  color: var(--text);
  border-bottom: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
}

.preview-admin p {
  margin: 0;
  font-size: var(--text-label);
  font-weight: 650;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}

.preview-admin .btn {
  flex-shrink: 0;
  white-space: nowrap;
}

.preview-site {
  flex: 1;
  min-height: 0;
  overflow: hidden;
  background: var(--bg);
}

.preview-iframe-wrap {
  width: 100%;
  height: 100%;
  min-height: 0;
  border: 0;
  background: var(--surface);
  display: block;
}

.shop-header,
.shop-catalog {
  width: min(1040px, 100%);
  margin: 0 auto;
  padding: var(--space-6) var(--space-4);
}

.shop-header {
  display: flex;
  align-items: center;
  gap: var(--space-4);
}

.shop-logo {
  width: 96px;
  height: 96px;
  object-fit: cover;
  border-radius: var(--radius);
  background: var(--surface-muted);
}

.shop-identity { display: grid; gap: var(--space-2); }
.shop-identity p { color: var(--text-secondary); }

.shop-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: var(--space-4);
}

.shop-card {
  display: grid;
  align-content: start;
  gap: var(--space-3);
  padding: var(--space-3);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}

.shop-card img {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  border-radius: var(--radius-sm);
  background: var(--surface-muted);
}

.shop-copy { display: grid; gap: var(--space-2); }
.shop-copy h2 { font-size: var(--text-card); }
.shop-meta,
.shop-arabic { color: var(--text-secondary); }
.shop-arabic { font-family: var(--arabic); }
.shop-turkish { color: var(--text-secondary); }

@media (max-width: 720px) {
  .shop-grid { grid-template-columns: 1fr; }
  .shop-header,
  .shop-catalog { padding: var(--space-4); }
  .shop-card img { aspect-ratio: 16 / 10; }
  .preview-admin .btn { min-height: var(--control-h); }
}

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

.record-list { display: grid; gap: var(--space-3); }

.record-card,
.product-summary {
  width: 100%;
}

.record-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  min-height: var(--control-h-lg);
  padding: var(--space-4);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface);
  color: inherit;
  text-align: start;
  cursor: pointer;
}

.record-card.is-selected { border-color: var(--primary); }

.record-copy { display: grid; gap: var(--space-1); min-width: 0; }

.record-meta,
.url-host { color: var(--text-secondary); font-size: var(--text-label); }

.record-open {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  color: var(--primary);
  font-weight: 650;
  white-space: nowrap;
}

.record-detail { display: grid; gap: var(--space-4); }

.product.is-detail {
  border: 0;
  padding: 0;
  background: transparent;
}

.product.is-detail .product-summary { display: none; }

.url-preview {
  display: grid;
  gap: var(--space-1);
  padding: var(--space-4);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface-muted);
}

.url-preview a {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  min-height: var(--control-h);
  color: var(--primary);
  font-weight: 650;
}

.danger-zone {
  margin-top: var(--space-8);
  padding-top: var(--space-6);
  border-top: 1px solid var(--border);
}


#catalog.is-record > :not(#product-detail),
#stores.is-record > :not(.store-layout) { display: none; }

#stores.is-record #store-list { display: none; }

@media (min-width: 900px) {
  .store-detail-head {
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: start;
  }
  .store-detail-head .back-link { grid-column: 1 / -1; }
}

.store-map iframe { width: 100%; max-width: 100%; border: 0; border-radius: var(--radius-md); min-height: 220px; }

@media (max-width: 720px) {
  .store-profile,
  .product.is-detail .product-details { gap: var(--space-5); }
}

.batch-import { display: grid; gap: var(--space-4); }

.batch-order-list {
  display: grid;
  gap: var(--space-2);
  margin: 0;
  padding: 0;
  list-style: none;
  max-height: 280px;
  overflow: auto;
}

.batch-order-item {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: var(--space-3);
  align-items: center;
  padding: var(--space-2) var(--space-3);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface-muted);
}

.batch-order-item.is-selected { outline: 2px solid var(--primary); }

.batch-order-item img {
  width: 48px;
  height: 48px;
  object-fit: cover;
  border-radius: var(--radius-sm);
}

.batch-preview-cards {
  display: grid;
  gap: var(--space-4);
}

.batch-group-card {
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: var(--space-4);
  display: grid;
  gap: var(--space-3);
  background: var(--surface-muted);
}

.batch-group-card.is-warning { border-color: #c8922a; }

.batch-draft-fields {
  display: grid;
  gap: 0.5rem;
  margin: 0.75rem 0;
}

.batch-ai-progress { font-style: italic; }

.batch-thumb-row {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}

.batch-thumb {
  position: relative;
  width: 72px;
}

.batch-thumb img {
  width: 72px;
  height: 72px;
  object-fit: cover;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}

.batch-thumb.is-barcode img { outline: 2px solid var(--primary); }

.batch-badge-barcode {
  position: absolute;
  top: 4px;
  left: 4px;
  z-index: 2;
  font-size: 0.7rem;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 4px;
  background: var(--primary);
  color: #fff;
}

.batch-thumb { position: relative; }

.batch-ean-review-list {
  display: grid;
  gap: 1rem;
  margin-bottom: 1rem;
}

.batch-ean-card {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.75rem;
}

.batch-ean-zoom-viewport {
  overflow: hidden;
  max-height: 50vh;
  border-radius: 8px;
  background: #111;
  touch-action: none;
  margin: 0.5rem 0;
}

.batch-ean-zoom-viewport img {
  width: 100%;
  height: auto;
  transform-origin: center center;
  user-select: none;
}

.batch-ean-candidates {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin: 0.5rem 0;
}

.note.is-error { color: var(--danger, #b42318); }
.note.is-success { color: var(--success, #067647); }

.batch-thumb-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-1);
  margin-top: var(--space-1);
}

.batch-thumb-actions button {
  font-size: 0.72rem;
  padding: 2px 6px;
}

.dash-fold {
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface);
}

.dash-fold summary {
  padding: var(--space-3) var(--space-4);
  cursor: pointer;
  font-size: var(--text-section);
  font-weight: 650;
  list-style: none;
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.dash-fold summary::-webkit-details-marker { display: none; }

.dash-fold summary::before {
  content: "";
  flex: 0 0 auto;
  width: 0.45rem;
  height: 0.45rem;
  margin-right: var(--space-1);
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(-45deg);
  transition: transform 0.15s ease;
  opacity: 0.7;
}

.dash-fold[open] summary::before { transform: rotate(45deg); }

.dash-fold > :not(summary) {
  padding: 0 var(--space-4) var(--space-4);
  display: grid;
  gap: var(--space-4);
}

.dash-fold .action-row { padding-top: 0; }

.users-password-fold {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: var(--space-2) var(--space-3);
  background: var(--surface-muted);
}

.users-password-fold summary {
  font-size: var(--text-body);
  font-weight: 650;
  min-height: var(--control-h);
  display: flex;
  align-items: center;
  padding: var(--space-1) 0;
  cursor: pointer;
  list-style: none;
}

.users-password-fold summary::-webkit-details-marker { display: none; }

.users-toggle {
  width: auto;
  justify-self: start;
  min-height: var(--control-h);
}

.users-admin { display: grid; gap: var(--space-4); }
.users-list { display: grid; gap: var(--space-3); }
.users-row {
  display: grid;
  gap: var(--space-2);
  padding: var(--space-3);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
}
.users-row.is-disabled { opacity: 0.65; }
.users-create-form { display: flex; flex-wrap: wrap; gap: var(--space-3); align-items: flex-end; }
.users-create-form .field { flex: 1 1 12rem; margin: 0; }
