/* Alive Church Worship Team - single stylesheet.
   Warm editorial: cream paper, ink text, one bronze accent.
   Mobile-first. Dark-mode aware via prefers-color-scheme. */

:root {
  --paper: #f4f6fa;
  --paper-2: #ffffff;
  --paper-3: #e9edf4;
  --ink: #0d1117;
  --ink-soft: #5a6473;
  --line: #dbe1ea;
  --accent: #1f5eea;
  --accent-ink: #1848b8;
  --accent-soft: #e7edfc;
  --good: #23794d;
  --good-soft: #e2f1e8;
  --bad: #bf3b2e;
  --bad-soft: #f9e7e4;
  --warn: #96660a;
  --warn-soft: #f5edd6;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(13, 17, 23, 0.05), 0 8px 24px -12px rgba(13, 17, 23, 0.18);
  --serif: "Iowan Old Style", "Palatino Nova", Palatino, Georgia, "Times New Roman", serif;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", "Helvetica Neue", Helvetica, Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper: #0b0e14;
    --paper-2: #131824;
    --paper-3: #1b2230;
    --ink: #e8edf5;
    --ink-soft: #93a0b3;
    --line: #263041;
    --accent: #4d8dff;
    --accent-ink: #7aa9ff;
    --accent-soft: #16233a;
    --good: #5fbd8b;
    --good-soft: #16281f;
    --bad: #ea8577;
    --bad-soft: #331d1a;
    --warn: #d9ac4b;
    --warn-soft: #32290f;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.5), 0 8px 24px -12px rgba(0, 0, 0, 0.7);
  }
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.55;
  color: var(--ink);
  background: var(--paper);
  min-height: 100vh;
}

/* Subtle paper grain */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: 0.35;
  background-image: radial-gradient(rgba(120, 100, 70, 0.05) 1px, transparent 1px);
  background-size: 22px 22px;
  z-index: 0;
}

.wrap {
  position: relative;
  z-index: 1;
  max-width: 640px;
  margin: 0 auto;
  padding: 20px 18px 64px;
}

.wrap.wide { max-width: 1100px; }

/* ---- Masthead ---- */

.masthead {
  text-align: center;
  padding: 26px 0 20px;
}

.masthead .kicker {
  font-family: var(--sans);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 8px;
}

.masthead h1 {
  font-family: var(--serif);
  font-weight: 600;
  font-size: clamp(28px, 6.5vw, 38px);
  line-height: 1.12;
  letter-spacing: -0.01em;
}

.masthead .rule {
  width: 52px;
  height: 2px;
  background: var(--accent);
  margin: 16px auto 0;
  border-radius: 2px;
}

.masthead .sub {
  color: var(--ink-soft);
  font-size: 15px;
  margin-top: 12px;
}

/* ---- Cards & structure ---- */

