/* =========================================================================
   ROSIE — Global layout & base typography
   ========================================================================= */
* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.55;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  letter-spacing: -0.01em;
}

body {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  padding: 0;
}

a {
  color: var(--teal);
  text-decoration: none;
}
a:hover { text-decoration: underline; text-underline-offset: 2px; }

/* ---- App shell --------------------------------------------------------- */
/* Full-bleed column. The header and footer span the viewport; each screen
   owns its own width — dark call-flow screens are centered at a readable
   measure, while light report screens go edge-to-edge (see reports.css). */
.app {
  width: 100%;
  min-width: 0;
  display: flex;
  flex-direction: column;
  flex: 1 0 auto; /* grow to fill height between header and footer */
}

/* ---- Screens ----------------------------------------------------------- */
.screen {
  display: none;
  flex-direction: column;
  gap: 0.5rem;
  position: relative;
  min-width: 0;
}
.screen.active { display: flex; }
.screen > * { min-width: 0; }

/* Dark, centered screens (the live call flow: setup / call / analysis /
   training). Constrained to a readable measure and sitting on the dark
   body background. Light report screens opt out via .report-screen. */
.screen:not(.report-screen) {
  width: 100%;
  max-width: 960px;
  margin: 0 auto;
  padding: 1rem;
}

/* Light report screens fill the width and the available height so the
   light surface reads as a full page, not a card on the dark shell. */
.report-screen.active { flex: 1 0 auto; }


/* Visually lock the setup screen while a call is launching */
.screen[inert] {
  opacity: 0.45;
  transition: opacity 200ms ease;
}

/* ---- Screen header ----------------------------------------------------- */
.screen-header { text-align: center; padding: 0.35rem 0; }
.screen-header h1 {
  font-family: var(--font-display);
  font-size: 1.35rem;
  font-weight: 900;
  color: var(--text);
  letter-spacing: -0.02em;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

/* ---- Live indicator dot ----------------------------------------------- */
.pulse-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--teal);
  box-shadow: 0 0 8px var(--teal-glow);
  animation: pulseDot 1.6s ease-in-out infinite;
}

/* ---- Focus ring -------------------------------------------------------- */
:focus-visible {
  outline: 2px solid var(--teal);
  outline-offset: 2px;
  border-radius: var(--radius-xs);
}

/* ---- App header ---------------------------------------------------------
   Single full-width navy bar (matches the design system appbar): brand +
   byline on the left, the primary page tabs, and the utility icons + account
   avatar pinned to the right. This is the ONLY header — report screens no
   longer carry their own sub-tab bar. */
.app-header {
  width: 100%;
  height: 60px;
  display: flex;
  align-items: stretch;
  gap: 1.25rem;
  padding: 0 26px;
  background: var(--app-nav);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.app-header-brand {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  flex-shrink: 0;
  text-decoration: none;
}

.app-header-logo {
  height: 30px;
  width: auto;
  display: block;
}

/* "Performance Gap Intelligence™" byline — separated from the brand by a
   hairline, as in the design appbar. Hidden on narrow viewports. */
.app-header-byline {
  align-self: center;
  padding-left: 16px;
  border-left: 1px solid rgba(255, 255, 255, 0.16);
  font: 600 11px/1.3 var(--font-body);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.5);
  white-space: nowrap;
  flex-shrink: 0;
}

/* ---- Header primary navigation ---------------------------------------- */
.app-nav {
  display: flex;
  align-items: stretch;
  gap: 2px;
  min-width: 0;
}
.app-nav[hidden] { display: none; }

.app-nav-tab {
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  padding: 0 16px;
  display: inline-flex;
  align-items: center;
  font: 600 13px/1 var(--font-body);
  letter-spacing: -0.01em;
  color: rgba(255, 255, 255, 0.55);
  white-space: nowrap;
  cursor: pointer;
  transition: color var(--dur-micro) var(--ease), border-color var(--dur-micro) var(--ease);
}
.app-nav-tab:hover { color: #fff; }
.app-nav-tab.active { color: #fff; border-bottom-color: var(--yellow); }

/* Right-hand group: utility icons + account avatar */
.app-header-right {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}
/* the avatar menu sets margin-left:auto for the standalone layout — neutralize
   it inside the group so it sits next to the utility icons */
.app-header-right .auth-user-menu { margin-left: 8px; }

/* Utility icons (notifications / help) — match the design appbar buttons. */
.app-header-ic {
  width: 34px;
  height: 34px;
  border-radius: 9px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  color: rgba(255, 255, 255, 0.6);
  cursor: pointer;
  transition: background var(--dur-micro) var(--ease), color var(--dur-micro) var(--ease);
}
.app-header-ic[hidden] { display: none; }
.app-header-ic:hover { background: rgba(255, 255, 255, 0.08); color: #fff; }
.app-header-ic svg { width: 18px; height: 18px; }

/* Collapse non-essential header furniture on narrow viewports so the brand,
   tabs, and avatar always fit. */
@media (max-width: 860px) { .app-header-byline { display: none; } }
@media (max-width: 620px) {
  .app-header { gap: 0.75rem; padding: 0 14px; }
  .app-header-ic { display: none; }
  .app-nav { overflow-x: auto; }
}

/* ---- Footer ------------------------------------------------------------ */
.app-footer {
  width: 100%;
  margin-top: auto;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 0.5rem;
  padding: 0.8rem 26px;
  border-top: 1px solid var(--border);
  font-size: 0.62rem;
  color: var(--text-faint);
  letter-spacing: 0.05em;
}

.footer-logo {
  height: 20px;
  width: auto;
  display: block;
  opacity: 0.7;
}

.brand-link {
  color: inherit;
  text-decoration: none;
  font-weight: 700;
}
.brand-link:hover { text-decoration: underline; text-underline-offset: 2px; }

.footer-wordmark {
  font-family: var(--font-display);
  font-size: 0.72rem;
  font-weight: 900;
  font-style: italic;
  color: var(--text-muted);
  letter-spacing: -0.02em;
}

.footer-sep {
  color: var(--border-emph);
  user-select: none;
}
