/* علّام — نظام التصميم المشترك
   الترتيب والأسلوب مستوحى من bidapp.sa (خلفية كريمية، بطاقات بيضاء، أزرار كبسولة،
   عناوين ضخمة بنقطة ملوّنة، شرائط إحصائية) — بهوية علّام: الكحلي #030164 وخطوط bidapp (IBM Plex Sans Arabic + Inter + Space Grotesk). */

:root {
  --bg: #F3EEE5;          /* كريمي دافي */
  --bg-2: #EAE3D6;        /* كريمي أغمق للأسطح الثانوية */
  --card: #FFFFFF;
  --ink: #0B0907;         /* أسود دافي للنص */
  --muted: #6F6A62;
  --faint: #A39D93;
  --line: #E4DDD0;
  --brand: #030164;       /* كحلي علّام */
  --brand-2: #2E3FD6;
  --brand-soft: #E6E7F7;
  --ok: #16A34A;   --ok-soft: #DCF5E5;
  --warn: #D97706; --warn-soft: #FDF0D5;
  --bad: #DC2626;  --bad-soft: #FDE2E2;
  --info: #2563EB; --info-soft: #DCE8FD;
  --radius: 22px;
  --shadow: 0 1px 2px rgba(11,9,7,.04), 0 8px 24px -12px rgba(11,9,7,.10);
  /* نفس خطوط bidapp: العربي IBM Plex Sans Arabic، واللاتيني/الأرقام Space Grotesk للنص وInter للعناوين */
  --font: "Space Grotesk", "IBM Plex Sans Arabic", -apple-system, "SF Arabic", "Segoe UI", Tahoma, sans-serif;
  --font-display: "Inter", "IBM Plex Sans Arabic", -apple-system, "SF Arabic", sans-serif;
}
/* تُحمَّل الخطوط من كل صفحة:
   https://fonts.googleapis.com/css2?family=IBM+Plex+Sans+Arabic:wght@400;500;600;700&family=Inter:wght@500;600;700;800&family=Space+Grotesk:wght@400;500;600;700&display=swap */

* { box-sizing: border-box; }
html, body { margin: 0; }
[hidden] { display: none !important; }
body { font-family: var(--font); background: var(--bg); color: var(--ink); font-size: 15px; line-height: 1.6; -webkit-font-smoothing: antialiased; }
a { color: inherit; }
.ti { font-size: 1.15em; vertical-align: -0.15em; line-height: 1; }

/* ---------- العناوين (ضخمة + نقطة ملوّنة) ---------- */
.display { font-family: var(--font-display); font-weight: 700; font-size: clamp(30px, 4vw, 44px); line-height: 1.15; margin: 0; }
.display .dot, .h2 .dot { color: var(--brand); }
.h2 { font-family: var(--font-display); font-weight: 700; font-size: 26px; line-height: 1.2; margin: 0; }
.lead { color: var(--muted); font-size: 15px; margin: 6px 0 0; }
.eyebrow { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 700; color: var(--brand); background: var(--brand-soft); border-radius: 99px; padding: 3px 11px; font-variant-numeric: tabular-nums; }
.section-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin: 34px 0 16px; }
.section-head .left { display: flex; flex-direction: column; gap: 10px; }

/* ---------- الأزرار (كبسولة) ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; font-family: inherit; font-size: 14px; font-weight: 700;
  border-radius: 999px; padding: 10px 20px; border: 1px solid transparent; cursor: pointer; text-decoration: none; transition: transform .08s ease, background .15s ease; white-space: nowrap; }
.btn:active { transform: scale(.98); }
.btn-primary { background: var(--brand); color: #fff; }
.btn-primary:hover { background: #02014a; }
.btn-dark { background: var(--ink); color: #fff; }
.btn-ghost { background: transparent; color: var(--ink); border-color: var(--line); }
.btn-ghost:hover { background: var(--card); }
.btn-danger { background: var(--bad-soft); color: var(--bad); }
.btn-sm { padding: 6px 13px; font-size: 12.5px; }
.btn-icon { width: 36px; height: 36px; padding: 0; border-radius: 50%; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }

/* ---------- البطاقات ---------- */
.card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); border: 1px solid rgba(11,9,7,.04); }
.card-pad { padding: 22px; }
.grid { display: grid; gap: 14px; }
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }
.grid-3 { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.grid-4 { grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); }

/* بطاقة رقم */
.kpi { padding: 20px 22px; display: flex; flex-direction: column; gap: 6px; }
.kpi .k-label { color: var(--muted); font-size: 13px; display: flex; align-items: center; gap: 6px; }
.kpi .k-value { font-family: var(--font-display); font-size: 32px; font-weight: 700; letter-spacing: -0.02em; line-height: 1.1; font-variant-numeric: tabular-nums; }
.kpi .k-sub { font-size: 12px; color: var(--faint); }

/* شريط إحصائية عريض (مثل «72 hrs — BRIEF → PROPOSALS») */
.strip { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 22px 26px; flex-wrap: wrap; }
.strip .s-text { font-size: 17px; font-weight: 500; }
.strip .s-text b { color: var(--brand); font-weight: 700; }
.strip .s-metric { text-align: left; }
.strip .s-metric .v { font-family: var(--font-display); font-size: 30px; font-weight: 700; letter-spacing: -0.02em; color: var(--brand); line-height: 1; font-variant-numeric: tabular-nums; }
.strip .s-metric .l { font-size: 11px; letter-spacing: .06em; color: var(--faint); text-transform: uppercase; margin-top: 4px; }

