:root {
  --bg: #02081a;
  --card: #050b22;
  --neon-blue: #29b6ff;
  --neon-purple: #b347ff;
  --success: #00e676;
  --danger: #ff3366;
  --text: #f5f7ff;
  --text-muted: #9aa4c6;
  --border: rgba(255,255,255,0.08);
}

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

body {
  font-family: system-ui, -apple-system, sans-serif;
  background: radial-gradient(circle at top, #07102b 0, var(--bg) 45%, #000 100%);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
}

a { color: var(--neon-blue); text-decoration: none; }
a:hover { text-decoration: underline; }

.client-page { max-width: 720px; margin: 0 auto; padding: 24px 16px 64px; }

.client-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 28px;
}
.client-logo {
  font-size: 18px;
  font-weight: 700;
  color: var(--neon-blue);
  padding: 6px 14px;
  border-radius: 999px;
  border: 1px solid rgba(41,182,255,0.4);
  white-space: nowrap;
  transition: box-shadow 0.2s;
}
.client-logo:hover { box-shadow: 0 0 14px rgba(41,182,255,0.4); text-decoration: none; }
.client-header h1 { font-size: 18px; font-weight: 600; }

/* ── Profile Card ── */
.profile-card {
  display: flex;
  align-items: flex-start;
  gap: 18px;
  background: radial-gradient(circle at right, rgba(41,182,255,0.1), transparent 60%), var(--card);
  border: 1px solid rgba(41,182,255,0.2);
  border-radius: 18px;
  padding: 24px;
  margin-bottom: 16px;
  position: relative;
  overflow: hidden;
}
.profile-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--neon-blue), var(--neon-purple), transparent);
}
.profile-avatar {
  width: 60px; height: 60px;
  border-radius: 18px;
  background: linear-gradient(135deg, #29b6ff, #b347ff);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 26px;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
  box-shadow: 0 0 24px rgba(41,182,255,0.35);
}
.profile-info { flex: 1; min-width: 0; }
.profile-name { font-size: 18px; font-weight: 700; margin-bottom: 6px; }
.profile-detail { font-size: 13px; color: var(--text-muted); margin-top: 3px; }
.profile-detail-addr { font-size: 12px; }
.profile-actions { display: flex; gap: 8px; flex-shrink: 0; flex-direction: column; }
.btn-sm {
  font-size: 12px;
  padding: 7px 16px;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,0.2);
  background: rgba(5,11,34,0.9);
  color: var(--text);
  cursor: pointer;
  white-space: nowrap;
  transition: border-color 0.15s, box-shadow 0.15s, background 0.15s;
}
.btn-sm:hover { border-color: var(--neon-blue); box-shadow: 0 0 10px rgba(41,182,255,0.3); }
.btn-logout { border-color: rgba(255,51,102,0.3); color: var(--danger); }
.btn-logout:hover { border-color: var(--danger); box-shadow: 0 0 10px rgba(255,51,102,0.3); }

/* ── Stats Bar ── */
.stats-bar {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 20px;
}
.stat-item {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 16px 12px;
  text-align: center;
  transition: border-color 0.15s;
}
.stat-item:hover { border-color: rgba(41,182,255,0.2); }
.stat-icon { font-size: 20px; margin-bottom: 6px; }
.stat-num { font-size: 26px; font-weight: 700; color: var(--neon-blue); line-height: 1; }
.stat-label { font-size: 11px; color: var(--text-muted); margin-top: 6px; }

/* ── Filter tabs ── */
.filter-tabs { display: flex; gap: 8px; margin-bottom: 16px; flex-wrap: wrap; }
.filter-tab {
  font-size: 12px;
  padding: 7px 18px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  transition: 0.15s;
  font-family: inherit;
}
.filter-tab:hover { border-color: var(--neon-blue); color: var(--text); }
.filter-tab.active { background: rgba(41,182,255,0.15); border-color: var(--neon-blue); color: var(--neon-blue); font-weight: 600; }

