/* Connect CMS screens. Built for a tablet at a church entrance: big targets, clear next step, one colour per ministry group. */
:root {
  --paper: #f1f3f7;
  --surface: #ffffff;
  --ink: #18222f;
  --ink-soft: #52606f;
  --line: #d6dbe3;
  --action: #2543d6;
  --action-ink: #ffffff;
  --action-soft: #e8ecfb;
  --accent: #2543d6;
  --danger: #b3261e;
  --ok: #17794a;
  --focus: #ffb000;
  --g-creche: #e8a33d;
  --g-early: #d9486f;
  --g-primary: #1f8f83;
  --g-teens: #6a4bd8;
  --g-college: #47536a;
  --radius: 10px;
  --tap: 3.25rem;
  font-family: "Avenir Next", "Segoe UI", Roboto, "Helvetica Neue", system-ui, sans-serif;
}
@media (prefers-color-scheme: dark) {
:root:not([data-theme="light"]) { --paper: #0f1620; --surface: #19232f; --ink: #eef1f6; --ink-soft: #a5b0be; --line: #2e3a49;
    --action: #7d93ff; --action-ink: #0b1020; --action-soft: #1d2a55; --accent: #7d93ff; --danger: #ff8a80; --ok: #5fd39b; }
}
:root[data-theme="dark"] { --paper: #0f1620; --surface: #19232f; --ink: #eef1f6; --ink-soft: #a5b0be; --line: #2e3a49;
    --action: #7d93ff; --action-ink: #0b1020; --action-soft: #1d2a55; --accent: #7d93ff; --danger: #ff8a80; --ok: #5fd39b; }
* { box-sizing: border-box; }
html { font-size: 17px; }
body { margin: 0; background: var(--paper); color: var(--ink); line-height: 1.45; -webkit-text-size-adjust: 100%; }
h1, h2, h3 { line-height: 1.2; margin: 0 0 .5rem; letter-spacing: -.01em; }
h1 { font-size: 1.9rem; font-weight: 750; }
h2 { font-size: 1.3rem; font-weight: 700; }
h3 { font-size: 1.05rem; font-weight: 700; }
p { margin: 0 0 .75rem; max-width: 62ch; }
.soft { color: var(--ink-soft); }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }

/* group colours: set --g from the group name wherever data-group appears */
[data-group] { --g: var(--ink-soft); }
[data-group="Crèche"] { --g: var(--g-creche); }
[data-group="Early Years"] { --g: var(--g-early); }
[data-group="Primary"] { --g: var(--g-primary); }
[data-group="Active Teens"] { --g: var(--g-teens); }
[data-group="College"] { --g: var(--g-college); }

/* buttons and fields */
button, .button { font: inherit; min-height: var(--tap); padding: 0 1.25rem; border-radius: var(--radius); border: 2px solid var(--line); background: var(--surface); color: var(--ink); font-weight: 650; cursor: pointer; }
button:disabled { opacity: .5; cursor: not-allowed; }
button.primary { background: var(--action); border-color: var(--action); color: var(--action-ink); }
button.danger { color: var(--danger); border-color: var(--danger); }
button.quiet { border-color: transparent; background: transparent; color: var(--ink-soft); min-height: 2.5rem; padding: 0 .75rem; }
button.small { min-height: 2.5rem; padding: 0 .9rem; }
label { display: block; font-weight: 650; margin-bottom: .25rem; }
input:not([type]), input[type="number"], input[type="date"], input[type="text"], input[type="email"], input[type="password"], input[type="search"], textarea, select {
  font: inherit; width: 100%; min-height: var(--tap); padding: .5rem .85rem; border-radius: var(--radius); border: 2px solid var(--line); background: var(--surface); color: var(--ink);
}
.field { margin-bottom: 1rem; }
.hint { color: var(--ink-soft); font-size: .92rem; margin-top: .25rem; }
.error { color: var(--danger); font-weight: 650; margin: .5rem 0; }
.check { display: flex; gap: .75rem; align-items: flex-start; font-weight: 500; padding: .6rem 0; cursor: pointer; }
.check input { width: 1.6rem; height: 1.6rem; flex: none; margin: 0; accent-color: var(--action); }

/* page frame */
.frame { max-width: 1100px; margin: 0 auto; padding: 0 1rem 3rem; }
.topbar { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem 1rem; padding: .75rem 1rem; background: var(--surface); border-bottom: 3px solid var(--accent); position: sticky; top: 0; z-index: 5; }
.topbar .where { font-weight: 750; margin-right: auto; }
.topbar .who { color: var(--ink-soft); font-size: .92rem; }
.pagehead { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 1rem; padding: 1.5rem 0 1rem; }
.pagehead h1 { margin: 0; margin-right: auto; }

/* sign-in */
.signin { max-width: 26rem; margin: 8vh auto 0; padding: 0 1rem; }
.signin h1 { font-size: 2.4rem; }
.signin form { margin-top: 1.5rem; }

/* workspace chooser */
.spaces { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr)); margin-top: 1.5rem; }
.space { text-align: left; padding: 1.25rem; min-height: 9rem; border: 2px solid var(--line); border-left-width: 10px; border-left-color: var(--action); display: flex; flex-direction: column; gap: .35rem; }
.space strong { font-size: 1.35rem; }
.space span { font-weight: 450; color: var(--ink-soft); }
.space[aria-disabled="true"] { border-left-color: var(--line); opacity: .65; }

