:root {
  --cream:        #F5EFE5;
  --cream-card:   #FAF5EC;
  --ink:          #1E1B17;
  --ink-soft:     #3A3530;
  --ink-muted:    #6F6457;
  --brand:        #3b28cc;
  --brand-dark:   #2a1d9e;
  --rule:         #E6DECB;
}
* { margin: 0; padding: 0; box-sizing: border-box; }
body, body.cream-body { font-family: 'Inter', sans-serif; background: var(--cream); color: var(--ink); min-height: 100vh; }
.container { max-width: 1160px; margin: 0 auto; padding: 1.5rem 1.6rem 4rem; }

/* ============ Floating pill nav ============ */
.pill-nav-shell { position: sticky; top: 1rem; z-index: 100; padding: 0 1.4rem; margin-top: 1rem; }
.pill-nav {
  max-width: 1100px; margin: 0 auto;
  background: white;
  border: 1px solid var(--rule);
  border-radius: 100px;
  padding: 0.55rem 0.75rem 0.55rem 1.4rem;
  display: flex; align-items: center; gap: 1rem;
  box-shadow: 0 6px 24px -10px rgba(30,27,23,0.12);
}
.pn-logo { display: flex; align-items: center; gap: 9px; text-decoration: none; color: var(--ink); font-weight: 800; font-size: 1.05rem; }
.pn-logo img { width: 32px; height: 32px; border-radius: 8px; object-fit: contain; background: transparent; }
.pn-links { flex: 1; display: flex; justify-content: center; gap: 1.6rem; }
.pn-links a { text-decoration: none; color: var(--ink-soft); font-size: 0.92rem; font-weight: 500; padding: 0.35rem 0.2rem; border-bottom: 2px solid transparent; }
.pn-links a:hover { color: var(--ink); }
.pn-links a.active { color: var(--brand); border-bottom-color: var(--brand); }
.btn-pill { display: inline-flex; align-items: center; gap: 8px; padding: 0.85rem 1.5rem; border-radius: 100px; font-family: inherit; font-size: 0.95rem; font-weight: 600; text-decoration: none; cursor: pointer; border: 1.5px solid transparent; white-space: nowrap; transition: background .15s, transform .15s; }
.btn-pill:hover { transform: translateY(-1px); }
.btn-pill-primary { background: var(--brand); color: white; box-shadow: 0 8px 20px -8px rgba(59,40,204,0.55); }
.btn-pill-primary:hover { background: var(--brand-dark); color: white; }
.btn-pill-tiny { padding: 0.45rem 0.95rem; font-size: 0.78rem; }
@media (max-width: 720px) {
  .pn-links { display: none; }
  .pn-logo span { display: none; }
}

/* Use DM Serif Display for the page heading */
.orders-header h1 {
  font-family: 'DM Serif Display', serif;
  font-weight: 400;
  font-size: clamp(1.9rem, 3.6vw, 2.6rem);
  line-height: 1.1;
  color: var(--ink);
}

/* Cards on cream */
.history-card { background: var(--cream-card) !important; border-color: var(--rule) !important; }
.order-card, .payment-card { background: var(--cream-card) !important; border-color: var(--rule) !important; }
.cust-kpi { background: var(--cream-card) !important; border-color: var(--rule) !important; }
.filter-bar { background: var(--cream-card) !important; border-color: var(--rule) !important; }

