[hidden] { display: none !important; }
:root {
  --brand: #16324f;      /* navy - change to SN brand colour */
  --brand-2: #1f4a73;
  --accent: #f28c28;     /* orange accent */
  --accent-soft: #fff1e3;
  --ok: #1e9e6a; --ok-soft: #e3f6ee;
  --warn: #c98a00; --warn-soft: #fff6dc;
  --bad: #d14343; --bad-soft: #fdeaea;
  --bg: #f4f6f9; --card: #fff; --text: #1d2733; --muted: #6b7785; --line: #e3e8ee;
  --radius: 14px; --shadow: 0 2px 10px rgba(22, 50, 79, .07);
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); font: 15px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
a { color: var(--brand-2); }
h1 { font-size: 1.45rem; margin: 0 0 .25rem; color: var(--brand); }
h2 { font-size: 1.1rem; margin: 0 0 .6rem; color: var(--brand); }
h3 { font-size: 1rem; margin: 0 0 .4rem; }
.muted { color: var(--muted); } .small { font-size: .85rem; } .right { text-align: right; }
.view { max-width: 1060px; margin: 0 auto; padding: 16px 14px 96px; }

/* top bar */
.topbar { position: sticky; top: 0; z-index: 20; background: var(--brand); color: #fff; display: flex; align-items: center; gap: 16px; padding: 10px 16px; box-shadow: 0 2px 8px rgba(0,0,0,.15); }
.brand { display: flex; align-items: center; gap: 10px; color: #fff; text-decoration: none; }
.brand img { width: 34px; height: 34px; }
.brand strong { display: block; font-size: 1rem; } .brand small { display: block; font-size: .72rem; opacity: .8; letter-spacing: .03em; }
.topnav { margin-left: auto; display: flex; gap: 4px; flex-wrap: wrap; }
.topnav a { color: #fff; text-decoration: none; padding: 7px 11px; border-radius: 8px; font-size: .9rem; opacity: .85; position: relative; }
.topnav a:hover, .topnav a.active { background: rgba(255,255,255,.14); opacity: 1; }
.bottomnav { display: none; }
.badge { display: inline-block; min-width: 18px; padding: 0 5px; height: 18px; line-height: 18px; border-radius: 9px; background: var(--accent); color: #fff; font-size: .7rem; font-weight: 700; text-align: center; margin-left: 4px; }
@media (max-width: 760px) {
  .topnav { display: none; }
  .bottomnav { display: flex; position: fixed; bottom: 0; left: 0; right: 0; z-index: 20; background: #fff; border-top: 1px solid var(--line); padding: 4px 4px calc(4px + env(safe-area-inset-bottom)); }
  .bottomnav a { flex: 1; text-align: center; text-decoration: none; color: var(--muted); font-size: .7rem; padding: 6px 2px; border-radius: 8px; position: relative; }
  .bottomnav a .ico { display: block; font-size: 1.25rem; line-height: 1.2; }
  .bottomnav a.active { color: var(--brand); font-weight: 600; background: var(--accent-soft); }
  .bottomnav .badge { position: absolute; top: 2px; right: 18%; }
}

/* layout */
.grid { display: grid; gap: 14px; }
.grid.two { grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }
.grid.stats { grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); }
.card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px; border: 1px solid var(--line); }
.card.hero { background: linear-gradient(135deg, var(--brand), var(--brand-2)); color: #fff; border: 0; }
.card.hero h1, .card.hero h2 { color: #fff; }
.stat { text-align: center; padding: 14px 8px; }
.stat .num { font-size: 1.9rem; font-weight: 800; color: var(--brand); line-height: 1.1; }
.stat .lbl { font-size: .8rem; color: var(--muted); }
.hero .stat .num { color: #fff; } .hero .stat .lbl { color: rgba(255,255,255,.8); }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.stack > * + * { margin-top: 10px; }
.spacer { height: 14px; }
.pagehead { display: flex; justify-content: space-between; align-items: flex-end; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }

/* forms */
label { display: block; font-size: .85rem; font-weight: 600; margin-bottom: 4px; color: #3a4654; }
input, select, textarea { width: 100%; padding: 10px 12px; border: 1px solid #cfd7e0; border-radius: 10px; font: inherit; background: #fff; color: var(--text); }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); border-color: transparent; }
input[type=checkbox] { width: auto; transform: scale(1.2); margin-right: 8px; }
.check { display: flex; align-items: flex-start; gap: 4px; font-weight: 500; }
.field { margin-bottom: 12px; }
.fields { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 0 12px; }
button, .btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 10px 16px; border-radius: 10px; border: 1px solid transparent; background: var(--brand); color: #fff; font: inherit; font-weight: 600; cursor: pointer; text-decoration: none; }
button:hover, .btn:hover { filter: brightness(1.08); }
button:disabled { opacity: .5; cursor: default; }
.btn-accent { background: var(--accent); }
.btn-ghost { background: #fff; color: var(--brand); border-color: #cfd7e0; }
.btn-ok { background: var(--ok); } .btn-bad { background: var(--bad); }
.btn-sm { padding: 6px 10px; font-size: .83rem; border-radius: 8px; }
.btn-block { width: 100%; }
.seg { display: inline-flex; background: #e9eef4; border-radius: 10px; padding: 3px; gap: 2px; flex-wrap: wrap; }
.seg button { background: transparent; color: var(--muted); padding: 7px 12px; font-size: .88rem; }
.seg button.on { background: #fff; color: var(--brand); box-shadow: var(--shadow); }

/* RSVP buttons */
.rsvp { display: flex; gap: 6px; flex-wrap: wrap; }
.rsvp button { background: #fff; color: var(--text); border: 1px solid #cfd7e0; padding: 8px 12px; font-weight: 600; }
.rsvp button.on.going { background: var(--ok); color: #fff; border-color: var(--ok); }
.rsvp button.on.not_going { background: var(--bad); color: #fff; border-color: var(--bad); }
.rsvp button.on.maybe { background: var(--warn); color: #fff; border-color: var(--warn); }

/* pills */
.pill { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: .75rem; font-weight: 700; background: #e9eef4; color: var(--muted); }
.pill.approved, .pill.going { background: var(--ok-soft); color: var(--ok); }
.pill.pending, .pill.maybe { background: var(--warn-soft); color: var(--warn); }
.pill.rejected, .pill.not_going { background: var(--bad-soft); color: var(--bad); }
.pill.accent { background: var(--accent-soft); color: #b35d0b; }

/* lists / tables */
.list { list-style: none; margin: 0; padding: 0; }
.list li { padding: 11px 0; border-bottom: 1px solid var(--line); }
.list li:last-child { border-bottom: 0; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .9rem; }
th, td { padding: 9px 8px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
th { font-size: .75rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
tr.me td { background: var(--accent-soft); }
.meeting-date { min-width: 58px; text-align: center; background: var(--accent-soft); border-radius: 10px; padding: 6px 4px; color: #b35d0b; }
.meeting-date .d { font-size: 1.4rem; font-weight: 800; line-height: 1; }
.meeting-date .m { font-size: .72rem; text-transform: uppercase; font-weight: 700; }

/* chat */
.chat { display: grid; grid-template-columns: 260px 1fr; gap: 14px; height: calc(100vh - 150px); min-height: 420px; }
.chat-list { overflow-y: auto; padding: 8px; }
.chat-list a { display: flex; justify-content: space-between; align-items: center; padding: 10px; border-radius: 10px; text-decoration: none; color: var(--text); }
.chat-list a.on { background: var(--accent-soft); }
.chat-list a small { display: block; color: var(--muted); font-size: .75rem; }
.chat-main { display: flex; flex-direction: column; padding: 0; overflow: hidden; }
.chat-head { padding: 12px 16px; border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 10px; }
.chat-msgs { flex: 1; overflow-y: auto; padding: 14px; background: #f8fafc; }
.msg { max-width: 78%; margin-bottom: 10px; }
.msg .bubble { background: #fff; border: 1px solid var(--line); padding: 8px 12px; border-radius: 14px 14px 14px 4px; white-space: pre-wrap; word-wrap: break-word; }
.msg .meta { font-size: .72rem; color: var(--muted); margin: 0 4px 2px; }
.msg.mine { margin-left: auto; text-align: right; }
.msg.mine .bubble { background: var(--brand); color: #fff; border-color: var(--brand); border-radius: 14px 14px 4px 14px; text-align: left; }
.chat-input { display: flex; gap: 8px; padding: 10px; border-top: 1px solid var(--line); background: #fff; }
.chat-input textarea { resize: none; height: 44px; }
.chat-back { display: none; }
@media (max-width: 760px) {
  .chat { grid-template-columns: 1fr; height: calc(100vh - 150px); }
  .chat.has-channel .chat-list { display: none; }
  .chat:not(.has-channel) .chat-main { display: none; }
  .chat-back { display: inline-flex; }
}

/* modal & toast */
.modal { position: fixed; inset: 0; background: rgba(14, 28, 44, .5); z-index: 50; display: flex; align-items: center; justify-content: center; padding: 16px; }
.modal-card { background: #fff; border-radius: var(--radius); width: 100%; max-width: 560px; max-height: 90vh; overflow-y: auto; padding: 20px; }
.toast { position: fixed; left: 50%; bottom: 84px; transform: translateX(-50%); background: var(--text); color: #fff; padding: 10px 18px; border-radius: 10px; z-index: 60; box-shadow: var(--shadow); max-width: 90vw; }
.toast.error { background: var(--bad); }

/* auth */
.auth { max-width: 420px; margin: 6vh auto; }
.auth .logo { text-align: center; margin-bottom: 16px; }
.auth .logo img { width: 72px; }
.notice { background: var(--accent-soft); border-left: 4px solid var(--accent); padding: 10px 12px; border-radius: 8px; font-size: .9rem; }
.empty { text-align: center; color: var(--muted); padding: 24px 8px; }
.tabs { display: flex; gap: 6px; overflow-x: auto; margin-bottom: 14px; padding-bottom: 2px; }
.tabs a { white-space: nowrap; padding: 8px 14px; border-radius: 999px; background: #fff; border: 1px solid var(--line); text-decoration: none; color: var(--text); font-size: .9rem; }
.tabs a.on { background: var(--brand); color: #fff; border-color: var(--brand); }
.points-tag { font-weight: 800; color: var(--accent); }
.rules dt { font-weight: 700; color: var(--brand); margin-top: 12px; }
.rules dd { margin: 2px 0 0; color: #3a4654; }
.att-row { display: flex; align-items: center; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--line); }
.att-row label { margin: 0; flex: 1; font-weight: 500; display: flex; align-items: center; }
.winner { text-align: center; padding: 22px; background: var(--accent-soft); border-radius: var(--radius); }
.winner .name { font-size: 1.5rem; font-weight: 800; color: var(--brand); }
