/**
 * نظام أثر لتوثيق الإنجازات ومؤشرات الأداء
 * ملف التنسيق الشامل (style.css)
 * واجهة عربية RTL - Mobile First - متوافقة مع الطباعة
 */

:root {
  --ink: #17342f;
  --green: #123d36;
  --green-2: #1e5a50;
  --green-dark: #0b2622;
  --mint: #e8f1ee;
  --paper: #f7f8f5;
  --white: #ffffff;
  --gold: #c99a43;
  --gold-soft: #f4ead5;
  --gold-border: #ead7b5;
  --red: #b74747;
  --red-soft: #fbebee;
  --blue: #2364a0;
  --blue-soft: #e8f2fc;
  --line: #dbe5e1;
  --muted: #60736f;
  --shadow: 0 12px 35px rgba(15, 55, 48, 0.08);
  --radius: 18px;
  --radius-sm: 10px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; font-size: 86.4%; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Tahoma, "Cairo", "Arial", sans-serif;
  line-height: 1.65;
  direction: rtl;
  text-align: right;
}

button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
a { color: var(--green); text-decoration: none; }
a:hover { text-decoration: underline; }

.wrap {
  width: min(1200px, calc(100% - 32px));
  margin: auto;
}

/* شريط التنقل العلوي (Topbar) */
.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(247, 248, 245, 0.97);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}
.nav {
  min-height: 64px;
  height: auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 0;
  flex-wrap: wrap;
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 800;
  color: var(--green);
  min-width: 0;
  flex: 1;
}
.brand a {
  color: inherit;
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  max-width: 100%;
}
img.nav-logo {
  max-height: 40px !important;
  height: 40px !important;
  width: auto !important;
  max-width: 110px !important;
  object-fit: contain !important;
  flex-shrink: 0 !important;
}
.brand-text {
  min-width: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  gap: 1px;
}
.brand-text strong {
  display: block;
  font-size: 1.05rem;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.brand-text small {
  display: block;
  color: var(--muted);
  font-weight: 500;
  font-size: .72rem;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
img.login-logo {
  max-height: 65px !important;
  height: 65px !important;
  width: auto !important;
  max-width: 180px !important;
  object-fit: contain !important;
  margin: 0 auto 12px !important;
  display: block !important;
}
img.report-logo {
  max-height: 55px !important;
  height: 55px !important;
  width: auto !important;
  max-width: 160px !important;
  object-fit: contain !important;
  display: block !important;
  flex-shrink: 0 !important;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 4px;
  flex: 2;
  justify-content: center;
}
.nav-links a {
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  font-weight: 700;
  font-size: .86rem;
  color: var(--ink);
  transition: .2s;
  white-space: nowrap;
}
.nav-links a:hover, .nav-links a.active {
  background: var(--mint);
  color: var(--green);
  text-decoration: none;
}
.nav-user-chip,
.unit-switch-in-menu,
.nav-logout-mobile,
.unit-switch-label {
  display: none;
}
.nav-user-desktop { display: inline-flex; align-items: center; gap: 6px; }
.nav-user-name {
  max-width: 160px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: .82rem;
  font-weight: 700;
  color: var(--green);
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}
.nav-logout { display: inline-flex; }

/* زر قائمة الجوال */
.nav-toggle {
  display: none;
  width: 42px;
  height: 42px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: white;
  padding: 10px 9px;
  flex-direction: column;
  justify-content: space-between;
  align-items: stretch;
}
.nav-toggle span {
  display: block;
  height: 2px;
  background: var(--green);
  border-radius: 2px;
  transition: transform .2s, opacity .2s;
}
.nav-toggle[aria-expanded="true"] span:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}
.nav-toggle[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
.nav-toggle[aria-expanded="true"] span:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
}

.page-head-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}
.btn-primary-action {
  background: var(--gold);
  min-height: 42px;
  padding-inline: 18px;
}
.btn-primary-action:hover { background: #b68735; }

.unit-switch-form select {
  width: 100%;
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 6px 10px;
  background: white;
  font-size: .86rem;
  color: var(--ink);
}

/* الأزرار (Buttons) */
.btn {
  border: 0;
  border-radius: 10px;
  padding: 9px 16px;
  background: var(--green);
  color: white;
  font-weight: 700;
  font-size: .86rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: all .2s ease;
  text-decoration: none;
}
.btn:hover { background: var(--green-2); color: white; text-decoration: none; transform: translateY(-1px); }
.btn.secondary { background: white; color: var(--green); border: 1px solid var(--line); }
.btn.secondary:hover { background: var(--paper); border-color: var(--green); }
.btn.gold { background: var(--gold); color: white; }
.btn.gold:hover { background: #b68735; }
.btn.danger { background: var(--red); color: white; }
.btn.danger:hover { background: #9c3636; }
.btn.sm { padding: 6px 10px; font-size: .78rem; border-radius: 8px; }

/* التنبيهات (Alerts) */
.alert {
  padding: 12px 16px;
  border-radius: 12px;
  margin-bottom: 20px;
  font-size: .88rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.alert-success { background: #e5f5eb; color: #17623a; border: 1px solid #c2e9d2; }
.alert-danger { background: var(--red-soft); color: var(--red); border: 1px solid #f4c7cb; }
.alert-info { background: var(--blue-soft); color: var(--blue); border: 1px solid #c8e0f7; }
.alert-warning { background: var(--gold-soft); color: #845e1b; border: 1px solid var(--gold-border); }

/* البطاقات والشبكات (Panels & Grids) */
.page-head {
  padding: 24px 0 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 15px;
}
.page-head h1 { font-size: 1.65rem; margin: 0; color: var(--green); }
.page-head p { margin: 3px 0 0; color: var(--muted); font-size: .88rem; }

.panel {
  background: white;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  margin-bottom: 24px;
  overflow: hidden;
}
.panel-head {
  padding: 16px 20px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 15px;
}
.panel-head h2, .panel-head h3 { margin: 0; font-size: 1.05rem; color: var(--green); }
.panel-body { padding: 20px; }

/* شريط الفلترة (Filter Toolbar) */
.toolbar {
  background: white;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px 20px;
  margin-bottom: 20px;
  box-shadow: var(--shadow);
}
.toolbar-form {
  display: flex;
  align-items: flex-end;
  gap: 12px;
  flex-wrap: wrap;
}
.filter-group { flex: 1; min-width: 140px; }
.filter-group label { display: block; font-size: .78rem; font-weight: 700; margin-bottom: 5px; color: var(--muted); }
.filter-group input, .filter-group select {
  width: 100%;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: #fbfcfb;
  font-size: .84rem;
}
.filter-group input:focus, .filter-group select:focus {
  border-color: var(--gold);
  outline: 0;
  box-shadow: 0 0 0 3px var(--gold-soft);
}

/* بطاقات المؤشرات (KPI Cards) */
.kpis-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 14px;
  margin-bottom: 24px;
}
.kpi-card {
  background: white;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 16px 18px;
  box-shadow: 0 4px 15px rgba(15, 55, 48, 0.04);
  position: relative;
  transition: transform .2s ease;
}
.kpi-card:hover { transform: translateY(-2px); }
.kpi-card small { color: var(--muted); display: block; font-size: .8rem; margin-bottom: 6px; font-weight: 700; }
.kpi-card strong { font-size: 1.85rem; line-height: 1.2; color: var(--green); display: block; }
.kpi-card .kpi-sub {
  font-size: .76rem;
  margin-top: 8px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  color: var(--muted);
}
.badge-rate {
  padding: 2px 7px;
  border-radius: 99px;
  font-weight: 800;
  font-size: .72rem;
}
.badge-rate.exceeded { background: #e5f5eb; color: #17623a; }
.badge-rate.good { background: var(--blue-soft); color: var(--blue); }
.badge-rate.pending { background: var(--paper); color: var(--muted); border: 1px solid var(--line); }

/* الرسوم البيانية والجداول */
.chart-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-bottom: 24px;
}
.chart-grid.chart-grid-3 {
  grid-template-columns: repeat(3, 1fr);
}
.chart-grid.chart-grid-4 {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}
.chart-grid-4 .chart-panel { padding: 12px; }
.chart-grid-4 .chart-container { height: 220px; }
.chart-span-2 { grid-column: span 2; }
.chart-panel {
  border: 1px solid var(--line);
  border-radius: 14px;
  background: white;
  padding: 16px;
  box-shadow: var(--shadow);
}
.chart-panel h4 {
  margin: 0 0 12px;
  font-size: .95rem;
  color: var(--green);
}
.chart-container {
  position: relative;
  width: 100%;
  height: 242px;
  direction: ltr;
}
.chart-container > div { height: 100%; }
.chart-container.tall { height: 276px; }
.chart-container .apexcharts-tooltip,
.chart-container .apexcharts-legend-text { direction: rtl; }

/* رأس بطاقة الرسم وزر التكبير */
.chart-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 10px;
}
.chart-panel-head h4 { margin: 0; }
.chart-expand-btn {
  flex: none;
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper);
  color: var(--green);
  font-size: 1rem;
  line-height: 1;
  cursor: pointer;
  transition: background .15s, color .15s;
}
.chart-expand-btn:hover { background: var(--green); color: white; }
.chart-placeholder { border: 1px dashed var(--line); border-radius: 14px; }
.chart-expand-backdrop {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: rgba(10, 30, 26, .55);
}
.chart-panel.is-expanded {
  position: fixed;
  z-index: 1001;
  top: 6vh;
  left: 50%;
  transform: translateX(-50%);
  width: min(1100px, 92vw);
  padding: 20px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, .3);
}
.chart-panel.is-expanded h4 { font-size: 1.15rem; }
.chart-panel.is-expanded .chart-container { height: calc(88vh - 110px); }

/* مؤشر الأثر وتقييم الاعتماد */
.impact-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 16px;
}
.impact-card {
  border: 1px solid var(--line);
  border-radius: 14px;
  background: white;
  padding: 16px 18px;
  box-shadow: var(--shadow);
}
.impact-card small { display: block; color: var(--muted); font-size: .78rem; margin-bottom: 6px; }
.impact-card strong { display: block; font-size: 1.8rem; color: var(--green); line-height: 1.2; }
@media (max-width: 700px) {
  .impact-grid { grid-template-columns: 1fr; }
}

/* وثيقة التقرير الرسمي (مشتركة بين report.php والتقرير العام) */
.report-header {
  border-bottom: 3px solid var(--green);
  padding-bottom: 18px;
  margin-bottom: 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}
.report-brand h2 { margin: 0 0 4px; font-size: 1.45rem; color: var(--green); }
.report-brand p { margin: 0; color: var(--muted); font-size: .88rem; }
.report-meta { text-align: left; font-size: .84rem; color: var(--muted); }
.report-meta strong { color: var(--ink); display: block; font-size: 1rem; margin-bottom: 3px; }
.report-section-title {
  font-size: 1.1rem;
  color: var(--green);
  border-right: 4px solid var(--gold);
  padding-right: 10px;
  margin: 28px 0 14px;
}
.rec-box {
  border: 1px dashed var(--line);
  border-radius: 12px;
  padding: 16px;
  background: #fafbfa;
  min-height: 80px;
  font-size: .85rem;
  color: var(--muted);
}
.report-charts .chart-panel { box-shadow: none; }

/* الصفحات العامة (أرشيف التقارير) */
.public-header {
  background: var(--green);
  color: white;
  padding: 26px 0;
}
.public-header-inner { display: flex; align-items: center; gap: 18px; }
.public-header h1 { margin: 0 0 4px; font-size: 1.5rem; }
.public-header p { margin: 0; opacity: .85; font-size: .9rem; }
.public-logo {
  height: 60px;
  width: auto;
  max-width: 150px;
  object-fit: contain;
  background: white;
  border-radius: 12px;
  padding: 6px;
}
.public-toolbar { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.archive-year {
  margin: 26px 0 12px;
  font-size: 1.15rem;
  color: var(--green);
  border-right: 4px solid var(--gold);
  padding-right: 10px;
}
.archive-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 14px;
}
.archive-card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
  padding: 18px;
  background: white;
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: var(--shadow);
  color: var(--ink);
  text-decoration: none;
  transition: transform .15s, border-color .15s;
}
.archive-card:hover { transform: translateY(-2px); border-color: var(--gold); }
.archive-card strong { color: var(--green); font-size: 1rem; line-height: 1.5; }
.archive-card small { color: var(--muted); }
.archive-card-cta { margin-top: auto; font-size: .82rem; font-weight: 700; color: var(--gold); }

/* روابط النشر العام */
.share-link-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.share-link-input {
  flex: 1;
  min-width: 260px;
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--paper);
  font-size: .82rem;
  direction: ltr;
  text-align: left;
}
.publish-options label {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 8px 0;
  font-size: .86rem;
  cursor: pointer;
}
.publish-options input[type="checkbox"] { margin-top: 3px; width: auto; }
.publish-options small { display: block; color: var(--muted); font-size: .74rem; }

/* البحث الفوري */
.filter-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  align-self: flex-end;
}
.filter-status { font-size: .78rem; color: var(--muted); white-space: nowrap; }
.filter-actions .btn[hidden] { display: none; }
#activitiesResults { transition: opacity .15s; }
#activitiesResults.is-loading { opacity: .55; pointer-events: none; }

