/* منظّمي — المكوّنات والتجاوب
   جزء من index.html قُسِّم في المهمة 0.5؛ لا يُعاد ترتيب الملفات في index.html. */

/* Tags / Chips */
.tag-chip {
  display: inline-flex;
  align-items: center;
  height: 24px;
  padding-inline: 10px;
  border-radius: var(--radius-xs);
  font-size: 0.6875rem;
  font-weight: 500;
  background-color: var(--bg-surface-2);
  color: var(--text-secondary);
  border: 1px solid var(--border-subtle);
  white-space: nowrap;
  cursor: pointer;
  text-decoration: none;
}

.tag-chip.active {
  background-color: var(--accent-subtle-bg);
  color: var(--accent-primary);
  border-color: var(--accent-primary);
}

/* Empty State */
.empty-state {
  border: 2px dashed var(--border-strong);
  border-radius: 16px;
  padding: 48px 24px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-4);
  background-color: transparent;
  margin-block: var(--space-6);
}

.empty-icon-wrap {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background-color: var(--bg-surface-2);
  color: var(--accent-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border-subtle);
}

/* Modals & Dialogs */
.modal-overlay {
  position: fixed;
  inset: 0;
  background-color: rgba(18, 20, 23, 0.65);
  backdrop-filter: blur(3px);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-4);
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition-normal);
}

.modal-overlay.open {
  opacity: 1;
  pointer-events: auto;
}

.modal-container {
  background-color: var(--bg-surface-1);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-modal);
  box-shadow: var(--shadow-modal);
  width: 100%;
  max-width: 560px;
  max-height: 90vh;
  max-height: 90dvh;              /* على الجوال: الارتفاع الظاهر فعلاً (يصغر مع شريط المتصفح ولوحة المفاتيح) */
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transform: scale(0.97);
  transition: transform var(--transition-normal);
}

.modal-overlay.open .modal-container {
  transform: scale(1);
}

.modal-header {
  padding: 16px 24px;
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

/* النموذج بين الرأس والجسم والتذييل: يمتد عمودياً ويسمح للجسم وحده بالتمرير، فيبقى زر الحفظ ظاهراً دائماً. */
.modal-container > form {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
}

.modal-body {
  padding: 24px;
  overflow-y: auto;
  flex: 1 1 auto;
  min-height: 0;
  overscroll-behavior: contain;
}

.modal-header, .modal-footer { flex-shrink: 0; }

.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: var(--space-3);
  background-color: var(--bg-surface-2);
}

/* Toast Container */
.toast-container {
  position: fixed;
  inset-block-end: 24px;
  inset-inline-start: 24px;
  z-index: 300;
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  pointer-events: none;
}

.toast {
  width: 360px;
  padding: 14px 18px;
  border-radius: var(--radius-sm);
  background-color: var(--text-primary);
  color: var(--bg-surface-1);
  box-shadow: var(--shadow-modal);
  display: flex;
  align-items: center;
  gap: var(--space-3);
  border-inline-end: 4px solid var(--accent-primary);
  pointer-events: auto;
  transform: translateX(-16px);
  opacity: 0;
  transition: transform var(--transition-toast), opacity var(--transition-toast);
}

.toast.show {
  transform: translateX(0);
  opacity: 1;
}

.toast.success { border-inline-end-color: var(--semantic-success); }
.toast.danger { border-inline-end-color: var(--semantic-danger); }
.toast.warning { border-inline-end-color: var(--semantic-warning); }

/* Tabs Component */
.tab-bar {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  border-bottom: 1px solid var(--border-subtle);
  margin-bottom: var(--space-6);
  overflow-x: auto;
}

.tab-btn {
  height: 40px;
  padding-inline: 16px;
  background: transparent;
  border: none;
  color: var(--text-secondary);
  font-family: inherit;
  font-size: 0.9375rem;
  font-weight: 500;
  cursor: pointer;
  position: relative;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
}

.tab-btn.active {
  color: var(--accent-primary);
  font-weight: 600;
  background-color: var(--accent-subtle-bg);
  border-radius: 3px 3px 0 0;
}

.tab-btn.active::after {
  content: '';
  position: absolute;
  inset-block-end: 0;
  inset-inline: 0;
  height: 2px;
  background-color: var(--accent-primary);
}

/* Course Detail Page Header */
.course-header-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  margin-bottom: var(--space-6);
  flex-wrap: wrap;
}

.course-badge-color {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  display: inline-block;
}

/* Dropdown/Select Styling */
select.form-control {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%25525866' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: left 12px center;
  padding-inline-end: 36px;
}

