/*
 * This is a manifest file that'll be compiled into application.css.
 *
 * With Propshaft, assets are served efficiently without preprocessing steps. You can still include
 * application-wide styles in this file, but keep in mind that CSS precedence will follow the standard
 * cascading order, meaning styles declared later in the document or manifest will override earlier ones,
 * depending on specificity.
 *
 * Consider organizing styles into separate files for maintainability.
 */

/* The metrics board. Plain CSS and system fonts, because the page is a
   dashboard kept open in a tab: it is read far more often than it is
   navigated, and should cost as little as possible to render. */

:root {
  --bg: #0f1115;
  --panel: #171a21;
  --line: #262b36;
  --ink: #e6e8ec;
  --muted: #8b93a3;
  --accent: #7fd1ae;
  --bad: #ef8a80;
  /* Limited Operations: operating, but not the Active green. */
  --warn: #d9b26f;
  /* The clickability underline shared by the catalog pages and the chemotype map
     dossier: the accent at rest, so a link reads as the fact it names until
     hovered. */
  --ref-line: rgba(127, 209, 174, 0.45);
}

/* A column with a definite height: the chemotype map's `1fr` shell row resolves
   against it, so a long dossier scrolls inside the panel instead of stretching
   the document. A child that outgrows the body still scrolls the page -- a
   flex item's automatic minimum size beats `flex-shrink`. `dvh` because
   mobile URL bars shrink `vh`. */
body {
  margin: 0;
  height: 100vh;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--ink);
  font: 15px/1.5 ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-variant-numeric: tabular-nums;
}

.board {
  box-sizing: border-box;
  width: 100%;
  max-width: 74rem;
  margin: 0 auto;
  padding: 2rem 1.25rem 4rem;
  display: grid;
  gap: 1.25rem;
}

.site-footer {
  box-sizing: border-box;
  flex: none;
  width: 100%;
  max-width: 74rem;
  margin: auto auto 0;
  padding: 1rem 1.25rem 1.5rem;
  border-top: 1px solid var(--line);
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.75rem 1.5rem;
  color: var(--muted);
  font-size: 0.8125rem;
}

.site-footer nav {
  display: flex;
  gap: 1rem;
}

.site-footer a {
  color: var(--muted);
  text-underline-offset: 0.2em;
}

.site-footer a:hover {
  color: var(--accent);
}

.site-footer-mcp {
  min-width: 0;
  margin: 0;
}

.site-footer-mcp span {
  margin-right: 0.5rem;
}

.site-footer-mcp code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  overflow-wrap: anywhere;
}

.legal-page, .chemotypes-page {
  flex: none;
  max-width: 50rem;
}

.legal-page h2, .chemotypes-page h2 {
  margin: 0 0 0.5rem;
  font-size: 1rem;
}

.legal-page p, .chemotypes-page p {
  margin: 0 0 0.75rem;
}

.chemotypes-page a {
  color: var(--accent);
  text-underline-offset: 0.2em;
}

.masthead {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.5rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--line);
}

.masthead h1 {
  margin: 0;
  font-size: 1.25rem;
  letter-spacing: 0.02em;
}

/* The brand is one SVG lockup (app/assets/images/logo.svg) rather than a text
   heading, so the neon mark and the wordmark keep their spacing. 30px is the
   smallest height at which the palm/sun interior still reads; the wordmark is
   inline with the h1 it replaced. */
.brand-logo {
  display: block;
  height: 30px;
  width: auto;
}

/* The company icon plus the title block, so the icon stays centered on the
   heading while the badge remains on the masthead's far edge. */
.masthead-title {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.stamp {
  margin: 0;
  color: var(--muted);
  font-size: 0.8125rem;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 1rem 1.125rem 1.125rem;
}

.panel h2 {
  margin: 0 0 0.875rem;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: var(--muted);
}

.stats {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(9.5rem, 1fr));
  gap: 0.75rem;
}

.stat {
  display: flex;
  flex-direction: column;
  gap: 0.125rem;
  padding: 0.625rem 0.75rem;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--line);
  border-radius: 6px;
}

.stat .value {
  font-size: 1.375rem;
  font-weight: 600;
  color: var(--accent);
}

.stat .label {
  font-size: 0.75rem;
  color: var(--muted);
}

/* A card with a hint says so before it is hovered: the label takes a dotted
   rule and the pointer becomes the help cursor. A permanent "?" on every tile
   would be louder than the numbers. */
