/* Admin Dashboard Modern Styling - Fore Coffee */
:root {
  --primary: #014332;
  --primary-hover: #025943;
  --primary-light: #e6f0ed;
  --accent: #d97706;
  --bg-body: #f4f7f6;
  --bg-card: #ffffff;
  --text-main: #111827;
  --text-muted: #6b7280;
  --border: #e5e7eb;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 18px;
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.08);
}

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

body {
  font-family: "Plus Jakarta Sans", system-ui, -apple-system, sans-serif;
  background-color: var(--bg-body);
  color: var(--text-main);
  line-height: 1.5;
  min-height: 100vh;
}

/* Topbar */
.admin-topbar {
  background: #ffffff;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 50;
  box-shadow: var(--shadow-sm);
}

.topbar-inner {
  max-width: 1400px;
  margin: 0 auto;
  padding: 14px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.brand-group {
  display: flex;
  align-items: center;
  gap: 12px;
}

.admin-logo-badge {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ffffff;
  box-shadow: 0 4px 10px rgba(1, 67, 50, 0.25);
}

.admin-logo-badge svg {
  width: 24px;
  height: 24px;
  fill: currentColor;
}

.brand-heading {
  font-size: 18px;
  font-weight: 800;
  color: var(--primary);
  display: flex;
  align-items: center;
  gap: 8px;
  letter-spacing: -0.3px;
}

.badge-role {
  font-size: 10px;
  font-weight: 700;
  background: #fef3c7;
  color: #92400e;
  padding: 2px 8px;
  border-radius: 999px;
  letter-spacing: 0.5px;
}

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

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

.topbar-merchant-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: #ecfdf5;
  border: 1px solid #a7f3d0;
  color: #065f46;
  padding: 6px 14px;
  border-radius: 999px;
  font-size: 12.5px;
  font-weight: 600;
  white-space: nowrap;
}

.pulse-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #10b981;
  box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7);
  animation: pulse-ring 2s infinite cubic-bezier(0.4, 0, 0.6, 1);
}

@keyframes pulse-ring {
  0% {
    transform: scale(0.95);
    box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7);
  }
  70% {
    transform: scale(1);
    box-shadow: 0 0 0 6px rgba(16, 185, 129, 0);
  }
  100% {
    transform: scale(0.95);
    box-shadow: 0 0 0 0 rgba(16, 185, 129, 0);
  }
}

.live-clock {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-muted);
  background: #f3f4f6;
  padding: 6px 12px;
  border-radius: 999px;
}

.btn-topbar-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  border-radius: 999px;
  background: var(--primary-light);
  color: var(--primary);
  text-decoration: none;
  font-size: 12.5px;
  font-weight: 700;
  transition: all 0.2s ease;
}

.btn-topbar-link:hover {
  background: #d1e5df;
}

/* Main Container */
.admin-main {
  max-width: 1400px;
  margin: 0 auto;
  padding: 24px;
}

/* Stats Grid - 4-Card Balanced Layout */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}

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

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 16px 20px;
  display: flex;
  align-items: center;
  gap: 16px;
  box-shadow: var(--shadow-sm);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.stat-sub-text {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 3px;
  font-weight: 500;
}

.stat-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.stat-icon-wrap {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
}

