/* ============================================================
   Lounge Membership Platform — shared design system
   Brand carried from the build-plan doc: brass/navy, Archivo Narrow
   for headings, a system-UI sans for dense app text, tabular mono
   for badge/credential data. Light + dark via data-theme / OS pref.
   ============================================================ */

:root {
  --paper: #eef0f0;
  --surface: #ffffff;
  --surface-alt: #f4f5f3;
  --ink: #141b24;
  --ink-soft: #3c4753;
  --ink-faint: #69737e;
  --rule: #d3d8da;

  --accent: #9c6b2e;
  --accent-ink: #5f3f19;
  --accent-tint: #f2e6d3;

  --ok: #2e7d55;
  --ok-tint: #e2f0e8;
  --info: #3a6ea5;
  --info-tint: #e3ebf4;
  --warn: #966616;
  --warn-tint: #f4e9d3;
  --err: #b23b3b;
  --err-tint: #f5e2e2;

  --focus-ring: #9c6b2e;
  --shadow-sm: 0 1px 3px rgba(20, 27, 36, 0.08);
  --shadow-md: 0 12px 32px -12px rgba(20, 27, 36, 0.28);
  --shadow-lg: 0 24px 60px -20px rgba(20, 27, 36, 0.32);

  --font-display: "Archivo Narrow", "Roboto Condensed", "Arial Narrow", sans-serif;
  --font-display-serif: Georgia, "Iowan Old Style", "Palatino Linotype", "Times New Roman", serif;
  --font-ui: -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-mono: ui-monospace, "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;

  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 24px;
  --space-6: 32px;
  --space-7: 48px;

  --radius-sm: 5px;
  --radius-md: 8px;
  --sidebar-w: 232px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper: #12171d;
    --surface: #1a2129;
    --surface-alt: #202932;
    --ink: #e9e6dd;
    --ink-soft: #b9c0c7;
    --ink-faint: #818b94;
    --rule: #2c353d;

    --accent: #d6a54b;
    --accent-ink: #f2dcae;
    --accent-tint: #3a2f1a;

    --ok: #5cbf8c;
    --ok-tint: #173427;
    --info: #7aaee0;
    --info-tint: #182a3a;
    --warn: #d9ab53;
    --warn-tint: #3a2c12;
    --err: #e18787;
    --err-tint: #3a1f1f;

    --focus-ring: #d6a54b;
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.45);
    --shadow-md: 0 12px 32px -12px rgba(0, 0, 0, 0.6);
    --shadow-lg: 0 24px 60px -20px rgba(0, 0, 0, 0.7);
  }
}
:root[data-theme="dark"] {
  --paper: #12171d; --surface: #1a2129; --surface-alt: #202932;
  --ink: #e9e6dd; --ink-soft: #b9c0c7; --ink-faint: #818b94; --rule: #2c353d;
  --accent: #d6a54b; --accent-ink: #f2dcae; --accent-tint: #3a2f1a;
  --ok: #5cbf8c; --ok-tint: #173427; --info: #7aaee0; --info-tint: #182a3a;
  --warn: #d9ab53; --warn-tint: #3a2c12; --err: #e18787; --err-tint: #3a1f1f;
  --focus-ring: #d6a54b;
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.45);
  --shadow-md: 0 12px 32px -12px rgba(0, 0, 0, 0.6);
  --shadow-lg: 0 24px 60px -20px rgba(0, 0, 0, 0.7);
}
:root[data-theme="light"] {
  --paper: #eef0f0; --surface: #ffffff; --surface-alt: #f4f5f3;
  --ink: #141b24; --ink-soft: #3c4753; --ink-faint: #69737e; --rule: #d3d8da;
  --accent: #9c6b2e; --accent-ink: #5f3f19; --accent-tint: #f2e6d3;
  --ok: #2e7d55; --ok-tint: #e2f0e8; --info: #3a6ea5; --info-tint: #e3ebf4;
  --warn: #966616; --warn-tint: #f4e9d3; --err: #b23b3b; --err-tint: #f5e2e2;
  --focus-ring: #9c6b2e;
  --shadow-sm: 0 1px 3px rgba(20, 27, 36, 0.08);
  --shadow-md: 0 12px 32px -12px rgba(20, 27, 36, 0.28);
  --shadow-lg: 0 24px 60px -20px rgba(20, 27, 36, 0.32);
}

