/* ECI Inter variable font — loaded from ECI CDN (matches ECI Nexus AI Studio design system) */
@font-face {
  font-family: InterVariable;
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url("https://eci-webui.azureedge.net/components/preview/assets/fonts/Inter/InterVariable.woff2") format("woff2");
}
@font-face {
  font-family: InterVariable;
  font-style: italic;
  font-weight: 100 900;
  font-display: swap;
  src: url("https://eci-webui.azureedge.net/components/preview/assets/fonts/Inter/InterVariable-Italic.woff2") format("woff2");
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  /* ── Helix design tokens v2 (dark-first) — see docs/ui-style-guide.md ── */
  --font-size-root: 16px;
  font-size: var(--font-size-root);

  --font-size-xs: 0.75rem;     /* 12px — table headers, badges */
  --font-size-sm: 0.875rem;    /* 14px — labels, table cells */
  --font-size-md: 0.9375rem;   /* 15px — body, inputs, buttons */
  --font-size-lg: 1.0625rem;   /* 17px — card titles */
  --font-size-xl: 1.25rem;     /* 20px — section headings */
  --font-size-2xl: 1.5rem;     /* 24px — page titles */
  --font-size-3xl: 1.75rem;    /* 28px — hub hero */
  --font-size-compact: 0.875rem;

  --line-height-tight: 1.25;
  --line-height-normal: 1.5;
  --line-height-relaxed: 1.65;

  --font-weight-normal: 400;
  --font-weight-medium: 500;
  --font-weight-semibold: 600;
  --font-weight-bold: 700;

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

  --page-gutter: clamp(20px, 3.5vw, 36px);
  --layout-max-width: 1520px;

  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;
  --radius: var(--radius-md);

  --transition-normal: 0.2s ease;
  --transition-fast: 0.14s ease;

  --control-height-sm: 34px;
  --control-height-md: 40px;
  --control-height-lg: 48px;

  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.28), 0 0 1px rgba(255, 255, 255, 0.04);
  --shadow-md: 0 12px 40px rgba(0, 0, 0, 0.38), 0 4px 12px rgba(0, 0, 0, 0.22);
  --shadow-lg: 0 24px 64px rgba(0, 0, 0, 0.48), 0 8px 24px rgba(0, 0, 0, 0.28);
  --shadow-glow: 0 0 0 1px rgba(255, 255, 255, 0.06), 0 0 24px rgba(56, 142, 255, 0.08);
  --shadow-inset-highlight: inset 0 1px 0 rgba(255, 255, 255, 0.07);

  --glass-blur: 22px;
  --overlay-scrim: rgba(4, 8, 18, 0.78);

  /* ECI token bridge */
  --eci-font-family: "InterVariable", system-ui, -apple-system, "Segoe UI", sans-serif;
  --eci-font-family-mono: ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", monospace;
  --eci-font-size-base: 16px;
  --eci-border-radius-sm: 8px;
  --eci-border-radius-md: 12px;
  --eci-border-radius-input: 8px;
  --eci-border-radius-button: 8px;
  --eci-transition-normal: 0.18s;
  --eci-transition-fast: 0.12s;

  /* Brand (ECI red — logo/danger only, not global UI chrome) */
  --brand-color-primary: #F5333F;
  --brand-color-primary-dark: #c42a35;
  --brand-rgb: 245, 51, 63;

  /* Primary UI action — saturated blue for readable white button text */
  --action: #1e5aaf;
  --action-hover: #174f96;
  --action-rgb: 30, 90, 175;
  --action-text: #ffffff;
  --link: #6eb8ff;

  /* Legacy --accent alias → action (fixes product pages using var(--accent) for buttons/links) */
  --accent: var(--action);
  --accent-dark: var(--action-hover);
  --accent-rgb: var(--action-rgb);

  --success: #45c98a;
  --success-rgb: 69, 201, 138;
  --warning: #f0b429;
  --warning-rgb: 240, 180, 41;
  --danger: #f2555f;
  --danger-rgb: 242, 85, 95;
  --info: #6eb8ff;
  --info-rgb: 110, 184, 255;
  --header-ui: #7ec8ff;
  --header-ui-rgb: 126, 200, 255;

  --focus-ring: 0 0 0 3px rgba(var(--action-rgb), 0.38);

  /* Dark surfaces (default) */
  --surface-app: #060912;
  --surface-1: #101622;
  --surface-2: #161e2e;
  --surface-elevated: #1c2638;
  --surface-hover: rgba(126, 200, 255, 0.06);
  --border-subtle: rgba(255, 255, 255, 0.09);
  --border-strong: rgba(255, 255, 255, 0.16);
  --text-primary: #f3f6fb;
  --text-secondary: #b4bece;
  --text-muted: #7d8a9e;

  --glass-bg: rgba(22, 30, 46, 0.62);
  --glass-bg-strong: rgba(18, 26, 40, 0.88);
  --glass-border: rgba(255, 255, 255, 0.12);
  --glass-shadow: var(--shadow-md), var(--shadow-inset-highlight);

  --app-mesh-1: radial-gradient(ellipse 120% 90% at 8% -20%, rgba(56, 142, 255, 0.22), transparent 55%);
  --app-mesh-2: radial-gradient(ellipse 80% 60% at 92% 0%, rgba(99, 102, 241, 0.14), transparent 50%);
  --app-mesh-3: radial-gradient(ellipse 70% 50% at 50% 110%, rgba(30, 80, 160, 0.18), transparent 55%);
  --hero-gradient: linear-gradient(180deg, rgba(16, 22, 34, 0.9) 0%, transparent 100%);
  --ambient-glow: var(--app-mesh-1), var(--app-mesh-2), var(--app-mesh-3);

  /* Legacy aliases */
  --brand-color-black: var(--text-primary);
  --brand-color-gray: var(--text-muted);
  --brand-color-gray-dark: var(--text-secondary);
  --brand-color-gray-light: var(--border-subtle);
  --brand-color-white: var(--surface-app);
  --bg: var(--surface-app);
  --bg2: var(--surface-2);
  --surface: var(--surface-1);
  --surface2: var(--surface-2);
  --border: var(--border-subtle);
  --border-dark: var(--border-strong);
  --text: var(--text-primary);
  --text-body: var(--text-secondary);
}

/* Explicit light theme */
html[data-theme="light"] {
  --shadow-sm: 0 1px 3px rgba(15, 23, 42, 0.06);
  --shadow-md: 0 8px 24px rgba(15, 23, 42, 0.08);
  --shadow-lg: 0 16px 40px rgba(15, 23, 42, 0.12);
  --overlay-scrim: rgba(15, 23, 42, 0.45);

  --surface-app: #e8ecf2;
  --surface-1: #ffffff;
  --surface-2: #f3f5f9;
  --surface-elevated: #ffffff;
  --surface-hover: rgba(15, 23, 42, 0.04);
  --border-subtle: rgba(15, 23, 42, 0.1);
  --border-strong: rgba(15, 23, 42, 0.16);
  --text-primary: #1a1f2b;
  --text-secondary: #4a5568;
  --text-muted: #718096;

  --glass-bg: rgba(255, 255, 255, 0.78);
  --glass-bg-strong: rgba(255, 255, 255, 0.94);
  --glass-border: rgba(15, 23, 42, 0.1);
  --glass-shadow: var(--shadow-md);

  --app-mesh-1: radial-gradient(ellipse 100% 80% at 10% -20%, rgba(59, 130, 246, 0.12), transparent 55%);
  --app-mesh-2: radial-gradient(ellipse 70% 50% at 90% 0%, rgba(99, 102, 241, 0.08), transparent 50%);
  --app-mesh-3: none;
  --hero-gradient: linear-gradient(180deg, #ffffff 0%, var(--surface-app) 100%);
  --ambient-glow: var(--app-mesh-1), var(--app-mesh-2);
  --glass-shadow: var(--shadow-md), inset 0 1px 0 rgba(255, 255, 255, 0.65);

  --brand-color-black: var(--text-primary);
  --brand-color-gray: var(--text-muted);
  --brand-color-gray-dark: var(--text-secondary);
  --brand-color-gray-light: var(--border-subtle);
  --brand-color-white: #ffffff;
  --bg: var(--surface-app);
  --bg2: var(--surface-2);
  --surface: var(--surface-1);
  --surface2: var(--surface-2);
  --border: var(--border-subtle);
  --border-dark: var(--border-strong);
  --text: var(--text-primary);
  --text-body: var(--text-secondary);
}

/* Explicit dark (same as :root; keeps parity when ThemeManager sets data-theme) */
html[data-theme="dark"],
.eci-elements-app[data-theme="dark"] {
  color-scheme: dark;
}

html[data-theme="light"] {
  color-scheme: light;
}

/* ── Theme Toggle ────────────────────────────────────────── */
.theme-toggle {
  position: relative;
  width: 52px;
  height: 28px;
  background: var(--bg);
  border: 1px solid var(--border-dark);
  border-radius: 999px;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  align-items: center;
  padding: 3px;
  margin-left: 16px;
  flex-shrink: 0;
}

.theme-toggle:hover {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(var(--accent-rgb), 0.12);
}

.theme-toggle-track {
  position: absolute;
  inset: 3px;
  border-radius: 999px;
  overflow: hidden;
}

.theme-toggle-thumb {
  position: absolute;
  width: 20px;
  height: 20px;
  background: linear-gradient(135deg, #FFD93D 0%, #FF9500 100%);
  border-radius: 50%;
  top: 50%;
  left: 3px;
  transform: translateY(-50%);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 8px rgba(255, 149, 0, 0.4);
}

.theme-toggle-thumb svg {
  width: 12px;
  height: 12px;
  color: #fff;
  transition: all 0.3s;
}

.theme-toggle-thumb .icon-sun { display: block; }
.theme-toggle-thumb .icon-moon { display: none; }

[data-theme="dark"] .theme-toggle-thumb {
  left: calc(100% - 23px);
  background: linear-gradient(135deg, #58A6FF 0%, #A371F7 100%);
  box-shadow: 0 2px 8px rgba(88, 166, 255, 0.4);
}

[data-theme="dark"] .theme-toggle-thumb .icon-sun { display: none; }
[data-theme="dark"] .theme-toggle-thumb .icon-moon { display: block; }

[data-theme="dark"] .theme-toggle {
  background: var(--surface-2);
  border-color: var(--border-subtle);
}

/* ── Cloudflare Access profile (with hamburger in .header-tools) ─ */
.header-tools {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

/* Hub (no nav): push profile + menu to the right. Product pages: nav already uses margin-left: auto. */
header:not(:has(nav)) .header-tools {
  margin-left: auto;
}

.access-profile {
  position: relative;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 8px;
}

.access-profile-trigger {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1px solid rgba(var(--header-ui-rgb), 0.35);
  background: rgba(var(--header-ui-rgb), 0.1);
  color: var(--header-ui);
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-bold);
  letter-spacing: 0.02em;
  cursor: pointer;
  font-family: inherit;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: border-color 0.15s, background 0.15s;
}

.access-profile-trigger:hover {
  border-color: var(--header-ui);
  background: rgba(var(--header-ui-rgb), 0.18);
}

/* Grants or Approvals has something waiting; the menu row says which. */
.access-profile-trigger.is-pending {
  color: #fff;
  background: var(--danger);
  border-color: var(--danger);
}

.access-profile-trigger.is-pending:hover {
  background: var(--danger);
  border-color: var(--danger);
  filter: brightness(1.08);
}

.access-profile-dropdown {
  display: none;
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  min-width: min(340px, calc(100vw - 40px));
  max-width: 380px;
  max-height: min(70vh, 520px);
  overflow: auto;
  background: var(--glass-bg-strong);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-md);
  z-index: 200;
  padding: var(--space-4) var(--space-5);
}

@supports ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .access-profile-dropdown {
    backdrop-filter: blur(var(--glass-blur));
    -webkit-backdrop-filter: blur(var(--glass-blur));
  }
}

.access-profile-dropdown.open {
  display: block;
}

.access-profile-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.access-profile-name {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text);
  margin: 0 0 4px;
  line-height: 1.25;
}

.access-profile-email {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin: 0;
  word-break: break-all;
}

.access-profile-logout {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
  text-decoration: none;
  padding: 6px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  transition: color 0.15s, border-color 0.15s, background 0.15s;
}

.access-profile-logout:hover {
  color: var(--danger);
  border-color: rgba(220, 53, 69, 0.35);
  background: rgba(220, 53, 69, 0.06);
}

.access-profile-approvals {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 4px;
  border-top: 1px solid var(--border);
  padding-top: 12px;
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-semibold);
  color: var(--text);
  text-decoration: none;
}

.access-profile-approvals:hover {
  color: var(--accent);
}

.access-profile-waiting {
  display: inline-flex;
  align-items: center;
  height: 20px;
  padding: 0 8px;
  border-radius: 999px;
  background: var(--danger);
  color: #fff;
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-bold);
  letter-spacing: 0.02em;
}

.access-profile-waiting[hidden] {
  display: none;
}

/* UI change notices (helix-notices.js, docs/ui-notices.md) */
.helix-notice-overlay {
  z-index: 320;
  align-items: center;
}

.helix-notice-image {
  display: block;
  width: 100%;
  height: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
}

.modal-body .helix-notice-text {
  margin: 0;
  color: var(--text-primary);
}

.helix-notice-link {
  font-weight: var(--font-weight-semibold);
  color: var(--accent);
}

.helix-notice-footer {
  justify-content: space-between;
}

.helix-notice-dismiss {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: var(--font-size-sm);
  color: var(--text-muted);
  cursor: pointer;
}

.access-profile-groups {
  margin-top: 4px;
  border-top: 1px solid var(--border);
  padding-top: 12px;
}

.access-profile-groups summary {
  cursor: pointer;
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-semibold);
  color: var(--text-muted);
  list-style: none;
  display: flex;
  align-items: center;
  gap: 6px;
  user-select: none;
}

.access-profile-groups summary::-webkit-details-marker {
  display: none;
}

.access-profile-groups summary::after {
  content: '▾';
  font-size: 0.65rem;
  opacity: 0.7;
}

.access-profile-groups[open] summary::after {
  content: '▴';
}

.access-profile-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}

.access-profile-hint {
  margin: 0;
  flex: 1 1 100%;
  font-size: var(--font-size-xs);
  color: var(--text-muted);
  line-height: 1.5;
  font-weight: 400;
}

.access-group-pill {
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-medium);
  padding: var(--space-1) var(--space-3);
  border-radius: 999px;
  background: rgba(59, 130, 246, 0.12);
  color: #2563eb;
  border: 1px solid rgba(59, 130, 246, 0.28);
  max-width: 100%;
  word-break: break-word;
}

