:root {
  --scan-accent: #1548ff;
  --scan-accent-soft: #dfe8ff;
  --scan-ink: #191715;
  --scan-ink-soft: #6b6158;
  --scan-line: rgba(24, 18, 12, 0.1);
  --scan-line-strong: rgba(24, 18, 12, 0.18);
  --scan-surface: rgba(255, 255, 255, 0.9);
  --scan-surface-strong: #fffaf4;
  --scan-shadow: 0 24px 80px rgba(30, 17, 9, 0.12);
  --scan-radius-xl: 2rem;
  --scan-radius-lg: 1.55rem;
  --scan-radius-md: 1.1rem;
  --scan-font-sans: "Manrope", "Segoe UI", sans-serif;
  --scan-font-display: "Georgia", "Times New Roman", serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
  margin: 0;
  overflow: hidden;
}

body {
  color: var(--scan-ink);
  font-family: var(--scan-font-sans);
  background:
    radial-gradient(circle at top left, rgba(255, 255, 255, 0.85), transparent 30%),
    radial-gradient(circle at bottom right, rgba(232, 206, 178, 0.72), transparent 25%),
    linear-gradient(180deg, #fbf5eb, #efe3d5);
}

a {
  color: inherit;
  text-decoration: none;
}

button,
input,
select {
  font: inherit;
}

.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;
}

.is-hidden {
  display: none !important;
}

.scan-body,
.scan-shell,
.scan-stage,
.scan-stage__media,
.scan-stage__panel {
  min-height: 0;
}

.scan-body {
  height: 100dvh;
  overflow: hidden;
}

.scan-body--login {
  overflow: auto;
}

.login-shell {
  min-height: 100%;
  padding: 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

.login-utilities {
  position: fixed;
  top: 1rem;
  right: 1rem;
  z-index: 5;
}

.login-card {
  width: min(32rem, 100%);
  padding: 2rem;
  border: 1px solid rgba(255, 255, 255, 0.7);
  border-radius: 2.25rem;
  background: rgba(255, 255, 255, 0.88);
  box-shadow: 0 28px 90px rgba(58, 38, 17, 0.12);
  text-align: center;
  backdrop-filter: blur(24px);
}

.login-brand {
  width: min(18rem, 100%);
  height: auto;
}

.login-kicker {
  margin: 0.4rem 0 0;
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: var(--scan-ink-soft);
}

.login-title {
  margin: 1rem 0 0;
  font-family: var(--scan-font-display);
  font-size: clamp(2.4rem, 7vw, 4rem);
  line-height: 0.92;
}

.login-form {
  margin-top: 2rem;
  display: grid;
  gap: 1rem;
  text-align: left;
}

.form-field {
  display: grid;
  gap: 0.5rem;
}

.form-field span {
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--scan-ink-soft);
}

.form-field input,
.panel-form input,
.panel-form select,
.search-form__input,
.language-picker select {
  width: 100%;
  border: 1px solid var(--scan-line-strong);
  border-radius: 1rem;
  background: white;
  padding: 0.9rem 1rem;
  outline: none;
  transition:
    border-color 160ms ease,
    box-shadow 160ms ease,
    background-color 160ms ease;
}

.form-field input:focus,
.panel-form input:focus,
.panel-form select:focus,
.search-form__input:focus,
.language-picker select:focus {
  border-color: var(--scan-accent);
  box-shadow: 0 0 0 4px rgba(21, 72, 255, 0.14);
}

.primary-button,
.secondary-button,
.action-button,
.stock-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  border: 0;
  cursor: pointer;
  transition:
    transform 160ms ease,
    background-color 160ms ease,
    border-color 160ms ease,
    opacity 160ms ease;
}

