/* ================= USER TRAFFIC: charts, heatmap, ranked bars =================
   `utc-` is this file (panel bodies); `ut-` is alt-user-traffic.css; two sheets must not both declare a
   bare rule for one name (css-class-collision-check.py). Reuses `sx-*` vocabulary: the two `sx-` rules
   here are a modifier and a descendant. Colour is never the only message; wide content scrolls in its own box. */

/* ---------- screen-reader-only, this file's own ----------
   Same rule as `.a-sr` (alt-components.css) under this sheet's own prefix — the collision check
   forbids extending a shared name from here, and a <caption> needs naming without being drawn. */
.alt-app .utc-sr{
  position:absolute; width:1px; height:1px; margin:-1px; padding:0;
  overflow:hidden; clip:rect(0 0 0 0); white-space:nowrap; border:0;
}

/* ---------- a panel's body, and the controls in its head ---------- */

.alt-app .utc-body{ min-width:0; }
/* A body focused because a card sent the reader to it is a DESTINATION, not a control — it
   takes the ring and nothing else changes (same rule as `.sx-view:focus-visible`). */
.alt-app .utc-body:focus{ outline:none; }
.alt-app .utc-body:focus-visible{ outline:2px solid var(--a-ring); outline-offset:4px; }

.alt-app .utc-ctls{
  display:flex; align-items:center; gap:var(--a-2); flex-wrap:wrap;
  min-width:0; align-self:flex-start;
}
.alt-app .utc-ctl{ display:flex; align-items:center; gap:var(--a-1); min-width:0; }
.alt-app .utc-ctl-gap{ width:var(--a-1); flex:0 0 auto; }
.alt-app .utc-grain-host{ display:contents; }

/* ---------- the two-up row ----------
   Its own grid, not `.sx-grid` (that one becomes three columns at 1480px for the treemap's
   named panels — two children would leave an empty track). Steps are the PANE's width via
   container query, not the window's, since this pane sits in a console rail of variable width. */
.alt-app .utc-two{
  display:grid; gap:var(--a-4); align-items:start;
  grid-template-columns:minmax(0, 1fr); min-width:0;
}
.alt-app .utc-two > *{ min-width:0; }
@container sxpane (min-width: 860px){
  .alt-app .utc-two{ grid-template-columns:repeat(2, minmax(0, 1fr)); }
}

/* ---------- the four states ----------
   `.utc-state` is the shared shell; the modifier is what keeps a loading state from reusing the
   empty state's markup, which would make a slow fetch look like an empty result. */
.alt-app .utc-state{
  display:flex; flex-direction:column; align-items:flex-start; gap:var(--a-1);
  padding:var(--a-5); min-width:0;
  font-size:var(--a-fs-12); line-height:var(--a-lh-ui);   /* a state line is a hint (DS-48), as .ut-state is; the container no longer inherits 16 */
  border:1px solid var(--a-line-soft); border-radius:var(--a-r);
  background:var(--a-bg);
}
/* Empty is dashed and error is amber-edged, so the two are not one box with different words. */
.alt-app .utc-state.is-empty{ border-style:dashed; border-color:var(--a-line); }
.alt-app .utc-state.is-error{ border-color:var(--a-amber); background:var(--a-amber-soft); }
.alt-app .utc-state-t{ margin:0; font-weight:600; color:var(--a-text); }
.alt-app .utc-state-d{ margin:0; font-size:var(--a-fs-12); line-height:var(--a-lh-ui); color:var(--a-faint); max-width:70ch; }
.alt-app .utc-state-btn{ margin-top:var(--a-2); }
/* The cards row is a grid, so loading/error blocks must span it or they read as one failed card among empty
   tracks. Targets `.a-stats` (alt-components.css), not `.sx-cards`: the Activity Overview cards use `.a-stat`,
   and the Storage Explorer builds its own loading/error markup so never emits `.utc-state` there. */
.alt-app .a-stats > .utc-state{ grid-column:1 / -1; }

/* A caveat that keeps a figure honest is a notice (DS-A05): `.a-notice.info` for the horizon, `.a-notice.caution` for a floor or an ignored filter.
   Only the room around it is this sheet's. */