/* ---- reset & base ---- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-ui);
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 700;
  letter-spacing: 0.01em;
  color: var(--ink);
  margin: 0 0 var(--space-3);
  text-wrap: balance;
}
h1 { font-size: 1.9rem; }
h2 { font-size: 1.4rem; }
h3 { font-size: 1.1rem; }
p { margin: 0 0 var(--space-3); color: var(--ink-soft); max-width: 68ch; }
a { color: var(--info); }
a:hover { text-decoration-thickness: 2px; }

/* Public-facing pages (Pages/Shared/_Layout.cshtml) get a quieter, more considered headline
   treatment than the admin tool — a serif at a lighter weight reads as a membership brand, not
   dashboard chrome. Scoped to main.page so admin's own h1 (compact topbar title) is untouched. */
main.page h1 {
  font-family: var(--font-display-serif);
  font-weight: 500;
  font-size: clamp(2rem, 4vw, 2.75rem);
  line-height: 1.15;
  letter-spacing: 0;
}
small, .small { font-size: 0.86rem; }
code, .mono { font-family: var(--font-mono); }
.tabular-nums { font-variant-numeric: tabular-nums; }

:focus-visible {
  outline: 2.5px solid var(--focus-ring);
  outline-offset: 2px;
  border-radius: 3px;
}

