/* =============================================================================
   sl-components.css — StayLinked SmartHub Component Primitives
   -----------------------------------------------------------------------------
   Faithful CSS translation of the Figma component pages. Every rule references
   sl-tokens.css — no raw colour, size, or shadow literals in this file.

   Requires: sl-tokens.css loaded first.

   Figma sources:
     Buttons          node 32:973  (primary / secondary / other / destructive)
     Inputs           node 32:829  (default / active / error / disabled / readonly)
     Profile cards    node 32:773  (card + kebab icon-button)
     Session cards    node 48:2445 (active-current / active / inactive)
     Settings button  node 41:2092

   Naming: BEM-ish, prefixed .sl- to avoid colliding with legacy classes and
   bootstrap.min.css. States: :hover/:active/:focus-visible plus .is-active for
   JS-driven persistent states.
   ========================================================================== */

/* =============================================================================
   1. BUTTONS — Figma 32:973, restated by the Package Editor Redesign (Nov 2026)
   Base frame: padding 10px 16px, radius 8px, flat (no elevation), label
   Roboto Medium 15/20, height = --sl-control-height (44px touch minimum).
   An icon sits before the label with an 8px gap.
   ========================================================================== */
.sl-btn {
  box-sizing: border-box;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--sl-space-2);
  min-height: var(--sl-control-height);
  padding: var(--sl-space-2h) var(--sl-space-4);
  border: 1px solid transparent;
  border-radius: var(--sl-radius-md);
  box-shadow: var(--sl-elevation-none);

  font-family: var(--sl-font-family);
  font-size: var(--sl-font-size-row);
  font-weight: var(--sl-font-weight-medium);
  line-height: var(--sl-line-height-body);
  letter-spacing: var(--sl-letter-spacing-label);
  text-align: center;
  text-decoration: none;
  white-space: nowrap;

  cursor: pointer;
  user-select: none;
  transition:
    background-color var(--sl-duration-base) var(--sl-easing-standard),
    box-shadow       var(--sl-duration-base) var(--sl-easing-standard),
    border-color     var(--sl-duration-base) var(--sl-easing-standard);
}

.sl-btn:focus-visible {
  outline: var(--sl-focus-ring-width) solid var(--sl-focus-ring-color);
  outline-offset: var(--sl-focus-ring-offset);
}

.sl-btn:disabled,
.sl-btn[aria-disabled="true"] {
  cursor: not-allowed;
  box-shadow: var(--sl-elevation-none);
  background: var(--sl-surface-disabled);
  border-color: var(--sl-border-strong);
  color: var(--sl-text-muted);
}

/* --- Primary — Figma 32:1039 / 32:1036 ------------------------------------ */
.sl-btn--primary {
  background: var(--sl-action-primary-bg);
  color: var(--sl-action-primary-fg);
}
.sl-btn--primary:hover:not(:disabled)  { background: var(--sl-action-primary-bg-hover); }
.sl-btn--primary:active:not(:disabled),
.sl-btn--primary.is-active             { background: var(--sl-action-primary-bg-active); }

/* --- Secondary (outlined) — Figma 32:1047 / 32:1053 ------------------------ */
.sl-btn--secondary {
  background: var(--sl-action-secondary-bg);
  border-color: var(--sl-action-secondary-border);
  color: var(--sl-action-secondary-fg);
}
.sl-btn--secondary:hover:not(:disabled)  { background: var(--sl-action-secondary-bg-hover); }
.sl-btn--secondary:active:not(:disabled),
.sl-btn--secondary.is-active             { background: var(--sl-action-secondary-bg-active); }

/* --- Tertiary / "Other" (filled tonal) — Figma 32:1067 / 32:1070 ----------- */
.sl-btn--tertiary {
  background: var(--sl-action-tertiary-bg);
  color: var(--sl-action-tertiary-fg);
}
.sl-btn--tertiary:hover:not(:disabled)   { background: var(--sl-action-tertiary-bg-hover); }
.sl-btn--tertiary:active:not(:disabled),
.sl-btn--tertiary.is-active {
  background: var(--sl-action-tertiary-bg-active);
  box-shadow: var(--sl-elevation-2);            /* Figma active state elevates */
}

/* --- Destructive (quiet until confirmed) — Figma 32:1031 / 32:1025 --------- */
.sl-btn--destructive {
  background: var(--sl-action-danger-bg);
  border-color: var(--sl-action-danger-border);
  color: var(--sl-action-danger-fg);
}
.sl-btn--destructive:hover:not(:disabled)  { background: var(--sl-action-danger-bg-hover); }
.sl-btn--destructive:active:not(:disabled),
.sl-btn--destructive.is-active             { background: var(--sl-action-danger-bg-active); }

/* =============================================================================
   2. TEXT INPUTS — Figma 32:829, restated by the Package Editor Redesign (Nov 2026)
   Base frame: 44px tall (--sl-control-height), padding 12px, radius 4px
   (--sl-field-radius), value Roboto Regular 16px (--sl-field-font-size).
   Works on <input>, <textarea>, <select>.
   ========================================================================== */
.sl-input {
  box-sizing: border-box;
  display: block;
  width: 100%;
  min-height: var(--sl-control-height);
  padding: var(--sl-space-2h) var(--sl-space-3);
  background: var(--sl-surface-raised);
  border: 1px solid var(--sl-border-field);
  border-radius: var(--sl-field-radius);

  font-family: var(--sl-font-family);
  font-size: var(--sl-field-font-size);
  font-weight: var(--sl-font-weight-regular);
  line-height: var(--sl-line-height-body);
  color: var(--sl-text-field);

  transition:
    border-color var(--sl-duration-fast) var(--sl-easing-standard),
    box-shadow   var(--sl-duration-fast) var(--sl-easing-standard);
}

.sl-input::placeholder { color: var(--sl-text-muted); }

/* Active — Figma 32:923: 2px primary border. Inset ring avoids layout shift. */
/* The active field. Purple, not the action blue: the point of the colour here
   is "this is where you are typing", which is a different statement from "this
   is a thing you can press". */
.sl-input:focus,
.sl-input.is-active {
  outline: none;
  border-color: var(--sl-selected-border);
  box-shadow: inset 0 0 0 1px var(--sl-selected-border);
}

/* Error — Figma 32:949 / 32:942 */
.sl-input.is-invalid,
.sl-input:user-invalid,
.text-field.is-invalid,
.text-area.is-invalid {
  border-color: var(--sl-border-danger);
}
.sl-input.is-invalid:focus,
.sl-input:user-invalid:focus,
.text-field.is-invalid:focus,
.text-area.is-invalid:focus {
  box-shadow: inset 0 0 0 1px var(--sl-border-danger);
}

/* Disabled — Figma 32:931: grey fill, dashed border */
.sl-input:disabled {
  background: var(--sl-surface-disabled);
  border-style: dashed;
  color: var(--sl-text-muted);
  cursor: not-allowed;
}

/* Read-only — Figma 32:937: grey fill, solid border.
   Selects are excluded on purpose. :read-only matches every element that is
   not a text-editable control, so a <select> matches it always and would
   render as though it were disabled. The shell's own copy of this rule already
   scopes itself to input for the same reason. */
.sl-input:read-only:not(:disabled):not(select) {
  background: var(--sl-surface-disabled);
}