.card {
  background: var(--paper-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
  margin-bottom: 16px;
}

.card h2 {
  font-family: var(--serif);
  font-weight: 600;
  font-size: 21px;
  margin-bottom: 4px;
}

.card .hint {
  color: var(--ink-soft);
  font-size: 14px;
  margin-bottom: 14px;
}

.stack > * + * { margin-top: 12px; }

/* ---- Buttons ---- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font: inherit;
  font-weight: 600;
  font-size: 16px;
  padding: 13px 20px;
  border-radius: 12px;
  border: 1px solid transparent;
  cursor: pointer;
  text-decoration: none;
  transition: transform 0.06s ease, background 0.15s ease, border-color 0.15s ease;
  -webkit-tap-highlight-color: transparent;
}

.btn:active { transform: scale(0.985); }

.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-ink); }
@media (prefers-color-scheme: dark) {
  .btn-primary { color: #0b0e14; }
}

.btn-ghost {
  background: transparent;
  color: var(--ink);
  border-color: var(--line);
}
.btn-ghost:hover { border-color: var(--accent); color: var(--accent-ink); }

.btn-danger { background: transparent; color: var(--bad); border-color: var(--bad); }
.btn-quiet { background: transparent; color: var(--ink-soft); border: none; font-weight: 500; font-size: 14px; padding: 8px 10px; }
.btn-quiet:hover { color: var(--accent-ink); }

.btn-block { display: flex; width: 100%; }
.btn-sm { font-size: 14px; padding: 8px 14px; border-radius: 10px; }
.btn[disabled] { opacity: 0.5; cursor: not-allowed; }

/* ---- Big choice buttons (landing) ---- */

.choice {
  display: block;
  width: 100%;
  text-align: left;
  background: var(--paper-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px 20px;
  font: inherit;
  color: var(--ink);
  cursor: pointer;
  box-shadow: var(--shadow);
  transition: border-color 0.15s ease, transform 0.06s ease;
}
.choice:active { transform: scale(0.99); }
.choice:hover { border-color: var(--accent); }
.choice .t { font-family: var(--serif); font-size: 19px; font-weight: 600; display: block; }
.choice .d { color: var(--ink-soft); font-size: 14px; margin-top: 3px; display: block; }

/* ---- Roster name list ---- */

.name-list { list-style: none; }
.name-list li + li { border-top: 1px solid var(--line); }
.name-list button {
  display: block;
  width: 100%;
  text-align: left;
  background: none;
  border: none;
  font: inherit;
  font-size: 17px;
  padding: 14px 6px;
  color: var(--ink);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.name-list button:hover { color: var(--accent-ink); }

/* ---- Forms ---- */

label.field { display: block; }
label.field .lbl,
.lbl {
  display: block;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--ink-soft);
  margin-bottom: 6px;
}

input[type="text"], input[type="tel"], input[type="email"],
input[type="password"], input[type="month"], input[type="date"],
input[type="time"], input[type="number"], select, textarea {
  width: 100%;
  font: inherit;
  font-size: 16px;
  color: var(--ink);
  background: var(--paper-2);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px 14px;
  outline: none;
  transition: border-color 0.15s ease;
}
input:focus, select:focus, textarea:focus { border-color: var(--accent); }

.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

/* ---- Chips (multi-select roles) ---- */

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  font: inherit;
  font-size: 15px;
  font-weight: 500;
  padding: 9px 15px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--paper-2);
  color: var(--ink);
  cursor: pointer;
  transition: all 0.12s ease;
  -webkit-tap-highlight-color: transparent;
}
.chip.on {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  font-weight: 600;
}
@media (prefers-color-scheme: dark) {
  .chip.on { color: #0b0e14; }
}

/* ---- Toggle switch ---- */

.switch-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 4px 0;
}
.switch-row .q { font-size: 15px; font-weight: 500; }
.switch-row .q small { display: block; color: var(--ink-soft); font-weight: 400; font-size: 13px; }

.switch {
  position: relative;
  width: 50px;
  height: 30px;
  flex-shrink: 0;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--paper-3);
  cursor: pointer;
  transition: background 0.15s ease;
}
.switch::after {
  content: "";
  position: absolute;
  top: 3px; left: 3px;
  width: 22px; height: 22px;
  border-radius: 50%;
  background: var(--paper-2);
  box-shadow: 0 1px 3px rgba(0,0,0,0.25);
  transition: transform 0.15s ease;
}
.switch.on { background: var(--good); border-color: var(--good); }
.switch.on::after { transform: translateX(20px); }

/* ---- Availability date toggles ---- */

.date-list { list-style: none; }
.date-list li + li { margin-top: 10px; }

.date-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  font: inherit;
  text-align: left;
  padding: 15px 16px;
  border-radius: 12px;
  border: 1.5px solid var(--good);
  background: var(--good-soft);
  color: var(--ink);
  cursor: pointer;
  transition: all 0.13s ease;
  -webkit-tap-highlight-color: transparent;
}
.date-toggle .when { font-weight: 600; font-size: 16px; }
.date-toggle .when small { display: block; font-weight: 400; font-size: 13px; color: var(--ink-soft); }
.date-toggle .state {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--good);
  white-space: nowrap;
}
.date-toggle.blocked {
  border-color: var(--bad);
  background: var(--bad-soft);
}
.date-toggle.blocked .when { text-decoration: line-through; text-decoration-thickness: 1.5px; }
.date-toggle.blocked .state { color: var(--bad); }

/* ---- Stepper ---- */