[data-theme='dark'] .access-group-pill {
  background: rgba(56, 139, 253, 0.14);
  color: #79b8ff;
  border-color: rgba(56, 139, 253, 0.35);
}

/* ── Hamburger Menu ─────────────────────────────────────────── */
.hamburger-menu {
  position: relative;
  margin-left: auto;
}

.header-tools .hamburger-menu {
  margin-left: 0;
}

.hamburger-btn {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 5px;
  width: 40px;
  height: 40px;
  background: none;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  cursor: pointer;
  padding: 8px;
  transition: all .2s;
}

.hamburger-btn:hover {
  background: rgba(var(--accent-rgb), 0.08);
  border-color: var(--border);
}

.hamburger-btn.open {
  background: var(--surface);
  border-color: var(--border);
}

.hamburger-line {
  width: 20px;
  height: 2px;
  background: var(--text-muted);
  border-radius: 2px;
  transition: all .25s ease;
}

.hamburger-btn:hover .hamburger-line,
.hamburger-btn.open .hamburger-line {
  background: var(--text-primary);
}

.hamburger-btn.open .hamburger-line:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}

.hamburger-btn.open .hamburger-line:nth-child(2) {
  opacity: 0;
  transform: scaleX(0);
}

.hamburger-btn.open .hamburger-line:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
}

.hamburger-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  min-width: 240px;
  max-width: min(320px, calc(100vw - 24px));
  max-height: min(70vh, calc(100vh - 72px));
  overflow: visible;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 8px 32px rgba(0,0,0,0.15);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-8px);
  transition: opacity .2s ease, visibility .2s ease, transform .2s ease;
  z-index: 1000;
}

.hamburger-dropdown.open {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

/* The button can wrap onto the left of the next header row. right: 0 then
   draws the panel off the left edge. align-viewport-start opens it the other way. */
.hamburger-dropdown.align-viewport-start {
  right: auto;
  left: 0;
}

.hamburger-dropdown-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  font-size: .9rem;
  font-weight: 500;
  color: var(--text);
  text-decoration: none;
  cursor: pointer;
  transition: background .15s;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
}

.hamburger-dropdown-item:hover {
  background: var(--surface-hover);
  color: var(--text-primary);
}

.hamburger-dropdown-item .menu-icon {
  font-size: 1.1rem;
  width: 20px;
  text-align: center;
  opacity: 0.8;
}

.hamburger-nav-group { position: relative; }
.hamburger-nav-group-btn::after {
  content: '';
  margin-left: auto;
  width: 6px;
  height: 6px;
  border-right: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor;
  transform: rotate(135deg);
  opacity: 0.55;
  flex-shrink: 0;
}
.hamburger-nav-sub {
  display: none;
  position: absolute;
  top: 0;
  right: 100%;
  margin-right: -6px;
  padding: 4px 6px 4px 4px;
  min-width: 220px;
  max-height: min(70vh, calc(100vh - 72px));
  overflow-y: auto;
  background: var(--surface-elevated);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  z-index: 1001;
}
.hamburger-nav-group:hover > .hamburger-nav-sub,
.hamburger-nav-group:focus-within > .hamburger-nav-sub,
.hamburger-nav-group.is-open > .hamburger-nav-sub { display: block; }
.hamburger-dropdown.flyout-end .hamburger-nav-sub {
  right: auto;
  left: 100%;
  margin-right: 0;
  margin-left: -6px;
}
.hamburger-dropdown.flyout-end .hamburger-nav-group-btn::after {
  transform: rotate(-45deg);
}
@media (max-width: 720px) {
  .hamburger-dropdown { overflow-y: auto; }
  .hamburger-nav-sub,
  .hamburger-dropdown.flyout-end .hamburger-nav-sub {
    position: static;
    left: auto;
    right: auto;
    margin: 0;
    max-height: none;
    border: 0;
    border-radius: 0;
    box-shadow: none;
    background: transparent;
    padding: 0 0 0 12px;
  }
  .hamburger-nav-group:hover > .hamburger-nav-sub,
  .hamburger-nav-group:focus-within > .hamburger-nav-sub { display: none; }
  .hamburger-nav-group.is-open > .hamburger-nav-sub { display: block; }
}

.hamburger-dropdown-heading {
  padding: 10px 16px 4px;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.hamburger-dropdown-item[aria-current="page"] {
  font-weight: 600;
  color: var(--text-primary);
}

.hamburger-dropdown-item.is-pending {
  color: var(--danger);
  font-weight: 700;
}

.hamburger-dropdown-divider {
  height: 1px;
  background: var(--border);
  margin: 4px 0;
}

.hamburger-dropdown-section {
  padding: 8px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.hamburger-dropdown-section .section-label {
  font-size: .8rem;
  font-weight: 500;
  color: var(--text-muted);
}

/* Theme toggle inside menu - smaller version */
.menu-theme-toggle {
  position: relative;
  width: 44px;
  height: 24px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 999px;
  cursor: pointer;
  padding: 2px;
  transition: all .25s;
}

.menu-theme-toggle:hover {
  border-color: var(--accent);
}

.menu-theme-toggle-thumb {
  position: absolute;
  width: 18px;
  height: 18px;
  background: linear-gradient(135deg, #FFD93D 0%, #FF9500 100%);
  border-radius: 50%;
  top: 50%;
  left: 2px;
  transform: translateY(-50%);
  transition: all .25s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 6px rgba(255, 149, 0, 0.35);
}

.menu-theme-toggle-thumb svg {
  width: 10px;
  height: 10px;
  color: #fff;
}

.menu-theme-toggle-thumb .icon-sun { display: block; }
.menu-theme-toggle-thumb .icon-moon { display: none; }

[data-theme="dark"] .menu-theme-toggle {
  background: var(--surface-2);
  border-color: var(--border-subtle);
}

[data-theme="dark"] .menu-theme-toggle-thumb {
  left: calc(100% - 20px);
  background: linear-gradient(135deg, #58A6FF 0%, #A371F7 100%);
  box-shadow: 0 2px 6px rgba(88, 166, 255, 0.35);
}

[data-theme="dark"] .menu-theme-toggle-thumb .icon-sun { display: none; }
[data-theme="dark"] .menu-theme-toggle-thumb .icon-moon { display: block; }


[data-theme="dark"] .hamburger-dropdown-item:hover {
  background: rgba(var(--accent-rgb), 0.12);
}

[data-theme="dark"] .hamburger-dropdown-divider {
  background: #21262D;
}

body,
.eci-elements-app {
  font-family: var(--eci-font-family);
  font-feature-settings: "cv02", "cv03", "cv04", "cv11";
  font-size: var(--font-size-md);
  background-color: var(--surface-app);
  background-image: var(--ambient-glow);
  background-attachment: fixed;
  color: var(--text-secondary);
  min-height: 100vh;
  overflow-x: clip;
  max-width: 100%;
  font-weight: var(--font-weight-normal);
  line-height: var(--line-height-normal);
}

html {
  overflow-x: clip;
  max-width: 100%;
}

.app-shell main {
  position: relative;
  z-index: 1;
}

/* ── Glass surfaces ─────────────────────────────────────── */
.glass-panel,
.glass-card,
.glass-nav {
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  box-shadow: var(--glass-shadow);
  position: relative;
}

@supports ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .glass-panel,
  .glass-card,
  .glass-nav {
    backdrop-filter: blur(var(--glass-blur));
    -webkit-backdrop-filter: blur(var(--glass-blur));
  }
}

@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .glass-panel,
  .glass-card,
  .glass-nav {
    background: var(--glass-bg-strong);
  }
}

.glass-card {
  border-radius: var(--radius-md);
  transition: transform var(--transition-normal), box-shadow var(--transition-normal), border-color var(--transition-normal);
}

.glass-card:hover {
  border-color: var(--border-strong);
  box-shadow: var(--shadow-lg);
  transform: translateY(-2px);
}

/* ── Header ─────────────────────────────────────────────── */
header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--glass-bg-strong);
  border-bottom: 1px solid var(--glass-border);
  box-shadow: var(--shadow-sm);
  padding: 0 var(--page-gutter);
  min-height: 72px;
  height: auto;
  display: flex;
  align-items: center;
  gap: var(--space-6);
  flex-wrap: wrap;
  row-gap: var(--space-3);
  box-shadow: var(--shadow-md), var(--shadow-inset-highlight);
}

@supports ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  header {
    backdrop-filter: blur(var(--glass-blur));
    -webkit-backdrop-filter: blur(var(--glass-blur));
  }
}

.brand {
  display: flex; align-items: center; gap: 12px;
  text-decoration: none;
  min-width: 0;
}

.brand-icon {
  width: auto;
  min-width: 40px;
  max-width: 220px;
  height: 44px;
  background: transparent;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: #fff;
  font-size: var(--font-size-md);
  font-weight: var(--font-weight-bold);
  overflow: hidden;
  padding: 0 var(--space-1);
}

.brand-icon img {
  height: 100%;
  width: auto;
  max-width: 100%;
  object-fit: contain;
  object-position: left center;
  border-radius: var(--radius-sm);
  display: block;
}

/* The Helix mark is a white monochrome silhouette, so on the light theme's pale header it
   is all but invisible. Invert it to black rather than ship a second image for the page:
   a filter cannot fall out of step with the asset, and it applies on first paint so the
   logo never flashes white before a script gets to it. The favicon cannot use this - the
   browser draws it outside the document - so that one is swapped by href in ThemeManager.
   Scoped away from body[data-product], where .brand-icon holds the product's own logo and
   inverting it would wreck the colours. */
html[data-theme="light"] body:not([data-product]) .brand-icon img {
  filter: invert(1);
}

/* ECI horizontal wordmarks — white pill (Horizon, Spruce, DDMS) */
body[data-product] .brand-icon {
  min-width: 130px;
  max-width: 220px;
  height: 44px;
  background: #ffffff;
  border: 1px solid rgba(255, 255, 255, 0.9);
  border-radius: var(--radius-lg);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.14);
  padding: var(--space-2) var(--space-3);
}

/* Product Links uses a drawn mark, not the white Helix silhouette. */
body[data-product="links"] .brand-icon {
  min-width: 44px;
  width: 44px;
  max-width: 44px;
  padding: 4px;
}

body[data-product="links"] .brand-icon .links-mark {
  width: 36px;
  height: 36px;
  display: block;
}

.brand-text {
  display: flex; flex-direction: column; line-height: 1;
  min-width: 0;
}

.brand-name {
  font-size: var(--font-size-lg);
  font-weight: var(--font-weight-bold);
  letter-spacing: 0.01em;
  color: var(--text-primary);
}

.brand-sub {
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-semibold);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-top: 2px;
}

.back-link {
  margin-left: auto;
  color: var(--text-muted);
  text-decoration: none;
  font-size: .85rem;
  font-weight: 500;
  padding: 7px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  transition: all .18s;
}

.back-link:hover {
  background: var(--surface-hover);
  color: var(--text-primary);
  border-color: var(--border-strong);
}

/* ── Navigation tabs ──────────────────────────────────────── */
nav {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-1);
  row-gap: var(--space-2);
  margin-left: auto;
  justify-content: flex-end;
  max-width: 100%;
  padding: var(--space-1);
  border-radius: var(--radius-lg);
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-subtle);
}

/* `display:flex` above outranks the user agent's [hidden]{display:none}, so any nav set
   hidden in script stayed on screen as an empty bordered strip. The mobile product-nav
   host is built on every page and left hidden above 768px, which is how this showed up
   under the header everywhere. Same trap as .hub-toolbar, .hz-cm-action-btn and
   .helix-iam-edit-banner; scoped to the element rule that causes it rather than to that
   one host, because the next hidden nav would hit it too. */
nav[hidden] {
  display: none;
}

nav button {
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-muted);
  padding: var(--space-2) var(--space-4);
  border-radius: var(--radius-md);
  cursor: pointer;
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-medium);
  font-family: inherit;
  min-height: var(--control-height-sm);
  transition: background var(--transition-normal), color var(--transition-normal), border-color var(--transition-normal), box-shadow var(--transition-normal);
  letter-spacing: 0.01em;
}

nav button:hover {
  background: var(--surface-hover);
  color: var(--text-primary);
  border-color: var(--border-subtle);
}

nav button.active {
  background: rgba(var(--action-rgb), 0.12);
  border-color: rgba(var(--action-rgb), 0.2);
  color: var(--text-primary);
  font-weight: var(--font-weight-semibold);
  box-shadow: inset 0 -3px 0 var(--action), var(--shadow-inset-highlight);
}

/* ── Main layout ────────────────────────────────────────── */
main {
  padding: var(--space-7) var(--page-gutter);
  max-width: var(--layout-max-width);
  margin: 0 auto;
  width: 100%;
  min-width: 0;
  box-sizing: border-box;
}

.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* ── Page title ─────────────────────────────────────────── */
.page-title {
  font-size: var(--font-size-2xl);
  font-weight: var(--font-weight-bold);
  margin-bottom: var(--space-5);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-3);
  letter-spacing: -0.02em;
  color: var(--text-primary);
  min-width: 0;
  line-height: var(--line-height-tight);
}

.count-badge {
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-bold);
  background: var(--surface-2);
  border: 1px solid var(--border-strong);
  color: var(--text-secondary);
  padding: var(--space-1) var(--space-4);
  border-radius: 999px;
  letter-spacing: 0.03em;
}

/* Horizon inventory-cache preview: hover title carries served_from detail */
.count-badge.hz-inv-live {
  cursor: help;
}
.count-badge.hz-inv-cache {
  cursor: help;
  border-color: var(--accent, #2a6f97);
  color: var(--accent, #2a6f97);
}

/* ── Filter bar ─────────────────────────────────────────── */
.filters {
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  padding: var(--space-6);
  margin-bottom: var(--space-6);
  box-shadow: var(--glass-shadow);
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-5);
  align-items: flex-end;
  max-width: 100%;
  min-width: 0;
}

/* display:flex outranks the user-agent [hidden] rule, so a closed filter bar stays visible. */
.filters[hidden] {
  display: none !important;
}

@supports ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .filters {
    backdrop-filter: blur(var(--glass-blur));
    -webkit-backdrop-filter: blur(var(--glass-blur));
  }
}

.filter-group {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  min-width: 168px;
}

/* Script publish: same baseline as other filter bars. Do not use .search-box
   here — its flex-basis is a toolbar width and becomes a tall field inside
   a column .filter-group, which drops Product, File, and Upload off the line. */
