/* ==========================================================================
   ממשק הניהול - אותו קו עיצובי של מסך התצוגה: שמנת, חום בהיר וזהב.
   ========================================================================== */
:root {
  --bg: #FAF6F0;
  --panel: #FFFFFF;
  --border: #DED2BE;
  --hairline: rgba(234, 226, 212, 0.9);
  --accent: #773341;
  --accent-dark: #612736;
  --text: #241F1A;
  --muted: #6E6151;
  --shadow: rgba(36, 31, 26, 0.07);
  --danger: #A64A3F;

  --font-heading: "Frank Ruhl Libre", sans-serif;
  --font-body: "Heebo", sans-serif;
}

* { box-sizing: border-box; }

/* קריטי: מאפיין hidden חייב לגבור על כל display אחר (למשל display:flex של
   מסך הכניסה), אחרת מסך הכניסה נשאר מוצג גם אחרי התחברות מוצלחת. */
[hidden] { display: none !important; }

body {
  margin: 0;
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}

button, input, select, textarea { font-family: var(--font-body); }
button:disabled { cursor: wait; opacity: 0.62; }

.icon-sprite {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
}

.app-view {
  min-height: 100vh;
  display: flex;
  background: var(--bg);
}

h1, h2, h3 { font-family: var(--font-heading); }

/* ---------- מסך התחברות ---------- */

.login-view {
  height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
}

.login-card {
  background: var(--panel);
  padding: 3rem 2.5rem;
  border: 1px solid var(--hairline);
  border-radius: 20px;
  width: 340px;
  display: flex;
  flex-direction: column;
  gap: 1.2rem;
  box-shadow: 0 18px 50px var(--shadow);
}

.login-card h1 {
  margin: 0 0 0.3rem;
  font-size: 1.35rem;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-align: center;
  color: var(--accent);
}

.login-card input {
  padding: 0.8rem;
  font-size: 1rem;
  font-family: var(--font-body);
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #fff;
  color: var(--text);
}

.login-card input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(119, 51, 65, 0.18);
}

.login-card button, .btn {
  padding: 0.8rem;
  font-size: 1rem;
  font-family: var(--font-heading);
  font-weight: 500;
  letter-spacing: 0.04em;
  border: none;
  border-radius: 10px;
  background: var(--accent);
  color: var(--panel);
  cursor: pointer;
  transition: background 0.2s ease;
}

.login-card button:hover { background: var(--accent-dark); }

.error { color: var(--danger); text-align: center; margin: 0; font-size: 0.9rem; }

/* ---------- מעטפת ניהול: Sidebar + Topbar ---------- */

.admin-sidebar {
  position: sticky;
  top: 0;
  z-index: 30;
  width: 264px;
  height: 100vh;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  color: #F3EDE3;
  background:
    radial-gradient(130% 90% at 50% -10%, rgba(119, 51, 65, 0.55), transparent 62%),
    #240A11;
  border-inline-end: 1px solid rgba(177, 140, 73, 0.25);
  box-shadow: -12px 0 36px rgba(36, 10, 17, 0.12);
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  min-height: 96px;
  padding: 1.25rem 1.25rem 1rem;
  border-bottom: 1px solid rgba(177, 140, 73, 0.2);
}

.sidebar-logo {
  width: 48px;
  height: 48px;
  flex-shrink: 0;
  object-fit: contain;
  background: #FAF6F0;
  border-radius: 10px;
  padding: 0.25rem;
}

.sidebar-brand-copy {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.18rem;
}

.sidebar-product {
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.04em;
  color: #C7B79D;
}

.sidebar-brand-copy strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-family: var(--font-heading);
  font-size: 1.05rem;
  font-weight: 700;
  color: #FAF6F0;
}

.sidebar-preview-link {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.55rem;
  margin: 1rem 1rem 0.35rem;
  padding: 0.7rem 0.85rem;
  border: 1px solid rgba(177, 140, 73, 0.48);
  border-radius: 10px;
  color: #F3E7C8;
  text-decoration: none;
  font-size: 0.88rem;
  font-weight: 500;
  transition: background 0.18s ease, border-color 0.18s ease;
}

