:root {
  --bg-page: #0b1120;
  --bg-card: #161f32;
  --bg-input: #0f172a;
  --border: rgba(255, 255, 255, 0.1);
  --text-heading: #f8fafc;
  --text-main: #cbd5e1;
  --text-muted: #94a3b8;
  --accent: #0c66e4;
  --accent-hover: #0055cc;
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: radial-gradient(circle at top right, #1e293b 0%, #0f172a 55%, #0b1120 100%);
  color: var(--text-main);
  min-height: 100vh;
  line-height: 1.5;
}

button, input, select, textarea { font-family: inherit; font-size: inherit; color: inherit; border: none; outline: none; }
button { cursor: pointer; background: transparent; }
a { text-decoration: none; color: inherit; }

/* Auth Screen */
.auth-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px; }
.auth-card { width: 100%; max-width: 420px; background: var(--bg-card); border: 1px solid var(--border); border-radius: 14px; padding: 26px 24px; box-shadow: 0 18px 40px rgba(0, 0, 0, 0.45); }
.auth-tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; background: var(--bg-input); padding: 4px; border-radius: 9px; margin: 16px 0; }
.auth-tab { padding: 8px; border-radius: 7px; font-weight: 600; font-size: 13px; color: var(--text-muted); }
.auth-tab.active { background: var(--accent); color: #fff; }
.auth-demo-note { margin-top: 14px; font-size: 12px; color: var(--text-muted); background: rgba(56, 189, 248, 0.08); border: 1px solid rgba(56, 189, 248, 0.22); border-radius: 8px; padding: 9px 12px; }

/* App Header */
.topbar { position: sticky; top: 0; z-index: 50; background: rgba(15, 23, 42, 0.92); backdrop-filter: blur(10px); border-bottom: 1px solid var(--border); padding: 12px 20px; display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: 10px; }
.brand-icon { width: 34px; height: 34px; border-radius: 9px; background: linear-gradient(135deg, #0c66e4, #06b6d4); display: flex; align-items: center; justify-content: center; color: #fff; font-size: 18px; }

.page-wrap { max-width: 1120px; margin: 0 auto; padding: 22px 16px 60px; }

/* Buttons & Form Inputs */
.btn-primary { background: var(--accent); color: #fff; font-weight: 600; font-size: 13px; padding: 8px 14px; border-radius: 8px; display: inline-flex; align-items: center; gap: 6px; }
.btn-primary:hover { background: var(--accent-hover); }
.btn-secondary { background: rgba(255, 255, 255, 0.07); border: 1px solid var(--border); color: var(--text-heading); font-weight: 600; font-size: 12.5px; padding: 7px 12px; border-radius: 8px; display: inline-flex; align-items: center; gap: 6px; }
.btn-secondary:hover { background: rgba(255, 255, 255, 0.13); }
.btn-whatsapp { background: #16a34a; color: #fff !important; font-weight: 700; font-size: 12.5px; padding: 7px 13px; border-radius: 8px; display: inline-flex; align-items: center; gap: 6px; }
.btn-whatsapp:hover { background: #15803d; }
.btn-danger { color: #f87171; background: rgba(248, 113, 113, 0.12); border: 1px solid rgba(248, 113, 113, 0.28); border-radius: 8px; padding: 6px 11px; font-size: 12.5px; font-weight: 600; }

.field { display: flex; flex-direction: column; gap: 5px; }
.field label { font-size: 12px; font-weight: 600; color: var(--text-muted); }
.field input, .field select, .field textarea { background: var(--bg-input); border: 1px solid var(--border); border-radius: 8px; padding: 8px 11px; color: var(--text-heading); font-size: 13.5px; width: 100%; }
.field input:focus, .field select:focus, .field textarea:focus { border-color: #388bff; }

.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }

/* Orders Dashboard */
.orders-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 18px; }
.kpi-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 12px; margin-bottom: 18px; }
.kpi-card { background: var(--bg-card); border: 1px solid var(--border); border-radius: 10px; padding: 14px 16px; }
.kpi-lbl { font-size: 11.5px; color: var(--text-muted); text-transform: uppercase; font-weight: 600; }
.kpi-val { font-size: 24px; font-weight: 800; color: var(--text-heading); margin: 4px 0 2px; }
.kpi-sub { font-size: 12px; color: #64748b; }

.search-box { display: flex; align-items: center; gap: 8px; background: var(--bg-input); border: 1px solid var(--border); border-radius: 8px; padding: 9px 13px; margin-bottom: 10px; }
.search-box input { width: 100%; background: transparent; color: var(--text-heading); font-size: 13.5px; }

.filter-row { display: flex; flex-wrap: wrap; gap: 7px; margin-bottom: 18px; }
.filter-chip { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 999px; background: var(--bg-card); border: 1px solid var(--border); color: var(--text-main); font-size: 12px; font-weight: 600; }
.filter-chip.active { background: rgba(56, 139, 255, 0.22); border-color: #388bff; color: #fff; }
.chip-dot { width: 8px; height: 8px; border-radius: 50%; }

.orders-list { display: flex; flex-direction: column; gap: 14px; }
.order-card { background: var(--bg-card); border: 1px solid var(--border); border-radius: 12px; padding: 16px 18px; display: flex; flex-direction: column; gap: 12px; }
.order-top { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.code-pill { background: rgba(56, 139, 255, 0.18); color: #60a5fa; border: 1px solid rgba(56, 139, 255, 0.35); padding: 2px 9px; border-radius: 999px; font-size: 11.5px; font-weight: 700; }
.stage-badge { padding: 4px 11px; border-radius: 999px; font-size: 12px; font-weight: 700; }

.mini-progress { display: grid; grid-template-columns: repeat(6, 1fr); gap: 6px; }
.mini-bar { height: 5px; border-radius: 999px; background: rgba(255, 255, 255, 0.1); }
.mini-step.done .mini-bar, .mini-step.current .mini-bar { background: var(--step-color, #388bff); }
.mini-lbl { font-size: 10.5px; color: #64748b; margin-top: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mini-step.current .mini-lbl { color: #fff; font-weight: 700; }

.chips-row { display: flex; flex-wrap: wrap; gap: 8px; }
.meta-chip { font-size: 12px; padding: 4px 10px; border-radius: 6px; background: rgba(255, 255, 255, 0.04); border: 1px solid rgba(255, 255, 255, 0.08); }
.meta-chip.has-val { border-color: rgba(234, 179, 8, 0.35); background: rgba(234, 179, 8, 0.08); }
.meta-chip.porter { border-color: rgba(6, 182, 212, 0.4); background: rgba(6, 182, 212, 0.1); color: #67e8f9; }
.card-actions { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; padding-top: 8px; border-top: 1px solid rgba(255, 255, 255, 0.06); }

/* Modals */
.modal-overlay { position: fixed; inset: 0; background: rgba(0, 0, 0, 0.72); display: flex; align-items: center; justify-content: center; z-index: 9999; padding: 12px; }
.modal-card { background: var(--bg-card); border: 1px solid var(--border); border-radius: 12px; max-width: 840px; width: 100%; max-height: 92vh; display: flex; flex-direction: column; overflow: hidden; box-shadow: 0 20px 50px rgba(0, 0, 0, 0.6); }
.modal-head { padding: 16px 20px; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.modal-body { padding: 18px 20px; overflow-y: auto; display: flex; flex-direction: column; gap: 16px; }
.section-box { background: rgba(255, 255, 255, 0.02); border: 1px solid var(--border); border-radius: 10px; padding: 14px; }
.section-title { font-size: 12.5px; font-weight: 700; color: var(--text-heading); text-transform: uppercase; letter-spacing: 0.4px; margin-bottom: 10px; }

.wa-box { background: linear-gradient(135deg, rgba(22, 163, 74, 0.15) 0%, rgba(15, 23, 42, 0.5) 100%); border: 1px solid rgba(34, 197, 94, 0.38); border-radius: 10px; padding: 12px 14px; display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.wa-url-input { width: 100%; margin-top: 5px; background: rgba(0, 0, 0, 0.25); border: 1px solid rgba(255, 255, 255, 0.12); border-radius: 6px; padding: 6px 10px; font-size: 12.5px; color: #e2e8f0; }

.stepper { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 7px; }
.step-pill { display: flex; align-items: center; gap: 7px; padding: 8px; border-radius: 8px; background: var(--bg-input); border: 1px solid var(--border); color: var(--text-muted); text-align: left; }
.step-pill.done { border-color: rgba(34, 197, 94, 0.45); background: rgba(34, 197, 94, 0.08); color: #cbd5e1; }
.step-pill.current { border-color: var(--step-color, #388bff); background: rgba(56, 139, 255, 0.18); color: #fff; }
.step-num { width: 22px; height: 22px; border-radius: 50%; background: rgba(255, 255, 255, 0.09); display: inline-flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 700; flex-shrink: 0; }
.step-pill.current .step-num { background: var(--step-color, #388bff); color: #fff; }
.step-pill.done .step-num { background: #16a34a; color: #fff; }
.step-lbl { font-size: 11px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: block; }

.att-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; background: var(--bg-input); border: 1px solid var(--border); border-radius: 8px; padding: 8px 12px; }

/* Public Customer Tracking Page */
.track-shell { max-width: 720px; margin: 0 auto; padding: 20px 14px 48px; display: flex; flex-direction: column; gap: 16px; }
.track-card { background: rgba(30, 41, 59, 0.85); backdrop-filter: blur(12px); border: 1px solid var(--border); border-radius: 14px; padding: 18px 20px; box-shadow: 0 10px 28px rgba(0, 0, 0, 0.3); }
.track-progress-bg { height: 8px; background: rgba(255, 255, 255, 0.1); border-radius: 999px; margin-top: 14px; overflow: hidden; }
.track-progress-fill { height: 100%; border-radius: 999px; transition: width 0.35s ease; }
.track-delivery-banner { margin-top: 14px; padding: 11px 14px; border-radius: 10px; background: rgba(15, 23, 42, 0.55); border: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.track-porter-card { border-color: rgba(6, 182, 212, 0.45); background: linear-gradient(135deg, rgba(6, 182, 212, 0.14) 0%, rgba(30, 41, 59, 0.9) 100%); }
.track-info-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 10px; }
.track-info-box { background: rgba(15, 23, 42, 0.55); border: 1px solid rgba(255, 255, 255, 0.08); border-radius: 9px; padding: 10px 12px; }
.timeline { display: flex; flex-direction: column; }
.tl-step { display: flex; gap: 14px; position: relative; padding-bottom: 18px; }
.tl-step:last-child { padding-bottom: 0; }
.tl-step:not(:last-child)::before { content: ""; position: absolute; left: 14px; top: 30px; bottom: 0; width: 2px; background: rgba(255, 255, 255, 0.12); }
.tl-step.completed:not(:last-child)::before { background: #22c55e; }
.tl-marker { width: 30px; height: 30px; border-radius: 50%; background: rgba(255, 255, 255, 0.08); border: 2px solid rgba(255, 255, 255, 0.2); color: #94a3b8; font-size: 12px; font-weight: 700; display: flex; align-items: center; justify-content: center; flex-shrink: 0; z-index: 1; }
.tl-step.completed .tl-marker { background: #16a34a; border-color: #22c55e; color: #fff; }
.tl-step.active .tl-marker { background: var(--step-color, #38bdf8); border-color: #fff; color: #fff; box-shadow: 0 0 0 4px rgba(56, 189, 248, 0.22); }
.tl-extra { margin-top: 6px; font-size: 12.5px; color: #e2e8f0; background: rgba(255, 255, 255, 0.05); border-left: 3px solid var(--step-color, #38bdf8); padding: 6px 10px; border-radius: 4px; }

@media (max-width: 768px) {
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .stepper { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .mini-progress { grid-template-columns: repeat(3, 1fr); row-gap: 8px; }
}

/* Subscription Paywall & Admin Plan Badges */
.plan-pill-banner { background: rgba(234, 179, 8, 0.12); border: 1px solid rgba(234, 179, 8, 0.35); border-radius: 9px; padding: 9px 12px; display: flex; flex-direction: column; gap: 2px; font-size: 12px; color: #fde68a; }
.plan-active-pill { font-size: 12px; font-weight: 700; color: #4ade80; background: rgba(34, 197, 94, 0.14); border: 1px solid rgba(34, 197, 94, 0.35); padding: 5px 11px; border-radius: 999px; }
.pending-badge { background: #eab308; color: #0f172a; font-size: 11px; font-weight: 800; padding: 1px 7px; border-radius: 999px; margin-left: 4px; }

.paywall-wrap { max-width: 820px; margin: 0 auto; padding: 28px 16px 60px; }
.paywall-card { background: var(--bg-card); border: 1px solid var(--border); border-radius: 14px; padding: 24px; box-shadow: 0 18px 40px rgba(0, 0, 0, 0.4); }
.price-box { background: rgba(234, 179, 8, 0.12); border: 1px solid rgba(234, 179, 8, 0.35); border-radius: 10px; padding: 10px 16px; text-align: center; }
.paywall-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; margin-top: 18px; }
.qr-preview-box { background: #fff; border-radius: 10px; padding: 10px; display: flex; justify-content: center; margin-bottom: 10px; }
.qr-preview-box img { max-width: 190px; max-height: 190px; object-fit: contain; }
.upi-id-box { display: flex; align-items: center; justify-content: space-between; gap: 10px; background: var(--bg-input); border: 1px solid var(--border); border-radius: 8px; padding: 10px 12px; }

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

