/* helix-tokens.css — Design system tokens + layout primitives for LabQuim Helix UI.
 * Ported from lab_ui_revamp/helix/helix.css.
 * Loaded after app.css. Overrides cascade via more-specific selectors in helix-mud-overrides.css.
 * MudBlazor version pinned: 7.14. Review hx-mud-overrides.css if upgrading.
 */

/* ── tokens ─────────────────────────────────────────────────────────────────── */
:root {
  /* primary palette (default: Slate-Blue) */
  --p-50:  oklch(0.97 0.015 250);
  --p-100: oklch(0.94 0.030 250);
  --p-200: oklch(0.88 0.060 250);
  --p-400: oklch(0.62 0.110 250);
  --p-500: oklch(0.52 0.120 250);
  --p-600: oklch(0.45 0.120 250);
  --p-700: oklch(0.38 0.100 250);
  --p-900: oklch(0.22 0.060 250);

  /* warm-tinted neutrals */
  --n-0:      #ffffff;
  --bg:       oklch(0.985 0.004 80);
  --surface:  #ffffff;
  --surface-2: oklch(0.97 0.005 80);
  --surface-3: oklch(0.945 0.006 80);
  --line:     oklch(0.91 0.006 80);
  --line-2:   oklch(0.86 0.008 80);
  --ink:      oklch(0.22 0.012 260);
  --ink-2:    oklch(0.36 0.012 260);
  --ink-3:    oklch(0.52 0.012 260);
  --ink-4:    oklch(0.68 0.010 260);

  /* semantic */
  --ok:        oklch(0.55 0.11 155);
  --ok-bg:     oklch(0.96 0.04 155);
  --ok-ink:    oklch(0.32 0.10 155);
  --amber:     oklch(0.66 0.13 65);
  --amber-bg:  oklch(0.965 0.04 75);
  --amber-ink: oklch(0.42 0.10 65);
  --danger:    oklch(0.55 0.18 25);
  --danger-bg: oklch(0.96 0.03 25);
  --danger-ink:oklch(0.40 0.16 25);
  --info:      oklch(0.55 0.10 230);
  --info-bg:   oklch(0.96 0.03 230);
  --info-ink:  oklch(0.32 0.10 230);
  --violet:    oklch(0.55 0.12 290);
  --violet-bg: oklch(0.965 0.025 290);
  --violet-ink:oklch(0.36 0.10 290);

  /* secondary + accent (overridden by branding-vars) */
  --secondary:     var(--p-400);
  --secondary-bg:  var(--p-50);
  --secondary-ink: var(--p-700);
  --accent:        var(--p-200);

  /* order-state palette */
  --c-state-recepcion:  var(--p-500);
  --c-state-muestra:    var(--violet);
  --c-state-pagado:     var(--amber);
  --c-state-completada: var(--ok);
  --c-state-cancelada:  oklch(0.7 0.012 260);

  /* density */
  --row-y: 12px;
  --row-x: 16px;
  --row-h: 44px;
  --text:  14px;
  --text-sm: 12.5px;
  --text-xs: 11.5px;

  /* radii */
  --r-1: 6px;
  --r-sm: 8px;
  --r-2: 10px;
  --r-3: 14px;
  --r-pill: 999px;

  /* type */
  --f-sans:  "IBM Plex Sans",  ui-sans-serif, system-ui, -apple-system, "Helvetica Neue", sans-serif;
  --f-serif: "IBM Plex Serif", ui-serif, Georgia, serif;
  --f-mono:  "IBM Plex Mono",  ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;

  /* shadows */
  --sh-1: 0 1px 0 oklch(0.92 0.006 80);
  --sh-2: 0 1px 2px rgba(20,24,40,.04), 0 1px 0 oklch(0.92 0.006 80);
  --sh-3: 0 12px 32px rgba(20,24,40,.08), 0 2px 8px rgba(20,24,40,.04);
}

[data-density="compact"] {
  --row-y: 8px;
  --row-x: 14px;
  --row-h: 36px;
  --text:  13px;
  --text-sm: 12px;
  --text-xs: 11px;
}

/* palette swaps */
[data-palette="indigo"] {
  --p-50:  oklch(0.97 0.018 290);
  --p-100: oklch(0.94 0.035 290);
  --p-200: oklch(0.88 0.070 290);
  --p-400: oklch(0.60 0.130 290);
  --p-500: oklch(0.50 0.150 290);
  --p-600: oklch(0.44 0.150 290);
  --p-700: oklch(0.36 0.130 290);
  --p-900: oklch(0.22 0.080 290);
  --c-state-recepcion: var(--p-500);
}
[data-palette="forest"] {
  --p-50:  oklch(0.97 0.018 160);
  --p-100: oklch(0.94 0.035 160);
  --p-200: oklch(0.88 0.060 160);
  --p-400: oklch(0.58 0.090 160);
  --p-500: oklch(0.48 0.090 160);
  --p-600: oklch(0.40 0.080 160);
  --p-700: oklch(0.32 0.070 160);
  --p-900: oklch(0.20 0.040 160);
  --c-state-recepcion: var(--p-500);
}
[data-palette="clay"] {
  --p-50:  oklch(0.97 0.018 50);
  --p-100: oklch(0.94 0.035 50);
  --p-200: oklch(0.88 0.060 50);
  --p-400: oklch(0.62 0.105 45);
  --p-500: oklch(0.55 0.115 40);
  --p-600: oklch(0.47 0.110 35);
  --p-700: oklch(0.38 0.090 30);
  --p-900: oklch(0.24 0.060 30);
  --c-state-recepcion: var(--p-500);
}

/* ── base ───────────────────────────────────────────────────────────────────── */
.hx-body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--f-sans);
  font-size: var(--text);
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

