/* ToolGlue design tokens on top of MudBlazor (doc 08). Dark is default; no white flash. */

:root {
  --mud-typography-default-family: 'Inter', -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', sans-serif;
  --tg-radius: 12px;
  /* Falls back to the dark hairline before MudBlazor mounts; flips with the active palette after. */
  --tg-hairline: var(--mud-palette-lines-default, rgba(255, 255, 255, 0.07));
  --tg-glow: 0 0 24px rgba(34, 211, 238, 0.12);
}

html, body {
  background: #0B0D12;
  min-height: 100%;
  -webkit-tap-highlight-color: transparent;
}

/* Wordmark */
.tg-wordmark {
  font-weight: 700;
  font-size: 1.05rem;
  letter-spacing: 0.02em;
  color: var(--mud-palette-text-primary) !important;
}

.tg-wordmark-dot {
  color: var(--mud-palette-primary);
}

/* Surfaces */
.tg-card, .tg-stat, .tg-empty {
  border: 1px solid var(--tg-hairline);
  border-radius: var(--tg-radius);
  background: var(--mud-palette-surface);
}

.tg-stat .tg-stat-value {
  font-variant-numeric: tabular-nums;
}

.tg-empty-icon {
  width: 56px;
  height: 56px;
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(34, 211, 238, 0.08);
  box-shadow: var(--tg-glow);
}

.tg-code {
  border: 1px solid var(--tg-hairline);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.03);
  padding: 8px 12px;
  overflow-x: auto;
}

.tg-code code {
  font-family: ui-monospace, 'Cascadia Code', Consolas, monospace;
  font-size: 0.85rem;
  color: var(--mud-palette-primary);
  white-space: nowrap;
}

/* Billing */
.tg-money-value {
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  letter-spacing: -0.01em;
  line-height: 1.1;
}

.tg-money-lg .tg-money-value {
  font-size: 2.75rem;
}

.tg-money-usd {
  font-variant-numeric: tabular-nums;
  color: var(--mud-palette-text-secondary);
}

.tg-ledger-amount {
  font-variant-numeric: tabular-nums;
  font-weight: 600;
}

.tg-pack {
  border: 1px solid var(--tg-hairline);
  border-radius: var(--tg-radius);
  background: var(--mud-palette-surface);
  transition: border-color 120ms ease, box-shadow 120ms ease;
}

.tg-pack:hover {
  border-color: var(--mud-palette-primary);
  box-shadow: var(--tg-glow);
}

/* Mobile bottom navigation (thumb-first, ≥44px targets) */
.tg-bottomnav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 1300;
  justify-content: space-around;
  padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
  background: color-mix(in srgb, var(--mud-palette-background) 88%, transparent);
  backdrop-filter: blur(12px);
  border-top: 1px solid var(--tg-hairline);
}

.tg-bottomnav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  min-width: 56px;
  min-height: 44px;
  padding: 4px 8px;
  border-radius: 10px;
  font-size: 0.65rem;
  text-decoration: none;
  color: var(--mud-palette-text-secondary);
}

.tg-bottomnav-item.active {
  color: var(--mud-palette-primary);
  background: rgba(34, 211, 238, 0.08);
}

/* Give the main content room above the bottom bar on mobile */
@media (max-width: 959px) {
  .tg-main {
    padding-bottom: 76px;
  }
}

/* ---------------------------------------------------------------------------
   Auth pages (static SSR, doc 08). Dark by default, mobile-first, thumb-friendly,
   plain HTML form elements — the first impression, so it carries the full bar.
   These tokens are self-contained (no MudBlazor at render time on /account).
---------------------------------------------------------------------------- */
.tg-auth-shell {
  --tg-bg: #0B0D12;
  --tg-surface: #12151D;
  --tg-hair: rgba(255, 255, 255, 0.08);
  --tg-primary: #22D3EE;
  --tg-text: #E6EAF2;
  --tg-muted: #98A2B3;
  --tg-error: #FB7185;
  --tg-success: #34D399;
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 16px calc(24px + env(safe-area-inset-bottom));
  background:
    radial-gradient(60% 50% at 50% 0%, rgba(34, 211, 238, 0.10), transparent 70%),
    var(--tg-bg);
  color: var(--tg-text);
  font-family: 'Inter', -apple-system, 'Segoe UI', Roboto, sans-serif;
}

