:root {
  --bg: #f6f1e7;
  --card: #fffdf8;
  --text: #3b2412;
  --muted: #7d6a58;
  --accent: #7a1f12;
  --line: #e4d8c4;
  --big: #fbefd2;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, "Segoe UI", Arial, sans-serif;
  font-size: 16px;
}

header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 24px;
  background: var(--accent);
  color: #fff;
}

h1 {
  margin: 0;
  font-size: 22px;
  display: flex;
  align-items: center;
  gap: 12px;
}

/* הלוגו המלא "צג חומה בתי כנסת" (סמל האנטנה לבד רק בלשונית ובסימניות). על הפס הכהה הוא על תג לבן */
.brand-logo {
  height: 58px;
  width: auto;
  padding: 4px 8px;
  background: #fff;
  border-radius: 8px;
}

h2 {
  margin: 0 0 12px;
  font-size: 18px;
}

main {
  max-width: 960px;
  margin: 0 auto;
  padding: 24px 16px;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 20px;
}

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 20px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 12px;
}

.field > span {
  font-size: 14px;
  color: var(--muted);
}

input,
select,
button,
.button {
  font: inherit;
}

input:not([type]),
input[type="date"],
input[type="email"],
input[type="tel"],
input[type="password"],
input[type="number"],
input[type="time"],
input[type="search"],
textarea,
select {
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--text);
  min-width: 0;
}

.row {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 12px;
}

.row .field {
  flex: 1 1 120px;
}

.tabs {
  display: flex;
  gap: 16px;
}

.check {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 20px;
}

/* הודעות לפי לוח השנה: תיבת V, שם ההודעה, ומתי היא מופיעה. */
.luach-check {
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.luach-check small {
  color: var(--muted, #667);
}

.preview {
  min-height: 1.4em;
  margin: 4px 0;
  color: var(--accent);
  font-weight: 600;
}

.error {
  min-height: 1.2em;
  margin: 0 0 8px;
  color: #b3261e;
}

.actions,
.tools {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

button,
.button {
  display: inline-block;
  padding: 8px 16px;
  border: 1px solid var(--accent);
  border-radius: 6px;
  background: var(--accent);
  color: #fff;
  cursor: pointer;
  text-decoration: none;
}

header .button {
  background: #fff;
  color: var(--accent);
}

.secondary {
  background: transparent;
  color: var(--accent);
}

.small {
  padding: 4px 10px;
  font-size: 14px;
}

.list-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 4px;
}

.list-head h2 {
  margin: 0;
}

#count {
  color: var(--muted);
  font-weight: 400;
}

.hint {
  color: var(--muted);
  font-size: 14px;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th,
td {
  text-align: right;
  padding: 8px;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}

th {
  font-size: 14px;
  color: var(--muted);
  font-weight: 500;
}

tr.big td {
  background: var(--big);
}

tr.big td:first-child {
  font-weight: 700;
}

td .muted {
  display: block;
  color: var(--muted);
  font-size: 14px;
}

td.buttons {
  white-space: nowrap;
  text-align: left;
}

.empty {
  text-align: center;
  color: var(--muted);
  padding: 24px;
}

@media (max-width: 640px) {
  header {
    padding: 12px 16px;
  }

  thead {
    display: none;
  }

  tr {
    display: block;
    border-bottom: 1px solid var(--line);
    padding: 6px 0;
  }

  td {
    display: block;
    border: none;
    padding: 2px 8px;
  }

  td.buttons {
    text-align: right;
    padding-top: 6px;
  }
}

.narrow {
  max-width: 420px;
  width: 100%;
  margin: 0 auto;
}

header .tools {
  align-items: center;
}

header .tools {
  min-width: 0;
}

/* שם ארוך של בית כנסת לא מרחיב את הדף מעבר לרוחב הטלפון */
header select {
  padding: 6px 8px;
  border-radius: 6px;
  border: none;
  min-width: 0;
  max-width: 100%;
  text-overflow: ellipsis;
}

@media (max-width: 640px) {
  header {
    flex-wrap: wrap;
    gap: 8px 12px;
  }

  header h1 {
    font-size: 19px;
  }

  header .tools {
    flex: 1 1 100%;
  }

  header select {
    flex: 1 1 100%;
  }
}

.on-dark {
  color: #fff;
  border-color: #fff;
}

.status {
  margin: 0;
  padding: 10px 14px;
  border-radius: 8px;
  background: #e5f2e3;
  color: #24572a;
}

.status.bad {
  background: #fbe4e2;
  color: #b3261e;
}

.tabs-nav {
  display: flex;
  gap: 4px;
  overflow-x: auto;
  border-bottom: 2px solid var(--line);
  margin-bottom: 20px;
}

.tab {
  flex: 0 0 auto;
  white-space: nowrap;
  background: transparent;
  color: var(--muted);
  border: none;
  border-bottom: 3px solid transparent;
  border-radius: 0;
  margin-bottom: -2px;
}

/* בטלפון כל הלשוניות גלויות (בכמה שורות), ולא מוסתרות בגלילה לצד */
@media (max-width: 640px) {
  .tabs-nav {
    flex-wrap: wrap;
    overflow-x: visible;
    row-gap: 2px;
  }

  .tab {
    padding-inline: 10px;
  }
}

.tab.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
  font-weight: 600;
}

#app-view [data-panel] {
  display: grid;
  gap: 20px;
}