.stat-icon-wrap.green { background: #dcfce7; }
.stat-icon-wrap.amber { background: #fef3c7; }
.stat-icon-wrap.blue { background: #e0f2fe; }
.stat-icon-wrap.purple { background: #f3e8ff; }

.stat-meta {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.stat-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.stat-val {
  font-size: 20px;
  font-weight: 800;
  color: var(--text-main);
  white-space: nowrap;
}

.text-truncate {
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Tabs Bar */
.admin-tabs-bar {
  display: flex;
  gap: 8px;
  border-bottom: 2px solid #e5e7eb;
  margin-bottom: 24px;
  overflow-x: auto;
  padding-bottom: 2px;
}

.admin-tab {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 18px;
  font-family: inherit;
  font-size: 14px;
  font-weight: 700;
  color: var(--text-muted);
  background: transparent;
  border: none;
  border-bottom: 3px solid transparent;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
}

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

.admin-tab.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
}

.tab-pill {
  font-size: 11px;
  padding: 2px 7px;
  border-radius: 999px;
  background: #f3f4f6;
  color: var(--text-muted);
}

.admin-tab.active .tab-pill {
  background: var(--primary-light);
  color: var(--primary);
}

/* Tab Panels */
.tab-panel {
  display: none;
}

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

/* Panel Card */
.panel-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--shadow-sm);
}

.card-header {
  margin-bottom: 20px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
}

.card-header.flex-between {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.card-title {
  font-size: 18px;
  font-weight: 800;
  color: var(--text-main);
}

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

/* Settings Grid (Form + Preview) */
.settings-grid {
  display: grid;
  grid-template-columns: 1fr 400px;
  gap: 24px;
  align-items: start;
}

@media (max-width: 1024px) {
  .settings-grid {
    grid-template-columns: 1fr;
  }
}

.settings-form {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.form-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-field label {
  font-size: 13.5px;
  color: #1f2937;
  display: flex;
  align-items: center;
  gap: 4px;
}

.required-star {
  color: #ef4444;
}

.form-field input[type="text"],
.form-field input[type="number"] {
  width: 100%;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  border: 1.5px solid #d1d5db;
  font-family: inherit;
  font-size: 14px;
  color: var(--text-main);
  background: #ffffff;
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.form-field input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(1, 67, 50, 0.15);
}

.input-with-suffix {
  position: relative;
  display: flex;
  align-items: center;
}

.input-with-suffix input {
  padding-right: 40px;
}

.input-suffix {
  position: absolute;
  right: 14px;
  font-weight: 700;
  color: var(--text-muted);
}

.field-hint {
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.4;
}

.field-hint code {
  background: #f3f4f6;
  padding: 2px 5px;
  border-radius: 4px;
  font-size: 11px;
}

.form-actions {
  display: flex;
  gap: 12px;
  margin-top: 10px;
}

.btn-primary-action {
  padding: 13px 24px;
  border-radius: var(--radius-sm);
  background: var(--primary);
  color: #ffffff;
  border: none;
  font-family: inherit;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  box-shadow: 0 4px 12px rgba(1, 67, 50, 0.25);
  transition: all 0.2s ease;
}

.btn-primary-action:hover {
  background: var(--primary-hover);
  transform: translateY(-1px);
}

.btn-secondary-action {
  padding: 13px 20px;
  border-radius: var(--radius-sm);
  background: #f3f4f6;
  color: var(--text-main);
  border: 1px solid var(--border);
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}

.btn-secondary-action:hover {
  background: #e5e7eb;
}

/* Preview Card */
.badge-tag {
  font-size: 11px;
  font-weight: 700;
  background: #e0f2fe;
  color: #0369a1;
  padding: 3px 8px;
  border-radius: 6px;
}

.flyer-preview-box {
  background: #f9fafb;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.flyer-meta-badge {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 700;
  color: var(--primary);
}

.dot-online {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #10b981;
}

.flyer-img-container {
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.flyer-img-container img {
  max-width: 100%;
  max-height: 280px;
  object-fit: contain;
  border-radius: 4px;
}

.flyer-caption {
  font-size: 11.5px;
  color: var(--text-muted);
  line-height: 1.4;
}

.wa-format-box {
  margin-top: 16px;
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  border-radius: var(--radius-md);
  padding: 14px;
}

.wa-header {
  font-size: 12px;
  font-weight: 700;
  color: #166534;
  margin-bottom: 8px;
}

.wa-pre {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 11px;
  color: #14532d;
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 200px;
  overflow-y: auto;
  line-height: 1.4;
}

/* Orders Table */
.header-tools {
  display: flex;
  align-items: center;
  gap: 10px;
}

.search-input-wrap input {
  padding: 9px 14px;
  border-radius: 999px;
  border: 1px solid #d1d5db;
  font-family: inherit;
  font-size: 13px;
  outline: none;
  min-width: 240px;
}

.search-input-wrap input:focus {
  border-color: var(--primary);
}

.btn-refresh {
  padding: 8px 14px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: #ffffff;
  color: var(--text-main);
  font-family: inherit;
  font-size: 12.5px;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.btn-refresh:hover {
  background: #f3f4f6;
}

.filter-pills-row {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
  overflow-x: auto;
  padding-bottom: 4px;
}

.filter-pill {
  padding: 6px 14px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: #ffffff;
  color: var(--text-muted);
  font-family: inherit;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}

.filter-pill:hover {
  border-color: #9ca3af;
}

.filter-pill.active {
  background: var(--primary);
  color: #ffffff;
  border-color: var(--primary);
}

.table-responsive {
  overflow-x: auto;
  margin-top: 10px;
}

.admin-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.admin-table th {
  background: #f9fafb;
  color: #4b5563;
  font-weight: 700;
  text-align: left;
  padding: 12px 14px;
  border-bottom: 1.5px solid var(--border);
  white-space: nowrap;
}

.admin-table td {
  padding: 14px;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}

.admin-table tr:hover td {
  background: #fdfdfd;
}

.order-id-badge {
  font-family: ui-monospace, monospace;
  font-size: 12px;
  font-weight: 700;
  color: var(--primary);
  display: block;
}

.order-time-text {
  font-size: 11px;
  color: var(--text-muted);
}

.customer-name {
  font-weight: 700;
  display: block;
}

.customer-phone {
  font-size: 11.5px;
  color: var(--text-muted);
}

.store-name-text {
  font-weight: 600;
  color: #1f2937;
}

.order-items-snippet {
  font-size: 12px;
  line-height: 1.4;
  color: #374151;
  max-width: 320px;
}

.order-items-snippet .menu-item-line {
  margin-bottom: 4px;
}

.order-items-snippet .specs-text {
  color: var(--text-muted);
  font-size: 11px;
}

.total-amount-box {
  font-size: 14px;
  font-weight: 800;
  color: var(--primary);
}

.discount-tag {
  display: inline-block;
  font-size: 10.5px;
  font-weight: 700;
  color: #b45309;
  background: #fef3c7;
  padding: 1px 6px;
  border-radius: 4px;
}

/* Status Badges */
.status-badge {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
}

.status-badge.pending_verification {
  background: #fef3c7;
  color: #92400e;
}

.status-badge.paid {
  background: #dbeafe;
  color: #1e40af;
}

.status-badge.completed {
  background: #dcfce7;
  color: #15803d;
}

.status-badge.cancelled {
  background: #fee2e2;
  color: #991b1b;
}

/* Action Buttons */
.action-buttons-wrap {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.btn-table-wa {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 6px 10px;
  background: #25d366;
  color: #ffffff;
  border-radius: 6px;
  text-decoration: none;
  font-size: 11.5px;
  font-weight: 700;
  white-space: nowrap;
}

.btn-table-wa:hover {
  background: #1ebc59;
}

.btn-table-sm {
  padding: 5px 8px;
  background: #f3f4f6;
  color: var(--text-main);
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}

.btn-table-sm:hover {
  background: #e5e7eb;
}

.btn-table-danger {
  color: #dc2626;
  border-color: #fecaca;
  background: #fff5f5;
}

.btn-table-danger:hover {
  background: #fee2e2;
}

/* Empty State */
.empty-box {
  padding: 40px 20px;
  text-align: center;
  color: var(--text-muted);
}

.empty-icon {
  font-size: 36px;
  display: block;
  margin-bottom: 8px;
}

.badge-counter {
  font-size: 12px;
  font-weight: 700;
  color: var(--primary);
  background: var(--primary-light);
  padding: 6px 12px;
  border-radius: 999px;
}

/* Toast */
.admin-toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: #111827;
  color: #ffffff;
  padding: 12px 20px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  gap: 10px;
  box-shadow: var(--shadow-lg);
  font-size: 13.5px;
  font-weight: 600;
  z-index: 1000;
  transition: transform 0.3s ease, opacity 0.3s ease;
}

.admin-toast.hidden {
  opacity: 0;
  transform: translateY(20px);
  pointer-events: none;
}

.toast-icon {
  color: #10b981;
  font-weight: 800;
}

/* Modal */
.admin-modal {
  border: none;
  background: transparent;
  padding: 20px;
  max-width: 650px;
  width: 100%;
  margin: auto;
}

.admin-modal::backdrop {
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(2px);
}

.admin-modal-card {
  background: #ffffff;
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-lg);
}

.modal-head {
  padding: 16px 20px;
  background: #f9fafb;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.btn-close-modal {
  background: none;
  border: none;
  font-size: 18px;
  cursor: pointer;
  color: var(--text-muted);
}

.modal-body {
  padding: 20px;
  max-height: 75vh;
  overflow-y: auto;
}



/* ==========================================================================
   ADMIN LOGIN SCREEN & AUTHENTICATION STYLES
   ========================================================================== */
.admin-login-wrapper {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: radial-gradient(circle at 50% 20%, #e6f0ed 0%, #f4f7f6 70%);
}

.admin-login-wrapper.hidden {
  display: none !important;
}

.admin-app-hidden {
  display: none !important;
}

.login-card {
  width: 100%;
  max-width: 440px;
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 36px 32px;
  box-shadow: 0 20px 40px rgba(1, 67, 50, 0.08);
}

.login-brand {
  text-align: center;
  margin-bottom: 24px;
}

.login-logo-circle {
  width: 56px;
  height: 56px;
  border-radius: 16px;
  background: var(--primary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #ffffff;
  box-shadow: 0 8px 18px rgba(1, 67, 50, 0.25);
  margin-bottom: 12px;
}

.login-logo-circle svg {
  width: 32px;
  height: 32px;
  fill: currentColor;
}

.login-title {
  font-size: 22px;
  font-weight: 800;
  letter-spacing: -0.5px;
  color: var(--primary);
}

.login-subtitle {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 6px;
}

.login-alert {
  background: #fee2e2;
  border: 1px solid #fca5a5;
  color: #991b1b;
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 12.5px;
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 18px;
}

.login-alert.hidden {
  display: none;
}

.login-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.input-icon-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.field-icon {
  position: absolute;
  left: 12px;
  font-size: 14px;
  color: var(--text-muted);
  pointer-events: none;
}

.input-icon-wrap input {
  width: 100%;
  padding: 12px 14px 12px 38px;
  border-radius: var(--radius-sm);
  border: 1.5px solid #d1d5db;
  font-family: inherit;
  font-size: 14px;
  color: var(--text-main);
  background: #ffffff;
  outline: none;
  transition: all 0.2s ease;
}

.input-icon-wrap input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(1, 67, 50, 0.15);
}

.btn-eye-toggle {
  position: absolute;
  right: 12px;
  background: none;
  border: none;
  cursor: pointer;
  font-size: 15px;
  color: var(--text-muted);
  padding: 4px;
}

.btn-block {
  width: 100%;
  justify-content: center;
  padding: 14px;
  font-size: 14.5px;
  margin-top: 6px;
}

.login-hint-box {
  margin-top: 20px;
  padding: 12px;
  background: #f9fafb;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  text-align: center;
  font-size: 11.5px;
  color: #4b5563;
  line-height: 1.4;
}

/* Profile Pill & Logout in Topbar */
.admin-profile-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 5px 12px;
  border-radius: 999px;
  background: #f3f4f6;
  border: 1px solid var(--border);
  font-size: 12.5px;
}

.admin-avatar {
  font-size: 13px;
}

.btn-logout-chip {
  background: #fee2e2;
  color: #991b1b;
  border: 1px solid #fecaca;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-logout-chip:hover {
  background: #fca5a5;
}

/* Profit KPI Highlighting */
.profit-highlight {
  background: #f0fdf4 !important;
  border-color: #86efac !important;
}

.stat-icon-wrap.emerald {
  background: #d1fae5;
  color: #065f46;
}

.stat-icon-wrap.red-tint {
  background: #fee2e2;
}

.profit-margin-sub {
  font-size: 11px;
  font-weight: 700;
  color: #059669;
  margin-top: 2px;
}

/* Profit Values & Badges */
.cost-display-box {
  font-size: 13px;
  font-weight: 700;
  color: #4b5563;
}

.cost-disc-badge {
  font-size: 11px;
  color: #047857;
  font-weight: 600;
  display: block;
  margin-top: 2px;
}

.cost-unset {
  color: #9ca3af;
  font-size: 11.5px;
  display: block;
}

.btn-cost-set {
  background: #e0f2fe;
  color: #0369a1;
  border-color: #7dd3fc;
}

.profit-box {
  display: flex;
  flex-direction: column;
}

.profit-val-positive {
  font-weight: 800;
  color: #059669;
  font-size: 13.5px;
}

.profit-val-negative {
  font-weight: 800;
  color: #dc2626;
  font-size: 13.5px;
}

.profit-pct-badge {
  font-size: 10.5px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 4px;
  display: inline-block;
  width: fit-content;
  margin-top: 2px;
}

.pct-positive {
  color: #047857;
  background: #d1fae5;
}

.pct-negative {
  color: #991b1b;
  background: #fee2e2;
}

.profit-sub-note {
  font-size: 10.5px;
  color: #047857;
  font-weight: 600;
  margin-top: 2px;
}

.profit-unset {
  color: #9ca3af;
  font-size: 12px;
}

.btn-cost-edit {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 3px 8px;
  border-radius: 4px;
  border: 1px dashed #9ca3af;
  background: #ffffff;
  font-size: 11px;
  font-weight: 600;
  color: #374151;
  cursor: pointer;
  margin-top: 4px;
}

.btn-cost-edit:hover {
  background: #f3f4f6;
  border-color: var(--primary);
  color: var(--primary);
}

.item-qty-tag {
  display: inline-block;
  background: #f3f4f6;
  color: #374151;
  padding: 1px 5px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 700;
}

.delivery-badge-tag {
  font-size: 11px;
  font-weight: 600;
  color: var(--primary);
  background: var(--primary-light);
  padding: 2px 7px;
  border-radius: 999px;
  width: fit-content;
  margin-top: 3px;
}

/* Status Dropdown Colors */
.status-select {
  border-radius: 6px;
  font-weight: 700;
  outline: none;
}
.status-select.status-pending_verification {
  background: #fef3c7;
  color: #92400e;
  border-color: #fde68a;
}
.status-select.status-paid {
  background: #dbeafe;
  color: #1e40af;
  border-color: #bfdbfe;
}
.status-select.status-completed {
  background: #dcfce7;
  color: #15803d;
  border-color: #bbf7d0;
}
.status-select.status-cancelled {
  background: #fee2e2;
  color: #991b1b;
  border-color: #fecaca;
}

/* Cost Input with prefix */
.input-with-prefix {
  position: relative;
  display: flex;
  align-items: center;
}

.input-prefix {
  position: absolute;
  left: 14px;
  font-weight: 700;
  color: var(--text-muted);
}

.input-with-prefix input {
  padding-left: 42px !important;
}

.btn-preset-chip {
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid #d1d5db;
  background: #ffffff;
  color: #374151;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
}

.btn-preset-chip:hover {
  background: var(--primary-light);
  border-color: var(--primary);
  color: var(--primary);
}

/* Default Mobile Order Cards (Desktop: Hidden) */
.orders-cards-mobile {
  display: none;
}

/* ==========================================================================
   RESPONSIVE MOBILE STYLES FOR ADMIN DASHBOARD (< 768px)
   ========================================================================== */
@media (max-width: 768px) {
  .admin-topbar {
    position: static;
  }

  .topbar-inner {
    padding: 12px 14px;
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }

  .brand-group {
    justify-content: flex-start;
  }

  .brand-heading {
    font-size: 16px;
  }

  .brand-sub {
    font-size: 11px;
  }

  .topbar-actions {
    width: 100%;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 8px;
  }

  .topbar-merchant-pill {
    font-size: 11px;
    padding: 4px 10px;
  }

  .live-clock {
    display: none;
  }

  .btn-topbar-link {
    font-size: 11.5px;
    padding: 5px 10px;
  }

  .admin-profile-pill {
    padding: 3px 8px;
    font-size: 12px;
  }

  .admin-main {
    padding: 12px 10px;
  }

  /* 2x2 Grid for Mobile Stats */
  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    margin-bottom: 16px;
  }

  .stat-card {
    padding: 12px 10px;
    gap: 10px;
    border-radius: 12px;
  }

  .stat-icon-wrap {
    width: 38px;
    height: 38px;
    font-size: 18px;
    border-radius: 10px;
    flex-shrink: 0;
  }

  .stat-title {
    font-size: 10px;
  }

  .stat-val {
    font-size: 14.5px;
  }

  .stat-sub-text {
    font-size: 9.5px;
  }

  .admin-tabs-bar {
    margin-bottom: 14px;
    gap: 4px;
  }

  .admin-tab {
    padding: 9px 12px;
    font-size: 12px;
  }

  .panel-card {
    padding: 14px 12px;
    border-radius: 14px;
  }

  .card-header.flex-between {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
  }

  .card-title {
    font-size: 16px;
  }

  .card-subtitle {
    font-size: 12px;
  }

  .header-tools {
    width: 100%;
    flex-direction: column;
    gap: 8px;
  }

  .search-input-wrap {
    width: 100%;
  }

  .search-input-wrap input {
    width: 100%;
  }

  .btn-refresh {
    width: 100%;
    justify-content: center;
  }

  /* Switch Orders Table with Mobile Card View on Phone (keep Stores table visible) */
  #tab-orders .table-responsive {
    display: none !important;
  }

  .orders-cards-mobile {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 10px;
  }

  .order-mobile-card {
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 14px;
    padding: 14px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
    display: flex;
    flex-direction: column;
    gap: 10px;
  }

  .omc-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
    padding-bottom: 8px;
    border-bottom: 1px solid #f3f4f6;
  }

  .omc-status-select {
    padding: 4px 8px;
    font-size: 11px;
  }

  .omc-info-grid {
    display: flex;
    flex-direction: column;
    gap: 5px;
    font-size: 12.5px;
  }

  .omc-info-line {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
  }

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

  .omc-customer-name {
    font-size: 13.5px;
    color: #111827;
  }

  .omc-wa-pill {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    padding: 2px 8px;
    border-radius: 999px;
    background: #25d366;
    color: #ffffff;
    font-size: 11px;
    font-weight: 700;
    text-decoration: none;
  }

  .omc-phone-muted {
    font-size: 11.5px;
    color: #6b7280;
  }

  .omc-store-text {
    font-weight: 600;
    color: #374151;
  }

  .omc-delivery-badge {
    font-size: 10.5px;
    font-weight: 600;
    color: var(--primary);
    background: var(--primary-light);
    padding: 1px 7px;
    border-radius: 999px;
  }

  .omc-items-box {
    background: #f9fafb;
    border: 1px solid #f3f4f6;
    border-radius: 10px;
    padding: 10px 12px;
    display: flex;
    flex-direction: column;
    gap: 5px;
  }

  .omc-item-row {
    font-size: 12.5px;
    line-height: 1.35;
  }

  .omc-item-main {
    display: flex;
    align-items: baseline;
    gap: 6px;
  }

  .omc-item-qty {
    font-weight: 800;
    color: var(--primary);
    font-size: 12px;
  }

  .omc-item-name {
    font-weight: 700;
    color: #1f2937;
  }

  .omc-item-spec {
    font-size: 11px;
    color: #6b7280;
    padding-left: 20px;
    margin-top: 1px;
  }

  .omc-financial-grid {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 6px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    padding: 8px 6px;
  }

  .omc-fin-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 2px;
  }

  .omc-fin-label {
    font-size: 9.5px;
    font-weight: 700;
    text-transform: uppercase;
    color: #64748b;
  }

  .omc-fin-val {
    font-size: 12px;
    font-weight: 800;
    color: #1e293b;
    white-space: nowrap;
  }

  .omc-profit-card {
    background: #ecfdf5;
    border-radius: 8px;
    padding: 4px;
    border: 1px solid #a7f3d0;
  }

  .omc-profit-card.profit-loss {
    background: #fef2f2;
    border-color: #fecaca;
  }

  .profit-pct-pill {
    font-size: 9.5px;
    font-weight: 800;
    color: #047857;
    background: #d1fae5;
    padding: 1px 5px;
    border-radius: 4px;
  }

  .cost-tag {
    display: inline-block;
    font-size: 9.5px;
    font-weight: 700;
    color: #0369a1;
    background: #e0f2fe;
    padding: 1px 5px;
    border-radius: 4px;
  }

  .text-primary {
    color: var(--primary) !important;
  }

  .text-emerald {
    color: #059669 !important;
  }

  .text-danger {
    color: #dc2626 !important;
  }

  .text-muted {
    color: #94a3b8 !important;
  }

  .btn-cost-edit-sm {
    padding: 1px 5px;
    border-radius: 4px;
    border: 1px dashed #93c5fd;
    background: #eff6ff;
    color: #1d4ed8;
    font-size: 10px;
    font-weight: 700;
    cursor: pointer;
  }

  .omc-actions-row {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 2px;
  }

  .btn-omc-action {
    flex: 1;
    padding: 7px 8px;
    border-radius: 8px;
    border: 1px solid #d1d5db;
    background: #ffffff;
    color: #374151;
    font-family: inherit;
    font-size: 11.5px;
    font-weight: 700;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    transition: background 0.15s ease;
  }

  .btn-omc-action:hover {
    background: #f3f4f6;
  }

  .btn-omc-danger {
    flex: 0 0 auto;
    color: #dc2626;
    border-color: #fecaca;
    background: #fff5f5;
  }

  .admin-modal {
    padding: 10px;
    max-width: 96vw;
    width: 96vw;
  }

  .admin-modal-card {
    max-height: 90vh;
    overflow-y: auto;
    border-radius: 16px;
  }

  .modal-head {
    padding: 12px 16px;
  }

  .modal-head h3 {
    font-size: 15px;
  }

  .modal-body {
    padding: 14px;
  }

  .login-card {
    padding: 24px 18px;
    border-radius: 16px;
  }

  .login-title {
    font-size: 20px;
  }
}

@media (max-width: 480px) {
  .stats-grid {
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }
  
  .stat-card {
    padding: 10px 8px;
  }

  .stat-val {
    font-size: 13px;
  }
}
