/* ============================================================================
   RetentionCopilot AI — Application layout
   Layers on top of brand.css. Owns: page shell, header / nav, footer,
   risk + status badges, and motion. One A! blue accent per viewport.
   ============================================================================ */

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--athera-off-white);
  color: var(--athera-charcoal);
  font-family: var(--athera-sans);
  font-weight: 400;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* ---- Page shell ----------------------------------------------------------- */
.page {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 48px;
}
main.page { flex: 1 0 auto; }

.section { padding: 80px 0; }
.section--tight { padding: 48px 0; }

@media (max-width: 720px) {
  .page { padding: 0 24px; }
  .section { padding: 56px 0; }
}

/* ---- Header / nav --------------------------------------------------------- */
.app-header {
  border-bottom: 1px solid var(--athera-line);
  background: var(--athera-white);
}
.app-header__inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 20px 48px;
  display: flex;
  align-items: center;
  gap: 32px;
}
.app-header__brand {
  display: flex;
  align-items: baseline;
  gap: 16px;
  text-decoration: none;
  flex-shrink: 0;
}
.app-header__wordmark {
  font-family: var(--athera-display);
  font-size: 26px;
  font-weight: 300;
  color: var(--athera-charcoal);
  letter-spacing: -0.01em;
  line-height: 1;
}
.app-header__product {
  font-family: var(--athera-sans);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--athera-grey);
  white-space: nowrap;
}
.app-header__persona {
  margin-left: auto;
  text-align: right;
  line-height: 1.4;
  flex-shrink: 0;
}
.app-header__persona-name {
  font-family: var(--athera-sans);
  font-size: 13px;
  font-weight: 500;
  color: var(--athera-charcoal);
}
.app-header__persona-role {
  font-family: var(--athera-sans);
  font-size: 11px;
  font-weight: 400;
  color: var(--athera-grey);
}

.app-nav {
  border-bottom: 1px solid var(--athera-line);
  background: var(--athera-white);
}
.app-nav__inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 48px;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.app-nav__link {
  position: relative;
  padding: 14px 4px;
  margin-right: 24px;
  font-family: var(--athera-sans);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--athera-grey);
  text-decoration: none;
  transition: color 0.2s ease;
}
.app-nav__link:hover { color: var(--athera-charcoal); }
.app-nav__link--active { color: var(--athera-charcoal); }
.app-nav__link--active::after {
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: -1px;
  height: 2px;
  background: var(--athera-blue);
}

@media (max-width: 720px) {
  .app-header__inner,
  .app-nav__inner { padding-left: 24px; padding-right: 24px; }
  .app-header__inner { flex-wrap: wrap; gap: 12px 24px; }
  .app-header__persona { margin-left: 0; text-align: left; width: 100%; order: 3; }
}

/* ---- Footer --------------------------------------------------------------- */
.app-footer {
  flex-shrink: 0;
  margin-top: 80px;
  border-top: 1px solid var(--athera-line);
  background: var(--athera-white);
}
.app-footer__inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 40px 48px;
  display: flex;
  align-items: flex-start;
  gap: 28px;
}
.app-footer__emblem { width: 28px; height: 28px; flex-shrink: 0; opacity: 0.9; }
.app-footer__body { max-width: 760px; }
.app-footer__disclaimer {
  font-family: var(--athera-sans);
  font-size: 12px;
  font-weight: 400;
  line-height: 1.7;
  color: var(--athera-grey);
}
.app-footer__meta {
  margin-top: 12px;
  font-family: var(--athera-mono);
  font-size: 10px;
  color: var(--athera-grey-light);
}
@media (max-width: 720px) {
  .app-footer__inner { padding: 32px 24px; }
}

/* ---- Badges --------------------------------------------------------------
   Never colour alone: each badge pairs a colour with a label AND a shape
   glyph so the level reads without relying on hue (WCAG-friendly).
   --------------------------------------------------------------------------- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 4px 10px;
  border-radius: 2px;
  border: 1px solid transparent;
  font-family: var(--athera-sans);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  white-space: nowrap;
  line-height: 1;
}
.badge__glyph {
  width: 8px; height: 8px;
  flex-shrink: 0;
  display: inline-block;
}

/* Risk / urgency levels — shape encodes level independent of colour:
   Low = circle, Medium = square (rotated diamond), High = triangle. */
.badge--low {
  background: rgba(95, 184, 214, 0.10);
  border-color: rgba(95, 184, 214, 0.35);
  color: var(--athera-blue-deep);
}
.badge--low .badge__glyph { border-radius: 50%; background: var(--athera-blue-deep); }

.badge--medium {
  background: rgba(200, 149, 90, 0.12);
  border-color: rgba(200, 149, 90, 0.40);
  color: #8a5e2b;
}
.badge--medium .badge__glyph {
  background: #8a5e2b;
  transform: rotate(45deg);
  width: 7px; height: 7px;
}

.badge--high {
  background: rgba(55, 65, 81, 0.06);
  border-color: rgba(55, 65, 81, 0.30);
  color: var(--athera-charcoal);
}
.badge--high .badge__glyph {
  width: 0; height: 0;
  background: transparent;
  border-left: 5px solid transparent;
  border-right: 5px solid transparent;
  border-bottom: 9px solid var(--athera-charcoal);
}

/* Status badges — open / resolved / none / escalated.
   Shape glyph distinguishes them beyond colour. */
.badge--status {
  background: var(--athera-surface);
  border-color: var(--athera-line);
  color: var(--athera-charcoal-light);
}
.badge--status .badge__glyph {
  border-radius: 50%;
  background: var(--athera-grey-light);
}
.badge--status-open .badge__glyph { background: var(--athera-amber); }
.badge--status-escalated .badge__glyph {
  background: var(--athera-charcoal);
  border-radius: 0;
  transform: rotate(45deg);
  width: 7px; height: 7px;
}
.badge--status-resolved .badge__glyph {
  border-radius: 50%;
  background: var(--athera-blue-deep);
}

/* ---- Motion --------------------------------------------------------------- */
a, button, .badge, .athera-button-primary, .athera-button-secondary, .app-nav__link {
  transition: all 0.2s ease;
}

@keyframes athera-fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}
.fade-in { animation: athera-fade-in 0.3s ease both; }

/* ---- Loading / error states ----------------------------------------------- */
.state {
  padding: 48px;
  text-align: center;
  border: 1px solid var(--athera-line);
  border-radius: 4px;
  background: var(--athera-white);
}
.state__label {
  font-family: var(--athera-sans);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--athera-grey);
}
.state__message {
  margin-top: 10px;
  font-family: var(--athera-sans);
  font-size: 15px;
  color: var(--athera-charcoal-light);
}
.state--error .state__label { color: var(--athera-amber); }

.skeleton {
  background: linear-gradient(90deg, var(--athera-surface) 25%, var(--athera-mist) 50%, var(--athera-surface) 75%);
  background-size: 200% 100%;
  animation: athera-shimmer 1.4s ease infinite;
  border-radius: 3px;
}
@keyframes athera-shimmer {
  from { background-position: 200% 0; }
  to { background-position: -200% 0; }
}

/* ---- Accessibility -------------------------------------------------------- */
a:focus-visible,
button:focus-visible,
.athera-button-primary:focus-visible,
.athera-button-secondary:focus-visible,
.app-nav__link:focus-visible {
  outline: 2px solid var(--athera-blue-deep);
  outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
}