/* لوحة تحليل نتائج الفلترة في سجل الأعمال */
.insights-panel > summary {
  list-style: none;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  padding: 14px 18px;
  font-weight: 700;
  color: var(--green);
}
.insights-panel > summary::-webkit-details-marker { display: none; }
.insights-panel > summary::after { content: '▾'; color: var(--muted); }
.insights-panel[open] > summary::after { content: '▴'; }
.insights-panel .panel-body { padding-top: 0; }
.insights-panel .kpis-grid { margin-bottom: 16px; }
.chart-empty {
  height: 100%;
  display: grid;
  place-items: center;
  color: var(--muted);
  font-size: .88rem;
}

/* النماذج (Forms) */
.form { display: grid; gap: 14px; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.three { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 14px; }
.field label { display: block; font-weight: 700; font-size: .84rem; margin-bottom: 6px; color: var(--ink); }
.field label span.req { color: var(--red); }
.field input, .field select, .field textarea {
  width: 100%;
  border: 1px solid var(--line);
  background: #fbfcfb;
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  color: var(--ink);
  outline: 0;
  transition: border-color .2s;
}
.field input:focus, .field select:focus, .field textarea:focus {
  border-color: var(--gold);
  box-shadow: 0 0 0 3px var(--gold-soft);
  background: white;
}
.field textarea { min-height: 85px; resize: vertical; }

.range-wrap {
  display: grid;
  grid-template-columns: 1fr 60px;
  align-items: center;
  gap: 12px;
}
.range-wrap input[type=range] {
  accent-color: var(--gold);
  padding: 0;
  cursor: pointer;
}
.range-val {
  background: var(--mint);
  color: var(--green);
  font-weight: 800;
  font-size: .9rem;
  padding: 4px 8px;
  border-radius: 8px;
  text-align: center;
}

/* الجداول (Data Tables) */
.table-responsive { width: 100%; overflow-x: auto; }
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: .84rem;
  text-align: right;
}
.data-table th, .data-table td {
  padding: 11px 14px;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}