.primary-button {
  width: 100%;
  border-radius: 1.2rem;
  background: linear-gradient(135deg, #1438ad, #2457ff);
  padding: 0.95rem 1.2rem;
  color: white;
  font-weight: 700;
  box-shadow: 0 18px 40px rgba(21, 72, 255, 0.24);
}

.secondary-button {
  border-radius: 1rem;
  border: 1px solid var(--scan-line);
  background: rgba(255, 255, 255, 0.9);
  padding: 0.8rem 1rem;
  font-size: 0.9rem;
  font-weight: 700;
  box-shadow: 0 10px 28px rgba(20, 12, 8, 0.08);
}

.secondary-button--icon {
  white-space: nowrap;
}

.primary-button:hover,
.secondary-button:hover,
.action-button:hover,
.stock-button:hover,
.icon-button:hover {
  transform: translateY(-1px);
}

.scan-shell {
  height: 100%;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  padding: 0.75rem;
  overflow: hidden;
}

.scan-header {
  display: flex;
  align-items: stretch;
  gap: 0.45rem;
  flex-shrink: 0;
  min-width: 0;
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.scan-header::-webkit-scrollbar {
  display: none;
}

.scan-header > * {
  flex: 0 0 auto;
  min-width: 0;
}

.scan-header__brand {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.5rem;
  height: 2.5rem;
  flex-shrink: 0;
  overflow: hidden;
  border: 1px solid var(--scan-line);
  border-radius: 0.95rem;
  background: white;
  box-shadow: 0 10px 28px rgba(20, 12, 8, 0.08);
}

.scan-header__brand:focus-visible {
  outline: none;
  box-shadow:
    0 0 0 4px rgba(21, 72, 255, 0.14),
    0 10px 28px rgba(20, 12, 8, 0.08);
}

.scan-header__logo {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.scan-header__actions {
  display: flex;
  flex-wrap: nowrap;
  align-items: stretch;
  gap: 0.45rem;
  min-width: 0;
  flex-shrink: 0;
}

.scan-header__actions > * {
  min-width: 0;
}

.scan-header__actions .language-picker {
  flex: 0 0 7rem;
}

.scan-header__actions .language-picker select {
  height: 100%;
  padding: 0.72rem 0.8rem;
  font-size: 0.78rem;
}

.scan-header__actions .secondary-button {
  flex: 0 0 auto;
  white-space: nowrap;
  padding: 0.72rem 0.85rem;
  font-size: 0.82rem;
}

.secondary-button--toolbar {
  width: 2.75rem;
  min-width: 2.75rem;
  padding: 0.72rem;
}

.toolbar-icon {
  width: 1.15rem;
  height: 1.15rem;
  display: block;
  object-fit: contain;
}

.toggle-button {
  width: auto;
  min-width: 10rem;
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.55rem;
  border: 1px solid var(--scan-line);
  border-radius: 1.1rem;
  background: rgba(255, 255, 255, 0.9);
  padding: 0.72rem 0.85rem;
  color: var(--scan-ink);
  box-shadow: 0 10px 28px rgba(20, 12, 8, 0.08);
}

.toggle-button__label {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 700;
}

.toggle-button__status {
  display: none;
  flex-shrink: 0;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--scan-ink-soft);
}

.toggle-pill {
  position: relative;
  width: 2.8rem;
  height: 1.55rem;
  flex-shrink: 0;
  border-radius: 999px;
  background: #d7cec2;
  transition: background-color 160ms ease;
}

.toggle-pill__knob {
  position: absolute;
  top: 0.12rem;
  left: 0.15rem;
  width: 1.28rem;
  height: 1.28rem;
  border-radius: 50%;
  background: white;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.18);
  transition: left 160ms ease;
}

.toggle-button.is-on .toggle-pill {
  background: var(--scan-accent);
}

.toggle-button.is-on .toggle-pill__knob {
  left: 1.35rem;
}

.language-picker select {
  min-width: 0;
  padding: 0.8rem 0.9rem;
  font-size: 0.82rem;
}

.scan-stage {
  flex: 1;
  display: grid;
  gap: 0.75rem;
  grid-template-rows: minmax(15rem, 0.95fr) minmax(0, 1.05fr);
  overflow: hidden;
}

.scan-stage__media,
.scan-stage__panel {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.scan-window-bar,
.scan-media-frame,
.scan-panel-body > .panel-card,
.scan-panel-body > .panel-stack > .panel-card,
.scan-panel-body > .panel-stack > .action-strip,
.scan-panel-body > .panel-stack > .action-grid,
.scan-panel-body > .panel-stack > .panel-scroll,
.search-form,
.notice {
  flex-shrink: 0;
}

.scan-window-bar,
.scan-media-frame,
.scan-stage__panel,
.login-card {
  box-shadow: var(--scan-shadow);
}

.scan-window-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.6rem;
  padding: 0.85rem 1rem;
  border: 1px solid var(--scan-line);
  border-radius: 1.45rem;
  background: rgba(255, 255, 255, 0.92);
}

.scan-window-bar__title {
  min-width: 0;
  margin: 0 auto;
  font-family: var(--scan-font-display);
  font-size: 1.25rem;
  font-style: italic;
  font-weight: 700;
  text-align: center;
  color: var(--scan-ink-soft);
}

.scan-window-bar__actions,
.scan-overlay-controls__actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.scan-media-frame {
  position: relative;
  flex: 1;
  min-height: 0;
  overflow: hidden;
  border-radius: 1.7rem;
  background: #181310;
}

.scan-media-frame.has-image {
  border: 1px solid var(--scan-line);
  background: radial-gradient(circle at top, #fbf6f0, #dfc8b0 60%, #d3b395);
}

.scan-video,
.scan-image {
  width: 100%;
  height: 100%;
}

.scan-video {
  object-fit: cover;
}

.scan-image {
  object-fit: contain;
  padding: 1.2rem;
}

.scan-media-frame__gradient {
  position: absolute;
  inset-inline: 0;
  pointer-events: none;
}

.scan-media-frame__gradient--top {
  top: 0;
  height: 5.5rem;
  background: linear-gradient(180deg, rgba(0, 0, 0, 0.58), transparent);
}

.scan-media-frame__gradient--bottom {
  bottom: 0;
  height: 7rem;
  background: linear-gradient(0deg, rgba(0, 0, 0, 0.76), transparent);
}

.scan-overlay-controls,
.scan-known-status {
  position: absolute;
  left: 1rem;
  right: 1rem;
  top: 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.scan-known-status {
  justify-content: flex-start;
}

.status-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.45rem 0.8rem;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.48);
  color: white;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.22em;
  text-transform: uppercase;
}

.icon-button {
  width: 2.4rem;
  height: 2.4rem;
  border: 1px solid var(--scan-line);
  border-radius: 999px;
  background: white;
  color: var(--scan-ink);
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
}

.icon-button--ghost {
  border-color: rgba(255, 255, 255, 0.18);
  background: rgba(255, 255, 255, 0.16);
  color: white;
  backdrop-filter: blur(14px);
}

.icon-button:disabled,
.primary-button:disabled,
.secondary-button:disabled,
.action-button:disabled,
.stock-button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
  transform: none;
}

