/* ── Mona Admin Dashboard ──────────────────────────────────────────────── */

:root {
  --bg-primary: #f8fafc;
  --bg-secondary: #ffffff;
  --bg-tertiary: #f1f5f9;
  --bg-hover: #e2e8f0;
  --border: #e2e8f0;
  --border-light: #f1f5f9;
  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-muted: #94a3b8;
  --accent: #3b82f6;
  --accent-hover: #2563eb;
  --accent-light: #eff6ff;
  --success: #10b981;
  --success-bg: #ecfdf5;
  --warning: #f59e0b;
  --warning-bg: #fffbeb;
  --danger: #ef4444;
  --danger-bg: #fef2f2;
  --info: #6366f1;
  --info-bg: #eef2ff;
  --radius-sm: 6px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.07), 0 2px 4px -2px rgba(0, 0, 0, 0.05);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.08), 0 4px 6px -4px rgba(0, 0, 0, 0.04);
  --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.04);
  --font-sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', sans-serif;
  --font-mono: 'SF Mono', SFMono-Regular, ui-monospace, Menlo, monospace;
  --transition: 150ms ease;
}

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

body {
  font-family: var(--font-sans);
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* ── Login Page ─────────────────────────────────────────────────────────── */

.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%);
}

.login-card {
  background: var(--bg-secondary);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xl);
  padding: 48px 40px;
  width: 100%;
  max-width: 400px;
  text-align: center;
}

.login-logo {
  font-size: 28px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 8px;
  letter-spacing: -0.5px;
}

.login-subtitle {
  font-size: 14px;
  color: var(--text-secondary);
  margin-bottom: 32px;
}

.login-card .g-signin-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  padding: 12px 24px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--bg-secondary);
  font-size: 14px;
  font-weight: 500;
  color: var(--text-primary);
  cursor: pointer;
  transition: all var(--transition);
}

.login-card .g-signin-btn:hover {
  background: var(--bg-tertiary);
  border-color: #cbd5e1;
  box-shadow: var(--shadow-sm);
}

.login-card .g-signin-btn svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

.login-error {
  margin-top: 16px;
  padding: 10px 14px;
  background: var(--danger-bg);
  color: var(--danger);
  border-radius: var(--radius-sm);
  font-size: 13px;
  display: none;
}

.login-error.visible { display: block; }

.login-loading {
  margin-top: 16px;
  color: var(--text-muted);
  font-size: 13px;
  display: none;
}

.login-loading.visible { display: flex; align-items: center; justify-content: center; gap: 8px; }

/* ── Dashboard Layout ───────────────────────────────────────────────────── */

.dashboard {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Top Bar */
.topbar {
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border);
  padding: 0 24px;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 50;
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.topbar-brand {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.3px;
}

.topbar-badge {
  font-size: 11px;
  font-weight: 500;
  color: var(--accent);
  background: var(--accent-light);
  padding: 2px 8px;
  border-radius: 99px;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 16px;
}

.topbar-email {
  font-size: 13px;
  color: var(--text-secondary);
}

.btn-logout {
  font-size: 13px;
  color: var(--text-secondary);
  background: none;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 6px 12px;
  cursor: pointer;
  transition: all var(--transition);
}

.btn-logout:hover {
  background: var(--bg-tertiary);
  color: var(--text-primary);
}

/* Main Content */
.main-content {
  flex: 1;
  padding: 24px;
  max-width: 1280px;
  margin: 0 auto;
  width: 100%;
}

/* ── Stats Cards ────────────────────────────────────────────────────────── */

.stats-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}

.stat-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
}

.stat-label {
  font-size: 13px;
  color: var(--text-secondary);
  font-weight: 500;
  margin-bottom: 4px;
}

.stat-value {
  font-size: 28px;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -1px;
}

.stat-sub {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
}