.sidebar-preview-link:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(177, 140, 73, 0.75);
}

.sidebar-preview-link svg,
.nav-item svg,
.mobile-menu-btn svg,
.topbar-primary svg {
  width: 19px;
  height: 19px;
  flex-shrink: 0;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: 0.55rem 0.75rem 1rem;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.18) transparent;
}

.nav-group { margin-top: 1rem; }
.nav-group:first-child { margin-top: 0.35rem; }

.nav-group-label {
  display: block;
  padding: 0 0.75rem 0.4rem;
  color: #A6947A;
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.08em;
}

.nav-item {
  width: 100%;
  min-height: 44px;
  display: flex;
  align-items: center;
  gap: 0.7rem;
  padding: 0.64rem 0.75rem;
  border: 1px solid transparent;
  border-radius: 10px;
  background: transparent;
  color: #DED2BE;
  cursor: pointer;
  text-align: start;
  font-size: 0.9rem;
  font-weight: 400;
  transition: color 0.15s ease, background 0.15s ease, border-color 0.15s ease;
}

.nav-item:hover {
  color: #FAF6F0;
  background: rgba(255, 255, 255, 0.06);
}

.nav-item.active {
  color: #FAF6F0;
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(177, 140, 73, 0.2);
  font-weight: 500;
}

.nav-item.active svg { color: #D6B673; }

.sidebar-footer {
  padding: 0.9rem 1rem 1.1rem;
  border-top: 1px solid rgba(177, 140, 73, 0.2);
}

.sidebar-system-status {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.65rem;
  color: #C7B79D;
  font-size: 0.77rem;
}

.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #708A5A;
  box-shadow: 0 0 0 3px rgba(112, 138, 90, 0.14);
}

.sidebar-logout {
  padding: 0;
  border: none;
  background: none;
  color: #C7B79D;
  cursor: pointer;
  font-size: 0.8rem;
}

.sidebar-logout:hover { color: #FAF6F0; }

.admin-workspace {
  min-width: 0;
  flex: 1;
  display: flex;
  flex-direction: column;
}

.admin-topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  min-height: 82px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
  padding: 1rem 2rem;
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--hairline);
}

.topbar-heading {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 0.8rem;
}

.topbar-heading h1 {
  margin: 0;
  font-size: 1.45rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: var(--text);
}

.topbar-heading p {
  margin: 0.15rem 0 0;
  color: var(--muted);
  font-size: 0.82rem;
}

.topbar-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.65rem;
}

.save-state {
  display: flex;
  align-items: center;
  gap: 0.42rem;
  padding-inline-end: 0.4rem;
  color: var(--muted);
  font-size: 0.77rem;
  white-space: nowrap;
}

.save-state-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--border);
}

