/* Stingray 1 components
 * Load after tokens/tokens.css and css/icons.css. Put class="sg" on <body> (never <html>: rem tokens follow the root font size).
 * Rules enforced by tools/build.mjs: color comes only from component tokens, no hard-coded color, every length on the 4pt grid.
 * Blocks between foundation markers are the only place semantic color tokens may be read.
 * Shape: radius grows with the element (mark 3, control 4, float 6, container 10). Surfaces: a near-white canvas under white raised surfaces, never nested.
 * State classes .is-hover .is-active .is-focus mirror the pseudo-classes for documentation and tests. */

/* foundation:start */
/* Two weights, each a static file. There is no variable axis to render differently in another engine, and no weight in between to reach for. */
@font-face {
  font-family: "Atkinson Hyperlegible Next";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("../fonts/AtkinsonHyperlegibleNext-Regular-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
  font-family: "Atkinson Hyperlegible Next";
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url("../fonts/AtkinsonHyperlegibleNext-SemiBold-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
  font-family: "Atkinson Hyperlegible Next";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("../fonts/AtkinsonHyperlegibleNext-Regular-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

@font-face {
  font-family: "Atkinson Hyperlegible Next";
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url("../fonts/AtkinsonHyperlegibleNext-SemiBold-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

/* The fixed-width cut of the same family, for code, logs and terminal output. */
@font-face {
  font-family: "Atkinson Hyperlegible Mono";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("../fonts/AtkinsonHyperlegibleMono-Regular-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
  font-family: "Atkinson Hyperlegible Mono";
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url("../fonts/AtkinsonHyperlegibleMono-SemiBold-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
  font-family: "Atkinson Hyperlegible Mono";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("../fonts/AtkinsonHyperlegibleMono-Regular-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

@font-face {
  font-family: "Atkinson Hyperlegible Mono";
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url("../fonts/AtkinsonHyperlegibleMono-SemiBold-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

.sg {
  margin: 0;
  background: var(--sg-page-background);
  color: var(--sg-page-text);
  font-family: var(--sg-font-family-base);
  font-size: var(--sg-type-body-size);
  line-height: var(--sg-type-body-line);
  font-weight: var(--sg-type-body-weight);
  font-kerning: normal;
  font-variant-ligatures: none;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  -webkit-font-smoothing: antialiased;
}

:root.sg {
  font-size: 100%;
}

.sg,
.sg *,
.sg *::before,
.sg *::after {
  box-sizing: border-box;
}

.sg :where(h1, h2, h3, h4, h5, h6, p, figure, dl, dd, blockquote, fieldset) {
  margin: 0;
}

.sg :where(fieldset) {
  padding: 0;
  border: 0;
  min-inline-size: 0;
}

.sg :where(legend) {
  padding: 0;
}

/* hidden means hidden, whatever display a component sets */
.sg [hidden]:not([hidden="until-found"]) {
  display: none !important;
}

.sg :where(button, input, select, textarea) {
  font: inherit;
  color: inherit;
  margin: 0;
}

.sg :where(kbd) {
  font-family: inherit;
  font-size: inherit;
}

.sg :where(samp, code, pre) {
  font-family: var(--sg-font-family-mono);
  font-size: inherit;
  font-variant-ligatures: none;
}

/* No italics anywhere: emphasis is weight. */
.sg :where(em, i, cite, dfn, var, address) {
  font-style: normal;
}

.sg :where(em, dfn) {
  font-weight: var(--sg-type-body-strong-weight);
}

.sg :where(a:not([class])) {
  color: var(--sg-link-text);
  text-decoration-thickness: var(--sg-stroke-hairline);
  text-underline-offset: var(--sg-space-1);
}

.sg :where(a:not([class])):hover {
  color: var(--sg-link-text-hover);
  text-decoration-thickness: var(--sg-stroke-rule);
}

/* Focus is ink, 2px, offset 2px, on every focusable thing. Never restyle it per component. */
.sg :focus-visible,
.sg .is-focus {
  outline: var(--sg-focus-width) solid var(--sg-color-focus-ring);
  outline-offset: var(--sg-focus-offset);
}

@media (forced-colors: active) {

  .sg :focus-visible,
  .sg .is-focus {
    outline-color: Highlight;
  }
}

/* Type styles. Hierarchy is size and weight only. */
.sg-type-hero {
  font-size: var(--sg-type-hero-size);
  line-height: var(--sg-type-hero-line);
  font-weight: var(--sg-type-hero-weight);
  letter-spacing: var(--sg-type-hero-tracking);
}

.sg-type-display {
  font-size: var(--sg-type-display-size);
  line-height: var(--sg-type-display-line);
  font-weight: var(--sg-type-display-weight);
  letter-spacing: var(--sg-type-display-tracking);
}

.sg-type-heading-1 {
  font-size: var(--sg-type-heading-1-size);
  line-height: var(--sg-type-heading-1-line);
  font-weight: var(--sg-type-heading-1-weight);
  letter-spacing: var(--sg-type-heading-1-tracking);
}

.sg-type-heading-2 {
  font-size: var(--sg-type-heading-2-size);
  line-height: var(--sg-type-heading-2-line);
  font-weight: var(--sg-type-heading-2-weight);
  letter-spacing: var(--sg-type-heading-2-tracking);
}

.sg-type-heading-3 {
  font-size: var(--sg-type-heading-3-size);
  line-height: var(--sg-type-heading-3-line);
  font-weight: var(--sg-type-heading-3-weight);
}

.sg-type-heading-4 {
  font-size: var(--sg-type-heading-4-size);
  line-height: var(--sg-type-heading-4-line);
  font-weight: var(--sg-type-heading-4-weight);
}

.sg-type-body-large {
  font-size: var(--sg-type-body-large-size);
  line-height: var(--sg-type-body-large-line);
  font-weight: var(--sg-type-body-large-weight);
}

.sg-type-body {
  font-size: var(--sg-type-body-size);
  line-height: var(--sg-type-body-line);
  font-weight: var(--sg-type-body-weight);
}

.sg-type-body-strong {
  font-size: var(--sg-type-body-strong-size);
  line-height: var(--sg-type-body-strong-line);
  font-weight: var(--sg-type-body-strong-weight);
}

.sg-type-label {
  font-size: var(--sg-type-label-size);
  line-height: var(--sg-type-label-line);
  font-weight: var(--sg-type-label-weight);
}

.sg-type-caption {
  font-size: var(--sg-type-caption-size);
  line-height: var(--sg-type-caption-line);
  font-weight: var(--sg-type-caption-weight);
}

.sg-num {
  font-variant-numeric: tabular-nums;
}

.sg-num-end {
  font-variant-numeric: tabular-nums;
  text-align: end;
}

/* fixed-width text outside code: hashes, addresses, keys, anything compared character by character */
.sg-mono {
  font-family: var(--sg-font-family-mono);
  font-variant-ligatures: none;
}

.sg-sr-only {
  position: absolute;
  inline-size: 1px;
  block-size: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

.sg-skip {
  position: absolute;
  inset-inline-start: var(--sg-space-2);
  inset-block-start: var(--sg-space-2);
  z-index: var(--sg-layer-tooltip);
  padding: var(--sg-space-2) var(--sg-space-3);
  border-radius: var(--sg-radius-control);
  background: var(--sg-tooltip-background);
  color: var(--sg-tooltip-text);
  transform: translateY(-200%);
}

.sg-skip:focus {
  transform: none;
}

/* Layout helpers: gaps come from the semantic spacing tokens, so nothing off-grid can be expressed. */
.sg-stack {
  display: flex;
  flex-direction: column;
  gap: var(--sg-space-stack-field);
}

.sg-stack--related {
  gap: var(--sg-space-stack-related);
}

.sg-stack--group {
  gap: var(--sg-space-stack-group);
}

.sg-stack--section {
  gap: var(--sg-space-stack-section);
}

.sg-cluster {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--sg-space-inline-control);
}

.sg-cluster--tight {
  gap: var(--sg-space-inline-tight);
}

.sg-cluster--loose {
  gap: var(--sg-space-4);
}

.sg-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--sg-space-2) var(--sg-space-3);
}

.sg-toolbar__spacer {
  margin-inline-start: auto;
}

/* foundation:end */

/* ---------- Icon ---------- */
.sg-icon {
  display: inline-block;
  flex: none;
  inline-size: var(--sg-icon-size, var(--sg-control-icon-size));
  block-size: var(--sg-icon-size, var(--sg-control-icon-size));
  background-color: currentColor;
  -webkit-mask: var(--sg-icon-mask) center / contain no-repeat;
  mask: var(--sg-icon-mask) center / contain no-repeat;
  forced-color-adjust: none;
  /* fallback: browsers without the next value paint the author color */
  forced-color-adjust: preserve-parent-color;
  /* keep the fill, but take the parent's system color so it never matches the forced background */
}

.sg-icon--small {
  --sg-icon-size: var(--sg-size-icon-small);
}

.sg-icon--medium {
  --sg-icon-size: var(--sg-size-icon-medium);
}

.sg-icon--large {
  --sg-icon-size: var(--sg-size-icon-large);
}

/* Chevrons and arrows point the other way in right-to-left text; every other icon keeps its shape. */
[dir="rtl"] :is(.sg-icon--left-line, .sg-icon--right-line, .sg-icon--arrow-left-line, .sg-icon--arrow-right-line),
[dir="rtl"] .sg-breadcrumb li+li::before {
  rotate: 180deg;
}

/* ---------- Button ---------- */
.sg-button {
  --_bg: var(--sg-button-secondary-background);
  --_bg-hover: var(--sg-button-secondary-background-hover);
  --_bg-pressed: var(--sg-button-secondary-background-pressed);
  --_fg: var(--sg-button-secondary-text);
  --_fg-hover: var(--sg-button-secondary-text);
  --_border: var(--sg-button-secondary-border);
  --_border-hover: var(--sg-button-secondary-border-hover);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--sg-control-gap);
  min-block-size: var(--sg-control-height);
  padding: 0 var(--sg-control-padding-x);
  border: var(--sg-control-border-width) solid var(--_border);
  border-radius: var(--sg-control-radius);
  background: var(--_bg);
  color: var(--_fg);
  font-size: var(--sg-control-font-size);
  line-height: var(--sg-control-line-height);
  font-weight: var(--sg-type-body-strong-weight);
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  user-select: none;
  transition: background-color var(--sg-motion-duration-state) var(--sg-motion-easing-enter), border-color var(--sg-motion-duration-state) var(--sg-motion-easing-enter);
}

.sg-button:hover,
.sg-button.is-hover {
  background: var(--_bg-hover);
  border-color: var(--_border-hover);
  color: var(--_fg-hover);
}

.sg-button:active,
.sg-button.is-active {
  background: var(--_bg-pressed);
}

.sg-button--primary {
  --_bg: var(--sg-button-primary-background);
  --_bg-hover: var(--sg-button-primary-background-hover);
  --_bg-pressed: var(--sg-button-primary-background-pressed);
  --_fg: var(--sg-button-primary-text);
  --_fg-hover: var(--sg-button-primary-text);
  --_border: var(--sg-button-primary-background);
  --_border-hover: var(--sg-button-primary-background-hover);
}

.sg-button--tertiary {
  --_bg: var(--sg-button-tertiary-background);
  --_bg-hover: var(--sg-button-tertiary-background-hover);
  --_bg-pressed: var(--sg-button-tertiary-background-pressed);
  --_fg: var(--sg-button-tertiary-text);
  --_fg-hover: var(--sg-button-tertiary-text-hover);
  --_border: var(--sg-button-tertiary-background);
  --_border-hover: var(--sg-button-tertiary-background-hover);
}

.sg-button--danger {
  --_bg: var(--sg-button-danger-background);
  --_bg-hover: var(--sg-button-danger-background-hover);
  --_bg-pressed: var(--sg-button-danger-background-pressed);
  --_fg: var(--sg-button-danger-text);
  --_fg-hover: var(--sg-button-danger-text);
  --_border: var(--sg-button-danger-background);
  --_border-hover: var(--sg-button-danger-background-hover);
}

.sg-button--tertiary.sg-button--icon {
  --_fg: var(--sg-button-tertiary-icon);
  --_fg-hover: var(--sg-button-tertiary-icon-hover);
}

.sg-button--small {
  --sg-icon-size: var(--sg-size-icon-small);
  gap: var(--sg-space-1);
  min-block-size: var(--sg-control-height-small);
}

/* a leading icon carries its own visual space, so that side takes a little less padding and the content reads as centered */
.sg-button:not(.sg-button--icon):has(> :is(.sg-icon, .sg-loader):first-child) {
  padding-inline-start: calc(var(--sg-control-padding-x) - var(--sg-space-1));
}

.sg-button--large {
  min-block-size: var(--sg-control-height-large);
}

.sg-button--icon {
  padding: 0;
  min-inline-size: var(--sg-control-height);
}

.sg-button--icon.sg-button--small {
  min-inline-size: var(--sg-control-height-small);
}

.sg-button--icon.sg-button--large {
  min-inline-size: var(--sg-control-height-large);
}

.sg-button:disabled,
.sg-button[aria-disabled="true"] {
  background: var(--sg-button-disabled-background);
  border-color: var(--sg-button-disabled-border);
  box-shadow: none;
  color: var(--sg-button-disabled-text);
  cursor: not-allowed;
}

.sg-button--tertiary:disabled,
.sg-button--tertiary[aria-disabled="true"] {
  background: var(--sg-button-tertiary-background);
  border-color: var(--sg-button-tertiary-background);
}

/* Forced colors: the primary keeps a filled look. forced-color-adjust: none also stops the text backplate that would hide HighlightText, so every state is spelled out in system colors. */
@media (forced-colors: active) {
  .sg-button--primary {
    forced-color-adjust: none;
    background: Highlight;
    color: HighlightText;
    border-color: Highlight;
  }

  .sg-button--primary:hover,
  .sg-button--primary.is-hover,
  .sg-button--primary:active,
  .sg-button--primary.is-active {
    background: Highlight;
    color: HighlightText;
    border-color: HighlightText;
  }

  .sg-button--primary:disabled,
  .sg-button--primary[aria-disabled="true"] {
    background: ButtonFace;
    color: GrayText;
    border-color: GrayText;
  }
}

.sg-button[aria-busy="true"] {
  cursor: progress;
  pointer-events: none;
}

/* joined buttons. A split button is an action and the icon button that opens its menu. */
.sg-button-group {
  display: inline-flex;
}

.sg-button-group>.sg-button {
  border-radius: 0;
}

.sg-button-group>.sg-button:first-child {
  border-start-start-radius: var(--sg-control-radius);
  border-end-start-radius: var(--sg-control-radius);
}

.sg-button-group>.sg-button:last-child {
  border-start-end-radius: var(--sg-control-radius);
  border-end-end-radius: var(--sg-control-radius);
}

.sg-button-group>.sg-button+.sg-button {
  margin-inline-start: calc(-1 * var(--sg-control-border-width));
}

.sg-button-group>.sg-button--primary+.sg-button--primary,
.sg-button-group>.sg-button--danger+.sg-button--danger {
  margin-inline-start: var(--sg-control-border-width);
}

.sg-button-group>.sg-button:is(:hover, :focus-visible) {
  position: relative;
  z-index: 1;
}

/* ---------- Link ---------- */
.sg-link {
  color: var(--sg-link-text);
  text-decoration: underline;
  text-decoration-thickness: var(--sg-stroke-hairline);
  text-underline-offset: var(--sg-space-1);
}

.sg-link:hover,
.sg-link.is-hover {
  color: var(--sg-link-text-hover);
  text-decoration-thickness: var(--sg-stroke-rule);
}

.sg-link .sg-icon {
  vertical-align: text-bottom;
  margin-inline-start: var(--sg-space-1);
}

/* ---------- Field, input, select, textarea ---------- */
.sg-field {
  display: flex;
  flex-direction: column;
  gap: var(--sg-space-stack-related);
}

.sg-field__label {
  color: var(--sg-input-label);
  font-size: var(--sg-type-body-strong-size);
  line-height: var(--sg-type-body-strong-line);
  font-weight: var(--sg-type-body-strong-weight);
}

.sg-field__help {
  color: var(--sg-input-help);
  font-size: var(--sg-type-caption-size);
  line-height: var(--sg-type-caption-line);
}

.sg-field__error {
  display: flex;
  align-items: flex-start;
  gap: var(--sg-space-inline-icon);
  color: var(--sg-input-error-text);
  font-size: var(--sg-type-caption-size);
  line-height: var(--sg-type-caption-line);
  font-weight: var(--sg-type-body-strong-weight);
}

.sg-field__error .sg-icon {
  --sg-icon-size: var(--sg-size-icon-small);
  color: var(--sg-input-error-icon);
}

.sg-input {
  display: block;
  inline-size: 100%;
  min-block-size: var(--sg-control-height);
  padding: 0 var(--sg-control-padding-x);
  border: var(--sg-control-border-width) solid var(--sg-input-border);
  border-radius: var(--sg-control-radius);
  background: var(--sg-input-background);
  color: var(--sg-input-text);
  font-size: var(--sg-control-font-size);
  line-height: var(--sg-control-line-height);
}

.sg-input::placeholder {
  color: var(--sg-input-placeholder);
  opacity: 1;
}

.sg-input:hover,
.sg-input.is-hover {
  border-color: var(--sg-input-border-hover);
}

.sg-input:focus-visible,
.sg-input.is-focus {
  border-color: var(--sg-input-border-focus);
}

.sg-input[aria-invalid="true"] {
  border-color: var(--sg-input-border-error);
  box-shadow: inset 0 0 0 var(--sg-control-border-width) var(--sg-input-border-error);
}

.sg-input[readonly] {
  background: var(--sg-input-background-readonly);
  border-color: var(--sg-input-border-disabled);
}

.sg-input:disabled {
  background: var(--sg-input-background-disabled);
  border-color: var(--sg-input-border-disabled);
  color: var(--sg-input-text-disabled);
  cursor: not-allowed;
}

textarea.sg-input {
  padding-block: var(--sg-space-2);
  min-block-size: 6rem;
  resize: vertical;
}

.sg-input-group {
  position: relative;
}

.sg-input-group__icon {
  position: absolute;
  inset-block: 0;
  inset-inline-start: var(--sg-control-padding-x);
  margin-block: auto;
  color: var(--sg-input-help);
  pointer-events: none;
}

.sg-input-group .sg-input {
  padding-inline-start: calc(var(--sg-control-padding-x) + var(--sg-control-icon-size) + var(--sg-control-gap));
}

.sg-select {
  position: relative;
}

.sg-select .sg-input {
  appearance: none;
  padding-inline-end: calc(var(--sg-control-padding-x) + var(--sg-control-icon-size) + var(--sg-control-gap));
  cursor: pointer;
}

.sg-select::after {
  content: "";
  position: absolute;
  inset-block: 0;
  inset-inline-end: var(--sg-control-padding-x);
  margin-block: auto;
  inline-size: var(--sg-control-icon-size);
  block-size: var(--sg-control-icon-size);
  background-color: var(--sg-input-text);
  -webkit-mask: var(--sg-i-down-line) center / contain no-repeat;
  mask: var(--sg-i-down-line) center / contain no-repeat;
  pointer-events: none;
}

@media (forced-colors: active) {
  .sg-select::after {
    background-color: ButtonText;
    forced-color-adjust: none;
  }
}

/* ---------- Checkbox and radio ---------- */
.sg-choice {
  display: inline-flex;
  align-items: flex-start;
  gap: var(--sg-control-gap);
  min-block-size: var(--sg-size-target-minimum);
  color: var(--sg-choice-label);
  cursor: pointer;
}

.sg-choice__label {
  font-size: var(--sg-control-font-size);
  line-height: var(--sg-control-line-height);
}

.sg-choice__input {
  appearance: none;
  display: grid;
  place-content: center;
  flex: none;
  inline-size: var(--sg-size-icon-small);
  block-size: var(--sg-size-icon-small);
  margin: calc((var(--sg-control-line-height) - var(--sg-size-icon-small)) / 2) 0 0;
  border: var(--sg-control-border-width) solid var(--sg-choice-border);
  border-radius: var(--sg-radius-mark);
  background: var(--sg-choice-background);
  cursor: pointer;
}

.sg-choice__input[type="radio"] {
  border-radius: var(--sg-radius-round);
}

.sg-choice__input:hover,
.sg-choice__input.is-hover {
  border-color: var(--sg-choice-border-hover);
}

.sg-choice__input::before {
  content: "";
  inline-size: calc(var(--sg-size-icon-small) - 2 * var(--sg-control-border-width));
  block-size: calc(var(--sg-size-icon-small) - 2 * var(--sg-control-border-width));
  background-color: var(--sg-choice-mark);
  visibility: hidden;
  -webkit-mask: var(--sg-i-check-line) center / 100% no-repeat;
  mask: var(--sg-i-check-line) center / 100% no-repeat;
}

.sg-choice__input[type="radio"]::before {
  inline-size: var(--sg-space-2);
  block-size: var(--sg-space-2);
  border-radius: var(--sg-radius-round);
  -webkit-mask: none;
  mask: none;
}

.sg-choice__input:checked,
.sg-choice__input:indeterminate {
  background: var(--sg-choice-background-checked);
  border-color: var(--sg-choice-border-checked);
}

.sg-choice__input:checked::before,
.sg-choice__input:indeterminate::before {
  visibility: visible;
}

.sg-choice__input:indeterminate::before {
  inline-size: var(--sg-space-2);
  block-size: var(--sg-stroke-rule);
  -webkit-mask: none;
  mask: none;
}

.sg-choice__input:disabled {
  background: var(--sg-choice-background-disabled);
  border-color: var(--sg-choice-border-disabled);
  cursor: not-allowed;
}

.sg-choice__input:disabled::before {
  background-color: var(--sg-choice-mark-disabled);
}

.sg-choice:has(:disabled) {
  color: var(--sg-choice-label-disabled);
  cursor: not-allowed;
}

@media (forced-colors: active) {
  .sg-choice__input::before {
    background-color: CanvasText;
    forced-color-adjust: none;
  }

  .sg-choice__input:checked,
  .sg-choice__input:indeterminate {
    background: Highlight;
  }

  .sg-choice__input:checked::before,
  .sg-choice__input:indeterminate::before {
    background-color: HighlightText;
  }
}

/* ---------- Switch ---------- */
.sg-switch {
  display: inline-flex;
  align-items: center;
  gap: var(--sg-control-gap);
  min-block-size: var(--sg-size-target-minimum);
  cursor: pointer;
}

.sg-switch__input {
  appearance: none;
  position: relative;
  flex: none;
  inline-size: 2rem;
  block-size: var(--sg-size-icon-medium);
  margin: 0;
  border: var(--sg-control-border-width) solid var(--sg-switch-track);
  border-radius: var(--sg-radius-round);
  background: var(--sg-switch-background);
  cursor: pointer;
  transition: background-color var(--sg-motion-duration-state) var(--sg-motion-easing-enter);
}

.sg-switch__input::before {
  content: "";
  position: absolute;
  inset-block: 0;
  margin-block: auto;
  inset-inline-start: calc((var(--sg-size-icon-medium) - 2 * var(--sg-control-border-width) - var(--sg-space-3)) / 2);
  inline-size: var(--sg-space-3);
  block-size: var(--sg-space-3);
  border-radius: var(--sg-radius-round);
  background: var(--sg-switch-track);
  transition: translate var(--sg-motion-duration-state) var(--sg-motion-easing-enter), background-color var(--sg-motion-duration-state) var(--sg-motion-easing-enter);
}

.sg-switch__input:checked {
  background: var(--sg-switch-track-checked);
  border-color: var(--sg-switch-track-checked);
}

.sg-switch__input:checked::before {
  background: var(--sg-switch-thumb);
  translate: var(--sg-space-3) 0;
}

.sg-switch__input:disabled {
  background: var(--sg-switch-track-disabled);
  border-color: var(--sg-switch-track-disabled);
  cursor: not-allowed;
}

.sg-switch__input:disabled::before {
  background: var(--sg-switch-thumb-disabled);
}

@media (forced-colors: active) {
  .sg-switch__input::before {
    background-color: CanvasText;
    forced-color-adjust: none;
  }

  .sg-switch__input:checked {
    background: Highlight;
  }

  .sg-switch__input:checked::before {
    background-color: HighlightText;
  }
}

/* ---------- Slider and range ----------
 * Native range inputs over a painted track. The script sets --_b (and --_a for a range), 0 to 1, for the fill. */
.sg-slider {
  --_t: var(--sg-size-16);
  display: flex;
  align-items: center;
  gap: var(--sg-space-3);
  min-block-size: var(--sg-control-height);
}

.sg-slider__track {
  display: grid;
  flex: 1;
  align-items: center;
  min-inline-size: 8rem;
}

.sg-slider__track::before,
.sg-slider__track::after {
  content: "";
  grid-area: 1 / 1;
  block-size: var(--sg-space-1);
  border-radius: var(--sg-radius-round);
  pointer-events: none;
}

.sg-slider__track::before {
  background: var(--sg-slider-track);
}

.sg-slider__track::after {
  inline-size: calc(var(--_t) / 2 + var(--_b, 0) * (100% - var(--_t)));
  background: var(--sg-slider-fill);
}

.sg-slider--range .sg-slider__track::after {
  inline-size: calc((var(--_b, 0) - var(--_a, 0)) * (100% - var(--_t)));
  margin-inline-start: calc(var(--_t) / 2 + var(--_a, 0) * (100% - var(--_t)));
}

.sg-slider__input {
  position: relative;
  z-index: 1;
  grid-area: 1 / 1;
  inline-size: 100%;
  block-size: var(--sg-size-24);
  margin: 0;
  background: transparent;
  -webkit-appearance: none;
  appearance: none;
  cursor: pointer;
}

.sg-slider__input::-webkit-slider-runnable-track {
  block-size: var(--_t);
  background: transparent;
}

.sg-slider__input::-moz-range-track {
  block-size: var(--_t);
  background: transparent;
}

.sg-slider__input::-webkit-slider-thumb {
  box-sizing: border-box;
  inline-size: var(--_t);
  block-size: var(--_t);
  border: var(--sg-stroke-rule) solid var(--sg-slider-thumb-border);
  border-radius: var(--sg-radius-round);
  background: var(--sg-slider-thumb);
  box-shadow: var(--sg-slider-thumb-shadow);
  -webkit-appearance: none;
  appearance: none;
}

.sg-slider__input::-moz-range-thumb {
  box-sizing: border-box;
  inline-size: var(--_t);
  block-size: var(--_t);
  border: var(--sg-stroke-rule) solid var(--sg-slider-thumb-border);
  border-radius: var(--sg-radius-round);
  background: var(--sg-slider-thumb);
  box-shadow: var(--sg-slider-thumb-shadow);
}

/* two thumbs share one track: only the thumbs take the pointer */
.sg-slider--range .sg-slider__input {
  pointer-events: none;
}

.sg-slider--range .sg-slider__input::-webkit-slider-thumb {
  pointer-events: auto;
}

.sg-slider--range .sg-slider__input::-moz-range-thumb {
  pointer-events: auto;
}

.sg-slider__input:disabled {
  cursor: not-allowed;
}

.sg-slider__input:disabled::-webkit-slider-thumb {
  border-color: var(--sg-slider-disabled);
  box-shadow: none;
}

.sg-slider__input:disabled::-moz-range-thumb {
  border-color: var(--sg-slider-disabled);
  box-shadow: none;
}

.sg-slider:has(:disabled) .sg-slider__track::after {
  background: var(--sg-slider-disabled);
}

.sg-slider__value {
  flex: none;
  min-inline-size: 4ch;
  color: var(--sg-slider-value);
  font-variant-numeric: tabular-nums;
  text-align: end;
}

@media (forced-colors: active) {
  .sg-slider__track::before {
    forced-color-adjust: none;
    background: GrayText;
  }

  .sg-slider__track::after {
    forced-color-adjust: none;
    background: Highlight;
  }
}

/* ---------- Tag, status, severity, avatar, kbd ---------- */
.sg-tag {
  display: inline-flex;
  align-items: center;
  block-size: var(--sg-size-tag);
  padding: 0 var(--sg-space-2);
  border-radius: var(--sg-radius-mark);
  background: var(--sg-tag-background);
  color: var(--sg-tag-text);
  font-size: var(--sg-type-label-size);
  line-height: var(--sg-type-label-line);
  font-weight: var(--sg-type-label-weight);
  white-space: nowrap;
}

/* A status is a glyph plus a label. The glyph takes the meaning color (who acts next) and a shape, so it survives grayscale. */
.sg-status {
  --_c: var(--sg-status-act);
  --_g: var(--sg-i-round-line);
  display: inline-flex;
  align-items: center;
  gap: var(--sg-control-gap);
  color: var(--sg-status-text);
  white-space: nowrap;
}

.sg-status::before {
  content: "";
  flex: none;
  inline-size: var(--_s, var(--sg-control-icon-size));
  block-size: var(--_s, var(--sg-control-icon-size));
  background-color: var(--_c);
  -webkit-mask: var(--_g) center / contain no-repeat;
  mask: var(--_g) center / contain no-repeat;
  forced-color-adjust: none;
}

.sg-status--open {
  --_c: var(--sg-status-act);
  --_g: var(--sg-i-round-line);
}

.sg-status--progress {
  --_c: var(--sg-status-act);
  --_g: var(--sg-i-play-circle-line);
}

.sg-status--pending {
  --_c: var(--sg-status-idle);
  --_g: var(--sg-i-time-line);
}

.sg-status--resolved {
  --_c: var(--sg-status-done);
  --_g: var(--sg-i-check-circle-fill);
}

.sg-status--closed {
  --_c: var(--sg-status-idle);
  --_g: var(--sg-i-archive-line);
}

.sg-status--risk {
  --_c: var(--sg-status-risk);
  --_g: var(--sg-i-alert-fill);
}

.sg-status--breach {
  --_c: var(--sg-status-breach);
  --_g: var(--sg-i-alert-octagon-fill);
}

.sg-status--info {
  --_c: var(--sg-status-act);
  --_g: var(--sg-i-information-fill);
}

.sg-status--success {
  --_c: var(--sg-status-done);
  --_g: var(--sg-i-check-circle-fill);
}

.sg-status--warning {
  --_c: var(--sg-status-risk);
  --_g: var(--sg-i-alert-fill);
}

.sg-status--error {
  --_c: var(--sg-status-breach);
  --_g: var(--sg-i-alert-octagon-fill);
}

/* SLA timer: the status vocabulary with a clock. The glyph and the words carry the state; the script counts down to data-due. */
.sg-sla {
  --_c: var(--sg-sla-ok);
  --_g: var(--sg-i-time-line);
  display: inline-flex;
  align-items: center;
  gap: var(--sg-control-gap);
  color: var(--sg-sla-text);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.sg-sla::before {
  content: "";
  flex: none;
  inline-size: var(--_s, var(--sg-control-icon-size));
  block-size: var(--_s, var(--sg-control-icon-size));
  background-color: var(--_c);
  -webkit-mask: var(--_g) center / contain no-repeat;
  mask: var(--_g) center / contain no-repeat;
}

.sg-sla[data-state="risk"] {
  --_c: var(--sg-sla-risk);
  --_g: var(--sg-i-alert-fill);
}

.sg-sla[data-state="breach"] {
  --_c: var(--sg-sla-breach);
  --_g: var(--sg-i-alert-octagon-fill);
  font-weight: var(--sg-type-body-strong-weight);
}

.sg-sla[data-state="met"] {
  --_c: var(--sg-sla-met);
  --_g: var(--sg-i-check-circle-fill);
}

.sg-sla[data-state="paused"] {
  --_c: var(--sg-sla-paused);
  --_g: var(--sg-i-pause-circle-line);
}

.sg-sla__time {
  font-variant-numeric: tabular-nums;
}

.sg-sla__label {
  color: var(--sg-sla-label);
  font-size: var(--sg-type-caption-size);
  line-height: var(--sg-type-caption-line);
  font-weight: var(--sg-type-caption-weight);
}

@media (forced-colors: active) {
  .sg-sla::before {
    background-color: CanvasText;
  }
}

/* sizes: small for list rows and meta lines, large for a record's header; without one, the glyph follows the density */
.sg-status--small,
.sg-sla--small {
  --_s: var(--sg-size-icon-small);
  gap: var(--sg-space-1);
  font-size: var(--sg-type-caption-size);
  line-height: var(--sg-type-caption-line);
}

.sg-status--large,
.sg-sla--large {
  --_s: var(--sg-size-icon-large);
  gap: var(--sg-space-2);
  font-size: var(--sg-type-body-large-size);
  line-height: var(--sg-type-body-large-line);
}

/* severity: the bar width (also the gap) and the four heights are set per size */
.sg-severity {
  --_w: var(--sg-space-1);
  --_h1: var(--sg-space-2);
  --_h2: var(--sg-space-3);
  --_h3: var(--sg-space-4);
  --_h4: var(--sg-size-20);
  display: inline-flex;
  align-items: flex-end;
  gap: var(--_w);
  block-size: var(--_h4);
}

.sg-severity--small {
  --_w: var(--sg-stroke-rule);
  --_h1: var(--sg-space-1);
  --_h2: var(--sg-space-2);
  --_h3: var(--sg-space-3);
  --_h4: var(--sg-space-4);
}

.sg-severity--large {
  --_h1: var(--sg-space-3);
  --_h2: var(--sg-space-4);
  --_h3: var(--sg-size-20);
  --_h4: var(--sg-size-24);
}

.sg-severity>i {
  inline-size: var(--_w);
  background: var(--sg-severity-track);
}

.sg-severity>i:nth-child(1) {
  block-size: var(--_h1);
}

.sg-severity>i:nth-child(2) {
  block-size: var(--_h2);
}

.sg-severity>i:nth-child(3) {
  block-size: var(--_h3);
}

.sg-severity>i:nth-child(4) {
  block-size: var(--_h4);
}

.sg-severity[data-level="1"]>i:nth-child(-n + 1) {
  background: var(--sg-severity-low);
}

.sg-severity[data-level="2"]>i:nth-child(-n + 2) {
  background: var(--sg-severity-medium);
}

.sg-severity[data-level="3"]>i:nth-child(-n + 3) {
  background: var(--sg-severity-high);
}

.sg-severity[data-level="4"]>i:nth-child(-n + 4) {
  background: var(--sg-severity-critical);
}

@media (forced-colors: active) {
  .sg-severity>i {
    background: GrayText;
    forced-color-adjust: none;
  }

  .sg-severity[data-level="1"]>i:nth-child(-n + 1),
  .sg-severity[data-level="2"]>i:nth-child(-n + 2),
  .sg-severity[data-level="3"]>i:nth-child(-n + 3),
  .sg-severity[data-level="4"]>i:nth-child(-n + 4) {
    background: CanvasText;
  }
}

@media (forced-colors: active) {
  .sg-status::before {
    background-color: CanvasText;
  }
}

.sg-avatar {
  display: inline-grid;
  place-items: center;
  flex: none;
  inline-size: var(--sg-size-control-small);
  block-size: var(--sg-size-control-small);
  border-radius: var(--sg-radius-round);
  background: var(--sg-avatar-background);
  color: var(--sg-avatar-text);
  font-size: var(--sg-type-label-size);
  line-height: var(--sg-type-label-line);
  font-weight: var(--sg-type-label-weight);
}

/* ten gradients, picked from the initials by the script or set with data-color: they tell people apart and mean nothing.
 * With no picture the background is bright and airy: a light base with two vivid blooms, each gradient with its own
 * places for them, and ink initials at 7:1 on every stop. It is the same in light and dark; a fine rim keeps the edge
 * where a gradient fades to white. */
.sg-avatar[data-color="1"] {
  --_c1: var(--sg-avatar-gradient-1-from);
  --_c2: var(--sg-avatar-gradient-1-via);
  --_c3: var(--sg-avatar-gradient-1-to);
  --_p2: 10% 100%;
  --_s2: 78%;
  --_p3: 100% 78%;
  --_s3: 62%;
}

.sg-avatar[data-color="2"] {
  --_c1: var(--sg-avatar-gradient-2-from);
  --_c2: var(--sg-avatar-gradient-2-via);
  --_c3: var(--sg-avatar-gradient-2-to);
  --_p2: 8% 92%;
  --_s2: 70%;
  --_p3: 86% 18%;
  --_s3: 62%;
}

.sg-avatar[data-color="3"] {
  --_c1: var(--sg-avatar-gradient-3-from);
  --_c2: var(--sg-avatar-gradient-3-via);
  --_c3: var(--sg-avatar-gradient-3-to);
  --_p2: 64% 30%;
  --_s2: 62%;
  --_p3: 12% 92%;
  --_s3: 60%;
}

.sg-avatar[data-color="4"] {
  --_c1: var(--sg-avatar-gradient-4-from);
  --_c2: var(--sg-avatar-gradient-4-via);
  --_c3: var(--sg-avatar-gradient-4-to);
  --_p2: 4% 62%;
  --_s2: 70%;
  --_p3: 96% 90%;
  --_s3: 74%;
}

.sg-avatar[data-color="5"] {
  --_c1: var(--sg-avatar-gradient-5-from);
  --_c2: var(--sg-avatar-gradient-5-via);
  --_c3: var(--sg-avatar-gradient-5-to);
  --_p2: 50% 118%;
  --_s2: 78%;
  --_p3: 50% 62%;
  --_s3: 60%;
}

.sg-avatar[data-color="6"] {
  --_c1: var(--sg-avatar-gradient-6-from);
  --_c2: var(--sg-avatar-gradient-6-via);
  --_c3: var(--sg-avatar-gradient-6-to);
  --_p2: 0% 6%;
  --_s2: 72%;
  --_p3: 70% 100%;
  --_s3: 70%;
}

.sg-avatar[data-color="7"] {
  --_c1: var(--sg-avatar-gradient-7-from);
  --_c2: var(--sg-avatar-gradient-7-via);
  --_c3: var(--sg-avatar-gradient-7-to);
  --_p2: 30% 20%;
  --_s2: 78%;
  --_p3: 6% 70%;
  --_s3: 60%;
}

.sg-avatar[data-color="8"] {
  --_c1: var(--sg-avatar-gradient-8-from);
  --_c2: var(--sg-avatar-gradient-8-via);
  --_c3: var(--sg-avatar-gradient-8-to);
  --_p2: 92% 12%;
  --_s2: 70%;
  --_p3: 8% 96%;
  --_s3: 66%;
}

.sg-avatar[data-color="9"] {
  --_c1: var(--sg-avatar-gradient-9-from);
  --_c2: var(--sg-avatar-gradient-9-via);
  --_c3: var(--sg-avatar-gradient-9-to);
  --_p2: 90% 96%;
  --_s2: 74%;
  --_p3: 4% 30%;
  --_s3: 60%;
}

.sg-avatar[data-color="10"] {
  --_c1: var(--sg-avatar-gradient-10-from);
  --_c2: var(--sg-avatar-gradient-10-via);
  --_c3: var(--sg-avatar-gradient-10-to);
  --_p2: 14% 12%;
  --_s2: 72%;
  --_p3: 94% 92%;
  --_s3: 68%;
}

.sg-avatar:is([data-color="1"], [data-color="2"], [data-color="3"], [data-color="4"], [data-color="5"], [data-color="6"], [data-color="7"], [data-color="8"], [data-color="9"], [data-color="10"]) {
  --_rim: inset 0 0 0 var(--sg-control-border-width) var(--sg-avatar-rim);
  background:
    radial-gradient(circle at var(--_p2), var(--_c2) 0, transparent var(--_s2)),
    radial-gradient(circle at var(--_p3), var(--_c3) 0, transparent var(--_s3)),
    var(--_c1);
  box-shadow: var(--_rim);
  color: var(--sg-avatar-gradient-text);
}

@media (forced-colors: active) {
  .sg-avatar:is([data-color="1"], [data-color="2"], [data-color="3"], [data-color="4"], [data-color="5"], [data-color="6"], [data-color="7"], [data-color="8"], [data-color="9"], [data-color="10"]) {
    background: Canvas;
  }
}

.sg-kbd {
  display: inline-block;
  min-inline-size: var(--sg-size-icon-medium);
  padding: 0 var(--sg-space-1);
  border: var(--sg-control-border-width) solid var(--sg-kbd-border);
  border-block-end-width: var(--sg-stroke-rule);
  border-radius: var(--sg-radius-mark);
  background: var(--sg-kbd-background);
  color: var(--sg-kbd-text);
  font-size: var(--sg-type-caption-size);
  line-height: var(--sg-type-caption-line);
  font-weight: var(--sg-type-label-weight);
  text-align: center;
  white-space: nowrap;
}

/* ---------- Avatar group ----------
 * Overlapping avatars, each ringed in the surface they sit on, ending in a neutral count of the people not shown. */
.sg-avatar-group {
  display: inline-flex;
  align-items: center;
  padding-inline-start: var(--sg-space-1);
}

.sg-avatar-group>.sg-avatar {
  margin-inline-start: calc(-1 * var(--sg-space-1));
  box-shadow: 0 0 0 var(--sg-stroke-rule) var(--sg-avatar-group-ring), var(--_rim, 0 0 transparent);
}

.sg-avatar-group__more {
  background: var(--sg-avatar-group-more-background);
  color: var(--sg-avatar-group-more-text);
}

@media (forced-colors: active) {
  .sg-avatar-group>.sg-avatar {
    border: var(--sg-control-border-width) solid Canvas;
  }
}

/* ---------- Panel: the only container ----------
 * A raised, rounded surface: hairline, faint shadow, 10px corners. Never nested inside another raised surface. */
.sg-panel {
  padding: var(--sg-space-inset-panel);
  border: var(--sg-control-border-width) solid var(--sg-panel-border);
  border-radius: var(--sg-radius-container);
  background: var(--sg-panel-background);
  box-shadow: var(--sg-panel-shadow);
  color: var(--sg-panel-text);
}

.sg-panel--flush {
  padding: 0;
  overflow: hidden;
}

.sg-panel__title {
  margin-block-end: var(--sg-space-2);
  font-size: var(--sg-type-heading-4-size);
  line-height: var(--sg-type-heading-4-line);
  font-weight: var(--sg-type-heading-4-weight);
}

/* ---------- Banner and classification ---------- */
.sg-banner {
  --_rule: var(--sg-banner-rule-neutral);
  position: relative;
  display: flex;
  align-items: flex-start;
  gap: var(--sg-space-3);
  padding: var(--sg-space-inset-panel) var(--sg-space-inset-panel) var(--sg-space-inset-panel) calc(var(--sg-space-inset-panel) + var(--sg-space-1));
  overflow: hidden;
  border: var(--sg-control-border-width) solid var(--sg-banner-border);
  border-radius: var(--sg-radius-float);
  background: var(--sg-banner-background);
  color: var(--sg-banner-text);
}

/* the status bar is inset against the leading edge and clipped by the corner radius */
.sg-banner::before {
  content: "";
  position: absolute;
  inset-block: 0;
  inset-inline-start: 0;
  inline-size: var(--sg-space-1);
  background: var(--_rule);
}

.sg-banner--info {
  --_rule: var(--sg-banner-info);
}

.sg-banner--success {
  --_rule: var(--sg-banner-success);
}

.sg-banner--warning {
  --_rule: var(--sg-banner-warning);
}

.sg-banner--error {
  --_rule: var(--sg-banner-error);
}

@media (forced-colors: active) {
  .sg-banner::before {
    background: CanvasText;
    forced-color-adjust: none;
  }
}

.sg-banner__icon {
  flex: none;
  color: var(--_rule);
  --sg-icon-size: var(--sg-size-icon-medium);
}

.sg-banner__body {
  flex: 1;
  min-inline-size: 0;
}

.sg-banner__title {
  color: var(--sg-banner-title);
  font-weight: var(--sg-type-body-strong-weight);
}

.sg-banner__actions {
  margin-block-start: var(--sg-space-2);
}

.sg-banner--prominent {
  padding-inline-start: var(--sg-space-inset-panel);
}

.sg-banner--prominent::before {
  display: none;
}

.sg-banner--prominent.sg-banner--warning {
  background: var(--sg-banner-solid-warning);
  border-color: var(--sg-banner-solid-warning);
  color: var(--sg-banner-on-solid-warning);
}

.sg-banner--prominent.sg-banner--error {
  background: var(--sg-banner-solid-error);
  border-color: var(--sg-banner-solid-error);
  color: var(--sg-banner-on-solid-error);
}

.sg-banner--prominent .sg-banner__icon,
.sg-banner--prominent .sg-banner__title {
  color: inherit;
}

.sg-classification {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--sg-space-inline-icon);
  min-block-size: var(--sg-size-24);
  padding: 0 var(--sg-space-4);
  background: var(--sg-classification-background);
  color: var(--sg-classification-text);
  font-size: var(--sg-type-label-size);
  line-height: var(--sg-type-label-line);
  font-weight: var(--sg-type-label-weight);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.sg-classification .sg-icon {
  --sg-icon-size: var(--sg-size-icon-small);
}

.sg-classification :focus-visible {
  outline-color: var(--sg-classification-ring);
}

/* ---------- Toast: a receipt ----------
 * A stub with the shape-coded status glyph and the time, a dashed perforation, then what happened and to what.
 * A 2px line drains along the bottom while an info or success toast runs out; it pauses with the timer. */
.sg-toast-region {
  position: fixed;
  inset-block-end: var(--sg-space-4);
  inset-inline-end: var(--sg-space-4);
  z-index: var(--sg-layer-toast);
  display: flex;
  flex-direction: column;
  gap: var(--sg-space-2);
  inline-size: min(25rem, calc(100vw - 2rem));
}

.sg-toast {
  --_rule: var(--sg-toast-rule-neutral);
  position: relative;
  display: grid;
  grid-template-columns: 4rem minmax(0, 1fr) auto;
  overflow: hidden;
  border: var(--sg-control-border-width) solid var(--sg-toast-border);
  border-radius: var(--sg-radius-float);
  background: var(--sg-toast-background);
  color: var(--sg-toast-text);
  box-shadow: var(--sg-toast-shadow);
  animation: sg-print var(--sg-motion-duration-overlay) var(--sg-motion-easing-enter);
}

.sg-toast--info {
  --_rule: var(--sg-toast-info);
}

.sg-toast--success {
  --_rule: var(--sg-toast-success);
}

.sg-toast--warning {
  --_rule: var(--sg-toast-warning);
}

.sg-toast--error {
  --_rule: var(--sg-toast-error);
}

.sg-toast__stub {
  display: grid;
  align-content: center;
  justify-items: center;
  gap: var(--sg-space-1);
  padding: var(--sg-space-3) var(--sg-space-2);
  border-inline-end: var(--sg-control-border-width) dashed var(--sg-toast-perforation);
  background: var(--sg-toast-stub-background);
}

.sg-toast__icon {
  --sg-icon-size: var(--sg-size-icon-large);
  color: var(--_rule);
}

.sg-toast__time {
  color: var(--sg-toast-time);
  font-size: var(--sg-type-caption-size);
  line-height: var(--sg-type-caption-line);
  font-variant-numeric: tabular-nums;
}

.sg-toast__body {
  min-inline-size: 0;
  padding: var(--sg-space-3) var(--sg-space-2) var(--sg-space-3) var(--sg-space-4);
}

.sg-toast__title {
  font-weight: var(--sg-type-body-strong-weight);
}

.sg-toast__msg {
  overflow-wrap: anywhere;
}

.sg-toast__actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sg-space-1);
  margin-block-start: var(--sg-space-2);
  margin-inline-start: calc(-1 * var(--sg-control-padding-x));
}

.sg-toast__close {
  align-self: start;
  margin: var(--sg-space-1);
}

.sg-toast__timer {
  position: absolute;
  inset-block-end: 0;
  inset-inline-start: 0;
  inline-size: 100%;
  block-size: var(--sg-stroke-rule);
  background: var(--_rule);
  animation: sg-drain var(--sg-toast-time, 8s) linear forwards;
}

.sg-toast:hover .sg-toast__timer,
.sg-toast:focus-within .sg-toast__timer {
  animation-play-state: paused;
}

.sg-toast.is-leaving {
  opacity: 0;
  transition: opacity var(--sg-motion-duration-reveal) var(--sg-motion-easing-exit);
}

@keyframes sg-print {
  from {
    clip-path: inset(0 0 100% 0);
  }

  to {
    clip-path: inset(0);
  }
}

@keyframes sg-drain {
  to {
    inline-size: 0;
  }
}

@keyframes sg-rise {
  from {
    opacity: 0;
    translate: 0 0.5rem;
  }

  to {
    opacity: 1;
    translate: 0 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  .sg-toast__timer {
    animation: none;
  }
}

@media (forced-colors: active) {
  .sg-toast__timer {
    background: CanvasText;
    forced-color-adjust: none;
  }
}

/* ---------- Dialog ----------
 * A severity emblem drawn in the status-shape vocabulary (circle, triangle, octagon), an inset list of exactly what will change,
 * and a footer tray that shows the keys. The body scrolls; the header and tray stay put. */
.sg-dialog {
  --_emblem: var(--sg-dialog-info);
  inline-size: min(30rem, calc(100vw - 2rem));
  max-block-size: calc(100vh - 4rem);
  padding: 0;
  overflow: hidden;
  border: var(--sg-control-border-width) solid var(--sg-dialog-border);
  border-radius: var(--sg-radius-container);
  background: var(--sg-dialog-background);
  color: var(--sg-dialog-text);
  box-shadow: var(--sg-dialog-shadow);
}

.sg-dialog[open] {
  display: flex;
  flex-direction: column;
  animation: sg-rise var(--sg-motion-duration-overlay) var(--sg-motion-easing-enter);
}

.sg-dialog--info {
  --_emblem: var(--sg-dialog-info);
}

.sg-dialog--warning {
  --_emblem: var(--sg-dialog-warning);
}

.sg-dialog--danger {
  --_emblem: var(--sg-dialog-error);
}

.sg-dialog::backdrop {
  background: var(--sg-dialog-scrim);
}

.sg-dialog__header {
  display: flex;
  flex: none;
  align-items: flex-start;
  gap: var(--sg-space-3);
  padding: var(--sg-space-inset-dialog) var(--sg-space-inset-dialog) var(--sg-space-2);
}

.sg-dialog__emblem {
  --sg-icon-size: var(--sg-size-icon-large);
  flex: none;
  margin-block-start: calc((var(--sg-type-heading-4-line) - var(--sg-size-icon-large)) / 2);
  color: var(--_emblem);
}

.sg-dialog__title {
  flex: 1;
  min-inline-size: 0;
  font-size: var(--sg-type-heading-4-size);
  line-height: var(--sg-type-heading-4-line);
  font-weight: var(--sg-type-heading-4-weight);
}

.sg-dialog__body {
  flex: 1 1 auto;
  min-block-size: 0;
  overflow: auto;
  padding: 0 var(--sg-space-inset-dialog) var(--sg-space-inset-dialog);
}

/* with an emblem, the body lines up with the title text rather than the emblem */
.sg-dialog:has(.sg-dialog__emblem) .sg-dialog__body {
  padding-inline-start: calc(var(--sg-space-inset-dialog) + var(--sg-size-icon-large) + var(--sg-space-3));
}

.sg-dialog__impact {
  display: grid;
  margin: var(--sg-space-3) 0 0;
  padding: 0;
  overflow: hidden;
  list-style: none;
  border-radius: var(--sg-radius-float);
  background: var(--sg-dialog-well);
}

.sg-dialog__impact>li {
  display: flex;
  gap: var(--sg-space-3);
  padding: var(--sg-space-2) var(--sg-space-3);
}

.sg-dialog__impact>li+li {
  border-block-start: var(--sg-control-border-width) solid var(--sg-dialog-border);
}

.sg-dialog__impact .sg-num {
  flex: none;
  min-inline-size: 5.5rem;
  font-variant-numeric: tabular-nums;
  font-weight: var(--sg-type-body-strong-weight);
}

.sg-dialog__footer {
  display: flex;
  flex: none;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: var(--sg-space-2) var(--sg-space-inline-control);
  padding: var(--sg-space-3) var(--sg-space-inset-dialog);
  border-block-start: var(--sg-control-border-width) solid var(--sg-dialog-border);
  background: var(--sg-dialog-footer-background);
}

.sg-dialog__keys {
  display: inline-flex;
  align-items: center;
  gap: var(--sg-space-2);
  margin-inline-end: auto;
  color: var(--sg-dialog-keys);
  font-size: var(--sg-type-caption-size);
  line-height: var(--sg-type-caption-line);
}

/* ---------- Drawer ----------
 * A panel that floats in from the edge of the window, inset from it on every side, for record details, filters or a short form
 * that should keep the page in view. A native <dialog>, opened and closed with the same attributes as the dialog.
 * The header and footer stay put; their hairlines appear only while the body scrolls under them. */
.sg-drawer {
  --_gap: var(--sg-space-2);
  --_from: calc(100% + var(--_gap));
  inset-block: var(--_gap);
  inset-inline: auto var(--_gap);
  inline-size: min(30rem, calc(100vw - 2 * var(--_gap)));
  max-inline-size: none;
  block-size: auto;
  max-block-size: none;
  margin: 0;
  padding: 0;
  overflow: hidden;
  border: var(--sg-control-border-width) solid var(--sg-drawer-border);
  border-radius: var(--sg-radius-container);
  background: var(--sg-drawer-background);
  color: var(--sg-drawer-text);
  box-shadow: var(--sg-drawer-shadow);
  transition: translate var(--sg-motion-duration-overlay) var(--sg-motion-easing-enter), opacity var(--sg-motion-duration-overlay) var(--sg-motion-easing-enter), overlay var(--sg-motion-duration-overlay) allow-discrete, display var(--sg-motion-duration-overlay) allow-discrete;
}

.sg-drawer[open] {
  display: flex;
  flex-direction: column;
}

.sg-drawer:not([open]) {
  translate: var(--_from) 0;
  opacity: 0;
}

@starting-style {
  .sg-drawer[open] {
    translate: var(--_from) 0;
    opacity: 0;
  }
}

.sg-drawer--small {
  inline-size: min(20rem, calc(100vw - 2 * var(--_gap)));
}

.sg-drawer--large {
  inline-size: min(40rem, calc(100vw - 2 * var(--_gap)));
}

.sg-drawer--start {
  --_from: calc(-100% - var(--_gap));
  inset-inline: var(--_gap) auto;
}

[dir="rtl"] .sg-drawer {
  --_from: calc(-100% - var(--_gap));
}

[dir="rtl"] .sg-drawer--start {
  --_from: calc(100% + var(--_gap));
}

.sg-drawer::backdrop {
  background: var(--sg-drawer-scrim);
  transition: opacity var(--sg-motion-duration-overlay) var(--sg-motion-easing-enter), overlay var(--sg-motion-duration-overlay) allow-discrete, display var(--sg-motion-duration-overlay) allow-discrete;
}

.sg-drawer:not([open])::backdrop {
  opacity: 0;
}

@starting-style {
  .sg-drawer[open]::backdrop {
    opacity: 0;
  }
}

.sg-drawer [tabindex="-1"]:focus {
  outline: none;
}

.sg-drawer__header {
  display: flex;
  flex: none;
  align-items: flex-start;
  gap: var(--sg-space-3);
  padding: var(--sg-space-4) var(--sg-space-3) var(--sg-space-4) var(--sg-space-6);
  border-block-end: var(--sg-control-border-width) solid transparent;
  transition: border-color var(--sg-motion-duration-state) var(--sg-motion-easing-enter);
}

.sg-drawer.is-scrolled .sg-drawer__header {
  border-block-end-color: var(--sg-drawer-divider);
}

.sg-drawer__header>.sg-button:last-child {
  margin-inline-start: auto;
}

.sg-drawer__heading {
  flex: 1;
  min-inline-size: 0;
  padding-block-start: var(--sg-space-1);
}

.sg-drawer__eyebrow {
  color: var(--sg-drawer-label);
  font-size: var(--sg-type-label-size);
  line-height: var(--sg-type-label-line);
  font-weight: var(--sg-type-label-weight);
}

.sg-drawer__title {
  font-size: var(--sg-type-heading-3-size);
  line-height: var(--sg-type-heading-3-line);
  font-weight: var(--sg-type-heading-3-weight);
  overflow-wrap: anywhere;
}

.sg-drawer__subtitle {
  margin-block-start: var(--sg-space-1);
  color: var(--sg-drawer-meta);
}

.sg-drawer__actions {
  display: flex;
  flex: none;
  align-items: center;
  gap: var(--sg-space-1);
}

.sg-drawer__position {
  padding-inline: var(--sg-space-1);
  color: var(--sg-drawer-meta);
  font-size: var(--sg-type-caption-size);
  line-height: var(--sg-type-caption-line);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.sg-drawer__sep {
  inline-size: var(--sg-control-border-width);
  block-size: var(--sg-space-4);
  margin-inline: var(--sg-space-1);
  background: var(--sg-drawer-divider);
}

.sg-drawer__body {
  flex: 1 1 auto;
  min-block-size: 0;
  overflow: auto;
  overscroll-behavior: contain;
  padding: var(--sg-space-2) var(--sg-space-6) var(--sg-space-6);
}

.sg-drawer__body>*+* {
  margin-block-start: var(--sg-space-6);
}

.sg-drawer__body legend {
  margin-block-end: var(--sg-space-2);
  padding: 0;
}

/* narrow columns: a drawer and a split view's details pane give the label less room */
:is(.sg-drawer, .sg-split__aside, .sg-popover, .sg-hovercard) .sg-kv {
  grid-template-columns: minmax(0, 8rem) minmax(0, 1fr);
}

:is(.sg-drawer, .sg-split__aside, .sg-popover, .sg-hovercard) .sg-kv>dt {
  padding-inline-start: 0;
}

.sg-drawer__section-title {
  margin-block-end: var(--sg-space-2);
  color: var(--sg-drawer-label);
  font-size: var(--sg-type-label-size);
  line-height: var(--sg-type-label-line);
  font-weight: var(--sg-type-label-weight);
}

.sg-drawer__footer {
  display: flex;
  flex: none;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: var(--sg-space-2) var(--sg-space-inline-control);
  padding: var(--sg-space-4) var(--sg-space-6);
  border-block-start: var(--sg-control-border-width) solid transparent;
  transition: border-color var(--sg-motion-duration-state) var(--sg-motion-easing-enter);
}

.sg-drawer.is-scrollable .sg-drawer__footer {
  border-block-start-color: var(--sg-drawer-divider);
}

.sg-drawer__keys {
  display: inline-flex;
  align-items: center;
  gap: var(--sg-space-2);
  margin-inline-end: auto;
  color: var(--sg-drawer-meta);
  font-size: var(--sg-type-caption-size);
  line-height: var(--sg-type-caption-line);
}

@media (max-width: 30rem) {
  .sg-drawer__keys {
    display: none;
  }
}

/* ---------- Menu (Popover API) and tooltip ---------- */
.sg-menu {
  position: fixed;
  margin: 0;
  inset: auto;
  min-inline-size: 12rem;
  padding: var(--sg-space-1);
  border: var(--sg-control-border-width) solid var(--sg-menu-border);
  border-radius: var(--sg-radius-float);
  background: var(--sg-menu-background);
  color: var(--sg-menu-text);
  box-shadow: var(--sg-menu-shadow);
  overflow: visible;
}

/* two rules on purpose: one selector list holding an unknown pseudo-class would be dropped whole by an older browser */
.sg-menu:popover-open {
  display: block;
}

.sg-menu.is-open {
  display: block;
  z-index: var(--sg-layer-overlay);
}

.sg-menu__item {
  position: relative;
  display: flex;
  align-items: center;
  gap: var(--sg-space-inline-icon);
  inline-size: 100%;
  min-block-size: var(--sg-control-height);
  padding: 0 var(--sg-control-padding-x);
  border: var(--sg-control-border-width) solid transparent;
  border-radius: calc(var(--sg-radius-float) - var(--sg-space-1));
  background: transparent;
  color: inherit;
  font-size: var(--sg-control-font-size);
  line-height: var(--sg-control-line-height);
  text-align: start;
  text-decoration: none;
  cursor: pointer;
}

.sg-menu__item>.sg-icon {
  color: var(--sg-menu-icon);
}

/* the highlight: hover, keyboard focus and an open submenu are one clear step above the menu, edged one step further, with the
 * short brand bar Stingray uses for "you are here"; pressed is one more step. The icon, the shortcut and the description turn ink. */
.sg-menu__item:is(:hover, :focus-visible, .is-hover, [aria-expanded="true"]) {
  border-color: var(--sg-menu-item-hover-border);
  background: var(--sg-menu-item-hover);
}

.sg-menu__item:is(:active, .is-active) {
  border-color: var(--sg-menu-item-hover-border);
  background: var(--sg-menu-item-pressed);
}

.sg-menu__item:is(:hover, :focus-visible, :active, .is-hover, .is-active, [aria-expanded="true"])::before {
  content: "";
  position: absolute;
  inset-block: calc(var(--sg-space-2) - var(--sg-control-border-width));
  inset-inline-start: calc(var(--sg-space-1) - var(--sg-control-border-width));
  inline-size: var(--sg-stroke-rule);
  border-radius: var(--sg-radius-round);
  background: var(--sg-menu-indicator);
}

.sg-menu__item:is(:hover, :focus-visible, :active, .is-hover, .is-active, [aria-expanded="true"])> :is(.sg-icon, .sg-menu__shortcut),
.sg-menu__item:is(:hover, :focus-visible, :active, .is-hover, .is-active, [aria-expanded="true"]) .sg-menu__description {
  color: var(--sg-menu-shortcut-hover);
}

.sg-menu__item:is(:hover, :focus-visible, :active, .is-hover, .is-active, [aria-expanded="true"])>.sg-menu__shortcut {
  border-color: var(--sg-menu-shortcut-border-hover);
}

.sg-menu__item:focus-visible {
  outline-offset: calc(-1 * var(--sg-focus-width));
}

/* a destructive item is red at rest; on the highlight its label turns ink, because red text falls under 7:1 on the fill, and the red stays on the icon */
.sg-menu__item--danger {
  color: var(--sg-menu-danger);
}

.sg-menu__item--danger:is(:hover, :focus-visible, :active, .is-hover, .is-active) {
  color: var(--sg-menu-text);
}

.sg-menu__item--danger>.sg-icon,
.sg-menu__item--danger:is(:hover, :focus-visible, :active, .is-hover, .is-active, [aria-expanded="true"])>.sg-icon {
  color: var(--sg-menu-danger-icon);
}

.sg-menu__item[aria-disabled="true"] {
  color: var(--sg-menu-text-disabled);
  cursor: not-allowed;
}

.sg-menu__item[aria-disabled="true"]>.sg-icon {
  color: inherit;
}

.sg-menu__item[aria-disabled="true"]:is(:hover, :active) {
  border-color: transparent;
  background: transparent;
}

.sg-menu__item[aria-disabled="true"]::before {
  content: none;
}

.sg-menu__item[aria-disabled="true"] .sg-menu__description {
  color: var(--sg-menu-description);
}

/* a second line under the label: what the item does, or why it is off */
.sg-menu__text {
  display: grid;
  min-inline-size: 0;
}

.sg-menu__description {
  color: var(--sg-menu-description);
  font-size: var(--sg-type-caption-size);
  line-height: var(--sg-type-caption-line);
}

.sg-menu__item:has(.sg-menu__description) {
  padding-block: var(--sg-space-2);
}

/* a shortcut is a key cap; a chord is one cap per key */
.sg-menu__shortcut {
  flex: none;
  margin-inline-start: auto;
  min-inline-size: var(--sg-size-icon-medium);
  padding: 0 var(--sg-space-1);
  border: var(--sg-control-border-width) solid var(--sg-menu-shortcut-border);
  border-block-end-width: var(--sg-stroke-rule);
  border-radius: var(--sg-radius-mark);
  background: var(--sg-menu-shortcut-background);
  color: var(--sg-menu-shortcut);
  font-size: var(--sg-type-caption-size);
  line-height: var(--sg-type-caption-line);
  font-weight: var(--sg-type-label-weight);
  text-align: center;
  white-space: nowrap;
}

.sg-menu__shortcut+.sg-menu__shortcut {
  margin-inline-start: calc(var(--sg-space-1) - var(--sg-space-inline-icon));
}

/* what the actions apply to, above them */
.sg-menu__header {
  display: grid;
  margin: calc(-1 * var(--sg-space-1)) calc(-1 * var(--sg-space-1)) var(--sg-space-1);
  padding: var(--sg-space-2) var(--sg-control-padding-x);
  border-block-end: var(--sg-control-border-width) solid var(--sg-menu-divider);
}

.sg-menu__context {
  color: var(--sg-menu-header);
  font-family: var(--sg-font-family-mono);
  font-size: var(--sg-type-caption-size);
  line-height: var(--sg-type-caption-line);
  font-weight: var(--sg-type-body-strong-weight);
}

.sg-menu__title {
  overflow: hidden;
  contain: inline-size;
  color: var(--sg-menu-header-meta);
  font-size: var(--sg-type-caption-size);
  line-height: var(--sg-type-caption-line);
  white-space: nowrap;
  text-overflow: ellipsis;
}

@media (forced-colors: active) {

  .sg-menu__item::before,
  .sg-combobox__option::before,
  .sg-palette__option::before {
    forced-color-adjust: none;
    background: Highlight;
  }
}

.sg-menu__divider {
  block-size: 0;
  margin: var(--sg-space-1) calc(-1 * var(--sg-space-1));
  border: 0;
  border-block-start: var(--sg-control-border-width) solid var(--sg-menu-divider);
}

/* an item that opens a submenu: a chevron at the end, and the highlight while its submenu is open */
.sg-menu__item[aria-haspopup="menu"]::after {
  content: "";
  flex: none;
  inline-size: var(--sg-size-icon-small);
  block-size: var(--sg-size-icon-small);
  margin-inline-start: auto;
  background-color: var(--sg-menu-submenu);
  -webkit-mask: var(--sg-i-right-line) center / contain no-repeat;
  mask: var(--sg-i-right-line) center / contain no-repeat;
}

[dir="rtl"] .sg-menu__item[aria-haspopup="menu"]::after {
  rotate: 180deg;
}

@media (forced-colors: active) {
  .sg-menu__item[aria-haspopup="menu"]::after {
    background-color: CanvasText;
  }
}

.sg-tooltip {
  position: fixed;
  z-index: var(--sg-layer-tooltip);
  max-inline-size: 20rem;
  padding: var(--sg-space-1) var(--sg-space-2);
  border-radius: var(--sg-radius-control);
  background: var(--sg-tooltip-background);
  color: var(--sg-tooltip-text);
  font-size: var(--sg-type-caption-size);
  line-height: var(--sg-type-caption-line);
}

/* ---------- Popover and hover card ----------
 * A non-modal panel beside its trigger. The script places it on data-side and flips it when there is no room. */
.sg-popover,
.sg-hovercard {
  position: fixed;
  inset: auto;
  inline-size: max-content;
  max-inline-size: min(22rem, calc(100vw - 2 * var(--sg-space-2)));
  max-block-size: calc(100vh - 2 * var(--sg-space-2));
  margin: 0;
  padding: 0;
  overflow: auto;
  border: var(--sg-control-border-width) solid var(--sg-popover-border);
  border-radius: var(--sg-radius-float);
  background: var(--sg-popover-background);
  color: var(--sg-popover-text);
  box-shadow: var(--sg-popover-shadow);
}

.sg-popover.is-open {
  z-index: var(--sg-layer-overlay);
}

.sg-popover:focus-visible {
  outline-offset: calc(-1 * var(--sg-focus-width));
}

.sg-popover__header {
  display: flex;
  align-items: center;
  gap: var(--sg-space-2);
  padding: var(--sg-space-3) var(--sg-space-3) 0 var(--sg-space-4);
}

.sg-popover__title {
  flex: 1;
  min-inline-size: 0;
  font-size: var(--sg-type-body-strong-size);
  line-height: var(--sg-type-body-strong-line);
  font-weight: var(--sg-type-body-strong-weight);
}

.sg-popover__body {
  padding: var(--sg-space-3) var(--sg-space-4) var(--sg-space-4);
}

.sg-popover__header+.sg-popover__body {
  padding-block-start: var(--sg-space-2);
}

.sg-popover__meta {
  color: var(--sg-popover-meta);
  font-size: var(--sg-type-caption-size);
  line-height: var(--sg-type-caption-line);
}

.sg-popover__footer {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: var(--sg-control-gap);
  padding: var(--sg-space-3) var(--sg-space-4);
  border-block-start: var(--sg-control-border-width) solid var(--sg-popover-divider);
}

.sg-hovercard {
  inline-size: 20rem;
  padding: var(--sg-space-4);
}

.sg-hovercard__head {
  display: flex;
  align-items: center;
  gap: var(--sg-space-3);
}

.sg-hovercard__head+* {
  margin-block-start: var(--sg-space-3);
}

/* ---------- Tabs and segmented control ----------
 * The hidden ::after twin holds the semibold width, so selecting never shifts neighbors, and it has no height, so it never moves the label off centre. stingray.js fills data-text.
 * Tabs mark the current one with a short 2px ink bar with round ends. A segmented control is an inset track with a raised thumb:
 * the track is 6px, the thumb 4px, so the corners are concentric across the 2px inset. */
/* the hairline is drawn inside the row, so the tabs and their bar sit on it without making the row overflow (and show a scrollbar) */
.sg-tabs {
  display: flex;
  gap: var(--sg-space-1);
  overflow-x: auto;
  overflow-y: hidden;
  box-shadow: inset 0 calc(-1 * var(--sg-control-border-width)) 0 var(--sg-tabs-border);
}

@media (forced-colors: active) {
  .sg-tabs {
    border-block-end: var(--sg-control-border-width) solid CanvasText;
  }
}

.sg-tab {
  position: relative;
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-block-size: var(--sg-control-height);
  padding: 0 var(--sg-control-padding-x);
  border: 0;
  border-radius: var(--sg-radius-control) var(--sg-radius-control) 0 0;
  background: transparent;
  color: var(--sg-tabs-text);
  font-size: var(--sg-control-font-size);
  line-height: var(--sg-control-line-height);
  white-space: nowrap;
  cursor: pointer;
}

.sg-tab::after {
  content: attr(data-text);
  block-size: 0;
  overflow: hidden;
  visibility: hidden;
  font-weight: var(--sg-type-body-strong-weight);
}

.sg-tab:hover,
.sg-tab.is-hover {
  background: var(--sg-tabs-item-hover);
  color: var(--sg-tabs-text-hover);
}

.sg-tab[aria-selected="true"] {
  color: var(--sg-tabs-text-selected);
  font-weight: var(--sg-type-body-strong-weight);
}

.sg-tab[aria-selected="true"]::before {
  content: "";
  position: absolute;
  inset-inline: var(--sg-control-padding-x);
  inset-block-end: 0;
  block-size: var(--sg-stroke-rule);
  border-radius: var(--sg-radius-round);
  background: var(--sg-tabs-indicator);
}

.sg-tab:focus-visible {
  outline-offset: calc(-1 * var(--sg-focus-width));
}

@media (forced-colors: active) {
  .sg-tab[aria-selected="true"]::before {
    background: Highlight;
    forced-color-adjust: none;
  }
}

.sg-tabpanel {
  padding-block: var(--sg-space-4);
}

/* a tab that can close: the cross sits inside the tab; Delete closes the focused tab */
.sg-tab:has(> .sg-tab__close) {
  padding-inline-end: calc(var(--sg-space-2) + var(--sg-size-target-minimum));
}

.sg-tab__close {
  position: absolute;
  inset-block-start: 50%;
  inset-inline-end: var(--sg-space-1);
  display: grid;
  place-items: center;
  inline-size: var(--sg-size-target-minimum);
  block-size: var(--sg-size-target-minimum);
  border-radius: var(--sg-radius-mark);
  translate: 0 -50%;
}

.sg-tab__close::before {
  content: "";
  inline-size: var(--sg-size-icon-small);
  block-size: var(--sg-size-icon-small);
  background-color: var(--sg-tabs-close);
  -webkit-mask: var(--sg-i-close-line) center / contain no-repeat;
  mask: var(--sg-i-close-line) center / contain no-repeat;
}

.sg-tab__close:hover {
  background: var(--sg-tabs-close-hover);
}

.sg-tab__close:hover::before {
  background-color: var(--sg-tabs-close-hover-icon);
}

@media (forced-colors: active) {
  .sg-tab__close::before {
    background-color: CanvasText;
  }
}

.sg-segmented {
  display: inline-flex;
  gap: var(--sg-stroke-rule);
  margin: 0;
  padding: var(--sg-stroke-rule);
  border: var(--sg-control-border-width) solid var(--sg-segmented-border);
  border-radius: var(--sg-radius-track);
  background: var(--sg-segmented-background);
}

/* fill: equal segments across the container; on a screen too narrow for one row they wrap instead of spilling out */
.sg-segmented--fill {
  display: flex;
  flex-wrap: wrap;
}

.sg-segmented--fill>.sg-segmented__item {
  flex: 1;
  padding-inline: var(--sg-space-2);
}

.sg-segmented__item {
  position: relative;
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-block-size: calc(var(--sg-control-height) - 2 * var(--sg-stroke-rule) - 2 * var(--sg-control-border-width));
  padding: 0 var(--sg-control-padding-x);
  border: var(--sg-control-border-width) solid transparent;
  border-radius: var(--sg-radius-control);
  color: var(--sg-segmented-text);
  font-size: var(--sg-control-font-size);
  line-height: var(--sg-control-line-height);
  white-space: nowrap;
  cursor: pointer;
  transition: background-color var(--sg-motion-duration-state) var(--sg-motion-easing-enter), color var(--sg-motion-duration-state) var(--sg-motion-easing-enter);
}

.sg-segmented__item::after {
  content: attr(data-text);
  block-size: 0;
  overflow: hidden;
  visibility: hidden;
  font-weight: var(--sg-type-body-strong-weight);
}

.sg-segmented__input {
  position: absolute;
  inset: 0;
  margin: 0;
  opacity: 0;
  cursor: pointer;
}

.sg-segmented__input:focus-visible {
  outline: none;
}

.sg-segmented__item:hover,
.sg-segmented__item.is-hover {
  color: var(--sg-segmented-text-hover);
}

.sg-segmented__item:has(:checked) {
  border-color: var(--sg-segmented-selected-border);
  background: var(--sg-segmented-selected-background);
  box-shadow: var(--sg-segmented-selected-shadow);
  color: var(--sg-segmented-selected-text);
  font-weight: var(--sg-type-body-strong-weight);
}

/* separate rule on purpose: a static preview marks its selected segment with a class instead of a checked radio */
.sg-segmented__item.is-selected {
  border-color: var(--sg-segmented-selected-border);
  background: var(--sg-segmented-selected-background);
  box-shadow: var(--sg-segmented-selected-shadow);
  color: var(--sg-segmented-selected-text);
  font-weight: var(--sg-type-body-strong-weight);
}

.sg-segmented__item:has(:focus-visible) {
  outline: var(--sg-focus-width) solid var(--sg-focus-ring);
  outline-offset: var(--sg-focus-offset);
  z-index: 1;
}

@media (forced-colors: active) {
  .sg-segmented__item:has(:checked) {
    forced-color-adjust: none;
    border-color: Highlight;
    background: Highlight;
    color: HighlightText;
  }
}

/* ---------- Data table and grid ----------
 * One raised, rounded frame; a tinted header with a hairline under it; hairlines between rows. No zebra and no row hover: the selected row is the only fill a row ever gets. */
.sg-table-wrap {
  overflow: auto;
  border: var(--sg-control-border-width) solid var(--sg-table-border);
  border-radius: var(--sg-radius-container);
  background: var(--sg-table-background);
  box-shadow: var(--sg-table-shadow);
}

.sg-table-wrap:focus-visible {
  outline-offset: calc(-1 * var(--sg-focus-width));
}

.sg-table-wrap {
  scroll-padding-block-start: var(--sg-table-row-height);
}

.sg-table {
  inline-size: 100%;
  border-collapse: separate;
  border-spacing: 0;
  color: var(--sg-table-text);
  font-size: var(--sg-table-font-size);
  line-height: var(--sg-table-line-height);
}

.sg-table caption {
  padding: var(--sg-space-2) 0;
  text-align: start;
  color: var(--sg-table-text-secondary);
}

.sg-table :where(th, td) {
  block-size: var(--sg-table-row-height);
  padding: 0 var(--sg-table-cell-x);
  border-block-end: var(--sg-control-border-width) solid var(--sg-table-row-divider);
  text-align: start;
  vertical-align: middle;
  white-space: nowrap;
}

.sg-table thead th {
  position: sticky;
  inset-block-start: 0;
  z-index: var(--sg-layer-sticky);
  border-block-end-color: var(--sg-table-header-border);
  background: var(--sg-table-header-background);
  color: var(--sg-table-header-text);
  font-weight: var(--sg-type-label-weight);
}

.sg-table .sg-num-end {
  text-align: end;
}

.sg-table tbody tr[aria-selected="true"] {
  background: var(--sg-table-row-selected);
}

.sg-table tbody tr[aria-selected="true"]> :first-child {
  position: relative;
}

.sg-table tbody tr[aria-selected="true"]> :first-child::before {
  content: "";
  position: absolute;
  inset-block: var(--sg-space-1);
  inset-inline-start: var(--sg-space-1);
  inline-size: var(--sg-space-1);
  border-radius: var(--sg-radius-round);
  background: var(--sg-table-selection-bar);
}

.sg-table:not(:has(tfoot)) tbody tr:last-child> :where(th, td) {
  border-block-end: 0;
}

.sg-table :where(th, td):focus-visible {
  outline-offset: calc(-1 * var(--sg-focus-width));
}

.sg-table__select {
  inline-size: var(--sg-size-control-small);
  padding-inline: 0;
  text-align: center;
}

.sg-table__select .sg-choice {
  justify-content: center;
  min-block-size: 0;
}

.sg-table__sort {
  display: inline-flex;
  align-items: center;
  gap: var(--sg-space-inline-tight);
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  cursor: pointer;
}

.sg-table__sort::after {
  content: "";
  inline-size: var(--sg-size-icon-small);
  block-size: var(--sg-size-icon-small);
  background-color: var(--sg-table-sort-icon);
  -webkit-mask: var(--sg-i-transfer-vertical-line) center / contain no-repeat;
  mask: var(--sg-i-transfer-vertical-line) center / contain no-repeat;
  forced-color-adjust: none;
}

th[aria-sort="ascending"]>.sg-table__sort::after {
  background-color: var(--sg-table-sort-icon-active);
  -webkit-mask-image: var(--sg-i-sort-ascending-line);
  mask-image: var(--sg-i-sort-ascending-line);
}

th[aria-sort="descending"]>.sg-table__sort::after {
  background-color: var(--sg-table-sort-icon-active);
  -webkit-mask-image: var(--sg-i-sort-descending-line);
  mask-image: var(--sg-i-sort-descending-line);
}

th[aria-sort="ascending"],
th[aria-sort="descending"] {
  color: var(--sg-table-text);
}

@media (forced-colors: active) {

  .sg-table__sort::after,
  th[aria-sort]>.sg-table__sort::after {
    background-color: CanvasText;
  }
}

.sg-table__truncate {
  display: block;
  max-inline-size: 16rem;
  overflow: hidden;
  text-overflow: ellipsis;
}

@media (forced-colors: active) {
  .sg-table tbody tr[aria-selected="true"]> :first-child::before {
    background: Highlight;
    forced-color-adjust: none;
  }
}

/* Two-line rows for queues: subject first, metadata second. Height follows content (8px above and below), never a fixed row height. */
.sg-table--two-line :where(th, td) {
  block-size: auto;
  padding-block: var(--sg-space-2);
  white-space: normal;
}

.sg-table tfoot :where(th, td) {
  border-block-end: 0;
  border-block-start: var(--sg-control-border-width) solid var(--sg-table-header-border);
  background: var(--sg-table-header-background);
  font-weight: var(--sg-type-label-weight);
}

.sg-table__title {
  display: block;
  font-weight: var(--sg-type-body-strong-weight);
}

.sg-table__meta {
  display: block;
  color: var(--sg-table-text-secondary);
  font-size: var(--sg-type-caption-size);
  line-height: var(--sg-type-caption-line);
}

/* a row that opens: the toggle is a chevron that turns, and the detail row spans the table on the subtle band */
.sg-table__toggle {
  inline-size: var(--sg-size-control-small);
  padding-inline: 0;
  text-align: center;
}

.sg-table__expand {
  display: inline-grid;
  place-items: center;
  inline-size: var(--sg-size-target-minimum);
  block-size: var(--sg-size-target-minimum);
  padding: 0;
  border: 0;
  border-radius: var(--sg-radius-mark);
  background: transparent;
  vertical-align: middle;
  cursor: pointer;
}

.sg-table__expand::before {
  content: "";
  inline-size: var(--sg-size-icon-small);
  block-size: var(--sg-size-icon-small);
  background-color: var(--sg-table-expand-icon);
  -webkit-mask: var(--sg-i-right-line) center / contain no-repeat;
  mask: var(--sg-i-right-line) center / contain no-repeat;
  transition: rotate var(--sg-motion-duration-state) var(--sg-motion-easing-enter);
}

.sg-table__expand[aria-expanded="true"]::before {
  rotate: 90deg;
}

[dir="rtl"] .sg-table__expand:not([aria-expanded="true"])::before {
  rotate: 180deg;
}

.sg-table__detail>td {
  block-size: auto;
  padding: var(--sg-space-3) var(--sg-table-cell-x);
  background: var(--sg-table-detail-background);
  white-space: normal;
}

/* the first column stays while the rest scrolls sideways; with a select column, both stay */
.sg-table--pin-first :where(th, td):first-child,
.sg-table--pin-first :is(.sg-table__select, .sg-table__toggle)+ :where(th, td) {
  position: sticky;
  z-index: 1;
  background: var(--sg-table-background);
}

.sg-table--pin-first :where(th, td):first-child {
  inset-inline-start: 0;
}

.sg-table--pin-first :is(.sg-table__select, .sg-table__toggle)+ :where(th, td) {
  inset-inline-start: var(--sg-size-control-small);
}

.sg-table--pin-first :where(th, td):first-child:not(.sg-table__select, .sg-table__toggle),
.sg-table--pin-first :is(.sg-table__select, .sg-table__toggle)+ :where(th, td) {
  border-inline-end: var(--sg-control-border-width) solid var(--sg-table-pin-border);
}

.sg-table--pin-first thead th:first-child,
.sg-table--pin-first thead :is(.sg-table__select, .sg-table__toggle)+th {
  z-index: calc(var(--sg-layer-sticky) + 1);
  background: var(--sg-table-header-background);
}

.sg-table--pin-first tbody tr[aria-selected="true"]> :is(:first-child, :is(.sg-table__select, .sg-table__toggle) + *) {
  background: var(--sg-table-row-selected);
}

.sg-table.sg-table--pin-first tbody tr[aria-selected="true"]> :first-child {
  position: sticky;
}

.sg-table--pin-first .sg-table__detail>td {
  position: static;
  border-inline-end: 0;
  background: var(--sg-table-detail-background);
}

/* column resize: a handle on the trailing edge of the header cell. Once a column is resized the table keeps exact widths and cuts long cells with an ellipsis. */
.sg-table__resizer {
  position: absolute;
  inset-block: 0;
  inset-inline-end: 0;
  inline-size: var(--sg-space-2);
  cursor: col-resize;
  touch-action: none;
}

.sg-table__resizer::after {
  content: "";
  position: absolute;
  inset-block: var(--sg-space-1);
  inset-inline-end: 0;
  inline-size: var(--sg-stroke-rule);
  border-radius: var(--sg-radius-round);
}

th:hover>.sg-table__resizer::after,
th:focus-visible>.sg-table__resizer::after,
.sg-table__resizer.is-dragging::after {
  background: var(--sg-table-resizer);
}

.sg-table.is-resized {
  table-layout: fixed;
}

.sg-table.is-resized :where(th, td) {
  overflow: hidden;
  text-overflow: ellipsis;
}

@media (forced-colors: active) {
  .sg-table__expand::before {
    background-color: CanvasText;
  }

  th:hover>.sg-table__resizer::after,
  .sg-table__resizer.is-dragging::after {
    background: Highlight;
  }
}

/* ---------- Pagination, breadcrumb, nav ---------- */
.sg-pagination {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--sg-space-3);
  font-size: var(--sg-control-font-size);
  line-height: var(--sg-control-line-height);
}

.sg-pagination__range {
  margin-inline-end: auto;
  color: var(--sg-pagination-text-current);
}

.sg-pagination__list {
  display: flex;
  gap: var(--sg-space-1);
  margin: 0;
  padding: 0;
  list-style: none;
}

.sg-pagination__item {
  position: relative;
  display: inline-grid;
  place-items: center;
  min-block-size: var(--sg-control-height);
  min-inline-size: var(--sg-control-height);
  padding: 0 var(--sg-space-2);
  border: 0;
  border-radius: var(--sg-radius-control);
  background: transparent;
  color: var(--sg-pagination-text);
  text-decoration: none;
  cursor: pointer;
}

.sg-pagination__item:hover,
.sg-pagination__item.is-hover {
  background: var(--sg-button-tertiary-background-hover);
  color: var(--sg-link-text-hover);
}

.sg-pagination__item[aria-current="page"] {
  background: var(--sg-pagination-background-current);
  color: var(--sg-pagination-text-current);
  font-weight: var(--sg-type-body-strong-weight);
}

.sg-pagination__item[aria-current="page"]::after {
  content: "";
  position: absolute;
  inset-inline: var(--sg-space-2);
  inset-block-end: var(--sg-space-1);
  block-size: var(--sg-stroke-rule);
  border-radius: var(--sg-radius-round);
  background: var(--sg-pagination-indicator);
}

.sg-pagination__item[aria-disabled="true"] {
  color: var(--sg-pagination-text-disabled);
  pointer-events: none;
}

.sg-breadcrumb ol {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  margin: 0;
  padding: 0;
  list-style: none;
}

.sg-breadcrumb li+li::before {
  content: "";
  display: inline-block;
  inline-size: var(--sg-size-icon-small);
  block-size: var(--sg-size-icon-small);
  margin-inline: var(--sg-space-1);
  vertical-align: text-bottom;
  background-color: var(--sg-breadcrumb-separator);
  -webkit-mask: var(--sg-i-right-line) center / contain no-repeat;
  mask: var(--sg-i-right-line) center / contain no-repeat;
  forced-color-adjust: none;
}

@media (forced-colors: active) {
  .sg-breadcrumb li+li::before {
    background-color: CanvasText;
  }
}

.sg-breadcrumb a {
  color: var(--sg-breadcrumb-text);
  text-underline-offset: var(--sg-space-1);
}

.sg-breadcrumb [aria-current="page"] {
  color: var(--sg-breadcrumb-text-current);
  font-weight: var(--sg-type-body-strong-weight);
}

.sg-nav__heading {
  margin: var(--sg-space-4) 0 var(--sg-space-1);
  padding: 0 var(--sg-control-padding-x);
  color: var(--sg-nav-heading);
  font-size: var(--sg-type-label-size);
  line-height: var(--sg-type-label-line);
  font-weight: var(--sg-type-label-weight);
}

.sg-nav__list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.sg-nav__link {
  position: relative;
  display: flex;
  align-items: center;
  gap: var(--sg-control-gap);
  min-block-size: var(--sg-control-height);
  padding: 0 var(--sg-control-padding-x);
  border: var(--sg-control-border-width) solid transparent;
  border-radius: var(--sg-radius-control);
  color: var(--sg-nav-text);
  font-size: var(--sg-control-font-size);
  line-height: var(--sg-control-line-height);
  text-decoration: none;
}

.sg-nav__text {
  display: inline-grid;
}

.sg-nav__text::after {
  content: attr(data-text);
  grid-area: 1 / 1;
  block-size: 0;
  overflow: hidden;
  visibility: hidden;
  font-weight: var(--sg-type-body-strong-weight);
}

.sg-nav__link:hover,
.sg-nav__link.is-hover {
  background: var(--sg-nav-item-hover);
  color: var(--sg-nav-text-current);
}

.sg-nav__link:focus-visible {
  outline-offset: calc(-1 * var(--sg-focus-width));
}

.sg-nav__link[aria-current="page"] {
  border-color: var(--sg-nav-current-border);
  background: var(--sg-nav-current-background);
  box-shadow: var(--sg-nav-current-shadow);
  color: var(--sg-nav-text-current);
  font-weight: var(--sg-type-body-strong-weight);
}

.sg-nav__link[aria-current="page"]::before {
  content: "";
  position: absolute;
  inset-block: var(--sg-space-2);
  inset-inline-start: var(--sg-space-1);
  inline-size: var(--sg-stroke-rule);
  border-radius: var(--sg-radius-round);
  background: var(--sg-nav-indicator);
}

.sg-nav__link>.sg-count {
  margin-inline-start: auto;
}

@media (forced-colors: active) {
  .sg-nav__link[aria-current="page"]::before {
    background: Highlight;
    forced-color-adjust: none;
  }
}

/* ---------- Stat, meter, timeline, key-value, provenance, empty ---------- */
/* one raised strip; each cell draws a hairline on its leading and top edges, and the strip clips the outer ones, so dividers stay correct however the cells wrap */
.sg-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(10rem, 1fr));
  overflow: hidden;
  border: var(--sg-control-border-width) solid var(--sg-stat-border);
  border-radius: var(--sg-radius-container);
  background: var(--sg-stat-background);
  box-shadow: var(--sg-stat-shadow);
}

.sg-stat {
  display: flex;
  flex-direction: column;
  gap: var(--sg-space-1);
  min-inline-size: 0;
  padding: var(--sg-space-4);
}

.sg-stats>.sg-stat {
  box-shadow: calc(-1 * var(--sg-control-border-width)) 0 0 0 var(--sg-stat-divider), 0 calc(-1 * var(--sg-control-border-width)) 0 0 var(--sg-stat-divider);
}

.sg-stat__label {
  color: var(--sg-stat-label);
}

.sg-stat__value {
  color: var(--sg-stat-value);
  font-size: var(--sg-type-heading-1-size);
  line-height: var(--sg-type-heading-1-line);
  font-weight: var(--sg-type-heading-1-weight);
  letter-spacing: var(--sg-type-heading-1-tracking);
}

.sg-stat--hero .sg-stat__value {
  font-size: var(--sg-type-hero-size);
  line-height: var(--sg-type-hero-line);
  font-weight: var(--sg-type-hero-weight);
  letter-spacing: var(--sg-type-hero-tracking);
}

.sg-stat__delta {
  display: inline-flex;
  align-items: center;
  gap: var(--sg-space-inline-tight);
  color: var(--sg-stat-delta-neutral);
  font-weight: var(--sg-type-body-strong-weight);
}

.sg-stat__delta--good {
  color: var(--sg-stat-delta-good);
}

.sg-stat__delta--bad {
  color: var(--sg-stat-delta-bad);
}

.sg-stat__delta .sg-icon {
  --sg-icon-size: var(--sg-size-icon-small);
}

.sg-stat__trend {
  block-size: var(--sg-size-28);
  margin-block-start: var(--sg-space-1);
}

.sg-stat__trend svg {
  display: block;
  inline-size: 100%;
  block-size: 100%;
  overflow: visible;
}

.sg-meter {
  --sg-meter-value: 0%;
  position: relative;
  block-size: var(--sg-space-1);
  overflow: hidden;
  border-radius: var(--sg-radius-round);
  background: var(--sg-meter-track);
}

.sg-meter--large {
  block-size: var(--sg-space-2);
}

.sg-meter__fill {
  display: block;
  block-size: 100%;
  inline-size: var(--sg-meter-value);
  background: var(--sg-meter-fill);
  transition: inline-size var(--sg-motion-duration-reveal) var(--sg-motion-easing-enter);
}

.sg-meter[data-state="risk"] .sg-meter__fill {
  background: var(--sg-meter-fill-risk);
}

.sg-meter[data-state="breach"] .sg-meter__fill {
  background: var(--sg-meter-fill-breach);
}

@media (forced-colors: active) {
  .sg-meter {
    background: GrayText;
    forced-color-adjust: none;
  }

  .sg-meter__fill {
    background: Highlight;
  }
}

/* timeline: each event on a hairline rail, marked by the person who acted (or an icon for the system) with a small glyph for its kind; one sentence with the time at the end, and what was written as a card below it */
.sg-timeline {
  margin: 0;
  padding: 0;
  list-style: none;
  color: var(--sg-timeline-text);
}

.sg-timeline__day {
  margin: 0 0 var(--sg-space-3);
  padding-inline-start: calc(var(--sg-size-control-small) + var(--sg-space-3));
  color: var(--sg-timeline-meta);
  font-size: var(--sg-type-caption-size);
  line-height: var(--sg-type-caption-line);
  font-weight: var(--sg-type-body-strong-weight);
}

.sg-timeline:not([hidden])+.sg-timeline__day {
  margin-block-start: var(--sg-space-6);
}

.sg-timeline__item {
  position: relative;
  display: grid;
  gap: var(--sg-space-2);
  padding-block: 0 var(--sg-space-6);
  padding-inline: calc(var(--sg-size-control-small) + var(--sg-space-3)) 0;
}

.sg-timeline__item--minor {
  padding-block-end: var(--sg-space-4);
}

.sg-timeline__item::before {
  content: "";
  position: absolute;
  inset-block: calc(var(--sg-size-control-small) + var(--sg-space-2)) var(--sg-space-1);
  inset-inline-start: calc((var(--sg-size-control-small) - var(--sg-control-border-width)) / 2);
  inline-size: var(--sg-control-border-width);
  background: var(--sg-timeline-line);
}

/* the last event still shown, after a filter too, ends the rail */
.sg-timeline__item:not(:has(~ .sg-timeline__item:not([hidden]))) {
  padding-block-end: 0;
}

.sg-timeline__item:not(:has(~ .sg-timeline__item:not([hidden])))::before {
  display: none;
}

.sg-timeline__marker {
  position: absolute;
  inset-block-start: 0;
  inset-inline-start: 0;
  display: grid;
  place-items: center;
  inline-size: var(--sg-size-control-small);
  block-size: var(--sg-size-control-small);
  color: var(--sg-timeline-icon);
}

.sg-timeline__marker>.sg-icon {
  --sg-icon-size: var(--sg-size-icon-small);
}

.sg-timeline__marker--done {
  color: var(--sg-timeline-done);
}

/* the kind glyph sits on the avatar's corner, ringed in the surface so it reads as its own mark */
.sg-timeline__kind {
  --_edge: var(--sg-timeline-kind-border);
  position: absolute;
  inset-block-end: calc(-1 * var(--sg-space-2));
  inset-inline-end: calc(-1 * var(--sg-space-2));
  display: grid;
  place-items: center;
  inline-size: var(--sg-size-16);
  block-size: var(--sg-size-16);
  border-radius: var(--sg-radius-round);
  background: var(--sg-timeline-kind-background);
  box-shadow: 0 0 0 var(--sg-stroke-rule) var(--sg-timeline-kind-ring), inset 0 0 0 var(--sg-control-border-width) var(--_edge);
  color: var(--sg-timeline-icon);
}

.sg-timeline__kind>.sg-icon {
  --sg-icon-size: var(--sg-space-3);
}

.sg-timeline__kind--reply {
  --_edge: transparent;
  background: var(--sg-timeline-kind-reply-background);
  color: var(--sg-timeline-kind-reply-icon);
}

.sg-timeline__kind--note {
  --_edge: var(--sg-timeline-kind-note-border);
  background: var(--sg-timeline-kind-note-background);
  color: var(--sg-timeline-kind-note-icon);
}

.sg-timeline__line {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: start;
  gap: 0 var(--sg-space-2);
  margin: 0;
  padding-block: calc((var(--sg-size-control-small) - var(--sg-type-body-line)) / 2);
  line-height: var(--sg-type-body-line);
}

.sg-timeline__line :is(b, strong) {
  font-weight: var(--sg-type-body-strong-weight);
}

.sg-timeline__line>time {
  color: var(--sg-timeline-meta);
  font-size: var(--sg-type-caption-size);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.sg-timeline__line .sg-avatar {
  inline-size: var(--sg-size-20);
  block-size: var(--sg-size-20);
  vertical-align: middle;
}

.sg-timeline__item--minor .sg-timeline__line {
  color: var(--sg-timeline-minor);
  font-size: var(--sg-type-caption-size);
}

/* the chevron has its own column, so it stays beside the sentence however the sentence wraps */
.sg-timeline__group>summary {
  grid-template-columns: minmax(0, max-content) auto 1fr;
  cursor: pointer;
  list-style: none;
  border-radius: var(--sg-radius-mark);
}

.sg-timeline__group>summary>time {
  grid-column: 3;
  justify-self: end;
}

.sg-timeline__group>summary::-webkit-details-marker {
  display: none;
}

.sg-timeline__group>summary:hover {
  color: var(--sg-timeline-text);
}

.sg-timeline__group>summary::after {
  content: "";
  grid-row: 1;
  grid-column: 2;
  margin-block-start: calc((var(--sg-type-body-line) - var(--sg-size-icon-small)) / 2);
  inline-size: var(--sg-size-icon-small);
  block-size: var(--sg-size-icon-small);
  background-color: var(--sg-timeline-icon);
  -webkit-mask: var(--sg-i-down-line) center / contain no-repeat;
  mask: var(--sg-i-down-line) center / contain no-repeat;
  forced-color-adjust: none;
}

.sg-timeline__group[open]>summary::after {
  rotate: 180deg;
}

.sg-timeline__group>ul {
  display: grid;
  gap: var(--sg-space-1);
  margin: var(--sg-space-2) 0 0;
  padding: 0;
  padding-inline-start: var(--sg-space-3);
  border-inline-start: var(--sg-stroke-rule) solid var(--sg-timeline-rule);
  list-style: none;
  color: var(--sg-timeline-minor);
  font-size: var(--sg-type-caption-size);
  line-height: var(--sg-type-caption-line);
}

.sg-timeline__group li {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--sg-space-1);
}

.sg-timeline__card {
  display: grid;
  gap: var(--sg-space-1);
  padding: var(--sg-space-3);
  border: var(--sg-control-border-width) solid var(--sg-timeline-card-border);
  border-radius: var(--sg-radius-float);
  background: var(--sg-timeline-card-background);
  overflow-wrap: anywhere;
}

.sg-timeline__card>* {
  margin: 0;
}

.sg-timeline__card--note {
  border-color: var(--sg-timeline-note-border);
  background: var(--sg-timeline-note-background);
}

.sg-timeline__card>.sg-attachment {
  justify-self: start;
  margin-block-start: var(--sg-space-1);
}

.sg-timeline__foot {
  display: flex;
  align-items: center;
  gap: var(--sg-space-1);
  margin-block-start: var(--sg-space-1);
  color: var(--sg-timeline-meta);
  font-size: var(--sg-type-caption-size);
  line-height: var(--sg-type-caption-line);
}

.sg-timeline__foot>.sg-icon {
  --sg-icon-size: var(--sg-size-icon-small);
  color: var(--sg-timeline-done);
}

.sg-timeline__change {
  display: inline-flex;
  align-items: center;
  gap: var(--sg-space-1);
  vertical-align: middle;
}

.sg-timeline__change>.sg-icon {
  --sg-icon-size: var(--sg-size-icon-small);
  color: var(--sg-timeline-icon);
}

.sg-timeline__change>.sg-status {
  gap: var(--sg-space-1);
  min-block-size: var(--sg-size-20);
  padding-inline: var(--sg-space-1) var(--sg-space-2);
  border: var(--sg-control-border-width) solid var(--sg-timeline-chip-border);
  border-radius: var(--sg-radius-control);
  background: var(--sg-timeline-chip-background);
  font-size: var(--sg-type-caption-size);
  line-height: var(--sg-type-caption-line);
}

.sg-timeline__change>.sg-status::before {
  inline-size: var(--sg-space-3);
  block-size: var(--sg-space-3);
}

@media (forced-colors: active) {
  .sg-timeline__item::before {
    forced-color-adjust: none;
    background: GrayText;
  }

  .sg-timeline__kind {
    border: var(--sg-control-border-width) solid CanvasText;
  }

  .sg-timeline__group>summary::after {
    background-color: CanvasText;
  }
}

.sg-kv {
  display: grid;
  grid-template-columns: minmax(8rem, 12rem) minmax(0, 1fr);
}

.sg-kv>dt,
.sg-kv>dd {
  display: flex;
  align-items: center;
  min-block-size: var(--sg-density-row-height);
  margin: 0;
  padding: 0 var(--sg-space-2);
  border-block-end: var(--sg-control-border-width) solid var(--sg-kv-divider);
}

.sg-kv>dt {
  color: var(--sg-kv-label);
}

.sg-kv>dd {
  overflow-wrap: anywhere;
}

/* a long value, like an address, wraps instead of running out of its cell */
.sg-kv>dd {
  color: var(--sg-kv-value);
}

/* a value edited in place: the view is a button with a pencil, and it swaps to its control */
.sg-edit {
  display: inline-flex;
  align-items: center;
  min-inline-size: 0;
  max-inline-size: 100%;
}

.sg-edit__view {
  display: inline-flex;
  align-items: center;
  gap: var(--sg-space-2);
  min-inline-size: 0;
  min-block-size: var(--sg-size-target-minimum);
  margin-inline-start: calc(-1 * var(--sg-space-2));
  padding: 0 var(--sg-space-2);
  border: 0;
  border-radius: var(--sg-radius-control);
  background: transparent;
  color: inherit;
  text-align: start;
  cursor: pointer;
}

.sg-edit__view:hover {
  background: var(--sg-kv-edit-hover);
}

.sg-edit__view>.sg-icon {
  --sg-icon-size: var(--sg-size-icon-small);
  color: var(--sg-kv-edit-icon);
}

.sg-edit__value {
  min-inline-size: 0;
  overflow-wrap: anywhere;
}

.sg-edit__control {
  min-inline-size: 10rem;
}

.sg-provenance {
  display: flex;
  flex-wrap: wrap;
  gap: 0 var(--sg-space-2);
  color: var(--sg-provenance-text);
  font-size: var(--sg-type-caption-size);
  line-height: var(--sg-type-caption-line);
}

.sg-provenance>*+*::before {
  content: "\00B7";
  margin-inline-end: var(--sg-space-2);
  color: var(--sg-provenance-separator);
}

.sg-empty {
  display: grid;
  justify-items: center;
  gap: var(--sg-space-2);
  padding: var(--sg-space-8) var(--sg-space-4);
  text-align: center;
}

.sg-empty__icon {
  --sg-icon-size: var(--sg-size-icon-large);
  color: var(--sg-empty-icon);
}

.sg-empty__title {
  color: var(--sg-empty-title);
  font-size: var(--sg-type-heading-4-size);
  line-height: var(--sg-type-heading-4-line);
  font-weight: var(--sg-type-heading-4-weight);
}

.sg-empty__text {
  max-inline-size: 28rem;
  color: var(--sg-empty-text);
}

/* ---------- Code and prose ----------
 * Same family as everything else. Indentation uses tab-size, alignment uses tabular figures, highlighting uses weight and one hue. */
.sg-code {
  padding: 0 var(--sg-space-1);
  border: var(--sg-control-border-width) solid var(--sg-code-border);
  border-radius: var(--sg-radius-mark);
  background: var(--sg-code-background);
  color: var(--sg-code-text);
  font-variant-numeric: tabular-nums;
  overflow-wrap: anywhere;
}

.sg-code-block {
  margin: 0;
  color-scheme: dark;
  padding: var(--sg-space-4);
  overflow: auto;
  border: var(--sg-control-border-width) solid var(--sg-code-block-border);
  border-radius: var(--sg-radius-container);
  background: var(--sg-code-block-background);
  color: var(--sg-code-block-text);
  font-size: var(--sg-type-body-size);
  line-height: var(--sg-type-body-line);
  font-variant-numeric: tabular-nums;
  white-space: pre;
  tab-size: 1.5em;
  -moz-tab-size: 1.5em;
}

.sg-code__comment {
  color: var(--sg-code-block-comment);
}

.sg-code__literal {
  color: var(--sg-code-block-literal);
}

.sg-code__keyword {
  font-weight: var(--sg-type-body-strong-weight);
}

.sg-prose {
  max-inline-size: 70ch;
  font-size: var(--sg-type-body-large-size);
  line-height: var(--sg-type-body-large-line);
}

.sg-prose>*+* {
  margin-block-start: var(--sg-space-4);
}

.sg-prose :where(h2) {
  margin-block-start: var(--sg-space-8);
  font-size: var(--sg-type-heading-2-size);
  line-height: var(--sg-type-heading-2-line);
  font-weight: var(--sg-type-heading-2-weight);
  letter-spacing: var(--sg-type-heading-2-tracking);
}

.sg-prose :where(h3) {
  margin-block-start: var(--sg-space-6);
  font-size: var(--sg-type-heading-3-size);
  line-height: var(--sg-type-heading-3-line);
  font-weight: var(--sg-type-heading-3-weight);
}

.sg-prose :where(h4) {
  margin-block-start: var(--sg-space-6);
  font-size: var(--sg-type-heading-4-size);
  line-height: var(--sg-type-heading-4-line);
  font-weight: var(--sg-type-heading-4-weight);
}

.sg-prose :where(ul, ol) {
  padding-inline-start: var(--sg-space-6);
}

.sg-prose :where(li + li) {
  margin-block-start: var(--sg-space-1);
}

.sg-prose :where(strong) {
  font-weight: var(--sg-type-body-strong-weight);
}

.sg-prose :where(a) {
  color: var(--sg-link-text);
  text-underline-offset: var(--sg-space-1);
}

.sg-prose :where(a):hover {
  color: var(--sg-link-text-hover);
  text-decoration-thickness: var(--sg-stroke-rule);
}

.sg-prose :where(code) {
  padding: 0 var(--sg-space-1);
  border: var(--sg-control-border-width) solid var(--sg-code-border);
  border-radius: var(--sg-radius-mark);
  background: var(--sg-code-background);
  color: var(--sg-code-text);
  font-variant-numeric: tabular-nums;
}

.sg-code,
.sg-code-block,
.sg-prose :where(code) {
  font-family: var(--sg-font-family-mono);
  font-variant-ligatures: none;
}

/* ---------- Log viewer ----------
 * The dark code block in the mono face: a time, a level word and the text on each line. Levels carry a word and weight, never color alone.
 * The script follows new lines only while the reader is at the end; otherwise a button offers the jump (nothing moves under the reader). */
.sg-log {
  position: relative;
  color-scheme: dark;
  overflow: hidden;
  border: var(--sg-control-border-width) solid var(--sg-log-border);
  border-radius: var(--sg-radius-container);
  background: var(--sg-log-background);
  color: var(--sg-log-text);
  font-family: var(--sg-font-family-mono);
  font-size: var(--sg-type-caption-size);
  line-height: var(--sg-type-caption-line);
  font-variant-ligatures: none;
}

.sg-log__lines {
  max-block-size: 24rem;
  overflow: auto;
  padding-block: var(--sg-space-2);
}

.sg-log__lines:focus-visible {
  outline-offset: calc(-1 * var(--sg-focus-width));
}

.sg-log__line {
  display: grid;
  grid-template-columns: auto 5ch minmax(0, 1fr);
  gap: 0 var(--sg-space-3);
  padding: 0 var(--sg-space-4);
}

.sg-log__line:hover {
  background: var(--sg-log-line-hover);
}

.sg-log__time {
  color: var(--sg-log-time);
}

.sg-log__text {
  min-inline-size: 0;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.sg-log__line[data-level="warn"]>.sg-log__level {
  color: var(--sg-log-warning);
  font-weight: var(--sg-type-body-strong-weight);
}

.sg-log__line[data-level="error"]> :is(.sg-log__level, .sg-log__text) {
  color: var(--sg-log-error);
}

.sg-log__line[data-level="error"]>.sg-log__level {
  font-weight: var(--sg-type-body-strong-weight);
}

.sg-log__latest {
  position: absolute;
  inset-block-end: var(--sg-space-3);
  inset-inline: 0;
  inline-size: max-content;
  margin-inline: auto;
}

/* ---------- Chart ----------
 * Marks carry the series color, text never does. Gridlines are solid hairlines, lines are 2px, dots carry a 2px surface ring,
 * touching marks are separated by a 2px surface gap. Texture is opt-in: data-texture on the chart, print, or forced colors. */
.sg-chart {
  --sg-tex-1: none;
  --sg-tex-2: none;
  --sg-tex-3: none;
  --sg-tex-4: none;
  display: grid;
  gap: var(--sg-space-3);
  margin: 0;
  padding: var(--sg-space-4);
  border: var(--sg-control-border-width) solid var(--sg-chart-border);
  border-radius: var(--sg-radius-container);
  background: var(--sg-chart-background);
  box-shadow: var(--sg-chart-shadow);
}

/* a chart inside a panel or a stat strip drops its own frame, so raised surfaces never nest */
.sg-chart--bare {
  padding: 0;
  border: 0;
  border-radius: 0;
  background: none;
  box-shadow: none;
}

.sg-chart .sg-table-wrap {
  box-shadow: none;
}

.sg-chart__title {
  font-size: var(--sg-type-heading-4-size);
  line-height: var(--sg-type-heading-4-line);
  font-weight: var(--sg-type-heading-4-weight);
}

.sg-chart__desc {
  color: var(--sg-chart-legend);
  font-size: var(--sg-type-caption-size);
  line-height: var(--sg-type-caption-line);
}

.sg-chart__legend {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sg-space-1) var(--sg-space-4);
  margin: 0;
  padding: 0;
  list-style: none;
  color: var(--sg-chart-legend);
}

.sg-chart__key {
  display: inline-flex;
  align-items: center;
  gap: var(--sg-space-2);
}

.sg-chart__swatch-svg {
  flex: none;
}

.sg-chart__swatch {
  background: var(--_c);
  forced-color-adjust: none;
}

.sg-chart__swatch--line {
  inline-size: var(--sg-space-4);
  block-size: var(--sg-stroke-rule);
}

.sg-chart__key-value {
  margin-inline-start: auto;
  padding-inline-start: var(--sg-space-4);
  color: var(--sg-chart-value);
  font-weight: var(--sg-type-label-weight);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.sg-chart__ramp {
  display: inline-flex;
  gap: var(--sg-stroke-rule);
}

.sg-chart__ramp>i {
  inline-size: var(--sg-space-4);
  block-size: var(--sg-space-3);
  border-radius: var(--sg-radius-2);
  background: var(--_c);
  forced-color-adjust: none;
}

/* pie and donut: the legend sits beside the plot and carries each part's value and share; on a narrow chart it drops below */
.sg-chart--part {
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 12rem), 1fr));
  align-items: center;
}

.sg-chart--part>* {
  grid-column: 1 / -1;
}

.sg-chart--part>.sg-chart__head {
  order: -2;
}

.sg-chart--part>.sg-chart__plot {
  order: -1;
  grid-column: auto;
}

.sg-chart--part>.sg-chart__legend {
  grid-column: auto;
  flex-direction: column;
  flex-wrap: nowrap;
  gap: var(--sg-space-2);
  max-inline-size: 16rem;
}

.sg-chart__plot {
  position: relative;
}

.sg-chart__svg {
  display: block;
  inline-size: 100%;
  block-size: auto;
  overflow: visible;
}

.sg-chart__grid {
  stroke: var(--sg-chart-grid);
  stroke-width: 1;
  shape-rendering: crispEdges;
}

.sg-chart__axis {
  stroke: var(--sg-chart-axis);
  stroke-width: 1;
  shape-rendering: crispEdges;
}

.sg-chart__tick {
  fill: var(--sg-chart-label);
  font-size: var(--sg-type-caption-size);
}

.sg-chart__value {
  fill: var(--sg-chart-value);
  font-size: var(--sg-type-caption-size);
  font-weight: var(--sg-type-label-weight);
}

.sg-chart__mark {
  fill: var(--_fill, var(--_c));
}

.sg-chart__line {
  fill: none;
  stroke: var(--_c);
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.sg-chart__area {
  fill: var(--_c);
  fill-opacity: 0.1;
}

.sg-chart__dot {
  fill: var(--_c);
  stroke: var(--sg-chart-gap);
  stroke-width: 2;
}

.sg-chart__cross {
  stroke: var(--sg-chart-axis);
  stroke-width: 1;
}

.sg-chart__hit {
  fill: transparent;
}

.sg-chart__mark.is-hover {
  opacity: 0.8;
}

.sg-chart__slice {
  stroke: var(--sg-chart-gap);
  stroke-width: 2;
  stroke-linejoin: round;
}

.sg-chart__cell--empty {
  fill: var(--sg-chart-track);
}

.sg-chart__cell.is-hover {
  opacity: 1;
}

.sg-chart__hit.is-hover {
  stroke: var(--sg-chart-value);
  stroke-width: 2;
}

/* gauge: unlit segments wear the track; lit ones take a step of the sequential scale */
.sg-chart__seg {
  fill: none;
  stroke: var(--_c, var(--sg-chart-track));
  stroke-linecap: round;
}

.sg-chart__center {
  position: absolute;
  inset-inline: 0;
  display: grid;
  justify-items: center;
  gap: var(--sg-space-1);
  margin-inline: auto;
  inline-size: fit-content;
  text-align: center;
}

.sg-chart__figure {
  color: var(--sg-chart-value);
  font-size: var(--sg-type-heading-1-size);
  line-height: var(--sg-type-heading-1-line);
  font-weight: var(--sg-type-heading-1-weight);
  letter-spacing: var(--sg-type-heading-1-tracking);
  font-variant-numeric: tabular-nums;
}

.sg-chart__caption {
  color: var(--sg-chart-label);
  font-size: var(--sg-type-caption-size);
  line-height: var(--sg-type-caption-line);
}

.sg-chart__change {
  display: inline-flex;
  align-items: center;
  gap: var(--sg-space-1);
  min-block-size: var(--sg-size-24);
  padding-inline: var(--sg-space-1) var(--sg-space-2);
  border: var(--sg-control-border-width) solid var(--sg-chart-chip-border);
  border-radius: var(--sg-radius-control);
  background: var(--sg-chart-chip-background);
  color: var(--sg-chart-value);
  font-size: var(--sg-type-caption-size);
  line-height: var(--sg-type-caption-line);
  font-weight: var(--sg-type-label-weight);
}

.sg-chart__change>.sg-icon {
  --sg-icon-size: var(--sg-size-icon-small);
  color: var(--sg-chart-chip-icon);
}

.sg-chart__change[data-tone="good"]>.sg-icon {
  color: var(--sg-chart-good);
}

.sg-chart__change[data-tone="bad"]>.sg-icon {
  color: var(--sg-chart-bad);
}

.sg-chart__target {
  stroke: var(--sg-chart-value);
  stroke-width: 2;
  stroke-linecap: round;
}

.sg-chart__total {
  fill: var(--sg-chart-value);
  font-size: var(--sg-type-heading-2-size);
  font-weight: var(--sg-type-heading-2-weight);
  letter-spacing: var(--sg-type-heading-2-tracking);
  font-variant-numeric: tabular-nums;
}

.sg-chart__tex-base {
  fill: var(--_c);
}

.sg-chart__tex-ink {
  stroke: var(--sg-chart-texture-ink);
  stroke-width: 2;
  stroke-opacity: 0.45;
}

:is(.sg-chart, .sg-spark) [data-series="1"] {
  --_c: var(--sg-chart-series-1);
}

:is(.sg-chart, .sg-spark) [data-series="2"] {
  --_c: var(--sg-chart-series-2);
}

:is(.sg-chart, .sg-spark) [data-series="3"] {
  --_c: var(--sg-chart-series-3);
}

:is(.sg-chart, .sg-spark) [data-series="4"] {
  --_c: var(--sg-chart-series-4);
}

:is(.sg-chart, .sg-spark) [data-series="5"] {
  --_c: var(--sg-chart-series-5);
}

:is(.sg-chart, .sg-spark) [data-series="6"] {
  --_c: var(--sg-chart-series-6);
}

:is(.sg-chart, .sg-spark) [data-series="7"] {
  --_c: var(--sg-chart-series-7);
}

:is(.sg-chart, .sg-spark) [data-series="8"] {
  --_c: var(--sg-chart-series-8);
}

:is(.sg-chart, .sg-spark) [data-series="context"] {
  --_c: var(--sg-chart-context);
}

:is(.sg-chart, .sg-spark) [data-sign="positive"] {
  --_c: var(--sg-chart-positive);
}

:is(.sg-chart, .sg-spark) [data-sign="negative"] {
  --_c: var(--sg-chart-negative);
}

:is(.sg-chart, .sg-spark) [data-ord="1"] {
  --_c: var(--sg-chart-ord-1);
}

:is(.sg-chart, .sg-spark) [data-ord="2"] {
  --_c: var(--sg-chart-ord-2);
}

:is(.sg-chart, .sg-spark) [data-ord="3"] {
  --_c: var(--sg-chart-ord-3);
}

:is(.sg-chart, .sg-spark) [data-ord="4"] {
  --_c: var(--sg-chart-ord-4);
}

:is(.sg-chart, .sg-spark) [data-ord="5"] {
  --_c: var(--sg-chart-ord-5);
}

:is(.sg-chart, .sg-spark) [data-seq="1"] {
  --_c: var(--sg-chart-seq-1);
}

:is(.sg-chart, .sg-spark) [data-seq="2"] {
  --_c: var(--sg-chart-seq-2);
}

:is(.sg-chart, .sg-spark) [data-seq="3"] {
  --_c: var(--sg-chart-seq-3);
}

:is(.sg-chart, .sg-spark) [data-seq="4"] {
  --_c: var(--sg-chart-seq-4);
}

:is(.sg-chart, .sg-spark) [data-seq="5"] {
  --_c: var(--sg-chart-seq-5);
}

:is(.sg-chart, .sg-spark) [data-seq="6"] {
  --_c: var(--sg-chart-seq-6);
}

:is(.sg-chart, .sg-spark) [data-seq="7"] {
  --_c: var(--sg-chart-seq-7);
}

.sg-chart[data-texture] .sg-chart__mark[data-series="1"] {
  --_fill: var(--sg-tex-1);
}

.sg-chart[data-texture] .sg-chart__mark[data-series="2"] {
  --_fill: var(--sg-tex-2);
}

.sg-chart[data-texture] .sg-chart__mark[data-series="3"] {
  --_fill: var(--sg-tex-3);
}

.sg-chart[data-texture] .sg-chart__mark[data-series="4"] {
  --_fill: var(--sg-tex-4);
}

/* readout: a small menu beside the mark. Its header names the dimension in the mono cut and the value under it, each series has a row, and a footer band holds the total or the share. */
.sg-chart__tip {
  position: absolute;
  z-index: var(--sg-layer-overlay);
  min-inline-size: 10rem;
  overflow: hidden;
  border: var(--sg-control-border-width) solid var(--sg-chart-tip-border);
  border-radius: var(--sg-radius-float);
  background: var(--sg-chart-tip-background);
  color: var(--sg-chart-tip-text);
  box-shadow: var(--sg-chart-tip-shadow);
  pointer-events: none;
  font-size: var(--sg-type-caption-size);
  line-height: var(--sg-type-caption-line);
}

.sg-chart__tip-head {
  display: grid;
  padding: var(--sg-space-2) var(--sg-space-3);
  border-block-end: var(--sg-control-border-width) solid var(--sg-chart-tip-divider);
}

.sg-chart__tip-context {
  color: var(--sg-chart-tip-context);
  font-family: var(--sg-font-family-mono);
  font-weight: var(--sg-type-body-strong-weight);
}

.sg-chart__tip-title {
  font-weight: var(--sg-type-body-strong-weight);
}

.sg-chart__tip-rows {
  display: grid;
  gap: var(--sg-space-1);
  padding: var(--sg-space-2) var(--sg-space-3);
}

.sg-chart__tip-row {
  display: flex;
  align-items: center;
  gap: var(--sg-space-2);
}

.sg-chart__tip-key {
  inline-size: var(--sg-space-3);
  block-size: var(--sg-stroke-rule);
  background: var(--_c);
  forced-color-adjust: none;
}

.sg-chart__tip-name {
  color: var(--sg-chart-tip-name);
}

.sg-chart__tip-value {
  margin-inline-start: auto;
  padding-inline-start: var(--sg-space-3);
  font-weight: var(--sg-type-label-weight);
  font-variant-numeric: tabular-nums;
}

.sg-chart__tip-foot {
  display: flex;
  align-items: center;
  padding: var(--sg-space-2) var(--sg-space-3);
  border-block-start: var(--sg-control-border-width) solid var(--sg-chart-tip-divider);
  background: var(--sg-chart-tip-foot-background);
  color: var(--sg-chart-tip-name);
}

.sg-chart__tip-foot>.sg-chart__tip-value {
  color: var(--sg-chart-tip-text);
}

.sg-chart__foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--sg-space-2) var(--sg-space-4);
}

.sg-chart.is-loading .sg-chart__plot {
  opacity: 0.6;
}

@media (forced-colors: active) {
  .sg-chart {
    --_fill: initial;
  }

  .sg-chart__line,
  .sg-chart__seg[data-seq],
  .sg-chart__target {
    stroke: CanvasText;
  }

  .sg-chart__grid,
  .sg-chart__axis,
  .sg-chart__seg {
    stroke: GrayText;
  }

  .sg-chart__slice {
    stroke: Canvas;
  }
}

/* ---------- Count ----------
 * A small number beside a label: unread items, rows in a queue. Neutral by default; the inverse surface when it asks for attention. */
.sg-count {
  display: inline-grid;
  place-items: center;
  flex: none;
  min-inline-size: var(--sg-size-20);
  block-size: var(--sg-size-20);
  padding: 0 var(--sg-space-1);
  border-radius: var(--sg-radius-round);
  background: var(--sg-count-background);
  color: var(--sg-count-text);
  font-size: var(--sg-type-label-size);
  line-height: var(--sg-type-label-line);
  font-weight: var(--sg-type-label-weight);
  font-variant-numeric: tabular-nums;
}

.sg-count--strong {
  background: var(--sg-count-strong-background);
  color: var(--sg-count-strong-text);
}

@media (forced-colors: active) {
  .sg-count {
    border: var(--sg-control-border-width) solid CanvasText;
  }
}

/* ---------- Combobox ----------
 * A text input that filters a listbox under it. The list is a manual popover, so no clipping or scrolling ancestor can hide it.
 * Focus stays in the input; the active option moves with aria-activedescendant. */
.sg-combobox {
  position: relative;
}

.sg-combobox .sg-input {
  padding-inline-end: calc(var(--sg-control-padding-x) + var(--sg-control-icon-size) + var(--sg-control-gap));
}

.sg-combobox::after {
  content: "";
  position: absolute;
  inset-block: 0;
  inset-inline-end: var(--sg-control-padding-x);
  margin-block: auto;
  inline-size: var(--sg-control-icon-size);
  block-size: var(--sg-control-icon-size);
  background-color: var(--sg-input-text);
  -webkit-mask: var(--sg-i-down-line) center / contain no-repeat;
  mask: var(--sg-i-down-line) center / contain no-repeat;
  pointer-events: none;
  forced-color-adjust: none;
  transition: rotate var(--sg-motion-duration-state) var(--sg-motion-easing-enter);
}

.sg-combobox:has(> [aria-expanded="true"])::after {
  rotate: 180deg;
}

/* the chosen option's avatar, when it has one, stays in the field */
.sg-combobox__lead.sg-avatar {
  position: absolute;
  inset-block: 0;
  inset-inline-start: var(--sg-space-2);
  margin-block: auto;
  inline-size: var(--sg-size-24);
  block-size: var(--sg-size-24);
  pointer-events: none;
}

.sg-combobox:has(> .sg-combobox__lead) .sg-input {
  padding-inline-start: calc(2 * var(--sg-space-2) + var(--sg-size-24));
}

.sg-combobox__list {
  position: fixed;
  inset: auto;
  z-index: var(--sg-layer-overlay);
  max-block-size: 16rem;
  margin: 0;
  padding: var(--sg-space-1);
  overflow: auto;
  overscroll-behavior: contain;
  list-style: none;
  border: var(--sg-control-border-width) solid var(--sg-combobox-border);
  border-radius: var(--sg-radius-float);
  background: var(--sg-combobox-background);
  color: var(--sg-combobox-text);
  box-shadow: var(--sg-combobox-shadow);
}

/* options can sit in labelled groups; a group with nothing left after filtering hides */
.sg-combobox__list [role="group"]:not(:has([role="option"]:not([hidden]))) {
  display: none;
}

.sg-combobox__list [role="group"]::before {
  content: attr(aria-label);
  content: attr(aria-label) / "";
  display: block;
  padding: var(--sg-space-2) var(--sg-control-padding-x) var(--sg-space-1);
  color: var(--sg-combobox-group);
  font-size: var(--sg-type-label-size);
  line-height: var(--sg-type-label-line);
  font-weight: var(--sg-type-label-weight);
}

/* nothing matches: the list says so, and stingray.js announces it */
.sg-combobox__list:not(:has([role="option"]:not([hidden])))::after {
  content: attr(data-empty);
  display: block;
  padding: var(--sg-space-2) var(--sg-control-padding-x);
  color: var(--sg-combobox-empty);
}

.sg-combobox__option {
  position: relative;
  display: flex;
  align-items: center;
  gap: var(--sg-space-inline-icon);
  min-block-size: var(--sg-control-height);
  padding: 0 var(--sg-control-padding-x);
  border: var(--sg-control-border-width) solid transparent;
  border-radius: calc(var(--sg-radius-float) - var(--sg-space-1));
  font-size: var(--sg-control-font-size);
  line-height: var(--sg-control-line-height);
  cursor: pointer;
}

.sg-combobox__option>.sg-avatar {
  inline-size: var(--sg-size-24);
  block-size: var(--sg-size-24);
}

.sg-combobox__option[hidden] {
  display: none;
}

/* the active option is highlighted like a menu item: a gray step, a thin edge and the brand bar */
.sg-combobox__option[aria-selected="true"] {
  border-color: var(--sg-combobox-option-active-border);
  background: var(--sg-combobox-option-active);
}

.sg-combobox__option[aria-selected="true"]::before {
  content: "";
  position: absolute;
  inset-block: calc(var(--sg-space-2) - var(--sg-control-border-width));
  inset-inline-start: calc(var(--sg-space-1) - var(--sg-control-border-width));
  inline-size: var(--sg-stroke-rule);
  border-radius: var(--sg-radius-round);
  background: var(--sg-combobox-indicator);
}

.sg-combobox__list .sg-match>mark {
  text-decoration-color: var(--sg-combobox-match);
}

.sg-combobox__option[aria-selected="true"] .sg-combobox__meta {
  color: var(--sg-combobox-meta-active);
}

.sg-combobox__meta {
  margin-inline-start: auto;
  color: var(--sg-combobox-meta);
  font-size: var(--sg-type-caption-size);
  line-height: var(--sg-type-caption-line);
}

.sg-combobox__option.is-chosen {
  font-weight: var(--sg-type-body-strong-weight);
}

.sg-combobox__option.is-chosen::after {
  content: "";
  flex: none;
  inline-size: var(--sg-size-icon-small);
  block-size: var(--sg-size-icon-small);
  background-color: var(--sg-combobox-check);
  -webkit-mask: var(--sg-i-check-line) center / contain no-repeat;
  mask: var(--sg-i-check-line) center / contain no-repeat;
  forced-color-adjust: none;
}

.sg-combobox__option:not(:has(.sg-combobox__meta)).is-chosen::after {
  margin-inline-start: auto;
}

/* the count and the keys under the options; it stays in view while the list scrolls */
.sg-combobox__footer {
  position: sticky;
  z-index: 2;
  inset-block-end: calc(-1 * var(--sg-space-1));
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--sg-space-1) var(--sg-space-2);
  margin: var(--sg-space-1) calc(-1 * var(--sg-space-1)) calc(-1 * var(--sg-space-1));
  padding: var(--sg-space-2) var(--sg-control-padding-x);
  border-block-start: var(--sg-control-border-width) solid var(--sg-combobox-footer-border);
  background: var(--sg-combobox-footer-background);
  color: var(--sg-combobox-footer-text);
  font-size: var(--sg-type-caption-size);
  line-height: var(--sg-type-caption-line);
}

.sg-combobox__list:not(:has([role="option"]:not([hidden]))) .sg-combobox__footer {
  display: none;
}

.sg-combobox__count {
  font-variant-numeric: tabular-nums;
}

/* the letters typed into a combobox or the palette: the script wraps an option's text in .sg-match and the letters in a mark */
.sg-match>mark {
  background: none;
  color: inherit;
  font-weight: var(--sg-type-body-strong-weight);
  text-decoration: underline;
  text-decoration-thickness: var(--sg-stroke-rule);
  text-underline-offset: var(--sg-stroke-rule);
}

@media (forced-colors: active) {

  .sg-combobox::after,
  .sg-combobox__option.is-chosen::after {
    background-color: CanvasText;
  }

  .sg-combobox__option[aria-selected="true"] {
    forced-color-adjust: none;
    background: Highlight;
    color: HighlightText;
  }
}

/* ---------- Date and date range ----------
 * The native date input: the browser's own picker, keyboard entry and locale order. Stingray draws the calendar glyph and tabular figures. */
.sg-input:is([type="date"], [type="time"], [type="datetime-local"], [type="month"]) {
  font-variant-numeric: tabular-nums;
}

.sg-input::-webkit-calendar-picker-indicator {
  inline-size: var(--sg-control-icon-size);
  block-size: var(--sg-control-icon-size);
  margin: 0;
  padding: 0;
  background: var(--sg-input-text);
  -webkit-mask: var(--sg-i-calendar-line) center / contain no-repeat;
  mask: var(--sg-i-calendar-line) center / contain no-repeat;
  opacity: 1;
  cursor: pointer;
}

.sg-date-range>legend {
  margin-block-end: var(--sg-space-stack-related);
  padding: 0;
}

.sg-date-range__fields {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--sg-space-2);
}

.sg-date-range__fields>.sg-input {
  flex: 1 1 10rem;
  inline-size: auto;
}

.sg-date-range__sep {
  color: var(--sg-input-help);
}

.sg-date-range__presets {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sg-space-1);
  margin-block-start: var(--sg-space-2);
}

/* ---------- File upload ----------
 * The native file input covers the whole drop zone, transparent, so clicking, dropping and the keyboard all reach the real control.
 * stingray.js keeps a list of the chosen files, adds to it on every pick, and removes one on request. */
.sg-upload {
  display: flex;
  flex-direction: column;
  gap: var(--sg-space-2);
}

.sg-upload__zone {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--sg-space-1);
  padding: var(--sg-space-6) var(--sg-space-4);
  border: var(--sg-control-border-width) dashed var(--sg-upload-border);
  border-radius: var(--sg-radius-container);
  background: var(--sg-upload-background);
  color: var(--sg-upload-text);
  text-align: center;
  transition: border-color var(--sg-motion-duration-state) var(--sg-motion-easing-enter), background-color var(--sg-motion-duration-state) var(--sg-motion-easing-enter);
}

