/* فيود للمشاريع — الهوية: كحلي هندسي مع ذهبي، شبكة مخطط خفيفة في الخلفية */
:root {
  --bg: #0d1625; --bg2: #111c2f; --panel: #15223a; --panel2: #1b2b47; --line: #29405f; --line2: #22344f;
  --text: #e7edf5; --muted: #93a5bf; --gold: #c9a24a; --gold2: #e3c47c; --ink: #0d1625;
  --ok: #4cb782; --warn: #e2a63c; --bad: #e46a5e; --blue: #79a4f2;
  --r: 10px; --r2: 14px;
  --font: "Cairo", "Segoe UI", Tahoma, Arial, sans-serif;
  --side: 248px;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font-family: var(--font); font-size: 15px; line-height: 1.6; color: var(--text); background: var(--bg);
  -webkit-text-size-adjust: 100%; text-rendering: optimizeLegibility;
}
a { color: var(--gold2); text-decoration: none; }
a:hover { text-decoration: underline; }
button, input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3, h4 { margin: 0; line-height: 1.35; font-weight: 700; }
h2 { font-size: 1.15rem; } h3 { font-size: 1.02rem; } h4 { font-size: .95rem; margin: .8rem 0 .3rem; color: var(--muted); }
p { margin: .4rem 0; }
:focus-visible { outline: 2px solid var(--gold2); outline-offset: 2px; border-radius: 6px; }
.muted { color: var(--muted); } .small { font-size: .85rem; }
.txt-bad { color: var(--bad); font-weight: 700; } .txt-warn { color: var(--warn); font-weight: 700; }
.prewrap { white-space: pre-wrap; }
svg { flex-shrink: 0; }

