:root {
  --bg: #f6f4ef;
  --bg2: #efece5;
  --card: #fdfcfa;
  --ink: #1c2230;
  --ink2: #3b4352;
  --muted: #6c707a;
  --faint: #9a9da4;
  --line: #e4e0d7;
  --navy: #1f2836;
  --accent: #a5692a;
  --tan: #d4b593;
  --mark: #fbe3c4;
  --ok: #3f7a52;
  --bad: #a43d32;
  --serif: "Newsreader", Georgia, "Times New Roman", serif;
  --sans: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --radius: 22px;
  --shadow: 0 18px 40px -24px rgba(31, 40, 54, .25), 0 2px 6px rgba(31, 40, 54, .04);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; }
body {
  background: radial-gradient(1200px 500px at 100% 0%, #f1ede5 0%, transparent 60%), var(--bg);
  color: var(--ink);
  font: 14px/1.6 var(--sans);
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
a { color: inherit; }
button { font: inherit; cursor: pointer; }
button:disabled { cursor: not-allowed; }
input, textarea { font: inherit; color: inherit; }

/* ---------- top bar ---------- */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px clamp(16px, 4vw, 56px);
  border-bottom: 1px solid var(--line);
  background: rgba(246, 244, 239, .85);
  backdrop-filter: blur(8px);
  position: sticky; top: 0; z-index: 20;
}
.brand { display: flex; align-items: center; gap: 12px; text-decoration: none; }
.brand-mark {
  width: 36px; height: 36px; border-radius: 50%;
  background: var(--navy); color: #fff;
  display: grid; place-items: center;
  font: 500 17px/1 var(--serif);
}
.brand-text { display: flex; flex-direction: column; line-height: 1.2; }
.brand-name { font: 500 16px var(--serif); }
.brand-sub { font-size: 9.5px; letter-spacing: .22em; text-transform: uppercase; color: var(--muted); }
.nav { display: flex; gap: 4px; }
.nav a {
  text-decoration: none; font-size: 12.5px; color: var(--ink2);
  padding: 6px 12px; border-radius: 999px;
}
.nav a:hover { background: var(--bg2); }
.nav a.on { background: #ebe7df; color: var(--ink); }

.wrap { width: 100%; max-width: 1000px; margin: 0 auto; padding: 40px clamp(16px, 4vw, 40px) 64px; flex: 1; }
.wrap.wide { max-width: 1120px; }
.footer {
  border-top: 1px solid var(--line);
  text-align: center; font-size: 12px; color: var(--muted);
  padding: 22px 16px;
}

/* ---------- type ---------- */
.eyebrow {
  display: flex; align-items: center; gap: 14px;
  font-size: 10.5px; letter-spacing: .24em; text-transform: uppercase; color: var(--accent);
  margin: 8px 0 18px;
}
.eyebrow::before { content: ""; width: 28px; height: 1px; background: var(--tan); }
.hero-title {
  font: 400 clamp(34px, 5.4vw, 52px)/1.06 var(--serif);
  letter-spacing: -.015em; margin: 0 0 20px; max-width: 620px;
}
.hero-title em { color: var(--ink2); }
.page-title { font: 500 clamp(26px, 3.6vw, 32px)/1.15 var(--serif); letter-spacing: -.01em; margin: 8px 0 10px; }
.lede { color: var(--ink2); max-width: 520px; font-size: 13.5px; margin: 0 0 28px; }
.small { font-size: 12px; color: var(--muted); }
.label { font-size: 10.5px; letter-spacing: .2em; text-transform: uppercase; color: var(--ink2); margin: 0 0 10px; }
.mono { font-family: ui-monospace, "SF Mono", Menlo, monospace; }

/* ---------- cards & buttons ---------- */
.card {
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 26px 24px;
}
.card + .card { margin-top: 18px; }
.btn {
  display: inline-flex; align-items: center; gap: 7px;
  border: 1px solid var(--line); background: var(--card); color: var(--ink);
  padding: 8px 15px; border-radius: 999px; font-size: 12.5px;
  text-decoration: none; white-space: nowrap;
}
.btn:hover:not(:disabled) { background: var(--bg2); }
.btn.dark { background: var(--navy); border-color: var(--navy); color: #fff; }
.btn.dark:hover:not(:disabled) { background: #2b3647; }
.btn.tan { background: var(--tan); border-color: var(--tan); color: #fff; }
.btn.tan:hover:not(:disabled) { background: #c8a47d; }
.btn.grey { background: #8f939a; border-color: #8f939a; color: #fff; }
.btn:disabled { opacity: .55; }
.btn.dark:disabled, .btn.tan:disabled { opacity: .7; }
.btn svg { width: 14px; height: 14px; }
.linkbtn { background: none; border: 0; padding: 0; color: var(--ink2); text-decoration: underline; text-underline-offset: 3px; text-decoration-color: var(--faint); font-size: 12px; }
.linkbtn:hover { color: var(--ink); }
.field {
  width: 100%; background: #f6f3ee; border: 1px solid #ddd8ce;
  border-radius: 12px; padding: 10px 12px; outline: none;
}
.field:focus { border-color: var(--tan); background: #fff; }
textarea.field { resize: vertical; font-family: ui-monospace, "SF Mono", Menlo, monospace; font-size: 12.5px; line-height: 1.6; }

/* ---------- drop zone ---------- */
.drop { text-align: center; padding: 42px 24px 30px; transition: background .15s, border-color .15s; }
.drop.over { background: #fbf7f0; border-color: var(--tan); }
.drop-icon {
  width: 44px; height: 44px; border-radius: 50%; border: 1px solid var(--line);
  display: grid; place-items: center; margin: 0 auto 14px; background: #faf8f4;
}
.drop h2 { font: 400 20px var(--serif); margin: 0 0 8px; }
.drop p { margin: 0 auto 18px; max-width: 320px; color: var(--muted); font-size: 12px; }
.divider { border-top: 1px solid var(--line); max-width: 384px; margin: 28px auto 20px; }
.or { font-size: 10px; letter-spacing: .22em; text-transform: uppercase; color: var(--ink2); margin-bottom: 10px; }
.linkrow { display: flex; gap: 8px; max-width: 384px; margin: 0 auto; }
.linkrow .field { flex: 1; }
.hint { font-size: 11.5px; color: var(--ink2); max-width: 384px; margin: 10px auto 0; }

.steps { display: grid; grid-template-columns: repeat(3, 1fr); margin-top: 42px; border: 1px solid var(--line); border-radius: 16px; background: #f3f1ec; overflow: hidden; }
.steps > div { padding: 22px 18px; }
.steps > div + div { border-left: 1px solid var(--line); }
.steps .n { font: 500 10px var(--sans); color: var(--accent); letter-spacing: .1em; }
.steps h3 { font: 500 14px var(--serif); margin: 10px 0 6px; }
.steps p { margin: 0; color: var(--muted); font-size: 12px; }

/* ---------- progress ---------- */
.working { text-align: center; padding: 40px 24px 30px; }
.bars { display: flex; justify-content: center; align-items: center; gap: 4px; height: 34px; margin-bottom: 12px; }
.bars i { width: 2.5px; background: var(--accent); border-radius: 2px; animation: bar 1.1s ease-in-out infinite; }
.bars i:nth-child(1){height:14px;animation-delay:-.1s}.bars i:nth-child(2){height:24px;animation-delay:-.3s}
.bars i:nth-child(3){height:32px;animation-delay:-.5s}.bars i:nth-child(4){height:20px;animation-delay:-.2s}
.bars i:nth-child(5){height:28px;animation-delay:-.6s}.bars i:nth-child(6){height:12px;animation-delay:-.4s}
.bars i:nth-child(7){height:18px;animation-delay:-.7s}
@keyframes bar { 50% { transform: scaleY(.35); } }
.working h2 { font: 400 19px var(--serif); margin: 0 0 6px; }
.working p { color: var(--muted); font-size: 12px; margin: 0 auto; max-width: 340px; }
.meter { display: flex; justify-content: center; gap: 10px; margin: 14px 0 18px; font-size: 11px; color: var(--ink2); }
.meter span + span { border-left: 1px solid var(--line); padding-left: 10px; }
.pbar { height: 4px; background: var(--bg2); border-radius: 4px; max-width: 300px; margin: 14px auto 0; overflow: hidden; }
.pbar > div { height: 100%; background: var(--accent); width: 0; transition: width .2s; }
.errorbox { background: #fbefec; border: 1px solid #efd3cd; color: var(--bad); border-radius: 12px; padding: 10px 14px; font-size: 12.5px; margin: 14px auto 0; max-width: 460px; }

/* ---------- queue ---------- */
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.qhead h3 { font: 500 17px var(--serif); margin: 0 0 6px; display: flex; gap: 8px; align-items: center; }
.qhead p { margin: 0 0 14px; color: var(--ink2); font-size: 12px; max-width: 420px; }
.qlinks { min-height: 98px; }
.qbar { display: flex; gap: 8px; margin-top: 12px; }
.sep { border-top: 1px solid var(--line); margin: 20px 0 16px; }
.drive-row { display: flex; gap: 8px; max-width: 360px; }
.drive-row .field { flex: 1; }
.empty { text-align: center; padding: 24px; color: var(--ink2); font-size: 12px; background: #f1efea; border: 1px solid var(--line); border-radius: 16px; margin-top: 18px; }
.qlist { margin-top: 18px; padding: 6px 0; max-height: 640px; overflow: auto; }
.qitem { display: grid; grid-template-columns: 34px 1fr auto; gap: 8px; padding: 12px 22px; align-items: center; border-bottom: 1px solid #efebe4; }
.qitem:last-child { border-bottom: 0; }
.qitem .num { font: 11px ui-monospace, Menlo, monospace; color: var(--muted); align-self: start; padding-top: 2px; }
.qitem .t { font-size: 12.5px; color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.qitem .t a { text-decoration: none; }
.qitem .t a:hover { text-decoration: underline; }
.qitem .m { font-size: 11px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.qitem .err { color: var(--bad); font-size: 11px; }
.pill { font-size: 11px; padding: 3px 10px; border-radius: 999px; border: 1px solid var(--line); color: var(--ink2); background: #fff; display: inline-flex; gap: 6px; align-items: center; }
.pill.run { color: var(--accent); border-color: #ecd9c3; background: #fdf6ee; }
.pill.done { color: var(--ok); border-color: #cfe2d5; background: #f2f8f4; }
.pill.fail { color: var(--bad); border-color: #efd3cd; background: #fcf3f1; }
.pill.saved { color: #2d5aa0; border-color: #cfdcef; background: #f2f6fc; }
.qactions { display: flex; gap: 6px; align-items: center; }
.tiny { font-size: 11px; padding: 3px 9px; }

/* ---------- rabbi ---------- */
.searchrow { display: flex; gap: 10px; }
.searchrow .field { flex: 1; }
.cands { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 14px; margin-top: 18px; }
.cand { display: flex; gap: 12px; align-items: center; padding: 14px; border: 1px solid var(--line); border-radius: 16px; background: var(--card); }
.cand img, .cand .ph { width: 54px; height: 54px; border-radius: 50%; object-fit: cover; background: var(--bg2); flex: none; display: grid; place-items: center; font: 500 16px var(--serif); color: var(--ink2); }
.cand .nm { font: 500 14px var(--serif); line-height: 1.25; }
.cand .ct { font-size: 11px; color: var(--muted); margin: 2px 0 8px; }

/* ---------- editor ---------- */
.ed-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; padding-bottom: 16px; border-bottom: 1px solid var(--line); margin-bottom: 18px; }
.ed-head h1 { font: 500 clamp(24px, 3.2vw, 30px)/1.2 var(--serif); margin: 0 0 12px; letter-spacing: -.01em; }
.ed-meta { display: flex; align-items: center; gap: 10px; font-size: 12px; color: var(--muted); }
.ed-meta .badge { width: 30px; height: 30px; border-radius: 50%; border: 1px solid var(--line); display: grid; place-items: center; font: 15px var(--serif); color: var(--ink); background: #fff; }
.ed-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.ed-grid { display: grid; grid-template-columns: minmax(0, 1fr) 236px; gap: 20px; align-items: start; }
.tabs { display: inline-flex; border: 1px solid var(--line); border-radius: 999px; padding: 3px; background: var(--card); }
.tabs button { border: 0; background: none; padding: 6px 13px; border-radius: 999px; font-size: 12px; color: var(--ink2); display: inline-flex; gap: 6px; align-items: center; }
.tabs svg { width: 14px; height: 14px; }
.tabs button.on { background: #ebe7df; color: var(--ink); }
.paper { margin-top: 12px; padding: 28px 30px; font: 400 15.5px/1.85 var(--serif); color: #222; }
.paper p { margin: 0 0 1em; }
.paper mark { background: var(--mark); color: inherit; padding: 0 2px; border-radius: 3px; position: relative; cursor: help; }
.paper mark:hover::after {
  content: "heard: " attr(data-heard);
  position: absolute; left: 0; bottom: calc(100% + 6px);
  background: var(--navy); color: #fff; font: 11px/1.3 var(--sans);
  padding: 5px 8px; border-radius: 6px; white-space: nowrap; z-index: 5;
}
.paper textarea { width: 100%; min-height: 70vh; border: 0; outline: none; resize: vertical; background: transparent; font: inherit; line-height: inherit; }
.side .card { padding: 18px; border-radius: 18px; }
.side h4 { margin: 0; font: 500 14px var(--serif); }
.seg { display: grid; grid-template-columns: 1fr 1fr; border: 1px solid var(--line); border-radius: 999px; padding: 3px; margin: 12px 0 10px; background: #f3f1ec; }
.seg button { border: 0; background: none; border-radius: 999px; padding: 7px 0; font-size: 12px; color: var(--ink2); }
.seg button.on { background: #fff; color: var(--ink); box-shadow: 0 1px 3px rgba(0,0,0,.08); }
.side .help { font-size: 11px; color: var(--muted); margin: 4px 0 10px; }
.side textarea { min-height: 120px; font-size: 11.5px; }
details.gl { border: 1px solid var(--line); border-radius: 14px; margin-top: 14px; background: #fff; }
details.gl summary { list-style: none; padding: 12px 14px; font-size: 12px; cursor: pointer; display: flex; justify-content: space-between; }
details.gl summary::after { content: "⌄"; color: var(--muted); }
details.gl[open] summary::after { content: "⌃"; }
.gl-list { max-height: 320px; overflow: auto; padding: 0 14px 12px; font-size: 11.5px; }
.gl-list div { padding: 5px 0; border-top: 1px solid #f0ece5; }
.gl-list b { font-weight: 600; }
.gl-list span { color: var(--muted); }
.ed-edited { font-size: 11.5px; color: var(--muted); margin-top: 10px; }

/* ---------- toast & modal ---------- */
.toast {
  position: fixed; left: 50%; bottom: 26px; transform: translateX(-50%);
  background: var(--navy); color: #fff; font-size: 12.5px; padding: 10px 16px; border-radius: 999px;
  box-shadow: var(--shadow); z-index: 50; max-width: 90vw;
}
.modal { position: fixed; inset: 0; background: rgba(28, 34, 48, .35); display: grid; place-items: center; z-index: 60; padding: 16px; }
.modal .card { width: 100%; max-width: 380px; }
.modal h3 { font: 500 18px var(--serif); margin: 0 0 8px; }
.modal p { font-size: 12.5px; color: var(--ink2); margin: 0 0 14px; }

@media (max-width: 760px) {
  .ed-grid { grid-template-columns: 1fr; }
  .steps { grid-template-columns: 1fr; }
  .steps > div + div { border-left: 0; border-top: 1px solid var(--line); }
  .linkrow, .searchrow, .drive-row { flex-direction: column; }
  .topbar { flex-wrap: wrap; gap: 10px; }
  .paper { padding: 20px; }
}

/* ---------- by rabbi: browse all ---------- */
.splist { margin-top: 16px; max-height: 560px; overflow: auto; display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 6px 10px; padding-right: 4px; }
.spletter { grid-column: 1 / -1; font: 500 13px var(--serif); color: var(--accent); border-bottom: 1px solid var(--line); padding: 10px 2px 4px; position: sticky; top: 0; background: var(--card); z-index: 1; }
.sp { display: flex; align-items: center; gap: 10px; text-align: left; border: 1px solid transparent; background: none; border-radius: 12px; padding: 6px 8px; color: var(--ink); min-width: 0; }
.sp:hover { background: #f6f2ea; border-color: var(--line); }
.sp.on { border-color: var(--tan); background: #fcf6ee; }
.sp img, .sp .ph { width: 38px; height: 38px; border-radius: 50%; object-fit: cover; flex: none; background: var(--bg2); display: grid; place-items: center; font: 500 13px var(--serif); color: var(--ink2); }
.spn { flex: 1; min-width: 0; font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.spc { font-size: 10.5px; color: var(--muted); flex: none; }
.pick { margin-bottom: 18px; }
.pick-top { display: grid; grid-template-columns: auto 1fr auto; gap: 22px; align-items: center; }
.pick img.big, .pick .ph.big { width: 110px; height: 110px; border-radius: 16px; object-fit: cover; background: var(--bg2); display: grid; place-items: center; font: 500 30px var(--serif); color: var(--ink2); }
.pick-name { font: 500 26px/1.15 var(--serif); margin: 0 0 8px; }
.pick-stats { font-size: 12.5px; color: var(--ink2); }
.pick-act { display: flex; flex-direction: column; align-items: flex-end; gap: 10px; align-self: start; }
.btn.amber { background: #a5692a; border-color: #a5692a; color: #fff; padding: 10px 18px; }
.btn.amber:hover:not(:disabled) { background: #8f5a22; }
#pkList { max-height: none; }
#pkList .qitem { grid-template-columns: 44px 1fr; }
#pkList .t a { text-decoration: none; }
#pkList .t a:hover { text-decoration: underline; }
@media (max-width: 760px) {
  .pick-top { grid-template-columns: auto 1fr; }
  .pick-act { grid-column: 1 / -1; align-items: stretch; }
  .pick img.big, .pick .ph.big { width: 80px; height: 80px; }
  .splist { grid-template-columns: 1fr; }
}