::-webkit-scrollbar { width: 12px; height: 12px; }
::-webkit-scrollbar-thumb { background: oklch(0.86 0.006 80); border-radius: 999px; border: 3px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-thumb:hover { background-color: oklch(0.78 0.008 80); background-clip: padding-box; }

.mono  { font-family: var(--f-mono);  font-feature-settings: "tnum" 1, "zero" 1; }
.serif { font-family: var(--f-serif); }
.tnum  { font-variant-numeric: tabular-nums; }

/* ── shell ──────────────────────────────────────────────────────────────────── */
.hx-shell {
  display: grid;
  grid-template-columns: 248px 1fr;
  min-height: 100vh;
  transition: grid-template-columns 0.28s cubic-bezier(0.22, 0.68, 0, 1.1);
}
.hx-shell.hx-side-mode-icon      { grid-template-columns: 64px 1fr; }
.hx-shell.hx-side-mode-collapsed { grid-template-columns: 0fr 1fr; }
.hx-shell.hx-side-mode-labeled   { grid-template-columns: 248px 1fr; }

.hx-main    { display: flex; flex-direction: column; min-width: 0; grid-column: 2; }
.hx-content {
  padding: 24px clamp(20px, 3vw, 36px) 56px;
  max-width: 1480px; width: 100%; margin: 0 auto;
  animation: hxFadeUp 0.32s cubic-bezier(0.16, 1, 0.3, 1) both;
}

/* ── sidebar ────────────────────────────────────────────────────────────────── */
.hx-side {
  background: var(--surface);
  border-right: 1px solid var(--line);
  display: flex; flex-direction: column;
  position: sticky; top: 0; align-self: start;
  height: 100vh; overflow: hidden;
  transition: opacity 0.2s ease, transform 0.28s cubic-bezier(0.22, 0.68, 0, 1.1);
  will-change: transform, opacity;
}
.hx-shell.hx-side-mode-collapsed .hx-side {
  opacity: 0;
  transform: translateX(-16px);
  pointer-events: none;
  overflow: hidden;
  min-width: 0;
  border-right-color: transparent;
}
.hx-side-icon { align-items: stretch; }
.hx-brand {
  display: flex; align-items: center; gap: 10px;
  padding: 18px 16px 16px; color: var(--ink);
  text-decoration: none;
}
.hx-side-icon .hx-brand { padding: 16px 10px; justify-content: center; }
.hx-brand-mark {
  width: 32px; height: 32px; display: grid; place-items: center;
  background: var(--p-600); color: white; border-radius: 8px; flex: 0 0 32px;
}
.hx-brand-mark svg { width: 20px; height: 20px; }
/* PNG brand mark (Delta LIMS): fill the box, drop the tinted background */
.hx-brand-mark:has(.hx-brand-img) { background: transparent; }
.hx-brand-img { width: 100%; height: 100%; object-fit: contain; display: block; }
.hx-brand-text  { display: flex; flex-direction: column; line-height: 1.1; }
.hx-brand-text b { font-family: var(--f-serif); font-weight: 600; font-size: 17px; letter-spacing: -0.005em; }
.hx-brand-text i { font-style: normal; color: var(--ink-3); font-size: 11px; letter-spacing: 0.02em; }

.hx-nav { flex: 1; overflow-y: auto; padding: 4px 10px 16px; }
.hx-side-icon .hx-nav { padding: 4px 8px 16px; }
.hx-nav-sec { padding: 8px 0; }
.hx-nav-h {
  font-size: 10px; font-weight: 600; letter-spacing: 0.08em;
  text-transform: uppercase; color: var(--ink-4);
  padding: 8px 10px 6px;
}
.hx-nav-rule { height: 1px; background: var(--line); margin: 8px 6px; }
.hx-nav-i {
  display: flex; align-items: center; gap: 10px;
  padding: 7px 10px; border-radius: 8px;
  color: var(--ink-2); cursor: pointer; text-decoration: none;
  transition: background .12s, color .12s; position: relative;
}
.hx-side-icon .hx-nav-i { padding: 8px; justify-content: center; }
.hx-nav-i:hover { background: var(--surface-2); color: var(--ink); }
.hx-nav-i.is-active { background: var(--p-50); color: var(--p-700); }
.hx-nav-i::before {
  content: "";
  position: absolute; left: -10px; top: 8px; bottom: 8px; width: 2px;
  background: var(--accent); border-radius: 2px;
  opacity: 0; transform: scaleY(0.4);
  transition: opacity 0.18s ease, transform 0.18s cubic-bezier(0.22, 0.68, 0, 1.1);
}
.hx-nav-i.is-active::before {
  opacity: 1; transform: scaleY(1);
}
.hx-side-icon .hx-nav-i.is-active::before { display: none; }

/* Tooltip for icon-only sidebar */
.hx-side-icon .hx-nav-i[title] { overflow: visible; }
.hx-side-icon .hx-nav-i[title]::after {
  content: attr(title);
  position: absolute;
  left: calc(100% + 10px);
  top: 50%;
  transform: translateY(-50%) translateX(-4px);
  background: var(--ink, #1a1a1a);
  color: #fff;
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
  padding: 4px 9px;
  border-radius: 6px;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.15s ease, transform 0.15s ease;
  z-index: 200;
  box-shadow: 0 2px 8px rgba(0,0,0,.18);
}
.hx-side-icon .hx-nav-i[title]:hover::after {
  opacity: 1;
  transform: translateY(-50%) translateX(0);
}

.hx-nav-icn { display: grid; place-items: center; width: 18px; height: 18px; flex: 0 0 18px; }
.hx-nav-icn svg { width: 18px; height: 18px; }
.hx-nav-lbl { display: flex; flex-direction: column; line-height: 1.15; }
.hx-nav-lbl span { font-size: 13.5px; font-weight: 500; }
.hx-nav-lbl i { font-style: normal; color: var(--ink-4); font-size: 10.5px; }
.hx-nav-i.is-active .hx-nav-lbl i { color: var(--p-500); }

.hx-side-foot { border-top: 1px solid var(--line); padding: 12px; }
.hx-side-foot-acc {
  display: flex; align-items: center; gap: 10px;
  padding: 6px 8px; border-radius: 8px;
}
.hx-side-foot-acc:hover { background: var(--surface-2); }
.hx-side-foot-id { display: flex; flex-direction: column; line-height: 1.1; }
.hx-side-foot-id b { font-size: 13px; font-weight: 600; }
.hx-side-foot-id i { font-style: normal; font-size: 11px; color: var(--ink-3); }

.hx-avatar {
  width: 28px; height: 28px; border-radius: 999px;
  background: var(--secondary-bg); color: var(--secondary-ink);
  display: grid; place-items: center;
  font-size: 11px; font-weight: 600; letter-spacing: 0.04em; flex: 0 0 28px;
}
.hx-avatar.sm { width: 26px; height: 26px; font-size: 10.5px; flex: 0 0 26px; }

/* ── topbar ─────────────────────────────────────────────────────────────────── */
.hx-top {
  position: sticky; top: 0; z-index: 5;
  background: color-mix(in oklab, var(--bg) 90%, white);
  -webkit-backdrop-filter: blur(10px) saturate(160%);
  backdrop-filter: blur(10px) saturate(160%);
  border-bottom: 1px solid var(--line);
  height: 60px; display: flex; align-items: center; justify-content: space-between;
  padding: 0 clamp(16px, 2.5vw, 28px); gap: 16px;
}
.hx-top-l { display: flex; align-items: center; gap: 12px; min-width: 0; }
.hx-top-r { display: flex; align-items: center; gap: 8px; }
.hx-top-title h1 {
  margin: 0; font-family: var(--f-serif); font-weight: 500;
  font-size: 19px; letter-spacing: -0.01em; line-height: 1.1;
  display: flex; align-items: baseline; gap: 10px;
}
.hx-top-title h1 i {
  font-style: normal; font-family: var(--f-sans); font-weight: 400;
  font-size: 12px; color: var(--ink-4); letter-spacing: 0.02em;
}
.hx-crumb { font-size: 11px; color: var(--ink-4); letter-spacing: 0.02em; line-height: 1; padding-bottom: 4px; }
.hx-crumb a { color: var(--p-600); }
.hx-crumb a:hover { text-decoration: underline; }

.hx-icon-btn {
  width: 34px; height: 34px; border-radius: 8px;
  display: grid; place-items: center; color: var(--ink-3);
  transition: background .12s, color .12s; background: none; border: 0; cursor: pointer;
}
.hx-icon-btn:hover { background: var(--surface-2); color: var(--ink); }
.hx-icon-btn:focus-visible { outline: 2px solid var(--p-200); outline-offset: 2px; }
.hx-icon-btn svg { width: 18px; height: 18px; }

.hx-divider-v { width: 1px; height: 22px; background: var(--line); margin: 0 4px; }

.hx-branch-select {
  min-width: 160px; max-width: 240px; height: 34px;
  padding: 0 28px 0 10px; border: 1px solid var(--line); border-radius: 8px;
  background: var(--surface) url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%236B7280' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E") no-repeat right 8px center / 14px;
  color: var(--ink); font: inherit; font-size: 13px; cursor: pointer;
  appearance: none; -webkit-appearance: none;
}
.hx-branch-select:hover { background-color: var(--surface-2); }
.hx-branch-select:focus-visible { outline: 2px solid var(--p-200); outline-offset: 2px; }

.hx-top-acc { display: flex; align-items: center; gap: 8px; padding: 0 4px; }
.hx-top-acc-id { display: flex; flex-direction: column; line-height: 1.1; }
.hx-top-acc-id b { font-size: 13px; font-weight: 600; }
.hx-top-acc-id i { font-style: normal; font-size: 10.5px; color: var(--ink-4); }

/* ── tag ────────────────────────────────────────────────────────────────────── */
.hx-tag {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: var(--text-xs); font-weight: 500;
  padding: 2px 8px; border-radius: 999px;
  background: var(--surface-2); color: var(--ink-2);
  border: 1px solid var(--line); white-space: nowrap;
}
.hx-tag.mono { font-family: var(--f-mono); font-size: 11px; }
.hx-tag-md   { padding: 4px 10px; font-size: 12px; }
.hx-tag-dot  { width: 6px; height: 6px; border-radius: 999px; background: currentColor; opacity: .8; flex: 0 0 6px; }
.hx-tag-ok      { background: var(--ok-bg);     color: var(--ok-ink);     border-color: color-mix(in oklab, var(--ok)     30%, var(--line)); }
.hx-tag-amber   { background: var(--amber-bg);   color: var(--amber-ink);  border-color: color-mix(in oklab, var(--amber)  30%, var(--line)); }
.hx-tag-danger  { background: var(--danger-bg);  color: var(--danger-ink); border-color: color-mix(in oklab, var(--danger) 30%, var(--line)); }
.hx-tag-info    { background: var(--info-bg);    color: var(--info-ink);   border-color: color-mix(in oklab, var(--info)   30%, var(--line)); }
.hx-tag-violet  { background: var(--violet-bg);  color: var(--violet-ink); border-color: color-mix(in oklab, var(--violet) 30%, var(--line)); }
.hx-tag-primary { background: var(--p-50);       color: var(--p-700);      border-color: var(--p-100); }
.hx-tag-muted   { color: var(--ink-3); }
.hx-tag-neutral { color: var(--ink-2); }

/* ── button ─────────────────────────────────────────────────────────────────── */
.hx-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font-weight: 500; font-family: var(--f-sans);
  border-radius: 8px; padding: 0 14px; height: 36px;
  border: 1px solid transparent;
  transition: background .14s, border-color .14s, color .14s, box-shadow .14s, transform .04s;
  user-select: none; cursor: pointer; text-decoration: none;
}
.hx-btn-i     { display: grid; place-items: center; }
.hx-btn-i svg { width: 16px; height: 16px; }
/* Unwrapped inline SVG icons inside buttons — keep them sized + non-stretching */
.hx-btn > svg { width: 16px; height: 16px; flex: 0 0 auto; }
.hx-btn-sm    { height: 30px; padding: 0 10px; font-size: 12.5px; border-radius: 7px; }
.hx-btn-sm > svg { width: 14px; height: 14px; }
.hx-btn-lg > svg { width: 18px; height: 18px; }
.hx-btn-lg    { height: 44px; padding: 0 18px; font-size: 15px; }
.hx-btn-full  { width: 100%; }
.hx-btn.is-disabled { opacity: .5; cursor: not-allowed; }
.hx-btn:active:not(.is-disabled) { transform: translateY(0.5px); }

.hx-btn-primary { background: var(--p-600); color: white; }
.hx-btn-primary:hover:not(.is-disabled) { background: var(--p-700); }
.hx-btn-primary:focus-visible { outline: 2px solid var(--p-200); outline-offset: 2px; }

.hx-btn-secondary { background: var(--surface); color: var(--ink); border-color: var(--line-2); box-shadow: var(--sh-1); }
.hx-btn-secondary:hover:not(.is-disabled) { background: var(--surface-2); }
.hx-btn-secondary:focus-visible { outline: 2px solid var(--p-200); outline-offset: 2px; }

.hx-btn-ghost { background: transparent; color: var(--ink-2); }
.hx-btn-ghost:hover:not(.is-disabled) { background: var(--surface-2); color: var(--ink); }
.hx-btn-ghost:focus-visible { outline: 2px solid var(--p-200); outline-offset: 2px; }

.hx-btn-cta {
    border: 1.5px solid color-mix(in srgb, var(--p-400) 50%, transparent);
    color: var(--p-600);
}
.hx-btn-cta:hover:not(.is-disabled) {
    animation: none;
    background: color-mix(in srgb, var(--p-500) 10%, transparent);
    border-color: var(--p-500);
    color: var(--p-700);
    transform: translateY(-2px);
    box-shadow: 0 8px 24px -4px color-mix(in srgb, var(--p-500) 40%, transparent);
    transition: background 0.2s, box-shadow 0.2s, transform 0.2s;
}

/* Glowing border CTA — pulsing primary halo to draw the eye */
.hx-btn-glow {
    position: relative;
    border: 1.5px solid color-mix(in srgb, var(--p-400) 85%, transparent);
    animation: hxBtnGlow 1.8s ease-in-out infinite;
}
.hx-btn-glow:hover:not(.is-disabled) {
    /* keep the glow pulsing on hover; add a lift on top */
    transform: translateY(-2px);
    transition: transform 0.18s ease;
}
@keyframes hxBtnGlow {
    0%, 100% {
        box-shadow:
            0 0 0 0 color-mix(in srgb, var(--p-500) 70%, transparent),
            0 0 16px 1px color-mix(in srgb, var(--p-400) 55%, transparent);
    }
    50% {
        box-shadow:
            0 0 0 7px color-mix(in srgb, var(--p-400) 30%, transparent),
            0 0 38px 6px color-mix(in srgb, var(--p-500) 80%, transparent);
    }
}
@media (prefers-reduced-motion: reduce) {
    .hx-btn-glow { animation: none; }
}

.hx-btn-link { background: transparent; color: var(--p-600); padding: 0; height: auto; }
.hx-btn-link:hover { text-decoration: underline; }
.hx-btn-link:focus-visible { outline: 2px solid var(--p-200); outline-offset: 2px; border-radius: 3px; }

.hx-btn-danger { background: var(--surface); color: var(--danger-ink); border-color: color-mix(in oklab, var(--danger) 25%, var(--line-2)); }
.hx-btn-danger:hover:not(.is-disabled) { background: var(--danger-bg); }
.hx-btn-danger:focus-visible { outline: 2px solid color-mix(in oklab, var(--danger) 40%, transparent); outline-offset: 2px; }

/* row-action icon button */
.hx-act {
  width: 28px; height: 28px; border-radius: 6px;
  display: inline-grid; place-items: center;
  color: var(--ink-3); transition: background .12s, color .12s;
  background: none; border: 0; cursor: pointer;
}
.hx-act:hover { background: var(--surface-2); color: var(--ink); }
.hx-act:focus-visible { outline: 2px solid var(--p-200); outline-offset: 2px; }
.hx-act svg   { width: 15px; height: 15px; }
.hx-act-danger:hover { background: var(--danger-bg); color: var(--danger-ink); }

/* ── inputs ─────────────────────────────────────────────────────────────────── */
.hx-field      { display: flex; flex-direction: column; gap: 5px; }
.hx-field-full { width: 100%; }
.hx-field-lbl  { font-size: 11.5px; font-weight: 500; color: var(--ink-3); letter-spacing: 0.02em; }
.hx-field-hint { font-size: 11px; color: var(--ink-4); }
.hx-field-hint.is-error { color: var(--danger-ink); }

.hx-inp, .hx-sel, .hx-ta {
  width: 100%;
  background: var(--surface); border: 1px solid var(--line-2);
  border-radius: 8px; padding: 0 12px; height: 38px;
  outline: none; transition: border-color .14s, box-shadow .14s, background .14s;
  font-size: var(--text); color: var(--ink); font-family: var(--f-sans);
}
.hx-ta { padding: 10px 12px; height: auto; min-height: 76px; resize: vertical; }
.hx-inp::placeholder, .hx-ta::placeholder { color: var(--ink-4); }
.hx-inp:focus, .hx-sel:focus, .hx-ta:focus {
  border-color: var(--p-400);
  box-shadow: 0 0 0 3px var(--p-100);
}
.hx-inp-wrap { position: relative; }
.hx-inp-i    { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); color: var(--ink-4); pointer-events: none; }
.hx-inp-i svg { width: 16px; height: 16px; }
.hx-inp-pl { padding-left: 34px; }

