:root {
  --bg-app: #FAF9F6;
  --bg-surface: #FFFFFF;
  --text-primary: #1C1B18;
  --text-secondary: #5C5952;
  --border-subtle: #E5E2DC;

  /* פלטת צבעים רגועה לפי התכנית */
  --calm-bg: #E8F3EE;
  --calm-text: #1F5E43;
  --calm-accent: #246B4D;

  --warn-bg: #FEF6E6;
  --warn-text: #7A4F01;
  --warn-border: #F2D79B;

  --action-bg: #FDF0EB;
  --action-text: #8C3B2B;
  --action-border: #E8BFB3;

  --radius-lg: 20px;
  --radius-md: 14px;
  --radius-pill: 999px;
  --shadow-card: 0 4px 18px rgba(28, 27, 24, 0.05);
}

*,
*::before,
*::after {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html,
body {
  margin: 0;
  padding: 0;
  background-color: var(--bg-app);
  color: var(--text-primary);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Hebrew", "Segoe UI", Arial, sans-serif;
  line-height: 1.45;
  min-height: 100dvh;
}

.app-shell {
  max-width: 480px;
  min-height: 100dvh;
  margin: 0 auto;
  padding-top: calc(12px + env(safe-area-inset-top));
  padding-bottom: calc(88px + env(safe-area-inset-bottom));
  padding-inline: 16px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

/* סרגל עליון */
.top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding-block: 4px;
}

.top-bar__title {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-secondary);
}

/* תגיות */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: var(--radius-pill);
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.badge--warning {
  background-color: var(--warn-bg);
  color: var(--warn-text);
  border: 1px solid var(--warn-border);
}

.badge--calm {
  background-color: rgba(31, 94, 67, 0.12);
  color: var(--calm-text);
}

.badge--neutral {
  background-color: var(--border-subtle);
  color: var(--text-primary);
}

.badge--today {
  background-color: var(--calm-accent);
  color: #FFFFFF;
}

/* כותרת תאריך יומי */
.date-header {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 16px 20px;
  box-shadow: var(--shadow-card);
}

.date-header__top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 4px;
}

.date-header__weekday {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-secondary);
}

.date-header__hebrew {
  margin: 0;
  font-size: 27px;
  font-weight: 800;
  letter-spacing: -0.01em;
  color: var(--text-primary);
}

.date-header__gregorian {
  margin: 4px 0 0;
  font-size: 15px;
  color: var(--text-secondary);
}

/* כרטיס הוראה בודדת */
.action-card {
  border-radius: var(--radius-lg);
  padding: 18px 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  box-shadow: var(--shadow-card);
}

.action-card--calm {
  background-color: var(--calm-bg);
  border: 1px solid rgba(31, 94, 67, 0.2);
}

.action-card--rabbi {
  background-color: var(--warn-bg);
  border: 1px solid var(--warn-border);
}

.action-card__meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.action-card__instruction {
  margin: 0;
  font-size: 20px;
  font-weight: 700;
  color: var(--calm-text);
  line-height: 1.4;
}

.action-card--rabbi .action-card__instruction {
  color: var(--warn-text);
}

.action-card__subnote {
  margin: 0;
  font-size: 14px;
  color: var(--calm-text);
  opacity: 0.9;
}

.action-card--rabbi .action-card__subnote {
  color: var(--warn-text);
}

.action-card__triggers {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.action-card__triggers .btn {
  flex: 1;
  min-width: 140px;
}

/* כפתורים */
.btn,
.btn-check,
.btn-link {
  font-family: inherit;
  cursor: pointer;
  border: none;
  transition: transform 0.08s ease, background-color 0.15s ease;
}

.btn:active,
.btn-check:active {
  transform: scale(0.98);
}

.btn {
  min-height: 48px;
  padding: 12px 16px;
  border-radius: var(--radius-md);
  font-size: 15px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.btn--primary {
  background-color: var(--calm-accent);
  color: #FFFFFF;
}

.btn--accent {
  background-color: var(--action-text);
  color: #FFFFFF;
}

.btn--secondary {
  background-color: var(--bg-surface);
  color: var(--text-primary);
  border: 1px solid var(--border-subtle);
}

.btn--ghost {
  background-color: transparent;
  color: var(--calm-text);
  text-decoration: underline;
  padding-inline: 8px;
}

.btn--small {
  min-height: 38px;
  padding: 6px 12px;
  font-size: 13px;
}

.btn--icon {
  width: 48px;
  height: 48px;
  padding: 0;
  background-color: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  font-size: 20px;
}

.btn--danger-outline {
  background-color: var(--action-bg);
  color: var(--action-text);
  border: 1px solid var(--action-border);
}

.btn-link {
  background: var(--bg-surface);
  color: var(--calm-text);
  border: 1px solid rgba(31, 94, 67, 0.25);
  border-radius: var(--radius-pill);
  padding: 6px 14px;
  min-height: 34px;
  font-size: 13px;
  font-weight: 700;
}

/* כפתור סימון בוצע */
.btn-check {
  min-height: 50px;
  width: 100%;
  border-radius: var(--radius-md);
  background-color: var(--bg-surface);
  color: var(--calm-text);
  border: 2px solid var(--calm-accent);
  font-size: 15px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-top: 2px;
}

.btn-check__box {
  width: 22px;
  height: 22px;
  border-radius: 6px;
  border: 2px solid var(--calm-accent);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  color: transparent;
}

.btn-check[aria-pressed="true"] {
  background-color: var(--calm-accent);
  color: #FFFFFF;
}

.btn-check[aria-pressed="true"] .btn-check__box {
  background-color: #FFFFFF;
  color: var(--calm-accent);
  border-color: #FFFFFF;
}

/* ניווט יומי */
.day-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: auto;
}

.day-nav .btn--primary,
.day-nav .btn--secondary {
  flex: 1;
}

/* תצוגות */
.view {
  display: flex;
  flex-direction: column;
  gap: 14px;
  flex: 1;
}

.view[hidden] {
  display: none;
}

/* לוח שנה עברי ולועזי */
.cal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 12px 14px;
}