#app-view [data-panel][hidden] {
  display: none;
}

.time-row {
  display: flex;
  gap: 8px;
  margin-bottom: 8px;
}

.time-row .t-name {
  flex: 1;
}

.time-row .p-parasha,
.time-row .p-haftara {
  flex: 1;
  min-width: 0;
}

.time-row .p-date {
  flex: none;
  width: 160px;
  direction: ltr;
}

.time-row {
  align-items: center;
}

.time-row .t-show {
  flex: none;
  width: 28px;
  height: 28px;
  accent-color: #7a1f12;
}

.time-row .t-time {
  width: 140px;
  direction: ltr;
}

textarea {
  font: inherit;
  resize: vertical;
}

.sticky {
  position: sticky;
  bottom: 0;
  align-items: center;
  padding: 12px 0;
  background: var(--bg);
}

/* עורך זמני התפילות, שנטען בתוך לשונית. הגובה מתעדכן לפי התוכן. */
.embedded-editor {
  display: block;
  width: 100%;
  min-height: 600px;
  border: 0;
}

/* ---- עריכת המסך ותזמון (js/admin-editor.js) ---- */

/* בלשוניות העורך הדף רחב יותר, כדי שהמסך ייראה גדול. */
main:has([data-panel="editor"]:not([hidden])),
main:has([data-panel="schedule"]:not([hidden])) {
  max-width: 1500px;
}

.grow {
  flex: 1;
}

#editor-root,
#schedule-root,
.editor > * {
  min-width: 0;
}

/* שורת הרקעים: תמונה קטנה עם "רקע 1", "רקע 2"... */
.bg-strip {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  padding-bottom: 4px;
}

.bg-tile {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 4px;
  border: 3px solid transparent;
  border-radius: 10px;
  background: transparent;
  color: var(--text);
  font-weight: 700;
  font-size: 17px;
}

.bg-tile img {
  height: 70px;
  border-radius: 6px;
  display: block;
}

.bg-tile.selected {
  border-color: var(--accent);
  background: var(--big);
}

.holiday-tools {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 12px 0;
}

.holiday-tools button {
  font-size: 17px;
}

.saved-card {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 10px;
  margin-bottom: 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
}

.saved-card img {
  width: 110px;
  border-radius: 6px;
}

.saved-card strong {
  font-size: 18px;
}

.saved-card .check {
  margin: 6px 0;
}

.saved-name {
  font-size: 18px;
  font-weight: 700;
  color: var(--accent);
}

.big-check {
  font-size: 17px;
  margin: 14px 0 4px;
}

.editor {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 20px;
  align-items: start;
}

.editor.open {
  grid-template-columns: minmax(0, 1fr) 420px;
}

/* המסך עצמו (index.html?preview=1) ומעליו כפתור לכל חלונית. */
.screen-frame {
  position: relative;
  width: 100%;
  /* כל המסך נכנס בגובה החלון, מתחת לשורת הרקעים ומעל כפתור השמירה. */
  max-width: calc((100vh - 370px) * 16 / 9);
  min-width: min(100%, 480px);
  margin: 0 auto;
  aspect-ratio: 16 / 9;
  border-radius: 8px;
  overflow: hidden;
  background: #000;
  box-shadow: 0 4px 18px rgba(59, 36, 18, 0.25);
}

.screen-frame.portrait {
  aspect-ratio: 9 / 16;
  width: auto;
  max-width: none;
  min-width: 0;
  height: calc(100vh - 370px);
  min-height: 420px;
}

.screen-frame iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
  pointer-events: none;
}

.hot {
  position: absolute;
  padding: 0;
  border: 3px dashed rgba(255, 255, 255, 0);
  border-radius: 8px;
  background: transparent;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}

.hot:hover,
.hot:focus-visible {
  border-color: rgba(212, 160, 23, 0.95);
  background: rgba(255, 236, 170, 0.18);
  outline: none;
}

.hot.selected {
  border: 4px solid #d4a017;
  background: rgba(255, 236, 170, 0.22);
}

.hot .num {
  position: absolute;
  top: -2px;
  right: -2px;
  min-width: 34px;
  height: 34px;
  padding: 0 6px;
  border-radius: 17px;
  background: var(--accent);
  color: #fff;
  font-size: 20px;
  font-weight: 700;
  line-height: 34px;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.4);
}

.hot.selected .num {
  background: #d4a017;
  color: #2b1a08;
}

.hot.whole .num {
  top: 50%;
  right: 50%;
  transform: translate(50%, -50%);
  height: auto;
  padding: 10px 22px;
  border-radius: 12px;
  font-size: 22px;
  line-height: 1.3;
}

.editor-hint {
  margin: 10px 0 0;
  font-size: 18px;
  color: var(--muted);
  text-align: center;
}

/* החלון בצד: שלבים, ובכל שלב כפתורים גדולים. */
.drawer {
  position: sticky;
  top: 12px;
  max-height: calc(100vh - 24px);
  overflow-y: auto;
  background: var(--card);
  border: 2px solid var(--accent);
  border-radius: 12px;
  padding: 18px;
  font-size: 17px;
}

