/* RSA Musmachim portal — page styles layered over styles.css tokens.
   Mobile-first: cards over tables, 44px touch targets, readable at 375px. */

/* ── Buttons: comfortable touch targets everywhere in the portal ────────── */
.button { min-height: 44px; }
/* "Small" is about type and padding, never about being hard to hit — Edit,
   Delete and Preview are 44px like everything else. */
.button.small { min-height: 44px; }
.button.big {
  display: block;
  width: 100%;
  text-align: center;
  font-size: 1.05rem;
  padding: 0.85rem 1.2rem;
}
.button.quiet { background: #eef1ea; color: var(--evergreen-dark); }
.button.quiet:hover { background: #e2e7dc; }
/* Link-styled buttons sit mid-sentence ("…works once. Send a new code"), so
   they cannot become 44px blocks without breaking the line. Vertical padding
   on an inline box grows the touch target without moving a single word; the
   negative side margin keeps the horizontal rhythm exactly as it was. */
.linklike {
  min-height: 0;
  padding: 0.6rem 0.3rem;
  margin: 0 -0.3rem;
}
/* In the header the link-button is a flex item, so it can take a real box. */
.header-user .linklike { min-height: 44px; margin: 0; }

/* ── Top navigation ─────────────────────────────────────────────────────── */
/* Eight links do not fit across a 375px phone, so the strip scrolls. The
   gradient/shadow pair is the only thing telling a musmach that Reflection,
   RSVP and Submit exist off to the right — without it the last four links
   are simply invisible on a phone. The shadows are painted at the edges and
   scroll away with the content (background-attachment: local). */
.portal-nav {
  background:
    linear-gradient(to right, var(--surface) 40%, rgba(255, 255, 255, 0))
      left center,
    linear-gradient(to left, var(--surface) 40%, rgba(255, 255, 255, 0))
      right center,
    radial-gradient(farthest-side at 0 50%, rgba(16, 35, 59, 0.18),
      rgba(16, 35, 59, 0)) left center,
    radial-gradient(farthest-side at 100% 50%, rgba(16, 35, 59, 0.18),
      rgba(16, 35, 59, 0)) right center;
  background-color: var(--surface);
  background-repeat: no-repeat;
  background-size: 2.5rem 100%, 2.5rem 100%, 0.85rem 100%, 0.85rem 100%;
  background-attachment: local, local, scroll, scroll;
  border-bottom: 1px solid var(--line);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  white-space: nowrap;
  padding: 0 0.5rem;
}
.portal-nav a {
  display: inline-block;
  padding: 0.75rem 0.8rem;
  min-height: 44px;
  color: var(--muted);
  text-decoration: none;
  font-size: 0.9rem;
  border-bottom: 3px solid transparent;
}
.portal-nav a:hover { color: var(--evergreen-dark); }
.portal-nav a[aria-current="page"] {
  color: var(--evergreen-dark);
  font-weight: bold;
  border-bottom-color: var(--gold);
}
.portal-nav a:focus-visible,
.button:focus-visible, .chip:focus-visible, .linklike:focus-visible {
  outline: 2px solid var(--evergreen);
  outline-offset: 2px;
}

/* ── Progress bars ──────────────────────────────────────────────────────── */
.progress-track {
  background: #e6eae2;
  border-radius: 999px;
  height: 0.75rem;
  overflow: hidden;
}
.progress-fill {
  background: var(--evergreen);
  height: 100%;
  border-radius: 999px;
  transition: width 0.4s ease;
  min-width: 0;
}
.progress-label { font-size: 0.82rem; color: var(--muted); margin-top: 0.3rem; }

/* ── Status pills for the four sections ─────────────────────────────────── */
.pill.not_started { background: #e7ebf2; color: var(--navy); }
.pill.in_progress { background: #fdf3dd; color: #8a6414; }
.pill.needs_update { background: var(--danger); color: #fff; }

/* ── Dashboard section cards ────────────────────────────────────────────── */
.section-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.8rem;
  margin: 1rem 0;
}
@media (min-width: 700px) {
  .section-grid { grid-template-columns: 1fr 1fr; }
}
.section-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 1rem 1.1rem;
  box-shadow: 0 1px 3px rgba(16,35,59,0.07);
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}
.section-card.needs-update { border-color: var(--danger); border-width: 2px; }
.section-card .sc-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}
.section-card .sc-title {
  font-family: Georgia, serif;
  font-size: 1.05rem;
  color: var(--evergreen-dark);
  margin: 0;
}
.section-card .sc-summary { font-size: 0.88rem; color: var(--muted); margin: 0; }
.section-card .sc-change {
  font-size: 0.85rem;
  color: var(--danger);
  background: #fbeeee;
  border-radius: 4px;
  padding: 0.4rem 0.6rem;
  margin: 0;
}
/* Not scoped to .section-card: the Review & Submit page uses .sc-link inside
   a plain .card, where the old .section-card-only rule never matched — that
   link rendered as an unstyled 17px-tall default-blue browser link. It is
   inline-block so min-height actually applies (min-height is ignored on an
   inline box, which is why the dashboard's 32px was the most it ever got). */
a.sc-link {
  display: inline-block;
  color: var(--evergreen);
  font-size: 0.88rem;
  font-weight: bold;
  text-decoration: underline;
  padding: 0.75rem 0;
  min-height: 44px;
}
.section-card a.sc-link { align-self: flex-start; }

/* Urgent change-request banner at the top of a section page */
.banner-needs-update {
  border-left: 5px solid var(--danger);
  background: #fbeeee;
  border-radius: 4px;
  padding: 0.8rem 1rem;
  margin: 0.9rem 0;
}
.banner-needs-update b { color: var(--danger); }

/* ── Filter chips ───────────────────────────────────────────────────────── */
.chip-row { display: flex; gap: 0.4rem; flex-wrap: wrap; margin: 0.8rem 0 0.5rem; }
.chip {
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--muted);
  border-radius: 999px;
  padding: 0.5rem 0.95rem;
  min-height: 44px;
  font: inherit;
  font-size: 0.85rem;
  cursor: pointer;
}
.chip[aria-pressed="true"] {
  background: var(--evergreen);
  border-color: var(--evergreen);
  color: #fff;
  font-weight: bold;
}

/* ── Recipient cards ────────────────────────────────────────────────────── */
.recipient-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.85rem 1rem;
  margin: 0.6rem 0;
  box-shadow: 0 1px 2px rgba(16,35,59,0.05);
}
.rc-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.6rem;
  flex-wrap: wrap;
}
.rc-name { font-weight: bold; font-size: 1rem; overflow-wrap: anywhere; }
.rc-sub { font-size: 0.85rem; color: var(--muted); margin: 0.15rem 0 0; overflow-wrap: anywhere; }
.rc-badges { display: flex; flex-wrap: wrap; gap: 0.35rem; margin-top: 0.45rem; }
.prob-badge {
  display: inline-block;
  background: #fbeeee;
  color: var(--danger);
  border-radius: 4px;
  font-size: 0.78rem;
  padding: 0.15rem 0.5rem;
}
.rc-actions { display: flex; gap: 0.5rem; margin-top: 0.6rem; flex-wrap: wrap; }
.rc-actions .button.small { min-height: 44px; padding: 0.45rem 0.9rem; }
.dup-banner {
  border-left: 4px solid var(--gold);
  background: #fdf8ee;
  border-radius: 4px;
  padding: 0.5rem 0.7rem;
  margin-top: 0.55rem;
  font-size: 0.85rem;
}
.dup-banner .dup-actions { display: flex; gap: 0.5rem; margin-top: 0.4rem; flex-wrap: wrap; }