.scripts-publish .filter-group {
  flex: 1 1 12rem;
  max-width: 22rem;
  min-width: 0;
}
.scripts-publish .filter-group select,
.scripts-publish .filter-group input[type="text"],
.scripts-publish .filter-group input[type="file"] {
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}
.scripts-publish input[type="file"] {
  min-height: var(--control-height-md);
  padding: 6px 8px;
  background: var(--surface-1);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-size: var(--font-size-sm);
  font-family: inherit;
}
.scripts-publish input[type="file"]::file-selector-button {
  margin-right: var(--space-3);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  color: var(--text-primary);
  font: inherit;
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-semibold);
  padding: 4px 10px;
  cursor: pointer;
}
.scripts-publish > .btn {
  flex: 0 0 auto;
}
.filter-group[hidden] {
  display: none !important;
}

.filter-group label {
  font-size: var(--font-size-sm);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  font-weight: var(--font-weight-semibold);
}

.filter-group select,
.filter-group input[type="text"],
.filter-group input[type="search"],
.filter-group input[type="number"],
.filter-group input[type="datetime-local"],
.filter-group input[type="date"],
.filter-group input[type="time"] {
  -webkit-appearance: none;
  appearance: none;
  background: var(--surface-1);
  border: 1px solid var(--border-strong);
  color: var(--text-primary);
  border-radius: var(--radius-md);
  padding: var(--space-2) var(--space-3);
  font-size: var(--font-size-md);
  min-height: var(--control-height-md);
  font-family: inherit;
  outline: none;
  transition: border-color var(--transition-normal), box-shadow var(--transition-normal);
  background-clip: padding-box;
  box-sizing: border-box;
}

.filter-group input[type="datetime-local"],
.filter-group input[type="date"],
.filter-group input[type="time"] {
  min-height: 2.5rem;
}

.filter-group select:focus,
.filter-group input[type="text"]:focus,
.filter-group input[type="search"]:focus,
.filter-group input[type="number"]:focus,
.filter-group input[type="datetime-local"]:focus,
.filter-group input[type="date"]:focus,
.filter-group input[type="time"]:focus {
  border-color: var(--accent);
  box-shadow: var(--focus-ring);
}

.filter-group select:focus-visible,
.filter-group input:focus-visible,
.btn:focus-visible,
nav button:focus-visible,
.customer-card:focus-visible,
.hamburger-btn:focus-visible,
.access-profile-trigger:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
}

.filter-group input[type="text"]::placeholder,
.filter-group input[type="search"]::placeholder {
  color: var(--text-muted);
  opacity: 1;
}

/* Scrollable suggest — inline on mobile (pushes content), overlay on desktop. */
.helix-suggest {
  position: relative;
  display: block;
  width: 100%;
  min-width: 0;
}
.helix-suggest > input {
  width: 100%;
  box-sizing: border-box;
}
.filter-group > .helix-suggest {
  width: 100%;
}
.helix-suggest-menu {
  position: static;
  display: block;
  width: 100%;
  margin-top: var(--space-2);
  max-height: min(16rem, 40dvh);
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  background: var(--surface-1);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  box-shadow: none;
  padding: var(--space-1);
  box-sizing: border-box;
  z-index: auto;
}
.helix-suggest-menu[hidden] {
  display: none !important;
}
.helix-suggest-option {
  display: flex;
  align-items: center;
  width: 100%;
  margin: 0;
  padding: var(--space-2) var(--space-3);
  min-height: 44px;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-primary);
  font: inherit;
  font-size: 1rem; /* ≥16px — avoids iOS focus zoom */
  text-align: left;
  cursor: pointer;
}
.helix-suggest-option:hover,
.helix-suggest-option:focus-visible {
  background: var(--surface-hover);
  outline: none;
}
.helix-suggest-option span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.helix-suggest-option .helix-suggest-hint {
  margin-left: auto;
  padding-left: var(--space-3);
  flex-shrink: 0;
  font-size: var(--font-size-sm);
  color: var(--text-muted);
}
.helix-suggest-empty,
.helix-suggest-more {
  padding: var(--space-2) var(--space-3);
  font-size: var(--font-size-sm);
  color: var(--text-muted);
}

/* Desktop: floating overlay under the field (does not grow the filter card). */
@media (min-width: 769px) {
  .helix-suggest-menu {
    position: absolute;
    left: 0;
    right: 0;
    top: calc(100% + 4px);
    margin-top: 0;
    z-index: 60;
    max-height: min(20rem, 45vh);
    box-shadow: var(--shadow-md);
  }
  /* .filters blurs its backdrop, which makes it a stacking context: the menu's z-index
     cannot reach past the card painted after it unless the whole bar rises. */
  .filters:has(.helix-suggest.is-open) {
    position: relative;
    z-index: 20;
  }
  .helix-suggest-option {
    min-height: var(--control-height-md);
    font-size: var(--font-size-md);
  }
}

/* WebKit: search fields ignore some inherited styles unless appearance is reset */
.filter-group input[type="search"]::-webkit-search-decoration,
.filter-group input[type="search"]::-webkit-search-cancel-button,
.filter-group input[type="search"]::-webkit-search-results-button {
  -webkit-appearance: none;
  appearance: none;
}

/* HTML5 date/time: match UI font and control chrome to the rest of the form */
.filter-group input[type="datetime-local"]::-webkit-datetime-edit,
.filter-group input[type="datetime-local"]::-webkit-datetime-edit-fields-wrapper,
.filter-group input[type="datetime-local"]::-webkit-datetime-edit-text,
.filter-group input[type="datetime-local"]::-webkit-datetime-edit-month-field,
.filter-group input[type="datetime-local"]::-webkit-datetime-edit-day-field,
.filter-group input[type="datetime-local"]::-webkit-datetime-edit-year-field,
.filter-group input[type="datetime-local"]::-webkit-datetime-edit-hour-field,
.filter-group input[type="datetime-local"]::-webkit-datetime-edit-minute-field,
.filter-group input[type="datetime-local"]::-webkit-datetime-edit-ampm-field {
  font-family: inherit;
  color: inherit;
  padding: 0 1px;
}
.filter-group input[type="datetime-local"]::-webkit-calendar-picker-indicator,
.filter-group input[type="date"]::-webkit-calendar-picker-indicator {
  cursor: pointer;
  opacity: 0.55;
  filter: none;
}
.filter-group input[type="datetime-local"]::-webkit-calendar-picker-indicator:hover,
.filter-group input[type="date"]::-webkit-calendar-picker-indicator:hover {
  opacity: 0.9;
}

.filter-group select option { background: var(--surface); color: var(--text); }

.toggle-group { display: flex; flex-direction: column; gap: 6px; }

.toggle-group label.heading {
  font-size: var(--font-size-xs);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  font-weight: var(--font-weight-semibold);
}

.toggles { display: flex; flex-wrap: wrap; gap: 8px; }

.toggle-chip {
  display: flex; align-items: center; gap: 7px;
  background: var(--surface-2);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  padding: var(--space-2) var(--space-3); cursor: pointer;
  font-size: var(--font-size-sm); font-weight: var(--font-weight-medium);
  font-family: inherit;
  transition: all .18s; user-select: none;
  color: var(--text-muted);
}

.toggle-chip input[type="checkbox"] { display: none; }

.toggle-chip:hover { background: var(--surface-hover); color: var(--text-primary); border-color: var(--border-strong); }

.toggle-chip.checked {
  background: rgba(var(--action-rgb), 0.1);
  border-color: rgba(var(--action-rgb), 0.32);
  color: var(--text-primary);
  font-weight: var(--font-weight-semibold);
}

/* Structured customer query bar (helix-query.js) */
.filter-group.helix-query-group {
  flex: 1 1 100%;
  min-width: 0;
}
#tab-customers > .filters {
  position: relative;
  z-index: 20;
  padding: var(--space-3) var(--space-4);
  gap: var(--space-3);
  margin-bottom: var(--space-4);
}
#tab-customers > .filters .filter-group {
  min-width: 132px;
}
#tab-customers > .filters .filter-group:first-child {
  min-width: 176px;
  flex: 1 1 176px;
}
#btn-customer-advanced-search[aria-expanded="true"] {
  border-color: rgba(var(--action-rgb), 0.45);
  background: rgba(var(--action-rgb), 0.1);
  color: var(--text-primary);
}
.helix-query-bar {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  width: 100%;
}
.helix-query-chips {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}
.helix-query-chip {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  background: rgba(var(--action-rgb), 0.1);
  border: 1px solid rgba(var(--action-rgb), 0.32);
  border-radius: var(--radius-sm);
  padding: var(--space-1) var(--space-2) var(--space-1) var(--space-3);
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-semibold);
  font-family: inherit;
  color: var(--text-primary);
}
.helix-query-chip-remove {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.25rem;
  height: 1.25rem;
  padding: 0;
  border: none;
  border-radius: 999px;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  font: inherit;
  line-height: 1;
}
.helix-query-chip-remove:hover {
  color: var(--text-primary);
  background: var(--surface-hover);
}
.helix-query-error {
  margin: 0;
  font-size: var(--font-size-sm);
  color: var(--danger);
}
.helix-query-add {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  align-items: center;
}
.helix-query-add select,
.helix-query-add input {
  min-width: 7rem;
}
.helix-query-add [hidden],
.helix-query-chips[hidden],
.helix-query-error[hidden] {
  display: none !important;
}

/* ── Buttons ────────────────────────────────────────────── */
.btn {
  background: linear-gradient(180deg, var(--action) 0%, var(--action-hover) 100%);
  color: var(--action-text);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: var(--radius-md);
  padding: var(--space-2) var(--space-6);
  font-size: var(--font-size-md);
  font-weight: var(--font-weight-semibold);
  min-height: var(--control-height-md);
  font-family: inherit;
  cursor: pointer;
  transition: filter var(--transition-normal), box-shadow var(--transition-normal), transform var(--transition-fast);
  box-shadow: 0 4px 16px rgba(var(--action-rgb), 0.32), var(--shadow-inset-highlight);
  letter-spacing: 0.01em;
}

.btn:hover { filter: brightness(1.06); box-shadow: 0 6px 22px rgba(var(--action-rgb), 0.38), var(--shadow-inset-highlight); }
.btn:active { filter: brightness(0.96); transform: translateY(1px); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; box-shadow: none; filter: grayscale(0.2); }

.helix-back-to-top {
  position: fixed;
  left: max(1.25rem, env(safe-area-inset-left, 0px));
  bottom: max(1.25rem, env(safe-area-inset-bottom, 0px));
  z-index: 90;
}

.helix-back-to-top[hidden] {
  display: none !important;
}

.btn-danger {
  background: linear-gradient(180deg, var(--danger) 0%, #d93a48 100%);
  box-shadow: 0 4px 16px rgba(var(--danger-rgb), 0.28), var(--shadow-inset-highlight);
}
.btn-danger:hover { box-shadow: 0 6px 22px rgba(var(--danger-rgb), 0.36), var(--shadow-inset-highlight); }

.btn-ghost {
  background: transparent;
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  box-shadow: none;
}
.btn-ghost:hover {
  background: var(--surface-hover);
  color: var(--text-primary);
  border-color: var(--border-strong);
  box-shadow: none;
  filter: none;
}

.btn-secondary {
  background: var(--surface-2);
  border: 1px solid var(--border-strong);
  color: var(--text-secondary);
  border-radius: var(--radius-sm);
  padding: var(--space-2) var(--space-4);
  font-size: var(--font-size-md);
  font-weight: var(--font-weight-medium);
  min-height: var(--control-height-md);
  font-family: inherit;
  cursor: pointer;
  transition: background var(--transition-normal), color var(--transition-normal), border-color var(--transition-normal);
}
.btn-secondary:hover { background: var(--surface-hover); color: var(--text-primary); }

.btn-action {
  background: var(--surface-2);
  border: 1px solid var(--border-strong);
  color: var(--text-primary);
  border-radius: var(--radius-sm);
  padding: var(--space-2) var(--space-3);
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-semibold);
  min-height: var(--control-height-sm);
  font-family: inherit;
  cursor: pointer;
  white-space: nowrap;
  transition: all var(--transition-fast);
}
.btn-action:hover {
  background: var(--surface-hover);
  border-color: rgba(var(--action-rgb), 0.35);
  color: var(--link);
  box-shadow: var(--shadow-sm);
}

.btn-sm {
  background: var(--surface-2);
  border: 1px solid var(--border-strong);
  color: var(--text-primary);
  border-radius: var(--radius-sm);
  padding: var(--space-2) var(--space-3);
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-semibold);
  min-height: var(--control-height-sm);
  font-family: inherit;
  cursor: pointer;
  white-space: nowrap;
  transition: all var(--transition-fast);
  flex-shrink: 0;
}
.btn-sm:hover {
  background: var(--surface-hover);
  border-color: rgba(var(--action-rgb), 0.35);
  color: var(--link);
}

.btn-rdp {
  background: rgba(var(--success-rgb), 0.12);
  border: 1px solid rgba(var(--success-rgb), 0.3);
  color: var(--success);
  border-radius: var(--radius-sm);
  padding: var(--space-2) var(--space-3);
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-bold);
  min-height: var(--control-height-sm);
  font-family: inherit; cursor: pointer;
  transition: all .15s;
  white-space: nowrap;
}
.btn-rdp:hover {
  background: rgba(45,155,90,.18);
  border-color: var(--success);
  box-shadow: 0 2px 10px rgba(45,155,90,.2);
}

/* ── Table card (premium data grid) ─────────────────────── */
.table-wrap {
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--glass-shadow);
  display: flex;
  flex-direction: column;
  max-height: calc(100vh - 200px);
  min-width: 0;
  max-width: 100%;
}

@supports ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .table-wrap {
    backdrop-filter: blur(var(--glass-blur));
    -webkit-backdrop-filter: blur(var(--glass-blur));
  }
}

.table-toolbar {
  padding: var(--space-4) var(--space-5);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-4);
  border-bottom: 1px solid var(--border-subtle);
  background: rgba(255, 255, 255, 0.02);
  position: sticky;
  top: 0;
  z-index: 10;
  flex-shrink: 0;
  min-width: 0;
}

.table-toolbar > span {
  min-width: 0;
  flex: 1 1 auto;
  text-align: right;
  white-space: normal;
}

/* Auto-refresh freshness label (common/helix-live.js) */
.helix-live {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--font-size-xs);
  color: var(--text-muted);
  white-space: nowrap;
}

.helix-live-btn {
  background: none;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  cursor: pointer;
  font: inherit;
  line-height: 1.5;
  padding: 0 var(--space-2);
}

.helix-live-btn:hover,
.helix-live-btn:focus-visible {
  color: var(--text-primary);
  border-color: var(--action);
}

.helix-live--error .helix-live-age { color: var(--warning); }

.helix-live--busy .helix-live-btn { animation: helix-live-spin 1s linear infinite; }

@keyframes helix-live-spin { to { transform: rotate(360deg); } }

