/* ===== BRANDING: colours and fonts of this copy (גני חב״ד, fabric / felt look). Texts are in js/brand.js. =====
   The variable names come from the template app; their values are this design's colours:
   --plum = main purple felt (main buttons, labels), --title = brown of the linen signs (headings),
   --sage = green felt ("למדנו השבוע"), --rose = pink felt, --blue = blue felt, --gold = tan stitch lines,
   --blush = cream linen page background (all screens). Fonts: Rubik (headings), Assistant (text), Frank Ruhl Libre (lesson reading). */
:root {
  --blush: #fdf8ef;     /* cream, with a fine linen weave (body) – her choice for every screen */
  --cream: #f8f2e8;
  --card: #fdf9f2;
  --linen: #efe3cf;
  --title: #5b3a29;
  --sage: #74bd80;
  --sage-deep: #3f8a4e;
  --sage-soft: #e3f1e2;
  --rose: #e98d93;
  --rose-deep: #c4566a;
  --rose-soft: #fbe4e3;
  --blue: #5180b9;
  --blue-soft: #e3edf8;
  --plum: #7d58a8;
  --plum-dark: #66468f;
  --gold: #c2a383;
  --text: #4a3428;
  --muted: #8b7663;
  --radius: 24px;
  --head-font: 'Rubik', 'Assistant', sans-serif;
  --cream-frame: #fff7e8; /* the framed cards inside the app, e.g. the lesson card on the home screen */
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100vh; min-height: 100dvh;
  font-family: 'Assistant', 'Arial Hebrew', Arial, sans-serif;
  font-size: 18px; line-height: 1.55; color: var(--text);
  background-color: var(--blush);
  /* fine linen weave */
  background-image: repeating-linear-gradient(0deg, rgba(120, 90, 60, .035) 0 1px, transparent 1px 3px),
                    repeating-linear-gradient(90deg, rgba(120, 90, 60, .03) 0 1px, transparent 1px 4px);
}
h1, h2, h3 { font-family: var(--head-font); color: var(--title); font-weight: 700; line-height: 1.2; margin: 0; }
h1 { font-size: 2.4rem; }
h2 { font-size: 1.7rem; }
h3 { font-size: 1.3rem; }
p { margin: 0 0 .6em; }
a { color: var(--plum); }
.muted { color: var(--muted); }
.small { font-size: .9rem; }
.center { text-align: center; }
.hidden { display: none !important; }


.page { max-width: 520px; margin: 0 auto; padding: 14px 16px calc(96px + env(safe-area-inset-bottom) + var(--badge, 0px)); }
body.admin .page { max-width: 940px; padding-bottom: 60px; }

