* { margin: 0; padding: 0; box-sizing: border-box; }
html, body {
  min-height: 100%;
  background: #0b0e12;
  color: #e8eaed;
  font-family: system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}
body { display: flex; flex-direction: column; min-height: 100vh; }

/* `hidden` HIDES, whatever else styles the element (D182) -- the same line as
   style.css, for the dashboard, login and admin pages, which do not load it.
   qa/l2-browser/hidden_guard.test.mjs checks every element on every page. */
[hidden] { display: none !important; }

/* --- Top bar --- */
#topbar {
  display: flex; align-items: baseline; gap: 12px;
  padding: 16px 24px;
  background: #12161c; border-bottom: 1px solid #262c33;
}
#brand { font-weight: 700; font-size: 20px; letter-spacing: .4px; color: #8ab4f8; }
#tagline { font-size: 13px; color: #9aa0a6; }
#link-note { margin-left: auto; font-size: 12px; color: #6d747c; }
#link-note.warn { color: #e0a548; }

/* The signed-in controls. Sized and coloured to sit with #link-note rather
   than as browser defaults -- an unstyled <button> renders as a white box on
   this dark bar, which is what it did before this rule existed. */
#admin-link, #back-link, #sign-out {
  font-size: 12px;
  color: #9aa0a6;
  text-decoration: none;
  background: none;
  border: 1px solid #262c33;
  border-radius: 5px;
  padding: 4px 10px;
  font-family: inherit;
  cursor: pointer;
  line-height: 1.4;
}
#admin-link:hover, #back-link:hover, #sign-out:hover { color: #e8eaed; border-color: #3a424b; }

/* --- Main --- */
/* min-width:0 IS LOAD-BEARING now that #main is a flex ROW item (D164). A flex
   item's minimum size defaults to its CONTENT, and #grid's 340px track makes
   that about 388px -- so without this a narrow window floors #main at 388px
   plus the dock and the whole page scrolls sideways.

   `margin: 0 auto` stays, and is not the bug it looks like: flex-grow resolves
   first, max-width clamps, and the leftover goes to the auto margins, which is
   what keeps the cards centred in whatever track is left of the dock. */
#main { flex: 1; min-width: 0; max-width: 1100px; width: 100%; margin: 0 auto; padding: 28px 24px 48px; }
#intro { color: #9aa0a6; font-size: 14px; line-height: 1.6; max-width: 640px; margin-bottom: 26px; }
#loading { color: #6d747c; font-size: 14px; }

/* 340 rather than 320: the three-figure findings row is the widest thing on a
   card and wraps unreadably below about 330. Two cards still sit side by side
   in the 1100px column. */
/* min(340px, 100%) rather than a bare 340px: the track may now be narrower
   than a card would like, because the dock takes its width out of #main rather
   than out of the viewport. A bare minimum overflows instead of shrinking, and
   that overflow is a sideways scrollbar on the whole page. */
#grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(340px, 100%), 1fr));
  gap: 20px;
}

