/*
 * The member portal.
 *
 * The audience is not the office. It is three hundred and fifty households, a
 * good number of whom are elderly, most of whom will visit twice a year, and
 * all of whom arrived to answer one question: what do I owe, and how do I pay
 * it. So the type is larger than the office screens, the balance is the first
 * thing on the page, and there is nothing to learn.
 *
 * It borrows the public site's palette rather than the back office's, because
 * as far as a member is concerned this is the shul's website and not a
 * different piece of software.
 */

:root {
  --ink: var(--slate);
  --muted: var(--slate-soft);
  --faint: var(--slate-soft);
  --rule: var(--keyline);
  --rule-soft: var(--keyline);
  --paper: var(--parchment);
  --panel: var(--parchment);
  --accent: var(--navy);
  --accent-soft: var(--parchment-deep);
  --accent-dark: var(--navy-deep);
  --owing: var(--flag-high);
  --credit: var(--flag-ok);
}

* { box-sizing: border-box; }

/* Display type and controls, so neither falls back to the platform's own face
   and puts a third typeface on the page. */
h1, h2, h3 { font-family: var(--serif); color: var(--navy); }
button, input, select, textarea { font: inherit; color: inherit; }

/* Left alone, a control keeps the browser's own white, which the kit rules
   out. Setting it here catches every field, including any added later. */
input, select, textarea {
  background: var(--paper);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
}
[hidden] { display: none !important; }

body {
  margin: 0;
  font-family: var(--sans);
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  -webkit-font-smoothing: antialiased;
}

.topbar {
  display: flex; align-items: center; gap: 1rem;
  padding: 0 1.25rem; height: 60px;
  background: var(--panel); border-bottom: 1px solid var(--rule);
}
.brand { display: flex; align-items: center; gap: 0.6rem; color: inherit; text-decoration: none; font-size: 1rem; }
/* The gate, at the kit's 55px minimum. */
.mark { width: 58px; height: auto; flex: none; }
.who { margin-left: auto; display: flex; align-items: center; gap: 0.75rem; font-size: 0.85rem; color: var(--muted); }

main { max-width: 44rem; margin: 0 auto; padding: 1.75rem 1.25rem 5rem; }

.card {
  background: var(--panel); border: 1px solid var(--rule);
  border-radius: var(--radius); padding: 1.5rem;
}
.card + .card, #account + .give, .card + #account { margin-top: 1.25rem; }
#account > .card + .card { margin-top: 1.25rem; }

h1 { font-size: 1.5rem; margin: 0; font-weight: 600; }
h2 { font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--faint); margin: 0 0 1rem; font-weight: 600; }
p { margin: 0.75rem 0; }
.meta { color: var(--muted); font-size: 0.9rem; margin: 0.25rem 0 0; }
.note { color: var(--muted); font-size: 0.9rem; min-height: 1.2em; }
.fineprint { color: var(--faint); font-size: 0.85rem; }
a { color: var(--accent); }

/* --------------------------------------------------------- the statement */

.statement-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 1.5rem; flex-wrap: wrap; }

/* The one number the member came for. */
.balance { text-align: right; }
.balance .amount { font-size: 2.4rem; line-height: 1.05; font-weight: 600; font-variant-numeric: tabular-nums; }
.balance .label { font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--faint); }
.owing { color: var(--owing); }
.credit { color: var(--credit); }
.settled { color: var(--credit); }

.pay { display: flex; gap: 0.65rem; flex-wrap: wrap; margin-top: 1.25rem; }

/* -------------------------------------------------------------- controls */

button, .primary {
  font: inherit; cursor: pointer;
  padding: 0.6rem 1.1rem; border-radius: var(--radius);
  border: 1px solid var(--rule); background: var(--panel); color: var(--ink);
}
button:hover { border-color: var(--accent); color: var(--accent); }
.primary { background: var(--accent); border-color: var(--accent); color: var(--parchment); font-weight: 500; }
.primary:hover { background: var(--accent-dark); border-color: var(--accent-dark); color: var(--parchment); }
/* Disabled is exempt from the contrast rules, but this is the button that
   takes a payment: it should stay readable while it is waiting. */
.primary[disabled] {
  background: var(--parchment-deep);
  border-color: var(--keyline-strong);
  color: var(--slate);
  cursor: default;
}
.quiet { color: var(--muted); }

label { display: block; font-size: 0.85rem; color: var(--muted); margin-bottom: 0.3rem; }
.optional { color: var(--faint); font-style: italic; }

input, select {
  width: 100%; font: inherit; padding: 0.55rem 0.7rem;
  border: 1px solid var(--rule); border-radius: var(--radius); background: var(--panel); color: inherit;
}
input:focus, select:focus { outline: 2px solid var(--accent); outline-offset: -1px; }

.row { display: flex; gap: 0.85rem; flex-wrap: wrap; }
.field { margin-bottom: 0.9rem; }
.field.grow { flex: 1; min-width: 12rem; }

/* A currency field should show what unit it is in without the payer having to
 * type it, and without the symbol scrolling away as they do. */
.money-input { position: relative; }
.money-input span { position: absolute; left: 0.7rem; top: 50%; transform: translateY(-50%); color: var(--faint); }
.money-input input { padding-left: 1.5rem; width: 9rem; font-variant-numeric: tabular-nums; }

#signin-form button, #give-form button { margin-top: 0.35rem; }

/* ---------------------------------------------------------------- tables */

table { width: 100%; border-collapse: collapse; font-size: 0.95rem; }
th {
  text-align: left; font-weight: 600; font-size: 0.72rem; text-transform: uppercase;
  letter-spacing: 0.04em; color: var(--faint); padding: 0 0.6rem 0.5rem 0;
  border-bottom: 1px solid var(--rule);
}
td { padding: 0.6rem 0.6rem 0.6rem 0; border-bottom: 1px solid var(--rule-soft); vertical-align: top; }
tr:last-child td { border-bottom: 0; }
th:last-child, td:last-child { padding-right: 0; }
.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }

.person { padding: 0.65rem 0; border-bottom: 1px solid var(--rule-soft); }
.person:last-child { border-bottom: 0; }
.person .name { font-weight: 600; }
.person .detail { color: var(--muted); font-size: 0.88rem; }
.hebrew { font-family: var(--hebrew); direction: rtl; unicode-bidi: isolate; display: inline-block; }

.empty { color: var(--faint); font-size: 0.95rem; }

/* A payment that has arrived but has not yet been entered against the account
 * is a real state and the member should see it, rather than paying twice. */
.pending { display: inline-block; padding: 0.05rem 0.45rem; border-radius: var(--radius); background: var(--rule-soft); color: var(--muted); font-size: 0.78rem; }

.banner {
  border-radius: var(--radius); padding: 0.85rem 1rem; margin-bottom: 1.25rem;
  border: 1px solid var(--flag-ok-edge); background: var(--flag-ok-bg); color: var(--credit); font-size: 0.95rem;
}

.error {
  position: fixed; left: 1rem; right: 1rem; bottom: 1rem; margin: 0 auto; max-width: 36rem;
  background: var(--flag-high-bg); color: var(--owing); border: 1px solid var(--flag-high-edge);
  border-radius: var(--radius); padding: 0.8rem 1rem; font-size: 0.9rem;
}

@media (max-width: 520px) {
  body { font-size: 16px; }
  main { padding: 1.25rem 0.9rem 4rem; }
  .card { padding: 1.15rem; border-radius: var(--radius); }
  .balance { text-align: left; }
  .balance .amount { font-size: 2rem; }
  .pay button { width: 100%; }
}