/* sessions */
.sessions { list-style: none; margin: 0; padding: 0; display: grid; gap: .75rem; }
.session { display: flex; flex-wrap: wrap; gap: .75rem 1.25rem; align-items: center; padding: 1rem 1.25rem; background: var(--surface); border: 2px solid var(--line); border-radius: var(--radius); }
.session .name { font-weight: 750; font-size: 1.15rem; margin-right: auto; }
.chips { display: flex; flex-wrap: wrap; gap: .4rem; }
.chip { display: inline-flex; align-items: center; gap: .4rem; padding: .15rem .65rem .15rem .5rem; border-radius: 999px; border: 2px solid var(--g, var(--line)); font-weight: 650; font-size: .9rem; background: var(--surface); }
.chip::before { content: ""; width: .6rem; height: .6rem; border-radius: 50%; background: var(--g, var(--ink-soft)); }
.form-panel { background: var(--surface); border: 2px solid var(--line); border-radius: var(--radius); padding: 1.25rem; margin-bottom: 1.5rem; }
.pickgroups { display: flex; flex-wrap: wrap; gap: .5rem; }
.pickgroups label { display: inline-flex; align-items: center; gap: .5rem; margin: 0; padding: .5rem .9rem; border: 2px solid var(--g, var(--line)); border-radius: 999px; cursor: pointer; font-weight: 650; min-height: 2.75rem; }
.pickgroups input { accent-color: var(--g); width: 1.2rem; height: 1.2rem; }

/* session screen */
.tabs { display: flex; gap: .25rem; border-bottom: 2px solid var(--line); margin-bottom: 1.25rem; }
.tabs button { border: none; border-bottom: 4px solid transparent; border-radius: 0; background: transparent; min-height: 3rem; }
.tabs button[aria-selected="true"] { border-bottom-color: var(--action); color: var(--action); }
.split { display: grid; gap: 1.5rem; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); align-items: start; }
@media (max-width: 760px) { .split { grid-template-columns: 1fr; } }
.rows { list-style: none; margin: 1rem 0 0; padding: 0; display: grid; gap: .5rem; }
.rowbtn { width: 100%; text-align: left; display: grid; grid-template-columns: 1fr auto; gap: .15rem 1rem; padding: .75rem 1rem .75rem 1.25rem; border: 2px solid var(--line); border-left: 10px solid var(--g, var(--line)); background: var(--surface); font-weight: 500; }
.rowbtn[aria-pressed="true"] { border-color: var(--action); border-left-color: var(--g, var(--action)); box-shadow: inset 0 0 0 2px var(--action); }
.rowbtn .nm { font-weight: 750; font-size: 1.15rem; }
.rowbtn .sub { color: var(--ink-soft); grid-column: 1; }
.pill { align-self: center; justify-self: end; grid-row: 1 / span 2; grid-column: 2; padding: .2rem .7rem; border-radius: 999px; font-weight: 650; font-size: .9rem; border: 2px solid var(--line); }
.pill.in { border-color: var(--ok); color: var(--ok); }
.pill.reg { border-color: var(--action); color: var(--action); }
.pill.out { color: var(--ink-soft); }
.panel { background: var(--surface); border: 2px solid var(--line); border-radius: var(--radius); padding: 1.25rem; position: sticky; top: 4.5rem; }
.carers { border: none; padding: 0; margin: 0 0 .75rem; }
.carers legend { font-weight: 650; margin-bottom: .35rem; padding: 0; }
.carer { display: flex; align-items: center; gap: .75rem; padding: .75rem 1rem; margin-bottom: .4rem; border: 2px solid var(--line); border-radius: var(--radius); cursor: pointer; font-weight: 650; min-height: var(--tap); }
.carer input { width: 1.4rem; height: 1.4rem; accent-color: var(--action); margin: 0; }
.carer:has(input:checked) { border-color: var(--action); background: color-mix(in srgb, var(--action) 10%, var(--surface)); }
.empty { padding: 2rem 1rem; color: var(--ink-soft); }

