/* Fluent 2 primitives, shared by the dashboard and the alert toast.
   Colours, type ramp, radii, elevation and motion are taken from the WinUI 3
   design tokens so the app sits alongside Settings rather than next to it.
   Dark is the default; [data-theme="light"] is set on <html> before paint. */

:root {
  /* --- layers --- */
  --solid-base: #202020;
  --solid-secondary: #1c1c1c;
  --layer: rgba(255, 255, 255, 0.0538);
  --card: rgba(255, 255, 255, 0.0512);
  --card-hover: rgba(255, 255, 255, 0.0837);
  --card-pressed: rgba(255, 255, 255, 0.0326);
  --stroke: rgba(255, 255, 255, 0.0698);
  --stroke-strong: rgba(255, 255, 255, 0.1);
  --divider: rgba(255, 255, 255, 0.0837);

  /* --- text --- */
  --text: #ffffff;
  --text-secondary: rgba(255, 255, 255, 0.786);
  --text-tertiary: rgba(255, 255, 255, 0.5442);
  --text-disabled: rgba(255, 255, 255, 0.3628);

  /* --- accent + system --- */
  --accent: #60cdff;
  --accent-hover: #7fd8ff;
  --accent-pressed: #4cb0e0;
  --on-accent: #000000;
  --accent-tint: rgba(96, 205, 255, 0.12);
  --critical: #ff99a4;
  --critical-tint: rgba(255, 153, 164, 0.12);
  --caution: #fce100;
  --success: #6ccb5f;

  /* --- controls --- */
  --control: rgba(255, 255, 255, 0.0605);
  --control-hover: rgba(255, 255, 255, 0.0837);
  --control-pressed: rgba(255, 255, 255, 0.0326);
  --control-stroke: rgba(255, 255, 255, 0.0698);

  /* --- shape --- */
  --radius-control: 4px;
  --radius-card: 8px;
  --radius-overlay: 8px;

  /* --- elevation --- */
  --shadow-card: 0 1px 2px rgba(0, 0, 0, 0.28);
  --shadow-flyout: 0 8px 16px rgba(0, 0, 0, 0.32), 0 0 1px rgba(0, 0, 0, 0.4);

  /* --- motion: Fluent's decelerate curve, and its three tempos --- */
  --ease-out: cubic-bezier(0, 0, 0, 1);
  --ease-in-out: cubic-bezier(0.55, 0.55, 0, 1);
  --fast: 150ms;
  --normal: 250ms;
  --slow: 333ms;
}