.data-table th { background: #f6f8f6; font-weight: 800; color: var(--green); white-space: nowrap; }
.data-table tbody tr:hover { background: #fafbfa; }

/* شارات الحالات (Badges) */
.badge {
  display: inline-block;
  padding: 3px 8px;
  border-radius: 99px;
  font-size: .74rem;
  font-weight: 800;
  white-space: nowrap;
}
.badge-success { background: #e5f5eb; color: #17623a; }
.badge-warning { background: #fff2db; color: #9c6500; }
.badge-danger { background: var(--red-soft); color: var(--red); }
.badge-primary { background: var(--blue-soft); color: var(--blue); }
.badge-secondary { background: #eceeed; color: #5a6b67; }
.badge-gold { background: var(--gold-soft); color: #875c13; border: 1px solid var(--gold-border); }

/* مهام الوحدة */
.task-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}
.task-assign-form {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}
.task-assign-form select {
  max-width: 160px;
  padding: 6px 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfb;
  font-size: .78rem;
}
.inline-form { display: inline; margin: 0; }
.task-desc {
  margin-top: 4px;
  color: var(--muted);
  font-size: .78rem;
  white-space: pre-wrap;
}
.task-meta { font-size: .72rem; color: var(--muted); margin-top: 2px; }
.muted { color: var(--muted); }
.empty-note { margin: 0; color: var(--muted); text-align: center; padding: 18px 8px; }
.task-create-form .field { margin-bottom: 12px; }

/* النوافذ المنبثقة (Modals) */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 55, 48, 0.45);
  backdrop-filter: blur(4px);
  z-index: 100;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 15px;
}
.modal-backdrop.show { display: flex; }
.modal {
  background: white;
  border-radius: var(--radius);
  max-width: 720px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.2);
  position: relative;
  animation: modalIn .2s ease-out;
}
@keyframes modalIn {
  from { opacity: 0; transform: scale(.96); }
  to { opacity: 1; transform: scale(1); }
}
.modal-head {
  padding: 18px 24px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.modal-head h3 { margin: 0; font-size: 1.15rem; color: var(--green); }
.modal-close {
  background: transparent;
  border: 0;
  font-size: 1.4rem;
  color: var(--muted);
  line-height: 1;
  padding: 4px;
}
.modal-body { padding: 24px; }
.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--line);
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  background: #fbfcfb;
}

/* تذييل الصفحة (Footer) */
.footer {
  padding: 30px 0 40px;
  color: var(--muted);
  font-size: .84rem;
  margin-top: 40px;
}
.footer-inner {
  border-top: 1px solid var(--line);
  padding-top: 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
}

/* تجاوب الشاشات (Responsive) */
@media (max-width: 1100px) {
  .nav-links a { padding: 8px 8px; font-size: .8rem; }
  .chart-grid.chart-grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 900px) {
  .chart-grid { grid-template-columns: 1fr; }
  .chart-grid.chart-grid-3,
  .chart-grid.chart-grid-4 { grid-template-columns: 1fr; }
  .chart-span-2 { grid-column: auto; }
  .chart-panel.is-expanded { top: 3vh; width: 96vw; padding: 14px; }
  .two, .three { grid-template-columns: 1fr; }
  .toolbar-form { flex-direction: column; align-items: stretch; }
  .filter-group { width: 100%; }
  .filter-group select,
  .filter-group input,
  .toolbar-form .btn {
    width: 100%;
    min-height: 44px;
  }

  .nav {
    display: grid;
    grid-template-columns: 1fr auto;
    align-items: center;
    gap: 8px;
    padding: 8px 0;
    min-height: 56px;
  }
  .brand { grid-column: 1; }
  .nav-actions { grid-column: 2; }
  .nav-toggle { display: flex; }
  .nav-logout { display: none; }
  .nav-user-desktop { display: none; }

  .nav-links {
    display: none;
    grid-column: 1 / -1;
    width: 100%;
    flex-direction: column;
    align-items: stretch;
    gap: 4px;
    padding: 8px 0 4px;
    border-top: 1px solid var(--line);
    margin-top: 4px;
  }
  .nav-links.open { display: flex; }
  .nav-links a {
    padding: 12px 14px;
    font-size: .95rem;
    min-height: 44px;
    white-space: normal;
  }
  .nav-user-chip {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 10px 14px;
    margin-bottom: 4px;
    background: var(--mint);
    border-radius: 10px;
    font-size: .88rem;
    font-weight: 700;
  }
  .unit-switch-in-menu {
    display: block;
    padding: 8px 4px 12px;
  }
  .unit-switch-label {
    display: block;
    font-size: .75rem;
    color: var(--muted);
    margin-bottom: 6px;
    font-weight: 700;
  }
  .nav-logout-mobile {
    display: flex !important;
    margin-top: 6px;
    color: var(--red) !important;
    border: 1px solid #f4c7cb;
    background: var(--red-soft);
    justify-content: center;
  }
  img.nav-logo {
    max-height: 34px !important;
    height: 34px !important;
    max-width: 90px !important;
  }
  .brand-text strong { font-size: 1rem; }
  .brand-text small { max-width: 42vw; }
}

@media (max-width: 600px) {
  .wrap { width: calc(100% - 20px); }
  .page-head {
    flex-direction: column;
    align-items: stretch;
    gap: 14px;
  }
  .page-head-actions {
    width: 100%;
    flex-direction: column;
  }
  .page-head-actions .btn {
    width: 100%;
    min-height: 48px;
    font-size: .95rem;
  }
  .kpis-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
  .kpi-card { padding: 12px; }
  .kpi-card strong { font-size: 1.25rem; }
  .tabs-nav {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    flex-wrap: nowrap;
    padding-bottom: 10px;
  }
  .tabs-nav a { white-space: nowrap; flex-shrink: 0; }
  .table-responsive {
    margin: 0 -4px;
    border-radius: 12px;
  }
  .data-table { font-size: .8rem; }
  .data-table th, .data-table td { padding: 10px 8px; }
  .modal {
    width: 100%;
    max-width: 100%;
    max-height: 100%;
    border-radius: 16px 16px 0 0;
    margin-top: auto;
  }
  .modal-backdrop {
    align-items: flex-end;
    padding: 0;
  }
  .modal-body { padding: 16px; }
  .modal-footer {
    flex-direction: column-reverse;
    position: sticky;
    bottom: 0;
  }
  .modal-footer .btn { width: 100%; min-height: 48px; }
  .footer { padding-bottom: calc(24px + env(safe-area-inset-bottom, 0px)); }
  .footer-inner { flex-direction: column; align-items: flex-start; }
}

/* الخطة الاستراتيجية — عرض شجري خفيف */
.strategy-tree { display: flex; flex-direction: column; gap: 14px; margin-bottom: 24px; }
.strategy-goal .panel-head h3 {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  flex-wrap: wrap;
  line-height: 1.45;
}
.strategy-objectives {
  list-style: none;
  margin: 0;
  padding: 8px 16px 14px;
}
.strategy-objectives li {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
  font-size: 0.95rem;
  line-height: 1.45;
}
.strategy-objectives li:last-child { border-bottom: 0; }
.strategy-link-select {
  width: 100%;
  max-width: 280px;
  padding: 7px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  font-size: 0.85rem;
}
.strategy-hint {
  margin-top: 4px;
  font-size: 0.78rem;
  color: var(--blue);
}

/* تنسيقات الطباعة الرسمية للتقرير المؤسسي (Print Mode) */
@media print {
  body { background: white !important; color: black !important; font-size: 11pt; }
  .topbar, .toolbar, .nav-actions, .btn, .footer, .modal-backdrop, .nav-toggle { display: none !important; }
  .panel { border: 1px solid #ccc !important; box-shadow: none !important; break-inside: avoid; margin-bottom: 20px; }
  .data-table th { background: #f0f0f0 !important; color: black !important; -webkit-print-color-adjust: exact; }
  .kpis-grid { grid-template-columns: repeat(4, 1fr) !important; gap: 10px !important; }
  .kpi-card { border: 1px solid #ccc !important; box-shadow: none !important; }
  .chart-grid:not(.print-charts) { display: none !important; }
  .chart-grid.print-charts {
    display: grid !important;
    grid-template-columns: 1fr 1fr !important;
    gap: 12px !important;
    break-inside: avoid;
  }
  .chart-panel { box-shadow: none !important; break-inside: avoid; }
  .chart-span-2 { grid-column: auto !important; }
  .chart-container { height: 220px !important; }
  .chart-container .apexcharts-canvas,
  .chart-container svg.apexcharts-svg { width: 100% !important; height: 100% !important; }
  .apexcharts-toolbar, .apexcharts-tooltip { display: none !important; }
  .insights-panel { display: none !important; }
  .only-print { display: block !important; }
}
