/* ============================================================
   Customer accounts — login / register / account
   ============================================================ */
.auth-wrap { max-width: 460px; margin: 0 auto; padding: 28px 16px 80px; }
.auth-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); padding: 24px; box-shadow: var(--shadow-sm); }
.auth-title { margin: 0 0 4px; font-size: var(--fz-xl); font-weight: 800; letter-spacing: -.01em; }
.auth-sub { margin: 0 0 20px; color: var(--text-muted); font-size: var(--fz-sm); }

.auth-field { margin-bottom: 14px; }
.auth-field label { display: block; font-size: var(--fz-sm); font-weight: 600; margin-bottom: 6px; }
.auth-opt { font-weight: 400; color: var(--text-muted); }
.auth-input { width: 100%; min-height: 44px; padding: 11px 13px; border-radius: var(--r-md); border: 1px solid var(--border); background: var(--surface-2); color: var(--text); font-size: 16px; font-family: inherit; }
.auth-input:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 22%, transparent); }

/* Password field + inline show/hide toggle.
   The toggle is anchored to .pw-wrap, which holds ONLY the input and the button — never
   to .auth-field-pw. The login field also contains a "Forgot password?" link after the
   input, so anchoring to the field made `bottom: 6px` measure from below that link and
   dropped the eye icon out of the input entirely. Keep anything else out of .pw-wrap. */
.auth-field-pw .pw-wrap { position: relative; }
.auth-field-pw .pw-wrap .auth-input { padding-right: 46px; }
.pw-toggle {
  position: absolute; right: 6px; bottom: 6px; width: 34px; height: 32px;
  display: grid; place-items: center; border: 0; background: transparent; cursor: pointer;
  color: var(--text-muted); border-radius: var(--r-sm, 8px); padding: 0;
}
.pw-toggle:hover { color: var(--text); }
.pw-toggle:focus-visible { outline: 3px solid var(--ring); outline-offset: 2px; }
.pw-toggle .pw-toggle-hide { display: none; }
.pw-toggle[aria-pressed="true"] .pw-toggle-show { display: none; }
.pw-toggle[aria-pressed="true"] .pw-toggle-hide { display: block; }

