/* ===========================================================================
 * Scoren — the pieces that carry meaning
 *
 * Phase 0 · build-plan.md §4 · visual-identity.md · GUIDE.md §1
 *
 * These exist BEFORE any screen because every screen needs them and because
 * each one encodes a rule that is easy to break by accident. They are not a
 * component library; they are five rules with a stylesheet attached.
 * =========================================================================== */

/* ── DATA · every number, everywhere ────────────────────────────────────────
 * Mono and tabular-nums. Figures have to line up down a column — a Cost page
 * or a bill is read VERTICALLY, and proportional digits make that impossible.
 * Money is right-aligned and always two decimals. */
.scoren-data {
  font-family: var(--font-data);
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum" 1;
}
.scoren-money {
  font-family: var(--font-data);
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum" 1;
  text-align: right;
  white-space: nowrap;
}

/* ── ABSENT · the em dash ───────────────────────────────────────────────────
 * GUIDE.md: "An em dash is a real absent value. $0.00 means somebody typed
 * zero. Never show $0.00 for 'we don't know'."
 *
 * This is not styling — it is the difference between "this sale had no age
 * check" and "this sale's age check found an age of zero". */
.scoren-absent {
  font-family: var(--font-data);
  color: var(--ink-faint);
  text-align: right;
}
.scoren-absent::before { content: "\2014"; }   /* — U+2014 EM DASH */

/* ── STATUS PILL · a dot PLUS a word ────────────────────────────────────────
 * The word is ALWAYS there. Colour alone never carries a status, because
 * colour alone fails for a colour-blind manager and prints as grey.
 *
 * Note the mapping, which is deliberate and counter-intuitive:
 *   Committed / Complete = --quiet, NOT green. Done is not the same as good,
 *   and --accent never means "good" (visual-identity.md). */
.scoren-pill {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: 3px 10px 3px 8px;
  border-radius: var(--radius-pill);
  font-size: var(--text-chip);
  font-weight: var(--weight-mid);
  line-height: 1.4;
  white-space: nowrap;
  background: var(--quiet-soft);
  color: var(--quiet);
}
.scoren-pill::before {
  content: "";
  width: 6px; height: 6px;
  border-radius: var(--radius-pill);
  background: currentColor;
  flex: none;
}
.scoren-pill[data-tone="live"]     { background: var(--accent-soft); color: var(--accent); }
.scoren-pill[data-tone="attention"]{ background: var(--warn-soft);   color: var(--warn);   }
.scoren-pill[data-tone="done"]     { background: var(--quiet-soft);  color: var(--quiet);  }
.scoren-pill[data-tone="undone"]   { background: var(--danger-soft); color: var(--danger); }

/* ── THE INCOMPLETE MARK · says WHAT is missing ─────────────────────────────
 * "· 3 lines no cost", never a bare icon. A total summed from some-but-not-all
 * values carries it. All-blank shows an em dash instead.
 *
 * GUIDE.md: "An incomplete total says what is missing — never a bare icon." */
.scoren-incomplete {
  color: var(--warn);
  font-size: var(--text-subline);
  font-family: var(--font-ui);
  white-space: nowrap;
}
.scoren-incomplete::before { content: "\00B7\00A0"; }   /* ·<nbsp> */
/* THE DOUBLE-DOT TRAP: this class draws its own dot. Put incompleteText()
 * inside it, NOT incompleteMark() — the latter already carries one, and the
 * two together render "· · 3 lines no cost". See packages/ui/src/format.mjs. */

/* ── THE PIN WALL · a plain sentence, inline, where the action is ───────────
 * GUIDE.md: "'Ask' is this project's word, never a screen's." The screen says
 * "A manager needs to approve this" / "An Admin or Owner needs to approve
 * this". Never a sign-out and back in; never the word Ask.
 *
 * Where a reason is required, THE REASON COMES BEFORE THE PIN — an approver
 * should see what they are approving. That ordering is the markup's job. */
.scoren-pin-wall {
  display: grid;
  gap: var(--space-3);
  padding: var(--space-4);
  background: var(--surface-2);
  border: 1px solid var(--line-control);
  border-radius: var(--radius-panel);
}
.scoren-pin-wall__says {
  font-size: var(--text-body);
  color: var(--ink);
  margin: 0;
}
.scoren-pin-wall__field {
  min-width: 0;   /* its spaced dots must never widen the wall past its column */
  font-family: var(--font-data);
  font-variant-numeric: tabular-nums;
  font-size: var(--text-title);
  letter-spacing: .35em;
  padding: var(--space-2) var(--space-3);
  border: 1px solid var(--line-control);
  border-radius: var(--radius-control);
  background: var(--surface);
  color: var(--ink);
  transition: border-color var(--motion), box-shadow var(--motion);
}

/* ── UNAVAILABLE · two cases, and they look different ON PURPOSE ────────────
 * PERMISSION → the control is ABSENT. Nothing renders. There is no class for
 *   this, and that is the point: you do not style what you do not render.
 *   Getting this backwards is the single most common way to break the feel of
 *   this product (GUIDE.md §1).
 * STATE      → the control is VISIBLE and GREYED with its reason underneath,
 *   in --ink-faint italic. It is coming back; hiding it makes working software
 *   look broken.
 * GREYED, NEVER FADED (hig.md §3; Apple rules check 2026-09-27, items 2 and
 *   9). This was `opacity: .5`, which drew Inventory's "Soon" rows at 2.06:1;
 *   STACK.md holds greyed words to 4.5:1 like any others. The words inside go
 *   to --ink-soft (5.1:1 or better on every ground, both themes); a greyed
 *   BUTTON's own look is controls.css's `.scoren-button[aria-disabled="true"]`
 *   (a blocked button always carries it), a
 *   greyed ROW's is `.scoren-row.scoren-blocked` there. */
.scoren-blocked        { pointer-events: none; color: var(--ink-soft); }
.scoren-blocked__why   {
  /* ⚠ It must be a SIBLING of the blocked control, never a child: a parent's
   * opacity fades everything inside it, and `opacity: 1` on a child cannot
   * undo it (the dual-pricing page nested it, and its sentence rendered at
   * 2.05:1). The line below only keeps it solid where it belongs. */
  display: block;
  opacity: 1;
  font-size: var(--text-subline);
  font-style: italic;
  color: var(--ink-faint);
  margin-top: var(--space-1);
}

/* ── FOCUS · where the keys go ──────────────────────────────────────────────
 * One ring, --focus-ring in tokens.css: 3px of the till green. A cashier
 * may be on a keyboard all shift, and a scanner is a keyboard, so
 * :focus-visible counts. The ring is an outline: the box does not move. */
:where(a, button, input, select, textarea, [tabindex]):focus-visible {
  outline: var(--focus-ring);
  outline-offset: 2px;
  border-radius: var(--radius-control);
}

/* ── TABLES ─────────────────────────────────────────────────────────────────
 * Wide content scrolls inside its OWN container. The page body never scrolls
 * sideways (visual-identity.md). */
.scoren-table-scroll { overflow-x: auto; }
.scoren-table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--text-table);
  line-height: var(--leading-row);
}
.scoren-table th {
  font-size: var(--text-label);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .07em;
  color: var(--ink-faint);
  text-align: left;
  padding: var(--cell-y) var(--cell-x);
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
.scoren-table td {
  padding: var(--cell-y) var(--cell-x);
  border-bottom: 1px solid var(--line-soft);
  color: var(--ink);
}
.scoren-table th.num, .scoren-table td.num { text-align: right; }
