/* Team Insights: the overlay, its navigation and the Overview.
   `ti-` is the shell (overlay, header, date range, nav, states, shared primitives), `ti-ov-` the
   Overview's; Engagement and Audit use `ti-eng-`/`ti-aud-`. One page loads all four, so
   css-class-collision-check.py reports any bare class two of them declare. */

/* No z-index here: JS/core/layers.js assigns it at runtime above the top-most layer
   (z-scale-check.py polices this), since Insights can open over the team settings dialog.
   No theme literals either; every colour is an `--a-*` role. */

/* The wide things scroll inside themselves — `.ti-ov-chartwrap` is the only overflow box here,
   so a ninety-day chart widens itself, never the overlay (which would scroll the whole dialog). */

/* ================= THE OVERLAY ================= */

.alt-app .ti-overlay{
  position:fixed; inset:0;
  display:flex; align-items:center; justify-content:center;
  /* NO PADDING, BECAUSE THE GUTTER IS THE CARD'S OWN PERCENTAGE. A fixed 16px inset is the same
     16px on a 1024 laptop and on a 2560 display, which is the non-proportionate half of what the
     owner reported below; `.ti-card`'s 97.5% produces a margin that grows with the window
     instead. Below 820px the card takes the whole viewport and there is no gutter at all. */
  padding:0;
  /* DS-41: the shared scrim, no blur. */
  background:var(--a-scrim);
}
/* `display:flex` beats the user agent's `[hidden]{display:none}`, which is how an overlay that
   is supposed to be shut stays on screen. */
.alt-app .ti-overlay[hidden]{ display:none; }

/* 97.5% of the viewport in both axes, deliberately with no max-width ceiling: the Overview reflows,
   the member table has a min-width floor, and the chart scrolls in `.ti-ov-chartwrap`. Height is
   definite so switching views does not resize the dialog (as sizeSettingsDialog() in
   JS/core/modal-size.js). `min-width:0` lets flex children shrink instead of widening it. */
.alt-app .ti-card{
  display:flex; flex-direction:column; min-width:0;
  width:97.5%; height:97.5%;
  background:var(--a-panel);
  border:1px solid var(--a-line);
  border-radius:var(--a-r-lg);
  box-shadow:var(--a-shadow-lg);
  overflow:hidden;
}

/* Dialog ceiling history: `max-width:1440px` was replaced by the 97.5% card above. */

/* ---------- the header row ---------- */

.alt-app .ti-head{
  display:flex; align-items:center; gap:var(--a-4);
  flex-wrap:wrap; flex:0 0 auto;
  padding:var(--a-4) var(--a-5);
  border-bottom:1px solid var(--a-line-soft);
  background:var(--a-raised);
}
.alt-app .ti-title{
  margin:0; min-width:0; flex:1 1 auto;
  /* DS-14: the view title is the overlay title, display face 16px/600. */
  font-family:var(--a-display); font-size:var(--a-fs-16); font-weight:600; line-height:var(--a-lh-tight);
  color:var(--a-text);
  /* A long team name wraps rather than pushing the close button off the row. */
  overflow-wrap:anywhere;
}
/* The view's name is a qualifier on the title, not part of it — quieter, and it changes while
   the rest does not. */
.alt-app .ti-title-view{ color:var(--a-dim); font-weight:600; }

.alt-app .ti-head-end{
  display:flex; align-items:center; gap:var(--a-2);
  flex-wrap:wrap; min-width:0;
}
.alt-app .ti-range{ display:flex; align-items:center; gap:var(--a-2); flex-wrap:wrap; min-width:0; }
.alt-app .ti-range-sel{ max-width:180px; }
.alt-app .ti-custom{ display:flex; align-items:center; gap:var(--a-2); flex-wrap:wrap; min-width:0; }
.alt-app .ti-custom[hidden]{ display:none; }
.alt-app .ti-custom-f{ display:flex; align-items:center; gap:var(--a-1); min-width:0; }
.alt-app .ti-custom-l{
  font-size:var(--a-fs-11); font-weight:700; letter-spacing:.09em; text-transform:uppercase;
  color:var(--a-dim);
}
.alt-app .ti-custom-in{ max-width:150px; }
.alt-app .ti-close{ flex:0 0 auto; }