/* Field wrapper: positions the trailing error icon — Figma 32:958 */
.sl-field {
  position: relative;
  display: block;
}
.sl-field__error-icon {
  display: none;
  position: absolute;
  right: var(--sl-space-3);
  top: 50%;
  transform: translateY(-50%);
  color: var(--sl-text-danger);
  font-size: var(--sl-font-size-sm);
  pointer-events: none;
}
.sl-field:has(.sl-input.is-invalid) .sl-field__error-icon,
.sl-field:has(.sl-input:user-invalid) .sl-field__error-icon {
  display: block;
}
/* Reserve room for the icon so text never runs under it */
.sl-field:has(.sl-field__error-icon) .sl-input.is-invalid,
.sl-field:has(.sl-field__error-icon) .sl-input:user-invalid {
  padding-right: calc(var(--sl-space-3) * 2 + 1.25em);
}

/* Label 14px Medium, 6px above the control. Help 13px, 6px below it. */
.sl-field__label {
  display: block;
  margin-bottom: 0.375rem;
  font-family: var(--sl-font-family);
  font-size: var(--sl-font-size-sm);
  font-weight: var(--sl-font-weight-medium);
  color: var(--sl-text-primary);
}

.sl-field__help,
.sl-field__error-text {
  display: block;
  margin-top: 0.375rem;
  font-size: var(--sl-font-size-hint);
  line-height: 1.4;
}
.sl-field__help       { color: var(--sl-text-secondary); }
.sl-field__error-text { color: var(--sl-text-danger); }

/* =============================================================================
   3. CARDS — shared chrome: light-blue hairline, raised surface, soft lift.
   Same tokens as package start, My Hub, Help, Licensing, and profiles.
   Title SemiBold 16/20, description Regular 12/20. Width is fluid — the
   grid in sl-responsive.css owns sizing.
   ========================================================================== */
.sl-card {
  box-sizing: border-box;
  position: relative;
  display: flex;
  align-items: center;
  gap: var(--sl-space-2h);
  min-height: var(--sl-card-min-height);
  padding: var(--sl-space-2h);
  background: var(--sl-surface-raised);
  border: 1px solid var(--sl-border-accent-soft);
  border-radius: var(--sl-radius-md);
  box-shadow: var(--sl-elevation-start);
  font-family: var(--sl-font-family);
  color: var(--sl-text-primary);
  transition:
    border-color     var(--sl-duration-fast) var(--sl-easing-standard),
    background-color var(--sl-duration-base) var(--sl-easing-standard),
    box-shadow       var(--sl-duration-base) var(--sl-easing-standard);
}

/* Interactive cards (role=button / <a> / <button>) */
.sl-card--interactive { cursor: pointer; }
.sl-card--interactive:hover  { border-color: var(--sl-border-accent); }
.sl-card--interactive:active,
/* A picked card keeps the selection tint and gains its line, so selection is
   legible without relying on the fill alone. */
.sl-card--interactive.is-active {
  background: var(--sl-selected-bg);
  border-color: var(--sl-selected-border);
}
.sl-card--interactive:focus-visible {
  outline: var(--sl-focus-ring-width) solid var(--sl-focus-ring-color);
  outline-offset: var(--sl-focus-ring-offset);
}

/* Variants — Figma 48:2445 */
.sl-card--current  { border-color: var(--sl-border-accent); }   /* active, this session */
.sl-card--inactive { background: var(--sl-surface-accent); }    /* selectable, not running */

.sl-card__body {
  flex: 1 1 auto;
  min-width: 0;                        /* allow text truncation inside flex */
}

.sl-card__title {
  margin: 0;
  font-size: var(--sl-font-size-md);
  font-weight: var(--sl-font-weight-semibold);
  line-height: var(--sl-line-height-body);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sl-card__description {
  margin: 0;
  font-size: var(--sl-font-size-xs);
  font-weight: var(--sl-font-weight-regular);
  line-height: var(--sl-line-height-body);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* "(Default)" affix on the description row — Figma 48:2506 */
.sl-card__meta {
  color: var(--sl-text-muted);
  font-size: var(--sl-font-size-xs);
}

/* Status indicator — Figma 48:2671: "Current" Roboto Light 11/20 + 10px dot */
.sl-card__status {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin-left: auto;
  font-size: var(--sl-font-size-2xs);
  font-weight: var(--sl-font-weight-light);
  color: var(--sl-text-primary);
  white-space: nowrap;
}
.sl-card__status-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--sl-palette-green-100);
  flex-shrink: 0;
}

/* Dismiss "×" — Figma 48:2670: top-right, primary blue */
.sl-card__dismiss {
  position: absolute;
  top: var(--sl-space-2);
  right: var(--sl-space-2h);
  padding: var(--sl-space-1);
  border: 0;
  background: transparent;
  color: var(--sl-text-link);
  font-size: var(--sl-font-size-xs);
  line-height: 1;
  cursor: pointer;
}
.sl-card__dismiss:focus-visible {
  outline: var(--sl-focus-ring-width) solid var(--sl-focus-ring-color);
  outline-offset: 1px;
  border-radius: var(--sl-radius-xs);
}

/* =============================================================================
   4. ICON BUTTON (kebab) — Figma 32:784 / 32:789 and card-embedded 48:2524
   40x40, radius 4px, tonal blue fill, elevation 1; pressed = darker + outline.
   ========================================================================== */
.sl-icon-btn {
  box-sizing: border-box;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: var(--sl-icon-button-size);
  height: var(--sl-icon-button-size);
  flex-shrink: 0;
  padding: 0;
  background: var(--sl-surface-accent);
  border: 1px solid transparent;
  border-radius: var(--sl-radius-sm);
  box-shadow: var(--sl-elevation-1);
  color: var(--sl-text-link);
  font-size: var(--sl-font-size-sm);
  cursor: pointer;
  transition:
    background-color var(--sl-duration-fast) var(--sl-easing-standard),
    box-shadow       var(--sl-duration-fast) var(--sl-easing-standard);
}
.sl-icon-btn:hover { background: var(--sl-surface-accent-strong); }
.sl-icon-btn:active {
  background: var(--sl-surface-accent-strong);
  border-color: var(--sl-border-accent);
  box-shadow: var(--sl-elevation-none);
}
/* Pressed lasts as long as the finger is down. is-active is a state the
   button stays in, so it takes the selection colour, not the pressed one. */
.sl-icon-btn.is-active {
  background: var(--sl-selected-bg);
  border-color: var(--sl-selected-border);
  color: var(--sl-selected-fg);
  box-shadow: var(--sl-elevation-none);
}
.sl-icon-btn:focus-visible {
  outline: var(--sl-focus-ring-width) solid var(--sl-focus-ring-color);
  outline-offset: var(--sl-focus-ring-offset);
}

/* =============================================================================
   5. SETTINGS MENU BUTTON — Figma 41:2092 / 49:2722 / 49:2729
   Full-width row: white, radius 8px, elevation 1, label Roboto Medium 14/20,
   trailing chevron; active = pressed grey + elevation 2.
   ========================================================================== */
.sl-menu-btn {
  box-sizing: border-box;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sl-space-2);
  width: 100%;
  min-height: var(--sl-control-height);
  padding: var(--sl-space-2h);
  background: var(--sl-surface-raised);
  border: 0;
  border-radius: var(--sl-radius-md);
  box-shadow: var(--sl-elevation-1);

  font-family: var(--sl-font-family);
  font-size: var(--sl-font-size-sm);
  font-weight: var(--sl-font-weight-medium);
  line-height: var(--sl-line-height-body);
  letter-spacing: var(--sl-letter-spacing-label);
  color: var(--sl-text-primary);
  text-align: left;
  text-decoration: none;

  cursor: pointer;
  transition:
    background-color var(--sl-duration-base) var(--sl-easing-standard),
    box-shadow       var(--sl-duration-base) var(--sl-easing-standard);
}
.sl-menu-btn:hover { background: var(--sl-surface-sunken); }
.sl-menu-btn:active,
.sl-menu-btn.is-active {
  background: var(--sl-surface-pressed);
  box-shadow: var(--sl-elevation-2);
}
.sl-menu-btn:focus-visible {
  outline: var(--sl-focus-ring-width) solid var(--sl-focus-ring-color);
  outline-offset: var(--sl-focus-ring-offset);
}

