/* ============================================================
 * APEX SALES OS · SYSTEM STATE PAGES
 * Owner: Worker W22
 * Page-local styles only · .page-sys-* namespace
 * Used by: 404 (not-found), network-error, permission-denied,
 *          loading-overlay utility, empty-state wrappers
 * ============================================================ */

/* outer frame — centered card on a faint radial purple wash */
.page-sys-frame {
  min-height: calc(100vh - 56px);
  display: grid;
  place-items: center;
  padding: 60px 24px;
  background:
    radial-gradient(circle at 50% 0%, rgba(99, 91, 255, 0.06), transparent 60%),
    var(--bg-warm);
}

/* the card itself · capped width, centered column */
.page-sys-card {
  max-width: 480px;
  width: 100%;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}

/* circular icon medallion · 80x80, neutral by default */
.page-sys-icon {
  width: 80px;
  height: 80px;
  border-radius: 20px;
  background: var(--bg-tint);
  border: 1px solid var(--border);
  display: grid;
  place-items: center;
  color: var(--text-faint);
  margin-bottom: 4px;
}
.page-sys-icon svg {
  width: 36px;
  height: 36px;
}

/* accent variant · purple-soft tint for success/online states */
.page-sys-icon.accent {
  background: var(--primary-soft);
  border-color: var(--status-done-bd);
  color: var(--primary);
}

/* eyebrow label · mono uppercase status code */
.page-sys-eyebrow {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11.5px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

/* page title */
.page-sys-title {
  font-size: 24px;
  font-weight: 600;
  letter-spacing: -0.015em;
  line-height: 1.2;
  margin: 0;
  color: var(--text);
}

/* supporting paragraph */
.page-sys-sub {
  font-size: 14px;
  color: var(--text-muted);
  line-height: 1.6;
  max-width: 380px;
  margin: 0;
}

/* CTA row · one primary + one secondary */
.page-sys-actions {
  display: flex;
  gap: 10px;
  margin-top: 8px;
  flex-wrap: wrap;
  justify-content: center;
}

/* meta footer · mono attempted-path + support link */
.page-sys-meta {
  margin-top: 20px;
  padding-top: 18px;
  border-top: 1px solid var(--border);
  width: 100%;
  font-size: 11.5px;
  color: var(--text-faint);
  display: flex;
  flex-direction: column;
  gap: 4px;
  align-items: center;
}
.page-sys-meta .mono {
  font-family: 'JetBrains Mono', monospace;
  color: var(--text-muted);
}
.page-sys-meta a {
  color: var(--text-muted);
  text-decoration: none;
}
.page-sys-meta a:hover {
  color: var(--text-soft);
  text-decoration: underline;
}

/* network error · live ping chip */
.page-sys-ping {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 14px;
  padding: 6px 12px;
  background: var(--bg-tint);
  border: 1px solid var(--border);
  border-radius: 99px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  color: var(--text-muted);
}
.page-sys-ping .dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--text-faint);
  animation: livePulse 1.6s infinite ease-in-out;
}
.page-sys-ping.up .dot {
  background: var(--primary);
}
/* offline state · muted grey, NEVER red */
.page-sys-ping.down .dot {
  background: var(--text-faint);
}

/* ============================================================
 * .system-page · BEM fallback classes used by the inline
 * renderers inside shared/router.js (renderNotFound,
 * renderError, renderPermissionDenied, renderLoading).
 *
 * Mirrors mockup #11 design language with the same purple
 * radial wash, eyebrow → big title → muted body → action row.
 * Visible immediately when something goes wrong inside the
 * router itself (before a landable system page can mount).
 * ============================================================ */

