/* glen-design: v1 */
/* ============================================================================
   Signals: the Watch (a monitoring dial where every rule is a sensor and every
   open alert sits on its rule, nearer the core the more serious, sized by the
   money it names), the alert stream with one next step each, how alerts reach
   people, and the rules as plain sentences. Tokens only; both appearances.
   ========================================================================== */

.sg{ display: grid; gap: var(--s6); }
.sg-head-act{ display: flex; gap: var(--s2); flex-wrap: wrap; }

/* meaning, one colour each: red for critical and high, amber for medium,
   grey for low, green for good news, the accent for information */
:is(.sg-node, .sg-glyph, .sg-alert).sev-critical{ --sg-c: var(--bad); }
:is(.sg-node, .sg-glyph, .sg-alert).sev-high{ --sg-c: color-mix(in oklab, var(--bad) 80%, var(--surface-1)); }
:is(.sg-node, .sg-glyph, .sg-alert).sev-medium{ --sg-c: var(--warn); }
:is(.sg-node, .sg-glyph, .sg-alert).sev-low{ --sg-c: var(--ink-faint); }
:is(.sg-node, .sg-glyph, .sg-alert).sev-good{ --sg-c: var(--ok); }
:is(.sg-node, .sg-glyph, .sg-alert).sev-info{ --sg-c: var(--accent); }
.sg-t-bad{ color: var(--bad); } .sg-t-warn{ color: var(--warn); } .sg-t-quiet{ color: var(--ink-dim); }
.sg-t-ok{ color: var(--ok); } .sg-t-info{ color: var(--accent); }

/* --- THE HERO: the Watch beside its readout ----------------------------- */
.sg-hero{ display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: var(--s6); padding: var(--s5) var(--s6) var(--s6); align-items: start; }
.sg-stage{ display: grid; gap: var(--s3); min-width: 0; }
.sg-hero-h p{ margin: var(--s2) 0 0; font-size: var(--fs-base); color: var(--ink-dim); max-width: 60ch; }
.sg-hero-h b{ color: var(--ink); font-weight: 600; }
.sg-watch-host{ min-width: 0; }
.sg-watch{ position: relative; container-type: inline-size; width: 100%; max-width: 820px; margin: 0 auto; }
.sg-watch-bg{ position: absolute; inset: 0; pointer-events: none; opacity: .8; }
.sg-dial{ position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }

/* the dial: bands tinted by the severity they hold, a rim with instrument ticks */
.sg-band{ fill: none; stroke-width: 1.25; }
.sg-band.b-critical{ stroke: color-mix(in oklab, var(--bad) 42%, transparent); }
.sg-band.b-high{ stroke: color-mix(in oklab, var(--bad) 24%, transparent); }
.sg-band.b-medium{ stroke: color-mix(in oklab, var(--warn) 30%, transparent); }
.sg-band.b-low{ stroke: var(--line-2); }
.sg-zone{ fill: none; stroke: var(--bad-tint); stroke-width: 40; opacity: 0; transition: opacity var(--dur-slow) var(--ease-out); }
.sg-watch.has-critical .sg-zone{ opacity: 1; }
.sg-rim{ fill: none; stroke: var(--line-2); stroke-width: 1.5; }
.sg-ticks{ fill: none; stroke: var(--ink-faint); stroke-width: 8; opacity: .3; }
.sg-spoke{ stroke: var(--line-2); stroke-width: 1; stroke-dasharray: 2 6; vector-effect: non-scaling-stroke; }
.sg-spoke.is-off{ opacity: .35; }
.sg-link{ stroke-width: 2; stroke-linecap: round; opacity: .55; vector-effect: non-scaling-stroke; }
.sg-link.sg-t-bad{ stroke: var(--bad); } .sg-link.sg-t-warn{ stroke: var(--warn); } .sg-link.sg-t-quiet{ stroke: var(--ink-faint); }

/* the sweep: the one travelling accent. It is the rule check itself; the JS
   reads its angle and lights each sensor as the leading edge passes it */
.sg-sweep{
  position: absolute; z-index: 1; pointer-events: none; border-radius: 50%;
  left: calc((var(--x) - var(--d) / 2) * 1cqw); top: calc((var(--y) - var(--d) / 2) * 1cqw);
  width: calc(var(--d) * 1cqw); aspect-ratio: 1;
  background: conic-gradient(from 0deg, transparent 0deg 292deg, var(--tint) 330deg, var(--glow) 359deg, transparent 360deg);
}
.sg-sweep::after{ content: ''; position: absolute; left: 50%; top: 0; width: 2px; height: 50%; transform: translateX(-50%);
  background: linear-gradient(to top, transparent 30%, var(--accent)); opacity: .7; }

/* band labels: a ruler up the top axis, left of centre */
.sg-bandl{
  position: absolute; z-index: 1; left: calc(var(--x) * 1cqw - var(--s2)); top: calc(var(--y) * 1cqw); transform: translate(-100%, -50%);
  font: 500 var(--fs-micro)/1 var(--font-mono); letter-spacing: .06em; text-transform: uppercase; color: var(--ink-faint);
  padding: var(--s1) var(--s2); border-radius: var(--r-pill); background: var(--surface-1); white-space: nowrap; pointer-events: none;
}

