/* "The registry at work" — products × documents, a clock, and DocuMaaS's decisions. */
.vh { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

.demo { padding-top: 8px; padding-bottom: 72px; }
.demo-caption { padding-top: 14px; font-size: 14px; color: var(--ink-soft); max-width: 46em; }

.rd {
  --cw: 30px;          /* one document column */
  --ncol: 13;          /* total document columns (copy/demo.json groups) */
  --gap-g: 22px;       /* space between manufacturer and company documents */
  --pad: 24px;
  --row-hl: #F1EDE3;
  border: 1px solid var(--ink);
  background: var(--paper);
}

/* band: clock + control */
.rd-band { display: flex; justify-content: space-between; align-items: center; gap: 16px; padding: 10px var(--pad); }
.rd-clock { font-size: 14px; color: var(--ink-soft); }
.rd-clock time { font-size: 16px; color: var(--ink); }
.rd-btn { font: inherit; font-size: 14px; color: var(--ink); background: transparent; border: 1px solid var(--ink); border-radius: 0; height: 36px; min-width: 96px; padding: 0 14px; cursor: pointer; }
.rd-btn:hover { background: var(--row-hl); }
.rd-btn:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
.rd-progress { height: 1px; background: var(--line); }
.rd-progress span { display: block; height: 1px; width: 0; background: var(--ink); transition: width 400ms linear; }

/* outcome counters */
.rd-stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); margin: 0; border-bottom: 1px solid var(--ink); }
.rd-stat { padding: 14px var(--pad) 16px; border-left: 1px solid var(--line); }
.rd-stat:first-child { border-left: 0; }
.rd-stat dt { font-size: 13px; color: var(--ink-soft); }
.rd-stat dd { margin: 6px 0 0; font-size: 28px; line-height: 1.1; display: flex; align-items: baseline; gap: 2px; }
.rd-of { font-size: 16px; color: var(--ink-soft); }
.rd-stat .rd-v.sticker-pill { font-size: 22px; line-height: 1.1; padding: 2px 14px; }

/* matrix */
.rd-head, .rd-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) calc(var(--cw) * var(--ncol) + var(--gap-g)) 190px;
  column-gap: 24px;
  align-items: center;
  padding: 0 var(--pad);
}
.rd-head { align-items: end; padding-top: 8px; padding-bottom: 8px; border-bottom: 1px solid var(--ink); font-size: 13px; color: var(--ink-soft); }
.rd-cells { display: grid; grid-template-columns: repeat(9, var(--cw)) var(--gap-g) repeat(4, var(--cw)); justify-items: center; align-items: center; }
.rd-head .rd-hcells { justify-items: stretch; align-items: end; }
.rd-hgroup { padding-top: 6px; border-top: 1px solid var(--ink); font-size: 12px; line-height: 1.3; color: var(--ink); text-align: center; white-space: nowrap; }
.rd-mhead { display: none; }

.rd-row { padding-top: 10px; padding-bottom: 10px; border-bottom: 1px solid var(--line); transition: background-color 300ms ease; }
.rd-row.is-active { background: var(--row-hl); }
.rd-prod { display: grid; grid-template-columns: 22px minmax(0, 1fr); column-gap: 8px; line-height: 1.3; }
.rd-idx { grid-row: span 2; font-size: 13px; color: var(--ink-soft); padding-top: 1px; }
.rd-name { font-size: 15px; }
.rd-maker { font-size: 13px; color: var(--ink-soft); }
.rd-reg { display: flex; flex-direction: column; align-items: flex-start; gap: 3px; font-size: 13px; line-height: 1.3; }
.rd-reg time { font-size: 14px; }
.rd-reg-s { color: var(--vigente); }
.rd-reg .rd-reg-s.sticker-pill { font-size: 12px; padding: 2px 10px; color: var(--ink); }
.rd-reg.is-hit time { text-decoration: underline; text-underline-offset: 3px; }

