:root {
  /* From the IPGS crest: navy banner, Irish green and orange, silver shield. */
  --green: #1c2a6b;      /* navy: header, hero, dates */
  --green-2: #169b62;    /* Irish green: primary buttons */
  --green-3: #11804f;    /* links, focus */
  --gold: #f08a3c;       /* orange accent */
  --gold-soft: #fde4cf;
  --orange: #f08a3c;
  --bg: #f3f4f7;
  --card: #ffffff;
  --ink: #18241d;
  --muted: #5f6d64;
  --line: #e2ddd0;
  --chip: #eef3ef;
  --danger: #b3261e;
  --shadow: 0 1px 2px rgba(15, 61, 42, .06), 0 4px 16px rgba(15, 61, 42, .06);
  --radius: 14px;
  --serif: 'Fraunces', Georgia, 'Times New Roman', serif;
  --sans: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0c1511; --card: #142019; --ink: #e8eee9; --muted: #9db0a4; --line: #24342b; --chip: #1c2c23;
    --gold-soft: #3a3220; --shadow: 0 1px 2px rgba(0,0,0,.3); color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0c1511; --card: #142019; --ink: #e8eee9; --muted: #9db0a4; --line: #24342b; --chip: #1c2c23;
  --gold-soft: #3a3220; --shadow: 0 1px 2px rgba(0,0,0,.3); color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--ink); font: 15px/1.5 var(--sans); -webkit-font-smoothing: antialiased; }
img { max-width: 100%; display: block; }
a { color: var(--green-3); }
h1, h2, h3 { font-family: var(--serif); line-height: 1.2; margin: 0 0 .5em; }
h1 { font-size: 1.6rem; } h2 { font-size: 1.25rem; } h3 { font-size: 1.05rem; }
p { margin: 0 0 .75em; }
button, input, select, textarea { font: inherit; color: inherit; }
.boot { min-height: 100vh; display: grid; place-items: center; background: var(--green); }
.boot img { animation: pulse 1.4s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .5; transform: scale(.96); } }

