/* Kern Kiwanis Member Hub */
body.hub-page { background: var(--water); }
body.hub-page .site-footer { display: none; }

/* ---------- Sign in / create account ---------- */
.auth { min-height: calc(100vh - 115px); display: grid; grid-template-columns: 1fr 460px; gap: 56px; align-items: center; max-width: var(--max); margin: 0 auto; padding: 56px 24px; }
.auth h1 { font-size: clamp(2.3rem, 5vw, 3.6rem); }
.auth .ticks li { margin-bottom: .7em; }
.auth-card { background: var(--white); border-radius: var(--r-lg); padding: 30px; box-shadow: 0 30px 60px -30px rgba(7,28,61,.35); border-top: 6px solid var(--gold); }
.tabs { display: flex; gap: 4px; background: var(--water); padding: 4px; border-radius: 10px; margin-bottom: 22px; }
.tabs button { flex: 1; border: 0; background: transparent; font: 700 .95rem var(--sans); color: var(--muted); padding: 10px; border-radius: 8px; cursor: pointer; }
.tabs button[aria-selected="true"] { background: var(--white); color: var(--navy); box-shadow: 0 1px 3px rgba(7,28,61,.15); }
.form-error { background: #fbe9e7; color: var(--danger); border-radius: var(--r-sm); padding: 10px 12px; font-size: .92rem; margin-bottom: 14px; }
.form-ok { background: #e6f3ea; color: var(--ok); border-radius: var(--r-sm); padding: 10px 12px; font-size: .92rem; margin-bottom: 14px; }
.hint { font-size: .85rem; color: var(--muted); margin-top: 6px; }
@media (max-width: 900px) { .auth { grid-template-columns: 1fr; gap: 28px; padding-top: 36px; } }

/* ---------- App shell ---------- */
.hub { display: grid; grid-template-columns: 290px 1fr; height: calc(100vh - 115px); max-width: 1500px; margin: 0 auto; }
.hub-side { background: var(--navy-deep); color: #c8d3e5; overflow-y: auto; padding: 18px 14px 30px; }
.me { display: flex; gap: 12px; align-items: center; padding: 8px 8px 18px; border-bottom: 1px solid rgba(255,255,255,.12); margin-bottom: 12px; }
.av { width: 38px; height: 38px; flex: none; border-radius: 50%; background: var(--gold); color: var(--navy-deep); display: grid; place-items: center; font-weight: 700; font-size: .85rem; }
.me strong { color: var(--white); display: block; line-height: 1.2; }
.me small { color: #9fb0ca; text-transform: capitalize; }
.side-group { margin: 16px 0 6px; padding: 0 10px; font-family: var(--head); color: var(--gold); font-size: 1rem; font-weight: 600; }
.side-link { display: flex; align-items: center; gap: 10px; color: #dbe3f0; text-decoration: none; padding: 8px 10px; border-radius: 8px; font-size: .95rem; font-weight: 600; }
.side-link:hover { background: rgba(255,255,255,.07); color: var(--white); }
.side-link[aria-current="page"] { background: var(--white); color: var(--navy); }
.side-link svg { width: 18px; height: 18px; flex: none; }
.side-link .dot { margin-left: auto; width: 9px; height: 9px; border-radius: 50%; background: var(--gold); }
.side-link .lock { margin-left: auto; opacity: .55; }
.side-link.space::before { content: "#"; color: var(--gold); font-weight: 700; width: 18px; text-align: center; }
.side-link[aria-current="page"].space::before { color: var(--navy); }

.hub-main { display: flex; flex-direction: column; min-width: 0; background: var(--white); }
.main-head { display: flex; align-items: center; gap: 14px; padding: 18px 28px 0; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.main-head .titles { flex: 1; min-width: 200px; padding-bottom: 14px; }
.main-head h1 { font-size: 1.75rem; margin: 0; }
.main-head p { margin: 2px 0 0; color: var(--muted); font-size: .95rem; }
.main-tabs { display: flex; gap: 4px; width: 100%; }
.main-tabs a { text-decoration: none; color: var(--muted); font-weight: 700; font-size: .95rem; padding: 10px 14px; border-bottom: 3px solid transparent; }
.main-tabs a[aria-current="page"] { color: var(--navy); border-color: var(--gold); }
.main-body { flex: 1; overflow-y: auto; padding: 24px 28px 40px; }
.side-toggle { display: none; background: var(--water); border: 0; border-radius: 8px; padding: 9px 12px; font: 700 .9rem var(--sans); color: var(--navy); cursor: pointer; margin-bottom: 14px; }
.banner { background: var(--gold-soft); color: #5b4708; padding: 12px 16px; border-radius: var(--r-sm); font-size: .95rem; margin-bottom: 18px; }

@media (max-width: 900px) {
  .hub { grid-template-columns: 1fr; height: auto; min-height: calc(100vh - 115px); }
  .hub-side { position: fixed; inset: 0 30% 0 0; z-index: 80; transform: translateX(-102%); transition: transform .25s var(--ease); box-shadow: 20px 0 50px rgba(0,0,0,.3); }
  .hub.side-open .hub-side { transform: none; }
  .hub.side-open::after { content: ""; position: fixed; inset: 0; background: rgba(7,28,61,.35); z-index: 70; }
  .side-toggle { display: inline-block; }
  .main-head { padding: 16px 18px 0; }
  .main-body { padding: 18px; }
}

/* ---------- Chat ---------- */
.chat { display: flex; flex-direction: column; height: 100%; }
.main-body.chat-body { padding: 0; display: flex; flex-direction: column; overflow: hidden; }
.msgs { flex: 1; overflow-y: auto; padding: 22px 28px 10px; }
.day { text-align: center; margin: 18px 0 10px; font-size: .8rem; font-weight: 700; color: var(--muted); }
.day span { background: var(--white); padding: 0 12px; position: relative; }
.day::before { content: ""; display: block; height: 1px; background: var(--line); margin-bottom: -10px; }
.msg { display: grid; grid-template-columns: 38px 1fr; gap: 12px; padding: 6px 8px; border-radius: 10px; position: relative; }
.msg:hover { background: #f6f8fc; }
.msg .av { background: var(--navy); color: var(--gold); }
.msg .who { font-weight: 700; color: var(--navy); margin-right: 8px; }
.msg time { color: var(--muted); font-size: .8rem; }
.msg .text { white-space: pre-wrap; overflow-wrap: anywhere; margin-top: 1px; }
.msg .text a { word-break: break-all; }
.msg .del { position: absolute; right: 8px; top: 6px; display: none; background: var(--white); border: 1px solid var(--line); border-radius: 6px; font-size: .78rem; padding: 2px 8px; cursor: pointer; color: var(--danger); }
.msg:hover .del, .msg:focus-within .del { display: block; }
.msg.cont { grid-template-columns: 38px 1fr; padding-top: 0; }
.msg.cont .av, .msg.cont .head { visibility: hidden; height: 0; }
.msg.new { animation: rise .35s var(--ease); }
.composer { border-top: 1px solid var(--line); padding: 14px 28px 18px; display: flex; gap: 10px; align-items: flex-end; background: var(--white); }
.composer textarea { min-height: 48px; max-height: 180px; resize: none; }
.composer .btn { flex: none; }
.empty { text-align: center; color: var(--muted); padding: 40px 20px; }
.empty h3 { color: var(--navy); }
@media (max-width: 900px) { .msgs { padding: 16px 14px 8px; } .composer { padding: 12px 14px 14px; } }

/* ---------- To-dos ---------- */
.todo-add { display: grid; grid-template-columns: 1fr 160px 170px auto; gap: 10px; margin-bottom: 22px; }
@media (max-width: 760px) { .todo-add { grid-template-columns: 1fr 1fr; } .todo-add input[name=title] { grid-column: 1 / -1; } }
.todo { display: grid; grid-template-columns: 34px 1fr auto; gap: 12px; align-items: start; padding: 14px 4px; border-bottom: 1px solid var(--line); }
.check { width: 26px; height: 26px; border-radius: 50%; border: 2px solid var(--navy); background: var(--white); cursor: pointer; display: grid; place-items: center; padding: 0; margin-top: 1px; transition: background .15s, transform .15s var(--ease); }
.check:hover { background: var(--water); }
.check svg { width: 14px; height: 14px; opacity: 0; }
.todo.done .check { background: var(--gold); border-color: var(--gold); }
.todo.done .check svg { opacity: 1; }
.todo.done .t-title { text-decoration: line-through; color: var(--muted); }
.check.pop { transform: scale(1.18); }
.t-title { font-weight: 600; }
.t-meta { font-size: .86rem; color: var(--muted); margin-top: 2px; }
.t-meta .tag { display: inline-block; background: var(--water); color: var(--navy); border-radius: 999px; padding: 1px 9px; font-weight: 600; margin-right: 6px; }
.t-meta .due-soon { color: var(--danger); font-weight: 700; }
.row-actions { display: flex; gap: 6px; }
.link-btn { background: none; border: 0; padding: 4px 6px; color: var(--navy); font: 600 .85rem var(--sans); cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }
.link-btn.danger { color: var(--danger); }
.filters { display: flex; gap: 6px; margin-bottom: 16px; flex-wrap: wrap; }
.filters button { border: 1.5px solid var(--line); background: var(--white); border-radius: 999px; padding: 6px 14px; font: 600 .88rem var(--sans); color: var(--muted); cursor: pointer; }
.filters button[aria-pressed="true"] { border-color: var(--navy); color: var(--white); background: var(--navy); }
.group-title { font-family: var(--head); font-size: 1.15rem; color: var(--navy); margin: 26px 0 4px; }

/* ---------- Files ---------- */
.drop { border: 2px dashed #a9bbd5; border-radius: var(--r-md); padding: 24px; text-align: center; background: #f6f9fd; margin-bottom: 22px; transition: background .15s, border-color .15s; }
.drop.over { background: var(--gold-soft); border-color: var(--gold); }
.drop .opts { display: flex; gap: 14px; justify-content: center; align-items: center; flex-wrap: wrap; margin-top: 12px; font-size: .92rem; }
.drop label.inline { display: inline-flex; gap: 6px; align-items: center; font-weight: 600; margin: 0; }
.drop input[type=checkbox] { width: auto; }
.file { display: grid; grid-template-columns: 44px 1fr auto; gap: 14px; align-items: center; padding: 12px 4px; border-bottom: 1px solid var(--line); }
.ficon { width: 44px; height: 52px; border-radius: 6px; background: var(--water); color: var(--navy); display: grid; place-items: center; font-size: .7rem; font-weight: 700; position: relative; }
.ficon::after { content: ""; position: absolute; top: 0; right: 0; border-width: 0 12px 12px 0; border-style: solid; border-color: var(--water-2) var(--white); }
.f-name { font-weight: 600; overflow-wrap: anywhere; }
.f-meta { font-size: .85rem; color: var(--muted); }
.progress { height: 6px; background: var(--water); border-radius: 3px; overflow: hidden; margin-top: 12px; }
.progress span { display: block; height: 100%; background: var(--gold); width: 0; transition: width .2s; }

/* ---------- Calendar ---------- */
.cal-grid-wrap { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 28px; }
@media (max-width: 1100px) { .cal-grid-wrap { grid-template-columns: 1fr; } }
.cal-head { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.cal-head h2 { font-size: 1.5rem; margin: 0 auto 0 0; }
.icon-btn { width: 38px; height: 38px; border-radius: 8px; border: 1.5px solid var(--line); background: var(--white); cursor: pointer; font-size: 1.1rem; color: var(--navy); }
.icon-btn:hover { border-color: var(--navy); }
.month { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); border-top: 1px solid var(--line); border-left: 1px solid var(--line); }
.month .dow { font-size: .78rem; font-weight: 700; color: var(--muted); padding: 6px 8px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); background: #f6f8fc; }
.cell { min-width: 0; overflow: hidden; min-height: 98px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); padding: 6px; font-size: .8rem; cursor: pointer; background: var(--white); text-align: left; font-family: inherit; color: inherit; border-top: 0; border-left: 0; display: block; width: 100%; }
.cell:hover { background: #f6f9fd; }
.cell.other { background: #fafbfd; color: #a6b1c2; }
.cell .n { font-weight: 700; display: inline-grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; }
.cell.today .n { background: var(--gold); color: var(--navy-deep); }
.cell.sel { outline: 2px solid var(--navy); outline-offset: -2px; }
.pill { display: block; margin-top: 3px; padding: 2px 6px; border-radius: 4px; background: var(--water); color: var(--navy); font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pill.meeting { background: var(--navy); color: var(--white); }
.pill.private { background: var(--gold-soft); color: #5b4708; }
@media (max-width: 700px) { .cell { min-height: 58px; } .pill { font-size: 0; height: 6px; padding: 0; margin-top: 4px; } }
.day-panel h3 { margin-top: 0; }
.day-event { padding: 12px 0; border-bottom: 1px solid var(--line); }
.day-event h4 { font-family: var(--sans); font-size: 1rem; margin: 0 0 2px; color: var(--navy); }
.day-event p { margin: 0 0 8px; font-size: .9rem; color: var(--muted); }
.badge { display: inline-block; font-size: .72rem; font-weight: 700; border-radius: 999px; padding: 1px 8px; background: var(--gold-soft); color: #5b4708; margin-left: 6px; vertical-align: middle; }

dialog { border: 0; border-radius: var(--r-lg); padding: 0; width: min(560px, 94vw); box-shadow: 0 40px 80px -30px rgba(7,28,61,.6); }
dialog::backdrop { background: rgba(7,28,61,.45); }
dialog form { padding: 26px; }
dialog h2 { font-size: 1.5rem; }
.check-row { display: flex; gap: 8px; align-items: center; font-weight: 600; color: var(--navy); }
.check-row input { width: auto; }

/* ---------- Tables (people, admin) ---------- */
.table { width: 100%; border-collapse: collapse; font-size: .95rem; }
.table th { text-align: left; font-size: .8rem; color: var(--muted); font-weight: 700; padding: 8px 10px; border-bottom: 2px solid var(--line); }
.table td { padding: 12px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table select { width: auto; padding: 6px 10px; font-size: .9rem; }
.role { text-transform: capitalize; font-weight: 600; }
.role.guest { color: #8a6a10; }
@media (max-width: 760px) {
  .table thead { display: none; }
  .table tr { display: block; border-bottom: 1px solid var(--line); padding: 10px 0; }
  .table td { display: block; border: 0; padding: 3px 0; }
}
.toast { position: fixed; bottom: 24px; left: 50%; max-width: 90vw; text-align: center; transform: translateX(-50%); background: var(--navy-deep); color: var(--white); padding: 12px 20px; border-radius: 10px; font-weight: 600; z-index: 100; animation: rise .25s var(--ease); box-shadow: 0 14px 30px -10px rgba(0,0,0,.4); }

/* Rename inline form */
.rename { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.rename input { flex: 1; min-width: 180px; padding: 8px 10px; font-size: .95rem; }
.pill.cancelled { text-decoration: line-through; opacity: .6; }

/* Handbook */
.handbook { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 36px; align-items: start; }
.hb-nav { position: sticky; top: 0; display: flex; flex-direction: column; gap: 2px; }
.hb-nav a { text-decoration: none; color: var(--muted); font-weight: 600; font-size: .95rem; padding: 8px 12px; border-radius: 8px; border-left: 3px solid transparent; }
.hb-nav a:hover { background: var(--water); color: var(--navy); }
.hb-nav a[aria-current="page"] { color: var(--navy); background: var(--water); border-left-color: var(--gold); }
.hb-body { max-width: 72ch; }
.hb-body h2 { font-size: 1.9rem; }
.hb-body h3 { margin-top: 1.6em; font-size: 1.25rem; }
.hb-body .roster li span:last-child { max-width: 60%; }
@media (max-width: 860px) {
  .handbook { grid-template-columns: 1fr; gap: 16px; }
  .hb-nav { position: static; flex-direction: row; flex-wrap: wrap; }
  .hb-nav a { border-left: 0; border: 1.5px solid var(--line); border-radius: 999px; padding: 6px 12px; font-size: .88rem; }
}

/* ---------- Hub home ---------- */
.guest-link { display: block; text-align: center; margin-top: 14px; font-weight: 700; color: var(--muted); }
.side-help { width: 100%; background: rgba(214,160,29,.16); border: 0; font: inherit; cursor: pointer; color: var(--gold) !important; margin: 4px 0 8px; }
.head-nav { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.back-home { display: none; font-weight: 700; text-decoration: none; background: var(--navy); color: var(--white); border-radius: 8px; padding: 9px 14px; margin-bottom: 14px; }
.ask-big { display: flex; align-items: center; gap: 16px; width: 100%; text-align: left; border: 0; cursor: pointer; background: linear-gradient(120deg, var(--navy), #163f80); color: #d6e0f0; border-radius: var(--r-lg); padding: 18px 22px; font: inherit; margin-bottom: 22px; box-shadow: 0 14px 30px -18px rgba(7,28,61,.6); }
.ask-big strong { display: block; color: var(--white); font-family: var(--head); font-size: 1.35rem; }
.mic-dot { width: 56px; height: 56px; border-radius: 50%; background: var(--gold); color: var(--navy-deep); display: grid; place-items: center; flex: none; animation: micPulse 2.6s ease-in-out infinite; }
.mic-dot svg { width: 26px; height: 26px; }
@keyframes micPulse { 0%, 100% { box-shadow: 0 0 0 0 rgba(214,160,29,.55); } 50% { box-shadow: 0 0 0 12px rgba(214,160,29,0); } }
.home-grid { display: grid; grid-template-columns: 1.2fr 1fr; gap: 20px; align-items: start; }
.home-card { background: var(--white); border: 1.5px solid var(--line); border-radius: var(--r-lg); padding: 20px 22px; }
.home-card h2 { font-size: 1.4rem; display: flex; align-items: center; gap: 10px; }
.count { font-family: var(--sans); font-size: .85rem; background: var(--gold); color: var(--navy-deep); border-radius: 999px; padding: 2px 10px; }
.chats-card { grid-row: span 3; }
.chat-row { display: grid; grid-template-columns: 1fr auto; grid-template-rows: auto auto; column-gap: 12px; text-decoration: none; color: var(--text); padding: 14px 12px; border-radius: 12px; border-bottom: 1px solid var(--line); min-height: 64px; }
.chat-row:hover { background: var(--water); }
.cr-name { font-weight: 700; font-size: 1.1rem; color: var(--navy); }
.cr-meta { grid-row: 2; font-size: .92rem; color: var(--muted); }
.cr-go { grid-row: 1 / span 2; grid-column: 2; align-self: center; font-size: 1.8rem; color: var(--muted); }
.chat-row.unread { background: var(--gold-soft); }
.chat-row.unread .cr-meta { color: #8a5a00; font-weight: 700; }
.chat-row.unread .cr-name::after { content: ""; display: inline-block; width: 10px; height: 10px; border-radius: 50%; background: var(--gold); margin-left: 8px; vertical-align: middle; }
.chat-row.locked { opacity: .55; }
.wk-row { display: grid; grid-template-columns: 1fr; padding: 10px 0; border-bottom: 1px solid var(--line); }
.wk-row strong { color: var(--navy); font-size: .95rem; }
.wk-row small { color: var(--muted); }
.home-btn { width: 100%; margin-top: 14px; }
.tiles { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.tiles a { display: flex; flex-direction: column; align-items: center; gap: 6px; text-decoration: none; color: var(--navy); font-weight: 700; font-size: .92rem; padding: 14px 6px; border-radius: 12px; background: var(--water); }
.tiles svg { width: 26px; height: 26px; }
@media (max-width: 900px) {
  .home-grid { grid-template-columns: 1fr; }
  .chats-card { grid-row: auto; }
  .back-home { display: inline-block; }
  .side-toggle { margin-bottom: 14px; }
  .main-body.chat-body .msgs { flex: none; height: calc(100dvh - 330px); min-height: 260px; }
  .composer { position: sticky; bottom: calc(68px + env(safe-area-inset-bottom)); }
  .composer textarea { font-size: 1.05rem; }
  .msg .text { font-size: 1.05rem; }
}
.pw-wrap { position: relative; }
.pw-wrap input { padding-right: 84px; }
.pw-toggle { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); min-height: 40px; padding: 0 14px; border: 0; border-radius: 8px; background: var(--water); color: var(--navy); font: 700 .95rem var(--sans); cursor: pointer; }
.remember { display: flex; align-items: center; gap: 10px; font-weight: 600; color: var(--text); margin: 4px 0 18px; cursor: pointer; }
.remember input { width: 22px; height: 22px; accent-color: var(--navy); flex: none; }
@media (max-width: 900px) {
  .auth { padding-top: 20px; gap: 20px; }
  .auth-card { order: -1; }
  .auth > div:first-child h1 { font-size: 1.8rem; }
}
.forgot-link { display: block; width: 100%; background: none; border: 0; margin-top: 14px; padding: 8px; font: 700 1rem var(--sans); color: var(--navy); text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }
