/* منصة المركز الإعلامي — حسب دليل هوية شركة الرواد للتعليم ومدارس الرواد */

/* خط الهوية «ميسون»: ضع ملفات الخط المرخّصة (woff2) في assets/fonts بهذه الأسماء ليُستخدم تلقائيًا،
   وإلا يُستخدم خط Tajawal البديل. */
@font-face { font-family: "Mayson"; src: url("../fonts/Mayson-Regular.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Mayson"; src: url("../fonts/Mayson-Medium.woff2") format("woff2"); font-weight: 500; font-display: swap; }
@font-face { font-family: "Mayson"; src: url("../fonts/Mayson-Bold.woff2") format("woff2"); font-weight: 700 800; font-display: swap; }
@font-face { font-family: "Mayson"; src: url("../fonts/Mayson-Extrabold.woff2") format("woff2"); font-weight: 900; font-display: swap; }

:root {
  /* الألوان الأساسية */
  --navy: #2e446d;
  --brand-green: #008d45;
  --lime: #89b840;
  /* الألوان الداعمة */
  --mint: #b6dec2;
  --navy-2: #0f395a;
  --teal: #046971;
  --teal-2: #22859a;
  --aqua: #28afae;
  --ocean: #085e88;

  --gold: var(--lime);           /* لون التمييز */
  --gold-soft: #eef7f0;
  --bg: #f3f6f8;
  --card: #ffffff;
  --soft: #eef4f6;
  --ink: #1f2a3a;
  --muted: #5d6b7c;
  --line: #dde6ec;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(46, 68, 109, .06), 0 4px 16px rgba(46, 68, 109, .05);

  --blue: #085e88;   --blue-bg: #e4f0f7;
  --green: #00783b;  --green-bg: #e3f4e8;
  --amber: #a35a00;  --amber-bg: #fdf0db;
  --purple: #6a3fc8; --purple-bg: #efe9fc;
  --gray: #4b5563;   --gray-bg: #eceff3;
  --red: #b42318;    --red-bg: #fdecea;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font-family: "Mayson", "Tajawal", "Geeza Pro", "Segoe UI", Tahoma, sans-serif;
  font-size: 15px; line-height: 1.65;
}
a { color: var(--teal); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { margin: 0; line-height: 1.35; color: var(--navy); }
p { margin: 0 0 .6em; }
code { background: var(--soft); padding: 1px 6px; border-radius: 5px; direction: ltr; display: inline-block; }
.ic { width: 18px; height: 18px; flex: none; vertical-align: -3px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.strong { font-weight: 700; color: var(--navy); }
.center { text-align: center; }
.nowrap { white-space: nowrap; }
.t-start { text-align: start; }
.t-end { text-align: end; }

/* ---------- الهيكل ---------- */
.shell { display: flex; min-height: 100vh; }
.side {
  width: 250px; flex: none; position: sticky; top: 0; height: 100vh; overflow-y: auto;
  background: linear-gradient(170deg, var(--navy) 0%, var(--navy-2) 60%, var(--teal) 130%);
  color: #fff; display: flex; flex-direction: column; padding: 22px 14px 16px;
}
.side-logo { text-align: center; padding: 4px 10px 6px; }
.side-logo img { width: 84px; height: auto; }
.side-app { text-align: center; font-weight: 700; font-size: 14px; opacity: .85; padding-bottom: 16px; margin-bottom: 12px; border-bottom: 1px solid rgba(255,255,255,.14); }
.nav { display: flex; flex-direction: column; gap: 3px; }
.nav a {
  display: flex; align-items: center; gap: 11px; padding: 10px 13px; border-radius: 10px;
  color: rgba(255,255,255,.86); font-weight: 500; text-decoration: none; transition: background .15s;
}
.nav a:hover { background: rgba(255,255,255,.09); color: #fff; }
.nav a.on { background: #fff; color: var(--navy); font-weight: 800; box-shadow: inset -4px 0 0 var(--gold); }
.side-user { margin-top: auto; padding-top: 14px; border-top: 1px solid rgba(255,255,255,.14); }
.who { display: flex; flex-direction: column; padding: 0 6px 10px; }
.who b { font-size: 14px; }
.who span { font-size: 12px; color: var(--gold); font-weight: 700; }
.side-links { display: flex; gap: 6px; }
.side-links a, .side-links button {
  flex: 1; display: flex; align-items: center; justify-content: center; gap: 6px;
  background: rgba(255,255,255,.09); color: #fff; border: 0; border-radius: 9px; padding: 8px;
  font: inherit; font-size: 13px; cursor: pointer; text-decoration: none;
}
.side-links form { flex: 1; display: flex; }
.side-links a:hover, .side-links button:hover, .side-links a.on { background: rgba(255,255,255,.18); }
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar { display: none; }
.content { padding: 26px 30px 60px; max-width: 1320px; width: 100%; }
.content.bare { padding: 0; max-width: none; }
.side-backdrop { display: none; }

/* ---------- عنوان الصفحة ---------- */
.ptitle { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 20px; }
.ptitle h1 { font-size: 26px; font-weight: 900; }
.ptitle p { color: var(--muted); margin: 4px 0 0; }
.pactions { display: flex; gap: 8px; flex-wrap: wrap; }

/* ---------- البطاقات ---------- */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; margin-bottom: 18px; box-shadow: var(--shadow); }
.card.narrow { max-width: 820px; }
.card-h { font-size: 17px; font-weight: 800; display: flex; align-items: center; gap: 8px; margin-bottom: 12px; }
.card-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; flex-wrap: wrap; }
.card-top .card-h { margin: 0; }
.card.note { background: var(--gold-soft); border-color: #b6dec2; box-shadow: none; }
.card.note ul, .card.note ol { margin: 8px 0 0; padding-inline-start: 20px; }
.empty { text-align: center; padding: 30px 10px; color: var(--muted); }
.empty.sm { padding: 16px 0; }
.empty h3 { margin-bottom: 8px; }
.grid-2 { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 0 18px; }
.grid-2.top { gap: 18px; align-items: start; }
.grid-2.top > .card { margin-bottom: 0; }
.grid-2.top { margin-bottom: 18px; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 18px; }
.grid-3 .span-3 { grid-column: 1 / -1; }
.grid-side { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 18px; align-items: start; }

/* ---------- المؤشرات ---------- */
.kpis { display: grid; grid-template-columns: repeat(5, 1fr); gap: 14px; margin-bottom: 18px; }
.kpis.sm { grid-template-columns: repeat(4, 1fr); }
.kpi { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; box-shadow: var(--shadow); position: relative; overflow: hidden; }
.kpi span { display: block; color: var(--muted); font-size: 13px; font-weight: 700; }
.kpi b { display: block; font-size: 30px; font-weight: 900; color: var(--navy); line-height: 1.25; margin: 2px 0; }
.kpi b em { font-style: normal; font-size: 17px; color: var(--muted); font-weight: 700; }
.kpi small { color: var(--muted); font-size: 12.5px; }
.kpi.accent { background: linear-gradient(140deg, var(--navy), var(--teal)); border: 0; }
.kpi.accent span, .kpi.accent small { color: rgba(255,255,255,.82); }
.kpi.accent b { color: #fff; }
.kpi.warn b { color: var(--red); }
.kpi .bar { display: block; height: 5px; background: rgba(127,140,155,.18); border-radius: 4px; margin-top: 8px; overflow: hidden; }
.kpi .bar i { display: block; height: 100%; background: var(--gold); border-radius: 4px; }
.mini-kpis { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 14px; }
.mini-kpis div { background: var(--soft); border-radius: 10px; padding: 10px; text-align: center; }
.mini-kpis b { display: block; font-size: 22px; color: var(--navy); font-weight: 900; }
.mini-kpis span { font-size: 12.5px; color: var(--muted); }

.attention { border-color: #f3c6c1; background: linear-gradient(180deg, #fff, #fffafa); }
.attention .card-h { color: var(--red); }
.att-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 16px; }
.att-grid h4 { font-size: 14px; margin-bottom: 6px; }
.att-grid ul, .mini-list, .up-list { list-style: none; margin: 0; padding: 0; }
.att-grid li, .mini-list li { display: flex; flex-direction: column; padding: 7px 0; border-bottom: 1px dashed var(--line); }
.att-grid li:last-child, .mini-list li:last-child { border-bottom: 0; }
.att-grid li a, .mini-list li a { font-weight: 700; color: var(--ink); }
.att-grid li span, .mini-list li span { font-size: 12.5px; color: var(--muted); }

.up-list li a { display: flex; align-items: center; gap: 12px; padding: 8px 4px; border-bottom: 1px solid var(--line); color: var(--ink); text-decoration: none; }
.up-list li:last-child a { border-bottom: 0; }
.up-list li a:hover { background: var(--soft); }
.up-d { width: 48px; flex: none; text-align: center; font-size: 11.5px; color: var(--muted); line-height: 1.2; }
.up-d b { display: block; font-size: 20px; color: var(--navy); }
.up-t { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.up-t b { font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.up-t small { color: var(--muted); display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }

.hbars { display: flex; flex-direction: column; gap: 9px; }
.hb { display: grid; grid-template-columns: 130px 1fr 62px; align-items: center; gap: 10px; font-size: 13.5px; }
.hb-l { font-weight: 700; color: var(--ink); }
.hb-track { height: 12px; background: var(--soft); border-radius: 6px; overflow: hidden; }
.hb-fill { display: block; height: 100%; background: linear-gradient(90deg, var(--teal), var(--navy)); border-radius: 6px; min-width: 2px; }
.hb-n { font-weight: 800; color: var(--navy); display: flex; align-items: baseline; gap: 6px; }
.hb-n small { color: var(--muted); font-weight: 500; margin-inline-start: 4px; }
.note-sm { margin-top: 12px; font-size: 13px; background: var(--gold-soft); border-radius: 8px; padding: 8px 12px; }

.meter { display: inline-block; width: 70px; height: 8px; background: var(--soft); border-radius: 5px; overflow: hidden; vertical-align: middle; margin-inline-end: 4px; }
.meter i { display: block; height: 100%; border-radius: 5px; }
.meter.good i { background: var(--green); } .meter.mid i { background: var(--gold); } .meter.low i { background: var(--red); }

/* ---------- الجداول ---------- */
.tbl { width: 100%; border-collapse: collapse; font-size: 14px; }
.tbl th { text-align: start; font-size: 12.5px; color: var(--muted); font-weight: 800; padding: 9px 10px; border-bottom: 2px solid var(--line); white-space: nowrap; }
.tbl td { padding: 11px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl tbody tr:hover td { background: #f8fbfc; }
.tbl tr.dim td { opacity: .55; }
.tbl input:not([type=checkbox]) { min-width: 0; }
.ok { color: var(--green); font-weight: 700; display: inline-flex; align-items: center; gap: 4px; margin-inline-end: 8px; }

/* ---------- الشارات ---------- */
.badge { display: inline-block; font-size: 12px; font-weight: 700; padding: 2px 10px; border-radius: 20px; white-space: nowrap; line-height: 1.7; }
.b-blue { background: var(--blue-bg); color: var(--blue); }
.b-green { background: var(--green-bg); color: var(--green); }
.b-amber { background: var(--amber-bg); color: var(--amber); }
.b-purple { background: var(--purple-bg); color: var(--purple); }
.b-gray { background: var(--gray-bg); color: var(--gray); }
.b-red { background: var(--red-bg); color: var(--red); }
.dom { display: inline-block; font-size: 12.5px; font-weight: 700; padding: 1px 9px; border-radius: 6px; background: var(--soft); color: var(--navy); border-inline-start: 3px solid var(--teal); white-space: nowrap; }
.d-values { border-color: #1f7a8c; } .d-culture { border-color: #7c3aed; } .d-science { border-color: #0ea5e9; } .d-english { border-color: #db2777; }
.d-sports { border-color: #16a34a; } .d-arts { border-color: #f59e0b; } .d-community { border-color: #64748b; } .d-talents { border-color: #d4a017; }
.pfs { display: inline-flex; gap: 3px; flex-wrap: wrap; vertical-align: middle; }
.pf { display: inline-flex; align-items: center; justify-content: center; min-width: 22px; height: 20px; padding: 0 4px; border-radius: 5px; font: 800 10.5px/1 system-ui, sans-serif; direction: ltr; }

/* ---------- الأزرار ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  padding: 9px 16px; border-radius: 10px; border: 1px solid var(--line); background: #fff; color: var(--navy);
  font: inherit; font-weight: 700; font-size: 14px; cursor: pointer; text-decoration: none; white-space: nowrap; transition: .15s;
}
.btn:hover { text-decoration: none; border-color: var(--teal); background: var(--soft); }
.btn-primary { background: var(--navy); border-color: var(--navy); color: #fff; box-shadow: inset 0 -3px 0 var(--gold); }
.btn-primary:hover { background: var(--navy-2); border-color: var(--navy-2); color: #fff; }
.btn-ghost { background: transparent; }
.btn-danger { color: var(--red); border-color: #f1c0bb; }
.btn-danger:hover { background: var(--red-bg); border-color: var(--red); }
.btn-sm { padding: 5px 11px; font-size: 13px; border-radius: 8px; }
.btn.block { width: 100%; }
.danger-zone { margin-top: 10px; }

/* ---------- النماذج ---------- */
.form { display: flex; flex-direction: column; gap: 4px; }
.field { display: flex; flex-direction: column; gap: 5px; margin-bottom: 12px; border: 0; padding: 0; min-width: 0; }
.field > span { font-weight: 700; font-size: 13.5px; color: var(--navy); }
input, select, textarea {
  font: inherit; color: var(--ink); background: #fff; width: 100%;
  border: 1px solid #c9d8e1; border-radius: 10px; padding: 9px 12px; transition: border .15s, box-shadow .15s;
}
textarea { resize: vertical; line-height: 1.7; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--teal); box-shadow: 0 0 0 3px rgba(31,122,140,.15); }
input[type=checkbox], input[type=radio] { width: auto; accent-color: var(--navy); }
.in-sm { width: 70px; }
.chk { display: inline-flex; align-items: center; gap: 8px; font-weight: 500; cursor: pointer; }
.chk.boxed { display: flex; background: var(--soft); border-radius: 10px; padding: 11px 14px; margin-bottom: 10px; }
.chk.boxed.gold { background: var(--gold-soft); border: 1px solid #b6dec2; }
.checks { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 8px; }
.checks .chk { background: var(--soft); border-radius: 9px; padding: 8px 12px; }
.form-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; }
.row-form { flex-direction: row; align-items: flex-end; gap: 12px; flex-wrap: wrap; }
.row-form .field { flex: 1; min-width: 170px; margin: 0; }
.row-form .field.sm { flex: 0 0 90px; min-width: 90px; }

.filters { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 10px; }
.filters .field { margin: 0; min-width: 130px; flex: 0 1 160px; }
.filters .field.grow { flex: 1 1 200px; }
.filters.inline { align-items: center; }
.filters.inline select { width: auto; padding: 7px 10px; }

.seg { display: flex; background: var(--soft); border-radius: 12px; padding: 4px; margin-bottom: 16px; }
.seg label { flex: 1; text-align: center; padding: 9px; border-radius: 9px; font-weight: 700; cursor: pointer; color: var(--muted); }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg label:has(input:checked) { background: #fff; color: var(--navy); box-shadow: var(--shadow); }

.upload { display: flex; flex-direction: column; align-items: center; gap: 4px; border: 2px dashed #b9cdd8; border-radius: 12px; padding: 20px; text-align: center; cursor: pointer; background: #fafcfd; color: var(--teal); position: relative; }
.upload:hover { border-color: var(--teal); background: var(--soft); }
.upload input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.upload .ic { width: 30px; height: 30px; }
.upload small { color: var(--muted); }

.pf-picks { display: flex; flex-wrap: wrap; gap: 8px; }
.pf-pick { display: inline-flex; align-items: center; gap: 7px; border: 1px solid var(--line); border-radius: 10px; padding: 7px 12px; cursor: pointer; font-weight: 500; background: #fff; }
.pf-pick:has(input:checked) { border-color: var(--navy); background: var(--soft); box-shadow: inset 0 0 0 1px var(--navy); }

.status-flow { display: flex; flex-wrap: wrap; gap: 6px; }
.sf { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 20px; font-weight: 700; font-size: 13px; cursor: pointer; border: 1px solid transparent; }
.sf input { margin: 0; }
.sf.locked { opacity: .45; cursor: not-allowed; }
.sf-gray { background: var(--gray-bg); color: var(--gray); }
.sf-amber { background: var(--amber-bg); color: var(--amber); }
.sf-purple { background: var(--purple-bg); color: var(--purple); }
.sf-blue { background: var(--blue-bg); color: var(--blue); }
.sf-green { background: var(--green-bg); color: var(--green); }
.sf-red { background: var(--red-bg); color: var(--red); }
.sf:has(input:checked) { border-color: currentColor; }
.flow-help { padding-inline-start: 18px; margin: 8px 0 0; font-size: 13.5px; }
.flow-help li { margin-bottom: 4px; }

.dl { display: grid; grid-template-columns: 120px 1fr; gap: 8px 14px; margin: 0; }
.dl dt { color: var(--muted); font-weight: 700; font-size: 13.5px; }
.dl dd { margin: 0; }
.dl.sm { grid-template-columns: 90px 1fr; font-size: 13.5px; }

/* ---------- الصور ---------- */
.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; }
.gallery.sm { grid-template-columns: repeat(3, 1fr); gap: 6px; margin-bottom: 10px; }
.gallery img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 10px; display: block; background: var(--soft); }
.ph { position: relative; }
.ph form { position: absolute; top: 6px; left: 6px; }
.ph-del { background: rgba(255,255,255,.92); border: 0; border-radius: 8px; padding: 5px; color: var(--red); cursor: pointer; display: flex; }

/* ---------- الرسائل ---------- */
.flash { padding: 11px 16px; border-radius: 10px; margin-bottom: 14px; font-weight: 500; border: 1px solid; }
.f-success { background: var(--green-bg); color: #0f5e2c; border-color: #b8e2c5; }
.f-error { background: var(--red-bg); color: #8d1b12; border-color: #f3c6c1; }
.f-info { background: var(--blue-bg); color: #17468f; border-color: #c4d7fa; }

/* ---------- التقويم ---------- */
.cal-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding: 12px 16px; }
.month-nav { display: flex; align-items: center; gap: 8px; }
.month-nav h2 { font-size: 20px; font-weight: 900; min-width: 150px; text-align: center; }
.view-switch { display: flex; background: var(--soft); border-radius: 10px; padding: 3px; }
.view-switch a { padding: 6px 14px; border-radius: 8px; font-weight: 700; color: var(--muted); text-decoration: none; font-size: 14px; }
.view-switch a.on { background: #fff; color: var(--navy); box-shadow: var(--shadow); }
.toggle { text-decoration: none !important; color: var(--muted); font-size: 14px; }
.toggle .tg { width: 32px; height: 18px; border-radius: 10px; background: #c9d8e1; position: relative; transition: .15s; }
.toggle .tg::after { content: ""; position: absolute; top: 2px; right: 2px; width: 14px; height: 14px; border-radius: 50%; background: #fff; transition: .15s; }
.toggle.on { color: var(--navy); }
.toggle.on .tg { background: var(--teal); }
.toggle.on .tg::after { right: 16px; }

.status-strip { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.ss { display: inline-flex; align-items: center; gap: 6px; padding: 6px 13px; border-radius: 20px; font-size: 13px; font-weight: 700; text-decoration: none !important; border: 1px solid transparent; }
.ss b { font-size: 15px; }
.ss.on { border-color: currentColor; }

.cal { padding: 0; overflow: hidden; }
.cal-head, .cal-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); }
.cal-head div { padding: 10px; font-weight: 800; font-size: 13px; color: var(--navy); text-align: center; background: var(--soft); border-bottom: 1px solid var(--line); }
.cal-head div.wk { color: var(--muted); }
.day { min-height: 118px; border-inline-start: 1px solid var(--line); border-bottom: 1px solid var(--line); padding: 6px; display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.day:nth-child(7n+1) { border-inline-start: 0; }
.day.out { background: #fafbfc; }
.day.out .dn { color: #b4c0ca; }
.day.wk { background: #fbfcfd; }
.day.today { background: #fffbf0; box-shadow: inset 0 3px 0 var(--gold); }
.day-h { display: flex; align-items: center; justify-content: space-between; }
.dn { font-weight: 800; font-size: 14px; color: var(--navy); width: 26px; height: 26px; display: flex; align-items: center; justify-content: center; border-radius: 50%; }
.day.today .dn { background: var(--navy); color: #fff; }
.dname { display: none; }
.add { opacity: 0; color: var(--teal); padding: 2px; border-radius: 6px; display: flex; }
.day:hover .add { opacity: 1; }
.add:hover { background: var(--soft); }
.ev { display: block; border-radius: 7px; padding: 4px 7px; font-size: 12.5px; text-decoration: none !important; line-height: 1.4; border: 1px solid transparent; min-width: 0; }
.ev:hover { filter: brightness(.96); }
.ev-t { display: block; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ev-m { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; margin-top: 2px; }
.ev-m .pf { min-width: 18px; height: 16px; font-size: 9px; }
.ev-m .muted.small { font-size: 10.5px; }
.ev-b { font-size: 10.5px; opacity: .8; }
.ev.prog { background: #fff; border: 1px dashed #9fb7c5; color: var(--navy); }
.ev.prog .ev-b { display: block; }
.ev.late { border-color: var(--red) !important; box-shadow: 0 0 0 1px var(--red); }
.ev.mini { display: inline-block; padding: 0 6px; }
.legend { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: -6px; }
.late-key { border: 2px solid var(--red); border-radius: 5px; padding: 0 5px; }

.submit-strip { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.sub-chip { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 20px; background: #fff; border: 1px solid var(--line); color: var(--muted); font-weight: 700; font-size: 13px; text-decoration: none !important; }
.sub-chip .dot { width: 8px; height: 8px; border-radius: 50%; background: #c9d3db; display: inline-block; }
.sub-chip.ok { color: var(--green); background: var(--green-bg); border-color: #b8e2c5; }
.sub-chip.on { box-shadow: 0 0 0 2px var(--navy); }

/* ---------- التقارير ---------- */
.reports { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 18px; }
.rep { display: flex; flex-direction: column; margin: 0; }
.rep h3 { font-size: 18px; margin-bottom: 4px; }
.rep p { color: var(--muted); font-size: 14px; flex: 1; }
.rep .btn { margin-top: 4px; }
.rep-ic { width: 46px; height: 46px; border-radius: 12px; background: var(--navy); color: #fff; display: flex; align-items: center; justify-content: center; margin-bottom: 12px; box-shadow: inset 0 -4px 0 var(--gold); }
.rep-ic .ic { width: 22px; height: 22px; }

/* ---------- الدخول ---------- */
.auth { min-height: 100vh; display: flex; align-items: stretch; }
.auth-brand {
  flex: 1; background: linear-gradient(160deg, var(--navy) 0%, var(--navy-2) 55%, var(--teal) 100%);
  color: #fff; display: flex; flex-direction: column; justify-content: center; padding: 60px; position: relative; overflow: hidden;
}
.auth-brand::before { content: ""; position: absolute; width: 520px; height: 520px; border-radius: 50%; border: 2px solid rgba(255,255,255,.1); top: -200px; left: -200px; }
.auth-brand::after { content: ""; position: absolute; width: 360px; height: 360px; border-radius: 50%; border: 2px solid rgba(137,184,64,.45); bottom: -140px; right: -100px; }
.auth-brand img.auth-company { width: 130px; margin-bottom: 22px; position: relative; }
.auth-brand h2 { color: #fff; font-size: 36px; font-weight: 900; position: relative; }
.auth-brand p { font-size: 18px; opacity: .88; max-width: 460px; margin-top: 12px; position: relative; }
.auth-card { width: 460px; max-width: 100%; background: #fff; padding: 60px 44px; display: flex; flex-direction: column; justify-content: center; margin: auto; }
.auth .auth-card.wide { width: 520px; border-radius: 18px; box-shadow: var(--shadow); padding: 40px; }
.auth-logo { width: 230px; margin-bottom: 26px; }
.auth-card h1 { font-size: 26px; font-weight: 900; margin-bottom: 18px; }

/* ---------- قالب التقرير المطبوع ---------- */
.rpt-body { background: #e9eff3; }
.rpt-tools { position: sticky; top: 0; z-index: 5; display: flex; justify-content: center; gap: 10px; padding: 12px; background: rgba(233,239,243,.92); backdrop-filter: blur(6px); }
.rpt { width: 210mm; max-width: 100%; min-height: 297mm; margin: 0 auto 30px; background: #fff; padding: 16mm 15mm 14mm; box-shadow: 0 6px 30px rgba(0,0,0,.08); font-size: 13px; display: flex; flex-direction: column; }
.rpt-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 20px; border-bottom: 3px solid var(--navy); padding-bottom: 12px; margin-bottom: 16px; position: relative; }
.rpt-head::after { content: ""; position: absolute; bottom: -3px; right: 0; width: 70px; height: 3px; background: var(--gold); }
.rpt-company { height: 52px; width: auto; display: block; }
.rpt-kicker { color: var(--teal); font-weight: 800; font-size: 12px; }
.rpt-head h1 { font-size: 24px; font-weight: 900; }
.rpt-head p { margin: 2px 0 0; color: var(--muted); font-size: 14px; }
.rpt-kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(90px, 1fr)); gap: 8px; margin-bottom: 14px; }
.rpt-kpis div { background: var(--soft); border-radius: 10px; padding: 10px 6px; text-align: center; border-bottom: 3px solid var(--teal); }
.rpt-kpis b { display: block; font-size: 21px; font-weight: 900; color: var(--navy); line-height: 1.3; }
.rpt-kpis span { font-size: 11.5px; color: var(--muted); font-weight: 700; }
.rpt-sec { display: flex; align-items: center; gap: 10px; margin: 18px 0 9px; break-after: avoid; }
.rpt-sec .num { width: 30px; height: 30px; border-radius: 9px; background: var(--navy); color: #fff; font-weight: 900; display: flex; align-items: center; justify-content: center; box-shadow: inset 0 -3px 0 var(--gold); flex: none; }
.rpt-sec h2 { font-size: 16px; font-weight: 800; }
.rtbl { width: 100%; border-collapse: separate; border-spacing: 0; border: 1px solid var(--line); border-radius: 9px; overflow: hidden; font-size: 12px; }
.rtbl th { background: var(--teal); color: #fff; font-weight: 700; padding: 7px 8px; text-align: start; }
.rtbl td { padding: 6px 8px; border-top: 1px solid var(--line); vertical-align: top; }
.rtbl tr:nth-child(even) td { background: #f7fbfc; }
.rtbl tr { break-inside: avoid; }
.rpt-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 18px; }
.rpt-box { border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; margin-bottom: 10px; break-inside: avoid; }
.rpt-box h3 { font-size: 13.5px; color: var(--teal); margin-bottom: 4px; }
.rpt-box p { margin: 0; }
.rpt-box.gold { background: var(--gold-soft); border-color: #b6dec2; }
.rpt-miss { color: var(--red); font-weight: 700; }
.rpt-note { margin-top: 18px; background: var(--gold-soft); border-right: 5px solid var(--gold); border-radius: 8px; padding: 10px 14px; font-size: 12.5px; }
.rpt-foot { margin-top: auto; padding-top: 14px; border-top: 1px solid var(--line); display: flex; justify-content: space-between; color: var(--muted); font-size: 11px; }
.hbars.print .hb { grid-template-columns: 105px 1fr 56px; font-size: 12px; }

@media print {
  @page { size: A4; margin: 0; }
  body, .rpt-body { background: #fff; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .rpt-tools { display: none; }
  .rpt { box-shadow: none; margin: 0; width: auto; min-height: 0; }
}

/* ---------- الجوال ---------- */
@media (max-width: 1100px) {
  .kpis { grid-template-columns: repeat(3, 1fr); }
  .grid-side { grid-template-columns: 1fr; }
}
@media (max-width: 900px) {
  .side { position: fixed; right: 0; top: 0; z-index: 50; transform: translateX(100%); transition: transform .25s; box-shadow: -8px 0 30px rgba(0,0,0,.2); }
  body.nav-open .side { transform: none; }
  body.nav-open .side-backdrop { display: block; position: fixed; inset: 0; background: rgba(10,25,40,.45); z-index: 40; }
  .topbar { display: flex; align-items: center; justify-content: space-between; background: #fff; border-bottom: 1px solid var(--line); padding: 10px 16px; position: sticky; top: 0; z-index: 30; }
  .burger { background: none; border: 0; color: var(--navy); padding: 6px; cursor: pointer; display: flex; }
  .burger .ic { width: 26px; height: 26px; }
  .top-logo { height: 34px; width: auto; }
  .content { padding: 18px 16px 50px; }
  .ptitle h1 { font-size: 22px; }
  .grid-2, .grid-2.top, .grid-3 { grid-template-columns: minmax(0, 1fr); }
  .kpis, .kpis.sm { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .kpi b { font-size: 25px; }
  .card { padding: 16px; }

  /* الجداول تتحول إلى بطاقات */
  .tbl thead { display: none; }
  .tbl, .tbl tbody, .tbl tr, .tbl td { display: block; width: 100%; }
  .tbl tr { border: 1px solid var(--line); border-radius: 12px; padding: 8px 12px; margin-bottom: 10px; }
  .tbl td { border: 0; padding: 4px 0; display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
  .tbl td[data-l]::before { content: attr(data-l); color: var(--muted); font-size: 12px; font-weight: 700; min-width: 86px; }
  .tbl td.t-end { justify-content: flex-start; padding-top: 8px; }
  .tbl tbody tr:hover td { background: none; }

  /* التقويم يتحول إلى قائمة أيام */
  .cal-head { display: none; }
  .cal-grid { display: block; }
  .day { min-height: 0; border-inline-start: 0; padding: 10px 12px; }
  .day.empty-day, .day.out { display: none; }
  .dname { display: inline; flex: 1; font-weight: 700; color: var(--navy); margin-inline-start: 8px; font-size: 14px; }
  .dn { display: none; }
  .add { opacity: 1; }
  .ev-t { white-space: normal; }
  .filters .field { flex: 1 1 140px; }
  .month-nav h2 { font-size: 17px; min-width: 0; }
  .hb { grid-template-columns: 105px 1fr 56px; }
  .auth { flex-direction: column; }
  .auth-brand { padding: 36px 24px; flex: none; }
  .auth-brand img.auth-company { width: 90px; margin-bottom: 14px; }
  .auth-brand h2 { font-size: 26px; }
  .auth-brand p { font-size: 15px; }
  .auth-card { padding: 30px 22px; width: 100%; }
  .auth-logo { display: none; }
  .row-form { flex-direction: column; align-items: stretch; }
  .row-form .field.sm { flex: 1; }
  .dl { grid-template-columns: 1fr; gap: 2px; }
  .dl dd { margin-bottom: 8px; }
  .rpt { padding: 18px; min-height: 0; }
  .rpt-company { height: 36px; }
  .rpt-grid { grid-template-columns: 1fr; }
  .rtbl { display: block; overflow-x: auto; }
}

/* ---------- شعارات الفروع تحت شعار الشركة ---------- */
.logo-strip { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 10px; }
.logo-strip img { height: 46px; width: auto; display: block; }
.logo-strip img.is-ags { height: 34px; }
.side-branches { padding: 12px 6px 14px; margin: 4px 0 2px; border-top: 1px solid rgba(255,255,255,.14); gap: 8px; }
.side-branches img { height: 40px; opacity: .92; }
.side-branches img.is-ags { height: 30px; }
.side-app { border-top: 0; }
.auth-branches { justify-content: flex-start; gap: 16px; margin-bottom: 30px; padding-top: 18px; border-top: 1px solid rgba(255,255,255,.2); max-width: 460px; position: relative; }
.auth-branches img { height: 64px; }
.auth-branches img.is-ags { height: 48px; }
.auth-shape { position: absolute; width: 230px; height: 230px; left: 40px; bottom: 40px; opacity: .9; }
.rpt-logos { display: flex; flex-direction: column; align-items: flex-end; gap: 8px; flex: none; }
.rpt-branches { justify-content: flex-end; gap: 8px; }
.rpt-branches img { height: 34px; }
.rpt-branches img.is-ags { height: 24px; }
.logo-cell { display: flex; align-items: center; gap: 8px; }
.logo-cell img { height: 38px; width: auto; }
.logo-cell select { width: auto; max-width: 170px; padding: 6px 8px; font-size: 13px; }
.ptitle h1 { position: relative; padding-bottom: 6px; }
.ptitle h1::after { content: ""; position: absolute; bottom: 0; right: 0; width: 44px; height: 4px; border-radius: 3px; background: linear-gradient(90deg, var(--lime), var(--brand-green)); }
@media (max-width: 900px) {
  .auth-shape { width: 120px; height: 120px; left: 16px; bottom: auto; top: 16px; opacity: .55; }
  .auth-branches img { height: 44px; }
  .auth-branches img.is-ags { height: 32px; }
  .rpt-branches img { height: 24px; }
}
.auth-brand + .auth-card { margin: 0; }
.rpt-branches img:only-child { height: 54px; }
.rpt-branches img.is-ags:only-child { height: 40px; }

/* ---------- رفع الصور والفيديو إلى Drive ---------- */
.btn-gold { background: var(--lime); border-color: var(--lime); color: #fff; }
.btn-gold:hover { background: var(--brand-green); border-color: var(--brand-green); color: #fff; }
.uploader { margin-bottom: 14px; }
.uploader .upload { border-color: var(--mint); background: var(--gold-soft); color: var(--brand-green); }
.uploader.busy .upload { opacity: .6; pointer-events: none; }
.up-queue { list-style: none; margin: 10px 0 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.up-queue li { background: var(--soft); border-radius: 10px; padding: 8px 12px; display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 10px; align-items: center; font-size: 13px; }
.up-queue li b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 700; }
.up-queue li small { color: var(--muted); white-space: nowrap; }
.up-bar { grid-column: 1 / -1; height: 6px; background: #dce6ea; border-radius: 4px; overflow: hidden; }
.up-bar i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--lime), var(--brand-green)); transition: width .2s; }
.up-queue li.done small { color: var(--green); font-weight: 700; }
.up-queue li.failed { background: var(--red-bg); }
.up-queue li.failed small { color: var(--red); white-space: normal; grid-column: 1 / -1; }
.up-queue li.up-note { display: block; background: var(--green-bg); color: var(--green); font-weight: 700; }
.media { display: block; position: relative; }
.media img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 10px; display: block; background: var(--soft); }
.media.is-video video { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 10px; background: #0f1d33; display: block; }

/* ---------- الخطة الفصلية ---------- */
.plans-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 520px), 1fr)); gap: 18px; }
.plans-grid .card { margin: 0; }
.plan-logo { height: 34px; width: auto; }
.plan-terms { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 12px; }
.plan-term { border: 1px solid var(--line); border-radius: 12px; padding: 12px; display: flex; flex-direction: column; gap: 6px; border-top: 4px solid #c9d3db; }
.plan-term.st-approved { border-top-color: var(--green); }
.plan-term.st-submitted { border-top-color: var(--amber); }
.plan-term.st-revise { border-top-color: var(--red); }
.pt-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; }
.pt-head b { color: var(--navy); }
.pt-file { display: inline-flex; align-items: center; gap: 6px; font-weight: 700; word-break: break-all; }
.pt-note { font-size: 13px; background: var(--soft); border-radius: 8px; padding: 8px 10px; }
.pt-note.is-revise { background: var(--red-bg); color: #8d1b12; }
.pt-review textarea { font-size: 13px; margin-bottom: 6px; }
.pt-upload summary { cursor: pointer; font-weight: 700; color: var(--teal); font-size: 14px; padding: 4px 0; }
.pt-upload .form { margin-top: 8px; }
.upload.sm { padding: 12px; }
.upload.sm .ic { width: 22px; height: 22px; }

/* ---------- الإنجازات ---------- */
.ach-levels { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 12px; margin-bottom: 16px; }
.ach-level { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; display: flex; flex-direction: column; gap: 2px; text-decoration: none !important; color: var(--ink); box-shadow: var(--shadow); border-top: 4px solid var(--navy); }
.ach-level .ic { width: 22px; height: 22px; }
.ach-level b { font-size: 26px; font-weight: 900; color: var(--navy); line-height: 1.2; }
.ach-level span { font-size: 13px; color: var(--muted); font-weight: 700; }
.ach-level.on { box-shadow: 0 0 0 2px var(--navy); }
.lv-governorate { border-top-color: var(--blue); } .lv-governorate .ic { color: var(--blue); }
.lv-region { border-top-color: var(--purple); } .lv-region .ic { color: var(--purple); }
.lv-kingdom { border-top-color: var(--brand-green); } .lv-kingdom .ic { color: var(--brand-green); }
.lv-international { border-top-color: #c98a00; } .lv-international .ic { color: #c98a00; }
.rank { color: var(--brand-green); }
.level-picks { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.level-pick { display: flex; align-items: center; justify-content: center; gap: 6px; border: 1px solid var(--line); border-radius: 10px; padding: 10px 6px; cursor: pointer; font-weight: 700; background: #fff; border-top-width: 4px; }
.level-pick input { position: absolute; opacity: 0; pointer-events: none; }
.level-pick:has(input:checked) { background: var(--soft); box-shadow: inset 0 0 0 2px var(--navy); }
@media (max-width: 900px) {
  .plan-terms { grid-template-columns: minmax(0, 1fr); }
  .ach-levels { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ach-levels .ach-level.all { grid-column: 1 / -1; }
  .level-picks { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
/* محاذاة شعار AGS مع أعلى شعارات الفروع */
.logo-strip { align-items: flex-start; }
/* شعار AGS بنفس ارتفاع شعارات الفروع (محاذاة من أعلى وأسفل) */
.logo-strip img.is-ags { height: 46px; }
.side-branches img.is-ags { height: 40px; }
.auth-branches img.is-ags { height: 64px; }
.rpt-branches img.is-ags { height: 34px; }
.rpt-branches img.is-ags:only-child { height: 54px; }
@media (max-width: 900px) {
  .auth-branches img.is-ags { height: 44px; }
  .rpt-branches img.is-ags { height: 24px; }
}
.media-form { display: flex; flex-direction: column; gap: 10px; margin-bottom: 16px; }
.media-form .btn { align-self: flex-start; }
.upload.media-pick { border-color: var(--mint); background: var(--gold-soft); color: var(--brand-green); }

/* ---------- الفصل والأسبوع ---------- */
.wk-chip { display: inline-block; background: var(--gold-soft); color: var(--brand-green); border: 1px solid var(--mint); border-radius: 6px; padding: 0 8px; font-size: 12.5px; font-weight: 700; white-space: nowrap; }
.wk-sub { display: block; font-size: 12px; font-weight: 500; color: var(--muted); }
.cal-settings summary { cursor: pointer; margin: 0; }
.cal-settings[open] summary { margin-bottom: 14px; }
.cal-terms { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.cal-term { border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px 4px; margin: 0; }
.cal-term legend { font-weight: 800; color: var(--navy); padding: 0 6px; }
@media (max-width: 900px) { .cal-terms { grid-template-columns: 1fr; } }

/* ---------- شارة غير المقروء ---------- */
.nav-badge { font-style: normal; background: #e5484d; color: #fff; font-size: 11px; font-weight: 800; min-width: 20px; height: 20px; border-radius: 10px; display: inline-flex; align-items: center; justify-content: center; padding: 0 6px; margin-inline-start: auto; }
.top-mail { position: relative; color: var(--navy); display: flex; padding: 6px; }
.top-mail .ic { width: 24px; height: 24px; }
.top-mail .nav-badge { position: absolute; top: -2px; left: -4px; }

/* ---------- المناسبات ---------- */
.ev-chips { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 10px; }
.ev-chip { border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; display: flex; flex-direction: column; gap: 2px; border-inline-start: 4px solid var(--purple); background: #fff; }
.ev-chip.k-holiday { border-inline-start-color: var(--red); background: #fffafa; }
.ev-chip.k-school { border-inline-start-color: var(--blue); }
.ev-chip b { font-size: 14px; color: var(--navy); }
.ev-chip small { color: var(--muted); font-size: 12.5px; }
.ev-cd { align-self: flex-start; font-size: 11.5px; font-weight: 800; color: var(--muted); background: var(--soft); border-radius: 6px; padding: 1px 8px; }
.ev-cd.hot { background: var(--lime); color: #fff; }
.ev-list { list-style: none; margin: 0; padding: 0; }
.ev-item { display: flex; align-items: center; gap: 14px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.ev-item:last-child { border-bottom: 0; }
.ev-item.past { opacity: .5; }
.ev-date { width: 52px; flex: none; text-align: center; border-radius: 10px; background: var(--soft); padding: 6px 0; line-height: 1.2; }
.ev-date b { display: block; font-size: 20px; color: var(--navy); }
.ev-date span { font-size: 11px; color: var(--muted); }
.ev-item.k-holiday .ev-date { background: var(--red-bg); }
.ev-item.k-holiday .ev-date b { color: var(--red); }
.ev-item.k-occasion .ev-date { background: var(--purple-bg); }
.ev-item.k-occasion .ev-date b { color: var(--purple); }
.ev-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.ev-body b { color: var(--ink); }
.ev-body small { color: var(--muted); }
.ev-side { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
/* في جدول النشر */
.day.holiday { background: repeating-linear-gradient(135deg, #fff5f5, #fff5f5 6px, #fff 6px, #fff 12px); }
.ev.occ { background: var(--purple-bg); color: var(--purple); font-weight: 700; }
.ev.occ.k-holiday { background: var(--red-bg); color: var(--red); }
.ev.occ.k-school { background: var(--blue-bg); color: var(--blue); }

/* ---------- الرسائل ---------- */
.inbox { list-style: none; margin: 0; padding: 0; }
.inbox li a { display: grid; grid-template-columns: 180px minmax(0, 1fr) auto; gap: 14px; align-items: center; padding: 12px 6px; border-bottom: 1px solid var(--line); color: var(--ink); text-decoration: none; }
.inbox li:last-child a { border-bottom: 0; }
.inbox li a:hover { background: var(--soft); }
.ib-who { font-weight: 700; color: var(--navy); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ib-main { display: flex; flex-direction: column; min-width: 0; }
.ib-main b { font-weight: 500; }
.ib-main small { color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ib-meta { color: var(--muted); font-size: 12.5px; display: flex; align-items: center; gap: 6px; white-space: nowrap; }
.inbox li.unread .ib-main b, .inbox li.unread .ib-who { font-weight: 900; }
.inbox li.unread a { background: #f7fbf8; }
.rcpt-group { margin-bottom: 10px; }
.rcpt-group > b { display: block; margin: 4px 0; }
.chat { display: flex; flex-direction: column; gap: 12px; }
.msg { max-width: 85%; align-self: flex-start; background: var(--soft); border-radius: 14px 14px 14px 4px; padding: 10px 14px; }
.msg.mine { align-self: flex-end; background: #e9f5ee; border-radius: 14px 14px 4px 14px; }
.msg-head { display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap; margin-bottom: 4px; }
.msg-head b { color: var(--navy); }
.msg-body { line-height: 1.8; white-space: normal; }
.chat .reply { margin-top: 8px; border-top: 1px solid var(--line); padding-top: 12px; }
@media (max-width: 900px) {
  .inbox li a { grid-template-columns: minmax(0, 1fr) auto; }
  .ib-who { grid-column: 1 / -1; font-size: 13px; }
  .ev-item { flex-wrap: wrap; }
  .ev-side { width: 100%; justify-content: flex-start; }
  .msg { max-width: 100%; }
}