.sg-upload__zone:hover,
.sg-upload__zone.is-hover {
  border-color: var(--sg-upload-border-hover);
}

.sg-upload__zone.is-dragover {
  border-style: solid;
  border-color: var(--sg-upload-border-drop);
  background: var(--sg-upload-background-drop);
}

.sg-upload__zone:has(:focus-visible) {
  outline: var(--sg-focus-width) solid var(--sg-focus-ring);
  outline-offset: var(--sg-focus-offset);
}

.sg-upload__input {
  position: absolute;
  inset: 0;
  inline-size: 100%;
  block-size: 100%;
  margin: 0;
  opacity: 0;
  cursor: pointer;
}

.sg-upload__input:focus-visible {
  outline: none;
}

.sg-upload__icon {
  --sg-icon-size: var(--sg-size-icon-large);
  color: var(--sg-upload-icon);
}

.sg-upload__action {
  color: var(--sg-upload-action);
  font-weight: var(--sg-type-body-strong-weight);
  text-decoration: underline;
  text-decoration-thickness: var(--sg-stroke-hairline);
  text-underline-offset: var(--sg-space-1);
}

.sg-upload__list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.sg-upload__list:empty {
  display: none;
}

.sg-upload__file {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto auto;
  align-items: center;
  gap: var(--sg-space-1) var(--sg-space-2);
  min-block-size: var(--sg-control-height);
  padding-block: var(--sg-space-1);
  border-block-end: var(--sg-control-border-width) solid var(--sg-upload-file-divider);
  color: var(--sg-upload-file-text);
}

