/* ==========================================================================
   QRBELL Store — User Dashboard / My Account overview
   All selectors namespaced `.dash-*` (plus a few `.ac-head__*` additions that
   belong with the shared account head in account.css). Reuses the existing
   design tokens and `.qb-*` components — navy + yellow identity, same radii
   and spacing as the rest of the store.
   ========================================================================== */

/* ---- Page head: title row + right-aligned action ---- */
.ac-head__row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-3);
  flex-wrap: wrap;
}
.ac-head__action { flex: 0 0 auto; }
@media (max-width: 575px) {
  .ac-head__action { width: 100%; }
  .ac-head__action > .qb-btn { width: 100%; }
}

/* ==========================================================================
   QUICK ACTIONS
   ========================================================================== */
.dash-quick {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: var(--space-3);
  margin-bottom: var(--space-5);
}
@media (max-width: 991px) {
  .dash-quick { grid-template-columns: repeat(2, 1fr); }
}
.dash-quick__btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  min-height: var(--touch-min);
  padding: var(--space-3) var(--space-4);
  background: var(--color-surface);
  border: 1px solid var(--color-border-strong);
  border-radius: var(--radius-btn);
  color: var(--color-text);
  font-size: var(--text-sm);
  font-weight: var(--weight-semibold);
  text-align: center;
  transition: border-color var(--transition-base), background-color var(--transition-base), transform var(--transition-base);
}
.dash-quick__btn i { font-size: 1rem; color: var(--qb-gold-700); }
.dash-quick__btn:hover {
  border-color: var(--qb-navy-900);
  background: var(--color-surface-alt);
  text-decoration: none;
  color: var(--color-text);
}
.dash-quick__btn:focus-visible { outline: 2px solid var(--color-accent); outline-offset: 2px; }

@media (max-width: 767px) {
  .dash-quick { grid-template-columns: 1fr; gap: var(--space-2); }
  .dash-quick__btn { justify-content: flex-start; }
}

/* ==========================================================================
   STAT CARDS
   ========================================================================== */
.dash-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--space-3);
  margin-bottom: var(--space-6);
}
.dash-stat {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  padding: var(--space-4);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  color: var(--color-text);
  transition: border-color var(--transition-base), box-shadow var(--transition-base), transform var(--transition-base);
}
.dash-stat:hover {
  border-color: var(--qb-navy-900);
  box-shadow: var(--shadow-sm);
  text-decoration: none;
  color: var(--color-text);
}
.dash-stat:focus-visible { outline: 2px solid var(--color-accent); outline-offset: 2px; }
.dash-stat__value {
  font-family: var(--font-heading);
  font-size: var(--text-2xl);
  font-weight: var(--weight-extra);
  font-variant-numeric: tabular-nums;
  line-height: 1;
  color: var(--qb-navy-900);
}
.dash-stat__label { color: var(--color-text-muted); font-size: var(--text-xs); font-weight: var(--weight-medium); }
.dash-stat__go {
  position: absolute;
  top: var(--space-4);
  right: var(--space-4);
  font-size: 0.85rem;
  color: var(--color-text-faint);
  transition: transform var(--transition-base), color var(--transition-base);
}
.dash-stat:hover .dash-stat__go { transform: translateX(2px); color: var(--qb-gold-700); }
.dash-stat.is-alert { border-color: var(--color-warning); background: var(--qb-gold-050); }
.dash-stat.is-alert .dash-stat__value { color: var(--qb-gold-700); }

@media (max-width: 767px) {
  .dash-stats { grid-template-columns: repeat(2, 1fr); gap: var(--space-2); }
}

/* Dark theme — keep the value legible on navy surfaces */
:root:not([data-theme="light"]) .dash-stat__value,
[data-theme="dark"] .dash-stat__value { color: var(--color-text); }

/* ==========================================================================
   SECTION CARD
   ========================================================================== */
.dash-card {
  padding: var(--space-5);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
}
.dash-card + .dash-card { margin-top: var(--space-4); }
.dash-card__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  margin-bottom: var(--space-4);
}
.dash-card__title { margin: 0; font-size: var(--text-md); font-weight: var(--weight-bold); }

.dash-link {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  font-size: var(--text-sm);
  font-weight: var(--weight-semibold);
  color: var(--color-accent);
}
.dash-link:hover { color: var(--color-accent-hover); }

.dash-inline-error {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  flex-wrap: wrap;
  padding: var(--space-3) var(--space-4);
  background: var(--color-danger-soft);
  color: var(--color-danger-strong);
  border-radius: var(--radius-xs);
  font-size: var(--text-sm);
}

/* ==========================================================================
   MY QR CODES
   ========================================================================== */
.dash-qr-list { display: grid; gap: var(--space-3); }
.dash-qr {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: var(--color-surface);
}
.dash-qr__icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: var(--radius-xs);
  background: var(--qb-navy-900);
  color: var(--color-primary);
  font-size: 1.1rem;
}
.dash-qr__body { min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.dash-qr__name { font-size: var(--text-base); font-weight: var(--weight-semibold); }
.dash-qr__meta { color: var(--color-text-muted); font-size: var(--text-xs); }
.dash-qr__badges { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2); margin-top: 2px; }
.dash-qr__act {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: var(--text-2xs);
  font-weight: var(--weight-semibold);
  color: var(--color-text-faint);
}
.dash-qr__act.is-on { color: var(--color-success-strong); }

