/* ui/ledger.css — the Ledger components (docs/DESIGN.md, section 2).
   Document · Stamp · Button · Row/table · Integration cell · Empty state · Error.
   Only tokens from ui/tokens.css are used. Nothing here animates; the three motions
   live in ui/motion.css and are class-toggled by app.js. */

/* ---- Document -------------------------------------------------------------------- */
.doc {
  position: relative;
  background: var(--card);
  border: var(--rule-structure) solid var(--ink);
  box-shadow: var(--shadow-offset) var(--shadow-offset) 0 var(--shadow);
  margin: 0 var(--shadow-offset) var(--shadow-offset) 0;
  max-width: 100%;
}
.doc__head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 10px 16px;
  border-bottom: var(--rule-structure) solid var(--ink);
  font-family: var(--font-chrome);
  font-size: var(--fs-caption);
  letter-spacing: var(--ls-chrome);
  text-transform: uppercase;
  color: var(--ink);
}
.doc__head > * { min-width: 0; overflow-wrap: anywhere; }
.doc__body { padding: 4px 0; }
.doc__row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 16px;
  padding: 8px 16px;
  border-bottom: var(--rule-inside) solid var(--rule);
}
.doc__row:last-child { border-bottom: 0; }
.doc__label { flex: 1 1 auto; min-width: 0; }
.doc__value {
  flex: 0 0 auto;
  font-family: var(--font-chrome);
  letter-spacing: var(--ls-chrome);
  text-align: right;
  white-space: nowrap;
}
.doc__row--flag { background: var(--stamp-bg); }
.doc__row--flag .doc__value { color: var(--stamp); font-weight: 700; }
.doc__row--match { background: var(--pass-bg); }
.doc__row--match .doc__value { color: var(--pass); font-weight: 700; }
.doc__row--pending .doc__value { color: var(--pending); }
.doc__row--muted .doc__value { color: var(--ink-3); }
.doc__note { display: block; font-size: var(--fs-caption); color: var(--ink-2); margin-top: 2px; max-width: var(--measure); }
.doc__foot {
  padding: 8px 16px;
  border-top: var(--rule-structure) solid var(--ink);
  font-family: var(--font-chrome);
  font-size: var(--fs-footer);
  letter-spacing: var(--ls-chrome);
  color: var(--ink-3);
}
.doc__actions { display: flex; gap: 10px; flex-wrap: wrap; padding: 12px 16px; border-top: var(--rule-inside) solid var(--rule); }
.doc--stack { margin-bottom: calc(var(--shadow-offset) + 22px); }

/* ---- Stamp ----------------------------------------------------------------------- */
.stamp {
  position: absolute;
  top: -14px;
  right: 14px;
  z-index: 1;
  display: inline-block;
  padding: 6px 11px;
  border: var(--stamp-border) solid var(--stamp);
  color: var(--stamp);
  background: var(--card);
  font-family: var(--font-chrome);
  font-weight: 700;
  font-size: var(--fs-stamp);
  letter-spacing: var(--ls-stamp);
  text-transform: uppercase;
  line-height: 1.2;
  white-space: nowrap;
  transform: rotate(-8deg);
  transform-origin: center;
  pointer-events: none;
}
/* A stamp sits top-right over the header rule; the header meta moves left so the
   stamp never covers it (docs/QA.md 10). */
.stamp + .doc__head { padding-right: 176px; }
.stamp--pass { border-color: var(--pass); color: var(--pass); }
.stamp--pending { border-color: var(--pending); color: var(--pending); }
.stamp--inline { position: static; transform: rotate(-8deg); margin: 0 6px; vertical-align: middle; }
/* The small glyph used in ledger rows that are on hold. */
.stamp-glyph {
  display: inline-block;
  width: 10px; height: 10px;
  border: 2px solid var(--stamp);
  transform: rotate(-8deg);
  vertical-align: -1px;
  margin-right: 6px;
}