/* ── card ───────────────────────────────────────────────────────────────────── */
.hx-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: var(--sh-2);
  padding: 18px 20px 20px;
}
.hx-card.no-pad { padding: 0; }
.hx-card-h {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; margin-bottom: 14px;
}
.hx-card-h h3  { margin: 0; font-size: 14px; font-weight: 600; letter-spacing: -0.005em; }
.hx-card-act   { display: flex; gap: 8px; align-items: center; }

/* ── table ──────────────────────────────────────────────────────────────────── */
.hx-table-wrap { border: 1px solid var(--line); border-radius: 12px; background: var(--surface); overflow: hidden; }
.hx-table { width: 100%; border-collapse: collapse; }
.hx-table thead th {
  font-size: 10.5px; font-weight: 600; letter-spacing: 0.07em; text-transform: uppercase;
  color: var(--ink-4); text-align: left; padding: 10px var(--row-x);
  background: var(--surface-2); border-bottom: 1px solid var(--line);
  position: sticky; top: 0;
}
.hx-table tbody td {
  padding: var(--row-y) var(--row-x);
  border-bottom: 1px solid var(--line);
  font-size: var(--text); vertical-align: middle;
  transition: background 0.1s ease;
}
.hx-table tbody tr:last-child td { border-bottom: 0; }
.hx-table tbody tr:hover td { background: var(--surface-2); }
.hx-td-num     { text-align: right; font-variant-numeric: tabular-nums; }
.hx-td-right   { text-align: right; }
.hx-td-actions { white-space: nowrap; text-align: right; }
.hx-td-actions .hx-act { margin-left: 2px; }
.hx-td-folio   { font-family: var(--f-mono); font-size: var(--text-sm); color: var(--ink-2); }
.hx-td-mono    { font-family: var(--f-mono); font-size: var(--text-sm); }
.hx-td-muted   { color: var(--ink-3); }
.hx-td-strong  { font-weight: 600; }
.hx-table tr.is-pinned td { background: color-mix(in oklab, var(--p-50) 70%, transparent); }

