/* ==========================================================================
   LumaMarket stylesheet
   1. Design tokens      5. Buttons & links     9. Pages: auth, dashboards
   2. Base & typography  6. Forms              10. Admin table
   3. Layout             7. Feedback           11. Responsive
   4. Header & footer    8. Pages: home        12. Reduced motion
   ========================================================================== */

/* 1. Design tokens --------------------------------------------------------- */
:root {
  /* Brand */
  --color-navy: #172B49;          /* identity, headings, high-emphasis surfaces */
  --color-blue: #286BB2;          /* primary actions, links, focus */
  --color-blue-hover: #1F5893;
  --color-blue-soft: #EAF2FA;     /* selected and hover tints */

  /* Neutrals */
  --color-bg: #FFFFFF;
  --color-bg-subtle: #F7F6F2;
  --color-text: #172033;
  --color-text-muted: #596579;    /* 5.4:1 or better on both backgrounds */
  --color-border: #E1E5EB;        /* decorative dividers */
  --color-border-strong: #C9D0DA;
  --color-input-border: #7D8799;  /* 3.6:1, meets the non-text contrast rule */

  /* Semantic feedback */
  --color-success: #1E6B43;
  --color-success-bg: #ECF7F0;
  --color-success-border: #A9D8BD;
  --color-error: #B42318;
  --color-error-bg: #FDF0EF;
  --color-error-border: #F2C4BF;
  --color-info: #1F5893;
  --color-info-bg: #EAF2FA;
  --color-info-border: #BED3EA;
  --color-warning: #93370D;
  --color-warning-bg: #FFF6E5;

  /* Typography */
  --font-sans: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-display: "Plus Jakarta Sans", var(--font-sans);
  --text-xs: .75rem;
  --text-sm: .875rem;
  --text-base: 1rem;
  --text-lg: 1.125rem;

  /* Spacing, shape, depth */
  --gutter: clamp(1rem, 4vw, 2rem);
  --container: 75rem;
  --radius-sm: 6px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --shadow-sm: 0 1px 2px rgba(23, 32, 51, .05);
  --shadow-md: 0 12px 32px rgba(23, 32, 51, .08);
  --focus-ring: 3px solid var(--color-blue);
  --transition: .15s ease;
}

/* 2. Base & typography ----------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }
@media (prefers-reduced-motion: no-preference) { html { scroll-behavior: smooth; } }

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--color-bg-subtle);
  color: var(--color-text);
  font-family: var(--font-sans);
  font-size: var(--text-base);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
body.page-home { background: var(--color-bg); }

h1, h2, h3 {
  margin: 0;
  color: var(--color-navy);
  font-family: var(--font-display);
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -.015em;
  text-wrap: balance;
}
p { margin: 0; text-wrap: pretty; }
img { max-width: 100%; display: block; }
a { color: var(--color-blue); }
a:hover { color: var(--color-blue-hover); }

:focus-visible { outline: var(--focus-ring); outline-offset: 2px; }
main:focus { outline: none; }
[id] { scroll-margin-top: 6rem; }

.eyebrow {
  color: var(--color-blue);
  font-size: .8125rem;
  font-weight: 600;
  letter-spacing: .08em;
  text-transform: uppercase;
}
.nowrap { white-space: nowrap; }
.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.skip-link {
  position: absolute;
  top: -100px;
  left: 1rem;
  z-index: 100;
  padding: .75rem 1rem;
  border-radius: var(--radius-md);
  background: var(--color-navy);
  color: #fff;
  font-weight: 600;
}
.skip-link:focus { top: 1rem; color: #fff; }

/* 3. Layout ---------------------------------------------------------------- */
main { flex: 1; }

.container {
  width: 100%;
  max-width: calc(var(--container) + 2 * var(--gutter));
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.page { padding-block: clamp(2rem, 4vw, 3rem) clamp(3rem, 6vw, 4.5rem); }

.page-header { margin-bottom: 2rem; }
.page-header h1 { margin: .375rem 0 .5rem; font-size: clamp(1.75rem, 1.4rem + 1.2vw, 2.25rem); }
.page-header p:not(.eyebrow) { max-width: 40rem; color: var(--color-text-muted); }

.panel {
  padding: clamp(1.25rem, 3vw, 1.75rem);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  background: var(--color-bg);
  box-shadow: var(--shadow-sm);
}
.panel-header { margin-bottom: 1.5rem; }
.panel-header h2 { font-family: var(--font-sans); font-size: var(--text-lg); font-weight: 600; letter-spacing: 0; }
.panel-header p { margin-top: .25rem; color: var(--color-text-muted); font-size: .9375rem; }
.panel-footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 1rem 1.25rem;
  margin-top: 1.5rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--color-border);
}
.panel-flush { padding: 0; overflow: hidden; }
.panel-flush > .panel-header {
  margin: 0;
  padding: 1.25rem clamp(1.25rem, 3vw, 1.5rem);
  border-bottom: 1px solid var(--color-border);
}
.panel-header-row {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1rem 2rem;
}

.profile-layout {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1.5rem;
  align-items: start;
}
.dashboard-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr);
  gap: 1.5rem;
  align-items: start;
}

/* 4. Header & footer ------------------------------------------------------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  border-bottom: 1px solid var(--color-border);
  background: rgba(255, 255, 255, .97);
}
.site-header-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: .75rem 1.5rem;
  min-height: 4.25rem;
  padding-block: .625rem;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: .625rem;
  border-radius: var(--radius-sm);
  color: var(--color-navy);
  text-decoration: none;
}
.brand:hover { color: var(--color-navy); }
.brand-mark {
  display: inline-grid;
  place-items: center;
  width: 2rem;
  height: 2rem;
  border-radius: var(--radius-md);
  background: var(--color-navy);
  color: #fff;
  font-family: var(--font-display);
  font-size: 1.0625rem;
  font-weight: 700;
}
.brand-name { font-family: var(--font-display); font-size: 1.1875rem; font-weight: 700; letter-spacing: -.02em; }

.site-nav { display: flex; flex-wrap: wrap; align-items: center; gap: .25rem .5rem; }
.site-nav form { margin: 0; }
.nav-link {
  position: relative;
  display: inline-flex;
  align-items: center;
  min-height: 2.5rem;
  padding: 0 .75rem;
  border-radius: var(--radius-sm);
  color: var(--color-text);
  font-size: .9375rem;
  font-weight: 500;
  text-decoration: none;
  transition: background-color var(--transition), color var(--transition);
}
.nav-link:hover { background: var(--color-bg-subtle); color: var(--color-navy); }
.nav-link[aria-current="page"] { color: var(--color-navy); font-weight: 600; }
.nav-link[aria-current="page"]::after {
  content: "";
  position: absolute;
  right: .75rem;
  bottom: .125rem;
  left: .75rem;
  height: 2px;
  border-radius: 2px;
  background: var(--color-blue);
}
.nav-user {
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  margin-inline: .25rem .25rem;
  padding-left: .875rem;
  border-left: 1px solid var(--color-border);
  font-size: var(--text-sm);
  font-weight: 500;
}

.site-footer { border-top: 1px solid var(--color-border); background: var(--color-bg); }
.site-footer-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: .5rem 1.5rem;
  padding-block: 1.5rem;
  color: var(--color-text-muted);
  font-size: var(--text-sm);
}
.site-footer nav { display: flex; flex-wrap: wrap; gap: .25rem 1.25rem; }
.site-footer a { color: var(--color-text-muted); text-decoration: none; padding-block: .25rem; }
.site-footer a:hover { color: var(--color-navy); text-decoration: underline; }

/* 5. Buttons & links ------------------------------------------------------- */
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .5rem;
  min-height: 2.75rem;
  padding: 0 1.25rem;
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  font: 600 .9375rem/1.2 var(--font-sans);
  text-align: center;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  transition: background-color var(--transition), border-color var(--transition), color var(--transition);
}
.button-primary { background: var(--color-blue); color: #fff; }
.button-primary:hover { background: var(--color-blue-hover); color: #fff; }
.button-primary:active { background: var(--color-navy); }
.button-secondary { border-color: var(--color-border-strong); background: var(--color-bg); color: var(--color-navy); }
.button-secondary:hover { border-color: var(--color-navy); background: var(--color-bg-subtle); color: var(--color-navy); }
.button-ghost { background: transparent; color: var(--color-blue); }
.button-ghost:hover { background: var(--color-blue-soft); }
.button-small { min-height: 2.25rem; padding: 0 .875rem; font-size: var(--text-sm); }
.button-large { min-height: 3rem; padding: 0 1.5rem; font-size: var(--text-base); }
.button-block { width: 100%; }
.button-google { border-color: var(--color-border-strong); background: var(--color-bg); color: var(--color-text); }
.button-google:hover { border-color: var(--color-navy); background: var(--color-bg-subtle); color: var(--color-text); }
.divider {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin: 1.5rem 0;
  color: var(--color-text-muted);
  font-size: var(--text-sm);
}
.divider::before,
.divider::after { content: ""; flex: 1; height: 1px; background: var(--color-border); }
.button:disabled { opacity: .55; cursor: not-allowed; }

.button-row { display: flex; flex-wrap: wrap; gap: .75rem; }
.button-row-center { justify-content: center; }

.text-link {
  display: inline-flex;
  align-items: center;
  gap: .375rem;
  padding-block: .25rem;
  color: var(--color-blue);
  font-weight: 600;
  text-decoration: none;
}
.text-link:hover { text-decoration: underline; text-underline-offset: 3px; }

.badge {
  display: inline-flex;
  align-items: center;
  padding: .0625rem .5rem;
  border-radius: 999px;
  font-size: var(--text-xs);
  font-weight: 600;
  line-height: 1.6;
  letter-spacing: .02em;
}
.badge-buyer { background: var(--color-info-bg); color: var(--color-info); }
.badge-seller { background: var(--color-success-bg); color: var(--color-success); }
.badge-admin { background: var(--color-navy); color: #fff; }

/* 6. Forms ----------------------------------------------------------------- */
.form { display: grid; gap: 1.25rem; }
.field label,
fieldset legend {
  display: block;
  margin-bottom: .375rem;
  color: var(--color-text);
  font-size: .9375rem;
  font-weight: 600;
}
.field-hint { margin-bottom: .5rem; color: var(--color-text-muted); font-size: var(--text-sm); }
.form > .field-hint { margin: -.5rem 0 0; }
.form-actions { padding-top: .25rem; }

input:not([type="radio"]):not([type="checkbox"]),
select {
  width: 100%;
  min-height: 2.75rem;
  padding: .5625rem .75rem;
  border: 1px solid var(--color-input-border);
  border-radius: var(--radius-md);
  background-color: var(--color-bg);
  color: var(--color-text);
  font: inherit;
  font-size: var(--text-base); /* 16px stops iOS zooming into fields */
  transition: border-color var(--transition), box-shadow var(--transition);
}
input:not([type="radio"]):not([type="checkbox"]):hover,
select:hover { border-color: var(--color-text-muted); }
input:not([type="radio"]):not([type="checkbox"]):focus,
select:focus {
  border-color: var(--color-blue);
  outline: 2px solid transparent; /* stays visible in Windows high-contrast mode */
  box-shadow: 0 0 0 3px rgba(40, 107, 178, .3);
}
input:user-invalid { border-color: var(--color-error); }
input::placeholder { color: #6B7587; }

select {
  appearance: none;
  padding-right: 2.25rem;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5l5 5 5-5' fill='none' stroke='%23596579' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-position: right .75rem center;
  background-repeat: no-repeat;
  cursor: pointer;
}

.password-input { position: relative; }
.password-input input { padding-right: 4.75rem !important; }
.password-toggle {
  position: absolute;
  top: 50%;
  right: .3125rem;
  min-width: 3.75rem;
  height: 2.125rem;
  padding: 0 .625rem;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--color-blue);
  font: 600 var(--text-sm) var(--font-sans);
  cursor: pointer;
  transform: translateY(-50%);
}
.password-toggle:hover { background: var(--color-blue-soft); }
.password-toggle[hidden] { display: none; }

.field-feedback { margin-top: .375rem; font-size: var(--text-sm); font-weight: 500; }
.field-feedback:empty { display: none; }
.field-feedback.is-valid { color: var(--color-success); }
.field-feedback.is-invalid { color: var(--color-error); }

fieldset { min-width: 0; margin: 0; padding: 0; border: 0; }
.role-options { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .75rem; }
.role-option {
  display: flex;
  align-items: flex-start;
  gap: .75rem;
  padding: 1rem;
  border: 1px solid var(--color-border-strong);
  border-radius: var(--radius-lg);
  cursor: pointer;
  transition: border-color var(--transition), background-color var(--transition);
}
.role-option:hover { border-color: var(--color-input-border); }
.role-option input {
  flex: none;
  width: 1.125rem;
  height: 1.125rem;
  margin: .1875rem 0 0;
  accent-color: var(--color-blue);
}
.role-option:has(input:checked) {
  border-color: var(--color-blue);
  background: var(--color-blue-soft);
  box-shadow: inset 0 0 0 1px var(--color-blue);
}
.role-option:has(input:focus-visible) { outline: var(--focus-ring); outline-offset: 2px; }
.role-option input:focus-visible { outline: none; }
.role-option-title { display: block; font-weight: 600; line-height: 1.4; }
.role-option-text { display: block; margin-top: .125rem; color: var(--color-text-muted); font-size: var(--text-sm); line-height: 1.45; }

.detail-list { display: grid; margin: 0; }
.detail-list > div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding-block: .75rem;
  border-bottom: 1px solid var(--color-border);
}
.detail-list > div:first-child { border-top: 1px solid var(--color-border); }
.detail-list dt { color: var(--color-text-muted); font-size: .9375rem; }
.detail-list dd { margin: 0; min-width: 0; font-weight: 500; text-align: right; overflow-wrap: anywhere; }
.detail-list-stacked > div:first-child { border-top: 0; padding-top: 0; }
.detail-list-stacked > div:last-child { border-bottom: 0; }

/* 7. Feedback -------------------------------------------------------------- */
.flash-area { display: grid; gap: .5rem; padding-top: 1.5rem; }
.alert {
  display: flex;
  align-items: flex-start;
  gap: .75rem;
  padding: .875rem 1rem;
  border: 1px solid;
  border-radius: var(--radius-md);
  font-size: .9375rem;
  font-weight: 500;
}
.alert-icon {
  position: relative;
  flex: none;
  width: 1.25rem;
  height: 1.25rem;
  margin-top: .125rem;
  border-radius: 50%;
  background: currentColor;
}
.alert-icon::after {
  position: absolute;
  inset: 0;
  color: #fff;
  font-size: .75rem;
  font-weight: 700;
  line-height: 1.25rem;
  text-align: center;
}
.alert-success { border-color: var(--color-success-border); background: var(--color-success-bg); color: var(--color-success); }
.alert-success .alert-icon::after { content: "\2713"; }
.alert-error { border-color: var(--color-error-border); background: var(--color-error-bg); color: var(--color-error); }
.alert-error .alert-icon::after { content: "!"; }
.alert-info { border-color: var(--color-info-border); background: var(--color-info-bg); color: var(--color-info); }
.alert-info .alert-icon::after { content: "i"; font-family: Georgia, serif; font-style: italic; }

.status-pill {
  display: inline-block;
  padding: .125rem .625rem;
  border-radius: 999px;
  background: var(--color-warning-bg);
  color: var(--color-warning);
  font-size: var(--text-xs);
  font-weight: 600;
  letter-spacing: .02em;
}

.empty-state { padding: 3rem 1.5rem; text-align: center; }
.empty-state h3 { font-size: var(--text-lg); }
.empty-state p { max-width: 28rem; margin: .5rem auto 1.5rem; color: var(--color-text-muted); }

/* 8. Pages: home ----------------------------------------------------------- */
.hero { overflow: hidden; background: #F6FAFD; /* matches the illustration's own background so it blends in */ }
.hero-inner {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr);
  align-items: center;
  gap: clamp(1.5rem, 3vw, 2.5rem);
  padding-block: clamp(2.5rem, 6vw, 5rem);
}
.hero h1 {
  max-width: 11em;
  margin: 0 0 1.75rem;
  font-size: clamp(2.25rem, 1rem + 3.9vw, 4.25rem);
  line-height: 1.1;
  letter-spacing: -.035em;
}
.hero-accent { display: block; color: var(--color-blue); }
.hero-lead {
  max-width: 36rem;
  margin-bottom: 1.25rem;
  color: var(--color-text);
  font-size: clamp(1.0625rem, 1rem + .3vw, 1.1875rem);
  line-height: 1.6;
}
.hero .button-row { margin-top: 2rem; }
.hero-media { margin: 0; }
/* The picture has generous empty margins, so it is scaled up to let the artwork fill the column. */
.hero-media img { width: 125%; max-width: none; height: auto; margin-left: -8%; }
.hero-content { position: relative; z-index: 1; }

.section { padding-block: clamp(3rem, 6vw, 5rem); }
.section-header { max-width: 40rem; margin-bottom: 2rem; }
.section-header .status-pill { margin-bottom: .75rem; }
.section-header h2 { font-size: clamp(1.5rem, 1.2rem + 1vw, 2rem); }
.section-header p { margin-top: .5rem; color: var(--color-text-muted); font-size: 1.0625rem; }

.account-types { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1.5rem; }
.account-type {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  padding: clamp(1.5rem, 3vw, 2rem);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
}
.account-type h3 { margin: 1rem 0 .5rem; font-size: 1.25rem; }
.account-type p { margin-bottom: 1.25rem; color: var(--color-text-muted); }
.account-type .text-link { margin-top: auto; }
.section-note {
  margin-top: 2rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--color-border);
  color: var(--color-text-muted);
  font-size: .9375rem;
}

/* 9. Pages: auth, dashboards, errors --------------------------------------- */
.auth-layout { display: grid; justify-items: center; padding-block: clamp(2rem, 6vw, 4rem); }
.auth-card {
  width: 100%;
  max-width: 28rem;
  padding: clamp(1.5rem, 5vw, 2.5rem);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  background: var(--color-bg);
  box-shadow: var(--shadow-md);
}
.auth-card-wide { max-width: 34rem; }
.auth-header { margin-bottom: 1.5rem; }
.auth-header h1 { margin-bottom: .5rem; font-size: clamp(1.5rem, 1.3rem + .8vw, 1.75rem); }
.auth-header p { color: var(--color-text-muted); }
.auth-card .alert { margin-bottom: 1.25rem; }
.auth-card .alert + .alert { margin-top: -.75rem; }
.auth-card .button-block { margin-top: .5rem; }
.auth-switch {
  margin-top: 1.75rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--color-border);
  color: var(--color-text-muted);
  text-align: center;
}
.auth-switch a { font-weight: 600; }

