/* glisse for every element (https://github.com/0kzh/glisse). glisse.css styles its own components (.lg-button, .lg-input,
   .lg-switch ...); this layer gives the same look to the plain HTML elements of all Nexey pages: text fields, selects,
   text areas, file pickers, checkboxes (as glisse switches), radios, sliders, segmented choices and cards.
   Loaded last on every page shell (sign-in pages, account pages, portal, docs, old account centre). Uses the glisse
   tokens, so it follows light and dark (data-theme or the system) like glisse itself.
   The selectors start with :is(html, #lg) on purpose: the id in :is() lifts them above the older per-page rules, so
   one file decides the look. Colours that a page sets on its body (the app colour on sign-in pages) are read
   where they are used, as var(--accent-ui, var(--star, ...)), not copied into a :root variable. Size, padding and layout stay with each page; this file only sets the material. */

:root {
  --lg-field: rgb(118 118 128 / .12);
  --lg-field-hover: rgb(118 118 128 / .17);
  --lg-field-focus: rgb(255 255 255 / .92);
  --lg-field-edge: rgb(0 0 0 / .1);
  --lg-card: rgb(255 255 255 / .72);
  --lg-card-edge: rgb(0 0 0 / .06);
  --lg-card-light: rgb(255 255 255 / .9);
  --lg-card-drop: 0 1px 2px rgb(11 13 20 / .04), 0 24px 60px -24px rgb(11 13 20 / .2);
  --lg-thumb: #fff;
  --lg-thumb-shadow: 0 3px 8px rgb(0 0 0 / .14), 0 1px 2px rgb(0 0 0 / .08), inset 0 0 0 .5px rgb(0 0 0 / .04);
}
:root[data-theme="dark"] {
  --lg-field: rgb(118 118 128 / .24);
  --lg-field-hover: rgb(118 118 128 / .32);
  --lg-field-focus: rgb(28 28 34 / .9);
  --lg-field-edge: rgb(255 255 255 / .1);
  --lg-card: rgb(26 30 40 / .62);
  --lg-card-edge: rgb(255 255 255 / .1);
  --lg-card-light: rgb(255 255 255 / .08);
  --lg-card-drop: 0 1px 2px rgb(0 0 0 / .4), 0 24px 60px -24px rgb(0 0 0 / .8);
  --lg-thumb-shadow: 0 3px 8px rgb(0 0 0 / .4), 0 1px 2px rgb(0 0 0 / .3);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --lg-field: rgb(118 118 128 / .24);
    --lg-field-hover: rgb(118 118 128 / .32);
    --lg-field-focus: rgb(28 28 34 / .9);
    --lg-field-edge: rgb(255 255 255 / .1);
    --lg-card: rgb(26 30 40 / .62);
    --lg-card-edge: rgb(255 255 255 / .1);
    --lg-card-light: rgb(255 255 255 / .08);
    --lg-card-drop: 0 1px 2px rgb(0 0 0 / .4), 0 24px 60px -24px rgb(0 0 0 / .8);
    --lg-thumb-shadow: 0 3px 8px rgb(0 0 0 / .4), 0 1px 2px rgb(0 0 0 / .3);
  }
}

/* ---------------------------------------------------------------- text fields, selects, text areas */

