/* =====================================================================
   GymMunshi UI · v1.0
   Components built only from tokens (../tokens/tokens.css).
   Load order: tokens.css → gm-ui.css → your page CSS.
   All classes start with gm- so the kit never collides with a project.
   No framework, no build step. Works with server-rendered HTML + htmx.
   ===================================================================== */

/* ---------- 1. Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--gm-bg);
  color: var(--gm-text);
  font: var(--gm-weight-regular) var(--gm-text-base)/var(--gm-leading) var(--gm-font-body);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
img, svg, video { max-width: 100%; }
a { color: var(--gm-accent-text); text-decoration-thickness: 1px; text-underline-offset: 2px; }
a:hover { color: var(--gm-accent-hover); }
:focus-visible { outline: 2px solid var(--gm-focus); outline-offset: 2px; border-radius: var(--gm-radius-sm); }
::selection { background: var(--gm-accent-soft); }
hr { border: 0; border-top: 1px solid var(--gm-line); margin: var(--gm-space-6) 0; }
[hidden] { display: none !important; }

.gm-h1, .gm-h2, .gm-h3, .gm-h4 { margin: 0; font-family: var(--gm-font-display); color: var(--gm-text); text-wrap: balance; }
.gm-h1 { font-size: clamp(36px, 6vw, var(--gm-text-6xl)); font-weight: var(--gm-weight-hero); line-height: 1; letter-spacing: -0.035em; }
.gm-h2 { font-size: clamp(28px, 3.8vw, var(--gm-text-4xl)); font-weight: var(--gm-weight-display); line-height: 1.08; letter-spacing: -0.03em; }
.gm-h3 { font-size: var(--gm-text-xl); font-weight: 700; line-height: 1.25; letter-spacing: -0.015em; }
.gm-h4 { font-size: var(--gm-text-lg); font-weight: 700; line-height: 1.3; }
.gm-lede { font-size: var(--gm-text-lg); color: var(--gm-text-2); max-width: 62ch; margin: 0; }
.gm-text-2 { color: var(--gm-text-2); }
.gm-muted { color: var(--gm-muted); }
.gm-small { font-size: var(--gm-text-sm); }
.gm-eyebrow { font: var(--gm-weight-medium) var(--gm-text-xs)/1 var(--gm-font-mono); letter-spacing: .08em; text-transform: uppercase; color: var(--gm-accent-text); }
.gm-mono, .gm-money { font-family: var(--gm-font-mono); font-variant-numeric: tabular-nums; }
.gm-money { font-weight: var(--gm-weight-medium); white-space: nowrap; }
.gm-kbd { font: var(--gm-weight-medium) var(--gm-text-xs)/1 var(--gm-font-mono); padding: 3px 6px; border-radius: 5px; border: 1px solid var(--gm-line-strong); border-bottom-width: 2px; background: var(--gm-surface); color: var(--gm-text-2); }
.gm-code { font: var(--gm-text-sm)/1.7 var(--gm-font-mono); background: var(--gm-surface-3); padding: 2px 6px; border-radius: 5px; }
.gm-pre { margin: 0; font: var(--gm-text-sm)/1.7 var(--gm-font-mono); background: var(--gm-elevated); color: #e2e8f0; padding: var(--gm-space-4) var(--gm-space-5); border-radius: var(--gm-radius-lg); overflow-x: auto; }

/* ---------- 2. Layout ---------- */
.gm-container { width: 100%; max-width: var(--gm-container); margin-inline: auto; padding-inline: var(--gm-gutter); }
.gm-stack { display: flex; flex-direction: column; gap: var(--gm-gap, var(--gm-space-4)); }
.gm-row { display: flex; flex-wrap: wrap; align-items: center; gap: var(--gm-gap, var(--gm-space-3)); }
.gm-row--between { justify-content: space-between; }
.gm-grid { display: grid; gap: var(--gm-gap, var(--gm-space-4)); grid-template-columns: repeat(auto-fill, minmax(min(var(--gm-min, 240px), 100%), 1fr)); }
/* Fill the row: items stretch to share the width instead of leaving empty columns (marketing pages, short lists) */
.gm-grid--fit { grid-template-columns: repeat(auto-fit, minmax(min(var(--gm-min, 240px), 100%), 1fr)); }
.gm-spacer { flex: 1; }
.gm-divider { height: 1px; background: var(--gm-line); border: 0; margin: 0; }
.gm-section { padding-block: clamp(48px, 7vw, 96px); }
.gm-bg-grid {
  background-image: linear-gradient(var(--gm-grid) 1px, transparent 1px), linear-gradient(90deg, var(--gm-grid) 1px, transparent 1px);
  background-size: 56px 56px;
}