@media (prefers-reduced-motion: reduce) {
  .helix-live--busy .helix-live-btn { animation: none; opacity: 0.6; }
}

.search-box {
  background: var(--surface-1);
  border: 1px solid var(--border-strong);
  color: var(--text-primary);
  border-radius: var(--radius-md);
  padding: var(--space-2) var(--space-4);
  font-size: var(--font-size-md);
  min-height: var(--control-height-md);
  font-family: inherit;
  outline: none;
  flex: 1 1 240px;
  min-width: 0;
  max-width: 360px;
  width: 100%;
  transition: border-color var(--transition-normal), box-shadow var(--transition-normal);
}

.search-box:focus {
  border-color: var(--action);
  box-shadow: var(--focus-ring);
}

.search-box::placeholder { color: var(--text-muted); }

/* Clearable search — hover/focus × on the right (utils.js helixInitClearableSearch) */
.helix-search-wrap {
  position: relative;
  display: block;
  min-width: 0;
  box-sizing: border-box;
}
.helix-search-wrap--box {
  display: flex;
  align-items: center;
  flex: 1 1 240px;
  min-width: 0;
  max-width: 360px;
  width: 100%;
}
.helix-search-wrap--box > .search-box {
  flex: 1 1 auto;
  max-width: none;
  width: 100%;
  min-width: 0;
}
.helix-search-wrap--admin {
  display: inline-block;
  width: min(280px, 100%);
  max-width: 100%;
}
.helix-search-wrap--admin > .search-input {
  width: 100%;
  max-width: none;
}
.filter-group > .helix-search-wrap {
  width: 100%;
}
.svc-picker-wrap > .helix-search-wrap {
  width: 100%;
  margin-bottom: 10px;
}
.svc-picker-wrap > .helix-search-wrap > input[type="search"] {
  margin-bottom: 0;
}
.helix-search-wrap > input,
.lookup-input-wrap.helix-search-wrap > input {
  padding-right: 2.1rem;
}
/* The × is positioned against the wrapper, so the field has to *be* the wrapper —
   any difference between the two is a button that lands somewhere other than inside
   the field. The --box and --admin variants already size their own input and the
   global-search lookup manages its own width; a bare input in a filter group was the
   one case nothing covered, which is why the × sat 45px inside the Spruce field and
   430px to the right of the RockSolid one. Same shape as `.helix-suggest > input`. */
.helix-search-wrap:not(.lookup-input-wrap) > input {
  width: 100%;
  box-sizing: border-box;
}
.lookup-input-wrap.helix-search-wrap > #global-search {
  padding-right: 2.75rem;
}
.helix-search-clear {
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  z-index: 2;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.5rem;
  height: 1.5rem;
  padding: 0;
  margin: 0;
  border: none;
  border-radius: 999px;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition-fast), color var(--transition-fast), background var(--transition-fast);
}
.lookup-input-wrap.helix-search-wrap > .helix-search-clear {
  right: 14px;
}
.helix-search-clear.is-visible {
  opacity: 1;
  pointer-events: auto;
}
.helix-search-clear:hover {
  color: var(--text-primary);
  background: rgba(128, 128, 128, 0.16);
}
.helix-search-clear:focus-visible {
  opacity: 1;
  pointer-events: auto;
  outline: none;
  box-shadow: var(--focus-ring);
  color: var(--text-primary);
}

.table-scroll {
  overflow-y: auto;
  overflow-x: auto;
  flex: 1;
  min-width: 0;
  max-width: 100%;
  -webkit-overflow-scrolling: touch;
}

/* The pager bounds a paged table's height, so it grows with the page and uses the
   page scrollbar instead of a second one inside the card. */
.table-wrap.page-flow { max-height: none; }
.table-wrap.page-flow > .table-scroll { flex: none; }

table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: var(--font-size-sm);
}

thead tr {
  background: var(--surface-2);
}

thead th {
  position: sticky;
  top: 0;
  z-index: 9;
  background: var(--surface-2);
  box-shadow: 0 1px 0 var(--border-subtle);
}

th {
  text-align: left;
  padding: var(--space-3) var(--space-5);
  font-size: var(--font-size-xs);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  font-weight: var(--font-weight-bold);
  white-space: nowrap;
  cursor: pointer;
  user-select: none;
  transition: color var(--transition-fast), background var(--transition-fast);
  border-bottom: 1px solid var(--border-subtle);
}

th:hover { color: var(--text-primary); background: var(--surface-hover); }
th .si { margin-left: var(--space-1); opacity: 0.45; font-size: var(--font-size-xs); }
th.sort-asc .si, th.sort-desc .si { opacity: 1; color: var(--action); }

td {
  padding: var(--space-3) var(--space-4);
  border-bottom: 1px solid var(--border-subtle);
  vertical-align: middle;
  color: var(--text-secondary);
  line-height: var(--line-height-normal);
}

td.cell-nowrap,
td[data-nowrap],
.table-scroll td.nowrap {
  white-space: nowrap;
  max-width: none;
}

#storage-app th:not([data-col]) { cursor: default; }
#storage-app td.storage-actions { white-space: nowrap; }

td.cell-truncate {
  max-width: 280px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

tr { transition: background var(--transition-fast); }
tr:hover td { background: rgba(var(--action-rgb), 0.05); }
tr:last-child td { border-bottom: none; }

table input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--action);
  cursor: pointer;
  vertical-align: middle;
}

/* ── Tags / status badges ───────────────────────────────── */
.tag {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-1) var(--space-3);
  border-radius: 999px;
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-bold);
  letter-spacing: 0.03em;
  line-height: 1.3;
  white-space: nowrap;
}

.tag::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  flex-shrink: 0;
}

.tag-green  { background: rgba(var(--success-rgb), 0.12); color: var(--success); border: 1px solid rgba(var(--success-rgb), 0.28); }
.tag-green::before  { background: var(--success); }
.tag-red    { background: rgba(var(--danger-rgb), 0.12); color: var(--danger); border: 1px solid rgba(var(--danger-rgb), 0.28); }
.tag-red::before    { background: var(--danger); }
.tag-yellow { background: rgba(var(--warning-rgb), 0.12); color: var(--warning); border: 1px solid rgba(var(--warning-rgb), 0.28); }
.tag-yellow::before { background: var(--warning); }
.tag-blue   { background: rgba(var(--info-rgb), 0.12); color: var(--info); border: 1px solid rgba(var(--info-rgb), 0.28); }
.tag-blue::before { background: var(--info); }
.tag-grey   { background: var(--surface-2); color: var(--text-muted); border: 1px solid var(--border-subtle); }
.tag-grey::before { background: var(--text-muted); }

/* ── Pagination ─────────────────────────────────────────── */
.pagination {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-4) var(--space-5);
  border-top: 1px solid var(--border-subtle);
  font-size: var(--font-size-sm);
  color: var(--text-muted);
  background: rgba(255, 255, 255, 0.02);
  min-width: 0;
}

.pagination button {
  background: var(--surface-1);
  border: 1px solid var(--border-strong);
  color: var(--text-secondary);
  border-radius: var(--radius-sm);
  padding: var(--space-2) var(--space-4);
  min-height: var(--control-height-sm);
  cursor: pointer;
  font-size: var(--font-size-sm);
  font-family: inherit;
  font-weight: var(--font-weight-medium);
  transition: all var(--transition-fast);
}

.pagination button:hover:not(:disabled) {
  border-color: rgba(var(--action-rgb), 0.4);
  color: var(--link);
  background: rgba(var(--action-rgb), 0.06);
}

.pagination button:disabled { opacity: 0.45; cursor: not-allowed; }
.pagination .page-info { margin: 0 var(--space-2); font-size: var(--font-size-sm); }

.pagination select {
  background: var(--surface-1);
  border: 1px solid var(--border-strong);
  color: var(--text-secondary);
  border-radius: var(--radius-sm);
  padding: var(--space-2) var(--space-3);
  font-size: var(--font-size-sm);
  min-height: var(--control-height-sm);
  font-family: inherit;
  outline: none;
}

/* ── State messages ─────────────────────────────────────── */
.state-msg {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  justify-content: center;
  padding: 64px 20px;
  color: var(--text-muted);
  gap: 14px;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  box-sizing: border-box;
  text-align: center;
}

.state-msg .icon {
  font-size: 2.2rem;
  opacity: .35;
  align-self: center;
}
.state-msg p {
  font-size: .88rem;
  margin: 0 auto;
  width: 100%;
  max-width: 36rem;
  min-width: 0;
  box-sizing: border-box;
  white-space: normal;
  overflow-wrap: break-word;
  word-break: normal;
}

.spinner {
  width: 30px; height: 30px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin .7s linear infinite;
}

.spinner-sm {
  width: 14px;
  height: 14px;
  border-width: 2px;
  display: inline-block;
  vertical-align: middle;
}

.kv-loading {
  display: inline-flex;
  align-items: center;
  min-height: 1.1em;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ── Customer grid ──────────────────────────────────────── */
.customer-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(352px, 1fr));
  gap: var(--space-3);
}

.customer-alpha-jump {
  /* Vertical contacts-style rail — sticky beside the customer cards (not
     fixed to the viewport edge, where FABs cover 0–9 / A–Z). */
  position: sticky;
  top: calc(72px + 1rem);
  z-index: 45;
  display: flex;
  flex-direction: column;
  flex-wrap: nowrap;
  align-items: center;
  justify-content: center;
  gap: 0;
  margin: 0;
  padding: 12px 5px;
  max-height: min(78vh, 680px);
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: none;
  -ms-overflow-style: none;
  border: 1px solid var(--glass-border);
  border-radius: 999px;
  background: color-mix(in srgb, var(--glass-bg-strong, var(--surface-1)) 88%, transparent);
  box-shadow: var(--shadow-md);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.customer-alpha-jump::-webkit-scrollbar {
  display: none;
}

.customer-alpha-jump[hidden] {
  display: none !important;
}

/* Desktop: directory fills the search/filters width (3–5 card columns);
   A–Z rail sits in-flow on the right so FABs no longer cover it.
   Only when .active — bare #tab-customers.has-alpha-rail { display:flex }
   outranked .tab-panel { display:none } and left Customers stuck on other tabs.
   DOM order is nav then directory — order swaps them visually. */
#tab-customers.has-alpha-rail.active {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  column-gap: var(--space-3);
  padding-right: 0;
}

#tab-customers.has-alpha-rail > .page-title,
#tab-customers.has-alpha-rail > .filters {
  flex: 1 1 100%;
}

#tab-customers.has-alpha-rail > .customer-directory {
  order: 1;
  flex: 1 1 0;
  min-width: 0;
  width: auto;
  max-width: none;
}

#tab-customers.has-alpha-rail > .customer-alpha-jump {
  order: 2;
  flex: 0 0 auto;
  align-self: flex-start;
  /* Leave the FAB stack (calendar / feedback / IAM / inventory) clear */
  max-height: min(78vh, calc(100vh - 72px - 1rem - 240px));
}

.customer-alpha-btn {
  min-width: 1.35rem;
  width: 1.35rem;
  height: 1.05rem;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 999px;
  background: transparent;
  color: var(--text-muted);
  font-size: 0.62rem;
  font-weight: var(--font-weight-bold);
  letter-spacing: 0.02em;
  line-height: 1;
  cursor: pointer;
  transition: color 0.12s ease, background 0.12s ease, transform 0.12s ease;
}

.customer-alpha-btn:hover:not(:disabled) {
  color: var(--text-primary);
  background: var(--surface-2);
  border-color: var(--border-subtle);
  transform: scale(1.18);
}

.customer-alpha-btn:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
  color: var(--accent);
}

.customer-alpha-btn:disabled {
  opacity: 0.22;
  cursor: default;
}

.customer-letter-section {
  margin-top: var(--space-8);
  /* Clear sticky product header (~72px) so A/B/C titles stay visible after jump */
  scroll-margin-top: calc(72px + 1.75rem);
}

.customer-letter-section:first-child {
  margin-top: 0;
}

.customer-letter-heading {
  margin: 0 0 var(--space-4);
  padding-bottom: var(--space-2);
  border-bottom: 1px solid var(--border-subtle);
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-bold);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.customer-directory .customer-card {
  min-height: 0;
  padding: var(--space-4) var(--space-5);
  align-items: center;
}

/* ── View toggle (Tiles / List) ─────────────────────────────────────────── */
.view-toggle {
  display: inline-flex;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  overflow: hidden;
  background: var(--surface-1);
  min-height: var(--control-height-md);
  box-sizing: border-box;
}
.view-toggle-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: var(--space-2) var(--space-3);
  font-size: var(--font-size-md);
  font-weight: var(--font-weight-medium);
  color: var(--text-muted);
  background: transparent;
  border: none;
  cursor: pointer;
  transition: background var(--transition-fast), color var(--transition-fast);
}
.view-toggle-btn + .view-toggle-btn { border-left: 1px solid var(--border-strong); }
.view-toggle-btn:hover { color: var(--text-primary); background: var(--glass-bg-strong); }
.view-toggle-btn.is-active {
  color: #fff;
  background: var(--accent);
}
.view-toggle-icon { font-size: 1rem; line-height: 1; }

/* ── Customer list view ─────────────────────────────────────────────────── */
.customer-list {
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: var(--glass-bg);
  box-shadow: var(--glass-shadow);
}
.customer-list-head,
.customer-list-row {
  display: grid;
  grid-template-columns: minmax(0, 2.2fr) 80px minmax(0, 0.85fr) minmax(0, 0.85fr) minmax(0, 1.3fr);
  align-items: center;
  gap: var(--space-4);
  padding: 10px var(--space-4);
}
.customer-list-head {
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-semibold);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  background: var(--glass-bg-strong);
  border-bottom: 1px solid var(--glass-border);
}
.customer-list-row {
  cursor: pointer;
  border-bottom: 1px solid var(--border-subtle);
  transition: background var(--transition-fast);
  font-size: var(--font-size-sm);
  color: var(--text-primary);
}
.customer-list-row:last-child { border-bottom: none; }
.customer-list-row:hover { background: var(--glass-bg-strong); }
.customer-list-row:focus-visible {
  outline: none;
  background: var(--glass-bg-strong);
  box-shadow: inset 0 0 0 2px var(--accent);
}
.customer-list-name {
  font-weight: var(--font-weight-semibold);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.customer-prod-tag {
  display: inline-block;
  padding: 2px 8px;
  border-radius: var(--radius-full, 999px);
  font-size: .7rem;
  font-weight: 700;
  letter-spacing: .04em;
  color: #fff;
}
/* Three columns, for a page whose customers are all one product and report no seats —
   RockSolid Classic. Declared beside the five-column default so the two stay in step
   instead of that page carrying its own copy of the grid. */
.customer-list--compact .customer-list-head,
.customer-list--compact .customer-list-row {
  grid-template-columns: minmax(0, 2.4fr) minmax(0, 0.9fr) minmax(0, 1.4fr);
}

@media (max-width: 720px) {
  .customer-list:not(.customer-list--compact) .customer-list-head,
  .customer-list:not(.customer-list--compact) .customer-list-row {
    grid-template-columns: minmax(0, 2fr) 60px minmax(0, 1fr) minmax(0, 1fr);
  }
  .customer-list:not(.customer-list--compact) .customer-list-head span:nth-child(5),
  .customer-list:not(.customer-list--compact) .customer-list-row span:nth-child(5) { display: none; }
  /* Compact has nothing to drop — three columns already fit. */
  .customer-list--compact .customer-list-head,
  .customer-list--compact .customer-list-row {
    grid-template-columns: minmax(0, 1.8fr) minmax(0, 0.7fr) minmax(0, 1.1fr);
  }
}

.customer-card {
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  padding: var(--space-5);
  cursor: pointer;
  transition: transform var(--transition-normal), box-shadow var(--transition-normal), border-color var(--transition-normal), background var(--transition-normal);
  display: flex;
  align-items: flex-start;
  gap: var(--space-4);
  box-shadow: var(--glass-shadow);
  min-height: 72px;
}

@supports ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .customer-card {
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
  }
}