.drawer-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 6px;
}

.drawer-head h2 {
  margin: 0;
  font-size: 22px;
}

.close {
  width: 40px;
  height: 40px;
  padding: 0;
  font-size: 22px;
  line-height: 1;
}

.steps {
  display: flex;
  gap: 6px;
  margin: 8px 0 16px;
  font-size: 15px;
  color: var(--muted);
}

.steps span {
  flex: 1;
  padding: 6px 4px;
  border-bottom: 4px solid var(--line);
  text-align: center;
}

.steps span.on {
  color: var(--accent);
  font-weight: 700;
  border-bottom-color: var(--accent);
}

.steps span.done {
  border-bottom-color: #c9a27a;
}

.question {
  margin: 0 0 12px;
  font-size: 20px;
  font-weight: 700;
}

.choices {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.choice {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 14px 8px;
  border: 2px solid var(--line);
  border-radius: 12px;
  background: #fff;
  color: var(--text);
  text-align: center;
}

.choice:hover {
  border-color: var(--accent);
}

.choice .icon {
  font-size: 34px;
  line-height: 1.1;
}

.choice strong {
  font-size: 18px;
}

.choice small {
  color: var(--muted);
  font-size: 14px;
}

.choice.current {
  border-color: var(--accent);
  background: var(--big);
}

.choice .badge {
  position: absolute;
  top: 6px;
  left: 6px;
  padding: 1px 8px;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  font-size: 12px;
}

.drawer .field {
  margin-bottom: 14px;
}

.drawer .field > span {
  font-size: 16px;
  color: var(--text);
  font-weight: 600;
}

.drawer input,
.drawer select,
.drawer textarea {
  font-size: 17px;
}

.big-text {
  margin: 8px 0 14px;
  font-size: 18px;
  line-height: 1.5;
}

.back {
  margin-bottom: 12px;
}

/* שורה אחת בטבלה שנערכת: תפילה, זמן, הודעה. */
.erow {
  display: grid;
  gap: 6px;
  padding: 10px;
  margin-bottom: 8px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
}

.erow-line {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}

.erow-line input:not([type]),
.erow-line textarea {
  flex: 1 1 140px;
}

.erow .tag {
  color: var(--muted);
  font-size: 14px;
}

.icon-btn {
  width: 38px;
  height: 38px;
  padding: 0;
  font-size: 17px;
  line-height: 1;
}

.add-row {
  width: 100%;
  padding: 12px;
  font-size: 17px;
  border-style: dashed;
}

.reset-panel {
  width: 100%;
  margin-top: 14px;
}

.save-bar {
  position: sticky;
  bottom: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  padding: 12px 16px;
  border-top: 2px solid var(--line);
  background: var(--bg);
}

.save-bar .save {
  padding: 12px 34px;
  font-size: 19px;
  font-weight: 700;
}

.save-bar .msg {
  font-size: 17px;
  font-weight: 600;
}

.save-bar.dirty {
  background: #fff3cd;
  border-top-color: #e6cf7a;
}

.gallery-count {
  margin: 4px 0;
  font-size: 17px;
}

.gallery-thumbs {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
  gap: 10px;
  margin: 6px 0 10px;
}

.gallery-thumb {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 6px;
  border: 1px solid #e3d6bf;
  border-radius: 8px;
  background: #fff;
}

.gallery-thumb img {
  width: 100%;
  height: 90px;
  object-fit: cover;
  border-radius: 6px;
  background: #f1ece2;
}

.gallery-thumb.off img,
.gallery-thumb.loading img,
.gallery-thumb.failed img {
  opacity: 0.35;
}

.gallery-thumb .check {
  font-size: 16px;
}

.gallery-thumb button {
  position: absolute;
  top: 8px;
  left: 8px;
  background: #fff;
}

.gallery-note {
  position: absolute;
  top: 40px;
  font-weight: 700;
}

.gallery-thumb.failed .gallery-note,
.gallery-error {
  color: #a3271b;
}

/* מסך התזמון: שורה לכל רקע, עמודה לכל יום. */
.sched {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0 8px;
}

.sched th {
  padding: 6px;
  font-size: 17px;
  text-align: center;
  border: 0;
}

.sched td {
  padding: 6px;
  text-align: center;
  vertical-align: middle;
  border: 0;
  background: #fff;
}

.sched td:first-child {
  border-radius: 0 10px 10px 0;
  text-align: right;
}

.sched td:last-child {
  border-radius: 10px 0 0 10px;
}

.sched .bg-cell {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 18px;
  font-weight: 700;
}

.sched .bg-cell img {
  height: 64px;
  border-radius: 6px;
}

.sched .bg-cell .secondary {
  font-weight: 400;
}

.day-toggle {
  width: 54px;
  height: 54px;
  padding: 0;
  border: 2px solid var(--line);
  border-radius: 10px;
  background: #fff;
  color: transparent;
  font-size: 28px;
  line-height: 1;
}

.day-toggle.on {
  border-color: #2e7d32;
  background: #e8f5e9;
  color: #2e7d32;
}

/* בטלפון לאורך: כל רקע בכרטיס, ומתחתיו שבעת הימים בשורה אחת עם שם היום מעל כל תיבה */
@media (max-width: 640px) {
  .sched tr {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    margin-bottom: 10px;
    padding: 8px 6px;
    border: 0;
    border-radius: 10px;
    background: #fff;
  }

  .sched td {
    display: block;
    padding: 2px;
    background: none;
  }

  .sched td:first-child,
  .sched td:last-child {
    grid-column: 1 / -1;
    border-radius: 0;
  }

  .sched td:last-child {
    text-align: right;
  }

  .sched td[data-day]::before {
    content: attr(data-day);
    display: block;
    margin-bottom: 2px;
    font-size: 13px;
    color: var(--muted);
  }

  .sched .day-toggle {
    width: 100%;
    max-width: 44px;
  }
}

.sched-warn {
  color: #b3261e;
  font-weight: 600;
}

.sched-today {
  font-size: 18px;
  margin: 4px 0 12px;
}

@media (max-width: 1000px) {
  .editor.open {
    grid-template-columns: 1fr;
  }

  .drawer {
    position: static;
    max-height: none;
  }

  .day-toggle {
    width: 40px;
    height: 40px;
    font-size: 22px;
  }

  .sched .bg-cell img {
    height: 44px;
  }
}

/* ---- ניהול בתי כנסת (js/admin-super.js) ---- */

.synagogue-item {
  border-top: 1px solid var(--line);
  padding: 10px 0;
}

.gabbai {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 3px 0;
}

/* אימייל ארוך נשבר לשורה הבאה ולא מרחיב את הדף בטלפון */
.gabbai > span:first-child {
  min-width: 0;
  overflow-wrap: anywhere;
}

.gabbai .muted,
.gabbai button {
  flex: none;
}

.gabbai .muted {
  color: var(--muted);
  font-size: 0.9em;
}

/* נרשמו ועדיין לא שייכים: שורות גדולות ונוחות ללחיצה גם בטלפון */
.signups h4 {
  margin: 10px 0 4px;
}

.signup {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 0;
  border-bottom: 1px dashed var(--line);
}

.signup .who {
  min-width: 0;
}

.signup .mail {
  overflow-wrap: anywhere;
  text-align: right;
}

.signup .muted {
  color: var(--muted);
  font-size: 0.9em;
}

.signup button {
  flex: none;
  min-height: 44px;
}

/* פס סוגי הטבלאות: רחב ונמוך, מעל המסך, מופיע כשבוחרים חלונית */
.type-bar {
  margin-bottom: 10px;
  padding: 6px 8px;
  background: #fffaf0;
  border: 2px solid #c9973f;
  border-radius: 12px;
}

.type-bar[hidden] {
  display: none;
}

.type-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}