/* register */
.counts { display: flex; gap: .5rem; flex-wrap: wrap; margin-bottom: 1rem; }
.register { width: 100%; border-collapse: collapse; background: var(--surface); border: 2px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.register th { text-align: left; font-weight: 650; color: var(--ink-soft); font-size: .92rem; padding: .6rem 1rem; border-bottom: 2px solid var(--line); }
.register td { padding: .7rem 1rem; border-bottom: 1px solid var(--line); vertical-align: middle; }
.register tr:last-child td { border-bottom: none; }
.register td.band { border-left: 10px solid var(--g, var(--line)); }
.register .nm { font-weight: 750; }
@media (max-width: 760px) {
  .register thead { position: absolute; left: -9999px; }
  .register tr { display: grid; grid-template-columns: 1fr auto; padding: .5rem 0; border-bottom: 1px solid var(--line); }
  .register td { border: none; padding: .2rem 1rem; }
}

/* dialogs and toasts */
.dialog { border: none; border-radius: 14px; padding: 0; width: min(34rem, calc(100vw - 2rem)); background: var(--surface); color: var(--ink); }
.dialog.wide { width: min(46rem, calc(100vw - 2rem)); }
.dialog::backdrop { background: rgb(15 22 32 / .55); }
.dialog-head { display: flex; align-items: center; justify-content: space-between; padding: 1rem 1.25rem .5rem; }
.dialog-head h2 { margin: 0; }
.dialog-body { padding: .5rem 1.25rem 1.25rem; }
.actions { display: flex; flex-wrap: wrap; gap: .75rem; margin-top: 1rem; }
.number-input { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-size: 1.6rem; letter-spacing: .15em; text-transform: uppercase; text-align: center; }
.toast { position: fixed; left: 50%; bottom: 1.5rem; transform: translateX(-50%); background: var(--ink); color: var(--paper); padding: .8rem 1.25rem; border-radius: 999px; font-weight: 650; z-index: 20; max-width: calc(100vw - 2rem); }
.toast.bad { background: var(--danger); color: #fff; }
@media (prefers-reduced-motion: no-preference) {
  .dialog[open] { animation: rise .18s ease-out; }
  @keyframes rise { from { transform: translateY(12px); opacity: 0; } to { transform: none; opacity: 1; } }
}
a.button { display: inline-flex; align-items: center; text-decoration: none; }
a { color: var(--action); }

/* church logo, initials badge, setup step */
.brandmark { height: 2.25rem; width: auto; max-width: 8rem; object-fit: contain; border-radius: 6px; }
.brandmark.lg { height: 4.5rem; max-width: 14rem; }
.brandmark.badge { display: inline-flex; align-items: center; justify-content: center; min-width: 2.25rem; padding: 0 .5rem; background: var(--action); color: var(--action-ink); font-weight: 750; letter-spacing: .02em; }
.brandmark.badge.lg { min-width: 4.5rem; font-size: 1.6rem; }
.signin-logo { min-height: 0; margin-bottom: 1rem; }
.frame.narrow { max-width: 44rem; }
.logo-preview { display: block; max-width: 100%; background: repeating-conic-gradient(#e6e9ef 0 25%, #fff 0 50%) 0 0 / 16px 16px; border: 2px solid var(--line); border-radius: var(--radius); margin: 1rem 0; }
.swatches { border: none; padding: 0; margin: 0 0 1rem; }
.swatches legend { font-weight: 700; margin-bottom: .4rem; padding: 0; }
.swatch { display: flex; align-items: center; gap: .6rem; min-height: var(--tap); padding: 0 .75rem; border: 2px solid var(--line); border-radius: var(--radius); background: var(--surface); margin-bottom: .4rem; cursor: pointer; }
.swatch:has(input:checked) { border-color: var(--action); background: var(--action-soft); }
.swatch input { width: 1.25rem; height: 1.25rem; }
.swatch .colour-dot { width: 1.75rem; height: 1.75rem; border-radius: 50%; border: 2px solid var(--line); background: transparent; flex: none; }
.custom-colour { display: flex; align-items: center; gap: .6rem; margin-top: .4rem; color: var(--ink-soft); }
.custom-colour input { width: 3.25rem; height: 2.5rem; padding: 0; border: 2px solid var(--line); border-radius: 8px; background: none; }
.samples { display: grid; grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr)); gap: 1rem; margin: 1rem 0; }
.sample { padding: 1rem; border-radius: var(--radius); border: 2px solid var(--line); display: flex; flex-direction: column; align-items: flex-start; gap: .6rem; }
.sample.light { background: #ffffff; color: #18222f; }
.sample.dark { background: #19232f; color: #eef1f6; }
.sample-title { margin: 0; font-weight: 700; }
.sample-button { background: var(--action); color: var(--action-ink); padding: .6rem 1.1rem; border-radius: var(--radius); font-weight: 700; }
.sample-accent { color: var(--accent); font-weight: 700; border-bottom: 3px solid var(--accent); }

@media (max-width: 560px) {
  .topbar .who { order: 5; flex-basis: 100%; }
}

/* notifications */
.bell { position: relative; }
.bell-count { display: inline-block; min-width: 1.4rem; margin-left: .35rem; padding: 0 .4rem; border-radius: 999px; background: var(--danger); color: #fff; font-size: .8rem; font-weight: 750; line-height: 1.4rem; text-align: center; }
.bell-count[hidden] { display: none; }
.inbox { list-style: none; margin: 0; padding: 0; display: grid; gap: .5rem; }
.note { background: var(--surface); border: 2px solid var(--line); border-radius: var(--radius); }
.note.unread { border-left: 10px solid var(--action); }
.note-main { display: grid; gap: .15rem; width: 100%; text-align: left; padding: .8rem 1rem; border: none; background: transparent; font-weight: 500; min-height: var(--tap); border-radius: var(--radius); }
.note-title { font-weight: 700; }
.note-title .new { color: var(--action); }
.note-body { color: var(--ink); }
.note-time { font-size: .88rem; }
.prefs { width: 100%; border-collapse: collapse; background: var(--surface); border: 2px solid var(--line); border-radius: var(--radius); overflow: hidden; margin: 1rem 0 .5rem; }
.prefs th, .prefs td { padding: .7rem .8rem; border-bottom: 1px solid var(--line); text-align: center; vertical-align: middle; }
.prefs thead th { color: var(--ink-soft); font-size: .88rem; font-weight: 650; }
.prefs tbody th { text-align: left; font-weight: 650; }
.prefs th:first-child { text-align: left; }
.prefs input { width: 1.5rem; height: 1.5rem; accent-color: var(--action); }
.prefs tr:last-child th, .prefs tr:last-child td { border-bottom: none; }
@media (max-width: 640px) { .prefs thead th { font-size: .75rem; padding: .5rem .3rem; } .prefs th, .prefs td { padding: .5rem .3rem; } }
.settings-block { background: var(--surface); border: 2px solid var(--line); border-radius: var(--radius); padding: 1rem 1.25rem; margin-bottom: 1rem; }
.quiet-row { display: flex; flex-wrap: wrap; align-items: flex-end; gap: .75rem 1.25rem; }
.quiet-row .field { margin-bottom: 0; }
.quiet-row input[type="time"] { font: inherit; min-height: var(--tap); padding: .5rem .85rem; border-radius: var(--radius); border: 2px solid var(--line); background: var(--surface); color: var(--ink); }
.settings-block input[type="tel"] { font: inherit; width: 100%; min-height: var(--tap); padding: .5rem .85rem; border-radius: var(--radius); border: 2px solid var(--line); background: var(--surface); color: var(--ink); }
.role-list { margin: .25rem 0 0 1.5rem; display: grid; gap: 0; }
.actions.tight { margin-top: 0; gap: .4rem; }

/* before sign-in: finding the church, signing in, registering */
.auth { min-height: 100vh; display: flex; align-items: flex-start; justify-content: center; padding: 6vh 1rem 3rem; }
.auth-card { width: min(30rem, 100%); background: var(--surface); border: 2px solid var(--line); border-top: 8px solid var(--accent); border-radius: 14px; padding: 1.75rem 1.5rem 1.5rem; }
.auth-card h1 { font-size: 1.7rem; }
.auth-card h2 { margin-top: 1.5rem; }
.church-head { display: flex; align-items: center; gap: 1rem; margin-bottom: 1.25rem; }
.church-head h1 { margin: 0; }
.church-head p { margin: 0; }
.church-results { list-style: none; margin: .5rem 0 0; padding: 0; display: grid; gap: .4rem; }
.church-pick { width: 100%; text-align: left; display: flex; flex-direction: column; align-items: flex-start; gap: .1rem; padding: .6rem 1rem; font-weight: 500; }
.church-pick strong { font-weight: 700; }
.auth-links { display: flex; flex-wrap: wrap; gap: .25rem 1.25rem; margin-top: 1.25rem; align-items: center; }
.auth-links a, .auth-links button { font-size: .95rem; }
.notice { background: var(--action-soft); border-left: 6px solid var(--action); padding: .6rem .9rem; border-radius: 6px; max-width: none; }
.with-button { display: flex; gap: .5rem; align-items: stretch; }
.with-button input { flex: 1; min-width: 0; }
.with-button .reveal { min-width: 4.5rem; }
input[type="search"], input[type="tel"], input[type="date"] { font: inherit; width: 100%; min-height: var(--tap); padding: .5rem .85rem; border-radius: var(--radius); border: 2px solid var(--line); background: var(--surface); color: var(--ink); }

/* workspace tiles can be links */
a.space { text-decoration: none; color: var(--ink); background: var(--surface); border-radius: var(--radius); }
a.space:hover { border-color: var(--action); }
div.space { background: var(--surface); border-radius: var(--radius); }

/* Address Book */
.people { width: 100%; border-collapse: collapse; background: var(--surface); border: 2px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.people th, .people td { padding: .7rem 1rem; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
.people thead th { color: var(--ink-soft); font-size: .92rem; font-weight: 650; border-bottom: 2px solid var(--line); }
.people tbody th { font-weight: 700; }
.people tr:last-child th, .people tr:last-child td { border-bottom: none; }
@media (max-width: 640px) {
  .people thead { position: absolute; left: -9999px; }
  .people tr { display: block; padding: .5rem 0; border-bottom: 1px solid var(--line); }
  .people th, .people td { display: block; border: none; padding: .15rem 1rem; }
}
.tag { display: inline-block; margin-left: .6rem; padding: .05rem .55rem; border-radius: 999px; border: 2px solid var(--accent); color: var(--accent); font-size: .8rem; font-weight: 700; vertical-align: middle; }
.tag.quiet-tag { border-color: var(--line); color: var(--ink-soft); }
.card-grid { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(18rem, 1fr)); margin-bottom: 1.5rem; }
.panel-plain { background: var(--surface); border: 2px solid var(--line); border-radius: var(--radius); padding: 1rem 1.25rem; margin-bottom: 1rem; }
.card-grid .panel-plain { margin-bottom: 0; }
.facts { display: grid; grid-template-columns: max-content 1fr; gap: .35rem 1rem; margin: 0; }
.facts dt { color: var(--ink-soft); font-weight: 600; }
.facts dd { margin: 0; overflow-wrap: anywhere; }
.plain { list-style: none; margin: 0; padding: 0; display: grid; gap: .3rem; }
.wide-form { max-width: 52rem; }
.form-grid { display: grid; gap: 0 1rem; grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr)); }
.chips { display: flex; flex-wrap: wrap; gap: .4rem; margin-bottom: .5rem; }
.chip-x { padding-right: .2rem; }
.chip-x button { min-height: 1.8rem; padding: 0 .5rem; font-size: .85rem; }