.stat[data-controller~="tooltip"] {
  cursor: help;
}

.stat[data-controller~="tooltip"] .label {
  text-decoration: underline dotted rgba(139, 147, 163, 0.5);
  text-underline-offset: 0.2em;
}

.stat:focus-visible {
  outline: 1px solid var(--accent);
  outline-offset: 2px;
}

/* The methodology panel a card opens on hover, tap or keyboard focus. The
   controller positions it fixed, so these are only its looks; `hidden` wins
   over the positioning because a panel that has never opened is display:none. */
.tip {
  position: fixed;
  z-index: 40;
  display: block;
  width: max-content;
  max-width: min(24rem, calc(100vw - 1rem));
  padding: 0.5rem 0.625rem;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #0b0e13;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.55);
  color: var(--ink);
  font-size: 0.75rem;
  line-height: 1.45;
  text-wrap: pretty;
  pointer-events: none;
}

.tip[hidden] {
  display: none;
}

/* The found count's shape over the window. No axes, no grid: the card above
   carries today's number and the caption carries the gain, so the line only
   has to show the shape. It is drawn in a 240x48 viewBox and stretched to the
   panel, and the stroke is non-scaling so the width does not grow with it. */
.spark {
  margin: 0.9rem 0 0;
}

.spark figcaption {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 0.75rem;
  font-size: 0.75rem;
  color: var(--muted);
}

.spark .spark-delta {
  color: var(--accent);
  font-weight: 600;
}

.sparkline {
  display: block;
  width: 100%;
  height: 48px;
  margin-top: 0.4rem;
}

.sparkline polyline {
  fill: none;
  stroke: var(--accent);
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
  vector-effect: non-scaling-stroke;
}

.spark-scale {
  display: flex;
  justify-content: space-between;
  margin: 0.3rem 0 0;
  font-size: 0.6875rem;
  color: var(--muted);
}

.sparkline-empty {
  display: block;
  height: 48px;
  margin-top: 0.4rem;
  color: var(--muted);
}

/* The corpus flow. The SVG is drawn in a 1000x380 user space and stretched to
   the panel width, so the labels are readable at the same size as the cards it
   replaces. The helper also draws a vertical layout (stages top to bottom) for
   phones: below the breakpoint the wide chart stays display:none instead of
   scrolling sideways, because half a flow chart is worse than a different
   shape. Above it, a narrow desktop still scrolls inside its own box rather
   than shrinking the text to nothing; the page itself never scrolls sideways. */
.sankey-frame {
  display: block;
}

.sankey-vertical {
  display: none;
}

.sankey-scroll {
  overflow-x: auto;
  margin: 0 -0.25rem;
  padding: 0 0.25rem 0.25rem;
}

.sankey-horizontal .sankey {
  min-width: 46rem;
}

.sankey svg {
  display: block;
  width: 100%;
  height: auto;
}

@media (max-width: 46rem) {
  .sankey-horizontal {
    display: none;
  }

  .sankey-vertical {
    display: block;
  }
}

.sankey-stage {
  fill: var(--muted);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.09em;
}

.sankey-link {
  opacity: 0.22;
}

.sankey-link.is-accent {
  fill: var(--accent);
}

.sankey-link.is-warn {
  fill: var(--warn);
}

.sankey-link.is-bad {
  fill: var(--bad);
}

.sankey-link.is-muted {
  fill: #7a8494;
}

.sankey-node {
  cursor: help;
}

.sankey-node:focus {
  outline: none;
}

.sankey-bar {
  fill: #596273;
}

.sankey-node.is-accent .sankey-bar {
  fill: var(--accent);
}

.sankey-node.is-warn .sankey-bar {
  fill: var(--warn);
}

.sankey-node.is-bad .sankey-bar {
  fill: var(--bad);
}

.sankey-node.is-muted .sankey-bar {
  fill: #4a5262;
}

.sankey-hit {
  fill: transparent;
}

.sankey-label-name {
  fill: var(--ink);
  font-size: 13px;
}

.sankey-label-value {
  fill: var(--muted);
  font-size: 13px;
  font-weight: 600;
}

.sankey-leader {
  fill: none;
  stroke: var(--line);
  stroke-width: 1;
}

