:root {
  color-scheme: light;
  /* רקע אפרפר־לילך, בחירות וכפתורים בסגול לילך, הלוגו של פזית בסגול לילך */
  --bg: #f4f2f8;
  --card: #ffffff;
  --text: #2a282c;
  --muted: #6c686d;
  --line: #e3dfea;
  --primary: #7a5aab;
  --primary-soft: #efe9f8;
  --primary-line: #d6c8ee;
  --warn: #a8423a;
  --warn-line: #ecccc8;
  --gold-soft: #ffffff;
  --gold-line: #7a5aab;
  --wait-bg: #ecebea;
  --wait-text: #5d5a5e;
  --radius: 8px;
  --font: "Heebo", -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
}

* { box-sizing: border-box; }

html, body { margin: 0; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 18px;
  line-height: 1.45;
  -webkit-text-size-adjust: 100%;
}

main { max-width: 640px; margin: 0 auto; padding: 16px 16px 48px; }

header.top {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 10px 16px; margin: 0 0 16px;
}
header.top img { width: 96px; height: auto; display: block; }
header.top h1 { font-size: 21px; margin: 0; font-weight: 700; }
header.top .sub { color: var(--muted); font-size: 14px; }
header.top .end { display: flex; align-items: center; gap: 12px; }
header.top .start { display: flex; align-items: center; gap: 10px; }
.section { font-size: 13px; font-weight: 700; letter-spacing: .06em; color: var(--muted); margin: 18px 2px 8px; }
.meter { height: 4px; background: var(--line); border-radius: 2px; overflow: hidden; margin-top: 10px; }
.meter span { display: block; height: 100%; background: var(--primary); }
.label { font-size: 13px; font-weight: 700; letter-spacing: .06em; color: var(--primary); margin: 0 0 4px; }

h2 { font-size: 19px; margin: 24px 0 10px; }

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px 16px;
  margin-bottom: 12px;
}

.card.offer { background: var(--card); border-color: var(--primary); box-shadow: inset 0 0 0 1px var(--primary); }
.card.notice { background: var(--primary-soft); border-color: var(--primary-line); }
.card.cancelled { opacity: 0.6; }

.class-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; }
.class-title { font-weight: 700; font-size: 20px; }
.class-date { color: var(--muted); font-size: 15px; }
.count { font-size: 15px; color: var(--muted); white-space: nowrap; }
.count.full { color: var(--warn); font-weight: 600; }

.chip {
  display: inline-block;
  font-size: 14px;
  padding: 2px 10px;
  border-radius: 4px;
  background: var(--primary-soft);
  color: var(--primary);
  font-weight: 600;
}
.chip.wait { background: var(--wait-bg); color: var(--wait-text); }
.chip.offer { background: var(--primary-soft); color: var(--primary); }

.actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }

button, .btn {
  font: inherit;
  font-size: 17px;
  font-weight: 500;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--text);
  border-radius: 6px;
  padding: 10px 16px;
  min-height: 48px;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}
