/* PK2 Finance & Strategy · The Collections Queue (/tools/collections-queue/)
   The one per-tool layer, loaded after tokens.css, foundation.css and
   tool-page.css. It holds the drop zone, the privacy block, the counts, the
   invoice cards and the block under the instrument. No hex value anywhere:
   every colour reads a token. Nothing here animates. */

/* --------------------------------------------------------- 1 drop zone -- */

/* The file's own region: one hairline rule around a piece of the instrument
   core, large enough to be a target for a dragged file and readable as one.
   No shadow, no gradient. The instrument is the only object with depth. */
.cq-drop {
  margin-top: 22px;
  padding: 30px 26px 26px;
  border: 1px solid var(--hairline);
  border-radius: var(--radius-instr-inner);
  transition: border-color var(--dur-ui) ease;
}

/* Drag-over. The rule goes gold and thickens by nothing: the only change is
   colour, so the region does not move under the file. */
.cq-drop.is-over { border-color: var(--gold); }

.cq-drop-line {
  margin-top: 12px;
  max-width: 46ch;
  font-size: var(--size-body);
  line-height: 1.6;
  color: var(--text);
}

.cq-drop-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px 24px;
  margin-top: 22px;
}

/* The label is the button and the input is inside it, so a click anywhere on
   the pill opens the picker and the input keeps its own accessible name. */
.cq-file-label { position: relative; }

/* Clipped, not display:none: a hidden input is not focusable, and Tab has to
   reach this control. */