.stepper {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.stepper .q { font-size: 15px; font-weight: 500; flex: 1; }
.stepper .ctrl {
  display: flex;
  align-items: center;
  gap: 0;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--paper-2);
  overflow: hidden;
}
.stepper .ctrl button {
  font: inherit;
  font-size: 22px;
  font-weight: 500;
  width: 46px;
  height: 46px;
  border: none;
  background: none;
  color: var(--accent);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.stepper .ctrl button:disabled { color: var(--line); cursor: default; }
.stepper .ctrl .val {
  min-width: 40px;
  text-align: center;
  font-size: 19px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

/* ---- Confirmation ---- */

.confirm {
  text-align: center;
  padding: 40px 20px;
}
.confirm .mark {
  width: 58px; height: 58px;
  margin: 0 auto 18px;
  border-radius: 50%;
  background: var(--good-soft);
  color: var(--good);
  display: flex;
  align-items: center;
  justify-content: center;
}
.confirm h2 { font-family: var(--serif); font-size: 26px; font-weight: 600; margin-bottom: 8px; }
.confirm p { color: var(--ink-soft); max-width: 40ch; margin: 0 auto 6px; }

/* ---- Greeting bar ---- */

.hello {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 14px;
}
.hello .hi { font-family: var(--serif); font-size: 20px; font-weight: 600; }
.hello a, .hello button {
  font: inherit; font-size: 13px; color: var(--ink-soft);
  background: none; border: none; cursor: pointer;
  text-decoration: underline; text-underline-offset: 2px;
}

/* ---- Flash / errors ---- */

.flash {
  padding: 12px 16px;
  border-radius: 10px;
  font-size: 14px;
  margin-bottom: 14px;
}
.flash.err { background: var(--bad-soft); color: var(--bad); }
.flash.ok { background: var(--good-soft); color: var(--good); }

/* ---- Public schedule ---- */

.svc-card { margin-bottom: 14px; }
.svc-card .svc-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
  padding-bottom: 10px;
  margin-bottom: 12px;
}
.svc-card .svc-date { font-family: var(--serif); font-size: 19px; font-weight: 600; }
.svc-card .svc-meta { color: var(--ink-soft); font-size: 13px; }

.lineup { list-style: none; }
.lineup li {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  padding: 7px 0;
}
.lineup li + li { border-top: 1px dotted var(--line); }
.lineup .role { color: var(--ink-soft); font-size: 13px; text-transform: uppercase; letter-spacing: 0.05em; white-space: nowrap; }
.lineup .who { font-weight: 500; text-align: right; }
.lineup .who.lead { color: var(--accent-ink); font-weight: 700; }
.lineup .who.gap { color: var(--bad); font-weight: 700; letter-spacing: 0.04em; }
.lineup .who.empty { color: var(--ink-soft); font-weight: 400; font-style: italic; }

/* ================= ADMIN ================= */

.admin-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 0 6px;
  flex-wrap: wrap;
}
.admin-top .brand { font-family: var(--serif); font-size: 22px; font-weight: 600; }
.admin-top .brand small { display: block; font-family: var(--sans); font-size: 11px; letter-spacing: 0.18em; text-transform: uppercase; color: var(--accent); font-weight: 600; }

.tabs {
  display: flex;
  gap: 4px;
  overflow-x: auto;
  border-bottom: 1px solid var(--line);
  margin: 10px 0 20px;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.tabs::-webkit-scrollbar { display: none; }
.tabs button {
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  color: var(--ink-soft);
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  padding: 10px 14px;
  cursor: pointer;
  white-space: nowrap;
  -webkit-tap-highlight-color: transparent;
}
.tabs button.on { color: var(--accent-ink); border-bottom-color: var(--accent); }

.badge {
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  padding: 3px 9px;
  border-radius: 999px;
}
.badge.open { background: var(--good-soft); color: var(--good); }
.badge.locked { background: var(--warn-soft); color: var(--warn); }
.badge.published { background: var(--accent-soft); color: var(--accent-ink); }
.badge.gap { background: var(--bad-soft); color: var(--bad); }

.stat-row { display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.stat {
  flex: 1;
  min-width: 130px;
  background: var(--paper-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px 16px;
}
.stat .n { font-family: var(--serif); font-size: 28px; font-weight: 600; line-height: 1.1; }
.stat .l { font-size: 12px; color: var(--ink-soft); text-transform: uppercase; letter-spacing: 0.06em; margin-top: 2px; }

/* Admin tables */

.tbl-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table.tbl { border-collapse: collapse; width: 100%; font-size: 14px; }
.tbl th {
  text-align: left;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--ink-soft);
  font-weight: 600;
  padding: 8px 10px;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
.tbl td { padding: 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.tbl tr:last-child td { border-bottom: none; }

/* Response grid */

.grid-cell {
  width: 34px; height: 26px;
  border-radius: 6px;
  display: inline-block;
}
.grid-cell.yes { background: var(--good-soft); border: 1px solid var(--good); }
.grid-cell.no { background: var(--bad-soft); border: 1px solid var(--bad); }
.grid-cell.none { background: var(--paper-3); border: 1px dashed var(--line); }

/* Schedule editor */

.sched-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(270px, 1fr));
  gap: 14px;
}

.slot-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  margin-top: 8px;
  background: var(--paper);
  cursor: pointer;
  transition: border-color 0.12s ease, background 0.12s ease;
}
.slot-row:hover { border-color: var(--accent); }
.slot-row .r { font-size: 11px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--ink-soft); font-weight: 600; white-space: nowrap; }
.slot-row .m { font-weight: 600; font-size: 14px; text-align: right; }
.slot-row.gap-slot { border-color: var(--bad); background: var(--bad-soft); }
.slot-row.gap-slot .m { color: var(--bad); text-transform: uppercase; font-size: 12px; letter-spacing: 0.05em; }
.slot-row.opt-empty .m { color: var(--ink-soft); font-weight: 400; font-style: italic; font-size: 13px; }
.slot-row.leader-slot { border-color: var(--accent); background: var(--accent-soft); }
.slot-row.dragover { outline: 2px dashed var(--accent); outline-offset: 2px; }
.slot-row[draggable="true"] .m { cursor: grab; }

