:root {
  --teal: #25826e;
  --teal-dark: #1b5f51;
  --teal-light: #e6f6ef;
  --bg: #faf8f4;
  --card-bg: #ffffff;
  --text: #24312d;
  --text-muted: #6b7770;
  --border: #e2ddd2;
  --danger: #b3392c;
  --danger-light: #fbe9e6;
  --focus-ring: #0a5cff;
  --radius: 16px;
}

* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Segoe UI", Arial, Helvetica, sans-serif;
  min-height: 100%;
}

body {
  padding-bottom: 5rem;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Focus visibility for keyboard/NVDA users */
button:focus-visible,
input:focus-visible,
a:focus-visible {
  outline: 3px solid var(--focus-ring);
  outline-offset: 2px;
}

/* ---------- Header ---------- */
.app-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: 1.25rem 1.25rem 1rem;
  gap: 1rem;
}

.header-side {
  display: flex;
  flex-direction: column;
}

.header-right {
  text-align: right;
}

.header-left {
  text-align: left;
}

.bsd {
  margin: 0 0 0.15rem;
  font-size: 1rem;
  color: var(--text-muted);
}

.greeting {
  margin: 0;
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--text);
}

.date-hebrew {
  margin: 0 0 0.2rem;
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--teal-dark);
}

.date-gregorian {
  margin: 0;
  font-size: 0.95rem;
  color: var(--text-muted);
}

/* ---------- Main / list ---------- */
.app-main {
  max-width: 640px;
  margin: 0 auto;
  padding: 0 1rem;
}

.student-list {
  list-style: none;
  margin: 0.5rem 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.student-row {
  margin: 0;
}

.student-btn {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 1.1rem 1.25rem;
  font-size: 1.55rem;
  font-weight: 600;
  font-family: inherit;
  color: var(--text);
  background: var(--card-bg);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  text-align: right;
  transition: background-color 0.15s ease, border-color 0.15s ease, transform 0.05s ease;
}

.student-btn:active {
  transform: scale(0.99);
}

.student-btn .check-mark {
  flex-shrink: 0;
  width: 2.1rem;
  height: 2.1rem;
  border-radius: 50%;
  border: 2px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
  color: #fff;
  background: var(--bg);
}

.student-btn[aria-pressed="true"] {
  background: var(--teal-light);
  border-color: var(--teal);
}

.student-btn[aria-pressed="true"] .check-mark {
  background: var(--teal);
  border-color: var(--teal);
  color: #fff;
}

.empty-state {
  text-align: center;
  color: var(--text-muted);
  font-size: 1.1rem;
  margin: 2rem 0;
}

/* ---------- Confirm button ---------- */
.confirm-wrap {
  display: flex;
  justify-content: center;
  margin: 1.75rem 0 1rem;
}

.btn {
  font-family: inherit;
  font-size: 1.15rem;
  font-weight: 700;
  border: none;
  border-radius: 999px;
  padding: 0.9rem 2.25rem;
  cursor: pointer;
  transition: filter 0.15s ease, transform 0.05s ease;
}

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

.btn-primary {
  background: var(--teal);
  color: #fff;
}

.btn-primary:hover {
  filter: brightness(1.07);
}

.btn-secondary {
  background: var(--teal-light);
  color: var(--teal-dark);
}

.btn-secondary:hover {
  filter: brightness(0.97);
}

.btn-confirm {
  font-size: 1.3rem;
  padding: 1rem 3rem;
}

.tzedaka {
  text-align: center;
  color: var(--text-muted);
  font-size: 0.95rem;
  margin: 0.5rem 0 1.5rem;
}

/* ---------- Edit FAB ---------- */
.edit-fab {
  position: fixed;
  bottom: 1.25rem;
  left: 1.25rem;
  width: 3.2rem;
  height: 3.2rem;
  border-radius: 50%;
  border: none;
  background: var(--card-bg);
  color: var(--teal-dark);
  box-shadow: 0 2px 10px rgba(0,0,0,0.15);
  font-size: 1.4rem;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.edit-fab:hover {
  background: var(--teal-light);
}

/* ---------- Modal ---------- */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(20, 25, 22, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  z-index: 50;
}

.modal-overlay[hidden] {
  display: none !important;
}

.modal {
  background: var(--card-bg);
  border-radius: var(--radius);
  padding: 1.5rem;
  width: 100%;
  max-width: 480px;
  max-height: 85vh;
  overflow-y: auto;
}

.modal h2 {
  margin: 0 0 1rem;
  font-size: 1.4rem;
  color: var(--teal-dark);
}

.absent-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.absent-list li {
  font-size: 1.3rem;
  font-weight: 600;
  padding: 0.75rem 1rem;
  background: var(--danger-light);
  color: var(--danger);
  border-radius: 10px;
}

.all-present-msg {
  font-size: 1.15rem;
  color: var(--teal-dark);
  text-align: center;
  padding: 1rem 0;
}

.modal-actions {
  display: flex;
  justify-content: center;
  margin-top: 1.5rem;
}

/* ---------- Edit modal contents ---------- */
.add-student-form {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.add-student-form input {
  flex: 1;
  font-family: inherit;
  font-size: 1.1rem;
  padding: 0.65rem 0.9rem;
  border: 2px solid var(--border);
  border-radius: 10px;
  color: var(--text);
}

.edit-student-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.edit-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.65rem 0.9rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 10px;
}

.edit-row span {
  font-size: 1.1rem;
  font-weight: 600;
}

.remove-btn {
  flex-shrink: 0;
  width: 2.2rem;
  height: 2.2rem;
  border-radius: 50%;
  border: none;
  background: var(--danger-light);
  color: var(--danger);
  font-size: 1.1rem;
  font-weight: 700;
  cursor: pointer;
}

.remove-btn:hover {
  filter: brightness(0.95);
}

@media (max-width: 420px) {
  .student-btn {
    font-size: 1.3rem;
    padding: 0.95rem 1rem;
  }
  .greeting, .date-hebrew {
    font-size: 1.15rem;
  }
}