.type-row.sub {
  margin-top: 6px;
  padding-top: 6px;
  border-top: 1px dashed #c9973f;
}

.type-label {
  font-weight: 700;
  color: #7a1f12;
  margin-inline-end: 4px;
}

.type-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  font: inherit;
  font-size: 14px;
  color: #3b2412;
  background: #fff;
  border: 1.5px solid #d8c49a;
  border-radius: 999px;
  cursor: pointer;
}

.type-chip:hover {
  border-color: #c9973f;
}

.type-chip.current {
  color: #fff;
  background: #7a1f12;
  border-color: #7a1f12;
}

/* בחירת הרקע בראש מסך העריכה */
.bg-choose {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 10px;
  margin: 0 0 12px;
  padding: 12px 14px;
  border: 2px solid #d8c49a;
  border-radius: 12px;
  background: #fff;
}

.bg-now {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
}

.bg-now img {
  width: 120px;
  height: 68px;
  object-fit: cover;
  border-radius: 6px;
}

.bg-now-text {
  display: flex;
  flex-direction: column;
  flex: 1;
}

.bg-now-text small {
  color: var(--muted);
}

.bg-now-text strong {
  font-size: 1.3em;
}

.bg-choose .big-text,
.bg-multi-title {
  margin: 0;
  font-weight: 700;
}