.tg-auth-card {
  width: 100%;
  max-width: 400px;
  background: var(--tg-surface);
  border: 1px solid var(--tg-hair);
  border-radius: 16px;
  padding: 28px 24px 24px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.45);
}

.tg-auth-wordmark {
  display: inline-block;
  font-weight: 700;
  font-size: 1.25rem;
  letter-spacing: 0.02em;
  color: var(--tg-text);
  text-decoration: none;
  margin-bottom: 20px;
}

.tg-auth-wordmark span {
  color: var(--tg-primary);
}

.tg-auth-title {
  font-size: 1.35rem;
  font-weight: 650;
  margin: 0 0 4px;
}

.tg-auth-sub {
  color: var(--tg-muted);
  font-size: 0.9rem;
  margin: 0 0 20px;
}

.tg-auth-field {
  margin-bottom: 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.tg-auth-field label {
  font-size: 0.82rem;
  color: var(--tg-muted);
}

.tg-auth-input {
  width: 100%;
  min-height: 48px;
  padding: 0 14px;
  border-radius: 10px;
  border: 1px solid var(--tg-hair);
  background: rgba(255, 255, 255, 0.03);
  color: var(--tg-text);
  font-size: 1rem;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.tg-auth-input:focus {
  outline: none;
  border-color: var(--tg-primary);
  box-shadow: 0 0 0 3px rgba(34, 211, 238, 0.18);
}

.tg-auth-input::placeholder {
  color: #5b6675;
}

.tg-auth-check {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--tg-muted);
  font-size: 0.9rem;
  margin-bottom: 16px;
}

.tg-auth-check input {
  width: 18px;
  height: 18px;
  accent-color: var(--tg-primary);
}

.tg-auth-btn {
  width: 100%;
  min-height: 48px;
  border: none;
  border-radius: 10px;
  background: var(--tg-primary);
  color: #06222A;
  font-size: 1rem;
  font-weight: 650;
  cursor: pointer;
  transition: filter 0.15s;
}

.tg-auth-btn:hover {
  filter: brightness(1.08);
}

.tg-auth-btn:focus-visible {
  outline: 2px solid var(--tg-text);
  outline-offset: 2px;
}

.tg-auth-btn.secondary {
  background: transparent;
  color: var(--tg-text);
  border: 1px solid var(--tg-hair);
}

.tg-auth-sso {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 18px;
}

.tg-auth-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--tg-muted);
  font-size: 0.78rem;
  margin: 18px 0;
}

.tg-auth-divider::before,
.tg-auth-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--tg-hair);
}

.tg-auth-links {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 18px;
  font-size: 0.86rem;
}

.tg-auth-links a {
  color: var(--tg-primary);
  text-decoration: none;
}

.tg-auth-msg {
  border-radius: 10px;
  padding: 10px 14px;
  font-size: 0.86rem;
  margin-bottom: 16px;
  border: 1px solid var(--tg-hair);
}

.tg-auth-msg.error {
  color: var(--tg-error);
  background: rgba(251, 113, 133, 0.08);
  border-color: rgba(251, 113, 133, 0.35);
}

.tg-auth-msg.info {
  color: var(--tg-text);
  background: rgba(34, 211, 238, 0.06);
  border-color: rgba(34, 211, 238, 0.25);
}

.tg-auth-validation {
  color: var(--tg-error);
  font-size: 0.8rem;
}

.tg-auth-mono {
  font-family: ui-monospace, 'Cascadia Code', Consolas, monospace;
  font-size: 0.82rem;
  word-break: break-all;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--tg-hair);
  border-radius: 8px;
  padding: 10px 12px;
  color: var(--tg-primary);
}

.tg-auth-qr {
  display: flex;
  justify-content: center;
  padding: 16px;
  background: #fff;
  border-radius: 12px;
  margin: 8px 0 16px;
}

.tg-auth-qr svg {
  width: 200px;
  height: 200px;
}

/* Boot splash (avoid a flash of unstyled/empty layout while the circuit resolves auth) */
.tg-boot {
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #0B0D12;
}

/* Workspace switcher menu */
.tg-ws-menu {
  display: flex;
  flex-direction: column;
  min-width: 220px;
  padding: 6px;
}

.tg-ws-menu form {
  margin: 0;
}