.sg-upload__file>.sg-icon {
  color: var(--sg-upload-icon);
}

.sg-upload__name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sg-upload__size {
  color: var(--sg-upload-file-meta);
  font-size: var(--sg-type-caption-size);
  line-height: var(--sg-type-caption-line);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.sg-upload__file> :is(.sg-field__error, .sg-progress__track) {
  grid-column: 2 / -1;
}

.sg-upload__file>.sg-progress__track {
  margin-block-end: var(--sg-space-1);
}

@media (forced-colors: active) {
  .sg-upload__zone.is-dragover {
    border-color: Highlight;
  }
}

/* ---------- Stepper ----------
 * Numbered markers joined by a hairline. Done steps carry a check and link back; the current step is the inverse surface.
 * In a narrow container the steps stack and the joining lines go, so labels never truncate. */
.sg-stepper {
  container-type: inline-size;
  inline-size: 100%;
}

.sg-stepper__list {
  display: flex;
  gap: var(--sg-space-2);
  margin: 0;
  padding: 0;
  list-style: none;
}

.sg-stepper__step {
  display: flex;
  flex: 1 1 0;
  align-items: center;
  gap: var(--sg-space-2);
  min-inline-size: 0;
}

.sg-stepper__step:last-child {
  flex: 0 0 auto;
}

.sg-stepper__step:not(:last-child)::after {
  content: "";
  flex: 1 1 var(--sg-space-6);
  min-inline-size: var(--sg-space-4);
  block-size: var(--sg-control-border-width);
  background: var(--sg-stepper-line);
}

.sg-stepper__step[data-state="done"]:not(:last-child)::after {
  background: var(--sg-stepper-line-done);
}

.sg-stepper__link {
  display: flex;
  align-items: center;
  gap: var(--sg-space-2);
  min-inline-size: 0;
  border-radius: var(--sg-radius-control);
  color: inherit;
  text-decoration: none;
}

.sg-stepper__marker {
  display: inline-grid;
  place-items: center;
  flex: none;
  inline-size: var(--sg-size-24);
  block-size: var(--sg-size-24);
  border: var(--sg-control-border-width) solid var(--sg-stepper-marker-border);
  border-radius: var(--sg-radius-round);
  color: var(--sg-stepper-marker-text);
  font-size: var(--sg-type-label-size);
  line-height: var(--sg-type-label-line);
  font-weight: var(--sg-type-label-weight);
  font-variant-numeric: tabular-nums;
}

.sg-stepper__marker>.sg-icon {
  --sg-icon-size: var(--sg-size-icon-small);
}

.sg-stepper__step[data-state="done"] .sg-stepper__marker {
  border-color: var(--sg-stepper-marker-done-border);
  color: var(--sg-stepper-marker-done-icon);
}

.sg-stepper__step[aria-current="step"] .sg-stepper__marker {
  border: var(--sg-stroke-rule) solid var(--sg-stepper-marker-current-border);
  background: var(--sg-stepper-marker-current);
  color: var(--sg-stepper-marker-current-text);
}

.sg-stepper__text {
  display: flex;
  flex-direction: column;
  min-inline-size: 0;
}

.sg-stepper__label {
  color: var(--sg-stepper-label);
  white-space: nowrap;
}

.sg-stepper__link .sg-stepper__label {
  text-decoration: underline;
  text-decoration-thickness: var(--sg-stroke-hairline);
  text-underline-offset: var(--sg-space-1);
}

.sg-stepper__link:hover .sg-stepper__label {
  color: var(--sg-stepper-label-current);
  text-decoration-thickness: var(--sg-stroke-rule);
}

.sg-stepper__step[aria-current="step"] .sg-stepper__label {
  color: var(--sg-stepper-label-current);
  font-weight: var(--sg-type-body-strong-weight);
}

.sg-stepper__meta {
  color: var(--sg-stepper-meta);
  font-size: var(--sg-type-caption-size);
  line-height: var(--sg-type-caption-line);
}

@container (max-width: 36rem) {
  .sg-stepper__list {
    flex-direction: column;
  }

  .sg-stepper__step:not(:last-child)::after {
    display: none;
  }
}

@media (forced-colors: active) {
  .sg-stepper__step[aria-current="step"] .sg-stepper__marker {
    forced-color-adjust: none;
    border-color: Highlight;
    background: Highlight;
    color: HighlightText;
  }

  .sg-stepper__step:not(:last-child)::after {
    background: CanvasText;
  }
}

/* ---------- Bulk action bar ----------
 * Appears while rows of a grid are selected: the count, the actions for all of them, and a way to clear the selection.
 * It sits under the table and sticks to the bottom of the window, so the rows never move to make room for it. */
.sg-bulkbar {
  position: sticky;
  inset-block-end: var(--sg-space-4);
  z-index: var(--sg-layer-sticky);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--sg-space-2);
  margin-block-start: var(--sg-space-2);
  padding: var(--sg-space-2) var(--sg-space-2) var(--sg-space-2) var(--sg-space-4);
  border: var(--sg-control-border-width) solid var(--sg-bulkbar-border);
  border-radius: var(--sg-radius-float);
  background: var(--sg-bulkbar-background);
  color: var(--sg-bulkbar-text);
  box-shadow: var(--sg-bulkbar-shadow);
}

