:root {
  --bg: #f6f3ef; --card: #fff; --text: #1f1a17; --muted: #6b625b; --line: #e4ddd5;
  --brand: #7a1f2b; --brand-soft: #f6e6e8; --ok: #2f7d4a; --ok-soft: #e4f3e9; --warn: #a15c00; --warn-soft: #fdf0dc;
  --radius: 14px;
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #171412; --card: #221e1b; --text: #f1ece7; --muted: #a99f97; --line: #3a332e;
    --brand: #e0707f; --brand-soft: #3a2226; --ok: #6cc58b; --ok-soft: #1f3327; --warn: #f0b35c; --warn-soft: #3a2d1a; }
}
* { box-sizing: border-box; }
body { margin: 0; font-family: "Segoe UI", Arial, "Noto Sans Hebrew", sans-serif; background: var(--bg); color: var(--text);
  font-size: 16px; line-height: 1.5; }
a { color: var(--brand); }
.topbar { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; justify-content: space-between;
  gap: 8px; padding: 10px 16px; background: var(--brand); color: #fff; }
@media (prefers-color-scheme: dark) { .topbar { background: #4a141c; } }
.brand { color: #fff; text-decoration: none; font-weight: 700; display: flex; align-items: center; gap: 8px; }
.brand img { width: 28px; height: 28px; }
#topnav { display: flex; gap: 6px; align-items: center; font-size: 14px; }
#topnav a, #topnav button { color: #fff; background: rgba(255,255,255,.15); border: 0; border-radius: 999px;
  padding: 6px 12px; text-decoration: none; font: inherit; cursor: pointer; }
main { max-width: 860px; margin: 0 auto; padding: 16px 16px 80px; }
h1 { font-size: 22px; margin: 8px 0 16px; }
h2 { font-size: 18px; margin: 20px 0 10px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; margin-bottom: 12px; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
@media (max-width: 600px) { .grid3 { grid-template-columns: 1fr; } }
.bigbtn { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; min-height: 110px;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); text-decoration: none;
  color: var(--text); font-weight: 700; font-size: 18px; }
.bigbtn .ico { font-size: 32px; }
.bigbtn .sub { font-weight: 400; font-size: 13px; color: var(--muted); }
@media (max-width: 600px) { .bigbtn { flex-direction: row; justify-content: flex-start; min-height: 64px; padding: 0 16px; }
  .bigbtn .sub { margin-inline-start: auto; } }
.btn { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--brand); background: var(--brand); color: #fff;
  border-radius: 10px; padding: 9px 16px; font: inherit; cursor: pointer; text-decoration: none; }
.btn.ghost { background: transparent; color: var(--brand); }
.btn.small { padding: 4px 10px; font-size: 14px; }
.btn.danger { background: transparent; color: #b3261e; border-color: #b3261e; }
.btn:disabled { opacity: .5; }
.row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.spread { display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; }
form.stack, .stack { display: grid; gap: 10px; }
label { display: grid; gap: 4px; font-size: 14px; color: var(--muted); }
input, select, textarea { font: inherit; color: var(--text); background: var(--card); border: 1px solid var(--line);
  border-radius: 10px; padding: 9px 10px; width: 100%; }
textarea { min-height: 80px; resize: vertical; }
.fields2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
@media (max-width: 600px) { .fields2 { grid-template-columns: 1fr; } }
.list { list-style: none; padding: 0; margin: 0; }
.list > li { padding: 10px 0; border-bottom: 1px solid var(--line); }
.list > li:last-child { border-bottom: 0; }
.pill { display: inline-block; font-size: 12px; padding: 2px 8px; border-radius: 999px; background: var(--brand-soft); color: var(--brand); }
.pill.ok { background: var(--ok-soft); color: var(--ok); }
.pill.warn { background: var(--warn-soft); color: var(--warn); }
.task { display: flex; gap: 10px; align-items: flex-start; }
.task input[type=checkbox] { width: 22px; height: 22px; margin-top: 2px; flex: none; accent-color: var(--ok); }
.task.done .title { text-decoration: line-through; color: var(--muted); }
.task .body { flex: 1; }
.tabs { display: flex; gap: 6px; margin-bottom: 12px; }
.tabs button { border: 1px solid var(--line); background: var(--card); color: var(--text); border-radius: 999px; padding: 6px 14px; font: inherit; cursor: pointer; }
.tabs button.on { background: var(--brand); color: #fff; border-color: var(--brand); }
/* Monthly document form: one row per conversation, table columns on desktop, cards on phones */
.doc-row { display: grid; grid-template-columns: 1.3fr 1.6fr .75fr 1.6fr 1.3fr 1fr auto; gap: 6px; margin-bottom: 8px; align-items: start; }
.doc-row label { gap: 2px; }
.doc-row label > .lbl { display: none; }
.doc-row textarea { min-height: 42px; }
.doc-headrow { font-size: 13px; font-weight: 700; color: var(--muted); margin-bottom: 4px; }
@media (max-width: 760px) {
  .doc-headrow { display: none; }
  .doc-row { grid-template-columns: 1fr 1fr; padding: 10px; border: 1px solid var(--line); border-radius: 10px; }
  .doc-row label > .lbl { display: block; font-size: 13px; }
  .doc-row .c-name, .doc-row label:has(textarea), .doc-row label:has([name=status_text]), .doc-row label:has(.dpick) { grid-column: 1 / -1; }
  .doc-row .rm { justify-self: start; }
}
/* The document itself (leader view + print), laid out like the Word file */
.doc { background: #fff; color: #111; border: 1px solid var(--line); border-radius: var(--radius); padding: 24px 28px; }
.doc-logos { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.doc-logos img { height: 84px; width: auto; }
.doc h1 { text-align: center; font-size: 20px; margin: 4px 0 6px; text-decoration: underline; }
.doc .doc-name { font-weight: 700; margin: 0 0 14px; }
.doc h2 { font-size: 16px; margin: 18px 0 8px; text-decoration: underline; }
.doc ul { margin: 4px 0; padding-inline-start: 22px; }
.doc .muted { color: #777; }
.doc-table { border: 1px solid #555; font-size: 13px; }
.doc-table th, .doc-table td { border: 1px solid #555; padding: 5px 6px; color: #111; }
.doc-table th { background: #eee; text-align: center; }
.nowrap { white-space: nowrap; }
#viewas .viewas { background: #1d4ed8; color: #fff; padding: 10px 16px; display: flex; justify-content: space-between; gap: 8px; align-items: center; flex-wrap: wrap; }
#viewas .btn { background: #fff; color: #1d4ed8; border-color: #fff; }
#va { width: auto; max-width: 190px; padding: 5px 8px; font-size: 13px; border-radius: 999px; background: rgba(255,255,255,.95); color: #1f1a17; }
#banner .rem { background: var(--warn-soft); color: var(--warn); padding: 10px 16px; display: flex; justify-content: space-between; gap: 8px; align-items: center; }
#toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); background: #222; color: #fff; padding: 10px 18px;
  border-radius: 10px; opacity: 0; transition: opacity .2s; pointer-events: none; z-index: 20; }
#toast.show { opacity: 1; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: start; padding: 6px; border-bottom: 1px solid var(--line); vertical-align: top; }
.scroll { overflow-x: auto; }
.auth { max-width: 420px; margin: 24px auto; }
.bday-today { border-color: var(--brand); background: var(--brand-soft); }
.member-block { border-inline-start: 4px solid var(--brand); }
.extra { font-size: 13px; color: var(--muted); }
@page { size: A4; margin: 14mm; }
@media print { .topbar, #banner, #viewas, .noprint { display: none !important; } body { background: #fff; }
  main { max-width: none; padding: 0; } .doc { border: 0; padding: 0; } .doc .scroll { overflow: visible; }
  .doc-table { page-break-inside: auto; } .doc-table tr { page-break-inside: avoid; }
  .doc-table th { -webkit-print-color-adjust: exact; print-color-adjust: exact; } }
/* Easy date picker: quick buttons + day/month/year dropdowns */
.dpick { display: grid; gap: 6px; }
.dquick { display: flex; gap: 6px; flex-wrap: wrap; }
.dquick button { border: 1px solid var(--line); background: var(--card); color: var(--text); border-radius: 999px;
  padding: 4px 12px; font: inherit; font-size: 14px; cursor: pointer; }
.dquick button:hover { border-color: var(--brand); color: var(--brand); }
.dsel { display: flex; gap: 4px; align-items: center; }
.dsel select { width: auto; flex: 1 1 0; min-width: 0; padding: 8px 4px; }
.dsel select[data-part="m"] { flex-grow: 1.6; }
.dclear { border: 0; background: none; color: var(--muted); cursor: pointer; font: inherit; padding: 4px; }
.dpick.compact { display: inline-flex; }
.dpick.compact .dsel select { padding: 6px 2px; font-size: 14px; }
.doc-row .dsel select { padding: 7px 2px; font-size: 14px; }
@media (max-width: 600px) { .brand { white-space: nowrap; font-size: 15px; } #topnav { gap: 4px; } #va { max-width: 110px; }
  #topnav a { padding: 5px 9px; white-space: nowrap; } }
.newname { display: grid; gap: 4px; margin-top: 4px; }
.newname[hidden] { display: none; }
main:has(.doc-grid) { max-width: 1200px; }
.doc-row .dquick button { font-size: 12px; padding: 2px 8px; }
.doc-row .dsel { flex-wrap: wrap; }
.dsel select[data-part="y"] { min-width: 66px; }
.dsel select[data-part="d"] { min-width: 52px; }
/* Top-bar menu */
#topnav { position: relative; }
#menubtn { color: #fff; background: rgba(255,255,255,.15); border: 0; border-radius: 999px; padding: 6px 14px; font: inherit; cursor: pointer; white-space: nowrap; }
#menu { position: absolute; top: calc(100% + 8px); inset-inline-end: 0; min-width: 220px; background: var(--card); border: 1px solid var(--line);
  border-radius: 12px; box-shadow: 0 10px 30px rgba(0,0,0,.18); padding: 6px; display: grid; z-index: 30; }
#menu[hidden] { display: none; }
#topnav #menu a { color: var(--text); background: none; border-radius: 8px; padding: 9px 12px; display: flex; gap: 10px; align-items: center; font-size: 15px; }
#topnav #menu a:hover { background: var(--brand-soft); color: var(--brand); }
/* Home: big centered title */
.hero { text-align: center; padding: 26px 16px 22px; margin: 4px 0 18px; border-radius: 20px;
  background: linear-gradient(180deg, var(--brand-soft), transparent); }
.hero-logos { display: flex; justify-content: center; gap: 14px; margin-bottom: 10px; }
.hero-logos img { width: 76px; height: 76px; border-radius: 16px; background: #fff; object-fit: contain; box-shadow: 0 2px 8px rgba(0,0,0,.08); }
.hero-title { font-size: clamp(34px, 7vw, 54px); line-height: 1.1; margin: 6px 0 2px; color: var(--brand); letter-spacing: .5px; }
.hero-sub { margin: 0; color: var(--muted); font-size: 17px; }
.hero-hello { margin: 12px 0 0; font-size: 19px; font-weight: 600; }
.bigbtn { transition: transform .12s, border-color .12s; }
.bigbtn:hover, .midbtn:hover { border-color: var(--brand); transform: translateY(-2px); }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 12px; }
.midbtn { display: flex; align-items: center; gap: 10px; padding: 14px 16px; background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); text-decoration: none; color: var(--text); font-weight: 700; font-size: 16px; transition: transform .12s, border-color .12s; }
.midbtn .ico { font-size: 24px; }
.midbtn .sub { margin-inline-start: auto; font-weight: 400; font-size: 13px; color: var(--muted); }
@media (max-width: 600px) { .grid2 { grid-template-columns: 1fr; } }
/* Family division: one column per team member, stacks on phones */
main:has(.div-grid), main:has(.ptable) { max-width: 1280px; }
.div-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; align-items: start; }
.div-col { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; display: flex; flex-direction: column; }
.div-col header { background: var(--brand); color: #fff; padding: 10px 12px; display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.div-col header .muted { color: rgba(255,255,255,.8); margin-inline-start: auto; }
.div-col.warn header { background: var(--warn); }
.div-col.mine { border-color: var(--brand); box-shadow: 0 0 0 2px var(--brand-soft); }
.div-col ul { list-style: none; margin: 0; padding: 4px 12px; flex: 1; }
.div-col li { padding: 7px 0; border-bottom: 1px solid var(--line); }
.div-col li:last-child { border-bottom: 0; }
.div-col footer { background: var(--bg); padding: 8px 12px; font-size: 14px; border-top: 1px solid var(--line); }
/* Family members table, cards on phones */
.searchbar { position: sticky; top: 52px; z-index: 4; background: var(--bg); padding: 6px 0 10px; display: grid; gap: 4px; }
.searchbar input { font-size: 17px; padding: 12px 14px; }
.ptable-wrap { padding: 0; overflow-x: auto; }
.ptable th { background: var(--brand-soft); color: var(--brand); white-space: nowrap; position: sticky; top: 0; }
.ptable td, .ptable th { padding: 8px; }
.ptable tr[hidden] { display: none; }
.pnotes { min-width: 180px; font-size: 13px; color: var(--muted); }
@media (max-width: 760px) {
  .ptable thead { display: none; }
  .ptable, .ptable tbody, .ptable tr, .ptable td { display: block; width: 100%; }
  .ptable tr { border-bottom: 6px solid var(--bg); padding: 8px 12px; }
  .ptable td { border: 0; padding: 2px 0; }
  .ptable td:empty { display: none; }
  .ptable td::before { content: attr(data-l) ": "; color: var(--muted); font-size: 13px; }
  .ptable td:first-child::before { content: none; }
  .ptable td:first-child { font-size: 17px; }
  .pnotes { min-width: 0; }
}
.ptable td[data-l="טלפון"] { white-space: nowrap; }
/* Cherry symbol, drawn in the theme's brand color */
.cherry { display: inline-block; width: 1em; height: 1em; vertical-align: -0.12em; margin-inline-end: .25em; background: var(--brand);
  -webkit-mask: url(cherry-white.svg) center / contain no-repeat; mask: url(cherry-white.svg) center / contain no-repeat; }
.brand img { width: 30px; height: 30px; }
/* Moving families: card with a move button, and the "move to" dialog */
.famcard { display: flex; align-items: center; gap: 10px; }
.famcard .famlink { flex: 1; min-width: 0; display: block; text-decoration: none; color: inherit; }
.linkbtn { border: 0; background: none; color: var(--brand); font: inherit; cursor: pointer; padding: 0 4px; }
dialog.pick { border: 1px solid var(--line); border-radius: var(--radius); background: var(--card); color: var(--text);
  width: min(420px, calc(100vw - 32px)); padding: 16px; }
dialog.pick::backdrop { background: rgba(0, 0, 0, .4); }
/* Leader page: two titled sections, month as a small subtitle, a button per team member */
.leader-sec { margin-bottom: 24px; }
.leader-sec h2 { margin-bottom: 2px; }
.month-sub { font-size: 15px; font-weight: 600; color: var(--muted); margin: 0 0 10px; }
.name-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 10px; }
.namebtn { display: flex; flex-direction: column; gap: 2px; padding: 12px 14px; background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); text-decoration: none; color: var(--text); }
.namebtn:hover { border-color: var(--brand); }
.namebtn .small { color: var(--muted); }
@media (max-width: 600px) { #assign input[name=title] { flex-basis: 100% !important; } }
/* Phone reminders: anything marked hidden stays hidden, even buttons */
[hidden] { display: none !important; }
