:root {
  --bg: #f6f7f9;
  --card: #ffffff;
  --text: #1c2330;
  --muted: #6b7482;
  --accent: #7c3aed;
  --accent2: #06b6d4;
  --line: #e3e6eb;
  --danger: #c0392b;
  --rainbow: linear-gradient(90deg, #ef4444, #f59e0b, #10b981, #06b6d4, #7c3aed);
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #14171c;
    --card: #1e232b;
    --text: #e8ebf0;
    --muted: #8b95a4;
    --accent: #a78bfa;
    --accent2: #22d3ee;
    --line: #2c333e;
    --danger: #e0604f;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  padding-bottom: calc(40px + env(safe-area-inset-bottom));
}
main { max-width: 640px; margin: 0 auto; padding: 12px 14px; }
a { color: inherit; text-decoration: none; }
.muted { color: var(--muted); font-weight: normal; }

/* top bar */
.topbar {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 16px;
  padding-top: calc(10px + env(safe-area-inset-top));
  background: var(--card);
  border-bottom: 1px solid var(--line);
  box-shadow: inset 0 -3px 0 0 transparent;
  border-image: none;
}
.topbar::after { content: none; }
.brand { font-weight: 700; font-size: 16px; }
.topbar { border-bottom: 3px solid; border-image: var(--rainbow) 1; }
.topbar nav { display: flex; align-items: center; gap: 2px; }
.topbar nav a {
  padding: 6px 10px; border-radius: 8px; font-size: 14px; white-space: nowrap;
}
.topbar nav a.on { background: var(--accent); color: #fff; }
.topbar nav .quiet { color: var(--muted); }
.logoutform { display: inline; }
.linklike {
  background: none; border: 0; font: inherit; cursor: pointer;
  padding: 6px 10px; border-radius: 8px;
}

/* login / join */
.login-box { max-width: 380px; margin: 8vh auto 0; text-align: center; }
.login-box h1 { margin-bottom: 4px; }
.login-box p.muted { margin-top: 0; line-height: 1.5; }
.login-box form { display: flex; flex-direction: column; gap: 10px; margin-top: 18px; }
.fineprint { font-size: 12px; color: var(--muted); line-height: 1.5; margin-top: 14px; }

/* inputs & buttons, shared */
input, select, textarea {
  width: 100%; padding: 10px 12px; font-size: 16px;
  border: 1px solid var(--line); border-radius: 10px;
  background: var(--card); color: var(--text);
}
input::placeholder { color: var(--muted); }
button {
  padding: 10px 16px; font-size: 15px; font-weight: 600;
  border: 0; border-radius: 10px; background: var(--accent); color: #fff;
  cursor: pointer;
}
button.secondary {
  background: transparent; color: var(--text); border: 1px solid var(--line);
}
button:active { opacity: .8; }
.card {
  background: var(--card); border: 1px solid var(--line); border-radius: 14px;
}
.error { color: var(--danger); margin: 0; font-size: 14px; }
.noneyet { margin: 4px 0 10px; font-size: 13px; color: var(--muted); }
.page-title { margin: 10px 4px 2px; font-size: 20px; }

/* agenda */
.day { margin-top: 20px; }
.day h2 {
  font-size: 15px; margin: 0 0 8px 4px;
  display: flex; align-items: baseline; gap: 8px;
}
.day h2 .date { color: var(--muted); font-weight: normal; }
.day h2 .pill {
  background: var(--accent); color: #fff; font-size: 11px;
  padding: 2px 8px; border-radius: 999px; font-weight: 600;
}
.day h2.today { position: relative; }

.plancard { padding: 13px 14px; margin-bottom: 10px; }
.planhead { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.ptime {
  flex: none; font-size: 12px; font-weight: 700; color: var(--accent2);
  background: color-mix(in srgb, var(--accent2) 16%, transparent);
  padding: 2px 8px; border-radius: 999px;
}
.ptitle { font-weight: 700; font-size: 15px; }
.ploc { margin-top: 6px; font-size: 13px; }
.pnotes { margin-top: 4px; font-size: 13px; color: var(--muted); }
.plead {
  margin-top: 8px; display: flex; align-items: center; gap: 8px;
  font-size: 13px; color: var(--muted);
}

.avatar {
  display: inline-flex; align-items: center; justify-content: center;
  width: 24px; height: 24px; border-radius: 50%; flex: none;
  color: #fff; font-size: 10px; font-weight: 700;
}
.avatar.sm { width: 20px; height: 20px; font-size: 9px; }

details { margin-top: 8px; }
details > summary {
  cursor: pointer; font-size: 13px; font-weight: 600; color: var(--accent);
  list-style: none; padding: 4px 0;
}
details > summary::-webkit-details-marker { display: none; }
details > summary::marker { content: ""; }

.rosterlist { list-style: none; margin: 6px 0 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.rosterlist li { display: flex; align-items: center; gap: 8px; font-size: 13px; flex-wrap: wrap; }
.rname { font-weight: 600; }
.rkids { color: var(--muted); }
.rnotes { color: var(--muted); font-style: italic; }

.joinbox .joinform { display: flex; flex-direction: column; gap: 8px; margin-top: 8px; }
.formrow { display: flex; gap: 8px; }
.formrow button { flex: 1; }

.deleteform { margin-top: 8px; }
.xbtn {
  background: transparent; color: var(--danger); border: 1px solid var(--danger);
  padding: 7px 12px; font-size: 13px; font-weight: 600;
}

.addplan { margin-top: 6px; }
.addplan summary {
  padding: 10px 14px; background: var(--card); border: 1px dashed var(--line);
  border-radius: 12px;
}
.planform {
  display: flex; flex-direction: column; gap: 8px; margin-top: 8px;
  padding: 12px; background: var(--card); border: 1px solid var(--line);
  border-radius: 12px;
}
.presets { display: flex; flex-wrap: wrap; gap: 6px; }
.chip.mini {
  padding: 6px 11px; font-size: 13px; font-weight: 600;
  background: color-mix(in srgb, var(--accent) 12%, var(--card));
  border: 1px solid color-mix(in srgb, var(--accent) 45%, var(--line));
  color: var(--text); border-radius: 999px;
}
.timerow { display: flex; align-items: center; gap: 8px; }
.timerow input { flex: 1; }
.newloc { display: flex; flex-direction: column; gap: 8px; }
.newloc[hidden] { display: none; }

.icslink { margin-left: auto; font-size: 12px; }

/* export / subscribe */
.exportbox { padding: 14px 16px; margin-bottom: 12px; }
.exportbox h3 { margin: 0 0 6px; font-size: 15px; }
.exportbox p.muted { margin: 0 0 10px; font-size: 13px; line-height: 1.5; }
.urlbox input {
  font-size: 13px; font-family: ui-monospace, "SF Mono", Menlo, monospace;
  background: var(--bg);
}
.howto { margin: 10px 0 0; padding-left: 18px; font-size: 13px; color: var(--muted); line-height: 1.6; }
.howto li { margin-bottom: 4px; }
.webcallink { display: inline-block; margin-top: 10px; color: var(--accent); font-size: 13px; font-weight: 600; }
.btnlink {
  display: inline-block; margin-top: 4px; padding: 9px 16px; border-radius: 10px;
  background: var(--accent); color: #fff; font-weight: 600; font-size: 14px;
}

/* locations / parents */
.locrow, .parentrow {
  display: flex; align-items: center; gap: 10px; padding: 12px 14px; margin-bottom: 8px;
}
.locmain { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.lname { font-weight: 600; }
.lnotes { font-size: 13px; color: var(--muted); }
.quietlink { color: var(--muted); font-size: 13px; flex: none; }
.addform { padding: 14px; margin-top: 10px; }
.addform form { display: flex; flex-direction: column; gap: 10px; }