.main-header {
  background: rgba(244, 246, 254, 0.7);
  backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 1px solid rgba(59,40,204,0.08);
  position: sticky; top: 0; z-index: 100;
}
.header-inner { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; padding: 0.9rem 0; gap: 1rem; }
.logo-area { display: flex; align-items: center; gap: 12px; }
.logo-icon { width: 44px; height: 44px; border-radius: 14px; overflow: hidden; background: #3b28cc; }
.logo-icon img { width: 100%; height: 100%; object-fit: cover; }
.logo-text { font-size: 1.5rem; font-weight: 800; background: linear-gradient(135deg, #1E1B4B, #3b28cc); -webkit-background-clip: text; background-clip: text; color: transparent; }
.logo-text span { color: #6D28D9; background: none; -webkit-text-fill-color: #6D28D9; }
nav ul { display: flex; gap: 1.8rem; list-style: none; }
nav a { text-decoration: none; font-weight: 500; color: #4B5478; font-size: 0.92rem; }
nav a:hover, nav a.active { color: #3b28cc; }

.back-link {
  display: inline-flex; align-items: center; gap: 0.5rem;
  background: white; padding: 0.5rem 1.1rem;
  border-radius: 100px; text-decoration: none;
  color: #1f2a4e; font-weight: 500; font-size: 0.85rem;
  border: 1px solid #E2E8F8; cursor: pointer;
  margin-bottom: 1.2rem;
}
.back-link:hover { border-color: #3b28cc; color: #3b28cc; }

/* ----------- CHECKOUT (order summary + payment) ----------- */
.order-grid { display: grid; grid-template-columns: 1.4fr 1fr; gap: 1.5rem; }
@media (max-width: 760px) { .order-grid { grid-template-columns: 1fr; } }
.order-card, .payment-card {
  background: white; border-radius: 24px; padding: 1.8rem;
  border: 1px solid #ECEFFB;
  box-shadow: 0 1px 3px rgba(15,18,38,0.04), 0 8px 30px -12px rgba(59,40,204,0.10);
}
.order-card h2, .payment-card h2 { font-size: 1.1rem; margin-bottom: 1rem; display: inline-flex; align-items: center; gap: 0.5rem; }
.detail-row { display: flex; justify-content: space-between; padding: 0.6rem 0; border-bottom: 1px solid #ECEFFB; font-size: 0.9rem; }
.detail-row span:first-child { color: #6F7898; }
.total-row {
  background: linear-gradient(135deg, rgba(59,40,204,0.05), rgba(109,40,217,0.05));
  padding: 1rem; border-radius: 16px; margin-top: 1rem;
  display: grid; grid-template-columns: 1fr auto; gap: 6px 1rem;
  font-size: 0.9rem;
}
.total-row span:nth-child(even) { text-align: right; }
.payment-option {
  background: #F8F9FE; border-radius: 14px; padding: 0.9rem 1.1rem; margin-bottom: 0.7rem;
  cursor: pointer; border: 2px solid transparent; font-size: 0.9rem;
  transition: all .15s;
}
.payment-option:hover { background: #ECEFFB; }
.payment-option.selected { border-color: #3b28cc; background: rgba(59,40,204,0.05); }
.btn-confirm {
  background: linear-gradient(135deg, #3b28cc, #6D28D9); color: white; width: 100%;
  padding: 0.9rem; border-radius: 14px; font-weight: 700; border: none;
  margin-top: 1rem; cursor: pointer; font-size: 0.92rem;
  transition: all .2s; box-shadow: 0 8px 20px -6px rgba(59,40,204,0.5);
}
.btn-confirm:hover:not(:disabled) { transform: translateY(-2px); }
.btn-confirm:disabled { opacity: 0.6; cursor: wait; }
.gcash-detail {
  background: white; border-radius: 12px; padding: 0.7rem 0.9rem; margin-top: 0.6rem;
  display: flex; justify-content: space-between; align-items: center; font-size: 0.85rem;
}

/* ----------- ORDER HISTORY ----------- */
.orders-header {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 1.5rem; gap: 1rem; flex-wrap: wrap;
}
.orders-header h1 { font-size: 1.8rem; font-weight: 800; color: #1E1B4B; }
.btn-new-order {
  display: inline-flex; align-items: center; gap: 0.5rem;
  background: #3b28cc; color: white; padding: 0.65rem 1.2rem;
  border-radius: 100px; text-decoration: none; font-weight: 600; font-size: 0.88rem;
  box-shadow: 0 6px 16px -4px rgba(59,40,204,0.4);
  transition: all .2s;
}
.btn-new-order:hover { background: #2a1d9e; transform: translateY(-1px); }

.loading { text-align: center; padding: 3rem; color: #6F7898; }

/* Skeleton (shimmer) */
.skel {
  background: linear-gradient(90deg, #EEF1FB 0%, #F8FAFF 50%, #EEF1FB 100%);
  background-size: 200% 100%;
  animation: skel-shimmer 1.4s ease-in-out infinite;
  border-radius: 8px;
}
.skel-row { height: 110px; border-radius: 18px; margin-bottom: 0.65rem; }
@keyframes skel-shimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}
.error { background: #FEE2E2; color: #991B1B; padding: 1rem; border-radius: 12px; text-align: center; }

.empty-state {
  text-align: center; padding: 4rem 2rem; background: white;
  border-radius: 24px; border: 1px solid #ECEFFB;
  box-shadow: 0 1px 3px rgba(15,18,38,0.04);
}
.empty-state i { font-size: 3rem; color: #C7D4FF; margin-bottom: 1rem; }
.empty-state h2 { color: #1E1B4B; font-weight: 700; margin-bottom: 0.5rem; }
.empty-state p { color: #6F7898; max-width: 380px; margin: 0 auto 1.5rem; }

.history-card {
  display: grid; grid-template-columns: 90px 1fr; gap: 1.2rem;
  background: white; border-radius: 18px; padding: 1rem;
  border: 1px solid #ECEFFB;
  margin-bottom: 0.85rem;
  box-shadow: 0 1px 3px rgba(15,18,38,0.04);
  transition: all .15s;
}
.history-card:hover { border-color: #C7D4FF; transform: translateY(-1px); box-shadow: 0 8px 20px -8px rgba(59,40,204,0.15); }
.history-thumb { aspect-ratio: 350/640; border-radius: 12px; overflow: hidden; background: #F4F6FC; display: flex; align-items: center; justify-content: center; }
.history-thumb img { width: 100%; height: 100%; object-fit: contain; }
.thumb-placeholder { color: #C7D4FF; font-size: 1.6rem; }

.history-body { display: flex; flex-direction: column; min-width: 0; }
.history-top { display: flex; justify-content: space-between; align-items: center; gap: 0.5rem; margin-bottom: 0.45rem; }
.order-ref { font-weight: 700; color: #1E1B4B; font-size: 0.9rem; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
.status-pill { padding: 3px 10px; border-radius: 100px; font-size: 0.72rem; font-weight: 600; }

.history-meta {
  display: flex; flex-wrap: wrap; gap: 0.4rem 1rem;
  font-size: 0.8rem; color: #6F7898;
  margin-bottom: 0.55rem;
}
.history-meta span { display: inline-flex; align-items: center; gap: 5px; }
.history-meta i { color: #3b28cc; opacity: 0.7; font-size: 0.78rem; }

.history-actions { display: flex; gap: 0.4rem; flex-wrap: wrap; margin-bottom: 0.55rem; }
.card-btn {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 0.35rem 0.85rem;
  border-radius: 100px;
  background: white;
  border: 1px solid #E2E8F8;
  color: #1f2a4e;
  font-size: 0.75rem; font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  font-family: inherit;
  transition: all .15s;
}
.card-btn:hover { border-color: #3b28cc; color: #3b28cc; }
.card-btn.danger { color: #B91C1C; border-color: rgba(220,38,38,0.3); }
.card-btn.danger:hover { background: #DC2626; color: white; border-color: #DC2626; }
.card-btn:disabled { opacity: 0.5; cursor: wait; }
.card-btn i { font-size: 0.7rem; }

.history-footer { display: flex; justify-content: space-between; align-items: baseline; margin-top: auto; padding-top: 0.45rem; border-top: 1px dashed #ECEFFB; }
.placed-at { font-size: 0.74rem; color: #8B92AC; }
.total { font-weight: 800; color: #3b28cc; font-size: 1rem; }

@media (max-width: 560px) {
  .container { padding: 1rem 1.2rem 3rem; }
  .history-card { grid-template-columns: 70px 1fr; gap: 0.8rem; padding: 0.8rem; }
  .history-meta { font-size: 0.74rem; gap: 0.3rem 0.8rem; }
}

/* ----------- Customer KPIs ----------- */
.cust-kpis {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 0.85rem; margin-bottom: 1.2rem;
}
.cust-kpi {
  background: white; border: 1px solid #ECEFFB; border-radius: 18px;
  padding: 1rem 1.2rem;
  box-shadow: 0 1px 3px rgba(15,18,38,0.04);
}
.cust-kpi-label { font-size: 0.74rem; color: #6F7898; text-transform: uppercase; letter-spacing: 0.05em; font-weight: 600; }
.cust-kpi-value {
  font-size: 1.6rem; font-weight: 800; margin-top: 0.2rem;
  background: linear-gradient(135deg, #1E1B4B, #3b28cc);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}

/* ----------- Filter bar ----------- */
.filter-bar {
  display: flex; flex-wrap: wrap; gap: 0.5rem;
  background: white; padding: 0.75rem; border-radius: 16px;
  border: 1px solid #ECEFFB; margin-bottom: 0.8rem;
  box-shadow: 0 1px 3px rgba(15,18,38,0.03);
}
.filter-search {
  position: relative; flex: 1 1 220px; min-width: 200px;
}
.filter-search i {
  position: absolute; left: 12px; top: 50%; transform: translateY(-50%);
  color: #8B92AC; font-size: 0.85rem;
}
.filter-search input {
  width: 100%; padding: 0.55rem 0.85rem 0.55rem 2.1rem;
  border: 1px solid #E2E8F8; border-radius: 100px;
  font-family: inherit; font-size: 0.85rem; color: #1f2a4e;
  background: #F8F9FE;
}
.filter-search input:focus { outline: none; border-color: #3b28cc; background: white; }
.filter-select {
  padding: 0.55rem 0.85rem; border: 1px solid #E2E8F8;
  border-radius: 100px; background: white; color: #1f2a4e;
  font-family: inherit; font-size: 0.82rem; cursor: pointer;
}
.filter-select:focus { outline: none; border-color: #3b28cc; }
.filter-reset {
  padding: 0.55rem 1rem; border: 1px solid #E2E8F8;
  border-radius: 100px; background: white; color: #6F7898;
  font-family: inherit; font-size: 0.8rem; font-weight: 600;
  cursor: pointer; display: inline-flex; align-items: center; gap: 5px;
}
.filter-reset:hover { color: #3b28cc; border-color: #3b28cc; }

.filter-summary {
  font-size: 0.78rem; color: #6F7898; margin-bottom: 0.6rem;
  padding-left: 0.4rem;
}

/* ----------- Pager ----------- */
.pager {
  display: flex; justify-content: center; gap: 0.3rem; flex-wrap: wrap;
  margin-top: 1.2rem;
}
.pager-btn {
  min-width: 36px; padding: 0.4rem 0.8rem;
  border: 1px solid #E2E8F8; background: white; color: #1f2a4e;
  border-radius: 10px; font-family: inherit; font-size: 0.82rem; font-weight: 600;
  cursor: pointer;
}
.pager-btn:hover:not(:disabled):not(.active) { border-color: #3b28cc; color: #3b28cc; }
.pager-btn:disabled { opacity: 0.4; cursor: not-allowed; }
.pager-btn.active { background: #3b28cc; color: white; border-color: #3b28cc; }
.pager-gap { padding: 0.4rem 0.3rem; color: #8B92AC; }
