/* =============================================================================
   sl-migrate.css — Legacy → Figma component migration bridge
   -----------------------------------------------------------------------------
   Applies the Figma component treatments (see sl-components.css) to the LEGACY
   class vocabulary used across existing templates, so the redesign is visible
   without rewriting page markup. As pages adopt the .sl-* classes directly,
   delete the matching block here; when every block is gone, delete the file.

   LOAD ORDER: after page stylesheets, before sl-responsive.css.
   Selectors are prefixed with `body` to outrank same-specificity legacy rules
   regardless of link order.

   Deliberately NOT overridden: display, width/height, padding of legacy
   buttons (pages size them in incompatible ways) — only surface, geometry,
   typography, and interaction states.
   ========================================================================== */

/* =============================================================================
   1. BUTTONS — Figma 32:973
   Legacy vocabulary: .btn-primary  .btn-secondary  .btn-tertiary
                      .btn-warning  .btn-destructive
   ========================================================================== */
body .btn-primary,
body .btn-secondary,
body .btn-tertiary,
body .btn-warning,
body .btn-destructive {
  /* Package Editor Redesign (Nov 2026): flat, 15px Medium label. Was elevation 1, 14px SemiBold. */
  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);
  cursor: pointer;
  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);
}

/* Labels inside legacy buttons carry their own colour rules; inherit instead */
body .btn-primary label,
body .btn-secondary label,
body .btn-tertiary label,
body .btn-warning label,
body .btn-destructive label,
body .btn-primary span:where(.sl-label-text),
body .btn-secondary span:where(.sl-label-text),
body .btn-tertiary span:where(.sl-label-text),
body .btn-warning span:where(.sl-label-text),
body .btn-destructive span:where(.sl-label-text) {
  color: inherit;
  font-family: inherit;
  font-size: inherit;
  font-weight: inherit;
  letter-spacing: inherit;
  cursor: inherit;
}

/* Shared focus ring — replaces the mix of ad-hoc glows */
body .btn-primary:focus-visible,
body .btn-secondary:focus-visible,
body .btn-tertiary:focus-visible,
body .btn-warning:focus-visible,
body .btn-destructive:focus-visible {
  outline: var(--sl-focus-ring-width) solid var(--sl-focus-ring-color);
  outline-offset: var(--sl-focus-ring-offset);
}

/* Shared disabled treatment (fixes the dead --SLDS-Grey-Grey-20 rule) */
body .btn-primary:disabled,
body .btn-secondary:disabled,
body .btn-tertiary:disabled,
body .btn-warning:disabled,
body .btn-destructive:disabled {
  cursor: not-allowed;
  box-shadow: var(--sl-elevation-none);
  background: var(--sl-surface-disabled);
  border: 1px dashed var(--sl-border-strong);
  color: var(--sl-text-muted);
}

/* --- Primary — Figma 32:1039/32:1036 --------------------------------------- */
body .btn-primary {
  background: var(--sl-action-primary-bg);
  border: 1px solid transparent;
  color: var(--sl-action-primary-fg);
}
body .btn-primary:hover:not(:disabled)  { background: var(--sl-action-primary-bg-hover); }
body .btn-primary:active:not(:disabled) { background: var(--sl-action-primary-bg-active); }
body .btn-primary .fa-solid,
body .btn-primary .fa-regular { color: var(--sl-action-primary-fg); }

/* --- Secondary — Figma 32:1047/32:1053 ------------------------------------- */
body .btn-secondary {
  background: var(--sl-action-secondary-bg);
  border: 1px solid var(--sl-action-secondary-border);
  color: var(--sl-action-secondary-fg);
}
body .btn-secondary:hover:not(:disabled)  { background: var(--sl-action-secondary-bg-hover); }
body .btn-secondary:active:not(:disabled) { background: var(--sl-action-secondary-bg-active); }
body .btn-secondary .fa-solid,
body .btn-secondary .fa-regular { color: var(--sl-action-secondary-fg); }

/* --- Tertiary → Figma "Other" (tonal) — 32:1067/32:1070 -------------------- */
body .btn-tertiary {
  background: var(--sl-action-tertiary-bg);
  border: 1px solid transparent;
  color: var(--sl-action-tertiary-fg);
}
body .btn-tertiary:hover:not(:disabled)  { background: var(--sl-action-tertiary-bg-hover); }
body .btn-tertiary:active:not(:disabled) {
  background: var(--sl-action-tertiary-bg-active);
  box-shadow: var(--sl-elevation-2);
}
body .btn-tertiary label,
body .btn-tertiary .fa-solid,
body .btn-tertiary span:where(.sl-label-text) { color: var(--sl-action-tertiary-fg); }