/* ── Forms ──────────────────────────────────────────────────────────────── */
/* styles.css covers text/email/number; the portal also uses tel + search. */
input[type="tel"], input[type="search"] {
  width: 100%;
  padding: 0.6rem 0.7rem;
  border: 1px solid var(--line);
  border-radius: 5px;
  font: inherit;
  background: #fff;
  color: var(--ink);
}
.field-help { font-size: 0.78rem; color: var(--muted); margin: 0.15rem 0 0; }

/* The heading over a radio group. It was a <label>, but a <label> that
   controls nothing is an orphan: it announces as a stray label and clicking
   it focuses nothing. The group itself is named with aria-labelledby. */
.group-label {
  display: block;
  font-size: 0.85rem;
  font-weight: bold;
  margin: 0.7rem 0 0.25rem;
}
.field-grid { display: grid; grid-template-columns: 1fr; gap: 0 0.8rem; }
@media (min-width: 560px) {
  .field-grid.cols-3 { grid-template-columns: 2fr 1fr 1fr; }
  .field-grid.cols-2 { grid-template-columns: 1fr 1fr; }
}
.radio-row { display: flex; gap: 0.5rem; flex-wrap: wrap; margin-top: 0.3rem; }
.radio-row label {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
  padding: 0.6rem 0.9rem;
  min-height: 44px;
  margin: 0;
  font-weight: normal;
  font-size: 0.9rem;
  cursor: pointer;
}
.radio-row input[type="radio"] { width: 1.15rem; height: 1.15rem; accent-color: var(--evergreen); margin: 0; }
.radio-row label:has(input:checked) {
  border-color: var(--evergreen);
  background: #eef7f0;
  font-weight: bold;
}
.form-actions { display: flex; gap: 0.6rem; flex-wrap: wrap; align-items: center; }
.form-actions .button { margin-top: 0.9rem; }

.action-row { display: flex; gap: 0.6rem; flex-wrap: wrap; margin: 0.8rem 0; }
.action-row .button { margin-top: 0; }

/* ── Import wizard ──────────────────────────────────────────────────────── */
.map-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 0.6rem;
  align-items: center;
  padding: 0.4rem 0;
  border-bottom: 1px dashed var(--line);
}
.map-row .map-heading { font-size: 0.88rem; font-weight: bold; overflow-wrap: anywhere; }
.map-row .map-sample { font-size: 0.75rem; color: var(--muted); font-weight: normal; overflow-wrap: anywhere; }
.map-row select { margin: 0; }
input[type="file"] { width: 100%; padding: 0.5rem 0; font: inherit; }

/* ── Review mode ────────────────────────────────────────────────────────── */
.review-count { font-size: 0.9rem; color: var(--muted); margin: 0.2rem 0 0.5rem; }
.review-buttons {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
  margin-top: 1rem;
}
.review-buttons .button { margin-top: 0; width: 100%; }
.review-buttons .primary-slot { grid-column: 1 / -1; }
.problem-list { color: var(--danger); font-size: 0.85rem; margin: 0.6rem 0 0; padding-left: 1.2rem; }
.problem-list li { margin: 0.15rem 0; }

/* ── Video ──────────────────────────────────────────────────────────────── */
.player-wrap { background: #000; border-radius: 8px; overflow: hidden; }
.player-wrap video { display: block; width: 100%; max-height: 70vh; background: #000; }
.video-facts { font-size: 0.85rem; color: var(--muted); margin: 0.6rem 0 0; }
.version-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
  flex-wrap: wrap;
  border-bottom: 1px solid var(--line);
  padding: 0.55rem 0.2rem;
  font-size: 0.88rem;
}
.version-row:last-child { border-bottom: none; }

/* ── Letter ─────────────────────────────────────────────────────────────── */
.template-card .tpl-desc { color: var(--muted); font-size: 0.9rem; margin: 0.3rem 0 0.6rem; }
.letter-body {
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1rem;
  line-height: 1.65;
  background: #fffdf8;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 1rem 1.1rem;
  margin: 0.6rem 0;
  overflow-wrap: anywhere;
}
.letter-body p { margin: 0 0 0.8em; }
.editor-toolbar { display: flex; gap: 0.4rem; margin-bottom: 0.4rem; }
.editor-toolbar button {
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: 5px;
  min-width: 44px;
  min-height: 44px;
  font: inherit;
  cursor: pointer;
}
.editor-toolbar button:hover { background: #eef1ea; }
.editor-toolbar .tb-bold { font-weight: bold; }
.editor-toolbar .tb-italic { font-style: italic; }
.letter-editor {
  min-height: 14rem;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0.9rem 1rem;
  font-family: Georgia, "Times New Roman", serif;
  line-height: 1.65;
  overflow-wrap: anywhere;
}
.letter-editor:focus { outline: 2px solid var(--evergreen); outline-offset: 1px; }
.save-indicator { font-size: 0.8rem; color: var(--muted); min-height: 1.2rem; margin-top: 0.3rem; }

/* ── Picture ────────────────────────────────────────────────────────────── */
.picture-preview {
  max-width: 100%;
  max-height: 60vh;
  border-radius: 8px;
  border: 1px solid var(--line);
  display: block;
}

/* ── Submit review cards ────────────────────────────────────────────────── */
.submit-card .check { font-size: 1.2rem; margin-right: 0.4rem; }
.check.done { color: var(--ok); }
.check.todo { color: var(--muted); }
.fact-list { margin: 0.3rem 0 0; padding: 0; list-style: none; font-size: 0.88rem; color: var(--muted); }
.fact-list li { margin: 0.15rem 0; }

/* ── Misc ───────────────────────────────────────────────────────────────── */
.empty-state {
  text-align: center;
  color: var(--muted);
  padding: 1.6rem 1rem;
}
.center-note { text-align: center; color: var(--muted); font-size: 0.85rem; }
.spaced-top { margin-top: 1.2rem; }
.inline-count { font-weight: normal; color: var(--muted); }

/* ── Mailing list: RSA's real field set ─────────────────────────────────── */
/* Appended for the name-parts form (docs/REAL-DATA-FINDINGS-2026-08-28.md). */

/* "Most musmachim send 50-60 names." — shown only on an empty list. */
.list-hint {
  color: var(--muted);
  font-size: 0.9rem;
  margin: 0.6rem 0 0;
}

/* The live envelope line, above the fields it is computed from. */
.envelope-preview {
  background: #eef7f0;
  border: 1px solid var(--line);
  border-left: 5px solid var(--evergreen);
  border-radius: 6px;
  padding: 0.75rem 0.9rem;
  margin: 0 0 1rem;
}
.envelope-preview .ep-line {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
}
.envelope-preview .ep-label {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
}
.envelope-preview .ep-name {
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.15rem;
  color: var(--evergreen-dark);
  overflow-wrap: anywhere;
}
.envelope-preview .ep-name.ep-empty {
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: normal;
  color: var(--muted);
}
.envelope-preview .ep-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  min-height: 44px;
  margin: 0.35rem 0 0;
  font-size: 0.85rem;
  font-weight: normal;
  color: var(--muted);
  cursor: pointer;
}
.envelope-preview .ep-toggle input[type="checkbox"] {
  width: 1.15rem;
  height: 1.15rem;
  accent-color: var(--evergreen);
  margin: 0;
}
.envelope-preview .ep-manual { margin-top: 0.2rem; }
.envelope-preview .ep-manual label { margin-top: 0; }

/* His/Her title + name sit side by side once there is room for them. */
@media (min-width: 560px) {
  .field-grid.cols-title { grid-template-columns: minmax(0, 8rem) minmax(0, 1fr); }
}

/* Recipient card: envelope name, then how the letter greets them. */
.rc-salutation {
  font-size: 0.85rem;
  color: var(--muted);
  font-style: italic;
  margin: 0.2rem 0 0;
  overflow-wrap: anywhere;
}

/* Import wizard: "upload it as-is", and the computed name in the preview. */
.import-note {
  font-weight: bold;
  color: var(--evergreen-dark);
  margin: 0 0 0.3rem;
}
table.data th.prev-envelope { color: var(--evergreen-dark); }
table.data td.prev-envelope {
  font-weight: bold;
  color: var(--evergreen-dark);
  white-space: nowrap;
}

/* An optional checklist item says so on its face — a musmach must never
   think he is blocked by one, nor that he is finished while one is open. */
.sc-optional {
  font-size: 0.68rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.1rem 0.45rem;
  margin-left: auto;
}
.sc-head { display: flex; align-items: center; gap: 0.5rem; }

/* The original file, shown when the polished preview is missing or still
   being built. A musmach must always be able to see the video he sent. */
.warn-box {
  border-left: 4px solid var(--gold);
  background: #fbf5e9;
  padding: 0.8rem 1rem;
  border-radius: 4px;
  margin: 0 0 1rem;
  font-size: 0.94rem;
}
.original-block { margin-top: 1rem; }
.original-heading {
  font-size: 0.78rem;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0 0 0.5rem;
  font-family: inherit;
  font-weight: 600;
}
.original-block .player-wrap video {
  width: 100%;
  max-height: 60vh;
  background: #000;
  border-radius: 4px;
}

/* The access code: shown grouped, typed in any case, read off a printed
   email — so it wants a monospaced face and generous letter spacing. */
/* `input.` and not `.`: styles.css sets `font: inherit` on `input[type=text]`,
   which is a MORE specific selector, so a bare `.access-code-input` font-size
   never applied at all — the code rendered at plain 16px body Arial. */
/* NO text-transform. This one box now takes three different secrets, and a
   password IS case-sensitive: displaying "Shalom-Aleichem-26" back as
   "SHALOM-ALEICHEM-26" tells a man his capitals were thrown away and leaves
   him no way to see what he actually typed. The access code does not need
   the transform anyway — the server folds case for codes. */
input.access-code-input {
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  letter-spacing: 0.14em;
  font-size: 1.15rem;
}
.access-code-input::placeholder {
  letter-spacing: 0.1em;
  text-transform: none;
  opacity: 0.5;
}

/* The uploaded file's own name, so a musmach can tell at a glance that the
   photo we hold is the one he meant to send. */
.file-name {
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-size: 0.86rem;
  color: var(--ink);
  margin: 0.6rem 0 0.2rem;
  word-break: break-all;
}

/* ── Letter: the numbered steps ────────────────────────────────────────
   Choosing a letter and saying how to sign it are two different jobs, and
   a musmach who did only the first used to reach a dead end. */
.step-title {
  font-family: Georgia, serif;
  font-size: 1.15rem;
  color: var(--evergreen-dark);
  margin: 1.8rem 0 0.6rem;
}
.step-card .step-title { margin-top: 0; }
.step-card { margin-top: 1.2rem; }

/* `input.` for the same specificity reason as .access-code-input above. */
input.signature-input {
  font-size: 1.1rem;
  width: 100%;
  max-width: 26rem;
}
.save-status {
  display: inline-block;
  font-size: 0.82rem;
  color: var(--ok);
  margin-left: 0.6rem;
  min-height: 1.1em;
}
.sig-suggestions { display: flex; flex-wrap: wrap; gap: 0.4rem; margin: 0.3rem 0 0; }
.chip {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.3rem 0.8rem;
  font: inherit;
  font-size: 0.88rem;
  cursor: pointer;
  color: var(--ink);
}
.chip:hover { border-color: var(--evergreen); color: var(--evergreen-dark); }

/* Shown the way it prints, so what he approves is what he gets. */
.signature-preview, .final-letter {
  background: var(--surface);
  border: 1px solid var(--line);
  border-left: 3px solid var(--evergreen);
  border-radius: 4px;
  padding: 1rem 1.2rem;
  margin-top: 0.5rem;
  font-family: Calibri, Carlito, "Segoe UI", sans-serif;
  line-height: 1.45;
}
.sig-closing, .fl-closing { margin: 0 0 0.4rem; }
.sig-name, .fl-signature { margin: 0; font-weight: 600; }
.sig-empty { color: var(--muted); font-weight: normal; font-style: italic; }
.final-letter { margin: 0.8rem 0; }
.fl-salutation { margin: 0 0 0.7rem; }
.final-letter p { margin: 0 0 0.7rem; text-align: justify; }
.fl-closing { margin-top: 1rem; text-align: left; }
.fl-signature { text-align: left; }

/* Sign-in settings, in the header beside Sign out. Quiet on purpose: it is
   an account setting somebody touches once, not part of the checklist. */
.header-link {
  color: #dfe6ee; font-size: 0.85rem; text-decoration: underline;
  margin-right: 0.75rem; white-space: nowrap;
}
.header-link:hover { color: #fff; }
@media (max-width: 480px) { .header-link { font-size: 0.8rem; } }

/* The way in for somebody holding nothing at all. Set apart from the combined
   field above it, because a man opening his invitation has no access code, no
   password and no PIN, and the field above asks him for all three. */
.signin-first {
  margin-top: 1rem; padding-top: 0.9rem; border-top: 1px solid var(--line);
}
.signin-first p { margin: 0 0 0.6rem; color: var(--muted); }
.signin-first .button { width: 100%; }
@media (min-width: 480px) { .signin-first .button { width: auto; } }
/* Account-scoped facts and preferences stay readable on a phone. */
.profile-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 28px; margin: 24px 0; }
.profile-fields { border: 0; margin: 0; padding: 0; min-width: 0; }
.profile-fields legend { font-size: 1.1rem; font-weight: 700; margin-bottom: 10px; }
.profile-fields input, .profile-fields select { width: 100%; box-sizing: border-box; }
.profile-name-examples { display: grid; grid-template-columns: 180px minmax(0, 1fr); gap: 8px 20px; }
.profile-name-examples dt { color: #506064; }
.profile-name-examples dd { margin: 0; overflow-wrap: anywhere; font-weight: 600; }
@media (max-width: 640px) {
  .profile-grid { grid-template-columns: minmax(0, 1fr); }
  .profile-name-examples { grid-template-columns: minmax(0, 1fr); gap: 4px; }
  .profile-name-examples dd { margin-bottom: 12px; }
}

/* Letter page: switching between an RSA letter and his own (letter.js) */
.button.danger-outline { background: transparent; color: var(--danger); border: 1px solid var(--danger); }
.button.danger-outline:hover { background: #f7dcdc; }
.template-card.is-selected { border-color: var(--gold, #bd8a35); box-shadow: 0 0 0 2px rgba(189, 138, 53, 0.2); }
.switch-card { border-left: 4px solid var(--gold, #bd8a35); }