.save-state.is-saving .save-state-dot {
  background: var(--gold, #B18C49);
  animation: save-pulse 1s ease-in-out infinite;
}

.save-state.is-saved .save-state-dot { background: #708A5A; }
.save-state.is-error .save-state-dot { background: var(--danger); }

@keyframes save-pulse { 50% { opacity: 0.35; transform: scale(0.8); } }

.mobile-menu-btn {
  display: none;
  width: 42px;
  height: 42px;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--panel);
  color: var(--accent);
  cursor: pointer;
}

.btn.topbar-primary {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.62rem 1rem;
  font-family: var(--font-body);
  font-size: 0.86rem;
  font-weight: 600;
  letter-spacing: 0;
}

.btn.ghost {
  background: transparent;
  color: var(--accent);
  border: 1px solid var(--border);
  text-decoration: none;
  display: inline-block;
  margin-inline-start: 0.5rem;
  padding: 0.55rem 1.1rem;
  font-size: 0.9rem;
}

.topbar-preview { margin-inline-start: 0; }

.btn.ghost:hover {
  border-color: var(--accent);
  background: rgba(119, 51, 65, 0.06);
}

/* ---------- תוכן ---------- */

.tab-content {
  width: 100%;
  max-width: 1240px;
  margin: 0 auto;
  padding: 2rem;
}

.page-stack {
  display: flex;
  flex-direction: column;
  gap: 1.4rem;
}

.page-stack > .card { margin-bottom: 0; }

.global-banner {
  margin: 1rem 2rem 0;
  padding: 0.8rem 1rem;
  border: 1px solid #D6B673;
  border-radius: 12px;
  background: #FBF3E4;
  color: #765A2F;
  font-size: 0.88rem;
}

.card {
  background: var(--panel);
  border: 1px solid var(--hairline);
  border-radius: 18px;
  padding: 1.8rem;
  margin-bottom: 1.6rem;
  box-shadow: 0 10px 30px var(--shadow);
}

.card h2 {
  margin: 0 0 1.2rem;
  font-size: 1.02rem;
  font-weight: 500;
  letter-spacing: 0.08em;
  color: var(--accent);
  padding-bottom: 0.8rem;
  border-bottom: 1px solid var(--hairline);
}

/* ---------- טבלאות ---------- */

/* עוטף כל טבלה כדי שברוחב צר (טלפון) רק הטבלה תגלול אופקית ולא כל העמוד. */
.table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

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

th, td {
  text-align: right;
  padding: 0.7rem 0.4rem;
  border-bottom: 1px solid var(--hairline);
  font-size: 0.93rem;
}

tr:last-child td { border-bottom: none; }

th {
  color: var(--muted);
  font-weight: 500;
  font-size: 0.83rem;
  letter-spacing: 0.05em;
}

.thumb {
  width: 3.5rem;
  height: 2.5rem;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid var(--hairline);
  display: block;
}

.thumb--preview {
  width: 100%;
  max-width: 220px;
  height: auto;
  border-radius: 10px;
  margin-bottom: 0.5rem;
}

.row-actions button {
  border: none;
  background: none;
  cursor: pointer;
  font-size: 0.88rem;
  font-family: var(--font-body);
  padding: 0.2rem 0.5rem;
}

.row-actions .edit { color: var(--accent); }
.row-actions .delete { color: var(--danger); }

/* ---------- טפסים ---------- */

form.item-form {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1rem;
}

form.item-form label {
  display: flex;
  flex-direction: column;
  font-size: 0.85rem;
  color: var(--muted);
  gap: 0.35rem;
}

form.item-form input,
form.item-form textarea,
form.item-form select {
  padding: 0.55rem 0.7rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 0.95rem;
  font-family: var(--font-body);
  background: #fff;
  color: var(--text);
}

form.item-form input:focus,
form.item-form textarea:focus,
form.item-form select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(119, 51, 65, 0.18);
}

form.item-form input[type="color"] {
  padding: 0.15rem;
  height: 2.4rem;
  cursor: pointer;
}

form.item-form input[type="checkbox"] { accent-color: var(--accent); }
form.item-form input[type="checkbox"]:disabled { opacity: 0.45; cursor: not-allowed; }

/* מיקוד ברור על פקדים שאינם בתוך form.item-form (טבלאות, לוגין, טאבים) -
   טבעת רכה בצבע הנושא, כדי שניווט מקלדת יהיה תמיד ברור לעין. */
a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(119, 51, 65, 0.28);
}

.days-picker {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
  grid-column: 1 / -1;
}

.days-picker label {
  flex-direction: row;
  align-items: center;
  gap: 0.35rem;
  background: var(--bg);
  border: 1px solid var(--hairline);
  padding: 0.35rem 0.7rem;
  border-radius: 999px;
  color: var(--text);
}

.full-row { grid-column: 1 / -1; }

.form-actions {
  grid-column: 1 / -1;
  display: flex;
  gap: 0.6rem;
}

.form-actions button {
  padding: 0.65rem 1.6rem;
  border: none;
  border-radius: 10px;
  cursor: pointer;
  font-family: var(--font-heading);
  font-weight: 500;
  letter-spacing: 0.03em;
  font-size: 0.95rem;
  transition: background 0.2s ease;
}

