/* ------------------------------------------------------------------ */
/* Customer account page                                               */
/* ------------------------------------------------------------------ */

.account-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: none;
  border: 0;
  cursor: pointer;
  font: inherit;
}

.account-main {
  max-width: 1080px;
  margin: 0 auto;
  padding: clamp(24px, 5vw, 56px) clamp(16px, 4vw, 40px) 80px;
}

/* ---------------- Auth (signed out) ---------------- */

.account-auth {
  display: flex;
  justify-content: center;
  padding-top: clamp(8px, 3vw, 32px);
}

.auth-card {
  width: 100%;
  max-width: 440px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  padding: 8px 28px 28px;
}

.auth-tabs {
  display: flex;
  gap: 4px;
  padding: 4px;
  margin: 0 -12px 20px;
  background: var(--bg);
  border-radius: var(--radius-sm);
}

.auth-tab {
  flex: 1;
  padding: 9px 12px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--ink-soft);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}

.auth-tab.active {
  background: var(--surface);
  color: var(--ink);
  box-shadow: var(--shadow-sm);
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.auth-title {
  margin: 0;
  font-size: 1.4rem;
  letter-spacing: -0.02em;
}

.auth-sub {
  margin: -8px 0 4px;
  color: var(--ink-muted);
  font-size: 0.9rem;
}

/* ---------------- Dashboard (signed in) ---------------- */

.account-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 24px;
}

.account-title {
  margin: 0;
  font-size: clamp(1.5rem, 3vw, 2rem);
  letter-spacing: -0.03em;
}

.account-sub {
  margin: 4px 0 0;
  color: var(--ink-muted);
  font-size: 0.92rem;
}

.account-head-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

/* ---------------- Dashboard summary ---------------- */

.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px;
  margin-bottom: 20px;
}

.stat-card {
  display: flex;
  flex-direction: column;
  gap: 6px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: 16px 18px;
}

.stat-label {
  font-size: 0.78rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--ink-muted);
}

.stat-value {
  font-size: 1.45rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--ink);
}

.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: 20px 22px;
  margin-bottom: 20px;
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.panel-title {
  margin: 0;
  font-size: 1.05rem;
  letter-spacing: -0.01em;
}

.panel-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 14px;
}

.panel-head .panel-actions {
  margin-top: 0;
}

/* Status filter in the orders panel header. */
.order-filter {
  width: auto;
  min-width: 150px;
  padding: 8px 10px;
  font-size: 0.85rem;
}

/* Inline text button used inside empty states. */
.link-button {
  background: none;
  border: 0;
  padding: 0;
  font: inherit;
  color: var(--accent);
  cursor: pointer;
  text-decoration: underline;
}

.link-button:hover {
  color: var(--accent-ink, var(--accent));
}

.profile-panel {
  max-width: 720px;
}

/* ---------------- Orders ---------------- */

.orders-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.orders-empty {
  margin: 0;
  padding: 28px 8px;
  text-align: center;
  color: var(--ink-muted);
  font-size: 0.92rem;
}