@media (prefers-reduced-motion: no-preference) {
  a, button, .btn, .nav-link, .field input, .field select, .field textarea {
    transition: color 0.15s ease, background-color 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease, opacity 0.15s ease, transform 0.15s ease;
  }
}
@media (prefers-reduced-motion: reduce) {
  * { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
}

/* ---- skip link ---- */
.skip-link {
  position: absolute;
  left: 8px;
  top: -48px;
  background: var(--accent);
  color: #fff;
  padding: 0.6rem 1rem;
  border-radius: var(--radius-sm);
  font-family: var(--font-display);
  font-size: 0.9rem;
  z-index: 100;
  transition: top 0.15s ease;
}
.skip-link:focus { top: 8px; }

/* ---- layout shells ---- */
.container { max-width: 1080px; margin: 0 auto; padding: 0 var(--space-5); }

.site-header {
  background: var(--surface);
  border-bottom: 1px solid var(--rule);
}
.site-header .container {
  display: flex; align-items: center; justify-content: space-between;
  gap: var(--space-4); padding-top: var(--space-4); padding-bottom: var(--space-4);
}
.brand {
  display: flex; align-items: center; gap: var(--space-2);
  font-family: var(--font-display); font-weight: 700; font-size: 1.1rem;
  color: var(--ink); text-decoration: none;
}
.brand .mark { color: var(--accent); }
.site-nav { display: flex; align-items: center; gap: var(--space-5); }
.site-nav a { color: var(--ink-soft); text-decoration: none; font-size: 0.95rem; }
.site-nav a:hover { color: var(--ink); }

.site-footer {
  border-top: 1px solid var(--rule);
  color: var(--ink-faint);
  font-size: 0.85rem;
  padding: var(--space-5) 0;
  margin-top: var(--space-7);
}

main.page { padding: var(--space-6) 0 var(--space-7); }

/* ---- hero (public landing) ---- */
.hero {
  position: relative;
  padding: var(--space-7) var(--space-6);
  border-radius: var(--radius-md);
  background:
    radial-gradient(60% 120% at 85% 0%, color-mix(in srgb, var(--accent) 14%, transparent), transparent 70%),
    var(--surface);
  border: 1px solid var(--rule);
  box-shadow: var(--shadow-md);
  overflow: hidden;
}
.hero::before {
  content: "";
  position: absolute; inset: 0 0 auto 0; height: 3px;
  background: linear-gradient(90deg, var(--accent), color-mix(in srgb, var(--accent) 40%, transparent));
}
.hero .eyebrow { margin-bottom: var(--space-3); }
.hero p.lede { font-size: 1.08rem; max-width: 56ch; }
.hero .cluster { margin-top: var(--space-5); }

/* ---- admin shell ---- */
.admin-shell {
  display: grid;
  grid-template-columns: var(--sidebar-w) minmax(0, 1fr);
  min-height: 100vh;
}
.admin-sidebar {
  background: var(--surface);
  border-right: 1px solid var(--rule);
  padding: var(--space-5) var(--space-3);
  display: flex; flex-direction: column; gap: var(--space-5);
}
.admin-sidebar .brand { padding: 0 var(--space-2); }
.admin-nav { display: flex; flex-direction: column; gap: 2px; }
.admin-nav a {
  display: flex; align-items: center; gap: var(--space-3);
  padding: 0.55rem var(--space-2);
  border-radius: var(--radius-sm);
  color: var(--ink-soft);
  text-decoration: none;
  font-size: 0.92rem;
}
.admin-nav a svg { flex: none; width: 18px; height: 18px; stroke: currentColor; }
.admin-nav a:hover { background: var(--surface-alt); color: var(--ink); }
.admin-nav a[aria-current="page"] {
  background: var(--accent-tint); color: var(--accent-ink); font-weight: 600;
}
.admin-sidebar-footer { margin-top: auto; padding: var(--space-3) var(--space-2) 0; border-top: 1px solid var(--rule); }
.admin-main { min-width: 0; }
.admin-topbar {
  display: flex; align-items: center; justify-content: space-between;
  gap: var(--space-4); padding: var(--space-4) var(--space-6);
  background: var(--surface); border-bottom: 1px solid var(--rule);
  position: sticky; top: 0; z-index: 10;
}
.admin-content { padding: var(--space-6); max-width: 1180px; }

.nav-toggle { display: none; }

@media (max-width: 860px) {
  .admin-shell { grid-template-columns: 1fr; }
  .admin-sidebar { display: none; }
  .admin-sidebar.is-open {
    display: flex; position: fixed; inset: 0 25% 0 0; z-index: 50;
    box-shadow: var(--shadow-md); overflow-y: auto;
  }
  .admin-content, .admin-topbar { padding-left: var(--space-4); padding-right: var(--space-4); }
  .nav-toggle {
    display: inline-flex; align-items: center; justify-content: center;
    width: 40px; height: 40px; border-radius: var(--radius-sm); border: 1px solid var(--rule);
    background: var(--surface); color: var(--ink); cursor: pointer;
  }
}

/* ---- cards & panels ---- */
.card {
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: var(--radius-md);
  padding: var(--space-5);
  box-shadow: var(--shadow-sm);
}
.card + .card { margin-top: var(--space-4); }
.card-title { font-family: var(--font-display); font-size: 1.05rem; margin-bottom: var(--space-2); }

.stat-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: var(--space-4); }
.stat-tile { background: var(--surface); border: 1px solid var(--rule); border-radius: var(--radius-md); padding: var(--space-4); }
.stat-tile .label { font-family: var(--font-display); text-transform: uppercase; letter-spacing: 0.06em; font-size: 0.72rem; color: var(--ink-faint); }
.stat-tile .value { font-size: 1.7rem; font-weight: 700; font-variant-numeric: tabular-nums; margin-top: var(--space-1); }