.topbar { display: grid; grid-template-columns: 1fr auto 1fr; align-items: start; padding: 4px 4px 10px; }
.topbar .brand { font-family: var(--head-font); font-size: 1.05rem; line-height: 1.1; color: var(--title); font-weight: 700; text-decoration: none; text-align: center; white-space: nowrap; display: inline-flex; align-items: center; gap: 6px; }
.topbar .brand .logo { height: 36px; width: auto; display: block; }
.topbar .linkbtn { justify-self: end; }
.bh { font-size: .95rem; font-weight: 600; color: var(--title); padding: 6px 2px; justify-self: start; }
.bh.corner { position: absolute; top: 10px; right: 16px; }
.logo { max-width: 100%; height: auto; }
.orgbar { text-align: center; margin: 0 0 4px; }
.orglogos { height: 48px; width: auto; max-width: 70%; }
.waicon { width: 26px; height: 26px; flex: none; }
.btn.invite { display: flex; width: 100%; margin: 0 0 16px; }
/* home-screen guide */
.install summary { cursor: pointer; font-weight: 700; color: var(--plum); list-style: none; display: flex; justify-content: space-between; align-items: center; gap: 10px; min-height: 28px; }
.install summary::-webkit-details-marker { display: none; }
.install summary::after { content: '+'; font-size: 1.6rem; line-height: 1; color: var(--gold); }
.install[open] summary::after { content: '\2212'; }
.install h4 { margin: 16px 0 4px; color: var(--sage-deep); font-size: 1.05rem; }
.install ol { margin: 0; padding: 0 22px 0 0; }
.install li { margin: 6px 0; }
.shareicon { width: 1.15em; height: 1.15em; vertical-align: -.22em; color: var(--plum); }
.adminlink { text-align: center; margin: 26px 0 0; font-size: .78rem; }
.adminlink a { color: var(--muted); opacity: .55; text-decoration: none; }
#printArea { display: none; }
@media print {
  @page { margin: 8mm; }
  body { background: #fff; }
  body::before, body > *:not(#printArea) { display: none !important; }
  #printArea { display: block; }
  #printArea img { display: block; width: 100%; height: auto; page-break-after: always; break-after: page; }
  #printArea img:last-child { page-break-after: auto; break-after: auto; }
}
.linkbtn { background: none; border: 0; color: var(--plum); font: inherit; font-size: .95rem; text-decoration: underline; cursor: pointer; padding: 8px; }

/* cards */
.card {
  position: relative; background: var(--card); border-radius: var(--radius);
  padding: 20px 20px 22px; margin: 0 0 16px;
  border: 1px solid #eadcc6; box-shadow: 0 8px 24px rgba(91, 58, 41, .08);   /* soft card, like the opening screen */
}
.card.sage { background: var(--sage-soft); border-color: #cfe3cc; }
.card.rose { background: var(--rose-soft); border-color: #f1d0d0; }
.arch { /* linen sign with a running stitch, like the hanging signs in the designs */
  background-color: var(--linen);
  background-image: repeating-linear-gradient(0deg, rgba(120, 90, 60, .05) 0 1px, transparent 1px 3px),
                    repeating-linear-gradient(90deg, rgba(120, 90, 60, .045) 0 1px, transparent 1px 3px);
  padding: 30px 24px 26px; text-align: center;
}
.arch > * { position: relative; }
/* inside the app the framed cards (lesson card etc.) are cream, for contrast with the linen page */
.arch:not(.hang) { background-color: var(--cream-frame); background-image: none; border-color: #e6d3b6; box-shadow: 0 12px 30px rgba(91, 58, 41, .13); }
/* hanging on two ropes, with metal eyelets */
.hang { margin-top: 56px; }
.hang::before, .hang::after {
  content: ''; position: absolute; top: -58px; width: 4px; height: 70px; border-radius: 2px;
  background: repeating-linear-gradient(35deg, #a7845a 0 3px, #d6b78d 3px 6px);
}
.hang::before { right: 22%; transform: rotate(-9deg); transform-origin: bottom; }
.hang::after { left: 22%; transform: rotate(9deg); transform-origin: bottom; }
.hang .eyelet { position: absolute; top: 9px; width: 13px; height: 13px; border-radius: 50%; background: var(--linen); border: 3px solid #a99a88; }
.hang .eyelet.r { right: calc(22% - 6px); } .hang .eyelet.l { left: calc(22% - 6px); }
.label { display: inline-block; font-weight: 700; color: var(--plum); letter-spacing: .5px; font-size: .95rem; }
.goldline { /* divider: thin purple curves with a small peach heart */ height: 21px; border: 0; margin: 12px auto; width: 100%; background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 300 30'%3E%3Cpath d='M8 20 Q 70 4 132 16' fill='none' stroke='%23a07acb' stroke-width='2' stroke-linecap='round'/%3E%3Cpath d='M168 16 Q 230 4 292 20' fill='none' stroke='%23a07acb' stroke-width='2' stroke-linecap='round'/%3E%3Cpath d='M150 27c-7-5-12-9-12-14 0-3.3 2.6-5.8 5.7-5.8 2.6 0 4.7 1.4 6.3 3.5 1.6-2.1 3.7-3.5 6.3-3.5 3.1 0 5.7 2.5 5.7 5.8 0 5-5 9-12 14z' fill='%23f0a98a'/%3E%3C/svg%3E") center / 210px 21px no-repeat; }

/* buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 52px; padding: 12px 24px; border-radius: 999px; border: 0;
  outline: 1.5px dashed rgba(255, 255, 255, .65); outline-offset: -6px;   /* felt patch with a stitch */
  box-shadow: 0 3px 0 rgba(0, 0, 0, .12);
  background: var(--plum); color: #fff; font: inherit; font-weight: 700; font-size: 1.08rem;
  cursor: pointer; text-decoration: none; transition: background .15s, transform .05s;
}
.btn:hover { background: var(--plum-dark); }
.btn:active { transform: scale(.98); }
.btn:disabled { opacity: .5; cursor: default; }
.btn.block { display: flex; width: 100%; }
.btn.big { min-height: 62px; font-size: 1.25rem; }
.btn.ghost { background: var(--card); color: var(--plum); border: 1.5px solid var(--plum); outline-color: rgba(125, 88, 168, .4); box-shadow: none; }
.btn.ghost:hover { background: rgba(125, 88, 168, .07); }
.btn.sagebtn { background: var(--sage-deep); }
.btn.wa { background: #2f8f5b; }
.btn.sm { min-height: 40px; padding: 6px 16px; font-size: .95rem; white-space: nowrap; }
.btn.danger { background: transparent; color: #a23b3b; border: 1.5px solid #c98d8d; outline: 0; box-shadow: none; }
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.row.between { justify-content: space-between; }
.stack > * + * { margin-top: 12px; }

/* forms */
label.field { display: block; text-align: right; font-weight: 600; margin-bottom: 12px; }
input[type=text], input[type=tel], input[type=email], input[type=password], input[type=date], input[type=number], input[type=search], textarea, select {
  width: 100%; min-height: 52px; margin-top: 4px; padding: 10px 16px;
  border: 1.5px solid #e6d7c1; border-radius: 16px; background: #fbf5ea;
  font: inherit; color: var(--text);
}
textarea { min-height: 110px; resize: vertical; }
input:focus, textarea:focus, select:focus, .btn:focus-visible, .chip:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
input[type=tel] { direction: ltr; text-align: right; }

.tabs { display: flex; background: #f6efe3; border: 1px solid #ece0cc; border-radius: 999px; padding: 4px; margin: 16px 0; }
.tabs button { flex: 1; min-height: 44px; border: 0; background: transparent; border-radius: 999px; font: inherit; font-weight: 700; color: var(--plum); cursor: pointer; }
.tabs button.on { background: var(--plum); color: #fff; outline: 1.5px dashed rgba(255, 255, 255, .6); outline-offset: -5px; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 6px 0 14px; }
.chip { min-height: 44px; padding: 8px 16px; border-radius: 999px; border: 1.5px solid var(--sage); background: #fff; font: inherit; color: var(--sage-deep); font-weight: 600; cursor: pointer; }
.chip.on { background: var(--sage-deep); border-color: var(--sage-deep); color: #fff; }
.tag { display: inline-block; padding: 2px 10px; border-radius: 999px; background: var(--rose-soft); color: var(--plum); font-size: .82rem; font-weight: 600; white-space: nowrap; }
.tag.sage { background: var(--sage-soft); color: var(--sage-deep); }
.tag.gold { background: #f3e6c8; color: #7a5c1c; }

/* welcome */
.welcome { max-width: 460px; margin: 0 auto; padding: 44px 18px 30px; }
.welcome h1 .logo { display: block; width: 100%; max-width: 340px; margin: 4px auto 0; }
.welcome .org { color: var(--plum); font-weight: 700; font-size: 1.15rem; margin: 10px 0 0; }
.welcome .sub { font-size: 1.05rem; margin: 2px 0 0; color: var(--title); }
/* ---- opening screen and admin login (class .welcome.soft; redesigned 19.11.2026 after the ChatGPT mock-up she liked):
   no hanging sign; logo + subtitle + dates + curved line with a heart, then a soft sign-up card
   with pill tabs, a leaves-and-heart divider, cream fields with icons and a pill button ---- */
.welcome.soft { text-align: center; padding-top: 40px; }
.welcome.soft h1 .logo { max-width: 330px; margin-top: 10px; }
.welcome.soft .org { font-size: 1.2rem; margin-top: 12px; }
.heartline { display: block; width: 210px; height: 21px; margin: 10px auto 8px; }
/* watercolour drawings (made by her with ChatGPT; cut out by dev/make-watercolor.mjs) */
.welcome.soft { position: relative; }
.books { display: block; width: 190px; height: auto; margin: 0 auto -8px; position: relative; z-index: 1; }
.flowers { position: absolute; width: 104px; height: auto; pointer-events: none; opacity: .95; }
.flowers.br { right: -6px; bottom: 0; }
.flowers.tl { left: -6px; top: 4px; transform: rotate(180deg); }
@media (min-width: 480px) { .flowers { width: 130px; } }
/* a flower branch at the bottom of the home screen */
.flowers.homecorner { position: static; display: block; width: 110px; margin: 0 auto 0 -8px; transform: scaleX(-1); }
.signupcard { background: #fffaf2; border: 1px solid #eadcc6; outline: 0; border-radius: 28px; padding: 18px 20px 20px; box-shadow: 0 10px 30px rgba(91, 58, 41, .10); text-align: right; }
.signupcard .tabs { border-radius: 999px; background: #f6efe3; border: 1px solid #ece0cc; margin: 0; }
.signupcard .tabs button { border-radius: 999px; }
.signupcard .tabs button.on { outline-offset: -5px; }
.leafdiv { display: block; width: 120px; height: 22px; margin: 14px auto 6px; }
.inp { position: relative; display: block; }
.inp .inpicon { position: absolute; right: 16px; top: 50%; margin-top: -9px; width: 20px; height: 20px; color: #9b8670; pointer-events: none; z-index: 1; }
.signupcard input[type=text], .signupcard input[type=tel] { background: #fbf5ea; border-color: #e6d7c1; padding-right: 46px; }
.signupcard .btn { margin-top: 6px; }
.signupcard .btn .chev { width: 22px; height: 22px; }
.scene { margin: 18px auto 0; border-radius: var(--radius); overflow: hidden; box-shadow: 0 8px 20px rgba(91, 58, 41, .14); }
.scene img { display: block; width: 100%; height: auto; }

/* home */
.hello { font-size: 1.3rem; font-weight: 600; margin: 0 0 6px; text-align: center; }
.status-ok { display: flex; gap: 12px; align-items: flex-start; text-align: right; }
.check { flex: none; width: 40px; height: 40px; border-radius: 50%; background: var(--sage-deep); color: #fff; display: grid; place-items: center; font-size: 1.3rem; font-weight: 700; }
.bignum { font-family: var(--head-font); font-size: 3rem; line-height: 1; color: var(--plum); font-weight: 700; }
.progress { display: flex; gap: 6px; margin: 12px 0 6px; }
.progress span { flex: 1; height: 14px; border-radius: 999px; background: #e9dcd2; }
.progress span.done { background: var(--sage-deep); }
.progress span.now { box-shadow: 0 0 0 2px var(--gold); }
.members { list-style: none; padding: 0; margin: 10px 0; }
.members li { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 0; border-bottom: 1px solid #eadfd5; }
.members li:last-child { border-bottom: 0; }
.list { list-style: none; padding: 0; margin: 0; }
.list li a { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 14px 4px; border-bottom: 1px solid #eadfd5; text-decoration: none; font-weight: 600; }

/* bottom navigation */
.nav { position: fixed; bottom: 0; left: 0; right: 0; z-index: 5; display: flex; justify-content: center; background: rgba(255, 251, 244, .97); border-top: 1px solid #eadcc6; padding-bottom: calc(env(safe-area-inset-bottom) + var(--badge, 0px)); backdrop-filter: blur(6px); }
.nav a { flex: 1; max-width: 170px; text-align: center; padding: 14px 6px; text-decoration: none; color: var(--muted); font-weight: 700; }
.nav a.on { color: var(--plum); box-shadow: inset 0 3px 0 var(--plum); }

/* quiz */
.q { text-align: right; }
.q h3 { font-family: 'Assistant', sans-serif; font-size: 1.15rem; line-height: 1.4; margin-bottom: 10px; letter-spacing: 0; }
.opt { display: flex; align-items: center; gap: 10px; min-height: 52px; padding: 10px 14px; margin-bottom: 8px; border: 1.5px solid #e6d7c1; border-radius: 16px; background: #fffdf8; cursor: pointer; }
.opt input { width: 22px; height: 22px; accent-color: var(--plum); flex: none; }
.opt.right { border-color: var(--sage-deep); background: var(--sage-soft); }
.opt.wrong { border-color: #c98d8d; background: #f8e4e1; }

.pdf-page { display: block; width: 100%; height: auto; margin: 0 0 10px; border-radius: 8px; box-shadow: 0 2px 10px rgba(0, 0, 0, .12); background: #fff; }

#toast { position: fixed; bottom: calc(92px + env(safe-area-inset-bottom)); left: 50%; transform: translate(-50%, 20px); max-width: 88%; padding: 12px 20px; border-radius: 16px; background: var(--sage-deep); color: #fff; font-weight: 600; text-align: center; opacity: 0; pointer-events: none; transition: .25s; z-index: 50; }
#toast.show { opacity: 1; transform: translate(-50%, 0); }
#toast.err { background: #9a3a3a; }

/* admin */
.atabs { display: flex; gap: 6px; overflow-x: auto; padding: 4px 0 12px; }
.atabs button { flex: none; min-height: 44px; padding: 8px 18px; border-radius: 999px; border: 1.5px solid var(--plum); background: var(--card); color: var(--plum); font: inherit; font-weight: 700; cursor: pointer; }
.atabs button.on { background: var(--plum); color: #fff; }
.tablewrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .95rem; }
th, td { text-align: right; padding: 9px 8px; border-bottom: 1px solid #eadfd5; vertical-align: middle; }
th { color: var(--sage-deep); font-size: .88rem; white-space: nowrap; }
td.c, th.c { text-align: center; }
.cellbtn { width: 34px; height: 34px; border-radius: 50%; border: 1.5px solid #dcc7bb; background: #fff; cursor: pointer; font: inherit; color: var(--sage-deep); font-weight: 700; }
.cellbtn.done { background: var(--sage-deep); border-color: var(--sage-deep); color: #fff; }
.groupbox { border: 1px solid #e3d3c7; border-radius: 16px; padding: 12px 14px; margin-bottom: 10px; background: #fff; }
.groupbox.pending { border-color: var(--gold); background: #fdf7e8; }
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 4px 6px 4px 12px; margin: 3px; border-radius: 999px; background: var(--rose-soft); font-size: .92rem; }
.pill button { border: 0; background: rgba(125, 88, 168, .14); color: var(--plum); width: 24px; height: 24px; border-radius: 50%; cursor: pointer; font-weight: 700; line-height: 1; }
.picklist { max-height: 260px; overflow: auto; border: 1px solid #e3d3c7; border-radius: 16px; background: #fff; padding: 6px 12px; }
.picklist label { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid #f1e7df; }
.picklist input { width: 20px; height: 20px; accent-color: var(--plum); }
.qedit { border: 1px solid #e3d3c7; border-radius: 16px; padding: 14px; margin-bottom: 12px; background: #fff; }
.qedit .optrow { display: flex; align-items: center; gap: 8px; margin-top: 6px; }
.qedit .optrow input[type=radio] { width: 22px; height: 22px; accent-color: var(--sage-deep); flex: none; }
.qedit .optrow input[type=text] { margin-top: 0; min-height: 44px; }
.modal { position: fixed; inset: 0; z-index: 40; background: rgba(74, 52, 40, .55); overflow: auto; padding: 20px 12px; }
.modal .inner { max-width: 480px; margin: 0 auto; background: var(--blush); border-radius: 26px; padding: 16px; }
.banner { padding: 12px 16px; border-radius: 16px; background: #f3e6c8; color: #6b4f15; font-weight: 600; margin-bottom: 14px; }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; }
.stat { background: #fff; border-radius: 16px; padding: 14px; text-align: center; }
.stat b { display: block; font-family: var(--head-font); font-size: 2rem; color: var(--plum); line-height: 1; }


/* admin tables stay readable on a phone: they scroll sideways instead of squeezing */
body.admin .tablewrap table { min-width: 540px; }
body.admin td .muted.small { white-space: nowrap; }

/* in-app reading version of a lesson (same look as the lesson PDF) */
.readcard { padding: 22px 18px 14px; }
.reading { font-family: 'Frank Ruhl Libre', 'Times New Roman', serif; font-size: 1.16rem; line-height: 1.6; color: var(--text); }
.reading p { margin: 0 0 .85em; }
.reading h3 { display: flex; align-items: center; gap: 10px; font-size: 1.35rem; margin: 1.1em 0 .45em; color: var(--plum); }
.reading h3:first-child { margin-top: 0; }
.reading h3 .num { flex: none; width: 30px; height: 30px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; font-family: 'Assistant', sans-serif; font-size: 1rem; color: #fff; background: var(--plum); }
.reading h3.sage { color: var(--sage-deep); } .reading h3.sage .num { background: var(--sage-deep); }
.reading h3.rose { color: var(--rose-deep); } .reading h3.rose .num { background: var(--rose-deep); }
.reading h3.gold { color: var(--blue); } .reading h3.gold .num { background: var(--blue); }
.reading blockquote { margin: .4em 0 1em; padding: 14px 16px; background: var(--cream); border-right: 5px solid var(--gold); border-radius: 12px; font-weight: 700; color: var(--plum); line-height: 1.55; }
.reading blockquote small { display: block; margin-top: 6px; font-family: 'Assistant', sans-serif; font-weight: 400; font-size: .85rem; color: var(--muted); }
.reading .key { margin: .6em 0 1.2em; padding: 14px 16px; background: var(--plum); color: #fff; border-radius: 14px; font-weight: 700; line-height: 1.6; }
.reading .story { margin: .6em 0 1.1em; padding: 14px 16px 4px; border-radius: 16px; }
.reading .story.rose { background: var(--rose-soft); } .reading .story.sage { background: var(--sage-soft); }
.reading .slabel { display: flex; align-items: center; gap: 8px; font-family: var(--head-font); font-weight: 700; font-size: 1.15rem; line-height: 1; color: var(--plum); margin-bottom: 10px; }
.reading .story.sage .slabel { color: var(--sage-deep); }
.reading .slabel span { font-family: 'Assistant', sans-serif; font-size: .78rem; background: var(--plum); color: #fff; border-radius: 999px; padding: 3px 10px; }
.reading .story.sage .slabel span { background: var(--sage-deep); }
#lessonTabs .tabs { margin: 14px 0 0; }

/* small quiz button at the top of the lesson */
.quiztop{margin-top:10px;display:flex;justify-content:flex-start}