.alt-app .utc-horizon{ max-width:88ch; }
.alt-app .utc-warn{ margin-top:var(--a-2); max-width:78ch; }
.alt-app .utc-note{
  display:flex; align-items:center; flex-wrap:wrap; gap:var(--a-1) var(--a-2);
  margin:var(--a-2) 0 0; font-size:var(--a-fs-12); line-height:var(--a-lh-ui); color:var(--a-faint);
  max-width:78ch;
}
/* The cards' own scope sentence: present only while a filter is active, so it must collapse
   entirely rather than hold a blank line. */
.alt-app .utc-cardnote{ margin:0; max-width:88ch; }
.alt-app .utc-cardnote:empty{ display:none; }

/* The selected mark — a glyph rather than an icon: it survives a stylesheet that failed to
   load, and it is the half of "selected" that is not colour. */
.alt-app .utc-tick{
  flex:0 0 auto; font-size:var(--a-fs-11); line-height:var(--a-lh-ctl); color:var(--a-blue-text);
  margin-inline-end:var(--a-1);
}
/* A row's badge is an `.a-chip` (DS-26); only its place in the row's flex line is this sheet's. */
.alt-app .utc-tag{ flex:0 0 auto; }

/* ---------- the metric cards ----------
   `.a-stat` figures, not `.sx-card`, which reserves a 34px icon column these cards never fill.
   `.a-admin-figures > div.a-stat` (alt-admin.css) already drops the pointer cursor and hover edge from a
   non-button `.a-stat`, so no `.utc-static` modifier is needed. */
/* The tile and its parts (`.a-stat-sub`, DS-A02) are alt-admin-components.css'. This sheet only keeps the figure at the top, so a row of
   tiles with sub lines of different length still lines up. */
.alt-app .utc-ov-card{ justify-content:flex-start; }
/* The period-over-period line, absent today — utDelta() returns null against a zero baseline,
   so the element isn't created; the rule just gives the figure a home for when it is. */
.alt-app .utc-delta{
  font-size:var(--a-fs-11); font-weight:600; line-height:var(--a-lh-tight); color:var(--a-dim);
  font-variant-numeric:tabular-nums;
}

/* ============ 1 · ACTIVITY OVER TIME ============ */

/* CHART TEXT IS A1'S (DS-A07, alt-admin-components.css §6): `.a-chart-axis` for axis, tick, key and legend text, `.a-chart-val` for a value
   label, `.a-chart-centre` for a donut's centre figure (HTML, never SVG text in a viewBox), `.a-chart-s1..s6` for series. Nothing in this
   file sets a size or a weight on those; the rules below are layout and the state of a mark. */

/* The overflow box — everything wide sits in one, so the page itself never scrolls sideways;
   `overscroll-behavior-x` keeps a trackpad flick inside the chart. */
.alt-app .utc-scroll{
  width:100%; min-width:0; overflow-x:auto; overscroll-behavior-x:contain;
  padding-bottom:var(--a-1);
}

/* An explicit grid of equal tracks, not flex — grid rows cannot be overrun by a tall bar, which
   is how bars once drew on top of the date labels (sys_design-system §10). `--utc-cols` comes
   from the renderer's real bucket count, so the strip and its scroll box agree. */
.alt-app .utc-series{
  display:grid; gap:2px; align-items:end;
  grid-template-columns:repeat(var(--utc-cols, 30), minmax(14px, 1fr));
  min-width:min(100%, calc(var(--utc-cols, 30) * 26px));
}
.alt-app .utc-col{ min-width:0; display:flex; }
.alt-app .utc-col-btn{
  flex:1 1 auto; min-width:0;
  display:flex; flex-direction:column; gap:var(--a-1);
  padding:var(--a-1) 0; font:inherit; cursor:pointer;
  color:var(--a-text); background:none;
  border:1px solid transparent; border-radius:var(--a-r-sm);
}
.alt-app .utc-col-btn:hover{ background:var(--a-raised); }
.alt-app .utc-col-btn:focus-visible{ outline:2px solid var(--a-ring); outline-offset:1px; }
.alt-app .utc-col-track{
  display:flex; flex-direction:column; justify-content:flex-end; align-items:center;
  gap:2px; height:150px; min-width:0;
}
/* The figure sits inside the track, directly above its bar, so it rises with the bar. */
.alt-app .utc-col-val{
  white-space:nowrap; overflow:hidden; text-overflow:ellipsis;
  /* A figure may use the column's own border and the gap beside it, so a five-digit total does not truncate at a 36px column. */
  margin-inline:-2px; max-width:calc(100% + 4px); letter-spacing:-.03em;
}
.alt-app .utc-col-fill{
  width:100%; height:var(--utc-v, 0%); min-height:0;
  background:var(--a-chart-1); border-radius:var(--a-r-sm) var(--a-r-sm) 0 0;
}
/* A bucket with nothing in it keeps its place and loses its fill — an absent column reads as
   uncounted; a hairline at the axis (a top border on an empty box) reads as the zero it is. */
