* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  background: #f5f5f5;
  color: #333;
  min-height: 100vh;
}

/* ── Layout ────────────────────────────────── */
.page {
  max-width: 480px;
  margin: 0 auto;
  padding: 20px 16px;
  min-height: 100vh;
}

.page-center {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

/* ── Header ────────────────────────────────── */
.page-header {
  text-align: center;
  margin-bottom: 32px;
}

.page-header h1 {
  font-size: 24px;
  font-weight: 600;
  color: #1a1a1a;
  margin-bottom: 4px;
}

.page-header p {
  font-size: 14px;
  color: #999;
}

/* ── Cards ─────────────────────────────────── */
.card {
  background: #fff;
  border-radius: 12px;
  padding: 24px;
  margin-bottom: 16px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.06);
  width: 100%;
}

/* ── Forms ─────────────────────────────────── */
.form-group {
  margin-bottom: 16px;
}

.form-group label {
  display: block;
  font-size: 14px;
  font-weight: 500;
  color: #666;
  margin-bottom: 6px;
}

.form-group input {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid #e0e0e0;
  border-radius: 8px;
  font-size: 16px;
  transition: border-color 0.2s;
  outline: none;
}

.form-group input:focus {
  border-color: #1a1a1a;
}

/* ── Buttons ───────────────────────────────── */
.btn {
  display: block;
  width: 100%;
  padding: 14px;
  border: none;
  border-radius: 8px;
  font-size: 16px;
  font-weight: 500;
  cursor: pointer;
  transition: opacity 0.2s;
  text-align: center;
  text-decoration: none;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-dark {
  background: #1a1a1a;
  color: #fff;
}

.btn-dark:hover:not(:disabled) {
  background: #333;
}

.btn-primary {
  background: #2563eb;
  color: #fff;
}

.btn-primary:hover:not(:disabled) {
  background: #1d4ed8;
}

.btn-outline {
  background: transparent;
  color: #1a1a1a;
  border: 1px solid #ddd;
}

.btn-outline:hover:not(:disabled) {
  background: #f5f5f5;
}

.btn + .btn {
  margin-top: 10px;
}

/* ── Tabs (login/register toggle) ──────────── */
.tabs {
  display: flex;
  background: #f0f0f0;
  border-radius: 8px;
  padding: 3px;
  margin-bottom: 20px;
}

.tab {
  flex: 1;
  padding: 10px;
  text-align: center;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  color: #666;
  border: none;
  background: none;
}

.tab.active {
  background: #fff;
  color: #1a1a1a;
  box-shadow: 0 1px 2px rgba(0,0,0,0.08);
}

/* ── Scan page ─────────────────────────────── */
.scan-btn {
  font-size: 18px;
  padding: 16px;
  margin-bottom: 20px;
}

.field-group {
  background: #fff;
  border-radius: 12px;
  padding: 14px 16px;
  margin-bottom: 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}

.field-label {
  font-size: 14px;
  color: #666;
  font-weight: 500;
}

.field-value {
  font-size: 15px;
  color: #1a1a1a;
  font-weight: 500;
}

.placeholder {
  color: #ccc;
}

.dept-display {
  display: flex;
  align-items: center;
  gap: 6px;
}

.lock-icon {
  font-size: 14px;
}

.update-btn {
  margin-top: 8px;
  margin-bottom: 20px;
}

/* ── Order Details ─────────────────────────── */
.order-details {
  background: #fff;
  border-radius: 12px;
  padding: 16px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}

.detail-row {
  display: flex;
  justify-content: space-between;
  padding: 10px 0;
  border-bottom: 1px solid #f0f0f0;
}

.detail-row:last-child {
  border-bottom: none;
}

.detail-label {
  font-size: 14px;
  color: #999;
}

.detail-value {
  font-size: 14px;
  color: #333;
  font-weight: 500;
  text-align: right;
  max-width: 60%;
  word-break: break-all;
}

.detail-value.highlight {
  color: #2563eb;
  font-weight: 600;
}

/* ── Milestones ────────────────────────────── */
.milestone-section {
  margin-top: 16px;
  padding-top: 12px;
  border-top: 2px solid #f0f0f0;
}

.section-title {
  display: block;
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 10px;
  color: #1a1a1a;
}

.milestone-row {
  display: flex;
  align-items: center;
  padding: 8px 0;
  font-size: 13px;
}

.milestone-label {
  width: 50px;
  color: #999;
  flex-shrink: 0;
}

.milestone-value {
  color: #ccc;
  font-size: 13px;
}

.milestone-value.done {
  color: #16a34a;
  font-weight: 500;
}

.milestone-sep {
  margin: 0 6px;
  color: #ddd;
}

/* ── Pending page ──────────────────────────── */
.pending-icon {
  font-size: 64px;
  margin-bottom: 16px;
}

.pending-text {
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 8px;
}

.pending-desc {
  font-size: 14px;
  color: #999;
  margin-bottom: 24px;
  text-align: center;
  line-height: 1.6;
}

/* ── Alerts / Messages ─────────────────────── */
.alert {
  padding: 12px 14px;
  border-radius: 8px;
  font-size: 14px;
  margin-bottom: 16px;
}

.alert-error {
  background: #fef2f2;
  color: #dc2626;
  border: 1px solid #fecaca;
}

.alert-success {
  background: #f0fdf4;
  color: #16a34a;
  border: 1px solid #bbf7d0;
}

.alert-info {
  background: #eff6ff;
  color: #2563eb;
  border: 1px solid #bfdbfe;
}

.hidden {
  display: none !important;
}

/* ── Loading spinner ───────────────────────── */
.loading {
  text-align: center;
  padding: 20px;
  color: #999;
  font-size: 14px;
}

/* ── Toast notification ────────────────────── */
.toast {
  position: fixed;
  top: 20px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0,0,0,0.8);
  color: #fff;
  padding: 12px 24px;
  border-radius: 8px;
  font-size: 14px;
  z-index: 1000;
  opacity: 0;
  transition: opacity 0.3s;
  pointer-events: none;
}

.toast.show {
  opacity: 1;
}

/* ── Confirm modal ─────────────────────────── */
.modal-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 999;
}

.modal-content {
  background: #fff;
  border-radius: 14px;
  padding: 24px;
  width: 300px;
  text-align: center;
}

.modal-title {
  font-size: 17px;
  font-weight: 600;
  margin-bottom: 10px;
}

.modal-message {
  font-size: 14px;
  color: #666;
  margin-bottom: 20px;
  line-height: 1.5;
}

.modal-actions {
  display: flex;
  gap: 10px;
}

.modal-actions .btn {
  flex: 1;
  padding: 10px;
}

/* ── QR Scanner ────────────────────────────── */
#qr-reader {
  width: 100%;
  border-radius: 12px;
  overflow: hidden;
  margin-bottom: 16px;
}

#qr-reader video {
  border-radius: 12px;
}

/* ── Logout link ───────────────────────────── */
.logout-link {
  display: block;
  text-align: center;
  margin-top: 24px;
  color: #999;
  font-size: 13px;
  cursor: pointer;
  text-decoration: none;
}

.logout-link:hover {
  color: #666;
}

/* ── User info bar ─────────────────────────── */
.user-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 0;
  margin-bottom: 16px;
  font-size: 13px;
  color: #999;
}

.user-bar .nickname {
  font-weight: 500;
  color: #666;
}