.form-actions .save {
  background: var(--accent);
  color: var(--panel);
}

.form-actions .save:hover { background: var(--accent-dark); }

.form-actions .cancel {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--muted);
}

.muted { color: var(--muted); font-size: 0.85rem; }

/* פס שמירה דביק בתחתית העמוד - כדי שכפתור "שמירת כל הטקסטים" יישאר בהישג יד
   גם בעמוד ארוך עם הרבה קבוצות שדות, בלי צורך לגלול עד הסוף בכל פעם. */
.save-bar {
  position: sticky;
  bottom: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-top: 1.6rem;
  padding: 1rem 1.4rem;
  background: var(--panel);
  border: 1px solid var(--hairline);
  border-radius: 16px;
  box-shadow: 0 -6px 24px var(--shadow);
}

.save-bar button.save {
  padding: 0.65rem 1.6rem;
  border: none;
  border-radius: 10px;
  cursor: pointer;
  font-family: var(--font-heading);
  font-weight: 500;
  letter-spacing: 0.03em;
  font-size: 0.95rem;
  background: var(--accent);
  color: var(--panel);
  transition: background 0.2s ease;
}

.save-bar button.save:hover { background: var(--accent-dark); }

/* טבלת סבב המסכים - שדות מספריים קטנים */
#screensBody input[type="number"] {
  padding: 0.35rem 0.5rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-family: var(--font-body);
  background: #fff;
  color: var(--text);
}

/* ---------- כרטיסי "מסכים" (תצוגה מסודרת לכל מסך + הגדרותיו) ---------- */
.screen-card-top {
  display: flex;
  gap: 1.2rem;
  align-items: flex-start;
  margin-bottom: 1.2rem;
}

.screen-card-preview {
  flex-shrink: 0;
  width: 160px;
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid var(--hairline);
  box-shadow: 0 2px 6px var(--shadow);
}

.screen-preview-svg { display: block; width: 100%; height: auto; }

.screen-card-info h2 {
  margin: 0 0 0.4rem;
  font-size: 1.05rem;
  font-weight: 500;
  color: var(--accent);
  padding: 0;
  background: none;
  border-radius: 0;
  letter-spacing: 0.02em;
}

.screen-card-info .muted { font-size: 0.88rem; line-height: 1.5; }

.screen-card-rotation {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 1rem;
  padding: 0.9rem 0;
  border-top: 1px solid var(--hairline);
  font-size: 0.88rem;
  color: var(--muted);
}

.screen-card-rotation label { display: flex; align-items: center; gap: 0.4rem; }

.screen-card-rotation input[type="number"] {
  padding: 0.35rem 0.5rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-family: var(--font-body);
}

.screen-card-bg {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  padding-top: 0.9rem;
  border-top: 1px solid var(--hairline);
  font-size: 0.88rem;
}

/* ---------- גלריית תמונות מהפעילות ---------- */
.gallery-thumb-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 1rem;
}

.gallery-thumb-card {
  position: relative;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid var(--hairline);
}

.gallery-thumb {
  width: 100%;
  height: 110px;
  object-fit: cover;
  display: block;
}

.gallery-thumb-delete {
  position: absolute;
  bottom: 0;
  inset-inline: 0;
  width: 100%;
  padding: 0.4rem;
  border: none;
  background: rgba(36, 31, 26, 0.72);
  color: #fff;
  font-family: var(--font-body);
  font-size: 0.82rem;
  cursor: pointer;
}

/* ---------- Dashboard ---------- */

.dashboard-welcome {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1rem;
}

.dashboard-welcome h2 {
  margin: 0;
  font-family: var(--font-heading);
  font-size: 1.7rem;
  color: var(--text);
}