.alt-app .utc-col-btn.is-zero > .utc-col-track > .utc-col-fill{
  height:0; background:none; border-top:1px solid var(--a-line-strong); border-radius:0;
}
.alt-app .utc-col-lab{
  text-align:center;
  white-space:nowrap; overflow:hidden; text-overflow:ellipsis;
}

/* ============ 2 · ACTIVITY BY FEATURE — the donut ============ */

.alt-app .utc-donut{
  display:grid; grid-template-columns:minmax(0, 200px) minmax(0, 1fr);
  gap:var(--a-4); align-items:center; min-width:0;
}
.alt-app .utc-donut-fig{ width:100%; max-width:200px; min-width:0; }
.alt-app .utc-donut-svg{ width:100%; height:auto; display:block; }
.alt-app .utc-slice{ fill:none; stroke-width:12; stroke:var(--a-line-strong); }
.alt-app .utc-slice.is-live{ cursor:pointer; }
/* The selected segment thickens AND its legend carries the word — two signals plus the ✓, so
   nothing depends on fill alone. Unselected segments dim, not disappear (sys_design-system §7). */
.alt-app .utc-slice.is-on{ stroke-width:16; }
.alt-app .utc-s0{ stroke:var(--a-faint); }
.alt-app .utc-sw-other{ background:var(--a-faint); }
.alt-app .utc-lg-sw{ margin-top:3px; }
.alt-app .utc-s1{ stroke:var(--a-chart-1); }
.alt-app .utc-s2{ stroke:var(--a-chart-2); }
.alt-app .utc-s3{ stroke:var(--a-chart-3); }
.alt-app .utc-s4{ stroke:var(--a-chart-4); }
.alt-app .utc-s5{ stroke:var(--a-chart-5); }

.alt-app .utc-legend{ display:flex; flex-direction:column; gap:2px; min-width:0; }
.alt-app .utc-lg{
  display:flex; align-items:flex-start; gap:var(--a-2);
  width:100%; padding:var(--a-1) var(--a-2);
  font:inherit; font-size:var(--a-fs-11); font-weight:400; line-height:var(--a-lh-tight); text-align:left;
  color:var(--a-text); background:none;
  border:1px solid transparent; border-radius:var(--a-r-sm);
}
.alt-app button.utc-lg{ cursor:pointer; }
.alt-app button.utc-lg:hover{ background:var(--a-raised); }
.alt-app button.utc-lg:focus-visible{ outline:2px solid var(--a-ring); outline-offset:1px; }
.alt-app .utc-lg.is-on{ border-color:var(--a-blue); border-width:2px; background:var(--a-blue-soft); }
/* "Other" is not a control — there is no filter value meaning "every feature outside the top
   five", so it is drawn as text and reads as text. */
.alt-app .utc-lg.is-inert{ color:var(--a-dim); }
.alt-app .utc-lg-b{ display:flex; flex-direction:column; min-width:0; flex:1 1 auto; }
.alt-app .utc-lg-l{ display:flex; align-items:center; gap:var(--a-1); min-width:0; }
.alt-app .utc-lg-l > span{ overflow:hidden; text-overflow:ellipsis; }

/* ============ 3 · RANKED BARS — teams, activity types and people ============ */

