/* ==========================================================
   مأمن — بوابة المشاريع (تسجيل الدخول + لوحة العمل)
   ========================================================== */
body.app-body { background: var(--concrete); }

/* ---------- تسجيل الدخول ---------- */
.login { min-height: 100vh; min-height: 100dvh; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr); }
.login__side { position: relative; color: #fff; padding: 40px; display: flex; flex-direction: column; justify-content: space-between; gap: 32px; overflow: hidden; isolation: isolate; background: var(--ink); }
.login__side > img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: 0.3; z-index: -1; }
.login__side::after { content: ''; position: absolute; inset: 0; background: linear-gradient(to top, rgba(36, 33, 29, 0.95), rgba(36, 33, 29, 0.35)); z-index: -1; }
.login__side .brand { color: #fff; }
.login__side .brand__txt small { color: #bdb8ae; }
.login__side h2 { font-family: var(--f-display); font-size: clamp(1.8rem, 3vw, 2.6rem); font-weight: 700; line-height: 1.3; }
.login__side p { color: #d6d1c8; max-width: 46ch; margin-top: 10px; }
.roles-legend { list-style: none; display: grid; gap: 12px; margin-top: 26px; }
.roles-legend li { display: flex; gap: 12px; align-items: flex-start; font-size: 0.93rem; color: #d6d1c8; }
.roles-legend b { color: #fff; }
.login__main { display: flex; align-items: center; justify-content: center; padding: 40px 20px; background: #fff; }
.login__box { width: min(460px, 100%); display: grid; gap: 22px; }
.login__box h1 { font-size: 1.7rem; font-weight: 700; }
.login__box > p { color: var(--muted); margin-top: -14px; }
.divider { display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: 0.85rem; }
.divider::before, .divider::after { content: ''; flex: 1; height: 1px; background: var(--line); }
.demo-accounts { display: grid; gap: 10px; }
.demo-acc { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border: 1.5px solid var(--line); border-radius: var(--r); background: #fff; cursor: pointer; text-align: right; width: 100%; transition: border-color 0.15s, background-color 0.15s; }
.demo-acc:hover { border-color: var(--ink); background: #fcfcfa; }
.demo-acc .avatar { width: 40px; height: 40px; }
.demo-acc__txt { flex: 1; min-width: 0; }
.demo-acc b { display: block; font-size: 0.97rem; }
.demo-acc small { color: var(--muted); font-size: 0.82rem; display: block; line-height: 1.5; }
.demo-acc code { font-family: var(--f-mono); font-size: 0.72rem; background: var(--concrete); padding: 0.1em 0.45em; border-radius: 3px; color: var(--text-2); direction: ltr; display: inline-block; }
.demo-acc > .i { color: var(--muted); }
@media (max-width: 900px) { .login { grid-template-columns: 1fr; } .login__side { display: none; } }

/* ---------- هيكل التطبيق ---------- */
.app { display: grid; grid-template-columns: 264px minmax(0, 1fr); min-height: 100vh; }
.sidebar { background: var(--ink); color: #d6d2ca; display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; height: 100dvh; padding: 18px 14px; overflow-y: auto; }
.sidebar .brand { color: #fff; padding: 4px 8px 18px; border-bottom: 1px solid rgba(255, 255, 255, 0.1); margin-bottom: 10px; }
.sidebar .brand__txt small { color: #9f998f; }
.snav { display: grid; gap: 2px; }
.snav__label { font-size: 0.72rem; color: #8e887e; padding: 14px 12px 6px; font-weight: 600; }
.snav a { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: 8px; text-decoration: none; color: #d6d2ca; font-weight: 500; font-size: 0.93rem; }
.snav a:hover { background: rgba(255, 255, 255, 0.07); color: #fff; }
.snav a[aria-current='page'] { background: var(--yellow); color: var(--ink); font-weight: 700; }
.snav a .i { width: 20px; height: 20px; }
.snav .count { margin-inline-start: auto; background: var(--clay); color: #fff; border-radius: 999px; font-size: 0.72rem; padding: 0 0.5em; min-width: 20px; text-align: center; font-weight: 700; }
.snav a[aria-current='page'] .count { background: var(--ink); color: var(--yellow); }
.snav .proj-dot { width: 8px; height: 8px; border-radius: 50%; background: #8e887e; flex: none; margin-inline: 6px; }
.sidebar__foot { margin-top: auto; border-top: 1px solid rgba(255, 255, 255, 0.1); padding-top: 14px; display: grid; gap: 10px; }
.me { display: flex; gap: 10px; align-items: center; padding: 6px; border-radius: 8px; text-decoration: none; color: inherit; }
.me:hover { background: rgba(255, 255, 255, 0.07); }
.me b { display: block; color: #fff; font-size: 0.92rem; line-height: 1.3; }
.me small { color: #9f998f; font-size: 0.78rem; }
.sidebar__foot .btn { justify-content: flex-start; }
.app__main { min-width: 0; display: flex; flex-direction: column; }
.topbar { position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: 10px; height: 64px; padding: 0 24px; background: rgba(237, 237, 233, 0.94); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); }
.topbar__title { font-size: 1.05rem; font-weight: 700; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.topbar__sp { flex: 1; }
.pop { position: relative; }
.bell-dot { position: absolute; top: 4px; left: 4px; min-width: 18px; height: 18px; border-radius: 9px; background: var(--clay); color: #fff; font-size: 0.68rem; display: grid; place-items: center; padding: 0 4px; font-weight: 700; line-height: 1; }
.dropdown { position: absolute; top: calc(100% + 8px); left: 0; width: min(380px, calc(100vw - 24px)); background: #fff; border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--sh-3); z-index: 60; overflow: hidden; }
.dropdown__head { display: flex; justify-content: space-between; align-items: center; padding: 12px 14px; border-bottom: 1px solid var(--line); font-weight: 700; }
.dropdown__foot { padding: 10px 14px; border-top: 1px solid var(--line); text-align: center; }
.notif-list { list-style: none; max-height: 380px; overflow-y: auto; }
.notif { display: flex; gap: 10px; padding: 12px 14px; border-bottom: 1px solid var(--concrete); text-decoration: none; color: inherit; font-size: 0.9rem; line-height: 1.55; }
.notif:hover { background: #fafaf8; }
.notif--unread { background: #fffbea; }
.notif__dot { width: 8px; height: 8px; border-radius: 50%; margin-top: 0.55em; flex: none; background: transparent; }
.notif--unread .notif__dot { background: var(--clay); }
.notif small { display: block; color: var(--muted); font-size: 0.78rem; }
.user-chip { display: flex; align-items: center; gap: 8px; padding: 4px 6px 4px 10px; border-radius: 999px; border: 1px solid var(--line); background: #fff; cursor: pointer; font-weight: 600; font-size: 0.88rem; text-decoration: none; color: inherit; }
.user-chip .avatar { width: 30px; height: 30px; font-size: 0.8rem; }
.menu-list { list-style: none; padding: 6px; display: grid; gap: 2px; }
.menu-list button, .menu-list a { display: flex; align-items: center; gap: 10px; width: 100%; padding: 9px 10px; border-radius: 6px; border: 0; background: none; text-align: right; cursor: pointer; text-decoration: none; color: inherit; font-size: 0.9rem; }
.menu-list button:hover, .menu-list a:hover { background: var(--concrete); }
.menu-list .menu-label { font-size: 0.75rem; color: var(--muted); padding: 8px 10px 2px; font-weight: 600; }
.menu-list [aria-current='true'] { background: var(--yellow-soft); font-weight: 700; }
.view { padding: 24px; width: 100%; max-width: 1320px; margin-inline: auto; }
.view:focus { outline: none; }
.menu-toggle { display: none; }
.scrim { display: none; }
@media (max-width: 1040px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { position: fixed; inset: 0 0 0 auto; width: 284px; z-index: 80; transform: translateX(100%); transition: transform 0.25s ease; visibility: hidden; }
  .sidebar.open { transform: none; visibility: visible; }
  .scrim.open { display: block; position: fixed; inset: 0; background: rgba(20, 18, 15, 0.45); z-index: 70; }
  .menu-toggle { display: inline-grid; }
  .view { padding: 16px; }
  .topbar { padding: 0 10px; }
}
@media (max-width: 560px) { .user-chip span.nm { display: none; } }

/* ---------- عناصر مشتركة في البوابة ---------- */
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px 16px; flex-wrap: wrap; margin-bottom: 20px; }
.page-head h2 { font-size: 1.5rem; font-weight: 700; line-height: 1.35; }
.page-head p { color: var(--muted); font-size: 0.93rem; }
.page-head__actions { display: flex; gap: 8px; flex-wrap: wrap; }
.card { background: #fff; border: 1px solid var(--line); border-radius: var(--r-lg); padding: 20px; min-width: 0; position: relative; }
.card__title { font-size: 1rem; font-weight: 700; margin-bottom: 14px; display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; }
.card__title a { font-size: 0.85rem; font-weight: 600; color: var(--text-2); }
.stack { display: grid; gap: 16px; align-content: start; min-width: 0; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.grid-main { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); gap: 16px; align-items: start; }
@media (max-width: 1100px) { .grid-main { grid-template-columns: 1fr; } }
@media (max-width: 760px) { .grid-2 { grid-template-columns: 1fr; } }
.back-link { display: inline-flex; gap: 6px; align-items: center; color: var(--text-2); text-decoration: none; font-size: 0.88rem; font-weight: 600; margin-bottom: 12px; }
.back-link:hover { color: var(--ink); }

/* بطاقات المؤشرات */
.kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-bottom: 18px; }
.kpi { background: #fff; border: 1px solid var(--line); border-radius: var(--r-lg); padding: 16px 18px; text-decoration: none; color: inherit; display: grid; gap: 2px; transition: border-color 0.15s; }
a.kpi:hover { border-color: var(--ink); }
.kpi__label { font-size: 0.86rem; color: var(--text-2); display: flex; gap: 6px; align-items: center; }
.kpi__label .i { color: var(--muted); }
.kpi__value { font-size: 2rem; font-weight: 600; line-height: 1.25; }
.kpi__note { font-size: 0.8rem; color: var(--muted); }
.kpi--alert { border-color: var(--clay); box-shadow: inset 0 3px 0 var(--clay); }
@media (max-width: 1000px) { .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* الجداول */
.table-wrap { position: relative; overflow-x: auto; border: 1px solid var(--line); border-radius: var(--r-lg); background: #fff; }
table.tbl { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
.tbl th { text-align: right; font-weight: 600; color: var(--text-2); font-size: 0.8rem; background: #fafaf8; padding: 10px 14px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.tbl td { padding: 12px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl tr[data-href] { cursor: pointer; }
.tbl tr[data-href]:hover td { background: #fbfbf9; }
.tbl .cell-main b { display: block; font-weight: 700; }
.tbl .cell-main small { color: var(--muted); font-size: 0.8rem; }
.tbl .select { min-height: 36px; padding-block: 0.3em; font-size: 0.85rem; width: auto; }
.tbl img.thumb-sm { width: 56px; height: 42px; object-fit: cover; border-radius: 6px; }
.prog-cell { display: flex; align-items: center; gap: 10px; min-width: 150px; }
.prog-cell .meter { flex: 1; }
.prog-cell b { font-size: 0.85rem; min-width: 34px; }
.delta { font-size: 0.8rem; font-weight: 600; display: inline-flex; gap: 4px; align-items: center; white-space: nowrap; }
.delta--ok { color: var(--ok); }
.delta--bad { color: var(--bad); }

/* قوائم النشاط والطلبات */
.feed { list-style: none; display: grid; }
.feed li { display: flex; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--concrete); }
.feed li:last-child { border-bottom: 0; padding-bottom: 0; }
.feed li:first-child { padding-top: 0; }
.feed__ic { width: 34px; height: 34px; border-radius: 8px; display: grid; place-items: center; background: var(--concrete); flex: none; color: var(--text-2); }
.feed__ic--report { background: var(--yellow-soft); color: var(--brown); }
.feed__ic--comment { background: var(--steel-soft); color: var(--steel); }
.feed p { font-size: 0.9rem; line-height: 1.55; }
.feed a { color: inherit; text-decoration: none; font-weight: 600; }
.feed a:hover { text-decoration: underline; }
.feed small { color: var(--muted); font-size: 0.78rem; }

/* بطاقات المشاريع */
.proj-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 16px; }
.proj-card { background: #fff; border: 1px solid var(--line); border-radius: var(--r-lg); overflow: hidden; text-decoration: none; color: inherit; display: flex; flex-direction: column; transition: box-shadow 0.2s; }
.proj-card:hover { box-shadow: var(--sh-2); }
.proj-card__img { height: 150px; position: relative; background: var(--concrete-2); }
.proj-card__img img { width: 100%; height: 100%; object-fit: cover; }
.proj-card__img .badge { position: absolute; top: 10px; right: 10px; }
.proj-card__body { padding: 14px 16px 16px; display: grid; gap: 8px; }
.proj-card h3 { font-size: 1.02rem; font-weight: 700; }
.proj-card .muted { font-size: 0.84rem; }
.today-task { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 12px 0; border-bottom: 1px solid var(--concrete); flex-wrap: wrap; }
.today-task:last-child { border-bottom: 0; }
.today-task b { display: block; }

/* ---------- لوحة المشروع (رأس صفحة المشروع) ---------- */
.psign { background: var(--yellow); border: 3px solid var(--ink); border-radius: 6px; margin-bottom: 16px; overflow: hidden; }
.psign__stripe { height: 10px; background: var(--hazard); border-bottom: 3px solid var(--ink); }
.psign__in { display: grid; grid-template-columns: minmax(0, 1fr) 230px; gap: 22px; padding: 16px 20px 18px; }
.psign__title { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.psign__title .mark { width: 30px; color: var(--ink); }
.psign__title h2 { font-family: var(--f-display); font-size: 1.6rem; font-weight: 700; line-height: 1.3; }
.psign__code { font-family: var(--f-mono); font-size: 0.78rem; background: rgba(36, 33, 29, 0.1); padding: 0.1em 0.5em; border-radius: 4px; direction: ltr; }
.psign__rows { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0 22px; margin-top: 8px; }
.psign__rows div { padding: 6px 0; border-bottom: 1.5px dashed rgba(36, 33, 29, 0.32); display: flex; gap: 8px; justify-content: space-between; font-size: 0.87rem; min-width: 0; }
.psign__rows dt { color: rgba(36, 33, 29, 0.72); white-space: nowrap; }
.psign__rows dd { margin: 0; font-weight: 700; text-align: left; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.psign__prog { border-inline-start: 3px solid var(--ink); padding-inline-start: 22px; display: flex; flex-direction: column; justify-content: center; gap: 8px; }
.psign__prog > span { font-weight: 600; font-size: 0.9rem; }
.psign__prog b { font-size: 3.2rem; font-weight: 700; line-height: 1; }
.psign__prog small { font-size: 0.8rem; color: rgba(36, 33, 29, 0.78); }
@media (max-width: 1100px) { .psign__rows { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 800px) {
  .psign__in { grid-template-columns: 1fr; }
  .psign__prog { border-inline-start: 0; border-top: 3px solid var(--ink); padding: 14px 0 0; }
  .psign__prog b { font-size: 2.6rem; }
}
@media (max-width: 520px) { .psign__rows { grid-template-columns: 1fr; } .psign__title h2 { font-size: 1.3rem; } }

/* التبويبات */
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line-2); margin-bottom: 18px; overflow-x: auto; scrollbar-width: none; }
.tabs a { padding: 11px 14px; text-decoration: none; color: var(--text-2); font-weight: 600; font-size: 0.94rem; border-bottom: 3px solid transparent; margin-bottom: -1px; white-space: nowrap; display: flex; gap: 6px; align-items: center; }
.tabs a:hover { color: var(--ink); }
.tabs a[aria-current='page'] { color: var(--ink); border-bottom-color: var(--ink); }
.tabs .count { background: var(--concrete-2); border-radius: 999px; padding: 0 0.5em; font-size: 0.75rem; }
.tabs .count--alert { background: var(--clay); color: #fff; }

/* نظرة عامة */
.phase-now { display: grid; gap: 10px; }
.phase-now h3 { font-size: 1.25rem; font-weight: 700; }
.compare { display: grid; gap: 10px; }
.compare__row { display: grid; grid-template-columns: 110px minmax(0, 1fr) 44px; gap: 10px; align-items: center; font-size: 0.86rem; }
.compare__row b { text-align: left; }
.meter--plan { background: var(--concrete-2); }
.meter--plan > i { background: var(--slate); }
.facts { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.fact { background: var(--concrete); border-radius: var(--r); padding: 12px; }
.fact small { color: var(--muted); font-size: 0.78rem; display: block; }
.fact b { font-size: 1.15rem; }
@media (max-width: 560px) { .facts { grid-template-columns: 1fr 1fr; } }
.designs { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.designs a { aspect-ratio: 4 / 3; display: block; border-radius: 8px; overflow: hidden; cursor: zoom-in; background: var(--concrete); }
.designs img { width: 100%; height: 100%; object-fit: cover; }
.team { list-style: none; display: grid; gap: 10px; }
.team li { display: flex; gap: 10px; align-items: center; }
.team b { display: block; font-size: 0.92rem; }
.team small { color: var(--muted); font-size: 0.8rem; }
.last-rep { display: grid; grid-template-columns: 120px minmax(0, 1fr); gap: 14px; text-decoration: none; color: inherit; }
.last-rep img { width: 120px; height: 90px; object-fit: cover; border-radius: 8px; background: var(--concrete); }
.last-rep b { display: block; }
.last-rep ul { list-style: none; font-size: 0.86rem; color: var(--text-2); margin-top: 4px; }
.last-rep li::before { content: '✓ '; color: var(--ok); font-weight: 700; }

/* التقارير */
.toolbar { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
.toolbar .choices { gap: 6px; }
.reports { display: grid; gap: 14px; }
.report.flash { animation: report-flash 2.2s ease; }
@keyframes report-flash { 0%, 40% { box-shadow: 0 0 0 4px var(--yellow); } 100% { box-shadow: 0 0 0 0 transparent; } }
.report-callout { display: flex; gap: 12px; align-items: center; justify-content: space-between; flex-wrap: wrap; background: var(--yellow-soft); border: 1.5px dashed var(--amber); border-radius: var(--r-lg); padding: 14px 18px; margin-bottom: 14px; }
.report-callout b { display: block; }
.range-row { display: flex; align-items: center; gap: 12px; }
.range-row input[type='range'] { flex: 1; accent-color: var(--ink); }
.range-row output { font-weight: 700; min-width: 48px; text-align: left; }

/* ---------- الجدول الزمني (Gantt) ---------- */
.gantt { background: #fff; border: 1px solid var(--line); border-radius: var(--r-lg); overflow-x: auto; }
.gantt__inner { min-width: 820px; position: relative; }
.g-row { display: grid; grid-template-columns: 240px minmax(0, 1fr); border-bottom: 1px solid var(--line); min-height: 54px; }
.g-row:last-child { border-bottom: 0; }
.g-row--head { min-height: 38px; background: #fafaf8; }
.g-label { padding: 8px 14px; border-inline-end: 1px solid var(--line); display: flex; flex-direction: column; justify-content: center; gap: 2px; font-size: 0.87rem; position: sticky; right: 0; background: inherit; background-color: #fff; z-index: 3; }
.g-row--head .g-label { background-color: #fafaf8; font-weight: 600; color: var(--text-2); font-size: 0.8rem; }
.g-label b { font-weight: 600; line-height: 1.4; }
.g-label small { color: var(--muted); font-size: 0.76rem; display: flex; gap: 6px; align-items: center; }
.g-state { display: inline-flex; gap: 4px; align-items: center; font-weight: 600; }
.g-state .i { width: 13px; height: 13px; }
.g-state--done { color: var(--ok); }
.g-state--active { color: var(--warn); }
.g-state--late { color: var(--bad); }
.g-state--upcoming { color: var(--muted); }
.g-track { position: relative; }
.g-month { position: absolute; top: 0; bottom: 0; border-inline-start: 1px solid var(--line); font-size: 0.74rem; color: var(--muted); padding: 10px 6px 0; white-space: nowrap; overflow: hidden; }
.g-grid { position: absolute; top: 0; bottom: 0; inset-inline-start: 240px; inset-inline-end: 0; pointer-events: none; z-index: 1; }
.g-grid > span { position: absolute; top: 0; bottom: 0; border-inline-start: 1px dashed var(--concrete-2); }
.g-today { position: absolute; top: 0; bottom: 0; width: 0; border-inline-start: 2px solid var(--clay); z-index: 2; }
.g-today span { position: absolute; top: 6px; inset-inline-start: -1px; transform: translateX(50%); background: var(--clay); color: #fff; font-size: 0.7rem; font-weight: 700; padding: 1px 6px; border-radius: 4px; white-space: nowrap; }
.g-bar { position: absolute; top: 50%; translate: 0 -50%; height: 20px; z-index: 2; outline: none; }
.g-bar__track { display: block; height: 100%; border-radius: 4px; overflow: hidden; background: var(--amber-soft); }
.g-bar__track > i { display: block; height: 100%; background: var(--amber); }
.g-bar--done .g-bar__track { background: var(--ok-soft); }
.g-bar--done .g-bar__track > i { background: var(--ok); }
.g-bar--late .g-bar__track { background: var(--bad-soft); }
.g-bar--late .g-bar__track > i { background: var(--bad); }
.g-bar--upcoming .g-bar__track { background: repeating-linear-gradient(-45deg, #efefeb 0 6px, #e5e5e0 6px 12px); }
.g-bar::after { content: attr(data-tip); position: absolute; bottom: calc(100% + 8px); inset-inline-start: 0; background: var(--ink); color: #fff; font-size: 0.76rem; padding: 5px 9px; border-radius: 6px; white-space: nowrap; opacity: 0; pointer-events: none; transition: opacity 0.12s; z-index: 5; }
.g-bar:hover::after, .g-bar:focus-visible::after { opacity: 1; }
.g-bar:focus-visible .g-bar__track { outline: 3px solid var(--amber); outline-offset: 2px; }
.g-legend { display: flex; gap: 8px 18px; flex-wrap: wrap; font-size: 0.84rem; color: var(--text-2); margin-top: 12px; }
.g-legend span { display: inline-flex; gap: 6px; align-items: center; }
.sw { width: 22px; height: 10px; border-radius: 3px; display: inline-block; }
.phase-edit { display: grid; gap: 10px; }
.phase-edit__row { display: grid; grid-template-columns: minmax(0, 1.4fr) 150px 150px minmax(0, 1fr) 44px; gap: 10px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--concrete); }
.phase-edit__row .input { min-height: 38px; padding-block: 0.3em; }
@media (max-width: 760px) { .phase-edit__row { grid-template-columns: 1fr 1fr; } .phase-edit__row > b { grid-column: 1 / -1; } .phase-edit__row .range-row { grid-column: 1 / -1; } }

/* الدفعات والملفات */
.pay-sum { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 16px; }
@media (max-width: 900px) { .pay-sum { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.file-list { list-style: none; display: grid; }
.file-list li { display: flex; gap: 12px; align-items: center; padding: 12px 0; border-bottom: 1px solid var(--concrete); }
.file-list li:last-child { border-bottom: 0; }
.file-ic { width: 40px; height: 40px; border-radius: 8px; background: var(--bad-soft); color: var(--bad); display: grid; place-items: center; flex: none; }
.file-list .grow { flex: 1; min-width: 0; }
.file-list b { display: block; font-size: 0.92rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-list small { color: var(--muted); font-size: 0.8rem; }

/* تفاصيل الطلب */
.dl { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 20px; }
.dl div { padding: 10px 0; border-bottom: 1px solid var(--concrete); display: grid; gap: 2px; }
.dl dt { font-size: 0.8rem; color: var(--muted); }
.dl dd { margin: 0; font-weight: 600; }
@media (max-width: 560px) { .dl { grid-template-columns: 1fr; } }
.q-files { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 10px; }
.q-file { text-decoration: none; color: inherit; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; background: #fff; padding: 0; cursor: zoom-in; text-align: right; display: grid; }
.q-file img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; }
.q-file span { padding: 6px 8px; font-size: 0.78rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.q-file--pdf { cursor: pointer; place-items: center; aspect-ratio: auto; padding: 18px 8px; gap: 4px; text-align: center; }
.q-file--pdf .i { width: 28px; height: 28px; color: var(--bad); }
.status-steps { list-style: none; display: grid; gap: 0; }
.status-steps li { display: grid; grid-template-columns: 22px 1fr; gap: 10px; padding-bottom: 14px; position: relative; font-size: 0.88rem; }
.status-steps li::before { content: ''; width: 12px; height: 12px; border-radius: 50%; background: var(--line-2); margin: 5px 5px 0; }
.status-steps li.done::before { background: var(--ink); }
.status-steps li:not(:last-child)::after { content: ''; position: absolute; top: 20px; bottom: 0; right: 10px; width: 2px; background: var(--line); }
.status-steps small { display: block; color: var(--muted); font-size: 0.78rem; }
.creds { background: var(--yellow-soft); border: 1.5px dashed var(--amber); border-radius: var(--r); padding: 14px 16px; display: grid; gap: 6px; }
.creds code { font-family: var(--f-mono); background: #fff; padding: 0.1em 0.5em; border-radius: 4px; direction: ltr; display: inline-block; }
.feed li > .badge { align-self: flex-start; }
.sidebar .avatar--owner { box-shadow: 0 0 0 1.5px rgba(255, 255, 255, 0.28); }
@media (max-width: 760px) { table.tbl { min-width: 680px; } }

/* ==========================================================
   إضافات البوابة (PHP)
   ========================================================== */
.login__logo { width: 120px; height: auto; }
.login__side .brand__txt small { color: #bdb8ae; }
.snav__empty { padding: 6px 12px; font-size: 0.82rem; color: #8e887e; }
.dropdown--sm { width: min(280px, calc(100vw - 24px)); }
.menu-list form, .sidebar__foot form { margin: 0; }
.report-callout--info { background: var(--steel-soft); border-color: var(--steel); }
.facts--4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 760px) { .facts--4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.fact--card { background: #fff; border: 1px solid var(--line); }
.kpi__value--sm { font-size: 1.4rem; }
.sep { border: 0; border-top: 1px solid var(--line); margin: 18px 0; }
.psign__edit { margin-inline-start: auto; display: inline-flex; gap: 6px; align-items: center; font-size: 0.85rem; font-weight: 700; color: var(--ink); text-decoration: none; background: rgba(36, 33, 29, 0.08); padding: 0.3em 0.8em; border-radius: 6px; }
.psign__edit:hover { background: rgba(36, 33, 29, 0.16); }
.creds { margin-bottom: 16px; }
.creds b { display: flex; gap: 8px; align-items: center; }
.row-muted td { opacity: 0.55; }
.search-mini { display: flex; gap: 6px; }
.search-mini .input { min-height: 38px; padding-block: 0.35em; width: 230px; }
.form-actions { display: flex; gap: 10px; justify-content: flex-start; }
.danger-zone { border-color: var(--bad-soft); margin-top: 16px; }
.danger-zone .card__title { color: var(--bad); }
.form-card--pad { padding: 22px; }

/* تحرير المراحل والدفعات */
.phase-edit__row--head { font-size: 0.78rem; color: var(--muted); font-weight: 600; padding-bottom: 4px; }
.phase-edit__row--new { background: #fbfbf9; }
.del-check { display: inline-grid; place-items: center; width: 38px; height: 38px; border-radius: 8px; color: var(--muted); cursor: pointer; position: relative; }
.del-check input { position: absolute; opacity: 0; inset: 0; cursor: pointer; margin: 0; }
.del-check:hover { background: var(--bad-soft); color: var(--bad); }
.del-check:has(input:checked) { background: var(--bad); color: #fff; }
.del-check:has(input:focus-visible) { outline: 3px solid var(--amber); outline-offset: 2px; }
.pay-edit { display: grid; }
.pay-edit__row { display: grid; grid-template-columns: minmax(0, 1.6fr) 110px 160px 140px 44px; gap: 10px; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--concrete); }
.pay-edit__row--head { font-size: 0.78rem; color: var(--muted); font-weight: 600; }
.pay-edit__row--new { background: #fbfbf9; }
.pay-edit__row .input, .pay-edit__row .select { min-height: 38px; padding-block: 0.3em; }
@media (max-width: 760px) {
  .phase-edit__row, .pay-edit__row { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .phase-edit__row > :first-child, .pay-edit__row > :first-child { grid-column: 1 / -1; }
  .phase-edit__row--head, .pay-edit__row--head { display: none; }
}

/* الصور: الغلاف، الإدارة، التصاميم */
.cover-pick { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 10px; }
.cover-pick label { position: relative; cursor: pointer; border-radius: 8px; overflow: hidden; border: 3px solid transparent; }
.cover-pick label:has(input:checked) { border-color: var(--ink); }
.cover-pick input { position: absolute; top: 8px; right: 8px; accent-color: var(--ink); width: 18px; height: 18px; }
.cover-pick img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; }
.img-manage { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.img-manage__item { border: 1px solid var(--line); border-radius: 10px; overflow: hidden; background: #fff; display: grid; }
.img-manage__item img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; }
.img-manage__item label { display: flex; gap: 6px; align-items: center; padding: 6px 10px; font-size: 0.82rem; cursor: pointer; }
.img-manage__del { border-top: 1px solid var(--concrete); color: var(--bad); }
.img-manage__del:has(input:checked) { background: var(--bad-soft); font-weight: 700; }
.img-manage__item:has(.img-manage__del input:checked) img { opacity: 0.4; }
.thumbs--existing { margin-top: 4px; }
.thumb--pick { cursor: pointer; }
.thumb--pick input { position: absolute; opacity: 0; }
.thumb--pick span { position: absolute; inset: auto 0 0 0; background: rgba(36, 33, 29, 0.78); color: #fff; font-size: 0.75rem; padding: 3px 6px; display: flex; gap: 4px; align-items: center; justify-content: center; }
.thumb--pick:has(input:checked) img { opacity: 0.35; }
.thumb--pick:has(input:checked) span { background: var(--bad); }
.design-item { position: relative; }
.design-item form { position: absolute; top: 6px; left: 6px; }
.design-item .icon-btn { background: rgba(255, 255, 255, 0.92); width: 32px; height: 32px; }
.design-item .icon-btn:hover { background: var(--bad); color: #fff; }
.upload-inline { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; align-items: end; margin-top: 16px; padding-top: 14px; border-top: 1px dashed var(--line-2); }
.upload-inline .label { grid-column: 1 / -1; font-size: 0.85rem; }
.upload-inline .input { min-height: 40px; padding: 0.4em; }
.file-ic--img { background: var(--steel-soft); color: var(--steel); }
.file-list li { flex-wrap: wrap; }

/* الإعدادات: الباقات ومعرض الأعمال */
.pkg-edit { display: grid; gap: 14px; }
.pkg-edit__item { border: 1px solid var(--line); border-radius: var(--r); padding: 16px; margin: 0; min-width: 0; }
.pkg-edit__item legend { font-weight: 700; padding: 0 8px; }
.pkg-edit__item--new { border-style: dashed; background: #fbfbf9; }
.works-admin { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 14px; margin-bottom: 14px; }
.works-admin__item { background: #fff; border: 1px solid var(--line); border-radius: var(--r-lg); overflow: hidden; display: grid; align-content: start; }
.works-admin__item > a img { width: 100%; aspect-ratio: 16 / 9; object-fit: cover; }
.works-admin__item > .stack { padding: 12px; }
.works-admin__item .input, .works-admin__item .select { min-height: 38px; padding-block: 0.3em; font-size: 0.88rem; }

/* معالج التثبيت */
.install { width: min(720px, calc(100% - 32px)); margin: 40px auto 80px; display: grid; gap: 16px; justify-items: center; }
.install > * { width: 100%; }
.install > .login__logo { width: 110px; }
.install h1 { font-size: 1.6rem; font-weight: 700; text-align: center; }
.checks { list-style: none; display: grid; gap: 6px; font-size: 0.92rem; }
.checks li { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.checks .ok .i { color: var(--ok); }
.checks .bad { color: var(--bad); }
.checks .warn .i { color: var(--warn); }