.bg-multi-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.bg-pick {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.bg-thumb,
.bg-check {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 6px;
  font: inherit;
  font-weight: 700;
  color: var(--text);
  border: 1.5px solid #d8c49a;
  border-radius: 10px;
  background: #fff;
  cursor: pointer;
}

.bg-thumb.current,
.bg-check.on {
  border-color: #7a1f12;
  box-shadow: 0 0 0 2px #7a1f12;
}

.bg-thumb img,
.bg-check img {
  width: 140px;
  height: 79px;
  object-fit: cover;
  border-radius: 6px;
}

.bg-check input {
  width: 20px;
  height: 20px;
  vertical-align: middle;
}

@media (max-width: 640px) {
  .bg-thumb img,
  .bg-check img {
    width: 120px;
    height: 68px;
  }
}

/* טבלת זמני התפילות בעריכה: שם ושעה בשורה אחת, כמו במסך */
.prayer-table .p-row {
  padding: 6px 0;
  border-bottom: 1px solid #eadfc4;
}

.prayer-table .p-name {
  flex: 1;
  min-width: 0;
}

.prayer-table .p-time {
  width: 6.2em;
  text-align: center;
  direction: ltr;
  font-weight: 700;
  font-size: 18px;
}

.prayer-table .p-time.p-text {
  width: 11em;
  direction: rtl;
  font-size: 15px;
}

.prayer-table .p-time.bad {
  border-color: #b3261e;
  background: #fdecea;
}

.prayer-table .p-auto {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 2px 6px;
  font: inherit;
  font-weight: 700;
  font-size: 18px;
  color: #3b2412;
  background: #f4efe3;
  border: 1.5px dashed #c9973f;
  border-radius: 8px;
  cursor: pointer;
}

.prayer-table .p-auto small {
  font-size: 11px;
  font-weight: 400;
  color: #7a6a52;
}



.prayer-table .erow-line {
  flex-wrap: nowrap;
  gap: 4px;
}

.prayer-table .icon-btn {
  min-width: 0;
  width: 30px;
  height: 36px;
  padding: 0;
  font-size: 13px;
  flex: none;
}

.prayer-table .p-time {
  width: 5.2em;
  flex: none;
  padding-inline: 4px;
}

.prayer-table .p-name {
  font-size: 16px;
  padding-inline: 8px;
}

.prayer-table .p-how {
  flex-wrap: wrap;
  margin-top: 4px;
  font-size: 14px;
}

.prayer-table .p-how .p-grow {
  flex: 1;
  min-width: 8em;
}

.prayer-table .p-how .p-text,
.prayer-table .p-how input.p-grow {
  direction: rtl;
}

.prayer-table .p-min {
  width: 4.2em;
  text-align: center;
  direction: ltr;
}

.prayer-table .p-now {
  flex: none;
  min-width: 3.6em;
  text-align: center;
  font-weight: 700;
  font-size: 18px;
  direction: ltr;
  padding: 4px 6px;
  background: #f4efe3;
  border: 1.5px dashed #c9973f;
  border-radius: 8px;
}

.prayer-table .p-how .p-time {
  width: 5.2em;
}

/* טלפון על הצד: המסך משמאל והעריכה לידו, כמו במחשב */
@media (orientation: landscape) and (max-height: 520px) {
  header {
    padding: 8px 16px;
  }

  .editor.open {
    grid-template-columns: minmax(0, 1fr) minmax(300px, 44%);
  }

  .editor.open .drawer {
    position: sticky;
    top: 8px;
    max-height: calc(100vh - 16px);
    overflow-y: auto;
  }

  .screen-frame {
    max-width: calc((100vh - 170px) * 16 / 9);
    min-width: 0;
  }

  .screen-frame.portrait {
    height: calc(100vh - 170px);
    min-height: 0;
  }

  .editor-hint {
    display: none;
  }
}

/* הצעה לסובב את הטלפון, רק בטלפון בעמידה */
.rotate-hint {
  display: none;
  align-items: center;
  gap: 10px;
  margin: 0;
  padding: 10px 16px;
  background: #fff4d6;
  border-bottom: 2px solid #c9973f;
  color: #5a3a00;
  font-weight: 700;
}

.rotate-hint span {
  flex: 1;
}

.rotate-hint button {
  padding: 8px 12px;
  border: 2px solid #7a1f12;
  border-radius: 8px;
  background: #7a1f12;
  color: #fff;
  font: inherit;
}

.rotate-hint .close {
  background: transparent;
  color: #7a1f12;
}

@media (max-width: 640px) and (orientation: portrait) {
  .rotate-hint.on {
    display: flex;
  }

  .signed-out .rotate-hint.on {
    display: none;
  }
}

/* גודל, עובי וסוג כתב בחלונית */
.typeface {
  margin-top: 22px;
  padding-top: 14px;
  border-top: 2px dashed var(--line);
}

.prayer-table .p-cap {
  flex: 1;
  margin-top: 4px;
  font-size: 14px;
  direction: rtl;
}

/* שורת הרקע מעל המסך בעריכה: איזה רקע עורכים, וקישור להחלפה בהגדרות */
.bg-current {
  margin: 0 0 10px;
  font-weight: 700;
  color: var(--muted);
}

.link-btn {
  padding: 0;
  border: none;
  background: none;
  color: #7a1f12;
  font: inherit;
  text-decoration: underline;
  cursor: pointer;
}

.sponsor-section {
  margin: 20px 0 4px;
  font-size: 1.1em;
}

fieldset.field { border: 0; padding: 0; margin: 0; }
fieldset.field label { display: inline-flex; gap: 6px; align-items: center; margin-inline-end: 16px; }
#s-area-manual-wrap { flex-basis: 100%; }
.area-add-row { display: flex; gap: 8px; align-items: center; }
.area-add-row input { flex: 1; width: 0; min-width: 0; }
#s-area-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
#s-area-chips .chip { border: 1px solid #c9ced6; background: #fff; color: #2b2118; border-radius: 14px; padding: 4px 10px; cursor: pointer; font: inherit; }
/* כניסה והרשמה: שני כפתורים גדולים לבחירת המצב */
.auth-modes {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 16px;
}

.auth-mode {
  padding: 12px 8px;
  background: transparent;
  color: var(--accent);
  font-size: 18px;
  font-weight: 700;
  line-height: 1.3;
}

.auth-mode small {
  display: block;
  font-size: 14px;
  font-weight: 400;
}

.auth-mode.active {
  background: var(--accent);
  color: #fff;
}

#login-error:empty {
  margin: 0;
}

