:root {
  --green: #1e8e3e;
  --red: #d93025;
  --amber: #e8710a;
  --blue: #1a73e8;
  --gray: #5f6368;
  --bg: #f4f5f7;
  --card-bg: #ffffff;
  --border: #dadce0;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: #202124;
}

header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  background: #14213d;
  color: white;
}
header h1 { font-size: 20px; margin: 0; }

.status-pill {
  padding: 4px 12px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
}
.status-unknown { background: var(--gray); color: white; }
.status-ok { background: var(--green); color: white; }
.status-error { background: var(--red); color: white; }

main { padding: 16px; max-width: 700px; margin: 0 auto; }

.view.hidden { display: none; }

.view-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}
.view-header h2 { margin: 0; flex: 1; }

.btn {
  border: none;
  border-radius: 10px;
  padding: 12px 18px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  touch-action: manipulation;
}
.btn-primary { background: var(--blue); color: white; }
.btn-secondary { background: #e8eaed; color: #202124; }
.btn-large { width: 100%; padding: 18px; font-size: 18px; margin-top: 12px; }
.btn:active { opacity: 0.8; }
.btn:disabled { opacity: 0.4; cursor: not-allowed; }

.card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 16px;
}

.job-list { display: flex; flex-direction: column; gap: 12px; }

.job-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px;
  cursor: pointer;
}
.job-card:active { background: #f1f3f4; }
.job-card h3 { margin: 0 0 6px 0; }
.job-card .job-meta { color: var(--gray); font-size: 14px; }

.empty-state { color: var(--gray); text-align: center; padding: 40px 0; }

.job-lines { display: flex; flex-direction: column; gap: 12px; }

.line-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px;
}
.line-card.complete { border-color: var(--green); background: #e6f4ea; }

.line-card h4 { margin: 0 0 4px 0; }
.line-card .line-code { color: var(--gray); font-size: 13px; margin-bottom: 10px; }

.progress-bar {
  height: 10px;
  background: #e8eaed;
  border-radius: 6px;
  overflow: hidden;
  margin-bottom: 10px;
}
.progress-fill {
  height: 100%;
  background: var(--blue);
  transition: width 0.2s ease;
}
.line-card.complete .progress-fill { background: var(--green); }

/* Scanner modal */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.9);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}
.modal.hidden { display: none; }

.modal-inner {
  width: 100%;
  max-width: 500px;
  padding: 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.scanner-prompt {
  color: white;
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 12px;
  text-align: center;
}

#scanner-video {
  width: 100%;
  border-radius: 12px;
  background: #000;
}

.scanner-feedback {
  min-height: 60px;
  width: 100%;
  margin-top: 12px;
  padding: 12px;
  border-radius: 10px;
  text-align: center;
  font-weight: 600;
  font-size: 16px;
}
.scanner-feedback.ok { background: var(--green); color: white; }
.scanner-feedback.error { background: var(--red); color: white; }
.scanner-feedback.warn { background: var(--amber); color: white; }
.scanner-feedback:empty { padding: 0; min-height: 0; margin-top: 0; }

.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  background: #202124;
  color: white;
  padding: 12px 24px;
  border-radius: 10px;
  font-weight: 600;
  z-index: 2000;
}
.toast.hidden { display: none; }
.toast.error { background: var(--red); }
.toast.ok { background: var(--green); }

.success-card { text-align: center; }
.success-card h2 { color: var(--green); }
