/* App-specific styles.
 *
 * Bulma (vendored, loaded before this file) covers layout, typography, colours
 * and dark mode. Prefer a Bulma class or one of its CSS variables over adding
 * rules here.
 *
 * The receipt table is ordinary server-rendered markup driven by a cursor —
 * there is no client-side component and no shadow DOM, so these are plain
 * document-level rules.
 *
 * To restyle globally, override Bulma's variables rather than its selectors:
 *
 *   :root { --bulma-primary-h: 210deg; --bulma-link-l: 45%; }
 */

/* Numeric cells read as a column of figures, not prose. */
.rs-num,
th.rs-num {
  text-align: right;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.rs-total {
  font-weight: 600;
}

.rs-grand th,
.rs-grand .rs-num {
  border-top: 2px solid var(--bulma-border);
  font-weight: 700;
}

/* Keep the rate inputs from stretching the summary table. */
.rs-rate {
  width: 5.5rem;
}

.rs-rate .input {
  text-align: right;
}

.rs-summary .rs-head {
  text-align: right;
  font-size: 0.7rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--bulma-text-weak);
}

/* Each charge can be entered as a percentage or as an amount; the one you
 * typed is authoritative and the other is computed from it. Mark which. */
.rs-authoritative {
  font-weight: 600;
}

.rs-rate .input:not(.rs-authoritative) {
  color: var(--bulma-text-weak);
}

/* The receipt name reads as a heading but is plainly a field: it keeps its
 * border, so it does not look like static text. */
.rs-name {
  font-size: 1.15rem;
  font-weight: 600;
  max-width: 22rem;
}

/* ---- the line-item table ---- */

/* .rs-grid is the table itself now, not a wrapper. */
.rs-grid {
  margin-bottom: 0.75rem;
}

.rs-grid th {
  text-transform: capitalize;
  font-size: 0.75rem;
  letter-spacing: 0.02em;
  color: var(--bulma-text-weak);
}

/* Cells are inputs, but should read as table cells until focused. */
.rs-grid td .input {
  border-color: transparent;
  background: transparent;
  box-shadow: none;
  padding-left: 0.25rem;
  padding-right: 0.25rem;
}

.rs-grid td .input:hover {
  border-color: var(--bulma-border);
}

.rs-grid td .input:focus {
  border-color: var(--bulma-link);
  background: var(--bulma-scheme-main);
  box-shadow: 0 0 0 0.125em
    hsla(var(--bulma-link-h), var(--bulma-link-s), var(--bulma-link-l), 0.25);
}

/* Charge columns driven by a receipt-level rate render as text, not inputs. */
.rs-derived {
  display: inline-block;
  padding: calc(0.375em - 1px) 0.25rem;
  color: var(--bulma-text-weak);
}

.rs-grid .rs-total {
  display: inline-block;
  padding: calc(0.375em - 1px) 0.25rem;
}

.rs-who-col {
  min-width: 8rem;
}

.rs-num-col .input {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.rs-item-col {
  min-width: 9rem;
}