/* ---------- الهيكل ---------- */
#app { min-height: 100%; }
.side { display: none; }
.shell-main { min-height: 100vh; padding-bottom: calc(76px + env(safe-area-inset-bottom)); }
.top {
  position: sticky; top: 0; z-index: 20; display: flex; align-items: center; justify-content: space-between; gap: .5rem;
  padding: calc(.6rem + env(safe-area-inset-top)) 1rem .6rem; background: rgba(13, 22, 37, .92); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line2);
}
.top h1 { font-size: 1.12rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.top-tools { display: flex; gap: .25rem; }
#view {
  padding: 1rem; outline: none; max-width: 1280px; margin: 0 auto;
}
.shell-main {
  background-image: linear-gradient(rgba(121, 164, 242, .035) 1px, transparent 1px), linear-gradient(90deg, rgba(121, 164, 242, .035) 1px, transparent 1px);
  background-size: 28px 28px;
}
.bottom {
  position: fixed; inset: auto 0 0 0; z-index: 30; display: grid; grid-template-columns: repeat(5, 1fr);
  background: #0f1a2c; border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom);
}
.bottom a { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: .5rem .2rem .45rem; color: var(--muted); font-size: .72rem; text-decoration: none; }
.bottom a.on { color: var(--gold2); }
.bottom a.on svg { filter: drop-shadow(0 0 6px rgba(227, 196, 124, .35)); }
.offline-bar { background: #3a2c0e; color: var(--gold2); text-align: center; font-size: .85rem; padding: .3rem; }

@media (min-width: 900px) {
  #app { display: grid; grid-template-columns: var(--side) 1fr; }
  .side {
    display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; background: #0b1321; border-inline-end: 1px solid var(--line2); padding: 1rem .7rem;
  }
  .side nav { display: flex; flex-direction: column; gap: 2px; margin-top: 1.2rem; }
  .side nav a { display: flex; align-items: center; gap: .7rem; padding: .62rem .8rem; border-radius: var(--r); color: var(--muted); text-decoration: none; }
  .side nav a:hover { background: var(--panel); color: var(--text); }
  .side nav a.on { background: var(--panel2); color: var(--text); box-shadow: inset 3px 0 0 var(--gold); }
  [dir=rtl] .side nav a.on { box-shadow: inset -3px 0 0 var(--gold); }
  .side-foot { margin-top: auto; font-size: .78rem; color: var(--muted); display: flex; align-items: center; gap: .4rem; overflow: hidden; text-overflow: ellipsis; padding: .5rem; }
  .bottom { display: none; }
  .shell-main { padding-bottom: 2rem; }
  #view { padding: 1.4rem 2rem 3rem; }
  .top { padding: .9rem 2rem; }
}
.brand { display: flex; align-items: center; gap: .7rem; padding: .2rem .3rem; }
.brand b { display: block; font-size: 1.05rem; }
.brand small { color: var(--muted); font-size: .72rem; direction: ltr; display: block; }
.brand-mark { width: 46px; height: 46px; border-radius: 50%; display: grid; place-items: center; overflow: hidden; background: radial-gradient(circle at 35% 30%, #3a3320, #15120a); border: 1.5px solid var(--gold); color: var(--gold2); font-weight: 800; font-size: .8rem; }
.brand-mark img { width: 100%; height: 100%; object-fit: cover; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--warn); display: inline-block; }
.dot.on { background: var(--ok); }

/* ---------- الأزرار ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .4rem; min-height: 42px; padding: .45rem 1rem; border-radius: var(--r);
  background: var(--panel2); border: 1px solid var(--line); color: var(--text); cursor: pointer; text-decoration: none; font-weight: 600; white-space: nowrap;
}
.btn:hover { border-color: var(--gold); text-decoration: none; }
.btn svg { width: 18px; height: 18px; }
.btn.primary { background: linear-gradient(180deg, var(--gold2), var(--gold)); color: #1b1404; border-color: transparent; }
.btn.primary:hover { filter: brightness(1.05); }
.btn.danger { color: var(--bad); }
.btn.ghost { background: transparent; }
.btn.sm { min-height: 34px; padding: .25rem .7rem; font-size: .86rem; }
.btn.big { min-height: 52px; width: 100%; font-size: 1.05rem; }
.btn[disabled] { opacity: .45; cursor: not-allowed; }
.icon-btn { display: inline-grid; place-items: center; width: 40px; height: 40px; border-radius: 50%; background: transparent; border: 0; color: var(--muted); cursor: pointer; }
.icon-btn:hover { background: var(--panel); color: var(--text); }
.icon-btn.warn { color: var(--warn); }
.icon-btn.busy svg { animation: pulse 1s infinite alternate; }
@keyframes pulse { to { opacity: .35; } }
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }

/* ---------- الكتل ---------- */
.block { background: var(--panel); border: 1px solid var(--line2); border-radius: var(--r2); padding: 1rem; margin: 0 0 1rem; }
.block.inner { background: var(--bg2); }
.block-h { display: flex; align-items: center; justify-content: space-between; gap: .6rem; margin-bottom: .6rem; flex-wrap: wrap; }
.note { background: rgba(121, 164, 242, .08); border-inline-start: 3px solid var(--blue); padding: .55rem .8rem; border-radius: 6px; color: #c9d6ea; font-size: .9rem; }
.note.warn { background: rgba(226, 166, 60, .1); border-color: var(--warn); color: #f0d6a2; }
.banner { display: flex; align-items: center; gap: .6rem; padding: .7rem .9rem; border-radius: var(--r2); background: #2a2210; border: 1px solid #5a4719; color: var(--gold2); margin-bottom: 1rem; text-decoration: none; }
.banner.soft { background: var(--panel); border-color: var(--line); color: var(--muted); }
.empty { text-align: center; padding: 2.4rem 1rem; color: var(--muted); border: 1px dashed var(--line); border-radius: var(--r2); }
.empty .btn { margin-top: .6rem; }
.cols { display: grid; gap: 1rem; }
.cols > .block { margin: 0; }
.cols { margin-bottom: 1rem; }
@media (min-width: 1100px) { .cols { grid-template-columns: 1fr 1fr; } }

/* الرئيسية */
.home-grid { display: grid; gap: 1rem; }
.home-grid .block { margin: 0; }
@media (min-width: 900px) { .home-grid { grid-template-columns: 1.3fr 1fr; } .home-grid .lead { grid-row: span 2; } }
.quick-grid { display: grid; grid-template-columns: 1fr 1fr; gap: .6rem; margin-top: .6rem; }
.qbtn { display: flex; align-items: center; gap: .6rem; padding: .85rem; border-radius: var(--r); background: var(--panel2); border: 1px solid var(--line); color: var(--text); font-weight: 600; text-decoration: none; }
.qbtn:hover { border-color: var(--gold); text-decoration: none; }
.qbtn svg { color: var(--gold2); }
.more-list { display: grid; gap: .5rem; }
.more-list a, .more-list button { display: flex; align-items: center; gap: .8rem; padding: 1rem; background: var(--panel); border: 1px solid var(--line2); border-radius: var(--r2); color: var(--text); font-weight: 600; text-decoration: none; text-align: start; cursor: pointer; }

/* القوائم */
.rows { list-style: none; margin: 0; padding: 0; display: grid; gap: .45rem; }
.row { display: flex; align-items: center; gap: .7rem; width: 100%; padding: .65rem .8rem; border-radius: var(--r); background: var(--bg2); border: 1px solid var(--line2); color: var(--text); text-decoration: none; text-align: start; cursor: pointer; flex-wrap: wrap; }
a.row:hover, button.row:hover { border-color: var(--line); text-decoration: none; background: #15223a; }
.row-main { flex: 1 1 220px; min-width: 0; display: flex; flex-direction: column; }
.row-main b { overflow: hidden; text-overflow: ellipsis; }
.row-main small { color: var(--muted); }
.row-actions { display: flex; gap: .35rem; flex-wrap: wrap; }
.rows.cards .row { background: var(--panel); padding: .85rem 1rem; }
.timeline { list-style: none; margin: 0; padding: 0; border-inline-start: 2px solid var(--line); }
.timeline li { padding: .2rem .9rem .7rem; position: relative; }
.timeline li::before { content: ""; position: absolute; inset-inline-start: -6px; top: .55rem; width: 10px; height: 10px; border-radius: 50%; background: var(--gold); }
.timeline time { color: var(--muted); font-size: .8rem; }
.timeline s { color: var(--muted); }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: .35rem 1rem; margin: 0; }
.kv dt { color: var(--muted); } .kv dd { margin: 0; overflow-wrap: anywhere; }
.kv.answers { grid-template-columns: minmax(120px, 34%) 1fr; }
.sig { max-width: 260px; background: #fff; border-radius: 6px; }

/* الوسوم */
.tag { display: inline-block; padding: .08rem .55rem; border-radius: 999px; font-size: .78rem; font-weight: 600; background: var(--panel2); border: 1px solid var(--line); color: var(--muted); white-space: nowrap; }
.tag.ok, .tag.ss-approved, .tag.rs-inForce, .tag.stg-won { color: #9be3c0; border-color: #2f6f52; background: rgba(76, 183, 130, .12); }
.tag.warn, .tag.ss-verify, .tag.ss-estimate, .tag.rs-verify, .tag.stg-waiting { color: #f3cd86; border-color: #6d5420; background: rgba(226, 166, 60, .12); }
.tag.bad, .tag.rs-repealed, .tag.stg-lost { color: #f4a39a; border-color: #7a3830; background: rgba(228, 106, 94, .12); }
.tag.ss-draft, .tag.rs-draft, .tag.rs-amended, .tag.ss-field { color: #b9cdf6; border-color: #34507f; background: rgba(121, 164, 242, .1); }
.tag.used { color: var(--gold2); border-color: #5a4719; }
.tag.stg-new { color: var(--gold2); border-color: #5a4719; }
.badge { background: var(--gold); color: #1b1404; border-radius: 999px; padding: 0 .45rem; font-size: .75rem; }

/* التبويبات وشريط الأدوات */
.tabs { display: flex; gap: .25rem; overflow-x: auto; margin-bottom: 1rem; border-bottom: 1px solid var(--line2); scrollbar-width: none; }
.tabs a { padding: .6rem .9rem; color: var(--muted); border-bottom: 2px solid transparent; white-space: nowrap; text-decoration: none; font-weight: 600; }
.tabs a[aria-selected=true] { color: var(--text); border-color: var(--gold); }
.toolbar, .filters { display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; margin-bottom: .9rem; }
.toolbar > :first-child { margin-inline-end: auto; }
.filters select, .filters input { min-height: 40px; }
.filters .btn { margin-inline-start: auto; }
.tb-search { flex: 1 1 200px; min-height: 42px; }
.seg { display: inline-flex; background: var(--bg2); border: 1px solid var(--line); border-radius: var(--r); padding: 3px; }
.seg button { border: 0; background: transparent; color: var(--muted); padding: .35rem .8rem; border-radius: 7px; cursor: pointer; font-weight: 600; }
.seg button[aria-selected=true] { background: var(--panel2); color: var(--text); }
.crumb { margin: 0 0 .3rem; font-size: .88rem; }
.detail-head { display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap; align-items: flex-end; margin-bottom: 1rem; }
.detail-head h2 { font-size: 1.45rem; }
.head-actions { display: flex; gap: .4rem; flex-wrap: wrap; }
.grp { margin: 1.2rem 0 .5rem; color: var(--gold2); font-size: .95rem; }
.lib-index { list-style: none; padding: 0; margin: 0; display: grid; gap: .6rem; }
@media (min-width: 700px) { .lib-index { grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); } }
.lib-index a { display: flex; flex-direction: column; gap: .2rem; padding: 1rem; background: var(--panel); border: 1px solid var(--line2); border-radius: var(--r2); color: var(--text); text-decoration: none; min-height: 88px; }
.lib-index a:hover { border-color: var(--gold); }

/* الجداول — على الجوال تتحول لبطاقات */
.table-wrap { overflow-x: auto; border: 1px solid var(--line2); border-radius: var(--r2); background: var(--panel); }
.tbl { width: 100%; border-collapse: collapse; font-size: .92rem; }
.tbl th { text-align: start; font-weight: 600; color: var(--muted); background: var(--bg2); padding: .6rem .75rem; border-bottom: 1px solid var(--line2); white-space: nowrap; }
.tbl td { padding: .6rem .75rem; border-bottom: 1px solid var(--line2); vertical-align: top; }
.tbl tr[data-go], .tbl tr[data-row] { cursor: pointer; }
.tbl tbody tr:hover { background: #18284200; background: rgba(121, 164, 242, .05); }
.tbl td.long { max-width: 420px; }
.tbl td svg { color: var(--ok); }
@media (max-width: 699px) {
  .table-wrap { border: 0; background: transparent; }
  .tbl thead { display: none; }
  .tbl, .tbl tbody, .tbl tr, .tbl td { display: block; width: 100%; }
  .tbl tr { background: var(--panel); border: 1px solid var(--line2); border-radius: var(--r); margin-bottom: .5rem; padding: .4rem .2rem; }
  .tbl td { border: 0; padding: .2rem .7rem; display: flex; gap: .8rem; justify-content: space-between; }
  .tbl td::before { content: attr(data-l); color: var(--muted); font-size: .8rem; flex-shrink: 0; }
  .tbl td.c-main { font-weight: 700; font-size: 1rem; }
  .tbl td.c-main::before { display: none; }
  .tbl td:empty, .tbl td.long:empty { display: none; }
}

/* الحقول */
input, select, textarea { width: 100%; background: var(--bg); border: 1px solid var(--line); border-radius: 8px; padding: .55rem .7rem; min-height: 44px; }
textarea { min-height: 0; resize: vertical; }
input[type=checkbox], input[type=radio] { width: 20px; height: 20px; min-height: 0; accent-color: var(--gold); }
input[type=color] { padding: 2px; height: 44px; }
input:focus, select:focus, textarea:focus { border-color: var(--gold); outline: none; box-shadow: 0 0 0 3px rgba(201, 162, 74, .2); }
.fld { display: flex; flex-direction: column; gap: .3rem; margin: 0 0 .75rem; border: 0; padding: 0; min-width: 0; }
.fld > span, .fld > legend { font-size: .86rem; color: var(--muted); font-weight: 600; padding: 0; }
.fld.chk { flex-direction: row; align-items: center; gap: .55rem; }
.fld.chk span { color: var(--text); font-size: .95rem; }
.fld .mini { width: 80px; }
.form-grid { display: grid; gap: 0 1rem; }
@media (min-width: 700px) { .form-grid { grid-template-columns: 1fr 1fr; } .span2 { grid-column: span 2; } }
.bi-pair { display: grid; gap: .5rem; }
@media (min-width: 700px) { .bi-pair { grid-template-columns: 1fr 1fr; } }
.bi-pair label { display: flex; gap: .4rem; align-items: flex-start; }
.bi-pair em { font-style: normal; font-size: .72rem; color: var(--muted); min-width: 22px; padding-top: .7rem; }
.chips { display: flex; flex-wrap: wrap; gap: .4rem; }
.chip { display: inline-flex; align-items: center; gap: .4rem; padding: .35rem .7rem; border: 1px solid var(--line); border-radius: 999px; cursor: pointer; background: var(--bg2); }
.chip input { width: 16px; height: 16px; }
.chip:has(input:checked) { border-color: var(--gold); background: rgba(201, 162, 74, .14); }
.chips.static { margin-top: .6rem; }
.actions-row { display: flex; gap: .5rem; flex-wrap: wrap; margin-top: .4rem; }
.datef { display: block; }
.linkbox { font-family: ui-monospace, monospace; font-size: .85rem; }
.logo-fld .logo-prev { width: 120px; height: 120px; border-radius: 50%; border: 1px dashed var(--line); display: grid; place-items: center; overflow: hidden; background: #0a111d; }
.logo-prev img { width: 100%; height: 100%; object-fit: contain; }
.logo-prev.sm { width: 80px; height: 80px; border-radius: 8px; border: 1px dashed var(--line); display: grid; place-items: center; overflow: hidden; }
.idn-logo { width: 44px; height: 44px; border-radius: 50%; overflow: hidden; background: #0a111d; display: grid; place-items: center; border: 1px solid var(--line); }
.idn-logo img { width: 100%; height: 100%; object-fit: contain; }
.sticky-actions { position: sticky; bottom: calc(70px + env(safe-area-inset-bottom)); display: flex; gap: .5rem; justify-content: flex-end; flex-wrap: wrap; padding: .7rem; background: rgba(13, 22, 37, .94); border: 1px solid var(--line); border-radius: var(--r2); backdrop-filter: blur(8px); }
@media (min-width: 900px) { .sticky-actions { bottom: 1rem; } }
.fcards { list-style: none; padding: 0; margin: 0 0 .8rem; display: grid; gap: .6rem; }
.fcard { background: var(--bg2); border: 1px solid var(--line2); border-radius: var(--r); padding: .7rem; }
.fcard-h { display: flex; gap: .5rem; align-items: center; margin-bottom: .5rem; }
.fcard-h b { color: var(--gold2); min-width: 1.5rem; }
.fcard-h select { flex: 1; }
.fcard-tools { display: flex; }
.fcard .bi-pair { margin-bottom: .5rem; }
.hist summary { cursor: pointer; color: var(--gold2); margin: .4rem 0; }

/* الصور */
.ph-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: .5rem; }
.ph { position: relative; padding: 0; border: 1px solid var(--line2); border-radius: 8px; overflow: hidden; background: #000; cursor: pointer; aspect-ratio: 1; display: block; }
.ph img { width: 100%; height: 100%; object-fit: cover; display: block; }
.ph-meta { position: absolute; inset: auto 0 0 0; padding: .2rem .35rem; background: linear-gradient(transparent, rgba(0, 0, 0, .8)); font-size: .7rem; color: #fff; display: flex; gap: .3rem; flex-wrap: wrap; align-items: center; }
.ph-meta .tag { font-size: .62rem; padding: 0 .35rem; }
.ph-view img { width: 100%; max-height: 65vh; object-fit: contain; background: #000; border-radius: 8px; }
.ph-view figcaption { display: grid; gap: .2rem; margin: .6rem 0; font-size: .9rem; }

/* النوافذ */
.sheet-wrap { position: fixed; inset: 0; background: rgba(4, 8, 15, .6); display: flex; align-items: flex-end; justify-content: center; opacity: 0; transition: opacity .18s; }
.sheet-wrap.in { opacity: 1; }
.sheet { width: 100%; max-height: 92vh; display: flex; flex-direction: column; background: var(--panel); border: 1px solid var(--line); border-radius: 18px 18px 0 0; transform: translateY(24px); transition: transform .2s; padding-bottom: env(safe-area-inset-bottom); }
.sheet-wrap.in .sheet { transform: none; }
.sheet-h { display: flex; align-items: center; justify-content: space-between; gap: .5rem; padding: .8rem 1rem .5rem; border-bottom: 1px solid var(--line2); }
.sheet-h h2 { font-size: 1.05rem; }
.sheet-b { padding: 1rem; overflow-y: auto; overscroll-behavior: contain; }
.sheet-f { display: flex; gap: .5rem; justify-content: flex-end; flex-wrap: wrap; padding: .7rem 1rem; border-top: 1px solid var(--line2); }
.sheet-f .btn { flex: 1 1 auto; }
@media (min-width: 900px) {
  .sheet-wrap { align-items: center; }
  .sheet { width: min(640px, 94vw); border-radius: 18px; max-height: 88vh; }
  .sheet.wide { width: min(940px, 94vw); }
  .sheet-f .btn { flex: 0 0 auto; }
}
.search-in { font-size: 1.05rem; margin-bottom: .8rem; }
#toasts { position: fixed; inset: auto 0 calc(84px + env(safe-area-inset-bottom)) 0; z-index: 500; display: flex; flex-direction: column; align-items: center; gap: .4rem; pointer-events: none; }
@media (min-width: 900px) { #toasts { bottom: 1.4rem; } }
.toast { background: #1f3254; color: var(--text); border: 1px solid var(--line); padding: .55rem 1rem; border-radius: 999px; box-shadow: 0 6px 24px rgba(0, 0, 0, .35); font-weight: 600; max-width: 92vw; transition: opacity .3s; }
.toast.ok { border-color: #2f6f52; } .toast.bad { border-color: var(--bad); color: #ffd0ca; }
.toast.out { opacity: 0; }

/* ---------- النموذج العام ---------- */
body.public { background: #eef1f5; color: #1b2433; color-scheme: light; }
body.public .shell-main { display: none; }
.pub { max-width: 720px; margin: 0 auto; padding: 1rem 1rem 3rem; }
.pub-brand { display: flex; align-items: center; gap: .8rem; justify-content: center; padding: 1rem 0; }
.pub-brand img { width: 64px; height: 64px; object-fit: contain; }
.pub-brand b { display: block; font-size: 1.05rem; } .pub-brand span { color: #6b7688; font-size: .85rem; }
.pub-card { background: #fff; border-radius: 16px; padding: 1.2rem; box-shadow: 0 2px 14px rgba(20, 30, 50, .08); }
.pub-card h1 { font-size: 1.3rem; color: #1d3a85; margin-bottom: .4rem; }
.pub-card .intro { color: #4a5568; }
.pub-h { font-size: 1.02rem; color: #8a6a1e; border-bottom: 1px solid #eadfc5; padding-bottom: .3rem; margin: 1.3rem 0 .6rem; }
.pf { display: flex; flex-direction: column; gap: .35rem; margin: 0 0 1rem; border: 0; padding: 0; }
.pf .pl { font-weight: 600; } .pf .req { color: #c0392b; margin-inline-start: .2rem; } .pf .hint { color: #718096; }
.pub small.en { display: block; color: #718096; font-weight: 500; font-size: .78em; margin-top: .1rem; }
body.public input, body.public textarea, body.public select { background: #fff; border-color: #cbd3df; color: #1b2433; }
body.public .chip { background: #f6f8fb; border-color: #cbd3df; }
body.public .chip:has(input:checked) { background: #fbf3df; border-color: #b8902f; }
.pf canvas { width: 100%; max-width: 600px; aspect-ratio: 3; background: #fafbfc; border: 1px dashed #9aa6b8; border-radius: 10px; touch-action: none; }
.pub-photos { display: flex; flex-wrap: wrap; gap: .4rem; } .pub-photos img { width: 84px; height: 84px; object-fit: cover; border-radius: 8px; }
body.public .btn { background: #f1f3f7; border-color: #cbd3df; color: #1b2433; }
body.public .btn.primary { background: linear-gradient(180deg, #d6b25e, #b8902f); color: #1b1404; border: 0; }
.pub .err { color: #c0392b; font-weight: 600; }
.pub-done { padding: 2rem 0; text-align: center; font-size: 1.15rem; color: #2f6f52; font-weight: 700; }
.pub-foot { text-align: center; color: #6b7688; font-size: .8rem; margin-top: 1rem; }

/* ---------- معاينة الطباعة ---------- */
#print-root:empty { display: none; }
#print-root { position: fixed; inset: 0; z-index: 400; background: #4a5568; overflow-y: auto; }
.pv-bar { position: sticky; top: 0; z-index: 2; display: flex; gap: .5rem; align-items: center; justify-content: space-between; padding: calc(.5rem + env(safe-area-inset-top)) .8rem .5rem; background: #0d1625; border-bottom: 1px solid var(--line); }
.pv-hint { color: var(--muted); font-size: .8rem; text-align: center; flex: 1; }
@media (max-width: 600px) { .pv-hint { display: none; } }
.pv-paper { background: #fff; color: #1a1a1a; max-width: 210mm; margin: 1rem auto 3rem; padding: 10mm 11mm; box-shadow: 0 6px 30px rgba(0, 0, 0, .4); position: relative; overflow: hidden; }
@media (max-width: 600px) { .pv-paper { margin: 0; padding: 5mm; } }

/* ---------- الوثيقة (معاينة وطباعة) ---------- */
.p-doc { font-family: "Cairo", Tahoma, Arial, sans-serif; font-size: 10.5pt; line-height: 1.55; color: #1a1a1a; background: #fff; isolation: isolate; position: relative; }
.p-doc * { color-adjust: exact; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
.p-wm { position: absolute; top: 120mm; left: 50%; transform: translateX(-50%); width: 120mm; opacity: var(--wm); z-index: -1; pointer-events: none; }
.p-frame { width: 100%; border-collapse: collapse; }
.p-frame > thead td, .p-frame > tfoot td, .p-frame > tbody > tr > td { padding: 0; }
.p-run { display: flex; justify-content: space-between; gap: 1rem; font-size: 8pt; color: #555; border-bottom: 1px solid #ddd; padding-bottom: 1.5mm; margin-bottom: 3mm; }
.p-foot { display: flex; gap: 3mm; align-items: center; border-top: 1.5px solid var(--pa); margin-top: 4mm; padding-top: 2mm; font-size: 7.5pt; color: #444; }
.p-foot-qr svg, .p-foot-qr img { width: 13mm; height: 13mm; display: block; }
.p-head { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 4mm; background: var(--ph); color: #fff; border-bottom: 3px solid var(--pa); padding: 4mm 5mm; border-radius: 2mm; }
.p-head-name b { display: block; font-size: 12pt; } .p-head-name span { color: var(--pa); font-weight: 700; letter-spacing: .5px; font-size: 9pt; }
.p-head-logo { display: grid; place-items: center; }
.p-logo { width: 30mm; height: 30mm; object-fit: contain; }
.p-logo.ph { display: grid; place-items: center; border-radius: 50%; border: 2px solid var(--pa); color: var(--pa); font-weight: 800; font-size: 12pt; }
.p-head-contact { font-size: 7.6pt; line-height: 1.7; text-align: left; color: #e8e8e8; }
[dir=ltr] .p-head-contact { text-align: right; }
.p-title { margin: 6mm 0 4mm; }
.p-title h1 { color: var(--pc); font-size: 18pt; margin: 0; }
.p-title h1.en { font-size: 13pt; margin-top: 1mm; }
.p-sub { color: #555; font-size: 11pt; margin: 1mm 0; }
.p-who { color: #333; font-size: 9.5pt; background: #f6f6f2; border-inline-start: 3px solid var(--pa); padding: 2mm 3mm; }
.p-meta, .p-tbl { width: 100%; border-collapse: collapse; margin: 3mm 0 5mm; font-size: 9.5pt; }
.p-meta th, .p-tbl th { background: #f0f2f7; text-align: start; width: 30%; font-weight: 700; }
.p-meta th, .p-meta td, .p-tbl th, .p-tbl td { border: 1px solid #d5d9e2; padding: 1.8mm 2.5mm; vertical-align: top; }
.p-tbl tr:first-child th { width: auto; }
.p-tbl .p-sub-h { background: #fbf3df; color: #7a5a12; }
.p-tbl img { max-width: 60mm; max-height: 40mm; }
.p-sec { margin: 0 0 5mm; break-inside: auto; }
.p-bar { color: #fff; font-size: 11.5pt; padding: 2mm 3.5mm; border-radius: 1.5mm; margin: 0 0 3mm; display: flex; justify-content: space-between; gap: 4mm; break-after: avoid; }
.p-both { display: grid; grid-template-columns: 1fr 1fr; gap: 5mm; }
.p-h3 { color: var(--pc); font-size: 10.5pt; border-inline-start: 3px solid var(--pc); padding-inline-start: 2mm; margin: 3mm 0 2mm; }
.p-q { margin: 0 0 3.5mm; break-inside: avoid; }
.p-ql { font-weight: 700; margin-bottom: 1mm; }
.p-line { border-bottom: 1px solid #999; height: 7mm; }
.p-lines i { display: block; border-bottom: 1px solid #bbb; height: 7mm; }
.p-opts { display: flex; flex-wrap: wrap; gap: 2mm 6mm; }
.p-opts span { display: inline-flex; align-items: center; gap: 1.5mm; }
.p-box { display: inline-block; width: 3.5mm; height: 3.5mm; border: 1px solid #333; }
.p-box.round { border-radius: 50%; }
.p-signbox { height: 22mm; border: 1px dashed #888; border-radius: 2mm; }
.p-note { color: #666; font-size: 9pt; }
.p-sign { display: grid; grid-template-columns: 1fr 1fr; gap: 5mm; margin-top: 6mm; break-inside: avoid; }
.p-sign-col { border: 1px solid #d5d9e2; border-radius: 2mm; padding: 3mm 4mm; }
.p-sign-col h3 { font-size: 11pt; border-bottom: 2px solid; padding-bottom: 1mm; margin-bottom: 2mm; color: #222; }
.p-sign-col dl { display: grid; grid-template-columns: max-content 1fr; gap: .5mm 3mm; margin: 0 0 2mm; font-size: 9pt; }
.p-sign-col dt { color: #666; } .p-sign-col dd { margin: 0; }
.p-name { font-weight: 800; font-size: 11pt; margin: 0; }
.p-small { font-size: 8.5pt; color: #444; margin: 1mm 0; }
.p-sigline { margin: 4mm 0 2mm; font-size: 9pt; }
.p-qr { display: flex; align-items: center; gap: 2mm; font-size: 7.5pt; color: #555; }
.p-qr svg, .p-qr img { width: 20mm; height: 20mm; }
.p-disc { border: 1.5px dotted #888; border-radius: 2mm; padding: 2.5mm 3.5mm; margin: 4mm 0 2mm; font-size: 8.5pt; color: #333; break-inside: avoid; }
.p-disc p { margin: 1mm 0 0; }
.p-copy { font-size: 8pt; color: #555; text-align: center; margin: 2mm 0 0; }

@page { size: A4; margin: 9mm 10mm 11mm; @bottom-center { content: counter(page) " / " counter(pages); font: 8pt Tahoma, sans-serif; color: #777; } }
@media print {
  :root { color-scheme: light; }
  html, body { background: #fff !important; height: auto; color: #1a1a1a; }
  body > *:not(#print-root) { display: none !important; }
  #print-root { position: static; overflow: visible; background: #fff; }
  .pv-bar { display: none !important; }
  .pv-paper { margin: 0; padding: 0; box-shadow: none; max-width: none; overflow: visible; }
  .p-wm { position: fixed; top: 50%; transform: translate(-50%, -50%); }
  .p-sec { break-inside: auto; }
  tr, .p-q { break-inside: avoid; }
}
.upd-bar { display: flex; align-items: center; gap: .8rem; flex-wrap: wrap; margin-bottom: .8rem; }
.row.chg { border-color: #6d5420; }
.filters > select, .filters > input { flex: 1 1 170px; width: auto; }
.filters > .tb-search { flex: 2 1 240px; }
.filters > .btn { flex: 0 0 auto; }
.toolbar > select { width: auto; }