/* --- Warning (danger-outline) — no Figma comp; geometry normalised, the
       app's red affordance kept, states derived from the red ramp ------------ */
body .btn-warning {
  background: var(--sl-palette-blue-10);
  border: 1px solid var(--sl-palette-red-80);
  color: var(--sl-palette-red-110);
}
body .btn-warning:hover:not(:disabled)  { background: var(--sl-palette-red-10); }
body .btn-warning:active:not(:disabled) { background: var(--sl-palette-red-50); }
body .btn-warning label,
body .btn-warning .fa-solid,
body .btn-warning span:where(.sl-label-text) { color: var(--sl-palette-red-110); }

/* Dark theme (Nov 2026). The palette reds above are light-theme colors, so a
   dark page takes the theme's danger tokens instead (high contrast and
   color-blind modes remap them too). Icon-only ghost buttons keep their kit
   look. Labels and icons inherit, so a disabled button reads in the shared
   muted text instead of dark red on a dark fill. */
html[data-theme="dark"] body .btn-warning:not(:disabled):not(.sl-ghost-btn) {
  background: var(--sl-action-danger-bg);
  border-color: var(--sl-border-danger);
  color: var(--sl-text-danger);
}
html[data-theme="dark"] body .btn-warning:not(:disabled):not(.sl-ghost-btn):hover {
  background: color-mix(in srgb, var(--sl-text-danger) 12%, var(--sl-action-danger-bg));
}
html[data-theme="dark"] body .btn-warning:not(:disabled):not(.sl-ghost-btn):active {
  background: color-mix(in srgb, var(--sl-text-danger) 22%, var(--sl-action-danger-bg));
}
html[data-theme="dark"] body .btn-warning:not(.sl-ghost-btn) :is(label, .fa-solid, .fa-regular, span.sl-label-text) {
  color: inherit;
}

/* --- Destructive (quiet) — Figma 32:1031/32:1025 --------------------------- */
body .btn-destructive {
  background: var(--sl-action-danger-bg);
  border: 1px solid var(--sl-action-danger-border);
  color: var(--sl-action-danger-fg);
}
body .btn-destructive:hover:not(:disabled)  { background: var(--sl-action-danger-bg-hover); }
body .btn-destructive:active:not(:disabled) { background: var(--sl-action-danger-bg-active); }
body .btn-destructive label,
body .btn-destructive .fa-solid,
body .btn-destructive span:where(.sl-label-text) { color: var(--sl-action-danger-fg); }

/* =============================================================================
   2. TEXT INPUTS — Figma 32:829
   Legacy pages style bare `input` (24px tall) and give focus feedback only on
   :active (mousedown). Bridge brings the Figma field: 40px, proper focus ring,
   dashed disabled, grey read-only.
   Excluded: checkbox/radio/range/file/button-ish inputs (the app has custom
   checkbox chrome) — :where() keeps the exclusion at zero extra specificity.
   ========================================================================== */
body input:where(:not([type]),
                 [type="text"], [type="password"], [type="number"],
                 [type="email"], [type="url"], [type="search"], [type="tel"]),
body select,
body textarea {
  height: auto;
  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);
}

body input:where(:not([type]),
                 [type="text"], [type="password"], [type="number"],
                 [type="email"], [type="url"], [type="search"], [type="tel"]):focus,
body select:focus,
body textarea:focus {
  border-color: var(--sl-selected-border);
  box-shadow: inset 0 0 0 1px var(--sl-selected-border);
}
body input:where(:not([type]),
                 [type="text"], [type="password"], [type="number"],
                 [type="email"], [type="url"], [type="search"], [type="tel"]):focus:not(:focus-visible),
body select:focus:not(:focus-visible),
body textarea:focus:not(:focus-visible) {
  outline: none;
}
body input:where(:not([type]),
                 [type="text"], [type="password"], [type="number"],
                 [type="email"], [type="url"], [type="search"], [type="tel"]):focus-visible,