.sg-bulkbar[hidden] {
  display: none;
}

.sg-bulkbar__count {
  margin-inline-end: auto;
  font-weight: var(--sg-type-body-strong-weight);
  font-variant-numeric: tabular-nums;
}

/* ---------- Filter chips ----------
 * The filters that narrow a list, each removable, above the results they narrow. The remove button fills the chip's height,
 * so its target is 26px and its corner sits concentric inside the chip's. */
.sg-chips {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--sg-space-2);
}

.sg-chips[hidden] {
  display: none;
}

.sg-chip {
  display: inline-flex;
  align-items: stretch;
  min-block-size: var(--sg-control-height-small);
  padding-inline-start: var(--sg-space-2);
  border: var(--sg-control-border-width) solid var(--sg-chip-border);
  border-radius: var(--sg-radius-control);
  background: var(--sg-chip-background);
  color: var(--sg-chip-text);
}

.sg-chip__label {
  display: flex;
  align-items: center;
  gap: var(--sg-space-1);
  padding-inline-end: var(--sg-space-1);
  white-space: nowrap;
}

.sg-chip__key {
  color: var(--sg-chip-key);
}

.sg-chip__remove {
  display: grid;
  place-items: center;
  flex: none;
  aspect-ratio: 1;
  min-inline-size: var(--sg-size-target-minimum);
  padding: 0;
  border: 0;
  border-radius: var(--sg-radius-mark);
  background: transparent;
  color: var(--sg-chip-remove);
  cursor: pointer;
}

