:root {
  --navy: #13233f;
  --navy-2: #1d3360;
  --gold: #d4a72c;
  --gold-soft: #f6ecd0;
  --bg: #f5f4ef;
  --card: #ffffff;
  --ink: #18202e;
  --muted: #687184;
  --line: #e3e1d9;
  --green: #1f8a5b;
  --green-soft: #e1f3ea;
  --red: #c2413a;
  --red-soft: #fbe7e5;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(19, 35, 63, .06), 0 4px 16px rgba(19, 35, 63, .06);
  --serif: Georgia, "Times New Roman", serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color: var(--ink); background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3 { font-family: var(--serif); line-height: 1.2; margin: 0 0 .4em; color: var(--navy); }
h1 { font-size: 28px; } h2 { font-size: 21px; } h3 { font-size: 17px; }
a { color: var(--navy-2); }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.hidden { display: none !important; }

/* ── Boot / logo ─────────────────────────── */
.boot { min-height: 100vh; display: grid; place-items: center; }
.boot .logo { animation: pulse 1.2s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .5; } }
.logo {
  width: 34px; height: 34px; border-radius: 9px; background: var(--navy); color: var(--gold);
  display: inline-grid; place-items: center; font: 700 20px var(--serif); flex: none;
}
.logo.big { width: 64px; height: 64px; font-size: 38px; border-radius: 16px; }

