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

body {
  font-family: "Traditional Arabic", "Amiri", "Segoe UI", Tahoma, Arial, sans-serif;
  background: #eef1f5;
  color: #111;
  direction: rtl;
  padding: 15px;
}

/* شريط التحكم */
.toolbar {
  max-width: 210mm;
  margin: 0 auto 14px auto;
  background: #1e293b;
  color: #fff;
  padding: 10px 14px;
  border-radius: 10px;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
}

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

.tab-btn, .action-btn {
  border: none;
  padding: 8px 14px;
  border-radius: 6px;
  font-size: 14px;
  font-weight: bold;
  cursor: pointer;
  transition: 0.2s;
  font-family: inherit;
}

.tab-btn {
  background: #334155;
  color: #e2e8f0;
}

.tab-btn.active {
  background: #d97706;
  color: #fff;
}

.print-btn {
  background: #10b981;
  color: #fff;
}

.print-btn:hover {
  background: #059669;
}

.clear-btn {
  background: #ef4444;
  color: #fff;
}

.clear-btn:hover {
  background: #dc2626;
}

/* ورقة العمل */
.sheet {
  display: none;
  width: 210mm;
  min-height: 297mm;
  margin: 0 auto;
  background: #fff;
  padding: 10mm 10mm;
  border: 2px solid #1e293b;
  border-radius: 6px;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.08);
}

.sheet.page-active {
  display: block;
}

/* الترويسة */
.sheet-header {
  border: 2px solid #1e293b;
  border-radius: 6px;
  padding: 8px 12px;
  margin-bottom: 10px;
  background: #f8fafc;
}

.header-meta, .student-info {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}

.main-title {
  text-align: center;
  font-size: 24px;
  font-weight: 800;
  color: #0f172a;
  margin: 6px 0;
  padding: 3px 0;
  border-top: 1px dashed #94a3b8;
  border-bottom: 1px dashed #94a3b8;
}

.field-group {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 16px;
  font-weight: bold;
}

.field-group.grow {
  flex: 1;
}

.line-input {
  border: none;
  border-bottom: 1.5px dotted #334155;
  background: transparent;
  font-family: inherit;
  font-size: 16px;
  font-weight: bold;
  color: #0f172a;
  padding: 2px 6px;
  min-width: 150px;
  flex: 1;
  outline: none;
}

.line-input.short {
  min-width: 110px;
  flex: 0;
}

/* الجداول */
.table-wrapper {
  width: 100%;
  overflow-x: auto;
}

.tracker-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
  direction: ltr;
}

.tracker-table th,
.tracker-table td {
  border: 1px solid #1e293b;
  text-align: center;
  vertical-align: middle;
  padding: 0;
  user-select: none;
}

/* جدول القرآن */
.quran-table th {
  background: #f1f5f9;
  font-size: 9px;
  font-weight: bold;
  height: 18px;
  color: #0f172a;
}

.quran-table .row-title {
  background: #e2e8f0;
  font-size: 10px;
  font-weight: bold;
  width: 82px;
  direction: rtl;
  padding: 0 3px;
}

.quran-table .surah-cell {
  background: #f8fafc;
  font-size: 9.5px;
  font-weight: bold;
  width: 82px;
  direction: rtl;
  text-align: right;
  padding: 0 4px;
  white-space: nowrap;
  overflow: hidden;
}

.quran-table td.check-box {
  height: 15px;
  cursor: pointer;
  position: relative;
  background: #fff;
}

/* جدول الفجر */
.fajr-table th {
  background: #f1f5f9;
  font-size: 11px;
  font-weight: bold;
  height: 28px;
  color: #0f172a;
}

.fajr-table .row-title {
  background: #e2e8f0;
  font-size: 13px;
  font-weight: bold;
  width: 95px;
  direction: rtl;
}

.fajr-table .month-cell {
  background: #f8fafc;
  font-size: 13px;
  font-weight: bold;
  width: 95px;
  direction: rtl;
  height: 36px;
}

.fajr-table td.check-box {
  height: 36px;
  cursor: pointer;
  position: relative;
  background: #fff;
}

/* مربعات الشطب */
td.check-box:hover {
  background: #fef3c7;
}

td.check-box.checked::after {
  content: "✕";
  font-size: 12px;
  font-weight: 900;
  color: #0f172a;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
}

.fajr-table td.check-box.checked::after {
  font-size: 18px;
}

/* إعدادات الطباعة */
@media print {
  @page {
    size: A4 portrait;
    margin: 6mm;
  }

  body {
    background: #fff;
    padding: 0;
  }

  .no-print {
    display: none !important;
  }

  .sheet {
    display: none !important;
    width: 100%;
    min-height: auto;
    border: none;
    box-shadow: none;
    padding: 0;
    margin: 0;
  }

  .sheet.page-active {
    display: block !important;
  }

  td.check-box:hover {
    background: #fff;
  }
}