.cal-header__titles {
  text-align: center;
}

.cal-header__hebrew {
  margin: 0;
  font-size: 20px;
  font-weight: 800;
}

.cal-header__gregorian {
  margin: 2px 0 0;
  font-size: 13px;
  color: var(--text-secondary);
}

.cal-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.cal-weekdays {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  text-align: center;
  font-size: 13px;
  font-weight: 700;
  color: var(--text-secondary);
  padding-inline: 2px;
}

.cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 6px;
}

.cal-cell {
  position: relative;
  min-height: 58px;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
  padding: 6px 4px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-family: inherit;
  color: var(--text-primary);
}

.cal-cell--empty {
  background: transparent;
  border-color: transparent;
  cursor: default;
}

.cal-cell__greg {
  position: absolute;
  top: 4px;
  left: 6px;
  font-size: 11px;
  color: var(--text-secondary);
  font-weight: 600;
}

.cal-cell__heb {
  font-size: 16px;
  font-weight: 800;
  margin-top: 6px;
}

.cal-cell__dots {
  display: flex;
  gap: 3px;
  margin-top: 3px;
  min-height: 6px;
}

.dot {
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
}

.dot--done {
  background-color: var(--calm-accent);
}

.dot--event {
  background-color: var(--action-text);
}

.cal-cell--today {
  border: 2px solid var(--calm-accent);
  background-color: var(--calm-bg);
}

.cal-cell--selected {
  background-color: var(--calm-accent);
  color: #FFFFFF;
  border-color: var(--calm-accent);
}

.cal-cell--selected .cal-cell__greg {
  color: rgba(255, 255, 255, 0.85);
}

.cal-cell--selected .dot--done {
  background-color: #FFFFFF;
}

.cal-cell--selected .dot--event {
  background-color: #F2D79B;
}

.cal-legend {
  display: flex;
  justify-content: center;
  gap: 16px;
  font-size: 12px;
  color: var(--text-secondary);
}

.cal-legend__item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

/* כרטיסי טפסים ושער לרב */
.panel-card,
.rabbi-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 18px;
  box-shadow: var(--shadow-card);
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.rabbi-card {
  background: var(--warn-bg);
  border-color: var(--warn-border);
}

.panel-card__header,
.rabbi-card__header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
}

.panel-card__title,
.rabbi-card__title {
  margin: 0;
  font-size: 20px;
  font-weight: 800;
}

.rabbi-card__title {
  color: var(--warn-text);
}

.rabbi-card__subtitle {
  margin: 2px 0 0;
  font-size: 13px;
  color: var(--warn-text);
  opacity: 0.85;
}

.panel-card__subhead {
  margin: 0;
  font-size: 15px;
  font-weight: 700;
  color: var(--text-secondary);
}

.fieldset-clean {
  border: none;
  padding: 0;
  margin: 0;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.form-label {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-primary);
}

.date-preview-box {
  background: var(--calm-bg);
  border: 1px solid rgba(31, 94, 67, 0.2);
  border-radius: var(--radius-md);
  padding: 10px 14px;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
}

.date-preview-box__heb {
  font-size: 18px;
  color: var(--calm-text);
}

.date-preview-box__sub {
  font-size: 13px;
  color: var(--calm-text);
}

.date-picker-row {
  display: flex;
  align-items: center;
  gap: 6px;
}

.input-date,
.input-text,
.input-textarea {
  font-family: inherit;
  font-size: 15px;
  color: var(--text-primary);
  background: var(--bg-app);
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
  padding: 10px 12px;
  min-height: 44px;
}