.auth-msg { margin: 0 0 16px; padding: 11px 13px; border-radius: var(--r-md); font-size: var(--fz-sm); font-weight: 600; }
.auth-msg.err { background: color-mix(in srgb, #e5484d 12%, transparent); color: #e5484d; }
.auth-msg.ok  { background: color-mix(in srgb, #30a46c 16%, transparent); color: #1a7f4f; }
[data-theme="dark"] .auth-msg.ok { background: color-mix(in srgb, #30a46c 22%, var(--surface)); color: #5fe3a1; }

.auth-alt { margin: 16px 0 0; text-align: center; font-size: var(--fz-sm); color: var(--text-muted); }
.auth-alt a { color: var(--brand); font-weight: 600; text-decoration: none; }
.auth-alt a:hover { text-decoration: underline; }
.auth-disclaimer { margin: 14px 0 0; font-size: var(--fz-xs); color: var(--text-muted); line-height: 1.5; }
.btn-block { width: 100%; }
.auth-forgot { display: inline-block; margin-top: 8px; font-size: var(--fz-xs); font-weight: 600; color: var(--brand); text-decoration: none; }
.auth-forgot:hover { text-decoration: underline; }

/* ---- account page ---- */
.acct-wrap { max-width: 760px; margin: 0 auto; padding: 20px 16px 80px; }
.acct-head { margin: 4px 2px 18px; }
.acct-title { margin: 0 0 4px; font-size: var(--fz-xl); font-weight: 800; }
.acct-sub { margin: 0; color: var(--text-muted); font-size: var(--fz-sm); }

.acct-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); padding: 20px; box-shadow: var(--shadow-sm); margin-bottom: 16px; }
.acct-card-title { margin: 0 0 14px; font-size: var(--fz-lg); font-weight: 700; }

.acct-banner { display: flex; gap: 12px; align-items: flex-start; padding: 14px 16px; border-radius: var(--r-md); background: color-mix(in srgb, #f5a623 16%, transparent); color: #7a4b00; margin-bottom: 16px; font-size: var(--fz-sm); }
.acct-banner a { color: inherit; font-weight: 700; }
[data-theme="dark"] .acct-banner { background: color-mix(in srgb, #f5a524 22%, var(--surface)); color: #f5c451; }

.acct-points { display: flex; align-items: baseline; gap: 8px; margin-bottom: 6px; }
.acct-points-val { font-size: 2rem; font-weight: 800; color: var(--brand); line-height: 1; }
.acct-points-lbl { color: var(--text-muted); font-size: var(--fz-sm); }

.acct-tx { width: 100%; border-collapse: collapse; font-size: var(--fz-sm); }
.acct-tx th { text-align: left; color: var(--text-muted); font-weight: 600; padding: 6px 8px; border-bottom: 1px solid var(--border); }
.acct-tx td { padding: 8px; border-bottom: 1px solid var(--border); }
.acct-tx .pos { color: #1a7f4f; font-weight: 600; }
.acct-tx .neg { color: #e5484d; font-weight: 600; }

.acct-orders a { color: var(--brand); font-weight: 600; text-decoration: none; }
.acct-empty { color: var(--text-muted); font-size: var(--fz-sm); padding: 8px 0; }
.acct-empty a { color: var(--brand); font-weight: 600; text-decoration: none; }

/* ---- small / danger buttons (used by auth + account) ---- */
.btn-sm { --bh: 44px; min-height: 44px; padding: 0 16px; font-size: var(--fz-sm); }
.btn-danger { background: #e5484d; color: #fff; box-shadow: 0 8px 22px -10px rgba(229,72,77,.7); }
.btn-danger:not(:disabled):hover { background: #d23b40; transform: translateY(-1px); }

/* ============================================================
   Engaging login / register — form + benefits, two columns on desktop
   ============================================================ */
.auth-wrap-wide { max-width: 860px; }
.auth-grid { display: grid; grid-template-columns: 1fr; gap: 18px; align-items: start; }
@media (min-width: 760px) {
  .auth-grid { grid-template-columns: 1fr 320px; gap: 28px; }
  .auth-grid .auth-card { margin: 0; }
}
.auth-fineprint { margin: 12px 0 0; font-size: var(--fz-xs); color: var(--text-muted); line-height: 1.5; }

.auth-aside { padding: 4px 4px 0; }
@media (min-width: 760px) { .auth-aside { padding-top: 8px; } }
.auth-aside-title { margin: 0 0 14px; font-size: var(--fz-md); font-weight: 700; }
.auth-benefits { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 14px; }
.auth-benefit { display: flex; gap: 12px; align-items: flex-start; }
.auth-benefit-ic {
  flex: none; width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center;
  font-size: 20px; background: var(--brand-soft, color-mix(in srgb, var(--brand) 14%, transparent));
}
.auth-benefit strong { display: block; font-size: var(--fz-sm); }
.auth-benefit-sub { display: block; margin-top: 2px; color: var(--text-muted); font-size: var(--fz-xs); line-height: 1.5; }
.auth-aside-cta { margin: 18px 0 0; font-size: var(--fz-sm); color: var(--text-muted); }
.auth-aside-cta a { color: var(--brand); font-weight: 600; text-decoration: none; }

/* ---- "check your email" confirmation state ---- */
.auth-sent { max-width: 460px; margin: 0 auto; text-align: center; }
.auth-sent .auth-sub { text-align: left; }
.auth-sent-ic {
  width: 64px; height: 64px; border-radius: 50%; margin: 0 auto 14px; display: grid; place-items: center;
  font-size: 30px; background: color-mix(in srgb, var(--brand) 14%, transparent);
}
.auth-sent .auth-alt { margin-top: 18px; }

/* ============================================================
   Account — tabbed (pure-CSS radio tabs; no-JS safe)
   ============================================================ */
.acct-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }

/* Visually hidden but STILL focusable + operable (keyboard + AT reach the radios). */
.acct-radio {
  position: absolute; opacity: 0; width: 1px; height: 1px;
  margin: 0; overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%);
}
.acct-tabs { margin-top: 4px; }

/* Tab list — horizontal, scrolls sideways on small screens.
   Edge fade hints there's more to scroll to. */
.acct-tabnav {
  display: flex; gap: 6px; overflow-x: auto; -webkit-overflow-scrolling: touch;
  border-bottom: 1px solid var(--border); margin-bottom: 18px; padding-bottom: 0;
  scrollbar-width: none;
  -webkit-mask-image: linear-gradient(90deg, transparent 0, #000 14px, #000 calc(100% - 20px), transparent 100%);
          mask-image: linear-gradient(90deg, transparent 0, #000 14px, #000 calc(100% - 20px), transparent 100%);
}
.acct-tabnav::-webkit-scrollbar { display: none; }
.acct-tab {
  flex: none; cursor: pointer; white-space: nowrap; min-height: 44px; padding: 11px 14px; font-size: var(--fz-sm); font-weight: 600;
  color: var(--text-muted); border-bottom: 2.5px solid transparent; margin-bottom: -1px;
  display: inline-flex; align-items: center; gap: 6px; transition: color var(--dur) var(--ease), border-color var(--dur) var(--ease);
}
.acct-tab span { font-size: 15px; }
.acct-tab .os-ic { width: 17px; height: 17px; }
.acct-tab:hover { color: var(--text); }
.acct-tab-danger { color: #c2454a; }
[data-theme="dark"] .acct-tab-danger { color: #ff8a8f; }
/* Keyboard focus cue: focusing a radio outlines its associated visible tab label.
   Radios precede .acct-tabnav, so target the matching label via the general sibling combinator. */
#tab-points:focus-visible   ~ .acct-tabnav .acct-tab[data-tab="points"],
#tab-profile:focus-visible  ~ .acct-tabnav .acct-tab[data-tab="profile"],
#tab-security:focus-visible ~ .acct-tabnav .acct-tab[data-tab="security"],
#tab-orders:focus-visible   ~ .acct-tabnav .acct-tab[data-tab="orders"],
#tab-danger:focus-visible   ~ .acct-tabnav .acct-tab[data-tab="danger"] {
  outline: 3px solid var(--ring); outline-offset: 2px; border-radius: 6px;
}

/* Panels hidden by default; the checked radio reveals its panel + lights its tab. */
.acct-panel { display: none; }
.acct-panel .acct-card { margin-bottom: 0; }
#tab-points:checked   ~ .acct-panels .acct-panel[data-tab="points"],
#tab-profile:checked  ~ .acct-panels .acct-panel[data-tab="profile"],
#tab-security:checked ~ .acct-panels .acct-panel[data-tab="security"],
#tab-orders:checked   ~ .acct-panels .acct-panel[data-tab="orders"],
#tab-danger:checked   ~ .acct-panels .acct-panel[data-tab="danger"] { display: block; }
#tab-points:checked   ~ .acct-tabnav .acct-tab[data-tab="points"],
#tab-profile:checked  ~ .acct-tabnav .acct-tab[data-tab="profile"],
#tab-security:checked ~ .acct-tabnav .acct-tab[data-tab="security"],
#tab-orders:checked   ~ .acct-tabnav .acct-tab[data-tab="orders"] { color: var(--brand); border-bottom-color: var(--brand); }
#tab-danger:checked   ~ .acct-tabnav .acct-tab[data-tab="danger"] { color: #e5484d; border-bottom-color: #e5484d; }

/* Points hero */
.acct-points-hero { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.acct-points-hero > div { display: flex; align-items: baseline; gap: 8px; }

/* Table scroll container so wide tables don't blow out the layout on mobile */
.acct-tx-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.acct-tx-wrap .acct-tx { min-width: 460px; }

/* Danger zone */
.acct-danger { border-color: color-mix(in srgb, #e5484d 40%, var(--border)); }
.acct-danger .acct-card-title { color: #c2454a; }
.acct-danger-warn {
  background: color-mix(in srgb, #e5484d 9%, transparent); border: 1px solid color-mix(in srgb, #e5484d 28%, transparent);
  border-radius: var(--r-md); padding: 14px 16px; margin-bottom: 16px; font-size: var(--fz-sm); line-height: 1.5;
}
.acct-danger-warn ul { margin: 8px 0 0; padding-left: 18px; }
.acct-danger-warn li { margin-bottom: 5px; }
.acct-del-hint { margin: 6px 0 0; font-size: var(--fz-xs); color: var(--text-muted); }
.acct-del-hint.is-mismatch { color: #e5484d; }
[data-theme="dark"] .acct-del-hint.is-mismatch { color: #ff8a8f; }
.btn-danger:disabled { opacity: .5; cursor: not-allowed; box-shadow: none; transform: none; }

/* ---------- Orders: action buttons + view popup + reorder ---------- */
.ord-act {
  appearance: none; border: 1px solid var(--border); background: var(--surface-2);
  color: var(--text); font: inherit; font-size: var(--fz-sm); font-weight: 600;
  padding: 6px 12px; border-radius: var(--r-pill); cursor: pointer; margin-left: 6px;
  transition: border-color var(--dur) var(--ease), background var(--dur) var(--ease);
}
.ord-act:hover { border-color: var(--brand); }
.ord-act.ord-reorder { background: var(--brand); color: var(--on-brand); border-color: transparent; }

.ord-modal {
  position: fixed; inset: 0; z-index: 100; display: none;
  align-items: center; justify-content: center; padding: 16px;
  background: rgba(0, 0, 0, .5); -webkit-backdrop-filter: blur(2px); backdrop-filter: blur(2px);
}
.ord-modal.is-open { display: flex; }
.ord-modal-card {
  position: relative; width: 100%; max-width: 460px; max-height: 88dvh; overflow-y: auto;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-xl);
  box-shadow: var(--shadow-lg); padding: 22px 22px 18px;
  animation: ord-pop .22s var(--ease) both;
}
@keyframes ord-pop { from { opacity: 0; transform: translateY(10px) scale(.98); } to { opacity: 1; transform: none; } }
.ord-modal-x {
  position: absolute; top: 10px; right: 12px; width: 32px; height: 32px; border: 0;
  background: transparent; color: var(--text-muted); font-size: 26px; line-height: 1; cursor: pointer; border-radius: 50%;
}
.ord-modal-x:hover { background: var(--surface-2); color: var(--text); }
.ord-modal-title { margin: 0 0 4px; font-size: var(--fz-lg); }
.ord-meta { color: var(--text-muted); font-size: var(--fz-sm); margin-bottom: 6px; }
.ord-loading { color: var(--text-muted); text-align: center; padding: 24px 0; }
.ord-items { width: 100%; border-collapse: collapse; margin-top: 12px; font-size: var(--fz-sm); }
.ord-items td { padding: 7px 0; border-bottom: 1px solid var(--border); vertical-align: top; }
.ord-totals { margin-top: 4px; }
.ord-totals td { border-bottom: 0; padding: 3px 0; }
.ord-li-mod { color: var(--text-muted); font-size: var(--fz-xs); margin-top: 2px; }
.ord-modal-actions { margin-top: 16px; }
.ord-modal-actions .btn-brand {
  width: 100%; border: 0; border-radius: var(--r-md); padding: 13px; cursor: pointer;
  background: var(--brand); color: var(--on-brand); font: inherit; font-weight: 700; font-size: var(--fz-md);
}
.ord-modal-actions .btn-brand:disabled { opacity: .6; cursor: default; }
