/* App-level pieces shared by every page: base type, page header, boot splash and the error bar.
   Design tokens and primitives live in Nalix.Dashboard.Controls. */

html,
body {
  background: var(--surface-page);
}

body {
  margin: 0;
  color: var(--text-primary);
  font-family: var(--font-sans);
}

h1 {
  margin: 0;
  font-size: 22px;
  font-weight: 650;
  letter-spacing: -0.01em;
}

h1:focus {
  outline: none;
}

.page-head {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  flex-wrap: wrap;
}

.page-head p {
  margin: 4px 0 0;
  max-width: 72ch;
}

a {
  color: var(--accent);
}

/* Boot splash: shown inside #app until Blazor renders the first screen. */

.boot {
  min-height: 100vh;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 20px;
  background: var(--surface-page);
}

.boot-mark {
  display: block;
  width: 56px;
  height: 56px;
  border-radius: 12px;
  animation: boot-in 240ms ease-out both;
}

.boot-bar {
  width: 160px;
  height: 2px;
  overflow: hidden;
  border-radius: 2px;
  background: var(--border-subtle);
}

.boot-bar span {
  display: block;
  width: 40%;
  height: 100%;
  background: var(--accent);
  animation: boot 1.1s ease-in-out infinite;
}

@keyframes boot {
  from { transform: translateX(-100%); }
  to { transform: translateX(250%); }
}

@keyframes boot-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

@media (prefers-reduced-motion: reduce) {
  .boot-bar span {
    width: 100%;
    opacity: 0.4;
    animation: none;
  }

  .boot-mark {
    animation: none;
  }
}

/* Unhandled-error bar. Blazor shows it; the dismiss button is wired by the framework. */

#blazor-error-ui {
  display: none;
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: var(--z-modal, 1000);
  padding: 12px 44px;
  background: var(--danger);
  color: var(--accent-contrast);
  font-size: 14px;
  text-align: center;
}

#blazor-error-ui .reload {
  margin-left: 8px;
  color: inherit;
  font-weight: 600;
  text-decoration: underline;
}

#blazor-error-ui .dismiss {
  position: absolute;
  top: 50%;
  right: 12px;
  transform: translateY(-50%);
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  padding: 0;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: inherit;
  cursor: pointer;
}

#blazor-error-ui .dismiss:hover {
  background: color-mix(in srgb, currentColor 18%, transparent);
}

/* ── Page composition (AtmosOS dashboard pattern: toolbar, 12-column grid of cards) ── */

.nx-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
  margin-bottom: 12px;
}

.nx-toolbar__meta {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-left: auto;
  color: var(--text-muted);
  font-size: 13px;
}

.nx-live-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--success);
  box-shadow: 0 0 0 3px var(--success-soft);
}

.nx-live-dot.is-paused {
  background: var(--warning);
  box-shadow: 0 0 0 3px var(--warning-soft);
}

.nx-grid {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: 12px;
}

.nx-cell {
  display: flex;
  flex-direction: column;
  min-width: 0;
  grid-column: span 12;
}

.nx-cell > .ui-card,
.nx-cell > .uistat-group {
  flex: 1;
}

@media (min-width: 900px) {
  .nx-grid {
    gap: 16px;
  }

  .nx-span-4 { grid-column: span 4; }
  .nx-span-6 { grid-column: span 6; }
  .nx-span-8 { grid-column: span 8; }
  .nx-span-12 { grid-column: span 12; }
}

.nx-facts {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 12px 24px;
  margin: 0;
}

.nx-facts div {
  min-width: 0;
}

.nx-facts dt {
  font-size: .8125rem;
  font-weight: 500;
  color: var(--text-secondary);
}

.nx-facts dd {
  margin: 2px 0 0;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  overflow-wrap: anywhere;
}
