/* ثيم فاتح بروح أبل: خلفية رمادية دافية، كروت بيضاء، زجاج خفيف للشريط الجانبي والسفلي، وأخضر اللوجو كلون وحيد مميز */
:root {
  /* الأسطح */
  --bg: #f5f5f7; --surface: #ffffff; --surface-2: #fafafc; --field: #f2f2f5; --fill: rgba(60, 60, 67, .06); --fill-hi: rgba(60, 60, 67, .11);
  --frost: rgba(255, 255, 255, .74);
  --line: rgba(0, 0, 0, .075); --line-hi: rgba(0, 0, 0, .14);
  --shadow: 0 1px 2px rgba(0, 0, 0, .04), 0 10px 30px -14px rgba(0, 0, 0, .12);
  --shadow-lg: 0 24px 70px -20px rgba(0, 0, 0, .28);
  /* النص */
  --ink: #1d1d1f; --muted: #6e6e73; --dim: #8e8e93;
  /* الهوية (أخضر اللوجو) */
  --leaf: #23863c; --leaf-hi: #1c7132; --leaf-2: #34c759; --leaf-soft: rgba(52, 199, 89, .13); --leaf-line: rgba(35, 134, 60, .32); --on-leaf: #fff;
  /* الحالات */
  --ok: #1d7f37; --ok-bg: rgba(52, 199, 89, .15); --warn: #a15a00; --warn-bg: rgba(255, 159, 10, .16);
  --bad: #c9251b; --bad-bg: rgba(255, 59, 48, .11); --info: #0a58c2; --info-bg: rgba(0, 122, 255, .1);
  /* الخطوط */
  --f-display: "Readex Pro", "IBM Plex Sans Arabic", system-ui, sans-serif;
  --f-body: "IBM Plex Sans Arabic", system-ui, "Segoe UI", Tahoma, sans-serif;
  --f-num: "Inter", "SF Pro Text", system-ui, sans-serif;
  --r: 20px; --r-sm: 12px;
  color-scheme: light;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0; color: var(--ink); font-family: var(--f-body); font-size: 15px; line-height: 1.65; direction: rtl; -webkit-font-smoothing: antialiased;
  background:
    radial-gradient(900px 520px at 92% -8%, rgba(52, 199, 89, .10), transparent 60%),
    radial-gradient(800px 520px at 0% 108%, rgba(0, 122, 255, .06), transparent 60%),
    var(--bg);
  background-attachment: fixed;
}
body::before { content: ""; position: fixed; inset: 0 0 auto; height: env(safe-area-inset-top, 0px); z-index: 30; background: var(--bg); }
body.no-scroll { overflow: hidden; }
#app { position: relative; z-index: 1; min-height: 100%; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 3px solid rgba(52, 199, 89, .55); outline-offset: 2px; border-radius: 8px; }
svg { width: 20px; height: 20px; flex: none; }
h1, h2, h3 { font-family: var(--f-display); margin: 0; text-wrap: balance; font-weight: 600; }
h1 { font-size: clamp(26px, 3vw, 34px); letter-spacing: 0; line-height: 1.5; }
h2 { font-size: 17px; letter-spacing: 0; line-height: 1.5; }
h3 { line-height: 1.5; }
h3 { font-size: 15px; }
p { margin: 0; }
.num { font-family: var(--f-num); font-variant-numeric: tabular-nums; direction: ltr; unicode-bidi: isolate; letter-spacing: -.01em; }
.muted { color: var(--muted); } .small { font-size: 13px; } .grow { flex: 1; min-width: 0; }
.eyebrow { color: var(--leaf); font-size: 13px; font-weight: 500; margin-bottom: 4px; }
.sub { display: block; color: var(--muted); font-size: 13px; }
.pre { white-space: pre-wrap; }
.mobile-only { display: none !important; }

/* الكروت */
.glass { background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow); }