.sankey-node:hover .sankey-label-name,
.sankey-node:focus-visible .sankey-label-name {
  fill: var(--accent);
}

.sankey-node:hover .sankey-bar,
.sankey-node:focus-visible .sankey-bar {
  filter: brightness(1.3);
}

.sankey-node:focus-visible .sankey-bar {
  stroke: var(--accent);
  stroke-width: 2;
}

.grid {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}

.grid th,
.grid td {
  padding: 0.4rem 0.5rem;
  border-bottom: 1px solid var(--line);
  text-align: left;
  font-weight: 400;
}

.grid thead th {
  font-size: 0.6875rem;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--muted);
}

.grid tbody tr:last-child th,
.grid tbody tr:last-child td {
  border-bottom: none;
}

/* A company's stored favicon, or its letter tile while the icon sweep has not
   found one. The list is dense, so the small size sits on the text baseline. */
.company-icon {
  width: 1.5rem;
  height: 1.5rem;
  flex: none;
  margin-right: 0.4rem;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.04);
  object-fit: contain;
  vertical-align: -0.35rem;
}

.company-icon--large {
  width: 3rem;
  height: 3rem;
  margin-right: 0;
  border-radius: 6px;
  vertical-align: middle;
}

.company-icon--fallback {
  display: inline-grid;
  place-items: center;
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 600;
  line-height: 1;
}

.company-icon--large.company-icon--fallback {
  font-size: 1.25rem;
}

.grid .num,
.ranking .num {
  text-align: right;
}

/* The type cell reads as the activity DCC licenses; the registry's code is its
   tooltip. Same cue as a metric card that carries a hint: dotted rule, help
   cursor, and the tooltip controller opens on hover, tap or keyboard focus. */
.type-label[data-controller~="tooltip"] {
  cursor: help;
  text-decoration: underline dotted rgba(139, 147, 163, 0.5);
  text-underline-offset: 0.2em;
}

.type-label:focus-visible {
  outline: 1px solid var(--accent);
  outline-offset: 2px;
}

/* The family glyph, on the companies table's type cell and the company page's
   Family fact. Muted because the family is context for the type rather than
   the fact being read, and inline so it sits on the text baseline. */
.family-icon {
  fill: currentColor;
  color: var(--muted);
  vertical-align: -0.15em;
}

.ranking {
  margin: 0.75rem 0 0;
  padding: 0;
  list-style: none;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr));
  gap: 0.25rem 1.5rem;
  font-size: 0.875rem;
}

.ranking li {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.25rem 0;
  border-bottom: 1px solid var(--line);
}

.ranking .name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ranking .num {
  color: var(--muted);
  flex: none;
}

.note {
  margin: 0.75rem 0 0;
  font-size: 0.75rem;
  color: var(--muted);
}

/* The "All N …" link under a capped list. It is a catalog link like `.ref`,
   but the note's muted type is the context, so it gets the accent underline
   rather than the browser's blue. */
.note a {
  color: inherit;
  text-decoration: none;
  border-bottom: 1px solid var(--ref-line);
}