/* ---- buttons ---- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--space-2);
  font-family: var(--font-ui); font-size: 0.92rem; font-weight: 600; letter-spacing: 0.01em;
  padding: 0.6rem 1.1rem; min-height: 40px;
  border-radius: var(--radius-sm); border: 1px solid transparent;
  cursor: pointer; text-decoration: none; line-height: 1;
}
.btn-primary {
  background: var(--accent); color: #fff;
  box-shadow: 0 1px 2px rgba(20, 27, 36, 0.12), 0 8px 20px -8px color-mix(in srgb, var(--accent) 65%, transparent);
}
.btn-primary:hover { filter: brightness(1.06); transform: translateY(-1px); box-shadow: 0 2px 4px rgba(20, 27, 36, 0.14), 0 12px 24px -8px color-mix(in srgb, var(--accent) 70%, transparent); }
.btn-primary:active { transform: translateY(0); }
.btn-secondary { background: var(--surface); color: var(--ink); border-color: var(--rule); }
.btn-secondary:hover { background: var(--surface-alt); }
.btn-ghost { background: transparent; color: var(--ink-soft); }
.btn-ghost:hover { background: var(--surface-alt); color: var(--ink); }
.btn-danger { background: var(--err); color: #fff; }
.btn-danger:hover { filter: brightness(1.08); }
.btn-sm { min-height: 32px; padding: 0.35rem 0.75rem; font-size: 0.85rem; }
.btn:disabled, .btn[aria-disabled="true"] { opacity: 0.5; cursor: not-allowed; filter: none; }
.btn[aria-busy="true"] { position: relative; color: transparent; pointer-events: none; }
.btn[aria-busy="true"]::after {
  content: ""; position: absolute; width: 16px; height: 16px;
  border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%;
  color: #fff; animation: btn-spin 0.6s linear infinite;
}
.btn-secondary[aria-busy="true"]::after, .btn-ghost[aria-busy="true"]::after { color: var(--ink); }
@keyframes btn-spin { to { transform: rotate(360deg); } }

/* ---- forms ---- */
form { max-width: 480px; }
form.form-wide { max-width: none; }
.field { display: flex; flex-direction: column; gap: 0.35rem; margin-bottom: var(--space-4); }
.field[hidden] { display: none; }
.field > label, label.field-label {
  font-family: var(--font-display); font-size: 0.86rem; font-weight: 600; color: var(--ink);
}
.field .required::after { content: " *"; color: var(--err); }
input, select, textarea {
  font-family: var(--font-ui); font-size: 1rem; color: var(--ink);
  background: var(--surface); border: 1px solid var(--rule); border-radius: var(--radius-sm);
  padding: 0.6rem 0.75rem; min-height: 44px; width: 100%;
}
textarea { min-height: 88px; }
input:focus, select:focus, textarea:focus { border-color: var(--accent); }
input[aria-invalid="true"], select[aria-invalid="true"], textarea[aria-invalid="true"] { border-color: var(--err); }
.field-help { font-size: 0.82rem; color: var(--ink-faint); }
.field-error, .validation-summary-errors {
  font-size: 0.85rem; color: var(--err); font-weight: 600;
}
.field-error:empty, .validation-summary-errors:empty { display: none; }
.validation-summary-errors ul { margin: 0; padding-left: 1.1rem; }
label.field { display: flex; flex-direction: column; gap: 0.35rem; font-family: var(--font-display); font-size: 0.86rem; font-weight: 600; color: var(--ink); }
label.field input, label.field select, label.field textarea { font-family: var(--font-ui); font-weight: 400; }
.form-actions { display: flex; gap: var(--space-3); align-items: center; margin-top: var(--space-5); }