/* Table Component */
.data-table-wrapper {
  width: 100%;
  overflow-x: auto;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  background-color: var(--bg-surface-1);
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  text-align: right;
  font-size: 0.875rem;
}

.data-table th, .data-table td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-subtle);
}

.data-table th {
  background-color: var(--bg-surface-2);
  color: var(--text-secondary);
  font-weight: 600;
}

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

/* Drag Drop Area */
.upload-dropzone {
  border: 2px dashed var(--border-strong);
  border-radius: 16px;
  padding: 32px 24px;
  text-align: center;
  cursor: pointer;
  background-color: var(--bg-surface-1);
  transition: border-color var(--transition-fast), background-color var(--transition-fast);
  margin-bottom: var(--space-6);
}

.upload-dropzone.dragover {
  border-color: var(--accent-primary);
  background-color: var(--accent-subtle-bg);
}

/* Color Swatch Picker */
.color-swatches {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin-top: var(--space-1);
}

.color-swatch-opt {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  cursor: pointer;
  border: 2px solid transparent;
  transition: transform var(--transition-fast);
}

.color-swatch-opt.selected {
  border-color: var(--text-primary);
  transform: scale(1.15);
}

/* Skeleton Loading State */
.skeleton {
  background: linear-gradient(90deg, var(--bg-surface-2) 25%, var(--border-subtle) 50%, var(--bg-surface-2) 75%);
  background-size: 200% 100%;
  animation: skeleton-loading 1.5s infinite;
  border-radius: var(--radius-xs);
}