.placeholder-panel h2 { margin: .875rem 0 .5rem; font-size: 1.375rem; }
.placeholder-panel > p { max-width: 38rem; color: var(--color-text-muted); }
.check-list { display: grid; gap: .625rem; margin: 1.5rem 0 0; padding: 1.25rem 0 0; border-top: 1px solid var(--color-border); list-style: none; }
.check-list li { position: relative; padding-left: 1.875rem; }
.check-list li::before {
  content: "";
  position: absolute;
  top: .1875rem;
  left: 0;
  width: 1.25rem;
  height: 1.25rem;
  border-radius: 50%;
  background: var(--color-success-bg) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='10' viewBox='0 0 12 10'%3E%3Cpath d='M1.5 5.2l3 3 6-6.4' fill='none' stroke='%231E6B43' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / .75rem no-repeat;
}

.error-layout { padding-block: clamp(3rem, 10vw, 6rem); }
.error-panel { max-width: 36rem; margin-inline: auto; text-align: center; }
.error-code { color: var(--color-blue); font-size: .8125rem; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; }
.error-panel h1 { margin: .75rem 0 1rem; font-size: clamp(1.75rem, 1.4rem + 1.2vw, 2.25rem); }
.error-panel > p:not(.error-code) { margin-bottom: 2rem; color: var(--color-text-muted); font-size: 1.0625rem; }

