/* DEF-Comply — single stylesheet, RTL/LTR aware, no external dependencies */
* { box-sizing: border-box; }
html { font-size: 15px; }
body {
  margin: 0; background: #f3f4f6; color: #1f2937;
  font-family: "Segoe UI", Tahoma, Arial, "Noto Naskh Arabic", sans-serif;
  line-height: 1.55;
}
body.rtl { font-family: Tahoma, "Segoe UI", Arial, "Noto Naskh Arabic", sans-serif; }
a { color: #1d4ed8; text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---------------- top bar */
.topbar {
  background: #111827; color: #f9fafb; padding: 10px 22px;
  display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 8px;
}
.brand a { color: #fff; font-size: 1.15rem; }
.brand .tagline { color: #9ca3af; font-size: .82rem; margin: 0 12px; }
.nav { display: flex; align-items: center; flex-wrap: wrap; gap: 4px 14px; }
.nav a { color: #e5e7eb; padding: 4px 2px; }
.nav a.lang { color: #fbbf24; }
.nav .who { color: #d1d5db; margin: 0 8px; }
.nav .who small { color: #9ca3af; }

/* ---------------- layout */
.page { max-width: 1100px; margin: 22px auto; padding: 0 18px; }
.foot { color: #6b7280; font-size: .78rem; text-align: center; padding: 26px 18px; }
h1 { font-size: 1.5rem; margin: 6px 0 16px; }
h2 { font-size: 1.15rem; margin: 22px 0 10px; }
h3 { font-size: 1rem; margin: 16px 0 8px; }
.muted { color: #6b7280; }
.small { font-size: .85rem; }
.row { display: flex; gap: 16px; flex-wrap: wrap; }
.col { flex: 1 1 300px; }

.card {
  background: #fff; border: 1px solid #e5e7eb; border-radius: 10px;
  padding: 16px 18px; margin-bottom: 16px; box-shadow: 0 1px 2px rgba(0,0,0,.04);
}
.card h2:first-child, .card h3:first-child { margin-top: 0; }

/* ---------------- alerts & buttons */
.alert { padding: 10px 14px; border-radius: 8px; margin-bottom: 14px; }
.alert.ok { background: #dcfce7; color: #166534; border: 1px solid #86efac; }
.alert.err { background: #fee2e2; color: #991b1b; border: 1px solid #fca5a5; }
.alert.info { background: #dbeafe; color: #1e3a8a; border: 1px solid #93c5fd; }
.btn {
  display: inline-block; background: #1d4ed8; color: #fff; border: 0; border-radius: 7px;
  padding: 8px 16px; cursor: pointer; font-size: .95rem;
}
.btn:hover { background: #1e40af; text-decoration: none; }
.btn.secondary { background: #e5e7eb; color: #111827; }
.btn.secondary:hover { background: #d1d5db; }
.btn.danger { background: #dc2626; }
.btn.danger:hover { background: #b91c1c; }
.btn.small { padding: 4px 10px; font-size: .82rem; }

/* ---------------- forms */
label { display: block; font-weight: 600; margin: 10px 0 4px; }
input[type=text], input[type=password], input[type=number], select, textarea {
  width: 100%; padding: 8px 10px; border: 1px solid #d1d5db; border-radius: 7px; font: inherit; background: #fff;
}
textarea { min-height: 70px; }
.inline label { display: inline; font-weight: normal; margin: 0 8px 0 0; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 0 18px; }
.actions { margin-top: 16px; display: flex; gap: 10px; flex-wrap: wrap; }

/* ---------------- tables */
table { width: 100%; border-collapse: collapse; background: #fff; }
th, td { padding: 8px 10px; border-bottom: 1px solid #e5e7eb; text-align: start; vertical-align: top; }
th { background: #f9fafb; font-weight: 600; font-size: .9rem; }
tr:hover td { background: #fafafa; }
td.num, th.num { text-align: center; white-space: nowrap; }

/* ---------------- score visuals */
.bar { background: #e5e7eb; border-radius: 6px; height: 14px; overflow: hidden; min-width: 120px; }
.bar > span { display: block; height: 100%; border-radius: 6px; }
.bar.good > span { background: #16a34a; }
.bar.warn > span { background: #d97706; }
.bar.bad  > span { background: #dc2626; }
.pill { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: .82rem; font-weight: 600; color: #fff; }
.pill.good { background: #16a34a; }
.pill.warn { background: #d97706; }
.pill.bad  { background: #dc2626; }
.pill.grey { background: #9ca3af; }
.big { font-size: 2.6rem; font-weight: 700; line-height: 1; }
.big.good { color: #16a34a; } .big.warn { color: #d97706; } .big.bad { color: #dc2626; }
.stat { text-align: center; padding: 12px; }
.stat .lbl { color: #6b7280; font-size: .85rem; }

/* dashboard tiles */
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 14px; }
.tile { background: #fff; border: 1px solid #e5e7eb; border-radius: 10px; padding: 14px; }
.tile .code { color: #6b7280; font-size: .8rem; }
.tile .name { font-weight: 600; margin: 4px 0 10px; min-height: 2.6em; }
.tile .pct { font-size: 1.9rem; font-weight: 700; }
.tile .pct.good { color: #16a34a; } .tile .pct.warn { color: #d97706; } .tile .pct.bad { color: #dc2626; } .tile .pct.grey { color: #9ca3af; }

/* simple column chart (pure CSS) */
.chart { display: flex; align-items: flex-end; gap: 14px; height: 220px; padding: 10px 6px 0; border-bottom: 2px solid #d1d5db; }
.chart .c { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; min-width: 60px; }
.chart .c .v { font-size: .8rem; margin-bottom: 4px; }
.chart .c .b { width: 70%; border-radius: 6px 6px 0 0; }
.chart .c .b.good { background: #16a34a; } .chart .c .b.warn { background: #d97706; } .chart .c .b.bad { background: #dc2626; } .chart .c .b.grey { background: #d1d5db; }
.chart-labels { display: flex; gap: 14px; padding: 6px 6px 0; }
.chart-labels div { flex: 1; text-align: center; font-size: .78rem; color: #4b5563; min-width: 60px; }
.target-line { position: relative; }

/* assessment form */
.qblock { border: 1px solid #e5e7eb; border-radius: 10px; padding: 12px 14px; margin-bottom: 10px; background: #fff; }
.qblock .qt { font-weight: 600; }
.qblock .qh { color: #6b7280; font-size: .85rem; margin-top: 2px; }
.qblock .opts { margin-top: 8px; display: flex; flex-wrap: wrap; gap: 6px 16px; }
.qblock .opts label { font-weight: normal; margin: 0; display: inline-flex; align-items: center; gap: 4px; }
.qblock .ev { margin-top: 8px; }
.qblock .ev input { max-width: 560px; }
.crit-head { background: #eef2ff; border-radius: 8px; padding: 8px 12px; margin: 18px 0 8px; font-weight: 600; }
.badge { font-size: .75rem; background: #fef3c7; color: #92400e; border-radius: 6px; padding: 1px 7px; margin: 0 6px; }
.w { font-size: .78rem; color: #6b7280; }

/* login */
.login-box { max-width: 380px; margin: 60px auto; }
.login-box h1 { text-align: center; }
.creds { font-size: .8rem; color: #6b7280; margin-top: 12px; }

@media print {
  .topbar, .foot, .actions, .btn, .nav { display: none !important; }
  .page { max-width: none; margin: 0; }
  .card { box-shadow: none; break-inside: avoid; }
}