.note a:hover {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

.empty {
  margin: 0;
  font-size: 0.875rem;
  color: var(--muted);
}

/* The disclosure under a panel's primary table: the absolute profile under the
   potency comparison, the clean panels under the verdicts. It borrows the
   panel heading's small caps so it reads as a control, not a second heading. */
.profile-detail {
  margin-top: 0.875rem;
  border-top: 1px solid var(--line);
  padding-top: 0.625rem;
}

.profile-detail > summary {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  width: max-content;
  list-style: none;
  cursor: pointer;
  color: var(--muted);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.07em;
}

.profile-detail > summary::-webkit-details-marker {
  display: none;
}

.profile-detail > summary::before {
  content: "▸";
  font-size: 0.6875rem;
  transition: transform 0.15s ease;
}

.profile-detail[open] > summary::before {
  transform: rotate(90deg);
}

.profile-detail > summary:hover {
  color: var(--accent);
}

.profile-detail .grid {
  margin-top: 0.75rem;
}

.bad {
  color: var(--bad);
}

.menu {
  box-sizing: border-box;
  width: 100%;
  max-width: 74rem;
  margin: 0 auto;
  padding: 1.5rem 1.25rem 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.375rem 1.125rem;
  font-size: 0.8125rem;
}

.menu a {
  color: var(--muted);
  text-decoration: none;
}

.menu a:hover,
.menu a.active {
  color: var(--accent);
}

/* The site search sits at the far end of the menu and stays one line: the
   input is the only control that needs width, and the label and button borrow
   the menu's own muted type so the bar does not read as a second heading. */
.menu-search {
  display: flex;
  align-items: center;
  gap: 0.375rem;
  margin-left: auto;
}

.menu-search-label {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  color: var(--muted);
  font-size: 0.6875rem;
  text-transform: uppercase;
  letter-spacing: 0.07em;
}

.menu-search input[type="search"] {
  width: 15rem;
  max-width: 38vw;
  padding: 0.2rem 0.45rem;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 4px;
  color: var(--ink);
  font: inherit;
  font-size: 0.8125rem;
  text-transform: none;
  letter-spacing: normal;
}

.menu-search input[type="search"]:focus {
  outline: 1px solid var(--accent);
  border-color: var(--accent);
}

.menu-search input[type="submit"] {
  padding: 0.2rem 0.5rem;
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 4px;
  color: var(--muted);
  font: inherit;
  font-size: 0.6875rem;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  cursor: pointer;
}

.menu-search input[type="submit"]:hover {
  color: var(--accent);
  border-color: var(--accent);
}

@media (max-width: 40rem) {
  .menu-search {
    width: 100%;
    margin-left: 0;
  }

  .menu-search-label {
    flex: 1;
  }

  .menu-search input[type="search"] {
    width: 100%;
    max-width: none;
  }
}

.stamp a {
  color: var(--accent);
  text-decoration: none;
}

.pager {
  display: flex;
  gap: 1.25rem;
  align-items: baseline;
  margin-top: -0.5rem;
  color: var(--muted);
  font-size: 0.8125rem;
}

.pager a {
  color: var(--accent);
  text-decoration: none;
}

.fields {
  margin: 0;
  display: grid;
  grid-template-columns: minmax(10rem, max-content) 1fr;
  gap: 0.25rem 1.25rem;
  font-size: 0.875rem;
}

.fields dt {
  color: var(--muted);
}

.fields dd {
  margin: 0;
  overflow-wrap: anywhere;
}

/* Catalog links -- a related record in a detail field, a row title in an
   index table. The browser's blue/purple reads as chrome noise on a dark
   board; the green line (the accent's active signal) marks clickability
   instead, matching the chemotype map dossier's entity links. `.ref` is the same mark
   for a link that sits outside a field list or table (a company's licensee, a
   sibling license). */
.fields dd a,
.grid tbody a:not(.button),
.ref {
  color: inherit;
  text-decoration: none;
  border-bottom: 1px solid var(--ref-line);
}

.fields dd a:hover,
.grid tbody a:hover,
.ref:hover {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

/* An in-table action rather than a related record: the product page's per-COA
   "View COA". The green hairline above marks a reference, so a control gets a
   border and the accent at rest to read as pressable. */
.button {
  display: inline-block;
  padding: 0.15rem 0.5rem;
  border: 1px solid var(--ref-line);
  border-radius: 4px;
  color: var(--accent);
  font-size: 0.75rem;
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
}

.button:hover,
.button:focus-visible {
  border-color: var(--accent);
  background: rgba(127, 209, 174, 0.08);
}

/* The company record's three fact cards. auto-fit rather than a fixed
   two-column layout: the long tail of licenses has only facts, and two empty
   columns beside a populated one would read as a broken page. */
.profile-facts {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(17rem, 1fr));
  gap: 1.25rem;
  align-items: start;
}

/* Status pills. DCC's status is free text, so the tone is chosen by the
   helper and an unknown value falls back to muted rather than a color that
   claims more than the registry said. */
.badge {
  display: inline-block;
  padding: 0.1rem 0.45rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  white-space: nowrap;
}

.badge.is-active {
  color: var(--accent);
  border-color: var(--ref-line);
}

.badge.is-warn {
  color: var(--warn);
  border-color: rgba(217, 178, 111, 0.45);
}

.badge.is-bad {
  color: var(--bad);
  border-color: rgba(239, 138, 128, 0.45);
}

.badge.is-muted {
  color: var(--muted);
}

/* A panel's row count, kept beside the uppercase heading without inheriting
   its letter-spacing or caps. */
.panel h2 .count {
  margin-left: 0.375rem;
  color: var(--muted);
  font-weight: 400;
  letter-spacing: normal;
  text-transform: none;
}

/* A recall is the one panel heading that must not read as neutral chrome. */
.panel h2.recall-heading {
  color: var(--bad);
}

/* The sibling-license list inside a fact panel. */
.compact {
  margin: 0.3rem 0 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 0.15rem;
  font-size: 0.8125rem;
}

.muted {
  color: var(--muted);
}

/* A stored image on a generic record page. The limit keeps a large upload
   from pushing the fields off the board. */
.record-image {
  display: block;
  max-width: 16rem;
  max-height: 16rem;
  margin-bottom: 0.35rem;
  border: 1px solid var(--line);
  border-radius: 6px;
}

/* The product's stored label image and its printed facts. The image is the
   only durable copy: `product_image` was the payload's expiring signed URL.
   It sits with the label because that is what it is, not a page heading. The
   stored photos are usually much larger than the old 6rem square, so the box
   grows with the viewport up to 19rem while the facts keep the remaining
   width. */
.label-body {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 1.125rem;
}

.label-body .fields {
  flex: 1 1 16rem;
  min-width: 0;
}

.product-image {
  width: clamp(10rem, 30vw, 19rem);
  height: auto;
  max-height: 24rem;
  flex: none;
  object-fit: contain;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.03);
}