/* sensors: one per rule, on the rim */
.sg-sensor{
  position: absolute; left: 0; top: 0; z-index: 3; width: 16px; height: 16px; padding: 0; border: 0; background: none; cursor: pointer; border-radius: 50%;
  transform: translate(calc(var(--x) * 1cqw), calc(var(--y) * 1cqw)) translate(-50%, -50%);
  transition: transform var(--dur-drawer) var(--ease-in-out), opacity var(--dur-slow) var(--ease-out);
}
.sg-sd{ position: absolute; inset: 3px; border-radius: 50%; background: var(--surface-1); box-shadow: 0 0 0 1.5px var(--line-2), var(--shadow-1);
  transition: scale var(--dur-base) var(--ease-out), background var(--dur-base) ease; }
.sg-sensor.is-hot .sg-sd{ inset: 2px; }
.sg-sensor.hot-bad .sg-sd{ background: var(--bad); box-shadow: 0 0 0 3px var(--bad-tint); }
.sg-sensor.hot-warn .sg-sd{ background: var(--warn); box-shadow: 0 0 0 3px var(--warn-tint); }
.sg-sensor.hot-quiet .sg-sd{ background: var(--ink-faint); box-shadow: 0 0 0 3px var(--surface-3); }
.sg-sensor.is-off .sg-sd{ background: var(--surface-2); box-shadow: 0 0 0 1.5px var(--line); }
.sg-ping{ position: absolute; inset: 0; border-radius: 50%; box-shadow: 0 0 0 2px var(--accent), 0 0 12px var(--glow); opacity: 0; pointer-events: none; }
.sg-sl{
  position: absolute; width: max-content; max-width: 128px; font: 600 var(--fs-micro)/1.25 var(--font-body); color: var(--ink-dim);
  white-space: normal; pointer-events: none; transition: color var(--dur-fast) ease;
}
.sg-sl small{ display: block; font-weight: 400; font-size: var(--fs-micro); color: var(--ink-faint); }
.sg-sensor.is-hot .sg-sl{ color: var(--ink); }
.sg-sensor.is-off .sg-sl{ color: var(--ink-faint); }
.sg-sensor.side-r .sg-sl{ left: calc(100% + var(--s2)); top: 50%; transform: translateY(-50%); text-align: left; }
.sg-sensor.side-l .sg-sl{ right: calc(100% + var(--s2)); top: 50%; transform: translateY(-50%); text-align: right; }
.sg-sensor.side-t .sg-sl{ bottom: calc(100% + var(--s2)); left: 50%; transform: translateX(-50%); text-align: center; }
.sg-sensor.side-b .sg-sl{ top: calc(100% + var(--s2)); left: 50%; transform: translateX(-50%); text-align: center; }

/* alert nodes: sized by money through scale, so a change of size is a
   transform; the disc inside carries hover, entrance and the critical halo */
.sg-node{
  position: absolute; left: 0; top: 0; z-index: 2; width: calc(var(--dmax) * 1cqw); aspect-ratio: 1; padding: 0; border: 0; background: none; border-radius: 50%; cursor: pointer;
  transform: translate(calc(var(--x) * 1cqw), calc(var(--y) * 1cqw)) translate(-50%, -50%) scale(var(--k, 1));
  transition: transform var(--dur-drawer) var(--ease-in-out), opacity var(--dur-base) var(--ease-out);
}
.sg-disc{
  position: absolute; inset: 0; display: block; border-radius: 50%;
  background: radial-gradient(circle at 36% 30%, color-mix(in oklab, var(--sg-c) 62%, var(--hot)), var(--sg-c) 62%);
  box-shadow: 0 0 0 calc(2px / var(--k, 1)) var(--surface-1), 0 calc(4px / var(--k, 1)) calc(16px / var(--k, 1)) color-mix(in oklab, var(--sg-c) 38%, transparent);
  transition: scale var(--dur-base) var(--ease-out), filter var(--dur-base) ease;
}
/* the critical one is still and loud: two fixed halos, a steady glow, never a blink */
.sg-halo{ position: absolute; inset: -30%; border-radius: 50%; border: calc(1.5px / var(--k, 1)) solid color-mix(in oklab, var(--bad) 48%, transparent); pointer-events: none; }
.sg-halo--2{ inset: -66%; border-color: color-mix(in oklab, var(--bad) 22%, transparent); }
.sg-node.sev-critical .sg-disc{ box-shadow: 0 0 0 calc(2px / var(--k, 1)) var(--surface-1), 0 0 calc(28px / var(--k, 1)) color-mix(in oklab, var(--bad) 55%, transparent); }
.sg-ripple{ position: absolute; inset: 0; border-radius: 50%; box-shadow: 0 0 0 calc(2px / var(--k, 1)) var(--sg-c); pointer-events: none; opacity: 0; }
.sg-node.is-dim, .sg-nl.is-dim{ opacity: .2; }
.sg-node.is-gone, .sg-nl.is-gone{ opacity: 0; pointer-events: none; }

.sg-nl{
  position: absolute; left: 0; top: 0; z-index: 3; pointer-events: none; white-space: nowrap;
  transform: translate(calc(var(--x) * 1cqw), calc(var(--y) * 1cqw)) translateY(-50%);
  font: 500 var(--fs-micro)/1 var(--font-mono); color: var(--ink); padding: var(--s1) var(--s2); border-radius: var(--r-pill);
  background: var(--mat-float); -webkit-backdrop-filter: var(--mat-blur); backdrop-filter: var(--mat-blur); box-shadow: var(--ring);
  transition: transform var(--dur-drawer) var(--ease-in-out), opacity var(--dur-base) var(--ease-out);
}
.sg-nl.is-left{ transform: translate(calc(var(--x) * 1cqw), calc(var(--y) * 1cqw)) translate(-100%, -50%); }
.sg-nl.is-crit{ color: var(--on-accent); background: var(--bad); box-shadow: 0 4px 14px var(--bad-tint); }