.sg-chip__remove:hover,
.sg-chip__remove.is-hover {
  background: var(--sg-chip-remove-hover);
  color: var(--sg-chip-text);
}

.sg-chip__remove:focus-visible {
  outline-offset: calc(-1 * var(--sg-focus-width));
}

.sg-chip__remove>.sg-icon {
  --sg-icon-size: var(--sg-size-icon-small);
}

/* ---------- Accordion ----------
 * Native <details>: it opens with Enter and Space, find-in-page opens the section it finds, and a shared name makes one section open at a time. */
.sg-accordion {
  overflow: hidden;
  border: var(--sg-control-border-width) solid var(--sg-accordion-border);
  border-radius: var(--sg-radius-container);
  background: var(--sg-accordion-background);
  color: var(--sg-accordion-text);
  box-shadow: var(--sg-accordion-shadow);
}

.sg-accordion--flush {
  overflow: visible;
  border: 0;
  border-radius: 0;
  background: none;
  box-shadow: none;
}

.sg-accordion__item+.sg-accordion__item {
  border-block-start: var(--sg-control-border-width) solid var(--sg-accordion-divider);
}

.sg-accordion__summary {
  display: flex;
  align-items: center;
  gap: var(--sg-space-3);
  min-block-size: var(--sg-control-height-large);
  padding: var(--sg-space-2) var(--sg-space-4);
  list-style: none;
  font-weight: var(--sg-type-body-strong-weight);
  cursor: pointer;
}