/* ---------- the filter bar ----------
   Its own band under the header, since four selects plus Clear filters would overflow `.ti-head`.
   `flex-wrap:wrap` + `min-width:0` on every child makes it wrap rather than scroll (a flex
   item's default min-width refuses to shrink below content). */
.alt-app .ti-filters{
  display:flex; align-items:flex-end; flex-wrap:wrap; gap:var(--a-2) var(--a-3);
  flex:0 0 auto; min-width:0;
  padding:var(--a-3) var(--a-5);
  border-bottom:1px solid var(--a-line-soft);
  background:var(--a-panel);
}
.alt-app .ti-filters[hidden]{ display:none; }
/* A NARROWED SURFACE LOOKS NARROWED. The accent is the same one the horizon banner uses, because
   it carries the same kind of meaning: what is below this is qualified. */
.alt-app .ti-filters.is-filtered{
  border-inline-start:3px solid var(--a-blue);
  background:var(--a-raised);
}

.alt-app .ti-f{ display:flex; flex-direction:column; gap:var(--a-1); min-width:0; flex:0 1 auto; }
.alt-app .ti-f[hidden]{ display:none; }
/* The same caption tier the custom-range labels use, so the two rows of controls are labelled in
   one voice rather than two. */
.alt-app .ti-f-l{
  font-size:var(--a-fs-11); font-weight:700; letter-spacing:.09em; text-transform:uppercase;
  color:var(--a-dim);
}
.alt-app .ti-f-sel{ max-width:180px; min-width:0; }
.alt-app .ti-f-clear{ flex:0 0 auto; }
.alt-app .ti-f-clear[hidden]{ display:none; }
.alt-app .ti-f-err{
  margin:0; min-width:0; flex:1 1 auto;
  font-size:var(--a-fs-ctl-sm); line-height:var(--a-lh-body); color:var(--a-dim);
}
.alt-app .ti-f-err[hidden]{ display:none; }
/* What an OKR area selection covers gets its own line, not a fifth item in the control row —
   `flex:1 1 100%` forces the wrap rather than hoping for it. Same size/weight/colour as
   `.ti-f-err`: both are the bar speaking about itself. */
.alt-app .ti-f-note{
  margin:0; min-width:0; flex:1 1 100%;
  font-size:var(--a-fs-ctl-sm); line-height:var(--a-lh-body); color:var(--a-dim);
}
.alt-app .ti-f-note[hidden]{ display:none; }
.alt-app .ti-ico{ display:inline-flex; flex:0 0 auto; }
.alt-app .ti-ico > svg{ width:15px; height:15px; }

/* ---------- the body: navigation beside the content ---------- */

/* Sidebar is 224px because the longest label is 22 characters — measured in a real browser: that
   string needs ~145px at this size/weight, more than 200px leaves once padding, icon and gap are
   taken out. A clipped label is worse than a wide sidebar, so wrapping (below) is the belt to
   this brace rather than ellipsis. */
.alt-app .ti-body{
  display:grid; grid-template-columns:224px minmax(0, 1fr);
  min-height:0; min-width:0; flex:1 1 auto;
}
.alt-app .ti-nav{
  display:flex; flex-direction:column; gap:2px;
  padding:var(--a-3); min-width:0;
  border-right:1px solid var(--a-line-soft);
  background:var(--a-bg);
  overflow:auto;
}
/* min-height RATHER THAN height, so a label that wraps grows its item instead of spilling out of
   it. The pill still reads as one control because the vertical padding centres whatever is in
   it, and three items of unequal height is not a defect — a clipped label is. */
.alt-app .ti-nav-item{
  display:flex; align-items:center; gap:var(--a-2);
  width:100%; min-width:0; padding:var(--a-2) var(--a-3);
  min-height:var(--a-ctl-lg);
  border:1px solid transparent; border-radius:var(--a-r-pill);
  background:transparent; color:var(--a-dim);
  font-family:var(--a-body); font-size:var(--a-fs-ctl); font-weight:600; line-height:var(--a-lh-ui);
  text-align:left; cursor:pointer;
}
.alt-app .ti-nav-item:hover{ background:var(--a-raised); color:var(--a-text); }
.alt-app .ti-nav-item:focus-visible{ outline:2px solid var(--a-ring); outline-offset:2px; }
/* The filled pill the wireframe draws — `aria-current` carries the same fact for a reader who
   can't see it. `#fff` is the one colour literal here and it's the established one:
   `.a-btn.primary` and `.a-btn.on` both use white on `--a-blue-fill`, saturated in every theme
   including light, so a theme-following token would still have to resolve to white everywhere. */