.dashboard-welcome p {
  margin: 0.25rem 0 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.dashboard-health {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.9rem 1.1rem;
  border: 1px solid #D8E0D0;
  border-radius: 14px;
  background: #F1F5EC;
  color: #4D6140;
}

.dashboard-health.is-warning {
  border-color: #E6D09A;
  background: #FBF3E4;
  color: #765A2F;
}

.health-copy {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  font-size: 0.88rem;
}

.health-copy .status-dot { flex-shrink: 0; }
.dashboard-health.is-warning .status-dot { background: #B18C49; box-shadow: 0 0 0 3px rgba(177, 140, 73, 0.15); }

.dashboard-health a {
  color: inherit;
  font-size: 0.82rem;
  font-weight: 600;
}

.quick-actions {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.8rem;
}

.quick-action {
  display: flex;
  align-items: center;
  gap: 0.72rem;
  min-height: 70px;
  padding: 0.9rem 1rem;
  border: 1px solid var(--hairline);
  border-radius: 14px;
  background: var(--panel);
  color: var(--text);
  cursor: pointer;
  text-align: start;
  box-shadow: 0 4px 16px var(--shadow);
  transition: border-color 0.16s ease, transform 0.16s ease, box-shadow 0.16s ease;
}

.quick-action:hover {
  border-color: rgba(119, 51, 65, 0.35);
  transform: translateY(-1px);
  box-shadow: 0 8px 22px var(--shadow);
}

.quick-action-icon {
  width: 36px;
  height: 36px;
  flex-shrink: 0;
  display: grid;
  place-items: center;
  border-radius: 10px;
  background: rgba(119, 51, 65, 0.08);
  color: var(--accent);
  font-size: 1.3rem;
  font-weight: 300;
}

.quick-action strong { display: block; font-size: 0.9rem; font-weight: 600; }
.quick-action small { display: block; margin-top: 0.1rem; color: var(--muted); font-size: 0.72rem; }

.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: 1rem;
}

.dashboard-card {
  min-width: 0;
  padding: 1.25rem;
  border: 1px solid var(--hairline);
  border-radius: 18px;
  background: var(--panel);
  box-shadow: 0 8px 26px var(--shadow);
}

.dashboard-card--next { grid-column: span 5; }
.dashboard-card--today { grid-column: span 7; }
.dashboard-card--half { grid-column: span 6; }
.dashboard-card--wide { grid-column: 1 / -1; }

.dashboard-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.8rem;
  margin-bottom: 1rem;
}

.dashboard-card-head h3 {
  margin: 0;
  font-family: var(--font-heading);
  font-size: 1rem;
  color: var(--accent);
}

.dashboard-link,
.dashboard-card button.dashboard-link {
  padding: 0;
  border: none;
  background: none;
  color: var(--accent);
  cursor: pointer;
  font-size: 0.78rem;
  font-weight: 600;
  text-decoration: none;
}

.next-minyan-name {
  font-family: var(--font-heading);
  font-size: 1.8rem;
  font-weight: 700;
  color: var(--text);
}

.next-minyan-time {
  margin-top: 0.1rem;
  font-family: var(--font-heading);
  font-size: 3rem;
  font-weight: 700;
  line-height: 1;
  color: var(--accent);
  font-variant-numeric: tabular-nums;
}

.next-minyan-meta { margin-top: 0.65rem; color: var(--muted); font-size: 0.84rem; }

.dashboard-list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.dashboard-list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.62rem 0;
  border-bottom: 1px solid var(--hairline);
  font-size: 0.86rem;
}

.dashboard-list li:last-child { border-bottom: 0; }
.dashboard-list-time { color: var(--accent); font-weight: 700; font-variant-numeric: tabular-nums; }
.dashboard-list-sub { color: var(--muted); font-size: 0.75rem; }

.dashboard-zmanim {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.5rem;
  margin-top: 0.8rem;
  padding-top: 0.8rem;
  border-top: 1px solid var(--hairline);
}

.dashboard-zmanim div {
  min-width: 0;
  padding: 0.55rem 0.6rem;
  border-radius: 10px;
  background: var(--bg);
  text-align: center;
}