@keyframes skeleton-loading {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* Lightbox Modal */
.lightbox-content {
  max-width: 90vw;
  max-height: 85vh;
  object-fit: contain;
}

/* Search Results Grid */
.search-results-section {
  margin-bottom: var(--space-8);
}

.search-results-section h2 {
  margin-bottom: var(--space-4);
  padding-bottom: var(--space-2);
  border-bottom: 1px solid var(--border-subtle);
}

/* Responsive adjustments */
/* السحب (1.8): التمرير العمودي للمتصفح، والأفقي لإيماءاتنا */
@media (max-width: 1023px) {
  #app-root, [data-swipe] { touch-action: pan-y; }
}

/* ── الهواتف ── */
@media (max-width: 767px) {
  .header-inner {
    flex-wrap: wrap;
  }
  .search-bar-wrapper {
    order: 3;
    max-width: 100%;
    width: 100%;
  }
  .nav-links {
    display: none;
  }
  .mobile-nav {
    display: block;
  }
  main {
    padding-bottom: calc(80px + env(safe-area-inset-bottom));
  }
  /* 100vh في Safari أطول من الجزء الظاهر (خلف شريط العنوان)، فيختفي التذييل؛ dvh هو الظاهر فعلاً. */
  .modal-container {
    max-width: 100%;
    height: 100%;
    max-height: 100vh;
    max-height: 100dvh;
    border-radius: 0;
  }
  .modal-footer { padding-bottom: calc(16px + env(safe-area-inset-bottom)); }
}

/* ── التابلت: شريط تنقل كامل + بحث في سطر مستقل ── */
@media (min-width: 768px) and (max-width: 1100px) {
  .header-inner {
    flex-wrap: wrap;
    row-gap: var(--space-3);
  }
  .search-bar-wrapper {
    order: 3;
    flex: 1 1 100%;
    width: 100%;
    max-width: 100%;
  }
  .grid-courses {
    grid-template-columns: repeat(auto-fill, minmax(255px, 1fr));
  }
  .modal-container {
    max-width: min(680px, 90vw);
  }
}

/* لا يقل ارتفاع أي هدف لمس عن 44px على الأجهزة اللمسية */
@media (hover: none) and (pointer: coarse) {
  .btn, .nav-link, .mobile-nav-item, .tag-chip {
    min-block-size: 44px;
  }
  .btn-sm {
    min-block-size: 38px;
  }
}

/* Weekly Schedule — شبكة أيام × ساعات (1.1ب)، مطابقة للتصميم المرجعي في ROADMAP.md */
.schedule-scroll {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  padding-bottom: 4px;
}
.schedule-grid {
  --schedule-row: 72px;
  display: grid;
  grid-template-columns: 96px repeat(5, minmax(120px, 1fr));
  gap: 4px;
  min-width: 720px;
}
.schedule-corner,
.schedule-day-head,
.schedule-time {
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  background-color: var(--bg-surface-2);
  color: var(--text-primary);
  font-size: 0.8125rem;
  font-weight: 600;
}
.schedule-day-head { padding: 8px 4px; }
.schedule-time { direction: ltr; font-variant-numeric: tabular-nums; }
.schedule-cell {
  border: 1px solid var(--border-subtle);
  border-radius: 6px;
  background-color: var(--bg-surface-1);
  cursor: pointer;
  padding: 0;
}
.schedule-cell:hover { background-color: var(--active-card-bg); }
.schedule-cell:focus-visible,
.schedule-block:focus-visible { outline: 3px solid var(--accent-primary); outline-offset: 2px; }
.schedule-block {
  position: relative;
  z-index: 1;
  margin: 3px;
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.12);
}
/* الزر الرئيسي يغطي البطاقة كلها (تعديل)، وزر ⓘ فوقه في الزاوية (تفاصيل). */
.schedule-block-main {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  width: 100%;
  height: 100%;
  min-height: 44px;
  padding: 30px 8px 8px;
  border: none;
  background: transparent;
  color: #fff;
  font-family: inherit;
  text-align: center;
  cursor: pointer;
}
.schedule-block-badge {
  position: absolute;
  inset-block-start: 6px;
  inset-inline-start: 6px;
  padding: 1px 8px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.85);
  color: #1f2328;
  font-size: 0.75rem;
  font-weight: 600;
}
.schedule-block-info {
  position: absolute;
  inset-block-start: 4px;
  inset-inline-end: 4px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: #fff;
  color: #1f2328;
  font-size: 0.8125rem;
  font-weight: 700;
  font-style: italic;
  font-family: Georgia, serif;
  cursor: pointer;
}
/* هدف لمس أكبر من الدائرة المرئية */
.schedule-block-info::after { content: ''; position: absolute; inset: -9px; }
.schedule-block-main:focus-visible,
.schedule-block-info:focus-visible { outline: 3px solid #fff; outline-offset: -3px; }
.schedule-block-name { font-weight: 600; font-size: 0.875rem; line-height: 1.4; }
.schedule-block-meta { font-size: 0.75rem; opacity: 0.9; }

/* اليوم الحالي والمحاضرة الجارية (1.1ج) */
.schedule-day-head.is-today {
  background-color: var(--accent-primary);
  color: var(--on-accent);
}
.schedule-block.is-now { box-shadow: 0 0 0 3px var(--bg-base), 0 0 0 5px var(--accent-primary); }
.schedule-now-tag { color: var(--accent-primary); font-weight: 700; }

/* الجوال (1.1ج): يوم واحد بتبويبات بدل الشبكة */
.schedule-mobile { display: none; }
.schedule-tabs {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 4px;
  margin-bottom: var(--space-4);
}
.schedule-tab {
  min-height: 44px;
  padding: 6px 2px;
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  background-color: var(--bg-surface-1);
  color: var(--text-secondary);
  font-family: inherit;
  font-size: 0.8125rem;
  font-weight: 600;
  cursor: pointer;
}
.schedule-tab.is-today { border-color: var(--accent-primary); color: var(--accent-primary); }
.schedule-tab.active {
  background-color: var(--accent-primary);
  border-color: var(--accent-primary);
  color: var(--on-accent);
}
.schedule-day-list { display: grid; gap: var(--space-3); }
.schedule-list-item { margin: 0; }
.schedule-list-item .schedule-block-main { min-height: 96px; }
@media (max-width: 767px) {
  .schedule-scroll { display: none; }
  .schedule-mobile { display: block; }
}

/* التذكيرات (1.5أ) */
.reminder-toggle {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  min-height: 44px;
  font-weight: 600;
  cursor: pointer;
}
.reminder-toggle input { width: 18px; height: 18px; accent-color: var(--accent-primary); }
.reminder-fields { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-3); }
.reminder-fields[hidden] { display: none; }
.reminder-chip {
  display: inline-flex;
  align-items: center;
  height: 22px;
  padding-inline: 8px;
  border-radius: var(--radius-xs);
  border: 1px solid var(--border-subtle);
  background-color: var(--bg-surface-2);
  color: var(--text-secondary);
  font-size: 0.6875rem;
  font-weight: 600;
  white-space: nowrap;
}
.reminder-chip.success { color: var(--semantic-success); border-color: var(--semantic-success); background-color: transparent; }
.reminder-chip.warning { color: var(--semantic-warning); border-color: var(--semantic-warning); background-color: transparent; }
.reminder-chip.danger { color: var(--semantic-danger); border-color: var(--semantic-danger); background-color: transparent; }
.reminder-chip.is-next { color: var(--accent-primary); border-color: var(--accent-primary); background-color: var(--accent-subtle-bg); }
.reminder-chip.is-now { color: var(--on-accent); border-color: var(--accent-primary); background-color: var(--accent-primary); }
@media (max-width: 480px) {
  .reminder-fields { grid-template-columns: 1fr; }
}

