/* ============================================================================
   RiskTriage AI — application layout
   Built on top of the A!thera tokens in athera.css. Owns the shared shell
   (header, nav, main, footer) that shared.js injects, plus a small set of
   layout primitives the screens (sessions 3–5) reuse. Restraint first:
   generous whitespace, one blue accent per region, the thin blue rule as the
   only divider flourish.
   ============================================================================ */

/* Full-height column so the footer rests at the bottom on short pages. */
body {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* --- Header ---------------------------------------------------------------- */
.app-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(248, 247, 244, 0.92);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--athera-line);
}
.app-header__inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 48px;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}
.app-brand {
  display: inline-flex;
  align-items: baseline;
  gap: 8px;
  text-decoration: none;
}
.app-brand:hover { text-decoration: none; }
.app-brand__name {
  font-family: var(--athera-display);
  font-weight: 300;
  font-size: 24px;
  letter-spacing: -0.01em;
  color: var(--athera-charcoal);
}
.app-brand__ai {
  font-family: var(--athera-sans);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--athera-blue-deep);
}

.app-nav {
  display: flex;
  align-items: center;
  gap: 28px;
}
.app-nav__link {
  font-family: var(--athera-sans);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--athera-grey);
  padding: 6px 0;
  border-bottom: 1px solid transparent;
  transition: color 0.2s ease, border-color 0.2s ease;
}
.app-nav__link:hover { color: var(--athera-charcoal); text-decoration: none; }
.app-nav__link--active {
  color: var(--athera-charcoal);
  border-bottom-color: var(--athera-blue);
}

/* --- Main ------------------------------------------------------------------ */
.app-main { flex: 1 0 auto; }
.app-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 56px 48px 96px;
}
.app-container--narrow { max-width: 880px; }

/* --- Page head primitive --------------------------------------------------- */
.app-page-head { margin-bottom: 40px; }
.app-page-head__title { margin: 12px 0 0; }
.app-page-head .athera-blue-rule { margin-top: 24px; }

/* --- Generic primitives the screens reuse ---------------------------------- */
.app-panel {
  background: var(--athera-white);
  border: 1px solid var(--athera-line);
  border-radius: 4px;
  padding: 28px;
}
.app-panel--quiet { background: var(--athera-surface); }

.app-grid { display: grid; gap: 24px; }
.app-grid--2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.app-grid--3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.app-split { display: grid; gap: 32px; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }

.app-muted { color: var(--athera-grey); }
.app-stat { font-family: var(--athera-display); font-weight: 300; font-size: 40px; line-height: 1; color: var(--athera-charcoal); }

/* Key/value rows (e.g. customer profile, alert metadata) */
.app-kv { display: grid; grid-template-columns: 180px 1fr; gap: 10px 20px; }
.app-kv dt { font-family: var(--athera-sans); font-size: 10px; font-weight: 500; letter-spacing: 0.14em; text-transform: uppercase; color: var(--athera-grey-light); align-self: center; }
.app-kv dd { margin: 0; font-size: 14px; color: var(--athera-charcoal); }

/* Neutral status pill for alert status (distinct from risk badges) */
.app-status {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border: 1px solid var(--athera-line);
  border-radius: 2px;
  background: var(--athera-surface);
  font-family: var(--athera-sans);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--athera-charcoal-light);
  white-space: nowrap;
}

/* Numeric / amount alignment helper */
.app-num { font-family: var(--athera-mono); font-size: 12px; color: var(--athera-charcoal); }
.app-row-link { cursor: pointer; }
.app-row-link:hover td { background: var(--athera-surface); }

/* --- Footer ---------------------------------------------------------------- */
.app-footer {
  flex-shrink: 0;
  border-top: 1px solid var(--athera-line);
  background: var(--athera-white);
}
.app-footer__inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 36px 48px 56px;
  display: flex;
  flex-direction: column;
  gap: 22px;
}
.app-footer__top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 32px;
  flex-wrap: wrap;
}
.app-footer__endorse { display: flex; flex-direction: column; gap: 8px; }
.app-footer__endorse .athera-wordmark { font-size: 26px; }
.app-footer__meta { text-align: right; }
.app-footer__disclaimer {
  margin: 0;
  max-width: 760px;
  font-family: var(--athera-sans);
  font-size: 12px;
  font-weight: 400;
  line-height: 1.6;
  color: var(--athera-grey);
}

/* --- Responsive ------------------------------------------------------------ */
@media (max-width: 720px) {
  .app-header__inner { padding: 0 24px; gap: 16px; }
  .app-nav { gap: 18px; }
  .app-container { padding: 40px 24px 72px; }
  .app-footer__inner { padding: 32px 24px 44px; }
  .app-grid--2, .app-grid--3, .app-split { grid-template-columns: minmax(0, 1fr); }
  .app-kv { grid-template-columns: 1fr; gap: 4px 0; }
  .app-kv dd { margin-bottom: 12px; }
  .app-footer__meta { text-align: left; }
}