.tg-ws-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  min-height: 44px;
  padding: 8px 12px;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: var(--mud-palette-text-primary);
  font-size: 0.9rem;
  text-align: left;
  text-decoration: none;
  cursor: pointer;
}

.tg-ws-item:hover {
  background: rgba(255, 255, 255, 0.05);
}

.tg-ws-item.active {
  color: var(--mud-palette-primary);
}

.tg-ws-role {
  font-size: 0.72rem;
  color: var(--mud-palette-text-secondary);
  text-transform: lowercase;
}

.tg-ws-new {
  color: var(--mud-palette-primary);
  border-top: 1px solid var(--tg-hairline);
  margin-top: 4px;
  border-radius: 0 0 8px 8px;
}

.tg-logout-form {
  display: inline-flex;
  margin: 0;
}

/* One-time key reveal + snippets */
.tg-reveal {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  border: 1px solid var(--tg-hairline);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.03);
  padding: 10px 12px;
}

.tg-reveal code,
.tg-reveal pre {
  flex: 1;
  margin: 0;
  font-family: ui-monospace, 'Cascadia Code', Consolas, monospace;
  font-size: 0.8rem;
  color: var(--mud-palette-primary);
  white-space: pre-wrap;
  word-break: break-all;
  overflow-x: auto;
}

.tg-key-prefix {
  font-family: ui-monospace, 'Cascadia Code', Consolas, monospace;
  font-size: 0.8rem;
  color: var(--mud-palette-text-secondary);
}

/* Connect wizard: searchable connector grid (doc 08 — initials avatar, no external images) */
.tg-connector-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 12px;
}

.tg-connector-card {
  border: 1px solid var(--tg-hairline);
  border-radius: var(--tg-radius);
  background: var(--mud-palette-surface);
  padding: 16px 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  text-align: center;
  cursor: pointer;
  min-height: 44px;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.tg-connector-card:hover, .tg-connector-card:focus-visible {
  border-color: var(--mud-palette-primary);
  box-shadow: var(--tg-glow);
}

.tg-connector-avatar {
  width: 40px;
  height: 40px;
  border-radius: 999px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(34, 211, 238, 0.12);
  color: var(--mud-palette-primary);
  font-weight: 600;
  font-size: 0.9rem;
}

/* Connection status chips (doc 10: Active=glow, Disconnected=warning, Pending=secondary) */
.tg-status-active {
  box-shadow: var(--tg-glow);
}

/* OAuth consent (doc 08: the claude.ai onboarding moment — phone-first, plain language) */
.tg-consent-banner {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  margin-bottom: 18px;
  border-radius: 10px;
  border: 1px solid color-mix(in srgb, var(--tg-error) 45%, transparent);
  background: color-mix(in srgb, var(--tg-error) 12%, transparent);
  color: var(--tg-text);
  font-size: 0.85rem;
}

.tg-consent-section {
  margin-bottom: 18px;
}

.tg-consent-label {
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--tg-muted);
  margin-bottom: 8px;
}

.tg-consent-workspaces {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.tg-consent-workspace {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  border: 1px solid var(--tg-hair);
  border-radius: 10px;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}

.tg-consent-workspace:has(input:checked) {
  border-color: var(--tg-primary);
  background: rgba(34, 211, 238, 0.08);
}

.tg-consent-workspace input {
  accent-color: var(--tg-primary);
  width: 18px;
  height: 18px;
}

.tg-consent-workspace-name {
  flex: 1;
  font-weight: 600;
}

.tg-consent-workspace-role {
  font-size: 0.75rem;
  color: var(--tg-muted);
}

.tg-consent-scopes {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.tg-consent-scopes li {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.92rem;
}

.tg-consent-check {
  color: var(--tg-success);
  font-weight: 700;
}

.tg-consent-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 22px;
}

.tg-consent-foot {
  margin-top: 16px;
  font-size: 0.78rem;
  text-align: center;
}

/* Runs list + detail (doc 10: redacted exchange rendered nicely) */
.tg-run-row {
  cursor: pointer;
  transition: border-color 0.15s;
}

.tg-run-row:hover {
  border-color: var(--tg-primary);
}

.tg-run-url {
  word-break: break-all;
}

.tg-run-pre {
  margin: 0;
  padding: 10px 12px;
  border-radius: 8px;
  background: var(--tg-bg);
  color: var(--tg-text);
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size: 0.8rem;
  white-space: pre-wrap;
  word-break: break-word;
  overflow-x: auto;
}

.tg-run-panels {
  background: transparent;
}

/* ---------------------------------------------------------------------------
   The living wire — motion + realtime design language. Everything below reads
   from theme tokens; honors prefers-reduced-motion.
---------------------------------------------------------------------------- */

/* Page enter: content rises into place. */
.tg-enter {
  animation: tg-rise 240ms cubic-bezier(0.2, 0.8, 0.2, 1);
}

@keyframes tg-rise {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: none; }
}

