/* ========================================================== app chrome
   The old header was three stacked bars before a single piece of content:
   a white brand bar, a "Signed in:" bar, and two rows of wrapped tab boxes.
   On a 375px phone that is about 190px — a quarter of the screen — gone
   before the nom sees a single earth.

   It is now two compact rows: brand and status, then a tab rail that scrolls
   sideways instead of wrapping. Who you are signed in as moves into a menu
   behind an initials button, because it matters (you must never act in
   someone else's session) but it does not need a permanent bar.
   ---------------------------------------------------------------------- */

header.app.appbar {
  position: relative; z-index: 40;
  /* The old header rule makes this a flex container, which sized .appbar-in
     to its content; its `margin: 0 auto` then centred the whole brand in the
     bar instead of leaving it against the left edge. */
  display: block;
  padding: 0;
  background: #070b08;
  border-bottom: 1px solid rgba(255, 255, 255, .07);
  overflow: visible;
}

/* the sign-in photograph carries through into the header, heavily darkened so
   the brand and the status still read against it */
.appbar-photo {
  position: absolute; inset: var(--sa-top) 0 0 0; z-index: 0; pointer-events: none;
  /* The photograph is meant to be seen. It was at .62 opacity under a 92%
     black wash, which left a dark smear instead of a sunset — so it reads at
     full strength now, and only the left third is darkened enough to carry
     the wordmark. */
  background: url("assets/header-rail.jpg") center 56% / cover no-repeat;
  opacity: 1;
}
.appbar-photo::after {
  content: ""; position: absolute; inset: 0;
  background:
    /* weight under the brand only */
    linear-gradient(95deg, rgba(5, 8, 6, .88) 0%, rgba(5, 8, 6, .5) 30%,
                           rgba(5, 8, 6, .12) 56%, rgba(5, 8, 6, .3) 100%),
    /* and a fade into the page along the bottom edge */
    linear-gradient(180deg, rgba(5, 8, 6, 0) 52%, rgba(5, 8, 6, .72) 86%, #070b08 100%);
}

.appbar-in {
  position: relative; z-index: 1;
  /* top, not centre: the wordmark lines up with the status pill opposite it,
     and the photograph keeps the whole lower band to itself */
  display: flex; align-items: flex-start; justify-content: space-between; gap: 12px;
  max-width: 980px; margin: 0 auto;
  padding: 20px 16px 30px;      /* room for the scene under the brand */
  padding-top: calc(20px + var(--sa-top));
  padding-left: calc(16px + var(--sa-left));
  padding-right: calc(16px + var(--sa-right));
  min-height: calc(118px + var(--sa-top));
}

.appbar-brand { display: flex; align-items: flex-start; gap: 12px; min-width: 0; }
.jr-mark { margin-top: 2px; }
.jr-mark { width: 34px; height: 29px; flex: 0 0 auto; }
.appbar-words { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.appbar-words b {
  font-family: var(--font-display, inherit);
  font-size: 21px; font-weight: 800; letter-spacing: .4px; line-height: 1.12;
  color: #fff;
  text-shadow: 0 2px 10px rgba(0, 0, 0, .75);
}
.appbar-words i {
  font-style: normal; font-size: 12px; font-weight: 500; line-height: 1.2;
  color: #c6d4c9;
  text-shadow: 0 1px 8px rgba(0, 0, 0, .8);
}

/* stacked: the status sits above the account button, clear of the brand */
.appbar-right {
  display: flex; flex-direction: column; align-items: flex-end;
  gap: 9px; flex-shrink: 0;
}

/* The status pill and the account button sit over a sunset. Translucent,
   they vanished into it. Both are opaque now, so they read against whatever
   part of the photograph they happen to land on — and in daylight on site. */
/* The status sits under the wordmark, not beside it: in the top row it
   crowded the brand against the account button and left the photograph with
   no clear space at all. */
.appbar-right .offline-pill {
  align-self: flex-end;
  display: inline-flex; align-items: center; gap: 7px;
  height: 30px; padding: 0 12px;
  border-radius: 999px;
  font-size: 11px; font-weight: 700; letter-spacing: .9px;
  color: #e6f3ea;
  background: rgba(7, 12, 9, .88);
  border: 1px solid rgba(255, 255, 255, .2);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  box-shadow: 0 4px 16px rgba(0, 0, 0, .5);
}
.appbar-right .offline-pill::before {
  content: ""; width: 8px; height: 8px; border-radius: 50%; flex: 0 0 auto;
  background: #2fe36a; box-shadow: 0 0 9px rgba(47, 227, 106, .9);
}
.appbar-right .offline-pill.off { color: #ffcac5; border-color: rgba(229, 67, 60, .55); }
.appbar-right .offline-pill.off::before { background: #ff6a60; box-shadow: 0 0 9px rgba(255, 106, 96, .9); }

.appbar-user {
  display: flex; align-items: center; gap: 2px;
  height: 38px; padding: 0 6px 0 3px;
  border-radius: 999px; cursor: pointer;
  background: rgba(7, 12, 9, .88);
  border: 1px solid rgba(47, 227, 106, .68);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  box-shadow: 0 4px 16px rgba(0, 0, 0, .5);
  color: #d9ffe8;
}
.appbar-user > span {
  display: grid; place-items: center;
  width: 31px; height: 31px; border-radius: 50%;
  background: rgba(47, 227, 106, .26);
  color: #9affc2;
  font-family: var(--font-display, inherit);
  font-size: 11.5px; font-weight: 800; letter-spacing: .4px;
}
.appbar-user svg { width: 14px; height: 14px; }
.appbar-user:hover { background: rgba(14, 24, 17, .94); border-color: rgba(47, 227, 106, .9); }
.appbar-user[aria-expanded="true"] svg { transform: rotate(180deg); }

.appbar-menu {
  position: absolute; right: 14px; top: 84px;
  min-width: 216px; padding: 14px;
  border-radius: 16px;
  background: rgba(12, 18, 14, .98);
  border: 1px solid rgba(255, 255, 255, .11);
  box-shadow: 0 20px 48px rgba(0, 0, 0, .66);
  z-index: 60;
}
.appbar-menu[hidden] { display: none; }
.appbar-menu-who { display: flex; flex-direction: column; gap: 5px; margin-bottom: 12px; }
.appbar-menu-who b { font-size: 15px; color: #eef3ee; line-height: 1.25; }
.appbar-menu-who span {
  align-self: flex-start; padding: 3px 9px; border-radius: 999px;
  font-size: 10px; font-weight: 700; letter-spacing: 1px;
  background: rgba(47, 227, 106, .14); color: #6bffa0;
  border: 1px solid rgba(47, 227, 106, .34);
}
.appbar-menu a {
  display: block; padding: 11px 12px; border-radius: 10px;
  font-size: 14px; color: #ff9a92; text-decoration: none; text-align: center;
  background: rgba(255, 255, 255, .04);
  border: 1px solid rgba(255, 255, 255, .08);
}
.appbar-menu a:hover { background: rgba(255, 90, 80, .14); border-color: rgba(255, 90, 80, .4); }

/* ---------------------------------------------------------------- tabs
   Icon above label, in a row of equal cards. Five fit a phone; anything past
   the fourth destination goes under More, so the row never wraps and never
   scrolls out of reach. */
.tabs {
  display: grid; gap: 9px;
  grid-auto-flow: column; grid-auto-columns: 1fr;
  max-width: 980px; margin: 0 auto;
  padding: 14px 16px 6px;
  padding-left: calc(16px + var(--sa-left));
  padding-right: calc(16px + var(--sa-right));
  background: none; border: 0; overflow: visible;
}
.tabs button {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 7px;
  min-height: 86px; padding: 10px 4px;
  border-radius: 16px; cursor: pointer;
  font-size: 11.5px; font-weight: 600; line-height: 1.2; text-align: center;
  color: #b8c6bd;
  background: rgba(255, 255, 255, .04);
  border: 1px solid rgba(255, 255, 255, .085);
  transition: background .15s, color .15s, border-color .15s;
}
.tabs button svg { width: 24px; height: 24px; flex: 0 0 auto; }
.tabs button:hover { background: rgba(255, 255, 255, .075); color: #eef3ee; }
.tabs button.on {
  color: #ffffff; font-weight: 700;
  background: linear-gradient(170deg, rgba(47, 227, 106, .34), rgba(18, 146, 74, .22));
  border-color: rgba(47, 227, 106, .72);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .16);
}
.tabs button.on svg { color: #9affc2; }

/* the overflow sheet behind More */
/* fixed, so the top we compute from getBoundingClientRect lines up whatever
   the page is scrolled to */
.tab-more {
  position: fixed; right: calc(14px + var(--sa-right)); z-index: 55;
  min-width: 200px; padding: 8px;
  border-radius: 16px;
  background: rgba(12, 18, 14, .98);
  border: 1px solid rgba(255, 255, 255, .11);
  box-shadow: 0 20px 48px rgba(0, 0, 0, .66);
}
.tab-more[hidden] { display: none; }
.tab-more button {
  display: flex; align-items: center; gap: 11px; width: 100%;
  padding: 12px; border: 0; border-radius: 11px; cursor: pointer;
  background: none; color: #dbe6de; font-size: 14px; text-align: left;
}
.tab-more button svg { width: 19px; height: 19px; color: #6bffa0; }
.tab-more button:hover { background: rgba(255, 255, 255, .06); }
.tab-more button.on { background: rgba(47, 227, 106, .16); color: #fff; }

@media (max-width: 400px) {
  .appbar-in {
    padding: 17px 14px 26px;
    padding-top: calc(17px + var(--sa-top));
    padding-left: calc(14px + var(--sa-left));
    padding-right: calc(14px + var(--sa-right));
    min-height: calc(108px + var(--sa-top));
  }
  .appbar-words b { font-size: 19px; }
  .jr-mark { width: 30px; height: 26px; }
  .tabs {
    gap: 7px; padding: 12px 14px 4px;
    padding-left: calc(14px + var(--sa-left));
    padding-right: calc(14px + var(--sa-right));
  }
  .tabs button { min-height: 78px; font-size: 10.5px; border-radius: 14px; }
  .tabs button svg { width: 21px; height: 21px; }
}

/* ====================================================== page furniture */

.page-head { padding: 22px 0 16px; }
.page-head h1 {
  margin: 0; font-size: 32px; line-height: 1.16; font-weight: 800;
  letter-spacing: -.5px; color: #f2f7f2;
}
.page-sub { margin: 7px 0 0; font-size: 14px; line-height: 1.5; color: #8fa094; }

.section-head {
  margin: 26px 0 12px; font-size: 12px; font-weight: 700;
  letter-spacing: 2px; text-transform: uppercase; color: #7f9086;
}
/* the card styling itself lives in cards.css */

.hint { color: #7f9086; font-weight: 400; letter-spacing: 0; }

@media (max-width: 400px) {
  .page-head h1 { font-size: 27px; }
}

/* The stale-data notice is an empty wrapper most of the time, and .wrap gives
   it padding, which left a gap under the tab rail on every screen. */
#staleNote:empty { display: none; }

/* Every screen draws its first thing the same distance below the tab rail.
   Only Isolations has a .page-head, so hanging the gap off that gave the
   board, the fleet and the rest no breathing room at all — the gap belongs
   to the content area, not to one heading. */
/* clear of the gesture bar at the foot of the screen */
#main { padding-top: 14px; padding-bottom: var(--sa-bottom); }
.page-head { padding-top: 0; }
/* ...and nothing adds its own margin on top of that shared gap. Network
   control and Reports open on a bare h1, which carried 18px of its own and
   sat noticeably lower than every other screen. */
#main > div > h1:first-child,
#main > div > h2:first-child { margin-top: 0; }

/* ================================================= moving between screens
   Each screen arrives rather than appearing: the page settles up into place
   while the first few blocks follow a beat behind it. Transform and opacity
   only, so it runs on the compositor and costs a phone battery nothing.

   The delay is deliberately short — a nom switching to the Board in the
   middle of an isolation must not wait on choreography to read a count.
   ---------------------------------------------------------------------- */

@keyframes view-in {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: none; }
}
@keyframes view-child-in {
  from { opacity: 0; transform: translateY(14px); }
  to   { opacity: 1; transform: none; }
}

/* `backwards`, never `both`: it holds the from-state during the delay but
   hands the element back to its own styles at the end. With `both` a screen
   whose animation never starts — a throttled background tab, a browser that
   skips it — stays on the from-state forever, which is an invisible page. */
#main > div.view-in {
  animation: view-in .3s cubic-bezier(.22, .9, .3, 1) backwards;
}

/* the first few blocks cascade; everything below simply rides the parent */
#main > div.view-in > :nth-child(-n+5) {
  animation: view-child-in .42s cubic-bezier(.22, .9, .3, 1) backwards;
}
#main > div.view-in > :nth-child(1) { animation-delay: .03s; }
#main > div.view-in > :nth-child(2) { animation-delay: .07s; }
#main > div.view-in > :nth-child(3) { animation-delay: .11s; }
#main > div.view-in > :nth-child(4) { animation-delay: .15s; }
#main > div.view-in > :nth-child(5) { animation-delay: .19s; }

/* the tab you land on acknowledges the press */
@keyframes tab-land {
  0%   { transform: scale(1); }
  40%  { transform: scale(1.06); }
  100% { transform: scale(1); }
}
.tabs button.on { animation: tab-land .32s cubic-bezier(.3, 1.4, .4, 1); }

@media (prefers-reduced-motion: reduce) {
  #main > div.view-in,
  #main > div.view-in > :nth-child(-n+5),
  .tabs button.on { animation: none !important; }
}
