/* Card statement
   ----------------------------------------------------------------------
   A document, not a website: ruled sheets, tabular figures, squared edges.
   One accent, used for emphasis and nothing decorative. */

:root {
  --ink: #0d0d0f;
  --paper: #ffffff;
  --page: #ececed;
  --band: #f2f2f4;
  --rule: #e2e2e8;
  --rule-strong: #c9c9d2;
  --text: #16161a;
  --text-2: #43434e;
  --muted: #6c6c78;
  --faint: #93939e;
  --accent: #15625a;
  --accent-soft: #e6efed;
  --negative: #9a2c2c;
  --radius: 4px;
  --sans: "Segoe UI", -apple-system, BlinkMacSystemFont, Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }

html { background: var(--page); }

body {
  margin: 0;
  background: var(--page);
  color: var(--text);
  font: 15px/1.5 var(--sans);
  -webkit-font-smoothing: antialiased;
}

/* ------------------------------------------------------------ masthead */

.masthead { background: var(--ink); color: #fff; }

.masthead-inner {
  max-width: 1080px;
  margin: 0 auto;
  padding: 18px 24px;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 24px;
}

.wordmark {
  font-size: 17px;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.masthead-note { color: #9d9da8; font-size: 13px; }

.page { max-width: 1080px; margin: 0 auto; padding: 28px 24px 72px; }

/* -------------------------------------------------------------- lookup */

.lookup {
  background: var(--paper);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  padding: 26px 28px 28px;
}

.lookup h1 {
  margin: 0 0 20px;
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.01em;
}

#lookup-form {
  display: flex;
  align-items: flex-start;
  gap: 18px;
  flex-wrap: wrap;
}

.field { flex: 1 1 320px; min-width: 260px; }

.field label {
  display: block;
  margin-bottom: 7px;
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
}

.field input {
  width: 100%;
  min-height: 44px;
  padding: 10px 12px;
  border: 1px solid var(--rule-strong);
  border-radius: var(--radius);
  background: #fff;
  color: var(--text);
  font: inherit;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.02em;
}

.field input:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
  border-color: var(--accent);
}

.hint { margin: 7px 0 0; color: var(--muted); font-size: 12.5px; }

.primary {
  min-height: 44px;
  margin-top: 25px;
  padding: 0 22px;
  border: 1px solid var(--ink);
  border-radius: var(--radius);
  background: var(--ink);
  color: #fff;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}

.primary:hover:not(:disabled) { background: #26262c; }
.primary:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.primary:disabled { opacity: .55; cursor: progress; }

.notice {
  margin: 18px 0 0;
  padding: 11px 14px;
  border: 1px solid var(--rule-strong);
  border-left: 3px solid var(--negative);
  border-radius: var(--radius);
  background: #fdf6f6;
  color: #6f2020;
  font-size: 14px;
}

/* --------------------------------------------------------- the document */

.sheet {
  margin-top: 26px;
  background: var(--paper);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  overflow: hidden;
}

.doc-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  padding: 20px 28px;
  background: var(--ink);
  color: #fff;
}

.doc-head h2 {
  margin: 0;
  font-size: 19px;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.doc-head .issued { color: #9d9da8; font-size: 12.5px; text-align: right; }

/* Identity: holder on the left, the card's own facts on the right. */
.identity {
  display: flex;
  gap: 32px;
  padding: 24px 28px 4px;
  flex-wrap: wrap;
}

.identity > div { flex: 1 1 240px; }
.identity > div + div { padding-left: 32px; border-left: 1px solid var(--rule); }

.label {
  display: block;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  color: var(--faint);
}

.value {
  display: block;
  margin-top: 6px;
  font-size: 16px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.value.plain { font-weight: 500; font-size: 14.5px; }
.sub { margin: 6px 0 0; color: var(--text-2); font-size: 13.5px; line-height: 1.5; }
.label.spaced { margin-top: 18px; }

/* A card's state is a fact, so it is set in type, not in a coloured pill. */
.state { font-weight: 700; }
.state[data-state="normal"] { color: var(--accent); }
.state[data-state="freeze"],
.state[data-state="cancel"],
.state[data-state="blocked"] { color: var(--negative); }

.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  margin: 26px 28px 10px;
}

.section-head h3 { margin: 0; font-size: 16px; font-weight: 700; }
.section-head .note { color: var(--muted); font-size: 12.5px; }

/* Four figures, the one that matters inverted rather than coloured, so the
   sheet survives a monochrome printer. */
.summary { display: flex; margin: 0 28px; background: var(--band); flex-wrap: wrap; }

.figure { flex: 1 1 25%; min-width: 160px; padding: 15px 18px 16px; }
.figure + .figure { border-left: 1px solid var(--rule); }

.figure-label {
  display: block;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.11em;
  text-transform: uppercase;
  color: var(--muted);
}

.figure-value {
  display: block;
  margin-top: 8px;
  font-size: 23px;
  font-weight: 700;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}

.figure-cur { display: block; margin-top: 4px; color: var(--faint); font-size: 12px; }

.figure.closing { background: var(--ink); border-left-color: var(--ink); color: #fff; }
.figure.closing .figure-label { color: #c3c3cc; }
.figure.closing .figure-cur { color: #9a9aa4; }

/* ------------------------------------------------------------- ledger */

table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
thead { display: table-header-group; }

th {
  padding: 10px 12px;
  background: var(--ink);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.11em;
  text-transform: uppercase;
  text-align: left;
  white-space: nowrap;
}

td {
  padding: 12px;
  border-bottom: 1px solid #ededf1;
  vertical-align: top;
  font-size: 14px;
}

tbody tr:last-child td { border-bottom: 0; }
th.num, td.num { text-align: right; white-space: nowrap; }
th.date, td.date { white-space: nowrap; color: var(--text-2); width: 118px; }
th:first-child, td:first-child { padding-left: 28px; }
th:last-child, td:last-child { padding-right: 28px; }

td.desc strong { display: block; font-weight: 700; }
td.desc .meta { display: block; margin-top: 3px; color: var(--muted); font-size: 12.5px; word-break: break-word; }
td.desc .orig { display: block; margin-top: 2px; color: var(--faint); font-size: 12.5px; }

.out { color: var(--negative); }
.row-pending td { background: #fcfbf4; }
.row-failed td { color: var(--faint); }
.row-failed td.num { text-decoration: line-through; }

/* A flat mark, not a badge - the document carries no rounded chips. */
.flag {
  display: inline-block;
  margin-top: 4px;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}
.flag.pending { color: #7d6714; }
.flag.failed { color: var(--faint); }

tfoot td {
  padding: 14px 12px;
  background: var(--band);
  border-bottom: 0;
  font-weight: 700;
}

.empty { padding: 40px 28px; text-align: center; color: var(--muted); }

/* A balance the ledger cannot account for is stated, never folded away. */
.reconcile {
  margin: 18px 28px 0;
  padding: 12px 14px;
  border: 1px solid var(--rule-strong);
  border-left: 3px solid #b8912a;
  border-radius: var(--radius);
  background: #fdfaf2;
  color: #5e4a12;
  font-size: 13.5px;
  line-height: 1.55;
}

.doc-foot {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  margin: 26px 28px 0;
  padding: 14px 0 24px;
  border-top: 1px solid var(--ink);
  color: var(--muted);
  font-size: 12.5px;
}

.doc-foot strong { display: block; color: var(--text); font-size: 13.5px; }

.actions { margin: 20px 28px 26px; display: flex; gap: 12px; flex-wrap: wrap; }

.secondary {
  min-height: 40px;
  padding: 0 18px;
  border: 1px solid var(--rule-strong);
  border-radius: var(--radius);
  background: #fff;
  color: var(--text);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}

.secondary:hover { border-color: var(--accent); color: var(--accent); }
.secondary:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

@media (max-width: 720px) {
  .page { padding: 20px 14px 56px; }
  .identity > div + div { padding-left: 0; border-left: 0; }
  .figure + .figure { border-left: 0; border-top: 1px solid var(--rule); }
  .figure { flex-basis: 100%; }
  th:first-child, td:first-child { padding-left: 14px; }
  th:last-child, td:last-child { padding-right: 14px; }
  .section-head, .summary, .doc-foot, .reconcile, .actions { margin-inline: 14px; }
  .identity { padding-inline: 14px; }
}

/* --------------------------------------------------------------- print */

@media print {
  html, body { background: #fff; }
  .masthead, .lookup, .actions { display: none; }
  .page { max-width: none; padding: 0; }
  .sheet { margin: 0; border: 0; border-radius: 0; }
  /* The ledger header repeats on each page; the totals print once at the end
     - a tfoot is a footer group, so left alone it would repeat the closing
     totals under a mid-statement balance. */
  thead { display: table-header-group; }
  tfoot { display: table-row-group; }
  tr { break-inside: avoid; }
  .doc-head, .summary, .section-head { break-after: avoid; }
}