.stat-value.skeleton,
.stat-sub.skeleton {
  background: var(--bg-tertiary);
  border-radius: var(--radius-sm);
  color: transparent;
  animation: pulse 1.5s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

/* ── Filters Row ────────────────────────────────────────────────────────── */

.filters-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.filter-select,
.filter-input {
  font-family: var(--font-sans);
  font-size: 13px;
  color: var(--text-primary);
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  outline: none;
  transition: border-color var(--transition);
}

.filter-select:focus,
.filter-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.filter-input { width: 220px; }

.filter-input[type="date"] { width: 150px; }

.filters-row .filter-sep {
  font-size: 12px;
  color: var(--text-muted);
}

.btn-filter-clear {
  font-size: 13px;
  color: var(--accent);
  background: none;
  border: none;
  cursor: pointer;
  padding: 8px 4px;
}

.btn-filter-clear:hover { text-decoration: underline; }

/* ── Orders Table ───────────────────────────────────────────────────────── */

.table-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.table-wrapper {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
}

thead th {
  text-align: left;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-tertiary);
  white-space: nowrap;
}

tbody td {
  padding: 12px 16px;
  font-size: 14px;
  border-bottom: 1px solid var(--border-light);
  vertical-align: middle;
}

tbody tr:last-child td { border-bottom: none; }

tbody tr:hover { background: var(--bg-tertiary); }

.td-id {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-secondary);
}

.td-customer-name {
  font-weight: 500;
  color: var(--text-primary);
}

.td-customer-email {
  font-size: 12px;
  color: var(--text-muted);
}

.td-date {
  font-size: 13px;
  color: var(--text-secondary);
  white-space: nowrap;
}

.td-amount {
  font-family: var(--font-mono);
  font-weight: 600;
}

/* ── Status Badges ──────────────────────────────────────────────────────── */

.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  font-weight: 500;
  padding: 3px 10px;
  border-radius: 99px;
  white-space: nowrap;
}

.status-badge::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  flex-shrink: 0;
}

.status-badge.status-paid { background: var(--warning-bg); color: #b45309; }
.status-badge.status-paid::before { background: var(--warning); }

.status-badge.status-images_uploading,
.status-badge.status-images_uploaded { background: var(--info-bg); color: #4338ca; }
.status-badge.status-images_uploading::before,
.status-badge.status-images_uploaded::before { background: var(--info); }

.status-badge.status-sent_to_printer,
.status-badge.status-printing { background: #eff6ff; color: #1d4ed8; }
.status-badge.status-sent_to_printer::before,
.status-badge.status-printing::before { background: var(--accent); }

.status-badge.status-shipped { background: #f0fdf4; color: #15803d; }
.status-badge.status-shipped::before { background: var(--success); }

.status-badge.status-delivered { background: var(--success-bg); color: #047857; }
.status-badge.status-delivered::before { background: var(--success); }

.status-badge.status-draft { background: var(--bg-tertiary); color: var(--text-muted); }
.status-badge.status-draft::before { background: var(--text-muted); }

/* ── Action Buttons ─────────────────────────────────────────────────────── */

.actions-cell {
  display: flex;
  gap: 6px;
}

.btn {
  font-family: var(--font-sans);
  font-size: 12px;
  font-weight: 500;
  padding: 5px 10px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--transition);
  border: none;
  white-space: nowrap;
}

.btn-view {
  background: var(--bg-tertiary);
  color: var(--text-secondary);
  border: 1px solid var(--border);
}

.btn-view:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.btn-fulfill {
  background: var(--accent);
  color: #fff;
}

.btn-fulfill:hover { background: var(--accent-hover); }
.btn-fulfill:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-primary {
  background: var(--accent);
  color: #fff;
  padding: 8px 16px;
  font-size: 13px;
}

.btn-primary:hover { background: var(--accent-hover); }
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-secondary {
  background: var(--bg-tertiary);
  color: var(--text-secondary);
  border: 1px solid var(--border);
  padding: 8px 16px;
  font-size: 13px;
}

.btn-secondary:hover { background: var(--bg-hover); color: var(--text-primary); }

.btn-danger {
  background: var(--danger);
  color: #fff;
  padding: 8px 16px;
  font-size: 13px;
}

.btn-danger:hover { background: #dc2626; }

/* ── Pagination ─────────────────────────────────────────────────────────── */

.pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-top: 1px solid var(--border);
}

.pagination-info {
  font-size: 13px;
  color: var(--text-secondary);
}

.pagination-buttons {
  display: flex;
  gap: 4px;
}

.pagination-btn {
  font-family: var(--font-sans);
  font-size: 13px;
  padding: 6px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-secondary);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition);
}

.pagination-btn:hover:not(:disabled) {
  background: var(--bg-tertiary);
  color: var(--text-primary);
}

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

.pagination-btn.active {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

/* ── Modal ──────────────────────────────────────────────────────────────── */

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.5);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  opacity: 0;
  visibility: hidden;
  transition: all 200ms ease;
}

.modal-overlay.visible {
  opacity: 1;
  visibility: visible;
}

.modal {
  background: var(--bg-secondary);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xl);
  width: 100%;
  max-height: calc(100vh - 48px);
  display: flex;
  flex-direction: column;
  transform: translateY(10px);
  transition: transform 200ms ease;
}

