* { margin:0; padding:0; box-sizing:border-box; }
body {
  font-family: 'Inter', system-ui, sans-serif;
  background: #0F0F14;
  color: #E8E8F0;
  padding: 32px 16px;
}
.container { max-width: 860px; margin: 0 auto; }

/* Header */
header { margin-bottom: 32px; }
h1 { font-size: 1.8rem; font-weight: 600; letter-spacing: -0.02em; color: #fff; }
.sub { color: rgba(255,255,255,0.4); font-size: 0.9rem; margin-top: 4px; line-height: 1.5; }

/* Controls bar */
.controls {
  display: flex; justify-content: space-between; align-items: center;
  flex-wrap: wrap; gap: 12px;
  background: #1A1A24; border: 1px solid rgba(255,255,255,0.06);
  border-radius: 12px; padding: 12px 16px; margin-bottom: 24px;
}
.controls.bottom { margin-top: 24px; margin-bottom: 48px; }
.batch-info { font-size: 0.85rem; color: rgba(255,255,255,0.5); display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.divider { opacity: 0.3; }
.approved-badge { color: #4ade80; }
.rejected-badge { color: #f87171; }

.batch-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* Buttons */
.btn {
  font-family: 'Inter', sans-serif; font-size: 0.85rem; font-weight: 500;
  padding: 8px 16px; border-radius: 8px; border: 1px solid rgba(255,255,255,0.1);
  background: rgba(255,255,255,0.05); color: #E8E8F0; cursor: pointer;
  transition: all 0.2s;
}
.btn:hover { background: rgba(255,255,255,0.1); border-color: rgba(255,255,255,0.2); }
.btn:disabled { opacity: 0.3; cursor: not-allowed; }
.btn-sm { padding: 6px 12px; font-size: 0.8rem; }
.btn-primary {
  background: #C4A962; color: #0F0F14; font-weight: 600; border: none;
}
.btn-primary:hover { background: #D4B972; }
.btn-primary-reject {
  background: #ef4444; color: #fff; font-weight: 600; border: none;
}
.btn-primary-reject:hover { background: #dc2626; }
.btn-success { background: #22c55e; color: #0F0F14; font-weight: 600; border: none; }
.btn-success:hover { background: #16a34a; }
.btn-secondary { background: transparent; border: 1px solid rgba(255,255,255,0.15); color: rgba(255,255,255,0.6); }
.btn-round-2 { background: rgba(196,169,98,0.15); border-color: rgba(196,169,98,0.4); color: #C4A962; font-weight: 600; }
.btn-secondary:hover { border-color: #C4A962; color: #C4A962; }
.btn-ok { background: transparent; border: 1px solid rgba(34,197,94,0.3); color: #4ade80; }
.btn-ok:hover { background: rgba(34,197,94,0.1); border-color: #4ade80; }
.btn-ok.approved { background: #22c55e; color: #0F0F14; border-color: #22c55e; font-weight: 600; }

/* Reject buttons */
.btn-reject { background: transparent; font-size: 0.78rem; border: 1px solid rgba(239,68,68,0.2); color: rgba(239,68,68,0.7); }
.btn-reject:hover { background: rgba(239,68,68,0.1); border-color: #ef4444; color: #ef4444; }
.btn-reject.wrong-recipient { border-color: rgba(251,146,60,0.2); color: rgba(251,146,60,0.7); }
.btn-reject.wrong-recipient:hover { background: rgba(251,146,60,0.1); border-color: #fb923c; color: #fb923c; }

/* Email card */
.email-card {
  background: #1A1A24; border: 1px solid rgba(255,255,255,0.06);
  border-radius: 16px; margin-bottom: 24px; overflow: hidden;
  transition: border-color 0.3s;
}
.email-card:hover { border-color: rgba(255,255,255,0.12); }
.email-card.approved {
  border-color: rgba(34,197,94,0.3);
}
.email-card.approved .restaurant-header { border-left: 3px solid #22c55e; }
.email-card.rejected {
  border-color: rgba(239,68,68,0.2);
}
.email-card.rejected .restaurant-header { border-left: 3px solid #f87171; }

/* Restaurant info header */
.restaurant-header {
  display: flex; justify-content: space-between; align-items: flex-start;
  flex-wrap: wrap; gap: 8px;
  padding: 16px 20px; border-bottom: 1px solid rgba(255,255,255,0.06);
  border-left: 3px solid transparent; transition: border-color 0.3s;
}
.restaurant-info h3 { font-size: 1.1rem; font-weight: 600; color: #fff; }
.restaurant-meta { font-size: 0.8rem; color: rgba(255,255,255,0.4); margin-top: 2px; display: flex; gap: 12px; flex-wrap: wrap; }
.restaurant-meta span { display: flex; align-items: center; gap: 4px; }
.scores { display: flex; gap: 8px; flex-shrink: 0; }
.score-badge {
  font-size: 0.75rem; font-weight: 600;
  padding: 3px 8px; border-radius: 6px;
}
.score-ai { background: rgba(251,146,60,0.15); color: #fb923c; }
.score-ai.low { background: rgba(239,68,68,0.15); color: #ef4444; }
.score-ai.high { background: rgba(34,197,94,0.15); color: #4ade80; }
.score-gbp { background: rgba(59,130,246,0.15); color: #60a5fa; }
.score-gbp.low { background: rgba(239,68,68,0.15); color: #ef4444; }
.score-gbp.high { background: rgba(34,197,94,0.15); color: #4ade80; }

/* Reject badge */
.reject-badge {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 0.75rem; font-weight: 500; padding: 3px 8px; border-radius: 6px;
  margin-top: 4px;
}
.reject-badge.content { background: rgba(239,68,68,0.15); color: #ef4444; }
.reject-badge.format { background: rgba(251,146,60,0.15); color: #fb923c; }
.reject-badge.wrong-recipient { background: rgba(168,85,247,0.15); color: #c084fc; }

/* Email body */
.email-body {
  padding: 20px;
  font-size: 0.88rem;
  line-height: 1.65;
  white-space: pre-wrap;
  color: rgba(255,255,255,0.8);
  font-family: 'Inter', system-ui, sans-serif;
}

/* Actions bar */
.email-actions {
  display: flex; gap: 8px; padding: 12px 20px;
  border-top: 1px solid rgba(255,255,255,0.06);
  background: rgba(255,255,255,0.02);
  flex-wrap: wrap;
  align-items: center;
}
.reject-group {
  display: flex; gap: 4px; align-items: center;
  margin-left: auto;
}
.reject-group-label {
  font-size: 0.72rem; color: rgba(255,255,255,0.3);
  text-transform: uppercase; letter-spacing: 0.05em; margin-right: 4px;
}

/* Regenerating state */
.email-card.regenerating .email-body { opacity: 0.5; }
.email-card.regenerating .email-body::after {
  content: "Regenerating...";
  display: block; text-align: center; padding: 20px;
  font-size: 0.85rem; color: #C4A962; font-weight: 500;
}

/* Modal */
.modal-overlay {
  position: fixed; top: 0; left: 0; width: 100%; height: 100%;
  background: rgba(0,0,0,0.7); z-index: 1000;
  display: flex; align-items: center; justify-content: center;
  padding: 24px;
}
.modal {
  background: #1A1A24; border: 1px solid rgba(255,255,255,0.1);
  border-radius: 16px; padding: 32px; max-width: 500px; width: 100%;
}
.modal h3 { font-size: 1.2rem; margin-bottom: 4px; }
.modal-sub { font-size: 0.85rem; color: rgba(255,255,255,0.4); margin-bottom: 20px; }
.form-group { margin-bottom: 16px; }
.form-group label { display: block; font-size: 0.82rem; font-weight: 500; margin-bottom: 6px; color: rgba(255,255,255,0.6); }
.form-group .optional { font-weight: 400; color: rgba(255,255,255,0.3); font-size: 0.78rem; }
.form-group textarea {
  width: 100%; background: #16161E; border: 1px solid rgba(255,255,255,0.06);
  border-radius: 8px; padding: 12px; color: #E8E8F0; font-size: 0.85rem;
  font-family: 'Inter', sans-serif; resize: vertical; min-height: 80px;
}
.form-group textarea:focus { outline: none; border-color: rgba(196,169,98,0.4); }
.form-group .hint { font-size: 0.75rem; color: rgba(255,255,255,0.25); margin-top: 4px; }
.modal-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 20px; }

/* Panels (reject log, pattern view) */
.panel {
  background: #1A1A24; border: 1px solid rgba(255,255,255,0.08);
  border-radius: 16px; margin-bottom: 24px; overflow: hidden;
}
.panel-header {
  display: flex; justify-content: space-between; align-items: center;
  padding: 16px 20px; border-bottom: 1px solid rgba(255,255,255,0.06);
}
.panel-header h2 { font-size: 1rem; font-weight: 600; }
.panel-content { padding: 16px 20px; }
.reject-entry, .pattern-entry {
  padding: 12px 0; border-bottom: 1px solid rgba(255,255,255,0.04);
  font-size: 0.82rem;
}
.reject-entry:last-child, .pattern-entry:last-child { border-bottom: none; }
.reject-entry .rej-name { font-weight: 600; color: #fff; }
.reject-entry .rej-reason { font-size: 0.75rem; color: rgba(255,255,255,0.4); margin-top: 2px; }
.reject-entry .rej-notes { font-size: 0.78rem; color: rgba(255,255,255,0.3); margin-top: 4px; font-style: italic; }
.pattern-entry .pat-domain { font-weight: 600; color: #fb923c; }
.pattern-entry .pat-detail { font-size: 0.75rem; color: rgba(255,255,255,0.4); margin-top: 2px; }

/* Toast */
.toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%);
  background: #1A1A24; color: #E8E8F0; padding: 12px 24px;
  border-radius: 12px; border: 1px solid rgba(255,255,255,0.1);
  font-size: 0.85rem; font-weight: 500;
  opacity: 0; transition: opacity 0.3s, transform 0.3s;
  pointer-events: none; z-index: 100;
  white-space: nowrap;
}
.toast.show { opacity: 1; }

/* Insight button row */
.insight-bar {
  display: flex; gap: 8px; margin-bottom: 24px; flex-wrap: wrap;
}

/* Responsive */
@media (max-width: 640px) {
  body { padding: 20px 12px; }
  h1 { font-size: 1.4rem; }
  .controls { flex-direction: column; align-items: stretch; }
  .batch-actions { justify-content: center; }
  .restaurant-header { flex-direction: column; align-items: flex-start; }
  .email-body { padding: 16px; font-size: 0.82rem; }
  .reject-group { margin-left: 0; width: 100%; justify-content: flex-end; }
  .toast { white-space: normal; max-width: 90%; }
}

/* Loading */
#queue-loading {
  text-align: center; padding: 60px 20px; color: rgba(255,255,255,0.4);
}
.spinner { display: inline-block; width: 24px; height: 24px; border: 2px solid rgba(255,255,255,0.1); border-top-color: #C4A962; border-radius: 50%; animation: spin 0.8s linear infinite; margin-bottom: 12px; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Empty */
.empty-state { text-align: center; padding: 60px 20px; color: rgba(255,255,255,0.4); }
.empty-state h2 { color: rgba(255,255,255,0.6); margin-bottom: 8px; }