.sl-menu-btn__chevron {
  flex-shrink: 0;
  color: var(--sl-palette-grey-65);
  font-size: var(--sl-font-size-xs);
}

/* Group label above a menu stack — Figma 41:2105 "Admin tools", 5px gap */
.sl-menu-group__label {
  display: block;
  margin: 0 0 5px;
  font-family: var(--sl-font-family);
  font-size: var(--sl-font-size-xs);
  font-weight: var(--sl-font-weight-medium);
  color: var(--sl-text-secondary);
}
.sl-menu-group {
  display: flex;
  flex-direction: column;
  gap: var(--sl-space-2h);
}

/* =============================================================================
   6. SECTION-CARD COMPONENT SET — Package Editor Redesign (Nov 2026)
   The building blocks of a redesigned screen: section card, fields, switches
   and tiles, ghost icon buttons, badges, lists, empty states, callouts, drop
   zone, grid table, folds. Reference screen: the SmartBrowser package editor.
   Contract and usage: docs/DESIGN-LANGUAGE.md.

   Scope: every rule applies inside an element with class `sl-kit`. Put
   `sl-kit` on the content wrapper of a page that is built or redesigned in
   this language. The scope keeps these rules ahead of the older page CSS and
   leaves screens that have not moved over untouched.

   Switch markup keeps the app's toggle (input + .toggle-slider) so existing
   CSS and JS still work:

     <label class="toggle-wrapper sl-switch [sl-tile [is-lead]]">
       <input type="checkbox" ...>
       <span class="toggle-slider"></span>
       <span class="sl-switch__copy">
         <span class="sl-switch__label">Label</span>
         <span class="sl-switch__hint">Optional hint</span>
       </span>
     </label>

   Buttons add `sl-btn` to .btn-primary / .btn-secondary / .btn-destructive.
   `sl-ghost-btn` is the 44px icon-only button.
   ========================================================================== */

/* --- Fold: a collapsible part of a long card -------------------------------- */
.sl-kit .sl-fold {
  align-self: stretch;
  width: 100%;
  border-top: 1px solid var(--sl-border-subtle);
}

.sl-kit .sl-fold__summary {
  display: flex;
  align-items: center;
  gap: var(--sl-space-3);
  min-height: 4rem;
  padding: var(--sl-space-2) 0;
  list-style: none;
  cursor: pointer;
}

.sl-kit .sl-fold__summary::-webkit-details-marker {
  display: none;
}

.sl-kit .sl-fold__summary::before {
  content: "";
  flex: none;
  width: 0.45rem;
  height: 0.45rem;
  margin-left: var(--sl-space-1);
  border-right: 2px solid var(--sl-text-muted);
  border-bottom: 2px solid var(--sl-text-muted);
  transform: rotate(-45deg);
}

.sl-kit .sl-fold[open] > .sl-fold__summary::before {
  transform: rotate(45deg);
}

.sl-kit .sl-fold__copy {
  display: flex;
  flex-direction: column;
  gap: var(--sl-space-1);
}

.sl-kit .sl-fold__title {
  font-size: var(--sl-font-size-md);
  font-weight: 500;
  color: var(--sl-text-primary);
}

.sl-kit .sl-fold__note {
  font-size: var(--sl-font-size-sm);
  color: var(--sl-text-muted);
}

.sl-kit .sl-fold__body {
  display: flex;
  flex-direction: column;
  gap: var(--sl-space-3);
  padding: 0 0 var(--sl-space-6) var(--sl-space-6);
}



/* The hidden attribute always wins, whatever display a kit class sets. */
.sl-kit [hidden] {
  display: none !important;
}

/* --- Section card ------------------------------------------------------- */
.sl-kit .sl-section-card {
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: none;
  margin: 0;
  padding: clamp(var(--sl-space-4), 3vw, var(--sl-space-8));
  background: var(--sl-surface-raised);
  border: 1px solid var(--sl-border-subtle);
  border-radius: var(--sl-radius-lg);
  box-shadow: none;
  color: var(--sl-text-primary);
  /* reset.min.css leaves body at line-height 1, so the card sets a readable one. */
  line-height: var(--sl-line-height-body);
}

.sl-kit .sl-section-card__head {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: flex-start;
  gap: var(--sl-space-4);
  padding-bottom: var(--sl-space-6);
}

.sl-kit .sl-section-card__head.is-tight {
  padding-bottom: var(--sl-space-4);
}

.sl-kit .sl-section-card__copy {
  display: flex;
  flex-direction: column;
  gap: var(--sl-space-1);
  min-width: 0;
  max-width: 40rem;
}

.sl-kit .sl-h2 {
  margin: 0;
  font-size: var(--sl-font-size-xl);
  font-weight: var(--sl-font-weight-medium);
  line-height: var(--sl-line-height-tight);
  color: var(--sl-text-primary);
}

.sl-kit .sl-h3 {
  margin: 0;
  font-size: var(--sl-font-size-subhead);
  font-weight: var(--sl-font-weight-medium);
  line-height: var(--sl-line-height-tight);
  color: var(--sl-text-primary);
}

.sl-kit .sl-h4 {
  margin: 0;
  font-size: var(--sl-font-size-md);
  font-weight: var(--sl-font-weight-medium);
  color: var(--sl-text-primary);
}

.sl-kit .sl-lede {
  margin: 0;
  font-size: var(--sl-font-size-sm);
  line-height: 1.5;
  color: var(--sl-text-secondary);
}

.sl-kit .sl-req-note {
  margin: 0;
  font-size: var(--sl-font-size-hint);
  color: var(--sl-text-secondary);
}

/* A titled block inside a card, divided by a hairline above it. */
.sl-kit .sl-block {
  display: flex;
  flex-direction: column;
  gap: var(--sl-space-3);
  padding: var(--sl-space-6) 0;
  border-top: 1px solid var(--sl-border-hairline);
}

.sl-kit .sl-block:last-child {
  padding-bottom: 0;
}

.sl-kit .sl-block__head {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: flex-start;
  gap: var(--sl-space-4);
}

.sl-kit .sl-block__copy {
  display: flex;
  flex-direction: column;
  gap: var(--sl-space-1);
  min-width: 0;
  max-width: 35rem;
}

/* --- Fields --------------------------------------------------------------- */
.sl-kit .sl-field-row {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sl-space-4) var(--sl-space-6);
}

.sl-kit .sl-stack {
  display: flex;
  flex-direction: column;
  gap: var(--sl-space-4);
}

.sl-kit .sl-field {
  flex: 1 1 15rem;
  display: flex;
  flex-direction: column;
  gap: var(--sl-space-2);
  min-width: 0;
}

/* In a column container the row basis would become a height. */
.sl-kit .sl-stack > .sl-field,
.sl-kit .sl-block > .sl-field,
.sl-kit .sl-section-card > .sl-field,
.sl-kit .sl-inset > .sl-field,
.sl-kit .sl-fold__body > .sl-field {
  flex: none;
}

.sl-kit .sl-field.sl-field--sm { flex: 1 1 8rem; }
.sl-kit .sl-field.sl-field--wide { flex: 2 1 17.5rem; }
.sl-kit .sl-field.sl-field--full { flex: 1 1 100%; }

.sl-kit .sl-field__label,
.sl-kit .sl-field > label,
.sl-kit .sl-field > span:where(.sl-label-text) {
  margin: 0;
  font-size: var(--sl-font-size-sm);
  font-weight: var(--sl-font-weight-medium);
  line-height: var(--sl-line-height-tight);
  color: var(--sl-text-primary);
}