.alt-app .ti-nav-item.is-on{
  background:var(--a-blue-fill); border-color:transparent; color:var(--a-on-fill);
}
/* No ellipsis, ever, on a navigation label — three items is not a list long enough for
   truncation to buy anything, and the destination's own name must be readable in full before a
   reader presses it. */
.alt-app .ti-nav-l{ min-width:0; white-space:normal; overflow-wrap:break-word; }

.alt-app .ti-content{
  min-width:0; min-height:0; overflow:auto;
  padding:var(--a-5);
}
.alt-app .ti-content:focus{ outline:none; }
.alt-app .ti-content:focus-visible{ outline:2px solid var(--a-ring); outline-offset:-4px; }

/* ================= THE THREE STATES =================
   Three different boxes for three different sentences. A loading state drawn with the empty
   state's markup makes "still reading" and "there is nothing here" one screen. */

.alt-app .ti-state{
  display:flex; flex-direction:column; align-items:flex-start; gap:var(--a-2);
  padding:var(--a-5); min-width:0;
  border:1px solid var(--a-line-soft); border-radius:var(--a-r);
  background:var(--a-bg);
}
.alt-app .ti-state.is-empty{ border-style:dashed; border-color:var(--a-line); }
.alt-app .ti-state.is-error{ border-color:var(--a-amber); background:var(--a-amber-soft); }
.alt-app .ti-state-t{ margin:0; font-weight:600; color:var(--a-text); }
.alt-app .ti-state-d{ margin:0; font-size:var(--a-fs-ctl-sm); line-height:var(--a-lh-body); color:var(--a-dim); max-width:70ch; }
.alt-app .ti-state-btn{ margin-top:var(--a-1); }

/* THE SKELETON. Shapes with no figures in them — the whole point is that nothing here can be
   mistaken for a measurement while the read is still in flight. */
.alt-app .ti-skel{ display:flex; flex-direction:column; gap:var(--a-2); width:100%; min-width:0; }
.alt-app .ti-skel-b{
  display:block; height:12px; border-radius:var(--a-r-sm);
  background:linear-gradient(90deg, var(--a-line-soft), var(--a-raised), var(--a-line-soft));
  background-size:200% 100%;
  animation:ti-skel-shimmer 1.4s linear infinite;
}
.alt-app .ti-skel-0{ width:62%; }
.alt-app .ti-skel-1{ width:88%; }
.alt-app .ti-skel-2{ width:74%; }
.alt-app .ti-skel-3{ width:45%; }
@keyframes ti-skel-shimmer{
  from{ background-position:200% 0; }
  to{ background-position:-200% 0; }
}
/* Somebody who asked for less movement gets less movement. alt-tokens.css zeroes the durations
   this experience transitions with; an @keyframes animation is not a transition and has to be
   answered on its own. */
@media (prefers-reduced-motion: reduce){
  .alt-app .ti-skel-b{ animation:none; }
}

/* ================= THE SHARED PRIMITIVES ================= */

.alt-app .ti-panel{
  min-width:0;
  background:var(--a-panel);
  border:1px solid var(--a-line-soft);
  border-radius:var(--a-r-lg);
  padding:var(--a-4);
}
.alt-app .ti-panel-t{
  margin:0 0 var(--a-3);
  font-family:var(--a-display); font-size:var(--a-fs-16); font-weight:600; line-height:var(--a-lh-ui);
  color:var(--a-text);
}
.alt-app .ti-panel-b{ min-width:0; }

/* ---------- a metric tile ---------- */