.alt-app .utc-bars{ display:flex; flex-direction:column; gap:var(--a-2); min-width:0; }
.alt-app .utc-bar{
  display:flex; flex-direction:column; gap:var(--a-1);
  width:100%; padding:var(--a-2) var(--a-3); min-width:0;
  font:inherit; text-align:left;
  color:var(--a-text); background:var(--a-panel);
  border:1px solid var(--a-line-soft); border-radius:var(--a-r);
}
.alt-app button.utc-bar{ cursor:pointer; }
.alt-app button.utc-bar:hover{ background:var(--a-raised); border-color:var(--a-line-strong); }
.alt-app button.utc-bar:focus-visible{ outline:2px solid var(--a-ring); outline-offset:2px; }
/* A row that narrows nothing is a div, and it must not look like a control. */
.alt-app .utc-bar.is-inert{ background:var(--a-bg); }
.alt-app .utc-bar.is-on{
  border-color:var(--a-blue); border-width:2px;
  box-shadow:0 0 0 1px var(--a-blue) inset;
}
.alt-app .utc-bar-top{ display:flex; align-items:baseline; gap:var(--a-2); min-width:0; }
.alt-app .utc-bar-l{
  flex:1 1 auto; min-width:0; font-weight:600; font-size:var(--a-fs-13); line-height:var(--a-lh-ui);
  overflow:hidden; text-overflow:ellipsis; white-space:nowrap;
}
.alt-app .utc-bar-v{
  flex:0 0 auto;
}
/* The track is a row of its own height, so a fill can never be drawn over the label beneath it. */
.alt-app .utc-bar-track{
  display:flex; width:100%; height:8px; border-radius:var(--a-r-pill);
  background:var(--a-bg); border:1px solid var(--a-line-soft); overflow:hidden;
}
.alt-app .utc-bar-fill{ width:var(--utc-v, 0%); height:100%; background:var(--a-chart-1); }
.alt-app .utc-bar.is-on .utc-bar-fill{ background:var(--a-blue-text); }
.alt-app .utc-bar-sub{ font-size:var(--a-fs-12); line-height:var(--a-lh-ui); color:var(--a-faint); overflow-wrap:anywhere; }

/* ============ 4 · THE HEATMAP ============ */

/* An explicit grid: one label track, 24 equal hour tracks. `minmax(0,1fr)` stops a wide row
   pushing past the container; a real per-cell minimum lets the box scroll instead of collapsing. */
.alt-app .utc-heat{
  display:flex; flex-direction:column; gap:2px;
  min-width:min(100%, 700px);
}
.alt-app .utc-heat-row{
  display:grid; gap:2px; align-items:stretch;
  grid-template-columns:5.5em repeat(24, minmax(16px, 1fr));
  min-width:0;
}
.alt-app .utc-heat-day{
  display:flex; align-items:center; justify-content:space-between; gap:var(--a-1);
  min-width:0; padding-inline-end:var(--a-2);
}

/* The row total is text, at every width — what makes this grid readable with no colour at all:
   seven figures a reader can compare directly. */
.alt-app .utc-heat-day-v{ font-variant-numeric:tabular-nums; }
.alt-app .utc-heat-h{
  text-align:center;
  overflow:hidden; white-space:nowrap;
}
.alt-app .utc-heat-c{
  display:flex; align-items:center; justify-content:center;
  min-width:0; height:22px; padding:0;
  font-family:inherit; line-height:var(--a-lh-ctl); cursor:pointer;
  color:var(--a-text); border:1px solid var(--a-line-soft); border-radius:var(--a-r-sm);
  background:var(--a-bg);
}
.alt-app .utc-heat-c:hover{ border-color:var(--a-blue); }
.alt-app .utc-heat-c:focus-visible{ outline:2px solid var(--a-ring); outline-offset:1px; }
.alt-app .utc-heat-v{ overflow:hidden; white-space:nowrap; }

/* Six bands mixed from one role rather than six colours, so one accent works in dark, light and custom
   palettes. Not `opacity`, which would dim the count text. Plain declaration first: an engine without
   color-mix() discards the whole rule otherwise (same as alt-tasks.css/alt-embed-task.css). Band 0 is not a
   pale blue, because "nothing happened" is different from "quiet". */