.sl-kit .sl-required {
  color: var(--sl-text-danger);
}

.sl-kit .sl-optional {
  font-weight: var(--sl-font-weight-regular);
  color: var(--sl-text-muted);
}

.sl-kit .sl-hint {
  margin: 0;
  font-size: var(--sl-font-size-hint);
  line-height: 1.4;
  color: var(--sl-text-secondary);
}

.sl-kit .sl-hint.is-error {
  color: var(--sl-text-danger);
}

.sl-kit .sl-field .text-field,
.sl-kit .sl-field select,
.sl-kit .sl-control {
  width: 100%;
  max-width: none;
  min-height: var(--sl-control-height);
  margin: 0;
  padding: 0 var(--sl-space-3);
  box-sizing: border-box;
  border: 1px solid var(--sl-border-field);
  border-radius: var(--sl-radius-sm);
  background-color: var(--sl-surface-raised);
  font-family: inherit;
  font-size: var(--sl-font-size-input);
  color: var(--sl-text-field);
}

.sl-kit .sl-field textarea.text-field,
.sl-kit textarea.sl-control {
  min-height: 7.5rem;
  padding: var(--sl-space-2h) var(--sl-space-3);
  line-height: 1.5;
  resize: vertical;
}

.sl-kit .sl-field .settings-select {
  width: 100%;
  margin: 0;
}

/* Same token re-scoping: the field contract reads --sl-font-family. */
.sl-kit .sl-mono,
.sl-kit .sl-field .text-field.sl-mono {
  --sl-font-family: var(--sl-font-family-mono);
  font-family: var(--sl-font-family-mono);
}

/* Input with a unit on the right ("minutes", "seconds"). */
.sl-kit .sl-unit-field {
  display: flex;
  align-items: stretch;
  min-height: var(--sl-control-height);
  box-sizing: border-box;
  border: 1px solid var(--sl-border-field);
  border-radius: var(--sl-radius-sm);
  background: var(--sl-surface-raised);
  overflow: hidden;
}

/* The global field contract (sl-responsive.css) owns border and radius and is
   built to win, so the inner input is restyled by re-scoping its tokens. */
.sl-kit .sl-unit-field .text-field {
  --sl-border-field: transparent;
  --sl-field-radius: 0;
  flex: 1 1 auto;
  min-width: 0;
  min-height: 0;
}

.sl-kit .sl-unit-field:focus-within {
  border-color: var(--sl-selected-border);
}

.sl-kit .sl-unit-field__unit {
  flex: none;
  display: flex;
  align-items: center;
  padding: 0 var(--sl-space-3);
  border-left: 1px solid var(--sl-border-hairline);
  background: var(--sl-surface-page);
  font-size: var(--sl-font-size-sm);
  color: var(--sl-text-secondary);
}

/* Read-only value box (GUID, package type). */
.sl-kit .sl-readonly {
  display: flex;
  align-items: center;
  min-height: var(--sl-control-height);
  box-sizing: border-box;
  border: 1px solid var(--sl-border-hairline);
  border-radius: var(--sl-radius-sm);
  background: var(--sl-surface-sunken);
  color: var(--sl-text-field);
  overflow: hidden;
}

/* --- Switches ------------------------------------------------------------
   Markup keeps the app's toggle (input + .toggle-slider) so existing CSS
   and JS still work. The text moves into .sl-switch__copy and sits first:

   <label class="toggle-wrapper sl-switch [sl-tile [is-lead]]">
     <input type="checkbox" ...>
     <span class="toggle-slider"></span>
     <span class="sl-switch__copy">
       <span class="sl-switch__label">Label</span>
       <span class="sl-switch__hint">Optional hint</span>
     </span>
   </label>
   ------------------------------------------------------------------------- */
.sl-kit .toggle-wrapper.sl-switch {
  display: flex;
  align-items: center;
  gap: var(--sl-space-4);
  min-height: 3rem;
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-size: var(--sl-font-size-row);
  color: var(--sl-text-primary);
  cursor: pointer;
}

.sl-kit .sl-switch .sl-switch__copy {
  order: -1;
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  gap: 0.125rem;
  min-width: 0;
}

.sl-kit .sl-switch .sl-switch__label {
  font-size: var(--sl-font-size-row);
  font-weight: var(--sl-font-weight-regular);
  line-height: 1.35;
  color: var(--sl-text-primary);
}

.sl-kit .sl-tile .sl-switch__label,
.sl-kit .sl-switch.is-strong .sl-switch__label {
  font-weight: var(--sl-font-weight-medium);
}

.sl-kit .sl-switch .sl-switch__hint {
  font-size: var(--sl-font-size-hint);
  font-weight: var(--sl-font-weight-regular);
  line-height: 1.4;
  color: var(--sl-text-secondary);
}

/* Design switch: 40 x 24 track, 18px knob, no check glyph.
   .toggle-wrapper.sl-switch matches the weight of the older switch rules in
   SmartBrowserConfig.css so these win by load order. */
.sl-kit .toggle-wrapper.sl-switch .toggle-slider {
  width: 2.5rem;
  height: 1.5rem;
  background-color: var(--sl-border-field);
  border: 0;
  border-radius: var(--sl-radius-pill);
}

.sl-kit .toggle-wrapper.sl-switch .toggle-slider::before,
.sl-kit .toggle-wrapper.sl-switch input[type="checkbox"]:not(:disabled) + .toggle-slider::before,
.sl-kit .toggle-wrapper.sl-switch input[type="checkbox"]:disabled + .toggle-slider::before {
  top: 0.1875rem;
  left: 0.1875rem;
  width: 1.125rem;
  height: 1.125rem;
  transform: none;
  background-color: var(--sl-surface-raised);
  box-shadow: var(--sl-elevation-1);
  transition: transform var(--sl-duration-base);
}

.sl-kit .toggle-wrapper.sl-switch input[type="checkbox"]:checked + .toggle-slider {
  background-color: var(--sl-action-primary-bg);
}

.sl-kit .toggle-wrapper.sl-switch input[type="checkbox"]:checked + .toggle-slider::before,
.sl-kit .toggle-wrapper.sl-switch input[type="checkbox"]:checked:not(:disabled) + .toggle-slider::before,
.sl-kit .toggle-wrapper.sl-switch input[type="checkbox"]:checked:disabled + .toggle-slider::before {
  transform: translateX(1rem);
}

.sl-kit .toggle-wrapper.sl-switch input[type="checkbox"] + .toggle-slider::after,
.sl-kit .toggle-wrapper.sl-switch input[type="checkbox"]:checked + .toggle-slider::after {
  content: none;
}

.sl-kit .toggle-wrapper.sl-switch input[type="checkbox"]:disabled + .toggle-slider {
  opacity: 0.6;
  border: 0;
  background-color: var(--sl-border-field);
}

.sl-kit .toggle-wrapper.sl-switch input[type="checkbox"]:checked:disabled + .toggle-slider {
  background-color: var(--sl-action-primary-bg);
}

.sl-kit .toggle-wrapper.sl-switch input[type="checkbox"]:focus-visible + .toggle-slider {
  outline: var(--sl-focus-ring-width) solid var(--sl-focus-ring-color);
  outline-offset: var(--sl-focus-ring-offset);
}

/* Bordered tile: one switch per tile, tiles wrap in .sl-tiles. */
.sl-kit .toggle-wrapper.sl-tile,
.sl-kit .sl-tile {
  min-height: 3.5rem;
  padding: var(--sl-space-2h) 0.875rem;
  border: 1px solid var(--sl-border-hairline);
  border-radius: var(--sl-radius-md);
  background: var(--sl-surface-raised);
}