.order-card {
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px 18px;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.order-card:hover {
  border-color: #d6cec7;
  box-shadow: var(--shadow-sm);
}

.order-card-main {
  flex: 1 1 260px;
  min-width: 0;
}

.order-ref {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.82rem;
  color: var(--ink-muted);
  letter-spacing: 0.02em;
}

.order-title {
  margin: 2px 0 0;
  font-size: 0.98rem;
  font-weight: 650;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.order-meta {
  margin: 3px 0 0;
  font-size: 0.82rem;
  color: var(--ink-muted);
}

.order-card-side {
  display: flex;
  align-items: center;
  gap: 14px;
}

.order-amount {
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

/* Status pills */
.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 0.74rem;
  font-weight: 650;
  letter-spacing: 0.01em;
  white-space: nowrap;
}

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

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

.status-fulfilled {
  background: #dcfce7;
  color: #166534;
}

.status-paid_unfulfilled {
  background: #ffedd5;
  color: #9a3412;
}

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

.status-refunded {
  background: #ede9fe;
  color: #5b21b6;
}

/* ---------------- Order detail modal ---------------- */

.order-modal-panel {
  width: min(640px, 100%);
  max-height: min(86vh, 760px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.order-modal-panel .modal-body {
  overflow-y: auto;
  min-height: 0;
}

.order-detail-section {
  margin-bottom: 20px;
}

.order-detail-section:last-child {
  margin-bottom: 0;
}

.order-detail-label {
  margin: 0 0 6px;
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-muted);
}

.order-detail-value {
  margin: 0;
  font-size: 0.94rem;
}

.order-items {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.order-item {
  display: flex;
  align-items: center;
  gap: 12px;
}

.order-item-img {
  width: 48px;
  height: 48px;
  border-radius: 8px;
  object-fit: cover;
  background: var(--bg);
  flex: 0 0 auto;
}

.order-item-body {
  flex: 1 1 auto;
  min-width: 0;
}

.order-item-name {
  margin: 0;
  font-size: 0.9rem;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.order-item-sub {
  margin: 1px 0 0;
  font-size: 0.8rem;
  color: var(--ink-muted);
}

.order-item-price {
  font-size: 0.88rem;
  font-weight: 650;
  font-variant-numeric: tabular-nums;
}

/* Tracking timeline */
.track {
  display: flex;
  flex-direction: column;
  gap: 0;
  margin: 0;
  padding: 0;
  list-style: none;
}

.track-step {
  position: relative;
  padding: 0 0 18px 26px;
  font-size: 0.88rem;
  color: var(--ink-muted);
}

.track-step:last-child {
  padding-bottom: 0;
}

.track-step::before {
  content: "";
  position: absolute;
  left: 0;
  top: 4px;
  width: 11px;
  height: 11px;
  border-radius: 50%;
  border: 2px solid var(--line);
  background: var(--surface);
}

.track-step::after {
  content: "";
  position: absolute;
  left: 5px;
  top: 17px;
  bottom: 0;
  width: 1px;
  background: var(--line);
}

.track-step:last-child::after {
  display: none;
}

.track-step.done {
  color: var(--ink);
}

.track-step.done::before {
  border-color: var(--green);
  background: var(--green);
}

.track-step.current::before {
  border-color: var(--accent);
  background: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-soft);
}

.track-step-title {
  font-weight: 650;
}

.track-step-time {
  display: block;
  font-size: 0.78rem;
  color: var(--ink-muted);
  margin-top: 1px;
}

/* ---------------- Shared bits ---------------- */

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

.field-label {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--ink-soft);
}

.field-input {
  width: 100%;
  padding: 10px 12px;
  border: 1.5px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
  font: inherit;
  font-size: 0.94rem;
  color: var(--ink);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.field-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.field-hint {
  font-size: 0.78rem;
  color: var(--ink-muted);
}

.field-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 14px;
}

.form-error {
  margin: 0;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  background: #fee2e2;
  color: #991b1b;
  font-size: 0.85rem;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 18px;
  border: 1.5px solid transparent;
  border-radius: var(--radius-sm);
  font: inherit;
  font-size: 0.9rem;
  font-weight: 650;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, transform 0.1s ease;
}

.btn:active {
  transform: translateY(1px);
}

.btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.btn-primary {
  background: var(--accent);
  color: #fff;
}

.btn-primary:hover:not(:disabled) {
  background: var(--accent-ink);
}

.btn-ghost {
  background: var(--surface);
  border-color: var(--line);
  color: var(--ink);
}

.btn-ghost:hover:not(:disabled) {
  border-color: #d6cec7;
  background: var(--bg);
}

.btn-block {
  width: 100%;
}

.btn-sm {
  padding: 6px 12px;
  font-size: 0.82rem;
}

.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  margin-top: 16px;
}

.page-info {
  font-size: 0.84rem;
  color: var(--ink-muted);
}

/* ---------------- Modal shell ---------------- */

.modal {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: grid;
  place-items: center;
  padding: 20px;
}

.modal[hidden] {
  display: none;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(28, 25, 23, 0.5);
  backdrop-filter: blur(2px);
}

.modal-panel {
  position: relative;
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  width: min(560px, 100%);
}

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

.modal-head h2 {
  margin: 0;
  font-size: 1.05rem;
}

.modal-close {
  border: 0;
  background: transparent;
  font-size: 1rem;
  cursor: pointer;
  color: var(--ink-muted);
  padding: 4px 6px;
  border-radius: 6px;
}

.modal-close:hover {
  background: var(--bg);
  color: var(--ink);
}

.modal-body {
  padding: 20px;
}

/* ---------------- Toast ---------------- */

.toast {
  position: fixed;
  left: 50%;
  bottom: 28px;
  transform: translateX(-50%);
  z-index: 120;
  padding: 11px 20px;
  border-radius: 999px;
  background: var(--ink);
  color: #fff;
  font-size: 0.88rem;
  font-weight: 550;
  box-shadow: var(--shadow-lg);
  animation: toastIn 0.22s ease;
}

.toast[hidden] {
  display: none;
}

@keyframes toastIn {
  from {
    opacity: 0;
    transform: translate(-50%, 10px);
  }
  to {
    opacity: 1;
    transform: translate(-50%, 0);
  }
}

@media (max-width: 640px) {
  .auth-card {
    padding: 8px 18px 22px;
  }

  .order-card-side {
    width: 100%;
    justify-content: space-between;
  }

  .account-head {
    align-items: flex-start;
  }
}