:root[data-theme="light"] {
  --solid-base: #f3f3f3;
  --solid-secondary: #eeeeee;
  --layer: rgba(255, 255, 255, 0.5);
  --card: rgba(255, 255, 255, 0.7);
  --card-hover: rgba(249, 249, 249, 0.5);
  --card-pressed: rgba(249, 249, 249, 0.3);
  --stroke: rgba(0, 0, 0, 0.0578);
  --stroke-strong: rgba(0, 0, 0, 0.0924);
  --divider: rgba(0, 0, 0, 0.0803);

  --text: rgba(0, 0, 0, 0.8956);
  --text-secondary: rgba(0, 0, 0, 0.6063);
  --text-tertiary: rgba(0, 0, 0, 0.4458);
  --text-disabled: rgba(0, 0, 0, 0.3614);

  --accent: #005fb8;
  --accent-hover: #1a6fbf;
  --accent-pressed: #327fc7;
  --on-accent: #ffffff;
  --accent-tint: rgba(0, 95, 184, 0.08);
  --critical: #c42b1c;
  --critical-tint: rgba(196, 43, 28, 0.08);
  --caution: #9d5d00;
  --success: #0f7b0f;

  --control: rgba(255, 255, 255, 0.7);
  --control-hover: rgba(249, 249, 249, 0.5);
  --control-pressed: rgba(249, 249, 249, 0.3);
  --control-stroke: rgba(0, 0, 0, 0.0578);

  --shadow-card: 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow-flyout: 0 8px 16px rgba(0, 0, 0, 0.14), 0 0 1px rgba(0, 0, 0, 0.12);
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html,
body {
  height: 100%;
}

body {
  font-family: "Segoe UI Variable Text", "Segoe UI Variable", "Segoe UI",
    system-ui, sans-serif;
  font-size: 14px;
  line-height: 20px;
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  user-select: none;
  -webkit-user-select: none;
  cursor: default;
}

/* --- type ramp --- */
.type-title {
  font-family: "Segoe UI Variable Display", "Segoe UI Variable", "Segoe UI",
    system-ui, sans-serif;
  font-size: 20px;
  line-height: 26px;
  font-weight: 600;
}

.type-subtitle {
  font-family: "Segoe UI Variable Display", "Segoe UI Variable", "Segoe UI",
    system-ui, sans-serif;
  font-size: 18px;
  line-height: 24px;
  font-weight: 600;
}

.type-body-strong {
  font-size: 14px;
  line-height: 20px;
  font-weight: 600;
}

.type-body {
  font-size: 14px;
  line-height: 20px;
}

.type-caption {
  font-size: 12px;
  line-height: 16px;
}

.subtle {
  color: var(--text-secondary);
}

.faint {
  color: var(--text-tertiary);
}

/* --- buttons --- */
.btn {
  font: inherit;
  font-weight: 600;
  font-size: 14px;
  color: var(--text);
  background: var(--control);
  border: 1px solid var(--control-stroke);
  border-radius: var(--radius-control);
  padding: 6px 14px;
  min-height: 32px;
  cursor: pointer;
  transition: background var(--fast) var(--ease-out),
    border-color var(--fast) var(--ease-out);
}

.btn:hover {
  background: var(--control-hover);
}

.btn:active {
  background: var(--control-pressed);
  color: var(--text-secondary);
}

.btn-accent {
  color: var(--on-accent);
  background: var(--accent);
  border-color: transparent;
}

.btn-accent:hover {
  background: var(--accent-hover);
}

.btn-accent:active {
  background: var(--accent-pressed);
  color: var(--on-accent);
  opacity: 0.9;
}

.icon-button {
  display: grid;
  place-items: center;
  flex: none;
  width: 32px;
  height: 32px;
  color: var(--text-secondary);
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--radius-control);
  cursor: pointer;
  transition: background var(--fast) var(--ease-out),
    color var(--fast) var(--ease-out);
}

.icon-button:hover {
  background: var(--control-hover);
  border-color: var(--control-stroke);
  color: var(--text);
}

.icon-button:active {
  background: var(--control-pressed);
}

.icon-button.on {
  color: var(--accent);
}

.icon-button svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* Fluent's focus rectangle: a dark inner line inside a light outer one, so it
   stays visible on any surface. */
:focus-visible {
  outline: 2px solid var(--text);
  outline-offset: 1px;
  border-radius: var(--radius-control);
}

/* --- app monogram: a stable colour per app, no icon extraction needed --- */
.avatar {
  display: grid;
  place-items: center;
  flex: none;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  font-size: 15px;
  font-weight: 600;
  color: hsl(var(--tint, 205) 70% 42%);
  background: hsl(var(--tint, 205) 70% 42% / 0.16);
  box-shadow: inset 0 0 0 1px hsl(var(--tint, 205) 70% 42% / 0.24);
}

:root:not([data-theme="light"]) .avatar {
  color: hsl(var(--tint, 205) 80% 76%);
  background: hsl(var(--tint, 205) 80% 76% / 0.14);
  box-shadow: inset 0 0 0 1px hsl(var(--tint, 205) 80% 76% / 0.2);
}

/* --- badges --- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  line-height: 16px;
  font-weight: 600;
  border-radius: 999px;
  padding: 0 8px;
  vertical-align: 1px;
  white-space: nowrap;
}

.badge-live {
  color: var(--critical);
  background: var(--critical-tint);
}

.badge-idle {
  color: var(--text-secondary);
  background: var(--control);
}

.badge-muted {
  color: var(--text-secondary);
  background: var(--control);
}

/* Signature verdicts. Green is the only place the app ever reassures, so it
   is spent only on a chain that actually verified. */
.badge-ok {
  color: var(--success);
  background: color-mix(in srgb, var(--success) 14%, transparent);
}

.badge-warn {
  color: var(--critical);
  background: var(--critical-tint);
}

.badge .pip {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}

.badge-live .pip {
  animation: breathe 2s var(--ease-in-out) infinite;
}

@keyframes breathe {
  50% {
    opacity: 0.3;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}