.sl-kit .toggle-wrapper.sl-tile.is-lead {
  min-height: 4rem;
  border-color: var(--sl-border-subtle);
  background: var(--sl-surface-page);
}

.sl-kit .sl-tiles {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sl-space-3);
}

.sl-kit .sl-tiles > .sl-tile,
.sl-kit .sl-tiles > .sl-field {
  flex: 1 1 16.25rem;
  min-width: 0;
}

/* A tile that holds a switch plus more controls under it. */
.sl-kit .sl-tile-box {
  display: flex;
  flex-direction: column;
  padding: 0 0.875rem;
  border: 1px solid var(--sl-border-hairline);
  border-radius: var(--sl-radius-md);
  background: var(--sl-surface-raised);
}

.sl-kit .sl-tile-box > .toggle-wrapper.sl-switch {
  min-height: 3.75rem;
}

.sl-kit .sl-tile-box__body {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sl-space-4) var(--sl-space-6);
  padding: var(--sl-space-1) 0 var(--sl-space-4);
}

/* Group of plain switches with a legend (Page / Navigation / Cookies). */
.sl-kit .sl-switch-groups {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sl-space-4);
}

.sl-kit .sl-switch-group {
  flex: 1 1 15rem;
  min-width: 0;
  margin: 0;
  padding: var(--sl-space-1) 0.875rem var(--sl-space-2);
  border: 1px solid var(--sl-border-hairline);
  border-radius: var(--sl-radius-md);
  background: var(--sl-surface-raised);
}

.sl-kit .sl-switch-group > legend {
  float: none;
  width: auto;
  margin: 0 0 0 calc(-1 * var(--sl-space-2));
  padding: 0 var(--sl-space-2);
  font-size: var(--sl-font-size-sm);
  font-weight: var(--sl-font-weight-medium);
  color: var(--sl-text-primary);
}

/* Inset panel (open profile body, keyboard-per-field block). */
.sl-kit .sl-inset {
  display: flex;
  flex-direction: column;
  gap: var(--sl-space-3);
  padding: var(--sl-space-4);
  border: 1px solid var(--sl-border-hairline);
  border-radius: var(--sl-radius-md);
  background: var(--sl-surface-page);
}

/* --- Buttons -------------------------------------------------------------
   Add .sl-btn to the app's .btn-primary / .btn-secondary / .btn-destructive
   for the design's 44px geometry. .sl-ghost-btn is the 44px icon-only button. */
.sl-kit .sl-btn,
body .sl-kit .sl-btn {
  margin: 0;
  box-shadow: none;
  min-height: var(--sl-control-height);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--sl-space-2);
  padding: 0 var(--sl-space-4);
  border-radius: var(--sl-radius-md);
  font-family: inherit;
  font-size: var(--sl-font-size-row);
  font-weight: var(--sl-font-weight-medium);
  white-space: nowrap;
  cursor: pointer;
}

.sl-kit .sl-btn.is-start {
  align-self: flex-start;
}

/* Text that used to be a <label> with no form field: button text, and a few
   headings. It is a span now, with every label rule copied beside the
   original as span:where(.sl-label-text). A label shows the arrow cursor;
   inside a button the span keeps the button's own cursor. */
span.sl-label-text:not(button span) {
  cursor: default;
}

.sl-kit .sl-btn > label,
.sl-kit .sl-btn > span:where(.sl-label-text) {
  margin: 0;
  cursor: inherit;
}

.sl-kit .sl-ghost-btn {
  flex: none;
  margin: 0;
  box-shadow: none;
  width: var(--sl-control-height);
  height: var(--sl-control-height);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  background: transparent;
  border: 0;
  border-radius: var(--sl-radius-md);
  color: var(--sl-text-muted);
  font-size: var(--sl-font-size-md);
  cursor: pointer;
}

/* Some older list CSS paints arrow icons in the link color. */
.sl-kit .sl-ghost-btn > i {
  color: inherit;
}

.sl-kit .sl-ghost-btn:hover:not(:disabled) {
  background: var(--sl-surface-sunken);
  color: var(--sl-text-primary);
}

.sl-kit .sl-ghost-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.sl-kit .sl-ghost-btn:focus-visible,
.sl-kit .sl-btn:focus-visible {
  outline: var(--sl-focus-ring-width) solid var(--sl-focus-ring-color);
  outline-offset: var(--sl-focus-ring-offset);
}

.sl-kit .sl-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--sl-space-2);
}

/* --- Badges, chips, numbers ------------------------------------------------ */
.sl-kit .sl-badge {
  display: inline-flex;
  align-items: center;
  padding: 0.125rem var(--sl-space-2);
  border-radius: var(--sl-radius-pill);
  background: var(--sl-surface-accent);
  color: var(--sl-text-link);
  font-size: var(--sl-font-size-xs);
  font-weight: var(--sl-font-weight-medium);
  white-space: nowrap;
}

.sl-kit .sl-badge.is-neutral {
  background: var(--sl-surface-sunken);
  color: var(--sl-text-secondary);
}

.sl-kit .sl-num {
  flex: none;
  width: 1.75rem;
  height: 1.75rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  border: 1px solid var(--sl-border-subtle);
  border-radius: var(--sl-radius-sm);
  background: var(--sl-surface-raised);
  font-size: var(--sl-font-size-hint);
  font-weight: var(--sl-font-weight-bold);
  color: var(--sl-text-link);
}

.sl-kit .sl-num.is-soft {
  border-color: transparent;
  background: var(--sl-surface-accent);
}

.sl-kit .sl-code {
  padding: 0.0625rem 0.375rem;
  border-radius: var(--sl-radius-sm);
  background: var(--sl-surface-sunken);
  font-family: var(--sl-font-family-mono);
  font-size: var(--sl-font-size-hint);
  color: var(--sl-text-field);
}

/* Square icon tile beside a title (profile globe, dropzone, device). */
.sl-kit .sl-icon-tile {
  flex: none;
  width: 2.5rem;
  height: 2.5rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--sl-radius-md);
  background: var(--sl-surface-accent);
  color: var(--sl-text-link);
  font-size: var(--sl-font-size-md);
}

/* --- Lists, items, empty states ------------------------------------------- */
.sl-kit .sl-list {
  display: flex;
  flex-direction: column;
  gap: var(--sl-space-2);
  margin: 0;
  padding: 0;
  list-style: none;
}

.sl-kit .sl-item {
  display: flex;
  align-items: center;
  gap: var(--sl-space-3);
  padding: 0.375rem 0.375rem 0.375rem 0.875rem;
  border: 1px solid var(--sl-border-hairline);
  border-radius: var(--sl-radius-md);
  background: var(--sl-surface-raised);
}

.sl-kit .sl-item__copy {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.125rem;
  overflow-wrap: anywhere;
}

.sl-kit .sl-item__title {
  font-size: var(--sl-font-size-row);
  font-weight: var(--sl-font-weight-medium);
  color: var(--sl-text-primary);
}

.sl-kit .sl-item__meta {
  font-size: var(--sl-font-size-hint);
  color: var(--sl-text-secondary);
}

.sl-kit .sl-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--sl-space-2);
  margin: 0;
  padding: var(--sl-space-10) var(--sl-space-4);
  border: 1px dashed var(--sl-border-subtle);
  border-radius: var(--sl-radius-md);
  text-align: center;
  font-size: var(--sl-font-size-sm);
  color: var(--sl-text-secondary);
}

.sl-kit .sl-empty__title {
  margin: 0;
  font-size: var(--sl-font-size-md);
  font-weight: var(--sl-font-weight-medium);
  color: var(--sl-text-primary);
}

