/* =========================================================================
   Registry — stylesheet
   Direction: a records office, not a dashboard. Cool paper, ledger green,
   ink-black text. Structure comes from rules and edges, not from shadows.
   ========================================================================= */

:root {
  /* Surface — warm paper rather than clinical white */
  --paper:        #FAF6EC;
  --surface:      #FFFFFF;
  --surface-sunk: #F3ECDC;

  /* Ink — warm near-black, not grey */
  --ink:          #211B0E;
  --ink-mid:      #5B5140;
  --ink-soft:     #7E7361;
  --ink-faint:    #A79B85;

  /* Structure */
  --rule:         #E6DCC7;
  --rule-strong:  #CDBFA1;

  /* Gold — the primary accent, tuned to the congregation seal's ring.
     The bright tone fills and stripes; the deep tone carries white text
     at an accessible contrast (5.1:1). */
  --gold:         #D9A62A;
  --gold-deep:    #8C5E0A;
  --gold-wash:    #FBF0D6;

  /* Green — secondary, a shade truer to the seal than before. Section
     rules, tabs, active status. */
  --green:        #177A46;
  --green-deep:   #0F5C34;
  --green-wash:   #E1EFE7;

  /* Amber — cautions. Warning banners and notes about data that needs a
     look. Built from the gold family so it stays on palette. */
  --amber:        #7A560C;
  --amber-wash:   #FBF0D6;

  /* Red — reserved for destructive actions and changed cells, never
     decoration, so a red thing on screen always means something. Shifted
     toward the seal's true red rather than the earlier brick tone. */
  --rose:         #B62A2A;
  --rose-wash:    #FCE8E6;   /* matches the changed-cell fill in the sheet */
  --rose-rule:    #EFC4BE;

  /* The seal's own red and green, full strength — used only in small,
     clearly decorative touches (the gate screen's accent mark), never as
     body text or status color, where --rose and --green stay in charge. */
  --flag-red:     #D2242A;
  --flag-green:   #1E984F;

  /* Type */
  --sans:  "IBM Plex Sans", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --serif: "IBM Plex Serif", ui-serif, Georgia, "Times New Roman", serif;
  --mono:  "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, monospace;

  /* Rhythm */
  --sp-1: 4px;  --sp-2: 8px;  --sp-3: 12px; --sp-4: 16px;
  --sp-5: 24px; --sp-6: 32px; --sp-7: 48px; --sp-8: 72px;

  --radius: 3px;
  --measure: 68ch;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3 { margin: 0; font-weight: 500; line-height: 1.2; }
p { margin: 0; }
a { color: var(--green-deep); }

:focus-visible {
  outline: 2px solid var(--gold-deep);
  outline-offset: 2px;
  border-radius: 2px;
}

[hidden] { display: none !important; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}

/* ---------------------------------------------------------------- Gate -- */

.gate {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: var(--sp-5);
  background:
    linear-gradient(180deg, var(--paper) 0%, var(--surface-sunk) 100%);
}

.gate-card {
  width: 100%;
  max-width: 460px;
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  padding: var(--sp-7) var(--sp-6) var(--sp-6);
  box-shadow: 0 1px 3px rgba(20, 33, 28, 0.05), 0 12px 32px rgba(33, 27, 14, 0.06);
  text-align: center;
}

.gate-logo {
  display: block;
  margin: 0 auto var(--sp-4);
  width: 64px;
  height: 64px;
  border-radius: 50%;
  box-shadow: 0 2px 8px rgba(33, 27, 14, 0.14);
}

.gate-mark {
  font-family: var(--serif);
  font-size: 15px;
  font-weight: 600;
  color: var(--gold-deep);
  letter-spacing: 0.01em;
  margin-bottom: var(--sp-3);
}

/* A quiet nod to the seal's colours, not a literal flag — three short
   strokes rather than a full-width stripe, so it reads as decorative
   rather than a banner. */
.gate-accent {
  display: block;
  width: 46px;
  height: 4px;
  margin: 0 auto var(--sp-5);
  border-radius: 2px;
  background: linear-gradient(90deg,
    var(--gold) 0%, var(--gold) 60%,
    var(--flag-red) 60%, var(--flag-red) 80%,
    var(--flag-green) 80%, var(--flag-green) 100%);
}

.gate-title {
  font-family: var(--serif);
  font-size: 27px;
  font-weight: 500;
  letter-spacing: -0.012em;
  margin-bottom: var(--sp-3);
}

.gate-body {
  color: var(--ink-mid);
  font-size: 15px;
  margin: 0 auto var(--sp-5);
  max-width: 42ch;
}

.google-btn-wrap {
  display: flex;
  justify-content: center;
  margin-bottom: var(--sp-4);
  min-height: 44px; /* holds the layout steady while the button script loads */
}

.gate-status {
  margin-top: var(--sp-4);
  font-size: 14px;
  color: var(--ink-soft);
  min-height: 1.4em;
}
.gate-status.is-error { color: var(--rose); }

/* -------------------------------------------------------------- Topbar -- */

.shell { min-height: 100vh; display: flex; flex-direction: column; }

.topbar {
  background: var(--surface);
  border-bottom: 1px solid var(--rule);
  position: sticky;
  top: 0;
  z-index: 20;
}

.topbar-inner {
  max-width: 1160px;
  margin: 0 auto;
  padding: 0 var(--sp-5);
  height: 60px;
  display: flex;
  align-items: center;
  gap: var(--sp-6);
}

.wordmark {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--ink);
  flex: none;
}
.wordmark-logo { width: 26px; height: 26px; border-radius: 50%; flex: none; }
.wordmark-rule { width: 3px; height: 20px; background: var(--gold); border-radius: 2px; }
.wordmark-text { font-family: var(--serif); font-weight: 600; font-size: 17px; letter-spacing: -0.01em; white-space: nowrap; }

@media (max-width: 720px) {
  .wordmark-text { font-size: 15px; }
}

.nav { display: flex; gap: var(--sp-2); flex: 1 1 auto; }

.nav-link {
  padding: 6px 12px;
  border-radius: var(--radius);
  text-decoration: none;
  color: var(--ink-mid);
  font-size: 15px;
  font-weight: 450;
  transition: background 0.12s ease, color 0.12s ease;
}
.nav-link:hover { background: var(--surface-sunk); color: var(--ink); }
.nav-link.is-active { background: var(--gold-wash); color: var(--gold-deep); font-weight: 500; }