.sg-accordion__summary::-webkit-details-marker {
  display: none;
}

.sg-accordion__summary:hover,
.sg-accordion__summary.is-hover {
  background: var(--sg-accordion-summary-hover);
}

.sg-accordion__summary:focus-visible {
  outline-offset: calc(-1 * var(--sg-focus-width));
}

.sg-accordion__summary::after {
  content: "";
  flex: none;
  margin-inline-start: auto;
  inline-size: var(--sg-control-icon-size);
  block-size: var(--sg-control-icon-size);
  background-color: var(--sg-accordion-icon);
  -webkit-mask: var(--sg-i-down-line) center / contain no-repeat;
  mask: var(--sg-i-down-line) center / contain no-repeat;
  transition: rotate var(--sg-motion-duration-reveal) var(--sg-motion-easing-enter);
  forced-color-adjust: none;
}

.sg-accordion__summary:has(.sg-accordion__meta)::after {
  margin-inline-start: 0;
}

.sg-accordion__item[open]>.sg-accordion__summary::after {
  rotate: 180deg;
}

.sg-accordion__meta {
  margin-inline-start: auto;
  color: var(--sg-accordion-meta);
  font-weight: var(--sg-type-body-weight);
  font-size: var(--sg-type-caption-size);
  line-height: var(--sg-type-caption-line);
}

.sg-accordion__body {
  padding: 0 var(--sg-space-4) var(--sg-space-4);
}

.sg-accordion--flush :is(.sg-accordion__summary, .sg-accordion__body) {
  padding-inline: 0;
}

.sg-accordion--flush .sg-accordion__summary:hover {
  background: none;
}

@media (forced-colors: active) {
  .sg-accordion__summary::after {
    background-color: CanvasText;
  }
}

/* ---------- Record diff ----------
 * Before and after, field by field. The old value is struck through, the new one is semibold ink. No green or red: in Stingray those mean done and error. */
.sg-diff :where(th, td) {
  block-size: auto;
  padding-block: var(--sg-space-2);
  white-space: normal;
  vertical-align: top;
}

.sg-diff del {
  color: var(--sg-diff-before);
  text-decoration: line-through;
  text-decoration-thickness: var(--sg-stroke-hairline);
}

.sg-diff ins {
  color: var(--sg-diff-after);
  text-decoration: none;
  font-weight: var(--sg-type-body-strong-weight);
}

.sg-diff__none {
  color: var(--sg-diff-none);
}

/* ---------- Progress and skeleton ----------
 * Progress: an ink fill on a neutral track, with the label and the count above it. With no known end, a short fill travels the track.
 * Skeleton: still, neutral bars that hold the shape of rows on the first load only (nothing in Stingray pulses); later loads keep the old rows in place. */
.sg-progress {
  display: flex;
  flex-direction: column;
  gap: var(--sg-space-2);
}

.sg-progress__head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0 var(--sg-space-3);
}

.sg-progress__label {
  color: var(--sg-progress-label);
  font-weight: var(--sg-type-body-strong-weight);
}

.sg-progress__value {
  color: var(--sg-progress-count);
  font-variant-numeric: tabular-nums;
}

.sg-progress__track {
  --sg-progress-value: 0%;
  position: relative;
  block-size: var(--sg-space-1);
  overflow: hidden;
  border-radius: var(--sg-radius-round);
  background: var(--sg-progress-track);
}

.sg-progress__fill {
  display: block;
  block-size: 100%;
  inline-size: var(--sg-progress-value);
  border-radius: var(--sg-radius-round);
  background: var(--sg-progress-fill);
  transition: inline-size var(--sg-motion-duration-reveal) var(--sg-motion-easing-enter);
}

.sg-progress__track:not([aria-valuenow]) .sg-progress__fill {
  inline-size: 30%;
  animation: sg-travel 1.6s var(--sg-motion-easing-enter) infinite;
}

.sg-progress[data-state="done"] .sg-progress__fill {
  background: var(--sg-progress-fill-done);
}

.sg-progress[data-state="error"] .sg-progress__fill {
  background: var(--sg-progress-fill-error);
}

@keyframes sg-travel {
  from {
    translate: -100% 0;
  }

  to {
    translate: 340% 0;
  }
}

.sg-skeleton {
  --sg-skeleton-width: 100%;
  display: inline-block;
  inline-size: var(--sg-skeleton-width);
  max-inline-size: 100%;
  block-size: var(--sg-space-3);
  border-radius: var(--sg-radius-mark);
  background: var(--sg-skeleton-fill);
  vertical-align: middle;
}

@media (prefers-reduced-motion: reduce) {
  .sg-progress__track:not([aria-valuenow]) .sg-progress__fill {
    inline-size: 100%;
    animation: none;
    background: var(--sg-progress-busy);
  }
}

@media (forced-colors: active) {

  .sg-progress__track,
  .sg-skeleton {
    forced-color-adjust: none;
    background: GrayText;
  }

  .sg-progress__fill {
    forced-color-adjust: none;
    background: CanvasText;
  }
}

/* ---------- Loader ----------
 * A manta swimming in place: the Stingray silhouette, whose wings beat slowly up and down while the body glides a little.
 * One element, filled with the text color, so it works inside any button, at the size of an icon wherever it sits.
 * Under reduced motion it holds still with its wings level. The three wing poses are named, so a page loader can draw the same manta. */
.sg {
  --sg-loader-up: polygon(35% 20%, 42% 3%, 46% 15%, 50% 13%, 54% 15%, 58% 3%, 65% 20%, 84% 21%, 100% 24%, 72% 56%, 57% 68%, 53% 76%, 51% 100%, 49% 100%, 47% 76%, 43% 68%, 28% 56%, 0% 24%, 16% 21%);
  --sg-loader-level: polygon(35% 20%, 42% 3%, 46% 15%, 50% 13%, 54% 15%, 58% 3%, 65% 20%, 84% 30%, 100% 46%, 72% 62%, 57% 70%, 53% 77%, 51% 100%, 49% 100%, 47% 77%, 43% 70%, 28% 62%, 0% 46%, 16% 30%);
  --sg-loader-down: polygon(35% 20%, 42% 3%, 46% 15%, 50% 13%, 54% 15%, 58% 3%, 65% 20%, 84% 39%, 100% 64%, 72% 68%, 57% 72%, 53% 78%, 51% 100%, 49% 100%, 47% 78%, 43% 72%, 28% 68%, 0% 64%, 16% 39%);
}

.sg-loader {
  display: inline-block;
  flex: none;
  inline-size: var(--sg-icon-size, var(--sg-control-icon-size));
  block-size: var(--sg-icon-size, var(--sg-control-icon-size));
  vertical-align: middle;
  background: currentColor;
  clip-path: var(--sg-loader-level);
  animation: sg-swim var(--sg-motion-duration-loop) ease-in-out infinite;
}

.sg-loader--large {
  --sg-icon-size: var(--sg-size-48);
}

@keyframes sg-swim {

  0%,
  100% {
    clip-path: var(--sg-loader-up);
    translate: 0 4%;
  }

  50% {
    clip-path: var(--sg-loader-down);
    translate: 0 -4%;
  }
}

@media (prefers-reduced-motion: reduce) {
  .sg-loader {
    animation: none;
  }
}

@media (forced-colors: active) {
  .sg-loader {
    forced-color-adjust: none;
    background: CanvasText;
  }
}

/* ---------- Command palette ----------
 * A dialog with a search field over one listbox of records and actions, grouped. Ctrl+K or Cmd+K opens it from anywhere.
 * Focus stays in the field; arrows move the active option, Enter runs it. Group names are drawn from aria-label and hidden from assistive technology, which reads the label itself. */