/* --- Callouts -------------------------------------------------------------- */
.sl-kit .sl-callout {
  display: flex;
  align-items: flex-start;
  gap: var(--sl-space-3);
  padding: 0.875rem var(--sl-space-4);
  border: 1px solid var(--sl-border-hairline);
  border-radius: var(--sl-radius-md);
  background: var(--sl-surface-page);
  font-size: var(--sl-font-size-sm);
  line-height: 1.5;
  color: var(--sl-text-secondary);
}

.sl-kit .sl-callout.is-warn {
  border-color: color-mix(in srgb, var(--sl-feedback-warning-solid) 45%, transparent);
  background: var(--sl-feedback-warning-bg);
  color: var(--sl-text-primary);
}

.sl-kit .sl-callout.is-warn > .fa-solid {
  margin-top: 0.125rem;
  color: var(--sl-feedback-warning-solid);
}

/* --- Drop zone ------------------------------------------------------------- */
.sl-kit .sl-dropzone {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--sl-space-4);
  padding: var(--sl-space-5) var(--sl-space-6);
  border: 1.5px dashed var(--sl-border-subtle);
  border-radius: var(--sl-radius-md);
  background: var(--sl-surface-raised);
}

.sl-kit .sl-dropzone:focus-visible {
  outline: var(--sl-focus-ring-width) solid var(--sl-focus-ring-color);
  outline-offset: var(--sl-focus-ring-offset);
}

.sl-kit .sl-dropzone.is-over,
.sl-kit .sl-dropzone.drag-over {
  border-color: var(--sl-border-accent);
  background: var(--sl-surface-accent);
}

/* --- Grid table (file operations, cache rows) ----------------------------- */
.sl-kit .sl-grid-table {
  border: 1px solid var(--sl-border-hairline);
  border-radius: var(--sl-radius-md);
  overflow-x: auto;
}

.sl-kit .sl-grid-table__head,
.sl-kit .sl-grid-table__row {
  display: grid;
  align-items: center;
  gap: var(--sl-space-3);
  padding: var(--sl-space-2) var(--sl-space-3);
}

.sl-kit .sl-grid-table__head {
  padding-top: var(--sl-space-2h);
  padding-bottom: var(--sl-space-2h);
  background: var(--sl-surface-page);
  border-bottom: 1px solid var(--sl-border-hairline);
  font-size: var(--sl-font-size-hint);
  font-weight: var(--sl-font-weight-medium);
  color: var(--sl-text-secondary);
}

.sl-kit .sl-grid-table__row + .sl-grid-table__row {
  border-top: 1px solid var(--sl-border-hairline);
}

/* --- Disclosure link ("How URL matching works") -------------------------- */
.sl-kit .sl-disclosure > summary {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  min-height: 2.25rem;
  list-style: none;
  color: var(--sl-text-link);
  font-size: var(--sl-font-size-sm);
  font-weight: var(--sl-font-weight-medium);
  cursor: pointer;
}

.sl-kit .sl-disclosure > summary::-webkit-details-marker {
  display: none;
}

.sl-kit .sl-disclosure > summary::before {
  content: "";
  width: 0.4rem;
  height: 0.4rem;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(-45deg);
  transition: transform var(--sl-duration-base);
}

.sl-kit .sl-disclosure[open] > summary::before {
  transform: rotate(45deg);
}

/* Fold body per design: 4px top, 24px bottom, 30px indent under the chevron. */
.sl-kit .sl-fold > .sl-fold__body {
  gap: var(--sl-space-4);
  padding: var(--sl-space-1) 0 var(--sl-space-6) 1.875rem;
}

/* --- Page shell for screens outside the package editors (Nov 2026) ---------
   Settings, Manage account, and other screens built in this language. The
   two package editors keep their own shell in package-editor.css.

     <div id="main-container" class="sl-kit sl-page">
       breadcrumb
       <header class="sl-mast">
         <div class="sl-mast__row">
           <div class="sl-mast__id"> h1.sl-page-title, p.sl-page-lede </div>
           <div class="sl-actions"> buttons, quiet to loud </div>
         </div>
       </header>
       <div class="sl-page-body">
         <nav class="sl-section-nav"> span.sl-section-nav__label, items </nav>
         <div class="sl-page-main"> section cards </div>
       </div>
     </div>
   ------------------------------------------------------------------------- */

/* One centered column. Legacy rules pad #main-container by id, so the id is
   named here too. */
body #main-container.sl-kit.sl-page,
body .sl-kit.sl-page {
  --sl-page-inline: max(var(--sl-page-gutter), calc((100% - var(--sl-page-max)) / 2));
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  gap: var(--sl-space-5);
  width: 100%;
  min-width: 0;
  padding: var(--sl-space-4) var(--sl-page-inline) var(--sl-space-12);
  background: var(--sl-surface-page);
  color: var(--sl-text-primary);
  line-height: var(--sl-line-height-body);
}

.sl-kit .sl-mast {
  display: flex;
  flex-direction: column;
  gap: var(--sl-space-3);
}

.sl-kit .sl-mast__row {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: flex-end;
  gap: var(--sl-space-4);
}

.sl-kit .sl-mast__id {
  display: flex;
  flex-direction: column;
  gap: var(--sl-space-2);
  min-width: 0;
  max-width: 45rem;
}

.sl-kit .sl-page-title {
  margin: 0;
  font-size: var(--sl-font-size-page-title);
  font-weight: var(--sl-font-weight-medium);
  line-height: 1.2;
  color: var(--sl-text-primary);
  overflow-wrap: anywhere;
}

.sl-kit .sl-page-lede {
  margin: 0;
  font-size: var(--sl-font-size-sm);
  line-height: 1.5;
  color: var(--sl-text-secondary);
}

/* Section list on the left, the section on the right. When the two no longer
   fit side by side, the list wraps above the section. */
.sl-kit .sl-page-body {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: var(--sl-space-6);
}

.sl-kit .sl-page-main {
  flex: 999 1 35rem;
  display: flex;
  flex-direction: column;
  gap: var(--sl-space-6);
  min-width: 0;
}

.sl-kit .sl-section-nav {
  box-sizing: border-box;
  flex: 1 1 13.75rem;
  align-self: flex-start;
  display: flex;
  flex-direction: column;
  gap: var(--sl-space-1);
  min-width: 0;
  margin: 0;
  padding: var(--sl-space-2);
  background: var(--sl-surface-raised);
  border: 1px solid var(--sl-border-subtle);
  border-radius: var(--sl-radius-lg);
}

.sl-kit .sl-section-nav__label {
  display: block;
  padding: var(--sl-space-2) var(--sl-space-3) var(--sl-space-1);
  font-size: var(--sl-font-size-hint);
  font-weight: var(--sl-font-weight-medium);
  color: var(--sl-text-secondary);
}

.sl-kit .sl-section-nav__list {
  display: flex;
  flex-direction: column;
  gap: 0.125rem;
  margin: 0;
  padding: 0;
}

/* Items may also carry an older hook class (.settings-card) that sl-migrate.css
   paints as a raised card, so every state below names the item twice. */
.sl-kit .sl-section-nav .sl-section-nav__item {
  box-sizing: border-box;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sl-space-2);
  width: 100%;
  height: auto;
  min-height: var(--sl-control-height);
  margin: 0;
  padding: 0 var(--sl-space-3);
  background: transparent;
  border: 0;
  border-left: 3px solid transparent;
  border-radius: 0 0.375rem 0.375rem 0;
  box-shadow: none;
  font-family: inherit;
  font-size: var(--sl-font-size-row);
  font-weight: var(--sl-font-weight-regular);
  color: var(--sl-text-secondary);
  text-align: left;
  text-decoration: none;
  transition: none;
  cursor: pointer;
}