.input-date {
  flex: 1;
  text-align: center;
}

.input-textarea {
  resize: vertical;
  background: var(--bg-surface);
}

/* כרטיסי בחירת חלון זמן */
.radio-stack {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.radio-card {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--bg-app);
  border: 2px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  min-height: 54px;
  cursor: pointer;
}

.radio-card input[type="radio"] {
  width: 20px;
  height: 20px;
  accent-color: var(--calm-accent);
  margin: 0;
}

.radio-card:has(input:checked) {
  background: var(--calm-bg);
  border-color: var(--calm-accent);
}

.radio-card__content {
  display: flex;
  flex-direction: column;
}

.radio-card__title {
  font-size: 16px;
  color: var(--text-primary);
}

.radio-card__desc {
  font-size: 13px;
  color: var(--text-secondary);
}

.check-row {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 40px;
  font-size: 15px;
  cursor: pointer;
}

.check-row input[type="checkbox"] {
  width: 20px;
  height: 20px;
  accent-color: var(--calm-accent);
  margin: 0;
}

.form-actions {
  display: flex;
  gap: 10px;
  margin-top: 4px;
}

.form-actions .btn {
  flex: 1;
}

/* רשימת סיכום להקראה לרב */
.summary-list {
  margin: 0;
  background: var(--bg-surface);
  border: 1px solid var(--warn-border);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.summary-list__row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  border-bottom: 1px solid var(--bg-app);
  padding-bottom: 8px;
}

.summary-list__row:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.summary-list dt {
  font-size: 14px;
  color: var(--text-secondary);
  white-space: nowrap;
}

.summary-list dd {
  margin: 0;
  font-size: 16px;
  font-weight: 700;
  color: var(--text-primary);
  text-align: left;
}

.rabbi-card__tools {
  display: flex;
  gap: 8px;
  margin-top: 12px;
}

.rabbi-card__tools .btn {
  flex: 1;
}

.rabbi-guidance-box {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--warn-border);
}

.empty-box {
  background: var(--bg-surface);
  border-radius: var(--radius-md);
  padding: 16px;
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.empty-box p {
  margin: 0;
  font-size: 15px;
  color: var(--text-secondary);
}

/* היסטוריית אירועים */
.history-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.history-item {
  width: 100%;
  text-align: right;
  font-family: inherit;
  background: var(--bg-app);
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
  padding: 10px 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  cursor: pointer;
}

.history-item--active {
  border: 2px solid var(--warn-text);
  background: var(--warn-bg);
}

.history-item__main {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-primary);
}

.history-item__sub {
  font-size: 12px;
  color: var(--text-secondary);
}

/* ניווט תחתון */
.bottom-nav {
  position: fixed;
  bottom: 0;
  inset-inline: 0;
  max-width: 480px;
  margin: 0 auto;
  background: var(--bg-surface);
  border-top: 1px solid var(--border-subtle);
  padding: 8px 16px calc(8px + env(safe-area-inset-bottom));
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  z-index: 10;
}

.bottom-nav__item {
  min-height: 48px;
  border-radius: var(--radius-md);
  border: none;
  background: transparent;
  font-family: inherit;
  font-size: 14px;
  font-weight: 700;
  color: var(--text-secondary);
  cursor: pointer;
}

.bottom-nav__item--active {
  background-color: var(--calm-bg);
  color: var(--calm-text);
}

/* חלונית הסבר (Bottom Sheet) */
.sheet-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(28, 27, 24, 0.42);
  z-index: 20;
}

.bottom-sheet {
  position: fixed;
  bottom: 0;
  inset-inline: 0;
  max-width: 480px;
  margin: 0 auto;
  background: var(--bg-surface);
  border-top-left-radius: 24px;
  border-top-right-radius: 24px;
  padding: 12px 20px calc(22px + env(safe-area-inset-bottom));
  box-shadow: 0 -8px 30px rgba(0, 0, 0, 0.14);
  z-index: 30;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.bottom-sheet[hidden],
.sheet-backdrop[hidden] {
  display: none;
}

.bottom-sheet__handle {
  width: 40px;
  height: 4px;
  border-radius: 99px;
  background: var(--border-subtle);
  margin: 0 auto 4px;
}

.bottom-sheet__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.bottom-sheet__title {
  margin: 0;
  font-size: 18px;
  font-weight: 800;
}

.bottom-sheet__text {
  margin: 0;
  font-size: 15px;
  color: var(--text-primary);
}

.bottom-sheet__status {
  background: var(--bg-app);
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
  padding: 10px 12px;
  font-size: 13px;
  display: flex;
  justify-content: space-between;
  gap: 8px;
}

.bottom-sheet__footer {
  display: flex;
  gap: 10px;
}

.bottom-sheet__footer .btn {
  flex: 1;
}
