:root {
  color-scheme: light;
  --ink: #13201d;
  --muted: #63716d;
  --paper: #f8faf6;
  --panel: #ffffff;
  --panel-strong: #eef4ef;
  --line: #d9e3dc;
  --brand: #0f6f61;
  --brand-dark: #12312b;
  --accent: #eeb94f;
  --danger: #b73a3a;
  --shadow: 0 18px 50px rgb(28 50 40 / 14%);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  background:
    linear-gradient(135deg, rgb(18 49 43 / 8%), transparent 32%),
    linear-gradient(225deg, rgb(238 185 79 / 16%), transparent 28%),
    var(--paper);
  color: var(--ink);
}

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

button {
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.56;
}

.shell {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 390px;
  gap: 18px;
  min-height: 100vh;
  padding: 18px;
}

.workbench,
.side-panel {
  min-width: 0;
}

.app-header,
.panel-header,
.settings-form header,
.scanner-toolbar {
  align-items: center;
  display: flex;
  gap: 12px;
  justify-content: space-between;
}

.app-header h1,
.panel-header h2,
.settings-form h2 {
  font-size: clamp(1.4rem, 2vw, 2.2rem);
  line-height: 1.05;
  margin: 0;
}

.app-header-actions {
  justify-content: flex-end;
}

.eyebrow {
  color: var(--brand);
  font-size: 0.73rem;
  font-weight: 800;
  letter-spacing: 0;
  margin: 0 0 6px;
  text-transform: uppercase;
}

.icon-button {
  align-items: center;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--brand-dark);
  display: inline-flex;
  font-size: 1.25rem;
  height: 42px;
  justify-content: center;
  width: 42px;
}

.settings-button span,
.settings-button span::before,
.settings-button span::after {
  background: currentColor;
  border-radius: 999px;
  content: "";
  display: block;
  height: 4px;
  width: 20px;
}

.settings-button span {
  position: relative;
}

.settings-button span::before {
  left: 0;
  position: absolute;
  top: -7px;
}

.settings-button span::after {
  left: 0;
  position: absolute;
  top: 7px;
}

.batch-id-value {
  font-size: clamp(0.86rem, 3vw, 1rem);
  overflow-wrap: anywhere;
}

label {
  color: var(--muted);
  display: grid;
  font-size: 0.8rem;
  font-weight: 800;
  gap: 7px;
}

input,
select,
textarea {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  min-height: 43px;
  outline: none;
  padding: 10px 12px;
  width: 100%;
}

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

input:focus,
select:focus,
textarea:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgb(15 111 97 / 16%);
}

.scanner-card,
.side-panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.scanner-card {
  overflow: hidden;
}

.scanner-toolbar {
  flex-wrap: wrap;
  padding: 14px;
}

.mode-tabs {
  background: var(--panel-strong);
  border: 1px solid var(--line);
  border-radius: 8px;
  display: inline-grid;
  grid-template-columns: repeat(2, 1fr);
  overflow: hidden;
}

.tab {
  background: transparent;
  border: 0;
  color: var(--muted);
  min-height: 38px;
  min-width: 84px;
  padding: 0 14px;
}

.tab.is-active {
  background: var(--brand-dark);
  color: #fff;
}