/* ---- delivery method picker (public checkout) ---- */
.delivery-options { border: 0; padding: 0; margin: 0 0 var(--space-4); display: flex; flex-direction: column; gap: var(--space-3); }
.delivery-options legend { font-family: var(--font-display); font-size: 0.86rem; font-weight: 600; color: var(--ink); padding: 0 0 var(--space-2); }
.delivery-option {
  display: flex; align-items: flex-start; gap: var(--space-3);
  border: 1px solid var(--rule); border-radius: var(--radius-md);
  padding: var(--space-4); cursor: pointer; transition: border-color 0.15s ease;
}
.delivery-option:has(input:checked) { border-color: var(--accent); }
.delivery-option input[type="radio"] { width: auto; min-height: 0; margin-top: 3px; flex: none; }
.delivery-option-body { display: flex; flex-direction: column; gap: 2px; }
.delivery-option-title { font-family: var(--font-display); font-weight: 600; color: var(--ink); display: flex; align-items: center; gap: var(--space-2); }
.delivery-option-price { font-size: 0.78rem; font-weight: 600; color: var(--ink-faint); }
.delivery-option-sub { font-size: 0.85rem; color: var(--ink-faint); }
.delivery-option-disabled { cursor: not-allowed; opacity: 0.6; }

.muted { color: var(--ink-faint); }
.eyebrow {
  font-family: var(--font-display); text-transform: uppercase; letter-spacing: 0.12em;
  font-size: 0.72rem; color: var(--accent); font-weight: 700; margin: 0 0 var(--space-2);
}

/* ---- auth card (public join / dev login) ---- */
.auth-card {
  max-width: 440px; margin: var(--space-6) auto; background: var(--surface);
  border: 1px solid var(--rule); border-top: 3px solid var(--accent);
  border-radius: var(--radius-md); padding: var(--space-6);
  box-shadow: var(--shadow-lg);
}
.auth-card form { max-width: none; }
main.page .auth-card h1 { font-size: clamp(1.5rem, 3vw, 1.9rem); }

/* ---- tables ---- */
.table-wrap { overflow-x: auto; border: 1px solid var(--rule); border-radius: var(--radius-md); background: var(--surface); }
table { border-collapse: collapse; width: 100%; font-size: 0.9rem; min-width: 560px; }
thead th {
  text-align: left; font-family: var(--font-display); font-size: 0.72rem; text-transform: uppercase;
  letter-spacing: 0.06em; color: var(--ink-faint); padding: 0.7rem var(--space-4);
  border-bottom: 2px solid var(--rule); background: var(--surface-alt); white-space: nowrap;
}
thead th a { color: inherit; text-decoration: none; }
thead th a:hover { color: var(--ink); text-decoration: underline; }
tbody td { padding: 0.65rem var(--space-4); border-bottom: 1px solid var(--rule); vertical-align: middle; }
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: var(--surface-alt); }
td.num, th.num { font-variant-numeric: tabular-nums; text-align: right; }
.table-toolbar { display: flex; align-items: center; justify-content: space-between; gap: var(--space-4); margin-bottom: var(--space-3); flex-wrap: wrap; }

/* ---- status pills ---- */
.pill {
  display: inline-flex; align-items: center; gap: 0.35em;
  font-family: var(--font-mono); font-size: 0.76rem; font-weight: 600;
  padding: 0.18rem 0.6rem; border-radius: 99px; white-space: nowrap;
}
.pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.pill-ok { background: var(--ok-tint); color: var(--ok); }
.pill-info { background: var(--info-tint); color: var(--info); }
.pill-warn { background: var(--warn-tint); color: var(--warn); }
.pill-err { background: var(--err-tint); color: var(--err); }
.pill-neutral { background: var(--surface-alt); color: var(--ink-faint); }

/* ---- alerts / toasts ---- */
.alert { border-radius: var(--radius-sm); border: 1px solid var(--rule); padding: var(--space-3) var(--space-4); margin-bottom: var(--space-4); font-size: 0.92rem; }
.alert-ok { background: var(--ok-tint); color: var(--ok-ink, var(--ok)); border-color: transparent; }
.alert-err { background: var(--err-tint); color: var(--err); border-color: transparent; }
.alert-info { background: var(--info-tint); color: var(--info); border-color: transparent; }

.toast-stack { position: fixed; top: var(--space-4); right: var(--space-4); z-index: 200; display: flex; flex-direction: column; gap: var(--space-2); }
.toast {
  background: var(--ink); color: var(--paper); padding: 0.75rem 1rem; border-radius: var(--radius-sm);
  box-shadow: var(--shadow-md); font-size: 0.88rem; max-width: 320px;
}