.dashboard-zmanim span {
  display: block;
  overflow: hidden;
  color: var(--muted);
  font-size: 0.67rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dashboard-zmanim strong {
  display: block;
  margin-top: 0.18rem;
  color: var(--accent);
  font-family: var(--font-heading);
  font-size: 0.94rem;
  font-variant-numeric: tabular-nums;
}

.dashboard-empty {
  margin: 0;
  padding: 1rem 0;
  color: var(--muted);
  font-size: 0.84rem;
}

.shabbat-summary {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.7rem;
}

.summary-value {
  padding: 0.8rem;
  border-radius: 12px;
  background: var(--bg);
}

.summary-value span { display: block; color: var(--muted); font-size: 0.72rem; }
.summary-value strong { display: block; margin-top: 0.18rem; color: var(--text); font-size: 0.95rem; }

.summary-badge {
  display: inline-flex;
  align-items: center;
  margin-top: 0.8rem;
  padding: 0.32rem 0.65rem;
  border-radius: 999px;
  background: #FBF6EB;
  color: #765A2F;
  font-size: 0.75rem;
  font-weight: 600;
}

.announcement-preview {
  padding: 0.9rem 1rem;
  border: 1px solid var(--hairline);
  border-radius: 12px;
  background: var(--bg);
  color: var(--text);
  font-size: 0.88rem;
  line-height: 1.6;
}

.screen-rotation-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.screen-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
}

.screen-pill {
  padding: 0.35rem 0.65rem;
  border: 1px solid var(--hairline);
  border-radius: 999px;
  background: var(--bg);
  color: var(--text);
  font-size: 0.75rem;
}

/* ---------- טעינה, שגיאות ומשוב ---------- */

.page-loading {
  display: grid;
  gap: 1rem;
}

.skeleton {
  position: relative;
  overflow: hidden;
  border-radius: 14px;
  background: #EAE2D4;
}

.skeleton::after {
  content: '';
  position: absolute;
  inset: 0;
  transform: translateX(100%);
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.62), transparent);
  animation: skeleton-shimmer 1.35s ease-in-out infinite;
}

.skeleton--line { width: 42%; height: 18px; }
.skeleton--card { height: 170px; }

@keyframes skeleton-shimmer { to { transform: translateX(-100%); } }

.page-error {
  padding: 2.5rem;
  border: 1px solid #E7C7C2;
  border-radius: 18px;
  background: #FBEDEA;
  text-align: center;
}