.auth-next {
  display: block;
  margin-top: 8px;
}

.auth-done {
  margin: 0 0 12px;
  padding: 10px 12px;
  border-radius: 6px;
  background: #e8f5e9;
  color: #1b5e20;
  line-height: 1.5;
}

.name-fields {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 0 12px;
}

.forgot {
  margin: 12px 0 0;
}

/* כפתור גוגל */
.google-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  padding: 12px;
  border: 1px solid #c4c7c5;
  background: #fff;
  color: #1f1f1f;
  font-size: 17px;
  font-weight: 600;
}

.or {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 16px 0;
  color: var(--muted);
  font-size: 14px;
}

.or::before,
.or::after {
  content: "";
  flex: 1;
  border-top: 1px solid var(--line);
}

/* כותרות בטבלת הרקעים: ימות החול (לפי סגנון), מסכים מיוחדים, חגים */
.bg-section {
  margin: 18px 0 4px;
  padding-bottom: 4px;
  font-size: 1.15em;
  color: #7a1f12;
  border-bottom: 2px solid #d8c49a;
}

.bg-section:first-child {
  margin-top: 8px;
}

.bg-group {
  margin: 10px 0 0;
  font-size: 1em;
  color: var(--muted);
}

/* בחירת עיצוב שעון המחוגים */
.face-question {
  margin-top: 18px;
}

.clock-faces .icon .dclock {
  display: block;
  width: 130px;
  height: auto;
}

.clock-faces .icon .analog {
  display: block;
  width: 84px;
  height: 84px;
}

/* עיצובים שמורים לפי חג */
.holiday-group {
  margin: 0 0 12px;
  border: 2px solid var(--line);
  border-radius: 12px;
  padding: 8px 12px;
  background: #fff;
}

.holiday-group summary {
  cursor: pointer;
  padding: 6px 0;
  font-size: 20px;
  font-weight: 700;
}

/* פרטי בית הכנסת במפת בתי הכנסת */
.map-details { margin: 6px 0; }
.map-details summary { cursor: pointer; font-weight: 700; padding: 4px 0; }
.map-details .row { display: flex; flex-wrap: wrap; gap: 6px; margin: 6px 0; }
.map-details .check { display: block; margin: 6px 0; }
.pick-map { height: 300px; border-radius: 8px; margin: 6px 0; border: 1px solid var(--line); }

/* לוגו בית הכנסת בהגדרות הכלליות */
.logo-preview {
  display: block;
  max-height: 120px;
  max-width: 220px;
  margin: 4px 0 8px;
  object-fit: contain;
}

#s-logo-wrap .button {
  align-self: flex-start;
}

/* שינוי ליום אחד בזמני התפילות */
.one-day {
  margin-top: 14px;
}
.one-day-card {
  border: 2px solid #c9a227;
  border-radius: 10px;
  padding: 10px;
  margin-bottom: 12px;
  background: #fffaf0;
}
.one-day-head {
  justify-content: space-between;
}
.one-day-head strong {
  font-size: 18px;
}
.one-day-card .hint {
  margin: 4px 0 8px;
}
.one-day-note {
  width: 100%;
  margin-bottom: 8px;
}
.one-day-pick {
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}

/* הבלנק להדפסה: תמונה קטנה של נייר המכתבים, ביחס של דף A4 */
.blank-preview {
  display: block;
  width: 120px;
  aspect-ratio: 210 / 297;
  object-fit: contain;
  border: 1px solid #ccc;
  background: #fff;
  margin: 6px 0 10px;
}

/* הכרזה קולית: שורה לכל הכרזה */
.v-row {
  border-top: 1px solid #e6dccb;
  padding: 10px 0;
}
.v-row .v-min {
  width: 64px;
  margin-inline-start: 8px;
}
.v-tools {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 8px 0 4px;
}

/* התרעות והודעות קצין ביטחון */
#alerts-card > * + * { margin-top: 14px; }
#alerts-card fieldset.field label { display: flex; margin-block: 4px; }
/* מתפללים ועליות (js/admin-members.js) */
table.aliyot td.a-name {
  width: 7em;
  font-weight: 700;
}

table.aliyot select {
  width: 100%;
}

.events {
  margin: 0;
  padding-inline-start: 1.2em;
  line-height: 1.8;
}

.m-date {
  align-items: center;
  margin-bottom: 6px;
}

.m-date input {
  flex: 1 1 12em;
}

.log-tools {
  border-top: 1px solid var(--line);
  padding-top: 10px;
  margin-top: 14px;
}

.events .small {
  margin-inline-start: 6px;
}

.volume-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 4px 0 8px;
}

.volume-row input {
  flex: 1;
}

.price-list td { font-size: 18px; font-weight: 700; }
.price-list td:first-child { font-weight: 400; }