/* ---- empty states ---- */
.empty-state { text-align: center; padding: var(--space-7) var(--space-4); color: var(--ink-faint); }
.empty-state h3 { color: var(--ink-soft); }

/* ---- utility ---- */
.stack { display: flex; flex-direction: column; gap: var(--space-4); }
.cluster { display: flex; align-items: center; gap: var(--space-3); flex-wrap: wrap; }
.spread { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); flex-wrap: wrap; }

/* ============================================================
   Public-site brand (Pages/Shared/_Layout.cshtml only — scoped to
   body.site-public so the admin portal's brass/navy is untouched).
   Exact IMEG Business Lounge brand colors, not derived/approximated:
     080025 navy (headings, text-on-gold)   fdb71a gold (CTAs, accents)
     7094aa blue (eyebrows/decorative text)  ed5338 coral (errors)
     5d6367 body text gray                   c5ccd1 borders/off-white
   Gold is reserved for surfaces (buttons, borders, focus rings) — as
   text it fails contrast on white, so eyebrow/brand-mark text uses the
   blue instead. See body.site-public .eyebrow / .brand .mark below.

   Always light: the brand has no dark variant, so every surface/ink
   token is forced here rather than left to inherit the app's OS-driven
   dark theme. color-scheme: light keeps native form controls light too.
   ============================================================ */
body.site-public {
  color-scheme: light;
  --paper: #ffffff;
  --surface: #ffffff;
  --surface-alt: color-mix(in srgb, #c5ccd1 20%, white);
  --accent: #fdb71a;
  --accent-ink: #080025;
  --accent-tint: color-mix(in srgb, #fdb71a 16%, white);
  --ink: #080025;
  --ink-soft: #5d6367;
  --ink-faint: color-mix(in srgb, #5d6367 55%, white);
  --rule: #c5ccd1;
  --focus-ring: #fdb71a;
  --ok: #2e7d55;
  --ok-tint: #e2f0e8;
  --info: #7094aa;
  --info-tint: color-mix(in srgb, #7094aa 16%, white);
  --warn: #966616;
  --warn-tint: #f4e9d3;
  --err: #ed5338;
  --err-tint: color-mix(in srgb, #ed5338 14%, white);
  --shadow-sm: 0 1px 3px rgba(8, 0, 37, 0.08);
  --shadow-md: 0 12px 32px -12px rgba(8, 0, 37, 0.24);
  --shadow-lg: 0 24px 60px -20px rgba(8, 0, 37, 0.28);
  --font-ui: "Open Sans", -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-display-serif: "Fraunces", Georgia, "Iowan Old Style", "Palatino Linotype", serif;
}
body.site-public .btn-primary {
  background: var(--accent);
  color: var(--accent-ink);
  box-shadow: 0 1px 2px rgba(8, 0, 37, 0.12), 0 8px 20px -8px rgba(253, 183, 26, 0.55);
}
body.site-public .btn-primary:hover { filter: brightness(1.03); box-shadow: 0 2px 4px rgba(8, 0, 37, 0.14), 0 12px 24px -8px rgba(253, 183, 26, 0.6); }
body.site-public .skip-link { background: var(--accent); color: var(--accent-ink); }
body.site-public .eyebrow,
body.site-public .brand .mark { color: #7094aa; }

/* ---- feature grid (public homepage) ---- */
.feature-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: var(--space-5); margin-top: var(--space-6);
}
.feature-icon {
  display: inline-flex; align-items: center; justify-content: center;
  width: 44px; height: 44px; border-radius: var(--radius-md);
  background: var(--accent-tint); color: var(--accent-ink);
  margin-bottom: var(--space-3);
}
.feature-icon svg { width: 22px; height: 22px; stroke: currentColor; }
.feature h3 { font-size: 1.05rem; margin-bottom: var(--space-2); }
.feature p { margin: 0; font-size: 0.92rem; }
