/* الألوان والخط والمقاسات في tokens.css (يُحمَّل قبل هذا الملف) */

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font);
  font-size: 17px;
  line-height: 1.7;
}

a { color: var(--green-2); }
:focus-visible { outline: none; box-shadow: var(--focus); border-radius: 6px; }
input, select, button, textarea { font: inherit; }

/* الشريط العلوي */
.bar {
  background: var(--green);
  border-bottom: 3px solid var(--gold);
}
.bar-in {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 2px 12px;
  max-width: 900px;
  margin: 0 auto;
  padding: 12px 16px;
  color: #fff;
  text-decoration: none;
}
.bar-center { font-weight: 700; font-size: 1.1rem; }
.bar-college { color: #e9d9a8; font-size: .9rem; }

.wrap {
  max-width: 900px;
  margin: 0 auto;
  padding: 20px 16px 8px;
}

.h-page { margin: 0; font-size: 1.5rem; line-height: 1.4; }
.h-sec { margin: 32px 0 12px; font-size: 1.15rem; color: var(--green); }

/* ترويسة القسم / التبليغ */
.head {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 14px;
}
.head-logo { width: 84px; height: 84px; display: block; flex: none; }
.head-dept { margin: 0; color: var(--muted); }

.meta {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 18px;
  margin: 0 0 16px;
  color: var(--muted);
  font-size: .92rem;
}

.switch {
  margin: 0 0 16px;
  padding: 10px 14px;
  background: #fbf6e6;
  border: 1px solid #ecdcae;
  border-radius: 10px;
  font-size: .92rem;
}
.switch a { display: inline-block; font-weight: 700; white-space: nowrap; }

.body {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 14px 16px;
  margin-bottom: 16px;
}

/* شبكة الأقسام */
.grid {
  list-style: none;
  margin: 16px 0 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 12px;
}
.tile {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  height: 100%;
  padding: 14px 8px 12px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  color: var(--ink);
  text-decoration: none;
  text-align: center;
  font-weight: 600;
  font-size: .95rem;
  line-height: 1.5;
}
.tile img { width: 100%; max-width: 120px; height: auto; }
.tile, .row { transition: box-shadow .15s, border-color .15s, transform .15s; }
.tile:hover, .tile:focus-visible, .row:hover, .row:focus-visible { border-color: var(--gold); box-shadow: var(--shadow-up); transform: translateY(-1px); }

/* القوائم */
.list { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.row {
  display: block;
  padding: 12px 16px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow);
  color: var(--ink);
  text-decoration: none;
}
.row-big { border-inline-start: 5px solid var(--green); }
.row-title { display: block; font-weight: 700; }
.row-meta { display: block; color: var(--muted); font-size: .88rem; }

.tag {
  display: inline-block;
  padding: 0 8px;
  border-radius: 99px;
  background: #e8efe9;
  color: var(--green);
  font-size: .8rem;
  font-weight: 600;
}
.tag-urgent { background: #f7e3df; color: #9b2c1c; }

/* صور الجدول */
.sheet {
  margin: 0 -16px 18px;
  background: var(--card);
  border-block: 1px solid var(--line);
}
.sheet img { display: block; width: 100%; height: auto; }
.sheet figcaption {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  color: var(--muted);
  font-size: .9rem;
}
.btn {
  margin-inline-start: auto;
  padding: 6px 16px;
  border-radius: var(--radius-sm);
  background: var(--green);
  color: #fff;
  text-decoration: none;
  font-weight: 600;
  transition: background .12s;
}
.btn:hover { background: var(--brand-2); }

@media (min-width: 640px) {
  .sheet { margin-inline: 0; border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
}

.empty { color: var(--muted); }
/* شريط التنقل السفلي: روابط هادئة بحجم مريح للإصبع، لا أزرار ممتلئة */
.back { display: flex; flex-wrap: wrap; gap: 10px; margin: 28px 0 0; font-size: .95rem; }
.back a {
  display: inline-flex; align-items: center; min-height: 44px; padding: 6px 18px;
  background: var(--card); border: 1px solid var(--line); border-radius: 99px;
  color: var(--green); text-decoration: none; font-weight: 600;
}
.back a:hover, .back a:focus-visible { border-color: var(--gold); background: #fffdf7; }
.back-center { justify-content: center; margin-top: 14px; }

.foot {
  max-width: 900px;
  margin: 24px auto 0;
  padding: 16px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: .85rem;
  text-align: center;
}

/* بطاقة الجدول بصورة مصغرة */
.row-thumb { display: flex; align-items: center; gap: 14px; padding: 12px; }
.row-thumb img {
  flex: none; width: 132px; height: auto; max-height: 190px; object-fit: cover; object-position: top;
  border: 1px solid var(--line); border-radius: 6px; background: #fff;
}
.row-text { display: grid; gap: 4px; justify-items: start; }
.row-cta { margin: 6px 0 0; }
.switch .btn { margin: 6px 0 0; white-space: normal; }

/* ترويسة التبليغ: الشعار والعنوان في جهة، والبيانات وزر التبديل في الجهة المقابلة */
.head-title { flex: 1 1 auto; min-width: 0; }
.head-side {
  flex: none; display: grid; gap: 2px; justify-items: end; text-align: end;
  color: var(--muted); font-size: .92rem;
}
.head-side .btn { margin: 6px 0 0; }
.hint-line { margin: -4px 0 14px; color: var(--muted); font-size: .88rem; }
@media (max-width: 560px) {
  .head { flex-wrap: wrap; }
  .head-side { flex: 1 1 100%; justify-items: start; text-align: start; }
}

/* الجدول الذي انقضت مدته (ends في meta.json): وسم صغير وتنبيه فوق الصورة */
.stale { display: inline-block; padding: 1px 10px; border-radius: 99px; background: var(--warn-bg); color: var(--warn); font-size: .8rem; font-weight: 700; line-height: 1.6; vertical-align: middle; }
.stale-note { margin: 0 0 14px; padding: 10px 16px; border-radius: var(--radius-sm); border: 1px solid #ecd9b4; background: var(--warn-bg); color: var(--warn); font-weight: 600; line-height: 1.7; }
.stale-center { margin: 18px auto 0; max-width: 640px; text-align: center; }

.head-btns { display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; margin-top: 6px; }
.head-btns .btn { margin: 0; }
.btn-ghost { background: #fff; color: var(--green); box-shadow: inset 0 0 0 1.5px var(--green); }
@media (max-width: 560px) { .head-btns { justify-content: flex-start; } }

/* عارض الصورة فوق الصفحة */
.sheet > a { cursor: zoom-in; display: block; }
html.viewer-open { overflow: hidden; }
.viewer { position: fixed; inset: 0; z-index: 100; display: flex; flex-direction: column; background: rgba(12, 22, 18, .96); }
.viewer-bar { flex: none; display: flex; justify-content: space-between; gap: 10px; padding: 10px 12px; }
.viewer-bar button {
  min-height: 44px; padding: 6px 18px; border: 0; border-radius: 99px;
  font: inherit; font-weight: 700; cursor: pointer;
}
.viewer-close { background: #fff; color: #1d2a26; }
.viewer-zoom { background: rgba(255, 255, 255, .16); color: #fff; }
.viewer-stage { flex: 1; overflow: auto; display: flex; direction: ltr; user-select: none; -webkit-overflow-scrolling: touch; overscroll-behavior: contain; }
.viewer-stage img { margin: auto; max-width: 100%; max-height: 100%; height: auto; width: auto; background: #fff; cursor: zoom-in; }
.viewer-stage.zoomed img { max-width: none; max-height: none; width: max(100%, 1400px); cursor: grab; }
.viewer-stage.dragging img { cursor: grabbing; }

/* زر الحفظ/المشاركة على الهاتف بجانب زر التنزيل */
button.btn-share { border: 0; font: inherit; font-weight: 600; cursor: pointer; }
.sheet figcaption .btn-share { margin-inline-start: auto; }
.sheet figcaption .btn-share + .btn { margin-inline-start: 0; }