/* ── dashboard layout helpers ───────────────────────────────────────────────── */
.hx-kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 14px;
  margin-bottom: 28px;
}
.hx-dashboard-grid {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 20px;
  align-items: start;
}
@media (max-width: 720px) {
  .hx-dashboard-grid { grid-template-columns: 1fr; }
}

/* ── toolbar / tabs ─────────────────────────────────────────────────────────── */
.hx-toolbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 0 0 14px; }
.hx-toolbar > * { flex: 0 0 auto; }
.hx-toolbar .grow { flex: 1; }

.hx-tabs {
  display: flex; gap: 4px;
  padding: 3px; background: var(--surface-2);
  border: 1px solid var(--line); border-radius: 10px;
  width: fit-content;
}
.hx-tab {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 5px 12px; border-radius: 7px; cursor: pointer;
  color: var(--ink-3); font-size: 12.5px; font-weight: 500;
  background: none; border: 0;
}
.hx-tab em {
  font-style: normal; font-size: 10.5px; padding: 1px 6px;
  border-radius: 999px; background: var(--surface); color: var(--ink-4);
}
.hx-tab:hover { color: var(--ink); }
.hx-tab.is-active { background: var(--surface); color: var(--ink); box-shadow: var(--sh-1); }
.hx-tab.is-active em { background: color-mix(in oklab, var(--accent) 15%, var(--surface)); color: var(--accent); }

/* ── empty state ────────────────────────────────────────────────────────────── */
.hx-empty {
  text-align: center; padding: 36px 16px;
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  color: var(--ink-3);
}
.hx-empty-i {
  width: 44px; height: 44px; border-radius: 12px;
  display: grid; place-items: center;
  background: var(--surface-2); color: var(--ink-3); border: 1px solid var(--line);
}
.hx-empty h4 { margin: 4px 0 0; font-weight: 600; color: var(--ink-2); }
.hx-empty p  { margin: 0; max-width: 36ch; }

/* ── kpi card ───────────────────────────────────────────────────────────────── */
.hx-kpi {
  border: 1px solid var(--line); background: var(--surface);
  border-radius: 12px; padding: 14px 16px;
  display: flex; flex-direction: column; gap: 8px;
}
.hx-kpi-l    { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.hx-kpi-lbl  { font-size: 11px; font-weight: 600; color: var(--ink-4); letter-spacing: 0.07em; text-transform: uppercase; }
.hx-kpi-sublbl { font-size: 11px; color: var(--ink-3); }
.hx-kpi-val  {
  font-family: var(--f-serif); font-size: 28px; font-weight: 500; letter-spacing: -0.01em; line-height: 1.05;
}
.hx-kpi-val .unit   { font-size: 13px; color: var(--ink-3); margin-left: 4px; font-family: var(--f-sans); }
.hx-kpi-trend       { font-size: 11.5px; font-weight: 500; display: inline-flex; align-items: center; gap: 4px; }
.hx-kpi-trend.up    { color: var(--ok-ink); }
.hx-kpi-trend.down  { color: var(--danger-ink); }
a.hx-kpi-link { text-decoration: none; color: inherit; display: flex; flex-direction: column; gap: 8px; }
a.hx-kpi-link:hover { border-color: var(--p-200); box-shadow: 0 0 0 3px var(--p-100), var(--sh-2); }

/* ── stepper ────────────────────────────────────────────────────────────────── */
.hx-stepper { display: flex; align-items: center; }
.hx-step    { flex: 1; display: flex; align-items: center; gap: 10px; }
.hx-step + .hx-step { padding-left: 8px; }
.hx-step-dot {
  width: 24px; height: 24px; border-radius: 999px;
  display: grid; place-items: center;
  font-size: 11px; font-weight: 600;
  background: var(--surface); border: 1px solid var(--line-2); color: var(--ink-3);
  flex: 0 0 24px;
}
.hx-step.is-done   .hx-step-dot { background: var(--p-600); color: white; border-color: var(--p-600); }
.hx-step.is-active .hx-step-dot { background: white; color: var(--p-700); border-color: var(--p-600); box-shadow: 0 0 0 3px var(--p-100); }
.hx-step-lbl   { display: flex; flex-direction: column; line-height: 1.1; min-width: 0; }
.hx-step-lbl b { font-size: 12.5px; font-weight: 600; color: var(--ink-2); }
.hx-step.is-active .hx-step-lbl b { color: var(--p-700); }
.hx-step.is-todo   .hx-step-lbl b { color: var(--ink-4); font-weight: 500; }
.hx-step-lbl i { font-style: normal; font-size: 10.5px; color: var(--ink-4); }
.hx-step-bar { flex: 1; height: 2px; background: var(--line); border-radius: 2px; margin: 0 8px; }
.hx-step-bar.is-done { background: var(--p-600); }

/* ── chip group ─────────────────────────────────────────────────────────────── */
.hx-chips { display: inline-flex; gap: 4px; align-items: center; flex-wrap: wrap; }
.hx-chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 9px; border-radius: 999px;
  background: var(--surface-2); border: 1px solid var(--line);
  font-size: 11.5px; color: var(--ink-2);
}

/* ── horizontal rule label ──────────────────────────────────────────────────── */
.hx-rulelabel {
  display: flex; align-items: center; gap: 12px;
  color: var(--ink-4); font-size: 11px; letter-spacing: 0.07em; text-transform: uppercase; font-weight: 600;
}
.hx-rulelabel::before, .hx-rulelabel::after { content: ""; flex: 1; height: 1px; background: var(--line); }

/* ── page heading ───────────────────────────────────────────────────────────── */
.hx-page-h { margin-bottom: 1rem; }
.hx-page-h h1 {
  margin: 0;
  font-family: var(--f-serif); font-size: 22px;
  font-weight: 500; letter-spacing: -0.01em;
  color: var(--ink); line-height: 1.15;
}
.hx-page-h p {
  margin: 4px 0 0;
  font-size: var(--text-sm); color: var(--ink-3);
}

/* ── utilities ──────────────────────────────────────────────────────────────── */
.row         { display: flex; align-items: center; gap: 10px; }
.row.between { justify-content: space-between; }
.row.wrap    { flex-wrap: wrap; }
.col         { display: flex; flex-direction: column; gap: 10px; }
.gap-2 { gap: 8px; }  .gap-3 { gap: 12px; } .gap-4 { gap: 16px; } .gap-6 { gap: 24px; }
.grid        { display: grid; }
.muted       { color: var(--ink-3); }
.faint       { color: var(--ink-4); }
.strong      { font-weight: 600; }
.text-sm     { font-size: var(--text-sm); }
.text-xs     { font-size: var(--text-xs); }
.text-lg     { font-size: 16px; }
.serif-h     { font-family: var(--f-serif); font-weight: 500; letter-spacing: -0.01em; }
.mt-2 { margin-top: 8px; }   .mt-3 { margin-top: 12px; }  .mt-4 { margin-top: 16px; }  .mt-6 { margin-top: 24px; }
.mb-2 { margin-bottom: 8px; } .mb-3 { margin-bottom: 12px; } .mb-4 { margin-bottom: 16px; }
.w-full      { width: 100%; }

/* Sticky side-panel: becomes static on narrow screens to prevent overlap */
.hx-sticky-panel { position: sticky; top: 80px; }
@media (max-width: 720px) { .hx-sticky-panel { position: static; } }

/* Hidden on desktop; only visible via mobile media query below */
.hx-side-mask { display: none; }

