:root {
  color-scheme: light;
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
  background: #f4f7f2;
  color: #172019;
}

* {
  box-sizing: border-box;
}

body {
  min-height: 100vh;
  margin: 0;
}

button,
input {
  font: inherit;
}

button {
  min-height: 44px;
  border: 0;
  border-radius: 8px;
  padding: 0 16px;
  background: #166534;
  color: #fff;
  cursor: pointer;
  font-weight: 700;
}

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

button.secondary {
  background: #d9e4da;
  color: #172019;
}

button.danger {
  background: #b42318;
}

.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 24px max(20px, calc((100vw - 1120px) / 2));
  background: #fff;
  border-bottom: 1px solid #dce5dd;
}

.eyebrow {
  margin: 0 0 4px;
  color: #5d6f62;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: clamp(28px, 5vw, 42px);
  line-height: 1.1;
}

h2 {
  font-size: 20px;
  line-height: 1.25;
}

p {
  color: #627065;
  line-height: 1.6;
}

.status-pill,
.support-tag {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  border-radius: 999px;
  padding: 4px 10px;
  background: #e7efe8;
  color: #166534;
  font-size: 13px;
  font-weight: 800;
  white-space: nowrap;
}

.status-pill.offline {
  background: #fff0d5;
  color: #9a3412;
}

.support-tag.unsupported {
  background: #fee4e2;
  color: #b42318;
}

.app-shell {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(320px, 0.9fr);
  gap: 16px;
  width: min(1120px, calc(100vw - 40px));
  margin: 20px auto 40px;
}

.panel {
  border: 1px solid #dce5dd;
  border-radius: 8px;
  padding: 18px;
  background: #fff;
}

.camera-panel {
  grid-row: span 2;
}

.section-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}

.section-head p {
  margin-top: 6px;
}

.camera-box {
  position: relative;
  overflow: hidden;
  width: 100%;
  aspect-ratio: 4 / 3;
  border-radius: 8px;
  background: #111815;
}

#scanVideo {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.camera-placeholder {
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
  gap: 8px;
  padding: 24px;
  color: #eaf3ec;
  text-align: center;
}

.camera-placeholder span {
  color: #c6d5ca;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 16px;
}

.file-picker {
  display: grid;
  min-height: 112px;
  place-items: center;
  border: 2px dashed #b7c8ba;
  border-radius: 8px;
  background: #f7faf7;
  color: #166534;
  cursor: pointer;
  font-weight: 800;
}

.file-picker input {
  position: fixed;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.image-preview {
  display: grid;
  min-height: 132px;
  margin-top: 12px;
  place-items: center;
  overflow: hidden;
  border: 1px solid #dce5dd;
  border-radius: 8px;
  color: #627065;
  background: #fbfdfb;
}

.image-preview img {
  display: block;
  width: 100%;
  max-height: 240px;
  object-fit: contain;
}

.queue-list {
  display: grid;
  gap: 10px;
  margin: 16px 0 0;
  padding: 0;
  list-style: none;
}

.queue-item {
  display: grid;
  grid-template-columns: 64px minmax(0, 1fr);
  gap: 12px;
  align-items: center;
  min-height: 76px;
  border: 1px solid #dce5dd;
  border-radius: 8px;
  padding: 10px;
  background: #fbfdfb;
}

.queue-thumb {
  display: grid;
  width: 64px;
  height: 56px;
  place-items: center;
  overflow: hidden;
  border-radius: 6px;
  background: #e7efe8;
  color: #166534;
  font-weight: 800;
}

.queue-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.queue-main {
  min-width: 0;
}

.queue-main strong,
.queue-main span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.queue-main span {
  margin-top: 4px;
  color: #627065;
  font-size: 13px;
}

.toast {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 10;
  max-width: min(360px, calc(100vw - 40px));
  border-radius: 8px;
  padding: 12px 14px;
  background: #172019;
  color: #fff;
  box-shadow: 0 12px 28px rgb(23 32 25 / 20%);
  opacity: 0;
  transform: translateY(8px);
  transition:
    opacity 180ms ease,
    transform 180ms ease;
  pointer-events: none;
}

.toast.visible {
  opacity: 1;
  transform: translateY(0);
}

@media (max-width: 860px) {
  .app-header {
    align-items: flex-start;
    flex-direction: column;
  }

  .app-shell {
    grid-template-columns: 1fr;
  }

  .camera-panel {
    grid-row: auto;
  }
}