/* Avatar + name block grows; trailing actions (e.g. vault) stay on the right */
.customer-card-main {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: flex-start;
  gap: 14px;
}

.customer-card-main > .customer-name {
  flex: 1;
  min-width: 0;
}

.customer-card > .btn-sm {
  flex-shrink: 0;
  align-self: flex-start;
}

.customer-card:hover {
  border-color: var(--sys-accent, var(--border-strong));
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  background: var(--glass-bg-strong);
}

.customer-card:focus-visible {
  border-color: var(--accent);
  box-shadow: var(--focus-ring), var(--shadow-md);
}

.customer-avatar {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  border: 1px solid var(--border-subtle);
  color: var(--text-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: var(--font-weight-bold);
  font-size: var(--font-size-md);
  flex-shrink: 0;
}

/* Product tile — the icon fills the avatar instead of two letters on a colour.
   The three icons do not agree about their own corners (Spruce and RSMax carry
   transparency, RockSolid Classic carries black), so the tile clips to its own radius
   and the artwork is scaled just past the edge rather than trusted to end where the
   tile does. Everything else about the box is unchanged, so the card still lines up. */
.customer-avatar--tile {
  padding: 0;
  overflow: hidden;
}

.customer-avatar--tile img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transform: scale(1.08);
  display: block;
}

.customer-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.customer-name {
  font-size: var(--font-size-lg);
  font-weight: var(--font-weight-semibold);
  color: var(--text-primary);
  overflow-wrap: anywhere;
  word-break: break-word;
  line-height: var(--line-height-normal);
}

.tenant-badge {
  display: inline-flex !important;
  align-items: center;
  gap: var(--space-1);
  font-size: var(--font-size-xs) !important;
  font-weight: var(--font-weight-bold) !important;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: var(--space-1) var(--space-3);
  border-radius: 999px; white-space: nowrap; flex-shrink: 0;
}
.tenant-badge.dedicated {
  background: rgba(45,155,90,.18) !important;
  color: #4ade80 !important;
  border: 1px solid rgba(45,155,90,.4) !important;
}
.tenant-badge.shared {
  background: rgba(59,130,246,.15) !important;
  color: #60a5fa !important;
  border: 1px solid rgba(59,130,246,.35) !important;
}
.tenant-badge.unknown {
  background: rgba(140,140,140,.12) !important;
  color: #6b7280 !important;
  border: 1px solid rgba(140,140,140,.25) !important;
}

.customer-meta {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--font-size-sm);
  color: var(--text-muted);
  flex-wrap: nowrap;
  min-width: 0;
}

.customer-meta .customer-user-count,
.customer-meta .customer-seat-count {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  padding: 1px 8px;
  background: var(--surface-2);
  border: 1px solid var(--border-subtle);
  border-radius: 999px;
  font-weight: var(--font-weight-medium);
  font-size: var(--font-size-sm);
  color: var(--text-secondary);
  white-space: nowrap;
  flex-shrink: 0;
}

.customer-meta .customer-user-count.loading,
.customer-meta .customer-seat-count.is-empty {
  opacity: 0.5;
}

/* ── Detail drawer ──────────────────────────────────────── */
.drawer-overlay {
  position: fixed; inset: 0;
  background: var(--overlay-scrim);
  z-index: 200; display: none;
}

.drawer-overlay.open { display: block; }

.drawer {
  position: fixed; right: 0; top: 0; bottom: 0;
  width: max-content; min-width: 560px; max-width: 95vw;
  background: var(--glass-bg-strong);
  border-left: 1px solid var(--glass-border);
  z-index: 201; display: flex; flex-direction: column;
  overflow: hidden;
  transform: translateX(100%);
  transition: transform .28s cubic-bezier(.4,0,.2,1);
  box-shadow: var(--shadow-lg);
}

@supports ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .drawer {
    backdrop-filter: blur(var(--glass-blur));
    -webkit-backdrop-filter: blur(var(--glass-blur));
  }
}

.drawer.open { transform: translateX(0); }

.drawer-header {
  padding: 18px 22px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center;
  justify-content: space-between; flex-shrink: 0;
  min-width: 0;
  background: var(--bg2);
}

.drawer-title {
  font-weight: var(--font-weight-bold);
  font-size: var(--font-size-xl);
  letter-spacing: -0.02em;
  color: var(--text-primary);
}

.drawer-close {
  background: var(--surface); border: 1px solid var(--border-dark);
  color: var(--text-muted); cursor: pointer;
  font-size: .9rem; padding: 5px 9px;
  border-radius: var(--radius-sm); transition: all .15s;
  font-family: inherit;
}

.drawer-close:hover { background: var(--surface-hover); border-color: var(--border-strong); color: var(--text-primary); }

.drawer-body {
  flex: 1;
  min-width: 0;
  min-height: 0;
  overflow: auto;
  padding: var(--space-6);
  font-size: var(--font-size-md);
  line-height: var(--line-height-normal);
  color: var(--text-secondary);
}

.drawer-body::-webkit-scrollbar { width: 5px; }
.drawer-body::-webkit-scrollbar-track { background: transparent; }
.drawer-body::-webkit-scrollbar-thumb { background: var(--border-dark); border-radius: 10px; }

.kv-grid {
  display: grid; grid-template-columns: 1fr 1fr;
  gap: 1px; background: var(--border);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm); overflow: hidden;
}

.kv-item { background: var(--surface); padding: 10px 14px; transition: background .12s; }
.kv-item:hover { background: var(--bg2); }
.kv-key {
  font-size: var(--font-size-sm);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  margin-bottom: var(--space-1);
  font-weight: var(--font-weight-semibold);
}
.kv-val {
  font-size: var(--font-size-md);
  word-break: break-word;
  overflow-wrap: anywhere;
  color: var(--text-primary);
  line-height: var(--line-height-normal);
}
.kv-val.kv-val-missing { color: var(--text-muted); font-style: italic; }

.section-label {
  font-size: var(--font-size-sm);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  margin: var(--space-6) 0 var(--space-3);
  font-weight: var(--font-weight-bold);
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.section-label::after {
  content: '';
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, var(--border-strong), transparent);
}

/* ── Modal ─────────────────────────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0;
  background: var(--overlay-scrim);
  z-index: 300; display: none;
  align-items: flex-start;
  justify-content: center;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  padding: max(16px, env(safe-area-inset-top)) 12px max(20px, env(safe-area-inset-bottom));
  box-sizing: border-box;
}
.modal-overlay.open { display: flex; }

.modal {
  background: var(--glass-bg-strong);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  width: min(520px, calc(100vw - 32px));
  max-width: min(96vw, 100%);
  max-height: min(92vh, calc(100vh - 32px));
  margin: auto 0;
  box-shadow: var(--shadow-lg);
  display: none;
  flex-direction: column;
  overflow: hidden;
  min-height: 0;
  animation: modalIn .22s cubic-bezier(.4,0,.2,1);
}

/* Content-rich dialogs (customer hub, stations, hosting summary, PS Forms) */
.modal.wide {
  width: min(680px, calc(100vw - 32px));
}

@media (min-width: 1100px) {
  .modal.wide {
    width: min(760px, calc(100vw - 48px));
  }
}

@media (min-width: 1400px) {
  .modal.wide {
    width: min(820px, calc(100vw - 64px));
  }
}

/* Table-heavy dialogs (event logs, TS health, portal details, PS Forms builder) */
.modal.wide-xl {
  width: min(820px, calc(100vw - 32px));
}

@media (min-width: 1100px) {
  .modal.wide-xl {
    width: min(900px, calc(100vw - 48px));
  }
}

@media (min-width: 1400px) {
  .modal.wide-xl {
    width: min(960px, calc(100vw - 64px));
  }
}

/* Dialogs whose tables carry full UNC paths and SMB errors (template cache) */
.modal.wide-2xl {
  width: min(960px, calc(100vw - 32px));
}

@media (min-width: 1100px) {
  .modal.wide-2xl {
    width: min(1100px, calc(100vw - 48px));
  }
}

@media (min-width: 1400px) {
  .modal.wide-2xl {
    width: min(1280px, calc(100vw - 64px));
  }
}

/* Compact confirms and simple forms */
.modal.narrow {
  width: min(560px, calc(100vw - 32px));
}

.modal.narrow-sm {
  width: min(480px, calc(100vw - 32px));
}

.modal.modal-tall {
  max-height: min(92vh, calc(100vh - 32px));
}

.modal-overlay .modal.modal-tall,
.modal-overlay .modal.modal-flex {
  display: flex;
  flex-direction: column;
}

.modal-flex {
  display: flex;
  flex-direction: column;
}

.modal.wide .server-hub-kv {
  display: grid;
  grid-template-columns: minmax(130px, 36%) 1fr;
  align-items: start;
  gap: var(--space-3) var(--space-4);
}

.modal.wide .server-hub-v,
.modal.wide .server-hub-v-wrap {
  text-align: left;
  min-width: 0;
}

.modal.wide .server-hub-v-wrap {
  justify-content: flex-start;
}

/* Nested modal (child of overlay) */
.modal-overlay .modal { display: flex; }

/* Sibling modal (empty overlay + following .modal.open — Spruce customer/user dialogs) */
.modal-overlay.open:empty { display: block; }
.modal-overlay.open:empty ~ .modal.open {
  display: flex;
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 301;
  margin: 0;
  max-height: min(92vh, calc(100vh - 32px));
}

@keyframes modalIn {
  from { opacity: 0; transform: translateY(-14px) scale(.98); }
  to   { opacity: 1; transform: none; }
}

.modal-header {
  padding: 18px 22px 14px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: flex-start; justify-content: space-between;
  background: var(--bg2);
  border-radius: var(--radius) var(--radius) 0 0;
  flex-shrink: 0;
}

.modal-header-text { display: flex; flex-direction: column; gap: var(--space-1); }
.modal-title {
  font-weight: var(--font-weight-bold);
  font-size: var(--font-size-xl);
  letter-spacing: -0.02em;
  color: var(--text-primary);
  line-height: var(--line-height-tight);
}
.modal-subtitle {
  font-size: var(--font-size-md);
  color: var(--text-muted);
  font-family: var(--eci-font-family-mono);
  line-height: var(--line-height-normal);
  word-break: break-all;
  overflow-wrap: anywhere;
}

.modal-close {
  background: var(--surface); border: 1px solid var(--border-dark);
  color: var(--text-muted); cursor: pointer;
  font-size: .9rem; padding: 5px 9px;
  border-radius: var(--radius-sm); transition: all .15s; font-family: inherit; flex-shrink: 0;
}
.modal-close:hover { background: var(--surface-hover); border-color: var(--border-strong); color: var(--text-primary); }

.modal-body {
  padding: var(--space-6) var(--space-6);
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior: contain;
  font-size: var(--font-size-md);
  line-height: var(--line-height-normal);
  color: var(--text-secondary);
}

/* Modal subtitle alias (Spruce/DDMS legacy class) */
.modal-sub {
  font-size: var(--font-size-md);
  color: var(--text-muted);
  font-family: var(--eci-font-family-mono);
  margin-top: var(--space-1);
  line-height: var(--line-height-normal);
  word-break: break-all;
  overflow-wrap: anywhere;
}

/* ── Modal body typography (14px labels / 15px values) ── */
.modal-body label,
.drawer-body label {
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-semibold);
  color: var(--text-muted);
}

.modal-body label.hz-cm-action-btn,
.modal-body label.svc-picker-row,
.modal-body label.eventlog-machine-chip,
.modal-body label.apppool-table tr,
.modal-body .hz-cm-action-btn,
.drawer-body label.hz-cm-action-btn { font-size: inherit; font-weight: inherit; color: inherit; }

.modal-body input:not([type="checkbox"]):not([type="radio"]),
.modal-body select,
.modal-body textarea,
.drawer-body input:not([type="checkbox"]):not([type="radio"]),
.drawer-body select,
.drawer-body textarea {
  font-size: var(--font-size-md);
  font-family: inherit;
}

.modal-body table,
.drawer-body table { font-size: var(--font-size-md); }

.modal-body table th,
.drawer-body table th,
.modal-body .modal-table th {
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-semibold);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
}

.modal-body table td,
.drawer-body table td,
.modal-body .modal-table td {
  font-size: var(--font-size-md);
  color: var(--text-primary);
}

.modal-body code,
.drawer-body code {
  font-size: var(--font-size-sm);
  font-family: var(--eci-font-family-mono);
}

.modal-body p,
.modal-body li,
.drawer-body p,
.drawer-body li {
  font-size: inherit;
  line-height: var(--line-height-normal);
}

.modal-section-head,
.modal-body .section-label--inline {
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-bold);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  padding-bottom: var(--space-2);
  border-bottom: 1px solid var(--border-subtle);
}

.modal-confirm {
  margin: calc(-1 * var(--space-2)) 0 0;
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-md);
  border: 1px solid rgba(var(--danger-rgb), 0.3);
  background: rgba(var(--danger-rgb), 0.07);
  font-size: var(--font-size-md);
  color: var(--text-primary);
  line-height: var(--line-height-normal);
}

.modal-confirm-actions {
  display: flex;
  gap: var(--space-2);
  margin-top: var(--space-2);
}

.modal-hint,
.modal-body .modal-hint,
.drawer-body .modal-hint {
  font-size: var(--font-size-sm);
  color: var(--text-muted);
  line-height: var(--line-height-normal);
}