/* מחיקה סופית: אדום, כדי שלא יתבלבלו בינו לבין "הסרה" */
button.danger {
  border: 1px solid #b3261e;
  background: #fff;
  color: #b3261e;
}

/* מסלול חודשי שלא שולם (billing_stage): הודעה לגבאי, ומשלב 3 העריכה נעולה. השרת דוחה שמירה בכל מקרה. */
.billing-note {
  margin: 0;
  padding: 10px 14px;
  border-radius: 8px;
  background: #fff4d6;
  color: #7a4b00;
  font-weight: 600;
}

body.billing-locked [data-panel="editor"],
body.billing-locked [data-panel="schedule"],
body.billing-locked [data-panel="memorial"],
body.billing-locked [data-panel="prayers"],
body.billing-locked [data-panel="settings"] {
  pointer-events: none;
  opacity: 0.5;
}

.billing select[hidden] {
  display: none;
}

.billing-summary h3 {
  margin: 0 0 6px;
  color: #b3261e;
}

.billing-late {
  padding: 4px 0;
  font-weight: 600;
}

.billing-summary:not(:empty) {
  margin-bottom: 16px;
  padding: 12px 14px;
  border-radius: 8px;
  background: #fbe4e2;
}

/* ברכות מזל טוב בעורך ההודעות (simchaEditor). ברכה שהתאריך שלה עבר מואפרת. */
.simcha-editor {
  margin-top: 12px;
}

.simcha-row.past {
  opacity: 0.55;
}

/* כפתור חלון התמיכה מופיע רק בדף הכניסה. */
body:not(.signed-out) .support-open {
  display: none;
}

/* חלון "חבר וואטסאפ" (js/admin-whatsapp.js) */
.wa-dialog {
  max-width: 360px;
  width: calc(100% - 32px);
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--card);
  color: var(--text);
  text-align: center;
}

.wa-dialog::backdrop {
  background: rgba(0, 0, 0, 0.4);
}

.wa-dialog h2 {
  margin-top: 0;
}

.wa-code {
  font-size: 40px;
  font-weight: bold;
  letter-spacing: 6px;
  margin: 8px 0;
  user-select: all;
}

.wa-dialog .wa-send {
  background: #25d366;
  border-color: #25d366;
  margin-bottom: 12px;
}

.wa-dialog .actions {
  justify-content: center;
}

/* חיפוש בית כנסת בכותרת (js/admin-search.js) */
.syn-search {
  position: relative;
  display: flex;
  align-items: center;
  min-width: 0;
}

.syn-search[hidden] {
  display: none;
}

.syn-search svg {
  position: absolute;
  right: 9px;
  width: 18px;
  height: 18px;
  color: var(--muted);
  pointer-events: none;
}

.syn-search input {
  width: 190px;
  max-width: 100%;
  padding: 7px 34px 7px 10px;
  border: none;
  border-radius: 6px;
  font: inherit;
  color: var(--text);
  background: #fff;
}

.syn-search ul {
  position: absolute;
  top: calc(100% + 4px);
  right: 0;
  z-index: 50;
  min-width: 100%;
  width: max-content;
  max-width: min(360px, 90vw);
  max-height: 60vh;
  overflow-y: auto;
  margin: 0;
  padding: 4px 0;
  list-style: none;
  background: var(--card);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.18);
}

.syn-search li {
  padding: 8px 12px;
  cursor: pointer;
}

.syn-search li small {
  margin-right: 8px;
  color: var(--muted);
}

.syn-search li.active,
.syn-search li:hover {
  background: var(--big);
}

.syn-search li.none {
  color: var(--muted);
  cursor: default;
  background: none;
}

@media (max-width: 640px) {
  .syn-search {
    flex: 1 1 100%;
  }

  .syn-search input {
    width: 100%;
  }
}

/* סוכן נדרים פלוס */
.ned-steps { margin: 6px 0 10px; padding-inline-start: 22px; line-height: 1.8; }
.ned-list { list-style: none; padding: 0; margin: 8px 0 12px; max-height: 420px; overflow: auto; border: 1px solid var(--line); border-radius: 8px; }
.ned-list li { padding: 6px 10px; border-bottom: 1px solid var(--line); }
.ned-list li.ours { opacity: .55; }

.print-range {
  align-items: center;
  margin-top: 8px;
}

/* מתפללים ועליות: החלקים של הלשונית (עליות, שליח ציבור, חגים, כל הרישומים, המתפללים). */
.m-views {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.m-views .m-view {
  background: var(--card);
  color: var(--accent);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 8px 16px;
}

.m-views .m-view.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  font-weight: 700;
}

.table-wrap {
  overflow-x: auto;
}

table.hag th {
  text-align: right;
  font-size: 0.9em;
  color: var(--muted);
  font-weight: 600;
}

table.hag td.past,
table.hag th.past {
  color: var(--muted);
  font-size: 0.9em;
  white-space: nowrap;
}

table.hag select {
  min-width: 11em;
}

.m-search {
  width: 100%;
  margin-bottom: 8px;
}

table.m-log td.nowrap {
  white-space: nowrap;
}