.modal-overlay.visible .modal {
  transform: translateY(0);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.modal-title {
  font-size: 16px;
  font-weight: 600;
}

.modal-close {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: none;
  color: var(--text-muted);
  cursor: pointer;
  border-radius: var(--radius-sm);
  font-size: 18px;
  transition: all var(--transition);
}

.modal-close:hover {
  background: var(--bg-tertiary);
  color: var(--text-primary);
}

.modal-body {
  flex: 1;
  overflow-y: auto;
  padding: 24px;
}

.modal-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  padding: 16px 24px;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}

/* ── Order Detail ───────────────────────────────────────────────────────── */

.detail-grid {
  display: grid;
  grid-template-columns: 340px 1fr;
  gap: 24px;
}

.detail-section {
  margin-bottom: 20px;
}

.detail-section:last-child { margin-bottom: 0; }

.detail-section-title {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 10px;
}

.detail-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: 6px 0;
}

.detail-label {
  font-size: 13px;
  color: var(--text-secondary);
}

.detail-value {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-primary);
  text-align: right;
}

.detail-value.mono {
  font-family: var(--font-mono);
  font-size: 12px;
}

/* Status Timeline */
.timeline {
  position: relative;
  padding-left: 24px;
}

.timeline::before {
  content: '';
  position: absolute;
  left: 7px;
  top: 4px;
  bottom: 4px;
  width: 2px;
  background: var(--border);
}

.timeline-item {
  position: relative;
  padding-bottom: 16px;
}

.timeline-item:last-child { padding-bottom: 0; }

.timeline-dot {
  position: absolute;
  left: -24px;
  top: 2px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--bg-secondary);
  border: 2px solid var(--border);
  z-index: 1;
}

.timeline-item.active .timeline-dot {
  border-color: var(--accent);
  background: var(--accent);
}

.timeline-item.completed .timeline-dot {
  border-color: var(--success);
  background: var(--success);
}

.timeline-status {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-primary);
}

.timeline-date {
  font-size: 12px;
  color: var(--text-muted);
}

/* Tabs */
.tab-bar {
  display: flex;
  gap: 0;
  border-bottom: 1px solid var(--border);
  margin-bottom: 20px;
}

.tab-btn {
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 500;
  padding: 10px 16px;
  border: none;
  background: none;
  color: var(--text-secondary);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: all var(--transition);
}

.tab-btn:hover { color: var(--text-primary); }

.tab-btn.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* Book item cards */
.book-card {
  background: var(--bg-tertiary);
  border-radius: var(--radius-md);
  padding: 14px;
  margin-bottom: 10px;
}

.book-card:last-child { margin-bottom: 0; }

.book-card-title {
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 6px;
}

.book-card-detail {
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.6;
}

/* PDF Viewer */
.pdf-viewer {
  width: 100%;
  min-height: 600px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--bg-tertiary);
}

.pdf-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.pdf-link {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  background: var(--bg-tertiary);
  border-radius: var(--radius-md);
  text-decoration: none;
  color: var(--text-primary);
  font-size: 13px;
  transition: background var(--transition);
}

.pdf-link:hover { background: var(--bg-hover); }

.pdf-link-icon {
  color: var(--danger);
  flex-shrink: 0;
}

/* PDF Book Section */
.pdf-book-section {
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  margin-bottom: 16px;
  overflow: hidden;
}

.pdf-book-section:last-child { margin-bottom: 0; }

.pdf-book-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: var(--bg-tertiary);
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  user-select: none;
}

.pdf-book-header:hover { background: var(--bg-hover); }

.pdf-book-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 8px;
}

.pdf-book-meta {
  font-size: 12px;
  color: var(--text-secondary);
}

.pdf-book-body {
  padding: 16px;
}

.pdf-actions {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}

.btn-download {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-sans);
  font-size: 12px;
  font-weight: 500;
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg-secondary);
  color: var(--text-primary);
  cursor: pointer;
  text-decoration: none;
  transition: all var(--transition);
}

