body { background: #0a1628; color: #e0e0e0; }

#login-screen {
  max-width: 360px; margin: 60px auto; text-align: center;
}
#login-screen h2 { color: #4fc3f7; margin-bottom: 24px; font-size: 24px; }
#login-screen input {
  display: block; width: 100%; margin: 10px 0; padding: 12px;
  border: 1px solid rgba(255,255,255,0.2); border-radius: 6px;
  background: #0f1f3d; color: #e0e0e0; font-size: 16px;
}
#login-btn {
  width: 100%; padding: 12px; margin-top: 10px;
  background: #4fc3f7; color: #000; border: none; border-radius: 6px;
  font-size: 18px; font-weight: bold; cursor: pointer;
}
#login-error { color: #ef5350; margin-top: 10px; font-size: 14px; }

#scan-screen header {
  display: flex; justify-content: space-between; align-items: center;
  padding: 10px 16px; background: #0f1f3d;
}
#current-operator { font-size: 14px; flex: 1; }
#scanner-project-label {
  font-size: 13px; color: #4fc3f7; background: rgba(79,195,247,0.1);
  padding: 3px 10px; border-radius: 4px; margin-right: 8px;
}
#scanner-project-select {
  background: rgba(255,255,255,0.1); color: #e0e0e0;
  border: 1px solid rgba(255,255,255,0.2); border-radius: 4px;
  padding: 4px 8px; font-size: 13px; margin-right: 8px;
}
#scanner-project-select option {
  background: #1a2332; color: #e0e0e0;
}
#logout-btn {
  background: transparent; color: #ef5350; border: 1px solid #ef5350;
  padding: 4px 12px; border-radius: 4px; cursor: pointer;
}

#reader { width: 100%; max-width: 400px; margin: 10px auto; }

#scan-form { max-width: 400px; margin: 0 auto; padding: 0 16px 20px; }
.field { margin-bottom: 14px; }
.field label { display: block; font-size: 14px; color: #90a4ae; margin-bottom: 4px; }
.field input, .field select {
  width: 100%; padding: 10px; border: 1px solid rgba(255,255,255,0.2);
  border-radius: 6px; background: #0f1f3d; color: #e0e0e0; font-size: 16px;
}

#status-btns { display: flex; gap: 8px; }
.status-btn {
  flex: 1; padding: 8px; border: 1px solid rgba(255,255,255,0.2);
  border-radius: 6px; background: transparent; color: #90a4ae;
  cursor: pointer; font-size: 14px;
}
.status-btn.active { background: #4fc3f7; color: #000; border-color: #4fc3f7; }

#submit-btn {
  width: 100%; padding: 14px; margin-top: 8px;
  background: #66bb6a; color: #fff; border: none; border-radius: 8px;
  font-size: 18px; font-weight: bold; cursor: pointer;
}
#submit-msg { text-align: center; margin-top: 8px; font-size: 14px; min-height: 20px; }
.msg-success { color: #66bb6a; }
.msg-error { color: #ef5350; }
.msg-offline { color: #ffa726; }
.msg-info { color: #90a4ae; }

#device-info {
  display: flex; gap: 10px; margin-top: 6px; font-size: 13px;
}
#device-info .dev-type { color: #4fc3f7; }
#device-info .dev-stage { color: #90a4ae; }

#submit-btn:disabled { opacity: 0.6; }

#offline-badge {
  position: fixed; bottom: 0; left: 0; right: 0;
  background: #ffa726; color: #000; text-align: center;
  padding: 8px; font-size: 14px; font-weight: bold;
}

/* ── Tab bar ─────────────────────────────── */
#tab-bar {
  display: flex; border-bottom: 1px solid rgba(255,255,255,0.1);
}
.tab-btn {
  flex: 1; padding: 12px; border: none; background: transparent;
  color: #90a4ae; font-size: 15px; cursor: pointer;
  border-bottom: 2px solid transparent; transition: all 0.2s;
}
.tab-btn.active {
  color: #4fc3f7; border-bottom-color: #4fc3f7; font-weight: bold;
}

/* ── Tab content visibility ───────────────── */
.tab-content { display: none; }
.tab-content.active { display: block; }
#tab-scan { padding-bottom: 60px; }
#tab-history { padding: 0 12px 60px; }

/* ── History list ────────────────────────── */
.history-item {
  display: flex; flex-wrap: wrap; align-items: center;
  padding: 12px 0; border-bottom: 1px solid rgba(255,255,255,0.06);
  font-size: 14px;
}
.history-item .hi-code {
  flex: 1; font-weight: bold; color: #e0e0e0;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.history-item .hi-badges {
  display: flex; gap: 6px; flex-shrink: 0;
}
.history-item .hi-badge {
  padding: 2px 8px; border-radius: 10px; font-size: 11px;
}
.hi-badge.stage { background: rgba(79,195,247,0.2); color: #4fc3f7; }
.hi-badge.status-done { background: rgba(102,187,106,0.2); color: #66bb6a; }
.hi-badge.status-pending { background: rgba(255,167,38,0.2); color: #ffa726; }
.hi-badge.status-in_progress { background: rgba(79,195,247,0.2); color: #4fc3f7; }
.history-item .hi-meta {
  width: 100%; margin-top: 4px; font-size: 12px; color: #90a4ae;
  display: flex; justify-content: space-between;
}
.history-item .hi-remark {
  width: 100%; margin-top: 2px; font-size: 12px; color: #6e7e8e;
}
.history-item .hi-undo {
  background: transparent; color: #ef5350; border: 1px solid rgba(239,83,80,0.4);
  padding: 2px 10px; border-radius: 4px; font-size: 11px; cursor: pointer;
  margin-left: auto;
}
.history-item .hi-undo:hover { background: rgba(239,83,80,0.15); }
.history-item .hi-undo:disabled { opacity: 0.4; }

/* ── History states ──────────────────────── */
#history-loading, #history-empty, #history-more {
  text-align: center; padding: 24px; color: #6e7e8e; font-size: 14px;
}
#history-more {
  cursor: pointer; color: #4fc3f7; user-select: none;
}
#history-more:hover { color: #81d4fa; }