.sl-kit .sl-section-nav .sl-section-nav__item:hover,
.sl-kit .sl-section-nav .sl-section-nav__item:active {
  background: transparent;
  box-shadow: none;
  color: var(--sl-text-primary);
}

.sl-kit .sl-section-nav .sl-section-nav__item:is(.is-active, .selected, [aria-selected="true"], [aria-current="page"]) {
  background: var(--sl-surface-accent);
  border-left-color: var(--sl-border-accent);
  border-radius: 0 0.375rem 0.375rem 0;
  box-shadow: none;
  font-weight: var(--sl-font-weight-medium);
  color: var(--sl-text-link);
}

.sl-kit .sl-section-nav .sl-section-nav__item:focus-visible {
  outline: var(--sl-focus-ring-width) solid var(--sl-focus-ring-color);
  outline-offset: calc(-1 * var(--sl-focus-ring-width));
}

/* The list stays in view while a long section scrolls, once it sits beside it.
   A page whose content scrolls under the app header sets
   --sl-page-sticky-top to the header height. */
@media (min-width: 901px) {
  .sl-kit .sl-section-nav {
    position: sticky;
    top: calc(var(--sl-page-sticky-top, 0rem) + var(--sl-space-4));
  }
}

/* A row of actions at the foot of a section card (Revert, Save). */
.sl-kit .sl-card-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  align-items: center;
  gap: var(--sl-space-2);
  margin-top: var(--sl-space-6);
  padding-top: var(--sl-space-6);
  border-top: 1px solid var(--sl-border-hairline);
}

/* Amber state chip ("Pending restart"). */
.sl-kit .sl-badge.is-warn {
  gap: 0.375rem;
  background: var(--sl-feedback-warning-bg);
  color: var(--sl-feedback-warning-fg);
}

/* Fields on page-shell screens and dialogs. The global input contract
   (sl-migrate.css section 2) paints bare inputs, selects, and textareas with
   focus, disabled, and read-only states, so these rules only size them. Use
   bare controls here, not .text-field (its editor contract needs the
   .page-content.settings-layout wrapper) and not .ds-field (older look). */
.sl-kit:is(.sl-page, .sl-dialog) .sl-field > :is(input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]), select, textarea),
.sl-kit:is(.sl-page, .sl-dialog) .sl-select > select {
  box-sizing: border-box;
  width: 100%;
  max-width: none;
  margin: 0;
}

.sl-kit:is(.sl-page, .sl-dialog) .sl-field > textarea {
  min-height: 7.5rem;
  resize: vertical;
}

.sl-kit:is(.sl-page, .sl-dialog) .sl-unit-field > input {
  --sl-border-field: transparent;
  --sl-field-radius: 0;
  flex: 1 1 auto;
  width: auto;
  min-width: 0;
  min-height: 0;
  margin: 0;
}

.sl-kit:is(.sl-page, .sl-dialog) .sl-unit-field:has(input:disabled) {
  border-style: dashed;
  background: var(--sl-surface-disabled);
}

.sl-kit:is(.sl-page, .sl-dialog) :is(input, textarea).invalid {
  border-color: var(--sl-border-danger);
}

/* Select with a chevron: <div class="sl-select"><select>...</select><i class="fa-solid fa-chevron-down"></i></div> */
.sl-kit .sl-select {
  position: relative;
  display: block;
}

.sl-kit .sl-select > select {
  padding-right: 2.5rem;
  appearance: none;
  -webkit-appearance: none;
  cursor: pointer;
}

.sl-kit .sl-select > i {
  position: absolute;
  top: 50%;
  right: var(--sl-space-3);
  transform: translateY(-50%);
  color: var(--sl-text-secondary);
  font-size: var(--sl-font-size-hint);
  pointer-events: none;
}

/* Read-only value in a real input (a script reads its value). */
.sl-kit:is(.sl-page, .sl-dialog) .sl-field > input.sl-readonly {
  --sl-border-field: var(--sl-border-hairline);
  display: block;
  background: var(--sl-surface-sunken);
  color: var(--sl-text-field);
  cursor: default;
}

/* The switch's own base (same as global.css), for pages that do not load
   global.css. The kit rules above set its size and colors. */
.sl-kit .toggle-wrapper.sl-switch input[type="checkbox"] {
  opacity: 0;
  width: 0;
  height: 0;
}

.sl-kit .toggle-wrapper.sl-switch .toggle-slider {
  position: relative;
  flex-shrink: 0;
  transition: background-color var(--sl-duration-base);
}

.sl-kit .toggle-wrapper.sl-switch .toggle-slider::before {
  content: "";
  position: absolute;
  border-radius: 50%;
}

/* --- Confirm dialog: delete, remove, revoke (Nov 2026) ----------------------
   One pattern for every "are you sure" dialog. sl-confirm.js (loaded by the
   shell's standards scripts) puts focus on Cancel when it opens, keeps Tab
   inside, cancels on Escape, and returns focus to the trigger when it closes.

     <div id="deleteThingModal" class="sl-kit sl-confirm">
       <div class="sl-confirm__box" role="dialog" aria-modal="true"
            aria-labelledby="deleteThingTitle" aria-describedby="deleteThingText">
         <div class="sl-confirm__head">
           <h2 class="sl-h2" id="deleteThingTitle">Delete <span>name</span> thing?</h2>
           <button type="button" class="sl-ghost-btn sl-confirm__close"
                   aria-label="Cancel" data-sl-confirm-cancel>(xmark icon)</button>
         </div>
         <p class="sl-confirm__text" id="deleteThingText">One consequence sentence.</p>
         <p class="sl-callout">(info icon)<span>Optional note.</span></p>
         <div class="sl-confirm__actions">
           <button type="button" class="btn-destructive sl-btn" data-sl-confirm-cancel>Cancel</button>
           <button type="button" class="btn-warning sl-btn">(trash icon) Delete thing</button>
         </div>
       </div>
     </div>

   Scripts show a dialog by setting display ("flex" or "block") on the overlay
   and sometimes on the box, so nothing here depends on which one it is.
   Spacing is on margins for the same reason. Older pages also give the
   overlay .modal or .modal-content hooks; these rules outrank them. */
.sl-kit.sl-confirm {
  display: none;
  position: fixed;
  inset: 0;
  z-index: var(--sl-z-modal);
  box-sizing: border-box;
  flex-direction: column;
  justify-content: flex-start;
  align-items: center;
  width: auto;
  height: auto;
  margin: 0;
  padding: clamp(var(--sl-space-3), 10vh, var(--sl-space-12)) clamp(var(--sl-space-3), 2vw, var(--sl-space-4));
  background: var(--sl-scrim);
  opacity: 1;
  overflow-x: hidden;
  overflow-y: auto;
  color: var(--sl-text-primary);
  font-family: var(--sl-font-family);
  line-height: var(--sl-line-height-body);
  text-align: start;
}

.sl-kit.sl-confirm .sl-confirm__box {
  position: relative;
  inset: auto;
  box-sizing: border-box;
  flex: none;
  flex-direction: column;
  align-items: stretch;
  width: min(30rem, 100%);
  max-width: none;
  height: auto;
  min-height: 0;
  margin: 0 auto;
  padding: clamp(var(--sl-space-4), 3vw, var(--sl-space-6));
  background: var(--sl-surface-raised);
  border: 1px solid var(--sl-border-subtle);
  border-radius: var(--sl-radius-lg);
  box-shadow: var(--sl-elevation-3);
  color: var(--sl-text-primary);
  text-align: start;
  transform: none;
}

.sl-kit.sl-confirm .sl-confirm__head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: var(--sl-space-3);
  margin: 0 0 var(--sl-space-3);
}

.sl-kit.sl-confirm .sl-confirm__head .sl-h2 {
  min-width: 0;
  padding-top: var(--sl-space-2);
  overflow-wrap: anywhere;
}