.topbar-right { display: flex; align-items: center; gap: var(--sp-3); flex: none; }
.account { display: flex; align-items: center; gap: var(--sp-3); }
.account-email {
  font-size: 13px;
  color: var(--ink-soft);
  max-width: 22ch;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

@media (max-width: 860px) {
  .topbar-inner { height: auto; padding: var(--sp-3) var(--sp-4); flex-wrap: wrap; gap: var(--sp-3); }
  .nav { order: 3; flex-basis: 100%; }
  .topbar-right { margin-left: auto; }
  .account-email { display: none; }
}

/* ------------------------------------------------------------- Banners -- */

.banners { max-width: 1160px; margin: 0 auto; padding: 0 var(--sp-5); width: 100%; }

.banner {
  display: flex;
  align-items: baseline;
  gap: var(--sp-3);
  margin-top: var(--sp-4);
  padding: 10px var(--sp-4);
  border-radius: var(--radius);
  font-size: 14px;
  border: 1px solid;
}
.banner-info  { background: var(--green-wash); border-color: #C5DED6; color: var(--green-deep); }
.banner-warn  { background: var(--amber-wash); border-color: #E4D4AE; color: var(--amber); }
.banner-error { background: var(--rose-wash);  border-color: var(--rose-rule); color: var(--rose); }
.banner { flex-wrap: wrap; row-gap: var(--sp-2); }
.banner strong { font-weight: 600; flex: none; }
.banner span { flex: 1 1 300px; min-width: 0; }
.banner button { margin-left: auto; flex: none; }
.banner-info .btn-sm { align-self: center; border-color: #B7D4CA; }

/* ---------------------------------------------------------------- View -- */

.view {
  flex: 1 1 auto;
  width: 100%;
  max-width: 1160px;
  margin: 0 auto;
  padding: var(--sp-6) var(--sp-5) var(--sp-8);
}
.view:focus { outline: none; }

.footer {
  border-top: 1px solid var(--rule);
  padding: var(--sp-4) var(--sp-5);
  color: var(--ink-faint);
  font-size: 13px;
  text-align: center;
}

.page-head { margin-bottom: var(--sp-5); }
.page-title {
  font-family: var(--serif);
  font-size: 26px;
  font-weight: 500;
  letter-spacing: -0.012em;
}
.page-sub { color: var(--ink-soft); font-size: 15px; margin-top: 2px; max-width: var(--measure); }

/* -------------------------------------------------------------- Button -- */

.btn {
  font: inherit;
  font-size: 14px;
  font-weight: 500;
  padding: 8px 14px;
  border-radius: var(--radius);
  border: 1px solid var(--rule-strong);
  background: var(--surface);
  color: var(--ink);
  cursor: pointer;
  transition: background 0.12s ease, border-color 0.12s ease;
  white-space: nowrap;
}
.btn:hover:not(:disabled) { background: var(--surface-sunk); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }

.btn-primary { background: var(--gold-deep); border-color: var(--gold-deep); color: #fff; }
.btn-primary:hover:not(:disabled) { background: #6F5009; border-color: #6F5009; }

.btn-danger { background: var(--surface); border-color: var(--rose-rule); color: var(--rose); }
.btn-danger:hover:not(:disabled) { background: var(--rose-wash); }

.btn-danger-solid { background: var(--rose); border-color: var(--rose); color: #fff; }
.btn-danger-solid:hover:not(:disabled) { background: #8A2C22; }

.btn-quiet { border-color: transparent; background: transparent; color: var(--ink-mid); }
.btn-quiet:hover:not(:disabled) { background: var(--surface-sunk); color: var(--ink); }

.btn-lg { font-size: 15px; padding: 11px 20px; width: 100%; }

.btn-link {
  background: none; border: none; padding: 0;
  color: var(--green-deep); font: inherit; font-size: 14px;
  cursor: pointer; text-decoration: underline; text-underline-offset: 2px;
}

/* --------------------------------------------------------------- Forms -- */

.field { display: flex; flex-direction: column; gap: 5px; }
.field-label { font-size: 13px; font-weight: 500; color: var(--ink-mid); }
.field-label .req { color: var(--rose); }

.input, .select, .textarea {
  font: inherit;
  font-size: 15px;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--rule-strong);
  border-radius: var(--radius);
  padding: 8px 10px;
  width: 100%;
  transition: border-color 0.12s ease, box-shadow 0.12s ease;
}
.input:hover, .select:hover, .textarea:hover { border-color: var(--ink-faint); }
.input:focus, .select:focus, .textarea:focus {
  outline: none;
  border-color: var(--gold-deep);
  box-shadow: 0 0 0 3px var(--gold-wash);
}
.textarea { min-height: 76px; resize: vertical; line-height: 1.5; }
.select { appearance: none; padding-right: 30px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%236E7D75' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 10px center; }

.input[readonly], .input:disabled, .textarea[readonly] {
  background: var(--surface-sunk);
  color: var(--ink-mid);
  cursor: default;
  border-color: var(--rule);
}
.input.is-mono { font-family: var(--mono); font-size: 14px; letter-spacing: 0.01em; }

.field-hint { font-size: 12.5px; color: var(--ink-soft); }
.field-note { font-size: 12.5px; color: var(--amber); }
.field-error { font-size: 12.5px; color: var(--rose); }
.field.has-error .input,
.field.has-error .textarea,
.field.has-error .select { border-color: var(--rose); }

.field.is-changed .field-label::after {
  content: "changed";
  margin-left: 8px;
  font-size: 11px;
  font-weight: 500;
  color: var(--rose);
  background: var(--rose-wash);
  border-radius: 2px;
  padding: 1px 5px;
}

.readonly-value {
  font-size: 15px;
  padding: 8px 0;
  border-bottom: 1px solid var(--rule);
  min-height: 38px;
  word-break: break-word;
}
.readonly-value.is-empty { color: var(--ink-faint); }

/* ------------------------------------------------------------ Fieldset -- */

.group { margin-bottom: var(--sp-6); }
.group-head {
  display: flex; align-items: baseline; gap: var(--sp-3);
  padding-bottom: var(--sp-2);
  border-bottom: 1px solid var(--rule);
  margin-bottom: var(--sp-4);
}
.group-title { font-family: var(--serif); font-size: 17px; font-weight: 600; }
.group-note { font-size: 13px; color: var(--ink-soft); }

.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--sp-4); }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--sp-4); }
.span-2 { grid-column: span 2; }
@media (max-width: 860px) {
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .span-2 { grid-column: auto; }
}

/* ------------------------------------------------------------ Searchbar --
   Show on the left; search rows on the right. Every row reads the same way,
   field then value then its own remove and add buttons, so a second or
   third row needs no explaining. */

.searchbar {
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  padding: var(--sp-4);
  display: grid;
  grid-template-columns: 190px minmax(0, 1fr);
  gap: var(--sp-3) var(--sp-5);
  align-items: start;
}

.filters { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.filter-rows { display: flex; flex-direction: column; gap: var(--sp-2); }

.filter-head,
.filter-row {
  display: grid;
  grid-template-columns: 210px minmax(0, 1fr) calc(76px + var(--sp-1) * 1.5);
  gap: var(--sp-3);
}
.filter-row { align-items: stretch; }

.filter-btns { display: flex; gap: 6px; }
.btn-icon {
  width: 35px;
  padding: 0;
  font-size: 18px;
  line-height: 1;
  display: grid;
  place-items: center;
  color: var(--ink-mid);
}
.btn-icon:hover:not(:disabled) { color: var(--ink); }

.search-foot {
  display: flex;
  align-items: center;
  gap: var(--sp-4);
  flex-wrap: wrap;
  margin-top: var(--sp-2);
}
.search-foot .spacer { flex: 1 1 auto; }
.search-note { font-size: 13px; color: var(--ink-soft); }

.search-actions { display: flex; gap: var(--sp-2); }

.search-opts {
  display: flex; align-items: center; gap: 6px;
  font-size: 13px; color: var(--ink-mid);
  cursor: pointer;
}
.search-opts input { accent-color: var(--gold-deep); margin: 0; }

@media (max-width: 860px) {
  .searchbar { grid-template-columns: 1fr; }
  .filter-head-look { display: none; }
  .filter-head { grid-template-columns: 1fr; }
  .filter-row { grid-template-columns: minmax(0, 1fr) auto; row-gap: 6px; }
  .filter-row .filter-field { grid-column: 1 / -1; }
  .filter-rows { gap: var(--sp-4); }
}

/* Typeahead */
.typeahead { position: relative; }
.typeahead-list {
  position: absolute;
  top: calc(100% + 4px);
  left: 0; right: 0;
  z-index: 30;
  background: var(--surface);
  border: 1px solid var(--rule-strong);
  border-radius: var(--radius);
  box-shadow: 0 6px 20px rgba(20, 33, 28, 0.10);
  max-height: 260px;
  overflow-y: auto;
  padding: 4px;
  margin: 0;
  list-style: none;
}
.typeahead-item {
  padding: 7px 10px;
  border-radius: 2px;
  font-size: 14.5px;
  cursor: pointer;
}
.typeahead-item[aria-selected="true"], .typeahead-item:hover {
  background: var(--gold-wash);
  color: var(--gold-deep);
}
.typeahead-item mark { background: transparent; color: inherit; font-weight: 600; }

/* --------------------------------------------------------- Result meta -- */

.result-meta {
  display: flex;
  align-items: center;
  gap: var(--sp-3) var(--sp-5);
  margin: var(--sp-5) 0 var(--sp-4);
  font-size: 14px;
  color: var(--ink-soft);
  flex-wrap: wrap;
}
.meta-summary { display: flex; align-items: baseline; gap: var(--sp-3); flex-wrap: wrap; }
.is-attended-summary { color: var(--green-deep); font-weight: 600; }
.att-summary-detail { color: var(--ink-soft); font-size: 13px; }
.meta-tools { display: flex; align-items: center; gap: var(--sp-3); flex-wrap: wrap; margin-left: auto; }
.result-count { color: var(--ink); font-weight: 500; }

.sort-control { display: inline-flex; align-items: center; gap: 6px; }
.sort-label { font-size: 13px; color: var(--ink-mid); white-space: nowrap; }

.select-sm {
  width: auto;
  max-width: 210px;
  font-size: 13.5px;
  padding: 5px 28px 5px 9px;
  background-position: right 9px center;
}
.btn-sm { font-size: 13px; padding: 5px 11px; }
.sort-dir { min-width: 96px; }

/* -------------------------------------------------------- Record cards -- */

.cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(290px, 1fr));
  gap: var(--sp-4);
}

.card {
  position: relative;
  display: block;
  text-align: left;
  width: 100%;
  font: inherit;
  color: inherit;
  background: var(--surface);
  border: 1px solid var(--rule);
  border-left: 3px solid var(--gold);
  border-radius: var(--radius);
  padding: var(--sp-4) var(--sp-4) var(--sp-4) var(--sp-5);
  cursor: pointer;
  transition: background 0.12s ease, border-color 0.12s ease;
}
.card:hover { background: #FFFDF7; border-color: var(--rule-strong); border-left-color: var(--gold-deep); }
.card.is-inactive { border-left-color: var(--ink-faint); }

.card-name {
  font-family: var(--serif);
  font-size: 18px;
  font-weight: 600;
  letter-spacing: -0.008em;
  margin-bottom: 2px;
  padding-right: 70px;
}
.card-id {
  font-family: var(--mono);
  font-size: 11.5px;
  color: var(--ink-faint);
  margin-bottom: var(--sp-3);
}
.card-fields { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 3px var(--sp-3); font-size: 13.5px; }
.card-fields dt { color: var(--ink-soft); }
.card-fields dd { margin: 0; color: var(--ink-mid); overflow: hidden; text-overflow: ellipsis; }

.card .badge { position: absolute; top: var(--sp-4); right: var(--sp-4); }

/* -------------------------------------------------------------- Badges -- */

.badge {
  display: inline-block;
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.01em;
  padding: 2px 8px;
  border-radius: 10px;
  border: 1px solid;
}
.badge-active   { background: var(--green-wash); border-color: #C5DED6; color: var(--green-deep); }
.badge-inactive { background: var(--surface-sunk); border-color: var(--rule-strong); color: var(--ink-mid); }
.badge-current  { background: var(--green); border-color: var(--green); color: #fff; }
.badge-plain    { background: var(--surface); border-color: var(--rule-strong); color: var(--ink-mid); }
.badge-change   { background: var(--rose-wash); border-color: var(--rose-rule); color: var(--rose); }
.badge-pending  { background: var(--gold-wash); border-color: #EBDDB5; color: var(--gold-deep); }

/* --------------------------------------------------------- Empty state -- */

.empty {
  border: 1px dashed var(--rule-strong);
  border-radius: var(--radius);
  padding: var(--sp-7) var(--sp-5);
  text-align: center;
  background: var(--surface);
}
.empty-title { font-family: var(--serif); font-size: 18px; font-weight: 600; margin-bottom: 4px; }
.empty-body { color: var(--ink-soft); font-size: 14.5px; max-width: 46ch; margin: 0 auto var(--sp-4); }

.loading { color: var(--ink-soft); font-size: 15px; padding: var(--sp-6) 0; }

/* ------------------------------------------------------------- Profile -- */

.back-link {
  display: inline-block;
  font-size: 14px;
  color: var(--ink-soft);
  text-decoration: none;
  margin-bottom: var(--sp-4);
}
.back-link:hover { color: var(--ink); text-decoration: underline; }

.profile-head {
  display: flex;
  align-items: flex-start;
  gap: var(--sp-4);
  flex-wrap: wrap;
  padding-bottom: var(--sp-4);
  border-bottom: 2px solid var(--ink);
}
.profile-name {
  font-family: var(--serif);
  font-size: 32px;
  font-weight: 600;
  letter-spacing: -0.018em;
  line-height: 1.12;
}
.profile-id { font-family: var(--mono); font-size: 13px; color: var(--ink-soft); margin-top: 5px; }
.profile-meta { font-size: 13.5px; color: var(--ink-soft); margin-top: 2px; }
.profile-head-actions { margin-left: auto; display: flex; gap: var(--sp-2); flex-wrap: wrap; }

.tabs { display: flex; gap: var(--sp-1); border-bottom: 1px solid var(--rule); margin: var(--sp-5) 0 var(--sp-6); }
.tab {
  font: inherit; font-size: 15px; font-weight: 450;
  background: none; border: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  padding: 8px 14px;
  color: var(--ink-soft);
  cursor: pointer;
}
.tab:hover { color: var(--ink); }
.tab[aria-selected="true"] { color: var(--green-deep); border-bottom-color: var(--green); font-weight: 500; }

.sticky-actions {
  position: sticky;
  bottom: 0;
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  padding: var(--sp-3) var(--sp-4);
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  margin-top: var(--sp-5);
  box-shadow: 0 -4px 16px rgba(20, 33, 28, 0.06);
}
.sticky-actions .spacer { flex: 1 1 auto; }
.sticky-actions .dirty-note { font-size: 13.5px; color: var(--ink-soft); }

@media (max-width: 560px) {
  .sticky-actions { flex-wrap: wrap; row-gap: var(--sp-2); }
  .sticky-actions .dirty-note { flex: 1 0 100%; }
  .sticky-actions .spacer { display: none; }
  .sticky-actions .btn { flex: 1 1 0; }
}

/* --------------------------------------------------- History (the spine) --
   This is where the app earns its complexity, so it gets the boldest
   treatment in the interface: a continuous ledger spine with dated stops. */

.history { position: relative; padding-left: 30px; }
.history::before {
  content: "";
  position: absolute;
  left: 5px; top: 8px; bottom: 8px;
  width: 2px;
  background: linear-gradient(180deg, var(--gold) 0%, var(--green) 100%);
}

.hentry { position: relative; padding-bottom: var(--sp-6); }
.hentry:last-child { padding-bottom: 0; }
.hentry::before {
  content: "";
  position: absolute;
  left: -30px; top: 7px;
  width: 12px; height: 12px;
  border-radius: 50%;
  background: var(--surface);
  border: 2px solid var(--rule-strong);
}
.hentry.is-current::before { background: var(--gold); border-color: var(--gold-deep); }

.hentry-head { display: flex; align-items: baseline; gap: var(--sp-3); flex-wrap: wrap; }
.hentry-dates { font-family: var(--mono); font-size: 13px; color: var(--ink); font-weight: 500; }
.hentry-who { font-size: 13.5px; color: var(--ink-soft); }
.hentry-actions { margin-left: auto; display: flex; gap: var(--sp-2); }

.hentry-body { margin-top: var(--sp-3); }

.diff {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  overflow: hidden;
}
.diff th {
  text-align: left;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--ink-soft);
  padding: 7px 12px;
  background: var(--surface-sunk);
  border-bottom: 1px solid var(--rule);
}
.diff td { padding: 8px 12px; border-bottom: 1px solid var(--rule); vertical-align: top; }
.diff tr:last-child td { border-bottom: none; }
.diff .d-field { font-weight: 500; width: 26%; }
.diff .d-old { color: var(--ink-soft); text-decoration: line-through; text-decoration-color: var(--ink-faint); width: 34%; }
.diff .d-new { background: var(--rose-wash); color: var(--ink); width: 40%; }
.diff .d-empty { color: var(--ink-faint); font-style: italic; text-decoration: none; }

.no-change { font-size: 14px; color: var(--ink-soft); }

/* Snapshot table (read-only version viewer) */
.snapshot { width: 100%; border-collapse: collapse; font-size: 14px; }
.snapshot th {
  text-align: left; font-weight: 500; color: var(--ink-soft);
  padding: 6px 12px 6px 0; width: 40%; vertical-align: top;
  border-bottom: 1px solid var(--rule);
}
.snapshot td { padding: 6px 0; border-bottom: 1px solid var(--rule); word-break: break-word; }
.snapshot .is-empty { color: var(--ink-faint); }

/* --------------------------------------------------------------- Modal -- */

.modal-backdrop {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(20, 33, 28, 0.42);
  display: grid;
  place-items: center;
  padding: var(--sp-4);
  animation: fade 0.14s ease;
}
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }

.modal {
  background: var(--surface);
  border-radius: var(--radius);
  border-top: 3px solid var(--gold);
  width: 100%;
  max-width: 620px;
  max-height: 88vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 18px 48px rgba(20, 33, 28, 0.24);
}
.modal.is-danger { border-top-color: var(--rose); }
.modal.is-wide { max-width: 780px; }

.modal-head { padding: var(--sp-5) var(--sp-5) var(--sp-3); }
.modal-title { font-family: var(--serif); font-size: 20px; font-weight: 600; }
.modal-lede { font-size: 14.5px; color: var(--ink-mid); margin-top: 6px; max-width: 56ch; }

.modal-body { padding: 0 var(--sp-5) var(--sp-4); overflow-y: auto; flex: 1 1 auto; }
.modal-foot {
  padding: var(--sp-4) var(--sp-5);
  border-top: 1px solid var(--rule);
  display: flex;
  gap: var(--sp-2);
  justify-content: flex-end;
  flex-wrap: wrap;
}
.modal-foot .spacer { flex: 1 1 auto; }

.confirm-phrase {
  font-family: var(--mono);
  font-size: 13px;
  background: var(--surface-sunk);
  padding: 1px 6px;
  border-radius: 2px;
}

/* ----------------------------------------------------- Column manager -- */

.col-list { list-style: none; margin: 0; padding: 0; border: 1px solid var(--rule); border-radius: var(--radius); }
.col-row {
  display: flex; align-items: center; gap: var(--sp-3);
  padding: 9px var(--sp-4);
  border-bottom: 1px solid var(--rule);
  font-size: 14.5px;
}
.col-row:last-child { border-bottom: none; }
.col-row.is-locked { background: var(--surface-sunk); color: var(--ink-mid); }
.col-name { flex: 1 1 auto; }
.col-row .col-name { display: flex; flex-direction: column; }
.col-note { font-size: 12.5px; color: var(--ink-soft); }
.col-lock { font-size: 12px; color: var(--ink-soft); }
.col-actions { display: flex; gap: var(--sp-4); flex: none; }
.btn-link-danger { color: var(--rose); }

.col-section-title {
  font-family: var(--serif);
  font-size: 15px;
  font-weight: 600;
  margin: var(--sp-5) 0 var(--sp-2);
}
.col-roles { margin-bottom: var(--sp-5); }
.col-roles .col-section-title:not(:first-child) { margin-top: var(--sp-5); }

.role-list {
  list-style: none;
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  overflow: hidden;
  margin-bottom: var(--sp-2);
}
.role-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-3);
  padding: 9px var(--sp-4);
  border-bottom: 1px solid var(--rule);
  font-size: 14.5px;
}
.role-row:last-child { border-bottom: none; }
.role-row:nth-child(even) { background: var(--surface-sunk); }
.role-row .btn-link-danger:disabled { color: var(--ink-soft); cursor: default; }

/* ------------------------------------------------------------ Approvals -- */

.req-row {
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  padding: var(--sp-4);
}
.req-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-3);
}
.req-toggle {
  flex: 1 1 auto;
  min-width: 0;
  text-align: left;
  background: none;
  border: none;
  padding: 0;
  font: inherit;
  color: var(--ink);
  cursor: pointer;
  display: flex;
  align-items: baseline;
  gap: 4px;
  flex-wrap: wrap;
}
.req-toggle:hover .req-name { text-decoration: underline; text-underline-offset: 3px; }
.req-name { font-weight: 600; }
.req-fields-inline { color: var(--ink-soft); font-size: 14px; }
.req-fields { color: var(--ink-mid); font-size: 14px; margin: 6px 0 2px; }

.req-review {
  margin-top: var(--sp-4);
  padding-top: var(--sp-4);
  border-top: 1px solid var(--rule);
}
.req-actions { display: flex; gap: var(--sp-3); margin-top: var(--sp-4); }

/* ------------------------------------------------------------ Attendance -- */

.att-picker {
  display: flex;
  gap: var(--sp-5);
  flex-wrap: wrap;
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  padding: var(--sp-4);
}
.att-picker .field { min-width: 200px; flex: none; }
.att-picker input[type="week"] { min-width: 200px; }

.att-filters {
  display: flex;
  gap: var(--sp-3);
  flex-wrap: wrap;
  align-items: center;
  margin: var(--sp-4) 0;
}
.att-filters input[type="text"] { max-width: 260px; }

.att-list { display: flex; flex-direction: column; gap: 1px; }

.att-row {
  background: var(--surface);
  border: 1px solid var(--rule);
  padding: 12px var(--sp-4);
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--sp-3) var(--sp-5);
}
.att-list .att-row + .att-row { border-top: none; }
.att-list .att-row:first-child { border-radius: var(--radius) var(--radius) 0 0; }
.att-list .att-row:last-child { border-radius: 0 0 var(--radius) var(--radius); }