button.primary, .btn.primary { background: var(--primary); border-color: var(--primary); color: #fff; font-weight: 600; }
button.danger { color: var(--warn); border-color: var(--warn-line); }
button.small, .btn.small { min-height: 34px; padding: 4px 10px; font-size: 14px; }
button.link { border: none; background: none; color: var(--primary); padding: 4px 0; min-height: 0; text-decoration: underline; }
button:disabled { opacity: 0.5; cursor: default; }

ol.names, ul.names { margin: 10px 0 0; padding: 0 22px 0 0; }
ol.names li, ul.names li { padding: 3px 0; }
.names .me { font-weight: 700; }
.names .note { color: var(--muted); font-size: 14px; }
.wait-title { margin-top: 10px; font-size: 15px; color: var(--muted); font-weight: 600; }
.names.waiting li { color: var(--wait-text); }
.row-actions { display: inline-flex; gap: 6px; margin-inline-start: 6px; vertical-align: middle; }

details summary { cursor: pointer; color: var(--primary); font-size: 15px; margin-top: 10px; }

input, select, textarea {
  font: inherit;
  font-size: 16px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  color: var(--text);
  width: 100%;
}
textarea { min-height: 120px; }
label { display: block; font-size: 15px; color: var(--muted); margin: 10px 0 4px; }
.inline { display: flex; gap: 8px; align-items: center; }
.inline > * { flex: 1; }
.inline > button { flex: 0 0 auto; }

.muted { color: var(--muted); font-size: 15px; }
.err { color: var(--warn); }

.toast {
  position: fixed;
  inset-inline: 16px;
  bottom: 20px;
  max-width: 600px;
  margin: 0 auto;
  background: var(--text);
  color: #fff;
  padding: 12px 16px;
  border-radius: 12px;
  font-size: 16px;
  z-index: 10;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.2);
}
.toast.err { background: var(--warn); color: #fff; }

nav.tabs { display: flex; gap: 6px; overflow-x: auto; margin-bottom: 14px; }
nav.tabs button { flex: 0 0 auto; }
nav.tabs button.on { background: var(--primary); border-color: var(--primary); color: #fff; }

.stepper { display: inline-flex; align-items: center; gap: 6px; }
.stepper button { min-width: 38px; min-height: 34px; padding: 0 8px; }

.log-item { padding: 8px 0; border-bottom: 1px solid var(--line); font-size: 15px; }
.log-item:last-child { border-bottom: none; }
.log-item .when { color: var(--muted); font-size: 13px; }

.woman { padding: 10px 0; border-bottom: 1px solid var(--line); }
.woman:last-child { border-bottom: none; }
.woman .name { font-weight: 600; }
.woman.inactive .name { color: var(--muted); text-decoration: line-through; }

.tpl { display: grid; grid-template-columns: 1.3fr 1fr 0.8fr 1.4fr auto; gap: 6px; align-items: center; margin-bottom: 8px; }
.tpl input, .tpl select { padding: 8px 6px; font-size: 15px; }
.tpl-extra { grid-column: 1 / -1; display: flex; gap: 16px; align-items: center; flex-wrap: wrap; padding-bottom: 8px; border-bottom: 1px solid var(--line); }
.tpl-extra input[type=number] { width: 64px; }
.tpl-more { flex-basis: 100%; }
.tpl-more[open] { display: flex; flex-wrap: wrap; gap: 8px 16px; align-items: center; }
.tpl-more summary { flex-basis: 100%; }
.tpl-more input:not([type]) { flex: 1 1 140px; }
.tpl-extra label.check { margin: 0; }
@media (max-width: 480px) {
  .tpl { grid-template-columns: 1fr 1fr 0.8fr; }
  .tpl select.open { grid-column: 1 / 3; }
}

label.check { display: flex; align-items: flex-start; gap: 10px; color: var(--text); font-size: 16px; margin: 14px 0 4px; cursor: pointer; }
label.check input { width: 22px; height: 22px; flex: 0 0 auto; margin: 1px 0 0; accent-color: var(--primary); }
.steps { margin: 4px 0 8px; padding: 0 20px 0 0; }
.share-icon { vertical-align: -5px; color: #0a84ff; }
.small-link { font-size: 14px; margin-top: 10px; }

.chip.yoga { background: #e6f0e8; color: #2f6b45; }
.class-meta { margin-top: 6px; display: flex; flex-wrap: wrap; gap: 6px; align-items: center; font-size: 15px; }
.class-meta .meta { color: var(--muted); }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.month-day { font-weight: 700; font-size: 15px; color: var(--primary); margin: 20px 0 6px; }
.month-day:first-child { margin-top: 0; }
.month-row { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 12px 0; border-bottom: 1px solid var(--line); line-height: 1.8; }
.month-row.cancelled .month-main { opacity: 0.55; text-decoration: line-through; }
.month-main { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.month-main .class-meta { margin: 0; }
.month .card { margin: 8px 0; }
.pick-list { max-height: 50vh; overflow-y: auto; border: 1px solid var(--line); border-radius: 8px; padding: 0 12px 8px; margin-top: 8px; }
.pick-list label.check { margin: 8px 0 0; }
.name-link { border: none; background: none; padding: 0; min-height: 0; font: inherit; font-weight: 600; color: inherit; text-decoration: underline; text-decoration-color: var(--line); text-underline-offset: 4px; }
.woman.idle .name-link, .idle-text { color: var(--warn); }
.woman.idle { background: #fbf1f0; margin: 0 -16px; padding-inline: 16px; }
.names .faded { color: var(--muted); }
.kind { display: inline-block; width: 20px; text-align: center; font-weight: 700; border-radius: 4px; }
.kind.register { color: #2f6b45; background: #e6f0e8; }
.kind.cancel { color: var(--warn); background: #f7e3e1; }
.msg-card .msg-when { color: var(--muted); font-size: 13px; }
.msg-card p { margin: 4px 0 0; white-space: pre-line; }
.week-nav { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
button.log-class { display: flex; width: 100%; justify-content: space-between; align-items: center; gap: 8px; border: none; border-bottom: 1px solid var(--line); border-radius: 0; padding: 8px 0; min-height: 48px; text-align: start; background: none; font-size: 16px; }
button.log-class.past b { color: var(--muted); }
.attend-list { border: 1px solid var(--line); border-radius: 8px; padding: 0 12px 10px; margin-top: 8px; }
.attend-list label.check { margin: 10px 0 0; }
.attend-list .faded { color: var(--muted); }
.guest-row { display: flex; justify-content: space-between; align-items: center; margin-top: 10px; font-size: 16px; }
.fine-row { border-bottom: 1px solid var(--line); padding: 4px 0 8px; }
.fine-row:last-of-type { border-bottom: none; }
.fine-row summary { display: flex; justify-content: space-between; gap: 8px; color: var(--text); font-size: 16px; }
.fine-name { font-weight: 600; }
.fine-items li.excused { color: var(--muted); }
.fine-form { border: 1px solid var(--line); border-radius: 8px; padding: 8px 12px; }

.menu-btn { min-height: 44px; min-width: 44px; padding: 0 10px; font-size: 22px; line-height: 1; color: var(--primary); border-color: var(--primary-line); }
.drawer-bg { position: fixed; inset: 0; background: rgba(30, 20, 45, 0.35); border: none; border-radius: 0; z-index: 20; min-height: 0; padding: 0; cursor: default; }
.drawer { position: fixed; top: 0; bottom: 0; inset-inline-start: 0; width: min(78vw, 300px); background: var(--card); z-index: 21; padding: 24px 12px; display: flex; flex-direction: column; gap: 8px; box-shadow: 0 0 24px rgba(0, 0, 0, 0.2); }
.drawer button { justify-content: flex-start; border: none; font-size: 18px; }
.drawer button.on { background: var(--primary-soft); color: var(--primary); font-weight: 700; }
.view-head h2 { margin: 6px 0 12px; }

.health { background: var(--primary-soft); border-radius: 8px; padding: 8px 12px; margin: 8px 0; }
.rules { white-space: pre-wrap; line-height: 1.6; }
.modal-bg { position: fixed; inset: 0; background: rgba(30, 20, 45, 0.45); z-index: 30; display: flex; align-items: center; justify-content: center; padding: 16px; }
.modal { background: var(--card); border-radius: var(--radius); padding: 20px; max-width: 420px; width: 100%; box-shadow: 0 8px 32px rgba(0, 0, 0, 0.25); }
.modal p { margin-top: 0; line-height: 1.5; }

.dup-box { position: relative; background: #fff8e6; border: 1px solid #f0dca8; border-radius: 10px; padding: 10px 12px; margin: 12px 0; line-height: 1.6; }
.dup-pair { border-top: 1px solid #f0dca8; margin-top: 10px; padding-top: 10px; }
.box-x { position: absolute; top: 6px; left: 6px; background: none; border: none; font-size: 18px; color: var(--muted); padding: 6px 10px; cursor: pointer; }
.dup-card { margin-top: 6px; }
.bad-phone { color: var(--warn); font-size: 14px; }
.small-note { font-size: 13px; margin: 2px 0 10px; }

/* גלריה */
.g-add { display: flex; gap: 8px; }
.g-add input { flex: 1; }
.g-folders { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.g-folder { display: flex; flex-direction: column; gap: 4px; padding: 0 0 10px; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; text-align: center; cursor: pointer; }
.g-folder img, .g-empty { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; display: flex; align-items: center; justify-content: center; font-size: 36px; background: var(--line); }
.g-folder b { padding: 0 8px; }
.g-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(100px, 1fr)); gap: 4px; }
.g-thumb { position: relative; padding: 0; border: 3px solid transparent; border-radius: 6px; overflow: hidden; background: var(--line); aspect-ratio: 1; cursor: pointer; }
.g-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.g-thumb.on { border-color: var(--primary); }
.g-check { position: absolute; top: 6px; right: 6px; width: 26px; height: 26px; border-radius: 50%; background: rgba(255,255,255,.9); border: 2px solid var(--primary); color: var(--primary); font-weight: 700; line-height: 22px; }
.g-thumb.on .g-check { background: var(--primary); color: #fff; }
.g-selbar { position: sticky; top: 0; display: flex; flex-wrap: wrap; gap: 8px; align-items: center; padding: 10px 0 0; }
.g-busy { font-weight: 600; }
.g-viewer img { width: 100%; max-height: 75vh; object-fit: contain; background: #111; border-radius: var(--radius); }
.g-viewer-bar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.g-viewer-actions { justify-content: center; }
label.btn { cursor: pointer; }
.g-meter { height: 10px; background: var(--line); border-radius: 5px; overflow: hidden; margin-top: 8px; }
.g-meter span { display: block; height: 100%; background: var(--primary); }
.g-meter span.warn { background: var(--warn); }
nav.sub-tabs { flex-wrap: wrap; }
nav.sub-tabs button { min-height: 38px; font-size: 15px; padding: 6px 12px; border-radius: 20px; }
nav.sub-tabs button.on { background: var(--primary-soft); border-color: var(--primary-line); color: var(--primary); font-weight: 700; }
.ev-row { padding: 4px 0; }
.g-folder .g-date { font-size: 13px; }
.g-edit { display: grid; gap: 8px; margin-top: 8px; }

/* כרטיסי הגדרות מתקפלים */
details.card.fold > summary { list-style: none; display: flex; justify-content: space-between; align-items: center; margin: 0; color: var(--text); }
details.card.fold > summary::-webkit-details-marker { display: none; }
details.card.fold > summary h2 { margin: 0; }
details.card.fold > summary::after { content: '▾'; font-size: 22px; color: var(--muted); }
details.card.fold[open] > summary { margin-bottom: 10px; }
details.card.fold[open] > summary::after { content: '▴'; }
details.fold-sub { border-top: 1px solid var(--line, #e5e5e5); padding: 4px 0; }
details.fold-sub > summary { font-weight: 700; font-size: 16px; color: var(--text); padding: 6px 0; margin: 0; }

/* לוח חודשי: יום / שבוע / חודש */
.cal-modes { justify-content: center; }
.cal-nav { display: flex; justify-content: space-between; align-items: center; margin: 4px 0 8px; }
.cal-nav b { font-size: 17px; }
.cal-nav button { min-width: 48px; font-size: 18px; }
.cal-back { text-align: center; margin: -4px 0 8px; }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.cal-wd { text-align: center; font-size: 13px; color: var(--muted); font-weight: 700; padding-bottom: 2px; }
.cal-cell { display: flex; flex-direction: column; align-items: center; gap: 2px; min-height: 56px; padding: 4px 0; border-radius: 10px; font-size: 15px; }
.cal-cell.past { opacity: 0.45; }
.cal-cell.today { border-color: var(--primary); border-width: 2px; }
.cal-cell.mine .cal-n { font-weight: 700; color: var(--primary); }
.cal-marks { display: flex; flex-wrap: wrap; justify-content: center; gap: 2px; font-size: 11px; line-height: 1; }
i.dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--muted); opacity: 0.6; }
i.dot.me { background: var(--primary); opacity: 1; }
i.dot.wait { background: var(--wait-text); opacity: 1; }
.cal-legend { font-size: 13px; text-align: center; margin: 10px 0 0; }

.ev-own { display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; }
a.btn.small.ics { text-decoration: none; white-space: nowrap; }
.cal-right { display: inline-flex; gap: 6px; align-items: center; flex-wrap: wrap; justify-content: flex-end; }
.ev-when { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; } .ev-when input { width: 100%; min-width: 0; box-sizing: border-box; }