.btn-download:hover {
  background: var(--bg-tertiary);
  border-color: var(--accent);
  color: var(--accent);
}

/* Book status indicator on card */
.book-status-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-right: 6px;
  flex-shrink: 0;
}

.book-status-dot.uploaded { background: var(--success); }
.book-status-dot.pending { background: var(--warning); }

/* ── Confirmation Dialog ────────────────────────────────────────────────── */

.confirm-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.5);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  opacity: 0;
  visibility: hidden;
  transition: all 200ms ease;
}

.confirm-overlay.visible {
  opacity: 1;
  visibility: visible;
}

.confirm-dialog {
  background: var(--bg-secondary);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xl);
  padding: 24px;
  width: 100%;
  max-width: 420px;
  text-align: center;
}

.confirm-title {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 8px;
}

.confirm-message {
  font-size: 14px;
  color: var(--text-secondary);
  margin-bottom: 20px;
  line-height: 1.5;
}

.confirm-actions {
  display: flex;
  gap: 8px;
  justify-content: center;
}

/* ── Toast ──────────────────────────────────────────────────────────────── */

.toast-container {
  position: fixed;
  top: 16px;
  right: 16px;
  z-index: 300;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toast {
  padding: 12px 16px;
  border-radius: var(--radius-md);
  font-size: 13px;
  font-weight: 500;
  box-shadow: var(--shadow-lg);
  animation: toastIn 200ms ease forwards;
  max-width: 380px;
}

.toast.toast-success { background: var(--success-bg); color: #047857; border: 1px solid #a7f3d0; }
.toast.toast-error { background: var(--danger-bg); color: #b91c1c; border: 1px solid #fca5a5; }
.toast.toast-info { background: var(--info-bg); color: #4338ca; border: 1px solid #c7d2fe; }

.toast.removing { animation: toastOut 200ms ease forwards; }

@keyframes toastIn {
  from { opacity: 0; transform: translateX(20px); }
  to { opacity: 1; transform: translateX(0); }
}

@keyframes toastOut {
  from { opacity: 1; transform: translateX(0); }
  to { opacity: 0; transform: translateX(20px); }
}

/* ── Empty / Loading States ─────────────────────────────────────────────── */

.empty-state {
  text-align: center;
  padding: 48px 24px;
  color: var(--text-muted);
}

.empty-state-icon {
  font-size: 32px;
  margin-bottom: 12px;
  opacity: 0.5;
}

.empty-state-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 4px;
}

.empty-state-text {
  font-size: 13px;
}

.spinner {
  width: 16px;
  height: 16px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 600ms linear infinite;
  display: inline-block;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.table-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 48px;
  gap: 10px;
  color: var(--text-muted);
  font-size: 13px;
}

/* ── Navigation Tabs ────────────────────────────────────────────────────── */

.nav-tabs {
  display: flex;
  gap: 0;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border);
  padding: 0 24px;
}

.nav-tab {
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 500;
  padding: 12px 20px;
  border: none;
  background: none;
  color: var(--text-secondary);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: all var(--transition);
}

.nav-tab:hover { color: var(--text-primary); }

.nav-tab.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

/* ── Sections ──────────────────────────────────────────────────────────── */

.section { display: none; }
.section.active { display: block; }

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}

.section-title {
  font-size: 18px;
  font-weight: 600;
  color: var(--text-primary);
}

.section-subtitle {
  font-size: 13px;
  color: var(--text-secondary);
  margin-top: 4px;
}

/* ── Category Badges ───────────────────────────────────────────────────── */

.category-badge {
  display: inline-flex;
  font-size: 11px;
  font-weight: 500;
  padding: 2px 8px;
  border-radius: 99px;
  white-space: nowrap;
}

.category-badge.category-base_price { background: var(--accent-light); color: #1d4ed8; }
.category-badge.category-spread_price { background: #f0fdf4; color: #15803d; }
.category-badge.category-shipping { background: var(--info-bg); color: #4338ca; }
.category-badge.category-bundle_discount { background: var(--warning-bg); color: #b45309; }
.category-badge.category-page_limits { background: var(--bg-tertiary); color: var(--text-secondary); }

/* ── Coupon Status ─────────────────────────────────────────────────────── */

.coupon-status {
  display: inline-flex;
  font-size: 12px;
  font-weight: 500;
  padding: 3px 10px;
  border-radius: 99px;
  white-space: nowrap;
}

.coupon-status-active { background: var(--success-bg); color: #047857; }
.coupon-status-inactive { background: var(--bg-tertiary); color: var(--text-muted); }
.coupon-status-expired { background: var(--danger-bg); color: #b91c1c; }

.btn-sm-danger {
  font-family: var(--font-sans);
  font-size: 12px;
  font-weight: 500;
  padding: 5px 10px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--transition);
  border: 1px solid var(--danger);
  background: var(--bg-secondary);
  color: var(--danger);
  white-space: nowrap;
}

.btn-sm-danger:hover { background: var(--danger-bg); }

/* ── Form Elements ─────────────────────────────────────────────────────── */

.form-group {
  margin-bottom: 16px;
}

.form-row {
  display: flex;
  gap: 16px;
}

.form-group-half {
  flex: 1;
}

.form-label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-primary);
  margin-bottom: 6px;
}

.form-label .required { color: var(--danger); }

.form-hint {
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.form-input {
  font-family: var(--font-sans);
  font-size: 14px;
  color: var(--text-primary);
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  width: 100%;
  outline: none;
  transition: border-color var(--transition);
}

.form-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.form-input:disabled {
  background: var(--bg-tertiary);
  color: var(--text-muted);
  cursor: not-allowed;
}

.form-textarea {
  resize: vertical;
  min-height: 60px;
}

.form-preview {
  font-size: 13px;
  color: var(--text-secondary);
  margin-top: 8px;
  min-height: 20px;
}

.form-checkbox {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text-primary);
  cursor: pointer;
}

.form-checkbox input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--accent);
}

/* ── Responsive ─────────────────────────────────────────────────────────── */

/* Collapsed PDF section */
.pdf-book-section.collapsed .pdf-book-body { display: none; }
.pdf-book-section.collapsed .pdf-book-header { border-bottom: none; }

/* ── Prodigi Pipeline Tracker ──────────────────────────────────────────── */

.prodigi-pipeline {
  display: flex;
  align-items: flex-start;
  gap: 0;
  padding: 16px 0;
}

.pipeline-step {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  position: relative;
  text-align: center;
}

.pipeline-step-dot {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 2px solid var(--border);
  background: var(--bg-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2;
  transition: all 300ms ease;
  flex-shrink: 0;
}

.pipeline-step-dot svg {
  width: 14px;
  height: 14px;
  display: none;
}

.pipeline-step.complete .pipeline-step-dot {
  border-color: var(--success);
  background: var(--success);
}

.pipeline-step.complete .pipeline-step-dot svg {
  display: block;
  color: #fff;
}

.pipeline-step.in-progress .pipeline-step-dot {
  border-color: var(--accent);
  background: var(--accent);
  animation: pipeline-pulse 1.5s ease-in-out infinite;
}

.pipeline-step.in-progress .pipeline-step-dot svg {
  display: block;
  color: #fff;
}

@keyframes pipeline-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(59, 130, 246, 0.4); }
  50% { box-shadow: 0 0 0 6px rgba(59, 130, 246, 0); }
}

.pipeline-step-label {
  font-size: 11px;
  font-weight: 500;
  color: var(--text-muted);
  margin-top: 6px;
  line-height: 1.3;
  max-width: 80px;
}

.pipeline-step.complete .pipeline-step-label { color: var(--success); }
.pipeline-step.in-progress .pipeline-step-label { color: var(--accent); font-weight: 600; }

.pipeline-connector {
  position: absolute;
  top: 13px;
  left: calc(50% + 14px);
  right: calc(-50% + 14px);
  height: 2px;
  background: var(--border);
  z-index: 1;
}

.pipeline-step.complete .pipeline-connector { background: var(--success); }
.pipeline-step.in-progress .pipeline-connector { background: var(--accent); }

/* ── Prodigi Info Section ──────────────────────────────────────────────── */

.prodigi-section {
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 16px;
  margin-bottom: 16px;
}

.prodigi-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.prodigi-section-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.prodigi-section-title .prodigi-logo {
  width: 14px;
  height: 14px;
  border-radius: 3px;
  background: var(--accent);
  color: #fff;
  font-size: 8px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}

.btn-refresh {
  font-family: var(--font-sans);
  font-size: 12px;
  font-weight: 500;
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg-secondary);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition);
  display: flex;
  align-items: center;
  gap: 4px;
}