.att-identity { flex: 1 1 220px; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.att-name { font-weight: 500; min-width: 0; }
.att-surname { font-weight: 600; letter-spacing: 0.01em; }
.att-meta {
  display: flex;
  gap: var(--sp-3);
  flex-wrap: wrap;
  font-size: 12.5px;
  color: var(--ink-soft);
}

.att-week-picker { display: flex; gap: var(--sp-4); }
.att-week-picker .field { min-width: 130px; }
.att-week-picker select { min-width: 130px; }

.att-options { display: flex; gap: var(--sp-4); flex: none; }
.att-opt {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 14px;
  color: var(--ink-mid);
  cursor: pointer;
  white-space: nowrap;
}
.att-opt input { accent-color: var(--gold-deep); margin: 0; }
.att-opt:has(input:checked) { color: var(--ink); font-weight: 500; }

.att-detail {
  flex: 1 1 220px;
  min-width: 180px;
}
.att-detail .input { width: 100%; }

.att-row .btn-link { flex: none; font-size: 12.5px; white-space: nowrap; }

.att-removed { margin-top: var(--sp-3); }
.att-removed-panel {
  margin-top: var(--sp-2);
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  padding: var(--sp-3) var(--sp-4);
}
.att-removed-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 0;
  font-size: 13.5px;
  border-bottom: 1px solid var(--rule);
}
.att-removed-row:last-child { border-bottom: none; }