/* One COA history series. Every chart emits a wide and a narrow SVG; the
   stylesheet picks one, so a phone gets readable labels rather than a shrunken
   desktop drawing or a sideways scroll. */
.trend-stack {
  display: grid;
  gap: 1.25rem;
}

.trend {
  margin: 0;
}

.trend figcaption {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 0.75rem;
  margin-bottom: 0.25rem;
}

.trend-name {
  font-size: 0.875rem;
  font-weight: 600;
}

.trend-meta {
  color: var(--muted);
  font-size: 0.75rem;
}

.trend-narrow {
  display: none;
}

@media (max-width: 46rem) {
  .trend-wide {
    display: none;
  }

  .trend-narrow {
    display: block;
  }
}

.trend-chart {
  display: block;
  width: 100%;
  height: auto;
}

.trend-grid line {
  stroke: var(--line);
  stroke-width: 1;
}

.trend-grid text,
.trend-axis text {
  fill: var(--muted);
  font-size: 12px;
}

.trend-area {
  fill: rgba(127, 209, 174, 0.08);
}

.trend-line {
  fill: none;
  stroke: var(--accent);
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
  vector-effect: non-scaling-stroke;
}

.trend-dot {
  fill: var(--accent);
  stroke: var(--panel);
  stroke-width: 1;
}

/* A reading Metrc lists on the package that is not the package's own test:
   drawn, never dropped, but hollow so the discrepancy shows. */
.trend-dot.is-off-package {
  fill: none;
  stroke: var(--warn);
  stroke-width: 1.6;
}

.trend-point:hover .trend-dot.is-off-package {
  fill: none;
  stroke: var(--warn);
  stroke-width: 2;
}

.trend-dot-hit {
  fill: transparent;
  pointer-events: all;
}

.trend-point:hover .trend-dot {
  fill: var(--ink);
  stroke: var(--accent);
  stroke-width: 2;
}

.trend-layer {
  pointer-events: none;
}

.trend-stack-outline {
  fill: none;
  stroke: var(--muted);
  stroke-width: 1;
  stroke-linejoin: round;
  vector-effect: non-scaling-stroke;
}

.trend-column-hit {
  fill: transparent;
  pointer-events: all;
}

.trend-column-hit:hover {
  fill: rgba(255, 255, 255, 0.035);
}

.trend-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem 1rem;
  margin: 0.55rem 0 0;
  padding: 0;
  list-style: none;
  color: var(--muted);
  font-size: 0.75rem;
}