@media (max-width: 575px) {
  .dash-qr { grid-template-columns: auto minmax(0, 1fr); }
  .dash-qr > .qb-btn { grid-column: 1 / -1; width: 100%; }
}

/* ==========================================================================
   RECENT ORDERS
   ========================================================================== */
.dash-order-list { display: grid; gap: var(--space-3); }
.dash-order {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
}
.dash-order__media img {
  width: 48px;
  height: 48px;
  object-fit: cover;
  border-radius: var(--radius-xs);
  background: var(--color-surface-alt);
}
.dash-order__body { min-width: 0; display: flex; flex-direction: column; gap: 4px; align-items: flex-start; }
.dash-order__name { font-size: var(--text-base); font-weight: var(--weight-semibold); }
.dash-order__meta { color: var(--color-text-muted); font-size: var(--text-xs); font-variant-numeric: tabular-nums; }
.dash-order__end { display: flex; flex-direction: column; align-items: flex-end; gap: var(--space-2); }
.dash-order__amount { font-weight: var(--weight-bold); font-variant-numeric: tabular-nums; }
.dash-order__actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: var(--space-2); }

@media (max-width: 575px) {
  .dash-order { grid-template-columns: auto minmax(0, 1fr); }
  .dash-order__end { grid-column: 1 / -1; flex-direction: row; align-items: center; justify-content: space-between; }
  .dash-order__actions { flex: 1 1 auto; }
  .dash-order__actions .qb-btn { flex: 1 1 auto; }
}

/* ==========================================================================
   SAVED ADDRESSES (compact)
   ========================================================================== */
.dash-addr-grid {
  display: grid;
  gap: var(--space-3);
  grid-template-columns: minmax(0, 1fr);
}
@media (min-width: 640px) { .dash-addr-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

.dash-addr {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: var(--space-3) var(--space-4);
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius-sm);
}
.dash-addr.is-default { border-color: var(--color-accent); }
.dash-addr__top { display: flex; align-items: center; justify-content: space-between; gap: var(--space-2); margin-bottom: 2px; }
.dash-addr__name { font-size: var(--text-base); font-weight: var(--weight-semibold); }
.dash-addr__text { color: var(--color-text-muted); font-size: var(--text-xs); line-height: 1.5; }
.dash-addr__actions { display: flex; gap: var(--space-3); margin-top: var(--space-2); }
.dash-addr__add { margin-top: var(--space-3); }
@media (max-width: 575px) { .dash-addr__add { width: 100%; } }

/* ==========================================================================
   PROFILE SUMMARY (read-only)
   ========================================================================== */
.dash-profile { display: grid; gap: var(--space-3); margin: 0; grid-template-columns: minmax(0, 1fr); }
@media (min-width: 640px) { .dash-profile { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.dash-profile > div { display: flex; flex-direction: column; gap: 2px; }
.dash-profile dt { color: var(--color-text-faint); font-size: var(--text-2xs); font-weight: var(--weight-semibold); text-transform: uppercase; letter-spacing: var(--tracking-wide); }
.dash-profile dd { margin: 0; font-size: var(--text-base); font-weight: var(--weight-medium); display: flex; align-items: center; gap: var(--space-2); flex-wrap: wrap; }
.dash-verified { display: inline-flex; align-items: center; gap: 4px; font-size: var(--text-2xs); font-weight: var(--weight-bold); color: var(--color-success-strong); }
.dash-unverified { display: inline-flex; align-items: center; font-size: var(--text-2xs); font-weight: var(--weight-bold); color: #92600A; }

/* ==========================================================================
   NEED HELP
   ========================================================================== */
.dash-help-text { margin: 0 0 var(--space-3); color: var(--color-text-muted); font-size: var(--text-sm); }
.dash-help-actions { display: flex; flex-wrap: wrap; gap: var(--space-2); }
@media (max-width: 575px) {
  .dash-help-actions { flex-direction: column; }
  .dash-help-actions .qb-btn { width: 100%; }
}

/* ==========================================================================
   QR DETAIL — history timeline
   ========================================================================== */
.dash-timeline { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--space-3); }
.dash-timeline li { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: var(--space-3); }
.dash-timeline__dot { width: 10px; height: 10px; margin-top: 5px; border-radius: var(--radius-circle); background: var(--color-primary); }
.dash-timeline__body { display: flex; flex-direction: column; gap: 2px; }
.dash-timeline__label { font-size: var(--text-sm); font-weight: var(--weight-semibold); }
.dash-timeline__note { color: var(--color-text-muted); font-size: var(--text-xs); }
.dash-timeline__at { color: var(--color-text-faint); font-size: var(--text-2xs); }

/* ==========================================================================
   PROFILE — form actions (sticky Save on mobile, §7)
   ========================================================================== */
.ac-form-actions {
  display: flex;
  gap: var(--space-3);
  justify-content: flex-end;
  flex-wrap: wrap;
}
@media (max-width: 767px) {
  .ac-form-actions {
    position: sticky;
    bottom: calc(var(--bottomnav-height, 64px) + var(--space-2));
    z-index: 5;
    padding: var(--space-3);
    margin: var(--space-2) calc(var(--space-5) * -1) calc(var(--space-5) * -1);
    background: var(--color-surface);
    border-top: 1px solid var(--color-border);
    border-radius: 0 0 var(--radius-sm) var(--radius-sm);
  }
  .ac-form-actions .qb-btn { flex: 1 1 auto; }
}