/* Reports */
.att-report-filters { display: flex; gap: var(--sp-3); flex-wrap: wrap; align-items: center; margin: var(--sp-4) 0; }

.att-service-block { margin-bottom: var(--sp-5); }
.att-service-title {
  font-family: var(--serif);
  font-size: 18px;
  margin: 0 0 var(--sp-3);
}

.att-report-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--sp-3);
}

/* A real aligned table: one grid template shared by the header and every
   data row, so columns line up regardless of how long any one value is —
   a short numeric Area/Group code and a long district name both sit in
   the same place from row to row. */
.att-report-table { border: 1px solid var(--rule); border-radius: var(--radius); overflow: hidden; }

.att-report-head-row,
.att-report-row {
  display: grid;
  grid-template-columns: minmax(170px, 1.3fr) 90px 90px 100px 130px minmax(180px, 1fr) minmax(180px, 1fr);
  gap: var(--sp-3);
  align-items: center;
  padding: 10px var(--sp-4);
}
.att-report-row { background: var(--surface); border-top: 1px solid var(--rule); }
.att-report-row:first-of-type { border-top: none; }

.att-report-head-row {
  background: var(--surface-sunk);
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--ink-soft);
}

.att-report-cell { font-size: 13.5px; color: var(--ink-mid); overflow-wrap: break-word; }
.att-report-name { font-size: 14px; color: var(--ink); }
.att-report-service-cell { line-height: 1.4; }
.att-report-service-cell .is-exception { color: var(--rose); font-weight: 500; }
.att-report-detail-inline { color: var(--ink-mid); }