/* ── Top bar ─────────────────────────────── */
.topbar {
  position: sticky; top: 0; z-index: 20; background: var(--navy); color: #fff;
  display: flex; align-items: center; gap: 18px; padding: 10px 20px;
}
.brand { display: flex; align-items: center; gap: 10px; color: #fff; text-decoration: none; font: 700 19px var(--serif); }
.brand .logo { background: var(--gold); color: var(--navy); }
.topnav { display: flex; gap: 4px; overflow-x: auto; flex: 1; scrollbar-width: none; }
.topnav a {
  color: rgba(255, 255, 255, .78); text-decoration: none; padding: 7px 12px; border-radius: 8px;
  white-space: nowrap; font-weight: 500;
}
.topnav a:hover { color: #fff; background: rgba(255, 255, 255, .08); }
.topnav a.active { color: var(--navy); background: var(--gold); }
.me { display: flex; align-items: center; gap: 10px; }
.me a { display: flex; }
.me button { background: none; border: 1px solid rgba(255, 255, 255, .3); color: #fff; border-radius: 8px; padding: 6px 10px; cursor: pointer; font: inherit; font-size: 13px; }
.demo-strip { background: var(--gold-soft); color: #6b5410; text-align: center; font-size: 13px; padding: 6px 12px; }
.demo-strip button { background: none; border: 0; text-decoration: underline; color: inherit; cursor: pointer; font: inherit; }

@media (max-width: 720px) {
  .topbar { flex-wrap: wrap; gap: 8px; padding: 10px 12px; }
  .topnav { order: 3; flex-basis: 100%; }
  .me { margin-left: auto; }
}

/* ── Layout ──────────────────────────────── */
.container { max-width: 1120px; margin: 0 auto; padding: 24px 20px 80px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 18px; }
.page-head h1 { margin: 0; }
.page-head p { margin: 2px 0 0; }
.row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.spacer { flex: 1; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px; }
.card + .card, .section { margin-top: 20px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 560px) { .grid2 { grid-template-columns: 1fr; } }
.empty { text-align: center; color: var(--muted); padding: 32px 12px; }

/* ── Buttons & fields ────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border: 1px solid transparent; border-radius: 10px; padding: 9px 16px;
  font: 600 14px/1.2 inherit; font-family: inherit; cursor: pointer; text-decoration: none;
  background: #fff; color: var(--navy); border-color: var(--line); transition: filter .15s, background .15s;
}
.btn:hover { filter: brightness(.97); }
.btn:disabled { opacity: .55; cursor: default; }
.btn-primary { background: var(--navy); color: #fff; border-color: var(--navy); }
.btn-gold { background: var(--gold); color: var(--navy); border-color: var(--gold); }
.btn-danger { color: var(--red); }
.btn-ghost { background: transparent; border-color: transparent; }
.btn-sm { padding: 6px 10px; font-size: 13px; border-radius: 8px; }
.btn-lg { padding: 14px 22px; font-size: 16px; border-radius: 12px; }
.block { width: 100%; }
.link { background: none; border: 0; padding: 0; color: var(--navy-2); text-decoration: underline; cursor: pointer; font: inherit; }

.field { display: flex; flex-direction: column; gap: 5px; margin-bottom: 12px; }
.field > span { font-size: 13px; font-weight: 600; color: var(--navy); }
input, select, textarea {
  font: inherit; color: inherit; background: #fff; border: 1px solid #cfccc1; border-radius: 10px;
  padding: 10px 12px; width: 100%;
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--gold); outline-offset: 0; border-color: var(--gold); }
textarea { min-height: 80px; resize: vertical; }
.inline-select { width: auto; padding: 6px 8px; font-size: 13px; }
.form-error { background: var(--red-soft); color: var(--red); border-radius: 10px; padding: 9px 12px; font-size: 14px; margin-bottom: 12px; }
.form-error:empty { display: none; }

/* ── Avatars & badges ────────────────────── */
.avatar { border-radius: 50%; object-fit: cover; flex: none; background: var(--gold-soft); }
.avatar-ini { display: inline-grid; place-items: center; color: var(--navy); font-weight: 700; font-family: var(--serif); }
.badge { display: inline-block; font-size: 12px; font-weight: 600; padding: 2px 8px; border-radius: 99px; background: #eceae3; color: var(--muted); white-space: nowrap; }
.badge.gold { background: var(--gold-soft); color: #7a5d0c; }
.badge.navy { background: var(--navy); color: #fff; }
.badge.green { background: var(--green-soft); color: var(--green); }
.badge.red { background: var(--red-soft); color: var(--red); }

/* ── Auth pages ──────────────────────────── */
.auth-wrap { min-height: 100vh; display: grid; grid-template-columns: 1.1fr 1fr; }
.auth-hero {
  background: var(--navy); color: #fff; padding: 56px; display: flex; flex-direction: column; justify-content: center;
  background-image: radial-gradient(circle at 85% 15%, rgba(212, 167, 44, .25), transparent 45%);
}
.auth-hero h1 { color: #fff; font-size: 46px; margin-top: 20px; }
.auth-hero p { color: rgba(255, 255, 255, .78); font-size: 17px; max-width: 420px; }
.auth-hero .logo { background: var(--gold); color: var(--navy); }
.auth-side { display: grid; place-items: center; padding: 32px 20px; }
.auth-card { width: 100%; max-width: 420px; }
.divider { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 13px; margin: 18px 0 12px; }
.divider::before, .divider::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.demo-box { background: var(--gold-soft); border-radius: 10px; padding: 10px 12px; font-size: 13px; margin-bottom: 16px; color: #5c470d; }
@media (max-width: 820px) {
  .auth-wrap { grid-template-columns: 1fr; }
  .auth-hero { padding: 16px 20px; min-height: 0; flex-direction: row; align-items: center; justify-content: flex-start; gap: 12px; }
  .auth-hero .logo.big { width: 40px; height: 40px; font-size: 24px; border-radius: 10px; }
  .auth-hero h1 { font-size: 26px; margin: 0; }
  .auth-hero p { display: none; }
  .auth-side { place-items: start center; padding: 16px 12px 32px; }
}
.photo-pick { display: flex; flex-direction: column; align-items: center; gap: 8px; margin: 6px 0 16px; cursor: pointer; }
.photo-circle {
  width: 132px; height: 132px; border-radius: 50%; border: 2px dashed #bfb9a6; display: grid; place-items: center;
  text-align: center; color: var(--muted); font-size: 13px; font-weight: 600; background: #faf9f5 center/cover no-repeat;
}
.photo-circle.has { border: 3px solid var(--gold); color: transparent; }
.photo-circle svg { width: 34px; height: 34px; display: block; margin: 0 auto 4px; }

/* ── Tabs ────────────────────────────────── */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 20px; overflow-x: auto; }
.tabs a, .tabs button {
  padding: 10px 14px; text-decoration: none; color: var(--muted); font-weight: 600; border: 0; background: none;
  border-bottom: 3px solid transparent; margin-bottom: -1px; cursor: pointer; font: inherit; font-weight: 600; white-space: nowrap;
}
.tabs .active { color: var(--navy); border-bottom-color: var(--gold); }

/* ── Calendar ────────────────────────────── */
.cal { padding: 0; overflow: hidden; }
.cal-head, .cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); }
.cal-head div { padding: 8px; font-size: 12px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; border-bottom: 1px solid var(--line); }
.cal-cell { min-height: 104px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); padding: 6px; display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.cal-cell:nth-child(7n) { border-right: 0; }
.cal-cell.blank { background: #faf9f5; }
.cal-cell.clickable { cursor: pointer; }
.cal-cell.clickable:hover { background: #fbfaf6; }
.cal-num { font-size: 13px; font-weight: 600; color: var(--muted); width: 24px; height: 24px; display: grid; place-items: center; border-radius: 50%; }
.cal-cell.today .cal-num { background: var(--navy); color: #fff; }
.cal-ev {
  text-align: left; border: 0; background: var(--gold-soft); color: var(--navy); border-left: 3px solid var(--gold);
  border-radius: 5px; padding: 3px 6px; font: 12px/1.3 inherit; font-family: inherit; cursor: pointer;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
@media (max-width: 720px) {
  .cal-cell { min-height: 58px; padding: 3px; }
  .cal-ev { font-size: 0; padding: 0; height: 6px; border-left: 0; background: var(--gold); }
}
.event-list { display: flex; flex-direction: column; gap: 10px; }
.event-item { display: flex; gap: 14px; align-items: center; padding: 12px 14px; cursor: pointer; }
.date-block { width: 52px; text-align: center; flex: none; background: var(--navy); color: #fff; border-radius: 10px; padding: 6px 0; }
.date-block .m { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--gold); font-weight: 700; }
.date-block .d { font: 700 22px/1.1 var(--serif); }

/* ── Directory ───────────────────────────── */
.filters { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 18px; }
.filters input { flex: 2 1 220px; width: auto; }
.filters select { flex: 1 1 150px; width: auto; }
.people { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 14px; }
.person {
  background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 12px; text-align: center;
  cursor: pointer; transition: transform .12s, box-shadow .12s; box-shadow: var(--shadow); font: inherit; color: inherit;
}
.person:hover { transform: translateY(-2px); }
.person .avatar { margin: 0 auto 10px; display: block; }
.person .avatar-ini { display: grid; }
.person b { display: block; }
.group-title { margin: 26px 0 12px; display: flex; align-items: baseline; gap: 8px; }
.group-title:first-child { margin-top: 0; }
.profile-modal { text-align: center; }
.profile-modal dl { text-align: left; display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; margin: 18px 0 0; }
.profile-modal dt { font-weight: 600; color: var(--muted); font-size: 13px; }
.profile-modal dd { margin: 0; word-break: break-word; }

/* ── Tables ──────────────────────────────── */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th { text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 700; padding: 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
td { padding: 10px; border-bottom: 1px solid #efede6; vertical-align: middle; }
tr:last-child td { border-bottom: 0; }
.who { display: flex; align-items: center; gap: 10px; min-width: 170px; }
.who small { display: block; color: var(--muted); }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }

/* ── Attendance ──────────────────────────── */
.take-bar { position: sticky; top: 54px; z-index: 5; background: var(--bg); padding: 10px 0; display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.counter { font: 700 22px var(--serif); color: var(--navy); }
.chips { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 8px; }
.chip {
  display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 12px; border: 2px solid var(--line);
  background: #fff; cursor: pointer; text-align: left; font: inherit; color: inherit; user-select: none;
}
.chip .check { margin-left: auto; width: 22px; height: 22px; border-radius: 50%; border: 2px solid #cfccc1; flex: none; display: grid; place-items: center; color: #fff; font-size: 13px; }
.chip.on { border-color: var(--green); background: var(--green-soft); }
.chip.on .check { background: var(--green); border-color: var(--green); }
.chip.on .check::after { content: "✓"; }
.chip small { display: block; color: var(--muted); font-size: 12px; }
.save-bar { position: fixed; left: 0; right: 0; bottom: 0; background: #fff; border-top: 1px solid var(--line); padding: 12px 20px; display: flex; gap: 10px; justify-content: flex-end; z-index: 15; box-shadow: 0 -4px 16px rgba(0, 0, 0, .05); }

/* ── Reports ─────────────────────────────── */
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; margin-bottom: 20px; }
.tile { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); }
.tile .v { font: 700 30px/1.1 var(--serif); color: var(--navy); }
.tile .l { font-size: 13px; color: var(--muted); margin-top: 4px; }
.meter { display: flex; align-items: center; gap: 8px; min-width: 140px; }
.meter .bar { flex: 1; height: 8px; border-radius: 99px; background: #eceae3; overflow: hidden; }
.meter .bar i { display: block; height: 100%; background: var(--gold); border-radius: 99px; }
.meter b { width: 40px; text-align: right; font-variant-numeric: tabular-nums; font-size: 13px; }
.rank { font: 700 18px var(--serif); color: var(--gold); width: 26px; }
tr.expandable { cursor: pointer; }
tr.detail td { background: #faf9f5; }

/* ── Modal / toast / QR ──────────────────── */
.modal-bg { position: fixed; inset: 0; background: rgba(15, 22, 38, .5); display: grid; place-items: center; padding: 16px; z-index: 50; animation: fade .15s; }
.modal { background: #fff; border-radius: 18px; padding: 24px; width: 100%; max-width: 480px; max-height: 92vh; overflow: auto; box-shadow: 0 20px 60px rgba(0, 0, 0, .25); }
.modal-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 16px; flex-wrap: wrap; }
@keyframes fade { from { opacity: 0; } }
.toast { position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 20px); opacity: 0; background: var(--navy); color: #fff; padding: 10px 18px; border-radius: 10px; z-index: 60; transition: .25s; font-weight: 500; box-shadow: var(--shadow); }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.err { background: var(--red); }
.qr-overlay { position: fixed; inset: 0; background: var(--navy); color: #fff; z-index: 70; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 18px; padding: 24px; text-align: center; }
.qr-overlay h1 { color: #fff; font-size: clamp(28px, 5vw, 52px); margin: 0; }
.qr-overlay .qr { background: #fff; padding: 18px; border-radius: 20px; width: min(70vh, 80vw); }
.qr-overlay .qr svg { width: 100%; height: auto; display: block; }
.qr-overlay .url { color: var(--gold); font-size: 18px; word-break: break-all; }
.qr-overlay .close { position: absolute; top: 18px; right: 18px; }
.btn-danger-solid { background: var(--red); color: #fff; border-color: var(--red); }

/* ── Colored + multi-day events ──────────── */
.cal-ev { background: var(--s, var(--gold-soft)); border-left-color: var(--c, var(--gold)); }
.cal-span { background: var(--c); color: var(--t); border-left: 0; border-radius: 0; margin: 0 -7px; padding-left: 8px; font-weight: 600; }
.cal-span.s { margin-left: 0; border-top-left-radius: 5px; border-bottom-left-radius: 5px; }
.cal-span.e { margin-right: 0; border-top-right-radius: 5px; border-bottom-right-radius: 5px; }
.cal-span.cont { color: transparent; }
.event-item .date-block { background: var(--c, var(--navy)); }
.event-item .date-block .m { color: var(--t, var(--gold)); opacity: .85; }
.event-item .date-block .d { color: var(--t, #fff); }
.ev-color-bar { height: 6px; border-radius: 99px; background: var(--c); margin: -6px 0 14px; }
.swatches { display: flex; gap: 8px; flex-wrap: wrap; }
.swatch input { position: absolute; opacity: 0; pointer-events: none; }
.swatch i { display: block; width: 30px; height: 30px; border-radius: 50%; cursor: pointer; border: 3px solid #fff; box-shadow: 0 0 0 1px var(--line); }
.swatch input:checked + i { box-shadow: 0 0 0 2px var(--navy); }
.swatch input:focus-visible + i { outline: 2px solid var(--gold); outline-offset: 2px; }
@media (max-width: 720px) {
  .cal-ev { background: var(--c, var(--gold)); border-radius: 3px; }
  .cal-span { margin: 0 -4px; border-radius: 0; }
  .cal-span.s { margin-left: 0; } .cal-span.e { margin-right: 0; }
}

/* ── Attendance grade groups ─────────────── */
.att-group { margin-top: 22px; }
.att-group:first-of-type { margin-top: 6px; }
.att-group h3 { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }

/* ── Shared bits for newer features ──────── */
.badge.blue { background: #e3ebf8; color: #2c4f97; }
.badge.navy-soft { background: #dfe5f1; color: var(--navy); }
.nudge { background: var(--gold-soft); color: #5c470d; border-radius: 12px; padding: 10px 14px; margin-bottom: 16px; display: flex; gap: 10px; align-items: center; flex-wrap: wrap; font-size: 14px; }
details > summary { cursor: pointer; list-style: none; }
details > summary::-webkit-details-marker { display: none; }

/* ── Attendance start + self check-in ────── */
.att-start { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; text-align: center; padding: 26px; }
.att-start p { margin: 10px 0 0; }
.att-start .btn-lg { font-size: 17px; padding: 15px 26px; }
@media (max-width: 640px) { .att-start { grid-template-columns: 1fr; } }
.checkin-overlay { flex-direction: row; gap: 40px; align-items: stretch; }
.ci-left { flex: 1.3; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; }
.ci-left .qr { width: min(62vh, 46vw); }
.ci-timer { width: min(62vh, 46vw); height: 6px; background: rgba(255, 255, 255, .15); border-radius: 99px; overflow: hidden; }
.ci-timer i { display: block; height: 100%; width: 100%; background: var(--gold); }
.ci-right { flex: 1; display: flex; flex-direction: column; gap: 16px; min-width: 260px; max-height: 92vh; }
.ci-count { display: flex; align-items: baseline; gap: 10px; justify-content: center; }
.ci-count b { font: 700 72px var(--serif); color: var(--gold); }
.ci-count span { font-size: 20px; color: rgba(255, 255, 255, .8); }
.ci-faces { flex: 1; overflow: auto; display: grid; grid-template-columns: repeat(auto-fill, minmax(76px, 1fr)); gap: 10px; align-content: start; }
.ci-face { display: flex; flex-direction: column; align-items: center; gap: 4px; font-size: 13px; animation: pop .35s ease-out; }
@keyframes pop { from { transform: scale(.6); opacity: 0; } }
.ci-actions { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }
@media (max-width: 800px) {
  .checkin-overlay { flex-direction: column; overflow: auto; justify-content: flex-start; }
  .ci-left .qr, .ci-timer { width: min(80vw, 50vh); }
}
.checkin-card { max-width: 440px; margin: 40px auto; text-align: center; padding: 36px 24px; }
.ci-big { width: 84px; height: 84px; border-radius: 50%; margin: 0 auto 14px; display: grid; place-items: center; font-size: 46px; background: var(--green); color: #fff; }
.ci-big.bad { background: var(--red); }
.ci-spin { width: 40px; height: 40px; margin: 0 auto 14px; border: 4px solid var(--line); border-top-color: var(--gold); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Recruitment pipeline ────────────────── */
.pipeline { display: flex; align-items: center; gap: 6px; overflow-x: auto; margin-bottom: 16px; padding: 2px; }
.pipeline .arrow { color: #bdb8a8; font-size: 20px; }
.stage-pill { flex: 1 0 auto; min-width: 104px; background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 8px 12px; cursor: pointer; text-align: left; font: inherit; color: inherit; box-shadow: var(--shadow); }
.stage-pill b { display: block; font: 700 22px var(--serif); color: var(--navy); }
.stage-pill span { font-size: 12px; color: var(--muted); }
.stage-pill.active { border-color: var(--navy); outline: 2px solid var(--navy); }
td.follow { color: #9a5b00; font-weight: 600; }
.stage-select { min-width: 120px; }
.log { margin-top: 10px; display: flex; flex-direction: column; gap: 8px; max-height: 260px; overflow: auto; }
.log-item { background: #faf9f5; border: 1px solid var(--line); border-radius: 10px; padding: 8px 12px; }

/* ── Resources ───────────────────────────── */
.cat-chips { display: flex; gap: 6px; flex-wrap: wrap; margin: -6px 0 16px; }
.cat-chips button { border: 1px solid var(--line); background: #fff; border-radius: 99px; padding: 5px 12px; cursor: pointer; font: inherit; font-size: 13px; color: var(--muted); }
.cat-chips button.active { background: var(--navy); color: #fff; border-color: var(--navy); }
.res-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 12px; }
.res-card { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.res-main { display: flex; gap: 14px; align-items: center; width: 100%; text-align: left; padding: 16px; background: none; border: 0; cursor: pointer; font: inherit; color: inherit; }
.res-main > span:nth-child(2) { flex: 1; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.res-icon { font-size: 30px; flex: none; }
.res-go { font-size: 13px; font-weight: 600; color: var(--navy-2); white-space: nowrap; }
.res-main:hover .res-go { text-decoration: underline; }
.res-admin { display: flex; gap: 14px; padding: 0 16px 12px 60px; }
@media (max-width: 400px) { .res-list { grid-template-columns: 1fr; } }

/* ── Charts ──────────────────────────────── */
.chart-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.chart-card.wide { grid-column: 1 / -1; }
.chart-card + .chart-card { margin-top: 0; }
.chart-card h3 { margin-bottom: 2px; }
.chart-card > p { margin: 0 0 10px; }
@media (max-width: 860px) { .chart-grid { grid-template-columns: 1fr; } }
.chart { width: 100%; height: auto; display: block; overflow: visible; }
.chart .grid { stroke: #ecebe5; stroke-width: 1; }
.chart .base { stroke: #c9c6bb; stroke-width: 1; }
.chart .tick { font-size: 12px; fill: var(--muted); }
.chart .val { font-size: 12px; fill: var(--ink); font-weight: 600; }
.chart .hit { fill: transparent; }
.chart-col:hover .bar { filter: brightness(1.12); }
.chart-col:hover .hit { fill: rgba(19, 35, 63, .04); }
.chart-legend { display: flex; gap: 16px; font-size: 13px; color: var(--muted); margin-bottom: 6px; }
.chart-legend i, #chart-tip i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }
.chart-empty { color: var(--muted); text-align: center; padding: 50px 10px; font-size: 14px; }
.chart-table { margin-top: 8px; font-size: 13px; }
.chart-table summary { color: var(--navy-2); font-size: 12px; font-weight: 600; }
.chart-table table { margin-top: 6px; }
.chart-table td, .chart-table th { padding: 5px 8px; }
#chart-tip { position: fixed; z-index: 80; pointer-events: none; opacity: 0; transition: opacity .1s; background: #fff; color: var(--ink); border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; font-size: 13px; line-height: 1.5; box-shadow: 0 6px 20px rgba(0, 0, 0, .12); }
.hbars { display: flex; flex-direction: column; gap: 8px; }
.hbar { display: grid; grid-template-columns: 140px 1fr 36px; align-items: center; gap: 10px; font-size: 13px; padding: 2px 0; }
.hbar:hover { background: rgba(19, 35, 63, .04); border-radius: 6px; }
.hb-track { height: 14px; background: #f1efe8; border-radius: 0 4px 4px 0; overflow: hidden; }
.hb-track i { display: block; height: 100%; border-radius: 0 4px 4px 0; }
.hb-val { text-align: right; font-variant-numeric: tabular-nums; }

/* ── Handoff wizard ──────────────────────── */
.handoff-card { display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap; border-left: 4px solid var(--gold); }
.hw-progress { height: 8px; background: #eceae3; border-radius: 99px; overflow: hidden; margin-bottom: 16px; }
.hw-progress i { display: block; height: 100%; background: var(--green); transition: width .3s; }
.hw-steps { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 10px; }
.hw-steps li { display: flex; gap: 12px; border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; }
.hw-steps li.done { background: #f6fbf8; border-color: #cfe9dc; }
.hw-steps p { margin: 3px 0 8px; color: var(--muted); }
.hw-check { width: 24px; height: 24px; border-radius: 50%; border: 2px solid #cfccc1; flex: none; display: grid; place-items: center; color: #fff; font-size: 14px; }
.hw-steps li.done .hw-check { background: var(--green); border-color: var(--green); }

/* ── Phone bottom navigation ─────────────── */
.bottomnav { display: none; }
@media (max-width: 720px) {
  .topnav { display: none; }
  .topbar { flex-wrap: nowrap; }
  .bottomnav {
    display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; background: #fff;
    border-top: 1px solid var(--line); padding: 4px 4px calc(4px + env(safe-area-inset-bottom));
    box-shadow: 0 -2px 12px rgba(19, 35, 63, .06);
  }
  .bottomnav a { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 6px 2px; color: var(--muted); text-decoration: none; font-size: 11px; font-weight: 600; border-radius: 10px; }
  .bottomnav svg { width: 24px; height: 24px; }
  .bottomnav a.active { color: var(--navy); }
  .bottomnav a.active svg { color: var(--gold); stroke: var(--navy); fill: var(--gold-soft); }
  .container { padding: 18px 14px calc(96px + env(safe-area-inset-bottom)); }
  .save-bar { bottom: calc(60px + env(safe-area-inset-bottom)); padding: 10px 14px; }
  .toast { bottom: calc(80px + env(safe-area-inset-bottom)); }
  h1 { font-size: 24px; }
  .page-head { margin-bottom: 14px; }
  .page-head > .btn, .page-head > .row { width: 100%; }
  .page-head > .btn { justify-content: center; }
  .card { padding: 16px; }
  .tiles { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .tile { padding: 12px; }
  .tile .v { font-size: 24px; }
  .modal-bg { place-items: end center; padding: 0; }
  .modal { border-radius: 18px 18px 0 0; max-height: 90vh; padding: 20px 16px calc(20px + env(safe-area-inset-bottom)); }
  .tabs { margin-left: -14px; margin-right: -14px; padding: 0 8px; }
  .tabs a, .tabs button { padding: 10px 10px; font-size: 14px; }
  .filters input, .filters select { flex-basis: 100%; }
  .take-bar { top: 52px; }
  .take-bar input[type=date] { flex: 1 1 140px; }
  .chips { grid-template-columns: 1fr 1fr; }
  .chip { padding: 8px; gap: 8px; }
  .chip .avatar { width: 30px !important; height: 30px !important; }
  .chip b { font-size: 14px; }
  .people { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .person { padding: 14px 8px; }
  .person .avatar { width: 60px !important; height: 60px !important; }
  .res-list { grid-template-columns: 1fr; }
  .hbar { grid-template-columns: 110px 1fr 30px; }
  .event-item { padding: 10px 12px; }
  .pipeline .arrow { display: none; }
  .stage-pill { min-width: 92px; }
  .qr-overlay .close { top: 10px; right: 10px; }
}

/* Phone tables: turn rows into stacked cards instead of sideways scrolling */
@media (max-width: 720px) {
  .stack-table thead { display: none; }
  .stack-table, .stack-table tbody, .stack-table tr, .stack-table td { display: block; width: 100%; }
  .stack-table tr { border-bottom: 1px solid var(--line); padding: 10px 0; }
  .stack-table tr:last-child { border-bottom: 0; }
  .stack-table td { border: 0; padding: 3px 0; text-align: left !important; }
  .stack-table td[data-label]::before { content: attr(data-label) ": "; color: var(--muted); font-size: 12px; font-weight: 600; }
  .stack-table td.num { text-align: left; }
  .stack-table .who { min-width: 0; }
  .stack-table td:last-child:not([data-label]) { padding-top: 6px; }
}

/* ── Live name lists on the big QR screens ─ */
.by-grade { flex: 1; overflow: auto; display: flex; flex-direction: column; gap: 14px; text-align: left; }
.bg-group h3 { color: var(--gold); font-size: 18px; margin: 0 0 6px; display: flex; gap: 8px; align-items: baseline; }
.bg-group h3 span { font: 600 13px system-ui, sans-serif; color: rgba(255, 255, 255, .6); }
.bg-names { display: flex; flex-wrap: wrap; gap: 6px; }
.bg-name { display: inline-flex; align-items: center; gap: 7px; background: rgba(255, 255, 255, .1); border-radius: 99px; padding: 3px 12px 3px 3px; font-size: 14px; animation: pop .35s ease-out; }
.ci-wait { color: rgba(255, 255, 255, .6); text-align: center; margin-top: 30px; }
.qr-overlay.checkin-overlay .url { font-size: 15px; }
@media (max-width: 800px) { .by-grade { overflow: visible; } .ci-right { max-height: none; } }

/* ── "You're checked in" on the member's phone ─ */
.checked-in { text-align: center; padding: 34px 16px 20px; max-width: 460px; margin: 0 auto; animation: fade .3s; }
.ci-photo { position: relative; width: 132px; margin: 0 auto 18px; }
.ci-photo .avatar { box-shadow: 0 0 0 6px var(--green-soft), 0 0 0 9px var(--green); }
.ci-tick { position: absolute; right: -6px; bottom: -4px; width: 46px; height: 46px; border-radius: 50%; background: var(--green); color: #fff; display: grid; place-items: center; font-size: 26px; font-weight: 700; border: 4px solid var(--bg); animation: pop .4s .15s ease-out both; }
.ci-kicker { color: var(--green); font-weight: 700; font-size: 20px; margin: 0 0 4px; }
.checked-in h1 { font-size: 34px; margin-bottom: 6px; }
.ci-when { font-size: 16px; font-weight: 600; color: var(--navy); margin: 0 0 14px; }

/* ── Chart group labels (trimesters / school years) ─ */
.chart .divider { stroke: #d9d6cc; stroke-width: 1; stroke-dasharray: 3 3; }
.chart .group { font-size: 12px; font-weight: 700; fill: var(--navy); }

/* Bigger names on projector-size screens */
.bg-name { font-size: clamp(14px, 1.25vw, 20px); }
.bg-group h3 { font-size: clamp(17px, 1.5vw, 24px); }

/* Keep inline inputs inside narrow popups */
.modal .row > input, .modal label.row input[type=date] { max-width: 100%; min-width: 0; }
.modal label.row { line-height: 2.2; }

/* Trimester start markers on the calendar */
.tri-mark { font-size: 11px; font-weight: 700; color: var(--navy); background: #dfe5f1; border-radius: 5px; padding: 2px 6px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tri-mark.est { background: transparent; border: 1px dashed #b8c2d8; color: var(--muted); font-weight: 600; }
@media (max-width: 720px) { .tri-mark { font-size: 0; padding: 0; height: 6px; border-radius: 3px; background: var(--navy); border: 0; } .tri-mark.est { background: repeating-linear-gradient(90deg, #9aa6c0 0 4px, transparent 4px 7px); } }

/* ── Create account: member vs alumni ────── */
.type-choices { display: flex; flex-direction: column; gap: 12px; margin: 8px 0 16px; }
.type-card { display: flex; gap: 14px; align-items: center; padding: 16px; border: 2px solid var(--line); border-radius: 14px; text-decoration: none; color: inherit; background: #fff; transition: border-color .15s, transform .15s; }
.type-card:hover { border-color: var(--gold); transform: translateY(-1px); }
.type-card .tc-icon { font-size: 34px; }
.type-card b { display: block; font-size: 17px; color: var(--navy); }
.type-card small { color: var(--muted); }
.hello-hi { background: var(--gold-soft); border-radius: 12px; padding: 14px; margin: 4px 0 14px; font-size: 16px; line-height: 1.45; }
.status-card { display: flex; flex-direction: column; gap: 2px; max-width: 640px; margin-bottom: 16px; border-left: 4px solid var(--green); }

@media (max-width: 820px) { .auth-wrap { align-content: start; } }

/* ── Admin: member status editor ─────────── */
.status-row { display: grid; grid-template-columns: 130px 170px 1fr; gap: 10px 14px; align-items: center; padding: 10px 0; border-bottom: 1px solid #efede6; }
.status-row .swatches i { width: 24px; height: 24px; }
.linklike { background: none; border: 0; padding: 0; color: #a3342e; text-decoration: underline; cursor: pointer; font: inherit; }
.photo-pick > label { cursor: pointer; }
.status-hint { grid-column: 2 / -1; margin-top: -4px; }
@media (max-width: 640px) { .status-row { grid-template-columns: 1fr 1fr; } .status-row .swatches { grid-column: 1 / -1; } .status-hint { grid-column: 1 / -1; } }