:is(html, #lg) :is(input:not([type="checkbox"], [type="radio"], [type="range"], [type="file"], [type="color"], [type="submit"], [type="button"], [type="reset"], [type="image"], [type="hidden"]), select, textarea):not(.lg-input input, .nx-native) {
  border-color: transparent;
  background-color: var(--lg-field);
  box-shadow: inset 0 0 0 .5px var(--lg-field-edge), inset 0 1px 2px rgb(0 0 0 / .04);
  transition: background-color .2s ease, box-shadow .2s ease;
}
:is(html, #lg) :is(input:not([type="checkbox"], [type="radio"], [type="range"], [type="file"], [type="color"], [type="submit"], [type="button"], [type="reset"], [type="image"], [type="hidden"]), select):not(.lg-input input, .nx-native) { border-radius: 999px; }
:is(html, #lg) textarea:not(.lg-input textarea, .nx-native) { border-radius: 20px; }
@media (hover: hover) and (pointer: fine) {
  :is(html, #lg) :is(input:not([type="checkbox"], [type="radio"], [type="range"], [type="file"], [type="color"], [type="submit"], [type="button"], [type="reset"], [type="image"], [type="hidden"]), select, textarea):not(.lg-input input, .nx-native, :focus, :disabled):hover {
    background-color: var(--lg-field-hover);
  }
}
:is(html, #lg) :is(input:not([type="checkbox"], [type="radio"], [type="range"], [type="file"], [type="color"], [type="submit"], [type="button"], [type="reset"], [type="image"], [type="hidden"]), select, textarea):not(.lg-input input, .nx-native):focus {
  outline: none;
  background-color: var(--lg-field-focus);
  box-shadow: inset 0 0 0 1.5px var(--accent-ui, var(--star, var(--lg-fill))), 0 0 0 4px color-mix(in srgb, var(--accent-ui, var(--star, var(--lg-fill))) 18%, transparent);
}
:is(html, #lg) :is(input, select, textarea)[aria-invalid="true"]:not(.nx-native) {
  box-shadow: inset 0 0 0 1.5px var(--lg-destructive), 0 0 0 4px color-mix(in srgb, var(--lg-destructive) 14%, transparent);
}
:is(html, #lg) :is(input, select, textarea):disabled:not(.nx-native) { opacity: .55; }
/* the browser's autofill colour would cover the glass: keep it out */
:is(html, #lg) input:-webkit-autofill,
:is(html, #lg) input:-webkit-autofill:hover,
:is(html, #lg) input:-webkit-autofill:focus {
  -webkit-text-fill-color: currentColor;
  transition: background-color 600000s 0s, color 600000s 0s;
}

/* ---------------------------------------------------------------- file picker: the button is a glisse button */

:is(html, #lg) input[type="file"]:not(.nx-native) {
  border-color: transparent;
  border-radius: 999px;
  background-color: var(--lg-field);
  box-shadow: inset 0 0 0 .5px var(--lg-field-edge);
  color: var(--lg-muted);
}
:is(html, #lg) input[type="file"]::file-selector-button {
  height: 34px;
  margin-right: 12px;
  padding: 0 14px;
  border: 0;
  border-radius: 999px;
  background: var(--lg-glass);
  color: var(--lg-foreground);
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  box-shadow: inset 0 0 0 .5px var(--lg-edge), inset 0 1px 0 rgb(255 255 255 / .5), 0 1px 3px var(--lg-drop);
  cursor: pointer;
  transition: background-color .2s ease;
}
:is(html, #lg) input[type="file"]::file-selector-button:hover { background: var(--lg-glass-active); }

/* ---------------------------------------------------------------- checkbox: the glisse switch */
/* glisse's switch: a 60 by 25 track, a white pill thumb; while pressed the thumb lifts into a clear glass lens. */

:is(html, #lg) input[type="checkbox"]:not(.nx-native, .choice input, .swatch input) {
  -webkit-appearance: none;
  appearance: none;
  position: relative;
  flex: none;
  display: inline-block;
  width: 60px;
  min-width: 60px;
  height: 25px;
  min-height: 25px;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: var(--lg-track);
  box-shadow: none;
  vertical-align: middle;
  cursor: pointer;
  touch-action: pan-y;
  -webkit-tap-highlight-color: transparent;
  transition: background-color .25s var(--lg-ease);
}
:is(html, #lg) input[type="checkbox"]:not(.nx-native, .choice input, .swatch input)::before {
  content: "";
  position: absolute;
  top: 1.5px;
  left: 1.5px;
  width: 36px;
  height: 22px;
  border-radius: 999px;
  background: var(--lg-thumb);
  box-shadow: var(--lg-thumb-shadow);
  transition: transform .42s cubic-bezier(.3, 1.45, .45, 1), background-color .2s ease, box-shadow .2s ease;
}
:is(html, #lg) input[type="checkbox"]:not(.nx-native, .choice input, .swatch input)::after { content: none; }
:is(html, #lg) input[type="checkbox"]:not(.nx-native, .choice input, .swatch input):checked { background: var(--lg-on); }
:is(html, #lg) input[type="checkbox"]:not(.nx-native, .choice input, .swatch input):checked::before { transform: translateX(21px); }
/* pressed: the thumb lifts and turns to glass */
:is(html, #lg) input[type="checkbox"]:not(.nx-native, .choice input, .swatch input):active:not(:disabled)::before {
  background: rgb(255 255 255 / .28);
  -webkit-backdrop-filter: blur(.5px) brightness(1.15) saturate(1.5);
  backdrop-filter: blur(.5px) brightness(1.15) saturate(1.5);
  box-shadow: 0 6px 24px rgb(0 0 0 / .2), inset 0 0 0 1.5px rgb(255 255 255 / .5), inset 0 2px 1px rgb(255 255 255 / .45),
    inset 2px 7px 24px rgb(0 0 0 / .09), inset -2px -7px 24px rgb(255 255 255 / .16);
  transform: scale(1.3, 1.45);
}
:is(html, #lg) input[type="checkbox"]:not(.nx-native, .choice input, .swatch input):checked:active:not(:disabled)::before { transform: translateX(21px) scale(1.3, 1.45); }
:is(html, #lg) input[type="checkbox"]:not(.nx-native, .choice input, .swatch input):disabled { opacity: .35; cursor: default; }
:is(html, #lg) input[type="checkbox"]:not(.nx-native, .choice input, .swatch input):focus-visible { outline: 2px solid var(--lg-ring); outline-offset: 2px; }

/* ---------------------------------------------------------------- radio: a glass dot */

:is(html, #lg) input[type="radio"]:not(.nx-native, .choice input, .swatch input, .nx-seg input) {
  -webkit-appearance: none;
  appearance: none;
  position: relative;
  flex: none;
  display: inline-grid;
  place-items: center;
  width: 22px;
  min-width: 22px;
  height: 22px;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: var(--lg-field);
  box-shadow: inset 0 0 0 .5px var(--lg-field-edge);
  vertical-align: middle;
  cursor: pointer;
  transition: background-color .2s ease;
}
:is(html, #lg) input[type="radio"]:not(.nx-native, .choice input, .swatch input, .nx-seg input)::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: #fff;
  transform: scale(0);
  transition: transform .3s cubic-bezier(.3, 1.45, .45, 1);
}
:is(html, #lg) input[type="radio"]:not(.nx-native, .choice input, .swatch input, .nx-seg input):checked { background: var(--accent-ui, var(--star, var(--lg-fill))); box-shadow: none; }
:is(html, #lg) input[type="radio"]:not(.nx-native, .choice input, .swatch input, .nx-seg input):checked::before { transform: scale(1); }
:is(html, #lg) input[type="radio"]:not(.nx-native, .choice input, .swatch input, .nx-seg input):focus-visible { outline: 2px solid var(--lg-ring); outline-offset: 2px; }

/* ---------------------------------------------------------------- radios as a glisse segmented control */
/* <div class="nx-seg"><label><input type="radio"><span>Text</span></label> ...</div> */

:is(html, #lg) .nx-seg {
  display: grid;
  grid-auto-columns: minmax(0, 1fr);
  grid-auto-flow: column;
  gap: 0;
  margin: 0;
  padding: 4px;
  border: 0;
  border-radius: 999px;
  background: var(--lg-segment-track);
  box-shadow: inset 0 0 0 .5px var(--lg-field-edge);
}
:is(html, #lg) .nx-seg label {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 40px;
  margin: 0;
  padding: 0 14px;
  border: 0;
  border-radius: 999px;
  background: none;
  box-shadow: none;
  color: var(--lg-muted);
  font-weight: 600;
  cursor: pointer;
  transition: color .2s ease, background-color .25s var(--lg-ease), box-shadow .25s var(--lg-ease);
  -webkit-tap-highlight-color: transparent;
}
:is(html, #lg) .nx-seg label:hover { color: var(--lg-foreground); background: none; }
:is(html, #lg) .nx-seg input {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: 0;
  opacity: 0;
  pointer-events: none;
}
:is(html, #lg) .nx-seg label:has(input:checked) {
  background: var(--lg-segment-thumb);
  color: var(--lg-segment-label);
  box-shadow: 0 3px 8px rgb(0 0 0 / .12), 0 3px 1px rgb(0 0 0 / .04), inset 0 0 0 .5px var(--lg-edge);
}
:is(html, #lg) .nx-seg label:has(input:checked) span { color: inherit; }
:is(html, #lg) .nx-seg label:has(input:focus-visible) { outline: 2px solid var(--lg-ring); outline-offset: 2px; }

/* ---------------------------------------------------------------- slider: glisse's rail and glass thumb */

:is(html, #lg) input[type="range"]:not(.nx-native) {
  -webkit-appearance: none;
  appearance: none;
  height: 28px;
  margin: 0;
  background: none;
  cursor: pointer;
}
:is(html, #lg) input[type="range"]:not(.nx-native)::-webkit-slider-runnable-track { height: 6px; border-radius: 3px; background: var(--lg-rail); }
:is(html, #lg) input[type="range"]:not(.nx-native)::-moz-range-track { height: 6px; border-radius: 3px; background: var(--lg-rail); }
:is(html, #lg) input[type="range"]:not(.nx-native)::-moz-range-progress { height: 6px; border-radius: 3px; background: var(--accent-ui, var(--star, var(--lg-fill))); }
:is(html, #lg) input[type="range"]:not(.nx-native)::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 38px;
  height: 24px;
  margin-top: -9px;
  border: 0;
  border-radius: 999px;
  background: var(--lg-thumb);
  box-shadow: var(--lg-thumb-shadow);
  transition: transform .3s cubic-bezier(.3, 1.45, .45, 1), background-color .2s ease;
}
:is(html, #lg) input[type="range"]:not(.nx-native)::-moz-range-thumb {
  width: 38px;
  height: 24px;
  border: 0;
  border-radius: 999px;
  background: var(--lg-thumb);
  box-shadow: var(--lg-thumb-shadow);
}
:is(html, #lg) input[type="range"]:not(.nx-native):active::-webkit-slider-thumb {
  background: rgb(255 255 255 / .3);
  box-shadow: 0 6px 24px rgb(0 0 0 / .2), inset 0 0 0 1.5px rgb(255 255 255 / .5), inset 0 2px 1px rgb(255 255 255 / .45);
  transform: scale(1.35);
}
:is(html, #lg) input[type="range"]:not(.nx-native):focus-visible { outline: 2px solid var(--lg-ring); outline-offset: 4px; border-radius: 999px; }

/* ---------------------------------------------------------------- cards: sheets of glass */

:is(.nx-auth, #lg) .nx-card,
:is(html.dev, #lg) .card,
:is(html, #lg) .nx-glass-card {
  background-color: var(--lg-card);
  -webkit-backdrop-filter: blur(28px) saturate(1.8);
  backdrop-filter: blur(28px) saturate(1.8);
  box-shadow: inset 0 0 0 .5px var(--lg-card-edge), inset 0 1px 0 var(--lg-card-light), var(--lg-card-drop);
}
/* a card that glisse.js gave a measured rim draws its edge there */
:is(.nx-auth, #lg) .nx-card.lg-glass[data-rim],
:is(html.dev, #lg) .card.lg-glass[data-rim],
:is(html, #lg) .nx-glass-card.lg-glass[data-rim] {
  box-shadow: var(--lg-card-drop);
}

/* the portal's choice cards and the docs' tabs read as glass too */
:is(html.dev, #lg) .choice { background-color: var(--lg-field); box-shadow: inset 0 0 0 .5px var(--lg-field-edge); }
:is(html.dev, #lg) .choice:has(input:checked) {
  background-color: var(--lg-field-focus);
  box-shadow: inset 0 0 0 2px var(--accent-ui, var(--star, var(--lg-fill))), 0 10px 26px -14px color-mix(in srgb, var(--accent-ui, var(--star, var(--lg-fill))) 60%, transparent);
}

/* ---------------------------------------------------------------- glisse's real Switch and Segmented control (js/glisse-native.js) */
/* A checkbox gets glisse's Switch next to it; once that is mounted the checkbox is hidden but stays in the form. */
.lg-switch-wrap { position: relative; display: inline-flex; flex: none; align-items: center; vertical-align: middle; }
:is(html, #lg) .lg-switch-wrap:has(.lg-switch) > input[type="checkbox"] {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 1px;
  min-width: 0;
  height: 1px;
  min-height: 0;
  margin: 0;
  padding: 0;
  opacity: 0;
  pointer-events: none;
  clip-path: inset(50%);
}
:is(html, #lg) .lg-switch[data-invalid] { outline: 2px solid var(--lg-destructive); outline-offset: 3px; }
:is(html, #lg) .lg-switch-wrap .lg-switch { margin: 0; box-shadow: none; }

/* the account pages' top bar as a Segmented control */
.lg-nav-seg { display: flex; flex: 0 1 auto; min-width: 0; margin-right: auto; }
.lg-nav-seg:empty, .lg-nav-seg--off { display: none !important; }
.lg-nav-plain--off { display: none !important; }
.lg-nav-seg .lg-segmented { --lg-tab-height: 36px; }
.lg-nav-seg .lg-tab, .lg-nav-seg .lg-tab-copy { gap: 6px; font-size: 14px; font-weight: 500; }
.lg-nav-seg .lg-tab-icon > svg { width: 17px; height: 17px; }
.lg-tab-probe { position: absolute; visibility: hidden; white-space: nowrap; font-size: 14px; font-weight: 500; }
.lg-nav-seg--text .lg-tab-icon { display: none; }
.lg-nav-seg--icon .lg-tab-label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