.modal-field-label {
  display: block;
  margin-bottom: 4px;
  font-size: var(--font-size-sm);
  color: var(--text-muted);
}

.modal-empty,
.modal-body .modal-empty {
  padding: var(--space-4) 0;
  font-size: var(--font-size-sm);
  color: var(--text-muted);
}

.modal-panel-head {
  padding: var(--space-3) var(--space-4);
  background: var(--surface-2);
  font-size: var(--font-size-md);
  font-weight: var(--font-weight-semibold);
  border-bottom: 1px solid var(--border-subtle);
}

.modal-pre,
.modal-body pre,
.drawer-body pre {
  margin: var(--space-2) 0 0;
  padding: var(--space-3) var(--space-4);
  font-family: var(--eci-font-family-mono);
  font-size: var(--font-size-sm);
  background: var(--surface-2);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  white-space: pre-wrap;
  word-break: break-word;
  color: var(--text-primary);
}

/* A revealed RDS credential with per-user lines: label, password, reset date, Copy. */
.modal-pre .cred-line {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: 2px 0;
  white-space: normal;
}

.modal-pre .cred-line-label {
  min-width: 7rem;
  color: var(--text-muted);
}

.modal-pre .cred-line-note {
  color: var(--text-muted);
  font-size: var(--font-size-xs);
}

.modal-pre .cred-line-copy {
  margin-left: auto;
  font-size: .72rem;
  padding: 2px 8px;
}

.modal-fields-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-4) var(--space-5);
}

.modal-field { display: flex; flex-direction: column; gap: var(--space-2); }
.modal-field.span-2 { grid-column: 1 / -1; }

.modal-field label {
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-semibold);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
}

.modal-field input,
.modal-field select,
.modal-field textarea {
  padding: var(--space-2) var(--space-3);
  font-size: var(--font-size-md);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  background: var(--surface-1);
  color: var(--text-primary);
  font-family: inherit;
  width: 100%;
  box-sizing: border-box;
}

.modal-field textarea {
  min-height: 4.5rem;
  resize: vertical;
  font-family: var(--eci-font-family-mono);
  font-size: var(--font-size-sm);
}

.modal-field .hint {
  font-size: var(--font-size-sm);
  color: var(--text-muted);
  margin-top: var(--space-1);
}

@media (max-width: 600px) {
  .modal-fields-grid { grid-template-columns: 1fr; }
}

/* Services panel (customer modal) */
.modal-body .services-title {
  font-size: var(--font-size-md);
  font-weight: var(--font-weight-bold);
  color: var(--text-primary);
}

.modal-body .services-server {
  font-size: var(--font-size-sm);
  color: var(--text-muted);
  font-family: var(--eci-font-family-mono);
}

.modal-body .service-name { font-size: var(--font-size-sm); }
.modal-body .service-status { font-size: var(--font-size-xs); }
.modal-body .services-loading,
.modal-body .services-result { font-size: var(--font-size-sm); }
.modal-body .svc-check-name { font-size: var(--font-size-sm); }
.modal-body .svc-check-display { font-size: var(--font-size-sm); }

/* App pool modal */
.modal-body .apppool-table { font-size: var(--font-size-md); }
.modal-body .apppool-table th { font-size: var(--font-size-sm); }
.modal-body .restart-result { font-size: var(--font-size-sm); line-height: var(--line-height-normal); }

/* User info / hosting panels */
.modal-body .user-info-label { font-size: var(--font-size-sm); }
.modal-body .user-info-value { font-size: var(--font-size-md); }
.modal-body .users-hosting-meta { font-size: var(--font-size-sm); color: var(--text-muted); font-family: var(--eci-font-family-mono); word-break: break-all; }
.modal-body .users-hosting-miss,
.modal-body .users-hosting-warn { font-size: var(--font-size-sm); }
.modal-body .users-hosting-panel h3 { font-size: var(--font-size-md); font-weight: var(--font-weight-semibold); }

/* Event log modal */
.modal-body .eventlog-machine-chip { font-size: var(--font-size-sm); }
.modal-body .eventlog-job-row { font-size: var(--font-size-md); }
.modal-body .eventlog-progress { font-size: var(--font-size-sm); }
.modal-body .eventlog-job-row .btn-dl { font-size: var(--font-size-sm); }

/* Capture modal */
.modal-body .capture-progress,
.modal-body .capture-success,
.modal-body .capture-error { font-size: var(--font-size-md); }
.modal-body .btn-download { font-size: var(--font-size-md); }

/* PS Forms modals */
.modal-body .psform-field-help,
.modal-body .psforms-output-label,
.modal-body .psforms-script-label { font-size: var(--font-size-sm); color: var(--text-muted); }
.modal-body .psforms-output,
.modal-body .psforms-script-area { font-size: var(--font-size-sm); font-family: var(--eci-font-family-mono); }
.modal-body .psforms-run-status { font-size: var(--font-size-md); }
.modal-body .psforms-run-duration { font-size: var(--font-size-sm); }

/* Service picker / restart modal */
.modal-body .svc-picker-row-name { font-size: var(--font-size-md); }
.modal-body .svc-picker-empty { font-size: var(--font-size-sm); }
.modal-body .result-detail { font-size: var(--font-size-sm); opacity: 0.9; }

.modal-body .action-text { font-size: var(--font-size-md); }

.modal-body .action-section-title,
.modal-body .password-result-title {
  font-size: var(--font-size-sm);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: var(--font-weight-semibold);
}

.modal-body .action-section-title { color: var(--text-muted); margin-bottom: var(--space-2); }
.modal-body .password-result-title { color: var(--success); margin-bottom: var(--space-2); }

.modal-body .users-hosting-panel {
  font-size: var(--font-size-md);
  line-height: var(--line-height-normal);
}

.modal-body .password-value {
  font-size: var(--font-size-md);
  font-family: var(--eci-font-family-mono);
}

.modal-body .modal-section-head {
  font-size: var(--font-size-sm);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  font-weight: var(--font-weight-semibold);
}

.modal-body .db-params-loading,
.modal-body .db-params-error,
.modal-body .move-step { font-size: var(--font-size-sm); }

/* Shared modal metadata rows (customer / server / user dialogs) */
.server-hub-meta {
  display: flex;
  flex-direction: column;
  gap: 0;
  font-size: var(--font-size-md);
  margin-bottom: var(--space-2);
}

.server-hub-kv {
  display: flex;
  justify-content: space-between;
  gap: var(--space-4);
  align-items: flex-start;
  padding: var(--space-2) 0;
  border-bottom: 1px solid var(--border-subtle);
}

.server-hub-kv:last-child { border-bottom: none; }

.server-hub-k {
  margin: 0;
  color: var(--text-muted);
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-medium);
  flex-shrink: 0;
}
.server-hub-k[title] {
  cursor: help;
  text-decoration: underline dotted;
  text-decoration-color: color-mix(in srgb, var(--text-muted) 50%, transparent);
  text-underline-offset: 2px;
}

/* Labels proportional, values monospace — the face follows the column, not the row.
   Every value in these panels is something you copy, compare or paste: an ID, host,
   IP, URL, version or count. Choosing per row is what left the Spruce overview
   monospacing the SQL cluster IP but not the database name directly beside it, so
   there is no per-row choice to get wrong. */
.server-hub-v {
  margin: 0;
  text-align: right;
  word-break: break-word;
  overflow-wrap: anywhere;
  font-family: var(--eci-font-family-mono);
  font-size: var(--font-size-sm);
  color: var(--text-primary);
  line-height: var(--line-height-normal);
}

/* Pills and badges are labels the UI picked, not values read off a box, so they keep
   the proportional face. Badges set their own size and weight but not family, so
   without this they inherit the monospace above. Matched on the class name rather
   than a hand-kept list, so a new badge does not quietly turn up monospaced. */
.server-hub-v [class*="badge"],
.server-hub-v [class*="pill"],
.server-hub-v .tag,
.server-hub-v .server-probe {
  font-family: var(--eci-font-family);
}

.server-hub-v a {
  color: var(--link);
  text-decoration: none;
}

.server-hub-v a:hover { text-decoration: underline; }

.server-hub-v-wrap,
.field-copy-wrap,
.kv-val-wrap {
  display: inline-flex;
  align-items: flex-start;
  justify-content: flex-end;
  gap: var(--space-1);
  max-width: 100%;
  text-align: right;
}

.field-copy-wrap {
  width: 100%;
  justify-content: space-between;
  gap: var(--space-2);
}

.field-copy-wrap .modal-section-value {
  flex: 1;
  min-width: 0;
}

.kv-val-wrap {
  justify-content: space-between;
  gap: var(--space-2);
}

.kv-val-wrap .kv-val {
  flex: 1;
  min-width: 0;
}

.server-hub-title-row {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  flex-wrap: wrap;
  row-gap: var(--space-2);
}

.server-hub-title-row .modal-title { margin: 0; }

.portal-section-title {
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-bold);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  padding: 0 0 var(--space-2);
  border-bottom: 1px solid var(--border-subtle);
  margin: var(--space-4) 0 var(--space-3);
}

.modal-body .info-row,
.drawer-body .info-row {
  display: flex;
  align-items: baseline;
  gap: var(--space-3);
  margin-bottom: var(--space-2);
}

.modal-body .info-label,
.drawer-body .info-label {
  font-size: var(--font-size-sm);
  color: var(--text-muted);
  min-width: 7rem;
  flex-shrink: 0;
}

.modal-body .info-value,
.drawer-body .info-value {
  font-size: var(--font-size-md);
  font-weight: var(--font-weight-semibold);
  color: var(--text-primary);
  line-height: var(--line-height-normal);
}

.hz-cm-actions {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  margin-top: var(--space-4);
}

.hz-cm-action-btn {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-4) var(--space-5);
  min-height: var(--control-height-lg);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-strong);
  background: var(--surface-2);
  cursor: pointer;
  transition: background var(--transition-fast), border-color var(--transition-fast);
  text-align: left;
  font: inherit;
  width: 100%;
  box-sizing: border-box;
}

.hz-cm-action-btn:hover {
  background: var(--surface-hover);
  border-color: rgba(var(--action-rgb), 0.35);
}

.hz-cm-action-btn[hidden] { display: none !important; }

.hz-cm-action-icon {
  font-size: var(--font-size-xl);
  line-height: 1;
  flex-shrink: 0;
}

.hz-cm-action-text,
.action-text {
  font-size: var(--font-size-md);
  font-weight: var(--font-weight-semibold);
  color: var(--text-primary);
}

.cm-submenu {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  margin: var(--space-1) 0 var(--space-1) var(--space-4);
  padding-left: var(--space-3);
  border-left: 2px solid rgba(var(--action-rgb), 0.22);
}

.cm-submenu .hz-cm-action-btn {
  min-height: var(--control-height-md);
  padding: var(--space-3) var(--space-4);
}

.action-btn {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-4) var(--space-5);
  min-height: var(--control-height-lg);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-strong);
  background: var(--surface-2);
  cursor: pointer;
  transition: background var(--transition-fast), border-color var(--transition-fast);
  text-align: left;
  font: inherit;
  width: 100%;
  box-sizing: border-box;
}

.action-btn:hover {
  background: var(--surface-hover);
  border-color: rgba(var(--action-rgb), 0.35);
}

.action-icon { font-size: var(--font-size-xl); line-height: 1; flex-shrink: 0; }

.modal-footer {
  padding: 14px 22px 18px;
  display: flex; align-items: center; gap: 10px;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}

.result-box {
  border-radius: var(--radius-md);
  padding: var(--space-4);
  font-size: var(--font-size-sm);
  line-height: var(--line-height-relaxed);
  display: none;
}
.result-box.show { display: block; }
.result-box.is-pending {
  background: rgba(var(--danger-rgb), 0.05);
  border: 1px solid rgba(var(--danger-rgb), 0.2);
  color: var(--text-primary);
}
.result-box.success { background: rgba(45,155,90,.08); border: 1px solid rgba(45,155,90,.25); color: var(--success); }
.result-box.error   { background: rgba(245,51,63,.08); border: 1px solid rgba(245,51,63,.25); color: var(--danger); }
.result-box.warn    { background: rgba(245,158,11,.10); border: 1px solid rgba(245,158,11,.30); color: #b45309; }
.result-box .result-title { font-weight: 700; margin-bottom: 4px; }
.result-box .result-detail { opacity: .85; }

/* ── Permission-based visibility ───────────────────────── */
.helix-perm-hidden { display: none !important; }

/* ── Toast ─────────────────────────────────────────────── */
.toast {
  position: fixed; bottom: 28px; left: 50%; transform: translateX(-50%) translateY(80px);
  background: var(--surface);
  border: 1px solid var(--border-dark);
  color: var(--text-body);
  padding: 12px 24px;
  border-radius: var(--radius); font-size: .85rem; font-weight: 500;
  z-index: 9999; pointer-events: none;
  opacity: 0; transition: all .35s cubic-bezier(.4,0,.2,1);
  box-shadow: var(--shadow-md);
  display: flex; align-items: center; gap: 10px;
  max-width: min(36rem, calc(100vw - 2rem));
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); pointer-events: auto; }
.toast-icon { font-size: 1.1rem; flex-shrink: 0; }
.toast-msg { min-width: 0; white-space: pre-wrap; line-height: 1.35; }
.toast .toast-copy { opacity: 1; flex-shrink: 0; }

/* ── Vault specific ────────────────────────────────────── */
.tp-company-label {
  font-size: var(--font-size-lg);
  font-weight: var(--font-weight-semibold);
  color: var(--text-primary);
  margin-bottom: var(--space-5);
  display: flex;
  align-items: center;
  gap: var(--space-3);
}
.tp-company-label .tag { font-size: var(--font-size-xs); }

/* Native form controls — dark theme color-scheme */
html[data-theme="dark"] .filter-group select,
html[data-theme="dark"] .filter-group input[type="text"],
html[data-theme="dark"] .filter-group input[type="search"],
html[data-theme="dark"] .filter-group input[type="datetime-local"],
html[data-theme="dark"] .filter-group input[type="date"],
html[data-theme="dark"] .filter-group input[type="time"],
html[data-theme="dark"] .search-box {
  color-scheme: dark;
}

html[data-theme="light"] .filter-group select,
html[data-theme="light"] .filter-group input,
html[data-theme="light"] .search-box {
  color-scheme: light;
}

.modal-header,
.drawer-header,
.table-toolbar,
.pagination {
  background: var(--surface-2);
}

::selection {
  background: rgba(var(--action-rgb), 0.32);
}