.trend-legend li {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.trend-swatch {
  width: 0.55rem;
  height: 0.55rem;
  border-radius: 2px;
}

/* The COA record pairs its facts with the document they describe: the summary
   is narrow and the PDF takes the remaining width, stacking when the board is
   too narrow for both. */
.document-body {
  display: grid;
  grid-template-columns: minmax(18rem, 24rem) minmax(0, 1fr);
  gap: 1.25rem;
  align-items: start;
}

/* The summary's labels are short, and its column is narrower than the board,
   so the generic 10rem label gutter would leave almost no room for the value. */
.document-body .fields {
  grid-template-columns: minmax(6.5rem, max-content) 1fr;
}

/* A replaced element has no intrinsic height, and the PDF is the page's main
   object, so the preview gets a height of its own. The white page background
   keeps a light PDF from reading as a hole in the dark board. */
.pdf-preview {
  display: block;
  width: 100%;
  height: 75vh;
  min-height: 30rem;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
}

/* The parsed payload is a separate read, not a footnote to the preview, so it
   sits at body size with the catalog's green clickability underline. */
.document-actions {
  margin: 0.875rem 0 0;
  font-size: 0.875rem;
}

@media (max-width: 60rem) {
  .document-body {
    grid-template-columns: minmax(0, 1fr);
  }
}

/* A Metrc package UID is a 27-character barcode, not prose. Monospace and a
   wrap point let it sit in a table cell without widening the page. */
.grid .uid {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.8125rem;
  overflow-wrap: anywhere;
}

/* The index filter bar. It sits in the same panel as the table it narrows, and
   the labels use the same uppercase treatment as the table headers, so the bar
   reads as part of the grid rather than as page chrome. */
.filters {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  gap: 0.5rem 0.75rem;
  padding-bottom: 0.9rem;
  margin-bottom: 0.9rem;
  border-bottom: 1px solid var(--line);
}

.filter {
  display: grid;
  gap: 0.2rem;
  color: var(--muted);
  font-size: 0.6875rem;
  text-transform: uppercase;
  letter-spacing: 0.07em;
}

.filter input,
.filter select {
  padding: 0.3rem 0.45rem;
  min-width: 11rem;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 4px;
  color: var(--ink);
  font: inherit;
  font-size: 0.8125rem;
  text-transform: none;
  letter-spacing: normal;
}

.filter input:focus,
.filter select:focus {
  outline: 1px solid var(--accent);
  border-color: var(--accent);
}

.filters button,
.filter-clear {
  padding: 0.3rem 0.6rem;
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 4px;
  color: var(--muted);
  font: inherit;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  text-decoration: none;
  cursor: pointer;
}

.filters button:hover,
.filter-clear:hover {
  color: var(--accent);
  border-color: var(--accent);
}

/* At a 390px viewport the six-column catalog grid needs ~515px, which makes
   the whole page ~573px wide and forces a sideways page scroll. Stack each row
   into a card instead; each value carries its column header as a data-label,
   so the table still reads without a horizontal scrollbar. */
@media (max-width: 40rem) {
  .board {
    padding: 1.25rem 0.875rem 3rem;
  }

  .panel {
    padding: 0.875rem;
  }

  .grid thead {
    display: none;
  }

  .grid,
  .grid tbody,
  .grid tr,
  .grid th,
  .grid td {
    display: block;
    width: 100%;
  }

  .grid tbody tr {
    padding: 0.7rem 0;
    border-bottom: 1px solid var(--line);
  }

  .grid tbody tr:last-child {
    border-bottom: 0;
  }

  .grid th,
  .grid td {
    padding: 0;
    border-bottom: 0;
  }

  .grid tbody th[scope="row"] {
    padding-bottom: 0.35rem;
    font-weight: 600;
    overflow-wrap: anywhere;
  }

  .grid td {
    display: grid;
    grid-template-columns: minmax(6rem, max-content) minmax(0, 1fr);
    gap: 0.75rem;
    padding: 0.1rem 0;
    text-align: right;
    overflow-wrap: anywhere;
  }

  .grid td::before {
    content: attr(data-label);
    color: var(--muted);
    font-size: 0.6875rem;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    text-align: left;
    white-space: nowrap;
  }

  /* The stacked cell is a two-column grid, and a grid item stretches to fill
     its track by default: a status pill would span the whole value column
     instead of hugging its label (measured 2026-10-25 at 390px). A link is a
     blockified grid item for the same reason, so its hairline underline runs
     the width of the value track rather than the text ("COA →" measured
     2026-10-26 on the lab page at 390px). */
  .grid td > .badge,
  .grid td > a {
    justify-self: end;
  }

  /* A search result has no column header to repeat: the second line is the
     record's context, so it sits under the title instead of beside a "DETAIL"
     label. */
  .search-grid td {
    display: block;
    padding-top: 0.1rem;
    text-align: left;
  }

  .search-grid td::before {
    content: none;
  }
}