body select:focus-visible,
body textarea:focus-visible {
  outline: var(--sl-focus-ring-width) solid var(--sl-focus-ring-color);
  outline-offset: var(--sl-focus-ring-offset);
}

body input:where([type="text"], [type="password"], [type="number"],
                 [type="email"], [type="url"], [type="search"], [type="tel"],
                 :not([type])):disabled,
body select:disabled,
body textarea:disabled {
  background: var(--sl-surface-disabled);
  border-style: dashed;
  color: var(--sl-text-muted);
  cursor: not-allowed;
}

body input:where([type="text"], [type="password"], [type="number"],
                 [type="email"], [type="url"], [type="search"], [type="tel"],
                 :not([type]))[readonly],
body textarea[readonly] {
  background: var(--sl-surface-disabled);
}

/* Field labels above inputs — Figma 5px gap, medium weight */
body .input-label {
  font-family: var(--sl-font-family);
  font-size: var(--sl-font-size-sm);
  font-weight: var(--sl-font-weight-semibold);
  color: var(--sl-text-primary);
  margin-bottom: 5px;
}

/* =============================================================================
   3. SETTINGS NAV — Figma 41:2092 (.settings-card → Settings-Menu-Button)
   White raised row, radius 8, 40px, Roboto Medium 14; selected keeps the
   left-accent affordance on the pressed surface.
   ========================================================================== */
body .settings-card {
  min-height: var(--sl-control-height);
  height: auto;
  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);
  cursor: pointer;
  transition:
    background-color var(--sl-duration-base) var(--sl-easing-standard),
    box-shadow       var(--sl-duration-base) var(--sl-easing-standard);
}
body .settings-card:hover { background: var(--sl-surface-sunken); }
body .settings-card:active {
  background: var(--sl-surface-pressed);
  box-shadow: var(--sl-elevation-2);
}
body .settings-card:focus-visible {
  outline: var(--sl-focus-ring-width) solid var(--sl-focus-ring-color);
  outline-offset: var(--sl-focus-ring-offset);
}
body .settings-card.selected {
  background: var(--sl-surface-pressed);
  border-radius: var(--sl-radius-md);
  border-left: 3px solid var(--sl-border-accent);
  box-shadow: var(--sl-elevation-2);
}
body .settings-card .settings-card-label,
body .settings-card-label {
  font-family: var(--sl-font-family);
  font-size: var(--sl-font-size-sm);
  font-weight: var(--sl-font-weight-medium);
  letter-spacing: var(--sl-letter-spacing-label);
  color: var(--sl-text-primary);
  cursor: inherit;
}

/* =============================================================================
   4. HOME LAUNCH CARDS (admin/main.html) — Figma card surface at mega size
   These are .btn-tertiary inside #card-container-wrapper; restore card
   treatment over the generic tonal-button mapping above.
   ========================================================================== */
body #card-container-wrapper .btn-tertiary,
body #card-container-wrapper .card {
  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);
}
body #card-container-wrapper .btn-tertiary:hover,
body #card-container-wrapper .card:hover {
  background: var(--sl-surface-raised);
  border-color: var(--sl-border-accent);
  box-shadow: var(--sl-elevation-start);
}
body #card-container-wrapper .btn-tertiary:active,
body #card-container-wrapper .card:active {
  background: var(--sl-surface-pressed);
  box-shadow: var(--sl-elevation-1);
}

/* =============================================================================
   6. SMARTBROWSER / SMARTTE CONFIG — page banding
   -----------------------------------------------------------------------------
   Two bands instead of one flat canvas: the page identity (breadcrumb + title)
   sits on white, and the working area (Packages + table) sits on the tinted
   surface. The colour change carries the separation, so the heavy rule under
   the H1 is removed. Header type is dialled back — a page title shouldn't
   shout louder than the data it introduces.
   ========================================================================== */
body.sl-has-shell > #main-container {
  /* white identity band is set in sl-shell.css §7 (it loads later and would
     otherwise win); only the padding is adjusted here */
  padding-bottom: 0;
}

/* Identity band: quieter title, no divider rule */
body.sl-has-shell #page-heading {
  font-size: 1.5rem;
  font-weight: var(--sl-font-weight-regular);
  line-height: 1.3;
  letter-spacing: -0.01em;
  color: var(--sl-text-primary);
  margin: 2px 0 18px;
  border: 0;                 /* drop the thick divider — white/tint does the work */
  padding-bottom: 0;
}
body.sl-has-shell #page-heading::after { content: none; }

/* Subtitle under the identity-band title (e.g. "SmartTE Configuration" with
   "Direct Session configuration." beneath it). When present it tucks directly
   under #page-heading — whose 18px bottom margin is collapsed so the title and
   subtitle read as one block — and carries the 18px gap to the content below. */
body.sl-has-shell #page-heading:has(+ #page-subheading) { margin-bottom: 4px; }
body.sl-has-shell #page-subheading {
  margin: 0 0 18px;
  font-size: 0.9375rem;
  font-weight: var(--sl-font-weight-regular);
  line-height: 1.3;
  letter-spacing: -0.01em;
  color: var(--sl-text-secondary);
}

/* Working band: tinted, full-bleed to the container edges */
/* Working area: no tinted wrapper. A tinted band nested inside the workspace
   added a second horizontal inset, so wide tables were squeezed and overflowed
   their card. The table card now spans the full workspace width and provides
   its own separation; the white identity band above is unchanged. */
body.sl-has-shell #main-container #content-container {
  background: transparent;
  border-top: 0;
  margin-inline: 0;
  padding: 0;
  width: 100%;
  min-width: 0;
  max-width: none;
  height: auto;
  min-height: 0;
  box-sizing: border-box;
}

/* The inner panel no longer needs its own tint or the 5px top band */
body.sl-has-shell #content-container .server-bg {
  background: transparent;
  border-top: 0;
  border-radius: 0;
  justify-content: flex-start;
  height: auto;
}
body.sl-has-shell #content-container .server-bg-header {
  position: static;
  height: auto;
  width: 100%;
  margin-bottom: var(--sl-space-3);
}
body.sl-has-shell #content-container .server-bg-header h2 {
  font-size: var(--sl-font-size-md);
  font-weight: var(--sl-font-weight-semibold);
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--sl-text-muted);
  margin: 0;
}
body.sl-has-shell #content-container .server-table {
  width: 100%;
  height: auto;
}

/* --- Leaner column controls -------------------------------------------------
   Sort + filter affordances were two dark icons per column, always visible —
   twenty icons competing with ten labels. They now sit quiet and grey, and
   only surface on hover/focus of the header cell (the active sort stays
   visible so the current ordering is never hidden). */
body.sl-has-shell .seat-table thead th i,
body.sl-has-shell .server-table thead th i {
  color: var(--sl-text-muted);
  font-size: var(--sl-font-size-2xs);
  padding: 3px;
  opacity: 0;
  transition: opacity var(--sl-duration-fast) var(--sl-easing-standard),
              color var(--sl-duration-fast) var(--sl-easing-standard);
}
body.sl-has-shell .seat-table thead th:hover i,
body.sl-has-shell .seat-table thead th:focus-within i,
body.sl-has-shell .server-table thead th:hover i,
body.sl-has-shell .server-table thead th:focus-within i {
  opacity: 1;
}
/* active sort / filtered column stays visible */
body.sl-has-shell .seat-table thead th .sorted-asc-sortAlt i,
body.sl-has-shell .seat-table thead th .sorted-desc-sortAlt i,
body.sl-has-shell .server-table thead th .sorted-asc-sortAlt i,
body.sl-has-shell .server-table thead th .sorted-desc-sortAlt i {
  opacity: 1;
  color: var(--sl-text-link);
}
body.sl-has-shell .fa-solid.fa-sort-alt:hover,
body.sl-has-shell .fa-solid.fa-sliders-simple:hover {
  background: var(--sl-surface-accent);
  color: var(--sl-text-link);
  border-radius: var(--sl-radius-xs);
}
/* column headings themselves read as labels, not headlines */
body.sl-has-shell .seat-table thead th label,
body.sl-has-shell .server-table thead th label,
body.sl-has-shell .seat-table thead th span:where(.sl-label-text),
body.sl-has-shell .server-table thead th span:where(.sl-label-text) {
  font-size: 0.78125rem;
  font-weight: var(--sl-font-weight-semibold);
  color: var(--sl-text-secondary);
}

/* Section header: label left, primary action right — the action now sits above
   the table card (and so above the search field) instead of inside the toolbar. */