.search-form {
  display: flex;
  gap: 0.55rem;
  margin-top: 0.75rem;
}

.search-form__button {
  width: 3.2rem;
  border: 1px solid var(--scan-line);
  border-radius: 1rem;
  background: white;
  cursor: pointer;
  box-shadow: 0 10px 24px rgba(20, 12, 8, 0.06);
}

.scan-stage__panel {
  padding: 0;
}

.notice {
  border-radius: 1rem;
  padding: 0.9rem 1rem;
  font-size: 0.92rem;
  font-weight: 700;
}

.notice + .notice,
.notice + .scan-panel-body {
  margin-top: 0.7rem;
}

.notice--success {
  border: 1px solid #c5ead9;
  background: #eefaf3;
  color: #0f734a;
}

.notice--danger {
  border: 1px solid #f1c7c7;
  background: #fff2f2;
  color: #a33838;
}

.notice--warning {
  border: 1px solid #f3dfb4;
  background: #fff8e5;
  color: #8f6413;
}

.scan-panel-body {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.panel-card,
.panel-scroll,
.action-strip,
.action-grid button,
.stock-button {
  border: 1px solid var(--scan-line);
  border-radius: 1.55rem;
  background: rgba(255, 255, 255, 0.84);
}

.panel-card {
  flex: 1;
  min-height: 0;
  padding: 1.4rem;
  background: linear-gradient(180deg, #fffaf3, #efe0cd);
  box-shadow: 0 20px 48px rgba(65, 36, 18, 0.09);
}

.panel-card--center {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
}

.panel-stack {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.panel-stack--stock {
  gap: 0.75rem;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  padding-bottom: calc(0.75rem + env(safe-area-inset-bottom, 0px));
}

.panel-scroll {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  padding: 1rem;
  background: rgba(255, 255, 255, 0.84);
}

.panel-scroll--stock {
  padding: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
}

.panel-card--stock {
  min-height: auto;
  flex: none;
}

.panel-card--stock-summary {
  overflow: hidden;
}

.panel-title {
  margin: 0;
  font-family: var(--scan-font-display);
  font-size: clamp(2.15rem, 8vw, 4.8rem);
  font-style: italic;
  line-height: 0.92;
}

.panel-subtitle {
  margin: 0.55rem 0 0;
  font-size: 1rem;
  font-weight: 800;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--scan-ink-soft);
}

.panel-meta,
.panel-origin,
.panel-price,
.panel-kicker {
  margin: 0.55rem 0 0;
}

.panel-kicker {
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: rgba(21, 72, 255, 0.82);
}

.panel-origin,
.panel-meta {
  max-width: 24rem;
  color: var(--scan-ink-soft);
  line-height: 1.6;
}

.panel-meta {
  font-size: 0.9rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.panel-price {
  font-size: 0.92rem;
  font-weight: 800;
  color: var(--scan-accent);
}

.stock-card {
  width: min(15rem, 100%);
  margin-top: 1.4rem;
  border: 3px solid #14110f;
  border-radius: 1.35rem;
  background: white;
  padding: 1.2rem 1rem;
}

.stock-card__value {
  font-family: var(--scan-font-display);
  font-size: clamp(3rem, 11vw, 4.6rem);
  line-height: 0.92;
}

.stock-card__label {
  margin-top: 0.45rem;
  font-size: 0.84rem;
  font-weight: 800;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: var(--scan-ink-soft);
}

.threshold-alert {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 1rem;
  padding: 0.7rem 0.95rem;
  border-radius: 1rem;
  background: #fce9a9;
  color: #7a5703;
  font-size: 0.85rem;
  font-weight: 800;
}

.action-strip,
.action-grid button,
.stock-button {
  box-shadow: 0 14px 32px rgba(30, 17, 9, 0.08);
}

.action-strip {
  margin-top: 0.75rem;
  padding: 0.25rem;
}

.stock-button {
  width: 100%;
  min-height: 4rem;
  border: 3px solid #14110f;
  border-radius: 1.2rem;
  background: white;
  font-family: var(--scan-font-display);
  font-size: 1.8rem;
  font-weight: 700;
  color: var(--scan-ink);
}

.stock-button[data-delta="-1"] {
  border-color: #c93c3c;
}

.stock-button[data-delta="1"],
.stock-button[data-delta="4"],
.stock-button[data-delta="6"] {
  border-color: #2a8f4a;
}

.action-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.75rem;
  margin-top: 0.75rem;
}

.action-grid .stock-button {
  min-height: 3.8rem;
  font-size: 1.5rem;
}

.panel-form {
  display: grid;
  gap: 0.9rem;
}

.panel-form__header {
  padding: 1rem;
  border: 1px dashed rgba(21, 72, 255, 0.18);
  border-radius: 1.2rem;
  background: #fff7f5;
}

.panel-form__header h2 {
  margin: 0;
  font-family: var(--scan-font-display);
  font-size: 2.2rem;
  line-height: 0.94;
}

.panel-form__header p {
  margin: 0.5rem 0 0;
  color: rgba(21, 72, 255, 0.82);
  font-size: 0.9rem;
  font-weight: 700;
}

.panel-form__grid {
  display: grid;
  gap: 0.9rem;
}

.panel-form__grid--double,
.panel-form__grid--triple {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.panel-form__grid--triple {
  grid-template-columns: 1fr;
}

.panel-form label {
  display: grid;
  gap: 0.45rem;
}

.panel-form label span {
  font-size: 0.86rem;
  font-weight: 800;
  color: var(--scan-ink-soft);
}

.panel-form__footer {
  display: grid;
  gap: 0.7rem;
  margin-top: 0.9rem;
}

.panel-list {
  display: grid;
  gap: 0.75rem;
}

.panel-list__item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.8rem;
  padding: 1rem;
  border: 1px solid var(--scan-line);
  border-radius: 1.2rem;
  background: rgba(255, 255, 255, 0.88);
  text-align: left;
}

.panel-list__item-title {
  font-size: 1rem;
  font-weight: 800;
}

.panel-list__item-meta {
  margin-top: 0.25rem;
  font-size: 0.88rem;
  color: var(--scan-ink-soft);
}

.panel-list__item-pill {
  padding: 0.35rem 0.7rem;
  border-radius: 999px;
  background: #f7f1e9;
  font-size: 0.85rem;
  font-weight: 800;
  white-space: nowrap;
}

@media (min-width: 900px) {
  .scan-shell {
    padding: 1rem;
    gap: 1rem;
  }

  .scan-header {
    gap: 0.75rem;
    overflow: visible;
  }

  .scan-header__brand {
    width: 3.25rem;
    height: 3.25rem;
    border-radius: 1.2rem;
  }

  .toggle-button {
    width: auto;
    min-width: 12rem;
    padding-inline: 1rem;
  }

  .toggle-button__status {
    display: inline;
  }

  .scan-header__actions {
    margin-left: auto;
    justify-content: flex-end;
    gap: 0.6rem;
  }

  .scan-header__actions .language-picker {
    flex-basis: 8.5rem;
  }

  .secondary-button--toolbar {
    width: 3rem;
    min-width: 3rem;
  }

  .scan-stage {
    grid-template-columns: minmax(0, 1.08fr) minmax(20rem, 0.92fr);
    gap: 0;
    padding: 1rem;
    border: 1px solid var(--scan-line);
    border-radius: var(--scan-radius-xl);
    background: rgba(255, 255, 255, 0.82);
    backdrop-filter: blur(20px);
  }

  .scan-stage__media {
    padding-right: 1rem;
  }

  .scan-stage__panel {
    padding-left: 1rem;
    border-left: 1px solid rgba(24, 18, 12, 0.08);
  }

  .scan-image {
    padding: 2rem;
  }

  .panel-form__grid--triple {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 599px) {
  .scan-shell {
    padding-inline: 0.55rem;
  }

  .scan-header {
    gap: 0.35rem;
  }

  .scan-header__brand {
    width: 2.2rem;
    height: 2.2rem;
  }

  .toggle-button {
    min-width: 9rem;
    padding-inline: 0.72rem;
  }

  .scan-header__actions {
    gap: 0.35rem;
  }

  .scan-header__actions .language-picker {
    flex-basis: 6.4rem;
  }

  .scan-header__actions .language-picker select,
  .scan-header__actions .secondary-button {
    padding-inline: 0.72rem;
    font-size: 0.76rem;
  }

  .secondary-button--toolbar {
    width: 2.45rem;
    min-width: 2.45rem;
    padding: 0.62rem;
  }

  .toolbar-icon {
    width: 1rem;
    height: 1rem;
  }

  .scan-stage {
    grid-template-rows: minmax(12rem, 0.8fr) minmax(0, 1.2fr);
  }

  .panel-card {
    padding: 1.15rem;
  }

  .stock-button {
    min-height: 3.45rem;
    font-size: 1.65rem;
  }

  .action-grid {
    gap: 0.6rem;
  }

  .action-grid .stock-button {
    min-height: 3.2rem;
    font-size: 1.35rem;
  }
}