.unsaved {
  position: fixed;
  bottom: 18px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 60;
  background: var(--ink);
  color: var(--paper);
  border-radius: 999px;
  padding: 10px 18px;
  display: flex;
  gap: 12px;
  align-items: center;
  box-shadow: var(--shadow);
  font-size: 14px;
}
.unsaved .btn { padding: 7px 14px; font-size: 13px; }

/* Bottom sheet (mobile slot picker) */

.sheet-veil {
  position: fixed; inset: 0;
  background: rgba(20, 16, 10, 0.45);
  z-index: 80;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}
.sheet {
  background: var(--paper-2);
  border-radius: 18px 18px 0 0;
  width: 100%;
  max-width: 560px;
  max-height: 78vh;
  overflow-y: auto;
  padding: 18px 18px 30px;
  box-shadow: var(--shadow);
}
@media (min-width: 700px) {
  .sheet-veil { align-items: center; }
  .sheet { border-radius: 18px; }
}
.sheet h3 { font-family: var(--serif); font-size: 19px; margin-bottom: 2px; }
.sheet .hint { color: var(--ink-soft); font-size: 13px; margin-bottom: 12px; }
.pick-list { list-style: none; }
.pick-list li + li { border-top: 1px solid var(--line); }
.pick-list button {
  display: flex;
  width: 100%;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  font: inherit;
  background: none;
  border: none;
  text-align: left;
  padding: 13px 4px;
  cursor: pointer;
  color: var(--ink);
}
.pick-list button:hover { color: var(--accent-ink); }
.pick-list .warn-tag { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; color: var(--warn); background: var(--warn-soft); border-radius: 999px; padding: 3px 9px; white-space: nowrap; }
.pick-list .bad-tag { color: var(--bad); background: var(--bad-soft); }

/* Nudge copy block */

.nudge {
  background: var(--paper-3);
  border-radius: 10px;
  padding: 12px 14px;
  font-size: 13px;
  font-family: var(--mono);
  white-space: pre-wrap;
  word-break: break-word;
  margin-top: 10px;
}

/* Login */

.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.login-card {
  width: 100%;
  max-width: 360px;
  background: var(--paper-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 30px 26px;
  text-align: center;
}
.login-card h1 { font-family: var(--serif); font-size: 24px; font-weight: 600; }
.login-card .sub { color: var(--ink-soft); font-size: 14px; margin: 4px 0 18px; }
.login-card form { display: grid; gap: 12px; }

/* Toast */

.toast {
  position: fixed;
  top: 16px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 100;
  background: var(--ink);
  color: var(--paper);
  padding: 10px 20px;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 500;
  box-shadow: var(--shadow);
  opacity: 0;
  transition: opacity 0.2s ease;
  pointer-events: none;
}
.toast.show { opacity: 1; }

/* Utility */

.muted { color: var(--ink-soft); }
.small { font-size: 13px; }
.mt { margin-top: 16px; }
.right { text-align: right; }
.spread { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.hidden { display: none !important; }

@media (max-width: 480px) {
  .row2 { grid-template-columns: 1fr; }
  .card { padding: 16px; }
}

/* Reduce motion */
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}