.btn-refresh:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
  border-color: var(--accent);
}

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

.btn-refresh .spinner {
  width: 12px;
  height: 12px;
  border-width: 1.5px;
}

.prodigi-last-checked {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 8px;
}

/* Prodigi alerts */
.prodigi-alert {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  line-height: 1.5;
  margin-bottom: 10px;
}

.prodigi-alert-warning {
  background: var(--warning-bg);
  color: #b45309;
  border: 1px solid #fde68a;
}

.prodigi-alert-icon {
  flex-shrink: 0;
  font-size: 14px;
  line-height: 1;
}

/* ── Prodigi Thumbnails ────────────────────────────────────────────────── */

.prodigi-thumbnails {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 10px;
}

.prodigi-thumb {
  position: relative;
  border-radius: var(--radius-md);
  overflow: hidden;
  border: 1px solid var(--border);
  background: var(--bg-tertiary);
  cursor: pointer;
  transition: all var(--transition);
}

.prodigi-thumb:hover {
  border-color: var(--accent);
  box-shadow: var(--shadow-md);
}

.prodigi-thumb img {
  display: block;
  width: 120px;
  height: 120px;
  object-fit: cover;
}

.prodigi-thumb-label {
  font-size: 10px;
  font-weight: 500;
  color: var(--text-secondary);
  text-align: center;
  padding: 4px;
  background: var(--bg-secondary);
  border-top: 1px solid var(--border);
}