/* ── Mobile shell: sidebar overlay (≤ 900px) ────────────────────────────────── */
@media (max-width: 900px) {
  .hx-shell { grid-template-columns: 0fr 1fr !important; }

  .hx-side {
    display: flex !important;
    position: fixed !important;
    top: 0; left: 0; bottom: 0;
    width: 248px !important;
    z-index: 30;
    transform: translateX(-100%);
    box-shadow: var(--sh-3);
    transition: transform 0.28s cubic-bezier(0.22, 0.68, 0, 1.1),
                opacity   0.28s ease !important;
  }
  /* open states: labeled or icon → slide in */
  .hx-shell.hx-side-mode-labeled .hx-side,
  .hx-shell.hx-side-mode-icon    .hx-side {
    transform: translateX(0) !important;
    opacity: 1 !important;
  }
  /* collapsed → hidden */
  .hx-shell.hx-side-mode-collapsed .hx-side {
    transform: translateX(-100%) !important;
    opacity: 0 !important;
  }

  .hx-side-mask {
    display: block;
    position: fixed; inset: 0;
    background: rgba(20,24,40,0.35);
    backdrop-filter: blur(2px);
    z-index: 29;
    animation: hxFadeIn 0.2s ease both;
  }

  /* topbar: hide name/role text to keep bar compact */
  .hx-top-acc-id { display: none; }
}

/* ── landing ────────────────────────────────────────────────────────────────── */
.hx-landing { background: var(--bg); min-height: 100vh; scroll-behavior: smooth; }
/* Marketing landing is product-branded, NOT tenant-branded: pin the default
   Slate-Blue palette here so a logged-in tenant's custom colors (set on :root via
   LabQuimTheme.setCssVars) don't leak into the public landing page. */
.hx-landing {
  --p-50:  oklch(0.97 0.015 250);
  --p-100: oklch(0.94 0.030 250);
  --p-200: oklch(0.88 0.060 250);
  --p-300: oklch(0.76 0.080 250);
  --p-400: oklch(0.62 0.110 250);
  --p-500: oklch(0.52 0.120 250);
  --p-600: oklch(0.45 0.120 250);
  --p-700: oklch(0.38 0.100 250);
  --p-900: oklch(0.22 0.060 250);
}
/* smooth-scroll for nav anchors + offset so sticky nav doesn't cover targets */
html { scroll-behavior: smooth; }
.hx-landing [id] { scroll-margin-top: 96px; }
@media (prefers-reduced-motion: reduce) {
  html, .hx-landing { scroll-behavior: auto; }
}
.hx-landing-nav-wrap {
  position: sticky;
  top: 0;
  z-index: 100;
  width: 100%;
  background: transparent;
  backdrop-filter: blur(0px) saturate(100%);
  -webkit-backdrop-filter: blur(0px) saturate(100%);
  box-shadow: none;
  transition: background 0.35s ease, backdrop-filter 0.35s ease, -webkit-backdrop-filter 0.35s ease, box-shadow 0.35s ease;
}
.hx-landing-nav-wrap.is-scrolled {
  background: color-mix(in oklab, var(--bg) 80%, transparent);
  backdrop-filter: blur(18px) saturate(170%);
  -webkit-backdrop-filter: blur(18px) saturate(170%);
  box-shadow: 0 1px 0 var(--line);
}
.hx-landing-nav {
  display: flex; align-items: center; justify-content: space-between;
  padding: 22px clamp(24px, 5vw, 64px); max-width: 1280px; margin: 0 auto;
}
.hx-landing-nav-links { display: flex; gap: 28px; }
.hx-landing-nav-links a:not(.hx-btn) { font-size: 13px; color: var(--ink-2); text-decoration: none; }
.hx-landing-nav-links a:not(.hx-btn):hover { color: var(--ink); }

.hx-hero {
  padding: 36px clamp(24px, 5vw, 64px) 56px; max-width: 1280px; margin: 0 auto;
  display: grid; grid-template-columns: 1.1fr 1fr; gap: 56px;
  align-items: center; position: relative; isolation: isolate;
}
.hx-hero > div:not(.hx-helix), .hx-hero > .hx-verify { position: relative; z-index: 2; }

.hx-helix {
  position: absolute; top: -40px; bottom: -40px; right: -80px;
  width: 460px; z-index: 0; pointer-events: none; overflow: hidden;
  filter: blur(14px) saturate(115%); opacity: 0.55;
  mask-image: linear-gradient(180deg, transparent 0%, black 12%, black 88%, transparent 100%);
  -webkit-mask-image: linear-gradient(180deg, transparent 0%, black 12%, black 88%, transparent 100%);
}
.hx-helix svg {
  display: block; width: 100%; height: auto; transform-origin: center;
  animation: hxHelixSway 12s ease-in-out infinite alternate;
}
.hx-helix-scroll {
  animation: hxHelixScroll 18s linear infinite;
  transform-box: fill-box;
  will-change: transform;
}
.hx-helix-spark { position: absolute; border-radius: 999px; filter: blur(40px); opacity: 0.55; mix-blend-mode: screen; }
.hx-helix-spark-1 {
  width: 280px; height: 280px; top: 12%; right: 8%;
  background: radial-gradient(circle, var(--p-400) 0%, transparent 70%);
  animation: hxSparkA 9s ease-in-out infinite alternate;
}
.hx-helix-spark-2 {
  width: 220px; height: 220px; bottom: 8%; right: -6%;
  background: radial-gradient(circle, var(--p-200) 0%, transparent 70%);
  animation: hxSparkB 11s ease-in-out infinite alternate;
}

@keyframes hxHelixScroll { from { transform: translateY(0); } to { transform: translateY(-20%); } }
@keyframes hxHelixSway   { 0% { transform: rotate(-3deg) scale(1.02); } 100% { transform: rotate(4deg) scale(1.06); } }
@keyframes hxSparkA { 0% { transform: translate(0,0) scale(1); opacity: 0.45; } 100% { transform: translate(-20px,30px) scale(1.15); opacity: 0.65; } }
@keyframes hxSparkB { 0% { transform: translate(0,0) scale(1); opacity: 0.35; } 100% { transform: translate(30px,-20px) scale(1.2); opacity: 0.55; } }
@media (prefers-reduced-motion: reduce) {
  .hx-helix svg, .hx-helix-scroll, .hx-helix-spark { animation: none !important; }
}

