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

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 13px;
  background: #f9fafb;
  color: #111827;
}

#app { padding: 12px; }

.state { display: flex; flex-direction: column; align-items: center; justify-content: center; min-height: 120px; gap: 8px; color: #6b7280; }
.hidden { display: none !important; }

.spinner {
  width: 24px; height: 24px;
  border: 2px solid #e5e7eb;
  border-top-color: #6366f1;
  border-radius: 50%;
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

header {
  background: #fff;
  border-radius: 8px;
  padding: 12px;
  margin-bottom: 10px;
  box-shadow: 0 1px 3px rgba(0,0,0,.08);
}
.customer-info { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.avatar {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: #6366f1;
  color: #fff;
  font-size: 15px; font-weight: 600;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
h2 { font-size: 14px; font-weight: 600; }
.muted { color: #6b7280; font-size: 12px; }

.stats { display: flex; gap: 8px; }
.stat {
  flex: 1; background: #f3f4f6; border-radius: 6px;
  padding: 8px; text-align: center;
}
.stat-value { display: block; font-size: 14px; font-weight: 700; color: #111827; }
.stat-label { font-size: 10px; color: #6b7280; text-transform: uppercase; letter-spacing: .5px; }

.order-card {
  background: #fff;
  border-radius: 8px;
  padding: 12px;
  margin-bottom: 8px;
  box-shadow: 0 1px 3px rgba(0,0,0,.08);
}
.order-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.order-number { font-weight: 600; font-size: 13px; }
.order-date { color: #6b7280; font-size: 11px; }
.order-total { font-weight: 700; }

.badge {
  display: inline-block;
  padding: 2px 8px; border-radius: 99px;
  font-size: 11px; font-weight: 500;
}
.badge-fulfilled { background: #d1fae5; color: #065f46; }
.badge-pending   { background: #fef3c7; color: #92400e; }
.badge-cancelled { background: #fee2e2; color: #991b1b; }
.badge-refunded  { background: #e0e7ff; color: #3730a3; }

.order-items { font-size: 12px; color: #4b5563; margin-bottom: 8px; line-height: 1.6; }

.tracking { font-size: 11px; background: #f0fdf4; border-radius: 4px; padding: 4px 8px; margin-bottom: 8px; color: #166534; }

.order-actions { display: flex; flex-wrap: wrap; gap: 4px; }
.btn {
  padding: 4px 10px; border-radius: 5px; border: none;
  cursor: pointer; font-size: 11px; font-weight: 500; transition: opacity .15s;
}
.btn:hover { opacity: .8; }
.btn-danger   { background: #fee2e2; color: #991b1b; }
.btn-warning  { background: #fef3c7; color: #92400e; }
.btn-primary  { background: #6366f1; color: #fff; }
.btn-secondary{ background: #e5e7eb; color: #374151; }
.btn-info     { background: #dbeafe; color: #1e40af; }

.test-mode { display: flex; gap: 6px; margin-top: 8px; }
.test-mode input {
  flex: 1; padding: 6px 8px; border: 1px solid #d1d5db;
  border-radius: 5px; font-size: 12px;
}
.test-mode button { padding: 6px 10px; background: #6366f1; color: #fff; border: none; border-radius: 5px; cursor: pointer; font-size: 12px; }

.modal {
  position: fixed; inset: 0; background: rgba(0,0,0,.4);
  display: flex; align-items: center; justify-content: center; z-index: 100;
}
.modal-content {
  background: #fff; border-radius: 8px; padding: 16px;
  width: 280px; display: flex; flex-direction: column; gap: 8px;
}
.modal-content h3 { font-size: 14px; font-weight: 600; margin-bottom: 4px; }
.modal-content input {
  padding: 6px 8px; border: 1px solid #d1d5db; border-radius: 5px; font-size: 12px;
}
.modal-actions { display: flex; gap: 6px; justify-content: flex-end; margin-top: 4px; }