/* 10. Admin dashboard ------------------------------------------------------ */
.stat-strip {
  margin-bottom: 1.5rem;
  overflow: hidden;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}
.stat-strip dl {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 1px;
  margin: 0;
  background: var(--color-border); /* the 1px gaps become dividers */
}
.stat { padding: 1rem 1.25rem; background: var(--color-bg); }
.stat dt { color: var(--color-text-muted); font-size: .8125rem; font-weight: 500; }
.stat dd {
  margin: .125rem 0 0;
  color: var(--color-navy);
  font-family: var(--font-display);
  font-size: 1.75rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  line-height: 1.2;
}
.stat dd a { color: inherit; text-decoration: none; }
.stat dd a:hover,
.stat dd a:focus-visible { text-decoration: underline; }
.stat-strip.admin-summary dl { grid-template-columns: repeat(7, minmax(0, 1fr)); }

.filter-bar { display: flex; flex-wrap: wrap; align-items: flex-end; gap: .75rem; }
.field-inline label { margin-bottom: .25rem; font-size: .8125rem; }
.filter-bar input { width: 15rem; }
.filter-bar select { width: 9.5rem; }

.table-wrap { overflow-x: auto; }
.user-table { width: 100%; border-collapse: collapse; font-size: .9375rem; }
.user-table th,
.user-table td {
  padding: .875rem 1rem;
  border-bottom: 1px solid var(--color-border);
  text-align: left;
  vertical-align: middle;
}
.user-table th:first-child,
.user-table td:first-child { padding-left: clamp(1.25rem, 3vw, 1.5rem); }
.user-table th:last-child,
.user-table td:last-child { padding-right: clamp(1.25rem, 3vw, 1.5rem); }
.user-table thead th {
  background: var(--color-bg-subtle);
  color: var(--color-text-muted);
  font-size: var(--text-xs);
  font-weight: 600;
  letter-spacing: .06em;
  text-transform: uppercase;
  white-space: nowrap;
}
.user-table tbody tr:last-child > * { border-bottom: 0; }
.user-table tbody tr:hover { background: #FBFAF8; }
.user-table td[data-label="Joined"] { color: var(--color-text-muted); white-space: nowrap; }
.user-cell { font-weight: 400; }
.user-name { display: block; font-weight: 600; }
.user-email { display: block; color: var(--color-text-muted); font-size: var(--text-sm); overflow-wrap: anywhere; }
.user-table select { width: auto; min-width: 7.5rem; min-height: 2.25rem; padding-block: .3125rem; font-size: .9375rem; }
.is-inactive .user-name { color: var(--color-text-muted); }
.action-cell { text-align: right !important; white-space: nowrap; }
.action-cell form { margin: 0; }
.you-tag {
  margin-left: .25rem;
  padding: 0 .375rem;
  border: 1px solid var(--color-border-strong);
  border-radius: var(--radius-sm);
  color: var(--color-text-muted);
  font-size: var(--text-xs);
  font-weight: 500;
}
.status { display: inline-flex; align-items: center; gap: .375rem; font-weight: 500; }
.status::before { content: ""; width: .5rem; height: .5rem; border-radius: 50%; background: currentColor; }
.status-active { color: var(--color-success); }

.add-admin { margin-top: 1.5rem; }
.add-admin summary { cursor: pointer; font-size: var(--text-lg); font-weight: 600; color: var(--color-navy); }
.add-admin-help { margin: .5rem 0 1.5rem; max-width: 40rem; color: var(--color-text-muted); font-size: .9375rem; }
.add-admin-form { max-width: 28rem; }

/* 11. Responsive ----------------------------------------------------------- */
@media (pointer: coarse) {
  .button-small { min-height: 2.75rem; }
  .user-table select { min-height: 2.75rem; }
}

@media (max-width: 960px) {
  .stat-strip dl { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .stat-strip.admin-summary dl { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .nav-user-name { display: none; }
}

@media (max-width: 860px) {
  .hero-inner { grid-template-columns: 1fr; }
  .hero-media img { width: 100%; margin-left: 0; }
  .profile-layout,
  .dashboard-layout { grid-template-columns: 1fr; }
}

@media (max-width: 720px) {
  /* Each user becomes a stacked card instead of a wide table row. */
  .user-table thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .user-table tbody tr {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: .875rem 1rem;
    padding: 1.25rem;
    border-bottom: 1px solid var(--color-border);
  }
  .user-table tbody tr:last-child { border-bottom: 0; }
  .user-table tbody tr:hover { background: none; }
  .user-table th,
  .user-table td { display: block; padding: 0 !important; border: 0; }
  .user-table .user-cell,
  .user-table td[data-label="Joined"],
  .user-table .action-cell { grid-column: 1 / -1; }
  .user-table td[data-label]::before {
    content: attr(data-label);
    display: block;
    margin-bottom: .25rem;
    color: var(--color-text-muted);
    font-size: var(--text-xs);
    font-weight: 600;
    letter-spacing: .06em;
    text-transform: uppercase;
  }
  .user-table td[data-label="Joined"]::before { display: inline; margin-right: .5rem; }
  .user-table select { width: 100%; min-height: 2.75rem; }
  .action-cell { text-align: left !important; }
  .action-cell .button { width: 100%; min-height: 2.75rem; }

  .filter-bar { width: 100%; }
  .filter-bar .field-inline:first-child { flex: 1 1 100%; }
  .filter-bar input { width: 100%; }
  .filter-bar select { width: 100%; }
  .filter-bar .field-inline:nth-child(2) { flex: 1 1 8rem; }
}

@media (max-width: 560px) {
  .site-nav { flex: 1 1 100%; justify-content: flex-start; margin-left: -.75rem; }
  .site-nav .button,
  .site-nav form { margin-left: auto; }
  .nav-user { margin-inline: auto 0; padding-left: 0; border-left: 0; }
  .nav-user + form { margin-left: .25rem; }
  .button-row .button { flex: 1 1 100%; }
  .role-options,
  .account-types { grid-template-columns: 1fr; }
  .stat-strip dl { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stat-strip.admin-summary dl { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .site-footer-inner { flex-direction: column; align-items: flex-start; }
}

/* 12. Reduced motion ------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    transition-duration: .01ms !important;
    animation-duration: .01ms !important;
    scroll-behavior: auto !important;
  }
}
.forgot-link{margin:-.25rem 0 1rem;font-size:.9rem}

/* 13. Shop: catalogue, product, cart, orders --------------------------------- */
.product-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(15rem, 1fr)); gap: 1.25rem; margin-block: 1.25rem; }
.product-card { background: var(--color-bg); border: 1px solid var(--color-border); border-radius: var(--radius-lg); overflow: hidden; display: flex; flex-direction: column; box-shadow: var(--shadow-sm); }
.product-image { display: flex; align-items: center; justify-content: center; aspect-ratio: 4 / 3; background: var(--color-bg-subtle); }
.product-image img, .product-detail-image img { width: 100%; height: 100%; object-fit: cover; display: block; }
.product-image-empty { color: var(--color-text-muted); font-size: var(--text-sm); }
.product-body { padding: 1rem; display: grid; gap: .25rem; }
.product-body h3 { margin: 0; font-size: var(--text-lg); }
.product-body h3 a { color: var(--color-navy); text-decoration: none; }
.product-body h3 a:hover, .product-body h3 a:focus-visible { text-decoration: underline; }
.product-seller { margin: 0; color: var(--color-text-muted); font-size: var(--text-sm); }
.price { margin: .25rem 0; display: flex; align-items: baseline; flex-wrap: wrap; gap: .5rem; }
.price-now { font-family: var(--font-display); font-weight: 700; font-size: 1.25rem; color: var(--color-navy); }
.price-was { color: var(--color-text-muted); font-size: var(--text-sm); }
.badge-sale { background: var(--color-error-bg); color: var(--color-error); border: 1px solid var(--color-error-border); }
.stock { font-size: var(--text-sm); font-weight: 600; }
.stock-in { color: var(--color-success); }
.stock-low { color: var(--color-warning); }
.stock-out { color: var(--color-error); }
.product-detail { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 2rem; align-items: start; }
.product-detail-image { background: var(--color-bg-subtle); border-radius: var(--radius-lg); overflow: hidden; aspect-ratio: 4 / 3; display: flex; align-items: center; justify-content: center; }
.product-description { white-space: pre-line; max-width: 60ch; }
.buy-form { display: flex; align-items: flex-end; gap: 1rem; flex-wrap: wrap; margin-block: 1rem; }
.buy-form input[type="number"], .qty-input { width: 5.5rem; }
.breadcrumb { margin-block: 0 1rem; }
.catalog-search { margin-bottom: 1rem; }
.results-summary { color: var(--color-text-muted); margin: 0 0 .5rem; }
.pagination { display: flex; align-items: center; justify-content: center; gap: 1rem; margin-block: 1.5rem; }
.cart-table { width: 100%; border-collapse: collapse; }
.cart-table th, .cart-table td { padding: .75rem 1rem; text-align: left; border-bottom: 1px solid var(--color-border); vertical-align: middle; }
.cart-table thead th { font-size: var(--text-sm); color: var(--color-text-muted); }
.inline-form { display: inline-flex; gap: .5rem; align-items: center; }
.cart-total, .cart-total-line { display: flex; justify-content: flex-end; align-items: center; gap: 1.5rem; padding: 1rem; margin: 0; flex-wrap: wrap; }
.cart-total p { margin: 0; font-size: var(--text-lg); }
.cart-badge { display: inline-block; min-width: 1.35rem; padding: 0 .4rem; border-radius: 999px; background: var(--color-blue); color: #fff; font-size: var(--text-xs); text-align: center; }
.summary-list { list-style: none; margin: 0; padding: 0; }
.summary-list li { display: flex; justify-content: space-between; gap: 1rem; padding: .6rem 0; border-bottom: 1px solid var(--color-border); }
.payment-note { background: var(--color-warning-bg); border: 1px solid var(--color-border-strong); border-radius: var(--radius-md); padding: 1rem; margin-block: 1rem; }
.payment-note h3 { margin-top: 0; }
.checkbox { display: flex; gap: .5rem; align-items: flex-start; }
.field-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(10rem, 1fr)); gap: 1rem; }
.promo-fieldset { border: 1px solid var(--color-border-strong); border-radius: var(--radius-md); padding: 1rem; margin: 1rem 0; }
.promo-fieldset legend { font-weight: 600; padding-inline: .4rem; }
.form-thumb { display: block; max-width: 8rem; border-radius: var(--radius-md); margin-block: .5rem; }
.product-form-panel { max-width: 44rem; }
textarea { width: 100%; font: inherit; padding: .65rem .75rem; border: 1px solid var(--color-input-border); border-radius: var(--radius-md); }
.page-header-row { display: flex; justify-content: space-between; align-items: flex-end; gap: 1rem; flex-wrap: wrap; }
.button[aria-disabled="true"] { opacity: .5; cursor: not-allowed; }
@media (max-width: 48rem) {
  .product-detail { grid-template-columns: 1fr; }
  .cart-table thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .cart-table tr { display: block; border-bottom: 1px solid var(--color-border); padding: .5rem 0; }
  .cart-table th, .cart-table td { display: flex; justify-content: space-between; gap: 1rem; border: 0; padding: .35rem 1rem; }
  .cart-table td[data-label]::before { content: attr(data-label); color: var(--color-text-muted); }
}

/* 14. Weather ------------------------------------------------------------------ */
.weather-layout { display: grid; grid-template-columns: minmax(0, 22rem) minmax(0, 1fr); gap: 1.5rem; align-items: start; }
.weather-tabs { display: flex; gap: 1rem; margin-bottom: 1rem; }
.weather-result { text-align: center; }
.weather-temp { font-family: var(--font-display); font-size: 3rem; font-weight: 700; color: var(--color-navy); margin: 0; }
.weather-icon { width: 6rem; height: 6rem; background: var(--color-navy); border-radius: 50%; }
.weather-facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(8rem, 1fr)); gap: 1rem; margin-top: 1rem; text-align: left; }
.weather-loading { display: none; color: var(--color-text-muted); }
form.is-loading .weather-loading { display: block; }
@media (max-width: 48rem) { .weather-layout { grid-template-columns: 1fr; } }