@media (max-width: 900px) {
  .att-report-table { overflow-x: auto; }
  .att-report-head-row, .att-report-row { grid-template-columns: 170px 90px 90px 100px 130px 180px 180px; width: max-content; min-width: 100%; }
}

.att-breakdowns {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: var(--sp-4);
  margin: var(--sp-4) 0 var(--sp-5);
}
.att-breakdown {
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  padding: var(--sp-4);
}
.att-breakdown-title {
  font-family: var(--serif);
  font-size: 14px;
  font-weight: 600;
  margin: 0 0 var(--sp-3);
}
.att-breakdown-rows { display: flex; flex-direction: column; gap: 9px; }
.att-breakdown-row {
  display: grid;
  grid-template-columns: 100px 1fr auto;
  align-items: center;
  gap: var(--sp-3);
  font-size: 13px;
}
.att-breakdown-key { color: var(--ink-mid); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.att-breakdown-bar-wrap {
  display: flex;
  background: var(--surface-sunk);
  border-radius: 3px;
  height: 8px;
  overflow: hidden;
}
.att-breakdown-bar { display: block; height: 100%; }
.att-breakdown-bar.is-present { background: var(--green); }
.att-breakdown-bar.is-elsewhere { background: var(--gold); }
.att-breakdown-pct { color: var(--ink-soft); white-space: nowrap; font-variant-numeric: tabular-nums; }

.att-breakdown-legend {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: var(--sp-3) 0 0;
  font-size: 12px;
  color: var(--ink-soft);
}
.att-legend-swatch {
  display: inline-block;
  width: 9px;
  height: 9px;
  border-radius: 2px;
}
.att-legend-swatch.is-present { background: var(--green); margin-left: 4px; }
.att-legend-swatch.is-elsewhere { background: var(--gold); margin-left: 10px; }

.col-backup { margin-bottom: var(--sp-5); }
.backup-row {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  flex-wrap: wrap;
}
.backup-row .field-hint { flex: 1 1 260px; min-width: 0; }

.col-missing .field-hint { margin-bottom: var(--sp-3); }
.col-missing .col-list { background: var(--gold-wash); border-color: #EBDDB5; }
.col-missing .col-row { border-bottom-color: #EBDDB5; }

.rename-notes { font-size: 14px; color: var(--ink-mid); max-width: 56ch; }
.modal-warn {
  color: var(--amber);
  background: var(--amber-wash);
  border-left: 2px solid var(--gold);
  padding: 8px 12px;
}

.add-col { display: flex; gap: var(--sp-2); }
.add-col .input { flex: 1 1 auto; }

/* --------------------------------------------------------------- Toast -- */

/* Toasts sit over the corner where the Save button lives. Clicks pass
   through them, so saving twice in a row never waits on a toast to fade. */
.toast-root {
  position: fixed;
  bottom: var(--sp-5); right: var(--sp-5);
  z-index: 200;
  pointer-events: none;
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
  max-width: min(420px, calc(100vw - 32px));
}
.toast {
  background: var(--ink);
  color: #F2F5F3;
  border-radius: var(--radius);
  padding: 11px var(--sp-4);
  font-size: 14px;
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  box-shadow: 0 8px 26px rgba(20, 33, 28, 0.28);
  animation: toast-in 0.18s ease;
}
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.toast.is-error { background: var(--rose); }
.toast.is-success { background: var(--green-deep); }
.toast button {
  pointer-events: auto;
  background: none; border: none; color: inherit;
  font: inherit; font-weight: 600; font-size: 13.5px;
  cursor: pointer; text-decoration: underline; text-underline-offset: 2px;
  margin-left: auto; flex: none; padding: 0;
}

/* ------------------------------------------------ Combobox (fixed lists) --
   Gender and CFO. Click to browse the whole list, or type to filter it.
   Anything off-list is refused when the record is saved. */

.combo { position: relative; }
.combo-input { padding-right: 32px; }

.combo-toggle {
  position: absolute;
  top: 1px; right: 1px; bottom: 1px;
  width: 30px;
  display: grid;
  place-items: center;
  background: none;
  border: none;
  border-radius: 0 var(--radius) var(--radius) 0;
  color: var(--ink-soft);
  cursor: pointer;
}
.combo-toggle:hover { color: var(--ink); background: var(--surface-sunk); }

.combo-caret {
  width: 8px; height: 8px;
  border-right: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor;
  transform: translateY(-2px) rotate(45deg);
}

.combo-list {
  position: absolute;
  top: calc(100% + 4px);
  left: 0; right: 0;
  z-index: 30;
  background: var(--surface);
  border: 1px solid var(--rule-strong);
  border-radius: var(--radius);
  box-shadow: 0 6px 20px rgba(33, 27, 14, 0.12);
  max-height: 240px;
  overflow-y: auto;
  padding: 4px;
  margin: 0;
  list-style: none;
}
.combo-item {
  padding: 7px 10px;
  border-radius: 2px;
  font-size: 14.5px;
  cursor: pointer;
}
.combo-item[aria-selected="true"], .combo-item:hover {
  background: var(--gold-wash);
  color: var(--gold-deep);
  font-weight: 500;
}

/* ------------------------------------------ Tick box with a value list --
   Officer. The tick box carries the field name; ticking it opens the list,
   which hangs off a gold rule so it reads as belonging to the tick box. */

.check {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  font-size: 14.5px;
  line-height: 1.3;
  color: var(--ink);
  cursor: pointer;
}
.check input {
  width: 16px;
  height: 16px;
  margin: 0;
  flex: none;
  accent-color: var(--gold-deep);
  cursor: pointer;
}
.check-lead {
  align-self: flex-start;
  font-size: 15px;
  font-weight: 500;
  padding: 8px 0 2px;
}

.checklist {
  margin: 4px 0 0 7px;
  padding: 4px 0 6px 18px;
  border: none;
  border-left: 2px solid var(--gold);
  min-width: 0;
}
.checklist-legend {
  float: left;
  width: 100%;
  padding: 0;
  margin-bottom: 10px;
  font-size: 13px;
  font-weight: 500;
  color: var(--ink-mid);
}
/* Columns read top to bottom, so an alphabetical list scans the way people
   expect. Sixteen roles fall into four even columns on a wide screen and
   two on a phone. */
.checklist-grid {
  clear: both;
  columns: 4 132px;
  column-gap: var(--sp-4);
}
.checklist-grid .check {
  display: flex;
  break-inside: avoid;
  margin-bottom: 10px;
}
.check.is-offlist span { color: var(--ink-soft); font-style: italic; }

.field.has-error .checklist { border-left-color: var(--rose); }
.field.is-changed .check-text::after {
  content: "changed";
  margin-left: 8px;
  font-size: 11px;
  font-weight: 500;
  color: var(--rose);
  background: var(--rose-wash);
  border-radius: 2px;
  padding: 1px 5px;
  vertical-align: 1px;
}

/* ------------------------------------------- Phone with country code ---- */

.phone-group { display: grid; grid-template-columns: 132px minmax(0, 1fr); gap: var(--sp-2); }
.phone-code { font-size: 14px; }
.phone-number { font-variant-numeric: tabular-nums; }

@media (max-width: 480px) {
  .phone-group { grid-template-columns: 1fr; }
}

/* -------------------------------------------------- Directory name form --
   "DELA CRUZ, Maria Lourdes" — surname bold and upper case so a column of
   names can be scanned by surname without reading each one. */

.rec-name { display: inline; }
.rec-surname {
  font-weight: 600;
  letter-spacing: 0.01em;
}
.rec-name-fallback { font-family: var(--mono); font-size: 0.9em; color: var(--ink-soft); }

/* ------------------------------------------------------- Layout toggle -- */

.layout-toggle {
  display: inline-flex;
  border: 1px solid var(--rule-strong);
  border-radius: var(--radius);
  overflow: hidden;
}
.layout-btn {
  font: inherit;
  font-size: 13px;
  font-weight: 500;
  padding: 5px 12px;
  background: var(--surface);
  color: var(--ink-mid);
  border: none;
  cursor: pointer;
}
.layout-btn + .layout-btn { border-left: 1px solid var(--rule-strong); }
.layout-btn:hover { background: var(--surface-sunk); color: var(--ink); }
.layout-btn[aria-pressed="true"] {
  background: var(--gold-deep);
  color: #fff;
}

/* ----------------------------------------------------------- List view -- */

.list-wrap {
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  overflow-x: auto;
}

.rec-list { width: 100%; border-collapse: collapse; font-size: 14px; }

.rec-list th {
  text-align: left;
  font-size: 12px;
  font-weight: 500;
  color: var(--ink-soft);
  letter-spacing: 0.02em;
  padding: 10px var(--sp-4);
  background: var(--surface-sunk);
  border-bottom: 1px solid var(--rule-strong);
  white-space: nowrap;
}

.rec-list td {
  padding: 10px var(--sp-4);
  border-bottom: 1px solid var(--rule);
  vertical-align: middle;
  white-space: nowrap;
}
.rec-list tbody tr:last-child td { border-bottom: none; }

.rec-list tbody tr { cursor: pointer; transition: background 0.1s ease; }
.rec-list tbody tr:hover { background: var(--gold-wash); }
.rec-list tbody tr:focus-visible { outline: 2px solid var(--gold-deep); outline-offset: -2px; }

.rec-list .col-name { min-width: 220px; white-space: normal; }

.th-sort {
  font: inherit;
  letter-spacing: inherit;
  color: inherit;
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 7px;
}
.th-sort:hover { color: var(--ink); text-decoration: underline; text-underline-offset: 3px; }
.rec-list th[aria-sort="ascending"],
.rec-list th[aria-sort="descending"] { color: var(--ink); }
.th-caret {
  width: 6px; height: 6px;
  border-right: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor;
  transform: translateY(-2px) rotate(45deg);
}
th[aria-sort="ascending"] .th-caret { transform: translateY(2px) rotate(-135deg); }
.rec-list .col-status { width: 1%; text-align: right; }
.rec-list td.is-empty { color: var(--ink-faint); }

.rec-list tbody tr.is-inactive .rec-name { color: var(--ink-soft); }

@media (max-width: 700px) {
  .rec-list th, .rec-list td { padding: 9px var(--sp-3); }
  .rec-list .col-name { min-width: 160px; }
}

/* ------------------------------------------------------------- Offline -- */


body.is-offline .btn-primary,
body.is-offline .btn-danger,
body.is-offline .btn-danger-solid {
  opacity: 0.45;
  pointer-events: none;
}

/* --------------------------------------------------------------- Misc -- */

.sr-only {
  position: absolute; width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.mono { font-family: var(--mono); font-size: 0.92em; }
.stack-4 > * + * { margin-top: var(--sp-4); }
.stack-3 > * + * { margin-top: var(--sp-3); }

/* Access Log */
.log-section { margin-bottom: var(--sp-6); }
.log-table { border: 1px solid var(--rule); border-radius: var(--radius); overflow: hidden; }
.log-row {
  display: grid;
  grid-template-columns: 200px 1fr 1fr;
  gap: var(--sp-3);
  align-items: center;
  padding: 9px var(--sp-4);
  background: var(--surface);
  border-top: 1px solid var(--rule);
  font-size: 13.5px;
}
.log-row:first-of-type { border-top: none; }
.log-head-row {
  background: var(--surface-sunk);
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--ink-soft);
}
.log-when { color: var(--ink-soft); font-variant-numeric: tabular-nums; white-space: nowrap; }
.log-row.is-refused:not(.log-head-row) { color: var(--rose); }

/* ------------------------------------------------ missionary activity -- */

.ma-list-head, .ma-row {
  display: grid;
  grid-template-columns: minmax(160px, 1.2fr) 90px 90px 100px 120px repeat(7, 44px);
  gap: var(--sp-2);
  align-items: center;
  padding: 8px var(--sp-3);
}
.ma-list-head {
  background: var(--surface-sunk);
  font-size: 11.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--ink-soft);
  border-radius: var(--radius) var(--radius) 0 0;
}
.ma-day-head { text-align: center; }
.ma-row { background: var(--surface); border: 1px solid var(--rule); border-top: none; }
.ma-row:last-child { border-radius: 0 0 var(--radius) var(--radius); }
.ma-cell { font-size: 13.5px; color: var(--ink-mid); overflow-wrap: break-word; }
.ma-name { font-size: 14px; color: var(--ink); }
.ma-day-cell { display: flex; justify-content: center; }
.ma-day-cell input { accent-color: var(--gold-deep); margin: 0; }

/* Missionary Activity's report table has 6 columns (no Midweek/Weekend
   split); the shared .att-report-table grid assumes 7, so this overrides
   the column template rather than duplicating the whole block. */
.ma-report-table .att-report-head-row,
.ma-report-table .att-report-row {
  grid-template-columns: minmax(170px, 1.3fr) 90px 90px 100px 120px minmax(140px, 1fr);
}

@media (max-width: 900px) {
  .ma-list-head, .ma-row {
    grid-template-columns: 160px 90px 90px 100px 120px repeat(7, 44px);
    width: max-content;
    min-width: 100%;
  }
  .ma-report-table .att-report-head-row,
  .ma-report-table .att-report-row {
    grid-template-columns: 170px 90px 90px 100px 120px 140px;
    width: max-content;
    min-width: 100%;
  }
}

/* -------------------------------------------------------- visitation -- */

/* One tick and one note per member, so the row is the missionary grid with
   the seven day columns replaced by a single tick and a note field wide
   enough to actually write in. */
.vis-list-head, .vis-row {
  display: grid;
  grid-template-columns: minmax(160px, 1.2fr) 90px 90px 100px 120px 120px 64px minmax(200px, 1.4fr);
  gap: var(--sp-2);
  align-items: center;
  padding: 8px var(--sp-3);
}
.vis-list-head {
  background: var(--surface-sunk);
  font-size: 11.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--ink-soft);
  border-radius: var(--radius) var(--radius) 0 0;
}
.vis-tick-head { text-align: center; }
.vis-row { background: var(--surface); border: 1px solid var(--rule); border-top: none; }
.vis-row:last-child { border-radius: 0 0 var(--radius) var(--radius); }
.vis-cell { font-size: 13.5px; color: var(--ink-mid); overflow-wrap: break-word; }
.vis-name { font-size: 14px; color: var(--ink); }
.vis-tick-cell { display: flex; justify-content: center; }
.vis-tick-cell input { accent-color: var(--green-deep); margin: 0; width: 18px; height: 18px; }
.vis-note-cell .input { width: 100%; }
.input-sm { padding: 5px 8px; font-size: 13px; }

/* A ticked row is tinted, so a long list reads at a glance as "who is still
   outstanding" rather than needing every checkbox inspected. */
.vis-row-done { background: var(--green-wash); }

.vis-report-table .att-report-head-row,
.vis-report-table .att-report-row {
  grid-template-columns: minmax(170px, 1.2fr) 90px 90px 90px 110px 110px minmax(130px, 1fr) minmax(160px, 1.2fr);
}
.vis-notes-cell { color: var(--ink-soft); font-size: 12.5px; }

@media (max-width: 900px) {
  .vis-list-head, .vis-row {
    grid-template-columns: 160px 90px 90px 100px 120px 120px 64px 220px;
    width: max-content;
    min-width: 100%;
  }
  .vis-report-table .att-report-head-row,
  .vis-report-table .att-report-row {
    grid-template-columns: 170px 90px 90px 90px 110px 110px 130px 180px;
    width: max-content;
    min-width: 100%;
  }
}

/* ------------------------------------------------- profile history tab -- */

.ph-filter-head { margin-bottom: var(--sp-2); }
.ph-month-row { display: flex; flex-wrap: wrap; gap: var(--sp-2); margin-bottom: var(--sp-3); }
.ph-month-btn { background: var(--surface); }

.ph-week-chips { margin-bottom: var(--sp-2); }
.ph-chips { display: flex; flex-wrap: wrap; gap: var(--sp-2); }
.ph-chip {
  font: inherit;
  font-size: 12.5px;
  padding: 4px 10px;
  border: 1px solid var(--rule-strong);
  border-radius: 999px;
  background: var(--gold-wash);
  color: var(--gold-deep);
  cursor: pointer;
}
.ph-chip:hover { background: var(--rose-wash); color: var(--rose); border-color: var(--rose-rule); }
.ph-chip::after { content: " \\00d7"; }

.ph-table { border: 1px solid var(--rule); border-radius: var(--radius); overflow-x: auto; }
.ph-row { display: flex; align-items: stretch; border-top: 1px solid var(--rule); }
.ph-row:first-child { border-top: none; }
.ph-rowlabel {
  flex: 0 0 170px;
  padding: 8px var(--sp-3);
  font-size: 13px;
  color: var(--ink-mid);
  background: var(--surface-sunk);
  display: flex;
  align-items: center;
}
.ph-head .ph-rowlabel { background: var(--surface-sunk); }
.ph-cell {
  flex: 1 1 90px;
  min-width: 90px;
  padding: 8px 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  font-size: 12.5px;
  border-left: 1px solid var(--rule);
}
.ph-headcell {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  color: var(--ink-soft);
  background: var(--surface-sunk);
}
.ph-reason-row .ph-cell { color: var(--ink-mid); font-size: 12px; }
.ph-reason-row .ph-rowlabel { color: var(--ink-soft); font-style: italic; font-size: 12px; }

.ph-status { min-height: 32px; }
.ph-attended { background: var(--green-wash); color: var(--green-deep); }
.ph-absent   { background: var(--rose-wash);  color: var(--rose); }
.ph-neutral  { background: var(--surface-sunk); color: var(--ink-faint); }

/*
 * A week after the member was deactivated.
 *
 * Faded rather than recoloured: these cells still hold whatever they held,
 * but nothing was being tracked then, so they must not read as a finding.
 * Stripes carry that on their own for anyone who cannot tell the fade from
 * an ordinary neutral cell.
 */
.ph-untracked {
  opacity: 0.38;
  background-image: repeating-linear-gradient(
    135deg,
    transparent 0 5px,
    rgba(0, 0, 0, 0.05) 5px 10px
  );
}
.ph-untracked-label {
  background: var(--surface-sunk);
  color: var(--ink-faint);
  font-style: italic;
}

.ph-picker-row { display: flex; gap: var(--sp-3); flex-wrap: wrap; align-items: flex-end; }
.ph-picker-row .field { min-width: 160px; flex: none; }

.ph-removed-panel {
  margin-top: var(--sp-2);
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  padding: var(--sp-3) var(--sp-4);
}
.ph-removed-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 0;
  font-size: 13.5px;
  border-bottom: 1px solid var(--rule);
}
.ph-removed-row:last-child { border-bottom: none; }