::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: var(--surface-app); }
::-webkit-scrollbar-thumb {
  background: var(--border-strong);
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* A menu is read, not admired. --glass-bg-strong is 0.88 alpha, and at that opacity the
   card borders and headings underneath stayed legible straight through the blur — the
   nav list ended up competing with the page it floats over. Opaque, and on the elevated
   surface rather than the base one so it still reads as lifted off the page.
   The blur goes with it: there is nothing left to see through. */
.hamburger-dropdown {
  background: var(--surface-elevated);
  border-color: var(--border-strong);
  box-shadow: var(--shadow-lg);
}

@supports ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .modal {
    backdrop-filter: blur(var(--glass-blur));
    -webkit-backdrop-filter: blur(var(--glass-blur));
  }
}

/* ── Command palette ─────────────────────────────────────── */
.command-palette-overlay {
  position: fixed;
  inset: 0;
  z-index: 5000;
  background: var(--overlay-scrim);
  display: none;
  align-items: flex-start;
  justify-content: center;
  padding: max(12vh, 80px) var(--page-gutter) var(--space-6);
}

.command-palette-overlay.open {
  display: flex;
}

.command-palette-panel {
  width: min(560px, 100%);
  background: var(--glass-bg-strong);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}

.command-palette-input {
  width: 100%;
  border: none;
  border-bottom: 1px solid var(--border-subtle);
  padding: var(--space-4) var(--space-5);
  font-size: var(--font-size-md);
  font-family: inherit;
  background: transparent;
  color: var(--text-primary);
  outline: none;
}

.command-palette-list {
  max-height: 320px;
  overflow-y: auto;
  padding: var(--space-2);
}

.command-palette-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  width: 100%;
  padding: var(--space-3) var(--space-4);
  border: none;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-primary);
  font-size: var(--font-size-md);
  font-family: inherit;
  text-align: left;
  cursor: pointer;
}

.command-palette-item:hover,
.command-palette-item.active {
  background: var(--surface-hover);
}

.command-palette-item kbd {
  font-size: var(--font-size-xs);
  color: var(--text-muted);
  font-family: var(--eci-font-family-mono);
  padding: 2px 6px;
  border: 1px solid var(--border-subtle);
  border-radius: 4px;
}

.command-palette-hint {
  padding: var(--space-2) var(--space-4) var(--space-3);
  font-size: var(--font-size-xs);
  color: var(--text-muted);
  border-top: 1px solid var(--border-subtle);
}

/* ── Pass 2: semantic text utilities (neutral mono, links) ── */
.text-mono,
.mono {
  font-family: var(--eci-font-family-mono);
  color: var(--text-primary);
}

.user-info-value.mono,
.users-hosting-val {
  font-family: var(--eci-font-family-mono);
  color: var(--text-primary) !important;
}

.text-link,
a.text-link {
  color: var(--link);
  text-decoration: none;
}

.text-link:hover,
a.text-link:hover {
  text-decoration: underline;
}

/* Override inline accent on table identifier cells */
.table-scroll td[style*="font-family:monospace"],
.table-scroll td[style*="font-family: monospace"] {
  color: var(--text-primary) !important;
}

.table-scroll td strong {
  color: var(--text-primary);
  font-weight: var(--font-weight-semibold);
}

.table-scroll a {
  color: var(--link);
  text-decoration: none;
}

.table-scroll a:hover {
  text-decoration: underline;
}

.btn-subtle {
  background: rgba(var(--action-rgb), 0.08);
  border: 1px solid rgba(var(--action-rgb), 0.22);
  color: var(--link);
  box-shadow: none;
}

.btn-subtle:hover {
  background: rgba(var(--action-rgb), 0.14);
  border-color: rgba(var(--action-rgb), 0.35);
  filter: none;
}

/* Product modal / customer action buttons (shared across HZ/SP/DD) */
.action-btn.primary,
.hz-cm-action-btn.primary {
  background: var(--action) !important;
  border-color: var(--action) !important;
  color: var(--action-text) !important;
}

.action-btn.primary:hover,
.hz-cm-action-btn.primary:hover {
  background: var(--action-hover) !important;
  border-color: var(--action-hover) !important;
  filter: none;
}

.action-btn.primary .action-text,
.hz-cm-action-btn.primary .hz-cm-action-text {
  color: var(--action-text) !important;
}

.btn-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: var(--control-height-sm);
  min-height: var(--control-height-sm);
  padding: var(--space-2);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.btn-icon:hover:not(:disabled) {
  background: var(--surface-hover);
  color: var(--text-primary);
  border-color: var(--border-strong);
}
.btn-icon:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  filter: grayscale(0.45);
  color: var(--text-muted);
}

.glass-surface {
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  box-shadow: var(--glass-shadow);
  border-radius: var(--radius-lg);
}

@supports ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .glass-surface {
    backdrop-filter: blur(var(--glass-blur));
    -webkit-backdrop-filter: blur(var(--glass-blur));
  }
}

@media (max-width: 1200px) {
  main { padding: var(--space-6) var(--page-gutter); }
  .table-wrap { max-height: calc(100vh - 180px); }
}

@media (max-width: 1024px) {
  header { min-height: 64px; }
  nav { width: 100%; justify-content: flex-start; margin-left: 0; }
}