/* ---------- 3. Buttons ---------- */
.gm-btn {
  --_bg: var(--gm-surface); --_fg: var(--gm-text); --_bd: var(--gm-line-strong); --_bg-h: var(--gm-surface-3);
  display: inline-flex; align-items: center; justify-content: center; gap: var(--gm-space-2);
  height: var(--gm-control-h); padding-inline: var(--gm-space-4);
  border: 1px solid var(--_bd); border-radius: var(--gm-radius-md);
  background: var(--_bg); color: var(--_fg);
  font: var(--gm-weight-semibold) var(--gm-text-md)/1 var(--gm-font-body); white-space: nowrap;
  text-decoration: none; cursor: pointer; user-select: none;
  transition: background-color var(--gm-fast) ease, border-color var(--gm-fast) ease, transform var(--gm-fast) ease, box-shadow var(--gm-fast) ease;
}
.gm-btn:hover { background: var(--_bg-h); color: var(--_fg); }
.gm-btn:active { transform: translateY(1px); }
.gm-btn:disabled, .gm-btn[aria-disabled="true"] { opacity: .5; pointer-events: none; }
.gm-btn--primary { --_bg: var(--gm-accent); --_fg: var(--gm-on-accent); --_bd: transparent; --_bg-h: var(--gm-accent-hover); box-shadow: 0 8px 22px -12px var(--gm-accent); }
.gm-btn--dark { --_bg: var(--gm-contrast); --_fg: var(--gm-on-contrast); --_bd: transparent; --_bg-h: var(--gm-contrast-hover); }
.gm-btn--ghost { --_bg: transparent; --_bd: transparent; --_fg: var(--gm-text-2); --_bg-h: var(--gm-surface-3); }
.gm-btn--danger { --_bg: var(--gm-danger-fill); --_fg: #fff; --_bd: transparent; --_bg-h: var(--gm-danger); }
.gm-btn--success { --_bg: var(--gm-success-fill); --_fg: #fff; --_bd: transparent; --_bg-h: var(--gm-success); }
.gm-btn--sm { height: var(--gm-control-h-sm); padding-inline: var(--gm-space-3); font-size: var(--gm-text-sm); border-radius: var(--gm-radius-sm); }
.gm-btn--lg { height: var(--gm-control-h-lg); padding-inline: var(--gm-space-6); font-size: var(--gm-text-base); }
.gm-btn--block { width: 100%; }
.gm-btn--icon { width: var(--gm-control-h); padding: 0; }
.gm-btn[aria-busy="true"] { position: relative; color: transparent !important; pointer-events: none; }
.gm-btn[aria-busy="true"]::after {
  content: ""; position: absolute; width: 16px; height: 16px; border-radius: 50%;
  border: 2px solid var(--_fg); border-right-color: transparent; animation: gm-spin .7s linear infinite;
}
@keyframes gm-spin { to { transform: rotate(360deg); } }

/* ---------- 4. Forms ---------- */
.gm-field { display: grid; gap: 6px; align-content: start; }
.gm-label { font-size: var(--gm-text-sm); font-weight: var(--gm-weight-semibold); color: var(--gm-text); }
.gm-label .gm-req { color: var(--gm-accent-text); }
.gm-hint { font-size: var(--gm-text-sm); color: var(--gm-muted); }
.gm-error { font-size: var(--gm-text-sm); color: var(--gm-danger); }
.gm-input, .gm-select, .gm-textarea {
  width: 100%; height: var(--gm-control-h); padding: 0 var(--gm-space-3);
  background: var(--gm-surface); color: var(--gm-text);
  border: 1px solid var(--gm-line-strong); border-radius: var(--gm-radius-md);
  font: var(--gm-text-base) var(--gm-font-body);
  transition: border-color var(--gm-fast) ease, box-shadow var(--gm-fast) ease;
}
.gm-textarea { height: auto; min-height: 96px; padding: var(--gm-space-3); resize: vertical; line-height: var(--gm-leading); }
.gm-select { appearance: none; padding-right: 36px;
  background-image: linear-gradient(45deg, transparent 50%, var(--gm-muted) 50%), linear-gradient(135deg, var(--gm-muted) 50%, transparent 50%);
  background-position: calc(100% - 18px) 50%, calc(100% - 13px) 50%; background-size: 5px 5px; background-repeat: no-repeat; }
.gm-input::placeholder, .gm-textarea::placeholder { color: var(--gm-placeholder); }
.gm-input:hover, .gm-select:hover, .gm-textarea:hover { border-color: var(--gm-muted); }
.gm-input:focus, .gm-select:focus, .gm-textarea:focus { outline: none; border-color: var(--gm-accent); box-shadow: 0 0 0 3px var(--gm-accent-soft); }
.gm-input[aria-invalid="true"], .gm-select[aria-invalid="true"], .gm-textarea[aria-invalid="true"] { border-color: var(--gm-danger-fill); box-shadow: 0 0 0 3px var(--gm-danger-soft); }
.gm-input:disabled, .gm-select:disabled, .gm-textarea:disabled { background: var(--gm-surface-2); color: var(--gm-muted); cursor: not-allowed; }
.gm-input-group { display: flex; align-items: stretch; }
.gm-input-group > .gm-addon {
  display: inline-flex; align-items: center; padding-inline: var(--gm-space-3);
  border: 1px solid var(--gm-line-strong); background: var(--gm-surface-2); color: var(--gm-muted);
  font: var(--gm-weight-medium) var(--gm-text-md) var(--gm-font-mono);
}
.gm-input-group > .gm-addon:first-child { border-right: 0; border-radius: var(--gm-radius-md) 0 0 var(--gm-radius-md); }
.gm-input-group > .gm-addon:last-child { border-left: 0; border-radius: 0 var(--gm-radius-md) var(--gm-radius-md) 0; }
.gm-input-group > .gm-input:not(:first-child) { border-top-left-radius: 0; border-bottom-left-radius: 0; }
.gm-input-group > .gm-input:not(:last-child) { border-top-right-radius: 0; border-bottom-right-radius: 0; }

.gm-check, .gm-radio { display: inline-flex; align-items: center; gap: var(--gm-space-2); font-size: var(--gm-text-md); cursor: pointer; }
.gm-check input, .gm-radio input { width: 18px; height: 18px; margin: 0; accent-color: var(--gm-accent); cursor: pointer; }
.gm-switch { display: inline-flex; align-items: center; gap: var(--gm-space-3); cursor: pointer; font-size: var(--gm-text-md); }
.gm-switch input { appearance: none; width: 40px; height: 24px; margin: 0; border-radius: var(--gm-radius-full); background: var(--gm-surface-3); border: 1px solid var(--gm-line-strong); position: relative; cursor: pointer; transition: background-color var(--gm-base) var(--gm-ease); }
.gm-switch input::after { content: ""; position: absolute; top: 2px; left: 2px; width: 18px; height: 18px; border-radius: 50%; background: #fff; box-shadow: var(--gm-shadow-sm); transition: transform var(--gm-base) var(--gm-ease); }
.gm-switch input:checked { background: var(--gm-accent); border-color: transparent; }
.gm-switch input:checked::after { transform: translateX(16px); }
.gm-range { width: 100%; height: 32px; margin: 0; accent-color: var(--gm-accent); cursor: pointer; }
/* Form layout: one column on phones, two from 560 px. Add .gm-span-2 to a field to take the full row. */
.gm-form-grid { display: grid; gap: var(--gm-space-4); grid-template-columns: minmax(0, 1fr); }
@media (min-width: 560px) { .gm-form-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } .gm-form-grid > .gm-span-2 { grid-column: 1 / -1; } }
/* Honeypot for spam bots: keep it in the DOM but out of sight */
.gm-hp { position: absolute !important; left: -9999px; width: 1px; height: 1px; overflow: hidden; }

/* ---------- 5. Cards & tiles ---------- */
.gm-card { background: var(--gm-surface); border: 1px solid var(--gm-line); border-radius: var(--gm-radius-lg); box-shadow: var(--gm-shadow-sm); }
.gm-card__header { display: flex; align-items: center; justify-content: space-between; gap: var(--gm-space-3); padding: var(--gm-space-4) var(--gm-space-5); border-bottom: 1px solid var(--gm-line); }
.gm-card__title { margin: 0; font: 700 var(--gm-text-lg)/1.3 var(--gm-font-display); letter-spacing: -0.01em; }
.gm-card__body { padding: var(--gm-space-5); }
.gm-card__footer { display: flex; gap: var(--gm-space-2); justify-content: flex-end; padding: var(--gm-space-3) var(--gm-space-5); border-top: 1px solid var(--gm-line); background: var(--gm-surface-2); border-radius: 0 0 var(--gm-radius-lg) var(--gm-radius-lg); }
.gm-card--flat { box-shadow: none; }
.gm-card--raised { box-shadow: var(--gm-shadow-md); }
.gm-card--accent { border-color: var(--gm-accent-line); background: linear-gradient(180deg, var(--gm-accent-soft), transparent 55%), var(--gm-surface); }

.gm-stat { display: grid; gap: 6px; padding: var(--gm-space-5); background: var(--gm-surface); border: 1px solid var(--gm-line); border-radius: var(--gm-radius-lg); }
.gm-stat__label { font-size: var(--gm-text-sm); color: var(--gm-muted); }
.gm-stat__value { font: 800 var(--gm-text-3xl)/1.05 var(--gm-font-display); letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.gm-stat__meta { font: var(--gm-text-xs)/1.4 var(--gm-font-mono); color: var(--gm-muted); }
.gm-stat--alert { border-color: var(--gm-accent-line); background: linear-gradient(180deg, var(--gm-accent-soft), transparent 80%), var(--gm-surface); }
.gm-stat--alert .gm-stat__value { color: var(--gm-accent-text); }
.gm-trend-up { color: var(--gm-success); } .gm-trend-down { color: var(--gm-danger); }

/* ---------- 6. Badges & status ---------- */
.gm-badge {
  --_c: var(--gm-text-2); --_bg: var(--gm-surface-3);
  display: inline-flex; align-items: center; gap: 6px; height: 22px; padding-inline: 8px;
  border-radius: var(--gm-radius-sm); background: var(--_bg); color: var(--_c);
  font: 600 11px/1 var(--gm-font-mono); letter-spacing: .04em; text-transform: uppercase; white-space: nowrap;
}
.gm-badge--success { --_c: var(--gm-success); --_bg: var(--gm-success-soft); }
.gm-badge--warning { --_c: var(--gm-warning); --_bg: var(--gm-warning-soft); }
.gm-badge--danger  { --_c: var(--gm-danger);  --_bg: var(--gm-danger-soft); }
.gm-badge--info    { --_c: var(--gm-info);    --_bg: var(--gm-info-soft); }
.gm-badge--accent  { --_c: var(--gm-accent-text); --_bg: var(--gm-accent-soft); }
.gm-badge--solid   { --_c: var(--gm-on-accent); --_bg: var(--gm-accent); }
.gm-pill { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 6px; min-height: 28px; padding: 3px 12px; border-radius: var(--gm-radius-full); border: 1px solid var(--gm-line-strong); background: var(--gm-surface); font-size: var(--gm-text-sm); color: var(--gm-text-2); }

/* Membership status: always pair colour with a word, never colour alone */
.gm-status { display: inline-flex; align-items: center; gap: 7px; font-size: var(--gm-text-sm); font-weight: var(--gm-weight-semibold); color: var(--gm-text); }
.gm-status::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--_dot, var(--gm-muted)); box-shadow: 0 0 0 3px color-mix(in srgb, var(--_dot, var(--gm-muted)) 20%, transparent); }
.gm-status--active   { --_dot: var(--gm-state-active); }
.gm-status--expiring { --_dot: var(--gm-state-expiring); }
.gm-status--expired  { --_dot: var(--gm-state-expired); }
.gm-status--frozen   { --_dot: var(--gm-state-frozen); }
.gm-status--live::before { animation: gm-pulse 1.8s ease-in-out infinite; }
@keyframes gm-pulse { 50% { box-shadow: 0 0 0 6px transparent; } }

/* ---------- 7. Alerts & banners ---------- */
/* A tinted card with a round icon (v1.1): ✓ success, ! warning, × danger, i info. Same HTML as before. */
.gm-alert {
  --_c: var(--gm-info-fill); --_icon: "i";
  display: grid; grid-template-columns: 22px minmax(0, 1fr); column-gap: var(--gm-space-3); row-gap: 4px; align-items: start;
  padding: 14px var(--gm-space-4); border-radius: var(--gm-radius-lg);
  background: color-mix(in srgb, var(--_c) 7%, var(--gm-surface));
  border: 1px solid color-mix(in srgb, var(--_c) 26%, var(--gm-line));
  box-shadow: var(--gm-shadow-sm); color: var(--gm-text); font-size: var(--gm-text-md); line-height: 1.5;
}
.gm-alert::before {
  content: var(--_icon); grid-column: 1; grid-row: 1; width: 22px; height: 22px; margin-top: 1px; border-radius: 50%;
  display: grid; place-items: center; background: var(--_c); color: #fff; font: 700 12px/1 var(--gm-font-body);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--_c) 16%, transparent);
}
.gm-alert > * { grid-column: 2; min-width: 0; }
.gm-alert__title { font-weight: var(--gm-weight-semibold); color: var(--gm-text); margin: 0 0 2px; }
.gm-alert p { margin: 0; }
.gm-alert--success { --_c: var(--gm-success-fill, var(--gm-success)); --_icon: "\2713"; }
.gm-alert--warning { --_c: var(--gm-warning-fill, var(--gm-warning)); --_icon: "!"; }
.gm-alert--danger  { --_c: var(--gm-danger-fill, var(--gm-danger));  --_icon: "\00D7"; }
.gm-banner { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: var(--gm-space-3); padding: 10px var(--gm-gutter); background: var(--gm-elevated); color: #fff; font-size: var(--gm-text-md); text-align: center; }
.gm-banner--accent { background: var(--gm-accent); }
.gm-banner a { color: inherit; font-weight: var(--gm-weight-semibold); }

/* Check-in result banner: GREEN / AMBER / RED */
.gm-checkin { border-radius: var(--gm-radius-lg); overflow: hidden; border: 1px solid var(--gm-line); background: var(--gm-surface); }
.gm-checkin__head { display: flex; align-items: center; gap: var(--gm-space-3); padding: var(--gm-space-3) var(--gm-space-4); color: #fff; background: var(--_c, var(--gm-state-active)); }
.gm-checkin__head b { font: 800 var(--gm-text-md)/1 var(--gm-font-display); letter-spacing: .04em; text-transform: uppercase; }
.gm-checkin__head span { margin-left: auto; font: var(--gm-text-sm) var(--gm-font-mono); opacity: .92; }
.gm-checkin__body { display: flex; flex-wrap: wrap; gap: var(--gm-space-2); padding: var(--gm-space-3) var(--gm-space-4); }
.gm-checkin--green { --_c: var(--gm-state-active); }
.gm-checkin--amber { --_c: var(--gm-state-expiring); }
.gm-checkin--red   { --_c: var(--gm-state-expired); }

/* ---------- 8. Tables ---------- */
.gm-table-wrap { overflow-x: auto; border: 1px solid var(--gm-line); border-radius: var(--gm-radius-lg); background: var(--gm-surface); }
.gm-table { width: 100%; border-collapse: collapse; font-size: var(--gm-text-md); }
/* Tables never squeeze: cells stay on one line and the wrapper scrolls sideways on small screens.
   Add .gm-table--wrap to let long text wrap instead. */
.gm-table th, .gm-table td { white-space: nowrap; }
.gm-table--wrap th, .gm-table--wrap td { white-space: normal; }
.gm-table-wrap { -webkit-overflow-scrolling: touch; overscroll-behavior-x: contain; }
.gm-table th { text-align: left; padding: 10px var(--gm-space-4); font: 600 var(--gm-text-xs)/1.2 var(--gm-font-mono); letter-spacing: .05em; text-transform: uppercase; color: var(--gm-muted); background: var(--gm-surface-2); border-bottom: 1px solid var(--gm-line); white-space: nowrap; }
.gm-table td { padding: 12px var(--gm-space-4); border-bottom: 1px solid var(--gm-line); vertical-align: middle; }
.gm-table tbody tr:last-child td { border-bottom: 0; }
.gm-table tbody tr:hover td { background: var(--gm-surface-2); }
.gm-table .gm-num { text-align: right; font-family: var(--gm-font-mono); font-variant-numeric: tabular-nums; }
.gm-cell-person { display: flex; align-items: center; gap: var(--gm-space-3); min-width: 0; }
.gm-cell-person b { display: block; font-weight: var(--gm-weight-semibold); }
.gm-cell-person small { display: block; color: var(--gm-muted); font-size: var(--gm-text-sm); }

/* ---------- 9. Avatar ---------- */
.gm-avatar { width: 36px; height: 36px; flex: none; border-radius: 50%; display: inline-grid; place-items: center; overflow: hidden; background: var(--gm-surface-3); color: var(--gm-text-2); font: 600 var(--gm-text-sm)/1 var(--gm-font-body); }
.gm-avatar img { width: 100%; height: 100%; object-fit: cover; }
.gm-avatar--sm { width: 28px; height: 28px; font-size: 11px; }
.gm-avatar--lg { width: 56px; height: 56px; font-size: var(--gm-text-lg); }

/* ---------- 10. Tabs & segmented ---------- */
.gm-tabs { display: flex; gap: var(--gm-space-1); border-bottom: 1px solid var(--gm-line); overflow-x: auto; }
.gm-tab { appearance: none; background: none; border: 0; border-bottom: 2px solid transparent; margin-bottom: -1px; padding: 10px var(--gm-space-3); font: var(--gm-weight-semibold) var(--gm-text-md) var(--gm-font-body); color: var(--gm-muted); cursor: pointer; white-space: nowrap; }
.gm-tab:hover { color: var(--gm-text); }
.gm-tab[aria-selected="true"] { color: var(--gm-text); border-bottom-color: var(--gm-accent); }
.gm-segmented { display: inline-flex; align-self: flex-start; justify-self: start; padding: 3px; gap: 2px; border-radius: var(--gm-radius-md); background: var(--gm-surface-3); }
.gm-segmented button { appearance: none; border: 0; background: transparent; height: 30px; padding-inline: var(--gm-space-3); border-radius: 7px; font: var(--gm-weight-semibold) var(--gm-text-sm) var(--gm-font-body); color: var(--gm-muted); cursor: pointer; }
.gm-segmented button[aria-pressed="true"] { background: var(--gm-surface); color: var(--gm-text); box-shadow: var(--gm-shadow-sm); }

/* ---------- 11. Breadcrumb & pagination ---------- */
.gm-breadcrumb { display: flex; flex-wrap: wrap; gap: 6px; list-style: none; margin: 0; padding: 0; font-size: var(--gm-text-sm); color: var(--gm-muted); }
.gm-breadcrumb li + li::before { content: "/"; margin-right: 6px; opacity: .6; }
.gm-breadcrumb a { color: var(--gm-text-2); text-decoration: none; }
.gm-pagination { display: flex; gap: var(--gm-space-1); align-items: center; }
.gm-pagination a, .gm-pagination span { min-width: 34px; height: 34px; display: inline-grid; place-items: center; padding-inline: 8px; border-radius: var(--gm-radius-sm); font: var(--gm-weight-medium) var(--gm-text-sm) var(--gm-font-mono); color: var(--gm-text-2); text-decoration: none; }
.gm-pagination a:hover { background: var(--gm-surface-3); }
.gm-pagination [aria-current="page"] { background: var(--gm-contrast); color: var(--gm-on-contrast); }

/* ---------- 12. Progress, skeleton, empty state ---------- */
.gm-progress { height: 8px; border-radius: var(--gm-radius-full); background: var(--gm-surface-3); overflow: hidden; }
.gm-progress > i { display: block; height: 100%; width: var(--gm-value, 0%); background: var(--gm-accent); border-radius: inherit; transition: width var(--gm-slow) var(--gm-ease); }
.gm-skeleton { border-radius: var(--gm-radius-sm); background: linear-gradient(90deg, var(--gm-surface-3) 25%, var(--gm-surface-2) 50%, var(--gm-surface-3) 75%); background-size: 200% 100%; animation: gm-shimmer 1.4s linear infinite; min-height: 12px; }
@keyframes gm-shimmer { to { background-position: -200% 0; } }
.gm-empty { display: grid; justify-items: center; gap: var(--gm-space-3); text-align: center; padding: var(--gm-space-12) var(--gm-space-6); border: 1px dashed var(--gm-line-strong); border-radius: var(--gm-radius-lg); color: var(--gm-text-2); }
.gm-empty__icon { width: 48px; height: 48px; border-radius: var(--gm-radius-lg); display: grid; place-items: center; background: var(--gm-accent-soft); color: var(--gm-accent-text); }
.gm-empty h3 { margin: 0; font: 700 var(--gm-text-lg) var(--gm-font-display); color: var(--gm-text); }

/* ---------- 13. Dialog (native <dialog>) ---------- */
.gm-dialog { width: min(520px, calc(100vw - 32px)); padding: 0; border: 1px solid var(--gm-line); border-radius: var(--gm-radius-xl); background: var(--gm-surface); color: var(--gm-text); box-shadow: var(--gm-shadow-lg); }
.gm-dialog::backdrop { background: var(--gm-overlay); backdrop-filter: blur(2px); }
.gm-dialog__header { display: flex; align-items: center; justify-content: space-between; gap: var(--gm-space-3); padding: var(--gm-space-5) var(--gm-space-6) 0; }
.gm-dialog__title { margin: 0; font: 800 var(--gm-text-xl)/1.2 var(--gm-font-display); letter-spacing: -0.02em; }
.gm-dialog__body { padding: var(--gm-space-4) var(--gm-space-6); color: var(--gm-text-2); }
.gm-dialog__footer { display: flex; justify-content: flex-end; gap: var(--gm-space-2); padding: var(--gm-space-4) var(--gm-space-6) var(--gm-space-5); }
.gm-dialog[open] { animation: gm-pop var(--gm-base) var(--gm-ease); }
@keyframes gm-pop { from { opacity: 0; transform: translateY(8px) scale(.98); } }

/* ---------- 14. Toast ---------- */
.gm-toasts { position: fixed; z-index: var(--gm-z-toast); right: var(--gm-space-4); bottom: calc(var(--gm-space-4) + env(safe-area-inset-bottom, 0px)); display: grid; gap: var(--gm-space-2); width: min(360px, calc(100vw - 32px)); }
.gm-toast { display: flex; gap: var(--gm-space-3); align-items: center; padding: 12px var(--gm-space-4); border-radius: var(--gm-radius-lg); background: var(--gm-elevated); color: #fff; box-shadow: var(--gm-shadow-lg); font-size: var(--gm-text-md); animation: gm-pop var(--gm-base) var(--gm-ease); }
.gm-toast::before { content: ""; flex: none; width: 10px; height: 10px; border-radius: 50%; background: var(--_c, var(--gm-accent)); box-shadow: 0 0 0 4px color-mix(in srgb, var(--_c, var(--gm-accent)) 25%, transparent); }
.gm-toast--success { --_c: #10b981; } .gm-toast--warning { --_c: #f59e0b; } .gm-toast--danger { --_c: #ef4444; }

/* ---------- 15. Tooltip (CSS only: data-tip) ---------- */
[data-gm-tip] { position: relative; }
[data-gm-tip]:hover::after, [data-gm-tip]:focus-visible::after {
  content: attr(data-gm-tip); position: absolute; left: 50%; bottom: calc(100% + 8px); transform: translateX(-50%);
  padding: 6px 9px; border-radius: var(--gm-radius-sm); background: var(--gm-elevated); color: #fff; font: var(--gm-weight-medium) var(--gm-text-xs)/1.3 var(--gm-font-body);
  width: max-content; max-width: min(260px, 80vw); white-space: normal; text-align: center; letter-spacing: 0; text-transform: none; pointer-events: none; z-index: var(--gm-z-dropdown);
}

/* ---------- 16. Top bar (marketing & app) ---------- */
.gm-topbar { position: sticky; top: env(safe-area-inset-top, 0px); z-index: var(--gm-z-sticky); background: color-mix(in srgb, var(--gm-surface) 86%, transparent); backdrop-filter: saturate(160%) blur(16px); -webkit-backdrop-filter: saturate(160%) blur(16px); border-bottom: 1px solid var(--gm-line); }
.gm-topbar__row { display: flex; align-items: center; gap: var(--gm-space-5); height: var(--gm-topbar-h); }
.gm-topbar__logo { display: inline-flex; align-items: center; height: 30px; }
.gm-topbar__logo img { height: 100%; width: auto; display: block; }
.gm-topbar__links { display: flex; gap: var(--gm-space-5); }
.gm-topbar__links a { color: var(--gm-text-2); font-size: var(--gm-text-md); font-weight: var(--gm-weight-medium); text-decoration: none; }
.gm-topbar__links a:hover, .gm-topbar__links a[aria-current="page"] { color: var(--gm-text); }
@media (max-width: 820px) { .gm-topbar__links { display: none; } }
/* Mobile menu: <button class="gm-topbar__toggle" data-gm-menu> + <div class="gm-topbar__drawer"><nav>…links…</nav></div> inside .gm-topbar */
.gm-topbar__toggle { display: none; flex: none; }
.gm-topbar__drawer { display: none; border-top: 1px solid var(--gm-line); background: var(--gm-surface); max-height: calc(100dvh - var(--gm-topbar-h)); overflow-y: auto; }
.gm-topbar__drawer nav { display: grid; padding: var(--gm-space-2) var(--gm-gutter) var(--gm-space-4); }
.gm-topbar__drawer a { display: flex; align-items: center; min-height: 48px; font-size: var(--gm-text-lg); font-weight: var(--gm-weight-semibold); color: var(--gm-text); text-decoration: none; border-bottom: 1px solid var(--gm-line); }
.gm-topbar__drawer a:last-child { border-bottom: 0; }
@media (max-width: 820px) {
  .gm-topbar__toggle { display: inline-flex; }
  .gm-topbar[data-open="true"] .gm-topbar__drawer { display: block; }
  .gm-topbar__row { gap: var(--gm-space-3); }
}

/* ---------- 17. App shell: sidebar + main ---------- */
.gm-app { display: grid; grid-template-columns: var(--gm-sidebar-w) minmax(0, 1fr); min-height: 100vh; min-height: 100dvh; }
.gm-sidebar { position: sticky; top: 0; height: 100vh; height: 100dvh; overflow-y: auto; display: flex; flex-direction: column; gap: var(--gm-space-4); padding: var(--gm-space-4) var(--gm-space-3); background: var(--gm-surface); border-right: 1px solid var(--gm-line); }
.gm-sidebar__logo { display: flex; align-items: center; height: 40px; padding-inline: var(--gm-space-2); }
.gm-sidebar__logo img { height: 28px; width: auto; }
.gm-sidebar__section { font: 600 11px/1 var(--gm-font-mono); letter-spacing: .07em; text-transform: uppercase; color: var(--gm-muted); padding: var(--gm-space-3) var(--gm-space-3) var(--gm-space-1); }
.gm-menu { display: grid; gap: 2px; list-style: none; margin: 0; padding: 0; }
.gm-menu a { display: flex; align-items: center; gap: var(--gm-space-3); height: 38px; padding-inline: var(--gm-space-3); border-radius: var(--gm-radius-md); color: var(--gm-text-2); text-decoration: none; font-size: var(--gm-text-md); font-weight: var(--gm-weight-medium); }
.gm-menu a:hover { background: var(--gm-surface-3); color: var(--gm-text); }
.gm-menu a[aria-current="page"] { background: var(--gm-accent-soft); color: var(--gm-accent-text); font-weight: var(--gm-weight-semibold); }
.gm-menu svg { width: 18px; height: 18px; flex: none; }
.gm-menu .gm-count { margin-left: auto; font: 600 11px/1 var(--gm-font-mono); padding: 4px 6px; border-radius: 6px; background: var(--gm-accent); color: #fff; }
.gm-main { min-width: 0; display: flex; flex-direction: column; }
.gm-main__bar { position: sticky; top: 0; z-index: var(--gm-z-sticky); display: flex; align-items: center; gap: var(--gm-space-3); height: var(--gm-topbar-h); padding-inline: var(--gm-space-6); background: color-mix(in srgb, var(--gm-bg) 88%, transparent); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); border-bottom: 1px solid var(--gm-line); }
.gm-main__content { padding: var(--gm-space-6); display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--gm-space-6); align-content: start; }
.gm-page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: var(--gm-space-4); }
.gm-page-head h1 { margin: 0; font: 800 var(--gm-text-2xl)/1.15 var(--gm-font-display); letter-spacing: -0.02em; }
.gm-menu-toggle { display: none; }
@media (max-width: 960px) {
  .gm-app { grid-template-columns: minmax(0, 1fr); }
  .gm-sidebar { position: fixed; inset: 0 auto 0 0; width: min(var(--gm-sidebar-w), 86vw); z-index: var(--gm-z-overlay); transform: translateX(-100%); transition: transform var(--gm-base) var(--gm-ease); box-shadow: var(--gm-shadow-lg); }
  .gm-app[data-nav="open"] .gm-sidebar { transform: none; }
  .gm-menu-toggle { display: inline-flex; }
  .gm-main__bar, .gm-main__content { padding-inline: var(--gm-space-4); }
}

/* ---------- 18. Theme-aware logo & theme toggle ---------- */
/* <img class="gm-logo-light" src=".../logo-horizontal-color.svg"> + <img class="gm-logo-dark" src=".../logo-horizontal-reverse.svg"> */
.gm-logo-dark { display: none !important; }
:root[data-theme="dark"] .gm-logo-light { display: none !important; }
:root[data-theme="dark"] .gm-logo-dark { display: block !important; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) .gm-logo-light { display: none !important; }
  :root:not([data-theme]) .gm-logo-dark { display: block !important; }
}
.gm-theme-toggle .gm-icon-sun { display: none; }
:root[data-theme="dark"] .gm-theme-toggle .gm-icon-sun { display: block; }
:root[data-theme="dark"] .gm-theme-toggle .gm-icon-moon { display: none; }

/* ---------- 19. Choice cards & segmented radios (settings, plan pickers) ---------- */
/* <label class="gm-choice"><input type="radio" name="x" value="a"> …content… </label> */
.gm-choice { position: relative; display: grid; gap: var(--gm-space-2); padding: var(--gm-space-3); background: var(--gm-surface); border: 1px solid var(--gm-line-strong); border-radius: var(--gm-radius-lg); cursor: pointer; transition: border-color var(--gm-fast) ease, box-shadow var(--gm-fast) ease; }
.gm-choice:hover { border-color: var(--gm-muted); }
.gm-choice > input { position: absolute; opacity: 0; width: 1px; height: 1px; margin: 0; }
.gm-choice:has(> input:checked) { border-color: var(--gm-accent); box-shadow: 0 0 0 3px var(--gm-accent-soft); }
.gm-choice:has(> input:focus-visible) { outline: 2px solid var(--gm-focus); outline-offset: 2px; }
.gm-choice__title { display: flex; align-items: center; justify-content: space-between; gap: var(--gm-space-2); font-weight: var(--gm-weight-semibold); font-size: var(--gm-text-md); }
.gm-choice__title::after { content: ""; width: 16px; height: 16px; border-radius: 50%; border: 1.5px solid var(--gm-line-strong); flex: none; }
.gm-choice:has(> input:checked) .gm-choice__title::after { border: 5px solid var(--gm-accent); }
.gm-choice__desc { font-size: var(--gm-text-sm); color: var(--gm-muted); }
.gm-choices { display: grid; gap: var(--gm-space-3); grid-template-columns: repeat(auto-fill, minmax(var(--gm-min, 150px), 1fr)); }

/* Segmented radios: <div class="gm-segmented" role="radiogroup"><label><input type="radio" name="gm-theme" value="light">Light</label>… */
.gm-segmented label { position: relative; display: inline-flex; align-items: center; gap: 6px; height: 30px; padding-inline: var(--gm-space-3); border-radius: 7px; font: var(--gm-weight-semibold) var(--gm-text-sm) var(--gm-font-body); color: var(--gm-muted); cursor: pointer; }
.gm-segmented label > input { position: absolute; opacity: 0; width: 1px; height: 1px; margin: 0; }
.gm-segmented label:has(> input:checked) { background: var(--gm-surface); color: var(--gm-text); box-shadow: var(--gm-shadow-sm); }
.gm-segmented label:has(> input:focus-visible) { outline: 2px solid var(--gm-focus); outline-offset: 1px; }

/* Theme preview tile: <span class="gm-style-preview" data-style="onyx"><i></i><i></i><i></i></span> */
.gm-style-preview { --_bg: var(--gm-style-ink-bg); --_line: rgba(255, 255, 255, .72); --_line-2: rgba(255, 255, 255, .32);
  display: grid; align-content: center; gap: 6px; height: 72px; padding: 12px 14px; border-radius: var(--gm-radius-md); background: var(--_bg); border: 1px solid rgba(127, 127, 127, .2); }
.gm-style-preview i { display: block; height: 7px; border-radius: 4px; background: var(--_line-2); }
.gm-style-preview i:first-child { width: 55%; background: var(--_line); }
.gm-style-preview i:nth-child(2) { width: 80%; }
.gm-style-preview i:last-child { width: 32%; height: 12px; background: var(--gm-rose); }
.gm-style-preview[data-style="light"]    { --_bg: var(--gm-style-light-bg);    --_line: rgba(15, 23, 42, .75); --_line-2: rgba(15, 23, 42, .22); }
.gm-style-preview[data-style="ink"]      { --_bg: var(--gm-style-ink-bg); }
.gm-style-preview[data-style="onyx"]     { --_bg: var(--gm-style-onyx-bg); }
.gm-style-preview[data-style="amoled"]   { --_bg: var(--gm-style-amoled-bg); }
.gm-style-preview[data-style="graphite"] { --_bg: var(--gm-style-graphite-bg); }
.gm-style-preview[data-style="system"]   { background: linear-gradient(135deg, var(--gm-style-light-bg) 0 50%, var(--gm-style-ink-bg) 50% 100%); --_line: rgba(127, 127, 127, .8); --_line-2: rgba(127, 127, 127, .4); }

/* ---------- 20. Mobile-first helpers & content blocks ---------- */
/* Horizontal scroll row (chips, steps, small cards) instead of squeezing: <div class="gm-scroll-x">…</div> */
.gm-scroll-x { display: flex; gap: var(--gm-gap, var(--gm-space-2)); overflow-x: auto; scroll-snap-type: x proximity; -webkit-overflow-scrolling: touch; overscroll-behavior-x: contain; padding-bottom: 4px; scrollbar-width: thin; }
.gm-scroll-x > * { flex: 0 0 auto; scroll-snap-align: start; }

/* Action row: buttons stack full-width on phones */
.gm-actions { display: flex; flex-wrap: wrap; gap: var(--gm-space-3); align-items: center; }
@media (max-width: 560px) { .gm-actions > .gm-btn { flex: 1 1 100%; } }

/* Section heading block */
.gm-section-head { display: grid; gap: var(--gm-space-3); max-width: 760px; margin-bottom: clamp(24px, 5vw, 48px); }
.gm-section-head > p { margin: 0; color: var(--gm-text-2); font-size: var(--gm-text-lg); }
.gm-section-head--center { margin-inline: auto; text-align: center; justify-items: center; }

/* Offer flag: bright yellow "FREE" sticker that pulls the eye. Use sparingly (offers only).
   Inline: <span class="gm-flag">Free</span>
   On a button corner: <a class="gm-btn gm-has-flag">…<span class="gm-flag gm-flag--corner">Free</span></a>
   Gentle wiggle every few seconds: add gm-flag--pop (stops for reduced motion). */
.gm-flag { display: inline-flex; align-items: center; gap: 4px; padding: 3px 8px; border-radius: 6px; background: var(--gm-highlight); color: var(--gm-on-highlight);
  font: 800 11px/1.2 var(--gm-font-mono); letter-spacing: .06em; text-transform: uppercase; white-space: nowrap; vertical-align: middle;
  transform: rotate(-3deg); box-shadow: 0 2px 0 rgba(15, 23, 42, .18), 0 6px 16px -6px var(--gm-highlight); }
.gm-flag--lg { padding: 5px 11px; font-size: 13px; border-radius: 8px; }
.gm-has-flag { position: relative; }
.gm-flag--corner { position: absolute; top: -14px; right: -8px; z-index: 1; pointer-events: none; }
.gm-flag--pop { animation: gm-flag-pop 4s var(--gm-ease) infinite; }
@keyframes gm-flag-pop { 0%, 82%, 100% { transform: rotate(-3deg) scale(1); } 86% { transform: rotate(4deg) scale(1.12); } 90% { transform: rotate(-6deg) scale(1.12); } 94% { transform: rotate(-3deg) scale(1); } }
/* Yellow announcement strip above the top bar */
.gm-banner--highlight { background: var(--gm-highlight); color: var(--gm-on-highlight); text-decoration: none; font-weight: var(--gm-weight-semibold); }
.gm-banner--highlight:hover { color: var(--gm-on-highlight); }
.gm-banner--highlight .gm-flag { background: var(--gm-on-highlight); color: var(--gm-highlight); box-shadow: none; }

/* Small animated sparkle for "new" / "launching soon" labels: <span class="gm-spark" aria-hidden="true">✦</span> */
.gm-spark { display: inline-block; color: var(--gm-accent); line-height: 1; animation: gm-spark 2.4s var(--gm-ease) infinite; }
@keyframes gm-spark { 0%, 100% { transform: rotate(0) scale(1); opacity: 1; } 50% { transform: rotate(90deg) scale(.72); opacity: .6; } }

/* Icon tile */
.gm-icon-tile { width: 44px; height: 44px; flex: none; border-radius: 12px; display: grid; place-items: center; background: var(--gm-accent-soft); color: var(--gm-accent-text); }
.gm-icon-tile svg { width: 22px; height: 22px; }
.gm-icon-tile--success { background: var(--gm-success-soft); color: var(--gm-success); }
.gm-icon-tile--warning { background: var(--gm-warning-soft); color: var(--gm-warning); }
.gm-icon-tile--info { background: var(--gm-info-soft); color: var(--gm-info); }

/* Check list */
.gm-checklist { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--gm-space-3); }
.gm-checklist--inline { display: flex; flex-wrap: wrap; gap: var(--gm-space-2) var(--gm-space-5); }
.gm-checklist li { display: grid; grid-template-columns: 18px minmax(0, 1fr); gap: var(--gm-space-3); align-items: start; color: var(--gm-text-2); }
.gm-checklist li::before { content: ""; width: 18px; height: 18px; margin-top: 3px; background: var(--gm-accent);
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M3 8.5l3.2 3L13 4.5' fill='none' stroke='black' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / contain no-repeat;
          mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M3 8.5l3.2 3L13 4.5' fill='none' stroke='black' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / contain no-repeat; }

/* Accordion (FAQ): <div class="gm-accordion"><details><summary>Q</summary><p>A</p></details></div> */
.gm-accordion { border-top: 1px solid var(--gm-line); }
.gm-accordion details { border-bottom: 1px solid var(--gm-line); }
.gm-accordion summary { list-style: none; cursor: pointer; display: flex; justify-content: space-between; align-items: center; gap: var(--gm-space-4); min-height: 56px; padding: var(--gm-space-3) 2px; font: var(--gm-weight-semibold) var(--gm-text-lg)/1.4 var(--gm-font-body); color: var(--gm-text); }
.gm-accordion summary::-webkit-details-marker { display: none; }
.gm-accordion summary::after { content: "+"; flex: none; color: var(--gm-accent-text); font: 500 22px/1 var(--gm-font-mono); }
.gm-accordion details[open] summary::after { content: "\2212"; }
.gm-accordion details > :not(summary) { margin: 0; padding: 0 2px var(--gm-space-5); color: var(--gm-text-2); max-width: 70ch; }

/* ---------- 21. Motion preference ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
}
