/* ══════════════════════════════════════════════════════════════
   اتحاد العلاقات — نظام تشغيل المشاريع v3
   واجهة عربية RTL · داكن كحلي + ذهبي · خطوط النظام فقط
   ══════════════════════════════════════════════════════════════ */

:root {
  --ground: #0d1526;
  --ground-2: #0a1120;
  --panel: #16233c;
  --panel-2: #1c2c49;
  --panel-3: #223255;
  --line: #26375a;
  --line-soft: #1f2e4d;
  --gold: #e0b252;
  --gold-dim: #a8853d;
  --blue: #5b8def;
  --green: #4cc38a;
  --red: #e0525f;
  --amber: #e0a552;
  --purple: #9b7fe0;
  --text: #e8eefc;
  --text-2: #c3d0e8;
  --muted: #8fa1c2;
  --muted-2: #6c7fa0;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 10px 30px rgba(0, 0, 0, .45);
  --nav-w: 236px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  min-height: 100%;
}

body {
  background:
    radial-gradient(1100px 600px at 90% -10%, #17284a 0%, transparent 60%),
    radial-gradient(900px 500px at 5% 105%, #14203a 0%, transparent 55%),
    var(--ground);
  background-attachment: fixed;
  color: var(--text);
  font-family: "Segoe UI", "Noto Kufi Arabic", "Tajawal", system-ui, sans-serif;
  font-size: 15px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }
button { font-family: inherit; }
.hidden { display: none !important; }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #2a3c61; border-radius: 8px; }
::-webkit-scrollbar-thumb:hover { background: #375083; }

/* ─────────────── نماذج وأزرار ─────────────── */
label { display: block; font-size: 12.5px; color: var(--muted); margin-bottom: 5px; font-weight: 600; }

input[type=text], input[type=password], input[type=date], input[type=number],
input[type=search], select, textarea {
  width: 100%;
  background: var(--ground-2);
  border: 1px solid var(--line);
  color: var(--text);
  border-radius: var(--radius-sm);
  padding: 9px 12px;
  font-family: inherit;
  font-size: 14px;
  transition: border-color .15s, box-shadow .15s;
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--gold-dim);
  box-shadow: 0 0 0 3px rgba(224, 178, 82, .12);
}
textarea { resize: vertical; min-height: 78px; line-height: 1.6; }
select { cursor: pointer; }
option { background: var(--panel); color: var(--text); }
input::placeholder, textarea::placeholder { color: #5d6f92; }

.btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  background: var(--panel-2);
  border: 1px solid var(--line);
  color: var(--text);
  border-radius: var(--radius-sm);
  padding: 8px 14px;
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  transition: background .15s, border-color .15s, transform .08s;
  white-space: nowrap;
}
.btn:hover:not(:disabled) { background: var(--panel-3); border-color: #334775; }
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn:disabled { opacity: .42; cursor: not-allowed; }
.btn-gold { background: linear-gradient(180deg, #e6bc61, #cf9f3d); color: #211705; border-color: #b98c2e; }
.btn-gold:hover:not(:disabled) { background: linear-gradient(180deg, #f0c76c, #d9a944); border-color: #d3a238; }
.btn-ghost { background: transparent; }
.btn-danger { color: #ffbfc4; border-color: #5d2530; background: #35161c; }
.btn-danger:hover:not(:disabled) { background: #461c24; }
.btn-ok { color: #bff0d8; border-color: #1f5b41; background: #16382a; }
.btn-ok:hover:not(:disabled) { background: #1c4835; }
.btn-sm { padding: 5px 10px; font-size: 12.5px; }
.btn-block { width: 100%; justify-content: center; padding: 11px; }

/* ─────────────── شاشات الدخول ─────────────── */
.auth-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 22px;
}
.auth-card {
  width: 100%;
  max-width: 420px;
  background: linear-gradient(180deg, #182747, var(--panel));
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 30px 26px;
  box-shadow: var(--shadow);
}
.auth-brand { text-align: center; margin-bottom: 22px; }
.auth-mark {
  width: 56px; height: 56px; margin: 0 auto 12px;
  border-radius: 16px;
  background: linear-gradient(145deg, #e6bc61, #b98c2e);
  color: #1a1204;
  display: flex; align-items: center; justify-content: center;
  font-size: 25px; font-weight: 800;
  box-shadow: 0 6px 18px rgba(224, 178, 82, .25);
}
.auth-brand h1 { margin: 0; font-size: 19px; letter-spacing: -.2px; }
.auth-brand p { margin: 4px 0 0; color: var(--muted); font-size: 12.5px; }
.auth-card .field { margin-bottom: 14px; }
.auth-note {
  margin-top: 16px; font-size: 12px; color: var(--muted);
  text-align: center; line-height: 1.7;
}
.auth-err {
  background: #35161c; border: 1px solid #5d2530; color: #ffc2c7;
  border-radius: var(--radius-sm); padding: 9px 12px; font-size: 13px; margin-bottom: 14px;
}
.auth-info {
  background: #14314a; border: 1px solid #245577; color: #b8dcf3;
  border-radius: var(--radius-sm); padding: 9px 12px; font-size: 13px; margin-bottom: 14px;
}

/* ─────────────── الهيكل ─────────────── */
.topbar {
  position: sticky; top: 0; z-index: 60;
  height: 58px;
  display: flex; align-items: center; gap: 14px;
  padding: 0 18px;
  background: rgba(13, 21, 38, .93);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line-soft);
}
.topbar .mark {
  width: 32px; height: 32px; border-radius: 9px;
  background: linear-gradient(145deg, #e6bc61, #b98c2e);
  color: #1a1204; display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 15px; flex: none;
}
.topbar .org { font-weight: 700; font-size: 14.5px; white-space: nowrap; }
.topbar .org span { color: var(--muted); font-weight: 500; font-size: 12px; }
.topbar .spacer { flex: 1; }
.topbar .who { display: flex; align-items: center; gap: 9px; font-size: 13px; }
.topbar .who b { font-weight: 600; }
.topbar .who small { color: var(--muted); font-size: 11.5px; display: block; line-height: 1.2; }
.nav-toggle { display: none; }

.layout { display: flex; align-items: flex-start; }

.sidenav {
  position: sticky; top: 58px;
  width: var(--nav-w); flex: none;
  height: calc(100vh - 58px);
  overflow-y: auto;
  padding: 16px 12px 30px;
  border-inline-start: 1px solid var(--line-soft);
}
.nav-sec { font-size: 11px; color: var(--muted-2); font-weight: 700; padding: 12px 10px 6px; letter-spacing: .3px; }
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 11px; border-radius: 10px;
  color: var(--text-2); font-size: 14px; font-weight: 600;
  cursor: pointer; margin-bottom: 2px;
  border: 1px solid transparent;
}
.nav-item:hover { background: var(--panel); color: var(--text); text-decoration: none; }
.nav-item.on { background: var(--panel-2); color: var(--text); border-color: var(--line); box-shadow: inset 3px 0 0 var(--gold); }
.nav-item .ic { font-size: 15px; width: 20px; text-align: center; flex: none; }
.nav-item .badge {
  margin-inline-start: auto;
  background: var(--gold); color: #201603;
  border-radius: 999px; padding: 0 7px;
  font-size: 11.5px; font-weight: 800; min-width: 20px; text-align: center;
}
.nav-item .badge.red { background: var(--red); color: #fff; }

main.content { flex: 1; min-width: 0; padding: 20px 22px 80px; }

/* ─────────────── عناصر عامة ─────────────── */
.page-head { display: flex; align-items: flex-start; gap: 14px; flex-wrap: wrap; margin-bottom: 18px; }
.page-head h2 { margin: 0; font-size: 21px; letter-spacing: -.3px; }
.page-head p { margin: 3px 0 0; color: var(--muted); font-size: 13px; }
.page-head .spacer { flex: 1; }
.page-head .acts { display: flex; gap: 8px; flex-wrap: wrap; }

.card {
  background: var(--panel);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  padding: 16px;
}
.card h3 { margin: 0 0 12px; font-size: 15px; display: flex; align-items: center; gap: 8px; }
.card h3 .count { color: var(--muted); font-weight: 500; font-size: 12.5px; }

.grid { display: grid; gap: 14px; }
.g2 { grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }
.g3 { grid-template-columns: repeat(auto-fill, minmax(272px, 1fr)); }

.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.empty { color: var(--muted); font-size: 13.5px; padding: 22px 8px; text-align: center; }
.empty b { display: block; color: var(--text-2); font-size: 14px; margin-bottom: 4px; }
.mono { font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; font-size: 12px; direction: ltr; display: inline-block; }

.banner {
  display: flex; align-items: flex-start; gap: 10px;
  border-radius: var(--radius-sm); padding: 10px 13px;
  font-size: 13px; margin-bottom: 12px; border: 1px solid;
}
.banner.warn { background: #3a2c12; border-color: #6b5220; color: #f0d49a; }
.banner.danger { background: #35161c; border-color: #5d2530; color: #ffc2c7; }
.banner .ic { font-size: 15px; line-height: 1.4; }

/* شرائح */
.chip {
  display: inline-flex; align-items: center; gap: 5px;
  border-radius: 999px; padding: 2px 10px;
  font-size: 11.5px; font-weight: 700;
  background: var(--panel-2); border: 1px solid var(--line); color: var(--text-2);
  white-space: nowrap;
}
.chip.gold { background: #3a2c12; border-color: #6b5220; color: #f0d49a; }
.chip.blue { background: #172c53; border-color: #2b4a83; color: #b6cdfa; }
.chip.green { background: #123528; border-color: #1f5b41; color: #a9ecc9; }
.chip.red { background: #35161c; border-color: #5d2530; color: #ffbfc4; }
.chip.purple { background: #26204a; border-color: #453a7d; color: #cdbcf5; }
.chip.amber { background: #38290f; border-color: #6a4f1c; color: #f2ce93; }
.chip.grey { background: #1b2740; border-color: #2b3b5e; color: #9db0d0; }

.dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; flex: none; }
.dot.green { background: var(--green); box-shadow: 0 0 0 3px rgba(76, 195, 138, .16); }
.dot.yellow { background: var(--amber); box-shadow: 0 0 0 3px rgba(224, 165, 82, .16); }
.dot.red { background: var(--red); box-shadow: 0 0 0 3px rgba(224, 82, 95, .16); }
.dot.grey { background: #64789b; }

/* شريط تقدم */
.bar { height: 6px; background: #0e1a2f; border-radius: 999px; overflow: hidden; }
.bar > i { display: block; height: 100%; border-radius: 999px; background: linear-gradient(90deg, var(--gold), #f0cd85); }
.bar.blue > i { background: linear-gradient(90deg, var(--blue), #8fb4ff); }
.bar.green > i { background: linear-gradient(90deg, var(--green), #86e0b5); }
.bar.red > i { background: linear-gradient(90deg, var(--red), #f18b95); }

/* بلاطات الأرقام */
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(122px, 1fr)); gap: 10px; }
.tile {
  background: var(--panel); border: 1px solid var(--line-soft);
  border-radius: var(--radius); padding: 13px 14px;
  cursor: default;
}
.tile.link { cursor: pointer; }
.tile.link:hover { border-color: var(--line); background: var(--panel-2); }
.tile .n { font-size: 26px; font-weight: 800; line-height: 1.1; letter-spacing: -.5px; }
.tile .l { font-size: 12px; color: var(--muted); margin-top: 3px; }
.tile.is-red .n { color: var(--red); }
.tile.is-amber .n { color: var(--amber); }
.tile.is-green .n { color: var(--green); }
.tile.is-blue .n { color: var(--blue); }
.tile.is-gold .n { color: var(--gold); }
.tile.is-purple .n { color: var(--purple); }

/* الصورة الرمزية */
.avatar {
  width: 28px; height: 28px; border-radius: 9px;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 800; flex: none;
  letter-spacing: -.3px;
}
.avatar.lg { width: 36px; height: 36px; font-size: 13px; border-radius: 11px; }
.avatar.none { background: transparent; border: 1px dashed #3c507c; color: #6c7fa0; font-weight: 600; }

/* ─────────────── بطاقات المشاريع ─────────────── */
.pcard {
  background: var(--panel); border: 1px solid var(--line-soft);
  border-radius: var(--radius); padding: 15px;
  cursor: pointer; transition: border-color .15s, transform .1s, background .15s;
  display: flex; flex-direction: column; gap: 10px;
}
.pcard:hover { border-color: #334775; background: var(--panel-2); transform: translateY(-2px); }
.pcard .top { display: flex; align-items: flex-start; gap: 9px; }
.pcard .nm { font-weight: 700; font-size: 15px; line-height: 1.4; flex: 1; }
.pcard .meta { display: flex; flex-wrap: wrap; gap: 6px; }
.pcard .foot { display: flex; align-items: center; justify-content: space-between; font-size: 12px; color: var(--muted); }

/* ─────────────── المراحل ─────────────── */
.phase-strip { display: flex; gap: 10px; overflow-x: auto; padding-bottom: 6px; }
.phase {
  flex: 1 1 165px; min-width: 165px;
  background: var(--panel-2); border: 1px solid var(--line);
  border-radius: 10px; padding: 11px 12px;
}
.phase .nm { font-weight: 700; font-size: 13.5px; margin-bottom: 3px; }
.phase .sub { font-size: 11.5px; color: var(--muted); margin-bottom: 8px; }
.phase.done { border-color: #1f5b41; }
.phase.active { border-color: var(--gold-dim); box-shadow: 0 0 0 1px rgba(224, 178, 82, .18); }

/* قوائم */
.list { display: flex; flex-direction: column; gap: 8px; }
.row {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 11px; border-radius: 10px;
  background: var(--panel-2); border: 1px solid var(--line-soft);
}
.row.click { cursor: pointer; }
.row.click:hover { border-color: #334775; background: var(--panel-3); }
.row .grow { flex: 1; min-width: 0; }
.row .t { font-weight: 600; font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row .s { font-size: 11.5px; color: var(--muted); margin-top: 2px; display: flex; gap: 8px; flex-wrap: wrap; }
.row.sev-critical { border-inline-start: 3px solid var(--red); }
.row.sev-high { border-inline-start: 3px solid var(--amber); }
.row.sev-medium { border-inline-start: 3px solid var(--blue); }
.row.sev-low { border-inline-start: 3px solid #4d618c; }

/* ─────────────── التبويبات ─────────────── */
.tabs {
  display: flex; gap: 4px; overflow-x: auto;
  border-bottom: 1px solid var(--line-soft); margin-bottom: 16px;
  scrollbar-width: none;
}
.tabs::-webkit-scrollbar { display: none; }
.tab {
  padding: 9px 15px; border: 0; background: transparent;
  color: var(--muted); font-size: 13.5px; font-weight: 700; cursor: pointer;
  border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap;
  border-radius: 8px 8px 0 0;
}
.tab:hover { color: var(--text-2); background: rgba(255,255,255,.02); }
.tab.on { color: var(--gold); border-bottom-color: var(--gold); }

/* ─────────────── كانبان ─────────────── */
.toolbar {
  display: flex; gap: 8px; flex-wrap: wrap; align-items: center;
  margin-bottom: 14px;
}
.toolbar input[type=search], .toolbar select { width: auto; min-width: 150px; }

.kanban { display: flex; gap: 12px; overflow-x: auto; padding-bottom: 12px; align-items: flex-start; }
.kcol {
  flex: 0 0 278px; width: 278px;
  background: rgba(22, 35, 60, .55);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  padding: 11px;
}
.kcol > .h { margin-bottom: 10px; }
.kcol .ttl { display: flex; align-items: center; gap: 7px; font-weight: 700; font-size: 13.5px; }
.kcol .ttl .n { margin-inline-start: auto; color: var(--muted); font-size: 12px; font-weight: 600; }
.kcol .sub { font-size: 11px; color: var(--muted-2); margin-top: 3px; line-height: 1.5; }
.kcol .body { display: flex; flex-direction: column; gap: 8px; max-height: 62vh; overflow-y: auto; }

.tcard {
  background: var(--panel); border: 1px solid var(--line-soft);
  border-radius: 10px; padding: 10px 11px; cursor: pointer;
  transition: border-color .13s, transform .08s;
}
.tcard:hover { border-color: #3a5183; transform: translateY(-1px); }
.tcard .t { font-size: 13.2px; font-weight: 600; line-height: 1.5; margin-bottom: 7px; }
.tcard .f { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; }
.tcard .code { color: var(--muted-2); font-size: 10.5px; direction: ltr; }
.tcard .due { font-size: 11.5px; color: var(--muted); margin-inline-start: auto; }
.tcard .due.late { color: var(--red); font-weight: 700; }
.tcard.late { border-inline-start: 3px solid var(--red); }
.tcard.blocked { border-inline-start: 3px solid var(--amber); }

/* ─────────────── جدول المهام ─────────────── */
.tbl-wrap { overflow-x: auto; border: 1px solid var(--line-soft); border-radius: var(--radius); }
table.tbl { width: 100%; border-collapse: collapse; font-size: 13px; min-width: 660px; }
table.tbl th {
  text-align: start; padding: 10px 12px; background: var(--panel-2);
  color: var(--muted); font-size: 11.5px; font-weight: 700;
  border-bottom: 1px solid var(--line); white-space: nowrap;
}
table.tbl td { padding: 10px 12px; border-bottom: 1px solid var(--line-soft); vertical-align: middle; }
table.tbl tr:last-child td { border-bottom: 0; }
table.tbl tbody tr { background: var(--panel); cursor: pointer; }
table.tbl tbody tr:hover { background: var(--panel-2); }
table.tbl td.tt { font-weight: 600; max-width: 340px; }

.pager { display: flex; align-items: center; gap: 8px; justify-content: center; margin-top: 14px; flex-wrap: wrap; }
.pager .info { color: var(--muted); font-size: 12.5px; }

/* ─────────────── السجل ─────────────── */
.audit { display: flex; flex-direction: column; }
.aud {
  display: flex; gap: 11px; padding: 10px 2px;
  border-bottom: 1px solid var(--line-soft);
}
.aud:last-child { border-bottom: 0; }
.aud .when { font-size: 11px; color: var(--muted-2); width: 108px; flex: none; direction: ltr; text-align: start; padding-top: 2px; }
.aud .body { flex: 1; min-width: 0; }
.aud .ln { font-size: 13px; }
.aud .df { font-size: 12px; margin-top: 4px; color: var(--muted); word-break: break-word; }
.aud .df .b { color: #f0a3aa; text-decoration: line-through; }
.aud .df .a { color: #a9ecc9; }
.aud .why { font-size: 12px; color: var(--gold); margin-top: 3px; }

/* ─────────────── التعليقات ─────────────── */
.cmt { display: flex; gap: 10px; padding: 11px 0; border-bottom: 1px solid var(--line-soft); }
.cmt:last-child { border-bottom: 0; }
.cmt .b { flex: 1; min-width: 0; }
.cmt .hd { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 4px; }
.cmt .hd b { font-size: 13px; }
.cmt .hd time { font-size: 11px; color: var(--muted-2); }
.cmt .tx { font-size: 13.3px; white-space: pre-wrap; word-break: break-word; line-height: 1.7; color: var(--text-2); }
.cmt.k-blocker { background: rgba(224, 82, 95, .06); border-radius: 8px; padding: 11px 10px; }
.cmt.k-decision { background: rgba(155, 127, 224, .07); border-radius: 8px; padding: 11px 10px; }
.cmt.k-ai_review, .cmt.k-ai_note { background: rgba(91, 141, 239, .06); border-radius: 8px; padding: 11px 10px; }

/* ─────────────── النافذة المنبثقة ─────────────── */
.overlay {
  position: fixed; inset: 0; z-index: 200;
  background: rgba(5, 9, 18, .74);
  backdrop-filter: blur(3px);
  display: flex; align-items: flex-start; justify-content: center;
  padding: 26px 16px; overflow-y: auto;
}
.modal {
  width: 100%; max-width: 880px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: var(--shadow);
  overflow: hidden;
  margin-bottom: 40px;
}
.modal.sm { max-width: 520px; }
.modal.md { max-width: 660px; }
.modal .mhead {
  padding: 15px 18px; border-bottom: 1px solid var(--line-soft);
  display: flex; align-items: flex-start; gap: 12px;
  background: linear-gradient(180deg, #1a2a4a, var(--panel));
  position: sticky; top: 0; z-index: 3;
}
.modal .mhead .grow { flex: 1; min-width: 0; }
.modal .mhead h3 { margin: 0; font-size: 16.5px; line-height: 1.5; }
.modal .mhead .sub { display: flex; gap: 7px; flex-wrap: wrap; margin-top: 7px; align-items: center; }
.modal .mbody { padding: 16px 18px; }
.modal .mfoot {
  padding: 13px 18px; border-top: 1px solid var(--line-soft);
  display: flex; gap: 8px; justify-content: flex-start; flex-wrap: wrap;
  background: var(--ground-2);
}
.x-btn {
  background: transparent; border: 1px solid var(--line); color: var(--muted);
  width: 30px; height: 30px; border-radius: 8px; cursor: pointer; flex: none;
  font-size: 16px; line-height: 1; display: flex; align-items: center; justify-content: center;
}
.x-btn:hover { color: var(--text); background: var(--panel-2); }

.dod {
  background: rgba(224, 178, 82, .08);
  border: 1px solid rgba(224, 178, 82, .32);
  border-inline-start: 3px solid var(--gold);
  border-radius: 10px; padding: 11px 13px; margin: 12px 0;
}
.dod .lb { font-size: 11.5px; color: var(--gold); font-weight: 800; margin-bottom: 4px; }
.dod .tx { font-size: 13.5px; white-space: pre-wrap; line-height: 1.7; }

.gate {
  border-radius: 10px; padding: 11px 13px; margin: 12px 0; font-size: 13px;
  border: 1px solid;
}
.gate.ok { background: #123528; border-color: #1f5b41; color: #a9ecc9; }
.gate.bad { background: #35161c; border-color: #5d2530; color: #ffc2c7; }
.gate ul { margin: 7px 0 0; padding-inline-start: 18px; }
.gate li { margin-bottom: 3px; }

.kv { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; margin: 12px 0; }
.kv .i { background: var(--ground-2); border: 1px solid var(--line-soft); border-radius: 9px; padding: 8px 11px; }
.kv .i .l { font-size: 11px; color: var(--muted); }
.kv .i .v { font-size: 13.5px; font-weight: 600; margin-top: 2px; }

.sec-t { font-size: 12px; color: var(--muted); font-weight: 800; margin: 16px 0 8px; letter-spacing: .2px; }

.trans-row { display: flex; gap: 8px; flex-wrap: wrap; }

.dropzone {
  border: 2px dashed var(--line); border-radius: 12px;
  padding: 20px; text-align: center; color: var(--muted); font-size: 13px;
  cursor: pointer; transition: border-color .15s, background .15s;
}
.dropzone:hover, .dropzone.over { border-color: var(--gold-dim); background: rgba(224, 178, 82, .06); color: var(--text-2); }

.verdict { border-radius: 10px; padding: 12px 14px; margin: 12px 0; border: 1px solid; }
.verdict.PASS { background: #123528; border-color: #1f5b41; }
.verdict.FAIL { background: #35161c; border-color: #5d2530; }
.verdict.NEEDS_REVISION { background: #38290f; border-color: #6a4f1c; }
.verdict .hd { font-weight: 800; font-size: 14px; margin-bottom: 6px; }
.verdict ul { margin: 6px 0 0; padding-inline-start: 18px; font-size: 13px; }

.ai-answer {
  background: var(--ground-2); border: 1px solid var(--line-soft);
  border-inline-start: 3px solid var(--purple);
  border-radius: 10px; padding: 13px 15px; margin-top: 12px;
  white-space: pre-wrap; font-size: 13.6px; line-height: 1.8; word-break: break-word;
}
.suggests { display: flex; gap: 7px; flex-wrap: wrap; margin-top: 10px; }
.sug {
  background: var(--panel-2); border: 1px solid var(--line); color: var(--text-2);
  border-radius: 999px; padding: 5px 12px; font-size: 12.3px; cursor: pointer;
}
.sug:hover { border-color: var(--gold-dim); color: var(--text); }

.spin {
  width: 15px; height: 15px; border-radius: 50%;
  border: 2px solid rgba(224, 178, 82, .28); border-top-color: var(--gold);
  display: inline-block; animation: sp .7s linear infinite;
}
@keyframes sp { to { transform: rotate(360deg); } }
.loading { display: flex; align-items: center; gap: 10px; color: var(--muted); padding: 26px 6px; font-size: 13.5px; justify-content: center; }

/* ─────────────── التنبيهات ─────────────── */
#toasts {
  position: fixed; bottom: 18px; inset-inline-start: 18px; z-index: 500;
  display: flex; flex-direction: column; gap: 9px; max-width: min(400px, calc(100vw - 36px));
}
.toast {
  background: var(--panel-2); border: 1px solid var(--line);
  border-radius: 10px; padding: 11px 14px; font-size: 13.3px;
  box-shadow: var(--shadow); animation: tin .2s ease-out;
  display: flex; gap: 9px; align-items: flex-start;
}
.toast.ok { border-color: #1f5b41; background: #14372a; color: #c5f0dc; }
.toast.err { border-color: #5d2530; background: #38181f; color: #ffc9cd; }
.toast.warn { border-color: #6b5220; background: #3a2c12; color: #f2d9a4; }
@keyframes tin { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

/* ─────────────── الفريق ─────────────── */
.wl { display: flex; align-items: center; gap: 9px; }
.wl .bar { flex: 1; min-width: 60px; }
.wl .pct { font-size: 11.5px; color: var(--muted); width: 52px; text-align: end; direction: ltr; flex: none; }

/* ─────────────── الاستجابة ─────────────── */
@media (max-width: 1000px) {
  .sidenav {
    position: static; width: 100%; height: auto;
    border-inline-start: 0; border-bottom: 1px solid var(--line-soft);
    display: flex; gap: 6px; overflow-x: auto; padding: 10px;
  }
  .sidenav::-webkit-scrollbar { display: none; }
  .nav-sec { display: none; }
  .nav-item { margin-bottom: 0; white-space: nowrap; }
  .layout { flex-direction: column; }
  main.content { width: 100%; padding: 16px 14px 70px; }
}

@media (max-width: 620px) {
  body { font-size: 14.5px; }
  .topbar { padding: 0 12px; gap: 9px; }
  .topbar .org span { display: none; }
  .topbar .who small { display: none; }
  .kanban { display: block; overflow: visible; }
  .kcol { width: 100%; flex: none; margin-bottom: 12px; }
  .kcol .body { max-height: none; }
  .overlay { padding: 10px 8px; }
  .modal { border-radius: 13px; }
  .modal .mbody { padding: 13px 12px; }
  .modal .mhead { padding: 12px; }
  .aud { flex-direction: column; gap: 3px; }
  .aud .when { width: auto; }
  .tiles { grid-template-columns: repeat(auto-fit, minmax(105px, 1fr)); }
  .tile .n { font-size: 22px; }
}

@media (max-width: 400px) {
  main.content { padding: 12px 9px 60px; }
  .card { padding: 12px; }
  .page-head h2 { font-size: 18px; }
  .toolbar input[type=search], .toolbar select { min-width: 0; width: 100%; }
}

/* ══════════════════════════════════════════════════════════════════
   المؤشرات واللوحات
   ألوان السلاسل: خانات فئوية ثابتة بترتيب لا يُدوَّر.
   مُتحقَّق منها آلياً على سطح #16233c — نطاق الإضاءة، أرضية التشبّع،
   فصل عمى الألوان (ΔE 8.4 protan)، والتباين ≥ 3:1.
   ألوان الحالة (سليم/تحذير/حرج) محجوزة ولا تُستخدم كسلسلة أبداً.
   ══════════════════════════════════════════════════════════════════ */
:root {
  --s1: #3987e5;   /* خانة ١ — أزرق  */
  --s2: #d95926;   /* خانة ٢ — برتقالي */
  --s3: #199e70;   /* خانة ٣ — مائي  */
  --s4: #c98500;   /* خانة ٤ — أصفر  */
  --grid: #22314f;
  --surface: #16233c;
}

.kpis { display:grid; grid-template-columns:repeat(auto-fit,minmax(158px,1fr)); gap:12px; margin-bottom:18px; }
.kpi { background:var(--panel); border:1px solid var(--line-soft); border-radius:var(--radius); padding:14px 16px; }
.kpi .lbl { color:var(--muted); font-size:12px; margin-bottom:6px; }
/* أرقام البطاقات بأرقام متناسبة لا ثابتة العرض — الثابتة تُرخي الرقم الكبير */
.kpi .val { font-size:26px; font-weight:700; line-height:1.15; font-variant-numeric:proportional-nums; }
.kpi .sub { color:var(--muted-2); font-size:11px; margin-top:4px; }
.kpi.good .val { color:var(--green); } .kpi.warn .val { color:var(--amber); } .kpi.bad .val { color:var(--red); }

.viz { background:var(--panel); border:1px solid var(--line-soft); border-radius:var(--radius); padding:16px; margin-bottom:16px; }
.viz-head { display:flex; align-items:center; justify-content:space-between; gap:10px; margin-bottom:4px; }
.viz-head h3 { font-size:14px; margin:0; }
.viz-note { color:var(--muted-2); font-size:11px; margin:0 0 12px; }
.viz-body { overflow-x:auto; }
.viz svg { display:block; max-width:100%; height:auto; }
.viz .axis, .viz .gridline { stroke:var(--grid); stroke-width:1; }   /* خطوط شعرية صلبة لا متقطعة */
.viz .tick { fill:var(--muted-2); font-size:10px; font-variant-numeric:tabular-nums; }
.viz .dlabel { fill:var(--text-2); font-size:11px; font-variant-numeric:tabular-nums; }
.legend { display:flex; flex-wrap:wrap; gap:14px; margin-bottom:10px; }
.legend i { width:10px; height:10px; border-radius:3px; display:inline-block; margin-inline-end:6px; }
.legend span { color:var(--text-2); font-size:12px; display:inline-flex; align-items:center; }

.viz-tip { position:fixed; z-index:60; pointer-events:none; background:var(--panel-3);
  border:1px solid var(--line); border-radius:var(--radius-sm); padding:8px 10px;
  font-size:12px; color:var(--text); box-shadow:var(--shadow); opacity:0; transition:opacity .1s; }
.viz-tip.on { opacity:1; }
.viz-tip b { display:block; margin-bottom:4px; color:var(--text-2); font-weight:600; }
.viz-tip .r { display:flex; align-items:center; gap:6px; }
.viz-tip .r i { width:8px; height:8px; border-radius:2px; }
.viz-tip .r em { font-style:normal; color:var(--muted); margin-inline-start:auto; padding-inline-start:12px;
  font-variant-numeric:tabular-nums; }

.vtable { width:100%; border-collapse:collapse; font-size:12px; }
.vtable th, .vtable td { text-align:start; padding:6px 8px; border-bottom:1px solid var(--line-soft); }
.vtable th { color:var(--muted); font-weight:600; }
.vtable td.n { font-variant-numeric:tabular-nums; }
.health-row { display:flex; flex-wrap:wrap; gap:10px; }
.health-chip { display:inline-flex; align-items:center; gap:7px; background:var(--panel-2);
  border:1px solid var(--line-soft); border-radius:999px; padding:6px 13px; font-size:12.5px; }
.health-chip b { font-variant-numeric:tabular-nums; }
.vfilters { display:flex; flex-wrap:wrap; align-items:center; gap:8px; margin-bottom:16px; }
.vsep { width:1px; height:20px; background:var(--line); margin:0 6px; }
.viz .blabel { fill:var(--text-2); font-size:11.5px; }

/* ══════════════════════════════════════════════════════════════════
   الطبقة المالية
   ══════════════════════════════════════════════════════════════════ */
.ftabs { display:flex; flex-wrap:wrap; gap:6px; margin-bottom:18px;
  border-bottom:1px solid var(--line-soft); padding-bottom:12px; }
.ftab { background:none; border:1px solid transparent; color:var(--muted);
  padding:6px 13px; border-radius:var(--radius-sm); cursor:pointer; font-size:13px;
  font-family:inherit; }
.ftab:hover { color:var(--text-2); background:var(--panel-2); }
.ftab.on { background:var(--panel-2); border-color:var(--line); color:var(--gold); font-weight:600; }

.money { font-variant-numeric:tabular-nums; white-space:nowrap; }
.verdict { display:inline-flex; align-items:center; gap:5px; font-size:11.5px;
  padding:2px 9px; border-radius:999px; white-space:nowrap; }
.verdict.good { background:rgba(76,195,138,.13); color:var(--green); }
.verdict.warning { background:rgba(224,165,82,.13); color:var(--amber); }
.verdict.critical { background:rgba(224,82,95,.13); color:var(--red); }
.verdict.muted { background:var(--panel-2); color:var(--muted); }

.mbar { height:7px; background:#0e1a2f; border-radius:999px; overflow:hidden; margin-top:6px;
  position:relative; }
.mbar > i { display:block; height:100%; border-radius:999px; }
.mbar > b { position:absolute; top:-3px; bottom:-3px; width:2px; background:var(--text-2);
  opacity:.55; }

.fgrid { display:grid; grid-template-columns:repeat(auto-fit,minmax(210px,1fr)); gap:12px; margin-bottom:18px; }
.fcard { background:var(--panel); border:1px solid var(--line-soft); border-radius:var(--radius); padding:15px 17px; }
.fcard .lbl { color:var(--muted); font-size:12px; margin-bottom:5px; }
.fcard .val { font-size:24px; font-weight:700; font-variant-numeric:proportional-nums;
  font-family:inherit; line-height:1.2; }
.fcard .val small { font-size:13px; font-weight:500; color:var(--muted-2); }
.fcard .sub { color:var(--muted-2); font-size:11.5px; margin-top:5px; }
.fcard.good .val { color:var(--green); } .fcard.warn .val { color:var(--amber); }
.fcard.bad .val { color:var(--red); }

.tiers { display:grid; gap:8px; }
.tier { display:flex; gap:12px; align-items:flex-start; background:var(--panel-2);
  border:1px solid var(--line-soft); border-radius:var(--radius-sm); padding:10px 13px; }
.tier b { min-width:150px; font-size:12.5px; font-variant-numeric:tabular-nums; }
.tier span { font-size:12.5px; color:var(--text-2); }

/* ══════════════════════════════════════════════════════════════════
   المنظمة — الهيكل والصلاحية و RACI والاستراتيجية
   ══════════════════════════════════════════════════════════════════ */
.draft-banner { background:linear-gradient(90deg, rgba(224,178,82,.10), transparent);
  border:1px solid rgba(224,178,82,.30); border-radius:var(--radius);
  padding:14px 18px; margin-bottom:18px; display:flex; gap:14px; align-items:flex-start; }
.draft-banner .ic { font-size:20px; line-height:1; }
.draft-banner b { color:var(--gold); }
.draft-banner .acts { margin-inline-start:auto; display:flex; gap:8px; flex-wrap:wrap; }

.otree { list-style:none; margin:0; padding:0; }
.otree ul { list-style:none; margin:0; padding-inline-start:22px;
  border-inline-start:1px solid var(--line-soft); }
.opos { display:flex; align-items:center; gap:10px; padding:9px 12px; margin:4px 0;
  background:var(--panel-2); border:1px solid var(--line-soft); border-radius:var(--radius-sm); }
.opos .t { font-weight:600; font-size:13.5px; }
.opos .lv { font-size:10.5px; font-family:"IBM Plex Mono",monospace; color:var(--muted-2);
  border:1px solid var(--line); border-radius:3px; padding:1px 6px; }
.opos .who { margin-inline-start:auto; display:flex; gap:6px; flex-wrap:wrap; }
.opos .who span { font-size:11.5px; background:var(--panel-3); border-radius:999px; padding:2px 9px; }
.opos .vacant { color:var(--amber); font-size:11.5px; }

.step-chain { display:flex; flex-wrap:wrap; gap:6px; align-items:center; }
.step-chain .st { background:var(--panel-2); border:1px solid var(--line-soft);
  border-radius:var(--radius-sm); padding:4px 11px; font-size:12px; }
.step-chain .st.on { border-color:var(--gold); color:var(--gold); }
.step-chain i { color:var(--muted-2); font-style:normal; }

.krbar { height:6px; background:#0e1a2f; border-radius:999px; overflow:hidden; margin-top:5px; }
.krbar > i { display:block; height:100%; border-radius:999px; background:var(--blue); }
.why-chain { display:flex; flex-direction:column; gap:0; }
.why-chain .lnk { display:flex; gap:12px; align-items:flex-start; padding:9px 0;
  border-inline-start:2px solid var(--line); padding-inline-start:16px; margin-inline-start:6px; }
.why-chain .lnk b { font-size:11px; color:var(--muted); min-width:110px; }