.alt-app .utc-h0{ background:var(--a-bg); }
.alt-app .utc-h1{
  background:var(--a-blue-soft);
  background:color-mix(in srgb, var(--a-blue) 20%, var(--a-panel));
}
.alt-app .utc-h2{
  background:var(--a-blue-soft);
  background:color-mix(in srgb, var(--a-blue) 40%, var(--a-panel));
}
.alt-app .utc-h3{
  background:var(--a-blue-soft);
  background:color-mix(in srgb, var(--a-blue) 60%, var(--a-panel));
}
.alt-app .utc-h4{
  background:var(--a-blue);
  background:color-mix(in srgb, var(--a-blue) 80%, var(--a-panel));
}
.alt-app .utc-h5{ background:var(--a-blue); }
/* The number in a strongly-tinted cell reads against the tint, so the two darkest bands take
   the paired surface role rather than body text colour — both tokens, not measured here. */
.alt-app .utc-h4 > .utc-heat-v,
.alt-app .utc-h5 > .utc-heat-v{ color:var(--a-panel); }

/* The band key beside the "busiest hour" figure. Swatches, not words: "low" and "high" are a
   judgment, and the sentence next to them carries the actual numbers. */
.alt-app .utc-key{
  width:14px; height:10px; border-radius:var(--a-r-sm); flex:0 0 auto;
  border:1px solid var(--a-line-strong);
}
.alt-app .utc-key-l{ margin-inline:var(--a-1); }

/* ============ 5 · RECENT ACTIVITY ============ */

/* Its own scroller and a real minimum width — seven columns of mixed text don't fit a phone,
   and a table that widens the PAGE scrolls every other section sideways too. */
.alt-app .utc-tablewrap{ width:100%; min-width:0; overflow-x:auto; overscroll-behavior-x:contain; }
.alt-app .utc-table{ min-width:620px; }
.alt-app .utc-num{ font-variant-numeric:tabular-nums; white-space:nowrap; }
/* A result that is not success is named, not tinted — the word is already in the cell; the
   amber role is the second signal, and the cell reads correctly with no colour at all. */
.alt-app .utc-res.is-off{ color:var(--a-amber); font-weight:600; }

/* ============ 6 · SECURITY & ANOMALIES ============
   user-traffic-security.js owns this markup; every class starts `utc-`. The rule cards are `.a-stat`, not
   `.sx-card` (its icon grid wraps labels one character per line when no icon is drawn). The toolbar and
   pager are `.ut-log-toolbar`/`.ut-log-pager` (alt-user-traffic.css). */

/* The list is a native `<dl>`; unstyled it takes UA indent and equal dt/dd weight. Weight alone separates
   what from why; badge colour/border stays reserved for the four named rules. */
.alt-app .utc-gap-list{ display:flex; flex-direction:column; gap:var(--a-2); margin:var(--a-2) 0 0; }
.alt-app .utc-gap{ margin:0; }
.alt-app .utc-gap dt{ margin:0; font-weight:600; color:var(--a-text); font-size:var(--a-fs-13); line-height:var(--a-lh-ui); }
.alt-app .utc-gap dd{ margin:2px 0 0; color:var(--a-dim); font-size:var(--a-fs-12); line-height:var(--a-lh-ui); }

/* ---------- recent signals: toolbar, search, pager ----------
   Reuses `.ut-log-toolbar`/`.ut-log-pager`/`.ut-pagestat` (alt-user-traffic.css) and `.a-search`/`.a-input`
   (alt-components.css). These modifiers only size the search field, which a bare `.a-search` doesn't do in a
   flex row with no basis (same reason `.ti-eng-search` exists). */
.alt-app .utc-sig-toolbar{ margin:var(--a-3) 0; }
.alt-app .utc-sig-search{ flex:1 1 220px; min-width:0; max-width:360px; }
@container sxpane (max-width: 620px){
  /* The toolbar already wraps (`.ut-log-toolbar` is `flex-wrap:wrap`) — this only lets the
     search field use the full row once it has wrapped onto one, instead of capping at 360px of
     a 320px pane. */
  .alt-app .utc-sig-search{ max-width:none; }
}
/* `.ut-log-pager` carries no margin of its own (unlike `.ut-pager`, alt-user-traffic.css) —
   this view's pager always follows a table rather than standing alone, so it needs the gap the
   other callers of `.ut-pager` get for free. */