/* شعار التذكير (1.5ب) — يرث تخطيط .backup-reminder */
.reminder-banner { border-inline-start-color: var(--accent-primary); }
.reminder-banner-content { display: flex; align-items: flex-start; gap: var(--space-3); min-width: 0; }
.reminder-banner-body { color: var(--text-secondary); font-size: 0.875rem; margin-top: 2px; }
.reminder-banner-more {
  display: inline-block;
  margin-inline-start: 6px;
  padding: 0 8px;
  border-radius: 9999px;
  background-color: var(--accent-primary);
  color: var(--on-accent);
  font-size: 0.75rem;
  font-weight: 700;
}
.reminder-banner [hidden] { display: none; }

/* قوائم بنمط الجداول (.data-table): إطار واحد، صفوف بفواصل، وترويسة بخلفية surface-2.
   تستخدمها اللوحة والمواعيد والمدونة بدل بطاقة لكل عنصر. */
.list-panel {
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  background-color: var(--bg-surface-1);
  overflow: hidden;
  margin-bottom: var(--space-4);
}
.list-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
  padding: 10px 16px;
  background-color: var(--bg-surface-2);
  border-bottom: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  font-size: 0.875rem;
  font-weight: 600;
}
.list-head.is-danger { color: var(--semantic-danger); }
.list-row {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-subtle);
  font-size: 0.875rem;
}
.list-row:last-child { border-bottom: none; }
.list-row-main { flex: 1; min-width: 0; }
.list-row-meta {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  flex-wrap: wrap;
  margin-top: 4px;
  color: var(--text-secondary);
  font-size: 0.8125rem;
}
.list-empty { padding: 16px; color: var(--text-muted); font-size: 0.8125rem; line-height: 1.8; }
.list-add {
  display: block;
  width: 100%;
  min-height: 44px;
  border: none;
  border-top: 1px solid var(--border-subtle);
  background: transparent;
  color: var(--accent-primary);
  font-family: inherit;
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
}
.list-add:hover { background-color: var(--accent-subtle-bg); }
.tag-chip.is-static { cursor: default; }
.course-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  margin-inline-end: 6px;
  border-radius: 50%;
  background-color: var(--course-color, var(--text-muted));
  vertical-align: middle;
}

/* عنوان قسم على الصفحة مع رابط جانبي (مثل «أحدث الملفات المرفوعة») */
.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
  margin-bottom: var(--space-4);
}
.section-link { color: var(--accent-primary); font-size: 0.8125rem; text-decoration: none; }
/* الرابط داخل فقرة يتميز بالخط لا باللون وحده (لمن لا يميّز الألوان) */
p a, p .section-link, .type-secondary a, .list-row-meta a { text-decoration: underline; text-underline-offset: 3px; }

/* المواعيد (1.2) */
.task-title { font-weight: 600; overflow-wrap: anywhere; }
.task-check {
  position: relative;
  flex-shrink: 0;
  width: 20px;
  height: 20px;
  border: 2px solid var(--border-strong);
  border-radius: var(--radius-xs);
  background: transparent;
  color: #fff;
  font-size: 0.75rem;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
}
.task-check::after { content: ''; position: absolute; inset: -12px; }
.task-check:hover { border-color: var(--semantic-success); }
.task-row.is-done .task-check { background-color: var(--semantic-success); border-color: var(--semantic-success); }
.task-row.is-done .task-title { text-decoration: line-through; color: var(--text-muted); }

/* لوحة «اليوم» (1.3) */
.today-grid { display: grid; gap: var(--space-6); }
@media (min-width: 1024px) {
  .today-grid { grid-template-columns: 1fr 1fr; align-items: start; }
}
.session-time { flex-shrink: 0; min-width: 44px; color: var(--text-secondary); font-weight: 600; font-variant-numeric: tabular-nums; }
.session-row.is-past { color: var(--text-muted); }
.session-row.is-past .task-title, .session-row.is-past .list-row-meta { color: var(--text-muted); }
.session-row.is-now { background-color: var(--accent-subtle-bg); }
.today-exam {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  flex-wrap: wrap;
  margin-bottom: var(--space-6);
}
.today-exam-countdown { color: var(--accent-primary); font-size: 1.5rem; font-weight: 700; }