.hx-hero-headline { font-family: var(--f-serif); font-weight: 400; font-size: clamp(30px, 7vw, 64px); line-height: 1.04; letter-spacing: -0.018em; margin: 0 0 22px; color: var(--ink); }
.hx-hero-headline em { font-style: italic; color: var(--p-600); }
.hx-hero-sub     { font-size: 17px; line-height: 1.55; color: var(--ink-2); max-width: 50ch; margin: 0 0 28px; }
.hx-hero-actions { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.hx-hero-meta    { display: flex; gap: 28px; margin-top: 36px; padding-top: 24px; border-top: 1px solid var(--line); }
.hx-hero-meta b  { display: block; font-family: var(--f-serif); font-size: 22px; font-weight: 500; letter-spacing: -0.005em; }
.hx-hero-meta span { font-size: 11.5px; color: var(--ink-3); letter-spacing: 0.04em; text-transform: uppercase; font-weight: 500; }

.hx-verify {
  background: var(--surface); border: 1px solid var(--line); border-radius: 16px;
  padding: 22px 22px 18px; box-shadow: var(--sh-3);
}
.hx-section { padding: 64px clamp(24px, 5vw, 64px); max-width: 1280px; margin: 0 auto; }
.hx-section-title { font-family: var(--f-serif); font-weight: 500; font-size: 28px; letter-spacing: -0.01em; margin: 0; }

/* landing card hover — subtle lift + primary-tinted border/shadow */
.hx-landing .hx-card { transition: transform .2s cubic-bezier(.22,.68,0,1.1), box-shadow .2s ease, border-color .2s ease; }
.hx-landing .hx-card:hover {
  transform: translateY(-3px);
  border-color: color-mix(in srgb, var(--p-400) 45%, var(--line));
  box-shadow: 0 16px 34px -14px color-mix(in srgb, var(--p-600) 30%, transparent), var(--sh-2);
}
@media (prefers-reduced-motion: reduce) {
  .hx-landing .hx-card:hover { transform: none; }
}

/* shared feature-icon chip (modules / analytics / security cards) */
.hx-feat-ico {
  width: 38px; height: 38px; border-radius: 11px; display: grid; place-items: center;
  background: color-mix(in srgb, var(--p-500) 9%, var(--surface)); color: var(--p-600);
  border: 1px solid color-mix(in srgb, var(--p-500) 14%, transparent);
  margin-bottom: 12px;
}
.hx-feat-ico svg { width: 20px; height: 20px; }

/* contact-sales dialog */
.hx-contact-head { display: flex; align-items: center; gap: 12px; }
.hx-contact-head-ico {
  width: 42px; height: 42px; border-radius: 12px; flex: 0 0 42px;
  display: grid; place-items: center; color: white;
  background: linear-gradient(135deg, var(--p-500), var(--p-700));
  box-shadow: 0 6px 16px -6px color-mix(in srgb, var(--p-600) 55%, transparent);
}
.hx-contact-head-ico svg { width: 22px; height: 22px; }
.hx-contact-head h6 { margin: 0; font-family: var(--f-serif); font-weight: 500; font-size: 19px; letter-spacing: -0.01em; }
.hx-contact-head p  { margin: 2px 0 0; font-size: 12.5px; color: var(--ink-3); }

.hx-contact-banner {
  position: relative; overflow: hidden;
  border: 1px solid color-mix(in srgb, var(--p-600) 18%, var(--line));
  border-radius: 12px; padding: 12px 14px; margin-bottom: 18px;
  background: linear-gradient(120deg, color-mix(in srgb, var(--p-600) 7%, var(--surface)) 0%, var(--surface) 70%);
  display: grid; gap: 8px;
}
.hx-contact-banner::before {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: radial-gradient(110% 140% at 100% 0%, color-mix(in srgb, var(--p-400) 16%, transparent) 0%, transparent 55%);
}
.hx-contact-benefit { display: flex; align-items: center; gap: 9px; font-size: 13px; color: var(--ink-2); position: relative; }
.hx-contact-benefit svg { width: 15px; height: 15px; color: var(--p-600); flex: 0 0 15px; }

.hx-contact-success { text-align: center; padding: 26px 8px 18px; }
.hx-contact-success-ico {
  width: 64px; height: 64px; margin: 0 auto 14px; border-radius: 999px;
  display: grid; place-items: center; color: white;
  background: linear-gradient(135deg, var(--ok), oklch(0.45 0.10 155));
  box-shadow: 0 10px 26px -8px color-mix(in srgb, var(--ok) 60%, transparent);
  animation: hxPopIn 0.45s cubic-bezier(.22,.68,0,1.4) both;
}
.hx-contact-success-ico svg { width: 30px; height: 30px; }
@keyframes hxPopIn {
  from { opacity: 0; transform: scale(0.4); }
  to   { opacity: 1; transform: scale(1); }
}
@media (prefers-reduced-motion: reduce) {
  .hx-contact-success-ico { animation: none; }
}

/* closing CTA band */
.hx-landing-cta { max-width: 1280px; margin: 24px auto 0; padding: 0 clamp(24px, 5vw, 64px); }
.hx-landing-cta-inner {
  position: relative; overflow: hidden;
  border: 1px solid color-mix(in srgb, var(--p-600) 22%, var(--line));
  border-radius: 22px; padding: clamp(32px, 5vw, 56px);
  background: linear-gradient(135deg, color-mix(in srgb, var(--p-600) 7%, var(--surface)) 0%, var(--surface) 62%);
}
.hx-landing-cta-inner::before {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: radial-gradient(120% 130% at 100% 0%, color-mix(in srgb, var(--p-400) 20%, transparent) 0%, transparent 56%);
}
.hx-landing-cta-grid {
  position: relative; z-index: 1;
  display: grid; grid-template-columns: 1.5fr auto; gap: 24px 48px; align-items: center;
}
.hx-landing-cta h2 {
  font-family: var(--f-serif); font-weight: 500; font-size: clamp(24px, 4vw, 38px);
  letter-spacing: -0.015em; line-height: 1.08; margin: 0 0 10px; color: var(--ink);
}
.hx-landing-cta h2 em { font-style: italic; color: var(--p-600); }
.hx-landing-cta p { font-size: 15px; line-height: 1.55; color: var(--ink-2); margin: 0; max-width: 48ch; }
.hx-landing-cta-actions { display: flex; gap: 12px; flex-wrap: wrap; }
@media (max-width: 760px) {
  .hx-landing-cta-grid { grid-template-columns: 1fr; }
  .hx-landing-cta-actions { width: 100%; }
  .hx-landing-cta-actions .hx-btn { flex: 1; justify-content: center; }
}

/* ── legal pages (privacidad / terminos) ─────────────────────────────────── */
.hx-legal { max-width: 760px; margin: 0 auto; padding: 48px clamp(20px, 5vw, 40px) 64px; }
.hx-legal-title { font-family: var(--f-serif); font-weight: 500; font-size: clamp(28px, 5vw, 40px); letter-spacing: -0.012em; margin: 8px 0 16px; color: var(--ink); }
.hx-legal-lead  { font-size: 17px; line-height: 1.6; color: var(--ink-2); margin: 0 0 28px; padding-bottom: 24px; border-bottom: 1px solid var(--line); }
.hx-legal h2    { font-family: var(--f-serif); font-weight: 500; font-size: 19px; color: var(--ink); margin: 28px 0 8px; }
.hx-legal h3    { font-family: var(--f-sans); font-weight: 600; font-size: 14px; color: var(--ink); margin: 16px 0 6px; text-transform: uppercase; letter-spacing: 0.05em; }
.hx-legal p     { font-size: 15px; line-height: 1.65; color: var(--ink-2); margin: 0 0 12px; }
.hx-legal ul    { margin: 4px 0 14px 0; padding-left: 20px; }
.hx-legal li    { font-size: 15px; line-height: 1.65; color: var(--ink-2); margin-bottom: 4px; }
.hx-legal-meta  { font-size: 12.5px; color: var(--ink-4); margin-top: 32px; padding-top: 20px; border-top: 1px solid var(--line); }
.hx-legal-footer {
  max-width: 760px; margin: 0 auto; padding: 24px clamp(20px, 5vw, 40px) 48px;
  border-top: 1px solid var(--line);
  display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 12px;
}
@media (max-width: 480px) {
  .hx-legal { padding: 28px 16px 40px; }
  .hx-legal-footer { flex-direction: column; align-items: flex-start; gap: 14px; }
}

/* ── public result report ───────────────────────────────────────────────────── */
.hx-public { background: var(--bg); min-height: 100vh; }
.hx-public-nav {
  position: sticky; top: 0; z-index: 5;
  background: color-mix(in oklab, var(--bg) 90%, white);
  -webkit-backdrop-filter: blur(10px) saturate(160%);
  backdrop-filter: blur(10px) saturate(160%);
  border-bottom: 1px solid var(--line);
  height: 60px; display: flex; align-items: center; justify-content: space-between;
  padding: 0 clamp(16px, 4vw, 40px);
}
.hx-public-main { max-width: 1120px; margin: 0 auto; padding: 32px clamp(16px, 4vw, 40px) 64px; }

.hx-public-hero {
  display: grid; grid-template-columns: 1.4fr 1fr; gap: 24px;
  padding: 28px 0 24px;
}
.hx-public-hero-r { display: flex; flex-direction: column; gap: 12px; }
.hx-public-id-card {
  background: var(--surface); border: 1px solid var(--line); border-radius: 12px;
  padding: 16px 18px; box-shadow: var(--sh-2);
}
.hx-public-qr {
  background: var(--surface); border: 1px solid var(--line); border-radius: 12px;
  padding: 12px 14px; display: flex; align-items: center; gap: 14px;
}
.hx-public-banner {
  display: flex; align-items: center; gap: 16px;
  padding: 18px 20px; background: var(--ok-bg);
  border: 1px solid color-mix(in oklab, var(--ok) 28%, var(--line));
  border-radius: 12px; margin-bottom: 22px;
}
.hx-public-banner-i {
  width: 40px; height: 40px; border-radius: 999px;
  display: grid; place-items: center; background: white;
  border: 1px solid color-mix(in oklab, var(--ok) 30%, var(--line));
}
.hx-public-row { display: flex; align-items: center; gap: 16px; padding: 12px 18px; border-top: 1px solid var(--line); }
.hx-public-row:first-child { border-top: 0; }
.hx-public-foot { display: flex; gap: 32px; margin-top: 32px; padding-top: 24px; border-top: 1px solid var(--line); }
.hx-public-sign { flex: 0 0 280px; text-align: right; }

.hx-doc {
  background: white; border: 1px solid var(--line); border-radius: 12px;
  box-shadow: var(--sh-2); padding: 36px 44px 28px; max-width: 820px; margin: 0 auto;
}
.hx-doc-h { display: flex; justify-content: space-between; align-items: flex-start; gap: 24px; padding-bottom: 18px; border-bottom: 2px solid var(--p-600); }
.hx-doc-panel-h {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 14px; background: var(--p-50);
  border: 1px solid var(--p-100); border-radius: 8px 8px 0 0; color: var(--p-700);
}
.hx-doc-table { width: 100%; border-collapse: collapse; border: 1px solid var(--p-100); border-top: 0; border-radius: 0 0 8px 8px; overflow: hidden; }
.hx-doc-table thead th { font-size: 10.5px; font-weight: 600; letter-spacing: 0.07em; text-transform: uppercase; color: var(--ink-3); padding: 8px 14px; background: var(--surface-2); border-bottom: 1px solid var(--line); text-align: left; }
.hx-doc-table tbody td { padding: 10px 14px; border-bottom: 1px solid var(--line); }
.hx-doc-table tbody tr:last-child td { border-bottom: 0; }
.hx-doc-f { display: flex; justify-content: space-between; align-items: flex-end; gap: 24px; margin-top: 36px; padding-top: 18px; border-top: 1px solid var(--line); }
.hx-sig-line { width: 220px; height: 1px; background: var(--ink); margin: 0 0 6px auto; }

.hx-gauge       { flex: 1; min-width: 160px; }
.hx-gauge-track { position: relative; height: 6px; border-radius: 3px; background: var(--surface-2); border: 1px solid var(--line); }
.hx-gauge-band  { position: absolute; top: -1px; bottom: -1px; background: color-mix(in oklab, var(--ok) 35%, transparent); border-radius: 3px; }
.hx-gauge-marker { position: absolute; top: -4px; width: 4px; height: 14px; background: var(--p-700); border-radius: 2px; transform: translateX(-50%); box-shadow: 0 0 0 2px white; }
.hx-gauge-labels { display: flex; justify-content: space-between; font-family: var(--f-mono); font-size: 10px; color: var(--ink-4); margin-top: 6px; }

/* ── animations ─────────────────────────────────────────────────────────── */
@keyframes hxFadeUp {
  from { opacity: 0; transform: translateY(28px); }
  to   { opacity: 1; transform: none; }
}
@keyframes hxFadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}
@keyframes hxSlideRight {
  from { opacity: 0; transform: translateX(36px); }
  to   { opacity: 1; transform: translateX(0); }
}