.alt-app .ti-tile{
  display:flex; flex-direction:column; gap:2px; min-width:0;
  padding:var(--a-4);
  background:var(--a-panel);
  border:1px solid var(--a-line-soft);
  border-radius:var(--a-r-lg);
}
.alt-app .ti-tile-v{
  font-family:var(--a-display); font-size:var(--a-fs-28); font-weight:600; line-height:var(--a-lh-tight);
  color:var(--a-text); font-variant-numeric:tabular-nums;
}
.alt-app .ti-tile-l{ font-size:var(--a-fs-ctl-sm); color:var(--a-dim); }
/* THE COMPARISON ROW EXISTS ONLY WHEN THERE IS A COMPARISON. There is no "empty" or "unknown"
   modifier here on purpose: the element is not created at all when tiDelta() returns null, and a
   style for a placeholder would be the first step towards drawing one. */
.alt-app .ti-tile-d{
  display:flex; align-items:center; gap:var(--a-1);
  margin-top:var(--a-1); font-size:var(--a-fs-ctl); font-weight:600;
}
.alt-app .ti-tile-d.is-up{ color:var(--a-green); }
.alt-app .ti-tile-d.is-down{ color:var(--a-red); }
.alt-app .ti-tile-d.is-flat{ color:var(--a-dim); }
/* WHAT THIS FIGURE IS LIMITED TO, ON THE TILE. Like the comparison row above it, it exists only
   when there is something to say — there is no styled placeholder, because a permanent caption
   slot is how "attributable only" comes to be printed under a figure that is complete. 11px is
   the caption tier this application already uses; there is no half-step in the scale. */
.alt-app .ti-tile-n{
  margin:var(--a-1) 0 0; min-width:0;
  font-size:var(--a-fs-11); line-height:var(--a-lh-ui); color:var(--a-dim);
}

/* ---------- one bar row ---------- */

.alt-app .ti-bar{
  display:grid; grid-template-columns:minmax(0, 11em) minmax(60px, 1fr) auto;
  align-items:center; gap:var(--a-3);
  min-width:0; padding:var(--a-1) 0;
}
.alt-app .ti-bar-l{
  min-width:0; font-size:var(--a-fs-ctl); color:var(--a-text);
  overflow:hidden; text-overflow:ellipsis; white-space:nowrap;
}
.alt-app .ti-bar-track{
  display:block; height:10px; min-width:0;
  border-radius:var(--a-r-pill);
  background:var(--a-line-soft); overflow:hidden;
}
.alt-app .ti-bar-fill{
  display:block; height:100%; width:var(--ti-v, 0%);
  border-radius:var(--a-r-pill);
  background:var(--a-blue-fill);
}
.alt-app .ti-bar-v{
  font-size:var(--a-fs-ctl); font-weight:600; color:var(--a-text);
  font-variant-numeric:tabular-nums; text-align:right; min-width:4ch;
}

/* ================= THE OVERVIEW =================
   The three chart series colours are aliased once here from roles in CSS/alt/alt-tokens.css, so
   marks, lines and legend read the same values. */
.alt-app .ti-ov{
  --ti-ov-s1:var(--a-blue);
  --ti-ov-s2:var(--a-green);
  --ti-ov-s3:var(--a-purple);
  display:flex; flex-direction:column; gap:var(--a-4); min-width:0;
}

/* ---------- the four tiles ---------- */

/* The track minimum is 168px so four tiles stay a row of four — measured in a browser at 1024:
   190px needs 796px of content box, but the box beside the 224px sidebar is only ~730, breaking
   to an orphan tile below three. 168 fits four at 1024 and wraps to two-and-two below that. */
.alt-app .ti-ov-tiles{
  display:grid; gap:var(--a-3); min-width:0;
  grid-template-columns:repeat(auto-fit, minmax(168px, 1fr));
}
/* A state block inside the tile grid has to span it, or "reading the summary" sits in one column
   beside three empty tracks and reads as one tile that failed. */
.alt-app .ti-ov-tiles > .ti-state{ grid-column:1 / -1; }
/* 11px, the caption tier, not 11.5 — there is no half-step in this type scale (10/11/12/…/20),
   and responsive-layout.test.js forbids one on screen: a fractional size rounds differently per
   device pixel ratio, losing the hierarchy it was meant to express. `--a-dim`, not `--a-faint`,
   is what permits 11px at all — the same suite forbids anything smaller in the faint tier. */
.alt-app .ti-ov-tiles-note{
  grid-column:1 / -1; margin:0;
  font-size:var(--a-fs-11); line-height:var(--a-lh-body); color:var(--a-dim); max-width:80ch;
}