.prodigi-thumb-placeholder {
  width: 120px;
  height: 120px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  font-size: 11px;
}

/* ── Prodigi Badge (orders list) ───────────────────────────────────────── */

.prodigi-step-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 10px;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 99px;
  white-space: nowrap;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.prodigi-step-badge.step-downloading {
  background: var(--info-bg);
  color: #4338ca;
}

.prodigi-step-badge.step-preparing {
  background: #faf5ff;
  color: #7c3aed;
}

.prodigi-step-badge.step-allocating {
  background: var(--warning-bg);
  color: #b45309;
}

.prodigi-step-badge.step-printing {
  background: #fff7ed;
  color: #c2410c;
}

.prodigi-step-badge.step-shipping {
  background: var(--success-bg);
  color: #047857;
}

.prodigi-step-badge.step-complete {
  background: var(--success-bg);
  color: #047857;
}

/* ── Environment Badges ────────────────────────────────────────────────── */

.badge-sandbox {
  display: inline-flex;
  align-items: center;
  font-size: 10px;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 99px;
  white-space: nowrap;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  background: var(--warning-bg);
  color: #b45309;
  border: 1px solid #fde68a;
}

.badge-live {
  display: inline-flex;
  align-items: center;
  font-size: 10px;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 99px;
  white-space: nowrap;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  background: var(--success-bg);
  color: #047857;
  border: 1px solid #a7f3d0;
}

.btn-fulfill-test {
  background: var(--bg-secondary);
  color: #b45309;
  border: 1px solid #fde68a;
  padding: 8px 16px;
  font-size: 13px;
}

.btn-fulfill-test:hover {
  background: var(--warning-bg);
  border-color: var(--warning);
}

.btn-fulfill-live {
  background: var(--success);
  color: #fff;
  padding: 8px 16px;
  font-size: 13px;
}

.btn-fulfill-live:hover {
  background: #059669;
}

.btn-go-live {
  background: var(--success);
  color: #fff;
  padding: 8px 16px;
  font-size: 13px;
}

.btn-go-live:hover {
  background: #059669;
}

/* Thumbnail in orders table */
.order-thumb {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  object-fit: cover;
  border: 1px solid var(--border);
  vertical-align: middle;
  margin-right: 8px;
}

.order-id-cell {
  display: flex;
  align-items: center;
  gap: 8px;
}

@media (max-width: 1024px) {
  .stats-row { grid-template-columns: repeat(2, 1fr); }
  .detail-grid { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
  .stats-row { grid-template-columns: 1fr; }
  .filters-row { flex-direction: column; align-items: stretch; }
  .filter-input { width: 100%; }
  .topbar { padding: 0 16px; }
  .nav-tabs { padding: 0 16px; }
  .main-content { padding: 16px; }
  .form-row { flex-direction: column; gap: 0; }
}
