:root {
  --navy: #14264b;
  --blue: #1f3f7a;
  --saffron: #f0a21b;
  --saffron-d: #b86f00;
  --cream: #fbf6ea;
  --ink: #1b2236;
  --muted: #667089;
  --line: #e7dfcb;
  --card: #ffffff;
  --danger: #b3261e;
  --ok: #1d7a46;
  --radius: 16px;
  --nav-h: 64px;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--cream);
  color: var(--ink);
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
h1, h2, h3 { font-family: Georgia, "Times New Roman", serif; color: var(--navy); line-height: 1.2; margin: 0 0 .5rem; }
h1 { font-size: 1.7rem; }
h2 { font-size: 1.25rem; margin-top: 1.6rem; }
a { color: var(--blue); }
small { color: var(--muted); font-size: .8rem; letter-spacing: .02em; text-transform: uppercase; }
p { margin: 0 0 .8rem; }
.loading { text-align: center; padding: 3rem 1rem; color: var(--muted); }
.empty { color: var(--muted); text-align: center; padding: 1.2rem 0; }

/* Header and navigation */
.top {
  position: sticky; top: 0; z-index: 5;
  display: flex; align-items: center; gap: .6rem;
  padding: calc(.6rem + env(safe-area-inset-top)) 1rem .6rem;
  background: var(--navy); color: #fff;
}
.top img { width: 30px; height: 30px; border-radius: 8px; }
.top strong { font-family: Georgia, serif; font-weight: 600; letter-spacing: .01em; }

.wrap { max-width: 640px; margin: 0 auto; padding: 1rem 1rem calc(var(--nav-h) + 2rem + env(safe-area-inset-bottom)); }

