/* ==========================================================================
   Smart Pi UI — portable design-system starter
   Dark instrument-panel look: IBM Plex Sans, dark neutrals, cyan/green/orange/red.
   Namespaced --sp-* tokens and .sp-* classes so it drops into any product without
   colliding. Load IBM Plex Sans (see references/layout-and-mobile.md), link this
   file, then build with the classes below. Mobile fold at 767px.
   ========================================================================== */

/* --- IBM Plex Sans (self-hosted, bundled in ./fonts/ibm-plex-sans/) --------
   Paths are relative to THIS stylesheet. If you place smartpi-ui.css somewhere
   else, keep the fonts alongside it or adjust these url()s. Licence: OFL, see
   ./fonts/ibm-plex-sans/LICENSE.txt (ship it when you redistribute the fonts). */
@font-face {
  font-family: "IBM Plex Sans";
  src: url("../fonts/ibm-plex-sans/IBMPlexSans-Regular.woff2?v=ba711a3085ff") format("woff2");
  font-weight: 400; font-style: normal; font-display: swap;
}
@font-face {
  font-family: "IBM Plex Sans";
  src: url("../fonts/ibm-plex-sans/IBMPlexSans-Medium.woff2?v=5660f8a658f8") format("woff2");
  font-weight: 500; font-style: normal; font-display: swap;
}
@font-face {
  font-family: "IBM Plex Sans";
  src: url("../fonts/ibm-plex-sans/IBMPlexSans-SemiBold.woff2?v=f78048030eab") format("woff2");
  font-weight: 600; font-style: normal; font-display: swap;
}
@font-face {
  font-family: "IBM Plex Sans";
  src: url("../fonts/ibm-plex-sans/IBMPlexSans-Bold.woff2?v=fa7130d854a6") format("woff2");
  font-weight: 700; font-style: normal; font-display: swap;
}

:root {
  /* neutrals (aligned to Smart Pi Design System tokens) */
  --sp-bg: #262626;
  --sp-surface: #2b2b2b;
  --sp-surface-raised: #353535;
  --sp-well: #333333;
  --sp-border: #484848;
  --sp-border-soft: #3a3a3a;
  --sp-border-strong: #656565;
  --sp-chrome: #000;

  /* text (two-tier: body vs heading/value) */
  --sp-text: #cccccc;
  --sp-text-strong: #d6d8da;
  --sp-text-dim: #cdd0d2;
  --sp-muted: #a0a0a0;
  --sp-muted-2: #7d7d7d;

  /* Instrument accents and graphs, separate from health-state colours. */
  --sp-control-accent: #f25c19;
  --sp-control-graph: #66686d;
  --sp-control-graph-active: var(--sp-control-accent);
  --sp-control-handle: rgba(242, 92, 25, .25);
  --sp-control-plot: #1c1d1e;
  /* Retain band hooks for consumers; the instrument uses one orange accent. */
  --sp-eq-band-1: var(--sp-control-accent);
  --sp-eq-band-2: var(--sp-control-accent);
  --sp-eq-band-3: var(--sp-control-accent);
  --sp-eq-band-4: var(--sp-control-accent);
  --sp-eq-response: var(--sp-control-graph-active);

  /* status */
  --sp-cyan: #00c7ee;
  --sp-green: #31cc4b;
  --sp-orange: #e96225;
  --sp-red: #e05b5b;
  --sp-grey-btn: #6d6d6d;

  /* brand header banner */
  --sp-header-from: #f16b2f;
  --sp-header-to: #d64c0e;
  --sp-header-border: #a93c0a;

  /* type */
  --sp-font: "IBM Plex Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;

  /* frame */
  --sp-topbar-h: 70px;
  --sp-footer-h: 48px;
  --sp-frame-gap: 34px;
  --sp-frame-bottom-gap: 18px;

  /* radius */
  --sp-radius-card: 10px;
  --sp-radius-control: 6px;
  --sp-radius-chip: 3px;

  /* SweetAlert2 reads these variables when a product includes it. Keeping the
     palette in the always-loaded base prevents vendor defaults from introducing
     a light dialog into the otherwise fixed dark application shell. */
  --swal2-backdrop: rgba(10,11,12,.72);
  --swal2-background: #292b2c;
  --swal2-border: 1px solid #46494b;
  --swal2-border-radius: 10px;
  --swal2-color: #d7d9da;
  --swal2-outline: 0 0 0 3px rgba(0,199,238,.35);
  --swal2-confirm-button-background-color: #06a8c6;
  --swal2-confirm-button-color: #092229;
  --swal2-cancel-button-background-color: #3a3c3e;
  --swal2-cancel-button-color: #d7d9da;
  --swal2-deny-button-background-color: #e05b5b;
  --swal2-deny-button-color: #fff;
  --swal2-validation-message-background: #1d1f20;
  --swal2-validation-message-color: #f1a9a9;
}

/* --- base ---------------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }

.sp-app, .sp-app * { font-family: var(--sp-font); }
.sp-app .fa-solid, .sp-app .fas { font-family: "Font Awesome 6 Free"; font-weight: 900; }
.sp-app .fa-regular, .sp-app .far { font-family: "Font Awesome 6 Free"; font-weight: 400; }
.sp-app .fa-brands, .sp-app .fab { font-family: "Font Awesome 6 Brands"; font-weight: 400; }
.sp-app {
  color-scheme: dark;
  margin: 0;
  min-height: 100vh;
  background: var(--sp-bg);
  color: var(--sp-text);
  font-size: 14px;
  line-height: 1.4;
  -webkit-font-smoothing: antialiased;
}
.sp-app a { color: var(--sp-orange); text-decoration: none; }
/* Numeric fields drop the native spinner. Its chevrons are browser chrome that
   ignores the dark theme, and the values these fields hold — ports, channel
   counts, retention days — are typed, not nudged one step at a time. Arrow keys
   still increment, so no capability is lost. */
.sp-app input[type="number"] { appearance: textfield; -moz-appearance: textfield; }
.sp-app input[type="number"]::-webkit-outer-spin-button,
.sp-app input[type="number"]::-webkit-inner-spin-button { appearance: none; -webkit-appearance: none; margin: 0; }
.sp-app h2, .sp-app h3 { margin: 0; font-weight: 600; color: var(--sp-text-strong); }

