:root{
  --bg:#f7fafc;--panel:#ffffff;--line:#dfe3ea;--text:#111827;
  --muted:#6b7280;--brand:#b45309;--ok:#16a34a;--danger:#dc2626;--info:#2563eb
}
*{box-sizing:border-box}
html,body{margin:0;padding:0}
body{background:var(--bg);color:var(--text);font-family:"Times New Roman", Times, serif}
.container{max-width:1280px;margin:24px auto;padding:16px}

.header{display:flex;align-items:center;gap:12px;margin-bottom:12px}
.header img{width:42px;height:42px;border-radius:8px}
.brand{font-weight:800;color:var(--brand);font-size:22px}
.badge{display:inline-flex;gap:6px;background:#fff;border:1px solid var(--line);padding:6px 10px;border-radius:999px;color:var(--muted)}
.card{background:var(--panel);border:1px solid var(--line);border-radius:12px;overflow:hidden}
.toolbar{display:flex;flex-wrap:wrap;gap:8px;padding:12px;border-bottom:1px solid var(--line);background:#fff}
.toolbar input,.toolbar select,.toolbar button{padding:10px 12px;border-radius:10px;border:1px solid var(--line);background:#fff;color:var(--text)}
.toolbar .right{margin-inline-start:auto;display:flex;gap:8px;flex-wrap:wrap}

.grid{display:grid;grid-template-columns:320px 1fr;gap:12px;padding:12px}
@media(max-width:1100px){.grid{grid-template-columns:1fr}}
.section{background:#fff;border:1px solid var(--line);border-radius:10px;padding:12px}
.section h3{margin:0 0 8px 0}
.list{display:flex;flex-direction:column;gap:8px}
.member{display:flex;align-items:center;gap:6px}
.member input{flex:1}
.color{width:18px;height:18px;border-radius:4px;border:1px solid var(--line);cursor:pointer}

.table{overflow:auto;border:1px solid var(--line);border-radius:10px;background:#fff}
.schedule{width:100%;border-collapse:collapse;table-layout:fixed;font-size:14px;line-height:1.35}
.schedule caption{caption-side:top;padding:10px 0;font-weight:700;font-size:18px;text-align:center}
.schedule th,.schedule td{border:1px solid #cfd5dd;padding:8px;vertical-align:top;word-wrap:break-word}
.schedule thead th{background:#f3f4f6;text-align:center}
.schedule col.time{width:90px}
.schedule col.day{width:calc((100% - 90px)/7)}
.headwrap{display:flex;flex-direction:column;gap:2px;align-items:center;justify-content:center}
.headwrap .day{font-weight:700}
.headwrap .date{font-size:12px;color:#4b5563;white-space:nowrap}
.time-cell{white-space:nowrap;text-align:center;color:#111827;font-weight:700}

.cell{min-height:64px;position:relative}
.cell .task{position:relative;margin:6px 0;padding:6px 8px;border-radius:6px;border:1px solid #cbd5e1;background:#f8fafc;cursor:grab}
.cell .task .t{font-weight:700}
.cell .task .m{font-size:12px;color:#374151}

.actions{display:flex;gap:8px;flex-wrap:wrap;margin-top:8px}
.btn{background:#fff;border:1px solid var(--line);color:var(--text);border-radius:10px;padding:10px 14px;cursor:pointer}
.btn.ok{background:#dcfce7;color:#14532d;border:1px solid #22c55e;font-weight:800}
.btn.warn{background:#fee2e2;color:#7f1d1d;border:1px solid #ef4444;font-weight:800}
.note{color:var(--muted);font-size:13px}
input[type="time"]{direction:ltr}
.rtl{direction:rtl;text-align:right}

/* إخفاء أي صف قديم للتواريخ إن وُجد */
#datesRow{display:none!important}

/* ===== وضع الطباعة ===== */
@media print{
  /* بدون هوامش + وضع أفقي لظهور الأيام براحة */
  @page{ size:A4 landscape; margin:0 }

  html, body{ width:297mm; height:210mm; background:#fff; color:#000; margin:0; padding:0 }

  /* إظهار الجدول فقط، ومركزي بالكامل */
  .header,.toolbar,.grid > .section:first-child, .note{display:none!important}
  .container{max-width:none;margin:0;padding:0}
  .card{border:0}
  .table{border:0}

  /* يملأ العرض كله ويتوسّط */
  .schedule{ width:100%; margin:0 auto; border:1px solid #000; font-size:12.5px }
  .schedule th,.schedule td{ border:1px solid #000; padding:6px }
  .schedule thead th{ background:#eee!important; color:#000 }

  /* توسيط بطاقات المهام داخل الخلايا أثناء الطباعة */
  .cell .task{ margin:6px auto; display:inline-block }
}