/* ---------- الشارات (كبسولة بنقطة) ---------- */
.chip { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 700; padding: 3px 10px; border-radius: 99px; background: var(--bg); color: var(--muted); white-space: nowrap; }
.chip::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: currentColor; opacity: .9; }
.chip.plain::before { display: none; }
.chip.ok { background: var(--ok-soft); color: var(--ok); }
.chip.warn { background: var(--warn-soft); color: var(--warn); }
.chip.bad { background: var(--bad-soft); color: var(--bad); }
.chip.info { background: var(--info-soft); color: var(--info); }
.chip.brand { background: var(--brand-soft); color: var(--brand); }
.chip.dark { background: var(--ink); color: #fff; }

/* ---------- الجداول ---------- */
.table-wrap { overflow-x: auto; }
table.t { width: 100%; border-collapse: collapse; font-size: 14px; }
table.t th { text-align: right; font-size: 12px; font-weight: 700; color: var(--faint); padding: 14px 16px; border-bottom: 1px solid var(--line); white-space: nowrap; }
table.t td { text-align: right; padding: 14px 16px; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.t tr:last-child td { border-bottom: 0; }
table.t tr.clickable { cursor: pointer; }
table.t tr.clickable:hover td { background: #FBF9F5; }
.num { font-variant-numeric: tabular-nums; }
.ltr { direction: ltr; unicode-bidi: plaintext; }
.sub { font-size: 12px; color: var(--faint); }

/* ---------- الحقول ---------- */
.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-size: 13px; font-weight: 700; color: var(--ink); }
.input, select.input, textarea.input { width: 100%; font-family: inherit; font-size: 14px; color: var(--ink); background: var(--bg); border: 1px solid transparent; border-radius: 14px; padding: 11px 14px; outline: none; transition: border .15s, background .15s; }
.input:focus { border-color: var(--brand); background: #fff; }
textarea.input { min-height: 90px; resize: vertical; }
.hint { font-size: 12px; color: var(--faint); }

/* ---------- التخطيط: رأس + شريط جانبي ---------- */
.topbar { position: sticky; top: 0; z-index: 20; background: rgba(243,238,229,.86); backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 14px; padding: 12px 24px; }
.brandmark { display: flex; align-items: center; gap: 10px; font-family: var(--font-display); font-weight: 700; font-size: 20px; text-decoration: none; }
.brandmark img { width: 32px; height: 32px; border-radius: 10px; }
.brandmark .dot { color: var(--brand); }
.topbar .spacer { flex: 1; }
.app { display: flex; align-items: flex-start; }
.side { width: 240px; flex: none; position: sticky; top: 61px; height: calc(100vh - 61px); padding: 18px 14px; display: flex; flex-direction: column; gap: 3px; overflow-y: auto; }
.side .nav-item { display: flex; align-items: center; gap: 10px; width: 100%; text-align: start; background: transparent; border: 0; font-family: inherit;
  font-size: 14.5px; font-weight: 500; color: var(--muted); padding: 10px 14px; border-radius: 999px; cursor: pointer; text-decoration: none; }
.side .nav-item:hover { color: var(--ink); background: rgba(255,255,255,.6); }
.side .nav-item.on { background: var(--ink); color: #fff; }
.side .nav-item .count { margin-inline-start: auto; font-size: 11px; background: var(--brand); color: #fff; border-radius: 99px; padding: 1px 8px; }
.side .nav-item.on .count { background: #fff; color: var(--ink); }
.side .side-foot { margin-top: auto; padding-top: 14px; border-top: 1px solid var(--line); display: flex; flex-direction: column; gap: 6px; font-size: 13px; }
.main { flex: 1; min-width: 0; padding: 26px 30px 70px; max-width: 1180px; }
.burger { display: none; }
.overlay { display: none; }
@media (max-width: 860px) {
  .burger { display: inline-flex; }
  .side { position: fixed; top: 0; inset-inline-start: 0; height: 100vh; z-index: 40; background: var(--bg); transform: translateX(100%); visibility: hidden; transition: transform .22s ease, visibility .22s; }
  .side.open { transform: none; visibility: visible; box-shadow: -10px 0 40px rgba(11,9,7,.18); }
  .overlay.open { display: block; position: fixed; inset: 0; z-index: 35; background: rgba(11,9,7,.3); }
  .main { padding: 18px 16px 60px; }
  .topbar { padding: 10px 16px; }
}

/* ---------- أدوات صغيرة ---------- */
.row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.between { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.empty { padding: 40px 20px; text-align: center; color: var(--faint); }
.toast { position: fixed; bottom: 22px; inset-inline-start: 50%; transform: translateX(50%); background: var(--ink); color: #fff; border-radius: 999px; padding: 11px 20px; font-size: 14px; z-index: 100; box-shadow: var(--shadow); opacity: 0; transition: opacity .2s; pointer-events: none; }
.toast.show { opacity: 1; }
.dot-live { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.modal-bg { position: fixed; inset: 0; background: rgba(11,9,7,.35); z-index: 60; display: none; align-items: center; justify-content: center; padding: 16px; }
.modal-bg.open { display: flex; }
.modal { width: 100%; max-width: 560px; max-height: 88vh; overflow-y: auto; padding: 24px; }
.tabs-pill { display: inline-flex; background: var(--bg-2); border-radius: 999px; padding: 4px; gap: 2px; }
.tabs-pill button { border: 0; background: transparent; font-family: inherit; font-size: 13px; font-weight: 700; color: var(--muted); padding: 7px 14px; border-radius: 999px; cursor: pointer; }
.tabs-pill button.on { background: var(--card); color: var(--ink); box-shadow: var(--shadow); }

/* يُخفى على الجوالات الصغيرة */
@media (max-width: 480px) { .hide-sm { display: none !important; } }