@media (max-width: 640px) {
  table.hag thead {
    display: none;
  }

  table.hag td.past {
    padding: 2px 0;
  }

  table.hag td.past::before {
    content: attr(data-label) ": ";
  }

  table.m-log thead {
    display: none;
  }

  /* בטלפון כל רישום בשורה אחת או שתיים: תאריך, שבת, כיבוד ושם. */
  table.m-log td {
    display: inline-block;
    padding: 0 8px 0 0;
  }

  table.m-log td.m-who {
    font-weight: 700;
  }
}

/* שורת הקלדה של שם מתפלל בעליות ובכיבודים (nameFinder ב-js/admin-members.js) */
.m-find {
  margin: 4px 0 10px;
}

.m-find-field {
  position: relative;
}

.m-find input {
  width: 100%;
  font-size: 1.05em;
}

.m-find ul {
  position: absolute;
  top: calc(100% + 4px);
  right: 0;
  z-index: 50;
  min-width: 260px;
  max-width: 100%;
  max-height: 50vh;
  overflow-y: auto;
  margin: 0;
  padding: 4px 0;
  list-style: none;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.18);
}

.m-find li {
  padding: 8px 12px;
  cursor: pointer;
}

.m-find li.active {
  background: #f3e6d3;
}

.m-find li.none {
  color: var(--muted);
  cursor: default;
}

.m-find .hint {
  display: block;
  min-height: 1.4em;
  margin-top: 4px;
}

/* עריכת רשימת הכיבודים (honorEditor ב-js/admin-members.js) */
.h-line {
  align-items: center;
  margin-bottom: 6px;
}

.h-line input,
.h-line .h-name {
  flex: 1 1 12em;
}

.h-line .h-name {
  font-weight: 600;
  padding: 6px 2px;
}

/* גביית נדרים (js/admin-pledges.js) */
table.pledges td.p-amount {
  width: 9em;
  white-space: nowrap;
}

table.pledges td.p-amount input,
.p-add .p-sum {
  width: 6em;
}

.p-paid {
  color: var(--muted);
  font-size: 0.9em;
  margin-inline-start: 6px;
}

.p-add input {
  flex: 1 1 9em;
}

.p-add .p-sum {
  flex: 0 0 6em;
}

button.linkish {
  background: none;
  border: 0;
  padding: 0;
  color: inherit;
  font-weight: 700;
  text-align: right;
  cursor: pointer;
  text-decoration: underline dotted;
  text-underline-offset: 4px;
}

table.p-debts td.p-owed {
  font-weight: 700;
  white-space: nowrap;
}

table.p-debts tr.p-detail td {
  background: var(--bg, #f7f5f0);
}

table.p-debts .muted {
  opacity: 0.6;
}

@media (max-width: 640px) {
  table.p-debts thead {
    display: none;
  }

  table.p-debts td {
    display: inline-block;
    padding: 2px 8px 2px 0;
  }

  table.p-debts td.p-who,
  table.p-debts td.buttons {
    display: block;
  }
}

.buttons button:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* גביית נדרים: הכרטיס של מתפלל */
.p-person {
  border: 2px solid var(--accent);
}

.p-sum-line {
  margin: 0 0 10px;
}

table.p-history td.p-for {
  font-weight: 700;
}

table.p-history .p-due {
  color: var(--accent);
  font-weight: 700;
}

table.p-history tr.muted {
  opacity: 0.6;
}

@media (max-width: 640px) {
  table.p-history thead {
    display: none;
  }

  table.p-history td {
    display: inline-block;
    padding: 2px 8px 2px 0;
  }

  table.p-history td:first-child,
  table.p-history td.buttons {
    display: block;
  }
}

/* מכתב תזכורת על נדרים (js/pledge-letter.js) */
.pl-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: rgba(30, 20, 10, 0.75);
  display: flex;
  flex-direction: column;
}

.pl-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  background: var(--card);
}

.pl-bar .pl-status {
  flex-basis: 100%;
}

.pl-bar .pl-status:empty {
  display: none;
}

.pl-stage {
  flex: 1;
  overflow: auto;
  padding: 16px 8px;
  display: flex;
  justify-content: center;
  align-items: flex-start;
}

.pl-frame {
  position: relative;
  flex: none;
  box-shadow: 0 6px 30px rgba(0, 0, 0, 0.4);
}

.pl-frame .pl-letter {
  position: absolute;
  top: 0;
  right: 0;
}

/* תיקונים מהמתפללים (js/admin-corrections.js) */
.fix-list { list-style: none; margin: 8px 0 0; padding: 0; max-height: 480px; overflow: auto; }
.fix-list li { border: 1px solid #e4ddcf; border-radius: 10px; padding: 8px 10px; margin-bottom: 6px; }
.fix-list li.closed { opacity: 0.6; }
.fix-list .row { margin-top: 6px; gap: 6px; }

/* "מתי?" בשורת תפילה: קישור קטן, ורשימה רק כשבוחרים יום מיוחד */
.prayer-table .p-when-link {
  font-size: 14px;
  color: #8a6d3b;
}
.prayer-table .p-when-q {
  color: #5b3a12;
}
.prayer-table .p-when-sel {
  border: 2px solid #c9932b;
  background: #fff8e6;
  font-weight: 700;
}