/* The pulse dot: idle ember next to the wordmark that flares on live agent traffic. */
.tg-pulse-dot {
  width: 8px;
  height: 8px;
  margin-left: 10px;
  border-radius: 999px;
  background: var(--mud-palette-text-disabled);
  transition: background 300ms ease, box-shadow 300ms ease;
}

.tg-pulse-dot.live {
  background: var(--mud-palette-primary);
  box-shadow: 0 0 0 0 rgba(34, 211, 238, 0.7);
  animation: tg-pulse 1.4s ease-out;
}

@keyframes tg-pulse {
  0% { box-shadow: 0 0 0 0 rgba(34, 211, 238, 0.7); }
  100% { box-shadow: 0 0 0 14px rgba(34, 211, 238, 0); }
}

/* Command palette */
.tg-palette-overlay {
  position: fixed;
  inset: 0;
  z-index: 1500;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding: min(18vh, 160px) 16px 16px;
  background: color-mix(in srgb, var(--mud-palette-black, #07080C) 55%, transparent);
  backdrop-filter: blur(6px);
  animation: tg-fade 140ms ease;
}

@keyframes tg-fade {
  from { opacity: 0; }
  to { opacity: 1; }
}

.tg-palette {
  width: 100%;
  max-width: 560px;
  border: 1px solid var(--tg-hairline);
  border-radius: 16px;
  background: var(--mud-palette-surface);
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.55), var(--tg-glow);
  overflow: hidden;
  animation: tg-rise 180ms cubic-bezier(0.2, 0.8, 0.2, 1);
}

.tg-palette-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--tg-hairline);
}

.tg-palette-input {
  flex: 1;
  min-height: 28px;
  border: none;
  outline: none;
  background: transparent;
  color: var(--mud-palette-text-primary);
  font-size: 1rem;
  font-family: inherit;
}

.tg-palette-input::placeholder {
  color: var(--mud-palette-text-disabled);
}

.tg-palette-glyph {
  color: var(--mud-palette-text-secondary);
  flex-shrink: 0;
}

.tg-palette-list {
  max-height: min(50vh, 420px);
  overflow-y: auto;
  padding: 6px;
}

.tg-palette-item {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 44px;
  padding: 10px 12px;
  border: none;
  border-radius: 10px;
  background: transparent;
  color: var(--mud-palette-text-primary);
  font-size: 0.92rem;
  font-family: inherit;
  text-align: left;
  cursor: pointer;
}

.tg-palette-item.selected {
  background: rgba(34, 211, 238, 0.10);
}

.tg-palette-item.selected .tg-palette-glyph {
  color: var(--mud-palette-primary);
}

.tg-palette-label {
  flex-shrink: 0;
}

.tg-palette-hint {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--mud-palette-text-secondary);
  font-size: 0.78rem;
  text-align: right;
}

.tg-palette-empty {
  padding: 22px 16px;
  text-align: center;
  color: var(--mud-palette-text-secondary);
  font-size: 0.9rem;
}

.tg-palette-foot {
  display: flex;
  gap: 16px;
  align-items: center;
  padding: 8px 16px;
  border-top: 1px solid var(--tg-hairline);
  color: var(--mud-palette-text-secondary);
  font-size: 0.72rem;
}

.tg-palette-foot-brand {
  margin-left: auto;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.tg-kbd {
  display: inline-block;
  padding: 1px 6px;
  border: 1px solid var(--tg-hairline);
  border-bottom-width: 2px;
  border-radius: 5px;
  background: rgba(255, 255, 255, 0.04);
  color: var(--mud-palette-text-secondary);
  font-family: inherit;
  font-size: 0.72rem;
  line-height: 1.5;
}

.tg-palette-opener {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 34px;
  margin-right: 12px;
  padding: 4px 12px;
  border: 1px solid var(--tg-hairline);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.03);
  color: var(--mud-palette-text-secondary);
  font-size: 0.82rem;
  font-family: inherit;
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s;
}