/* hero elements: CSS animation plays on load, no JS needed */
.hx-anim-fade-up    { animation: hxFadeUp    0.95s cubic-bezier(.22,.68,0,1.1) var(--anim-delay, 0s) both; }
.hx-anim-fade-in    { animation: hxFadeIn    1.3s  ease                        var(--anim-delay, 0s) both; }
.hx-anim-slide-right { animation: hxSlideRight 0.95s cubic-bezier(.22,.68,0,1.1) var(--anim-delay, 0s) both; }

/* scroll-triggered: JS IntersectionObserver adds .is-visible */
[data-anim] {
  opacity: 0;
  transform: translateY(22px);
  transition: opacity 0.8s ease, transform 0.8s cubic-bezier(.22,.68,0,1.1);
  transition-delay: var(--anim-delay, 0s);
}
[data-anim].is-visible { opacity: 1; transform: none; }

/* staggered grid children */
[data-anim-stagger] > * {
  opacity: 0;
  transform: translateY(18px);
  transition: opacity 0.72s ease, transform 0.72s cubic-bezier(.22,.68,0,1.1);
}
[data-anim-stagger].is-visible > * { opacity: 1; transform: none; }
[data-anim-stagger].is-visible > *:nth-child(1) { transition-delay: 0.00s; }
[data-anim-stagger].is-visible > *:nth-child(2) { transition-delay: 0.11s; }
[data-anim-stagger].is-visible > *:nth-child(3) { transition-delay: 0.22s; }
[data-anim-stagger].is-visible > *:nth-child(4) { transition-delay: 0.33s; }
[data-anim-stagger].is-visible > *:nth-child(5) { transition-delay: 0.44s; }
[data-anim-stagger].is-visible > *:nth-child(6) { transition-delay: 0.55s; }
[data-anim-stagger].is-visible > *:nth-child(7) { transition-delay: 0.66s; }
[data-anim-stagger].is-visible > *:nth-child(8) { transition-delay: 0.77s; }
/* After entrance plays, JS adds .anim-settled — drop the slow entrance
   transition (duration + delay) so hover uses the card's own fast .2s one. */
[data-anim-stagger].is-visible.anim-settled > * {
  transition: transform .2s cubic-bezier(.22,.68,0,1.1), box-shadow .2s ease, border-color .2s ease;
  transition-delay: 0s;
}

@media (prefers-reduced-motion: reduce) {
  .hx-anim-fade-up, .hx-anim-fade-in, .hx-anim-slide-right,
  [data-anim], [data-anim-stagger] > * {
    animation: none !important;
    transition: none !important;
    opacity: 1 !important;
    transform: none !important;
  }
}

/* reduced-motion nav rules scoped to mobile only — desktop nav must stay visible */
@media (max-width: 768px) and (prefers-reduced-motion: reduce) {
  .hx-landing-nav-links,
  .hx-landing-nav-links > a,
  .hx-mobile-menu-cta { transition: none !important; }
  .hx-landing-nav-links.is-open > a,
  .hx-landing-nav-links.is-open .hx-mobile-menu-cta {
    opacity: 1 !important; transform: none !important;
  }
}

@media (max-width: 900px) {
  .hx-hero  { grid-template-columns: 1fr; gap: 32px; }
}

/* ── landing grids (desktop base) ───────────────────────────────────────── */
.hx-landing-feat-grid    { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.hx-landing-flow-descs   { display: grid; grid-template-columns: repeat(4, 1fr); gap: 0; width: 100%; }
.hx-landing-pricing-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }

/* hamburger: hidden on desktop */
.hx-landing-nav-hamburger {
  display: none;
  background: none; border: 1px solid var(--line); cursor: pointer;
  color: var(--ink);
  width: 44px; height: 44px;
  border-radius: 10px;
  align-items: center; justify-content: center;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.hx-landing-nav-hamburger:hover { background: var(--surface-2); border-color: var(--p-200); color: var(--p-600); }
.hx-landing-nav-hamburger:active { transform: scale(0.96); }

/* mobile menu backdrop — only visible when menu open at mobile */
.hx-mobile-menu-backdrop {
  display: none;
  position: fixed; inset: 0;
  background: rgba(0, 0, 0, 0.42);
  z-index: 90;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.24s ease;
  /* NB: backdrop-filter intentionally omitted here — it applies even at opacity:0 */
}
.hx-mobile-menu-backdrop.is-open {
  opacity: 1;
  pointer-events: auto;
  -webkit-backdrop-filter: blur(3px);
  backdrop-filter: blur(3px);
}

/* mobile CTA block inside open menu — hidden on desktop */
.hx-mobile-menu-cta { display: none; }

/* ── tablet: 641–1024px ──────────────────────────────────────────────────── */
@media (max-width: 1024px) {
  .hx-landing-feat-grid    { grid-template-columns: repeat(2, 1fr); }
  .hx-landing-pricing-grid { grid-template-columns: 1fr; max-width: 440px; margin: 0 auto; }
  .hx-landing-flow-descs   { grid-template-columns: repeat(2, 1fr); }
  .hx-landing-flow-descs > div:nth-child(odd) { border-left: none !important; }
}

/* ── nav switches to mobile layout at ≤ 900px (aligned with hero stacking) ── */
@media (max-width: 900px) {
  /* nav */
  .hx-landing-nav { padding: 12px 20px; min-height: 64px; }
  .hx-landing-nav-ctas { display: none; }
  .hx-landing-nav-hamburger { display: inline-flex; }

  /* backdrop visible at mobile when menu open */
  .hx-mobile-menu-backdrop { display: block; }

  /* mobile menu panel: fixed-position (anchored to viewport, not parent) */
  .hx-landing-nav-links {
    display: flex; flex-direction: column; align-items: stretch;
    position: fixed;
    top: 64px; left: 0; right: 0;
    max-height: calc(100vh - 64px);
    overflow-y: auto;
    background: var(--surface);
    border-top: 1px solid var(--line);
    border-bottom: 1px solid var(--line);
    box-shadow: 0 24px 48px -16px rgba(20, 24, 40, 0.20);
    padding: 12px 20px 24px;
    gap: 0;
    z-index: 95;
    /* closed state */
    visibility: hidden;
    opacity: 0;
    transform: translateY(-12px);
    pointer-events: none;
    transition: opacity 0.24s ease,
                transform 0.28s cubic-bezier(.22,.68,0,1.1),
                visibility 0s linear 0.28s;
  }
  .hx-landing-nav-links.is-open {
    visibility: visible;
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
    transition: opacity 0.24s ease,
                transform 0.28s cubic-bezier(.22,.68,0,1.1),
                visibility 0s linear 0s;
  }

  /* link items */
  .hx-landing-nav-links > a {
    font-family: var(--f-serif);
    font-size: 17px; font-weight: 500;
    color: var(--ink); padding: 16px 4px;
    border-bottom: 1px solid var(--line);
    display: flex; align-items: center; justify-content: space-between;
    text-decoration: none;
    opacity: 0; transform: translateX(-10px);
    transition: opacity 0.20s ease, transform 0.20s ease, color 0.12s, padding-left 0.12s;
    letter-spacing: -0.005em;
  }
  .hx-landing-nav-links > a::after {
    content: "→";
    font-family: var(--f-sans);
    font-size: 14px; color: var(--ink-4);
    transition: color 0.12s, transform 0.15s ease;
  }
  .hx-landing-nav-links > a:hover {
    color: var(--p-600);
    padding-left: 6px;
  }
  .hx-landing-nav-links > a:hover::after {
    color: var(--p-600); transform: translateX(2px);
  }
  .hx-landing-nav-links.is-open > a:nth-child(1) { opacity:1; transform:none; transition-delay:0.06s; }
  .hx-landing-nav-links.is-open > a:nth-child(2) { opacity:1; transform:none; transition-delay:0.11s; }
  .hx-landing-nav-links.is-open > a:nth-child(3) { opacity:1; transform:none; transition-delay:0.16s; }
  .hx-landing-nav-links.is-open > a:nth-child(4) { opacity:1; transform:none; transition-delay:0.21s; }
  .hx-landing-nav-links.is-open > a:nth-child(5) { opacity:1; transform:none; transition-delay:0.26s; }
  .hx-mobile-menu-cta {
    display: block; padding-top: 20px;
    opacity: 0; transform: translateY(8px);
    transition: opacity 0.20s ease 0.28s, transform 0.20s ease 0.28s;
  }
  .hx-landing-nav-links.is-open .hx-mobile-menu-cta {
    opacity: 1; transform: none;
  }
  .hx-mobile-menu-cta .hx-btn {
    height: 48px; font-size: 15px; border-radius: 12px; font-weight: 600;
  }

  /* hero */
  .hx-hero { padding: 28px 20px 44px; }
  .hx-hero-sub { font-size: 15px; }
  .hx-hero-meta { gap: 16px; flex-wrap: wrap; }
  .hx-hero-meta > div { min-width: 72px; }

  /* sections */
  .hx-section { padding: 44px 20px; }
  .hx-section-title { font-size: 22px; }
  .hx-section .row.between { flex-direction: column; align-items: flex-start; gap: 8px; }

  /* features */
  .hx-landing-feat-grid { grid-template-columns: 1fr; }

  /* stepper: allow horizontal scroll on mobile */
  .hx-stepper { overflow-x: auto; padding-bottom: 8px; }
  .hx-step    { min-width: 90px; flex-shrink: 0; }
  .hx-step-lbl i { display: none; }
  .hx-step-bar   { min-width: 24px; flex-shrink: 0; }

  /* flow descriptions: stack vertically */
  .hx-landing-flow-descs { grid-template-columns: 1fr !important; overflow-x: visible; }
  .hx-landing-flow-descs > div { border-left: none !important; padding-left: 0 !important; }
  .hx-landing-flow-descs > div + div { border-top: 1px solid var(--line); margin-top: 4px; padding-top: 12px; }

  /* pricing */
  .hx-landing-pricing-grid { grid-template-columns: 1fr; max-width: 100%; }

  /* footer */
  .hx-landing-footer-inner { flex-direction: column !important; align-items: flex-start; gap: 20px; }
  .hx-landing-footer-links { flex-wrap: wrap !important; gap: 12px 20px !important; }

  /* hide decorative helix bg — causes overflow on narrow viewports */
  .hx-helix { display: none; }
}

/* ── small phones: ≤ 480px ───────────────────────────────────────────────── */
@media (max-width: 480px) {
  .hx-landing-nav { padding: 12px 16px; }
  .hx-hero        { padding: 20px 16px 32px; gap: 24px; }
  .hx-hero-sub    { font-size: 14px; margin-bottom: 20px; }
  .hx-hero-meta   { gap: 12px; margin-top: 24px; padding-top: 16px; }
  .hx-hero-meta b { font-size: 18px; }
  .hx-hero-actions .hx-btn { width: 100%; justify-content: center; }
  .hx-section     { padding: 32px 16px; }
  .hx-section-title { font-size: 20px; }
  .hx-verify      { padding: 16px 16px 14px; border-radius: 14px; }
  .hx-card        { padding: 16px !important; }

  /* shell topbar: shrink branch picker select */
  .hx-top .mud-input-control { min-width: 0 !important; max-width: 120px !important; }
  .hx-top .mud-select        { min-width: 0 !important; }
  /* content: tighter horizontal padding */
  .hx-content { padding-left: 14px !important; padding-right: 14px !important; }
}

/* ── app tables & toolbars (≤ 600px) ────────────────────────────────────── */
@media (max-width: 600px) {
  /* hx-tabs: scroll horizontally instead of wrapping/overflowing */
  .hx-tabs {
    overflow-x: auto;
    flex-wrap: nowrap !important;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }
  .hx-tabs::-webkit-scrollbar { display: none; }

  /* content: tighter horizontal padding on phones */
  .hx-content { padding-left: 12px !important; padding-right: 12px !important; }

  /* hx-toolbar: wrap rows, collapse grow spacer */
  .hx-toolbar { flex-wrap: wrap; gap: 8px; }
  .hx-toolbar .grow { display: none !important; }

  /* KPI grid: 2 columns, tighter spacing */
  .hx-kpi-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; margin-bottom: 20px; }
  .hx-kpi-val  { font-size: 24px; }

  /* hx-table-wrap: allow horizontal scroll; hide low-priority columns */
  .hx-table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .hx-table th:nth-child(3), .hx-table td:nth-child(3),
  .hx-table th:nth-child(5), .hx-table td:nth-child(5) { display: none; }

  /* dashboard: tighter gap */
  .hx-dashboard-grid { gap: 14px; }

  /* MudDataGrid toolbar:
     - allow height to expand so wrapped rows aren't clipped
     - kill inline min-width on every input so they can fill their row
     - hide MudSpacer so items align left when stacked                     */
  .mud-data-grid .mud-toolbar { height: auto !important; min-height: 52px !important; }
  .mud-data-grid .mud-toolbar .mud-spacer { display: none !important; }
  .mud-data-grid .mud-toolbar .mud-input-control {
    min-width: 0 !important;
    width: 100% !important;
    max-width: 100% !important;
  }
  /* ensure the toolbar inner flex div also wraps */
  .mud-data-grid .mud-toolbar > div { flex-wrap: wrap !important; gap: 8px !important; }

  /* MudDialog: near full-width on small screens */
  .mud-dialog-container .mud-dialog {
    width: calc(100vw - 24px) !important;
    max-width: calc(100vw - 24px) !important;
    margin: 12px !important;
    border-radius: var(--r-2) !important;
  }
}

@media (max-width: 840px) {
  .hx-public-hero { grid-template-columns: 1fr; }
  .hx-public-foot { flex-direction: column; }
  .hx-public-sign { text-align: left; }
  .hx-public-sign .hx-sig-line { margin: 0 0 6px; }
}

/* ── print ──────────────────────────────────────────────────────────────────── */
@media print {
  .hx-public-nav, .hx-hero-actions, .hx-icon-btn { display: none !important; }
  .hx-doc { box-shadow: none; border: none; padding: 0; }
  body { background: white; }
}
