/* تقييم الموظفين — تنسيق مستقل عن tasks.css لأن الميزة كبيرة بما يكفي لتستحق
   ملفها، مع التزام كامل بنفس المتغيّرات والزوايا والمسافات المستخدمة في المهام. */

/* ── بطاقات الملخّص ── */
.ev-summary { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-bottom: 14px; }
.ev-card {
  border: 1px solid var(--border, #e2e8f0);
  border-radius: 12px;
  padding: 12px 14px;
  background: #fff;
}
.ev-card .lbl { font-size: 11.5px; color: var(--text-2, #94a3b8); margin-bottom: 4px; }
.ev-card .val { font-size: 20px; font-weight: 700; }
.ev-card .sub { font-size: 11px; color: var(--text-2, #94a3b8); margin-top: 2px; }
.ev-sections-avg { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-bottom: 16px; }
.ev-mini {
  border: 1px solid var(--border, #e2e8f0);
  border-radius: 10px;
  padding: 10px 12px;
  background: var(--surface-2, #f8fafc);
}
.ev-mini .lbl { font-size: 11px; color: var(--text-2, #64748b); }
.ev-mini .val { font-size: 16px; font-weight: 700; margin-top: 2px; }

/* ── الفلاتر ── */
.ev-filters { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; align-items: center; }
.ev-filters select, .ev-filters input {
  padding: 7px 10px;
  border: 1px solid var(--border, #e2e8f0);
  border-radius: 9px;
  font-family: inherit; font-size: 12.5px;
  background: transparent; color: inherit;
}
.ev-head { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.ev-head h3 { margin: 0; font-size: 15px; }
.ev-head .spacer { margin-inline-start: auto; }

/* ── الجدول ── */
.ev-table-wrap { overflow-x: auto; border: 1px solid var(--border, #e2e8f0); border-radius: 12px; }
.ev-table { width: 100%; border-collapse: collapse; font-size: 12.5px; white-space: nowrap; }
.ev-table th, .ev-table td { padding: 9px 10px; text-align: start; border-bottom: 1px solid var(--border, #eef2f7); }
.ev-table th { background: var(--surface-2, #f8fafc); font-weight: 600; font-size: 11.5px; color: var(--text-2, #64748b); }
.ev-table tr:last-child td { border-bottom: none; }
.ev-table tbody tr:hover { background: var(--surface-2, #f8fafc); }
.ev-act { background: none; border: none; cursor: pointer; font-size: 12px; padding: 2px 5px; color: var(--primary, #2563eb); }
.ev-act.danger { color: #dc2626; }

/* ── شارات التصنيف والحالة ── */
.ev-badge { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 11px; font-weight: 600; }
.ev-badge.excellent { background: #dcfce7; color: #166534; }
.ev-badge.very_good { background: #ccfbf1; color: #115e59; }
.ev-badge.good      { background: #dbeafe; color: #1e40af; }
.ev-badge.acceptable{ background: #ffedd5; color: #9a3412; }
.ev-badge.weak      { background: #fee2e2; color: #991b1b; }
.ev-badge.none      { background: var(--surface-2, #f1f5f9); color: var(--text-2, #64748b); }
.ev-status { display: inline-block; padding: 2px 8px; border-radius: 6px; font-size: 11px; }
.ev-status.draft { background: var(--surface-2, #f1f5f9); color: var(--text-2, #64748b); }
.ev-status.completed { background: #dcfce7; color: #166534; }

/* ── الحالات ── */
.ev-state { padding: 28px 16px; text-align: center; color: var(--text-2, #94a3b8); font-size: 13px; }
.ev-state.error { color: #dc2626; }

/* ── نموذج التقييم (درج كبير) ── */
.ev-drawer-backdrop {
  position: fixed; inset: 0; background: rgba(0,0,0,.4); z-index: 520;
  display: flex; justify-content: flex-end;
  opacity: 0; pointer-events: none; transition: opacity .2s;
}
.ev-drawer-backdrop.open { opacity: 1; pointer-events: auto; }
.ev-drawer {
  background: #fff; width: 100%; max-width: 940px; height: 100%;
  display: flex; flex-direction: column;
  transform: translateX(-100%); transition: transform .25s cubic-bezier(.32,.72,0,1);
}
.ev-drawer-backdrop.open .ev-drawer { transform: translateX(0); }
.ev-drawer-head {
  display: flex; align-items: center; gap: 10px;
  padding: 14px 18px; border-bottom: 1px solid var(--border, #e2e8f0);
}
.ev-drawer-head h3 { margin: 0; font-size: 15px; }
.ev-drawer-head .spacer { margin-inline-start: auto; }
.ev-drawer-body { flex: 1; overflow-y: auto; padding: 16px 18px; }
.ev-drawer-foot {
  display: flex; gap: 8px; align-items: center;
  padding: 12px 18px; border-top: 1px solid var(--border, #e2e8f0);
}
.ev-close { background: none; border: none; font-size: 20px; cursor: pointer; color: var(--text-2, #94a3b8); }

/* ── ترويسة النموذج ── */
.ev-meta { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 14px; }
.ev-meta label { display: block; font-size: 11.5px; color: var(--text-2, #64748b); margin-bottom: 4px; }
.ev-meta select, .ev-meta input {
  width: 100%; padding: 7px 10px;
  border: 1px solid var(--border, #e2e8f0); border-radius: 9px;
  font-family: inherit; font-size: 12.5px; background: transparent; color: inherit;
}

/* ── الملخّص الحيّ ── */
.ev-live {
  position: sticky; top: 0; z-index: 2;
  display: grid; grid-template-columns: repeat(6, 1fr); gap: 8px;
  padding: 10px; margin-bottom: 14px;
  border: 1px solid var(--border, #e2e8f0); border-radius: 12px;
  background: var(--surface-2, #f8fafc);
}
.ev-live .cell { text-align: center; }
.ev-live .cell .lbl { font-size: 10.5px; color: var(--text-2, #94a3b8); }
.ev-live .cell .val { font-size: 15px; font-weight: 700; }
.ev-progress { font-size: 12px; color: var(--text-2, #64748b); margin-bottom: 10px; }
.ev-progress b { color: inherit; }

/* ── الأقسام والمعايير ── */
.ev-section { border: 1px solid var(--border, #e2e8f0); border-radius: 12px; margin-bottom: 12px; overflow: hidden; }
.ev-section-head {
  display: flex; align-items: center; gap: 8px; width: 100%;
  padding: 11px 14px; background: var(--surface-2, #f8fafc);
  border: none; cursor: pointer; font-family: inherit;
  font-size: 13px; font-weight: 700; color: inherit; text-align: start;
}
.ev-section-head .count { margin-inline-start: auto; font-weight: 600; font-size: 11.5px; color: var(--text-2, #64748b); }
.ev-section-head .caret { font-size: 11px; color: var(--text-2, #94a3b8); }
.ev-section-body { padding: 10px 14px; }
.ev-section.collapsed .ev-section-body { display: none; }

.ev-crit { padding: 9px 0; border-bottom: 1px dashed var(--border, #eef2f7); }
.ev-crit:last-child { border-bottom: none; }
.ev-crit-top { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.ev-crit-name { font-size: 12.5px; flex: 1; }
.ev-crit-num { font-size: 11px; color: var(--text-2, #94a3b8); min-width: 18px; }
.ev-note-btn { background: none; border: none; cursor: pointer; font-size: 11.5px; color: var(--primary, #2563eb); }
.ev-note-input {
  width: 100%; margin-top: 6px; padding: 6px 9px;
  border: 1px solid var(--border, #e2e8f0); border-radius: 8px;
  font-family: inherit; font-size: 12px; background: transparent; color: inherit;
}
.ev-note-input.hidden { display: none; }

.ev-rates { display: grid; grid-template-columns: repeat(5, 1fr); gap: 5px; }
.ev-rate {
  padding: 7px 4px;
  border: 1.5px solid var(--border, #e2e8f0); border-radius: 9px;
  background: #fff; cursor: pointer;
  font-family: inherit; font-size: 11.5px; font-weight: 600;
  color: var(--text-2, #64748b);
  transition: border-color .15s, background .15s, color .15s;
}
.ev-rate:hover:not(:disabled) { border-color: var(--primary, #2563eb); }
.ev-rate:focus-visible { outline: 2px solid var(--primary, #2563eb); outline-offset: 2px; }
.ev-rate:disabled { opacity: .6; cursor: not-allowed; }
.ev-rate.on[data-rating="excellent"]  { border-color:#16a34a; background:#f0fdf4; color:#166534; }
.ev-rate.on[data-rating="very_good"]  { border-color:#0d9488; background:#f0fdfa; color:#115e59; }
.ev-rate.on[data-rating="good"]       { border-color:#2563eb; background:#eff6ff; color:#1e40af; }
.ev-rate.on[data-rating="acceptable"] { border-color:#ea580c; background:#fff7ed; color:#9a3412; }
.ev-rate.on[data-rating="weak"]       { border-color:#dc2626; background:#fef2f2; color:#991b1b; }
.ev-crit.missing .ev-crit-name::after { content: " •"; color: #dc2626; font-weight: 700; }

/* ── العرض والسجل ── */
.ev-view-row { display: flex; align-items: center; gap: 8px; padding: 6px 0; font-size: 12.5px; border-bottom: 1px dashed var(--border, #eef2f7); }
.ev-view-row .nm { flex: 1; }
.ev-view-row .pts { color: var(--text-2, #94a3b8); font-size: 11.5px; }
.ev-view-row .nt { color: var(--text-2, #64748b); font-size: 11.5px; font-style: italic; }
.ev-trend { display: flex; align-items: flex-end; gap: 6px; height: 96px; padding: 8px 0; }
.ev-trend .bar { flex: 1; min-width: 18px; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; gap: 3px; }
.ev-trend .fill { width: 100%; border-radius: 5px 5px 0 0; background: var(--primary, #2563eb); }
.ev-trend .pct { font-size: 10px; color: var(--text-2, #64748b); }
.ev-trend .mon { font-size: 10px; color: var(--text-2, #94a3b8); }

@media (max-width: 900px) {
  .ev-summary, .ev-sections-avg { grid-template-columns: repeat(2, 1fr); }
  .ev-meta { grid-template-columns: repeat(2, 1fr); }
  .ev-live { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 560px) {
  .ev-summary, .ev-sections-avg, .ev-meta { grid-template-columns: 1fr 1fr; }
  .ev-live { grid-template-columns: repeat(2, 1fr); }
  .ev-rates { grid-template-columns: repeat(3, 1fr); }
  .ev-drawer { max-width: 100%; }
}
@media (max-width: 380px) {
  .ev-rates { grid-template-columns: repeat(2, 1fr); }
  .ev-rate { font-size: 11px; padding: 6px 3px; }
}

[data-theme="dark"] .ev-card,
[data-theme="dark"] .ev-drawer,
[data-theme="dark"] .ev-rate { background: #131720; border-color: #2d3348; }
[data-theme="dark"] .ev-mini,
[data-theme="dark"] .ev-live,
[data-theme="dark"] .ev-section-head { background: #1a1f2e; }
[data-theme="dark"] .ev-table th { background: #1a1f2e; }
[data-theme="dark"] .ev-table-wrap,
[data-theme="dark"] .ev-section,
[data-theme="dark"] .ev-table th,
[data-theme="dark"] .ev-table td { border-color: #2d3348; }