.cq-file-input {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

/* The focus ring belongs to the pill, because that is what a keyboard user
   sees when the input inside it takes focus. */
.cq-file-label:focus-within {
  outline: 2px solid var(--focus-ring);
  outline-offset: 3px;
  border-color: var(--ink);
}

/* .btn-tertiary is written for a link; on a button it has a border, a ground
   and a text colour of its own to unset. */
.cq-demo-btn {
  padding: 0;
  border: 0;
  background: none;
  cursor: pointer;
}
.cq-demo-btn:focus-visible {
  outline: 2px solid var(--focus-ring);
  outline-offset: 3px;
}

.cq-drop-hint,
.cq-nojs {
  margin-top: 18px;
  max-width: 62ch;
  font-family: var(--font-mono);
  font-weight: 500;
  font-size: 12px;
  line-height: 1.6;
  color: var(--text-muted);
}

/* The tool needs script to read a file at all, so the page says so where the
   file would go. With script, the line is untrue and is removed. */
html.js .cq-nojs { display: none; }

/* ----------------------------------------------------------- 2 privacy -- */

/* Always on the page, above the fold, whether or not a file has been read.
   The claims are the system's own (BOUNDARIES.md); the last line names what
   enforces them. */
.cq-privacy {
  margin-top: 26px;
  padding-top: 20px;
  border-top: 1px solid var(--hairline);
}

.cq-privacy-list {
  margin: 12px 0 0;
  padding: 0;
  list-style: none;
  max-width: 62ch;
}
.cq-privacy-list li {
  padding: 7px 0;
  font-size: var(--size-small);
  line-height: 1.55;
  color: var(--text);
  border-bottom: 1px solid var(--hairline);
}
.cq-privacy-list li:last-child { border-bottom: 0; }

.cq-privacy-note {
  margin-top: 12px;
  max-width: 62ch;
  font-size: 13px;
  line-height: 1.55;
  color: var(--text-muted);
}

/* ------------------------------------------------------------- 3 error -- */

/* The parser's rejection, printed as the parser wrote it. A wrong total is a
   wrong file, and the page does not soften what the engine said. */
.cq-error {
  margin-top: 22px;
  padding: 16px 18px;
  border-left: 2px solid var(--error);
}
.cq-error-lead {
  font-size: var(--size-body);
  line-height: 1.55;
  color: var(--error);
}
.cq-error-message {
  margin-top: 8px;
  font-family: var(--font-mono);
  font-weight: 500;
  font-size: 13px;
  line-height: 1.6;
  color: var(--text);
  overflow-wrap: anywhere;
}

/* ------------------------------------------------------- 4 the report -- */

.cq-report:not(:empty) {
  margin-top: 24px;
  padding-top: 22px;
  border-top: 1px solid var(--hairline);
}

.cq-posture { display: block; }

.cq-company { margin-top: 14px; }

.cq-meta {
  margin-top: 8px;
  font-size: var(--size-small);
  line-height: 1.55;
  color: var(--text-muted);
}
.cq-meta .num-data { color: var(--ink); }
.cq-meta-dot { color: var(--fog); }

.cq-demo-note {
  margin-top: 12px;
  font-family: var(--font-mono);
  font-weight: 500;
  font-size: 12px;
  line-height: 1.6;
  color: var(--text-muted);
}

/* The three numerals. The restraint is the story: most of a queue is routine
   and only a few invoices are a judgment call, so the counts are the first
   thing on the report and they are at size. */
.cq-counts {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  column-gap: var(--gutter);
  row-gap: 22px;
  margin-top: 26px;
  padding-top: 22px;
  border-top: 1px solid var(--hairline);
}

/* The label above a numeral wraps to two lines on a phone, so the cell holds
   its numeral at the bottom and the three figures sit on one line whatever
   their labels do. */
.cq-count {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.cq-count-num {
  margin-top: 6px;
  font-size: clamp(48px, 5.6vw, 84px);
}

.cq-counts-note {
  margin-top: 18px;
  max-width: 62ch;
  font-size: var(--size-small);
  line-height: 1.55;
  color: var(--text-muted);
}

/* Where the page speaks about itself rather than about an invoice. */
.cq-mono-note {
  margin-top: 10px;
  max-width: 68ch;
  font-family: var(--font-mono);
  font-weight: 500;
  font-size: 12px;
  line-height: 1.6;
  color: var(--text-muted);
}

.cq-downloads {
  display: flex;
  flex-wrap: wrap;
  gap: 14px 16px;
  margin-top: 24px;
}

/* --------------------------------------------------------- 5 buckets -- */

.cq-bucket {
  margin-top: 34px;
  padding-top: 16px;
  border-top: 1px solid var(--hairline);
}

.cq-bucket-title,
.cq-notyet-summary {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  font-family: var(--font-mono);
  font-weight: 500;
  font-size: var(--size-label);
  line-height: 1.3;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--ink);
}

.cq-bucket-count {
  font-size: 18px;
  letter-spacing: 0;
  color: var(--ink);
}

.cq-empty {
  margin-top: 14px;
  font-size: var(--size-small);
  line-height: 1.55;
  color: var(--text-muted);
}

/* One invoice, ruled rather than boxed: the same hairline language the tables
   on the other tools use. The card is a row of the queue, not a tile. */
.cq-card {
  margin-top: 20px;
  padding: 16px 0 18px;
  border-bottom: 1px solid var(--hairline);
}

.cq-card-head {
  font-size: 15px;
  color: var(--ink);
}

.cq-card-body {
  margin-top: 10px;
  max-width: var(--measure);
  font-size: var(--size-small);
  line-height: 1.6;
  color: var(--text);
}

/* The one sentence the page writes for the invoices that want a person. The
   gold rule is the site's marker for a stated conclusion. */
.cq-card-call {
  margin-top: 12px;
  padding-left: 14px;
  border-left: 2px solid var(--gold);
  max-width: var(--measure);
  font-size: var(--size-small);
  line-height: 1.6;
  color: var(--ink);
}

.cq-card-label { margin-top: 16px; }

/* The plain reading: body type, one line for each line the engine wrote. This
   is what an owner reads. */
.cq-why {
  margin: 8px 0 0;
  padding: 0;
  list-style: none;
}
.cq-why li {
  margin-top: 6px;
  max-width: var(--measure);
  font-size: var(--size-small);
  line-height: 1.6;
  color: var(--text);
}
.cq-why li:first-child { margin-top: 0; }

/* The engine's own lines, kept word for word and folded away. Closed until
   asked for: the card should answer the question before it shows its work. */
.cq-engine { margin-top: 14px; }
.cq-engine-summary {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  cursor: pointer;
  font-family: var(--font-mono);
  font-weight: 500;
  font-size: 12px;
  line-height: 1.6;
  color: var(--text-muted);
  text-decoration: underline;
  text-underline-offset: 3px;
}
.cq-engine-summary::-webkit-details-marker { display: none; }
.cq-engine-summary:hover { color: var(--ink); }
.cq-engine-summary:focus-visible {
  outline: 2px solid var(--focus-ring);
  outline-offset: 3px;
}

.cq-reasons {
  margin: 8px 0 0;
  padding: 0;
  list-style: none;
}
.cq-reasons li {
  padding: 5px 0 5px 14px;
  position: relative;
  max-width: 76ch;
  font-family: var(--font-mono);
  font-weight: 500;
  font-size: 12px;
  line-height: 1.6;
  color: var(--text-muted);
  overflow-wrap: anywhere;
}
.cq-reasons li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 14px;
  width: 6px;
  height: 1px;
  background: var(--fog);
}