/* --- Card --- */
.card {
  display: flex; flex-direction: column;
  background: #12161c;
  border: 1px solid #262c33;
  border-radius: 10px;
  overflow: hidden;
  transition: border-color .15s, transform .15s;
}
.card.live { cursor: pointer; }
.card.live:hover { border-color: var(--accent, #4d7fc4); transform: translateY(-2px); }
.card.disabled { opacity: .82; }

/* --- The render ---
   16:9 and cropped, never letterboxed: the capture is the engine's opening
   framing (tools/capture_thumbnails.mjs) and a band of page background above a
   dam reads as a broken image. A fixed aspect-ratio box also means the card
   does not reflow when a lazy image finally arrives. */
.card-thumb {
  --thumb-zoom: 1.7;
  position: relative;
  aspect-ratio: 16 / 9;
  background: #0e1217;
  border-bottom: 1px solid #20262e;
  overflow: hidden;
}
/* ZOOMED, and this is a crop of the opening view rather than a different view.
 *
 * SeedFraming frames the whole SCENE BOUNDS, and the bounds are much bigger than
 * the structure: they include the vegetated banks and the outlying tile
 * fragments at the edges of the capture. So the honest opening shot puts the dam
 * in a thin band across the middle of a lot of black, which is correct as a
 * camera position and poor as a picture of a dam.
 *
 * The fix is a centred zoom, and it is safe BECAUSE of how the framing is
 * derived: SeedFraming centres on the bounds centre, so the structure is always
 * in the middle of the frame. Cropping toward the centre cannot cut the subject
 * out; it only removes the empty space that the bounds bought.
 *
 * Done here rather than in capture_thumbnails.mjs on purpose -- the committed
 * JPEG stays the full opening frame, so changing this number is a CSS edit
 * rather than a re-capture that needs the engine and a GPU. */
.thumb-img {
  display: block; width: 100%; height: 100%; object-fit: cover;
  transform: scale(var(--thumb-zoom));
  transition: transform .2s ease-out;
}
.card.live:hover .thumb-img { transform: scale(calc(var(--thumb-zoom) * 1.04)); }

/* No capture yet. Deliberately looks composed rather than broken -- a checkout
   that has never run the capture tool is a normal state, not an error. */
.thumb-fallback {
  width: 100%; height: 100%;
  display: flex; align-items: center; justify-content: center;
  background:
    radial-gradient(110% 130% at 30% 0%, color-mix(in srgb, var(--accent, #4d7fc4) 26%, transparent), transparent 65%),
    #10151b;
}
.thumb-fallback span {
  font-size: 38px; font-weight: 700; letter-spacing: 2px;
  color: color-mix(in srgb, var(--accent, #8ab4f8) 45%, #e8eaed);
  opacity: .8;
}

/* --- Head --- */
.card-head {
  padding: 16px 18px 4px;
  background:
    radial-gradient(120% 140% at 100% 0%, color-mix(in srgb, var(--accent, #4d7fc4) 12%, transparent), transparent 60%),
    transparent;
}
/* THE ONE ENLARGED THING ON THE CARD. The owner asked for the project name in
   big letters and for nothing else to grow with it -- so every other size on
   this page is unchanged, and this is an <h2> because it is now genuinely the
   heading of the section rather than a styled div. */
.card-title { font-size: 24px; font-weight: 680; line-height: 1.2; letter-spacing: -.2px; }
.card-sub { font-size: 12.5px; color: #9aa0a6; margin-top: 4px; }

/* The badge sits ON the render now, so it needs to survive a bright sky as well
   as a dark one -- hence its own backdrop rather than the card's background
   showing through. */
.badge {
  position: absolute; top: 12px; right: 12px;
  font-size: 10.5px; font-weight: 700; letter-spacing: .5px; text-transform: uppercase;
  padding: 3px 8px; border-radius: 20px;
  backdrop-filter: blur(6px);
}
.badge.live { background: rgba(10,26,15,.72); color: #7bd88f; border: 1px solid rgba(123,216,143,.45); }
.badge.loaded { background: rgba(10,18,32,.72); color: #8ab4f8; border: 1px solid rgba(138,180,248,.45); }
.badge.processing { background: rgba(32,22,6,.72); color: #e0a548; border: 1px solid rgba(224,165,72,.42); }
.badge .dot {
  display: inline-block; width: 6px; height: 6px; border-radius: 50%;
  background: currentColor; margin-right: 5px; vertical-align: middle;
}
.badge.live .dot { animation: pulse 1.6s ease-in-out infinite; }
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: .3; } }

.card-body { padding: 14px 18px 16px; flex: 1; display: flex; flex-direction: column; gap: 14px; }

/* --- Blocks (Specification, Findings) --- */
.block-title {
  font-size: 11px; text-transform: uppercase; letter-spacing: .6px; color: #7d858e;
  margin-bottom: 9px;
}
/* WHO SAID THIS NUMBER. A creator-stated figure and a store-derived one look
   identical in a dl, and invariant 6 is about not letting the product appear to
   vouch for precision it did not measure. The attribution is therefore part of
   the heading rather than a tooltip -- a tooltip is not read by the person who
   needed to read it. */
.block-note {
  text-transform: none; letter-spacing: 0; color: #6d747c; font-weight: 400;
}
.block-note::before { content: " · "; }

.specs { display: grid; grid-template-columns: auto 1fr; gap: 5px 14px; font-size: 13px; }
.specs dt { color: #9aa0a6; white-space: nowrap; }
.specs dd { color: #e8eaed; font-variant-numeric: tabular-nums; }

/* --- Findings --- */
/* The four parts -- figures, the outstanding line, the bar, the key -- are
   separate statements and need to read as separate statements. Without this
   they run together into one block of small text and the bar looks like an
   underline for the sentence above it. */
.findings-body { display: flex; flex-direction: column; gap: 9px; }
.fig-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.fig { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.fig b {
  font-size: 20px; font-weight: 650; line-height: 1.1;
  color: #e8eaed; font-variant-numeric: tabular-nums;
}
.fig span { font-size: 11px; line-height: 1.3; color: #7d858e; }

/* The unfinished-sweep line. `.open` is the case that matters: proposals nobody
   has looked at yet is the one number here that says the inspection is not
   done, so it is the one that is allowed a colour. */
.fig-note { font-size: 12px; color: #7d858e; }
.fig-note.open { color: #e0a548; }

/* The refusal. Not styled as an error -- an unreadable store is a condition to
   report, not an alarm, and the card still opens. */
.fig-none { font-size: 12.5px; line-height: 1.5; color: #7d858e; }

/* --- Severity --- */
.sev-bar {
  display: flex; height: 7px; border-radius: 999px; overflow: hidden;
  background: #1a1f26;
}
.sev-bar .seg { display: block; height: 100%; min-width: 2px; }
.sev-bar .seg[data-severity="critical"] { background: var(--sev-critical); }
.sev-bar .seg[data-severity="high"]     { background: var(--sev-high); }
.sev-bar .seg[data-severity="medium"]   { background: var(--sev-medium); }
.sev-bar .seg[data-severity="low"]      { background: var(--sev-low); }
.sev-bar .seg[data-severity="info"]     { background: var(--sev-info); }
.sev-bar .seg[data-severity="none"]     { background: var(--sev-none); }

.sev-key {
  list-style: none; display: flex; flex-wrap: wrap; gap: 4px 12px;
  font-size: 11.5px; color: #c3c8ce; font-variant-numeric: tabular-nums;
}
.sev-key li { display: flex; align-items: center; gap: 5px; }
.sev-key li span { color: #7d858e; }
/* A level with nothing in it is DIMMED, not dropped. "0 critical" is an answer;
   an absent row reads as a question nobody asked. */
.sev-key li.zero { opacity: .38; }
.sev-key i {
  display: block; width: 8px; height: 8px; border-radius: 2px; flex: none;
}
.sev-key i[data-severity="critical"] { background: var(--sev-critical); }
.sev-key i[data-severity="high"]     { background: var(--sev-high); }
.sev-key i[data-severity="medium"]   { background: var(--sev-medium); }
.sev-key i[data-severity="low"]      { background: var(--sev-low); }
.sev-key i[data-severity="info"]     { background: var(--sev-info); }
.sev-key i[data-severity="none"]     { background: var(--sev-none); }

/* Waiting on the broker. A shape rather than a spinner: the card is already
   usable and a spinner would suggest it is not. */
.skel { position: relative; overflow: hidden; background: #1a1f26; border-radius: 4px; }
.fig.skel { background: none; }
.fig.skel b, .fig.skel span {
  display: block; background: #1a1f26; border-radius: 4px;
}
.fig.skel b { height: 20px; width: 62%; }
.fig.skel span { height: 11px; width: 88%; margin-top: 4px; }
@media (prefers-reduced-motion: no-preference) {
  .skel::after, .fig.skel b::after, .fig.skel span::after {
    content: ""; position: absolute; inset: 0;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,.045), transparent);
    animation: shimmer 1.4s ease-in-out infinite;
  }
  @keyframes shimmer { 0% { transform: translateX(-100%); } 100% { transform: translateX(100%); } }
}

/* footer action */
.card-foot {
  padding: 14px 18px; border-top: 1px solid #20262e;
  display: flex; align-items: center; gap: 12px;
}
.card-foot .pill { flex: none; }
.open-btn {
  display: block; flex: 1; text-align: center;
  padding: 9px 14px; border-radius: 6px; font-size: 13.5px; font-weight: 600;
  text-decoration: none; border: 1px solid transparent; cursor: pointer;
}
.open-btn.enabled { background: #2b4a75; border-color: #4d7fc4; color: #eaf1fb; }
.open-btn.enabled:hover { background: #33578a; }
.open-btn.muted { background: #171c23; border-color: #2a313a; color: #6d747c; cursor: not-allowed; }

/* =========================================================================
   The docked record (D164)

   A CONTINUOUS RECORD, NOT A NOTIFIER. Nothing in here is allowed to look
   urgent: no tone dots, no amber state line, no button in the header. The bell
   in the top bar is the notifier and keeps all of that.

   THE VIEWER'S PANEL RULES ARE NOT AVAILABLE HERE. .panel-resize-handle,
   .panel-collapsed, #panel-resize-catcher and --panel-rail all live in
   style.css, which index.html does not load. The dock's equivalents below are
   deliberately named differently rather than redefined: two stylesheets
   defining one class differently is a trap for whoever greps it next.
   ========================================================================= */

#page {
  display: flex;
  flex: 1;
  min-height: 0;
}

#activity-dock {
  flex: 0 0 var(--dock-w, 360px);
  display: flex;
  flex-direction: column;
  /* STICKY, NOT STRETCHED. body is min-height:100vh and the page itself
     scrolls, so #page's height is content-driven: a percentage height here
     would resolve against an indefinite block and do nothing, and the default
     align-items would instead make the dock as tall as a six-card page --
     scrolling its own header, divider and restore control off the top, which
     would break the one thing the owner asked to stay reachable. align-self is
     required for sticky to mean anything in a flex row. */
  position: sticky;
  top: 0;
  align-self: start;
  height: calc(100vh - var(--topbar-h, 57px));
  background: #12161c;
  border-left: 1px solid #262c33;
}

/* --- collapsed: the rail ---
   The width comes out of --dock-w, so #main genuinely reflows and the cards
   reclaim the space. The header survives, because it carries the one control
   that brings the record back. */
#activity-dock.dock-collapsed {
  background: transparent;
  border-left: 0;
}

#activity-dock.dock-collapsed .dock-head {
  padding: 6px 0 0;
  border-bottom: 0;
  background: transparent;
  grid-template-columns: 1fr;
  justify-items: center;
}

#activity-dock.dock-collapsed .dock-title,
#activity-dock.dock-collapsed .dock-project,
#activity-dock.dock-collapsed .dock-state,
#activity-dock.dock-collapsed .activity-list {
  display: none;
}

/* --- the divider --- */
.dock-resize-handle {
  position: absolute;
  top: 0;
  bottom: 0;
  left: -5px;
  width: 10px;
  z-index: 3;
  cursor: ew-resize;
  touch-action: none;
  outline: none;
}

.dock-resize-handle::after {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: 4px;
  width: 2px;
  background: transparent;
  transition: background .12s;
}

.dock-resize-handle:hover::after,
.dock-resize-handle:focus-visible::after { background: #8ab4f8; }

/* A quick drag leaves the 10px handle immediately. This keeps the move events
   coming, and stops the drag selecting the card text it passes over. */
#dock-resize-catcher {
  position: fixed;
  inset: 0;
  z-index: 1000;
  cursor: ew-resize;
}

body.dock-resizing { user-select: none; }

/* --- the head --- */
.dock-head {
  flex: none;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 2px 8px;
  align-items: baseline;
  padding: 12px 14px 10px;
  border-bottom: 1px solid #262c33;
}

.dock-title {
  margin: 0;
  font-size: 13px;
  font-weight: 600;
  color: #e8eaed;
}

.dock-collapse {
  flex: none;
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  padding: 0;
  border: 1px solid #262c33;
  border-radius: 4px;
  background: rgba(255, 255, 255, .04);
  color: #9aa0a6;
  font-family: inherit;
  font-size: 15px;
  line-height: 1;
  cursor: pointer;
}

.dock-collapse:hover { color: #e8eaed; border-color: #3a424b; }
.dock-collapse:focus-visible { outline: 2px solid #6ea8fe; outline-offset: 2px; }

.dock-project { grid-column: 1 / -1; }
.dock-project-name { color: #9aa0a6; font-size: 11px; }

/* AN UNSTYLED <select> IS A WHITE BOX ON A NEAR-BLACK BAR, and this repo has
   paid for that twice: once for #sign-out above ("an unstyled <button> renders
   as a white box on this dark bar"), once in activity.css for a light-theme
   card that nothing in the text assertions could see.

   color-scheme is the half that is easy to miss. Without it the OPTION LIST
   the operating system draws stays light even when the closed control is dark,
   so the bug only appears once somebody clicks it. */
.dock-project-select {
  max-width: 100%;
  padding: 2px 6px;
  border: 1px solid #262c33;
  border-radius: 4px;
  background: #171c23;
  color: #9aa0a6;
  font-family: inherit;
  font-size: 11px;
  cursor: pointer;
  color-scheme: dark;
}

.dock-project-select:hover { color: #e8eaed; border-color: #3a424b; }
.dock-project-select:focus-visible { outline: 2px solid #6ea8fe; outline-offset: 1px; }

/* ONE COLOUR FOR EVERY STATE, ON PURPOSE. "Updated just now" and "Last updated
   11:38" are both statements of freshness, and the owner asked that a failed
   update not be dressed as an alarm -- every line already fetched stays on
   screen, so there is nothing for a reader to do about it. The loud version of
   this sentence still exists, on the bell. */
.dock-state {
  grid-column: 1 / -1;
  margin: 2px 0 0;
  color: #6d747c;
  font-size: 11px;
}

/* --- the lines --- */
.dock-lines {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  display: block;
  padding: 4px 14px 16px;
}

.dock-line {
  padding: 7px 0;
  border-bottom: 1px solid rgba(255, 255, 255, .05);
}

.dock-line:last-of-type { border-bottom: 0; }

/* .62 in the flyout, because you know what you did and it is shut most of the
   time. A permanently visible column at 38% opacity reads as a rendering
   fault, so the dock is quieter about being quiet. */
.dock-line.mine { opacity: .8; }

.dock-line-text {
  margin: 0;
  color: #e8eaed;
  font-size: 12.5px;
  line-height: 1.5;
}

.dock-tag {
  color: #8ab4f8;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  text-decoration: none;
}

.dock-tag:hover { text-decoration: underline; }
.dock-tag:focus-visible { outline: 2px solid #6ea8fe; outline-offset: 2px; }

.dock-line-when { color: #6d747c; }

.dock-line-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 4px 8px;
  margin-top: 2px;
  color: #9aa0a6;
  font-size: 11px;
}

/* A title WRAPS here. The flyout ellipsises one because 360px is all it will
   ever have; a column the reader can drag to 460px should use the width. */
.dock-line-title { color: #9aa0a6; }
.dock-line-detail { color: #9aa0a6; }
.dock-line-withdrawn { color: #e0a030; }

.dock-expand {
  margin-top: 3px;
  padding: 0;
  border: 0;
  background: none;
  color: #8ab4f8;
  font: inherit;
  font-size: 11px;
  cursor: pointer;
}

.dock-expand:hover { text-decoration: underline; }

.dock-members {
  margin: 4px 0 0 8px;
  padding-left: 8px;
  border-left: 1px solid rgba(255, 255, 255, .1);
}

.dock-member { padding: 2px 0; }
.dock-member-text { margin: 0; color: #9aa0a6; font-size: 11px; }

/* The end of the record, and the only thing that says a page is on its way.
   No button: reaching the bottom is the gesture. */
.dock-sentinel {
  min-height: 1px;
  padding: 12px 0 4px;
  color: #6d747c;
  font-size: 11px;
  text-align: center;
}

@media (prefers-reduced-motion: reduce) {
  .dock-resize-handle::after { transition: none; }
}

@media (max-width: 520px) {
  #grid { grid-template-columns: 1fr; }
  #topbar { flex-wrap: wrap; }
  #link-note { margin-left: auto; }
  .card-title { font-size: 21px; }
}