/* the core: what is at stake, with the assistant that watches it */
.sg-core{
  position: absolute; z-index: 4; left: calc((var(--x) - var(--d) / 2) * 1cqw); top: calc((var(--y) - var(--d) / 2) * 1cqw);
  width: calc(var(--d) * 1cqw); aspect-ratio: 1; border-radius: 50%; display: grid; place-content: center; justify-items: center; gap: var(--s1); cursor: help;
  background: radial-gradient(circle at 50% 28%, var(--surface-1), var(--surface-2));
  box-shadow: var(--shadow-2), 0 0 0 1px var(--line-2), 0 0 0 var(--s2) var(--tint);
  transition: box-shadow var(--dur-base) var(--ease-out), scale var(--dur-reveal) var(--ease-out), opacity var(--dur-reveal) var(--ease-out);
}
.sg-core .fig{ font-size: var(--fs-xl); }
.sg-core small{ font-size: var(--fs-micro); font-weight: 600; color: var(--ink-dim); }
.sg-core:focus-visible{ outline-offset: var(--s1); border-radius: 50%; }

.sg-tip{
  position: absolute; left: 0; top: 0; z-index: 6; width: max-content; max-width: 280px; display: grid; gap: var(--s1); justify-items: start;
  padding: var(--s3); border-radius: var(--r); pointer-events: none; opacity: 0;
  background: var(--mat-float); -webkit-backdrop-filter: var(--mat-blur); backdrop-filter: var(--mat-blur); box-shadow: var(--shadow-2), var(--ring);
  transform: translate(calc(var(--x) * 1cqw + var(--nx, 0px)), calc(var(--y) * 1cqw)) translate(-50%, -100%) translateY(var(--s1));
  transition: opacity var(--dur-fast) ease, transform var(--dur-fast) var(--ease-out);
}
.sg-tip.in{ opacity: 1; transform: translate(calc(var(--x) * 1cqw + var(--nx, 0px)), calc(var(--y) * 1cqw)) translate(-50%, -100%); }
.sg-tip.is-below{ transform: translate(calc(var(--x) * 1cqw + var(--nx, 0px)), calc(var(--y) * 1cqw)) translate(-50%, 0) translateY(calc(-1 * var(--s1))); }
.sg-tip.is-below.in{ transform: translate(calc(var(--x) * 1cqw + var(--nx, 0px)), calc(var(--y) * 1cqw)) translate(-50%, 0); }
.sg-tip b{ font-size: var(--fs-sm); line-height: 1.35; }
.sg-tip .num{ font-size: var(--fs-sm); }
.sg-tip small{ font-size: var(--fs-micro); color: var(--ink-dim); line-height: 1.4; }