/* The attribution horizon, when the window reaches further back than the record does. A banner
   rather than a footnote: it qualifies the two per-person figures above it. */
.alt-app .ti-ov-horizon{
  margin:0; padding:var(--a-2) var(--a-3);
  border:1px solid var(--a-line); border-inline-start:3px solid var(--a-blue);
  border-radius:var(--a-r-sm);
  background:var(--a-raised); color:var(--a-text);
  font-size:var(--a-fs-ctl-sm); line-height:var(--a-lh-body); max-width:90ch;
}
.alt-app .ti-ov-horizon[hidden]{ display:none; }

/* ---------- the two-up row ---------- */

.alt-app .ti-ov-two{
  display:grid; gap:var(--a-4); align-items:start; min-width:0;
  grid-template-columns:minmax(0, 1.5fr) minmax(0, 1fr);
}
.alt-app .ti-ov-two > *{ min-width:0; }

/* ---------- the chart ---------- */

.alt-app .ti-ov-legend{
  display:flex; align-items:center; flex-wrap:wrap; gap:var(--a-2) var(--a-4);
  margin-bottom:var(--a-3); min-width:0;
}
.alt-app .ti-ov-lg{ display:inline-flex; align-items:center; gap:var(--a-2); font-size:var(--a-fs-ctl-sm); color:var(--a-dim); }
/* THE KEY CARRIES THE MARKER'S SHAPE AS WELL AS ITS COLOUR, because the chart does — a legend of
   three identical dots in three colours is useless to the reader the shapes are there for. */
.alt-app .ti-ov-lg-m{ display:inline-block; width:10px; height:10px; background:currentColor; }
.alt-app .ti-ov-lg-m.is-circle{ border-radius:50%; }
.alt-app .ti-ov-lg-m.is-square{ border-radius:0; }
.alt-app .ti-ov-lg-m.is-triangle{
  width:0; height:0; background:none;
  border-left:6px solid transparent; border-right:6px solid transparent;
  border-bottom:10px solid currentColor;
}
.alt-app .ti-ov-lg-m.ti-ov-s1{ color:var(--ti-ov-s1); }
.alt-app .ti-ov-lg-m.ti-ov-s2{ color:var(--ti-ov-s2); }
.alt-app .ti-ov-lg-m.ti-ov-s3{ color:var(--ti-ov-s3); }

/* THE ONE OVERFLOW BOX ON THIS SURFACE. A long window is a wide chart, and it scrolls here
   rather than widening the overlay. */
.alt-app .ti-ov-chartwrap{ overflow-x:auto; overflow-y:hidden; min-width:0; }
.alt-app .ti-ov-chart{ display:block; max-width:none; }
.alt-app .ti-ov-gridline{ stroke:var(--a-line-soft); stroke-width:1; }
.alt-app .ti-ov-axis{ fill:var(--a-dim); font-family:var(--a-body); font-size:var(--a-fs-11); }
.alt-app .ti-ov-line{ fill:none; stroke-width:2; }
.alt-app .ti-ov-mark{ stroke:none; }
.alt-app .ti-ov-s1 .ti-ov-line{ stroke:var(--ti-ov-s1); }
.alt-app .ti-ov-s1 .ti-ov-mark{ fill:var(--ti-ov-s1); }
.alt-app .ti-ov-s2 .ti-ov-line{ stroke:var(--ti-ov-s2); }
.alt-app .ti-ov-s2 .ti-ov-mark{ fill:var(--ti-ov-s2); }
.alt-app .ti-ov-s3 .ti-ov-line{ stroke:var(--ti-ov-s3); }
.alt-app .ti-ov-s3 .ti-ov-mark{ fill:var(--ti-ov-s3); }

/* ---------- the bar panels ---------- */

.alt-app .ti-ov-bars{ display:flex; flex-direction:column; gap:2px; min-width:0; }
/* The caption tier again — see the note on .ti-ov-tiles-note above for why it is 11 and not
   11.5, and why --a-dim rather than --a-faint is what permits 11 at all. */