/* ---------- الهيكل ---------- */
.app { display: grid; grid-template-columns: 260px minmax(0, 1fr); min-height: 100vh; }
.side { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; gap: 18px; padding: 22px 14px 18px; border-width: 0 0 0 1px; border-radius: 0; box-shadow: none; background: var(--frost); backdrop-filter: blur(24px) saturate(180%); -webkit-backdrop-filter: blur(24px) saturate(180%); }
.brand { display: flex; align-items: center; gap: 11px; padding: 4px 10px; }
.brand img { width: 36px; height: auto; }
.brand b { font-family: var(--f-display); font-weight: 600; font-size: 17px; display: block; line-height: 1.25; }
.brand small { color: var(--dim); font-size: 11.5px; letter-spacing: .5px; font-family: var(--f-num); }
.nav { display: grid; gap: 2px; }
.nav a { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 10px; color: var(--ink); min-height: 44px; font-weight: 450; transition: background .15s, color .15s; }
.nav a svg { color: var(--muted); transition: color .15s; }
.nav a:hover { background: var(--fill); }
.nav a.active { background: var(--leaf-soft); color: var(--leaf-hi); font-weight: 600; }
.nav a.active svg { color: var(--leaf); }
.nav a.nav-cta { color: var(--leaf-hi); font-weight: 600; }
.nav a.nav-cta svg { color: var(--leaf); }
.me { margin-top: auto; display: flex; align-items: center; gap: 10px; padding: 10px; border-radius: 14px; background: var(--surface); border: 1px solid var(--line); }
.me b { display: block; font-size: 14px; } .me small { color: var(--muted); font-size: 12px; }
.avatar { width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; font-family: var(--f-display); font-size: 14px; font-weight: 500; background: linear-gradient(180deg, #e9f8ee, #d4f0dc); color: var(--leaf-hi); flex: none; }
.avatar.sm { width: 32px; height: 32px; font-size: 12px; }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar { position: sticky; top: env(safe-area-inset-top, 0px); z-index: 20; display: flex; align-items: center; gap: 10px; padding-block: 12px; padding-left: max(28px, env(safe-area-inset-left, 0px)); padding-right: max(28px, env(safe-area-inset-right, 0px)); background: linear-gradient(180deg, var(--bg) 40%, rgba(245, 245, 247, 0)); }
#view { padding-block: 6px 56px; padding-left: max(28px, env(safe-area-inset-left, 0px)); padding-right: max(28px, env(safe-area-inset-right, 0px)); max-width: 1220px; width: 100%; margin: 0 auto; display: grid; grid-template-columns: minmax(0, 1fr); gap: 22px; align-content: start; outline: none; }
.icon-btn { width: 44px; height: 44px; border-radius: 50%; display: inline-grid; place-items: center; background: var(--surface); border: 1px solid var(--line); color: var(--ink); position: relative; flex: none; box-shadow: 0 1px 2px rgba(0, 0, 0, .04); transition: background .15s; }
.icon-btn:hover { background: var(--field); }
.icon-btn.sm { width: 32px; height: 32px; border-radius: 50%; } .icon-btn.sm svg { width: 16px; height: 16px; }
.bell .badge { position: absolute; top: -7px; left: -7px; min-width: 18px; height: 18px; padding: 0 4px; border-radius: 10px; line-height: 1; background: #ff3b30; color: #fff; font-size: 11px; font-weight: 600; font-style: normal; display: grid; place-items: center; border: 2px solid var(--bg); box-sizing: content-box; }
.demo-chip { white-space: nowrap; border: 0; background: var(--info-bg); color: var(--info); border-radius: 20px; padding: 6px 14px; font-size: 13px; min-height: 36px; font-weight: 500; }
.tabbar { display: none; }

/* ---------- عناصر عامة ---------- */
.page-head, .hero { display: flex; align-items: flex-end; justify-content: space-between; gap: 14px; flex-wrap: wrap; padding-top: 6px; }
.hero h1 { font-size: clamp(28px, 3.4vw, 38px); }
.back { display: inline-flex; align-items: center; gap: 4px; color: var(--leaf); font-size: 14.5px; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 0 20px; border-radius: 12px; border: 0; background: var(--fill); color: var(--ink); font-weight: 500; font-size: 14.5px; transition: transform .1s, background .15s, box-shadow .15s, filter .15s; white-space: nowrap; }
.btn:hover { background: var(--fill-hi); }
.btn:active { transform: scale(.98); }
.btn:disabled { opacity: .4; cursor: not-allowed; }
.btn.primary { background: var(--leaf); color: var(--on-leaf); font-weight: 600; box-shadow: 0 1px 2px rgba(35, 134, 60, .3), 0 8px 18px -10px rgba(35, 134, 60, .7); }
.btn.primary:hover { background: var(--leaf-hi); }
.btn.ghost { background: transparent; box-shadow: inset 0 0 0 1px var(--line-hi); }
.btn.ghost:hover { background: var(--fill); }
.btn.danger { background: #ff3b30; color: #fff; }
.btn.danger-text { color: var(--bad); }
.btn.sm { min-height: 36px; padding: 0 14px; font-size: 13.5px; border-radius: 10px; } .btn.sm svg { width: 16px; height: 16px; }
.btn.block { width: 100%; }
.link { background: none; border: 0; color: var(--leaf); font-size: 14px; padding: 4px; font-weight: 500; }
.link:hover { text-decoration: underline; }
.row-end { display: flex; justify-content: flex-end; gap: 10px; flex-wrap: wrap; }
.row-between { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; }
.row-wrap { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.row-wrap.center { justify-content: center; }
.stack { display: grid; gap: 14px; }

.pill { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; font-weight: 600; padding: 3px 11px; border-radius: 20px; white-space: nowrap; line-height: 1.6; border: 0; }
.pill.as-btn { cursor: pointer; min-height: 30px; }
.tone-ok.pill, .days.tone-ok { background: var(--ok-bg); color: var(--ok); }
.tone-warn.pill, .days.tone-warn { background: var(--warn-bg); color: var(--warn); }
.tone-bad.pill, .days.tone-bad { background: var(--bad-bg); color: var(--bad); }
.tone-info.pill, .days.tone-info { background: var(--info-bg); color: var(--info); }
.tone-muted.pill, .days.tone-muted { background: var(--fill); color: var(--muted); }
.tone-bad-text { color: var(--bad); }
.days { display: inline-grid; justify-items: center; min-width: 74px; padding: 6px 8px; border-radius: 14px; line-height: 1.15; }
.days b { font-size: 19px; font-weight: 600; font-family: var(--f-num); } .days small { font-size: 10.5px; font-weight: 500; }
.cat { display: inline-grid; place-items: center; width: 28px; height: 28px; border-radius: 8px; font-family: var(--f-display); font-weight: 600; font-size: 14px; color: var(--leaf-hi); background: var(--leaf-soft); vertical-align: middle; }
.cat.empty { color: var(--dim); background: var(--fill); }
.hj { display: block; color: var(--dim); font-size: 11.5px; }

.banner { padding: 12px 16px; border-radius: 14px; font-size: 14px; border: 0; }
.banner.tone-info { background: var(--info-bg); color: #0a4a9e; }
.banner.tone-warn { background: var(--warn-bg); color: #7d4700; }
.banner.tone-bad { background: var(--bad-bg); color: #a31d15; }
.banner a { color: inherit; text-decoration: underline; }
.banner p { margin-bottom: 8px; }

.panel { border-radius: var(--r); min-width: 0; overflow: hidden; }
.panel.pad { padding: 22px; display: grid; gap: 16px; overflow: visible; }
.panel-h { display: flex; align-items: center; gap: 10px; padding: 16px 20px; border-bottom: 1px solid var(--line); }
.panel-h.flat { padding: 0; border: 0; }
.panel-h h2 { margin-inline-end: auto; display: flex; align-items: center; gap: 8px; }
.count { font-size: 12px; font-weight: 500; padding: 2px 10px; border-radius: 20px; background: var(--fill); color: var(--muted); }
.cols { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); gap: 22px; align-items: start; }

.empty { display: grid; justify-items: center; gap: 6px; text-align: center; padding: 40px 18px; color: var(--muted); }
.empty b { color: var(--ink); font-family: var(--f-display); font-weight: 500; font-size: 16px; }
.empty p { font-size: 13.5px; max-width: 42ch; }
.empty-star { width: 52px; height: 52px; border-radius: 50%; display: grid; place-items: center; color: var(--leaf); background: var(--leaf-soft); margin-bottom: 4px; }
.loading { display: flex; align-items: center; justify-content: center; gap: 10px; padding: 40px; color: var(--muted); }
.spinner { width: 18px; height: 18px; border-radius: 50%; border: 2px solid var(--fill-hi); border-top-color: var(--leaf); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.error-box { padding: 16px; border-radius: 14px; background: var(--bad-bg); color: #a31d15; }

/* إحصائيات */
.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
.stat { text-align: start; border-radius: var(--r); padding: 18px 20px; display: grid; gap: 2px; min-height: 44px; position: relative; overflow: hidden; transition: transform .18s, box-shadow .18s; cursor: pointer; }
.stat:hover { transform: translateY(-2px); box-shadow: 0 2px 4px rgba(0, 0, 0, .05), 0 18px 36px -16px rgba(0, 0, 0, .18); }
.stat::before { content: ""; width: 9px; height: 9px; border-radius: 50%; margin-bottom: 8px; background: var(--dim); }
.stat.tone-info::before { background: #007aff; } .stat.tone-warn::before { background: #ff9f0a; } .stat.tone-bad::before { background: #ff3b30; } .stat.tone-ok::before { background: var(--leaf-2); }
.stat span { color: var(--muted); font-size: 13.5px; }
.stat b { font-size: 36px; font-weight: 600; line-height: 1.15; letter-spacing: -.02em; color: var(--ink); }
.stat em { font-style: normal; color: var(--dim); font-size: 12.5px; }

/* قوائم */
.queue, .renew, .notifs { list-style: none; margin: 0; padding: 0; }
.queue li, .renew-row { display: flex; align-items: center; gap: 12px; padding: 14px 20px; border-bottom: 1px solid var(--line); cursor: pointer; transition: background .12s; }
.queue li:last-child, .renew-row:last-child { border-bottom: 0; }
.queue li:hover, .renew-row:hover { background: var(--surface-2); }
.q-main { flex: 1; min-width: 0; }
.q-acts { display: flex; gap: 6px; }
.renew-row > div:first-child { flex: 1; min-width: 0; }
.renew-row .sub .cat { width: 22px; height: 22px; font-size: 12px; border-radius: 6px; }
.bucket .dot, .notifs .dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; flex: none; }
.bucket.tone-bad .dot { background: #ff3b30; } .bucket.tone-warn .dot { background: #ff9f0a; } .bucket.tone-info .dot { background: #007aff; }
.notifs li { display: flex; gap: 12px; align-items: flex-start; padding: 15px 20px; border-bottom: 1px solid var(--line); cursor: pointer; }
.notifs li:last-child { border-bottom: 0; }
.notifs li:hover { background: var(--surface-2); }
.notifs li > div { flex: 1; min-width: 0; }
.notifs li .dot { margin-top: 8px; background: var(--fill-hi); }
.notifs li.unread { background: rgba(52, 199, 89, .06); }
.notifs li.unread .dot { background: var(--leaf-2); }
.notifs li.tone-bad.unread .dot { background: #ff3b30; }
.notifs li.tone-warn.unread .dot { background: #ff9f0a; }
.notifs time, .timeline time { color: var(--dim); font-size: 12px; white-space: nowrap; }
.team-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
.tm { padding: 16px 20px; border-inline-start: 1px solid var(--line); border-top: 1px solid var(--line); display: grid; gap: 8px; margin: -1px 0 0 -1px; }
.tm dl { display: grid; grid-template-columns: repeat(3, 1fr); margin: 0; gap: 6px; }
.tm dt { color: var(--muted); font-size: 11.5px; } .tm dd { margin: 0; font-size: 20px; font-weight: 600; font-family: var(--f-num); }

/* أدوات الفلترة */
.toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding: 10px 12px; border-radius: var(--r); }
.chips { display: flex; gap: 6px; flex-wrap: wrap; min-width: 0; max-width: 100%; }
.chip { border: 0; background: var(--fill); color: var(--ink); border-radius: 20px; padding: 6px 16px; min-height: 38px; font-size: 13.5px; font-weight: 450; transition: background .15s; }
.chip:hover { background: var(--fill-hi); }
.chip[aria-pressed="true"] { background: var(--ink); color: #fff; font-weight: 500; }
.search { display: flex; align-items: center; gap: 8px; border: 0; background: var(--field); border-radius: 12px; padding: 0 14px; min-height: 42px; width: min(320px, 100%); color: var(--dim); }
.search:focus-within { box-shadow: 0 0 0 3px rgba(52, 199, 89, .28); background: #fff; outline: 1px solid var(--leaf-line); }
.search input { border: 0; background: transparent; outline: none; width: 100%; color: var(--ink); min-height: 40px; }

/* جداول */
.table-wrap { overflow-x: auto; }
.tbl { width: 100%; border-collapse: collapse; font-size: 14px; }
.tbl th { text-align: start; font-weight: 500; color: var(--muted); font-size: 12.5px; padding: 12px 18px; background: var(--surface-2); white-space: nowrap; border-bottom: 1px solid var(--line); }
.tbl td { padding: 14px 18px; border-top: 1px solid var(--line); vertical-align: middle; }
.tbl tbody tr:first-child td { border-top: 0; }
.tbl tbody tr[data-open] { cursor: pointer; }
.tbl tbody tr:hover td { background: var(--surface-2); }
.tbl select, .tbl input { background: var(--field); border: 0; border-radius: 10px; padding: 6px 10px; min-height: 36px; max-width: 180px; }

/* نماذج */
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 16px; }
.span2 { grid-column: 1 / -1; }
.field { display: grid; gap: 6px; min-width: 0; }
.field > span:first-child { font-size: 13px; color: var(--muted); font-weight: 500; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.field input, .field select, .field textarea { width: 100%; border: 1px solid transparent; background: var(--field); border-radius: 12px; padding: 10px 14px; min-height: 46px; color: var(--ink); transition: border-color .15s, box-shadow .15s, background .15s; }
.field textarea { resize: vertical; }
.field input:focus, .field select:focus, .field textarea:focus { outline: none; background: #fff; border-color: var(--leaf); box-shadow: 0 0 0 4px rgba(52, 199, 89, .2); }
.field.needs input, .field.needs select { border-color: rgba(255, 59, 48, .5); background: #fff8f7; }
.field .hint { font-size: 12px; color: var(--warn); }
.field .hint.muted { color: var(--dim); }
.req { color: var(--bad); font-style: normal; }
.conf { font-size: 10.5px; font-weight: 600; padding: 1px 8px; border-radius: 6px; }
.conf.tone-ok { background: var(--ok-bg); color: var(--ok); } .conf.tone-warn { background: var(--warn-bg); color: var(--warn); } .conf.tone-bad { background: var(--bad-bg); color: var(--bad); }
.check { display: inline-flex; align-items: center; gap: 8px; font-size: 14px; min-height: 40px; cursor: pointer; }
.check input { width: 18px; height: 18px; accent-color: var(--leaf); }

/* رفع */
.stepper { display: flex; gap: 8px; list-style: none; padding: 0; margin: 0; flex-wrap: wrap; }
.stepper li { display: flex; align-items: center; gap: 8px; color: var(--dim); font-size: 14px; }
.stepper li + li::before { content: ""; width: 28px; height: 1.5px; border-radius: 1px; background: var(--fill-hi); }
.stepper span { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; background: var(--fill); font-family: var(--f-num); font-size: 12px; font-weight: 600; }
.stepper li.on { color: var(--ink); font-weight: 500; } .stepper li.on span { background: var(--leaf); color: var(--on-leaf); }
.stepper li.done span { color: var(--leaf-hi); background: var(--leaf-soft); }
.q-title { font-size: 20px; }
.choice-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.choice { text-align: start; padding: 18px 20px; border-radius: 16px; border: 1.5px solid var(--line); background: var(--surface); display: grid; gap: 4px; min-height: 88px; transition: border-color .15s, background .15s, box-shadow .15s; }
.choice:hover { border-color: var(--line-hi); }
.choice b { font-family: var(--f-display); font-weight: 500; font-size: 16px; } .choice span { color: var(--muted); font-size: 13px; }
.choice.on { border-color: var(--leaf); background: rgba(52, 199, 89, .07); box-shadow: 0 0 0 3px rgba(52, 199, 89, .15); }
.dropzone { display: grid; justify-items: center; gap: 6px; text-align: center; padding: 40px 16px; border-radius: 20px; border: 2px dashed var(--leaf-line); background: rgba(52, 199, 89, .05); cursor: pointer; color: var(--leaf); transition: background .15s, border-color .15s; }
.dropzone:hover { background: rgba(52, 199, 89, .09); }
.dropzone svg { width: 36px; height: 36px; }
.dropzone b { font-family: var(--f-display); font-weight: 500; font-size: 17px; color: var(--ink); }
.dropzone span { color: var(--muted); font-size: 13px; }
.dropzone.over { background: rgba(52, 199, 89, .16); border-color: var(--leaf); }
.file-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.file-list li { display: flex; align-items: center; gap: 10px; padding: 9px 14px; background: var(--field); border-radius: 12px; }
.file-list li span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-list small { color: var(--dim); }
.split { border: 1px solid var(--line); border-radius: 14px; padding: 10px 16px; display: grid; gap: 6px; margin: 0; }
.split legend { color: var(--muted); font-size: 13px; padding: 0 6px; }
.split label { display: flex; align-items: center; gap: 8px; min-height: 36px; cursor: pointer; }
.split input { accent-color: var(--leaf); width: 18px; height: 18px; }
.split small { color: var(--dim); }
.reading { display: grid; justify-items: center; gap: 10px; text-align: center; padding: 34px 10px; }
.counter { font-size: 12.5px; color: var(--muted); background: var(--fill); padding: 2px 12px; border-radius: 20px; font-family: var(--f-num); }
.orbit { position: relative; width: 84px; height: 84px; margin: 8px 0; }
.orbit span { position: absolute; inset: 0; border-radius: 50%; border: 3px solid var(--fill); border-top-color: var(--leaf); animation: spin 1.2s linear infinite; }
.orbit span:nth-child(2) { inset: 14px; border-top-color: #007aff; animation-duration: .9s; animation-direction: reverse; }
.orbit span:nth-child(3) { inset: 34px; background: var(--leaf-2); border: 0; animation: pulse 1.4s ease-in-out infinite; }
@keyframes pulse { 50% { transform: scale(.7); opacity: .6; } }
.review-head { display: grid; gap: 4px; }
.review-head .counter { justify-self: start; }
.review-grid { display: grid; grid-template-columns: minmax(0, 300px) minmax(0, 1fr); gap: 22px; align-items: start; }
.pages { display: grid; gap: 10px; position: sticky; top: 80px; }
.page-thumb { position: relative; display: block; border-radius: 14px; overflow: hidden; border: 1px solid var(--line); background: #fff; box-shadow: var(--shadow); }
.page-thumb img { display: block; width: 100%; height: auto; max-height: 420px; object-fit: contain; }
.page-thumb span { position: absolute; top: 8px; right: 8px; background: rgba(29, 29, 31, .72); color: #fff; font-size: 11px; padding: 1px 8px; border-radius: 6px; backdrop-filter: blur(6px); }
#u-form { display: grid; gap: 16px; }
.client-box { border: 1px solid var(--line); border-radius: 16px; padding: 14px 16px; margin: 0; display: grid; gap: 12px; background: var(--surface-2); }
.client-box legend { color: var(--leaf-hi); padding: 0 8px; font-size: 13px; font-weight: 600; }
.client-box a { color: var(--leaf); text-decoration: underline; }
.sticky-actions { position: sticky; bottom: 0; padding: 14px 0 4px; background: linear-gradient(0deg, var(--surface) 72%, rgba(255, 255, 255, 0)); }
.finish { display: grid; justify-items: center; gap: 10px; text-align: center; padding: 24px 0; }
.finish-star { width: 68px; height: 68px; border-radius: 50%; display: grid; place-items: center; background: var(--leaf-2); color: #fff; box-shadow: 0 14px 34px -12px rgba(52, 199, 89, .8); }
.finish-star svg { width: 32px; height: 32px; }
.done-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 4px; }
.done-list a { color: var(--leaf); font-weight: 500; }
.upload-cta { display: flex; align-items: center; gap: 16px; padding: 20px; border-radius: 22px; border: 0; background: linear-gradient(135deg, #e6f7ec, #f3fbf6 60%, #fff); box-shadow: inset 0 0 0 1px rgba(52, 199, 89, .28), var(--shadow); transition: transform .18s; }
.upload-cta:hover { transform: translateY(-2px); }
.cta-icon { width: 54px; height: 54px; border-radius: 16px; display: grid; place-items: center; background: var(--leaf); color: #fff; box-shadow: 0 10px 22px -10px rgba(35, 134, 60, .8); flex: none; }
.upload-cta b { display: block; font-family: var(--f-display); font-weight: 600; font-size: 18px; } .upload-cta small { color: var(--muted); }

/* الدرج */
.drawer-bg { position: fixed; inset: 0; background: rgba(0, 0, 0, .28); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); z-index: 40; animation: fade .2s ease-out; }
@keyframes fade { from { opacity: 0; } }
.drawer { position: fixed; top: 0; bottom: 0; left: 0; width: min(540px, 100%); z-index: 41; overflow-y: auto; background: var(--surface); box-shadow: var(--shadow-lg); padding-top: calc(20px + env(safe-area-inset-top, 0px)); padding-bottom: calc(26px + env(safe-area-inset-bottom, 0px)); padding-right: 24px; padding-left: max(24px, env(safe-area-inset-left, 0px)); animation: slide .26s cubic-bezier(.2, .8, .2, 1); }
.drawer.wide { width: min(780px, 100%); }
@keyframes slide { from { transform: translateX(-28px); opacity: 0; } }
.drawer-x { position: absolute; top: calc(14px + env(safe-area-inset-top, 0px)); left: max(14px, env(safe-area-inset-left, 0px)); }
.drawer-body { display: grid; grid-template-columns: minmax(0, 1fr); gap: 20px; }
.d-head { display: grid; gap: 4px; padding-left: 56px; }
.d-head h2 { font-size: 24px; }
.d-pills { display: flex; gap: 6px; flex-wrap: wrap; }
.d-grid { display: grid; grid-template-columns: minmax(0, 200px) minmax(0, 1fr); gap: 18px; align-items: start; }
.d-files { display: grid; gap: 8px; }
.file-thumb { display: block; border-radius: 12px; overflow: hidden; border: 1px solid var(--line); background: #fff; box-shadow: var(--shadow); }
.file-thumb img { display: block; width: 100%; height: auto; }
.file-thumb.doc-file { display: grid; place-items: center; gap: 6px; padding: 22px 10px; background: var(--field); color: var(--muted); font-size: 12px; text-align: center; word-break: break-all; box-shadow: none; }
.dl { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 10px 18px; margin: 0; font-size: 14px; align-items: baseline; }
.dl dt { color: var(--muted); font-size: 13px; } .dl dd { margin: 0; }
.sec { font-size: 14px; color: var(--muted); font-weight: 500; margin-bottom: 8px; }
.timeline { list-style: none; margin: 0; padding: 0 18px 0 0; border-right: 2px solid var(--fill); display: grid; gap: 12px; font-size: 14px; }
.timeline li { position: relative; display: flex; gap: 8px; flex-wrap: wrap; align-items: baseline; }
.timeline li::before { content: ""; position: absolute; right: -24px; top: 8px; width: 10px; height: 10px; border-radius: 50%; background: var(--leaf-2); box-shadow: 0 0 0 3px var(--surface); }
.timeline time { margin-inline-start: auto; }

/* ورقة (تأكيد/قائمة) */
.sheet-root .drawer-bg { z-index: 50; }
.sheet { position: fixed; z-index: 51; left: 50%; top: 50%; transform: translate(-50%, -50%); width: min(420px, calc(100% - 32px)); border-radius: 24px; padding: 24px; display: grid; gap: 14px; background: rgba(255, 255, 255, .92); backdrop-filter: blur(30px) saturate(180%); -webkit-backdrop-filter: blur(30px) saturate(180%); border: 1px solid var(--line); box-shadow: var(--shadow-lg); animation: pop .22s cubic-bezier(.2, .9, .3, 1.1); }
@keyframes pop { from { opacity: 0; transform: translate(-50%, -48%) scale(.96); } }
.sheet.menu { top: auto; bottom: calc(12px + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%); gap: 2px; padding: 10px; animation: rise .26s cubic-bezier(.2, .8, .2, 1); }
@keyframes rise { from { opacity: 0; transform: translate(-50%, 24px); } }
.sheet.menu a, .sheet.menu button { display: flex; align-items: center; gap: 12px; padding: 12px; border-radius: 12px; min-height: 48px; background: none; border: 0; text-align: start; width: 100%; font-weight: 450; }
.sheet.menu a:hover, .sheet.menu button:hover { background: var(--fill); }
.sheet.menu .me { margin: 0 0 6px; background: var(--field); border: 0; }

/* الدخول */
.center-screen { min-height: 100vh; display: grid; place-items: center; padding-block: 24px; padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); }
.login { width: min(440px, 100%); border-radius: 30px; padding: 36px 28px 30px; display: grid; gap: 14px; justify-items: stretch; text-align: center; box-shadow: 0 2px 4px rgba(0, 0, 0, .04), 0 40px 90px -40px rgba(0, 0, 0, .3); }
.login-logo { width: 72px; justify-self: center; margin-bottom: 4px; }
.login h1 { font-size: 28px; }
.login form { text-align: start; }
.who { display: grid; gap: 10px; }
.who-btn { display: grid; gap: 2px; text-align: start; padding: 14px 18px; border-radius: 16px; border: 1.5px solid var(--line); background: var(--surface); min-height: 60px; transition: border-color .15s, background .15s, transform .1s; }
.who-btn:hover { border-color: var(--leaf); background: rgba(52, 199, 89, .06); }
.who-btn:active { transform: scale(.99); }
.who-btn b { font-weight: 600; } .who-btn span { color: var(--muted); font-size: 13px; }

.how ol { margin: 0; padding-inline-start: 20px; display: grid; gap: 6px; color: var(--muted); }
.how b { color: var(--ink); }

/* إشعار مؤقت */
#toast { position: fixed; z-index: 60; bottom: calc(26px + env(safe-area-inset-bottom, 0px)); left: 50%; transform: translateX(-50%); max-width: calc(100% - 32px); padding: 12px 20px; border-radius: 16px; background: rgba(29, 29, 31, .92); color: #fff; backdrop-filter: blur(16px); box-shadow: 0 14px 40px -10px rgba(0, 0, 0, .4); font-size: 14px; }
#toast.tone-ok { background: rgba(24, 110, 48, .96); } #toast.tone-bad { background: rgba(190, 36, 28, .96); } #toast.tone-warn { background: rgba(150, 90, 0, .96); }

/* ---------- المهام والتواصل ---------- */
[hidden] { display: none !important; }
.queue li.static { cursor: default; } .queue li.static:hover { background: none; }
.sel { border: 0; background: var(--field); border-radius: 12px; padding: 0 14px; min-height: 42px; max-width: 200px; }
.nav-badge { margin-inline-start: auto; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px; background: var(--leaf); color: #fff; font-size: 11px; font-weight: 600; font-style: normal; display: grid; place-items: center; line-height: 1; }
.nav-badge.alert { background: #ff3b30; }
.tabbar a { position: relative; }
.tabbar .nav-badge { position: absolute; top: 4px; right: calc(50% - 22px); margin: 0; min-width: 18px; height: 18px; border: 2px solid var(--bg); box-sizing: content-box; }
.who-btn.off { opacity: .55; cursor: not-allowed; }
.task-row .pill svg, .pill svg { width: 13px; height: 13px; }
#done-box { box-shadow: none; background: var(--surface-2); }
.d-files { grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); }
.d-files .doc-file svg { width: 26px; height: 26px; }

/* ---------- الشاشات الصغيرة ---------- */
@media (max-width: 1080px) { .cols { grid-template-columns: 1fr; } .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 860px) {
  .app { grid-template-columns: 1fr; }
  .side { display: none; }
  .mobile-only { display: inline-flex !important; }
  .brand.mobile-only img { width: 30px; }
  .brand.mobile-only b { font-size: 15px; white-space: nowrap; }
  .brand.mobile-only { padding: 0; gap: 8px; min-width: 0; }
  .topbar { gap: 8px; }
  .topbar { padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); background: var(--frost); backdrop-filter: blur(24px) saturate(180%); -webkit-backdrop-filter: blur(24px) saturate(180%); border-bottom: 1px solid var(--line); }
  #view { padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); padding-block: 16px calc(112px + env(safe-area-inset-bottom, 0px)); gap: 18px; }
  .tabbar { display: grid; grid-template-columns: repeat(5, 1fr); position: fixed; z-index: 25; bottom: 0; left: 0; right: 0; padding-bottom: env(safe-area-inset-bottom, 0px); padding-left: env(safe-area-inset-left, 0px); padding-right: env(safe-area-inset-right, 0px); background: var(--frost); backdrop-filter: blur(24px) saturate(180%); -webkit-backdrop-filter: blur(24px) saturate(180%); border-top: 1px solid var(--line); }
  .tabbar a { display: grid; justify-items: center; gap: 2px; padding: 8px 2px; min-height: 58px; font-size: 11px; font-weight: 500; color: var(--dim); }
  .tabbar a.active { color: var(--leaf); }
  .tabbar a.tab-cta { color: var(--leaf-hi); }
  .tabbar a.tab-cta svg { width: 24px; height: 24px; padding: 11px; box-sizing: content-box; border-radius: 50%; background: var(--leaf); color: #fff; margin-top: -24px; box-shadow: 0 0 0 4px var(--bg), 0 12px 22px -8px rgba(35, 134, 60, .75); }
  .demo-chip { font-size: 11.5px; padding: 4px 10px; min-height: 32px; }
  .review-grid, .d-grid { grid-template-columns: 1fr; }
  .pages { position: static; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); }
  .page-thumb img { max-height: 200px; }
  .d-files { grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); }
  .sticky-actions { bottom: calc(58px + env(safe-area-inset-bottom, 0px)); }
}
@media (max-width: 640px) {
  .stats { gap: 12px; } .stat { padding: 14px 16px; } .stat b { font-size: 28px; }
  .form-grid, .choice-row { grid-template-columns: 1fr; }
  .toolbar { padding: 10px; } .search { width: 100%; }
  .chips { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; margin: 0 -2px; padding-bottom: 2px; }
  .chip { flex: none; }
  .panel.pad { padding: 18px; }
  /* الجداول تبقى كروت */
  .tbl thead { display: none; }
  .tbl, .tbl tbody, .tbl tr, .tbl td { display: block; width: 100%; }
  .tbl tr { padding: 14px 16px; border-top: 1px solid var(--line); display: grid; grid-template-columns: 1fr 1fr; gap: 8px 12px; }
  .tbl tbody tr:first-child { border-top: 0; }
  .tbl td { border: 0 !important; padding: 0; background: none !important; }
  .tbl td:first-child { grid-column: 1 / -1; font-size: 15.5px; }
  .tbl td::before { content: attr(data-l); display: block; color: var(--dim); font-size: 11px; }
  .tbl td:first-child::before { display: none; }
  .tbl select, .tbl input { max-width: 100%; width: 100%; }
  .queue li { flex-wrap: wrap; } .q-acts { width: 100%; }
  .d-head { padding-left: 50px; }
  .dl { grid-template-columns: 1fr; gap: 2px; } .dl dd { margin-bottom: 8px; }
  .stepper li + li::before { width: 12px; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }

/* ===== النسخ والتصدير ===== */
.bk-hero { background: linear-gradient(180deg, #fff, #f3faf5); border: 1px solid rgba(35, 134, 60, .18); }
.bk-head { display: flex; gap: 14px; align-items: flex-start; }
.bk-ico { width: 46px; height: 46px; border-radius: 14px; background: rgba(35, 134, 60, .12); color: var(--leaf); display: grid; place-items: center; flex: none; }
.bk-ico svg { width: 24px; height: 24px; }
.bk-status { gap: 10px; }
.bk-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 12px; }
.bk-card { background: var(--fill); border-radius: 14px; padding: 14px 16px; display: grid; gap: 6px; align-content: start; }
.bk-card .btn { min-height: 38px; }
.field.inline { display: inline-flex; flex-direction: row; align-items: center; gap: 8px; }
.field.inline select { min-height: 38px; }
.bk-prog { display: grid; gap: 6px; }
.bk-track { height: 8px; border-radius: 6px; background: var(--fill); overflow: hidden; }
.bk-track i { display: block; height: 100%; width: 0; background: var(--leaf); transition: width .2s; }
.vfy { display: flex; gap: 10px; align-items: center; padding: 10px 14px; border-radius: 12px; margin-block: 6px; }
.vfy.ok { background: rgba(35, 134, 60, .1); color: #1c6b30; } .vfy.bad { background: rgba(255, 59, 48, .1); color: #c3241b; }
.checks { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.checks li { display: flex; gap: 8px; align-items: center; font-size: 13.5px; }
.checks li svg { width: 16px; height: 16px; flex: none; } .checks li.ok svg { color: var(--leaf); } .checks li.bad svg { color: #ff3b30; }
.pad-s { padding: 4px 0; }


/* ---------- تنسيق: منع تداخل النصوص ---------- */
h1, h2, h3, h4 { line-height: 1.55; letter-spacing: 0; overflow-wrap: anywhere; }
h1 + p, h1 + .muted, h2 + p, .page-head p, .hero p { margin-top: 8px; line-height: 1.8; }
.page-head, .hero { align-items: flex-start; row-gap: 16px; padding-bottom: 6px; }
.page-head > *, .hero > * { min-width: 0; }
.page-head h1, .hero h1 { margin-bottom: 4px; }
p, label, span, small, b, .small, .muted { overflow-wrap: anywhere; }
.card, .panel, .field, .stat, .item { min-width: 0; }
.field > span { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; line-height: 1.6; margin-bottom: 6px; }
.field input, .field select, .field textarea { line-height: 1.6; }
.field textarea { min-height: 84px; }
.steps, .stepper { gap: 10px; row-gap: 12px; flex-wrap: wrap; }
.steps li, .stepper > * { line-height: 1.6; }
.btn { line-height: 1.4; }
.pill { line-height: 1.7; }
.stat b { line-height: 1.3; }
@media (max-width: 720px) {
  h1 { font-size: 26px; }
  .page-head, .hero { flex-direction: column; align-items: stretch; }
  .page-head .btn, .hero .btn { width: 100%; }
}
.topbar .brand { flex-shrink: 0; position: static; }
.topbar .demo-chip { min-width: 0; max-width: 100%; overflow: hidden; text-overflow: ellipsis; flex-shrink: 1; }
.topbar .grow { min-width: 0; }
@media (max-width: 720px) { .topbar .demo-chip { max-width: 34vw; } }

/* ---------- الفريق: إضافة مستخدم ---------- */
.invite-form { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 16px; margin-top: 14px; }
.invite-form .invite-actions { grid-column: 1 / -1; display: flex; }
.creds-text { white-space: pre-wrap; word-break: break-word; background: var(--fill); border-radius: 12px; padding: 14px 16px; margin: 12px 0; text-align: left; font-size: 13.5px; line-height: 1.8; }
.row-actions { display: flex; gap: 10px; flex-wrap: wrap; }
@media (max-width: 720px) { .invite-form { grid-template-columns: 1fr; } }

/* ---------- المطوّر + حذف ---------- */
.dev-credit { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 4px 8px; padding: 10px 8px; margin-top: 8px; font-size: 12px; line-height: 1.7; color: var(--dim); text-align: center; border-top: 1px solid var(--line); }
.dev-credit b { color: var(--muted); font-weight: 600; }
.dev-credit a { color: var(--leaf); }
.login .dev-credit { margin-top: 18px; }
.head-actions { display: inline-flex; gap: 6px; flex-wrap: wrap; }
.danger-text { color: var(--bad); }
.name-in { width: 100%; min-width: 140px; border: 0; background: transparent; font-weight: 600; font-size: 15px; padding: 6px 8px; border-radius: 8px; }
.name-in:hover, .name-in:focus { background: var(--fill); outline: none; }

/* ---------- المساعدة والخطوات الإرشادية ---------- */
.help-fab { position: fixed; left: 18px; bottom: 18px; z-index: 30; width: 46px; height: 46px; border-radius: 50%; border: 0; background: var(--leaf); color: #fff; font-size: 22px; font-weight: 600; line-height: 1; box-shadow: 0 8px 22px -8px rgba(35, 134, 60, .7); display: grid; place-items: center; }
.help-fab[hidden] { display: none; }
.help-fab.pulse { animation: helpPulse 1.8s ease-out infinite; }
@keyframes helpPulse { 0% { box-shadow: 0 0 0 0 rgba(52, 199, 89, .55), 0 8px 22px -8px rgba(35, 134, 60, .7); } 100% { box-shadow: 0 0 0 16px rgba(52, 199, 89, 0), 0 8px 22px -8px rgba(35, 134, 60, .7); } }
@media (max-width: 720px) { .help-fab { bottom: calc(86px + env(safe-area-inset-bottom, 0px)); left: 14px; width: 42px; height: 42px; } }
.sheet.guide { width: min(460px, calc(100% - 32px)); max-height: calc(100% - 48px); overflow: auto; }
.guide-steps { margin: 0; padding: 0; list-style: none; counter-reset: g; display: grid; gap: 12px; }
.guide-steps li { counter-increment: g; display: grid; grid-template-columns: 28px 1fr; gap: 4px 12px; align-items: start; line-height: 1.8; }
.guide-steps li::before { content: counter(g); grid-row: 1 / span 2; width: 28px; height: 28px; border-radius: 50%; background: var(--leaf-soft); color: var(--leaf); font-weight: 600; font-size: 13px; display: grid; place-items: center; font-family: var(--f-num); }
.guide-steps li b { font-weight: 600; }
.guide-steps li span { color: var(--muted); grid-column: 2; }
.guide-steps li:not(:has(b)) span { color: var(--ink); grid-row: 1; }
