*, *::before, *::after {
  box-sizing: border-box;
}

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  overflow-x: clip;
}

body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: 0.9375rem;
  line-height: 1.65;
  color: var(--ink-primary);
  background-color: var(--bg-canvas);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: clip;
}

h1, h2, h3, h4, p, ul, ol, figure, blockquote {
  margin: 0;
}

img {
  display: block;
  max-width: 100%;
  height: auto;
}

button, input, select, textarea {
  font: inherit;
  color: inherit;
  min-width: 0;
  max-width: 100%;
}

button {
  cursor: pointer;
  touch-action: manipulation;
}

a {
  color: inherit;
}

code, pre, .mono {
  font-family: var(--font-mono);
}

.tabular {
  font-variant-numeric: tabular-nums;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.hidden {
  display: none !important;
}

/* Accessible visible focus rings */
:focus-visible {
  outline: 2.5px solid var(--accent-primary);
  outline-offset: 2px;
}

/* =========================================================
   TRAINEE HOME ENTRY SCREEN (FRIENDLY HERO + ILLUSTRATION)
   ========================================================= */
.entry-screen {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 28px 24px 44px;
  background:
    radial-gradient(circle at 8% 12%, rgba(253, 186, 116, 0.18) 0%, transparent 38%),
    radial-gradient(circle at 92% 88%, rgba(15, 118, 110, 0.10) 0%, transparent 40%),
    var(--bg-canvas);
}

.entry-container {
  width: 100%;
  max-width: 1120px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 28px;
}

.entry-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.entry-hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 0.95fr);
  gap: 32px;
  align-items: center;
}

.entry-hero-copy {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.entry-kicker {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  align-self: flex-start;
  padding: 6px 13px;
  border-radius: var(--radius-pill);
  background: var(--accent-tint);
  border: 1px solid var(--accent-border);
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--accent-primary);
}

.entry-title {
  font-size: clamp(1.85rem, 3.6vw, 2.75rem);
  font-weight: 800;
  line-height: 1.16;
  letter-spacing: -0.03em;
  color: var(--cocoa-dark);
}

.entry-title-highlight {
  color: var(--accent-primary);
}

.entry-subtitle {
  font-size: 1rem;
  color: var(--ink-secondary);
  max-width: 560px;
  line-height: 1.6;
}

.entry-feature-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.entry-hero-visual {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
}

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

/* =========================================================
   DEDICATED /admin MENTOR ENTRY SCREEN
   ========================================================= */
.admin-entry-screen {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 28px 20px 44px;
  background:
    radial-gradient(circle at 80% 18%, rgba(15, 118, 110, 0.11) 0%, transparent 42%),
    radial-gradient(circle at 18% 85%, rgba(217, 119, 6, 0.12) 0%, transparent 40%),
    var(--bg-canvas);
}

.admin-entry-shell {
  width: 100%;
  max-width: 480px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* =========================================================
   AUTHENTICATED WORKSPACE SHELL
   ========================================================= */
.app-shell {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  min-width: 0;
  max-width: 100%;
}

.top-bar {
  position: sticky;
  top: 0;
  z-index: var(--z-header);
  height: var(--header-height);
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border-subtle);
  padding: 0 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: nowrap;
  gap: 12px;
  width: 100%;
  max-width: 100%;
}

.top-bar-left {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  flex: 0 1 auto;
}