.alt-app .ti-ov-note{
  margin:var(--a-3) 0 0;
  font-size:var(--a-fs-11); line-height:var(--a-lh-body); color:var(--a-dim); max-width:80ch;
}
/* THE SENTENCE THAT KEEPS TASK OUTCOMES HONEST, above the figures rather than under them —
   every other number on this screen is windowed and these four are not. Given the weight of a
   caption rather than of a footnote for exactly that reason. */
.alt-app .ti-ov-scope{
  margin:0 0 var(--a-3); padding:var(--a-2) var(--a-3);
  border-inline-start:3px solid var(--a-gold);
  border-radius:var(--a-r-sm);
  background:var(--a-gold-soft); color:var(--a-text);
  font-size:var(--a-fs-ctl-sm); line-height:var(--a-lh-body); max-width:90ch;
}
.alt-app .ti-ov-total{
  display:flex; align-items:baseline; justify-content:space-between; gap:var(--a-3);
  margin:var(--a-2) 0 0; padding-top:var(--a-2);
  border-top:1px solid var(--a-line-soft);
  font-size:var(--a-fs-ctl); color:var(--a-text);
}
.alt-app .ti-ov-total-l{ font-weight:600; }
.alt-app .ti-ov-total-v{ font-weight:600; font-variant-numeric:tabular-nums; }
/* The table alternative is carried by `.a-sr`; this only keeps a stray border rule from any
   ancestor table styling out of it. */
.alt-app .ti-ov-table{ border-collapse:collapse; }

/* ================= NARROW =================
   The sidebar becomes a strip above the content (steps follow CSS/alt/alt-responsive.css).
   The nav strip and chart scroll inside their own boxes and panels stack, so nothing overflows. */

@media (max-width:1023px){
  .alt-app .ti-ov-two{ grid-template-columns:minmax(0, 1fr); }
}

@media (max-width:820px){
  /* THE WHOLE VIEWPORT, NOT 97.5% OF IT. A 2.5% gutter is a proportionate margin on a desktop and
     wasted screen on a phone, where the surface underneath is never usefully visible anyway — so
     the card goes edge to edge and drops the border and the radius it has nothing to sit against. */
  .alt-app .ti-card{ width:100%; height:100%; border-radius:0; border:0; }
  .alt-app .ti-head{ padding:var(--a-3) var(--a-4); }
  .alt-app .ti-filters{ padding:var(--a-2) var(--a-4); }
  .alt-app .ti-title{ font-size:var(--a-fs-18); }
  .alt-app .ti-body{ grid-template-columns:minmax(0, 1fr); grid-template-rows:auto minmax(0, 1fr); }
  .alt-app .ti-nav{
    flex-direction:row; gap:var(--a-2);
    padding:var(--a-2) var(--a-3);
    border-right:0; border-bottom:1px solid var(--a-line-soft);
    overflow-x:auto;
  }
  .alt-app .ti-nav-item{ width:auto; flex:0 0 auto; }
  /* THE STRIP IS THE ONE PLACE THE LABEL STAYS ON ONE LINE. Wrapping inside a horizontal row
     would make three items of three different heights sitting side by side; the strip scrolls
     instead, so nothing is clipped and nothing is truncated — the label simply runs past the
     edge and the reader can reach it. */
  .alt-app .ti-nav-l{ white-space:nowrap; }
  .alt-app .ti-content{ padding:var(--a-4); }
}

@media (max-width:639px){
  .alt-app .ti-head{ gap:var(--a-2); }
  .alt-app .ti-head-end{ width:100%; }
  .alt-app .ti-range-sel{ max-width:none; flex:1 1 auto; }
  /* TWO UP, THEN TWO UP, rather than four stubs on one line. Each control keeps its label above
     it, so the pair reads as a pair; the Clear button takes the full width under them because a
     104px button wedged beside a select is the thing a thumb misses. */
  .alt-app .ti-f{ flex:1 1 44%; }
  .alt-app .ti-f-sel{ max-width:none; }
  .alt-app .ti-f-clear{ flex:1 1 100%; }
  .alt-app .ti-bar{ grid-template-columns:minmax(0, 1fr) auto; }
  /* THE TRACK GOES UNDER ITS OWN LABEL rather than being squeezed to a stub. The figure stays
     beside the label, because the figure is the data and the bar is the comparison. */
  .alt-app .ti-bar-track{ grid-column:1 / -1; }
}