/* ── Order Card ── */
.order-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 18px;
  margin-bottom: 10px;
  cursor: pointer;
  transition: border-color 0.15s, box-shadow 0.15s, transform 0.15s;
}
.order-card:hover {
  border-color: rgba(41,182,255,0.3);
  box-shadow: 0 0 18px rgba(41,182,255,0.08);
  transform: translateY(-1px);
}
.order-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 10px;
}
.order-num { font-family: monospace; font-size: 14px; color: var(--neon-blue); direction: ltr; text-align: left; font-weight: 600; }
.order-date { font-size: 11px; color: var(--text-muted); margin-top: 2px; }
.order-header-right { display: flex; gap: 6px; align-items: center; }
.order-status-badge {
  font-size: 11px;
  padding: 3px 12px;
  border-radius: 999px;
  font-weight: 600;
  white-space: nowrap;
}
.status-new { background: rgba(41,182,255,0.15); color: var(--neon-blue); }
.status-confirmed { background: rgba(179,71,255,0.15); color: var(--neon-purple); }
.status-shipped { background: rgba(255,193,7,0.15); color: #ffc107; }
.status-delivered { background: rgba(0,230,118,0.15); color: var(--success); }
.status-cancelled { background: rgba(255,51,102,0.15); color: var(--danger); }

.pay-badge {
  font-size: 11px;
  padding: 3px 12px;
  border-radius: 999px;
  font-weight: 600;
  white-space: nowrap;
}
.pay-paid { background: rgba(0,230,118,0.15); color: var(--success); }
.pay-cod { background: rgba(255,193,7,0.15); color: #ffc107; }

.order-body {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.order-body-left { display: flex; gap: 8px; align-items: center; }
.order-product { font-size: 13px; font-weight: 600; }
.order-qty { font-size: 12px; color: var(--text-muted); }
.order-body-right { text-align: left; }
.order-total { font-size: 16px; font-weight: 700; color: var(--neon-blue); }
.order-total small { font-size: 11px; color: var(--text-muted); font-weight: 400; }

/* ── Order Detail ── */
.order-detail-card {
  background: var(--card);
  border: 1px solid rgba(41,182,255,0.2);
  border-radius: 16px;
  padding: 20px;
  margin-bottom: 16px;
}
.detail-top { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 16px; }
.detail-order-num { font-size: 16px; font-weight: 700; color: var(--neon-blue); direction: ltr; text-align: left; font-family: monospace; }
.detail-row { display: flex; justify-content: space-between; padding: 8px 0; font-size: 13px; border-bottom: 1px solid rgba(255,255,255,0.05); }
.detail-row:last-child { border-bottom: none; }
.detail-label { color: var(--text-muted); font-size: 12px; }
.detail-total {
  display: flex;
  justify-content: space-between;
  padding: 12px 0 8px;
  font-size: 17px;
  font-weight: 700;
  color: var(--neon-blue);
  border-top: 1px solid rgba(41,182,255,0.2);
  margin-top: 4px;
}
.detail-total .detail-label { font-size: 13px; }

.payment-paid { color: var(--success); font-weight: 600; }
.payment-cod { color: #ffc107; font-weight: 600; }
.payment-pending { color: var(--danger); font-weight: 600; }

/* Timeline */
.timeline { margin-top: 16px; }
.timeline h3 { font-size: 14px; margin-bottom: 16px; color: var(--neon-blue); }
.timeline-item { display: flex; gap: 14px; margin-bottom: 16px; position: relative; }
.timeline-dot {
  width: 14px; height: 14px;
  border-radius: 999px;
  background: var(--neon-blue);
  box-shadow: 0 0 12px rgba(41,182,255,0.7);
  margin-top: 2px;
  flex-shrink: 0;
  position: relative;
  z-index: 1;
}
.timeline-item::before {
  content: '';
  position: absolute;
  top: 18px;
  right: 6px;
  width: 2px;
  height: calc(100% + 2px);
  background: rgba(41,182,255,0.15);
}
.timeline-item:last-child::before { display: none; }
.timeline-content { font-size: 13px; }
.timeline-status { font-weight: 600; }
.timeline-date { color: var(--text-muted); font-size: 12px; margin-top: 2px; }
.timeline-notes { color: var(--text-muted); font-size: 12px; margin-top: 2px; }

/* Invoices */
.invoices-section { margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--border); }
.invoices-section h3 { font-size: 13px; margin-bottom: 8px; color: var(--neon-blue); }
.invoice-link { display: inline-flex; align-items: center; gap: 6px; margin-left: 12px; margin-bottom: 6px; font-size: 13px; padding: 6px 14px; border-radius: 999px; border: 1px solid rgba(41,182,255,0.3); transition: 0.15s; }
.invoice-link:hover { border-color: var(--neon-blue); box-shadow: 0 0 10px rgba(41,182,255,0.3); text-decoration: none; }

/* Back button */
.back-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 16px;
  padding: 6px 14px;
  border-radius: 999px;
  border: 1px solid var(--border);
  transition: 0.15s;
}
.back-link:hover { border-color: var(--neon-blue); color: var(--text); text-decoration: none; }

/* ── Addresses ── */
.addresses-section { margin-bottom: 20px; }
.addresses-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.addresses-title { font-size: 14px; font-weight: 600; color: var(--neon-blue); }
.addresses-grid { display: flex; flex-direction: column; gap: 8px; }
.address-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px 16px;
  position: relative;
  transition: border-color 0.15s;
}
.address-card:hover { border-color: rgba(41,182,255,0.2); }
.address-card.empty-addr {
  text-align: center;
  padding: 20px;
  color: var(--text-muted);
  cursor: pointer;
  border-style: dashed;
  font-size: 13px;
}
.address-card.empty-addr:hover { border-color: var(--neon-blue); color: var(--neon-blue); }
.addr-default-badge {
  position: absolute;
  top: 8px; left: 8px;
  font-size: 10px;
  padding: 2px 10px;
  border-radius: 999px;
  background: rgba(41,182,255,0.15);
  color: var(--neon-blue);
  font-weight: 600;
}
.addr-label { font-size: 13px; font-weight: 600; margin-bottom: 4px; }
.addr-short { font-size: 12px; color: var(--text-muted); }
.addr-full { font-size: 12px; color: var(--text-muted); margin-top: 2px; }
.addr-actions { display: flex; gap: 6px; margin-top: 8px; }
.addr-actions .btn-sm { font-size: 11px; padding: 4px 12px; }

/* ── Empty state ── */
.empty-state { text-align: center; padding: 40px 16px; color: var(--text-muted); }
.empty-state-icon { font-size: 44px; margin-bottom: 10px; }
.empty-state-text { font-size: 14px; }

/* ── Search form (guest) ── */
.track-form label { display: block; font-size: 14px; margin-bottom: 8px; }
.track-input-row { display: flex; gap: 8px; }
.track-input {
  flex: 1;
  padding: 10px 14px;
  border-radius: 12px;
  border: 1px solid rgba(41,182,255,0.3);
  background: rgba(5,11,34,0.9);
  color: var(--text);
  font-size: 15px;
  outline: none;
  direction: ltr;
  text-align: left;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.track-input:focus { border-color: var(--neon-blue); box-shadow: 0 0 14px rgba(41,182,255,0.4); }
.btn-track {
  padding: 10px 22px;
  border-radius: 12px;
  border: 1px solid var(--neon-blue);
  background: linear-gradient(135deg, #0b1638, #050b22);
  color: var(--text);
  font-size: 14px;
  cursor: pointer;
  white-space: nowrap;
  transition: box-shadow 0.15s;
}
.btn-track:hover { box-shadow: 0 0 16px rgba(41,182,255,0.5); }
.track-error { color: var(--danger); font-size: 12px; margin-top: 6px; }
.track-hint { font-size: 11px; color: var(--text-muted); margin-top: 6px; }

/* ── Edit Modal ── */
#editModal { display:none;position:fixed;inset:0;background:rgba(0,0,0,0.7);z-index:999;align-items:center;justify-content:center;padding:24px;backdrop-filter:blur(4px); }
.modal-card {
  max-width:420px;
  width:100%;
  background: radial-gradient(circle at top, rgba(41,182,255,0.08), transparent 60%), linear-gradient(135deg,#0a1330,#050b22);
  border:1px solid rgba(41,182,255,0.25);
  border-radius:18px;
  padding:28px 24px;
  box-shadow:0 0 60px rgba(0,0,0,0.8), 0 0 30px rgba(41,182,255,0.1);
}
.modal-title { font-size:18px;margin-bottom:20px; }
.modal-body { display:flex;flex-direction:column;gap:14px; }
.modal-field label { font-size:12px;display:block;margin-bottom:4px;color:var(--text-muted); }
.modal-field .track-input { width:100%; }
.modal-error { font-size:12px;color:var(--danger);display:none; }
.modal-actions { display:flex;gap:10px;margin-top:6px; }
.modal-actions .btn-track { flex:1;text-align:center; }
.modal-actions .btn-cancel { border-color:rgba(255,255,255,0.2); }

/* ── Responsive ── */
@media (max-width: 500px) {
  .profile-card { flex-wrap: wrap; padding: 18px; }
  .profile-actions { width: 100%; flex-direction: row; justify-content: flex-end; }
  .stats-bar { gap: 6px; }
  .stat-item { padding: 12px 8px; }
  .stat-num { font-size: 20px; }
  .order-card { padding: 14px; }
  .order-total { font-size: 14px; }
  .order-header-right { flex-wrap: wrap; }
}

@media (max-width: 380px) {
  .stats-bar { grid-template-columns: repeat(3, 1fr); }
  .stat-icon { font-size: 16px; }
  .stat-num { font-size: 18px; }
  .client-header h1 { font-size: 15px; }
}