.sg-palette {
  inline-size: min(40rem, calc(100vw - 2rem));
  max-block-size: min(32rem, calc(100vh - 4rem));
  margin: 12vh auto auto;
  padding: 0;
  overflow: hidden;
  border: var(--sg-control-border-width) solid var(--sg-palette-border);
  border-radius: var(--sg-radius-container);
  background: var(--sg-palette-background);
  color: var(--sg-palette-text);
  box-shadow: var(--sg-palette-shadow);
}

.sg-palette[open] {
  display: flex;
  flex-direction: column;
  animation: sg-rise var(--sg-motion-duration-overlay) var(--sg-motion-easing-enter);
}

.sg-palette::backdrop {
  background: var(--sg-palette-scrim);
}

.sg-palette__search {
  flex: none;
  padding: var(--sg-space-3);
  border-block-end: var(--sg-control-border-width) solid var(--sg-palette-divider);
}

.sg-palette__list {
  flex: 1 1 auto;
  min-block-size: 0;
  overflow: auto;
  overscroll-behavior: contain;
  padding: var(--sg-space-2);
}

.sg-palette__list [role="group"]+[role="group"] {
  margin-block-start: var(--sg-space-2);
}

.sg-palette__list [role="group"]:not(:has([role="option"]:not([hidden]))) {
  display: none;
}

.sg-palette__list [role="group"]::before {
  content: attr(aria-label);
  content: attr(aria-label) / "";
  display: block;
  padding: var(--sg-space-1) var(--sg-space-3);
  color: var(--sg-palette-group);
  font-size: var(--sg-type-label-size);
  line-height: var(--sg-type-label-line);
  font-weight: var(--sg-type-label-weight);
}

.sg-palette__option {
  position: relative;
  display: flex;
  align-items: center;
  gap: var(--sg-space-3);
  min-block-size: var(--sg-control-height-large);
  padding: 0 var(--sg-space-3);
  border: var(--sg-control-border-width) solid transparent;
  border-radius: var(--sg-control-radius);
  cursor: pointer;
}

.sg-palette__option[hidden] {
  display: none;
}

.sg-palette__option[aria-selected="true"] {
  border-color: var(--sg-palette-option-active-border);
  background: var(--sg-palette-option-active);
}

.sg-palette__option[aria-selected="true"]::before {
  content: "";
  position: absolute;
  inset-block: calc(var(--sg-space-2) - var(--sg-control-border-width));
  inset-inline-start: calc(var(--sg-space-1) - var(--sg-control-border-width));
  inline-size: var(--sg-stroke-rule);
  border-radius: var(--sg-radius-round);
  background: var(--sg-palette-indicator);
}

.sg-palette__list .sg-match>mark {
  text-decoration-color: var(--sg-palette-match);
}

.sg-palette__option[aria-selected="true"] .sg-palette__meta {
  color: var(--sg-palette-meta-active);
}

.sg-palette__option>.sg-icon {
  color: var(--sg-palette-icon);
}

.sg-palette__meta {
  margin-inline-start: auto;
  color: var(--sg-palette-meta);
  font-size: var(--sg-type-caption-size);
  line-height: var(--sg-type-caption-line);
  white-space: nowrap;
}

.sg-palette__empty {
  padding: var(--sg-space-6) var(--sg-space-4);
  color: var(--sg-palette-meta);
  text-align: center;
}

.sg-palette__footer {
  display: flex;
  flex: none;
  flex-wrap: wrap;
  gap: var(--sg-space-1) var(--sg-space-4);
  padding: var(--sg-space-2) var(--sg-space-4);
  border-block-start: var(--sg-control-border-width) solid var(--sg-palette-divider);
  background: var(--sg-palette-footer-background);
  color: var(--sg-palette-meta);
  font-size: var(--sg-type-caption-size);
  line-height: var(--sg-type-caption-line);
}

.sg-palette__footer>span {
  display: inline-flex;
  align-items: center;
  gap: var(--sg-space-1);
}

@media (max-width: 30rem) {
  .sg-palette__footer {
    display: none;
  }
}

@media (forced-colors: active) {
  .sg-palette__option[aria-selected="true"] {
    forced-color-adjust: none;
    background: Highlight;
    color: HighlightText;
  }
}

/* ---------- Tree view ----------
 * One tab stop; arrows move, Right opens, Left closes or goes to the parent, Enter selects. stingray.js sets each row's depth,
 * so a selected or hovered row spans the full width while its content indents 24px a level: the toggle and gap of a parent. */
.sg-tree,
.sg-tree [role="group"] {
  margin: 0;
  padding: 0;
  list-style: none;
}

.sg-tree [role="treeitem"] {
  --_d: 0;
}

.sg-tree [role="treeitem"]:focus-visible {
  outline: none;
}

.sg-tree__item {
  position: relative;
  display: flex;
  align-items: center;
  gap: var(--sg-space-2);
  min-block-size: var(--sg-control-height);
  padding: 0 var(--sg-space-2) 0 calc(var(--sg-space-2) + var(--_d) * var(--sg-space-6));
  border-radius: var(--sg-radius-control);
  color: var(--sg-tree-text);
  font-size: var(--sg-control-font-size);
  line-height: var(--sg-control-line-height);
  cursor: pointer;
  user-select: none;
}

.sg-tree__item:hover,
.sg-tree__item.is-hover {
  background: var(--sg-tree-item-hover);
}

.sg-tree [role="treeitem"]:focus-visible>.sg-tree__item {
  outline: var(--sg-focus-width) solid var(--sg-focus-ring);
  outline-offset: calc(-1 * var(--sg-focus-width));
}

.sg-tree [aria-selected="true"]>.sg-tree__item {
  background: var(--sg-tree-item-selected);
  font-weight: var(--sg-type-body-strong-weight);
}

.sg-tree [aria-selected="true"]>.sg-tree__item::before {
  content: "";
  position: absolute;
  inset-block: var(--sg-space-2);
  inset-inline-start: var(--sg-space-1);
  inline-size: var(--sg-stroke-rule);
  border-radius: var(--sg-radius-round);
  background: var(--sg-tree-selection-bar);
}

.sg-tree__toggle {
  flex: none;
  inline-size: var(--sg-size-icon-small);
  block-size: var(--sg-size-icon-small);
  background-color: var(--sg-tree-toggle);
  -webkit-mask: var(--sg-i-right-line) center / contain no-repeat;
  mask: var(--sg-i-right-line) center / contain no-repeat;
  transition: rotate var(--sg-motion-duration-state) var(--sg-motion-easing-enter);
  forced-color-adjust: none;
}

.sg-tree [aria-expanded="true"]>.sg-tree__item>.sg-tree__toggle {
  rotate: 90deg;
}

[dir="rtl"] .sg-tree__toggle {
  rotate: 180deg;
}

.sg-tree [role="treeitem"]:not([aria-expanded])>.sg-tree__item>.sg-tree__toggle {
  visibility: hidden;
}

.sg-tree [aria-expanded="false"]>[role="group"] {
  display: none;
}

/* indent guides: each open level has a hairline under its parent's chevron, drawn over hover and selection fills */
.sg-tree [role="group"] {
  position: relative;
}

.sg-tree [role="group"]::before {
  content: "";
  position: absolute;
  z-index: 1;
  inset-block: 0;
  inset-inline-start: calc(var(--sg-space-2) + var(--_d) * var(--sg-space-6) + var(--sg-size-icon-small) / 2);
  inline-size: var(--sg-control-border-width);
  background: var(--sg-tree-guide);
  pointer-events: none;
}

.sg-tree__item>.sg-icon {
  color: var(--sg-tree-icon);
}

.sg-tree__label {
  min-inline-size: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sg-tree__item>.sg-count {
  margin-inline-start: auto;
}

@media (forced-colors: active) {

  .sg-tree__toggle,
  .sg-tree [role="group"]::before {
    background-color: CanvasText;
  }

  .sg-tree [aria-selected="true"]>.sg-tree__item::before {
    forced-color-adjust: none;
    background: Highlight;
  }
}

/* ---------- List ----------
 * Rows for inboxes and conversations: an avatar, a title with its time, a preview with its count. Unlike a data table, a list row
 * is one control, so it hovers and presses like navigation; the selected row takes the fill and the blue bar, unread rows are semibold ink. */
.sg-list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.sg-list__item {
  position: relative;
  display: flex;
  align-items: flex-start;
  gap: var(--sg-space-3);
  inline-size: 100%;
  min-block-size: var(--sg-control-height);
  padding: var(--sg-space-2) var(--sg-space-3);
  border: 0;
  border-radius: var(--sg-radius-control);
  background: transparent;
  color: var(--sg-list-title);
  text-align: start;
  text-decoration: none;
  cursor: pointer;
}

.sg-list__item:hover,
.sg-list__item.is-hover {
  background: var(--sg-list-item-hover);
}

.sg-list__item:active,
.sg-list__item.is-active {
  background: var(--sg-list-item-pressed);
}

.sg-list__item:focus-visible {
  outline-offset: calc(-1 * var(--sg-focus-width));
}

.sg-list__item:is([aria-current="true"], [aria-current="page"], [aria-selected="true"]) {
  background: var(--sg-list-item-selected);
}

.sg-list__item:is([aria-current="true"], [aria-current="page"], [aria-selected="true"])::before {
  content: "";
  position: absolute;
  inset-block: var(--sg-space-2);
  inset-inline-start: var(--sg-space-1);
  inline-size: var(--sg-stroke-rule);
  border-radius: var(--sg-radius-round);
  background: var(--sg-list-selection-bar);
}

.sg-list__body {
  display: grid;
  flex: 1;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 0 var(--sg-space-2);
  min-inline-size: 0;
}

.sg-list__title {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sg-list__meta {
  color: var(--sg-list-meta);
  font-size: var(--sg-type-caption-size);
  line-height: var(--sg-type-caption-line);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.sg-list__preview {
  grid-column: 1;
  overflow: hidden;
  color: var(--sg-list-preview);
  font-size: var(--sg-type-caption-size);
  line-height: var(--sg-type-caption-line);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sg-list__body>.sg-count {
  grid-column: 2;
  justify-self: end;
}

.sg-list__item[data-unread] .sg-list__title {
  font-weight: var(--sg-type-body-strong-weight);
}

.sg-list__item[data-unread] .sg-list__preview {
  color: var(--sg-list-title);
}

.sg-list>li+li {
  border-block-start: var(--sg-control-border-width) solid var(--sg-list-divider);
}

.sg-list--plain>li+li {
  border-block-start: 0;
}

@media (forced-colors: active) {
  .sg-list__item:is([aria-current="true"], [aria-current="page"], [aria-selected="true"])::before {
    forced-color-adjust: none;
    background: Highlight;
  }
}

/* ---------- Card ----------
 * One raised surface per item, for dashboards and galleries: never inside a panel, never inside another card.
 * A card that goes somewhere stretches its title link over the whole card and darkens its border on hover, like the secondary button. */
.sg-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(16rem, 100%), 1fr));
  gap: var(--sg-space-4);
  margin: 0;
  padding: 0;
  list-style: none;
}

.sg-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: var(--sg-space-2);
  min-inline-size: 0;
  padding: var(--sg-space-4);
  overflow: hidden;
  border: var(--sg-control-border-width) solid var(--sg-card-border);
  border-radius: var(--sg-radius-container);
  background: var(--sg-card-background);
  box-shadow: var(--sg-card-shadow);
  color: var(--sg-card-text);
}

.sg-card__media {
  display: block;
  inline-size: calc(100% + 2 * var(--sg-space-4));
  max-inline-size: none;
  aspect-ratio: 16 / 9;
  margin: calc(-1 * var(--sg-space-4)) calc(-1 * var(--sg-space-4)) var(--sg-space-2);
  object-fit: cover;
  border-block-end: var(--sg-control-border-width) solid var(--sg-card-divider);
}

.sg-card__title {
  color: var(--sg-card-title);
  font-size: var(--sg-type-heading-4-size);
  line-height: var(--sg-type-heading-4-line);
  font-weight: var(--sg-type-heading-4-weight);
}

.sg-card__title a {
  color: inherit;
  text-decoration: none;
}

.sg-card__meta {
  color: var(--sg-card-meta);
  font-size: var(--sg-type-caption-size);
  line-height: var(--sg-type-caption-line);
}

.sg-card__body {
  flex: 1;
}

.sg-card__footer {
  position: relative;
  z-index: 1;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--sg-space-2);
  padding-block-start: var(--sg-space-2);
}

.sg-card--link {
  transition: border-color var(--sg-motion-duration-state) var(--sg-motion-easing-enter);
}

.sg-card--link .sg-card__title a::after {
  content: "";
  position: absolute;
  inset: 0;
}

.sg-card--link:hover,
.sg-card--link.is-hover {
  border-color: var(--sg-card-border-hover);
}

.sg-card--link:is(:hover, .is-hover) .sg-card__title a {
  text-decoration: underline;
}

.sg-card--link .sg-card__title a:focus-visible {
  outline: none;
}

.sg-card--link:has(.sg-card__title a:focus-visible) {
  outline: var(--sg-focus-width) solid var(--sg-focus-ring);
  outline-offset: var(--sg-focus-offset);
}

/* ---------- Thread and message ----------
 * A conversation: messages in time order with date dividers. Inbound messages sit on the raised surface with a hairline, outbound
 * ones on the selected fill at the end side. Delivery is a glyph and a word. The thread is a polite log, so arrivals are announced once. */
.sg-thread {
  display: flex;
  flex-direction: column;
  gap: var(--sg-space-4);
}

.sg-thread__divider {
  display: flex;
  align-items: center;
  gap: var(--sg-space-3);
  color: var(--sg-message-divider-text);
  font-size: var(--sg-type-caption-size);
  line-height: var(--sg-type-caption-line);
}

.sg-thread__divider::before,
.sg-thread__divider::after {
  content: "";
  flex: 1;
  block-size: var(--sg-control-border-width);
  background: var(--sg-message-divider);
}

.sg-message {
  display: grid;
  grid-template-columns: auto minmax(0, 36rem);
  justify-content: start;
  gap: var(--sg-space-1) var(--sg-space-3);
}

.sg-message>.sg-avatar {
  grid-row: 1 / span 3;
}

.sg-message__head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0 var(--sg-space-2);
}

.sg-message__author {
  color: var(--sg-message-author);
  font-weight: var(--sg-type-body-strong-weight);
}

.sg-message__time {
  color: var(--sg-message-meta);
  font-size: var(--sg-type-caption-size);
  line-height: var(--sg-type-caption-line);
  font-variant-numeric: tabular-nums;
}

.sg-message__body {
  justify-self: start;
  max-inline-size: 100%;
  padding: var(--sg-space-2) var(--sg-space-3);
  border: var(--sg-control-border-width) solid var(--sg-message-in-border);
  border-radius: var(--sg-radius-float);
  background: var(--sg-message-in-background);
  color: var(--sg-message-text);
  overflow-wrap: anywhere;
}

.sg-message__body>*+* {
  margin-block-start: var(--sg-space-2);
}

.sg-message__attachments {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sg-space-2);
}

.sg-message__status {
  display: inline-flex;
  align-items: center;
  gap: var(--sg-space-1);
  color: var(--sg-message-meta);
  font-size: var(--sg-type-caption-size);
  line-height: var(--sg-type-caption-line);
}

.sg-message__status>.sg-icon {
  --sg-icon-size: var(--sg-size-icon-small);
  color: var(--sg-message-status);
}

.sg-message__status[data-state="read"]>.sg-icon {
  color: var(--sg-message-status-read);
}

.sg-message--out {
  grid-template-columns: minmax(0, 36rem) auto;
  justify-content: end;
}

.sg-message--out>.sg-avatar {
  grid-column: 2;
  grid-row: 1 / span 3;
}

.sg-message--out> :not(.sg-avatar) {
  grid-column: 1;
  justify-self: end;
}

.sg-message--out .sg-message__head {
  justify-content: flex-end;
}

.sg-message--out .sg-message__body {
  border-color: var(--sg-message-out-background);
  background: var(--sg-message-out-background);
}

.sg-message--continued {
  margin-block-start: calc(-1 * var(--sg-space-3));
}

.sg-message--continued>.sg-avatar {
  visibility: hidden;
}

.sg-message--continued .sg-message__head {
  display: none;
}

/* list: every message is a full-width row, stacked like a transcript, with no bubbles. The content is a centered column up to 46rem
 * beside the avatar; rows divide by hairlines, and the other party's rows sit on a band. In a pane, the thread runs edge to edge. */
.sg-thread--list {
  gap: 0;
}

.sg-thread--list>.sg-message {
  grid-template-columns: auto minmax(0, 46rem);
  justify-content: center;
  padding: var(--sg-space-4);
  border-block-start: var(--sg-control-border-width) solid var(--sg-message-divider);
}

.sg-thread--list>.sg-message:not(.sg-message--out) {
  background: var(--sg-message-list-band);
}

.sg-thread--list>.sg-message--continued {
  margin-block-start: calc(-1 * var(--sg-space-2));
  padding-block-start: 0;
  border-block-start: 0;
}

.sg-thread--list>.sg-message--out>.sg-avatar {
  grid-column: 1;
}

.sg-thread--list>.sg-message--out> :not(.sg-avatar) {
  grid-column: 2;
  justify-self: start;
}

.sg-thread--list>.sg-message--out .sg-message__head {
  justify-content: flex-start;
}

.sg-thread--list .sg-message__body,
.sg-thread--list .sg-message--out .sg-message__body {
  justify-self: stretch;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: none;
}

.sg-thread--list>.sg-thread__divider {
  padding: var(--sg-space-3) var(--sg-space-4);
}

.sg-split__body:has(> .sg-thread--list) {
  padding: 0;
}

/* ---------- Reply to one message ----------
 * A message can hold a reply button: it sits beside the bubble, shows on hover or focus, and is always shown where there
 * is no hover. The quoted message is a small card with a brand bar: above the text in a composer while the reply is
 * written, and first inside the reply once it is sent. The message a quote points at takes a brand ring. */
.sg-message__body:has(> .sg-message__reply) {
  position: relative;
  max-inline-size: calc(100% - var(--sg-control-height-small) - var(--sg-space-1));
}

/* room for the button beside it */
.sg-message__body>.sg-message__reply {
  position: absolute;
  inset-block-start: var(--sg-space-1);
  inset-inline-start: calc(100% + var(--sg-space-1) + var(--sg-control-border-width));
  margin: 0;
  opacity: 0;
}

/* 4px from the bubble's outer edge */
.sg-message--out .sg-message__body>.sg-message__reply {
  inset-inline: auto calc(100% + var(--sg-space-1) + var(--sg-control-border-width));
}

.sg-thread--list .sg-message__body>.sg-message__reply {
  inset-block-start: calc(-1 * var(--sg-space-1));
  inset-inline: calc(100% + var(--sg-space-1)) auto;
}

.sg-message:hover .sg-message__reply,
.sg-message.is-hover .sg-message__reply,
.sg-message__reply:focus-visible {
  opacity: 1;
}

@media (hover: none) {
  .sg-message__body>.sg-message__reply {
    opacity: 1;
  }
}

.sg-message:target>.sg-message__body {
  outline: var(--sg-stroke-rule) solid var(--sg-message-target);
  outline-offset: var(--sg-stroke-rule);
}

.sg-card--reply {
  gap: 0;
  padding: var(--sg-space-1) var(--sg-space-3);
  border: 0;
  border-inline-start: var(--sg-stroke-rule) solid var(--sg-card-reply-bar);
  border-radius: var(--sg-radius-control);
  background: var(--sg-card-reply-background);
  box-shadow: none;
  color: var(--sg-card-reply-text);
}

.sg-card--reply.sg-card--link:is(:hover, .is-hover) {
  border-color: var(--sg-card-reply-bar);
}

.sg-card--reply>.sg-card__title {
  color: var(--sg-card-reply-title);
  font-size: var(--sg-type-caption-size);
  line-height: var(--sg-type-caption-line);
  font-weight: var(--sg-type-body-strong-weight);
}

.sg-card--reply>.sg-card__body {
  flex: none;
  contain: inline-size;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

/* one line, and it never widens the bubble */
.sg-card--reply:has(> .sg-button) {
  padding-inline-end: calc(var(--sg-control-height-small) + var(--sg-space-2));
}

.sg-card--reply>.sg-button {
  position: absolute;
  inset-block-start: 50%;
  inset-inline-end: var(--sg-space-1);
  translate: 0 -50%;
}

.sg-message__body:has(> .sg-card--reply) {
  min-inline-size: min(16rem, 100%);
}

.sg-composer>.sg-card--reply {
  margin: var(--sg-space-2) var(--sg-space-2) 0;
}

/* ---------- Internal note ----------
 * In a thread, text only the team sees is a card, not a message: the note tint, the words "Internal note" with a glyph,
 * who wrote it and when, then the text. It spans the thread, so it never reads as either party's turn.
 * One line holds the title, the meta at the end and, last, the button that opens the note's options. */
.sg-card--note {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: var(--sg-space-2) 0;
  padding: var(--sg-space-3) var(--sg-space-4);
  border-color: var(--sg-card-note-border);
  background: var(--sg-card-note-background);
  box-shadow: none;
  color: var(--sg-card-note-text);
}

.sg-card--note>.sg-card__title {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--sg-space-1) var(--sg-space-2);
  margin-inline-end: var(--sg-space-3);
  font-size: var(--sg-type-body-strong-size);
  line-height: var(--sg-type-body-strong-line);
  font-weight: var(--sg-type-body-strong-weight);
}

.sg-card--note>.sg-card__title>.sg-icon {
  --sg-icon-size: var(--sg-size-icon-small);
}

.sg-card--note>.sg-card__meta {
  justify-self: end;
  color: var(--sg-card-note-meta);
  text-align: end;
}

/* the options button: pulled into the padding, so the line stays one text line tall and the dots sit on the card's edge */
.sg-card--note>.sg-button {
  grid-column: 3;
  grid-row: 1;
  margin-block: calc(-1 * var(--sg-space-1));
  margin-inline: var(--sg-space-1) calc(-1 * var(--sg-space-2));
}

.sg-card--note>.sg-card__body,
.sg-card--note>.sg-card__footer {
  grid-column: 1 / -1;
}

.sg-card--note>.sg-card__body>*+* {
  margin-block-start: var(--sg-space-2);
}

.sg-card--note>form.sg-card__body>.sg-input {
  min-block-size: 0;
  resize: none;
}

/* while it is edited, the field is as tall as the note */
/* a pinned note stays in view while the thread scrolls under it */
.sg-card--note[data-pinned] {
  position: sticky;
  inset-block-start: var(--sg-space-2);
  z-index: 1;
  box-shadow: var(--sg-card-shadow);
}

.sg-thread--list>.sg-card--note {
  align-self: center;
  inline-size: calc(100% - 2 * var(--sg-space-4));
  max-inline-size: calc(46rem + var(--sg-size-control-small) + var(--sg-space-3));
  margin-block: var(--sg-space-3);
}

/* ---------- Composer ----------
 * Shaped like the box of a chat assistant: one rounded, raised field with the text on top and, under it, a single row of
 * tools, toggles and the send button, with no rules between them. In note mode the whole box takes the note tint and a
 * line says who will see it, so an internal note is never sent as a reply by mistake. Its radius is the radius of the
 * controls in its row plus the 8px around them, so their corners are concentric with the box. */
.sg-composer {
  display: flex;
  flex-direction: column;
  border: var(--sg-control-border-width) solid var(--sg-composer-border);
  border-radius: calc(var(--sg-control-radius) + var(--sg-space-2));
  background: var(--sg-composer-background);
  box-shadow: var(--sg-composer-shadow);
  color: var(--sg-composer-text);
}

.sg-composer[data-mode="note"] {
  background: var(--sg-composer-note-background);
}

.sg-composer:has(.sg-composer__input:focus-visible) {
  outline: var(--sg-focus-width) solid var(--sg-focus-ring);
  outline-offset: var(--sg-focus-offset);
}

.sg-composer__hint {
  display: none;
  align-items: center;
  gap: var(--sg-space-1);
  padding: var(--sg-space-3) var(--sg-space-4) 0;
  font-size: var(--sg-type-caption-size);
  line-height: var(--sg-type-caption-line);
}

.sg-composer__hint>.sg-icon {
  --sg-icon-size: var(--sg-size-icon-small);
}

.sg-composer[data-mode="note"] .sg-composer__hint {
  display: flex;
}

.sg-composer__attachments {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sg-space-3);
  padding: var(--sg-space-3) var(--sg-space-4) 0;
}

.sg-composer__attachments:empty {
  display: none;
}

.sg-composer__input {
  display: block;
  inline-size: 100%;
  min-block-size: calc(var(--sg-type-body-line) + 2 * var(--sg-space-3));
  max-block-size: 16rem;
  padding: var(--sg-space-3) var(--sg-space-4);
  overflow: auto;
  border: 0;
  border-radius: inherit;
  background: transparent;
  color: inherit;
  font-size: var(--sg-type-body-size);
  line-height: var(--sg-type-body-line);
  resize: none;
}