/* Layout */
.top { position: sticky; top: 0; z-index: 20; background: var(--green); color: #fff; padding: calc(env(safe-area-inset-top) + 10px) 16px 10px; }
.top-in { max-width: 1040px; margin: 0 auto; display: flex; align-items: center; gap: 10px; }
.top img { width: 50px; height: 42px; }
.top .t { font-family: var(--serif); font-weight: 700; font-size: 1.05rem; line-height: 1.1; }
.top .t small { display: block; font-family: var(--sans); font-weight: 500; font-size: .72rem; color: var(--gold-soft); opacity: .85; letter-spacing: .04em; text-transform: uppercase; }
.top .sp { flex: 1; }
.top .me { width: 34px; height: 34px; border-radius: 50%; border: 2px solid var(--gold); overflow: hidden; background: var(--green-2); display: grid; place-items: center; font-weight: 700; font-size: .8rem; color: #fff; text-decoration: none; }
.top .me img { width: 100%; height: 100%; object-fit: cover; }
.top .adm { color: var(--gold-soft); text-decoration: none; font-size: .8rem; font-weight: 600; border: 1px solid rgba(201,162,76,.5); padding: 4px 10px; border-radius: 99px; }
main { max-width: 1040px; margin: 0 auto; padding: 16px 16px calc(96px + env(safe-area-inset-bottom)); }
nav.bottom { position: fixed; bottom: 0; left: 0; right: 0; z-index: 20; background: var(--card); border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom); }
nav.bottom .in { max-width: 640px; margin: 0 auto; display: grid; grid-template-columns: repeat(5, 1fr); }
nav.bottom a { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 8px 0 9px; font-size: .7rem; font-weight: 600; color: var(--muted); text-decoration: none; }
nav.bottom a svg { width: 22px; height: 22px; }
nav.bottom a.on { color: var(--green-3); }
nav.bottom a.on svg { stroke: var(--green-3); }

/* Pieces */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px; margin-bottom: 14px; }
.card.flush { padding: 0; overflow: hidden; }
.hero { background: linear-gradient(100deg, rgba(28,42,107,.94) 0%, rgba(28,42,107,.82) 55%, rgba(28,42,107,.35) 100%), url(/img/course.jpg) center 62% / cover no-repeat var(--green); color: #fff; border: 0; position: relative; overflow: hidden; }
.hero::after { content: ''; position: absolute; right: -40px; top: -40px; width: 180px; height: 180px; border-radius: 50%; border: 18px solid rgba(240,138,60,.18); }
.hero::before { content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 6px; background: linear-gradient(#169b62 0 33%, #fff 33% 66%, #f08a3c 66%); }
.hero h1 { color: #fff; }
.hero p { color: #dbe9e1; }
.grid { display: grid; gap: 14px; }
@media (min-width: 760px) { .grid.two { grid-template-columns: 1fr 1fr; } .grid.three { grid-template-columns: repeat(3, 1fr); } }
.row { display: flex; align-items: center; gap: 10px; }
.row.wrap { flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.stack > * + * { margin-top: 10px; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.tiny { font-size: .75rem; }
.right { text-align: right; }
.sec-h { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin: 18px 0 10px; }
.sec-h h2 { margin: 0; }
.sec-h a { font-size: .85rem; font-weight: 600; text-decoration: none; }
.empty { text-align: center; color: var(--muted); padding: 28px 12px; }
.badge { display: inline-block; font-size: .7rem; font-weight: 700; letter-spacing: .03em; text-transform: uppercase; padding: 2px 8px; border-radius: 99px; background: var(--gold-soft); color: #7a5b12; }
.badge.green { background: #dcefe4; color: var(--green-2); }
.badge.grey { background: var(--chip); color: var(--muted); }
.badge.red { background: #f9dedc; color: var(--danger); }
:root[data-theme="dark"] .badge, :root:not([data-theme="light"]) .badge { }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { display: inline-flex; align-items: center; gap: 4px; padding: 4px 10px; border-radius: 99px; background: var(--chip); font-size: .8rem; font-weight: 500; border: 1px solid transparent; }
button.chip { cursor: pointer; }
.chip.on { background: var(--green-2); color: #fff; }
.chip .x { cursor: pointer; opacity: .7; margin-left: 2px; }
.tabs { display: flex; gap: 6px; overflow-x: auto; padding: 2px 0 10px; margin: 0 -16px 6px; padding-left: 16px; padding-right: 16px; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tabs a { flex: none; padding: 7px 14px; border-radius: 99px; background: var(--card); border: 1px solid var(--line); color: var(--ink); font-size: .85rem; font-weight: 600; text-decoration: none; white-space: nowrap; }
.tabs a.on { background: var(--green); border-color: var(--green); color: #fff; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 10px 16px; border-radius: 10px; border: 1px solid var(--line); background: var(--card); font-weight: 600; cursor: pointer; text-decoration: none; color: var(--ink); min-height: 42px; }
.btn.primary { background: var(--green-2); border-color: var(--green-2); color: #fff; }
.btn.gold { background: var(--gold); border-color: var(--gold); color: #1f1606; }
.btn.wa { background: #25d366; border-color: #25d366; color: #06301a; }
.btn.danger { color: var(--danger); }
.btn.sm { padding: 6px 12px; min-height: 34px; font-size: .85rem; border-radius: 8px; }
.btn.block { width: 100%; }
.btn:disabled { opacity: .55; cursor: default; }
.icon-btn { background: none; border: 0; padding: 6px; cursor: pointer; color: var(--muted); border-radius: 8px; }

label.f { display: block; margin-bottom: 12px; }
label.f > span { display: block; font-size: .8rem; font-weight: 600; color: var(--muted); margin-bottom: 4px; }
input[type=text], input[type=tel], input[type=email], input[type=number], input[type=date], input[type=password], input[type=search], input[type=url], select, textarea {
  width: 100%; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--card); min-height: 42px;
}
textarea { min-height: 90px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--green-3); outline-offset: -1px; border-color: transparent; }
.check { display: flex; gap: 8px; align-items: center; margin-bottom: 12px; }
.form-grid { display: grid; gap: 0 12px; }
@media (min-width: 640px) { .form-grid { grid-template-columns: 1fr 1fr; } .form-grid .full { grid-column: 1 / -1; } }
fieldset { border: 0; padding: 0; margin: 0 0 8px; }
legend { font-family: var(--serif); font-weight: 700; font-size: 1.05rem; margin-bottom: 10px; padding: 0; }

/* Avatars */
.av { width: 48px; height: 48px; border-radius: 50%; flex: none; overflow: hidden; background: var(--green-2); color: #fff; display: grid; place-items: center; font-weight: 700; font-family: var(--serif); }
.av img { width: 100%; height: 100%; object-fit: cover; }
.av.lg { width: 104px; height: 104px; font-size: 2rem; border: 3px solid var(--gold); }
.av.sm { width: 32px; height: 32px; font-size: .75rem; }
.av.xs { width: 26px; height: 26px; font-size: .65rem; }

/* Directory */
.filters { display: grid; gap: 8px; }
@media (min-width: 760px) { .filters { grid-template-columns: 2fr 1fr 1fr 1fr; } }
.people { display: grid; gap: 10px; }
@media (min-width: 640px) { .people { grid-template-columns: 1fr 1fr; } }
@media (min-width: 980px) { .people { grid-template-columns: 1fr 1fr 1fr; } }
.person { display: flex; gap: 12px; align-items: flex-start; text-decoration: none; color: inherit; margin: 0; }
.person .nm { font-weight: 700; }
.person .jb { font-size: .85rem; color: var(--muted); }
.person .chips { margin-top: 6px; }
.person:hover { border-color: var(--green-3); }

.profile-head { text-align: center; }
.profile-head .av { margin: 0 auto 10px; }
.contact { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 12px; }
dl.kv { margin: 0; display: grid; grid-template-columns: 120px 1fr; gap: 6px 12px; }
dl.kv dt { color: var(--muted); font-size: .85rem; }
dl.kv dd { margin: 0; }
@media (max-width: 420px) { dl.kv { grid-template-columns: 1fr; } dl.kv dt { margin-top: 6px; } }

.meter { height: 8px; border-radius: 99px; background: rgba(255,255,255,.2); overflow: hidden; }
.meter > i { display: block; height: 100%; background: var(--gold); border-radius: 99px; }

/* Lists and tables */
.list { list-style: none; padding: 0; margin: 0; }
.list > li { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.list > li:last-child { border-bottom: 0; }
.tbl { width: 100%; border-collapse: collapse; font-size: .9rem; }
.tbl th, .tbl td { padding: 9px 8px; text-align: left; border-bottom: 1px solid var(--line); }
.tbl th { font-size: .72rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 700; }
.tbl td.n, .tbl th.n { text-align: right; font-variant-numeric: tabular-nums; }
.tbl tr.me td { background: var(--gold-soft); }
.scroll-x { overflow-x: auto; }
.pos { width: 28px; height: 28px; border-radius: 50%; display: inline-grid; place-items: center; font-weight: 700; font-size: .8rem; background: var(--chip); }
.pos.p1 { background: #e7c766; color: #3b2a00; } .pos.p2 { background: #d5d9dc; color: #2b2f33; } .pos.p3 { background: #e0a878; color: #3b1d00; }

.event-date { width: 54px; flex: none; text-align: center; border-radius: 10px; background: var(--green); color: #fff; padding: 6px 0; line-height: 1.1; }
.event-date b { display: block; font-family: var(--serif); font-size: 1.35rem; }
.event-date span { font-size: .68rem; text-transform: uppercase; letter-spacing: .06em; color: var(--gold-soft); }
.rsvp { display: flex; gap: 6px; }
.rsvp button { flex: 1; }
.rsvp .on.yes { background: var(--green-2); border-color: var(--green-2); color: #fff; }
.rsvp .on.maybe { background: var(--gold); border-color: var(--gold); color: #1f1606; }
.rsvp .on.no { background: #6b6b6b; border-color: #6b6b6b; color: #fff; }

/* Rich text */
.md h1, .md h2, .md h3 { margin-top: 1em; }
.md ul, .md ol { padding-left: 1.3em; margin: 0 0 .75em; }
.md p:last-child { margin-bottom: 0; }

/* Committee */
.leaders { display: grid; gap: 12px; grid-template-columns: repeat(2, 1fr); }
@media (min-width: 760px) { .leaders { grid-template-columns: repeat(4, 1fr); } }
.leader { text-align: center; padding: 16px 10px; margin: 0; }
.leader .ph { width: 96px; height: 96px; margin: 0 auto 10px; border-radius: 50%; overflow: hidden; border: 3px solid var(--gold); background: var(--green-2); display: grid; place-items: center; color: #fff; font-family: var(--serif); font-size: 1.8rem; font-weight: 700; }
.leader .ph img { width: 100%; height: 100%; object-fit: cover; }
.leader .role { font-size: .72rem; text-transform: uppercase; letter-spacing: .08em; color: var(--gold); font-weight: 700; }
.leader .who { font-family: var(--serif); font-weight: 700; font-size: 1.05rem; }
.leader.tbc .who { color: var(--muted); font-style: italic; font-weight: 500; }

/* Bank */
.bank-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.bank-row:last-child { border-bottom: 0; }
.bank-row b { font-family: ui-monospace, 'SF Mono', Consolas, monospace; font-size: 1.05rem; letter-spacing: .03em; }

/* Gallery */
.gal { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; }
@media (min-width: 760px) { .gal { grid-template-columns: repeat(5, 1fr); } }
.gal button { padding: 0; border: 0; aspect-ratio: 1; overflow: hidden; border-radius: 6px; cursor: pointer; background: var(--chip); }
.gal img { width: 100%; height: 100%; object-fit: cover; }

/* Awards */
.awards { display: grid; gap: 12px; grid-template-columns: repeat(2, 1fr); }
@media (min-width: 760px) { .awards { grid-template-columns: repeat(4, 1fr); } }
.award { position: relative; border-radius: 12px; padding: 8px; background: linear-gradient(145deg, #e6c56a, #a8822f 50%, #e9cf85); box-shadow: var(--shadow); }
.award.silver { background: linear-gradient(145deg, #e4e7ea, #9aa1a7 50%, #eef0f2); }
.award.nov { background: linear-gradient(145deg, #4cc88f, #11804f 50%, #4cc88f); }
.award.shoey { background: linear-gradient(145deg, #f2a35c, #a5501a 50%, #f5b47a); }
.award .in { background: #1c2a6b; border-radius: 6px; overflow: hidden; color: #fff; text-align: center; height: 100%; display: flex; flex-direction: column; }
.award .ph { aspect-ratio: 4 / 5; background: #121c4d center / cover no-repeat; display: grid; place-items: center; font-size: 2.4rem; }
.award .cap { padding: 8px 6px 10px; }
.award .cat { font-size: .66rem; text-transform: uppercase; letter-spacing: .08em; color: var(--gold-soft); font-weight: 700; }
.award .wn { font-family: var(--serif); font-weight: 700; font-size: 1rem; line-height: 1.15; }
.award .dt { font-size: .75rem; color: #c9d0ec; }
.award .acts { display: flex; gap: 4px; justify-content: center; margin-top: 6px; }

/* Modal and toast */
.modal-bg { position: fixed; inset: 0; z-index: 50; background: rgba(5, 20, 12, .55); display: flex; align-items: flex-end; justify-content: center; animation: fade .15s; }
@media (min-width: 640px) { .modal-bg { align-items: center; } }
.modal { background: var(--card); width: 100%; max-width: 560px; max-height: 92vh; overflow: auto; border-radius: 18px 18px 0 0; padding: 18px 16px calc(18px + env(safe-area-inset-bottom)); }
@media (min-width: 640px) { .modal { border-radius: 18px; } }
.modal.wide { max-width: 760px; }
.modal .mh { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.modal .mh h2 { margin: 0; }
@keyframes fade { from { opacity: 0; } }
#toast { position: fixed; left: 50%; bottom: calc(86px + env(safe-area-inset-bottom)); transform: translateX(-50%) translateY(20px); background: #10241a; color: #fff; padding: 10px 16px; border-radius: 10px; font-size: .9rem; opacity: 0; pointer-events: none; transition: .2s; z-index: 60; max-width: calc(100% - 32px); }
#toast.show { opacity: 1; transform: translateX(-50%); }
#toast.err { background: var(--danger); }
.lightbox img { max-height: 70vh; margin: 0 auto; border-radius: 8px; }
.card-preview { max-width: 360px; margin: 0 auto; border-radius: 8px; box-shadow: var(--shadow); }

/* Login */
.login { min-height: 100vh; background: linear-gradient(180deg, rgba(12,20,64,.15) 0%, rgba(12,20,64,0) 35%, rgba(12,20,64,.45) 100%), url(/img/course.jpg) center 60% / cover no-repeat #6fb6ea; display: flex; align-items: center; justify-content: center; padding: 24px 16px; }
.login .box { width: 100%; max-width: 420px; }
.login .brand { text-align: center; color: #fff; margin-bottom: 18px; }
.login .brand img { width: 240px; height: auto; margin: 0 auto 10px; filter: drop-shadow(0 8px 20px rgba(0,0,0,.35)); }
.login .brand h1 { color: #fff; font-size: 1.7rem; margin-bottom: 4px; text-shadow: 0 2px 10px rgba(12,20,64,.6); }
.login .brand p { color: #fff; margin: 0; font-size: .9rem; font-weight: 600; text-shadow: 0 1px 6px rgba(12,20,64,.7); }
.login .card { padding: 20px; }
.namelist { max-height: 46vh; overflow: auto; margin: 8px -4px 10px; }
.namelist button { display: flex; align-items: center; gap: 10px; width: 100%; padding: 10px 8px; border: 0; background: none; border-radius: 10px; cursor: pointer; text-align: left; font-weight: 600; }
.namelist button:hover { background: var(--chip); }
.pin { letter-spacing: .5em; text-align: center; font-size: 1.4rem; }
.credit { position: fixed; right: 8px; bottom: 6px; font-size: .62rem; color: rgba(255,255,255,.8); text-shadow: 0 1px 3px rgba(0,0,0,.7); }
.credit a { color: inherit; }
.link-btn { background: none; border: 0; color: var(--green-3); font-weight: 600; cursor: pointer; padding: 6px 0; }
