/* style.css — CRC Attendance
   A paper attendance register, brought up to date: ruled rows and banded
   structures, but with real depth, generous spacing and a layout that works
   as well in one hand as on a desk. */

:root {
  /* surfaces */
  --paper:      #f2f4f1;
  --paper-deep: #e8ebe6;
  --card:       #ffffff;
  --rule:       #e2e6df;
  --rule-strong:#c3cabf;

  /* ink */
  --ink:        #16201c;
  --ink-soft:   #5f6d66;
  --ink-faint:  #8d978f;

  /* accents */
  --green:      #14584a;
  --green-lift: #1b7a65;
  --green-wash: #e8f0ec;
  --amber:      #a8701a;
  --amber-wash: #faf0dd;
  --red:        #a33124;
  --red-wash:   #fbeae7;

  /* shape */
  --radius:     10px;
  --radius-sm:  7px;
  --radius-pill:999px;

  /* depth */
  --shadow-sm:  0 1px 2px rgba(16, 32, 26, .06);
  --shadow:     0 1px 2px rgba(16, 32, 26, .05), 0 4px 14px -6px rgba(16, 32, 26, .12);
  --shadow-lg:  0 10px 40px -12px rgba(16, 32, 26, .28), 0 2px 8px rgba(16, 32, 26, .08);
  --ring:       0 0 0 3px rgba(27, 122, 101, .28);

  /* motion */
  --ease:       cubic-bezier(.4, 0, .2, 1);
  --fast:       .15s var(--ease);
  --slow:       .28s var(--ease);
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 15px/1.55 -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto,
        "Helvetica Neue", Arial, sans-serif;
  font-feature-settings: "kern", "liga";
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 { font-weight: 650; letter-spacing: -.018em; margin: 0 0 .5rem; line-height: 1.22; }
h1 { font-size: clamp(1.4rem, 1.15rem + 1vw, 1.75rem); }
h2 { font-size: 1.15rem; margin-top: 2rem; }
h3 { font-size: .98rem; }
h4 { font-size: .88rem; }

a { color: var(--green); text-underline-offset: 2px; }
a:hover { color: var(--green-lift); }
.muted { color: var(--ink-soft); font-size: .88rem; }

:focus-visible {
  outline: 2px solid var(--green-lift);
  outline-offset: 2px;
  border-radius: 4px;
}

/* ---------- shell ---------- */

.topbar {
  position: sticky; top: 0; z-index: 60;
  display: flex; align-items: center; gap: 1rem;
  background: var(--green); color: #eef3f0;
  padding: .55rem 1.1rem;
  box-shadow: 0 1px 0 rgba(0,0,0,.08), 0 2px 12px -6px rgba(0,0,0,.4);
}
.topbar a { color: #cfe0d9; text-decoration: none; }
.logo {
  display: flex; align-items: center; gap: .55rem;
  font-weight: 650; color: #fff !important; letter-spacing: -.01em;
  white-space: nowrap;
}
.topbar nav { display: flex; gap: .2rem; flex: 1; }
.topbar nav a {
  padding: .4rem .8rem; border-radius: var(--radius-pill); font-size: .9rem;
  transition: background-color var(--fast), color var(--fast);
}
.topbar nav a:hover { background: rgba(255,255,255,.13); color: #fff; }
.topbar nav a.on { background: #fff; color: var(--green) !important; font-weight: 600; }
.who { display: flex; align-items: center; gap: .8rem; font-size: .85rem; }
.who span { opacity: .8; }
.who a:hover { color: #fff; }

.nav-toggle {
  display: none; background: none; border: 0; color: #fff;
  font-size: 1.25rem; line-height: 1; cursor: pointer;
  padding: .45rem .5rem; border-radius: var(--radius-sm);
  transition: background-color var(--fast);
}
.nav-toggle:hover { background: rgba(255,255,255,.14); }
.nav-backdrop { display: none; }

.brand-mark {
  display: inline-grid; place-items: center;
  width: 46px; height: 46px; border-radius: 50%;
  background: var(--green); color: #fff;
  font-weight: 700; letter-spacing: .06em; font-size: .95rem;
}
.brand-mark.small {
  width: 27px; height: 27px; font-size: .62rem;
  background: rgba(255,255,255,.16); box-shadow: inset 0 0 0 1px rgba(255,255,255,.25);
}

main { max-width: 1240px; margin: 0 auto; padding: 1.6rem 1.1rem 4rem; }
main > h1:first-child { margin-bottom: .9rem; }

.foot {
  max-width: 1240px; margin: 0 auto; padding: 1.2rem 1.1rem 2rem;
  display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap;
  border-top: 1px solid var(--rule); color: var(--ink-faint); font-size: .8rem;
}
.foot button.linky {
  background: none; border: 0; padding: 0; font: inherit;
  color: var(--green); cursor: pointer; text-decoration: underline;
}

/* ---------- standalone pages ---------- */

body.plain { display: grid; place-items: start center; padding: clamp(1.5rem, 6vh, 4rem) 1rem; }
.card-wrap {
  background: var(--card); border: 1px solid var(--rule); border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: clamp(1.25rem, 4vw, 2rem); width: 100%; max-width: 720px;
}
.card-wrap.narrow { max-width: 400px; text-align: left; }

/* ---------- forms ---------- */

label { display: block; margin: .8rem 0; font-size: .85rem; font-weight: 500; color: var(--ink-soft); }
label.check { display: flex; gap: .55rem; align-items: flex-start; color: var(--ink); font-weight: 400; }
label.check input { margin-top: .25rem; flex: none; }

input[type=text], input[type=email], input[type=password], input[type=number],
input[type=date], input[type=search], input[type=tel], select, textarea {
  display: block; width: 100%; margin-top: .3rem;
  padding: .55rem .7rem;
  border: 1px solid var(--rule-strong); border-radius: var(--radius-sm);
  background: #fff; color: var(--ink); font: inherit;
  transition: border-color var(--fast), box-shadow var(--fast);
}
input:hover:not(:disabled), select:hover:not(:disabled), textarea:hover { border-color: #a8b2a6; }
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--green-lift); box-shadow: var(--ring);
}
select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%235f6d66' d='M1 1.5 6 6.5l5-5'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right .65rem center;
  padding-right: 2rem;
}
textarea { min-height: 90px; resize: vertical; }
input[type=file] { font-size: .9rem; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .4rem;
  border: 1px solid transparent; border-radius: var(--radius-sm);
  background: var(--green); color: #fff;
  padding: .55rem 1.1rem; min-height: 40px;
  font: inherit; font-weight: 600; line-height: 1.2;
  cursor: pointer; text-decoration: none; margin-top: .5rem;
  box-shadow: var(--shadow-sm);
  transition: background-color var(--fast), box-shadow var(--fast), transform var(--fast);
}
.btn:hover { background: var(--green-lift); color: #fff; box-shadow: var(--shadow); }
.btn:active { transform: translateY(1px); box-shadow: none; }
.btn.ghost {
  background: #fff; color: var(--green); border-color: var(--rule-strong); box-shadow: var(--shadow-sm);
}
.btn.ghost:hover { background: var(--green-wash); border-color: var(--green-lift); color: var(--green); }
.btn.small { padding: .32rem .7rem; min-height: 32px; font-size: .85rem; font-weight: 550; }
.btn.danger { background: var(--red); }
.btn.danger:hover { background: #bb3a2b; }

.filters {
  display: flex; gap: .8rem; flex-wrap: wrap; align-items: flex-end;
  background: var(--card); border: 1px solid var(--rule); border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: .9rem 1rem; margin-bottom: 1.3rem;
}
.filters label { margin: 0; }
.filters .btn { margin-top: 0; }

/* ---------- alerts ---------- */

.alert {
  border: 1px solid var(--rule); border-left: 4px solid var(--green);
  background: var(--card); box-shadow: var(--shadow-sm);
  padding: .75rem 1rem; margin-bottom: 1.3rem; border-radius: var(--radius-sm);
}
.alert.bad  { border-left-color: var(--red);   background: var(--red-wash); border-color: #f0d6d1; }
.alert.warn { border-left-color: var(--amber); background: var(--amber-wash); border-color: #efe2c8; }
.alert.ok   { border-left-color: var(--green); background: var(--green-wash); border-color: #d4e4db; }

/* ---------- stat row ---------- */

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(158px, 1fr)); gap: .8rem; margin-bottom: 1.6rem; }
.stat {
  background: var(--card); border: 1px solid var(--rule); border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: .95rem 1.05rem;
  transition: box-shadow var(--fast), transform var(--fast);
}
.stat:hover { box-shadow: var(--shadow); }
.stat .n { font-size: 1.85rem; font-weight: 650; font-variant-numeric: tabular-nums; line-height: 1.08; letter-spacing: -.02em; }
.stat .k { font-size: .7rem; text-transform: uppercase; letter-spacing: .08em; color: var(--ink-faint); font-weight: 600; }
.stat .d { font-size: .8rem; color: var(--ink-soft); margin-top: .25rem; }

/* ---------- the register table ---------- */

.sheet-wrap {
  overflow-x: auto; -webkit-overflow-scrolling: touch;
  background: var(--card); border: 1px solid var(--rule); border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}

table.sheet { border-collapse: collapse; width: 100%; font-size: .88rem; }
table.sheet th, table.sheet td { padding: .55rem .7rem; text-align: left; border-bottom: 1px solid var(--rule); }
table.sheet tbody tr:last-child td { border-bottom: 0; }
table.sheet thead th {
  position: sticky; top: 0; z-index: 2;
  background: var(--paper-deep); border-bottom: 1px solid var(--rule-strong);
  font-size: .7rem; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-soft);
  font-weight: 650; white-space: nowrap;
}
table.sheet td.num, table.sheet th.num { text-align: right; font-variant-numeric: tabular-nums; }
table.sheet tbody tr { transition: background-color var(--fast); }
table.sheet tbody tr:hover { background: #f7faf7; }

/* structure band — the signature device: a heavy rule opening each overseer's block */
tr.band td {
  background: var(--green-wash); color: var(--green);
  font-weight: 650; font-size: .76rem; text-transform: uppercase; letter-spacing: .07em;
  border-top: 2px solid var(--green); border-bottom: 1px solid var(--rule-strong);
}
tr.subtotal td { background: #f3f6f2; font-weight: 650; border-bottom: 2px solid var(--rule-strong); }
tr.total td { background: var(--green); color: #fff; font-weight: 650; }
td.zero, .zero { color: var(--ink-faint); }
td.name { font-weight: 550; }

.sticky-col { position: sticky; left: 0; background: var(--card); z-index: 1; }
thead .sticky-col { background: var(--paper-deep); z-index: 3; }
tr.band .sticky-col { background: var(--green-wash); }
tr.subtotal .sticky-col { background: #f3f6f2; }
tr.total .sticky-col { background: var(--green); }
table.sheet tbody tr:hover .sticky-col { background: #f7faf7; }

/* count inputs on the capture grid */
input.count {
  width: 72px; margin: 0; padding: .35rem .4rem; text-align: right;
  font-variant-numeric: tabular-nums; font-size: .95rem;
}
input.count:placeholder-shown { background: #fcfcfa; }

/* name register toggles */
.roll { display: flex; gap: .3rem; }
.roll input { position: absolute; opacity: 0; width: 0; }
.roll label {
  margin: 0; padding: .35rem .75rem; border: 1px solid var(--rule-strong); border-radius: var(--radius-pill);
  cursor: pointer; font-size: .82rem; color: var(--ink-soft); background: #fff; user-select: none;
  transition: background-color var(--fast), color var(--fast), border-color var(--fast);
}
.roll input:checked + label { background: var(--green); border-color: var(--green); color: #fff; font-weight: 600; }
.roll input[value=absent]:checked + label { background: var(--red); border-color: var(--red); }
.roll input[value=apology]:checked + label { background: var(--amber); border-color: var(--amber); }
.roll input:focus-visible + label { outline: 2px solid var(--green-lift); outline-offset: 1px; }

.tag {
  display: inline-block; padding: .14rem .55rem; border-radius: var(--radius-pill);
  background: var(--green-wash); color: var(--green); font-size: .72rem; font-weight: 600;
  text-decoration: none;
}
a.tag:hover { background: #d9e8e0; color: var(--green); }
.tag.grey { background: #e9ebe8; color: var(--ink-soft); }
.tag.amber { background: var(--amber-wash); color: var(--amber); }

.pager { display: flex; gap: .4rem; align-items: center; margin-top: 1.2rem; flex-wrap: wrap; }
.pager a, .pager span {
  padding: .4rem .7rem; border: 1px solid var(--rule); border-radius: var(--radius-sm);
  text-decoration: none; background: #fff; font-size: .85rem; min-width: 38px; text-align: center;
  transition: background-color var(--fast), border-color var(--fast);
}
.pager a:hover { background: var(--green-wash); border-color: var(--green-lift); }
.pager .on { background: var(--green); color: #fff; border-color: var(--green); font-weight: 600; }

.sticky-save {
  position: sticky; bottom: 0; background: var(--card); z-index: 10;
  border-top: 2px solid var(--green); padding: .8rem 1rem;
  display: flex; gap: 1rem; align-items: center; justify-content: space-between; flex-wrap: wrap;
  margin-top: 0;
  box-shadow: 0 -6px 18px -12px rgba(16,32,26,.5);
}
.sticky-save .btn { margin-top: 0; }
.running { font-variant-numeric: tabular-nums; font-weight: 650; }

.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 1rem; }
.panel {
  background: var(--card); border: 1px solid var(--rule); border-radius: var(--radius);
  box-shadow: var(--shadow-sm); padding: 1.1rem 1.2rem;
}

.install-log .log-item {
  border: 1px solid var(--rule); border-left: 3px solid var(--green);
  border-radius: var(--radius-sm);
  padding: .55rem .85rem; margin-bottom: .5rem; background: #fff; font-size: .9rem;
}
.install-log .log-item.bad { border-left-color: var(--red); background: var(--red-wash); }
.install-log .err { color: var(--red); font-size: .8rem; margin-top: .3rem; font-family: ui-monospace, Menlo, Consolas, monospace; }

dl.detail { display: grid; grid-template-columns: minmax(120px, 30%) 1fr; gap: .4rem .9rem; margin: 0; font-size: .9rem; }
dl.detail dt { color: var(--ink-soft); }
dl.detail dd { margin: 0; }

/* ---------- what's new ---------- */

.modal-backdrop {
  position: fixed; inset: 0; z-index: 200;
  background: rgba(14, 24, 20, .5);
  display: grid; place-items: center; padding: 1rem;
  animation: fade-in .18s var(--ease);
}
.modal {
  background: var(--card); border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  width: 100%; max-width: 480px; max-height: min(78vh, 640px);
  display: flex; flex-direction: column; overflow: hidden;
  animation: modal-in .24s var(--ease);
}
.modal-head {
  padding: 1.1rem 1.25rem .8rem;
  border-bottom: 1px solid var(--rule);
}
.modal-head .eyebrow {
  font-size: .68rem; text-transform: uppercase; letter-spacing: .1em;
  color: var(--green); font-weight: 700;
}
.modal-head h2 { margin: .25rem 0 0; font-size: 1.2rem; }
.modal-head .when { color: var(--ink-faint); font-size: .8rem; margin-top: .2rem; }
.modal-body { padding: .9rem 1.25rem; overflow-y: auto; }
.modal-body ul { margin: 0 0 1rem; padding-left: 1.1rem; }
.modal-body li { margin-bottom: .45rem; font-size: .92rem; }
.modal-body li::marker { color: var(--green-lift); }
.modal-body .rel + .rel { margin-top: .4rem; padding-top: .9rem; border-top: 1px solid var(--rule); }
.modal-body .rel h3 { font-size: .85rem; color: var(--ink-soft); }
.modal-foot {
  padding: .9rem 1.25rem; border-top: 1px solid var(--rule);
  display: flex; justify-content: flex-end; gap: .6rem; background: #fbfcfa;
}
.modal-foot .btn { margin-top: 0; }

@keyframes fade-in { from { opacity: 0; } }
@keyframes modal-in { from { opacity: 0; transform: translateY(12px) scale(.98); } }

/* ---------- mobile ---------- */

@media (max-width: 840px) {
  .nav-toggle { display: block; order: 3; margin-left: auto; }
  .logo { order: 1; }

  .topbar nav {
    position: fixed; top: 0; right: 0; bottom: 0; z-index: 70;
    width: min(76vw, 300px);
    flex-direction: column; gap: .2rem;
    background: var(--green); padding: 4.2rem 1rem 1rem;
    box-shadow: var(--shadow-lg);
    transform: translateX(100%);
    transition: transform var(--slow);
    overflow-y: auto;
  }
  body.nav-open .topbar nav { transform: translateX(0); }
  .topbar nav a { padding: .8rem 1rem; border-radius: var(--radius-sm); font-size: 1rem; }

  .nav-backdrop {
    display: block; position: fixed; inset: 0; z-index: 65;
    background: rgba(10, 18, 15, .45);
    opacity: 0; pointer-events: none; transition: opacity var(--slow);
  }
  body.nav-open .nav-backdrop { opacity: 1; pointer-events: auto; }
  body.nav-open { overflow: hidden; }

  .who { order: 2; margin-left: auto; }
  .who span { display: none; }

  main { padding: 1.1rem .8rem 3.5rem; }
  h2 { margin-top: 1.5rem; }
  input.count { width: 60px; }

  /* 16px stops iOS zooming the page when a field takes focus */
  input[type=text], input[type=email], input[type=password], input[type=number],
  input[type=date], input[type=search], input[type=tel], select, textarea { font-size: 16px; }

  table.sheet th, table.sheet td { padding: .5rem .55rem; }
  .stats { grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: .6rem; }
  .stat .n { font-size: 1.55rem; }
  /* two columns instead of one tall stack, so the list is not pushed off screen */
  .filters {
    display: grid; grid-template-columns: 1fr 1fr;
    gap: .6rem .7rem; align-items: end; padding: .8rem;
  }
  .filters > label:first-of-type { grid-column: 1 / -1; }
  .filters > .btn, .filters > a.btn { width: 100%; }

  /* keep rows on one line and let the table scroll sideways, rather than
     squeezing every column until the words break up */
  table.sheet th, table.sheet td { white-space: nowrap; }
  table.sheet td .tag { max-width: 46vw; overflow: hidden; text-overflow: ellipsis; vertical-align: bottom; }
  .modal { max-height: 86vh; }
}

@media (max-width: 420px) {
  .btn { width: 100%; }
  .btn.small, .filters .btn, .pager a, .tag, a.tag { width: auto; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important; animation-iteration-count: 1 !important;
    transition-duration: .01ms !important; scroll-behavior: auto !important;
  }
}

/* ---------- import progress ---------- */

.run-row {
  border: 1px solid var(--rule); border-radius: var(--radius);
  padding: .8rem 1rem; margin-bottom: .6rem; background: #fff;
}
.run-head { display: flex; align-items: center; gap: .6rem; }
.run-name { flex: 1; font-weight: 500; }
.run-name .muted { font-weight: 400; display: block; font-size: .8rem; }
.run-count { font-variant-numeric: tabular-nums; white-space: nowrap; }

.run-dot {
  width: 11px; height: 11px; border-radius: 50%;
  background: var(--rule-strong); flex: none;
}
.run-row.running .run-dot { background: var(--green); }
.run-row.finished .run-dot { background: var(--green); }
.run-row.finished .run-dot::after {
  content: "✓"; display: block; color: #fff; font-size: 8px;
  line-height: 11px; text-align: center;
}

.run-bar {
  height: 6px; border-radius: 3px; background: #e7ebe6;
  margin: .6rem 0 .4rem; overflow: hidden;
}
.run-fill {
  height: 100%; width: 0; border-radius: 3px;
  background: var(--green);
  transition: width .35s ease;
}
.run-stats { font-size: .82rem; min-height: 1.1em; font-variant-numeric: tabular-nums; }

@media (prefers-reduced-motion: no-preference) {
  .run-row.running .run-dot { animation: run-pulse 1.1s ease-in-out infinite; }
  .run-row.running .run-fill {
    background-image: linear-gradient(100deg, transparent 40%, rgba(255,255,255,.45) 50%, transparent 60%);
    background-size: 220% 100%;
    animation: run-sheen 1.3s linear infinite;
  }
  .run-row.finished { animation: run-settle .4s ease; }
}
@keyframes run-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(20,88,74,.45); }
  50%      { box-shadow: 0 0 0 5px rgba(20,88,74,0); }
}
@keyframes run-sheen { from { background-position: 120% 0; } to { background-position: -120% 0; } }
@keyframes run-settle { from { background: #eef4f0; } to { background: #fff; } }

@media (prefers-reduced-motion: reduce) {
  .run-fill { transition: none; }
}

/* ---------- the structure fork ---------- */

.orgtree { min-width: 780px; padding: .5rem 0 0; }
.orgtree ul {
  display: flex; justify-content: center;
  list-style: none; margin: 0; padding: 0;
  position: relative;
}
.orgtree ul ul { padding-top: 24px; }

/* the stub down from a parent box to its children's rail */
.orgtree ul ul::before {
  content: ""; position: absolute; top: 0; left: 50%;
  width: 0; height: 24px; border-left: 2px solid #b03a2e;
  transform: translateX(-1px);
}

.orgtree li {
  display: flex; flex-direction: column; align-items: center;
  position: relative; padding: 24px 8px 0;
}

/* each child: half a horizontal rail on either side, and a stub down to its own box */
.orgtree li::before, .orgtree li::after {
  content: ""; position: absolute; top: 0; height: 24px; width: 50%;
}
.orgtree li::before { right: 50%; border-top: 2px solid #b03a2e; }
.orgtree li::after  { left: 50%;  border-top: 2px solid #b03a2e; border-left: 2px solid #b03a2e; }

/* the outer ends of the rail stop at the outer children */
.orgtree li:first-child::before { border-top: 0 none; }
.orgtree li:last-child::after   { border-top: 0 none; }

/* a lone child needs no rail, just its stub (handled by ::after's border-left) */
.orgtree li:only-child::before { border-top: 0 none; }

/* the overseer sits on top of everything, no connectors above it */
.orgtree > ul > li { padding-top: 0; }
.orgtree > ul > li::before, .orgtree > ul > li::after { display: none; }

.t-box {
  border: 1px solid var(--rule-strong); border-radius: 6px; background: #fff;
  padding: .45rem .6rem; min-width: 128px; max-width: 168px; text-align: center;
  display: flex; flex-direction: column; gap: .15rem; box-shadow: 0 1px 0 rgba(0,0,0,.04);
}
.t-role { font-size: .62rem; letter-spacing: .08em; text-transform: uppercase; color: #8a8577; }
.t-overseer { background: var(--green); border-color: var(--green); }
.t-overseer strong { color: #fff; }
.t-overseer .t-role { color: rgba(255,255,255,.75); }
.t-sup { border-color: var(--green); }
.t-coord { border-color: #b7791f; }
.t-hc strong a { text-decoration: none; }
.t-empty { border-style: dashed; background: #fbfaf6; }
.t-form input[type=text], .t-form select { width: 100%; font-size: .82rem; padding: .25rem .35rem; }

/* ---------- the weekly dashboard sheet ---------- */

.dash-top { display: flex; gap: 1rem; align-items: flex-start; margin-bottom: .8rem; }
.dash-title { flex: 0 0 240px; display: flex; flex-direction: column; gap: .4rem; }
.dash-title strong { font-size: 1.05rem; }
.dash-chart { flex: 1; min-width: 0; border: 1px solid var(--rule-strong); border-radius: 6px; padding: .4rem .6rem .1rem; }
.dash-chart-title { font-size: .68rem; text-align: center; color: #8a8577; letter-spacing: .04em; }

.m-row { display: inline-flex; align-items: center; gap: 0; margin: 1px 0; }
.m-chip {
  font-size: .6rem; letter-spacing: .03em; color: #fff; padding: 2px 5px;
  border-radius: 3px 0 0 3px; white-space: nowrap; min-width: 44px; text-align: right;
}
.m-in {
  width: 44px; font-size: .72rem; padding: 2px 4px; border: 1px solid var(--rule-strong);
  border-left: none; border-radius: 0 3px 3px 0; text-align: center;
}
.m-in.wide { width: 70px; }

.m-blue    { background: #2e6da4; } .m-navy   { background: #1f3a5f; }
.m-purple  { background: #6f42c1; } .m-magenta{ background: #c2185b; }
.m-green   { background: #2e7d32; } .m-gold   { background: #b7791f; }
.m-orange  { background: #d9722b; } .m-pink   { background: #d16ba5; }
.m-yellow  { background: #b5a300; } .m-brown  { background: #8d6e63; }
.m-grey    { background: #7a7a72; } .m-sky    { background: #3aa7d9; }

.dash-tree .t-box { min-width: 118px; max-width: 150px; padding: .35rem .45rem; gap: 1px; }
.dash-tree .t-role { font-size: .56rem; }
.dash-tree strong { font-size: .8rem; }

.dash-totals {
  display: grid; grid-template-columns: repeat(4, minmax(150px, 1fr));
  gap: .8rem; margin-top: 1rem; border-top: 2px solid #b03a2e; padding-top: .8rem;
}
.dash-totals h4 { margin: 0 0 .3rem; font-size: .78rem; }
.dash-totals .m-row { display: flex; justify-content: space-between; gap: 0; }
.dash-totals .m-chip { flex: 1; max-width: 150px; text-align: right; }
.dash-totals .m-in { width: 56px; }
.dash-comments { margin-top: .8rem; }
.dash-comments h4 { margin: 0 0 .3rem; font-size: .78rem; }
.dash-comments textarea { width: 100%; border: 1px solid var(--rule-strong); border-radius: 4px; padding: .4rem; }

/* ---------- printing the sheet ---------- */
.dash-sheet, .dash-sheet * {
  -webkit-print-color-adjust: exact;
  print-color-adjust: exact;               /* keep the chip and box colours on paper */
}
@media print {
  @page { size: A4 landscape; margin: 6mm; }
  header, .no-print, footer, .alert { display: none !important; }
  html, body { background: #fff; font-size: 12px; }
  main, .wrap { padding: 0 !important; margin: 0 !important; max-width: none !important; }
  .panel.dash-sheet { border: none; box-shadow: none; padding: 0; margin: 0; }

  /* everything below exists to land the sheet on ONE landscape page, like the original */
  .dash-sheet { zoom: .9; }

  .dash-top { margin-bottom: .4rem; gap: .6rem; }
  .dash-title { flex-basis: 190px; }
  .dash-chart { border-color: #999; }

  .orgtree { min-width: 0; }
  .orgtree ul ul { padding-top: 12px; }
  .orgtree ul ul::before { height: 12px; }
  .orgtree li { padding: 12px 3px 0; }
  .orgtree li::before, .orgtree li::after { height: 12px; }

  .dash-tree ul { justify-content: space-between; }
  .dash-tree .t-box { min-width: 100px; max-width: 134px; padding: .2rem .3rem; gap: 0; }
  .dash-totals .m-chip { max-width: 120px; }
  .dash-totals .m-in { width: 44px; }
  .dash-tree strong { font-size: .66rem; }
  .dash-tree .t-role { font-size: .48rem; }
  .m-chip { min-width: 34px; font-size: .5rem; padding: 1px 3px; }
  .m-in { width: 30px; font-size: .6rem; padding: 0 2px; border-color: #999; }

  .dash-totals { grid-template-columns: repeat(4, 1fr); gap: .4rem; margin-top: .4rem; padding-top: .4rem; }
  .dash-totals h4, .dash-comments h4 { margin-bottom: .15rem; font-size: .68rem; }
  .dash-comments { margin-top: .4rem; }
  .dash-comments textarea { border-color: #999; min-height: 42px; }
}

.t-clear {
  border: 1px solid var(--rule-strong); background: #fbfaf6; color: #8a4a42;
  border-radius: 4px; font-size: .68rem; padding: 2px 8px; cursor: pointer; width: 100%;
}
.t-clear:hover { border-color: #b03a2e; color: #b03a2e; }
@media print { .t-clear { display: none; } }

/* ---------- the structure page: sidebar + chart ---------- */

.struct-layout { display: flex; gap: 1rem; align-items: flex-start; }
.struct-chart { flex: 1; min-width: 0; }

.side-panel {
  flex: 0 0 236px; position: sticky; top: 1rem;
  max-height: calc(100vh - 2rem); overflow: hidden;
  display: flex; flex-direction: column; gap: .5rem;
  border: 1px solid var(--rule); border-radius: var(--radius);
  background: #fff; padding: .7rem;
}
.side-tabs { display: flex; gap: 2px; }
.side-tab {
  flex: 1; border: 1px solid var(--rule-strong); background: #fbfaf6;
  font-size: .72rem; padding: .3rem .2rem; cursor: pointer; border-radius: 4px;
}
.side-tab.active { background: var(--green); border-color: var(--green); color: #fff; }
.side-hint { font-size: .74rem; margin: 0; }
#sideSearch { width: 100%; font-size: .82rem; padding: .3rem .45rem; }

.chip-list { overflow-y: auto; display: flex; flex-direction: column; gap: 4px; min-height: 0; }
.chip {
  border: 1px solid var(--rule-strong); border-radius: 5px; background: #fff;
  padding: .3rem .5rem; font-size: .8rem; cursor: grab; line-height: 1.25;
}
.chip:active { cursor: grabbing; }
.chip .muted { display: block; font-size: .7rem; }
.chip:hover { border-color: var(--green); }

[data-drop].drop-ok { outline: 2px dashed var(--green); outline-offset: 2px; background: #eef4f0; }

@media (max-width: 900px) {
  .struct-layout { flex-direction: column; }
  .side-panel { position: static; max-height: 300px; width: 100%; flex-basis: auto; }
}
@media print { .side-panel { display: none !important; } }

/* ---------- wide pages and the collapsible side list ---------- */
main.wide { max-width: none; padding-left: 1.2rem; padding-right: 1.2rem; }
.struct-layout.side-hidden .side-panel { display: none; }
.struct-chart { overflow-x: auto; }   /* fallback when the fit floor is reached */

/* ---------- the GOALS block on the dashboard sheet ---------- */
.goals-block { margin-top: 1.2rem; border-top: 2px solid #b03a2e; padding-top: .8rem; }
.goals-head { display: flex; gap: 1.2rem; align-items: center; flex-wrap: wrap; margin-bottom: .5rem; }
.goals-table { max-width: 860px; }
.goals-table th.goals-group { text-align: center; font-size: .9rem; letter-spacing: .02em; }
.goals-table td.num { font-variant-numeric: tabular-nums; }
.goals-table td.num strong { font-weight: 650; }
.goals-table .m-in { border: 1px solid var(--rule-strong); border-radius: 3px; }
@media print {
  .goals-block { page-break-before: always; padding-top: 0; border-top: none; }
  .goals-table { max-width: none; width: 100%; }
}
.goals-table td[colspan] { text-align: center; }

/* ---------- the HC dashboard sheets ---------- */
.hc-sheet { margin-top: 1rem; }
.hcr-head { display: flex; gap: 1rem; align-items: center; flex-wrap: wrap; margin-bottom: .7rem; }
.hcr-head strong { font-size: 1rem; }
.hcr-people { display: flex; gap: .7rem; flex-wrap: wrap; margin-bottom: .8rem; }
.hcr-people .t-box { min-width: 150px; }
.hcr-strips { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: .7rem; }
table.sheet.mini { font-size: .78rem; }
table.sheet.mini th, table.sheet.mini td { padding: .22rem .4rem; }
table.sheet.mini .m-in { width: 40px; border-radius: 3px; border: 1px solid var(--rule-strong); }
.hcr-charts { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; margin-top: .8rem; }
.hcr-charts .dash-chart-title { margin-bottom: .2rem; }

@media (max-width: 860px) { .hcr-charts { grid-template-columns: 1fr; } }
@media print {
  .hc-sheet { page-break-after: always; margin-top: 0; border: none; box-shadow: none; }
  .hc-sheet:last-of-type { page-break-after: auto; }
  .hcr-strips { grid-template-columns: repeat(4, 1fr); gap: .4rem; }
  table.sheet.mini { font-size: .64rem; }
  table.sheet.mini .m-in { width: 30px; border-color: #999; }
  .hcr-charts { gap: .5rem; }
}

/* ---------- report pickers ---------- */
.picker-bar { display: flex; gap: .6rem; align-items: center; flex-wrap: wrap; margin-bottom: .8rem; }
.picker-bar .picker-search { flex: 1 1 220px; max-width: 340px; margin: 0; }
.picker-actions { display: flex; gap: .4rem; margin-left: auto; flex-wrap: wrap; }
.picker-actions .btn { margin-top: 0; }
.pick-list {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: .35rem .6rem; max-height: 340px; overflow-y: auto; padding: 2px;
}
.pick {
  display: flex; align-items: center; gap: .55rem; min-width: 0;
  padding: .45rem .65rem; border: 1px solid var(--rule); border-radius: var(--radius-sm);
  background: #fff; transition: border-color var(--fast), background-color var(--fast);
}
.pick:hover { border-color: var(--green-lift); background: var(--green-wash); }
.pick:has(input:checked) { border-color: var(--green); background: var(--green-wash); }
.pick input { margin: 0; flex: none; width: 17px; height: 17px; accent-color: var(--green); }
.pick a {
  flex: 1; min-width: 0; font-weight: 550; font-size: .9rem; text-decoration: none;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.pick a:hover { text-decoration: underline; }
.pick .tag { flex: none; }
.picker-note { margin: .7rem 0 0; font-size: .8rem; }

/* ---------- charts ---------- */

/* The SVG carries a fixed viewBox, so stretching it to a wide panel blows the
   labels up and squeezing it onto a phone makes them vanish. Hold the rendered
   width near its natural size and let narrow screens scroll instead. */
.chart { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.chart svg {
  display: block; height: auto;
  width: 100%;
  max-width: var(--cw, 760px);
  min-width: min(var(--cw, 760px), 640px);
}
@media print {
  .chart { overflow: visible; }
  .chart svg { min-width: 0; max-width: none; width: 100%; }
}

/* a slightly bigger grab area for the menu button */
.nav-toggle { min-height: 42px; min-width: 42px; }
.foot button.linky { padding: .3rem 0; }

/* [hidden] must win: several panels rely on it, and a later display rule
   (.chip-list, .pick-list) would otherwise keep them on screen. */
[hidden] { display: none !important; }

/* the structure chart must never widen the page itself */
.struct-chart { max-width: 100%; min-width: 0; }

/* ---------- reports ---------- */
.report-head { display: flex; align-items: baseline; gap: .8rem; flex-wrap: wrap; margin: .4rem 0 .8rem; }
.report-head h2 { margin: 0; font-size: 1.25rem; }
.delta { font-size: .8rem; font-weight: 600; }
.delta.up { color: var(--green-lift); }
.delta.down { color: var(--red); }
.delta.flat { color: var(--ink-faint); font-weight: 500; }
.spark { display: block; }
.legend-dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; vertical-align: baseline; }

details.fold {
  background: var(--card); border: 1px solid var(--rule); border-radius: var(--radius);
  box-shadow: var(--shadow-sm); margin-bottom: 1rem;
}
details.fold > summary {
  cursor: pointer; padding: .8rem 1.1rem; font-weight: 600; font-size: .92rem;
  color: var(--green); list-style: none; display: flex; align-items: center; gap: .5rem;
  border-radius: var(--radius);
}
details.fold > summary::-webkit-details-marker { display: none; }
details.fold > summary::before { content: "▸"; transition: transform var(--fast); display: inline-block; }
details.fold[open] > summary::before { transform: rotate(90deg); }
details.fold > summary:hover { background: var(--green-wash); }
details.fold > form, details.fold > .panel { margin: 0; }
details.fold > form { padding: 0 1.1rem 1.1rem; }
details.fold > .panel { border: 0; box-shadow: none; border-top: 1px solid var(--rule); border-radius: 0; }

/* charts may stretch a little to fill their panel, never enough to bloat the labels */
.chart svg { max-width: calc(var(--cw, 760px) * 1.2); }

@media (max-width: 840px) {
  .picker-actions { margin-left: 0; width: 100%; }
  .picker-actions .btn { flex: 1; }
  .picker-bar .picker-search { max-width: none; }
  .pick { padding: .6rem .7rem; }
}

/* ---------- every link is a button ----------
   House rule: nothing clickable is ever bare text — people who do not know the
   system will not spot it. Any link in the page body that is not already a
   button, tag or picker row is drawn as a small outlined button, so a link
   added later cannot slip through as plain text. */
main a:not(.btn):not(.tag):not(.logo),
.foot a:not(.btn) {
  display: inline-flex; align-items: center; gap: .3rem;
  padding: .16rem .6rem; margin: 1px 0;
  border: 1px solid var(--rule-strong); border-radius: var(--radius-sm);
  background: #fff; color: var(--green);
  font-weight: 550; font-size: .86em; line-height: 1.35;
  text-decoration: none; white-space: nowrap; vertical-align: baseline;
  box-shadow: var(--shadow-sm);
  transition: background-color var(--fast), border-color var(--fast), box-shadow var(--fast);
}
main a:not(.btn):not(.tag):not(.logo):hover,
.foot a:not(.btn):hover {
  background: var(--green-wash); border-color: var(--green-lift); color: var(--green);
  box-shadow: var(--shadow);
}
main a:not(.btn):not(.tag):not(.logo):active { transform: translateY(1px); box-shadow: none; }

/* in a table the name is the row's button: let long names shorten, not wrap */
table.sheet td a:not(.btn):not(.tag) { max-width: 100%; overflow: hidden; text-overflow: ellipsis; font-size: .92em; }
/* a picker row is already a boxed control — its name stays flush inside it */
.pick a:not(.btn):not(.tag) { border: 0; box-shadow: none; background: none; padding: 0; margin: 0; font-size: .9rem; display: block; }
.pick a:not(.btn):not(.tag):hover { background: none; box-shadow: none; text-decoration: underline; }
/* tags that link somewhere get a visible edge too */
a.tag { border: 1px solid #c9dcd2; box-shadow: var(--shadow-sm); padding: .2rem .65rem; }

/* the row of ways out, under a page title */
.actions { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; margin: 0 0 1.1rem; }
.actions .btn { margin-top: 0; }
.seg { display: inline-flex; gap: .25rem; }
.foot .btn { margin-top: 0; }

@media print { main a:not(.btn):not(.tag) { border: 0; box-shadow: none; padding: 0; background: none; color: inherit; } }
/* Sign out is a button too */
.who a {
  padding: .3rem .75rem; border-radius: var(--radius-pill);
  border: 1px solid rgba(255,255,255,.35); color: #fff; font-weight: 550;
  transition: background-color var(--fast);
}
.who a:hover { background: rgba(255,255,255,.16); }
/* inside the fork's boxes the homecell name fills the box width */
.orgtree .t-box a:not(.btn):not(.tag) { white-space: normal; justify-content: center; text-align: center; }

/* ---------- admin ---------- */
.row-wrap { container-type: inline-size; }
.row-edit { display: grid; grid-template-columns: minmax(0, 1fr) auto 96px 96px; gap: .5rem; align-items: center; }
.row-edit input[type=text] { margin: 0; width: 100%; min-width: 0; height: 38px; padding-top: 0; padding-bottom: 0; }
.row-edit .btn { margin: 0; width: 100%; height: 38px; min-height: 38px; padding-left: .4rem; padding-right: .4rem; justify-content: center; white-space: nowrap; }
.row-edit .re-tag { white-space: nowrap; }
@container (max-width: 360px) {
  .row-edit { grid-template-columns: 1fr 1fr; }
  .row-edit .re-name { grid-column: 1 / -1; }
  .row-edit .re-tag, .row-edit > span:empty { display: none; }
}
/* Staff / Leader choice on the user form */
.field-label { font-size: .85rem; font-weight: 600; color: var(--ink-soft); margin: .2rem 0 .35rem; }
.choice { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: .6rem; margin-bottom: .9rem; }
label.choice-card { display: flex; gap: .6rem; align-items: flex-start; margin: 0; padding: .8rem .9rem; cursor: pointer;
  border: 1.5px solid var(--rule-strong); border-radius: var(--radius); background: var(--card); color: var(--ink);
  font-weight: 400; transition: border-color var(--fast), background-color var(--fast); }
label.choice-card input { margin: .2rem 0 0; flex: none; width: auto; }
label.choice-card strong { display: block; }
label.choice-card small { display: block; color: var(--ink-soft); line-height: 1.35; margin-top: .1rem; }
label.choice-card:hover { border-color: var(--green); }
label.choice-card:has(input:checked) { border-color: var(--green); background: var(--green-wash); }
tr.retired { opacity: .6; }
form.pick { cursor: default; }
table.sheet td:has(.row-edit) { white-space: normal; }
}

/* ---------- person picker (Admin › user) ---------- */
.user-form { max-width: 860px; }
#personField, #leaderTypeField { margin-bottom: .9rem; }
#personQ { margin: 0; width: 100%; }
.person-results { display: grid; gap: .4rem; margin-top: .5rem; max-height: 420px; overflow-y: auto; }
.person-opt, .person-card {
  display: flex; gap: .7rem; align-items: center; width: 100%; text-align: left;
  padding: .65rem .8rem; border: 1px solid var(--rule-strong); border-radius: var(--radius);
  background: var(--card); color: var(--ink); font: inherit;
}
.person-opt { cursor: pointer; transition: border-color var(--fast), background-color var(--fast); }
.person-opt:hover:not(:disabled), .person-opt:focus-visible { border-color: var(--green); background: var(--green-wash); outline: none; }
.person-opt:disabled { opacity: .6; cursor: not-allowed; }
.person-card { border: 1.5px solid var(--green); background: var(--green-wash); }
.person-body { flex: 1; min-width: 0; display: grid; gap: .3rem; }
.person-body strong { font-size: 1rem; }
.person-pills { display: flex; flex-wrap: wrap; gap: .3rem; }
.person-pills .tag { white-space: normal; overflow-wrap: anywhere; }
.person-opt > .btn, .person-opt > .tag, .person-card > .btn { flex: none; }
.person-need { color: var(--red); font-weight: 600; margin: .2rem 0 0; }
@media (max-width: 520px) {
  .person-opt, .person-card { flex-wrap: wrap; }
  .person-body { flex: 1 1 100%; }
  .person-opt > .btn, .person-card > .btn { width: 100%; justify-content: center; }
}

/* ---------- rich selects (richselect.js upgrades every <select>) ---------- */
.rs { position: relative; display: block; width: 100%; margin-top: .3rem; min-width: 0; }
.rs-native { position: absolute !important; left: 0; bottom: 0; width: 100% !important; height: 100% !important;
  margin: 0 !important; opacity: 0; pointer-events: none; }
.rs-btn {
  display: flex; align-items: center; gap: .5rem; width: 100%; min-height: 42px; margin: 0;
  padding: .4rem .7rem; text-align: left; cursor: pointer;
  border: 1px solid var(--rule-strong); border-radius: var(--radius-sm);
  background: #fff; color: var(--ink); font: inherit;
  transition: border-color var(--fast), box-shadow var(--fast);
}
.rs-btn:hover:not(:disabled) { border-color: #a8b2a6; }
.rs-btn:focus-visible, .rs-open .rs-btn { outline: none; border-color: var(--green-lift); box-shadow: var(--ring); }
.rs-btn:disabled { opacity: .55; cursor: not-allowed; background: var(--paper); }
.rs-invalid .rs-btn { border-color: var(--red); }
.rs-face { flex: 1; min-width: 0; display: flex; align-items: center; gap: .4rem; flex-wrap: wrap; }
.rs-main { min-width: 0; overflow-wrap: anywhere; }
.rs-placeholder { color: var(--ink-faint); }
.rs-pills { display: inline-flex; flex-wrap: wrap; gap: .25rem; }
.rs-pills .tag { white-space: normal; overflow-wrap: anywhere; }
.rs-caret { flex: none; width: 12px; height: 8px; transition: transform var(--fast);
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='none' stroke='%235f6d66' stroke-width='1.6' d='M1 1.5 6 6.5l5-5'/%3E%3C/svg%3E") center no-repeat; }
.rs-open .rs-caret { transform: rotate(180deg); }

.rs-panel {
  position: fixed; z-index: 1000; display: flex; flex-direction: column; overflow: hidden;
  background: var(--card); border: 1px solid var(--rule-strong); border-radius: var(--radius);
  box-shadow: 0 12px 32px rgba(20, 40, 30, .18); font-size: .95rem;
}
.rs-panel:focus { outline: none; }
.rs-search { flex: none; margin: .5rem .5rem .3rem !important; width: auto !important; }
.rs-list { flex: 1 1 auto; min-height: 0; overflow-y: auto; padding: .3rem; display: block; overscroll-behavior: contain; }
.rs-opt { height: auto !important; max-height: none; white-space: normal; flex-shrink: 0; }
.rs-opt + .rs-opt { margin-top: 2px; }
.rs-opt {
  display: flex; align-items: center; gap: .5rem; width: 100%; min-height: 40px; margin: 0;
  padding: .45rem .6rem; text-align: left; cursor: pointer;
  border: 0; border-radius: var(--radius-sm); background: transparent; color: var(--ink); font: inherit;
}
.rs-opt .rs-main { flex: 1 1 auto; font-weight: 550; }
.rs-opt .rs-pills { flex: 0 1 auto; max-width: 55%; justify-content: flex-end; }
.rs-opt:hover:not(:disabled), .rs-opt.is-active { background: var(--green-wash); }
.rs-opt.is-on { background: var(--green-wash); }
.rs-opt.is-on .rs-main { color: var(--green); }
.rs-opt:disabled { opacity: .5; cursor: not-allowed; }
.rs-opt.rs-hint .rs-main { color: var(--ink-soft); font-weight: 400; }
.rs-opt.rs-add { border-top: 1px solid var(--rule); border-radius: 0 0 var(--radius-sm) var(--radius-sm); margin-top: .2rem; }
.rs-opt.rs-add .rs-main { color: var(--green); }
.rs-tick { flex: none; width: 1rem; margin-left: auto; color: var(--green); font-weight: 700; text-align: right; }
.rs-group { padding: .5rem .6rem .2rem; font-size: .72rem; font-weight: 700; letter-spacing: .06em;
  text-transform: uppercase; color: var(--ink-soft); }
.rs-none { padding: .8rem; color: var(--ink-soft); }
.rs-shade { position: fixed; inset: 0; z-index: 999; background: rgba(15, 30, 24, .4); }
.rs-sheet { left: 0 !important; right: 0; bottom: 0 !important; top: auto !important; width: auto !important;
  max-height: 72vh !important; border-radius: var(--radius) var(--radius) 0 0; border-width: 1px 0 0;
  padding-bottom: env(safe-area-inset-bottom); }
.rs-title { padding: .8rem .9rem .2rem; font-weight: 650; }
.rs-sheet .rs-opt { min-height: 46px; }
/* where selects sit in a row of filters or a compact form */
.filters .rs, .picker-bar .rs, .actions .rs { width: auto; flex: 1 1 180px; margin-top: 0; }
.rs { min-width: 120px; }
.t-form .rs { min-width: 0; }
.rs-btn .rs-main { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
label > .rs { margin-top: .3rem; }
.t-form .rs-btn { min-height: 30px; padding: .2rem .4rem; font-size: .82rem; }
.t-form .rs { margin-top: .2rem; }
@media print { .rs-caret { display: none; } .rs-btn { border: 0; padding: 0; min-height: 0; } }

/* ---------- homecell leader: people cards, visitor form, capture ---------- */
.people-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: .5rem; }
.person-card.plain { border: 1px solid var(--rule-strong); background: var(--card); }
.ftv-add { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: .7rem; align-items: end; }
.ftv-add label { margin: 0; }
.ftv-add .btn { height: 42px; }
.capture-kinds { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .5rem; margin-bottom: .9rem; }
.capture-kinds .btn { min-height: 52px; font-size: 1rem; padding-left: .4rem; padding-right: .4rem; }
.capture-date { display: flex; gap: .6rem; align-items: flex-end; flex-wrap: wrap; }
.capture-date label { margin: 0; flex: 1 1 200px; max-width: 280px; }
.capture-head { display: flex; gap: .6rem; align-items: center; flex-wrap: wrap; margin-bottom: .3rem; }
.tap-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: .5rem; margin-top: .6rem; }
label.tap { display: block; margin: 0; cursor: pointer; }
label.tap input { position: absolute; opacity: 0; pointer-events: none; }
.tap-box { display: flex; gap: .7rem; align-items: center; min-height: 56px; padding: .6rem .8rem;
  border: 1.5px solid var(--rule-strong); border-radius: var(--radius); background: var(--card); color: var(--ink);
  font-weight: 550; user-select: none; transition: border-color var(--fast), background-color var(--fast); }
.tap-mark { flex: none; width: 26px; height: 26px; border-radius: 50%; border: 2px solid var(--rule-strong);
  display: grid; place-items: center; color: #fff; font-size: .9rem; font-weight: 700; }
.tap-name { min-width: 0; overflow-wrap: anywhere; }
label.tap:hover .tap-box { border-color: var(--green); }
label.tap input:focus-visible + .tap-box { box-shadow: var(--ring); }
label.tap input:checked + .tap-box { border-color: var(--green); background: var(--green-wash); }
label.tap input:checked + .tap-box .tap-mark { background: var(--green); border-color: var(--green); }
label.tap input:checked + .tap-box .tap-mark::after { content: "\2713"; }
.capture-bar { position: sticky; bottom: 0; z-index: 5; display: flex; gap: 1rem; align-items: center; justify-content: space-between;
  margin-top: 1rem; padding: .8rem 1rem calc(.8rem + env(safe-area-inset-bottom));
  background: var(--card); border: 1px solid var(--rule-strong); border-radius: var(--radius) var(--radius) 0 0;
  box-shadow: 0 -6px 18px rgba(20, 40, 30, .08); }
.capture-bar .btn { min-height: 48px; padding-left: 1.4rem; padding-right: 1.4rem; }
@media (max-width: 520px) {
  .tap-grid, .people-cards { grid-template-columns: 1fr; }
  .capture-kinds .btn { font-size: .92rem; }
}