/* 15. Icons, trust badges, add to cart, side cart ------------------------------------------ */
.icon { width: 1.1em; height: 1.1em; flex: none; vertical-align: -.18em; margin-right: .4em; }
.icon-xl { width: 3rem; height: 3rem; margin: 0; color: var(--color-text-muted); }
.button .icon { margin-right: .45em; }
.nav-cart { display: inline-flex; align-items: center; }
.nav-cart .icon { margin-right: .35em; }

.badge-list { list-style: none; margin: 0 0 .15rem; padding: 0; display: flex; flex-wrap: wrap; gap: .35rem; }
.pbadge { display: inline-flex; align-items: center; gap: .25rem; padding: .15rem .55rem; border-radius: 999px; font-size: var(--text-xs); font-weight: 600; line-height: 1.5; border: 1px solid transparent; white-space: nowrap; }
.pbadge .icon { width: .95em; height: .95em; margin: 0; }
.pbadge-sale { background: var(--color-error-bg); color: var(--color-error); border-color: var(--color-error-border); }
.pbadge-choice { background: #FFF6E5; color: #7A4B00; border-color: #F0D49A; }
.pbadge-bestseller { background: var(--color-blue-soft); color: var(--color-info); border-color: var(--color-info-border); }
.pbadge-shipping { background: var(--color-success-bg); color: var(--color-success); border-color: var(--color-success-border); }
.pbadge-new { background: var(--color-navy); color: #fff; }
.pbadge-low { background: var(--color-warning-bg); color: var(--color-warning); border-color: #F0D49A; }

.product-actions { margin-top: .6rem; }
.product-actions form { margin: 0; }
.product-body { flex: 1; align-content: start; }
.product-card .product-actions { margin-top: auto; padding-top: .6rem; }
.product-card:focus-within, .product-card:hover { box-shadow: var(--shadow-md); }
.product-card { transition: box-shadow var(--transition), transform var(--transition); }

/* Gallery */
.gallery-thumbs { list-style: none; margin: .75rem 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: .5rem; }
.gallery-thumbs a { display: block; width: 4.5rem; height: 4.5rem; border: 2px solid var(--color-border); border-radius: var(--radius-md); overflow: hidden; }
.gallery-thumbs a[aria-current="true"] { border-color: var(--color-blue); }
.gallery-thumbs img { width: 100%; height: 100%; object-fit: cover; display: block; }
.gallery-thumbs a:focus-visible { outline: var(--focus-ring); outline-offset: 2px; }

/* Product form: image manager */
.image-manager, .image-previews { list-style: none; margin: .5rem 0 1rem; padding: 0; display: flex; flex-wrap: wrap; gap: .75rem; }
.image-manager li { display: grid; gap: .25rem; justify-items: start; font-size: var(--text-sm); }
.image-manager img, .image-previews img { width: 6rem; height: 6rem; object-fit: cover; border-radius: var(--radius-md); border: 1px solid var(--color-border); display: block; }

/* Side cart */
body.drawer-open { overflow: hidden; }
.drawer-backdrop { position: fixed; inset: 0; background: rgba(23, 32, 51, .45); opacity: 0; transition: opacity .2s ease; z-index: 90; }
.drawer-backdrop.is-open { opacity: 1; }
.drawer { position: fixed; top: 0; right: 0; bottom: 0; width: min(26rem, 100%); background: var(--color-bg); z-index: 100; box-shadow: -12px 0 40px rgba(23, 32, 51, .2); transform: translateX(100%); transition: transform .22s ease; display: flex; flex-direction: column; outline: none; }
.drawer.is-open { transform: none; }
#cart-drawer-content { display: flex; flex-direction: column; height: 100%; min-height: 0; }
.drawer-header { display: flex; align-items: center; justify-content: space-between; padding: 1rem 1.25rem; border-bottom: 1px solid var(--color-border); }
.drawer-header h2 { margin: 0; font-size: 1.25rem; }
.drawer-count { color: var(--color-text-muted); font-weight: 500; }
.drawer-close { background: none; border: 0; padding: .5rem; border-radius: var(--radius-md); cursor: pointer; color: var(--color-text); }
.drawer-close:hover { background: var(--color-bg-subtle); }
.drawer-close .icon { margin: 0; width: 1.4rem; height: 1.4rem; }
.drawer-message { margin: 0; padding: .65rem 1.25rem; font-size: var(--text-sm); display: flex; align-items: center; }
.drawer-message.is-ok { background: var(--color-success-bg); color: var(--color-success); }
.drawer-message.is-error { background: var(--color-error-bg); color: var(--color-error); }
.drawer-items { list-style: none; margin: 0; padding: 0 1.25rem; overflow-y: auto; flex: 1; }
.drawer-item { display: grid; grid-template-columns: 4.5rem 1fr auto; gap: .75rem; padding: 1rem 0; border-bottom: 1px solid var(--color-border); }
.drawer-thumb { width: 4.5rem; height: 4.5rem; background: var(--color-bg-subtle); border-radius: var(--radius-md); overflow: hidden; display: flex; align-items: center; justify-content: center; }
.drawer-thumb img { width: 100%; height: 100%; object-fit: cover; }
.drawer-item-name { font-weight: 600; color: var(--color-navy); text-decoration: none; }
.drawer-item-name:hover { text-decoration: underline; }
.drawer-item-price, .drawer-line-total { margin: .15rem 0; font-size: var(--text-sm); }
.drawer-line-total { font-weight: 600; }
.drawer-item-controls { display: flex; align-items: center; gap: .75rem; flex-wrap: wrap; margin-top: .35rem; }
.drawer-item-controls form { display: inline-flex; gap: .4rem; align-items: center; margin: 0; }
.drawer-item-controls .qty-input { width: 4.5rem; padding: .3rem .5rem; }
.text-button { background: none; border: 0; padding: .25rem; color: var(--color-error); text-decoration: underline; cursor: pointer; font: inherit; font-size: var(--text-sm); }
.drawer-footer { padding: 1rem 1.25rem 1.25rem; border-top: 1px solid var(--color-border); background: var(--color-bg-subtle); }
.drawer-subtotal { display: flex; justify-content: space-between; margin: 0 0 .25rem; font-size: var(--text-lg); }
.drawer-actions { display: grid; gap: .6rem; margin-top: .75rem; }
.drawer-viewcart { display: inline-block; margin-top: .75rem; }
.drawer-empty { flex: 1; display: grid; place-content: center; justify-items: center; text-align: center; gap: .5rem; padding: 2rem; }
.drawer-empty h3, .drawer-empty p { margin: 0; }

.toast { position: fixed; left: 50%; bottom: 1.5rem; transform: translateX(-50%); max-width: min(32rem, calc(100% - 2rem)); padding: .75rem 1.1rem; border-radius: var(--radius-md); background: var(--color-navy); color: #fff; box-shadow: var(--shadow-md); z-index: 110; }
.toast-error { background: var(--color-error); }

@media (prefers-reduced-motion: reduce) {
  .drawer, .drawer-backdrop, .product-card { transition: none; }
}

/* 16. Polish after browser review ------------------------------------------------------------ */
.cart-badge[hidden], .toast[hidden] { display: none; }
.cart-badge { margin-left: .4rem; }
.product-body { display: flex; flex-direction: column; gap: .25rem; }
.product-card .product-actions { margin-top: auto; }
.product-body .badge-list { min-height: 1.6rem; align-content: flex-start; }

/* 17. Weather: detected location bar ----------------------------------------------------------- */
.location-bar { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; background: var(--color-blue-soft); border: 1px solid var(--color-info-border); border-radius: var(--radius-md); padding: .75rem 1rem; margin-bottom: 1.25rem; }
.location-text { margin: 0; display: flex; align-items: flex-start; gap: .25rem; color: var(--color-navy); }
.location-text .icon { margin-top: .2em; }
.location-actions { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; }
.location-actions form, .location-bar > form { margin: 0; }
.weather-layout-single { grid-template-columns: minmax(0, 40rem); }
.panel-title { margin: 0 0 .75rem; font-weight: 600; }
.privacy-note { margin-top: 1rem; }
.weather-icon { display: block; margin: .5rem auto; }
.location-bar-problem { background: var(--color-warning-bg); border-color: #F0D49A; }
.location-text > div p { margin: 0; }
.location-reason { margin-top: .35rem !important; font-size: var(--text-sm); color: var(--color-text-muted); }
