:root {
  --bg: #eef2f5;
  --ink: #17202a;
  --muted: #687381;
  --line: #d5dde5;
  --panel: #ffffff;
  --soft: #f8fafc;
  --accent: #0f766e;
  --accent-strong: #0b5f59;
  --focus: rgba(15, 118, 110, 0.22);
  --shadow: 0 16px 36px rgba(22, 31, 42, 0.10);
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  font-size: 16px;
}

body {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  background: var(--bg);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
select {
  font: inherit;
}

.app-header {
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(16px);
}

.navbar {
  min-height: 58px;
}

.navbar-brand {
  color: var(--ink);
  font-weight: 850;
}

.nav-link {
  color: var(--muted);
  font-weight: 700;
}

.app-container {
  flex: 1 0 auto;
  width: min(1240px, calc(100% - 32px));
  margin: 0 auto;
  padding: 24px 0 56px;
}

.footer {
  flex: 0 0 auto;
  position: static;
  color: var(--muted);
  padding: 20px 0;
  border-top: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.72);
  line-height: 1.4;
}

.scanner-shell {
  display: grid;
  gap: 18px;
}

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

.header-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
}

.eyebrow {
  margin: 0 0 3px;
  color: var(--accent);
  font-size: 0.76rem;
  font-weight: 850;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: clamp(1.8rem, 4vw, 2.7rem);
  line-height: 1.04;
  font-weight: 850;
}

h2 {
  margin-bottom: 10px;
  font-size: 0.95rem;
  font-weight: 850;
}

.status-pill {
  min-height: 40px;
  min-width: 150px;
  padding: 9px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  color: var(--muted);
  font-weight: 800;
  text-align: center;
}

.status-pill.is-active {
  border-color: rgba(15, 118, 110, 0.30);
  color: var(--accent-strong);
  background: #e7f5f2;
}

.scanner-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 18px;
  align-items: start;
}

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

.camera-panel {
  overflow: hidden;
}

.toolbar {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) minmax(160px, 240px);
  gap: 12px;
  padding: 14px;
  border-bottom: 1px solid var(--line);
  background: var(--soft);
}

.field {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 850;
}

.field select {
  min-height: 42px;
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 12px;
  background: #fff;
  color: var(--ink);
}

.field select:focus,
.action-button:focus,
.ghost-button:focus {
  outline: 3px solid var(--focus);
  outline-offset: 1px;
}

.camera-frame {
  position: relative;
  aspect-ratio: 16 / 9;
  background: #111827;
}

.camera-frame video {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.scan-line {
  position: absolute;
  left: 7%;
  right: 7%;
  top: 50%;
  height: 2px;
  background: #2dd4bf;
  box-shadow: 0 0 20px rgba(45, 212, 191, 0.72);
  opacity: 0.86;
}

.action-button,
.ghost-button {
  min-height: 40px;
  border-radius: 8px;
  padding: 0 16px;
  font-weight: 850;
}

.action-button {
  border: 1px solid var(--accent-strong);
  background: var(--accent);
  color: #fff;
}

.ghost-button {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
}

.results-panel {
  position: sticky;
  top: 78px;
  display: grid;
  gap: 16px;
  padding: 18px;
}

.panel-title {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 14px;
}

.panel-title span {
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 800;
}

.result-group {
  display: grid;
  gap: 8px;
}

.result-list,
.ocr-box {
  display: grid;
  gap: 10px;
  min-height: 82px;
  align-content: start;
}

.result-item {
  display: grid;
  gap: 5px;
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--soft);
}

.result-item strong {
  color: var(--accent-strong);
  font-size: 0.8rem;
}

.result-item span,
.ocr-box p {
  overflow-wrap: anywhere;
  margin: 0;
}

.muted {
  color: var(--muted);
}

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

  .header-actions {
    width: 100%;
    justify-content: flex-start;
  }

  .scanner-grid {
    grid-template-columns: 1fr;
  }

  .results-panel {
    position: static;
  }
}

@media (max-width: 640px) {
  .app-container {
    width: min(100% - 20px, 1240px);
    padding-top: 16px;
  }

  .toolbar {
    grid-template-columns: 1fr;
  }

  .header-actions {
    flex-direction: column;
  }

  .action-button,
  .ghost-button,
  .status-pill {
    width: 100%;
  }

  .camera-frame {
    aspect-ratio: 4 / 3;
  }
}