.brand-lockup {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.brand-mark {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  background: linear-gradient(135deg, var(--accent-primary) 0%, var(--accent-warm) 100%);
  color: #FFFFFF;
  display: grid;
  place-items: center;
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  font-weight: 700;
  flex-shrink: 0;
  letter-spacing: -0.03em;
  box-shadow: var(--shadow-xs);
}

.brand-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.brand-name {
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: -0.015em;
  color: var(--ink-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.brand-sub {
  font-size: 0.72rem;
  color: var(--ink-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.top-nav {
  display: flex;
  align-items: center;
  gap: 4px;
  background: var(--bg-inset);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-pill);
  padding: 4px;
  flex: 0 1 auto;
  min-width: 0;
}

.top-bar-right {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex: 0 1 auto;
  min-width: 0;
}

.shell-body {
  display: flex;
  flex: 1;
  min-height: calc(100dvh - var(--header-height));
  min-width: 0;
  max-width: 100%;
  position: relative;
}

/* =========================================================
   LEFT JOURNEY RAIL (DESKTOP) & DRAWER (MOBILE/TABLET)
   ========================================================= */
.left-rail {
  width: var(--rail-width);
  flex-shrink: 0;
  background: var(--bg-inset);
  border-right: 1px solid var(--border-subtle);
  height: calc(100dvh - var(--header-height));
  position: sticky;
  top: var(--header-height);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transition: width var(--duration-base) var(--ease-standard);
}

.app-shell.rail-collapsed .left-rail {
  width: 0;
  border-right-width: 0;
}

.rail-inner {
  width: var(--rail-width);
  height: 100%;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  padding: 16px 14px 28px;
}

.rail-drawer-header {
  display: none;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 12px;
  margin-bottom: 12px;
  border-bottom: 1px solid var(--border-subtle);
}

.rail-backdrop {
  display: none;
}

.main-viewport {
  flex: 1;
  min-width: 0;
  max-width: 100%;
  padding: 24px 30px 76px;
}

.content-container {
  width: 100%;
  max-width: var(--content-max-width);
  min-width: 0;
  margin: 0 auto;
}

.content-container--wide {
  max-width: var(--wide-max-width);
}

/* =========================================================
   MOBILE STICKY BOTTOM NAVIGATION
   ========================================================= */
.mobile-bottom-nav {
  display: none;
}

.mobile-only-inline {
  display: none !important;
}

.desktop-only-inline {
  display: inline-flex;
}

/* =========================================================
   RESPONSIVE BREAKPOINTS
   ========================================================= */
@media (max-width: 1420px) {
  .brand-sub {
    display: none;
  }

  .top-nav-btn {
    padding: 7px 11px;
    font-size: 0.8125rem;
  }
}

@media (max-width: 1180px) {
  .top-nav-btn {
    padding: 7px 9px;
    font-size: 0.78125rem;
  }

  .brand-text {
    display: none;
  }
}

@media (max-width: 1023px) {
  .desktop-rail-toggle {
    display: none !important;
  }

  .mobile-only-inline {
    display: inline-flex !important;
  }

  .entry-hero-grid {
    grid-template-columns: minmax(0, 1fr);
    gap: 24px;
  }

  .entry-hero-visual {
    order: -1;
  }

  .entry-tiers-strip {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .left-rail {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    height: 100dvh;
    width: min(88vw, 340px);
    z-index: var(--z-drawer);
    transform: translateX(-105%);
    transition: transform var(--duration-base) var(--ease-standard);
    box-shadow: var(--shadow-lg);
  }

  .app-shell.rail-collapsed .left-rail {
    width: min(88vw, 340px);
    border-right: 1px solid var(--border-subtle);
  }

  .app-shell.mobile-rail-open .left-rail {
    transform: translateX(0);
  }

  .rail-inner {
    width: 100%;
    padding-top: 16px;
  }

  .rail-drawer-header {
    display: flex;
  }

  .rail-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(28, 25, 23, 0.45);
    backdrop-filter: blur(2px);
    z-index: var(--z-drawer-backdrop);
  }

  .app-shell.mobile-rail-open .rail-backdrop {
    display: block;
  }

  .main-viewport {
    padding: 18px 18px 76px;
  }
}

@media (max-width: 767px) {
  .entry-screen {
    padding: 18px 14px 32px;
  }

  .entry-tiers-strip {
    grid-template-columns: minmax(0, 1fr);
    gap: 10px;
  }

  .top-bar {
    padding: 0 10px;
    gap: 6px;
  }

  .top-bar-left {
    flex: 0 0 auto;
    gap: 7px;
  }

  .top-bar-right {
    flex: 1 1 auto;
    min-width: 0;
    gap: 6px;
  }

  .brand-mark {
    width: 32px;
    height: 32px;
    font-size: 0.75rem;
  }

  .top-nav {
    display: none;
  }

  .desktop-only-inline {
    display: none !important;
  }

  .brand-text {
    display: none;
  }

  .main-viewport {
    padding: 14px 12px calc(var(--mobile-nav-height) + 24px);
  }

  .mobile-bottom-nav {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: var(--z-bottom-nav);
    height: calc(var(--mobile-nav-height) + env(safe-area-inset-bottom, 0px));
    padding-bottom: env(safe-area-inset-bottom, 0px);
    background: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(12px);
    border-top: 1px solid var(--border-subtle);
    box-shadow: 0 -4px 16px rgba(67, 20, 7, 0.06);
  }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