.sg-composer__input:focus-visible {
  outline: none;
}

.sg-composer__input::placeholder {
  color: var(--sg-composer-placeholder);
  opacity: 1;
}

.sg-composer__bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--sg-space-2);
  padding: 0 var(--sg-space-2) var(--sg-space-2);
}

.sg-composer__bar> :last-child {
  margin-inline-start: auto;
}

/* the send action sits at the end */
.sg-composer__tools {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--sg-space-1);
}

/* a toggle is a checkbox drawn as a plain label, not a button: an icon, its words, and a small tag that says on or off.
 * The words for the tag come from data-on and data-off; the checkbox itself tells assistive technology the state. */
.sg-composer__toggle {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: var(--sg-space-1);
  min-block-size: var(--sg-control-height-small);
  padding: 0 var(--sg-space-1);
  border-radius: var(--sg-control-radius);
  color: var(--sg-composer-toggle-text);
  font-size: var(--sg-control-font-size);
  line-height: var(--sg-control-line-height);
  white-space: nowrap;
  cursor: pointer;
}

.sg-composer__toggle>input {
  position: absolute;
  inset: 0;
  inline-size: 100%;
  block-size: 100%;
  margin: 0;
  opacity: 0;
  cursor: pointer;
}

.sg-composer__toggle>.sg-icon {
  --sg-icon-size: var(--sg-size-icon-small);
}

.sg-composer__toggle::after {
  content: attr(data-off);
  padding: 0 var(--sg-space-1);
  border-radius: var(--sg-radius-mark);
  background: var(--sg-composer-toggle-tag-background);
  color: var(--sg-composer-toggle-tag-text);
  font-size: var(--sg-type-label-size);
  line-height: var(--sg-type-label-line);
  font-weight: var(--sg-type-label-weight);
}

.sg-composer__toggle:has(:checked)::after {
  content: attr(data-on);
  background: var(--sg-composer-toggle-on-background);
  color: var(--sg-composer-toggle-on-text);
}

.sg-composer__toggle:hover,
.sg-composer__toggle.is-hover {
  color: var(--sg-composer-toggle-text-hover);
}

.sg-composer__toggle:has(:focus-visible) {
  outline: var(--sg-focus-width) solid var(--sg-focus-ring);
  outline-offset: var(--sg-focus-offset);
}

@media (forced-colors: active) {
  .sg-composer[data-mode="note"] {
    border-style: dashed;
  }

  .sg-composer__toggle:has(:checked)::after {
    forced-color-adjust: none;
    background: Highlight;
    color: HighlightText;
  }
}

/* ---------- Attachment ----------
 * A file on a message, as in a chat assistant's composer: a small preview with the name and the size beside it. An image
 * or a video shows the picture; a document shows only its icon. The remove button is a round mark on the tile's corner.
 * The tile's radius is the preview's plus the 4px around it. */
.sg-attachment {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: var(--sg-space-2);
  min-inline-size: 0;
  max-inline-size: 100%;
  padding: var(--sg-space-1);
  padding-inline-end: var(--sg-space-3);
  border: var(--sg-control-border-width) solid var(--sg-attachment-border);
  border-radius: var(--sg-radius-float);
  background: var(--sg-attachment-background);
}

.sg-attachment__thumb {
  position: relative;
  display: grid;
  place-items: center;
  flex: none;
  inline-size: var(--sg-size-control-large);
  block-size: var(--sg-size-control-large);
  overflow: hidden;
  border-radius: calc(var(--sg-radius-float) - var(--sg-space-1));
  background: var(--sg-attachment-thumb-background);
  color: var(--sg-attachment-icon);
}

.sg-attachment__thumb> :is(img, video) {
  inline-size: 100%;
  block-size: 100%;
  object-fit: cover;
}

.sg-attachment__thumb>.sg-icon {
  --sg-icon-size: var(--sg-size-icon-medium);
}

/* a video says so with a play mark over its first frame */
.sg-attachment--video>.sg-attachment__thumb::before,
.sg-attachment--video>.sg-attachment__thumb::after {
  content: "";
  position: absolute;
  inset: 0;
  margin: auto;
}

.sg-attachment--video>.sg-attachment__thumb::before {
  inline-size: var(--sg-size-20);
  block-size: var(--sg-size-20);
  border-radius: var(--sg-radius-round);
  background: var(--sg-attachment-play-background);
}

.sg-attachment--video>.sg-attachment__thumb::after {
  inline-size: var(--sg-space-3);
  block-size: var(--sg-space-3);
  background-color: var(--sg-attachment-play-icon);
  -webkit-mask: var(--sg-i-play-line) center / contain no-repeat;
  mask: var(--sg-i-play-line) center / contain no-repeat;
}

.sg-attachment__body {
  display: grid;
  min-inline-size: 0;
}

.sg-attachment__name {
  overflow: hidden;
  max-inline-size: 12rem;
  color: var(--sg-attachment-name);
  font-weight: var(--sg-type-body-strong-weight);
  white-space: nowrap;
  text-overflow: ellipsis;
}

.sg-attachment__meta {
  color: var(--sg-attachment-meta);
  font-size: var(--sg-type-caption-size);
  line-height: var(--sg-type-caption-line);
  font-variant-numeric: tabular-nums;
}

.sg-attachment__remove {
  position: absolute;
  inset-block-start: calc(-1 * var(--sg-space-2) - var(--sg-control-border-width));
  inset-inline-start: calc(-1 * var(--sg-space-2) - var(--sg-control-border-width));
  display: grid;
  place-items: center;
  inline-size: var(--sg-size-target-minimum);
  block-size: var(--sg-size-target-minimum);
  padding: 0;
  border: var(--sg-control-border-width) solid var(--sg-attachment-remove-border);
  border-radius: var(--sg-radius-round);
  background: var(--sg-attachment-remove-background);
  color: var(--sg-attachment-remove-icon);
  cursor: pointer;
}

.sg-attachment__remove::before {
  content: "";
  inline-size: var(--sg-space-3);
  block-size: var(--sg-space-3);
  background-color: currentColor;
  -webkit-mask: var(--sg-i-close-line) center / contain no-repeat;
  mask: var(--sg-i-close-line) center / contain no-repeat;
}

.sg-attachment__remove:hover,
.sg-attachment__remove.is-hover {
  background: var(--sg-attachment-remove-hover);
}

@media (forced-colors: active) {
  .sg-attachment__remove::before {
    background-color: ButtonText;
  }

  .sg-attachment--video>.sg-attachment__thumb::after {
    background-color: CanvasText;
  }

  .sg-attachment--video>.sg-attachment__thumb::before {
    background: Canvas;
  }
}

/* ---------- Presence ----------
 * A glyph on the corner of an avatar, ringed in the surface color: online is a check in a filled circle, away a clock, busy a cross,
 * offline an empty ring. Shape and hue both carry the state, and the avatar's label says it in words. */
.sg-avatar[data-presence] {
  position: relative;
  overflow: visible;
}

.sg-avatar[data-presence]::before,
.sg-avatar[data-presence]::after {
  content: "";
  position: absolute;
  inset-block-end: calc(-1 * var(--sg-stroke-rule));
  inset-inline-end: calc(-1 * var(--sg-stroke-rule));
  border-radius: var(--sg-radius-round);
}

.sg-avatar[data-presence]::before {
  inline-size: var(--sg-space-3);
  block-size: var(--sg-space-3);
  background: var(--sg-presence-ring);
}

.sg-avatar[data-presence]::after {
  --_p: var(--sg-presence-online);
  --_g: var(--sg-i-check-circle-fill);
  margin: var(--sg-control-border-width);
  inline-size: calc(var(--sg-space-3) - 2 * var(--sg-control-border-width));
  block-size: calc(var(--sg-space-3) - 2 * var(--sg-control-border-width));
  background: var(--_p);
  -webkit-mask: var(--_g) center / contain no-repeat;
  mask: var(--_g) center / contain no-repeat;
  forced-color-adjust: none;
}

.sg-avatar[data-presence="away"]::after {
  --_p: var(--sg-presence-away);
  --_g: var(--sg-i-time-line);
}

.sg-avatar[data-presence="busy"]::after {
  --_p: var(--sg-presence-busy);
  --_g: var(--sg-i-close-circle-fill);
}

.sg-avatar[data-presence="offline"]::after {
  --_p: var(--sg-presence-offline);
  --_g: var(--sg-i-round-line);
}

@media (forced-colors: active) {
  .sg-avatar[data-presence]::after {
    background: CanvasText;
  }
}

/* ---------- Typing ----------
 * Who is typing, in words, after three small dots that rise in turn on the loop duration. Typing is activity, not a status, so it is neutral.
 * Under reduced motion the dots stand still. */
.sg-typing {
  display: inline-flex;
  align-items: center;
  gap: var(--sg-space-2);
  color: var(--sg-typing-text);
  font-size: var(--sg-type-caption-size);
  line-height: var(--sg-type-caption-line);
}

.sg-typing__dots {
  display: inline-flex;
  align-items: center;
  gap: var(--sg-space-1);
  block-size: var(--sg-space-3);
}

.sg-typing__dots>i {
  inline-size: var(--sg-space-1);
  block-size: var(--sg-space-1);
  border-radius: var(--sg-radius-round);
  background: var(--sg-typing-dot);
  animation: sg-typing var(--sg-motion-duration-loop) ease-in-out infinite;
}

.sg-typing__dots>i:nth-child(2) {
  animation-delay: calc(var(--sg-motion-duration-loop) / 6);
}

.sg-typing__dots>i:nth-child(3) {
  animation-delay: calc(var(--sg-motion-duration-loop) / 3);
}

@keyframes sg-typing {

  0%,
  60%,
  100% {
    translate: 0 0;
  }

  30% {
    translate: 0 calc(-1 * var(--sg-space-1));
  }
}

@media (prefers-reduced-motion: reduce) {
  .sg-typing__dots>i {
    animation: none;
  }
}

@media (forced-colors: active) {
  .sg-typing__dots>i {
    forced-color-adjust: none;
    background: CanvasText;
  }
}

/* ---------- Audio player and voice note ----------
 * Without the script the browser's own controls show; with it, a play button, a waveform you can seek and the time. */
.sg-audio {
  display: flex;
  align-items: center;
  gap: var(--sg-space-3);
  min-inline-size: 0;
}

.sg-audio:not([data-sg-ready])> :not(audio),
.sg-audio[data-sg-ready]>audio {
  display: none;
}

.sg-audio__play {
  flex: none;
}

.sg-audio__wave {
  position: relative;
  display: flex;
  flex: 1;
  align-items: center;
  justify-content: space-between;
  gap: 2px;
  min-inline-size: 6rem;
  block-size: var(--sg-size-28);
}

.sg-audio__bar {
  flex: 0 1 var(--sg-space-1);
  min-inline-size: 2px;
  block-size: calc(var(--_h, 0.1) * 100%);
  border-radius: var(--sg-radius-round);
  background: var(--sg-audio-bar);
}

.sg-audio__bar.is-played {
  background: var(--sg-audio-bar-played);
}

.sg-audio__wave--rail::before,
.sg-audio__wave--rail::after {
  content: "";
  position: absolute;
  inset-inline-start: 0;
  inset-block-start: 50%;
  block-size: var(--sg-space-1);
  border-radius: var(--sg-radius-round);
  translate: 0 -50%;
}

.sg-audio__wave--rail::before {
  inline-size: 100%;
  background: var(--sg-audio-bar);
}

.sg-audio__wave--rail::after {
  inline-size: calc(var(--_p, 0) * 100%);
  background: var(--sg-audio-bar-played);
}

/* the seek input lies over the waveform: invisible, but it takes the pointer, the keys and the focus ring */
.sg-audio__seek {
  position: absolute;
  z-index: 1;
  inset: 0;
  inline-size: 100%;
  block-size: 100%;
  margin: 0;
  border-radius: var(--sg-radius-mark);
  background: transparent;
  -webkit-appearance: none;
  appearance: none;
  cursor: pointer;
}

.sg-audio__seek::-webkit-slider-runnable-track {
  block-size: 100%;
  background: transparent;
}

.sg-audio__seek::-moz-range-track {
  background: transparent;
}

.sg-audio__seek::-webkit-slider-thumb {
  inline-size: 2px;
  block-size: 100%;
  background: transparent;
  -webkit-appearance: none;
  appearance: none;
}

.sg-audio__seek::-moz-range-thumb {
  inline-size: 2px;
  block-size: 100%;
  border: 0;
  border-radius: 0;
  background: transparent;
}

.sg-audio__time {
  flex: none;
  color: var(--sg-audio-time);
  font-size: var(--sg-type-caption-size);
  line-height: var(--sg-type-caption-line);
  font-variant-numeric: tabular-nums;
}

.sg-audio--compact {
  gap: var(--sg-space-2);
}

.sg-audio--compact .sg-audio__wave {
  min-inline-size: 8rem;
  block-size: var(--sg-size-24);
}

@media (forced-colors: active) {

  .sg-audio__bar,
  .sg-audio__wave--rail::before {
    forced-color-adjust: none;
    background: GrayText;
  }

  .sg-audio__bar.is-played,
  .sg-audio__wave--rail::after {
    forced-color-adjust: none;
    background: Highlight;
  }
}

/* ---------- Voice input ---------- */
.sg-voice {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--sg-space-3);
}

.sg-voice__button {
  flex: none;
}

.sg-voice__label {
  white-space: nowrap;
}

.sg-voice__level,
.sg-voice__time {
  display: none;
}

.sg-voice.is-recording .sg-voice__level {
  display: flex;
  align-items: center;
  gap: 2px;
  inline-size: 6rem;
  block-size: var(--sg-size-24);
}

.sg-voice__bar {
  flex: 1;
  min-inline-size: 2px;
  block-size: calc(max(0.08, var(--_h, 0)) * 100%);
  border-radius: var(--sg-radius-round);
  background: var(--sg-voice-level);
}

.sg-voice.is-recording .sg-voice__time {
  display: inline-flex;
  align-items: center;
  gap: var(--sg-space-2);
  color: var(--sg-voice-time);
  font-size: var(--sg-type-caption-size);
  line-height: var(--sg-type-caption-line);
  font-variant-numeric: tabular-nums;
}

.sg-voice__time::before {
  content: "";
  inline-size: var(--sg-space-2);
  block-size: var(--sg-space-2);
  border-radius: var(--sg-radius-round);
  background: var(--sg-voice-recording);
  animation: sg-blink var(--sg-motion-duration-loop) ease-in-out infinite;
}

@keyframes sg-blink {
  50% {
    opacity: 0.25;
  }
}

@media (prefers-reduced-motion: reduce) {
  .sg-voice__time::before {
    animation: none;
  }
}

@media (forced-colors: active) {

  .sg-voice__bar,
  .sg-voice__time::before {
    forced-color-adjust: none;
    background: CanvasText;
  }
}

/* ---------- Agent orb ----------
 * Flat discs, never a gradient: a brand core in a tinted halo, and a ring that grows with --_l (0 to 1, from Stingray.level) while listening. */
.sg-orb {
  --_s: var(--sg-size-48);
  position: relative;
  display: inline-grid;
  flex: none;
  place-items: center;
  inline-size: var(--_s);
  block-size: var(--_s);
  border-radius: var(--sg-radius-round);
  background: var(--sg-orb-halo);
}

.sg-orb--large {
  --_s: calc(2 * var(--sg-size-48));
}

.sg-orb::before {
  content: "";
  inline-size: 50%;
  block-size: 50%;
  border-radius: var(--sg-radius-round);
  background: var(--sg-orb-core);
}

.sg-orb::after {
  content: "";
  position: absolute;
  inset: 0;
  border: var(--sg-stroke-rule) solid var(--sg-orb-ring);
  border-radius: var(--sg-radius-round);
  opacity: 0;
}

.sg-orb[data-state="idle"]::before {
  animation: sg-breathe calc(2 * var(--sg-motion-duration-loop)) ease-in-out infinite;
}

.sg-orb[data-state="listening"]::after {
  opacity: 1;
  scale: calc(0.8 + var(--_l, 0) * 0.4);
  transition: scale var(--sg-motion-duration-fast) linear;
}

.sg-orb[data-state="thinking"]::after {
  animation: sg-ripple var(--sg-motion-duration-loop) ease-out infinite;
}

.sg-orb[data-state="talking"]::before {
  animation: sg-talk calc(var(--sg-motion-duration-loop) / 4) ease-in-out infinite alternate;
}

@keyframes sg-breathe {
  50% {
    scale: 1.1;
  }
}

@keyframes sg-ripple {
  from {
    opacity: 1;
    scale: 0.55;
  }

  to {
    opacity: 0;
    scale: 1;
  }
}

@keyframes sg-talk {
  from {
    scale: 1;
  }

  to {
    scale: 1.3;
  }
}

@media (prefers-reduced-motion: reduce) {

  .sg-orb::before,
  .sg-orb::after {
    animation: none;
    transition: none;
  }
}

@media (forced-colors: active) {
  .sg-orb {
    forced-color-adjust: none;
    border: var(--sg-control-border-width) solid CanvasText;
    background: Canvas;
  }

  .sg-orb::before {
    background: CanvasText;
  }

  .sg-orb::after {
    border-color: Highlight;
  }
}

/* ---------- Thinking text ---------- */
.sg-shimmer {
  color: var(--sg-shimmer-text);
}

.sg-shimmer>[aria-hidden]>span {
  animation: sg-shimmer var(--sg-motion-duration-loop) ease-in-out infinite;
  animation-delay: calc(var(--_i, 0) * var(--sg-motion-duration-loop) / 20);
}

@keyframes sg-shimmer {

  0%,
  60%,
  100% {
    color: var(--sg-shimmer-text);
  }

  30% {
    color: var(--sg-shimmer-peak);
  }
}

@media (prefers-reduced-motion: reduce) {
  .sg-shimmer>[aria-hidden]>span {
    animation: none;
  }
}

/* ---------- Page header ----------
 * The top of a page: an optional breadcrumb, then the title with the page's actions at the end of its line, facts about the page
 * under it, and optional tabs. It wraps instead of shrinking: when the title and the actions no longer fit, the actions move down. */
.sg-page-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--sg-space-1) var(--sg-space-4);
}

.sg-page-header>* {
  flex: 1 1 100%;
  min-inline-size: 0;
}

.sg-page-header__title {
  flex: 1 1 16rem;
  color: var(--sg-page-header-title);
  font-size: var(--sg-type-heading-1-size);
  line-height: var(--sg-type-heading-1-line);
  font-weight: var(--sg-type-heading-1-weight);
  letter-spacing: var(--sg-type-heading-1-tracking);
  overflow-wrap: anywhere;
}

.sg-page-header__actions {
  display: flex;
  flex: 0 1 auto;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--sg-space-2);
}

.sg-page-header__meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--sg-space-1) var(--sg-space-4);
  color: var(--sg-page-header-meta);
}

.sg-page-header>.sg-tabs {
  margin-block-start: var(--sg-space-3);
}

/* ---------- Split view ----------
 * Panes side by side in one raised frame: a list, the item it opened, and optional details. Each pane scrolls on its own. The frame
 * is a container: below 64rem of its own width the details pane hides, and below 40rem one pane shows at a time, the list until
 * data-show="main" is set. In the shell's main area it fills the height left under the page header. */
.sg-split {
  container: sg-split / inline-size;
  display: flex;
  inline-size: 100%;
  min-block-size: 24rem;
  overflow: hidden;
  border: var(--sg-control-border-width) solid var(--sg-split-border);
  border-radius: var(--sg-radius-container);
  background: var(--sg-split-background);
  box-shadow: var(--sg-split-shadow);
}

.sg-split__list,
.sg-split__main,
.sg-split__aside {
  display: flex;
  flex-direction: column;
  min-inline-size: 0;
  min-block-size: 0;
}

.sg-split__list {
  flex: 0 0 20rem;
  border-inline-end: var(--sg-control-border-width) solid var(--sg-split-divider);
}

.sg-split__main {
  flex: 1 1 0;
}

.sg-split__main--canvas {
  background: var(--sg-split-canvas);
}

.sg-split__aside {
  flex: 0 0 18rem;
  border-inline-start: var(--sg-control-border-width) solid var(--sg-split-divider);
}

.sg-split__head {
  display: flex;
  flex: none;
  align-items: center;
  gap: var(--sg-space-3);
  min-block-size: var(--sg-size-48);
  padding: var(--sg-space-2) var(--sg-space-4);
  border-block-end: var(--sg-control-border-width) solid var(--sg-split-divider);
}

.sg-split__body {
  flex: 1 1 auto;
  min-block-size: 0;
  overflow: auto;
  padding: var(--sg-space-4);
}

.sg-split__list>.sg-split__body {
  padding: var(--sg-space-2);
}

.sg-split__foot {
  flex: none;
  padding: var(--sg-space-3) var(--sg-space-4);
  border-block-start: var(--sg-control-border-width) solid var(--sg-split-divider);
}

.sg-split__foot:has(> .sg-composer) {
  padding-block-start: var(--sg-space-2);
  border-block-start: 0;
}

/* a composer is its own box: no rule above it */
.sg-split__back {
  display: none;
}

@container sg-split (max-width: 64rem) {
  .sg-split__aside {
    display: none;
  }

  .sg-split__list {
    flex-basis: 18rem;
  }
}

@container sg-split (max-width: 40rem) {

  .sg-split__list,
  .sg-split__main {
    flex-basis: 100%;
    border-inline: 0;
  }

  .sg-split:not([data-show="main"])>.sg-split__main,
  .sg-split[data-show="main"]>.sg-split__list {
    display: none;
  }

  .sg-split__back {
    display: inline-flex;
  }
}

/* ---------- Scrollbars ----------
 * Thin and quiet: an 8px rounded thumb, inset 2px in a 12px gutter on a clear track, in the control gray (3:1), one step stronger
 * under the pointer. Chromium and Safari read the -webkit- pseudo-elements; Firefox, which has none, reads the standard properties. */
:root:has(.sg)::-webkit-scrollbar,
.sg ::-webkit-scrollbar {
  width: var(--sg-space-3);
  height: var(--sg-space-3);
  background: transparent;
}

:root:has(.sg)::-webkit-scrollbar-thumb,
.sg ::-webkit-scrollbar-thumb {
  border: var(--sg-stroke-rule) solid transparent;
  border-radius: var(--sg-radius-round);
  background: var(--sg-scrollbar-thumb) padding-box;
}

:root:has(.sg)::-webkit-scrollbar-thumb:hover,
.sg ::-webkit-scrollbar-thumb:hover {
  background-color: var(--sg-scrollbar-thumb-hover);
}

:root:has(.sg)::-webkit-scrollbar-corner,
.sg ::-webkit-scrollbar-corner {
  background: transparent;
}

@supports not selector(::-webkit-scrollbar) {

  :root:has(.sg),
  .sg,
  .sg * {
    scrollbar-width: thin;
    scrollbar-color: var(--sg-scrollbar-thumb) transparent;
  }
}

@media (forced-colors: active) {

  :root:has(.sg)::-webkit-scrollbar-thumb,
  .sg ::-webkit-scrollbar-thumb {
    background-color: CanvasText;
  }
}

/* ---------- Print: a first-class output ---------- */
@media print {

  .sg,
  .sg * {
    print-color-adjust: exact;
    -webkit-print-color-adjust: exact;
  }

  .sg,
  .sg * {
    box-shadow: none !important;
  }

  .sg-no-print,
  .sg-toast-region,
  .sg-skip,
  .sg-tooltip,
  .sg-menu {
    display: none !important;
  }

  .sg-table-wrap {
    overflow: visible !important;
    max-block-size: none !important;
  }

  .sg-table thead {
    display: table-header-group;
  }

  .sg-table tr,
  .sg-chart,
  .sg-stat,
  .sg-panel,
  .sg-banner {
    break-inside: avoid;
  }

  .sg-nav,
  .sg-bulkbar,
  .sg-palette__footer {
    display: none !important;
  }

  .sg-split {
    display: block;
    overflow: visible;
    border: 0;
  }

  .sg-split__list,
  .sg-split__aside,
  .sg-split__back {
    display: none !important;
  }

  .sg-split__main {
    display: block !important;
  }

  .sg-split__body {
    overflow: visible;
  }

  .sg-progress__fill {
    animation: none;
  }

  .sg-chart .sg-chart__mark[data-series="1"] {
    --_fill: var(--sg-tex-1);
  }

  .sg-chart .sg-chart__mark[data-series="2"] {
    --_fill: var(--sg-tex-2);
  }

  .sg-chart .sg-chart__mark[data-series="3"] {
    --_fill: var(--sg-tex-3);
  }

  .sg-chart .sg-chart__mark[data-series="4"] {
    --_fill: var(--sg-tex-4);
  }

  a[href^="http"]:not(.sg-button)::after {
    content: " (" attr(href) ")";
    font-size: var(--sg-type-caption-size);
    overflow-wrap: anywhere;
  }
}