@media (max-width: 768px) {
  main { padding: var(--space-5) var(--page-gutter); }

  /*
   * Filter / search bars — keep a compact wrap grid, not a tall stack of
   * full-width fields. Search spans the row; selects share ~half width;
   * chips and action buttons pack underneath.
   */
  .filters {
    flex-direction: row;
    flex-wrap: wrap;
    align-items: flex-end;
    padding: var(--space-3);
    gap: var(--space-3);
    margin-bottom: var(--space-4);
  }
  .filters .filter-group {
    flex: 1 1 calc(50% - var(--space-3));
    min-width: 0 !important; /* beat inline min-width:240px etc. */
    max-width: 100%;
  }
  .filters .filter-group:has(> input[type="text"]),
  .filters .filter-group:has(> input[type="search"]),
  .filters .filter-group:has(> .helix-search-wrap),
  .filters .filter-group:has(> .helix-suggest),
  .filters .filter-group.helix-query-group {
    flex: 1 1 100%;
  }
  .filters .filter-group label {
    font-size: var(--font-size-xs);
  }
  .filters .filter-group select,
  .filters .filter-group input[type="text"],
  .filters .filter-group input[type="search"],
  .filters .filter-group input[type="number"],
  .filters .filter-group input[type="datetime-local"],
  .filters .filter-group input[type="date"],
  .filters .filter-group input[type="time"],
  .filters .filter-group .filter-select,
  .filters .filter-group .helix-sys-type-trigger,
  .filters .filter-group .helix-sys-type-combo,
  .filters .filter-group .helix-suggest {
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
  }
  .helix-suggest-menu {
    max-height: min(16rem, 40dvh);
  }
  .helix-suggest-option {
    min-height: 44px;
    font-size: 1rem;
  }
  /* ≥16px prevents iOS Safari zoom-on-focus (crops the inline suggest list). */
  .helix-suggest > input,
  .filter-group .helix-suggest > input,
  #users-company {
    font-size: 16px !important;
  }
  .filters .toggle-group {
    flex: 1 1 100%;
    width: 100%;
    margin-left: 0 !important;
    align-self: stretch !important;
  }
  .filters .toggles {
    gap: 6px;
  }
  .filters .toggle-chip {
    min-height: 36px;
    padding: 6px 10px;
  }
  .filters > .btn,
  .filters > .btn-secondary,
  .filters > .btn-primary {
    flex: 1 1 auto;
    min-width: calc(50% - var(--space-3));
    justify-content: center;
  }
  #tab-customers > .filters {
    padding: var(--space-3);
    gap: var(--space-2);
    margin-bottom: var(--space-3);
  }
  #tab-customers > .filters .filter-group:first-child {
    flex: 1 1 100%;
    min-width: 0 !important;
  }

  .drawer { width: 100%; min-width: 0; max-width: 100%; }
  .customer-grid { grid-template-columns: 1fr; }
  .page-title { font-size: var(--font-size-2xl); }
  .search-box,
  .helix-search-wrap--box {
    max-width: 100%;
    flex: 1 1 100%;
  }
  .table-toolbar {
    flex-wrap: wrap;
    gap: 8px;
    align-items: stretch;
  }
  .table-toolbar > .search-box,
  .table-toolbar > .helix-search-wrap,
  .table-toolbar > .helix-search-wrap--box {
    flex: 1 1 100%;
    max-width: 100%;
    width: 100%;
  }
  .table-toolbar-count {
    flex: 1 1 100%;
    text-align: left;
  }

  /*
   * Product tab bars become a full-width dropdown under the header on mobile
   * (html.helix-mobile-product-nav-active). Hamburger stays hub/other-product only.
   */
  header:has(> nav) {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas:
      "brand tools"
      "nav nav";
    align-items: center;
    column-gap: var(--space-3);
    row-gap: var(--space-2);
  }
  html.helix-mobile-product-nav-active header:has(> nav) {
    grid-template-areas: "brand tools";
    row-gap: 0;
  }
  header:has(> nav) > .brand {
    grid-area: brand;
    min-width: 0;
  }
  header:has(> nav) > .header-tools {
    grid-area: tools;
    margin-left: 0;
  }
  header:has(> nav) > nav,
  header:has(> nav) > nav.sp-nav,
  header:has(> nav) > nav.hz-nav,
  header:has(> nav) > nav.dd-nav,
  header:has(> nav) > nav.ec-nav,
  header:has(> nav) > nav.nav-clustered {
    grid-area: nav;
    width: 100%;
    max-width: 100%;
    margin-left: 0;
    justify-content: flex-start;
    flex-wrap: wrap;
    gap: 8px;
    box-sizing: border-box;
  }
  html.helix-mobile-product-nav-active header:has(> nav) > nav,
  html.helix-mobile-product-nav-active header:has(> nav) > nav.sp-nav,
  html.helix-mobile-product-nav-active header:has(> nav) > nav.hz-nav,
  html.helix-mobile-product-nav-active header:has(> nav) > nav.dd-nav,
  html.helix-mobile-product-nav-active header:has(> nav) > nav.ec-nav,
  html.helix-mobile-product-nav-active header:has(> nav) > nav.nav-clustered {
    display: none !important;
  }

  .helix-mobile-product-nav {
    display: none;
  }
  html.helix-mobile-product-nav-active .helix-mobile-product-nav:not([hidden]) {
    display: block;
    position: sticky;
    top: 56px;
    z-index: 90;
    margin: 0;
    padding: 0 var(--page-gutter);
    background: var(--glass-bg-strong);
    border-bottom: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
  }
  @supports ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
    html.helix-mobile-product-nav-active .helix-mobile-product-nav:not([hidden]) {
      backdrop-filter: blur(var(--glass-blur));
      -webkit-backdrop-filter: blur(var(--glass-blur));
    }
  }
  .helix-mobile-product-nav-trigger {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    width: 100%;
    min-height: 44px;
    padding: 10px 0;
    border: 0;
    background: transparent;
    color: var(--text-primary);
    font: inherit;
    font-size: var(--font-size-sm);
    font-weight: 600;
    text-align: left;
    cursor: pointer;
  }
  .helix-mobile-product-nav-label {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .helix-mobile-product-nav-chevron {
    flex: 0 0 auto;
    width: 0.55em;
    height: 0.55em;
    border-right: 2px solid currentColor;
    border-bottom: 2px solid currentColor;
    transform: rotate(45deg) translateY(-2px);
    opacity: 0.7;
    transition: transform 0.15s ease;
  }
  .helix-mobile-product-nav.is-open .helix-mobile-product-nav-chevron {
    transform: rotate(-135deg) translateY(-2px);
  }
  .helix-mobile-product-nav-menu {
    display: none;
    flex-direction: column;
    gap: 2px;
    padding: 0 0 10px;
    max-height: min(60vh, 420px);
    overflow: auto;
  }
  /* display:flex must not beat [hidden] / closed state (same trap as hub-toolbar). */
  .helix-mobile-product-nav.is-open .helix-mobile-product-nav-menu:not([hidden]) {
    display: flex;
  }
  .helix-mobile-product-nav-menu[hidden] {
    display: none !important;
  }
  .helix-mobile-product-nav-item {
    display: flex;
    align-items: center;
    width: 100%;
    min-height: 42px;
    padding: 8px 10px;
    border: 0;
    border-radius: var(--radius-sm);
    background: transparent;
    color: var(--text-primary);
    font: inherit;
    font-size: var(--font-size-sm);
    text-align: left;
    cursor: pointer;
  }
  .helix-mobile-product-nav-item.is-hub {
    font-weight: 600;
  }
  .helix-mobile-product-nav-item.is-nested {
    padding-left: 28px;
    color: var(--text-secondary, var(--text-muted));
    font-weight: 500;
  }
  .helix-mobile-product-nav-item.is-cluster-start {
    margin-top: 6px;
    padding-top: 12px;
    border-top: 1px solid var(--border-subtle, var(--border));
    border-radius: 0 0 var(--radius-sm) var(--radius-sm);
  }
  .helix-mobile-product-nav-item:hover,
  .helix-mobile-product-nav-item:focus-visible {
    background: rgba(var(--action-rgb), 0.08);
    outline: none;
  }
  .helix-mobile-product-nav-item[aria-current="page"] {
    background: rgba(var(--action-rgb), 0.12);
    font-weight: 600;
    color: var(--text-primary);
  }
  [data-theme="dark"] .helix-mobile-product-nav-item[aria-current="page"] {
    background: rgba(var(--action-rgb), 0.22);
  }

  body[data-product] .brand-icon {
    min-width: 88px;
    max-width: 132px;
    height: 34px;
    padding: 4px 8px;
  }
  body[data-product="links"] .brand-icon {
    min-width: 34px;
    width: 34px;
    max-width: 34px;
    padding: 2px;
  }
  body[data-product="links"] .brand-icon .links-mark {
    width: 28px;
    height: 28px;
  }
  .brand-sub {
    display: none;
  }

  /* Touch-friendly hub buttons */
  nav button,
  .sp-nav-hub,
  .hz-nav-hub,
  .dd-nav-hub,
  .ec-nav-hub,
  .nav-hub {
    min-height: 40px;
    padding: 8px 12px;
    white-space: nowrap;
  }

  .sp-nav-cluster,
  .hz-nav-cluster,
  .dd-nav-cluster,
  .ec-nav-cluster,
  .nav-cluster {
    align-items: stretch;
  }

  /* Flyouts open left-aligned so they stay on-screen on narrow viewports */
  .sp-nav-cluster .sp-nav-flyout,
  .hz-nav-cluster .hz-nav-flyout,
  .dd-nav-cluster .dd-nav-flyout,
  .ec-nav-cluster .ec-nav-flyout,
  .nav-cluster .nav-flyout {
    left: 0;
    right: auto;
    min-width: min(260px, calc(100vw - 2 * var(--page-gutter)));
    max-width: calc(100vw - 2 * var(--page-gutter));
    z-index: 200;
  }

  /*
   * A–Z rail → horizontal strip under filters (not sticky beside cards).
   * The desktop vertical rail is unusable on phones (tiny targets, overlaps cards).
   * Keep it in document flow so it never hides under the multi-row product header.
   */
  #tab-customers.has-alpha-rail.active {
    display: block;
    padding-right: 0;
  }
  #tab-customers.has-alpha-rail > .page-title,
  #tab-customers.has-alpha-rail > .filters,
  #tab-customers.has-alpha-rail > .customer-directory,
  #tab-customers.has-alpha-rail > .customer-alpha-jump {
    order: initial;
    flex: none;
    width: auto;
    max-width: none;
    min-width: 0;
  }
  #tab-customers.has-alpha-rail .customer-grid {
    width: auto;
    max-width: none;
  }
  .customer-alpha-jump {
    position: relative;
    top: auto;
    z-index: 1;
    flex-direction: row;
    flex-wrap: nowrap;
    justify-content: flex-start;
    align-items: center;
    align-self: auto;
    width: 100%;
    max-width: 100%;
    max-height: none;
    margin: 0 0 var(--space-3);
    padding: 6px 8px;
    gap: 2px;
    border-radius: var(--radius-md);
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
  }
  .customer-alpha-jump::-webkit-scrollbar {
    display: block;
    height: 4px;
  }
  .customer-alpha-btn {
    flex: 0 0 auto;
    min-width: 28px;
    width: 28px;
    height: 28px;
    font-size: 0.7rem;
  }
  .customer-alpha-btn:hover:not(:disabled) {
    transform: none;
  }
  .customer-letter-section {
    scroll-margin-top: calc(72px + 1.25rem);
  }

  /* ── Responsive tables: card stack, no horizontal scroll ── */
  .table-scroll,
  .admin-table-wrap,
  .audit-table-wrap,
  .reports-table-wrap,
  .apppool-table-wrap {
    overflow-x: hidden;
  }

  .helix-rtable {
    width: 100% !important;
    min-width: 0 !important;
    table-layout: auto !important;
  }

  .helix-rtable > thead {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
  }

  /* Child combinators so nested tables (e.g. website bindings) keep their own layout. */
  .helix-rtable,
  .helix-rtable > tbody,
  .helix-rtable > tbody > tr,
  .helix-rtable > tbody > tr > td {
    display: block;
    width: 100%;
    max-width: 100%;
  }

  .helix-rtable > tbody {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: var(--space-3);
  }

  .helix-rtable > tbody > tr {
    background: var(--surface-1);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: 10px 12px;
    box-sizing: border-box;
  }

  .helix-rtable > tbody > tr:hover > td {
    background: transparent;
  }

  .helix-rtable > tbody > tr > td {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    padding: 6px 0;
    border-bottom: 1px solid var(--border-subtle);
    text-align: right;
    white-space: normal;
    /* Use break-word — `anywhere` shrinks flex children to ~1ch wide. */
    word-break: normal;
    overflow-wrap: break-word;
    max-width: none;
    min-width: 0;
    line-height: 1.35;
  }

  .helix-rtable > tbody > tr > td:last-child {
    border-bottom: none;
    padding-bottom: 0;
  }

  .helix-rtable > tbody > tr > td:first-child {
    padding-top: 0;
  }

  .helix-rtable > tbody > tr > td::before {
    content: attr(data-label);
    flex: 0 1 42%;
    max-width: 42%;
    text-align: left;
    font-size: var(--font-size-xs);
    font-weight: var(--font-weight-bold);
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--text-muted);
    white-space: normal;
  }

  .helix-rtable > tbody > tr > td:not([data-label])::before,
  .helix-rtable > tbody > tr > td[data-label=""]::before {
    content: none;
    display: none;
  }

  .helix-rtable > tbody > tr > td:not([data-label]),
  .helix-rtable > tbody > tr > td[data-label=""] {
    justify-content: flex-start;
    text-align: left;
  }

  /* Empty / loading / error full-width row */
  .helix-rtable > tbody > tr > td.helix-rtable-full,
  .helix-rtable > tbody > tr > td[colspan],
  .helix-rtable > tbody > tr > td:has(.state-msg) {
    display: block !important;
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0;
    box-sizing: border-box;
    text-align: center;
    border-bottom: none;
    padding: var(--space-4) 0;
    overflow-wrap: break-word;
    word-break: normal;
  }

  .helix-rtable > tbody > tr > td.helix-rtable-full .state-msg,
  .helix-rtable > tbody > tr > td[colspan] .state-msg,
  .helix-rtable > tbody > tr > td:has(.state-msg) .state-msg {
    display: block;
    width: 100%;
    max-width: 100%;
    padding: var(--space-5) var(--space-3);
    box-sizing: border-box;
    text-align: center;
  }

  .helix-rtable > tbody > tr > td.helix-rtable-full .state-msg p,
  .helix-rtable > tbody > tr > td[colspan] .state-msg p,
  .helix-rtable > tbody > tr > td:has(.state-msg) .state-msg p {
    display: block;
    width: 100%;
    max-width: 36rem;
    margin-left: auto;
    margin-right: auto;
    white-space: normal;
    overflow-wrap: break-word;
    word-break: normal;
  }

  .helix-rtable > tbody > tr > td.helix-rtable-full::before,
  .helix-rtable > tbody > tr > td[colspan]::before,
  .helix-rtable > tbody > tr > td:has(.state-msg)::before {
    content: none !important;
    display: none !important;
  }

  .helix-rtable > tbody > tr > td.cell-truncate,
  .helix-rtable > tbody > tr > td.cell-nowrap,
  .helix-rtable > tbody > tr > td.nowrap {
    white-space: normal;
    overflow: visible;
    text-overflow: unset;
    max-width: none;
  }

  /*
   * Compact expandable cards — opt in with data-helix-rtable-compact="1"
   * and data-helix-compact-primary="0,3" (summary columns).
   * Optional data-helix-compact-pair="1": collapsed summary is Site ID (left)
   * + secondary primary (right) on one row (Customer Data).
   */
  .helix-rtable[data-helix-rtable-compact="1"] > tbody > tr.helix-rtable-compact-row {
    position: relative;
    padding-right: 28px;
    cursor: pointer;
  }
  .helix-rtable[data-helix-rtable-compact="1"] > tbody > tr.helix-rtable-compact-row::after {
    content: '';
    position: absolute;
    top: 16px;
    right: 12px;
    width: 0.45em;
    height: 0.45em;
    border-right: 2px solid var(--text-muted);
    border-bottom: 2px solid var(--text-muted);
    transform: rotate(45deg);
    opacity: 0.75;
    pointer-events: none;
    transition: transform 0.15s ease;
  }
  .helix-rtable[data-helix-rtable-compact="1"] > tbody > tr.helix-rtable-compact-row.is-expanded::after {
    top: 18px;
    transform: rotate(-135deg);
  }
  .helix-rtable[data-helix-rtable-compact="1"] > tbody > tr.helix-rtable-compact-row:not(.is-expanded) > td.helix-rtable-detail {
    display: none;
  }
  .helix-rtable[data-helix-rtable-compact="1"] > tbody > tr.helix-rtable-compact-row:not(.is-expanded) > td.helix-rtable-primary {
    border-bottom: none;
    padding-top: 2px;
    padding-bottom: 2px;
  }
  .helix-rtable[data-helix-rtable-compact="1"] > tbody > tr.helix-rtable-compact-row:not(.is-expanded) > td.helix-rtable-primary:first-child {
    padding-top: 0;
  }
  .helix-rtable[data-helix-rtable-compact="1"] > tbody > tr.helix-rtable-compact-row:not(.is-expanded) > td.helix-rtable-primary:last-of-type {
    padding-bottom: 0;
  }
  /* Summary rows: drop field labels so the card reads as a short list. */
  .helix-rtable[data-helix-rtable-compact="1"] > tbody > tr.helix-rtable-compact-row:not(.is-expanded) > td.helix-rtable-primary::before {
    content: none;
    display: none;
  }
  .helix-rtable[data-helix-rtable-compact="1"] > tbody > tr.helix-rtable-compact-row:not(.is-expanded) > td.helix-rtable-primary {
    justify-content: flex-start;
    text-align: left;
    gap: 8px;
  }

  /* Pair summary: primary left + secondary right on one line. */
  .helix-rtable[data-helix-rtable-compact="1"][data-helix-compact-pair="1"] > tbody > tr.helix-rtable-compact-row:not(.is-expanded) {
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    align-items: center;
    gap: 8px;
  }
  .helix-rtable[data-helix-rtable-compact="1"][data-helix-compact-pair="1"] > tbody > tr.helix-rtable-compact-row:not(.is-expanded) > td.helix-rtable-primary {
    width: auto;
    max-width: none;
    padding-top: 0;
    padding-bottom: 0;
  }
  .helix-rtable[data-helix-rtable-compact="1"][data-helix-compact-pair="1"] > tbody > tr.helix-rtable-compact-row:not(.is-expanded) > td.helix-rtable-primary:first-child {
    flex: 1 1 auto;
    min-width: 0;
    font-weight: var(--font-weight-semibold, 600);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .helix-rtable[data-helix-rtable-compact="1"][data-helix-compact-pair="1"] > tbody > tr.helix-rtable-compact-row:not(.is-expanded) > td.helix-rtable-primary:not(:first-child) {
    flex: 0 1 auto;
    margin-left: auto;
    justify-content: flex-end;
    text-align: right;
    color: var(--text-muted);
    font-variant-numeric: tabular-nums;
  }
  .helix-rtable[data-helix-rtable-compact="1"][data-helix-compact-pair="1"] > tbody > tr.helix-rtable-compact-row:not(.is-expanded) > td.helix-rtable-primary input {
    width: auto !important;
    max-width: 9rem;
    min-width: 0;
    padding: 0 !important;
    border: none !important;
    background: transparent !important;
    text-align: right;
    color: inherit;
    font: inherit;
    box-shadow: none !important;
    pointer-events: none; /* expand on tap; edit after expand */
  }
  .helix-rtable[data-helix-rtable-compact="1"][data-helix-compact-pair="1"] > tbody > tr.helix-rtable-compact-row.is-expanded > td.helix-rtable-primary input,
  .helix-rtable[data-helix-rtable-compact="1"][data-helix-compact-pair="1"] > tbody > tr.helix-rtable-compact-row.is-expanded > td.helix-rtable-detail input {
    width: 100% !important;
    max-width: 100%;
    box-sizing: border-box;
  }

  .helix-rtable[data-helix-rtable-compact="1"] > tbody > tr.helix-rtable-compact-row.is-expanded > td.helix-rtable-detail {
    display: flex;
  }
  .helix-rtable-mobile-action {
    display: none;
  }
  .helix-rtable[data-helix-rtable-compact="1"] > tbody > tr.helix-rtable-compact-row.is-expanded .helix-rtable-mobile-action {
    display: flex;
    width: 100%;
    justify-content: center;
    margin-top: 8px;
  }
  .helix-rtable[data-helix-rtable-compact="1"] > tbody > tr.helix-rtable-compact-row.is-expanded > td.helix-rtable-detail:has(.helix-rtable-mobile-action) {
    flex-direction: column;
    align-items: stretch;
  }
  /* Desktop chevron column (websites) — phone uses the card ::after chevron instead. */
  .helix-rtable[data-helix-rtable-compact="1"] > tbody > tr.helix-rtable-compact-row > td.helix-rtable-desktop-chev {
    display: none !important;
  }

  /* Nested compact lists (website bindings under an expanded site). */
  .helix-rtable > tbody > tr > td.helix-rtable-full .helix-rtable[data-helix-rtable-compact="1"] > tbody,
  .helix-rtable > tbody > tr > td[colspan] .helix-rtable[data-helix-rtable-compact="1"] > tbody {
    padding: 0;
    gap: 6px;
  }
  .helix-rtable > tbody > tr > td.helix-rtable-full .helix-rtable[data-helix-rtable-compact="1"] > tbody > tr,
  .helix-rtable > tbody > tr > td[colspan] .helix-rtable[data-helix-rtable-compact="1"] > tbody > tr {
    background: var(--surface-2, var(--surface));
    padding: 8px 10px;
    padding-right: 26px;
  }

  .pagination {
    justify-content: center;
  }

  .pagination select {
    max-width: 100%;
  }
}

@media (max-width: 430px) {
  :root { --font-size-root: 16px; }
  header { min-height: 56px; padding: var(--space-2) var(--page-gutter); }
  .page-title { font-size: var(--font-size-xl); }
  nav button { font-size: var(--font-size-xs); padding: var(--space-2) var(--space-3); }
  th, td { padding: var(--space-3) var(--space-4); }
  .helix-rtable > tbody { padding: var(--space-2); gap: 8px; }
}

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

  .customer-card:hover,
  .glass-card:hover {
    transform: none;
  }
}

/* One page footer on every Helix screen. Pipes sit between items and are
   removed by helix-version.js when the next item wraps to a new line. */
.helix-app-footer {
  margin-top: var(--space-8);
  padding: var(--space-6) var(--page-gutter);
  color: var(--text-muted);
  font-size: var(--font-size-sm);
  text-align: center;
  border-top: 1px solid var(--border-subtle, var(--border));
}
.helix-footer-line {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: baseline;
  width: 100%;
  margin: 0;
}
.helix-footer-item {
  white-space: nowrap;
}
.helix-footer-sep {
  padding: 0 0.55em;
  user-select: none;
}
.helix-footer-sep[hidden] {
  display: none;
}
a.helix-version-link,
.helix-app-footer a.helix-version-link {
  color: inherit;
  text-decoration: underline;
  text-underline-offset: 2px;
}
a.helix-version-link:hover {
  color: var(--accent);
}
#helix-feedback-btn.helix-feedback-btn-raised {
  bottom: 56px;
}

#helix-events-btn {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 9998;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: var(--accent, #3b82f6);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
  text-decoration: none;
}

#helix-events-btn:hover {
  transform: scale(1.1);
}

body:has(#helix-events-btn) #helix-feedback-btn,
body:has(#helix-events-btn) #helix-feedback-btn.helix-feedback-btn-raised {
  bottom: 72px;
}

/* The permission pencil sits above Feedback. Feedback moves up for the
   calendar, so the pencil has to move with it or it covers the chat bubble. */
body:has(#helix-events-btn) .helix-iam-edit-entry {
  bottom: 134px;
}

/* Inventory debug FAB defaults to 144px (above the pencil at 82px). With the
   calendar in the corner the pencil is at 134px, so lift debug clear of it. */
body:has(#helix-events-btn) #helix-inventory-debug-fab {
  bottom: 196px;
}