.system-page {
  min-height: calc(100vh - 56px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 60px 32px 72px;
  background:
    radial-gradient(60% 50% at 50% 0%, rgba(99, 91, 255, 0.06), transparent 70%),
    var(--bg-warm);
  gap: 14px;
}

.system-page__eyebrow {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.10em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin: 0;
}

.system-page__code {
  font-family: 'Inter Tight', system-ui, sans-serif;
  font-weight: 700;
  letter-spacing: -0.044em;
  font-size: 132px;
  line-height: 1;
  margin: 0 0 4px;
  background: var(--grad);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  font-variant-numeric: tabular-nums;
}

.system-page__title {
  font-size: 28px;
  font-weight: 600;
  letter-spacing: -0.018em;
  line-height: 1.2;
  margin: 0;
  color: var(--text);
  max-width: 560px;
}

.system-page__body {
  font-size: 15px;
  color: var(--text-muted);
  line-height: 1.55;
  margin: 0;
  max-width: 520px;
}

.system-page__body b {
  color: var(--text);
  font-weight: 600;
}

.system-page__path {
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  background: var(--bg-tint);
  border: 1px solid var(--border);
  color: var(--text-soft);
  padding: 7px 14px;
  border-radius: 99px;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin-top: 4px;
  max-width: 90%;
}

.system-page__path-label {
  color: var(--text-faint);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  font-weight: 600;
  font-size: 10.5px;
}

.system-page__actions {
  display: flex;
  gap: 10px;
  margin-top: 12px;
  flex-wrap: wrap;
  justify-content: center;
}

.system-page__action,
.system-page__action.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 11px 18px;
  font-size: 14px;
  font-weight: 550;
  border-radius: var(--radius, 8px);
}

.system-page__icon {
  width: 96px;
  height: 96px;
  border-radius: 28px;
  background: var(--surface);
  border: 1px solid var(--border);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 6px;
  position: relative;
  box-shadow: var(--shadow-sm, 0 2px 5px -1px rgba(50, 50, 93, 0.08));
}

.system-page__icon svg {
  width: 44px;
  height: 44px;
  color: var(--primary);
  position: relative;
  z-index: 1;
}

/* Live "reconnecting" ring around the icon for the network state */
.system-page__icon--pulsing::before {
  content: '';
  position: absolute;
  inset: -8px;
  border-radius: 36px;
  border: 1.5px solid var(--primary);
  opacity: 0;
  animation: netRingPulse 2s cubic-bezier(.4, 0, .6, 1) infinite;
}

@keyframes netRingPulse {
  0%   { opacity: .5; transform: scale(.92); }
  100% { opacity: 0;  transform: scale(1.12); }
}

/* Error stack-trace block (renderError only) */
.system-page__stack {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 16px;
  font-size: 12px;
  color: var(--text-muted);
  white-space: pre-wrap;
  word-break: break-word;
  margin-top: 18px;
  font-family: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
  max-width: 720px;
  width: 100%;
  text-align: left;
  max-height: 240px;
  overflow: auto;
}

/* ============================================================
 * Loading skeleton (.page-loading) used by the router while it
 * imports the matched route module. Replaces the prior bare
 * "Loading" text node with a gentle linear shimmer block —
 * no spinner, no bouncy animation, matches mockup STATE 01.
 * ============================================================ */

.page-loading {
  min-height: calc(100vh - 56px);
  padding: 28px 32px 40px;
  background: var(--bg-warm);
  display: flex;
  flex-direction: column;
  gap: 14px;
  font-size: 0;
}

.page-loading::before,
.page-loading::after,
.page-loading > .page-loading__row {
  content: '';
  display: block;
  border-radius: 12px;
  background:
    linear-gradient(90deg,
      var(--bg-tint) 0%,
      var(--bg-soft) 50%,
      var(--bg-tint) 100%);
  background-size: 200% 100%;
  animation: shimmer 1.8s ease-in-out infinite;
}

.page-loading::before {
  height: 168px;
  border: 1px solid var(--status-done-bd);
  margin-bottom: 8px;
}

.page-loading::after {
  height: 220px;
}

.page-loading__row {
  height: 64px;
}

.page-loading__label {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11.5px;
  color: var(--text-muted);
  text-align: center;
  margin-top: 14px;
  letter-spacing: 0.04em;
}

@keyframes shimmer {
  0%   { background-position: -200% 0; }
  100% { background-position:  200% 0; }
}