/* --- topbar -------------------------------------------------------------- */
.sp-topbar {
  position: fixed; top: 0; left: 0; right: 0;
  height: var(--sp-topbar-h);
  background: var(--sp-chrome);
  box-shadow: 0 0 12px rgba(0,0,0,0.5);
  z-index: 1000;
}
.sp-topbar__inner {
  display: grid;
  grid-template-columns: minmax(0,1fr) auto minmax(0,1fr);
  align-items: center;
  height: 100%;
  padding: 0 45px;
}
.sp-topbar__brand { justify-self: start; display: flex; align-items: center; }
.sp-logo { height: 54px; max-width: 340px; object-fit: contain; display: block; }
.sp-topbar__clock { justify-self: center; color: var(--sp-text-dim); font-size: 13px; }
.sp-topbar__meta {
  justify-self: end; display: flex; align-items: center; gap: 18px;
  color: var(--sp-text-dim); font-size: 13px; white-space: nowrap;
}
.sp-topbar__status { display: inline-flex; align-items: center; }
.sp-topbar__status > i { width: 17px; margin-right: 5px; color: #d9dcdf; font-size: 15px; text-align: center; }
.sp-account {
  position: relative; height: 30px; display: inline-flex; align-items: center;
  background: #151718; border: 1px solid #34383a; border-radius: 6px;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.04);
}
.sp-account__trigger {
  height: 28px; min-width: 0; max-width: 150px; padding: 0 7px 0 4px;
  display: inline-flex; align-items: center; gap: 6px; border: 0; border-radius: 5px;
  background: transparent; color: #eef0f1; cursor: pointer;
  font: 600 12px var(--sp-font); transition: background-color .14s ease,color .14s ease;
}
.sp-account__trigger:hover,.sp-account.is-open .sp-account__trigger { background:#232629;color:#fff; }
.sp-account__trigger span { display:block;overflow:hidden;text-overflow:ellipsis;white-space:nowrap; }
.sp-account__trigger > .fa-user {
  width:18px;height:18px;padding:3px;display:grid;place-items:center;flex:0 0 auto;
  border:1px solid #45494c;border-radius:50%;background:#242729;color:#cfd3d6;font-size:10px;
}
.sp-account__chevron { width:13px;font-size:10px;transition:transform .14s ease; }
.sp-account.is-open .sp-account__chevron { transform:rotate(180deg); }
.sp-account__menu {
  position:absolute;right:0;top:calc(100% + 7px);z-index:1100;display:none;min-width:156px;padding:5px;
  border:1px solid #3f4447;border-radius:6px;background:#1c1f21;
  box-shadow:0 8px 18px rgba(0,0,0,.38),inset 0 1px 0 rgba(255,255,255,.04);
}
.sp-account__menu::before {
  position:absolute;right:18px;top:-5px;width:8px;height:8px;content:"";transform:rotate(45deg);
  border-left:1px solid #3f4447;border-top:1px solid #3f4447;background:#1c1f21;
}
.sp-account.is-open .sp-account__menu { display:block; }
.sp-account__logout {
  width:100%;height:32px;padding:0 9px;display:flex;align-items:center;justify-content:flex-start;gap:8px;
  border-radius:5px;color:#d7dadd!important;font:700 11px var(--sp-font);transition:color .14s ease,background-color .14s ease;
}
.sp-account__logout:hover { background:#2a2d30;color:#f3833f!important; }
.sp-account__logout > i { width:14px;text-align:center; }
.sp-hamburger {
  display: none;
  height: 34px; width: 34px; align-items: center; justify-content: center;
  background: #151718; color: var(--sp-text-dim);
  border: 1px solid var(--sp-border); border-radius: var(--sp-radius-control);
  font-size: 18px; cursor: pointer;
}

/* --- content ------------------------------------------------------------- */
.sp-content {
  margin-top: 0;
  padding: calc(var(--sp-topbar-h) + var(--sp-frame-gap)) 45px
           calc(var(--sp-footer-h) + var(--sp-frame-bottom-gap));
  min-height: 100vh;
}
.sp-content__well {
  background: var(--sp-well);
  border-radius: var(--sp-radius-card);
  display: flex;
  flex-direction: column;
  height: calc(100vh - var(--sp-topbar-h) - var(--sp-frame-gap) - var(--sp-footer-h) - var(--sp-frame-bottom-gap));
  max-height: calc(100vh - var(--sp-topbar-h) - var(--sp-frame-gap) - var(--sp-footer-h) - var(--sp-frame-bottom-gap));
  min-height: 0;
  overflow: auto;
  -webkit-overflow-scrolling: touch;
  padding: 15px;
}
/* Overview pages and dashboards fill the well and scroll their own regions
   internally, so they may be shrunk to it. */
.sp-content__well > .config-overview-page,
.sp-content__well > .dashboardHost,
.sp-content__well > .dashboardPage { flex: 1 1 auto; }
/* A detail frame must not shrink. It sets overflow:hidden so its rounded corners
   clip cleanly, which means anything the well squeezed out of it would be
   discarded rather than scrollable — the well's scrollHeight would still equal
   its clientHeight, so no scrollbar would appear anywhere and the overflow would
   be unreachable. It still grows, so a page shorter than the well is unchanged.
   A detail page that wants to scroll internally sets overflow on its own body.
   The second selector is required because the breadcrumb sibling rule below has
   equal specificity and comes later, so it would otherwise restore the shrink on
   exactly the detail screens that carry a breadcrumb. */
.sp-content__well > .config-detail-page,
.sp-content__well > .app-breadcrumb + .config-detail-page { flex: 1 0 auto; }

/* --- breadcrumbs --------------------------------------------------------- */
.app-breadcrumb {
  align-items: center;
  background: linear-gradient(180deg,#383a3b 0%,#2e3031 100%); background-color:#2e3031;
  border: 1px solid #3a3c3e;
  border-radius: 8px 0 8px 0;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.04);
  color: #92979a;
  display: inline-flex;
  flex-wrap: nowrap;
  font-size: 11px;
  gap: 5px;
  margin: 0 0 12px;
  max-width: 100%;
  padding: 5px 11px;
}
.app-breadcrumb-icon { color: #00c7ee; fill: none; flex: 0 0 auto; height: 13px; stroke: currentColor; stroke-linecap: round; stroke-linejoin: round; stroke-width: 1.7; width: 13px; }
.app-breadcrumb-link { color: #00c7ee!important; text-decoration: none; }
.app-breadcrumb-link:hover,
.app-breadcrumb-link:focus-visible { color: #5fdcf5!important; text-decoration: underline; }
.app-breadcrumb-sep { color: #5a5d60; font-size: 11px; line-height: 1; }
.app-breadcrumb-current { color: #c7cacc; font-weight: 500; }
.sp-content__well > .app-breadcrumb {
  align-self: flex-start;
  flex: 0 0 auto;
  margin: -15px 0 0 -15px;
}
.sp-content__well > .app-breadcrumb + * { flex: 1 1 auto; min-height: 0; width: 100%; }

/* --- footer nav / action bar --------------------------------------------- */
.sp-footer {
  position: fixed; bottom: 0; left: 0; right: 0;
  height: var(--sp-footer-h);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 16px;
  background: var(--sp-chrome);
  border-top: 1px solid var(--sp-border);
  z-index: 900;
}
.sp-footer__slot { color: var(--sp-text-dim); font-size: 13px; display: flex; align-items: center; }
.sp-footer__nav ul { display: flex; gap: 4px; margin: 0; padding: 0; list-style: none; }
.sp-footer__nav a {
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: 4px 12px; color: var(--sp-muted); font-size: 11px; border-radius: var(--sp-radius-control);
}
.sp-footer__nav a svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.sp-footer__nav a.is-active { color: var(--sp-cyan); background: rgba(0,199,238,0.12); }
.footer-sticky { position: fixed; inset: auto 0 0; z-index: 900; height: var(--sp-footer-h); display: grid; grid-template-columns: minmax(120px,1fr) auto minmax(120px,1fr); align-items: center; padding: 0 16px; background: #191919; border: 1px solid #3b3b3b; border-radius: 0 0 28px 28px; box-shadow: 0 -3px 10px rgba(0,0,0,.28); }
.footer-primary-nav ul { display: flex; align-items: center; justify-content: center; gap: 6px; margin: 0; padding: 0; list-style: none; }
.footer-primary-nav a { height:40px; padding:0 14px; display:flex; align-items:center; justify-content:center; gap:7px; border:1px solid transparent; border-radius:6px; color:#d6d8da!important; font-size:13px; font-weight:400; line-height:1; white-space:nowrap; }
.footer-primary-nav a > i { width:24px; flex:0 0 24px; font-size:22px; line-height:24px; text-align:center; }
.footer-primary-nav a.is-active { color: #131313 !important; background: linear-gradient(180deg,#00caf1 0%,#00869f 100%); background-color:#00caf1; border-color: #00caf1; box-shadow: inset 0 1px 0 rgba(255,255,255,.22),0 2px 7px rgba(0,134,159,.2); }
.footer-primary-nav a:not(.is-active):hover,
.footer-primary-nav a:not(.is-active):focus-visible { background:#282828; border-color:transparent; box-shadow:none; color:#f1f3f4!important; outline:none; }
.footer-status-slot,.footer-actions-slot { align-items:center;display:flex;height:100%;min-width:0; }
.footer-status-slot { justify-content:flex-start; }
.footer-actions-slot { gap:6px;justify-content:flex-end; }
.sp-change-actions { align-items:center;display:flex;gap:6px;min-width:0; }
.footer-sticky:has(.sp-restart-required:not([hidden])) { padding-right:0; }
.footer-actions-slot:has(.sp-restart-required:not([hidden])),
.sp-change-actions:has(.sp-restart-required:not([hidden])) { align-items:stretch;height:100%; }

/* --- pending changes / restart action -----------------------------------
   Products own dirty detection, persistence and restart decisions. Core owns
   the visible states: toggle the state classes and [hidden], then update the
   accessible label while the product performs its work. */
.sp-change-action,.sp-change-discard,.sp-restart-required {
  appearance:none;font-family:var(--sp-font);line-height:1;white-space:nowrap;
}
.sp-change-action {
  height:40px;padding:0 14px;display:inline-flex;align-items:center;justify-content:center;gap:8px;
  border:1px solid transparent;border-radius:var(--sp-radius-control);background:transparent;
  color:#f25c19;cursor:pointer;font-size:13px;font-weight:400;letter-spacing:.03em;
  transition:background-color .15s ease,border-color .15s ease,color .15s ease;
}
.sp-change-action[hidden],.sp-change-discard[hidden],.sp-restart-required[hidden] { display:none; }
.sp-change-action > i { width:18px;font-size:17px;text-align:center; }
.sp-change-action > [hidden] { display:none; }
.sp-change-action.is-pending:hover,.sp-change-action.is-pending:focus-visible { background:rgba(255,255,255,.06);outline:0; }
.sp-change-action.is-pending > i { animation:sp-change-pending .55s ease-in-out infinite alternate; }
.sp-change-action.is-confirm {
  border-color:#ff8449;background:linear-gradient(180deg,#fa7a3d 0%,#df571c 100%); background-color:#df571c;color:#2b1505;
  box-shadow:inset 0 1px 0 rgba(255,255,255,.2),0 1px 2px rgba(0,0,0,.35);
}
.sp-change-action.is-confirm:hover,.sp-change-action.is-confirm:focus-visible { background:linear-gradient(180deg,#ff8b52 0%,#eb6326 100%); background-color:#eb6326;outline:0; }
.sp-change-action.is-confirm > i { animation:sp-change-confirm .7s ease-in-out infinite alternate;transform-origin:50% 70%; }
.sp-change-action.is-saving { cursor:wait;opacity:.7; }
.sp-change-action:disabled { cursor:wait;opacity:.7; }
.sp-change-discard {
  width:34px;height:34px;padding:0;display:inline-grid;place-items:center;border:1px solid transparent;
  border-radius:999px;background:transparent;color:#9a9d9f;cursor:pointer;font-size:15px;
}
.sp-change-discard:hover,.sp-change-discard:focus-visible { background:rgba(255,255,255,.06);color:#d8dadb;outline:0; }
.sp-restart-required {
  height:40px;padding:0 24px 0 16px;display:inline-flex;align-items:center;justify-content:center;gap:8px;
  border:1px solid #f6ca5b;border-radius:var(--sp-radius-control) 0 28px var(--sp-radius-control);
  background:linear-gradient(180deg,#f0c04a 0%,#d69b18 100%); background-color:#d69b18;color:#2b2106;
  box-shadow:inset 0 1px 0 rgba(255,255,255,.22),0 1px 2px rgba(0,0,0,.35);
  cursor:pointer;font-size:13px;font-weight:600;
}
.sp-restart-required:hover,.sp-restart-required:focus-visible { background:linear-gradient(180deg,#ffd362 0%,#e4a721 100%); background-color:#e4a721;outline:0; }
@keyframes sp-change-pending { from { opacity:.25;transform:translateY(-1px); } to { opacity:1;transform:translateY(1px); } }
@keyframes sp-change-confirm { from { opacity:.65;transform:rotate(-6deg) scale(.94); } to { opacity:1;transform:rotate(6deg) scale(1.05); } }

/* --- drawer (mobile nav) ------------------------------------------------- */
.sp-drawer {
  position: fixed; top: 0; right: 0; bottom: 0; width: 280px; max-width: 84vw;
  background: var(--sp-surface); border-left: 1px solid var(--sp-border); box-shadow:-8px 0 24px rgba(0,0,0,.32);
  padding: 18px; z-index: 1100; overflow-y: auto;
  transform: translateX(100%); transition: transform 0.15s ease;
}
.sp-nav-open .sp-drawer { transform: translateX(0); }
.sp-drawer__header { height:52px; margin:-18px -18px 13px; padding:0 12px 0 18px; display:flex; align-items:center; justify-content:space-between; border-bottom:1px solid #454849; background:#1f2122; }
.sp-drawer__header > strong { color:#eef0f1; font-size:14px; font-weight:600; }
.sp-drawer__close { width:34px; height:34px; display:inline-grid; place-items:center; border:1px solid #505457; border-radius:7px; background:#292b2c; color:#e1e4e5; font-size:17px; cursor:pointer; }
.sp-drawer__close:hover,.sp-drawer__close:focus-visible { border-color:#687075; background:#323536; color:#fff; outline:0; }
.sp-drawer nav { display:grid; gap:2px; }
.sp-drawer a {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 10px; color: var(--sp-text-dim); border-radius: var(--sp-radius-control);
}
.sp-drawer a > i { width:24px; flex:0 0 24px; color:inherit; font-size:20px; line-height:24px; text-align:center; }
.sp-drawer a > span { min-width:0; }
.sp-drawer a.is-active { color: var(--sp-cyan); background: rgba(0,199,238,0.12); }
.sp-nav-backdrop {
  position: fixed; inset: 0; background: rgba(0,0,0,0.55); z-index: 1050;
}
.sp-nav-open { overflow: hidden; }

/* --- page-header banner -------------------------------------------------- */
.sp-page-header {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  min-height: 50px; padding: 6px 14px;
  background: linear-gradient(180deg, var(--sp-header-from) 0%, var(--sp-header-to) 100%); background-color:var(--sp-header-from);
  border-bottom: 1px solid var(--sp-header-border);
  border-radius: 9px 9px 0 0;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.18);
  color: rgba(20,10,4,0.92);
}
.sp-page-header__title { display: flex; align-items: center; gap: 10px; min-width: 0; }
/* Match the canonical .config-overview-header used by product pages. The title
   must set its own colour: .sp-app h2 has equal specificity and would otherwise
   override the banner's inherited colour with the light body heading colour. */
.sp-page-header__title h2 {
  color: rgba(20,10,4,0.92);
  font-size: 16px;
  font-weight: 400;
  letter-spacing: -0.01em;
  line-height: 1.15;
  margin: 0 0 3px;
}
.sp-page-header__title > div > span { color: rgba(20,10,4,0.62); font-size: 10px; line-height: 1.2; }
.sp-page-header__icon {
  flex: 0 0 32px; height: 32px; width: 32px;
  display: inline-flex; align-items: center; justify-content: center;
  background: linear-gradient(180deg, #353535 0%, #242424 100%); background-color:#242424;
  border: 1px solid rgba(0,0,0,0.72); border-radius: var(--sp-radius-control);
  color: #c4c7c9;
}
.sp-page-header__icon svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
.sp-page-header__icon > i { font-size: 15px; }
.sp-page-header__actions { display: flex; align-items: center; gap: 10px; }

/* summary metric chips (in header actions) */
.sp-metric {
  display: flex; flex-direction: column; align-items: flex-end; line-height: 1.1;
  padding: 4px 10px; background: rgba(0,0,0,0.18); border-radius: var(--sp-radius-control);
}
.sp-metric span { font-size: 10px; text-transform: uppercase; letter-spacing: 0.04em; }
.sp-metric strong { font-size: 16px; }
.sp-metric strong.is-ok { color: #0b3d16; }

/* --- card ---------------------------------------------------------------- */
.sp-card {
  background: var(--sp-surface);
  border: 1px solid var(--sp-border);
  border-radius: var(--sp-radius-card);
  padding: 14px;
}
.sp-page-header + .sp-card { border-top: 0; border-radius: 0 0 var(--sp-radius-card) var(--sp-radius-card); }
/* display:block so the title owns its own line and the margin below it applies
   whatever element carries the class. On an inline element the margin is
   silently dropped and the next item sits flush against the text. */
.sp-card__title { color: var(--sp-text-strong); display: block; font-size: 15px; font-weight: 600; margin-bottom: 10px; }
.sp-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 10px; }
.sp-stack { display: flex; flex-direction: column; gap: 12px; }
.sp-section-title { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
.sp-section-title h3 { font-size: 15px; }
.sp-section-title p { margin: 0; color: var(--sp-muted); font-size: 12px; }
.sp-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

/* --- summary stats ------------------------------------------------------ */
.sp-stat {
  min-height: 96px; padding: 14px; position: relative; overflow: hidden;
  background: #262626; border: 1px solid var(--sp-border); border-radius: var(--sp-radius-control);
}
.sp-stat::before { content: ""; position: absolute; inset: 0 auto 0 0; width: 3px; background: var(--sp-muted-2); }
.sp-stat.is-ok::before { background: var(--sp-green); }
.sp-stat.is-active::before { background: var(--sp-orange); }
.sp-stat.is-info::before { background: var(--sp-cyan); }
.sp-stat__label { color: var(--sp-muted); font-size: 11px; text-transform: uppercase; letter-spacing: .04em; }
.sp-stat__value { display: block; margin-top: 5px; color: var(--sp-text-strong); font-size: 26px; line-height: 1; }
.sp-stat__meta { display: block; margin-top: 8px; color: var(--sp-muted); font-size: 12px; }

/* --- stacked field ------------------------------------------------------- */
.sp-field { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.sp-field__label { font-size: 11px; color: var(--sp-muted); }
.sp-field__value {
  background: #232323; color: var(--sp-text); font: inherit;
  border: 1px solid var(--sp-border-strong); border-radius: var(--sp-radius-control);
  box-sizing: border-box; padding: 8px 10px; width: 100%;
}
input.sp-field__value, select.sp-field__value { height: 38px; }
.sp-field__value:focus { outline: none; border-color: var(--sp-cyan); }

/* --- buttons ------------------------------------------------------------- */
.sp-btn {
  align-items: center; border: none; color: #fff; background: linear-gradient(var(--sp-orange), #c9531e); background-color:#c9531e;
  display: inline-flex; gap: 6px; justify-content: center;
  padding: 10px 16px; font: 500 14px var(--sp-font); border-radius: var(--sp-radius-control);
  cursor: pointer;
}
.sp-app a.sp-btn { color: #fff; }
.sp-btn:hover { filter: brightness(1.06); }
.sp-btn--grey { background: var(--sp-grey-btn); }
.sp-btn--danger { background: linear-gradient(var(--sp-red), #c44); background-color:#c44; }
.sp-btn--sm { padding: 5px 12px; font-size: 13px; }
.sp-btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* --- dialogs -------------------------------------------------------------
   .sp-dialog is the dependency-free native-dialog primitive. The SweetAlert2
   selectors below apply the same palette when a product already uses that
   library; SmartPi.UI does not require or ship the vendor script. */
.sp-dialog {
  width:min(560px,calc(100vw - 32px));padding:0;border:1px solid #46494b;border-radius:10px;
  background:#292b2c;box-shadow:0 18px 50px rgba(0,0,0,.55);color:#d7d9da;font-family:var(--sp-font);
}
.sp-dialog::backdrop { background:rgba(10,11,12,.72);backdrop-filter:blur(2px); }
.sp-dialog__body { padding:34px 38px 18px;display:grid;justify-items:center;text-align:center; }
.sp-dialog__icon {
  width:74px;height:74px;display:grid;place-items:center;border:3px solid var(--sp-orange);
  border-radius:50%;color:var(--sp-orange);font-size:39px;
}
.sp-dialog__title { margin:24px 0 8px!important;color:#f5f6f7!important;font-size:21px!important;font-weight:600!important; }
.sp-dialog__message { max-width:480px;margin:0;color:#c7cacc;font-size:15px;line-height:1.45; }
.sp-dialog__actions { width:100%;margin-top:25px;display:flex;justify-content:center;gap:8px; }
.sp-dialog__actions .sp-btn { min-width:112px;height:38px;padding:0 18px;border:1px solid #2cdbf6;background:linear-gradient(180deg,#1ed2ef 0%,#06a8c6 100%); background-color:#06a8c6;color:#092229;font-size:12px;font-weight:600; }
.sp-dialog__actions .sp-btn:hover { background:linear-gradient(180deg,#34dcf5 0%,#0db4d2 100%); background-color:#0db4d2;filter:none; }

/* Typed destructive confirmation remains distinct from a primary action. */
.sp-dialog__confirmation { width:100%; margin-top:18px; text-align:left; }
.sp-dialog__confirmation ~ .sp-dialog__actions .sp-btn { min-height:44px; }
.sp-dialog__actions .sp-btn--danger { border-color:var(--sp-red); background:linear-gradient(var(--sp-red),#c44); background-color:#c44; color:#fff; }
.sp-dialog__actions .sp-btn--danger:hover { background:linear-gradient(var(--sp-red),#c44); background-color:#c44; filter:brightness(1.06); }

.sp-app .swal2-popup { border:var(--swal2-border);box-shadow:0 18px 50px rgba(0,0,0,.55);font-family:var(--sp-font); }
.sp-app .swal2-title { color:#f5f6f7;font-size:1.25em; }
.sp-app .swal2-html-container { color:#c7cacc;font-size:.95em; }
.sp-app .swal2-styled.swal2-confirm {
  min-width:104px;padding:8px 18px;border:1px solid #2cdbf6;border-radius:5px;
  background:linear-gradient(180deg,#1ed2ef 0%,#06a8c6 100%); background-color:#06a8c6;color:#092229;
  box-shadow:inset 0 1px 0 rgba(255,255,255,.22),0 1px 2px rgba(0,0,0,.35);font-size:12px;font-weight:600;
}
.sp-app .swal2-styled.swal2-confirm:hover { background:linear-gradient(180deg,#34dcf5 0%,#0db4d2 100%); background-color:#0db4d2; }
.sp-app .swal2-styled.swal2-cancel { min-width:104px;padding:8px 18px;border:1px solid #54585b;border-radius:5px;font-size:12px; }
.sp-app .swal2-icon.swal2-warning { border-color:var(--sp-orange);color:var(--sp-orange); }
.sp-app .swal2-icon.swal2-error { border-color:var(--sp-red);color:var(--sp-red); }
.sp-app .swal2-icon.swal2-error [class^="swal2-x-mark-line"] { background-color:var(--sp-red); }
.sp-app .swal2-icon.swal2-success { border-color:var(--sp-green);color:var(--sp-green); }
.sp-app .swal2-icon.swal2-success .swal2-success-ring { border-color:rgba(49,204,75,.3); }
.sp-app .swal2-icon.swal2-success [class^="swal2-success-line"] { background-color:var(--sp-green); }
.sp-app .swal2-icon.swal2-info { border-color:#5bb8d4;color:#5bb8d4; }
.sp-app .swal2-icon.swal2-question { border-color:#8aa7b3;color:#8aa7b3; }

/* --- call button ----------------------------------------------------------
   One button whose look tracks a call's state, from the SIP server's per-
   extension call control. Swap the icon and toggle a state class from
   whatever call-state the product already tracks — this is markup + CSS
   only, no behaviour of its own. */
.sp-call-button {
  align-items: center; background: linear-gradient(180deg, #6d6d6d 0%, #5c5c5c 100%); background-color:#5c5c5c;
  border: 1px solid var(--sp-border-strong); border-radius: var(--sp-radius-control);
  color: #fff; cursor: pointer; display: inline-flex; font-size: 13px;
  height: 30px; justify-content: center; width: 30px;
}
.sp-call-button:disabled { cursor: default; opacity: .6; }
.sp-call-button.is-connected { background: #1f5c34; border-color: var(--sp-green); color: #dceee0; }
.sp-call-button.is-hangup-armed {
  animation: sp-call-button-pulse .9s ease-in-out infinite;
  background: #7a2020; border-color: var(--sp-red); color: #fff;
}
@keyframes sp-call-button-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(224,91,91,.25); }
  50% { box-shadow: 0 0 0 3px rgba(224,91,91,.3), 0 0 10px rgba(224,91,91,.45); }
}
@media (prefers-reduced-motion: reduce) {
  .sp-call-button.is-hangup-armed { animation: none; box-shadow: 0 0 0 2px rgba(224,91,91,.35); }
}

/* --- speed dials ----------------------------------------------------------
   A label plus a row of numbered one-touch dial buttons. `.is-active`
   marks the one currently dialling. */
.sp-speed-dials { align-items: center; display: flex; flex-wrap: wrap; gap: 6px; }
.sp-speed-dials__label { color: var(--sp-muted); font-size: 11px; margin-right: 2px; white-space: nowrap; }
.sp-speed-dial {
  background: linear-gradient(180deg, #3d3d3d, #333333); background-color:#333333; border: 1px solid var(--sp-border);
  border-radius: 5px; color: #fff; cursor: pointer; font-size: 11px; font-weight: 700;
  height: 23px; padding: 0; text-align: center; width: 28px;
}
.sp-speed-dial:hover, .sp-speed-dial.is-active {
  background: linear-gradient(180deg, var(--sp-cyan) 0%, #02b8d7 100%); background-color:#02b8d7; border-color: #21d9f4; color: #131313;
}
.sp-speed-dial:disabled { cursor: default; opacity: .65; }

/* --- corner tab -------------------------------------------------------------
   A small action tab pinned to a card's bottom-right corner, e.g. "open
   settings for the thing this card describes". Give the card
   `position: relative` — the tab positions itself against it. */
a.sp-corner-tab {
  align-items: center; background: linear-gradient(180deg, var(--sp-header-from) 0%, var(--sp-header-to) 100%); background-color:var(--sp-header-from);
  border-left: 1px solid var(--sp-header-border); border-radius: var(--sp-radius-control) 0 0 0;
  border-top: 1px solid #f57a43; bottom: 0; color: #2b1206; display: flex; font-size: 11px;
  height: 20px; justify-content: center; position: absolute; right: 0; text-decoration: none; width: 22px;
}
a.sp-corner-tab:hover { background: linear-gradient(180deg, #ff7a3d 0%, #e45516 100%); background-color:#e45516; border-color: #ff8a55; color: #180a03; }

/* --- table -------------------------------------------------------------- */
.sp-table-wrap { overflow-x: auto; border: 1px solid var(--sp-border); border-radius: var(--sp-radius-control); }
.sp-table { width: 100%; min-width: 640px; border-collapse: collapse; color: var(--sp-text); }
.sp-table th, .sp-table td { padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--sp-border-soft); }
.sp-table th { background: #242424; color: var(--sp-muted); font-size: 11px; text-transform: uppercase; letter-spacing: .04em; }
.sp-table tbody tr:last-child td { border-bottom: 0; }
.sp-table tbody tr:hover { background: rgba(255,255,255,.025); }
.sp-status { display: inline-flex; align-items: center; gap: 7px; white-space: nowrap; }
.sp-status::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--sp-muted-2); }
.sp-status.is-ok::before { background: var(--sp-green); box-shadow: 0 0 7px rgba(49,204,75,.45); }
.sp-status.is-active::before { background: var(--sp-orange); box-shadow: 0 0 7px rgba(233,98,37,.45); }

/* --- tally list -----------------------------------------------------------
   A stack of label/value rows where the value is an on/off word in a small
   pill, e.g. a card's compact settings summary. Unlike `.sp-status`, the
   label and value sit in fixed-width columns so a stack of rows lines up. */
.sp-tally-list { display: inline-grid; gap: 3px; }
.sp-tally-list__row { align-items: center; display: grid; gap: 5px; grid-template-columns: 78px max-content; justify-content: start; }
.sp-tally-list__row small { color: var(--sp-muted); font-size: 11px; white-space: nowrap; }
.sp-tally {
  align-items: center; background: linear-gradient(180deg, #303030 0%, #242424 100%); background-color:#242424;
  border: 1px solid var(--sp-border); border-radius: 3px; color: var(--sp-muted);
  display: inline-flex; font-size: 11px; font-weight: 500; gap: 5px; padding: 2px 8px; white-space: nowrap;
}
.sp-tally::before { background: #7a7a7a; border: 1.5px solid #7a7a7a; border-radius: 50%; box-sizing: border-box; content: ""; height: 9px; width: 9px; }
.sp-tally.is-on { color: var(--sp-cyan); }
.sp-tally.is-on::before { background: var(--sp-cyan); border-color: var(--sp-cyan); box-shadow: inset 0 0 0 2px var(--sp-surface); }

/* --- segmented toggle -------------------------------------------------------
   A binary choice shown as two labelled boxes rather than a switch, for when
   both options need a visible name (e.g. "Variable Bit Rate" vs "Constant Bit
   Rate" — a bare on/off switch would leave the reader guessing which is
   which). Backed by one real (visually hidden) checkbox for state and form
   submission; toggle `.is-alt` on the container to reflect it, e.g. on the
   input's change event. */
.sp-segmented-toggle { align-items: center; display: grid; gap: 10px; grid-template-columns: minmax(150px,1fr) minmax(150px,1fr); }
.sp-segmented-toggle--readonly { pointer-events: none; }
.sp-segmented-toggle__input { height: 1px; left: 0; opacity: 0; position: absolute; width: 1px; }
.sp-segmented-toggle__option {
  align-items: center; background: #1f2122; border: 1px solid var(--sp-border-strong);
  border-radius: var(--sp-radius-control); color: var(--sp-muted); cursor: pointer; display: flex;
  font-size: 12px; font-weight: 600; height: 34px; padding: 0 10px;
  transition: background-color 140ms ease, border-color 140ms ease, color 140ms ease; white-space: nowrap;
}
.sp-segmented-toggle--readonly .sp-segmented-toggle__option { cursor: default; }
.sp-segmented-toggle__option:last-child { justify-content: flex-end; text-align: right; }
.sp-segmented-toggle:not(.is-alt) .sp-segmented-toggle__option:first-child,
.sp-segmented-toggle.is-alt .sp-segmented-toggle__option:last-child {
  background: var(--sp-surface-raised); border-color: var(--sp-orange); color: #f0f1f2;
}

/* --- tick slider ------------------------------------------------------------
   A range input styled with tick marks and an orange fill, for a coarse
   0–10-ish scale where the steps themselves are part of the reading (e.g.
   speed/quality trade-off sliders). Set `--sp-slider-fill` to the current
   percentage — the product updates it on the input event, same as the
   accessible value the browser already tracks; this is not automatic. */
.sp-slider {
  --sp-slider-fill: 50%;
  accent-color: var(--sp-orange); appearance: none; -webkit-appearance: none;
  background: repeating-linear-gradient(to right, rgba(10,11,12,.92) 0 1px, transparent 1px 10%),
    linear-gradient(to right, var(--sp-orange) 0 var(--sp-slider-fill), #3a3d3f var(--sp-slider-fill) 100%);
  border: 1px solid var(--sp-border-strong); border-radius: 999px; display: block; height: 12px; width: 100%;
}
.sp-slider::-webkit-slider-runnable-track { background: transparent; border-radius: 999px; height: 12px; }
.sp-slider::-moz-range-track {
  background-color: #3a3d3f; background-image: repeating-linear-gradient(to right, rgba(10,11,12,.92) 0 1px, transparent 1px 10%);
  border: 1px solid var(--sp-border-strong); border-radius: 999px; height: 12px;
}
.sp-slider::-moz-range-progress {
  background-color: var(--sp-orange); background-image: repeating-linear-gradient(to right, rgba(10,11,12,.92) 0 1px, transparent 1px 10%);
  border-radius: 999px; height: 12px;
}
.sp-slider::-webkit-slider-thumb {
  appearance: none; -webkit-appearance: none; background: #f5f6f7; border: 1px solid #d7d9da;
  border-radius: 999px; box-shadow: 0 1px 3px rgba(0,0,0,.45); height: 22px; margin-top: -6px; width: 30px;
}
.sp-slider::-moz-range-thumb {
  background: #f5f6f7; border: 1px solid #d7d9da; border-radius: 999px; box-shadow: 0 1px 3px rgba(0,0,0,.45); height: 20px; width: 28px;
}

/* --- live speaker indicator ----------------------------------------------
   Small speaker badge for "this is actively broadcasting right now" — e.g.
   next to a row's name while an announcement or order is in flight for it.
   Purely presentational: render the markup conditionally from whatever
   live/polling state the page already has (see DVA's Live Status trip rows,
   driven by a per-trip "is announcing" flag) — it needs no timers or JS of
   its own.
   Custom SVG, not Font Awesome, and that is a deliberate exception: the
   design only pulses the two sound-wave arcs while the speaker body stays
   solid, and a web-font glyph is one indivisible character — CSS cannot
   animate part of it. No glyph can express this, so it falls under
   "specialised visual with no interface equivalent" in Iconography. */
.sp-live-speaker { color: var(--sp-green); display: inline-flex; margin-left: 6px; vertical-align: middle; }
.sp-live-speaker svg { height: 20px; width: 20px; }
.sp-live-speaker__body { fill: currentColor; stroke: none; }
.sp-live-speaker__wave {
  animation: sp-live-speaker-pulse 1.1s ease-in-out infinite;
  fill: none; stroke: currentColor; stroke-linecap: round; stroke-width: 1.8;
}
.sp-live-speaker__wave--2 { animation-delay: .18s; }
@keyframes sp-live-speaker-pulse { 0%, 100% { opacity: .3; } 50% { opacity: 1; } }
@media (prefers-reduced-motion: reduce) {
  .sp-live-speaker__wave { animation: none; opacity: .75; }
}

/* --- filter / search bar ------------------------------------------------- */
.sp-filterbar {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  flex-wrap: wrap; padding: 10px 0;
}
.sp-filterbar__presets { display: flex; gap: 6px; flex-wrap: wrap; }
.sp-chip {
  padding: 6px 12px; font-size: 13px; cursor: pointer;
  background: transparent; color: var(--sp-text-dim);
  border: 1px solid var(--sp-border); border-radius: var(--sp-radius-control);
}
.sp-chip.is-active { color: var(--sp-cyan); border-color: var(--sp-cyan); background: rgba(0,199,238,0.10); }
.sp-filterbar__search { display: flex; flex-direction: column; gap: 4px; }
.sp-filterbar__search span { font-size: 11px; color: var(--sp-muted); }
.sp-filterbar__search input {
  background: #232323; color: var(--sp-text); font: inherit; min-width: 220px;
  border: 1px solid var(--sp-border-strong); border-radius: var(--sp-radius-control); padding: 8px 10px;
}

/* --- status pill / dot --------------------------------------------------- */
.sp-pill {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 10px; font-size: 12px; border-radius: var(--sp-radius-chip);
  border: 1px solid var(--sp-border); color: var(--sp-text-dim);
}
.sp-pill.is-ok { color: var(--sp-green); border-color: rgba(49,204,75,0.5); }
.sp-pill.is-bad { color: var(--sp-red); border-color: rgba(224,91,91,0.5); }
.sp-pill.is-active { color: var(--sp-orange); border-color: rgba(233,98,37,0.5); }
.sp-pill.is-info { color: var(--sp-cyan); border-color: rgba(0,199,238,0.5); }
/* Several pills side by side, when one value is not the whole story — a state
   and a rate, say. Wraps rather than overflowing in a narrow card. Use this
   rather than .sp-actions, which is for buttons. */
.sp-pill-row { align-items: center; display: flex; flex-wrap: wrap; gap: 8px; }

/* --- toast --------------------------------------------------------------- */
.sp-toast {
  display: flex; left: 0; padding: 0 45px; pointer-events: none; position: fixed;
  right: 0; top: var(--sp-topbar-h); z-index: 1200;
}
.sp-toast__bar {
  align-items: center; animation: sp-toast-slide-down 260ms ease-out; background: rgba(31,33,34,.97);
  border: 1px solid var(--sp-border); border-radius: 0 0 8px 8px; box-shadow: 0 10px 26px rgba(0,0,0,.4);
  color: var(--sp-text); display: flex; flex: 1; font-size: 13px; gap: 14px;
  justify-content: space-between; min-height: 30px; padding: 4px 14px; pointer-events: auto;
  transform-origin: top center;
}
.sp-toast__message { align-items: center; display: flex; gap: 10px; min-width: 0; }
.sp-toast__message > i { flex: 0 0 auto; }
.sp-toast__bar--success { background: rgba(22,34,24,.97); border-color: rgba(49,204,75,.45); color: #b9eec4; }
.sp-toast__bar--warning { background: rgba(39,31,17,.97); border-color: rgba(233,170,37,.5); color: #f4d28a; }
.sp-toast__bar--danger { background: rgba(36,22,22,.97); border-color: rgba(224,91,91,.45); color: #f6c6c6; }
.sp-toast__close {
  align-items: center; appearance: none; background: transparent; border: 0; border-radius: 4px;
  color: currentColor; cursor: pointer; display: inline-flex; flex: 0 0 24px; height: 24px;
  justify-content: center; opacity: .72; padding: 0;
}
.sp-toast__close:hover { opacity: 1; }
.sp-toast__close:focus-visible { outline: 2px solid currentColor; outline-offset: 1px; }
.sp-toast.is-leaving .sp-toast__bar { animation: sp-toast-slide-up 240ms ease-in forwards; }
@keyframes sp-toast-slide-down {
  from { clip-path: inset(0 0 100% 0); opacity: 0; transform: scaleY(0); }
  to { clip-path: inset(0); opacity: 1; transform: scaleY(1); }
}
@keyframes sp-toast-slide-up {
  from { clip-path: inset(0); opacity: 1; transform: scaleY(1); }
  to { clip-path: inset(0 0 100% 0); opacity: 0; transform: scaleY(0); }
}

/* --- mobile fold (767px) ------------------------------------------------- */
@media (max-width: 767px) {
  .sp-topbar__inner { grid-template-columns: minmax(120px,auto) minmax(0,1fr); gap:8px; padding: 0 15px; }
  .sp-topbar__brand { max-width: calc(100vw - 170px); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .sp-topbar__clock { display: none; }
  .sp-topbar__meta { min-width:0;font-size:10px;gap:7px; }
  .sp-topbar__status { display:none; }
  .sp-account { height:42px; }
  .sp-account__trigger { height:40px;max-width:120px;padding:0 9px 0 6px;font-size:13px; }
  .sp-account__trigger > .fa-user { width:22px;height:22px;font-size:12px; }
  .sp-account__trigger span { max-width:66px; }
  .sp-account__menu { position:fixed;right:62px;top:calc(var(--sp-topbar-h) + 8px); }
  .sp-toast { padding: 0 15px; top: var(--sp-topbar-h); }
  .sp-hamburger { display: inline-flex;height:42px;width:42px; }
  .sp-content { padding-left: 15px; padding-right: 15px; }
  .sp-content__well { height: auto; max-height: none; min-height: calc(100vh - var(--sp-topbar-h) - var(--sp-frame-gap) - var(--sp-footer-h) - var(--sp-frame-bottom-gap)); overflow: visible; }
  .sp-footer__nav, .footer-primary-nav { display: none; } /* nav moves to the drawer */
  .sp-footer { justify-content: stretch; }  /* footer becomes an action bar */
  .sp-footer__slot { flex: 1; }
  .footer-sticky { grid-template-columns: 1fr; }
  .footer-status-slot { display:none; }
  .footer-actions-slot { width:100%;justify-content:flex-end; }
  .footer-sticky:has(.sp-restart-required:not([hidden])) { padding-right:0; }
  .sp-change-action,.sp-restart-required { max-width:calc(100vw - 56px); }
  .sp-change-action__label,.sp-restart-required__label { overflow:hidden;text-overflow:ellipsis; }
  .sp-dialog__body { padding:28px 20px 18px; }
  .sp-dialog__icon { width:64px;height:64px;font-size:33px; }
  .sp-dialog__title { font-size:19px!important; }
  .sp-dialog__message { font-size:14px; }
  .sp-filterbar__search input { min-width: 0; width: 100%; }
  /* Stack the whole banner, as product .config-overview-header rows do, so the
     title may wrap without the action slot crowding it. */
  .sp-page-header { align-items: stretch; flex-direction: column; gap: 10px; padding: 10px 12px; }
  .sp-page-header__title h2 { white-space: normal; }
  .sp-page-header__actions { flex-wrap: wrap; }
  .sp-grid { grid-template-columns: 1fr; }
  .sp-section-title { align-items: flex-start; flex-direction: column; }
  .sp-actions .sp-btn { flex: 1 1 auto; }
}
@media (min-width: 768px) {
  .sp-drawer, .sp-nav-backdrop { display: none; }  /* desktop uses the footer nav */
}

/* --- reduced motion ------------------------------------------------------ */
@media (prefers-reduced-motion: reduce) {
  .sp-drawer, .sp-toast__bar,.sp-change-action.is-pending > i,.sp-change-action.is-confirm > i { transition:none;animation:none; }
}
/* Playback control ------------------------------------------------------- */
.sp-playback-button,
.audio-play-button {
  align-items: center;
  appearance: none;
  background: rgba(49,204,75,.08);
  border: 1px solid rgba(49,204,75,.5);
  border-radius: var(--sp-radius-control);
  color: #78df89;
  cursor: pointer;
  display: inline-flex;
  flex: 0 0 30px;
  height: 30px;
  justify-content: center;
  padding: 0;
  width: 30px;
}
.sp-playback-button > i,
.audio-play-button > i { font-size: 14px; line-height: 1; }
.sp-playback-button > [hidden],
.audio-play-button > [hidden] { display: none; }
.sp-playback-button > svg,
.audio-play-button > svg { fill: none; height: 14px; stroke: currentColor; stroke-linecap: round; stroke-linejoin: round; stroke-width: 2; width: 14px; }
.sp-playback-button:hover,
.audio-play-button:hover,
.sp-playback-button[aria-pressed="true"],
.audio-play-button[aria-pressed="true"] { background: rgba(0,199,238,.16); border-color: #00c7ee; color: #fff; }
.sp-playback-button[aria-pressed="false"]:hover,
.audio-play-button[aria-pressed="false"]:hover { background: rgba(49,204,75,.16); border-color: var(--sp-green); color: #d8ffdf; }
.sp-playback-button:focus-visible,
.audio-play-button:focus-visible { box-shadow: 0 0 0 2px rgba(0,199,238,.28); outline: 0; }
.sp-playback-button[aria-pressed="false"]:focus-visible,
.audio-play-button[aria-pressed="false"]:focus-visible { box-shadow: 0 0 0 2px rgba(49,204,75,.28); }
.sp-playback-button:active:not(:disabled),
.audio-play-button:active:not(:disabled) { transform: translateY(1px); }
.sp-playback-button:disabled,
.audio-play-button:disabled { background: #292b2c; border-color: #45484a; color: #777c7f; cursor: not-allowed; opacity: .72; }
.sp-playback-unavailable,
.audio-unavailable {
  align-items: center; background: transparent; border: 1px solid var(--sp-muted-2);
  border-radius: var(--sp-radius-control); color: var(--sp-muted); display: inline-flex; flex: 0 0 30px;
  font-size: 14px; height: 30px; justify-content: center; line-height: 1; width: 30px;
}

/* --- audio level meter ---------------------------------------------------
   A dBFS level meter. The scale is deliberately non-linear so the top of the
   range, where clipping matters, gets the most width:

       -60dB   -40     -20      -12    -6   0
         0%     25%     50%     70%   85%  100%

   The colour breakpoints sit exactly on -12 and -6, so a lane changes colour
   at the moment its level crosses those marks rather than at an arbitrary
   fraction of the bar.

   The fill's gradient is sized against the *scale*, not against its own width,
   via --meter-level: a lane at 50% therefore shows only green rather than a
   squeezed copy of the whole gradient. Set --meter-level and width to the same
   percentage. Products own the audio pipeline and update both.
   ------------------------------------------------------------------------ */
.sp-level-meter {
  --sp-meter-ok: #31df5f;
  --sp-meter-warn: #f0cf36;
  --sp-meter-clip: #ec3d3d;
  --sp-meter-peak: #74ff8b;
  display: grid; gap: 3px; min-width: 0;
}
.sp-level-meter__lane { align-items: center; display: grid; gap: 7px; grid-template-columns: 32px minmax(0,1fr); height: 11px; min-width: 0; }
/* display:grid above would otherwise beat the hidden attribute, so a lane a
   product hides for a mono source would stay on screen. */
.sp-level-meter__lane[hidden] { display: none; }
.sp-level-meter__label { color: #9a9a9a; font-size: 10px; font-weight: 500; line-height: 1; text-align: left; white-space: nowrap; }
.sp-level-meter__track {
  background: linear-gradient(to right, rgba(49,223,95,.16) 0%, rgba(49,223,95,.16) 70%, rgba(246,207,61,.18) 85%, rgba(236,61,61,.2) 100%);
  border-radius: 3px; display: block; height: 5px; min-width: 0; overflow: hidden; position: relative;
}
.sp-level-meter__fill {
  background: linear-gradient(to right, var(--sp-meter-ok) 0%, var(--sp-meter-ok) 70%, var(--sp-meter-warn) 70%, var(--sp-meter-warn) 85%, var(--sp-meter-clip) 85%, var(--sp-meter-clip) 100%);
  background-position: left top; background-repeat: no-repeat;
  background-size: calc(10000% / var(--meter-level, 100)) 100%;
  border-radius: 3px; display: block; height: 4px; min-width: 1px;
  transition: width 90ms linear;
}
/* Peak hold sits above the fill and decays on its own clock. */
.sp-level-meter__peak {
  background: var(--sp-meter-peak); border-radius: 2px; display: block; height: 7px;
  position: absolute; top: -1px; width: 2px; z-index: 2;
  transform: translateX(-1px); transition: left 140ms linear;
}
.sp-level-meter__peak--warn { background: var(--sp-meter-warn); }
.sp-level-meter__peak--clip { background: var(--sp-meter-clip); }
/* The scale is decorative: mark it aria-hidden and keep the label gutter so
   the ticks align with the tracks above. */
.sp-level-meter__scale { display: grid; gap: 7px; grid-template-columns: 32px minmax(0,1fr); margin: 3px 0 0; padding: 0; }
.sp-level-meter__scale-track { height: 8px; position: relative; }
.sp-level-meter__tick { color: rgba(255,255,255,.34); font-size: 8px; font-weight: 500; letter-spacing: .01em; line-height: 1; position: absolute; top: 0; transform: translateX(-50%); white-space: nowrap; }
/* End ticks anchor inside the track rather than centring on 0% and 100%. The
   component is standalone, so it cannot rely on page padding to absorb an
   overhanging label. */
.sp-level-meter__tick--first { left: 0; transform: none; }
.sp-level-meter__tick--last { color: rgba(255,255,255,.5); left: auto; right: 0; transform: none; }

/* When the adjacent source heading names the lane, reclaim its label gutter. */
.sp-level-meter.sp-level-meter--unlabelled .sp-level-meter__lane,
.sp-level-meter.sp-level-meter--unlabelled .sp-level-meter__scale { grid-template-columns: minmax(0,1fr); gap: 0; }
.sp-level-meter.sp-level-meter--unlabelled .sp-level-meter__label {
  position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%);
}
.sp-level-meter.sp-level-meter--unlabelled .sp-level-meter__scale > :not(.sp-level-meter__scale-track) { display: none; }

/* A framed home for a small mono/stereo meter. It deliberately shares the
   multi-track bank's surface geometry without implying dense-track layout. */
.sp-level-meter-panel {
  background: rgba(20,20,20,.22); border: 1px solid #404040; border-radius: 5px;
  min-width: 0; padding: 9px 12px 7px;
}

/* A dense bank extends the same lane primitive to sources with 8, 16 or 32
   independent tracks. The consumer supplies the direction, source name and
   channel description; Core owns only the responsive meter composition.
   `data-track-count` is a layout hint, not an audio contract. */
.sp-level-meter-banks {
  display: grid; gap: 10px; grid-template-columns: repeat(2,minmax(0,1fr)); min-width: 0; width: 100%;
}
.sp-level-meter-bank {
  background: rgba(20,20,20,.22); border: 1px solid #404040; border-radius: 5px;
  display: grid; gap: 4px; min-width: 0; padding: 7px 12px 6px;
}
.sp-level-meter-bank__header {
  align-items: center; border-bottom: 1px solid rgba(255,255,255,.09); display: grid;
  gap: 9px; grid-template-columns: 28px minmax(0,1fr); min-width: 0; padding-bottom: 5px;
}
.sp-level-meter-bank__direction {
  align-items: center; background: rgba(233,98,37,.16); border: 1px solid rgba(233,98,37,.48);
  border-radius: 4px; color: #f0a079; display: flex; font-size: 9px; height: 24px; justify-content: center;
}
.sp-level-meter-bank__title { display: flex; flex-direction: column; min-width: 0; }
.sp-level-meter-bank__title b { color: #d7d7d7; font-size: 10px; font-weight: 600; }
.sp-level-meter-bank__title small {
  color: #8f9497; font-size: 9px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.sp-level-meter-bank__lanes { display: grid; gap: 1px; min-width: 0; }
.sp-level-meter-bank .sp-level-meter__lane { grid-template-columns: 30px minmax(0,1fr); height: 8px; }
.sp-level-meter-bank .sp-level-meter__label { font-size: 9px; }
.sp-level-meter-bank__scales { display: grid; min-width: 0; }
.sp-level-meter-bank .sp-level-meter__scale { grid-template-columns: 30px minmax(0,1fr); margin-top: 1px; padding-top: 1px; }
.sp-level-meter-bank[data-track-count="16"] .sp-level-meter-bank__lanes {
  column-gap: 14px; grid-auto-flow: column; grid-template-columns: repeat(2,minmax(0,1fr)); grid-template-rows: repeat(8,8px);
}
.sp-level-meter-bank[data-track-count="16"] .sp-level-meter-bank__scales {
  column-gap: 14px; grid-template-columns: repeat(2,minmax(0,1fr));
}
.sp-level-meter-bank[data-track-count="32"] .sp-level-meter-bank__lanes {
  column-gap: 10px; grid-auto-flow: column; grid-template-columns: repeat(4,minmax(0,1fr)); grid-template-rows: repeat(8,8px);
}
/* At 32 tracks each lane column is too narrow for useful tick labels. The
   scale is omitted from markup; this guard also prevents an accidental scale
   from being shown by a consumer copying an 8/16-track bank. */
.sp-level-meter-bank[data-track-count="32"] .sp-level-meter-bank__scales,
.sp-level-meter-bank[data-track-count="32"] .sp-level-meter__scale { display: none; }

/* Optional radial overview for 8–64 independent channels. Larger sources use
   several balanced wheels, each of which stays inside that supported range. The
   portable controller generates the SVG from dBFS values: -60 converges at the
   small centre and 0 reaches the outside edge. Filled sector area, rather than
   radius, follows the canonical meter position so quiet signals retain the same
   visual definition as linear lanes. The established thresholds remain -12 / -6
   dBFS in either meter shape. */
.sp-radial-meter-options {
  display: grid; gap: 10px; grid-template-columns: repeat(auto-fit,minmax(220px,1fr)); min-width: 0; width: 100%;
}
.sp-radial-meter-panel {
  background: #242627; border: 1px solid #404040; border-radius: 5px;
  display: grid; min-width: 0; overflow: hidden;
}
.sp-radial-meter-panel__header {
  align-items: center; border-bottom: 1px solid rgba(255,255,255,.09); display: grid;
  gap: 9px; grid-template-columns: 28px minmax(0,1fr); min-width: 0; padding: 7px 10px 6px;
}
.sp-radial-meter-panel__title { display: flex; flex-direction: column; min-width: 0; }
.sp-radial-meter-panel__title b { color: #d7d7d7; font-size: 10px; font-weight: 600; }
.sp-radial-meter-panel__title small { color: #8f9497; font-size: 9px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sp-radial-meter {
  --sp-meter-ok: #31df5f; --sp-meter-warn: #f0cf36; --sp-meter-clip: #ec3d3d; --sp-meter-peak: #74ff8b;
  -webkit-touch-callout: none; -webkit-user-select: none; user-select: none;
  aspect-ratio: 1; display: grid; margin: 4px auto 0; max-width: 300px; min-width: 0; place-items: center; width: 100%;
}
.sp-radial-meter__svg { display: block; height: auto; overflow: visible; width: 100%; }
.sp-radial-meter__slices {
  filter: drop-shadow(0 1.5px 1.5px rgba(0,0,0,.42)) drop-shadow(0 -1px .8px rgba(255,255,255,.04));
}
.sp-radial-meter__slice { transition: filter 90ms linear, opacity 110ms ease-out; }
.sp-radial-meter__slice:has(.sp-radial-meter__hit:hover) { filter: brightness(1.06); }
.sp-radial-meter[data-active-channel] .sp-radial-meter__slice:not(.is-active) { opacity: .48; }
/* A persistent selection (.is-selected) marks a channel that stays chosen after
   release. It lifts its own wedge but never dims its peers, because a selection
   held for minutes must not flatten the rest of the overview the way a
   momentary press does. A press still outranks it while it is held. */
.sp-radial-meter__slice.is-selected { filter: brightness(1.12) drop-shadow(0 0 1.2px rgba(255,255,255,.12)); }
.sp-radial-meter__slice.is-active { filter: brightness(1.2) drop-shadow(0 0 1.5px rgba(255,255,255,.16)); transform: none; }
.sp-radial-meter__track { stroke: #252728; stroke-width: .55; }
.sp-radial-meter__track-stop--a-inner { stop-color: #292b2c; }
.sp-radial-meter__track-stop--a-middle { stop-color: #303233; }
.sp-radial-meter__track-stop--a-edge { stop-color: #37393a; }
.sp-radial-meter__track-stop--b-inner { stop-color: #2e3031; }
.sp-radial-meter__track-stop--b-middle { stop-color: #353738; }
.sp-radial-meter__track-stop--b-edge { stop-color: #3c3e3f; }
.sp-radial-meter__fill { stroke: #252728; stroke-width: .55; }
.sp-radial-meter__peak { fill: var(--sp-meter-peak); pointer-events: none; stroke: #252728; stroke-width: .35; }
.sp-radial-meter__peak--warn { fill: var(--sp-meter-warn); }
.sp-radial-meter__peak--clip { fill: var(--sp-meter-clip); }
.sp-radial-meter__selection { fill: none; opacity: 0; pointer-events: none; stroke: var(--sp-muted); stroke-width: 1.1; vector-effect: non-scaling-stroke; }
.sp-radial-meter__slice.is-active .sp-radial-meter__selection,
.sp-radial-meter__slice.is-selected .sp-radial-meter__selection,
.sp-radial-meter__slice:has(.sp-radial-meter__hit:focus-visible) .sp-radial-meter__selection { opacity: 1; }
.sp-radial-meter__hit { cursor: pointer; fill: transparent; outline: none; touch-action: none; }
.sp-radial-meter--tooltip .sp-radial-meter__hit,
.sp-radial-meter--tooltip-only .sp-radial-meter__hit { cursor: crosshair; }
.sp-radial-meter-tooltip {
  background: rgba(24,26,27,.97); border: 1px solid #55595b; border-radius: 4px; box-shadow: 0 3px 10px rgba(0,0,0,.42);
  box-sizing: border-box; color: #c4c7c8; display: flex; font-size: 12px; gap: 7px; line-height: 1.2;
  max-width: calc(100vw - 12px); padding: 6px 8px; pointer-events: none; position: fixed; white-space: normal; z-index: 1100;
}
.sp-radial-meter-tooltip[hidden] { display: none; }
.sp-radial-meter-tooltip strong { color: var(--sp-text-strong); font-size: inherit; min-width: 0; overflow-wrap: anywhere; }
.sp-radial-meter-tooltip span { font-variant-numeric: tabular-nums; }
.sp-radial-meter__stop--ok { stop-color: var(--sp-meter-ok); }
.sp-radial-meter__stop--warn { stop-color: var(--sp-meter-warn); }
.sp-radial-meter__stop--clip { stop-color: var(--sp-meter-clip); }
.sp-radial-meter__threshold {
  fill: none; pointer-events: none; stroke: rgba(255,255,255,.12); stroke-dasharray: 2 3; stroke-width: .7;
}
/* This ring borders the inner edge of the dark band below in both states -
   with channel numbers or without - so the band always reads as a bordered
   recess rather than a border on one side only. */
.sp-radial-meter__outline {
  fill: none; pointer-events: none; stroke: var(--sp-border); stroke-width: 1.5;
}
/* A wheel with no channel numbers still gets the same dark band the numbers
   normally sit in, so its border reads as a soft graduated recess rather
   than a bare flat line - just a narrower one, since there is no label
   content it needs to leave room for. */
.sp-radial-meter__label-band {
  fill: none; pointer-events: none; r: 123.5px; stroke: rgba(0,0,0,.16); stroke-width: 6;
}
.sp-radial-meter[data-show-channel-numbers="true"] .sp-radial-meter__label-band {
  r: 129px; stroke-width: 17;
}
.sp-radial-meter__label-outline {
  fill: none; opacity: 0; pointer-events: none; stroke: rgba(0,0,0,.38); stroke-width: .75;
}
.sp-radial-meter[data-show-channel-numbers="true"] .sp-radial-meter__label-outline { opacity: 1; }
.sp-radial-meter__channel {
  fill: var(--sp-muted-2); font-size: 9px; font-variant-numeric: tabular-nums; opacity: 0; paint-order: stroke; pointer-events: none;
  stroke: #242627; stroke-width: 2px; text-anchor: middle;
}
.sp-radial-meter[data-show-channel-numbers="true"] .sp-radial-meter__channel { opacity: 1; }
.sp-radial-meter__slice.has-signal .sp-radial-meter__channel { fill: var(--sp-meter-ok); }
.sp-radial-meter[data-density="dense"] .sp-radial-meter__channel { font-size: 8px; }
.sp-radial-meter[data-label-density="compact"] .sp-radial-meter__channel {
  font-size: 6px; letter-spacing: -.12px;
}
/* A persistently selected channel wears the selected rim treatment, so an
   operator staying on one channel can find it at a glance. Visibility still
   follows [data-show-channel-numbers] only, so selecting a channel on a wheel
   with numbers hidden reveals nothing on the rim and the centre card stays the
   sole readout - never force opacity here. */
.sp-radial-meter__slice.is-selected .sp-radial-meter__channel {
  fill: var(--sp-text-strong); font-weight: 700; stroke-width: 2.6px;
}
.sp-radial-meter__centre { fill: #111; stroke: #565656; stroke-width: .8; }
.sp-radial-meter__active-readout {
  fill: rgba(20,22,23,.94); opacity: 0; pointer-events: none; stroke: rgba(183,187,189,.58); stroke-width: .8;
  transition: opacity 80ms linear;
}
.sp-radial-meter[data-active-channel] .sp-radial-meter__active-readout { opacity: 1; }
.sp-radial-meter__active-channel {
  fill: var(--sp-text-strong); font-size: 18px; font-variant-numeric: tabular-nums; font-weight: 700; paint-order: stroke;
  pointer-events: none; stroke: #111; stroke-width: 4px; text-anchor: middle;
}
.sp-radial-meter__active-value {
  fill: #c1c4c5; font-size: 11px; font-variant-numeric: tabular-nums; font-weight: 600; paint-order: stroke;
  pointer-events: none; stroke: #111; stroke-width: 3px; text-anchor: middle;
}
/* Grip mode: an oversized handle riding just outside the label ring, for
   products where grabbing a thin wedge precisely is the friction point. It
   never covers a channel number or wedge - see the JS comment on gripMode. */
.sp-radial-meter__grip { transition: opacity 120ms ease-out; }
.sp-radial-meter__grip-ring {
  fill: none; stroke: rgba(255,255,255,.28); stroke-dasharray: 2.4 2.4; stroke-width: .9;
}
.sp-radial-meter__grip-body { fill: #14181a; }
.sp-radial-meter__grip-lens { fill: #20242a; }
.sp-radial-meter__grip-led { fill: none; stroke-linecap: round; stroke-width: 2.6; }
.sp-radial-meter__grip-pointer { fill: var(--sp-text-strong); pointer-events: none; }
.sp-radial-meter__grip-hit { cursor: grab; fill: transparent; touch-action: none; }
.sp-radial-meter__grip-hit:active { cursor: grabbing; }

.sp-radial-meter-panel__scale {
  border-top: 1px solid rgba(255,255,255,.09); color: #858585; display: flex; font-size: 8px;
  justify-content: space-between; padding: 6px 10px;
}
.sp-radial-meter-panel__scale span:last-child { color: rgba(255,255,255,.5); }

@media (max-width: 900px) {
  .sp-level-meter-banks { grid-template-columns: minmax(0,1fr); }
}

@media (prefers-reduced-motion: reduce) {
  .sp-level-meter__fill,
  .sp-level-meter__peak,
  .sp-radial-meter__slice,
  .sp-radial-meter__active-readout,
  .sp-radial-meter__grip { transition: none; }
}

/* ---------------------------------------------------------------------------
   Directory picker — an inline results panel that drops under a text field
   when a "search the directory" action fires (LDAP base-DN and group lookup,
   or any similar remote-directory search). Hidden by default; a consumer's
   script toggles the [hidden] attribute and fills the body with either a
   single .sp-directory-picker__message (loading, empty, error) or a stack of
   .sp-directory-picker__result buttons.

   Sits in normal document flow directly under its field. A product spans it
   across a wider field grid the same way it would any other full-width
   field — e.g. the existing .system-field-wide utility — rather than this
   component assuming a grid ancestor of its own.
   ------------------------------------------------------------------------ */
.sp-directory-picker {
  background: #202223;
  border: 1px solid #454849;
  border-radius: 6px;
  font-size: 11px;
  margin-top: 6px;
  overflow: hidden;
  width: 100%;
}
.sp-directory-picker[hidden] { display: none; }
.sp-directory-picker__header {
  align-items: center;
  border-bottom: 1px solid #3b3e40;
  color: #92979a;
  display: flex;
  font-size: 10px;
  font-weight: 600;
  justify-content: space-between;
  letter-spacing: .05em;
  padding: 7px 10px;
  text-transform: uppercase;
}
.sp-directory-picker__close {
  background: transparent; border: 0; color: #92979a; cursor: pointer;
  font: inherit; font-size: 14px; line-height: 1; padding: 2px 4px;
}
.sp-directory-picker__close:hover,
.sp-directory-picker__close:focus-visible { color: #e1e4e5; outline: 0; }
.sp-directory-picker__body { max-height: 190px; overflow-y: auto; }
.sp-directory-picker__message { color: #92979a; margin: 0; padding: 10px; }
.sp-directory-picker--error .sp-directory-picker__message { color: var(--sp-red); }
.sp-directory-picker__result {
  background: #2b2d2e; border: 1px solid transparent; border-bottom: 1px solid #343738;
  color: inherit; cursor: pointer; display: block; font: inherit;
  padding: 7px 10px; text-align: left; width: 100%;
}
.sp-directory-picker__result:last-child { border-bottom-color: transparent; }
.sp-directory-picker__result:hover,
.sp-directory-picker__result:focus-visible { background: #343738; border-color: #575b5d; outline: 0; }
.sp-directory-picker__result strong { color: #e1e4e5; display: block; font-weight: 600; }
.sp-directory-picker__result span { color: #92979a; display: block; font-size: 10px; margin-top: 1px; }

/* Band hooks share the instrument accent; selection and focus remain separate. */
[data-sp-eq-band="1"] { --sp-eq-band-colour: var(--sp-eq-band-1); }
[data-sp-eq-band="2"] { --sp-eq-band-colour: var(--sp-eq-band-2); }
[data-sp-eq-band="3"] { --sp-eq-band-colour: var(--sp-eq-band-3); }
[data-sp-eq-band="4"] { --sp-eq-band-colour: var(--sp-eq-band-4); }