.tg-palette-opener:hover {
  border-color: var(--mud-palette-primary);
  color: var(--mud-palette-text-primary);
}

/* Skeleton shimmer: loading surfaces breathe instead of spinning. */
.tg-skeleton {
  position: relative;
  overflow: hidden;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.05);
  min-height: 16px;
}

.tg-skeleton::after {
  content: "";
  position: absolute;
  inset: 0;
  transform: translateX(-100%);
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.06), transparent);
  animation: tg-shimmer 1.6s infinite;
}

@keyframes tg-shimmer {
  100% { transform: translateX(100%); }
}

/* Status glow semantics: Active hums, Pending waits, Disconnected warns. */
.tg-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.78rem;
}

.tg-status::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 999px;
  background: currentColor;
}

.tg-status.active {
  color: var(--mud-palette-success);
}

.tg-status.active::before {
  box-shadow: 0 0 8px 1px color-mix(in srgb, var(--mud-palette-success) 70%, transparent);
}

.tg-status.pending {
  color: var(--mud-palette-warning);
}

.tg-status.disconnected {
  color: var(--mud-palette-error);
}

/* Drawer footer version stamp */
.tg-version {
  font-family: ui-monospace, 'Cascadia Code', Consolas, monospace;
  font-size: 0.68rem;
  color: var(--mud-palette-text-disabled);
}

/* Blazor reconnect overlay: match the brand instead of the stock gray modal. */
#components-reconnect-modal {
  background: color-mix(in srgb, #07080C 78%, transparent) !important;
  backdrop-filter: blur(4px);
  color: #E6EAF2 !important;
  font-family: 'Inter', -apple-system, 'Segoe UI', Roboto, sans-serif;
}

/* Live tickers */
.tg-ticker-row {
  animation: tg-rise 300ms cubic-bezier(0.2, 0.8, 0.2, 1);
}

@media (prefers-reduced-motion: reduce) {
  .tg-enter, .tg-palette, .tg-palette-overlay, .tg-ticker-row, .tg-pulse-dot.live {
    animation: none;
  }

  .tg-skeleton::after {
    animation: none;
  }
}

/* The hardcoded dark body is only the pre-boot flash guard; once MudBlazor mounts, the layout
   must paint from the active palette or light mode keeps a dark page body. */
.mud-layout {
  background: var(--mud-palette-background);
  min-height: 100dvh;
}

/* System map — the living wire */
.tg-sysmap svg {
  width: 100%;
  height: auto;
  display: block;
}

.tg-sysmap-wire {
  fill: none;
  stroke: var(--tg-hairline);
  stroke-width: 1.5;
  transition: stroke 300ms ease;
}

.tg-sysmap.live .tg-sysmap-wire {
  stroke: var(--mud-palette-primary);
  stroke-dasharray: 6 10;
  animation: tg-flow 900ms linear infinite;
  filter: drop-shadow(0 0 4px rgba(34, 211, 238, 0.5));
}

.tg-sysmap.building .tg-sysmap-wire {
  stroke: var(--mud-palette-secondary);
  stroke-dasharray: 6 10;
  animation: tg-flow 900ms linear infinite;
}

@keyframes tg-flow {
  to { stroke-dashoffset: -16; }
}

.tg-sysmap-circle {
  fill: var(--mud-palette-surface);
  stroke: var(--tg-hairline);
  stroke-width: 1.5;
  transition: stroke 200ms ease, filter 200ms ease;
}

.tg-sysmap-circle.hub {
  stroke: var(--mud-palette-primary);
  filter: drop-shadow(0 0 10px rgba(34, 211, 238, 0.25));
}

.tg-sysmap.building .tg-sysmap-circle.hub {
  stroke: var(--mud-palette-secondary);
  filter: drop-shadow(0 0 12px rgba(167, 139, 250, 0.4));
}

.tg-sysmap-circle.app.active { stroke: var(--mud-palette-success); }
.tg-sysmap-circle.app.pending { stroke: var(--mud-palette-warning); }
.tg-sysmap-circle.app.disconnected { stroke: var(--mud-palette-error); }