.alt-app .utc-sig-pager{ margin-top:var(--a-3); }

/* The selected rule card is plain `.a-stat.on`; alt-components.css already paints the selected tile. The
   button also carries `aria-pressed` (user-traffic-security.js) as accessibility state; it does not paint. */

/* Severity badge: `UTSEC_SEVERITY_LABEL` (JS) supplies the word; this adds only the colour role, on top of
   `.a-chip`. `align-self:flex-start` stops the column-flex `.a-stat` from stretching it. High is amber.
   Scoped under `.utc-sig-card` so `.a-stat span` and `.a-stat.on span` cannot erase the amber; the selected
   case uses `[aria-pressed="true"]`, not `.on`, because user-traffic-overview.test.js pins the foreign names. */
.alt-app .utc-sev{ align-self:flex-start; }
.alt-app .utc-sig-card .utc-sev,
.alt-app .utc-sig-card[aria-pressed="true"] .utc-sev{
  align-self:flex-start;
  border-color:var(--a-line); color:var(--a-dim); background:var(--a-raised);
}
/* Low is green, not gray: yellow and red mean "something to address", and a signal measured and found
   unremarkable is a resolved state, which reads green elsewhere in the product. */
.alt-app .utc-sig-card .utc-sev-low,
.alt-app .utc-sig-card[aria-pressed="true"] .utc-sev-low,
.alt-app .utc-sev-low{
  color:var(--a-green); border-color:var(--a-green);
  background:var(--a-green-soft);
  background:color-mix(in srgb, var(--a-green) 14%, var(--a-panel));
}
.alt-app .utc-sig-card .utc-sev-high,
.alt-app .utc-sig-card[aria-pressed="true"] .utc-sev-high,
.alt-app .utc-sev-high{
  color:var(--a-amber); border-color:var(--a-amber);
  background:var(--a-amber-soft);
  background:color-mix(in srgb, var(--a-amber) 14%, var(--a-panel));
}

/* The raw user-agent string — the fact beside the guess, often 100+ characters nobody chose the
   length of. `anywhere` breaks it rather than forcing the table's scroller wider than its other
   columns need. */
.alt-app .utc-ua{ display:inline-block; overflow-wrap:anywhere; max-width:100%; }

/* ---------- motion ----------
   Only colour and border transition (dropped under reduced motion); nothing animates size or position, so a
   bar never briefly misstates its length. No other `.a-stat` consumer has a hover transition, so none here. */
.alt-app .utc-col-btn,
.alt-app .utc-bar,
.alt-app .utc-lg,
.alt-app .utc-heat-c{
  transition:background-color var(--a-quick) var(--a-ease), border-color var(--a-quick) var(--a-ease);
}
@media (prefers-reduced-motion: reduce){
  .alt-app .utc-col-btn,
  .alt-app .utc-bar,
  .alt-app .utc-lg,
  .alt-app .utc-heat-c{ transition:none; }
}

/* ---------- narrow ----------
   Container queries on the PANE, not media queries on the window — this pane's width is the
   console rail's, not the browser's. */
@container sxpane (max-width: 620px){
  /* The donut stacks rather than shrinking — at 320px a 160px ring would leave the legend about
     110px, not enough for a feature name and two figures. */
  .alt-app .utc-donut{ grid-template-columns:minmax(0, 1fr); justify-items:center; }
  .alt-app .utc-legend{ width:100%; }

  /* Series columns get shorter, not narrower — the strip already scrolls, and a 150px track is
     most of a phone viewport for one panel. */
  .alt-app .utc-col-track{ height:110px; }

  /* The heatmap keeps every cell and scrolls — dropping hours or days would drop data at the
     width where a reader has the least of it. Only the in-cell count goes (two digits don't fit
     16px); it stays in each cell's accessible name, the readout, and the seven row totals. */
  .alt-app .utc-heat-row{ grid-template-columns:4.4em repeat(24, minmax(15px, 1fr)); }
  .alt-app .utc-heat-day{ flex-direction:column; align-items:flex-start; gap:0; }
  .alt-app .utc-heat-v{ display:none; }
}