body.sl-has-shell #content-container .server-bg-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sl-space-4);
}
body.sl-has-shell #content-container .server-bg-header__action {
  display: flex;
  align-items: center;
}
/* Toolbar now holds only search — push it to the right edge */
body.sl-has-shell #content-container .server-table-header {
  justify-content: flex-end;
}

/* --- Wide tables fill the workspace ----------------------------------------
   sbp-list-table.css pins these with `#main-container:has(#packageTable)`
   (specificity 2,0,0) — including a 900px floor and a clamp() width that made
   the table wider than its container. These selectors carry two ids plus a
   class to outrank it. Overflow is handled by scrolling INSIDE the card, so a
   genuinely wide table never pushes the page sideways. */
body.sl-has-shell #main-container #content-container .server-bg {
  width: 100%;
  min-width: 0;
  max-width: none;
  align-items: stretch;
  justify-content: flex-start;
  overflow: visible;
  padding-top: 0;
}
body.sl-has-shell #main-container #content-container .server-bg-header,
body.sl-has-shell #main-container #content-container .server-table {
  width: 100%;
  min-width: 0;
  max-width: none;
  box-sizing: border-box;
}
/* the card scrolls its own overflow rather than the page */
body.sl-has-shell #main-container #content-container .server-table {
  overflow-x: auto;
}
body.sl-has-shell #main-container #content-container .server-table table,
body.sl-has-shell #main-container #content-container .seat-table {
  width: 100%;
  min-width: 0;
  table-layout: auto;
}

/* Semantic color classes. High contrast remaps the tokens; do not inline paint. */
.required-marker {
  color: var(--sl-text-danger);
  font-weight: var(--sl-font-weight-semibold);
}
.toast-dismiss-wrap { float: right; }
.toast-dismiss {
  color: var(--sl-text-link);
  cursor: pointer;
}
.note-icon { color: var(--sl-text-link); }
.warn-icon { color: var(--sl-feedback-warning-solid); }
.is-expired { color: var(--sl-text-danger); }
.product-card-body.critical .entitlement-ico,
.product-card-body.critical .seat-ico {
  color: var(--sl-text-danger);
}
.product-card-body.warning .entitlement-ico,
.product-card-body.warning .seat-ico {
  color: var(--sl-feedback-warning-solid);
}
.fade-modal-header--danger {
  border: 1px solid var(--sl-border-danger);
  /* The toast header's base is the success green; an error toast (publish.js) needs the danger surface. */
  background: var(--sl-feedback-danger-bg);
}
.fade-modal-header--danger .icon,
.fade-modal-header--danger .title,
.fade-modal-header--danger .close-btn,
.fade-modal-header--danger :is(#closeFadeModalBtn, .sl-id-closeFadeModalBtn) {
  color: var(--sl-text-danger);
}
.upload-status.error,
#status.error {
  color: var(--sl-text-danger);
}

.fade-modal:focus-visible,
.fade-modal-header:focus-visible,
.success-modal:focus-visible,
.modal-header:focus-visible {
  outline: var(--sl-focus-ring-width) solid var(--sl-focus-ring-color);
  outline-offset: var(--sl-focus-ring-offset);
}

/* Inline paint retired onto classes. See docs/INLINE-CSS-CONVERSION-PLAN.md */
body .sl-on-accent { color: var(--sl-text-on-accent); }
body .sl-required { color: var(--sl-feedback-danger-fg); }
body .sl-warning-icon { color: var(--sl-feedback-warning-fg); }
body .sl-link-icon { color: var(--sl-text-link); }
body .sl-muted-aside {
  color: var(--sl-text-muted);
  font-weight: var(--sl-font-weight-regular);
}
body .is-expired { color: var(--sl-text-danger); }
body .is-current { color: var(--sl-text-primary); }
body .is-danger-icon { color: var(--sl-feedback-danger-fg); }
body .is-warning-icon { color: var(--sl-feedback-warning-fg); }
body .is-ok-icon { color: var(--sl-feedback-success-solid); }
body .is-invalid {
  border: 2px solid var(--sl-border-danger);
  box-shadow: 0 0 0 0.2rem color-mix(in srgb, var(--sl-border-danger) 25%, transparent);
}
body .sbp-note {
  font-size: var(--sl-font-size-sm);
  padding: var(--sl-space-2) var(--sl-space-3);
}
body .sbp-modal-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--sl-space-4);
  padding-bottom: var(--sl-space-3);
  border-bottom: 1px solid var(--sl-border-subtle);
}