.tabs {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 6;
  display: flex; justify-content: space-around;
  height: calc(var(--nav-h) + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
  background: #fff; border-top: 1px solid var(--line);
}
.tabs a {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  font-size: .7rem; color: var(--muted); text-decoration: none; position: relative;
}
.tabs a.on { color: var(--navy); font-weight: 600; }
.tabs a.on svg { stroke: var(--saffron-d); }
.dot { position: absolute; top: 8px; left: calc(50% + 8px); min-width: 16px; height: 16px; padding: 0 4px; border-radius: 8px; background: var(--danger); color: #fff; font-size: .65rem; line-height: 16px; text-align: center; }

/* Cards */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem; margin-bottom: .8rem; }
.hero {
  position: relative; overflow: hidden;
  border-radius: var(--radius); margin-bottom: 1rem; color: #fff;
  background: linear-gradient(135deg, var(--navy), var(--blue));
  background-size: cover; background-position: center;
}
.hero::before { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, rgba(20,38,75,.35), rgba(20,38,75,.85)); }
.hero-in { position: relative; padding: 4.5rem 1.2rem 1.2rem; }
.hero h1 { color: #fff; margin-bottom: .3rem; }
.hero p { margin: 0 0 .5rem; opacity: .95; }
.hero .gurbani { font-size: 1.15rem; margin-top: .8rem; padding-top: .8rem; border-top: 1px solid rgba(255,255,255,.3); }
.hero .gurbani small { color: rgba(255,255,255,.75); display: block; text-transform: none; }

.next { border-left: 5px solid var(--saffron); }
.next .label { color: var(--saffron-d); font-weight: 600; font-size: .8rem; text-transform: uppercase; letter-spacing: .05em; }

/* Session cards */
.session { cursor: pointer; }
.session .srow { display: flex; gap: .9rem; align-items: flex-start; }
.session.past { opacity: .72; }
.datebox { flex: 0 0 56px; border-radius: 12px; background: var(--navy); color: #fff; text-align: center; padding: .4rem 0; align-self: flex-start; }
.datebox b { display: block; font-size: 1.5rem; line-height: 1.1; font-family: Georgia, serif; }
.datebox span { font-size: .7rem; text-transform: uppercase; letter-spacing: .06em; }
.sinfo { flex: 1; min-width: 0; }
.sdate { font-weight: 600; color: var(--navy); }
.sday { color: var(--saffron-d); font-weight: 600; font-size: .95rem; }
.stime { font-size: .95rem; }
.saddr { color: var(--muted); font-size: .9rem; overflow-wrap: anywhere; }
.counts { margin-top: .6rem; font-size: .85rem; color: var(--muted); }
.vote { display: flex; gap: .5rem; margin-top: .6rem; }
.vote .btn { flex: 1; min-height: 44px; }
.credit { margin: -.5rem 0 1rem; font-size: .75rem; color: var(--muted); }

.detail .big { font-family: Georgia, serif; font-size: 1.5rem; color: var(--navy); }
.detail .big2 { font-size: 1.1rem; margin-bottom: .6rem; }
.times { display: flex; gap: 1rem; margin: .4rem 0 1rem; }
.times > div { flex: 1; background: var(--cream); border-radius: 12px; padding: .6rem .8rem; }
.times b { display: block; font-size: 1.25rem; color: var(--navy); }
.back { display: inline-block; margin-bottom: .6rem; text-decoration: none; }

.people { list-style: none; padding: 0; margin: 0; }
.people li { display: flex; align-items: center; justify-content: space-between; gap: .5rem; padding: .55rem 0; border-bottom: 1px solid var(--line); }
.people li:last-child { border-bottom: 0; }
.people .sub { display: block; font-size: .8rem; color: var(--muted); }

/* Buttons and forms */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .4rem;
  min-height: 44px; padding: .55rem 1.1rem; border-radius: 999px;
  border: 1.5px solid var(--navy); background: transparent; color: var(--navy);
  font: inherit; font-weight: 600; text-decoration: none; cursor: pointer;
}
.btn.primary { background: var(--saffron); border-color: var(--saffron); color: #2a1c00; }
.btn.ghost { background: #fff; }
.btn.sel { background: var(--navy); border-color: var(--navy); color: #fff; }
.btn.danger { border-color: var(--danger); color: var(--danger); background: #fff; }
.btn.small { min-height: 36px; padding: .3rem .85rem; font-size: .9rem; }
.btn.block { width: 100%; }
.btn[disabled] { opacity: .55; }
.link { background: none; border: 0; color: var(--blue); font: inherit; text-decoration: underline; cursor: pointer; padding: .3rem; }

label { display: block; margin-bottom: .8rem; font-weight: 600; font-size: .9rem; }
input, select, textarea {
  display: block; width: 100%; margin-top: .25rem; padding: .65rem .75rem;
  border: 1.5px solid var(--line); border-radius: 12px; background: #fff; color: var(--ink);
  font: inherit; font-weight: 400;
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--saffron); border-color: var(--saffron); }
input[type="checkbox"] { display: inline-block; width: auto; margin: 0 .5rem 0 0; }
.check { font-weight: 400; display: flex; align-items: center; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: .8rem; }
.actions { display: flex; gap: .6rem; margin: .4rem 0 .8rem; }
.daylabel { margin: -.4rem 0 .8rem; color: var(--saffron-d); font-weight: 600; }

.note { background: #fff6dc; border: 1px solid #f1d58b; border-radius: 12px; padding: .7rem .9rem; font-size: .92rem; }
.error { color: var(--danger); }

/* Signed out pages */
.auth { max-width: 420px; margin: 0 auto; padding: calc(2rem + env(safe-area-inset-top)) 1.2rem 2rem; text-align: center; }
.auth .logo { width: 96px; height: 96px; border-radius: 24px; box-shadow: 0 6px 20px rgba(20,38,75,.25); }
.auth form { text-align: left; margin: 1.2rem 0; }
.auth .vision { color: var(--muted); }

/* Admin */
.subtabs { display: flex; gap: .4rem; overflow-x: auto; margin: 0 0 1rem; padding-bottom: .2rem; }
.subtabs a { flex: 0 0 auto; padding: .4rem .9rem; border-radius: 999px; border: 1.5px solid var(--line); background: #fff; color: var(--ink); text-decoration: none; font-weight: 600; font-size: .9rem; }
.subtabs a.on { background: var(--navy); border-color: var(--navy); color: #fff; }
.toolbar { display: flex; gap: .5rem; flex-wrap: wrap; margin-bottom: 1rem; }

.cal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: .5rem; }
.cal-head h2 { margin: 0; }
.cal { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.cal .dow { text-align: center; font-size: .7rem; color: var(--muted); text-transform: uppercase; padding: 2px 0; }
.cal .cell { aspect-ratio: 1; border: 1px solid var(--line); border-radius: 10px; background: #fff; padding: 4px; font: inherit; font-size: .85rem; color: var(--ink); cursor: pointer; display: flex; flex-direction: column; align-items: center; justify-content: space-between; }
.cal .cell.blank { border: 0; background: transparent; cursor: default; }
.cal .cell.today { border-color: var(--navy); font-weight: 700; }
.cal .cell.has { background: var(--saffron); border-color: var(--saffron); color: #2a1c00; font-weight: 700; }
.cal .cell small { color: inherit; font-size: .6rem; text-transform: none; }

.badge { display: inline-block; padding: .05rem .5rem; border-radius: 999px; background: var(--navy); color: #fff; font-size: .7rem; font-weight: 600; vertical-align: middle; }
.badge.soft { background: #e9eefb; color: var(--navy); }
.rowbtns { display: flex; gap: .4rem; flex-wrap: wrap; margin-top: .4rem; }
.famhead { margin: 1.2rem 0 .2rem; color: var(--muted); font-size: .85rem; text-transform: uppercase; letter-spacing: .05em; font-weight: 600; }


/* Modal sheet */
.overlay { position: fixed; inset: 0; z-index: 20; background: rgba(15,22,40,.5); display: flex; align-items: flex-end; justify-content: center; }
.sheet { width: 100%; max-width: 560px; max-height: 92vh; overflow-y: auto; background: var(--cream); border-radius: 20px 20px 0 0; padding: 1.2rem 1.2rem calc(1.5rem + env(safe-area-inset-bottom)); }
.sheet h2 { margin-top: 0; }
@media (min-width: 700px) { .overlay { align-items: center; } .sheet { border-radius: 20px; } }

#toast { position: fixed; left: 50%; bottom: calc(var(--nav-h) + 1rem + env(safe-area-inset-bottom)); transform: translate(-50%, 20px); z-index: 30; max-width: 90vw; padding: .7rem 1.1rem; border-radius: 12px; background: var(--ink); color: #fff; opacity: 0; pointer-events: none; transition: .25s; font-size: .92rem; }
#toast.show { opacity: 1; transform: translate(-50%, 0); }