/* An unrecorded row is a to-do, not a result — muted rather than coloured
   like the real outcomes beside it. */
.att-opt-pending span { color: var(--ink-soft); font-style: italic; }
.att-pending-jump { margin-left: auto; }
.att-pending-note { color: var(--ink-soft); font-style: italic; }

/* Congregation suggestions, shown rather than hidden behind a datalist. */
.att-suggest-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin-top: 6px;
}
.att-suggest-label { font-size: 11.5px; color: var(--ink-soft); }
.att-suggest-chip {
  font: inherit;
  font-size: 12px;
  padding: 3px 9px;
  border: 1px solid var(--rule-strong);
  border-radius: 999px;
  background: var(--surface);
  color: var(--ink-mid);
  cursor: pointer;
}
.att-suggest-chip:hover {
  background: var(--gold-wash);
  border-color: var(--gold-deep);
  color: var(--gold-deep);
}

/* Which build of each half is running. Grey and ignorable when they match,
   which is the normal case; the mismatch state is carried by a banner as
   well, because a footnote is not where you notice something is wrong. */
.footer-build {
  margin-top: 4px;
  font-size: 11.5px;
  color: var(--ink-faint);
  font-variant-numeric: tabular-nums;
}
.footer-build-warn {
  color: var(--rose);
  font-weight: 500;
}