/* status marks: shape carries meaning as well as colour */
.cell { display: block; width: 12px; height: 12px; border-radius: 50%; box-sizing: border-box; border: 2px solid transparent; transition: background-color 200ms ease, border-color 200ms ease, box-shadow 200ms ease; }
.cell[data-s="ok"] { background: var(--vigente); border-color: var(--vigente); }
.cell[data-s="soon"] { background: var(--por-vencer-dot); border: 1.5px solid var(--por-vencer-text); }
.cell[data-s="wait"] { background: transparent; border-color: var(--ink-soft); }
.cell[data-s="check"] { background: var(--paper); border-color: var(--ink); box-shadow: inset 0 0 0 2px var(--paper), inset 0 0 0 4px var(--ink); }
.cell[data-s="back"] { background: var(--paper); border-color: var(--por-vencer-text); box-shadow: inset 0 0 0 2px var(--paper), inset 0 0 0 4px var(--por-vencer-dot); }
.cell.sq { border-radius: 2px; }
.cell[data-s="draft"] { background-image: var(--holo); background-color: #EDE7FF; border: 1.5px solid var(--ink); }
.cell[data-s="shape"] { background: transparent; border: 1.5px solid var(--ink); }
.cell[data-s="na"] { width: 8px; height: 2px; border: 0; border-radius: 1px; background: #CFC9BC; }
/* "this one just changed": a square frame, so it never reads as a status shape */
.cell { position: relative; }
.cell.is-hit::after { content: ""; position: absolute; inset: -6px; border: 1px solid var(--ink); border-radius: 2px; }
.cell[data-s="na"].is-hit::after { inset: -8px -6px; }

/* decisions */
.rd-feedwrap { border-top: 1px solid var(--ink); padding: 12px var(--pad) 4px; }
.rd-feedlabel { font-size: 13px; color: var(--ink-soft); padding-bottom: 4px; }
.rd-feed { list-style: none; margin: 0; padding: 0; min-height: 196px; }
.rd-entry { display: grid; grid-template-columns: 56px 44px minmax(0, 1fr); column-gap: 12px; padding: 9px 0; border-bottom: 1px solid var(--line); font-size: 15px; line-height: 1.45; animation: rd-in 260ms cubic-bezier(.2, 0, 0, 1) both; }
.rd-entry:last-child { border-bottom: 0; }
.rd-entry time { font-size: 14px; color: var(--ink-soft); padding-top: 1px; }
.rd-tag { font-size: 13px; color: var(--ink-soft); padding-top: 2px; }
.rd-entry .fact { color: var(--ink-soft); }
.rd-entry .dec { color: var(--ink); font-weight: 500; }
.rd-entry + .rd-entry .dec { font-weight: 400; }
@keyframes rd-in { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }

.rd-legend { display: flex; flex-wrap: wrap; gap: 8px 22px; list-style: none; margin: 0; padding: 12px var(--pad) 14px; border-top: 1px solid var(--line); font-size: 13px; color: var(--ink-soft); }
.rd-legend li { display: flex; align-items: center; gap: 8px; }
.rd-legend li.is-shape { color: var(--ink); }
.rd-legend li.is-shape + li:not(.is-shape) { margin-left: 10px; padding-left: 22px; border-left: 1px solid var(--line); }

/* narrower desktop: tighten columns */
@media (max-width: 1040px) {
  .rd { --cw: 26px; }
  .rd-head, .rd-row { grid-template-columns: minmax(0, 1fr) calc(var(--cw) * var(--ncol) + var(--gap-g)) 160px; column-gap: 16px; }
}

/* phone: product line on top, document strip below */
@media (max-width: 760px) {
  .rd { --cw: 20px; --gap-g: 14px; --pad: 12px; }
  .rd-btn { min-width: 84px; height: 34px; }
  .rd-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .rd-stat { padding: 12px var(--pad); }
  .rd-stat:nth-child(3) { border-left: 0; }
  .rd-stat:nth-child(n + 3) { border-top: 1px solid var(--line); }
  .rd-stat dd { font-size: 22px; }
  .rd-head { display: none; }
  .rd-mhead { display: block; padding: 10px var(--pad); font-size: 13px; color: var(--ink-soft); border-bottom: 1px solid var(--ink); }
  .rd-row { grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "prod reg" "cells cells"; row-gap: 10px; column-gap: 12px; align-items: start; }
  .rd-prod { grid-area: prod; }
  .rd-reg { grid-area: reg; align-items: flex-end; text-align: right; }
  .rd-cells { grid-area: cells; justify-self: start; padding-left: 30px; }
  .cell { width: 11px; height: 11px; }
  .rd-entry { grid-template-columns: 54px minmax(0, 1fr); column-gap: 10px; font-size: 14px; }
  .rd-entry time { white-space: nowrap; font-size: 13px; }
  .rd-tag { display: none; }
  .rd-legend li.is-shape + li:not(.is-shape) { margin-left: 0; padding-left: 0; border-left: 0; }
  .rd-feed { min-height: 240px; }
}

@media (prefers-reduced-motion: reduce) {
  .rd *, .rd *::before, .rd *::after { transition: none !important; animation: none !important; }
}
