/* ===== مسار — نظام التصميم =====
   الخلفية: #EEF1E9 (ورقي بارد مائل للأخضر)
   الحبر: #1E2A22 (أخضر-أسود عميق)
   الخط الأساسي: #35473A
   التمييز: #C97A2B (نحاسي دافئ)
   الخط الثانوي: #6B7F6E
   الحدود: #D8DECB
*/

@import url('https://fonts.googleapis.com/css2?family=Markazi+Text:wght@500;700&family=IBM+Plex+Sans+Arabic:wght@400;500;600&display=swap');

:root{
  --bg: #EEF1E9;
  --ink: #1E2A22;
  --body: #35473A;
  --accent: #C97A2B;
  --accent-ink: #7A4415;
  --muted: #6B7F6E;
  --line: #D8DECB;
  --card: #F6F8F1;
  --white: #FFFFFF;
  --radius: 14px;
}

*{ box-sizing: border-box; }

html{ scroll-behavior: smooth; }

body{
  margin: 0;
  background: var(--bg);
  background-image:
    linear-gradient(var(--line) 1px, transparent 1px),
    linear-gradient(90deg, var(--line) 1px, transparent 1px);
  background-size: 36px 36px;
  background-attachment: fixed;
  color: var(--body);
  font-family: 'IBM Plex Sans Arabic', sans-serif;
  direction: rtl;
  line-height: 1.7;
}

h1, h2, h3, .display{
  font-family: 'Markazi Text', 'IBM Plex Sans Arabic', serif;
  color: var(--ink);
  font-weight: 700;
  margin: 0;
}

a{ color: inherit; text-decoration: none; }

.wrap{
  max-width: 880px;
  margin: 0 auto;
  padding: 0 20px;
}