.scanner-actions,
.settings-actions {
  align-items: stretch;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.scanner-actions {
  flex: 1 1 360px;
}

.scan-count-pill,
.timer-pill {
  align-items: center;
  background: var(--panel-strong);
  border: 1px solid var(--line);
  border-radius: 8px;
  display: grid;
  min-height: 42px;
  min-width: 86px;
  padding: 6px 10px;
}

.scan-count-pill span,
.timer-pill span {
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 800;
  text-transform: uppercase;
}

.scan-count-pill strong,
.timer-pill strong {
  color: var(--ink);
  font-size: 1rem;
  line-height: 1;
}

.primary-button,
.secondary-button,
.ghost-button,
.remove-button {
  border-radius: 8px;
  font-weight: 800;
  line-height: 1.05;
  min-height: 42px;
  padding: 0 14px;
}

.primary-button {
  background: var(--brand);
  border: 1px solid var(--brand);
  color: #fff;
}

.secondary-button {
  background: #fff;
  border: 1px solid var(--line);
  color: var(--brand-dark);
}

.ghost-button,
.remove-button {
  background: transparent;
  border: 1px solid transparent;
  color: var(--muted);
}

.remove-button {
  color: var(--danger);
  min-height: 34px;
  padding: 0 8px;
}

.scanner-stage {
  aspect-ratio: 16 / 9;
  background:
    linear-gradient(135deg, rgb(18 49 43 / 88%), rgb(15 111 97 / 76%)),
    #12312b;
  min-height: 390px;
  overflow: hidden;
  position: relative;
}

.scandit-view {
  inset: 0;
  position: absolute;
}

.scanner-placeholder {
  align-items: center;
  color: #fff;
  display: grid;
  inset: 0;
  justify-items: center;
  padding: 24px;
  place-content: center;
  position: absolute;
  text-align: center;
  z-index: 1;
}

.scanner-placeholder strong {
  font-size: clamp(1.5rem, 4vw, 3rem);
  line-height: 1;
}

.scanner-placeholder span {
  color: rgb(255 255 255 / 78%);
  margin-top: 10px;
  max-width: 450px;
}

.scan-hud {
  align-items: center;
  background: rgb(255 255 255 / 92%);
  border: 1px solid rgb(255 255 255 / 65%);
  border-radius: 8px;
  display: flex;
  gap: 12px;
  left: 14px;
  padding: 8px 10px;
  position: absolute;
  top: 14px;
  z-index: 2;
}

.scan-hud span {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 800;
}

.scan-hud strong {
  background: var(--accent);
  border-radius: 7px;
  color: #1e1b12;
  min-width: 38px;
  padding: 5px 8px;
  text-align: center;
}

.status-line {
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.9rem;
  margin: 0;
  padding: 12px 14px;
}

.status-line.is-error {
  color: var(--danger);
  font-weight: 800;
}

.send-warning {
  background: #fff7e8;
  border: 1px solid #e6c27e;
  border-left: 5px solid var(--accent);
  border-radius: 8px;
  color: #6f4a00;
  display: grid;
  gap: 4px;
  margin: 10px 0;
  padding: 11px;
}

.send-warning[hidden] {
  display: none;
}

.send-warning strong {
  color: #4d3100;
}

.send-warning span {
  font-size: 0.82rem;
}

.side-panel {
  display: flex;
  flex-direction: column;
  max-height: calc(100vh - 36px);
  overflow: hidden;
  padding: 14px;
  position: sticky;
  top: 18px;
}

.progress-track {
  background: var(--panel-strong);
  border-radius: 999px;
  height: 9px;
  margin: 14px 0;
  overflow: hidden;
}

.progress-track span {
  background: var(--brand);
  display: block;
  height: 100%;
  transition: width 180ms ease;
  width: 0%;
}

.empty-state {
  align-items: center;
  border: 1px dashed var(--line);
  border-radius: 8px;
  color: var(--muted);
  display: grid;
  flex: 1;
  gap: 8px;
  justify-items: center;
  padding: 28px;
  text-align: center;
}

.empty-state[hidden] {
  display: none;
}

.empty-state strong {
  color: var(--ink);
}

.scan-list {
  display: grid;
  gap: 10px;
  list-style: none;
  margin: 0;
  max-height: 100%;
  overflow: auto;
  padding: 0 2px 8px 0;
}

.scan-item {
  align-items: center;
  background: #fff;
  border: 1px solid var(--line);
  border-left: 5px solid var(--brand);
  border-radius: 8px;
  display: grid;
  gap: 10px;
  grid-template-columns: minmax(0, 1fr) auto;
  padding: 11px;
}

.scan-item.is-duplicate {
  border-left-color: var(--danger);
}

.scan-code {
  display: block;
  font-size: 0.95rem;
  line-height: 1.25;
  overflow-wrap: anywhere;
}

.scan-meta {
  color: var(--muted);
  display: block;
  font-size: 0.78rem;
  margin-top: 4px;
}

.proof-photo {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  display: grid;
  gap: 10px;
  margin: 10px 0 12px;
  padding: 11px;
}

.proof-photo-copy {
  align-items: center;
  display: flex;
  justify-content: space-between;
  gap: 10px;
}

.proof-photo-copy span {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 800;
  text-transform: uppercase;
}

.proof-photo-copy strong {
  color: var(--ink);
}

.proof-photo img {
  aspect-ratio: 4 / 3;
  border-radius: 7px;
  height: auto;
  object-fit: cover;
  width: 100%;
}

.proof-photo-actions {
  display: grid;
  gap: 8px;
  grid-template-columns: minmax(0, 1fr) auto;
}

.export-bar {
  align-items: center;
  background: var(--panel);
  border-top: 1px solid var(--line);
  display: grid;
  gap: 10px;
  grid-template-columns: minmax(0, 1fr) minmax(120px, 0.85fr) minmax(112px, 0.8fr);
  margin: auto -14px -14px;
  padding: 14px;
  position: sticky;
  bottom: 0;
}

.batch-footer {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.batch-footer span {
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

.batch-footer strong {
  color: var(--ink);
  line-height: 1.1;
}

.settings-dialog {
  border: 0;
  border-radius: 8px;
  box-shadow: var(--shadow);
  max-width: min(720px, calc(100vw - 28px));
  padding: 0;
  width: 100%;
}

.settings-dialog::backdrop {
  background: rgb(19 32 29 / 48%);
}

.settings-form {
  display: grid;
  gap: 16px;
  padding: 18px;
}

.settings-note {
  background: var(--panel-strong);
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.45;
  margin: -6px 0 0;
  padding: 10px 12px;
}

fieldset {
  border: 1px solid var(--line);
  border-radius: 8px;
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin: 0;
  padding: 14px;
}

legend {
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 800;
  padding: 0 6px;
}

fieldset label {
  align-items: center;
  color: var(--ink);
  display: flex;
  font-weight: 650;
}

fieldset input {
  min-height: 0;
  width: auto;
}

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

  .side-panel {
    max-height: none;
    position: static;
  }
}

@media (max-width: 680px) {
  .shell {
    padding: 10px;
  }

  .scanner-stage {
    aspect-ratio: auto;
    height: 52vh;
    height: 52dvh;
    max-height: 430px;
    min-height: 300px;
  }

  .scanner-toolbar,
  .app-header,
  .panel-header {
    align-items: stretch;
  }

  .scanner-actions,
  .mode-tabs {
    width: 100%;
  }

  .scanner-actions {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 74px 82px;
  }

  .scanner-actions button,
  .export-bar button {
    flex: 1;
  }

  .export-bar {
    grid-template-columns: minmax(0, 1fr) minmax(108px, 0.9fr);
  }

  .batch-footer {
    grid-column: 1 / -1;
  }

  .scan-count-pill,
  .timer-pill {
    min-width: 0;
    padding: 6px 8px;
  }

  fieldset {
    grid-template-columns: 1fr;
  }
}