/* The close button sits in the box's top right corner, in the padding. */
.sl-kit.sl-confirm .sl-confirm__close {
  position: static;
  margin: calc(-1 * var(--sl-space-1)) calc(-1 * var(--sl-space-2)) 0 0;
}

.sl-kit.sl-confirm .sl-confirm__text {
  width: auto;
  margin: 0;
  font-size: var(--sl-font-size-md);
  line-height: 1.5;
  color: var(--sl-text-primary);
}

.sl-kit.sl-confirm .sl-confirm__text + .sl-confirm__text {
  margin-top: var(--sl-space-2);
}

.sl-kit.sl-confirm .sl-callout {
  margin: var(--sl-space-4) 0 0;
}

.sl-kit.sl-confirm .sl-callout:not(.is-warn) > .fa-solid {
  flex: none;
  margin-top: 0.1875rem;
  color: var(--sl-text-link);
}

.sl-kit.sl-confirm .sl-confirm__actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  align-items: center;
  gap: var(--sl-space-2);
  width: auto;
  margin: var(--sl-space-6) 0 0;
  padding: 0;
}

.sl-kit.sl-confirm .sl-confirm__actions .sl-btn {
  width: auto;
  height: auto;
  min-height: var(--sl-control-height);
  margin: 0;
  padding: 0 1.125rem;
}

/* Values to look at before confirming ("Expired assignment count"). */
.sl-kit.sl-confirm .sl-confirm__fields {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sl-space-4);
  margin: var(--sl-space-4) 0 0;
}

.sl-kit.sl-confirm .sl-confirm__fields > .sl-field {
  flex: 0 1 14rem;
}

/* A confirm dialog that also holds fields (Revoke or delete assignment). */
.sl-kit.sl-confirm .sl-confirm__box form {
  display: flex;
  flex-direction: column;
  gap: var(--sl-space-4);
  margin: var(--sl-space-4) 0 0;
}

.sl-kit.sl-confirm .sl-confirm__box form > .sl-confirm__actions {
  margin-top: var(--sl-space-2);
}

.sl-kit.sl-confirm :is(form, .sl-block) > .sl-field {
  flex: none;
}

.sl-kit.sl-confirm .sl-block {
  display: flex;
  flex-direction: column;
  gap: var(--sl-space-4);
  padding: var(--sl-space-5) 0 0;
}

/* Windows high contrast: the box edge stays visible over the scrim. */
@media (forced-colors: active) {
  .sl-kit.sl-confirm .sl-confirm__box {
    border: 2px solid CanvasText;
  }
}

/* --- Every dialog fits the window (Brandon, 22 November 2026) ---------------
   A dialog box is never taller than the window: it stops inside its overlay's
   padding, which is the gap above and below it, and what does not fit scrolls
   inside the box. The title row stays at the top and the buttons at the
   bottom while the rest scrolls between them, as Scan to configure does
   (smarthub-qr-modal.css, whose body is its own scroll area).

   Scripts show these boxes as "block" or "flex", so the rows are held with
   position: sticky rather than a flex layout, and work either way. Each row
   reaches out over the box's padding (--sl-dialog-pad, the same clamp the
   boxes are drawn with) so the scrolling content passes under an opaque
   edge. A hairline shows under the title and over the buttons only while
   there is more to scroll that way, where the browser can say so
   (scroll-state queries); elsewhere the rows simply stay.

   The dialog families, by their own classes (box, title row, button row):
     confirm   .sl-confirm__box             .sl-confirm__head      .sl-confirm__actions
     license   .lic-dialog__box             .lic-dialog__head      .lic-dialog__actions
     add pkg   .pkg-add-dialog__box         .pkg-add-dialog__head  .pkg-add-dialog__actions
     settings  #settings .settings-dialog   .settings-dialog__head .server-settings-btns, .abandon-btns
     console   .end-all-sessions-modal-content .cc-dialog__head    .end-all-sessions-actions
   A new dialog family adds its three classes to the lists below. The id in
   the first list gives every entry id weight (:is takes its strongest), which
   these rules need over the families' own id-level and kit rules. */
:is(.sl-confirm__box, .lic-dialog__box, .pkg-add-dialog__box, #settings .settings-dialog, .end-all-sessions-modal-content) {
  --sl-dialog-pad: clamp(var(--sl-space-4), 3vw, var(--sl-space-6));
  max-height: 100%;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  container-type: scroll-state;
}

/* Shown as a flex column, the rows keep their height; the box scrolls. */
:is(.sl-confirm__box, .lic-dialog__box, .pkg-add-dialog__box, #settings .settings-dialog, .end-all-sessions-modal-content) > * {
  flex-shrink: 0;
}

/* The Client console's box is drawn at a fixed 24px. */
#endAllSessionsModal .end-all-sessions-modal-content {
  --sl-dialog-pad: var(--sl-space-6);
}

:is(.sl-confirm__box, .lic-dialog__box, .pkg-add-dialog__box, #settings .settings-dialog, .end-all-sessions-modal-content) :is(.sl-confirm__head, .lic-dialog__head, .pkg-add-dialog__head, .settings-dialog__head, .cc-dialog__head) {
  position: sticky;
  /* Sticky offsets count from inside the box's padding; this puts the row at its edge. */
  top: calc(-1 * var(--sl-dialog-pad));
  z-index: 2;
  margin-top: calc(-1 * var(--sl-dialog-pad));
  margin-inline: calc(-1 * var(--sl-dialog-pad));
  padding: var(--sl-dialog-pad) var(--sl-dialog-pad) 0;
  background: var(--sl-surface-raised);
}

:is(.sl-confirm__box, .lic-dialog__box, .pkg-add-dialog__box, #settings .settings-dialog, .end-all-sessions-modal-content) :is(.sl-confirm__actions, .lic-dialog__actions, .pkg-add-dialog__actions, .server-settings-btns, .abandon-btns, .end-all-sessions-actions) {
  position: sticky;
  bottom: calc(-1 * var(--sl-dialog-pad));
  z-index: 2;
  margin-bottom: calc(-1 * var(--sl-dialog-pad));
  margin-inline: calc(-1 * var(--sl-dialog-pad));
  padding: 0 var(--sl-dialog-pad) var(--sl-dialog-pad);
  background: var(--sl-surface-raised);
}

/* Only a box that scrolls gives its buttons room over them; a short dialog
   keeps its spacing exactly. */
@container scroll-state(scrollable: y) {
  :is(.sl-confirm__box, .lic-dialog__box, .pkg-add-dialog__box, #settings .settings-dialog, .end-all-sessions-modal-content) :is(.sl-confirm__actions, .lic-dialog__actions, .pkg-add-dialog__actions, .server-settings-btns, .abandon-btns, .end-all-sessions-actions) {
    padding-top: var(--sl-space-3);
  }
}

@container scroll-state(scrollable: top) {
  :is(.sl-confirm__box, .lic-dialog__box, .pkg-add-dialog__box, #settings .settings-dialog, .end-all-sessions-modal-content) :is(.sl-confirm__head, .lic-dialog__head, .pkg-add-dialog__head, .settings-dialog__head, .cc-dialog__head) {
    box-shadow: 0 1px 0 var(--sl-border-subtle);
  }
}

@container scroll-state(scrollable: bottom) {
  :is(.sl-confirm__box, .lic-dialog__box, .pkg-add-dialog__box, #settings .settings-dialog, .end-all-sessions-modal-content) :is(.sl-confirm__actions, .lic-dialog__actions, .pkg-add-dialog__actions, .server-settings-btns, .abandon-btns, .end-all-sessions-actions) {
    box-shadow: 0 -1px 0 var(--sl-border-subtle);
  }
}