/* ===== الترويسة ===== */
header.site{
  padding: 22px 0;
  border-bottom: 1px solid var(--line);
  background: rgba(246,248,241,.7);
  backdrop-filter: blur(4px);
  position: sticky;
  top: 0;
  z-index: 10;
}
header.site .wrap{
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.brand{
  display: flex;
  align-items: center;
  gap: 10px;
}
.brand .mark{
  width: 34px; height: 34px;
  border: 2px solid var(--ink);
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-family: 'Markazi Text', serif;
  font-weight: 700;
  font-size: 20px;
  transform: rotate(-4deg);
}
.brand .name{ font-size: 22px; font-weight: 700; }
nav.site-nav{ display: flex; gap: 22px; font-size: 15px; color: var(--muted); }
nav.site-nav a:hover{ color: var(--accent-ink); }
nav.site-nav a.active{ color: var(--ink); border-bottom: 2px solid var(--accent); padding-bottom: 3px; }

/* ===== أقسام عامة ===== */
main{ padding: 56px 0 90px; }

.eyebrow{
  color: var(--accent-ink);
  font-size: 14px;
  margin-bottom: 6px;
}

.page-title{ font-size: 40px; margin-bottom: 8px; }
.page-sub{ color: var(--muted); font-size: 17px; max-width: 60ch; margin-bottom: 34px; }

/* ===== بطاقات الرئيسية ===== */
.tools-grid{
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 18px;
  margin-top: 40px;
}
@media (max-width: 760px){ .tools-grid{ grid-template-columns: 1fr; } }

.tool-card{
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 26px 22px;
  display: block;
  transition: transform .15s ease, border-color .15s ease;
  position: relative;
  overflow: hidden;
}
.tool-card:hover{ transform: translateY(-3px); border-color: var(--accent); }
.tool-card .num{
  font-family: 'Markazi Text', serif;
  font-size: 46px;
  color: var(--line);
  position: absolute;
  left: 14px;
  top: 6px;
  line-height: 1;
}
.tool-card h3{ font-size: 22px; margin-bottom: 8px; position: relative; }
.tool-card p{ color: var(--muted); font-size: 15px; margin: 0; position: relative; }

.hero-note{
  margin-top: 46px;
  border-top: 1px dashed var(--line);
  padding-top: 20px;
  font-size: 14px;
  color: var(--muted);
}

/* ===== نماذج الإدخال ===== */
.panel{
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 26px;
  margin-bottom: 22px;
}
.panel h2{ font-size: 20px; margin-bottom: 16px; }

.field-row{
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-bottom: 14px;
}
.field{ display: flex; flex-direction: column; gap: 6px; }
.field label{ font-size: 13px; color: var(--muted); }
.field input, .field select{
  border: 1px solid var(--line);
  background: var(--white);
  border-radius: 8px;
  padding: 10px 12px;
  font-family: inherit;
  font-size: 15px;
  color: var(--ink);
}
.field input:focus, .field select:focus{
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(201,122,43,.15);
}

/* ===== جدول المواد ===== */
.courses{ margin-top: 8px; }
.course-row{
  display: grid;
  grid-template-columns: 1fr 90px 110px 34px;
  gap: 10px;
  align-items: center;
  margin-bottom: 10px;
}
@media (max-width: 560px){
  .course-row{ grid-template-columns: 1fr; }
}
.course-row input, .course-row select{
  border: 1px solid var(--line);
  background: var(--white);
  border-radius: 8px;
  padding: 9px 10px;
  font-family: inherit;
  font-size: 14px;
}
.remove-btn{
  width: 34px; height: 34px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--white);
  color: var(--muted);
  cursor: pointer;
  font-size: 16px;
  line-height: 1;
}
.remove-btn:hover{ border-color: #C0392B; color: #C0392B; }

/* ===== أزرار ===== */
.btn{
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: none;
  border-radius: 8px;
  padding: 11px 20px;
  font-family: inherit;
  font-size: 15px;
  cursor: pointer;
}
.btn-primary{ background: var(--ink); color: var(--white); }
.btn-primary:hover{ background: #0f1710; }
.btn-ghost{ background: transparent; border: 1px dashed var(--muted); color: var(--body); }
.btn-ghost:hover{ border-color: var(--ink); color: var(--ink); }
.btn-block{ width: 100%; justify-content: center; margin-top: 6px; }

/* ===== النتائج ===== */
.results{
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  margin-top: 22px;
}
@media (max-width: 620px){ .results{ grid-template-columns: 1fr; } }
.result-box{
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
  text-align: center;
  background: var(--white);
}
.result-box .label{ font-size: 13px; color: var(--muted); margin-bottom: 6px; }
.result-box .value{ font-family: 'Markazi Text', serif; font-size: 34px; color: var(--ink); font-weight: 700; }
.result-box.highlight{ background: var(--ink); border-color: var(--ink); }
.result-box.highlight .label{ color: #A9B8AA; }
.result-box.highlight .value{ color: var(--white); }

.result-box.warn{ border-color: #C0392B; }
.result-box.warn .value{ color: #C0392B; }
.result-box.ok .value{ color: #2E7D4F; }

/* ===== شريط النسبة (الغياب) ===== */
.bar-track{
  height: 10px;
  border-radius: 6px;
  background: var(--line);
  overflow: hidden;
  margin-top: 18px;
}
.bar-fill{
  height: 100%;
  background: var(--accent);
  border-radius: 6px;
  transition: width .3s ease;
}
.bar-fill.danger{ background: #C0392B; }
.bar-caption{ font-size: 13px; color: var(--muted); margin-top: 8px; }

/* ===== التقويم ===== */
.cal-head{
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 18px;
}
.cal-head .month-label{ font-family: 'Markazi Text', serif; font-size: 26px; color: var(--ink); }
.cal-nav{ display: flex; gap: 8px; }
.cal-nav button{
  width: 34px; height: 34px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--white);
  cursor: pointer;
  font-size: 16px;
}
.cal-grid{
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 6px;
}
.cal-dow{ text-align: center; font-size: 12px; color: var(--muted); padding-bottom: 6px; }
.cal-day{
  aspect-ratio: 1;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--white);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  cursor: pointer;
  font-size: 14px;
  color: var(--body);
  position: relative;
}
.cal-day.empty{ background: transparent; border-color: transparent; cursor: default; }
.cal-day.today{ border-color: var(--ink); font-weight: 600; }
.cal-day .dot{
  width: 5px; height: 5px; border-radius: 50%; background: var(--accent);
  position: absolute; bottom: 7px;
}
.cal-day:hover:not(.empty){ border-color: var(--accent); }

.event-panel{
  margin-top: 20px;
  border-top: 1px dashed var(--line);
  padding-top: 18px;
}
.event-item{
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}
.event-item:last-child{ border-bottom: none; }
.event-dot{ width: 8px; height: 8px; border-radius: 50%; background: var(--accent); margin-top: 6px; flex-shrink: 0; }
.event-item .etitle{ color: var(--ink); font-weight: 600; font-size: 15px; }
.event-item .enote{ color: var(--muted); font-size: 13px; margin-top: 2px; }
.event-empty{ color: var(--muted); font-size: 14px; padding: 14px 0; }
.event-form{
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 14px;
}
.event-form input{
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 9px 10px;
  font-family: inherit;
  font-size: 14px;
}
.event-form input:first-child{ grid-column: 1 / -1; }

/* ===== تذييل ===== */
footer.site{
  border-top: 1px solid var(--line);
  padding: 26px 0;
  color: var(--muted);
  font-size: 13px;
  text-align: center;
}