/* ---- Button ---------------------------------------------------------------------- */
.btn, button.btn {
  display: inline-block;
  padding: 14px 26px;
  border: var(--rule-structure) solid var(--blue);
  border-radius: var(--radius-control);
  background: var(--blue);
  color: #fff;
  font-family: var(--font-body);
  font-size: var(--fs-body);
  font-weight: 600;
  line-height: 1.2;
  text-decoration: none;
  cursor: pointer;
  text-align: center;
}
.btn:hover { background: var(--blue-2); border-color: var(--blue-2); color: #fff; }
.btn--secondary, button.btn--secondary { background: transparent; color: var(--ink); border-color: var(--ink); }
.btn--secondary:hover, button.btn--secondary:hover { background: var(--paper-2); color: var(--ink); border-color: var(--ink); }
.btn--small { padding: 8px 14px; font-size: var(--fs-caption); }
.btn:disabled, .btn[aria-disabled="true"] { background: var(--paper-2); color: var(--ink-3); border-color: var(--rule); cursor: default; }

/* ---- Row / table ----------------------------------------------------------------- */
/* Wide ledgers scroll inside their own frame; the page never scrolls sideways (docs/QA.md 11). */
.ledger-wrap { max-width: 100%; overflow-x: auto; margin: 0 var(--shadow-offset) var(--shadow-offset) 0; }
.ledger { width: 100%; border-collapse: collapse; background: var(--card); border: var(--rule-structure) solid var(--ink); }
.ledger th, .ledger td { padding: 9px 12px; text-align: left; vertical-align: top; border-bottom: var(--rule-inside) solid var(--rule); }
.ledger thead th {
  font-family: var(--font-chrome);
  font-size: var(--fs-caption);
  font-weight: 400;
  letter-spacing: var(--ls-chrome);
  text-transform: uppercase;
  color: var(--ink-3);
  border-bottom: var(--rule-structure) solid var(--ink);
}
.ledger tbody tr:last-child td { border-bottom: 0; }
.ledger--zebra tbody tr:nth-child(even) td { background: var(--paper-2); }
.ledger .num, .ledger .chrome { font-family: var(--font-chrome); letter-spacing: var(--ls-chrome); }
.ledger .num { text-align: right; white-space: nowrap; }
.ledger .num--stamp { color: var(--stamp); font-weight: 700; }
.ledger .num--pass { color: var(--pass); font-weight: 700; }
.ledger .num--pending { color: var(--pending); }
.doc__head .num--stamp { color: var(--stamp); font-weight: 700; }
.doc__head .num--pass { color: var(--pass); font-weight: 700; }
.ledger tr[data-href] { cursor: pointer; }
.ledger tr[data-href]:hover td { background: var(--paper-2); }
.ledger td.status { white-space: nowrap; }
.ledger .note { font-family: var(--font-chrome); font-size: var(--fs-footer); letter-spacing: var(--ls-chrome); color: var(--ink-3); }

/* ---- Integration cell ------------------------------------------------------------ */
.integration { display: flex; justify-content: space-between; gap: 16px; padding: 8px 16px; border-bottom: var(--rule-inside) solid var(--rule); }
.integration:last-child { border-bottom: 0; }
.integration__name { flex: 1 1 auto; }
.integration__state { font-family: var(--font-chrome); letter-spacing: var(--ls-chrome); text-transform: uppercase; white-space: nowrap; text-align: right; }
.integration__state small { text-transform: none; letter-spacing: var(--ls-chrome); color: var(--ink-3); }
.integration--live .integration__state { color: var(--pass); }
.integration--pending .integration__state { color: var(--pending); }
.integration--off .integration__state { color: var(--ink-3); }
@media (max-width: 480px) { .integration__state { white-space: normal; } }

/* ---- Empty state ----------------------------------------------------------------- */
.empty .doc__row { flex-direction: column; align-items: flex-start; gap: 12px; padding: 18px 16px; }
.empty .doc__label { font-size: var(--fs-lead); }
.empty .chrome { color: var(--ink-2); font-size: var(--fs-caption); }

/* ---- Error ----------------------------------------------------------------------- */
.error {
  display: block;
  padding: 10px 16px;
  background: var(--stamp-bg);
  border-top: var(--rule-inside) solid var(--rule);
  border-bottom: var(--rule-inside) solid var(--rule);
  color: var(--ink);
  max-width: none;
}
.error strong { color: var(--stamp); font-weight: 600; }
.notice { display: block; padding: 10px 16px; background: var(--pass-bg); border-top: var(--rule-inside) solid var(--rule); border-bottom: var(--rule-inside) solid var(--rule); }
.working { font-family: var(--font-chrome); letter-spacing: var(--ls-chrome); color: var(--ink-3); }

/* ---- Inputs (3px radius, ink border) --------------------------------------------- */
.input, input.input, select.input, textarea.input {
  width: 100%;
  padding: 9px 10px;
  border: var(--rule-structure) solid var(--ink);
  border-radius: var(--radius-control);
  background: var(--card);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: var(--fs-body);
}
.input--chrome { font-family: var(--font-chrome); letter-spacing: var(--ls-chrome); text-align: right; }
.field { display: block; margin-bottom: 14px; }
.field > span { display: block; font-size: var(--fs-caption); color: var(--ink-2); margin-bottom: 4px; }
.check { display: flex; gap: 10px; align-items: flex-start; }
.check input { width: 16px; height: 16px; margin: 3px 0 0; accent-color: var(--blue); border-radius: 0; }

/* ---- Structure ------------------------------------------------------------------- */
.rule { border: 0; border-top: var(--rule-structure) solid var(--ink); margin: 0; }
.rule--inside { border-top-width: var(--rule-inside); border-top-color: var(--rule); }
.stack > * + * { margin-top: 28px; }
.right { text-align: right; }
.error__action { display: inline-block; margin-left: 10px; vertical-align: middle; }
