:root {
  --page-background: #f0f3fd;
  --primary: #645ed6;
  --secondary: #cdd6f8;
  --heading: #222046;
  --muted: #8989a1;
  /* Keep in sync with sidebar widths (80px / 236px). */
  --menu-collapsed-width: 80px;
  --menu-expanded-width: 236px;
  --current-menu-width: var(--menu-collapsed-width);
}

body.error-body {
  overflow: hidden;
  background: var(--page-background);
  color: var(--heading);
}

.error-page {
  position: fixed;
  inset: 0;
  overflow: hidden;
  background: var(--page-background);
}

.error-screen {
  position: relative;
  display: flex;
  width: 100%;
  height: 100vh;
  overflow: hidden;
  padding: 0;
  margin: 0;
  background: var(--page-background);
}

.error-screen:has(.sidebar.expanded) {
  --current-menu-width: var(--menu-expanded-width);
}

.error-screen:not(:has(.sidebar)) {
  --current-menu-width: 0px;
}

.error-content {
  box-sizing: border-box;
  flex: 1 1 auto;
  min-width: 0;
  width: 100%;
  margin: 0;
  margin-left: var(--current-menu-width);
  padding: 48px 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  text-align: center;
  transition: margin-left 180ms ease;
}

.error-illustration {
  width: min(349px, 60vw);
  max-width: 100%;
  height: auto;
  object-fit: contain;
  flex: 0 0 auto;
  user-select: none;
  pointer-events: none;
}

.error-title {
  box-sizing: border-box;
  width: 100%;
  max-width: min(1000px, 100%);
  margin: 0;
  padding: 0;
  color: var(--heading);
  font-size: clamp(28px, 4.5vw, 64px);
  line-height: 1.15;
  font-weight: 700;
  overflow-wrap: anywhere;
}

.error-description {
  box-sizing: border-box;
  width: 100%;
  max-width: min(720px, 100%);
  margin: 0;
  color: var(--muted);
  font-size: clamp(16px, 2vw, 20px);
  line-height: 1.4;
}

.error-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 14px;
  width: 100%;
  max-width: min(680px, 100%);
  margin-top: 8px;
}

.error-action {
  box-sizing: border-box;
  height: 65px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 8px;
  padding: 0 24px;
  text-decoration: none;
  font-size: 18px;
  line-height: 22px;
  font-weight: 400;
  cursor: pointer;
  transition: filter 140ms ease, transform 80ms ease;
}

.error-action:hover {
  filter: brightness(1.025);
}

.error-action:active {
  transform: translateY(1px);
}

.error-action-primary {
  width: min(329px, 100%);
  background: var(--primary);
  color: #fff;
}

.error-action-secondary {
  width: min(296px, 100%);
  background: var(--secondary);
  color: var(--heading);
}

.error-action:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 3px;
}

.error-screen .sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  height: 100%;
}

@media (max-height: 700px) {
  .error-content {
    gap: 12px;
    padding: 24px 16px;
  }

  .error-illustration {
    width: min(220px, 50vw);
  }

  .error-title {
    font-size: clamp(24px, 5vw, 40px);
  }

  .error-action {
    height: 52px;
    font-size: 16px;
  }
}
