* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  font-family: "Segoe UI", Tahoma, Arial, sans-serif;
  background: linear-gradient(135deg, #1e3a5f, #3b6b9a);
  color: #fff;
  min-height: 100vh;
}

.welcome {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 16px;
}

.welcome h1 {
  font-size: clamp(2rem, 6vw, 4rem);
  font-weight: 600;
  letter-spacing: 1px;
  margin-bottom: 24px;
}

/* Buttons */
.btn {
  display: inline-block;
  width: 100%;
  padding: 12px 16px;
  border: none;
  border-radius: 8px;
  background: #1e3a5f;
  color: #fff;
  font-size: 1rem;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  transition: background 0.2s;
}
.btn:hover { background: #2c5282; }
.btn-light {
  width: auto;
  padding: 12px 40px;
  background: #fff;
  color: #1e3a5f;
}
.btn-light:hover { background: #e2e8f0; }

/* Card (login / dashboard) */
.card {
  width: 100%;
  max-width: 380px;
  background: #fff;
  color: #1a202c;
  border-radius: 12px;
  padding: 32px 28px;
  text-align: start; /* follows the page direction (login is rtl) */
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25);
}
.welcome .card-title {
  font-size: 1.6rem;
  margin-bottom: 4px;
  text-align: center;
  letter-spacing: 0;
}
.card-subtitle {
  color: #4a5568;
  text-align: center;
  margin-bottom: 24px;
}
.card label {
  display: block;
  font-size: 0.9rem;
  font-weight: 600;
  margin-bottom: 6px;
}
.card input {
  width: 100%;
  padding: 10px 12px;
  margin-bottom: 18px;
  border: 1px solid #cbd5e0;
  border-radius: 8px;
  font-size: 1rem;
}
.card input:focus {
  outline: none;
  border-color: #3b6b9a;
  box-shadow: 0 0 0 3px rgba(59, 107, 154, 0.25);
}
.alert {
  background: #fed7d7;
  color: #9b2c2c;
  padding: 10px 12px;
  border-radius: 8px;
  margin-bottom: 18px;
  font-size: 0.9rem;
}
/* =========================================================
   App layout (pages behind login) — RTL, sidebar on the right
   ========================================================= */
body.app {
  background: #f1f4f8;
  color: #1a202c;
  min-height: 100vh;
}

.sidebar {
  position: fixed;
  top: 0;
  right: 0;
  width: 250px;
  height: 100vh;
  background: #402D1F; /* same brown as the logo text / login button */
  color: #fff;
  display: flex;
  flex-direction: column;
  z-index: 20;
  transition: transform 0.25s;
}
.brand {
  display: block;
  padding: 22px 20px;
  font-size: 1.5rem;
  font-weight: 700;
  color: #fff;
  text-decoration: none;
  letter-spacing: 0.5px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
  direction: ltr;
  text-align: center;
}
.nav {
  flex: 1;
  overflow-y: auto;
  padding: 12px 10px;
}
.nav-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 14px;
  margin-bottom: 4px;
  border-radius: 8px;
  color: #cbd5e0;
  text-decoration: none;
  font-size: 0.97rem;
  transition: background 0.15s, color 0.15s;
}
.nav-link:hover { background: rgba(255, 255, 255, 0.08); color: #fff; }
.nav-link.active { background: #261A11; color: #fff; font-weight: 600; } /* dark brown, darker than the sidebar */
.nav-icon { width: 22px; text-align: center; }

.sidebar-footer {
  padding: 14px 16px;
  border-top: 1px solid rgba(255, 255, 255, 0.12);
}
.sidebar-user { margin-bottom: 10px; color: #e2e8f0; font-size: 0.92rem; }
.logout-btn {
  width: 100%;
  padding: 9px;
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 8px;
  background: transparent;
  color: #fff;
  cursor: pointer;
  font: inherit;
}
.logout-btn:hover { background: rgba(255, 255, 255, 0.1); }

.main { margin-right: 250px; min-height: 100vh; }
.content { padding: 24px 28px; }
.nav-backdrop { display: none; }

/* Small screens: sidebar slides in */
@media (max-width: 860px) {
  .sidebar { transform: translateX(100%); }
  .main { margin-right: 0; }
  .content { padding: 16px; }
  .nav-toggle:checked ~ .sidebar { transform: translateX(0); }
  .nav-toggle:checked ~ .nav-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
    z-index: 15;
  }
}

/* Generic blocks */
.lead { font-size: 1.05rem; margin-bottom: 18px; }
.muted { color: #718096; }
.panel {
  background: #fff;
  border-radius: 12px;
  padding: 24px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}
.empty { text-align: center; padding: 48px 24px; }
.empty p { margin-bottom: 8px; }
.empty .btn { margin-top: 12px; }
.empty-icon { font-size: 2.5rem; margin-bottom: 12px; }

.btn-sm { width: auto; padding: 9px 18px; font-size: 0.95rem; }
.btn-ghost { background: #edf2f7; color: #2d3748; }
.btn-ghost:hover { background: #e2e8f0; }

/* Dashboard tiles */
.tiles {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 16px;
}
.tile {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 26px 16px;
  background: #fff;
  border-radius: 12px;
  color: #1e3a5f;
  font-weight: 600;
  text-decoration: none;
  text-align: center;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
  transition: transform 0.15s, box-shadow 0.15s;
}
.tile:hover { transform: translateY(-2px); box-shadow: 0 6px 16px rgba(0, 0, 0, 0.1); }
.tile-icon { font-size: 2rem; }

/* Sheet header + table (Excel-like) */
.sheet-head {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}
.sheet-title { font-size: 1.2rem; font-weight: 700; }
.sheet-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.search {
  padding: 9px 12px;
  border: 1px solid #cbd5e0;
  border-radius: 8px;
  font: inherit;
  min-width: 220px;
}

.table-wrap {
  overflow-x: auto;
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}
.sheet { width: 100%; border-collapse: collapse; font-size: 0.95rem; }
.sheet th, .sheet td {
  border: 1px solid #e2e8f0;
  padding: 10px 12px;
  text-align: center;
  white-space: nowrap;
}
.sheet thead th { background: #fdebd9; font-weight: 700; color: #2d3748; }
.sheet tbody tr:nth-child(even) { background: #f9fafb; }
.sheet tbody tr:hover { background: #ebf4ff; }
.sheet td.name { text-align: right; font-weight: 600; }
.sheet td.name a { color: #1e3a5f; }
.sheet td.notes { white-space: normal; min-width: 140px; text-align: right; }
.sheet td.strong { font-weight: 700; }
.sheet td.due { color: #c53030; font-weight: 700; }
.sheet td.ok { color: #2f855a; font-weight: 700; }
.sheet tfoot td { background: #1e3a5f; color: #fff; font-weight: 700; }
.row-actions { display: flex; gap: 6px; justify-content: center; }
.row-actions a, .row-actions button {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 1rem;
  text-decoration: none;
  padding: 2px 4px;
}
.row-actions form { display: inline; }

/* Add / edit form */
.form { max-width: 720px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
.field { margin-bottom: 14px; }
.field.full { grid-column: 1 / -1; }
.field label { display: block; font-weight: 600; font-size: 0.92rem; margin-bottom: 6px; }
.field input, .field textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid #cbd5e0;
  border-radius: 8px;
  font: inherit;
}
.field input:focus, .field textarea:focus {
  outline: none;
  border-color: #3b6b9a;
  box-shadow: 0 0 0 3px rgba(59, 107, 154, 0.25);
}
.installment {
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 12px 16px 2px;
  margin-bottom: 14px;
}
.installment legend { padding: 0 8px; font-weight: 700; color: #1e3a5f; }
.form-actions { display: flex; gap: 10px; margin-top: 6px; }
@media (max-width: 560px) {
  .form-grid { grid-template-columns: 1fr; }
}

/* Add student popup (centered on the page) */
.modal {
  border: none;
  border-radius: 14px;
  padding: 0;
  width: min(440px, calc(100% - 32px));
  max-height: calc(100vh - 48px);
  margin: auto;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.3);
  color: #1a202c;
}
.modal::backdrop { background: rgba(15, 23, 42, 0.55); }
.modal[open] { animation: modal-in 0.18s ease-out; }
@keyframes modal-in {
  from { opacity: 0; transform: translateY(12px) scale(0.98); }
  to { opacity: 1; transform: none; }
}
.modal form { display: flex; flex-direction: column; max-height: calc(100vh - 48px); }
.modal-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 22px;
  border-bottom: 1px solid #e2e8f0;
}
.modal-head h2 { font-size: 1.2rem; color: #1e3a5f; }
.modal-close {
  background: none;
  border: none;
  font-size: 1.8rem;
  line-height: 1;
  color: #718096;
  cursor: pointer;
}
.modal-close:hover { color: #1a202c; }
.modal-body { padding: 18px 22px 4px; overflow-y: auto; }
.modal-foot {
  display: flex;
  gap: 10px;
  padding: 14px 22px;
  border-top: 1px solid #e2e8f0;
  background: #f7fafc;
}

/* Editing a row directly in the table */
.sheet tbody tr.editing,
.sheet tbody tr.editing:hover { background: #fffbea; }
.sheet tr.editing td { padding: 6px; }
.cell-input {
  width: 90px;
  padding: 6px 8px;
  border: 1px solid #cbd5e0;
  border-radius: 6px;
  font: inherit;
  font-size: 0.92rem;
  text-align: center;
  background: #fff;
}
.cell-input:focus {
  outline: none;
  border-color: #3b6b9a;
  box-shadow: 0 0 0 3px rgba(59, 107, 154, 0.25);
}
.cell-input.cell-num { width: 85px; }
.cell-input.cell-name { width: 190px; text-align: right; }
.cell-input.cell-notes { width: 160px; text-align: right; }
.cell-btn {
  width: 32px;
  height: 32px;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-size: 1rem;
  color: #fff;
}
.cell-btn.save { background: #38a169; }
.cell-btn.save:hover { background: #2f855a; }
.cell-btn.cancel { background: #a0aec0; }
.cell-btn.cancel:hover { background: #718096; }

/* Desktop: scroll only the content area, so the browser scrollbar
   doesn't appear on the right edge next to the sidebar */
@media (min-width: 861px) {
  body.app { height: 100vh; overflow: hidden; }
  body.app .main { height: 100vh; overflow-y: auto; }
}

/* Small number under each home page tile */
.tile-sub { font-size: 0.85rem; font-weight: 500; color: #718096; min-height: 1.2em; }

/* No header bar. Phones: floating ☰ button to open the sidebar */
.menu-fab { display: none; }
@media (max-width: 860px) {
  .menu-fab {
    display: grid;
    place-items: center;
    position: fixed;
    top: 12px;
    right: 12px;
    width: 42px;
    height: 42px;
    border-radius: 10px;
    background: #1e3a5f;
    color: #fff;
    font-size: 1.3rem;
    cursor: pointer;
    z-index: 12;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
  }
  /* leave room so the button doesn't cover the first line */
  body.app .content { padding-top: 66px; }
}

/* Hide the page scrollbar (scrolling with the mouse wheel / touch still works) */
html, body.app, body.app .main { scrollbar-width: none; -ms-overflow-style: none; }
html::-webkit-scrollbar,
body.app::-webkit-scrollbar,
body.app .main::-webkit-scrollbar { display: none; }

/* =========================
   Accounting page
   ========================= */
.acc { max-width: none; } /* full width */
.acc-title { font-size: 1.5rem; color: #1e3a5f; margin-bottom: 18px; }
.acc-h2 { font-size: 1.1rem; color: #4a5568; margin: 26px 0 12px; }

/* Shared bars */
.progress { background: #e2e8f0; border-radius: 999px; overflow: hidden; height: 10px; }
.progress.big { height: 18px; }
.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #48bb78, #2f855a);
  border-radius: 999px;
  transition: width 0.4s;
}
.table-wrap.flat { box-shadow: none; border: 1px solid #e2e8f0; }

/* 1. Collection at a glance */
.acc-hero { padding: 26px 28px; }
.hero-label { color: #4a5568; font-weight: 600; }
.hero-pct { display: block; font-size: 3rem; font-weight: 800; color: #2f855a; line-height: 1.1; text-align: right; }
.hero-sub { color: #718096; font-size: 0.95rem; margin-bottom: 16px; }
.hero-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  margin-top: 22px;
  border-top: 1px solid #edf2f7;
  padding-top: 18px;
}
.hero-stat { display: flex; flex-direction: column; gap: 4px; padding: 0 16px; }
.hero-stat + .hero-stat { border-right: 1px solid #edf2f7; }
.hero-stat:first-child { padding-right: 0; }
.hs-label { color: #718096; font-size: 0.92rem; }
.hs-value { font-size: 1.6rem; font-weight: 800; color: #1a202c; }
.hs-value small { font-size: 0.8rem; font-weight: 500; color: #a0aec0; }
.hero-stat.green .hs-value { color: #2f855a; }
.hero-stat.red .hs-value { color: #c53030; }

/* 2. Installments */
.inst-cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.inst-card { padding: 18px 20px; display: flex; flex-direction: column; gap: 8px; }
.ic-name { font-weight: 700; color: #1e3a5f; }
.ic-amount { font-size: 1.5rem; font-weight: 800; }
.ic-amount small { font-size: 0.8rem; font-weight: 500; color: #a0aec0; }
.ic-count { color: #718096; font-size: 0.88rem; }

/* 3. Students */
.acc-students { padding: 18px 20px; }
.acc-toolbar {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
}
.filter-tabs { display: flex; flex-wrap: wrap; gap: 8px; }
.filter-tab {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  border: 1px solid #e2e8f0;
  border-radius: 999px;
  background: #fff;
  color: #4a5568;
  font: inherit;
  font-size: 0.93rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.filter-tab:hover { background: #f7fafc; }
.ft-count {
  min-width: 22px;
  padding: 0 7px;
  border-radius: 999px;
  background: #edf2f7;
  font-size: 0.82rem;
  text-align: center;
}
.filter-tab.red .ft-count { background: #fdecec; color: #c53030; }
.filter-tab.orange .ft-count { background: #fff4e0; color: #b7621b; }
.filter-tab.green .ft-count { background: #e6f6ec; color: #276749; }
.filter-tab.active { background: #1e3a5f; border-color: #1e3a5f; color: #fff; }
.filter-tab.active .ft-count { background: rgba(255, 255, 255, 0.2); color: #fff; }

.acc-table td.name a { color: #1e3a5f; text-decoration: none; }
.acc-table td.name a:hover { text-decoration: underline; }
.status-chip {
  display: inline-block;
  padding: 3px 12px;
  border-radius: 999px;
  font-size: 0.88rem;
  font-weight: 700;
}
.status-chip.red { background: #fdecec; color: #c53030; }
.status-chip.orange { background: #fff4e0; color: #b7621b; }
.status-chip.green { background: #e6f6ec; color: #276749; }
.acc-none { text-align: center; padding: 18px; }

@media (max-width: 760px) {
  .acc-hero { padding: 20px; }
  .hero-pct { font-size: 2.4rem; }
  .hero-stats { grid-template-columns: 1fr; gap: 12px; }
  .hero-stat { flex-direction: row; justify-content: space-between; align-items: baseline; padding: 0; }
  .hero-stat + .hero-stat { border-right: none; border-top: 1px solid #edf2f7; padding-top: 12px; }
  .hs-value { font-size: 1.3rem; }
  .inst-cards { grid-template-columns: 1fr; }
  .acc-toolbar .search { min-width: 0; width: 100%; }
  .acc-table { font-size: 0.9rem; }
  .acc-table th, .acc-table td { padding: 9px 7px; white-space: normal; }
}

/* Sidebar section headings (الاتوبيس / القربان) */
.nav-group {
  margin: 14px 14px 6px;
  font-size: 0.78rem;
  font-weight: 700;
  color: #8fa3bf;
  letter-spacing: 0.3px;
}

/* =========================
   Holy bread collections
   ========================= */
.period-pick { display: flex; align-items: center; gap: 8px; font-weight: 600; color: #4a5568; }
.period-pick select { min-width: 190px; cursor: pointer; background: #fff; }

.hb-totals {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 12px;
  margin-bottom: 16px;
}
.hb-total {
  background: #fff;
  border-radius: 12px;
  padding: 12px 16px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.hb-total span { color: #718096; font-size: 0.88rem; }
.hb-total strong { font-size: 1.35rem; color: #1a202c; }
.hb-total.primary strong { color: #2f855a; }

.field-info {
  padding: 10px 12px;
  border-radius: 8px;
  background: #f7fafc;
  color: #2d3748;
  font-weight: 600;
}
.modal .form-grid { gap: 0 14px; }
.cell-input.cell-date { width: 150px; }
.cell-input.cell-count { width: 70px; }

@media (max-width: 760px) {
  .hb-totals { grid-template-columns: repeat(2, 1fr); }
  .hb-total.primary { grid-column: 1 / -1; }
  .period-pick select { min-width: 0; }
}
.modal.wide { width: min(620px, calc(100% - 32px)); }
/* Long headings wrap so the whole table fits on the screen */
.hb-sheet th { white-space: normal; min-width: 64px; }
.hb-sheet th, .hb-sheet td { padding: 9px 10px; }
.hb-sheet td.notes { min-width: 120px; }

/* =========================
   Supermarket stock
   ========================= */
.btn-green { background: #2f855a; }
.btn-green:hover { background: #276749; }
.field select {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid #cbd5e0;
  border-radius: 8px;
  font: inherit;
  background: #fff;
}

.sm-filters {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 12px 16px;
  padding: 16px 18px;
  margin-bottom: 14px;
}
.sm-filter { display: flex; flex-direction: column; gap: 6px; }
.sm-filter.grow { flex: 1; min-width: 220px; }
.sm-filter > label { font-size: 0.88rem; font-weight: 600; color: #4a5568; }
.sm-filter .search { min-width: 0; background: #fff; }
.sm-filter select.search { min-width: 150px; cursor: pointer; }
.sm-filter input[type="date"]:disabled { background: #f1f4f8; color: #a0aec0; }
.sm-check { display: flex; align-items: center; gap: 6px; cursor: pointer; }
.sm-check input { width: 16px; height: 16px; cursor: pointer; }
.sm-show { min-width: 90px; }

.sm-summary { display: flex; flex-wrap: wrap; gap: 12px; margin-bottom: 14px; }
.sm-summary > div {
  background: #fff;
  border-radius: 12px;
  padding: 10px 16px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
  display: flex;
  align-items: baseline;
  gap: 10px;
}
.sm-summary span { color: #718096; font-size: 0.9rem; }
.sm-summary strong { font-size: 1.2rem; }
.sm-summary .warn strong { color: #c53030; }

/* Table: click a row to select it (blue, like the original screen) */
.sm-sheet tbody tr { cursor: pointer; }
.sm-sheet tbody tr.low td { background: #fff5f5; }
.sm-sheet tbody tr.selected td,
.sm-sheet tbody tr.selected:hover td { background: #2b5797; color: #fff; }
.sm-sheet tbody tr.selected td.due { color: #fed7d7; }
.sm-sheet td.name { min-width: 160px; }
.sm-barcode { font-size: 0.78rem; font-weight: 400; color: #718096; }
.sm-sheet tr.selected .sm-barcode { color: #cbd5e0; }
.sm-sheet th { white-space: normal; }

.move-types { display: flex; flex-wrap: wrap; gap: 8px; }
.move-types label {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 7px 12px;
  border: 1px solid #e2e8f0;
  border-radius: 999px;
  cursor: pointer;
  font-weight: 600;
  font-size: 0.92rem;
}
.move-types label:has(input:checked) { background: #1e3a5f; border-color: #1e3a5f; color: #fff; }
.move-types input { accent-color: #fff; }

@media (max-width: 760px) {
  .sm-filter { flex: 1 1 140px; }
  .sm-filter select.search { min-width: 0; }
}

/* Supermarket: new item typed directly as a row in the table */
.sm-sheet tbody tr.adding td,
.sm-sheet tbody tr.adding:hover td { background: #fffbea; cursor: default; }
.sm-sheet tr.adding td { padding: 6px; }
.sm-sheet tr.adding .new-tag { color: #b7791f; font-weight: 700; }
.sm-sheet tr.adding .cell-name { width: 100%; min-width: 170px; display: block; }
.sm-sheet tr.adding .cell-sub { margin-top: 4px; font-size: 0.85rem; text-align: left; }
.sm-sheet .add-meta { display: flex; gap: 8px; }
.sm-sheet .add-meta .cell-input { flex: 1; width: auto; min-width: 120px; text-align: right; }
.sm-sheet tbody tr.add-error td { background: #fed7d7; color: #9b2c2c; text-align: right; font-weight: 600; padding: 8px 12px; cursor: default; }

/* Supermarket items page: add / edit inside the row */
.sm-sheet tbody tr.editing-row td,
.sm-sheet tbody tr.editing-row:hover td { background: #fffbea; color: inherit; cursor: default; padding: 6px; }
.sm-sheet tr.editing-row .new-tag { color: #b7791f; font-weight: 700; }
.items-sheet .cell-input.cell-name { min-width: 170px; width: 100%; text-align: right; }
.items-sheet .cell-input.cell-code { width: 140px; text-align: left; }
.items-sheet .cell-input.cell-text { width: 120px; text-align: right; }
.items-sheet td.profit { white-space: nowrap; }
.items-sheet td.profit small { font-size: 0.78rem; }
.items-sheet tr.selected td.profit .ok,
.items-sheet tr.selected td.profit .due,
.items-sheet tr.selected td.profit small { color: #fff; }
/* keep the items table within the page */
.items-sheet th, .items-sheet td { padding: 9px 8px; }
.items-sheet .cell-input.cell-name { min-width: 140px; }
.items-sheet .cell-input.cell-code { width: 115px; }
.items-sheet .cell-input.cell-text { width: 95px; }
.items-sheet .cell-input.cell-num { width: 72px; }
.items-sheet .cell-input.cell-count { width: 60px; }
.items-sheet td.name { min-width: 130px; }

/* =========================
   Club monthly revenue
   ========================= */
.club { max-width: 900px; margin: 0 auto; }
.year-pick { display: flex; align-items: center; gap: 6px; }
.year-pick select { min-width: 110px; text-align: center; cursor: pointer; background: #fff; font-weight: 700; }
.year-pick .btn { width: auto; padding: 8px 12px; }
.club-sheet td.name { font-weight: 700; width: 130px; }
.club-sheet td.strong { font-size: 1.05rem; width: 180px; }
.club-sheet td.notes { text-align: right; }
.club-sheet tbody tr { cursor: default; }
.club-sheet tbody tr.blank td.name { color: #a0aec0; }
.club-sheet tbody tr.current td { background: #ebf8ff; }
.club-sheet tbody tr.current td.name::after { content: ' ●'; color: #3b6b9a; font-size: 0.7rem; }
.club-sheet tbody tr.editing-row td,
.club-sheet tbody tr.editing-row:hover td { background: #fffbea; padding: 6px; }
.club-sheet .cell-input.cell-money { width: 150px; }
.club-sheet .cell-input.cell-notes { width: 100%; min-width: 160px; }
.club-sheet tbody tr.add-error td { background: #fed7d7; color: #9b2c2c; text-align: right; font-weight: 600; padding: 8px 12px; }

/* Hide the sidebar's scrollbar (it still scrolls with the mouse wheel / touch) */
.sidebar, .sidebar .nav { scrollbar-width: none; -ms-overflow-style: none; }
.sidebar::-webkit-scrollbar, .sidebar .nav::-webkit-scrollbar { display: none; }
/* Club: summary cards on top */
.club-cards {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 16px;
}
.club-card {
  background: #fff;
  border-radius: 12px;
  padding: 14px 18px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.club-card span { color: #718096; font-size: 0.9rem; }
.club-card strong { font-size: 1.3rem; color: #1a202c; }
.club-card.total { background: #1e3a5f; }
.club-card.total span { color: #cbd5e0; }
.club-card.total strong { color: #fff; font-size: 1.5rem; }
@media (max-width: 760px) {
  .club-cards { grid-template-columns: repeat(2, 1fr); }
}
/* Club: table on the right, cards stacked in a column on the left */
.club { max-width: 1100px; }
.club-body {
  display: grid;
  grid-template-columns: 1fr 240px;
  gap: 16px;
  align-items: start;
}
.club-body .club-cards {
  grid-template-columns: 1fr;
  margin-bottom: 0;
  position: sticky;
  top: 16px;
}
@media (max-width: 900px) {
  .club-body { grid-template-columns: 1fr; }
  .club-body .club-cards { order: -1; grid-template-columns: repeat(2, 1fr); position: static; }
}

/* =========================
   Nursery (subscriptions / expenses)
   ========================= */
.year-pick input[type="month"] { min-width: 160px; background: #fff; font-weight: 700; text-align: center; }
.ns-sheet th, .ns-sheet td { padding: 9px 8px; }
.ns-sheet tbody tr { cursor: default; }
.ns-sheet .cell-input.cell-name { min-width: 150px; width: 100%; text-align: right; display: block; }
.ns-sheet .cell-input.cell-num { width: 85px; }
.ns-sheet .cell-input.cell-date { width: 140px; }
.ns-sheet .cell-input.cell-count { width: 80px; }
.ns-sheet .cell-input.cell-text { width: 110px; text-align: right; }
.ns-sheet .cell-input.cell-notes { width: 100%; min-width: 110px; }
.ns-sheet td.notes { min-width: 90px; }
.cat-chip { display: inline-block; padding: 2px 10px; border-radius: 999px; background: #edf2f7; font-size: 0.85rem; font-weight: 600; }

.club-card.net { background: #2f855a; }
.club-card.net span { color: #c6f6d5; }
.club-card.net strong { color: #fff; font-size: 1.5rem; }
.club-card.net.loss { background: #c53030; }
.club-card.net.loss span { color: #fed7d7; }
.club-card strong.due { color: #c53030; }
.club-card strong.ok { color: #2f855a; }
.club-card small { font-size: 0.8rem; }
.card-link { font-size: 0.85rem; color: #3b6b9a; text-decoration: none; margin-top: 4px; }
.card-link:hover { text-decoration: underline; }
.cat-list { display: flex; flex-direction: column; gap: 6px; margin-top: 4px; }
.cat-row { display: flex; justify-content: space-between; gap: 8px; font-size: 0.92rem; border-bottom: 1px dashed #e2e8f0; padding-bottom: 4px; }
.cat-row:last-child { border-bottom: none; }

/* Users page — role checkboxes and chips */
.role-list { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.role-option {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 600;
  font-size: 0.92rem;
}
.role-option:has(input:checked) { border-color: #3b6b9a; background: #ebf4ff; }
.role-option.role-admin { grid-column: 1 / -1; }
.role-option input { width: auto; margin: 0; }
.cat-chip.role-admin { background: #1e3a5f; color: #fff; }
.users-sheet td.roles-cell { white-space: normal; text-align: right; }
.denied-note { margin-bottom: 16px; }
@media (max-width: 560px) {
  .role-list { grid-template-columns: 1fr; }
}
.tile[hidden] { display: none; }

/* Section dashboards (pages/<Section>/dashboard) */
.section-head { display: flex; align-items: center; gap: 14px; margin-bottom: 18px; }
.section-icon { font-size: 2.4rem; line-height: 1; }
.stat-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 12px;
  margin-bottom: 22px;
}

/* =========================================================
   Supermarket dashboard — cards (pages/Supermarket/dashboard)
   ========================================================= */
.pos { display: flex; flex-direction: column; gap: 16px; }
.pos-head { display: flex; justify-content: space-between; align-items: center; }
.pos-title { font-size: 1.4rem; color: #1e3a5f; margin-bottom: 2px; }

/* Shared card */
.pos-card, .pos-stat-card, .pos-action {
  background: #fff;
  border-radius: 14px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}
.pos-card { padding: 18px 20px; }
.pos-card-title { font-size: 1.05rem; font-weight: 700; color: #1e3a5f; }

/* Summary cards */
.pos-stats {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 12px;
}
.pos-stat-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 18px;
  border-inline-start: 5px solid #cbd5e0;
  color: inherit;
  text-decoration: none;
}
.pos-stat-icon {
  display: grid;
  place-items: center;
  flex: none;
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: #edf2f7;
  font-size: 1.35rem;
}
.pos-stat-label { display: block; color: #718096; font-size: 0.85rem; }
.pos-stat-card strong { font-size: 1.25rem; color: #1a202c; }
.pos-accent-blue { border-inline-start-color: #3b6b9a; }
.pos-accent-blue .pos-stat-icon { background: #ebf4ff; }
.pos-accent-green { border-inline-start-color: #38a169; }
.pos-accent-green .pos-stat-icon { background: #f0fff4; }
.pos-accent-green strong { color: #2f855a; }
.pos-accent-red { border-inline-start-color: #e53e3e; }
.pos-accent-red .pos-stat-icon { background: #fff5f5; }
.pos-accent-red strong { color: #c53030; }
.pos-accent-navy { background: #1e3a5f; border-inline-start-color: #1e3a5f; }
.pos-accent-navy .pos-stat-icon { background: rgba(255, 255, 255, 0.15); }
.pos-accent-navy .pos-stat-label { color: #cbd5e0; }
.pos-accent-navy strong { color: #fff; }
.pos-accent-orange { border-inline-start-color: #dd6b20; background: #fffaf0; transition: transform 0.15s, box-shadow 0.15s; }
.pos-accent-orange .pos-stat-icon { background: #feebc8; }
.pos-accent-orange strong { color: #c05621; }
.pos-accent-orange:hover { transform: translateY(-2px); box-shadow: 0 6px 16px rgba(0, 0, 0, 0.1); }
.pos-accent-orange.pos-calm { background: #fff; border-inline-start-color: #cbd5e0; }
.pos-accent-orange.pos-calm strong { color: #1a202c; }

/* Action cards */
.pos-actions {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 12px;
}
.pos-action {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 18px 10px;
  border: none;
  font: inherit;
  font-weight: 700;
  color: #1e3a5f;
  text-decoration: none;
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s;
}
.pos-action:hover { transform: translateY(-2px); box-shadow: 0 6px 16px rgba(0, 0, 0, 0.1); }
.pos-action:active { transform: none; }
.pos-action-icon { font-size: 1.8rem; line-height: 1; }
.pos-action-primary { background: #1e3a5f; color: #fff; }

/* Form rows (entry + filters) */
.pos-row { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 10px 12px; }
.pos-entry .pos-card-title { margin-bottom: 12px; }
.pos-field { display: flex; flex-direction: column; gap: 4px; min-width: 120px; }
.pos-field > span { color: #4a5568; font-size: 0.82rem; font-weight: 600; }
.pos-field input, .pos-field select, .pos-field output {
  height: 38px;
  padding: 6px 10px;
  border: 1px solid #cbd5e0;
  border-radius: 8px;
  background: #fff;
  font: inherit;
  font-size: 0.95rem;
  color: #1a202c;
}
.pos-field input:focus, .pos-field select:focus {
  outline: none;
  border-color: #3b6b9a;
  box-shadow: 0 0 0 3px rgba(59, 107, 154, 0.25);
}
.pos-field output { display: flex; align-items: center; background: #f7fafc; font-weight: 700; }
.pos-grow { flex: 1 1 200px; }
.pos-num { min-width: 90px; width: 110px; }
.pos-field-btns { display: flex; gap: 6px; }
.pos-save { min-width: 110px; height: 38px; padding: 0 18px; }
.pos-save:disabled { opacity: 0.6; }
.pos-entry-msg { margin-top: 12px; padding: 8px 12px; border-radius: 8px; font-size: 0.9rem; font-weight: 600; }
.pos-entry-msg.ok { background: #c6f6d5; color: #22543d; }
.pos-entry-msg.err { background: #fed7d7; color: #9b2c2c; }

/* Ledger table inside its card */
.pos-filters { margin-bottom: 14px; }
.pos-filters .pos-card-title { align-self: center; }
.pos-grid-wrap { overflow: auto; max-height: 60vh; border: 1px solid #e2e8f0; border-radius: 10px; }
.pos-grid { width: 100%; border-collapse: collapse; font-size: 0.93rem; }
.pos-grid th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #f7fafc;
  color: #4a5568;
  font-weight: 700;
  font-size: 0.85rem;
  padding: 10px;
  border-bottom: 1px solid #e2e8f0;
  white-space: nowrap;
}
.pos-grid td { padding: 9px 10px; border-bottom: 1px solid #edf2f7; text-align: center; white-space: nowrap; }
.pos-grid tbody tr:hover td { background: #f7fbff; }
.pos-grid tr.pos-total td { background: #ebf4ff; color: #1e3a5f; font-weight: 700; }
.pos-grid tr.pos-opening td { background: #f7fafc; font-weight: 700; color: #4a5568; }
.pos-grid td.pos-name { text-align: right; font-weight: 600; }
.pos-grid td.pos-note { text-align: right; white-space: normal; min-width: 120px; color: #718096; }
.pos-grid td.pos-in { color: #2f855a; font-weight: 700; }
.pos-grid td.pos-out { color: #c53030; font-weight: 700; }
.pos-grid td.pos-bal { font-weight: 700; }
.pos-grid td.pos-empty { padding: 40px; color: #718096; }
.pos-chip { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: 0.8rem; font-weight: 700; background: #edf2f7; }
.pos-type-sale .pos-chip { background: #c6f6d5; color: #22543d; }
.pos-type-purchase .pos-chip { background: #bee3f8; color: #2a4365; }
.pos-type-sale_return .pos-chip, .pos-type-purchase_return .pos-chip { background: #feebc8; color: #7b341e; }
.pos-type-damaged .pos-chip { background: #fed7d7; color: #822727; }

@media (max-width: 560px) {
  .pos-field, .pos-num { flex: 1 1 100%; width: auto; }
  .pos-card { padding: 14px; }
}
/* Accounting page bits */
.pos-card-gap { margin-bottom: 12px; }
.pos-grid .pos-neg { color: #c53030; }
.pos-grid tr.pos-total .pos-neg { color: #c53030; }
.pos-stat-card .pos-neg { color: #c53030; }
.pos-accent-navy .pos-neg { color: #feb2b2; }
.pos-stat-card small { display: block; font-size: 0.78rem; }

/* Buses accounting — cards, full width (pages/Buses/accounting) */
.pos[hidden] { display: none; }
.acc-head { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 12px; }
.acc-stats { grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
.pos-stat-card strong small { font-size: 0.75rem; font-weight: 500; opacity: 0.7; }
.acc-pct-card { grid-column: span 2; }
.acc-pct-body { flex: 1; display: flex; flex-direction: column; gap: 6px; }
.acc-pct-card strong { font-size: 1.8rem; }
.acc-pct-card .progress { background: rgba(255, 255, 255, 0.18); height: 10px; }
.acc-split { display: grid; grid-template-columns: 3fr 2fr; gap: 16px; }
.acc-insts { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; }
.acc-inst, .acc-bus {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 14px 16px;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  background: #f9fbfd;
  color: inherit;
  text-decoration: none;
}
.acc-buses { display: flex; flex-direction: column; gap: 12px; }
.acc-bus { transition: transform 0.15s, box-shadow 0.15s; }
.acc-bus:hover { transform: translateY(-2px); box-shadow: 0 6px 16px rgba(0, 0, 0, 0.08); }
.acc-inst-top { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.acc-inst-pct { font-weight: 800; color: #2f855a; }
.acc-bus-nums { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: 0.88rem; color: #4a5568; }
.acc-bus-nums .ok b { color: #2f855a; }
.acc-bus-nums .due b { color: #c53030; }
.acc .acc-toolbar { justify-content: flex-start; }
.acc .acc-toolbar .filter-tabs { flex: 1; }
.acc-search { min-width: 220px; }
.acc-grid td.pos-name a { color: #1e3a5f; text-decoration: none; }
.acc-grid td.pos-name a:hover { text-decoration: underline; }
.acc-bar-cell { min-width: 150px; }
.acc-bar-cell .progress { display: inline-block; width: 90px; height: 8px; vertical-align: middle; margin-inline-end: 8px; }
.progress.red .progress-fill { background: #e53e3e; }
.progress.orange .progress-fill { background: linear-gradient(90deg, #f6ad55, #dd6b20); }
@media (max-width: 960px) {
  .acc-split { grid-template-columns: 1fr; }
  .acc-pct-card { grid-column: auto; }
}
@media (max-width: 560px) {
  .acc-search { min-width: 0; width: 100%; }
}

/* General accounting (pages/finance) */
.fin-sections { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px; }
.fin-card { display: flex; flex-direction: column; gap: 14px; color: inherit; text-decoration: none; transition: transform 0.15s, box-shadow 0.15s; }
.fin-card:hover { transform: translateY(-2px); box-shadow: 0 6px 16px rgba(0, 0, 0, 0.1); }
.fin-card-top { display: flex; align-items: center; gap: 12px; }
.fin-icon { display: grid; place-items: center; width: 48px; height: 48px; border-radius: 14px; background: #edf2f7; font-size: 1.6rem; flex: none; }
.fin-name { display: flex; flex-direction: column; }
.fin-name strong { font-size: 1.1rem; color: #1e3a5f; }
.fin-name .muted { font-size: 0.82rem; }
.fin-nums { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.fin-nums > div { display: flex; flex-direction: column; gap: 2px; padding: 10px 12px; border-radius: 10px; background: #f7fafc; }
.fin-nums span { color: #718096; font-size: 0.8rem; }
.fin-nums b { font-size: 1rem; }
.fin-nums .ok { color: #2f855a; }
.fin-nums .due { color: #c53030; }
.fin-net { background: #1e3a5f !important; }
.fin-net span { color: #cbd5e0; }
.fin-net b { color: #fff; }
.fin-net.loss { background: #c53030 !important; }
.fin-net .pos-neg { color: #fff; }
.fin-open { color: #3b6b9a; font-weight: 700; font-size: 0.9rem; align-self: flex-end; }
.fin-hint { font-size: 0.8rem; font-weight: 500; }
.pos-grid tr.fin-empty-row td { color: #a0aec0; }

/* Nursery accounting — expenses by category (pages/Nursery/accounting) */
.ns-cat { display: flex; flex-direction: column; gap: 6px; padding: 8px 0; border-bottom: 1px solid #edf2f7; }
.ns-cat:last-child { border-bottom: none; }
.ns-cat-top { display: flex; justify-content: space-between; gap: 8px; font-weight: 600; }
.pos-grid td.pos-name a { color: #1e3a5f; text-decoration: none; }
.pos-grid td.pos-name a:hover { text-decoration: underline; }

/* Welcome banner at the top of a section's first page (e.g. nursery subscriptions) */
.welcome-banner {
  margin-bottom: 32px;
  color: #1e3a5f;
  font-size: 1.35rem;
  font-weight: 700;
  text-align: center;
}

/* Ti Ekklesia App logo — sidebar (light version) and login page (original colours) */
.brand-img { display: block; width: 100%; max-width: 200px; height: auto; margin: 0 auto; }
.login-logo { margin-bottom: 8px; }
.login-logo img { display: block; width: 100%; max-width: 280px; height: auto; margin: 0 auto; }

/* Login page background (other pages keep their own) */
body.login-page { background: #fff; }
body.login-page .card { box-shadow: 0 10px 30px rgba(60, 40, 20, 0.12); }
/* Login button in the logo's text colour (dark coffee brown) */
body.login-page .btn { background: #402D1F; color: #fff; }
body.login-page .btn:hover { background: #2E1F14; }
body.login-page .btn:disabled { opacity: 0.7; }
/* Login inputs: always white, even when the browser autofills them (Chrome paints autofill blue) */
body.login-page .card input { background: #fff; color: #1a202c; }
body.login-page .card input:-webkit-autofill,
body.login-page .card input:-webkit-autofill:hover,
body.login-page .card input:-webkit-autofill:focus {
  -webkit-box-shadow: 0 0 0 1000px #fff inset;
  -webkit-text-fill-color: #1a202c;
  caret-color: #1a202c;
  transition: background-color 9999s ease-in-out 0s;
}

/* =========================================================
   Black sidebar — light text, cream logo, brown highlight (overrides the sidebar rules above)
   ========================================================= */
.sidebar {
  background: #000;
  color: #f3e7d8;
  border-left: none;
  box-shadow: none;
}
.brand { border-bottom: none; } /* no divider line under the logo */
.nav-link { color: #d6cbbf; }
.nav-link:hover { background: rgba(255, 255, 255, 0.08); color: #fff; }
.nav-link.active { background: #402D1F; color: #fff; font-weight: 600; }
.nav-group { color: #a08a78; }
.sidebar-footer { border-top-color: rgba(255, 255, 255, 0.12); }
.sidebar-user { color: #d6cbbf; }
.logout-btn { border-color: rgba(255, 255, 255, 0.3); color: #fff; }
.logout-btn:hover { background: rgba(255, 255, 255, 0.1); }
/* Sidebar profile card: avatar + username + role */
.sidebar-user {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  margin-bottom: 12px;
  padding: 8px 10px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.06);
}
.su-avatar {
  display: grid;
  place-items: center;
  flex: none;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: #402D1F;
  border: 2px solid #f3e7d8;
  color: #f3e7d8;
  font-weight: 700;
  font-size: 1.05rem;
}
.su-text { display: flex; flex-direction: column; min-width: 0; }
.su-text strong { color: #fff; font-size: 0.95rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.su-text small { color: #a08a78; font-size: 0.78rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Highlighted main card (pos-accent-navy: الصافى / صافى الربح / نسبة التحصيل ...) — cream with logo-brown text */
.pos-stat-card.pos-accent-navy { background: #F3EEDB; border-inline-start-color: #402D1F; }
.pos-accent-navy .pos-stat-icon { background: rgba(64, 45, 31, 0.1); }
.pos-accent-navy .pos-stat-label { color: #7a6352; }
.pos-accent-navy strong { color: #402D1F; }
.pos-accent-navy .pos-neg { color: #c53030; }
.acc-pct-card .progress { background: rgba(64, 45, 31, 0.15); }

/* =========================================================
   All cards white across the system (overrides the coloured card variants above).
   Numbers keep their meaning colours: green = income/profit, red = expenses/loss.
   ========================================================= */
.pos-stat-card.pos-accent-navy { background: #fff; border-inline-start-color: #402D1F; }
.pos-stat-card.pos-accent-orange { background: #fff; }
.pos-action.pos-action-primary { background: #fff; color: #402D1F; border: 2px solid #402D1F; }
.club-card.total, .club-card.net, .club-card.net.loss { background: #fff; }
.club-card.total span, .club-card.net span, .club-card.net.loss span { color: #718096; }
.club-card.total strong { color: #402D1F; }
.club-card.net strong { color: #2f855a; }
.club-card.net.loss strong { color: #c53030; }
.fin-net, .fin-net.loss { background: #f7fafc !important; }
.fin-net span { color: #718096; }
.fin-net b { color: #402D1F; }
.fin-net .pos-neg, .fin-net.loss b { color: #c53030; }

/* Admin dashboard (pages/main) */
.md-link { color: inherit; text-decoration: none; }
a.pos-stat-card.md-link:hover { box-shadow: 0 6px 16px rgba(0, 0, 0, 0.1); }
.md-section:hover { transform: none; }
.md-section-links { display: flex; justify-content: space-between; gap: 10px; font-size: 0.9rem; font-weight: 700; }
.md-section-links a { color: #402D1F; text-decoration: none; }
.md-section-links a:hover { text-decoration: underline; }
.md-alerts { display: flex; flex-wrap: wrap; gap: 10px; }
.md-alert {
  padding: 10px 16px;
  border-radius: 10px;
  background: #fff;
  border-inline-start: 5px solid #dd6b20;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
  color: #7b341e;
  text-decoration: none;
  font-weight: 600;
}
.md-alert:hover { background: #fffaf0; }
.md-chart-head { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.md-legend { display: flex; align-items: center; gap: 6px; font-size: 0.85rem; color: #4a5568; }
.md-key { display: inline-block; width: 12px; height: 12px; border-radius: 3px; margin-inline-start: 8px; }
.md-key.in, .md-bar.in { background: #38a169; }
.md-key.out, .md-bar.out { background: #e53e3e; }
.md-chart { display: grid; grid-template-columns: repeat(12, 1fr); gap: 8px; align-items: end; }
.md-col { display: flex; flex-direction: column; align-items: center; gap: 4px; min-width: 0; }
.md-val { font-size: 0.7rem; color: #718096; min-height: 1em; white-space: nowrap; }
.md-bars { display: flex; align-items: flex-end; justify-content: center; gap: 3px; width: 100%; height: 160px; border-bottom: 1px solid #e2e8f0; }
.md-bar { display: block; width: 40%; max-width: 18px; min-height: 0; border-radius: 4px 4px 0 0; transition: height 0.3s; }
.md-month { font-size: 0.75rem; color: #4a5568; white-space: nowrap; }
@media (max-width: 760px) {
  .md-chart { gap: 3px; }
  .md-val { display: none; }
  .md-month { font-size: 0.6rem; }
  .md-bars { height: 110px; }
}

/* =========================================================
   Saturday Mass (pages/SaturdayMass)
   ========================================================= */
.sat-filters { margin-bottom: 14px; }
.sat-code { font-family: Consolas, "Courier New", monospace; font-weight: 700; color: #402D1F; }
.sat-layout { display: grid; grid-template-columns: minmax(300px, 420px) 1fr; gap: 16px; align-items: start; }
.sat-scan-card { position: sticky; top: 16px; display: flex; flex-direction: column; gap: 12px; }
.sat-scan-card .pos-card-gap { margin-bottom: 0; }
.sat-reader { position: relative; width: 100%; min-height: 240px; border-radius: 12px; overflow: hidden; background: #1a202c; }
.sat-reader video { width: 100% !important; display: block; }
.sat-reader-off { position: absolute; inset: 0; display: grid; place-items: center; color: #a0aec0; font-weight: 600; }
.sat-scan-btns { display: flex; gap: 8px; }
.sat-scan-btns .btn { flex: 1; }
.sat-manual .pos-save { height: 38px; }
.sat-result { padding: 14px 16px; border-radius: 12px; font-size: 1.05rem; line-height: 1.6; }
.sat-result.ok { background: #c6f6d5; color: #22543d; }
.sat-result.warn { background: #feebc8; color: #7b341e; }
.sat-result.err { background: #fed7d7; color: #9b2c2c; }
.sat-stats { grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); }
.sat-days { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 4px; }
.sat-day { padding: 2px 10px; border: 1px solid #e2e8f0; border-radius: 999px; background: #fff; font: inherit; font-size: 0.82rem; cursor: pointer; }
.sat-day small { color: #2f855a; font-weight: 700; }
.sat-day.on { background: #402D1F; border-color: #402D1F; color: #fff; }
.sat-day.on small { color: #c6f6d5; }
@media (max-width: 960px) {
  .sat-layout { grid-template-columns: 1fr; }
  .sat-scan-card { position: static; }
}

/* QR card (popup + print) */
.sat-qr-body { display: flex; justify-content: center; padding-bottom: 18px; }
.sat-card {
  width: 240px;
  padding: 14px 14px 12px;
  border: 2px solid #402D1F;
  border-radius: 14px;
  background: #fff;
  color: #402D1F;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  break-inside: avoid;
}
.sat-card-logo { width: 150px; height: auto; }
.sat-card-service { font-size: 0.85rem; font-weight: 700; color: #7a6352; }
.sat-card-qr { width: 170px; height: 170px; margin: 4px 0; }
.sat-card-name { font-size: 1.1rem; font-weight: 800; }
.sat-card-grade { font-size: 0.85rem; color: #7a6352; }
.sat-card-code { font-family: Consolas, "Courier New", monospace; font-weight: 700; letter-spacing: 1px; }
.sat-print { display: none; }
@media print {
  body.app .sidebar, body.app .menu-fab, body.app .nav-backdrop, .no-print, dialog { display: none !important; }
  body.app, body.app .main { background: #fff !important; margin: 0 !important; }
  .content { padding: 0 !important; }
  .sat-print { display: grid; grid-template-columns: repeat(3, 240px); gap: 14px; justify-content: center; }
  .sat-print .sat-card { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}
/* Saturday Mass — scan-only page (centred) and report */
.sat-scan-page { align-items: center; }
.sat-scan-page .sat-scan-card { position: static; width: 100%; max-width: 560px; }
.sat-scan-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; flex-wrap: wrap; }
.sat-scan-head .pos-title { margin-bottom: 2px; }
.sat-scan-page .sat-reader { min-height: 300px; }
.sat-scan-page .sat-result { font-size: 1.2rem; text-align: center; }
.sat-report-split { grid-template-columns: 1fr 1fr; }
.sat-day-row { cursor: pointer; }
.pos-grid tr.sat-day-row.on td { background: #f6f0e9; font-weight: 700; }
@media (max-width: 960px) { .sat-report-split { grid-template-columns: 1fr; } }
/* Saturday Mass scan: camera box with the 3-second pause countdown on top */
.sat-reader-wrap { position: relative; border-radius: 12px; overflow: hidden; background: #1a202c; min-height: 300px; }
.sat-reader-wrap .sat-reader { min-height: 300px; border-radius: 0; background: transparent; }
.sat-reader-wrap .sat-reader-off { z-index: 1; }
.sat-pause {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  background: rgba(64, 45, 31, 0.55);
  color: #fff;
  font-weight: 700;
}
.sat-pause[hidden] { display: none; }
.sat-pause b { font-size: 4rem; line-height: 1; }

/* Admin section switcher at the top of the sidebar */
.nav-switch { display: flex; flex-direction: column; gap: 4px; margin: 0 0 12px; } /* in the sidebar footer, above the user card */
.nav-switch span { font-size: 0.75rem; font-weight: 700; color: #a08a78; }
.nav-switch select {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: 8px;
  background: #1a1a1a;
  color: #fff;
  font: inherit;
  font-size: 0.92rem;
  cursor: pointer;
}
.nav-switch select:focus { outline: none; border-color: #a08a78; }

/* Club revenue — single month entry form (pages/Club/revenue) */
.club-entry-page { align-items: center; }
.club-entry { width: 100%; max-width: 460px; display: flex; flex-direction: column; gap: 4px; }
.club-entry .pos-title { margin-bottom: 0; }
.club-entry > p { margin-bottom: 14px; }
.club-entry .field input { width: 100%; height: 42px; padding: 8px 12px; border: 1px solid #cbd5e0; border-radius: 8px; font: inherit; font-size: 1rem; }
.club-entry .field input:focus { outline: none; border-color: #402D1F; box-shadow: 0 0 0 3px rgba(64, 45, 31, 0.15); }
.club-entry .btn { margin-top: 6px; }
.club-entry-status { margin: -4px 0 12px; font-size: 0.88rem; font-weight: 600; }
.club-entry-status.saved { color: #2f855a; }
.club-entry-status.empty { color: #a0aec0; }
.club-entry-ok { padding: 10px 12px; border-radius: 8px; background: #c6f6d5; color: #22543d; font-weight: 600; margin-bottom: 4px; }

/* Holy bread expenses sheet (pages/HolyBread/expenses) */
.hb-exp-layout { display: grid; grid-template-columns: 1fr 300px; gap: 16px; align-items: start; }
.hb-exp-wrap { max-height: 70vh; }
.hb-exp-grid td.hb-note { white-space: normal; min-width: 90px; color: #c53030; font-weight: 600; }
.hb-exp-grid .cell-input { min-width: 70px; }
@media (max-width: 1100px) { .hb-exp-layout { grid-template-columns: 1fr; } }

/* =========================================================
   Sunday School ratings (pages/SundaySchool/ratings) + report stars
   ========================================================= */
.ss-star { color: #d69e2e; }
.ss-progress-card { display: flex; flex-direction: column; gap: 8px; }
.ss-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 14px; }
.ss-empty { grid-column: 1 / -1; text-align: center; padding: 30px; }
.ss-card { display: flex; flex-direction: column; gap: 8px; border-inline-start: 5px solid #e2e8f0; }
.ss-card.rated { border-inline-start-color: #38a169; }
.ss-card-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 2px; }
.ss-card-head strong { font-size: 1.05rem; color: #1a202c; }
.ss-item { display: flex; align-items: center; gap: 10px; }
.ss-item-label { width: 60px; font-weight: 700; color: #4a5568; font-size: 0.9rem; }
.ss-stars { display: flex; gap: 2px; direction: ltr; }
.ss-star-btn {
  border: none;
  background: none;
  padding: 0 2px;
  font-size: 1.6rem;
  line-height: 1;
  color: #e2e8f0;
  cursor: pointer;
  transition: transform 0.1s, color 0.1s;
}
.ss-star-btn:hover { transform: scale(1.15); }
.ss-star-btn.on { color: #d69e2e; }
.ss-num { min-width: 14px; font-weight: 700; color: #402D1F; }
.ss-saved { font-size: 0.82rem; font-weight: 700; }
.ss-saved.ok { color: #2f855a; }
.ss-saved.err { color: #c53030; }
/* Sunday School ratings — number boxes (1–5) instead of stars */
.ss-inputs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.ss-inputs .ss-item { flex-direction: column; align-items: stretch; gap: 4px; }
.ss-inputs .ss-item-label { width: auto; text-align: center; }
.ss-input {
  width: 100%;
  height: 44px;
  border: 1px solid #cbd5e0;
  border-radius: 8px;
  text-align: center;
  font: inherit;
  font-size: 1.3rem;
  font-weight: 800;
  color: #402D1F;
  background: #fff;
}
.ss-input::placeholder { font-size: 0.8rem; font-weight: 500; color: #cbd5e0; }
.ss-input:focus { outline: none; border-color: #402D1F; box-shadow: 0 0 0 3px rgba(64, 45, 31, 0.15); }
.ss-of { text-align: center; font-size: 0.75rem; }
/* Sunday School ratings — save button per card; orange edge while not saved */
.ss-card-foot { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-top: 4px; }
.ss-save { margin-inline-start: auto; background: #edf2f7; color: #402D1F; }
.ss-save:hover { background: #e2e8f0; }
.ss-card.dirty { border-inline-start-color: #dd6b20; }
.ss-card.dirty .ss-save { background: #402D1F; color: #fff; }
.ss-card.dirty .ss-save:hover { background: #2E1F14; }
.ss-save:focus-visible { outline: 3px solid rgba(64, 45, 31, 0.35); outline-offset: 2px; }
/* Sunday School report: day dropdown in the day-details card */
.ss-day-pick { min-width: 220px; }

/* =========================================================
   Sunday School services (الخدمات): chips, cards, services page
   ========================================================= */
.ss-svc-chip {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--svc, #402D1F);
  background: color-mix(in srgb, var(--svc, #402D1F) 12%, #fff);
  border: 1px solid color-mix(in srgb, var(--svc, #402D1F) 35%, #fff);
}
.sat-card-service {
  padding: 2px 12px;
  border-radius: 999px;
  background: var(--svc, #402D1F);
  color: #fff;
  font-size: 0.85rem;
  font-weight: 700;
  -webkit-print-color-adjust: exact;
  print-color-adjust: exact;
}
.field select { width: 100%; padding: 10px 12px; border: 1px solid #cbd5e0; border-radius: 8px; font: inherit; background: #fff; }
.ss-svc-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 14px; }
.ss-svc { position: relative; display: flex; flex-direction: column; gap: 8px; border-inline-start: 6px solid #cbd5e0; }
.ss-svc-top { display: flex; align-items: center; gap: 8px; font-size: 1.1rem; }
.ss-dot { width: 14px; height: 14px; border-radius: 50%; background: #cbd5e0; flex: none; }
.ss-svc-count { color: #4a5568; }
.ss-svc-count b { font-size: 1.4rem; color: #1a202c; }
.ss-svc-links { display: flex; gap: 14px; font-weight: 700; font-size: 0.9rem; }
.ss-svc-links a { color: #402D1F; text-decoration: none; }
.ss-svc-actions { position: absolute; top: 12px; inset-inline-end: 12px; }
.ss-svc-none { border-inline-start-style: dashed; }
/* Saturday Mass students: the Sunday School columns (service, attendance, ratings) */
.pos-grid th.sat-sun-h { background: #f6f0e9; color: #402D1F; }

/* =========================================================
   Student details page (pages/Shared/student)
   ========================================================= */
.pos-grid tbody tr[data-id] { cursor: pointer; }
.sp-link { color: #1e3a5f; text-decoration: none; font-weight: 700; }
.sp-link:hover { text-decoration: underline; }
.sp-head { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; }
.sp-avatar {
  display: grid; place-items: center; flex: none;
  width: 72px; height: 72px; border-radius: 50%;
  background: #402D1F; color: #f3e7d8; font-size: 2rem; font-weight: 800;
}
.sp-who { flex: 1; min-width: 220px; display: flex; flex-direction: column; gap: 8px; }
.sp-who .pos-title { margin: 0; }
.sp-tags { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.sp-code { font-size: 0.85rem; color: #4a5568; background: #f7fafc; border: 1px solid #e2e8f0; border-radius: 999px; padding: 2px 10px; }
.sp-contact { display: flex; flex-wrap: wrap; gap: 6px 18px; font-size: 0.92rem; color: #4a5568; }
.sp-contact a { color: #1e3a5f; font-weight: 600; text-decoration: none; }
.sp-qrs { display: flex; gap: 10px; }
.sp-qrs figure { margin: 0; text-align: center; }
.sp-qrs img { width: 110px; height: 110px; border: 1px solid #e2e8f0; border-radius: 8px; background: #fff; }
.sp-qrs figcaption { font-size: 0.75rem; color: #718096; }
.sp-back { align-self: flex-start; }
.pos-grid tr.sp-absent td { background: #fffafa; }
.sp-days { display: flex; flex-wrap: wrap; gap: 8px; }
.sp-day { padding: 6px 12px; border: 1px solid #e2e8f0; border-radius: 999px; background: #f9fbfd; font-size: 0.9rem; }
@media (max-width: 760px) { .sp-qrs { width: 100%; justify-content: center; } }

/* =========================================================
   Sunday School follow-up (pages/SundaySchool/visits) — one section per service
   ========================================================= */
.vs-group { border-top: 5px solid var(--svc, #402D1F); display: flex; flex-direction: column; gap: 10px; }
.vs-group-head { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px; }
.vs-group-head h2 { display: flex; align-items: center; gap: 8px; margin: 0; font-size: 1.2rem; color: #1a202c; }
.vs-badges { display: flex; flex-wrap: wrap; gap: 6px; flex: 1; }
.vs-sub { margin: 6px 0 0; font-size: 1rem; color: #402D1F; }
.vs-ok { color: #2f855a; font-weight: 700; }
.pos-grid tr.vs-urgent td { background: #fff5f5; }
.pos-grid tr.vs-done td { color: #718096; }
.vs-add { white-space: nowrap; }
.vs-types { display: flex; flex-wrap: wrap; gap: 8px; }

/* =========================================================
   Attendance reports (Saturday Mass + Sunday School) — public/js/service/report-page.js
   ========================================================= */
.rp-head { display: flex; flex-direction: column; gap: 12px; }
.rp-title .pos-title { margin-bottom: 2px; }
.rp-tabs { display: flex; flex-wrap: wrap; gap: 8px; }
.rp-tabs[hidden] { display: none; }
.rp-tab {
  padding: 8px 18px;
  border: 2px solid var(--svc, #402D1F);
  border-radius: 999px;
  background: #fff;
  color: var(--svc, #402D1F);
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.rp-tab:hover { background: color-mix(in srgb, var(--svc, #402D1F) 10%, #fff); }
.rp-tab.on { background: var(--svc, #402D1F); color: #fff; }
.rp-tab-all { --svc: #4a5568; }
.rp-filters { align-items: flex-end; }
.rp-cards { grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); }
.rp-split { grid-template-columns: 3fr 2fr; }
.rp-chart { min-height: 200px; }
.rp-chart.rp-chart-empty { display: block; }
.rp-bar { width: 60% !important; max-width: 34px !important; background: #2f855a; }
.rp-bar.low { background: #dd6b20; }
.rp-rates { display: flex; flex-direction: column; gap: 16px; padding-top: 6px; }
.rp-rate { display: flex; flex-direction: column; gap: 6px; }
.rp-rate-top { display: flex; justify-content: space-between; font-weight: 700; color: #2d3748; }
.rp-rate .progress { height: 12px; }
.rp-table td.acc-bar-cell .progress { width: 70px; }
.pos-grid tr.rp-need td { background: #fffaf0; }
@media (max-width: 960px) { .rp-split { grid-template-columns: 1fr; } }

/* View-only users (Holy Father): no add / edit / delete buttons */
body.read-only #new-btn,
body.read-only [data-action="edit"],
body.read-only [data-action="delete"],
body.read-only [data-action="undo"],
body.read-only .vs-add { display: none !important; }

/* Holy Father: all students table (pages/Father/students) */
.fa-grid td.fa-cell { white-space: nowrap; }
.fa-grid td.fa-cell .sat-code { display: block; font-size: 0.75rem; opacity: 0.7; }
.fa-grid td.fa-cell span { margin-inline-end: 6px; }
.fa-grid tr.fa-row { cursor: pointer; }
.fa-grid tr.fa-row:hover td { background: #f6f0e9; }

/* Student page: the tables two per row (the section cards inside #mains join the same grid) */
.sp-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; align-items: start; }
.sp-grid > .pos-card[hidden] { display: none; }
.sp-mains { display: contents; }
.sp-grid .pos-grid td, .sp-grid .pos-grid th { padding: 7px 8px; }
@media (max-width: 1100px) { .sp-grid { grid-template-columns: 1fr; } }

/* Sunday School full report (pages/SundaySchool/fullreport) */
.fr-find { display: flex; flex-direction: column; gap: 12px; }
.fr-results { display: flex; flex-wrap: wrap; gap: 8px; max-height: 220px; overflow-y: auto; }
.fr-pick { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border: 1px solid #e2e8f0; border-radius: 999px; background: #fff; font: inherit; font-size: 0.9rem; cursor: pointer; }
.fr-pick:hover { background: #f6f0e9; }
.fr-pick.on { border-color: #402D1F; background: #402D1F; color: #fff; }
.fr-pick.on .sat-code { color: #f3e7d8; }
.fr-actions { display: flex; flex-direction: column; gap: 8px; align-self: flex-start; }
@media print { .fr-find, .fr-actions { display: none !important; } }

/* =========================================================
   المخدوم المثالى (public/js/service/ideal-page.js): podium + ranking
   ========================================================= */
.id-podiums { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px; }
.id-podium {
  display: flex; flex-direction: column; align-items: center; gap: 6px; text-align: center;
  color: inherit; text-decoration: none; border-top: 6px solid #cbd5e0;
  transition: transform 0.15s, box-shadow 0.15s;
}
.id-podium:hover { transform: translateY(-2px); box-shadow: 0 6px 16px rgba(0, 0, 0, 0.1); }
.id-place-1 { border-top-color: #d69e2e; background: #fffbea; }
.id-place-2 { border-top-color: #a0aec0; }
.id-place-3 { border-top-color: #c05621; }
.id-medal { font-size: 2.4rem; line-height: 1; }
.id-name { font-size: 1.15rem; color: #1a202c; }
.id-points { color: #402D1F; }
.id-points b { font-size: 1.8rem; }
.id-none { grid-column: 1 / -1; text-align: center; }
.id-table td.id-rank { font-weight: 800; white-space: nowrap; }
.pos-grid tr.id-top td { background: #fffbea; }
.pos-grid tr.id-sep td { background: #f7fafc; color: #718096; font-weight: 700; text-align: right; }

/* =========================================================
   اعياد الميلاد (public/js/service/birthdays-page.js): today / next 7 days cards + month list
   ========================================================= */
.bd-cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 14px; }
.bd-list { display: flex; flex-direction: column; gap: 8px; margin-top: 10px; }
.bd-none { padding: 8px 0; }
.bd-card { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border: 1px solid #e2e8f0; border-radius: 10px; color: inherit; text-decoration: none; background: #fff; transition: box-shadow 0.15s; }
.bd-card:hover { box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08); }
.bd-card.bd-today { border-color: #d69e2e; background: #fffbea; }
.bd-day { display: flex; flex-direction: column; align-items: center; min-width: 52px; padding: 4px 6px; border-radius: 8px; background: #f6f0e9; color: #402D1F; line-height: 1.1; }
.bd-day b { font-size: 1.4rem; }
.bd-day small { font-size: 0.75rem; }
.bd-info { display: flex; flex-direction: column; align-items: flex-start; gap: 3px; flex: 1; min-width: 0; }
.bd-info strong { color: #1a202c; }
.bd-phone { font-size: 0.85rem; color: #4a5568; white-space: nowrap; }
.pos-grid tr.bd-row-today td { background: #fffbea; }

/* =========================================================
   الكروت (public/js/service/cards-page.js): every student's QR card, click to pick
   ========================================================= */
.cd-hint { margin: 4px 0 12px; font-size: 0.9rem; }
.cd-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 16px; justify-items: center; }
.cd-empty { grid-column: 1 / -1; }
.cd-item { position: relative; border-radius: 16px; padding: 3px; cursor: pointer; outline: none; transition: box-shadow 0.15s, transform 0.15s; }
.cd-item:hover { transform: translateY(-2px); box-shadow: 0 6px 16px rgba(0, 0, 0, 0.1); }
.cd-item:focus-visible { box-shadow: 0 0 0 3px #d69e2e; }
.cd-item.on { box-shadow: 0 0 0 3px #2f855a; }
.cd-check { position: absolute; top: 10px; right: 10px; width: 24px; height: 24px; border-radius: 50%; border: 2px solid #cbd5e0; background: #fff; color: transparent; display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: 0.85rem; }
.cd-item.on .cd-check { background: #2f855a; border-color: #2f855a; color: #fff; }
.cd-open { position: absolute; top: 8px; left: 10px; text-decoration: none; font-size: 1.1rem; opacity: 0.55; }
.cd-open:hover { opacity: 1; }

/* =========================================================
   تسجيل الحضور: QR scan / manual (public/js/service/attendance-page.js)
   ========================================================= */
.att-modes { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; padding: 4px; border-radius: 12px; background: #f6f0e9; }
.att-mode { padding: 9px 10px; border: 0; border-radius: 9px; background: transparent; font: inherit; font-weight: 700; color: #7a6352; cursor: pointer; }
.att-mode.on { background: #402D1F; color: #fff; }
#mode-scan { display: flex; flex-direction: column; gap: 12px; }
#mode-scan[hidden], #mode-manual[hidden] { display: none; }
.sat-scan-page .sat-scan-card.att-wide { max-width: 820px; }
.att-filters { margin-bottom: 8px; }
.att-bar { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 8px; }
.att-list { display: flex; flex-direction: column; gap: 6px; }
.att-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 8px 12px; border: 1px solid #e2e8f0; border-right: 4px solid #e53e3e; border-radius: 10px; background: #fff; }
.att-row.is-in { border-right-color: #38a169; background: #f0fff4; }
.att-row.att-busy { opacity: 0.55; pointer-events: none; }
.att-who { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.att-who small { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; }
.att-time { color: #2f855a; }
.att-toggle { display: flex; flex-shrink: 0; border: 1px solid #e2e8f0; border-radius: 9px; overflow: hidden; }
.att-toggle button { padding: 7px 12px; border: 0; background: #fff; font: inherit; font-weight: 700; font-size: 0.9rem; color: #718096; cursor: pointer; }
.att-toggle button + button { border-right: 1px solid #e2e8f0; }
.att-toggle .att-in.on { background: #38a169; color: #fff; }
.att-toggle .att-out.on { background: #e53e3e; color: #fff; }
@media (max-width: 520px) {
  .att-row { flex-direction: column; align-items: stretch; }
  .att-toggle button { flex: 1; }
}
#m-service-wrap[hidden] { display: none; }

/* =========================================================
   مدرسة الشمامسة — المواد والدرجات (pages/DeaconsSchool/subjects) + درجات المواد in the full report
   ========================================================= */
.sb-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 10px; margin-top: 10px; }
.sb-item { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 10px 12px; border: 1px solid #e2e8f0; border-right: 4px solid #402D1F; border-radius: 10px; background: #fff; }
.sb-item > div { display: flex; flex-direction: column; gap: 2px; }
.sb-save { display: flex; align-items: center; gap: 10px; }
.sb-score { display: inline-flex; align-items: center; gap: 6px; }
.sb-score input { width: 86px; padding: 6px 8px; border: 1px solid #cbd5e0; border-radius: 8px; font: inherit; text-align: center; }
.sb-score input:focus { outline: none; border-color: #402D1F; box-shadow: 0 0 0 2px rgba(64, 45, 31, 0.15); }
.sb-score input.sb-bad { border-color: #e53e3e; background: #fff5f5; }
.pos-grid tr.sb-changed td { background: #fffbea; }
.pos-grid tr.sb-total td { background: #f6f0e9; font-weight: 700; }
.fr-only { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; cursor: pointer; width: fit-content; }
#view-student[hidden], #view-grades[hidden] { display: none; }
.sb-sheet th small { font-weight: 400; }

/* =========================================================
   شهادة تقدير — المخدوم المثالى (public/js/service/certificate.js): A4 landscape, only it is printed
   ========================================================= */
.id-podium .id-name { text-decoration: none; font-weight: 800; }
.id-podium .id-name:hover { text-decoration: underline; }
.id-cert { margin-top: 4px; }
.id-cert-btn { border: 1px solid #e2e8f0; background: #fff; border-radius: 8px; padding: 3px 8px; cursor: pointer; font-size: 1rem; }
.id-cert-btn:hover { background: #fffbea; border-color: #d69e2e; }
#cert-area { display: none; }
@page cert { size: A4 landscape; margin: 0; }
@media print {
  body.cert-printing > *:not(#cert-area) { display: none !important; }
  body.cert-printing, body.cert-printing.app { background: #fff !important; margin: 0 !important; padding: 0 !important; }
  body.cert-printing #cert-area { display: block; }
}
.cert {
  page: cert;
  width: 297mm; height: 210mm; box-sizing: border-box; padding: 9mm;
  background: #fffaf0; color: #3b2a1a; direction: rtl;
  font-family: "Amiri", "Traditional Arabic", "Times New Roman", serif;
  -webkit-print-color-adjust: exact; print-color-adjust: exact;
}
.cert-frame {
  position: relative; height: 100%; box-sizing: border-box;
  border: 3px solid #b7892b; outline: 1.5px solid #b7892b; outline-offset: -9px;
  box-shadow: inset 0 0 0 12px #fffaf0, inset 0 0 0 13.5px #6b4a2b;
  background: radial-gradient(ellipse at center, #fffdf7 0%, #fdf3df 100%);
  display: flex; flex-direction: column; align-items: center; justify-content: space-between;
  padding: 9mm 22mm 7mm; text-align: center;
}
.cert-corner { position: absolute; width: 22mm; height: 22mm; color: #b7892b; }
.cert-corner svg { width: 100%; height: 100%; }
.cert-tr { top: 5mm; right: 5mm; transform: scaleX(-1); }
.cert-tl { top: 5mm; left: 5mm; }
.cert-br { bottom: 5mm; right: 5mm; transform: scale(-1, -1); }
.cert-bl { bottom: 5mm; left: 5mm; transform: scaleY(-1); }
.cert-head { display: flex; flex-direction: column; align-items: center; gap: 1mm; }
.cert-cross { width: 12mm; height: 12mm; color: #b7892b; }
.cert-church { font-family: "Aref Ruqaa", "Amiri", serif; font-size: 23pt; font-weight: 700; color: #6b4a2b; line-height: 1.2; }
.cert-section { font-size: 15pt; color: #8a6a3f; font-weight: 700; }
.cert-title { margin: 0; padding-bottom: 2mm; font-family: "Aref Ruqaa", "Amiri", serif; font-size: 44pt; line-height: 1.35; color: #b7892b; font-weight: 700; text-shadow: 0 1px 0 #fff; }
.cert-ribbon { padding: 1.5mm 10mm; border-radius: 999px; background: #6b4a2b; color: #fdf3df; font-size: 15pt; font-weight: 700; }
.cert-text { margin: 0; font-size: 15pt; line-height: 1.7; }
.cert-text b { color: #6b4a2b; }
.cert-name {
  font-family: "Aref Ruqaa", "Amiri", serif; font-size: 36pt; font-weight: 700; color: #2c1d10; line-height: 1.4;
  padding: 0 14mm 1.5mm; border-bottom: 1.5px solid #b7892b;
}
.cert-rates { display: flex; gap: 4mm; justify-content: center; }
.cert-rate {
  display: flex; flex-direction: column; align-items: center; min-width: 26mm; padding: 2mm 3mm;
  border: 1.5px solid #d9b56a; border-radius: 3mm; background: #fffdf7; line-height: 1.25;
}
.cert-rate span { font-size: 11pt; color: #8a6a3f; font-weight: 700; }
.cert-rate b { font-size: 19pt; color: #3b2a1a; }
.cert-rate small { font-size: 9.5pt; color: #8a6a3f; }
.cert-verse { margin: 0; font-size: 13.5pt; color: #6b4a2b; font-style: italic; }
.cert-verse small { font-style: normal; font-size: 10pt; }
.cert-foot { width: 100%; display: flex; justify-content: space-between; align-items: flex-end; padding: 0 6mm; }
.cert-sign { display: flex; flex-direction: column; align-items: center; gap: 7mm; width: 62mm; font-size: 13pt; font-weight: 700; color: #6b4a2b; }
.cert-sign i { display: block; width: 100%; border-bottom: 1.2px dotted #6b4a2b; }
.cert-mid { display: flex; flex-direction: column; align-items: center; gap: 1.5mm; }
.cert-seal {
  width: 20mm; height: 20mm; border-radius: 50%; display: flex; flex-direction: column; align-items: center; justify-content: center;
  background: radial-gradient(circle, #e8c66a 0%, #b7892b 70%); color: #fff; border: 2px solid #fff; box-shadow: 0 0 0 1.5px #b7892b;
}
.cert-seal b { font-size: 19pt; line-height: 1; }
.cert-seal small { font-size: 9pt; }
.cert-issued { font-size: 10pt; color: #8a6a3f; }

/* =========================================================
   المستخدمين: students tab + «إنشاء حسابات الطلاب» (pages/Admin/users) and the student welcome page (pages/Student/home)
   ========================================================= */
.us-bar { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 12px; }
.us-bar[hidden] { display: none; }
.us-search { min-width: 240px; padding: 8px 12px; border: 1px solid #cbd5e0; border-radius: 10px; font: inherit; }
.us-creds { width: min(760px, 96vw); }
.us-warn { background: #fffbea; color: #744210; border-color: #f6e05e; line-height: 1.8; }
.us-pass { font-family: Consolas, "Courier New", monospace; font-weight: 800; letter-spacing: 1px; color: #2f855a; }
.us-print { display: none; }
@media print {
  body.us-printing > *:not(#creds-print-area) { display: none !important; }
  body.us-printing #creds-print-area { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; padding: 6mm; }
}
.us-slip { display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 10px; border: 1.5px dashed #402D1F; border-radius: 10px; break-inside: avoid; text-align: center; color: #402D1F; }
.us-slip img { width: 120px; }
.us-slip strong { font-size: 1.05rem; }
.us-slip bdi { font-family: Consolas, "Courier New", monospace; font-weight: 800; }
.us-slip small { color: #7a6352; }
.st-welcome { text-align: center; align-items: center; }
.st-wave { font-size: 3rem; line-height: 1; margin-top: 4px; }
.st-hello { margin: 6px 0 0; color: #7a6352; font-size: 1.1rem; }
.st-name { margin: 2px 0 6px; font-size: 1.8rem; color: #402D1F; }
.st-user { margin: 0 0 14px; color: #718096; }
.st-welcome .btn { width: 100%; }

/* Student page: welcome + their sections (pages/Student/home) */
.st-page { align-items: flex-start; }
.st-wrap { width: min(980px, 100%); margin: 0 auto; padding: 24px 16px 40px; display: flex; flex-direction: column; align-items: center; gap: 16px; box-sizing: border-box; }
.st-wrap .st-welcome { width: min(380px, 100%); }
.st-title { margin: 6px 0 0; color: #402D1F; font-size: 1.3rem; align-self: stretch; text-align: right; }
.st-sections { align-self: stretch; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
@media (max-width: 640px) {
  .st-sections { gap: 10px; }
  .st-section.st-section-name { flex-direction: column; gap: 6px; padding: 16px 10px; text-align: center; }
  .st-section-name strong { font-size: 1.05rem; }
}
.st-empty { text-align: center; color: #718096; }
.st-section { display: flex; flex-direction: column; gap: 12px; border-top: 6px solid var(--sec, #402D1F); text-align: right; }
.st-sec-head { display: flex; align-items: center; gap: 10px; }
.st-sec-head > div { flex: 1; display: flex; flex-direction: column; align-items: flex-start; gap: 4px; }
.st-sec-head strong { font-size: 1.15rem; color: #1a202c; }
.st-sec-icon { font-size: 2rem; line-height: 1; }
.st-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.st-stat { display: flex; flex-direction: column; align-items: center; padding: 8px; border-radius: 10px; background: #f7fafc; }
.st-stat span { font-size: 0.85rem; color: #718096; font-weight: 600; }
.st-stat b { font-size: 1.5rem; color: #402D1F; }
.st-stat small { color: #718096; }
.st-bar { height: 8px; border-radius: 999px; background: #edf2f7; overflow: hidden; }
.st-bar i { display: block; height: 100%; background: var(--sec, #402D1F); border-radius: 999px; }
.st-last { font-size: 0.9rem; color: #4a5568; }
.st-subjects { display: flex; flex-direction: column; gap: 4px; padding-top: 8px; border-top: 1px dashed #e2e8f0; }
.st-sub-title { font-weight: 700; color: #402D1F; margin-bottom: 2px; }
.st-sub { display: flex; justify-content: space-between; font-size: 0.95rem; }
.st-sub small { color: #718096; font-weight: 400; }
.st-sections .card { max-width: none; padding: 20px; }

/* Student page navbar (pages/Student/home) */
.st-page { padding-top: 64px; }
.st-nav {
  position: fixed; top: 0; inset-inline: 0; z-index: 10; height: 64px;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 0 20px; background: #fff; border-bottom: 1px solid #efe6dc; box-shadow: 0 2px 10px rgba(60, 40, 20, 0.06);
}
.st-nav-logo img { height: 40px; width: auto; display: block; }
.st-nav-user { display: flex; align-items: center; gap: 10px; min-width: 0; }
.st-avatar { width: 38px; height: 38px; border-radius: 50%; flex-shrink: 0; display: grid; place-items: center; background: #402D1F; color: #fff; font-weight: 800; font-size: 1.05rem; }
.st-nav-who { display: flex; flex-direction: column; line-height: 1.2; min-width: 0; }
.st-nav-who strong { color: #1a202c; font-size: 0.95rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.st-nav-who bdi { color: #7a6352; font-size: 0.82rem; text-align: right; }
.st-nav-logout { display: inline-flex; align-items: center; gap: 6px; margin-inline-start: 6px; padding: 8px 14px; border: 1px solid #402D1F; border-radius: 8px; background: #fff; color: #402D1F; font: inherit; font-weight: 700; font-size: 0.9rem; cursor: pointer; white-space: nowrap; }
.st-nav-logout:hover { background: #402D1F; color: #fff; }
.st-nav-logout:disabled { opacity: 0.6; }
@media (max-width: 520px) {
  .st-nav { padding: 0 12px; }
  .st-nav-logo img { height: 32px; }
  .st-out-long { display: none; }
  .st-nav-logout { padding: 8px 10px; }
  .st-nav-who strong { max-width: 120px; }
}
.st-nav-logout svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.st-out-short { display: none; }
@media (max-width: 520px) { .st-out-short { display: inline; } }
.st-section.st-section-name { flex-direction: row; align-items: center; gap: 12px; padding: 22px 20px; }
.st-section-name strong { font-size: 1.25rem; color: #1a202c; }

/* Student page: click a section -> my attendance + ratings window */
a.st-section { text-decoration: none; color: inherit; transition: transform 0.15s, box-shadow 0.15s; }
a.st-section:hover { transform: translateY(-2px); box-shadow: 0 8px 22px rgba(60, 40, 20, 0.16); }
a.st-section::after { content: '‹'; margin-inline-start: auto; font-size: 1.6rem; color: #a0aec0; line-height: 1; }
.st-dlg-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 10px; margin-bottom: 10px; }
.st-dlg-h { margin: 18px 0 8px; font-size: 1.05rem; color: #402D1F; }
@media (max-width: 640px) { a.st-section::after { display: none; } }
/* Student section page (pages/Student/section) */
.st-page-head { align-self: stretch; display: flex; flex-direction: column; align-items: flex-start; gap: 6px; }
.st-back { color: #7a6352; text-decoration: none; font-weight: 700; }
.st-back:hover { text-decoration: underline; }
.st-page-title { margin: 0; font-size: 1.6rem; color: #1a202c; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.st-detail { align-self: stretch; display: flex; flex-direction: column; gap: 14px; }
.st-detail .card { max-width: none; padding: 18px; }
.st-block .st-dlg-h:first-child { margin-top: 0; }
.st-detail .st-bar i { background: var(--sec, #402D1F); }

/* Student pages: QR, درجاتى, الامتحانات, الكتب */
.st-hint { align-self: stretch; margin: 0; color: #4a5568; }
.st-qr-grid { align-self: stretch; display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 14px; justify-items: center; }
.st-qr-grid .card { max-width: 320px; }
.st-qr { display: flex; flex-direction: column; align-items: center; gap: 8px; text-align: center; border: 2px solid #402D1F; }
.st-qr-name { font-weight: 800; font-size: 1.15rem; color: #402D1F; }
.st-qr img { width: 220px; height: 220px; }
.st-qr-person { font-size: 1.1rem; color: #1a202c; }
.st-qr-code { font-size: 1.15rem; letter-spacing: 2px; }
.st-soon { align-self: stretch; max-width: none; display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 40px 20px; font-size: 1.05rem; }
.st-soon span { font-size: 3rem; }

/* الكتب: servants upload progress (pages/DeaconsSchool/books) + the student's books (pages/Student/books) */
.bk-progress { position: relative; height: 22px; border-radius: 999px; background: #edf2f7; overflow: hidden; margin-top: 6px; }
.bk-progress[hidden] { display: none; }
.bk-progress i { position: absolute; inset-block: 0; inset-inline-start: 0; width: 0; background: #2f855a; transition: width 0.2s; }
.bk-progress span { position: relative; display: block; text-align: center; font-size: 0.8rem; line-height: 22px; font-weight: 700; color: #1a202c; }
.st-books { align-self: stretch; display: flex; flex-direction: column; gap: 10px; }
.st-books .card { max-width: none; }
.st-book { display: flex; align-items: center; gap: 14px; padding: 16px 18px; }
.st-book-icon { font-size: 2.2rem; line-height: 1; }
.st-book-info { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.st-book-info strong { font-size: 1.1rem; color: #1a202c; }
.st-book-info small { color: #4a5568; }
.st-book-btns { display: flex; gap: 8px; flex-shrink: 0; }
.st-book-btn { padding: 8px 14px; border-radius: 8px; background: #402D1F; color: #fff; text-decoration: none; font-weight: 700; font-size: 0.9rem; white-space: nowrap; }
.st-book-btn:hover { background: #2E1F14; }
.st-book-dl { background: #fff; color: #402D1F; border: 1px solid #402D1F; }
.st-book-dl:hover { background: #f6f0e9; }
@media (max-width: 560px) { .st-book { flex-wrap: wrap; } .st-book-btns { width: 100%; } .st-book-btn { flex: 1; text-align: center; } }

/* PWA install button (login page) */
body.login-page .btn.btn-install { margin-top: 10px; background: #fff; color: #402D1F; border: 1px solid #402D1F; }
body.login-page .btn.btn-install:hover { background: #f6f0e9; }
body.login-page .btn.btn-install[hidden] { display: none; }
