/* Shuls HQ: a calm, editorial room for running every shul. Warm paper, deep pine ink, hairlines instead of boxes. */
:root {
  --paper: #f3f1ec; --sheet: #fbfaf7; --ink: #15191b; --ink-2: #3d4447; --muted: #6c7275;
  --line: rgba(21, 25, 27, .11); --line-2: rgba(21, 25, 27, .2);
  --pine: #1d4a42; --pine-dk: #16302b; --pine-bg: rgba(29, 74, 66, .08);
  --ok: #2d7650; --ok-bg: #e5f0e8; --warn: #93620f; --warn-bg: #f7eedb; --err: #a8352b; --err-bg: #f7e4e1;
  --serif: "Newsreader", Georgia, serif; --sans: "Geist", system-ui, -apple-system, "Segoe UI", sans-serif;
  --r: 14px; --gutter: clamp(16px, 3.4vw, 44px);
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body { margin: 0; background: var(--paper); color: var(--ink-2); font: 15px/1.5 var(--sans); font-variant-numeric: lining-nums; -webkit-font-smoothing: antialiased; }
a { color: var(--pine); }
h1, h2, h3 { color: var(--ink); font-weight: 400; margin: 0; }
h1 { font: 400 clamp(2rem, 3.6vw, 2.9rem)/1.05 var(--serif); letter-spacing: -.01em; }
h2 { font: 400 clamp(1.45rem, 2.2vw, 1.8rem)/1.15 var(--serif); }
h3 { font: 600 .98rem/1.3 var(--sans); }
.num { font-variant-numeric: lining-nums tabular-nums; }
.muted { color: var(--muted); }
.small { font-size: .84rem; }
[hidden] { display: none !important; }

/* Top bar */
.bar { position: sticky; top: 0; z-index: 20; background: rgba(243, 241, 236, .92); backdrop-filter: saturate(1.4) blur(10px); border-bottom: 1px solid var(--line); }
.bar-in { max-width: 1320px; margin: 0 auto; padding: 0 var(--gutter); height: 60px; display: flex; align-items: center; gap: 24px; }
.mark { display: flex; align-items: center; gap: 10px; color: var(--ink); text-decoration: none; font: 500 1.2rem var(--serif); white-space: nowrap; }
.mark img { width: 26px; height: 26px; }
.nav { display: flex; gap: 4px; flex: 1; overflow-x: auto; scrollbar-width: none; }
.nav a { padding: 7px 12px; border-radius: 999px; color: var(--ink-2); text-decoration: none; font-weight: 500; font-size: .92rem; white-space: nowrap; }
.nav a:hover { background: var(--pine-bg); }
.nav a.on { background: var(--pine-dk); color: #f3efe4; }
.out { background: none; border: 0; color: var(--muted); font: 500 .88rem var(--sans); cursor: pointer; white-space: nowrap; }
.page { max-width: 1320px; margin: 0 auto; padding: clamp(24px, 3.4vw, 40px) var(--gutter) 80px; }
.head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; margin-bottom: 22px; }
.head p { margin: 6px 0 0; color: var(--muted); }

/* Buttons and fields */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 40px; padding: 0 16px; border-radius: 999px; border: 1px solid var(--line-2); background: var(--sheet); color: var(--ink); font: 500 .9rem var(--sans); cursor: pointer; text-decoration: none; white-space: nowrap; }
.btn:hover { border-color: var(--ink-2); }
.btn.primary { background: var(--pine-dk); border-color: var(--pine-dk); color: #f3efe4; }
.btn.primary:hover { background: var(--pine); }
.btn.danger { color: var(--err); }
.btn.sm { height: 32px; padding: 0 12px; font-size: .84rem; }
.btn:disabled { opacity: .5; cursor: default; }
label.f { display: flex; flex-direction: column; gap: 6px; font-weight: 500; font-size: .86rem; color: var(--ink); }
label.f .hint { font-weight: 400; color: var(--muted); font-size: .8rem; }
input, select, textarea { font: 15px/1.4 var(--sans); color: var(--ink); background: #fff; border: 1px solid var(--line-2); border-radius: 10px; padding: 10px 12px; width: 100%; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--pine); box-shadow: 0 0 0 3px var(--pine-bg); }
.sub-input { display: flex; align-items: center; border: 1px solid var(--line-2); border-radius: 10px; background: #fff; overflow: hidden; }
.sub-input input { border: 0; border-radius: 0; box-shadow: none !important; }
.sub-input span { padding: 0 12px; color: var(--muted); white-space: nowrap; }
.seg { display: inline-flex; padding: 3px; gap: 2px; background: rgba(21, 25, 27, .06); border-radius: 999px; }
.seg button { border: 0; background: none; padding: 7px 14px; border-radius: 999px; font: 500 .86rem var(--sans); color: var(--ink-2); cursor: pointer; }
.seg button.on { background: var(--sheet); color: var(--ink); box-shadow: 0 1px 2px rgba(0,0,0,.08); }

/* Totals: a single line of figures, hairlines between */
.totals { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); border-top: 1px solid var(--ink); border-bottom: 1px solid var(--line); margin-bottom: 28px; }
.totals > div { padding: 16px 18px 14px 0; display: flex; flex-direction: column; gap: 2px; }
.totals > div + div { padding-left: 18px; border-left: 1px solid var(--line); }
.totals strong { font: 400 clamp(1.6rem, 2.6vw, 2.2rem)/1.1 var(--serif); color: var(--ink); font-variant-numeric: lining-nums tabular-nums; }
.totals span { color: var(--muted); font-size: .86rem; }

/* Shul cards */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 18px; align-items: start; }
.card { background: var(--sheet); border: 1px solid var(--line); border-radius: var(--r); display: flex; flex-direction: column; min-width: 0; }
.card.down { border-color: rgba(168, 53, 43, .35); }
.card-head { display: flex; gap: 12px; align-items: center; padding: 16px 18px 12px; }
.logo { width: 42px; height: 42px; flex: none; border-radius: 10px; background: #fff; border: 1px solid var(--line); display: grid; place-items: center; overflow: hidden; }
.logo img { max-width: 30px; max-height: 30px; }
.logo b { font: 500 1.1rem var(--serif); color: var(--pine); }
.card-title { min-width: 0; flex: 1; }
.card-title a { color: var(--ink); text-decoration: none; font: 500 1.18rem/1.2 var(--serif); display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.card-title a:hover { text-decoration: underline; }
.card-title span { color: var(--muted); font-size: .8rem; }
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px; font: 600 .74rem var(--sans); white-space: nowrap; }
.pill::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.pill.ok { background: var(--ok-bg); color: var(--ok); }
.pill.err { background: var(--err-bg); color: var(--err); }
.pill.warn { background: var(--warn-bg); color: var(--warn); }
.pill.plain { background: rgba(21,25,27,.06); color: var(--ink-2); }
.pill.plain::before, .pill.nodot::before { display: none; }
.rows { list-style: none; margin: 0; padding: 0 18px; }
.rows li { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; padding: 7px 0; border-top: 1px solid var(--line); font-size: .9rem; }
.rows li > span:first-child { color: var(--muted); }
.rows li > :last-child { text-align: right; color: var(--ink); min-width: 0; }
.rows li .warn { color: var(--warn); }
.rows li .err { color: var(--err); }
.camp { padding: 10px 18px 2px; border-top: 1px solid var(--line); }
.camp-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 2px 12px; font-size: .86rem; padding: 4px 0 8px; }
.camp-row .t { color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.camp-row .v { color: var(--muted); }
.track { grid-column: 1 / -1; height: 4px; border-radius: 4px; background: rgba(21,25,27,.08); overflow: hidden; }
.track i { display: block; height: 100%; background: var(--pine); border-radius: 4px; }
.demo-line { padding: 10px 18px; border-top: 1px solid var(--line); font-size: .86rem; display: flex; flex-direction: column; gap: 4px; }
.card-foot { margin-top: auto; padding: 14px 18px 16px; border-top: 1px solid var(--line); display: flex; gap: 8px; flex-wrap: wrap; }
.down-note { margin: 0 18px 14px; padding: 12px 14px; border-radius: 10px; background: var(--err-bg); color: var(--err); font-size: .88rem; }

/* Lists and tables */
.section { margin-top: 34px; }
.section > h2 { margin-bottom: 12px; }
.table { width: 100%; border-collapse: collapse; font-size: .9rem; background: var(--sheet); border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; }
.table th { text-align: left; font-weight: 600; font-size: .78rem; color: var(--muted); padding: 10px 14px; border-bottom: 1px solid var(--line); background: rgba(21,25,27,.02); }
.table td { padding: 11px 14px; border-top: 1px solid var(--line); vertical-align: top; color: var(--ink); }
.table tr:first-child td { border-top: 0; }
.table .r { text-align: right; }
.wrap { overflow-x: auto; border-radius: var(--r); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.chip { padding: 2px 9px; border-radius: 999px; background: var(--pine-bg); color: var(--pine-dk); font-size: .78rem; white-space: nowrap; }
.empty { padding: 26px; text-align: center; color: var(--muted); background: var(--sheet); border: 1px dashed var(--line-2); border-radius: var(--r); }
.signin-list { list-style: none; margin: 0; padding: 0; background: var(--sheet); border: 1px solid var(--line); border-radius: var(--r); }
.signin-list li { padding: 14px 18px; border-top: 1px solid var(--line); display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 2px 16px; }
.signin-list li:first-child { border-top: 0; }
.signin-list .who { color: var(--ink); font-weight: 600; }
.signin-list .when { color: var(--muted); font-size: .86rem; text-align: right; white-space: nowrap; }
.signin-list .chips { grid-column: 1 / -1; }

/* Shul page */
.shul-head { display: flex; gap: 16px; align-items: center; flex-wrap: wrap; margin-bottom: 22px; }
.shul-head .logo { width: 56px; height: 56px; border-radius: 14px; }
.shul-head .logo img { max-width: 40px; max-height: 40px; }
.shul-head .grow { flex: 1; min-width: 220px; }
.shul-head p { margin: 4px 0 0; color: var(--muted); }
.grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; align-items: start; }
.panel { background: var(--sheet); border: 1px solid var(--line); border-radius: var(--r); padding: 16px 0 6px; }
.panel > h3 { padding: 0 18px 8px; }
.switches { list-style: none; margin: 0; padding: 0 18px; }
.switches li { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 10px 0; border-top: 1px solid var(--line); }
.switches li:first-child { border-top: 0; }
.switch { position: relative; width: 44px; height: 26px; flex: none; }
.switch input { opacity: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; position: absolute; inset: 0; z-index: 1; }
.switch span { position: absolute; inset: 0; border-radius: 999px; background: rgba(21,25,27,.18); transition: background .15s; }
.switch span::after { content: ""; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.25); transition: transform .15s; }
.switch input:checked + span { background: var(--pine); }
.switch input:checked + span::after { transform: translateX(18px); }
.switch input:disabled { cursor: default; }
.note { padding: 12px 14px; margin: 0 18px 12px; border-radius: 10px; background: var(--pine-bg); color: var(--pine-dk); font-size: .88rem; }
.note.warn { background: var(--warn-bg); color: var(--warn); }
.note.err { background: var(--err-bg); color: var(--err); }

/* New shul */
.new-grid { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: 22px; align-items: start; }
.form { display: flex; flex-direction: column; gap: 14px; background: var(--sheet); border: 1px solid var(--line); border-radius: var(--r); padding: 18px; }
.form .actions { display: flex; gap: 8px; flex-wrap: wrap; }
.reqs { list-style: none; margin: 0; padding: 0; background: var(--sheet); border: 1px solid var(--line); border-radius: var(--r); }
.reqs li { border-top: 1px solid var(--line); }
.reqs li:first-child { border-top: 0; }
.reqs a { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 12px 16px; color: var(--ink); text-decoration: none; }
.reqs a:hover, .reqs a.on { background: var(--pine-bg); }
.reqs .meta { color: var(--muted); font-size: .82rem; }
pre.prompt, pre.log { margin: 0; white-space: pre-wrap; word-break: break-word; font: 12.5px/1.55 ui-monospace, SFMono-Regular, Menlo, monospace; color: var(--ink-2); background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 14px; max-height: 420px; overflow: auto; }
pre.log { background: #13201d; color: #d9e6df; border-color: #13201d; }
.req-detail { display: flex; flex-direction: column; gap: 14px; margin-top: 18px; }
.req-detail .row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* Sign-in */
.signin { min-height: 100svh; display: grid; place-items: center; padding: 24px 16px; }
.signin-box { width: min(420px, 100%); background: var(--sheet); border: 1px solid var(--line); border-radius: 18px; padding: 30px 28px; display: flex; flex-direction: column; gap: 16px; box-shadow: 0 30px 60px -40px rgba(21,25,27,.35); }
.signin-box .mark { font-size: 1.5rem; }
.signin-box p { margin: 0; color: var(--muted); }
.msg { padding: 10px 12px; border-radius: 10px; font-size: .88rem; }
.msg.ok { background: var(--ok-bg); color: var(--ok); }
.msg.err { background: var(--err-bg); color: var(--err); }

.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: var(--ink); color: #f3efe4; padding: 10px 16px; border-radius: 999px; font-size: .9rem; z-index: 50; box-shadow: 0 10px 30px rgba(0,0,0,.25); max-width: calc(100vw - 32px); }

@media (max-width: 960px) {
  .new-grid, .grid2 { grid-template-columns: minmax(0, 1fr); }
  .totals { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .totals > div:nth-child(3) { padding-left: 0; border-left: 0; }
  .totals > div:nth-child(n+3) { border-top: 1px solid var(--line); }
}
@media (max-width: 640px) {
  .bar-in { gap: 12px; height: auto; padding-top: 10px; padding-bottom: 10px; flex-wrap: wrap; }
  .nav { order: 3; flex-basis: 100%; }
  .out { margin-left: auto; }
  .cards { grid-template-columns: minmax(0, 1fr); }
  .table .hide-sm { display: none; }
  .signin-list li { grid-template-columns: minmax(0, 1fr); }
  .signin-list .when { text-align: left; }
}