/* the readout */
.sg-read{ display: grid; gap: var(--s4); align-content: start; min-width: 0; }
.sg-check{ display: flex; gap: var(--s3); align-items: flex-start; padding: var(--s3) var(--s4); border-radius: var(--r); background: var(--surface-2); box-shadow: inset 0 0 0 1px var(--line); }
.sg-check .dot{ margin-top: var(--s2); background: var(--accent); }
.sg-check-t{ display: grid; min-width: 0; }
.sg-check-t small{ font-size: var(--fs-micro); font-weight: 600; color: var(--ink-faint); }
.sg-check-t b{ font-size: var(--fs-base); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sg-check-t .meta{ white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sg-kpis{ display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--s2); }
.sg-kpi{ display: grid; gap: var(--s1); align-content: start; padding: var(--s3); border-radius: var(--r-sm); background: var(--surface-2); box-shadow: inset 0 0 0 1px var(--line);
  transition: transform var(--dur-base) var(--ease-out), box-shadow var(--dur-base) var(--ease-out); }
.sg-kpi .fig{ font-size: var(--fs-2xl); }
.sg-kpi small{ font-size: var(--fs-sm); line-height: 1.25; color: var(--ink-dim); }
.sg-kpi.is-alert{ background: var(--bad-tint); box-shadow: none; }
.sg-kpi.is-alert .fig{ color: var(--bad); }

.sg-legend{ display: grid; gap: var(--s1); }
.sg-leg-h, .sg-leg{ display: grid; grid-template-columns: 20px minmax(0, 1fr) 40px 92px; align-items: center; gap: var(--s2); }
.sg-leg-h{ padding: 0 var(--s3) var(--s1); font-size: var(--fs-micro); font-weight: 600; color: var(--ink-faint); }
.sg-leg-h span:first-child{ grid-column: 1 / 3; }
.sg-leg-h span:nth-child(n+2){ text-align: right; }
.sg-leg{ min-height: 40px; padding: 0 var(--s3); border: 0; border-radius: var(--r-sm); background: transparent; color: var(--ink); font: inherit; text-align: left; cursor: pointer;
  transition: background var(--dur-fast) ease, transform var(--dur-base) var(--ease-out); }
.sg-leg-l{ font-size: var(--fs-sm); font-weight: 600; }
.sg-leg b{ font-size: var(--fs-base); font-weight: 500; text-align: right; }
.sg-leg-m{ font-size: var(--fs-sm); color: var(--ink-dim); text-align: right; }
.sg-leg.is-zero{ color: var(--ink-faint); }
.sg-leg.is-zero .sg-glyph{ opacity: .45; }
.sg-glyph{ position: relative; width: 12px; height: 12px; border-radius: 50%; justify-self: center; background: var(--sg-c); flex: none; transition: scale var(--dur-base) var(--ease-out); }
.sg-glyph.sev-critical{ box-shadow: 0 0 0 3px var(--surface-1), 0 0 0 4.5px color-mix(in oklab, var(--bad) 55%, transparent); }
.sg-ask{ display: flex; flex-wrap: wrap; gap: var(--s2); }
.sg-ask .chip{ min-height: 32px; white-space: normal; text-align: left; line-height: 1.3; padding: var(--s1) var(--s3); }

/* --- THE STREAM ---------------------------------------------------------- */
.sg-grid{ display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: var(--s5); align-items: start; }
.sg-main{ display: grid; gap: var(--s6); min-width: 0; }
.sg-side{ display: grid; gap: var(--s4); min-width: 0; }
.sg-sec-h{ display: flex; align-items: flex-end; justify-content: space-between; gap: var(--s3); margin-bottom: var(--s3); }
.sg-sec-h h2{ font-size: var(--fs-xl); }
.sg-sec-h .meta{ margin: var(--s1) 0 0; }
.sg-count{ min-width: 36px; height: 32px; padding: 0 var(--s3); border-radius: var(--r-pill); display: grid; place-items: center; flex: none;
  font-size: var(--fs-base); background: var(--surface-3); color: var(--ink-dim); }
.sg-count.sg-t-bad{ background: var(--bad-tint); color: var(--bad); }
.sg-list{ display: grid; gap: var(--s3); }

.sg-alert{ display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: var(--s5); align-items: center; padding: var(--s4) var(--s5) var(--s4) var(--s6); cursor: pointer; overflow: hidden; }
.sg-alert::before{ content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: var(--sg-c); }
.sg-alert.sev-critical{
  background-image: radial-gradient(360px circle at var(--mx, 50%) var(--my, 50%), var(--spot), transparent 62%), linear-gradient(90deg, var(--bad-tint), transparent 60%);
  box-shadow: var(--shadow-1), 0 0 0 1px color-mix(in oklab, var(--bad) 42%, transparent), 0 12px 36px color-mix(in oklab, var(--bad) 14%, transparent);
}
.sg-alert.sev-high{ background-image: radial-gradient(360px circle at var(--mx, 50%) var(--my, 50%), var(--spot), transparent 62%), linear-gradient(90deg, color-mix(in oklab, var(--bad-tint) 55%, transparent), transparent 40%); }
.sg-a-body{ min-width: 0; }
.sg-a-meta{ display: flex; flex-wrap: wrap; align-items: center; gap: var(--s1) var(--s3); margin-bottom: var(--s2); font-size: var(--fs-sm); color: var(--ink-dim); }
.sg-a-src{ display: inline-flex; align-items: center; gap: var(--s1); }
.sg-a-src .ic{ width: 14px; height: 14px; color: var(--ink-faint); }
.sg-a-ago{ color: var(--ink-faint); }
.sg-a-t{ margin: 0 0 var(--s1); font: 600 var(--fs-lg)/1.3 var(--font-body); letter-spacing: -.01em; }
.sg-a-why{ margin: 0; font-size: var(--fs-base); line-height: 1.45; color: var(--ink-dim); max-width: 64ch; }
.sg-a-side{ display: grid; justify-items: end; gap: var(--s3); min-width: 180px; }
.sg-a-money{ display: grid; justify-items: end; gap: var(--s1); text-align: right; }
.sg-a-money .fig{ font-size: var(--fs-xl); }
.sg-a-money small{ font-size: var(--fs-sm); color: var(--ink-dim); max-width: 24ch; }
.sg-a-money.is-none small{ color: var(--ink-faint); }
.sg-alert.sev-critical .sg-a-money .fig{ color: var(--bad); }
.sg-a-body, .sg-a-side{ transition: opacity var(--dur-base) ease; }
.sg-alert.is-handled .sg-a-body, .sg-alert.is-handled .sg-a-side{ opacity: .32; }
.sg-alert.is-leaving{ opacity: 0; transform: scale(.98); transition: opacity var(--dur-base) var(--ease-out), transform var(--dur-base) var(--ease-out); }

/* the stamp: the demo step, done */
.sg-stamp{
  position: absolute; right: var(--s6); top: 50%; z-index: 2; translate: 0 -50%; rotate: -5deg; pointer-events: none;
  display: inline-flex; align-items: center; gap: var(--s2); padding: var(--s2) var(--s4); border-radius: var(--r-sm);
  background: var(--surface-1); color: var(--ok); box-shadow: 0 0 0 2px var(--ok), var(--shadow-2);
  font: 700 var(--fs-base)/1 var(--font-display); letter-spacing: .01em; white-space: nowrap;
}
.sg-stamp .ic{ width: 18px; height: 18px; }

/* a highlight that fades: new alerts, new rules, and arriving with focus */
:is(.sg-alert, .sg-calm, .sg-rule, .sg-done)::after{ content: ''; position: absolute; inset: 0; border-radius: inherit; pointer-events: none; opacity: 0;
  background: var(--tint); box-shadow: inset 0 0 0 2px var(--accent), 0 0 28px var(--glow); }

.sg-done{ position: relative; display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: var(--s3); padding: var(--s3) var(--s4);
  border-radius: var(--r); background: var(--surface-1); box-shadow: var(--ring); transition: transform var(--dur-base) var(--ease-out), box-shadow var(--dur-base) var(--ease-out); }
.sg-done-ic{ width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; background: var(--ok-tint); color: var(--ok); }
.sg-done-ic .ic{ width: 16px; height: 16px; }
.sg-done-t{ display: grid; min-width: 0; }
.sg-done-t b{ font-size: var(--fs-base); font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sg-done-t small{ font-size: var(--fs-sm); color: var(--ink-dim); }
.sg-none{ display: flex; align-items: center; gap: var(--s2); margin: 0; padding: var(--s4); border-radius: var(--r); font-size: var(--fs-sm); color: var(--ink-faint);
  outline: 1px dashed var(--line-2); outline-offset: -1px; max-width: none; }
.sg-none .ic{ width: 16px; height: 16px; }
.sg-empty{ display: grid; justify-items: center; gap: var(--s2); padding: var(--s7) var(--s5); text-align: center; border-radius: var(--r-lg);
  background: var(--surface-1); box-shadow: var(--ring); }
.sg-empty .ic{ width: 32px; height: 32px; color: var(--ok); }
.sg-empty b{ font: 700 var(--fs-xl)/1.2 var(--font-display); letter-spacing: -.02em; }
.sg-empty .meta{ max-width: 44ch; }

.sg-calm{ display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: var(--s4); align-items: center; padding: var(--s4) var(--s5); cursor: pointer; }
.sg-calm-ic{ width: 36px; height: 36px; border-radius: var(--r-sm); display: grid; place-items: center; background: var(--tint); color: var(--accent); }
.sg-calm-ic .ic{ width: 18px; height: 18px; }
.sg-calm.is-good .sg-calm-ic{ background: var(--ok-tint); color: var(--ok); }
.sg-calm-b{ min-width: 0; }
.sg-calm .sg-a-t{ font-size: var(--fs-base); }
.sg-calm .sg-a-why{ font-size: var(--fs-sm); }

/* --- NOTIFICATIONS ------------------------------------------------------ */
.sg-chans{ display: grid; gap: var(--s1); }
.sg-chan{ display: grid; grid-template-columns: 32px minmax(0, 1fr) 40px 40px; align-items: center; gap: var(--s3); padding: var(--s2); border-radius: var(--r-sm);
  transition: background var(--dur-fast) ease, transform var(--dur-base) var(--ease-out); }
.sg-chan-h{ padding-top: 0; padding-bottom: 0; font-size: var(--fs-micro); font-weight: 600; color: var(--ink-faint); }
.sg-chan-h span:nth-child(n+3){ text-align: right; }
.sg-chan-ic{ width: 32px; height: 32px; border-radius: var(--r-sm); display: grid; place-items: center; background: var(--tint); color: var(--accent); transition: scale var(--dur-base) var(--ease-out); }
.sg-chan-ic .ic{ width: 16px; height: 16px; }
.sg-chan.is-idle .sg-chan-ic{ background: var(--surface-3); color: var(--ink-faint); }
.sg-chan-t{ display: grid; min-width: 0; line-height: 1.3; }
.sg-chan-t b{ font-size: var(--fs-sm); }
.sg-chan-t small{ font-size: var(--fs-micro); color: var(--ink-dim); }
.sg-chan > b.num{ font-size: var(--fs-base); font-weight: 500; text-align: right; }
.sg-chan.is-idle > b.num{ color: var(--ink-faint); }
.sg-sub{ margin: var(--s5) 0 var(--s2); font: 600 var(--fs-sm)/1.3 var(--font-body); color: var(--ink-dim); letter-spacing: 0; }
.sg-log{ list-style: none; margin: 0; padding: 0; display: grid; gap: var(--s1); }
.sg-log-i{ display: grid; grid-template-columns: 28px minmax(0, 1fr); gap: var(--s1) var(--s3); padding: var(--s2); border-radius: var(--r-sm);
  transition: background var(--dur-fast) ease, transform var(--dur-base) var(--ease-out); }
.sg-log-ic{ grid-row: span 2; width: 28px; height: 28px; border-radius: var(--r-sm); display: grid; place-items: center; background: var(--surface-2); color: var(--ink-dim);
  transition: scale var(--dur-base) var(--ease-out); }
.sg-log-ic .ic{ width: 14px; height: 14px; }
.sg-log-t{ display: grid; min-width: 0; line-height: 1.3; }
.sg-log-t b{ font-size: var(--fs-sm); }
.sg-log-t small{ font-size: var(--fs-micro); color: var(--ink-dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sg-log-m{ grid-column: 2; display: flex; flex-wrap: wrap; align-items: center; gap: var(--s2); }
.sg-log-m small{ font-size: var(--fs-micro); color: var(--ink-faint); }
.sg-log-m small:empty{ display: none; }
.sg-log-m .chip .ic{ width: 12px; height: 12px; }
.sg-queued{ display: flex; gap: var(--s2); align-items: flex-start; margin: var(--s3) 0 0; font-size: var(--fs-sm); color: var(--ink-dim); }
.sg-queued .ic{ width: 16px; height: 16px; margin-top: var(--s1); color: var(--ink-faint); }

.sg-routes{ display: grid; gap: var(--s1); }
.sg-route{ display: grid; grid-template-columns: 20px minmax(0, 1fr) auto; align-items: start; gap: var(--s3); padding: var(--s3); border-radius: var(--r-sm);
  transition: background var(--dur-fast) ease, transform var(--dur-base) var(--ease-out); }
.sg-route .sg-glyph{ margin-top: var(--s1); }
.sg-route-t{ display: grid; line-height: 1.35; min-width: 0; }
.sg-route-t b{ font-size: var(--fs-sm); }
.sg-route-t span{ font-size: var(--fs-sm); }
.sg-route-t small{ font-size: var(--fs-micro); color: var(--ink-dim); }
.sg-route.is-you{ background: var(--tint); }
.sg-you{ padding: var(--s1) var(--s2); border-radius: var(--r-pill); font: 600 var(--fs-micro)/1 var(--font-body); color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }

/* --- RULES ------------------------------------------------------------- */
.sg-rules{ display: grid; gap: var(--s1); }
.sg-rules-grid{ display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: var(--s4); }
.sg-rule{ display: flex; flex-direction: column; gap: var(--s3); cursor: pointer; }
.sg-rule-top{ display: flex; align-items: center; gap: var(--s2); }
.sg-rule-top .switch{ margin-left: auto; }
.sg-rule-ch{ display: inline-flex; align-items: center; gap: var(--s1); font-size: var(--fs-sm); color: var(--ink-dim); }
.sg-rule-ch .ic{ width: 14px; height: 14px; }
.sg-rule h3{ font: 600 var(--fs-lg)/1.3 var(--font-body); letter-spacing: -.01em; }
.sg-sentence{ margin: 0; font-size: var(--fs-base); line-height: 1.75; color: var(--ink-dim); max-width: none; }
.sg-sentence em{ font: 500 var(--fs-micro)/1 var(--font-mono); font-style: normal; text-transform: uppercase; letter-spacing: .06em; white-space: nowrap;
  color: var(--accent); background: var(--tint); padding: var(--s1) var(--s2); border-radius: var(--r-sm); margin-right: var(--s1); }
.sg-rule-foot{ margin-top: auto; display: flex; flex-wrap: wrap; align-items: center; gap: var(--s2) var(--s4); padding-top: var(--s3); border-top: 1px solid var(--line);
  font-size: var(--fs-sm); color: var(--ink-dim); }
.sg-rule-foot b{ color: var(--ink); font-weight: 500; }
.sg-rule-to{ display: inline-flex; align-items: center; gap: var(--s2); margin-left: auto; }
.sg-rule-to .avatar{ width: 24px; height: 24px; }
.sg-rule > :not(.sg-rule-top), .sg-rule-top > :not(.switch){ transition: opacity var(--dur-base) ease; }
.sg-rule.is-off > :not(.sg-rule-top), .sg-rule.is-off .sg-rule-top > :not(.switch){ opacity: .45; }

/* --- LAYERS: the assign popover and the drawers ------------------------- */
.sg-pop{
  position: absolute; pointer-events: auto; max-height: 60vh; overflow: auto; overscroll-behavior: contain; padding: var(--s2);
  border-radius: var(--r-lg); background: var(--surface-1); box-shadow: var(--shadow-3), var(--ring);
  transform-origin: top right; transform: scale(.96) translateY(calc(-1 * var(--s1))); opacity: 0;
  transition: transform var(--dur-base) var(--ease-out), opacity var(--dur-fast) ease;
}
.sg-pop.is-up{ transform-origin: bottom right; transform: scale(.96) translateY(var(--s1)); }
.sg-pop.in{ transform: none; opacity: 1; }
.sg-pick-h{ display: grid; gap: var(--s1); padding: var(--s2) var(--s3) var(--s3); }
.sg-pick-h b{ font-size: var(--fs-base); }
.sg-pick-h small{ font-size: var(--fs-sm); color: var(--ink-dim); }
.sg-pick .row{ min-height: 52px; }
.sg-pick .sg-sugg{ display: flex; align-items: center; gap: var(--s1); color: var(--accent); }
.sg-pick .sg-sugg .ic{ width: 14px; height: 14px; flex: none; }
.sg-pick .row:first-child{ background: var(--tint); }
.sg-pick-host:not(:empty){ margin-top: var(--s5); padding: var(--s2); border-radius: var(--r); box-shadow: 0 0 0 2px var(--accent), 0 0 24px var(--glow); }

.sg-evi{ display: grid; grid-template-columns: 1fr 1fr; gap: var(--s2); margin: 0 0 var(--s4); }
.sg-evi > div{ display: grid; gap: var(--s1); align-content: start; padding: var(--s3); border-radius: var(--r-sm); background: var(--surface-2); }
.sg-evi small{ font-size: var(--fs-micro); font-weight: 600; color: var(--ink-dim); }
.sg-evi p{ margin: 0; font-size: var(--fs-sm); }
.sg-fired{ display: grid; gap: var(--s1); padding: var(--s3) var(--s4); border-radius: var(--r-sm); background: var(--surface-2); }
.sg-fired b{ font-size: var(--fs-base); }
.sg-next{ margin: 0; font-size: var(--fs-base); color: var(--ink-dim); }
.sg-next b{ color: var(--ink); font-weight: 600; }
.sg-rule-state{ display: flex; align-items: center; justify-content: space-between; gap: var(--s3); margin: var(--s2) 0 0; padding: var(--s3) var(--s4); border-radius: var(--r-sm); background: var(--surface-2); }
.sg-rule-state span{ display: grid; }
.sg-rule-state b{ font-size: var(--fs-base); }
.sg-rule-state small{ font-size: var(--fs-sm); color: var(--ink-dim); }
.sg-drawer .rows .sg-glyph{ margin: 0 var(--s1); }

.sg-draft{ display: grid; gap: var(--s3); padding: var(--s4); border-radius: var(--r); background: var(--surface-2); box-shadow: inset 0 0 0 1px var(--line); }
.sg-draft-h{ display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--s2); }
.sg-draft-m{ display: grid; grid-template-columns: auto minmax(0, 1fr); gap: var(--s1) var(--s3); margin: 0; font-size: var(--fs-sm); }
.sg-draft-m dt{ color: var(--ink-dim); }
.sg-draft-m dd{ margin: 0; font-weight: 600; }
.sg-draft-b{ margin: 0; min-height: 220px; padding: var(--s3) var(--s4); border-radius: var(--r-sm); background: var(--surface-1); font-size: var(--fs-sm); line-height: 1.6; white-space: pre-line; max-width: none; }

.sg-nr-ai{ display: grid; gap: var(--s3); padding: var(--s4); border-radius: var(--r); background: var(--tint); }
.sg-nr-ai .field{ background: var(--surface-1); }
.sg-nr-ai > .btn{ justify-self: start; }
.sg-nr-ai .meta{ margin: 0; }
.sg-lab{ display: inline-flex; align-items: center; gap: var(--s2); font: 600 var(--fs-sm)/1.3 var(--font-body); color: var(--ink); }
.sg-lab .ic{ width: 16px; height: 16px; color: var(--accent); }
.sg-nr-ex{ display: flex; flex-wrap: wrap; gap: var(--s2); }
.sg-nr-ex .chip{ min-height: 32px; padding: var(--s1) var(--s3); white-space: normal; text-align: left; line-height: 1.3; }
.sg-err{ display: flex; align-items: center; gap: var(--s2); margin: 0; font-size: var(--fs-sm); color: var(--bad); }
.sg-err .ic{ width: 16px; height: 16px; }
.sg-drawer .field[aria-invalid="true"]{ box-shadow: 0 0 0 2px var(--bad); }
.sg-or{ display: flex; align-items: center; gap: var(--s3); margin: var(--s5) 0; font-size: var(--fs-sm); color: var(--ink-faint); }
.sg-or::before, .sg-or::after{ content: ''; flex: 1; height: 1px; background: var(--line-2); }
.sg-nr-form{ display: grid; gap: var(--s4); }
.sg-f{ display: grid; gap: var(--s2); }
.sg-seg{ flex-wrap: wrap; width: fit-content; max-width: 100%; }
.sg-preview{ display: grid; gap: var(--s1); padding: var(--s3) var(--s4); border-radius: var(--r-sm); background: var(--surface-2); }
.sg-preview small{ font-size: var(--fs-micro); font-weight: 600; color: var(--ink-faint); }

/* --- STATES ------------------------------------------------------------- */
.sg-state{ min-height: 60vh; }
.sg-skel{ display: grid; gap: var(--s3); }
.sg-skel-dial{ width: min(100%, 520px); aspect-ratio: 1; border-radius: 50%; margin: 0 auto; }

/* --- MOTION ------------------------------------------------------------- */
@media (prefers-reduced-motion: no-preference){
  /* cards enter on their own translate and scale, so hover keeps a fast transform */
  .sg .reveal.card{
    transform: none; translate: 0 var(--s3); scale: .98;
    transition: opacity var(--dur-reveal) var(--ease-out) calc(var(--i, 0) * var(--stagger)),
                translate var(--dur-reveal) var(--ease-out) calc(var(--i, 0) * var(--stagger)),
                scale var(--dur-reveal) var(--ease-out) calc(var(--i, 0) * var(--stagger)),
                transform var(--dur-base) var(--ease-out), box-shadow var(--dur-base) var(--ease-out), --spot var(--dur-slow) var(--ease-out);
  }
  .sg .reveal.card.in{ translate: none; scale: none; }
  .settled .sg .reveal.card{ translate: none; scale: none; opacity: 1; transition: transform var(--dur-base) var(--ease-out), box-shadow var(--dur-base) var(--ease-out); }

  /* the Watch arrives: bands draw, the core settles, sensors and labels fade round */
  .sg-band{ stroke-dasharray: 1; stroke-dashoffset: 1; }
  .sg-watch.is-on .sg-band{ stroke-dashoffset: 0; transition: stroke-dashoffset var(--dur-reveal) var(--ease-out) calc(var(--i, 0) * var(--stagger)); }
  .sg-watch.is-still .sg-band{ transition: none; }
  .sg-watch:not(.is-on) :is(.sg-sensor, .sg-nl, .sg-bandl, .sg-spokes, .sg-sweep){ opacity: 0; }
  .sg-watch:not(.is-on) .sg-core{ opacity: 0; scale: .86; }
  .sg-watch.is-on :is(.sg-sensor, .sg-nl){ transition: transform var(--dur-drawer) var(--ease-in-out), opacity var(--dur-slow) var(--ease-out) calc(var(--dur-slow) + var(--i, 0) * var(--stagger)); }
  .sg-watch.is-still :is(.sg-sensor, .sg-nl){ transition: transform var(--dur-drawer) var(--ease-in-out), opacity var(--dur-slow) var(--ease-out); }
  .sg-spokes, .sg-bandl{ transition: opacity var(--dur-reveal) var(--ease-out); }
  .sg-sweep{ transition: opacity var(--dur-reveal) var(--ease-out); animation: sg-sweep var(--ambient-c) linear infinite; will-change: transform; }
  @keyframes sg-sweep{ to{ transform: rotate(360deg); } }

  /* state moments: the stamp lands once, highlights fade once */
  .sg-stamp{ animation: sg-stamp var(--dur-slow) var(--spring) both; }
  .sg-stamp .ic path{ stroke-dasharray: 24; stroke-dashoffset: 24; animation: sg-tick var(--dur-drawer) var(--ease-out) var(--dur-fast) forwards; }
  @keyframes sg-stamp{ from{ opacity: 0; scale: 1.5; } }
  @keyframes sg-tick{ to{ stroke-dashoffset: 0; } }
  .is-fresh::after{ animation: sg-flash calc(var(--dur-reveal) * 3) var(--ease-out) both; }
  .is-focus::after{ animation: sg-flash calc(var(--dur-reveal) * 3.6) var(--ease-in-out) both; }
  @keyframes sg-flash{ 0%, 35%{ opacity: 1; } 100%{ opacity: 0; } }
}
@media (prefers-reduced-motion: reduce){
  .sg-sweep{ display: none; }
}
.motion-paused .sg-sweep{ animation-play-state: paused; }

/* --- HOVER + PRESS ------------------------------------------------------ */
@media (hover: hover) and (pointer: fine){
  .sg-alert:hover, .sg-calm:hover, .sg-rule:hover{ transform: translateY(-3px); box-shadow: var(--shadow-2), 0 0 0 1px var(--line-2); --spot: var(--aurora-1); }
  .sg-alert.sev-critical:hover{ box-shadow: var(--shadow-2), 0 0 0 1px color-mix(in oklab, var(--bad) 62%, transparent), 0 16px 44px color-mix(in oklab, var(--bad) 22%, transparent); }
  .sg-kpi:hover{ transform: translateY(-2px); box-shadow: inset 0 0 0 1px var(--line-2), var(--shadow-1); }
  .sg-leg:hover{ background: var(--surface-2); transform: translateX(2px); }
  .sg-leg:hover .sg-glyph{ scale: 1.3; }
  .sg-node:hover .sg-disc{ scale: 1.18; filter: brightness(1.06); }
  .sg-sensor:hover .sg-sd{ scale: 1.4; }
  .sg-sensor:hover .sg-sl{ color: var(--ink); }
  .sg-core:hover{ box-shadow: var(--shadow-3), 0 0 0 1px var(--accent), 0 0 0 var(--s2) var(--tint-2); }
  .sg-done:hover{ transform: translateX(2px); box-shadow: var(--shadow-1), 0 0 0 1px var(--line-2); }
  .sg-chan:hover, .sg-route:hover, .sg-log-i:hover{ background: var(--surface-2); transform: translateX(2px); }
  .sg-route.is-you:hover{ background: var(--tint-2); }
  .sg-chan:hover .sg-chan-ic, .sg-log-i:hover .sg-log-ic{ scale: 1.1; }
}
.sg-alert:active, .sg-calm:active, .sg-rule:active{ transform: scale(.99); }
.sg-leg:active{ transform: scale(.98); }
.sg-node:active .sg-disc{ scale: .94; }
.sg-sensor:active .sg-sd{ scale: .9; }
.sg-node:focus-visible, .sg-sensor:focus-visible{ outline: 2px solid var(--accent); outline-offset: var(--s1); border-radius: 50%; }
:is(.sg-alert, .sg-calm, .sg-rule):focus-visible{ outline: 2px solid var(--accent); outline-offset: 3px; border-radius: var(--r); }

/* --- RESPONSIVE --------------------------------------------------------- */
@media (max-width: 1280px){
  .sg-hero{ grid-template-columns: minmax(0, 1fr) 300px; gap: var(--s5); }
  .sg-grid{ grid-template-columns: minmax(0, 1fr) 320px; }
}
@media (max-width: 1100px){
  .sg-hero, .sg-grid{ grid-template-columns: minmax(0, 1fr); }
  .sg-read{ grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: start; }
  .sg-read > .sg-check, .sg-read > .sg-ask{ grid-column: 1 / -1; }
}
@media (max-width: 760px){
  .sg{ gap: var(--s5); }
  .sg-head-act{ width: 100%; display: grid; grid-template-columns: 1fr 1fr; }
  .sg-hero{ padding: var(--s4); gap: var(--s4); }
  .sg-read{ grid-template-columns: minmax(0, 1fr); }
  .sg-sl, .sg-bandl, .sg-nl:not(.is-crit){ display: none; }
  .sg-core .fig{ font-size: var(--fs-lg); }
  .sg-core .mini-orb{ --o: 20px; }
  .sg-kpi .fig{ font-size: var(--fs-xl); }
  .sg-sec-h h2{ font-size: var(--fs-lg); }
  .sg-alert{ grid-template-columns: minmax(0, 1fr); gap: var(--s3); padding: var(--s4) var(--s4) var(--s4) var(--s5); }
  .sg-a-side{ justify-items: stretch; min-width: 0; }
  .sg-a-money{ grid-auto-flow: column; justify-content: start; align-items: baseline; gap: var(--s2); text-align: left; }
  .sg-a-act{ width: 100%; min-height: var(--h-touch); }
  .sg-stamp{ top: var(--s4); right: var(--s4); translate: none; }
  .sg-calm{ grid-template-columns: auto minmax(0, 1fr); gap: var(--s3); padding: var(--s4); }
  .sg-calm .sg-a-act{ grid-column: 1 / -1; min-height: var(--h-touch); }
  .sg-rules-grid{ grid-template-columns: minmax(0, 1fr); }
  .sg-rule-to{ margin-left: 0; }
  .sg-evi{ grid-template-columns: minmax(0, 1fr); }
}
