/* نظام متابعة الخطط – منتدى البركة. هوية المنتدى: الكحلي والفيروزي. */
:root {
  --navy: #26395a;
  --navy-2: #1d2d48;
  --teal: #7cc5ca;
  --teal-ink: #2a7f86;
  --surface: #ffffff;
  --page: #f3f5f7;
  --line: #e2e6eb;
  --grid: #e9ecef;
  --ink: #1b1f24;
  --ink-2: #545b66;
  --ink-3: #7b828c;
  --series-1: #2a78d6;
  --planned: #8a9099;
  --good: #0ca30c;
  --warning: #fab219;
  --critical: #d03b3b;
  --none: #b9bec5;
  --radius: 10px;
}

* { box-sizing: border-box; }
html { font-size: 15px; }
body {
  margin: 0;
  font-family: "IBM Plex Sans Arabic", "Segoe UI", Tahoma, sans-serif;
  background: var(--page);
  color: var(--ink);
  line-height: 1.6;
}
a { color: var(--teal-ink); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { line-height: 1.35; margin: 0 0 .5rem; }
h1 { font-size: 1.5rem; }
h2 { font-size: 1.15rem; }
h3 { font-size: 1rem; }
p { margin: 0 0 .75rem; }

/* التخطيط العام */
.layout { display: grid; grid-template-columns: 240px minmax(0, 1fr); min-height: 100vh; }
.sidebar { background: var(--navy); color: #fff; padding: 20px 14px; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.brand { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 8px 0 18px; border-bottom: 1px solid rgba(255,255,255,.12); margin-bottom: 14px; text-align: center; }
.brand img { width: 120px; background: #fff; border-radius: 8px; padding: 6px; }
.brand span { font-size: .85rem; color: var(--teal); }
.nav a { display: flex; justify-content: space-between; align-items: center; color: #e6ebf2; padding: 9px 12px; border-radius: 8px; margin-bottom: 2px; }
.nav a:hover { background: rgba(255,255,255,.08); text-decoration: none; }
.nav a.active { background: var(--teal); color: var(--navy-2); font-weight: 600; }
.nav .section { font-size: .75rem; color: #9fb0c8; margin: 14px 12px 4px; }
.badge-count { background: var(--critical); color: #fff; border-radius: 999px; padding: 0 8px; font-size: .75rem; }
.userbox { margin-top: 18px; padding: 12px; border-top: 1px solid rgba(255,255,255,.12); font-size: .85rem; color: #cfd8e3; }
.userbox form { display: inline; }
.userbox button { background: none; border: 0; color: var(--teal); cursor: pointer; padding: 0; font: inherit; }
main { padding: 24px 28px 48px; max-width: 1280px; width: 100%; min-width: 0; }
.page-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; margin-bottom: 18px; flex-wrap: wrap; }
.page-head .sub { color: var(--ink-2); font-size: .9rem; }
.crumbs { font-size: .85rem; color: var(--ink-3); margin-bottom: 4px; }

/* بطاقات */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; margin-bottom: 18px; }
.card > h2:first-child, .card > h3:first-child { margin-bottom: 12px; }
.card-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 12px; flex-wrap: wrap; }
.card-head h2, .card-head h3 { margin: 0; }
.grid { display: grid; gap: 18px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 14px; margin-bottom: 18px; }
.tile { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; }
.tile .label { color: var(--ink-2); font-size: .85rem; }
.tile .value { font-size: 1.7rem; font-weight: 600; color: var(--navy); }
.tile .hint { color: var(--ink-3); font-size: .8rem; }
.hero { font-size: 3.2rem; font-weight: 600; color: var(--navy); line-height: 1.1; }

/* جداول */
table { width: 100%; border-collapse: collapse; font-size: .92rem; }
th, td { text-align: right; padding: 9px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { color: var(--ink-2); font-weight: 600; background: #f8f9fb; font-size: .85rem; }
td.num, th.num { text-align: left; font-variant-numeric: tabular-nums; white-space: nowrap; }
tr:last-child td { border-bottom: 0; }
.table-wrap { overflow-x: auto; }

/* حالات */
.status { display: inline-flex; align-items: center; gap: 6px; font-size: .85rem; white-space: nowrap; }
.status::before { content: ""; width: 10px; height: 10px; border-radius: 50%; background: var(--none); flex: none; }
.status.green::before { background: var(--good); }
.status.amber::before { background: var(--warning); }
.status.red::before { background: var(--critical); }
.status.gray::before { background: var(--none); }
.pill { display: inline-block; padding: 1px 10px; border-radius: 999px; font-size: .8rem; background: #eef1f4; color: var(--ink-2); white-space: nowrap; }
.pill.draft, .pill.returned { background: #fff3d6; color: #7a5300; }
.pill.review, .pill.executive, .pill.secretary, .pill.submitted { background: #e3effd; color: #1c5cab; }
.pill.approved { background: #e2f5e2; color: #0b6b0b; }
.pill.late { background: #fde4e4; color: #a32626; }
.pill.none { background: #eef1f4; color: var(--ink-3); }

/* أشرطة التقدم */
.bar { position: relative; height: 10px; background: #e8edf3; border-radius: 999px; overflow: visible; min-width: 80px; }
.bar > .fill { position: absolute; inset-inline-start: 0; top: 0; bottom: 0; background: var(--series-1); border-radius: 999px; }
.bar > .plan { position: absolute; top: -4px; bottom: -4px; width: 2px; background: var(--ink); border-radius: 1px; }
.bar-row { display: grid; grid-template-columns: minmax(150px, 230px) 1fr 64px; gap: 12px; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--line); }
.bar-row:last-child { border-bottom: 0; }
.bar-row .name { font-size: .92rem; }
.bar-row .pct { text-align: left; font-weight: 600; font-variant-numeric: tabular-nums; }
.legend { display: flex; gap: 16px; flex-wrap: wrap; font-size: .82rem; color: var(--ink-2); margin-top: 8px; }
.legend i { display: inline-block; width: 14px; height: 10px; border-radius: 3px; margin-inline-end: 6px; vertical-align: middle; }
.legend i.tick { width: 2px; height: 14px; background: var(--ink); border-radius: 1px; }
.stack { display: flex; gap: 2px; height: 14px; border-radius: 4px; overflow: hidden; background: var(--surface); }
.stack span { display: block; height: 100%; }
.stack .green { background: var(--good); }
.stack .amber { background: var(--warning); }
.stack .red { background: var(--critical); }
.stack .gray { background: var(--none); }
.chart svg { width: 100%; height: auto; display: block; }
.chart text { font-family: inherit; }

/* نماذج */
form .field { margin-bottom: 14px; }
label { display: block; font-weight: 600; font-size: .9rem; margin-bottom: 4px; }
.helptext, .help { display: block; color: var(--ink-3); font-size: .8rem; margin-top: 3px; font-weight: 400; }
input[type=text], input[type=number], input[type=url], input[type=email], input[type=password], input[type=date], select, textarea {
  width: 100%; padding: 8px 10px; border: 1px solid #cfd5dc; border-radius: 8px; font: inherit; background: #fff; color: var(--ink);
}
textarea { min-height: 90px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--teal); border-color: var(--teal-ink); }
.checks { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 4px 16px; }
.checks label { font-weight: 400; display: flex; gap: 8px; align-items: flex-start; }
.checks input { margin-top: 5px; }
ul.errorlist { list-style: none; margin: 4px 0; padding: 0; color: var(--critical); font-size: .85rem; }
.form-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 0 14px; }

.btn { display: inline-flex; align-items: center; gap: 6px; padding: 8px 16px; border-radius: 8px; border: 1px solid var(--navy); background: var(--navy); color: #fff; font: inherit; font-size: .9rem; cursor: pointer; text-decoration: none; }
.btn:hover { background: var(--navy-2); text-decoration: none; color: #fff; }
.btn.secondary { background: #fff; color: var(--navy); }
.btn.secondary:hover { background: #f2f5f8; color: var(--navy); }
.btn.teal { background: var(--teal); border-color: var(--teal); color: var(--navy-2); }
.btn.danger { background: #fff; border-color: var(--critical); color: var(--critical); }
.btn.small { padding: 3px 10px; font-size: .8rem; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* رسائل */
.messages { list-style: none; padding: 0; margin: 0 0 16px; }
.messages li { padding: 10px 14px; border-radius: 8px; margin-bottom: 6px; background: #e3effd; color: #164a8a; }
.messages li.success { background: #e2f5e2; color: #0b6b0b; }
.messages li.error { background: #fde4e4; color: #a32626; }
.messages li.warning { background: #fff3d6; color: #7a5300; }
.notice { background: #fff8e6; border: 1px solid #f3d999; border-radius: 8px; padding: 10px 14px; margin-bottom: 14px; font-size: .9rem; }
.notice.info { background: #eef6fb; border-color: #c6e0ef; }
.issues { margin: 6px 0 0; padding-inline-start: 20px; }
.muted { color: var(--ink-3); }
.small { font-size: .85rem; }
.nowrap { white-space: nowrap; }
.original { background: #f8f9fb; border-inline-start: 3px solid var(--teal); padding: 6px 10px; font-size: .85rem; color: var(--ink-2); border-radius: 4px; margin-top: 4px; }

.objective { border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; margin-bottom: 14px; background: #fff; }
.objective-head { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; }
.objective-head h3 { margin: 0; }
.tag { display: inline-block; font-size: .75rem; background: #eaf6f7; color: var(--teal-ink); border-radius: 6px; padding: 0 8px; margin: 2px 0 2px 4px; }
.kpi-entry { border: 1px solid var(--line); border-radius: 8px; padding: 12px 14px; margin-bottom: 12px; background: #fcfdfe; }
.kpi-entry .meta { color: var(--ink-2); font-size: .82rem; margin-bottom: 8px; }
.timeline { list-style: none; padding: 0; margin: 0; }
.timeline li { padding: 8px 0; border-bottom: 1px solid var(--line); font-size: .88rem; }
.timeline li:last-child { border-bottom: 0; }

.login-wrap { min-height: 100vh; display: grid; place-items: center; background: var(--navy); }
.login-card { background: #fff; border-radius: 14px; padding: 28px 30px; width: min(400px, 92vw); }
.login-card img { width: 150px; display: block; margin: 0 auto 10px; }
.login-card h1 { text-align: center; font-size: 1.15rem; margin-bottom: 18px; }

.filters { display: flex; gap: 10px; align-items: end; flex-wrap: wrap; }
.filters .field { margin: 0; }
.filters select { width: auto; min-width: 150px; }

@media (max-width: 900px) {
  .layout { grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; }
  main { padding: 16px; }
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
  .bar-row { grid-template-columns: 1fr 56px; }
  .bar-row .bar { grid-column: 1 / -1; grid-row: 2; }
}
input[type=url], input[type=email] { direction: ltr; text-align: left; }