.cq-card-engine {
  margin-top: 12px;
  font-size: 12px;
  color: var(--text-muted);
}

.cq-card-decision {
  margin-top: 12px;
  max-width: var(--measure);
  font-size: var(--size-body);
  line-height: 1.5;
  color: var(--ink);
}

.cq-card-needs {
  margin-top: 6px;
  max-width: var(--measure);
  font-size: var(--size-small);
  line-height: 1.55;
  color: var(--text-muted);
}

/* Not yet due. A count and nothing else until it is asked for: these invoices
   need nothing today, and a queue that shouts about them is a worse queue. */
.cq-notyet {
  margin-top: 34px;
  padding-top: 16px;
  border-top: 1px solid var(--hairline);
}
.cq-notyet-summary { cursor: pointer; }
.cq-notyet-summary::-webkit-details-marker { display: none; }
.cq-notyet-summary:focus-visible {
  outline: 2px solid var(--focus-ring);
  outline-offset: 3px;
}
.cq-notyet-note {
  margin-top: 12px;
  font-size: var(--size-small);
  line-height: 1.55;
  color: var(--text-muted);
}

/* ------------------------------------------------------ 6 the data note -- */

.cq-datanote {
  margin-top: 34px;
  padding-top: 20px;
  border-top: 1px solid var(--hairline);
}
.cq-datanote-lead {
  max-width: 68ch;
  font-size: var(--size-small);
  line-height: 1.6;
  color: var(--text);
}
.cq-datanote .label { display: block; margin-top: 18px; }

.cq-degradations {
  margin: 10px 0 0;
  padding: 0;
  list-style: none;
}
.cq-degradations li {
  padding: 7px 0;
  max-width: 76ch;
  font-family: var(--font-mono);
  font-weight: 500;
  font-size: 12px;
  line-height: 1.6;
  color: var(--text-muted);
  border-bottom: 1px solid var(--hairline);
}
.cq-degradations li:last-child { border-bottom: 0; }

/* --------------------------------------------- 7 under the instrument -- */

.cq-escalation {
  grid-column: 1 / span 10;
  margin-top: 44px;
}

.cq-escalation-copy {
  max-width: var(--measure);
  margin-top: 16px;
}
.cq-escalation-copy p {
  margin-top: 12px;
  font-size: var(--size-body);
  line-height: 1.6;
  color: var(--text-muted);
}
.cq-escalation-copy p:first-child { margin-top: 0; }

/* ------------------------------------------------------------ 8 narrow -- */

@media (max-width: 1024px) {
  .cq-escalation { grid-column: 1 / span 8; }
}

@media (max-width: 640px) {
  .cq-drop { padding: 22px 18px 20px; }
  .cq-drop-actions { gap: 14px 18px; }

  /* The counts stay visible on a phone: three columns, one step smaller,
     rather than three screens of scrolling to reach the queue. */
  .cq-counts { column-gap: 12px; }
  .cq-count-num { font-size: clamp(34px, 11vw, 48px); }
  .cq-count .label { letter-spacing: 0.08em; }

  .cq-downloads .btn-secondary { flex: 1 1 100%; justify-content: center; }

  .cq-escalation { margin-top: 36px; }
}

/* The instrument core carries its own side padding; below 400 the card rows
   need every pixel of the line, so the region gives some back. */
@media (max-width: 400px) {
  .cq-drop { padding: 18px 14px 16px; }
  .cq-reasons li { font-size: 11px; }
}