/* المدونة: صف لكل تدوينة */
.post-row { display: block; padding: 16px; }
.post-row-head { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--space-3); }
.post-row-actions { display: flex; flex-shrink: 0; flex-wrap: wrap; justify-content: flex-end; }
.post-row-content { margin-top: var(--space-2); white-space: pre-line; color: var(--text-primary); }
@media (max-width: 480px) {
  .post-row-head { flex-direction: column; }
  .post-row-actions { justify-content: flex-start; margin-inline-start: -8px; }
}

.reminder-banner-icon { display: inline-flex; color: var(--accent-primary); }
.task-title .reminder-chip { vertical-align: middle; margin-inline-start: 4px; }

/* التقويم الشهري (1.4): إطار واحد مثل .list-panel وخطوط فاصلة رفيعة */
.calendar-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  flex-wrap: wrap;
  margin-bottom: var(--space-4);
}
.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  margin-bottom: var(--space-6);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  background-color: var(--bg-surface-1);
  overflow: hidden;
}
.calendar-day-head {
  padding: 10px 4px;
  background-color: var(--bg-surface-2);
  border-bottom: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  font-size: 0.8125rem;
  font-weight: 600;
  text-align: center;
}
.calendar-cell {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 4px;
  min-width: 0;
  min-height: 88px;
  padding: 6px;
  border: none;
  border-bottom: 1px solid var(--border-subtle);
  border-inline-end: 1px solid var(--border-subtle);
  background-color: var(--bg-surface-1);
  color: var(--text-primary);
  font-family: inherit;
  text-align: start;
  cursor: pointer;
}
.calendar-grid > :nth-child(7n) { border-inline-end: none; }
.calendar-grid > :nth-last-child(-n + 7) { border-bottom: none; }
.calendar-cell:hover { background-color: var(--bg-surface-2); }
.calendar-cell.is-other { color: var(--text-muted); }
.calendar-cell.is-other .calendar-events { opacity: 0.5; }
.calendar-cell.is-selected { background-color: var(--accent-subtle-bg); }
.calendar-cell.is-today .calendar-gregorian {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 24px;
  height: 24px;
  border-radius: var(--radius-xs);
  background-color: var(--accent-primary);
  color: var(--on-accent);
}
.calendar-dates { display: flex; align-items: baseline; justify-content: space-between; gap: 4px; }
.calendar-gregorian { font-size: 0.875rem; font-weight: 700; }
.calendar-hijri { font-size: 0.6875rem; color: var(--text-muted); }
.calendar-events { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.calendar-event {
  display: flex;
  align-items: center;
  min-width: 0;
  color: var(--text-secondary);
  font-size: 0.6875rem;
  line-height: 1.5;
}
.calendar-event .course-dot { flex-shrink: 0; margin-inline-end: 4px; }
.calendar-event-title { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.calendar-event.is-done { color: var(--text-muted); text-decoration: line-through; }
.calendar-event.is-overdue { color: var(--semantic-danger); }
.calendar-more { color: var(--accent-primary); font-size: 0.6875rem; font-weight: 600; }
@media (max-width: 767px) {
  .calendar-cell { min-height: 56px; padding: 4px 2px; align-items: center; }
  .calendar-dates { flex-direction: column; align-items: center; gap: 0; line-height: 1.2; }
  .calendar-events { flex-direction: row; flex-wrap: wrap; justify-content: center; gap: 2px; }
  .calendar-event-title, .calendar-more { display: none; }
  .calendar-event .course-dot { margin: 0; }
}

/* ترويسة مجموعة قابلة للطي داخل .list-panel (1.7) */
.list-toggle { width: 100%; border: none; border-top: 1px solid var(--border-subtle); font-family: inherit; cursor: pointer; min-height: 44px; }
.list-toggle:first-child { border-top: none; }
.list-toggle::after { content: '+'; margin-inline-start: var(--space-2); font-weight: 700; }
.list-toggle[aria-expanded="true"]::after { content: '−'; }
.list-toggle + [hidden] { display: none; }
@media (max-width: 480px) {
  .tab-bar .tab-btn { padding-inline: 10px; font-size: 0.875rem; }
  .tab-bar .tab-btn svg { display: none; }
}

/* Safari على الآيفون يكبّر الصفحة كلها عند التركيز على خانة خطها أقل من 16px ويصعب إرجاعها؛
   على شاشات اللمس لا تقل خانات الكتابة عن 16px (حتى مع تصغير حجم الواجهة). */
@media (pointer: coarse) {
  input:not([type="checkbox"]):not([type="radio"]):not([type="range"]), select, textarea {
    font-size: max(16px, 1em);
  }
}