.page-error h2 { margin: 0 0 0.5rem; color: #7C362E; font-size: 1.2rem; }
.page-error p { margin: 0 0 1.2rem; color: #7C5A53; font-size: 0.88rem; }

.toast-region {
  position: fixed;
  z-index: 400;
  inset-inline-end: 1.25rem;
  bottom: 1.25rem;
  width: min(360px, calc(100vw - 2rem));
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: flex-start;
  gap: 0.65rem;
  padding: 0.85rem 1rem;
  border: 1px solid var(--hairline);
  border-radius: 12px;
  background: var(--panel);
  color: var(--text);
  box-shadow: 0 14px 42px rgba(36, 31, 26, 0.16);
  font-size: 0.84rem;
  line-height: 1.45;
  pointer-events: auto;
  animation: toast-enter 0.22s ease-out both;
}

.toast::before {
  content: '';
  width: 8px;
  height: 8px;
  flex-shrink: 0;
  margin-top: 0.35rem;
  border-radius: 50%;
  background: #708A5A;
}

.toast--error { border-color: #E7C7C2; }
.toast--error::before { background: var(--danger); }
.toast--warning::before { background: #B18C49; }

@keyframes toast-enter { from { opacity: 0; transform: translateY(8px); } }

button[aria-busy="true"] { position: relative; padding-inline-end: 2.2rem !important; }
button[aria-busy="true"]::after {
  content: '';
  position: absolute;
  inset-inline-end: 0.8rem;
  top: 50%;
  width: 12px;
  height: 12px;
  margin-top: -7px;
  border: 2px solid currentColor;
  border-inline-start-color: transparent;
  border-radius: 50%;
  animation: busy-spin 0.7s linear infinite;
}

@keyframes busy-spin { to { transform: rotate(360deg); } }

/* ---------- בסיס Responsive ---------- */

.sidebar-scrim { display: none; }

@media (max-width: 1100px) {
  .admin-sidebar { width: 232px; }
  .tab-content { padding: 1.5rem; }
  .admin-topbar { padding-inline: 1.5rem; }
  .quick-actions { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .dashboard-card--next,
  .dashboard-card--today { grid-column: span 6; }
}

@media (max-width: 900px) {
  .admin-sidebar {
    position: fixed;
    inset-block: 0;
    inset-inline-start: 0;
    width: min(290px, 86vw);
    transform: translateX(110%);
    transition: transform 0.24s ease;
  }

  .app-view.sidebar-open .admin-sidebar { transform: translateX(0); }

  .sidebar-scrim {
    position: fixed;
    z-index: 25;
    inset: 0;
    display: block;
    background: rgba(36, 31, 26, 0.5);
    backdrop-filter: blur(2px);
  }

  .mobile-menu-btn { display: inline-flex; }
  .topbar-preview { display: none; }
  .dashboard-card--next,
  .dashboard-card--today,
  .dashboard-card--half { grid-column: 1 / -1; }
}

@media (max-width: 720px) {
  .admin-topbar {
    min-height: 72px;
    align-items: flex-start;
    flex-wrap: wrap;
    gap: 0.75rem;
    padding: 0.85rem 1rem;
  }

  .topbar-heading { flex: 1; }
  .topbar-heading h1 { font-size: 1.2rem; }
  .topbar-heading p { font-size: 0.76rem; }

  .topbar-actions {
    width: 100%;
    justify-content: space-between;
    padding-inline-start: 50px;
  }

  .save-state { padding-inline-end: 0; }
  .btn.topbar-primary { margin-inline-start: auto; }

  .tab-content { padding: 1rem; }
  .page-stack { gap: 1rem; }
  .card { padding: 1.1rem; border-radius: 14px; }

  form.item-form { grid-template-columns: 1fr; }
  .form-actions { position: sticky; bottom: 0; z-index: 4; padding: 0.75rem 0; background: var(--panel); }
  .form-actions button { flex: 1; min-height: 44px; }

  .save-bar { flex-direction: column; align-items: stretch; text-align: center; }
  .save-bar button { min-height: 44px; }

  .screen-card-top { flex-direction: column; }
  .screen-card-preview { width: 100%; }
  .screen-card-bg { align-items: flex-start; flex-wrap: wrap; }

  .dashboard-welcome { align-items: flex-start; flex-direction: column; }
  .dashboard-welcome h2 { font-size: 1.45rem; }
  .dashboard-health { align-items: flex-start; flex-direction: column; }
  .quick-actions { grid-template-columns: 1fr 1fr; gap: 0.65rem; }
  .quick-action { min-height: 76px; padding: 0.75rem; }
  .quick-action small { display: none; }
  .dashboard-grid { grid-template-columns: 1fr; }
  .dashboard-card--next,
  .dashboard-card--today,
  .dashboard-card--half,
  .dashboard-card--wide { grid-column: 1; }
  .screen-rotation-summary { align-items: flex-start; flex-direction: column; }
  .dashboard-zmanim { grid-template-columns: 1fr 1fr; }

  .toast-region { inset-inline: 1rem; width: auto; bottom: 1rem; }
  .global-banner { margin: 0.75rem 1rem 0; }
}

@media (max-width: 430px) {
  .quick-actions { grid-template-columns: 1fr; }
  .quick-action { min-height: 60px; }
  .shabbat-summary { grid-template-columns: 1fr; }
  .topbar-actions { padding-inline-start: 0; }
}

@media (prefers-reduced-motion: reduce) {
  .admin-sidebar,
  .quick-action,
  .toast { transition: none; animation: none; }
  .skeleton::after,
  .save-state.is-saving .save-state-dot { animation: none; }
}