.tg-sysmap-circle.ghost {
  stroke-dasharray: 4 4;
}

.tg-sysmap-node:hover .tg-sysmap-circle {
  stroke: var(--mud-palette-primary);
}

.tg-sysmap-glyph, .tg-sysmap-initials {
  fill: var(--mud-palette-text-primary);
  font-size: 11px;
  font-weight: 600;
  text-anchor: middle;
  dominant-baseline: middle;
}

.tg-sysmap-glyph.ghost {
  fill: var(--mud-palette-text-secondary);
  font-size: 16px;
}

.tg-sysmap-hubword {
  fill: var(--mud-palette-text-primary);
  font-size: 10.5px;
  font-weight: 700;
  text-anchor: middle;
}

.tg-sysmap-hubruns {
  fill: var(--mud-palette-text-secondary);
  font-size: 8px;
  text-anchor: middle;
}

.tg-sysmap-label {
  fill: var(--mud-palette-text-secondary);
  font-size: 8.5px;
  text-anchor: middle;
}

/* Sparkline */
.tg-spark {
  width: 100%;
  height: 44px;
  display: block;
}

.tg-spark-line {
  fill: none;
  stroke: var(--mud-palette-primary);
  stroke-width: 1.6;
  vector-effect: non-scaling-stroke;
}

.tg-spark-area {
  fill: rgba(34, 211, 238, 0.12);
  stroke: none;
}

.tg-spark-dot {
  fill: var(--mud-palette-primary);
}

.tg-spark-flat {
  stroke: var(--tg-hairline);
  stroke-width: 1.5;
  vector-effect: non-scaling-stroke;
}

/* Live runs feed */
.tg-feed-row {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 44px;
  padding: 8px 10px;
  border-radius: 10px;
  cursor: pointer;
  text-decoration: none;
  color: var(--mud-palette-text-primary);
}

.tg-feed-row:hover {
  background: rgba(255, 255, 255, 0.04);
}

.tg-feed-time {
  font-family: ui-monospace, 'Cascadia Code', Consolas, monospace;
  font-size: 0.72rem;
  color: var(--mud-palette-text-secondary);
  min-width: 58px;
}

.tg-feed-what {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.85rem;
}

.tg-feed-credits {
  font-variant-numeric: tabular-nums;
  font-size: 0.78rem;
  color: var(--mud-palette-text-secondary);
}

@media (prefers-reduced-motion: reduce) {
  .tg-sysmap.live .tg-sysmap-wire, .tg-sysmap.building .tg-sysmap-wire {
    animation: none;
  }
}

/* Mobile "More" sheet: the rest of the nav within thumb reach. */
.tg-more-overlay {
  position: fixed;
  inset: 0;
  z-index: 1295;
  background: color-mix(in srgb, #07080C 45%, transparent);
}

.tg-more-sheet {
  position: absolute;
  right: 8px;
  bottom: calc(72px + env(safe-area-inset-bottom));
  min-width: 200px;
  padding: 6px;
  border: 1px solid var(--tg-hairline);
  border-radius: 14px;
  background: var(--mud-palette-surface);
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.5);
  animation: tg-rise 160ms cubic-bezier(0.2, 0.8, 0.2, 1);
}

/* Circuit error bars: brand-styled, impossible to miss, never silent. */
#blazor-error-ui,
#tg-dead-ui {
  display: none;
  position: fixed;
  left: 12px;
  right: 12px;
  bottom: calc(12px + env(safe-area-inset-bottom));
  z-index: 2000;
  padding: 12px 16px;
  border: 1px solid color-mix(in srgb, #FB7185 45%, transparent);
  border-radius: 12px;
  background: #1a1016;
  color: #E6EAF2;
  font-family: 'Inter', -apple-system, 'Segoe UI', Roboto, sans-serif;
  font-size: 0.9rem;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.5);
}

#blazor-error-ui .reload,
#tg-dead-ui .reload {
  color: #22D3EE;
  margin-left: 8px;
}

#blazor-error-ui .dismiss,
#tg-dead-ui .dismiss {
  float: right;
  cursor: pointer;
  color: #98A2B3;
}

#tg-dead-ui.show {
  display: block;
}

