/* ============================================================
   Campus Hub — كراسة هندسة: ورق مربعات، حبر كحلي، وقلم فسفوري
   ============================================================ */
:root {
  --paper: #F3F5F8;
  --sheet: #FFFFFF;
  --sheet-2: #F8FAFC;
  --ink: #1B2A49;
  --ink-2: #4E5A73;
  --ink-3: #7C879C;
  --line: #DCE2EA;
  --grid: rgba(27, 42, 73, .055);
  --hl: #FFE14D;
  --hl-soft: #FFF4B8;
  --hl-mark: #FFE14D;
  --on-ink: #FFFFFF;
  --teal: #0E7A72;
  --teal-soft: #DDF2EF;
  --red: #C33F37;
  --red-soft: #FBE5E3;
  --amber: #A86A12;
  --amber-soft: #FBF0DC;
  --shadow: none;
  --r-sheet: 14px;
  --r-ctl: 10px;
  --nav-h: 64px;
  --font: 'IBM Plex Sans Arabic', system-ui, -apple-system, 'Segoe UI', sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #0E1421; --sheet: #161F31; --sheet-2: #1B2539; --ink: #E8EDF6; --ink-2: #A6B1C6; --ink-3: #75819A;
    --line: #283349; --grid: rgba(232, 237, 246, .035); --hl: #F2D33C; --hl-soft: #3A3417; --hl-mark: rgba(242, 211, 60, .34); --on-ink: #0E1421;
    --teal: #46C3B5; --teal-soft: #15302F; --red: #F0766C; --red-soft: #3A1E1F; --amber: #E7B05A; --amber-soft: #352A17;
    --shadow: none;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --paper: #0E1421; --sheet: #161F31; --sheet-2: #1B2539; --ink: #E8EDF6; --ink-2: #A6B1C6; --ink-3: #75819A;
  --line: #283349; --grid: rgba(232, 237, 246, .035); --hl: #F2D33C; --hl-soft: #3A3417; --hl-mark: rgba(242, 211, 60, .34); --on-ink: #0E1421;
  --teal: #46C3B5; --teal-soft: #15302F; --red: #F0766C; --red-soft: #3A1E1F; --amber: #E7B05A; --amber-soft: #352A17;
  --shadow: none;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; font-family: var(--font); font-size: 16px; line-height: 1.55; color: var(--ink);
  background-color: var(--paper);
  min-height: 100dvh;
  -webkit-tap-highlight-color: transparent;
}
h1, h2, h3, h4 { margin: 0; line-height: 1.25; font-weight: 700; }
h1 { font-size: 1.75rem; } h2 { font-size: 1.3rem; } h3 { font-size: 1.08rem; }
p { margin: 0; }
a { color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2.5px solid var(--ink); outline-offset: 2px; border-radius: 6px; }
.ic { width: 22px; height: 22px; flex: none; }
.muted { color: var(--ink-2); }
.small { font-size: .875rem; }
.tiny { font-size: .78rem; color: var(--ink-3); }
.ltr { direction: ltr; unicode-bidi: isolate; }
.num { font-variant-numeric: tabular-nums; }
.hidden { display: none !important; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* القلم الفسفوري — العنصر المميز في التصميم */
.hl {
  background: linear-gradient(176deg, transparent 52%, var(--hl-mark) 52%, var(--hl-mark) 88%, transparent 88%);
  padding-inline: .12em; -webkit-box-decoration-break: clone; box-decoration-break: clone;
}

/* ---------------- الهيكل ---------------- */
.shell { display: grid; grid-template-columns: 1fr; min-height: 100dvh; }
.side { display: none; }
.main { min-width: 0; padding-bottom: calc(var(--nav-h) + 24px + env(safe-area-inset-bottom)); }
.topbar {
  position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 10px;
  padding: calc(10px + env(safe-area-inset-top)) 16px 10px; background: color-mix(in srgb, var(--paper) 88%, transparent);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); border-bottom: 1px solid var(--line);
}
.topbar h1 { font-size: 1.15rem; flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.view { max-width: 980px; margin: 0 auto; padding: 20px 16px; }
.demo-bar { background: var(--amber-soft); color: var(--amber); font-size: .74rem; text-align: center; padding: 4px 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.bottom-nav {
  position: fixed; inset-inline: 0; bottom: 0; z-index: 30; display: grid; grid-template-columns: repeat(5, 1fr);
  height: calc(var(--nav-h) + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom);
  background: var(--sheet); border-top: 1px solid var(--line);
}
.bottom-nav a { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; font-size: .72rem; text-decoration: none; color: var(--ink-3); position: relative; }
.bottom-nav a.on { color: var(--ink); font-weight: 600; }
.bottom-nav a.on .ic { stroke-width: 2.2; }
.bottom-nav a.on span { background: linear-gradient(transparent 55%, var(--hl-mark) 55%, var(--hl-mark) 92%, transparent 92%); padding-inline: 3px; }
.badge { min-width: 18px; height: 18px; border-radius: 9px; background: var(--red); color: #fff; font-size: .7rem; font-weight: 700; display: inline-grid; place-items: center; padding: 0 5px; line-height: 1; }
.bottom-nav .badge { position: absolute; top: 8px; inset-inline-start: calc(50% + 6px); }

@media (min-width: 900px) {
  .shell { grid-template-columns: 248px 1fr; }
  .side {
    display: flex; flex-direction: column; position: sticky; top: 0; height: 100dvh; padding: 22px 14px;
    background: var(--sheet); border-inline-end: 1px solid var(--line);
  }
  .bottom-nav { display: none; }
  .main { padding-bottom: 32px; }
  .topbar { padding: 14px 28px; }
  .view { padding: 28px; }
}
.brand { display: flex; align-items: center; gap: 10px; padding: 0 8px 18px; text-decoration: none; }
.brand img { width: 36px; height: 36px; border-radius: 9px; }
.brand b { font-size: 1.2rem; }
.side nav { display: flex; flex-direction: column; gap: 2px; flex: 1; overflow-y: auto; }
.side nav a, .side nav button {
  display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: var(--r-ctl); text-decoration: none;
  color: var(--ink-2); font-weight: 500; background: none; border: 0; cursor: pointer; text-align: start; width: 100%;
}
.side nav a:hover, .side nav button:hover { background: var(--sheet-2); color: var(--ink); }
.side nav a.on { color: var(--ink); font-weight: 700; background: var(--sheet-2); }
.side nav a.on span:first-of-type { background: linear-gradient(transparent 55%, var(--hl-mark) 55%, var(--hl-mark) 92%, transparent 92%); padding-inline: 3px; }
.side nav .badge { margin-inline-start: auto; }
.side .sep { height: 1px; background: var(--line); margin: 10px 8px; }
.side .me { display: flex; align-items: center; gap: 10px; padding: 12px 8px 0; border-top: 1px solid var(--line); text-decoration: none; }
.side .me div { min-width: 0; }
.side .me b, .side .me small { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.side .me small { color: var(--ink-3); font-size: .78rem; }

.credit { text-align: center; font-size: .78rem; color: var(--ink-3); padding: 28px 16px 8px; }
.credit a { color: var(--ink-2); font-weight: 600; text-decoration: none; border-bottom: 1px solid var(--line); }

/* ---------------- الأزرار والحقول ---------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 0 18px;
  border-radius: var(--r-ctl); border: 1px solid var(--line); background: var(--sheet); color: var(--ink);
  font-weight: 600; cursor: pointer; text-decoration: none; white-space: nowrap; transition: background .15s, transform .1s;
}
.btn:hover { background: var(--sheet-2); }
.btn:active { transform: scale(.98); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn.primary { background: var(--ink); color: var(--on-ink); border-color: var(--ink); }
.btn.primary:hover { background: color-mix(in srgb, var(--ink) 88%, var(--paper)); }
.btn.marker { background: var(--hl); color: #1B2A49; border-color: var(--hl); }
.btn.marker:hover { filter: brightness(.96); }
.btn.danger { background: var(--red); color: #fff; border-color: var(--red); }
.btn.ghost { background: none; border-color: transparent; }
.btn.ghost:hover { background: var(--sheet-2); }
.btn.sm { min-height: 36px; padding: 0 12px; font-size: .88rem; }
.btn.block { width: 100%; }
.icon-btn { width: 40px; height: 40px; display: inline-grid; place-items: center; border-radius: var(--r-ctl); border: 0; background: none; cursor: pointer; color: var(--ink-2); flex: none; }
.icon-btn:hover { background: var(--sheet-2); color: var(--ink); }
.icon-btn.danger:hover { color: var(--red); }

.field { display: flex; flex-direction: column; gap: 6px; }
.field > span { font-size: .88rem; font-weight: 600; color: var(--ink-2); }
.field small { color: var(--ink-3); font-size: .8rem; }
.input, .field input, .field select, .field textarea, select.input {
  width: 100%; min-height: 46px; padding: 10px 14px; border: 1px solid var(--line); border-radius: var(--r-ctl);
  background: var(--sheet); outline: none; transition: border-color .15s, box-shadow .15s;
}
.field textarea { min-height: 90px; resize: vertical; }
.input:focus, .field input:focus, .field select:focus, .field textarea:focus { border-color: var(--ink); box-shadow: 0 0 0 3px color-mix(in srgb, var(--hl-mark) 55%, transparent); }
.pw { position: relative; }
.pw input { padding-inline-end: 48px; }
.pw-toggle { position: absolute; inset-inline-end: 4px; top: 50%; transform: translateY(-50%); width: 40px; height: 40px; border: 0; background: none; color: var(--ink-3); cursor: pointer; display: grid; place-items: center; }
.check { display: flex; align-items: center; gap: 10px; cursor: pointer; font-weight: 500; }
.check input { width: 20px; height: 20px; accent-color: var(--ink); }
.form { display: flex; flex-direction: column; gap: 16px; }
.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.row > .grow { flex: 1; min-width: 0; }
.grid-2 { display: grid; grid-template-columns: 1fr; gap: 16px; }
@media (min-width: 700px) { .grid-2 { grid-template-columns: 1fr 1fr; } }
.form-error { background: var(--red-soft); color: var(--red); padding: 10px 14px; border-radius: var(--r-ctl); font-size: .9rem; }

.chips { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex: none; border: 1px solid var(--line); background: var(--sheet); border-radius: 999px; padding: 7px 14px; cursor: pointer;
  font-size: .88rem; font-weight: 500; color: var(--ink-2); white-space: nowrap;
}
.chip.on { background: var(--ink); color: var(--on-ink); border-color: var(--ink); }
.chip-check { display: inline-flex; position: relative; }
.chip-check input { position: absolute; opacity: 0; inset: 0; width: 100%; height: 100%; margin: 0; pointer-events: none; }
.chip-check span { border: 1px solid var(--line); border-radius: 999px; padding: 7px 14px; cursor: pointer; font-size: .88rem; background: var(--sheet); }
.chip-check input:checked + span { background: var(--ink); color: var(--on-ink); border-color: var(--ink); }
.chip-check input:focus-visible + span { outline: 2.5px solid var(--ink); outline-offset: 2px; }

.seg { display: inline-flex; background: var(--sheet-2); border: 1px solid var(--line); border-radius: var(--r-ctl); padding: 3px; gap: 2px; }
.seg button { border: 0; background: none; padding: 7px 14px; border-radius: 8px; cursor: pointer; font-weight: 600; color: var(--ink-2); font-size: .9rem; }
.seg button.on { background: var(--sheet); color: var(--ink); box-shadow: var(--shadow); }

/* ---------------- الأوراق والقوائم ---------------- */
.sheet { background: var(--sheet); border: 1px solid var(--line); border-radius: var(--r-sheet); box-shadow: var(--shadow); }
.sheet.pad { padding: 18px; }
.section { display: flex; flex-direction: column; gap: 14px; margin-bottom: 30px; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.section-head h2 { font-size: 1.12rem; }
.section-head a { font-size: .88rem; font-weight: 600; color: var(--ink-2); text-decoration: none; }
.list { display: flex; flex-direction: column; }
.list > .item { display: flex; align-items: center; gap: 12px; padding: 14px 16px; border-top: 1px solid var(--line); min-width: 0; }
.list > .item:first-child { border-top: 0; }
.item .body { flex: 1; min-width: 0; }
.item .body b { display: block; overflow: hidden; text-overflow: ellipsis; }
.item .body .meta { font-size: .82rem; color: var(--ink-3); }
a.item { text-decoration: none; }
a.item:hover { background: var(--sheet-2); }
.tag { display: inline-flex; align-items: center; gap: 4px; padding: 2px 9px; border-radius: 999px; font-size: .75rem; font-weight: 600; background: var(--sheet-2); color: var(--ink-2); border: 1px solid var(--line); white-space: nowrap; }
.tag.ok { background: var(--teal-soft); color: var(--teal); border-color: transparent; }
.tag.warn { background: var(--amber-soft); color: var(--amber); border-color: transparent; }
.tag.bad { background: var(--red-soft); color: var(--red); border-color: transparent; }
.tag.mark { background: var(--hl); color: #1B2A49; border-color: transparent; }
.live-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--teal); box-shadow: 0 0 0 0 var(--teal); animation: pulse 1.8s infinite; flex: none; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--teal) 60%, transparent); } 70% { box-shadow: 0 0 0 9px transparent; } 100% { box-shadow: 0 0 0 0 transparent; } }

.avatar { border-radius: 50%; object-fit: cover; display: inline-grid; place-items: center; flex: none; font-weight: 700; background: hsl(var(--h, 220) 45% 88%); color: hsl(var(--h, 220) 45% 28%); }
:root[data-theme="dark"] .avatar:not(img) { background: hsl(var(--h, 220) 30% 26%); color: hsl(var(--h, 220) 60% 85%); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .avatar:not(img) { background: hsl(var(--h, 220) 30% 26%); color: hsl(var(--h, 220) 60% 85%); } }

.empty { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 6px; padding: 34px 20px; color: var(--ink-2); }
.empty .ic { width: 34px; height: 34px; color: var(--ink-3); margin-bottom: 4px; }
.empty p { font-size: .9rem; max-width: 36ch; }
.loading { display: flex; justify-content: center; gap: 6px; padding: 40px; }
.loading span { width: 8px; height: 8px; border-radius: 50%; background: var(--ink-3); animation: dots 1s infinite ease-in-out; }
.loading span:nth-child(2) { animation-delay: .15s; } .loading span:nth-child(3) { animation-delay: .3s; }
@keyframes dots { 0%, 80%, 100% { opacity: .25; transform: scale(.8); } 40% { opacity: 1; transform: scale(1); } }

.notice { display: flex; gap: 12px; align-items: flex-start; padding: 14px 16px; border-radius: var(--r-sheet); background: var(--hl-soft); border: 1px solid color-mix(in srgb, var(--hl-mark) 70%, var(--line)); }
.notice.bad { background: var(--red-soft); border-color: transparent; color: var(--red); }
.notice .ic { margin-top: 2px; }

.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); overflow-x: auto; scrollbar-width: none; margin-bottom: 18px; }
.tabs button { border: 0; background: none; padding: 10px 14px; cursor: pointer; font-weight: 600; color: var(--ink-3); border-bottom: 2.5px solid transparent; white-space: nowrap; margin-bottom: -1px; }
.tabs button.on { color: var(--ink); border-bottom-color: var(--ink); }

table.tbl { width: 100%; border-collapse: collapse; font-size: .92rem; }
.tbl th, .tbl td { padding: 10px 12px; text-align: start; border-top: 1px solid var(--line); vertical-align: middle; }
.tbl th { font-size: .8rem; color: var(--ink-3); font-weight: 600; border-top: 0; }
.tbl-wrap { overflow-x: auto; }

/* ---------------- النوافذ والتنبيهات ---------------- */
.modal-back { position: fixed; inset: 0; z-index: 100; background: rgba(14, 20, 33, .48); display: flex; align-items: flex-end; justify-content: center; animation: fade .18s; }
.modal-back.out { animation: fade .18s reverse forwards; }
.modal { background: var(--sheet); width: 100%; max-height: 92dvh; display: flex; flex-direction: column; border-radius: 18px 18px 0 0; animation: rise .22s ease-out; padding-bottom: env(safe-area-inset-bottom); }
.modal.wide { max-width: 900px; }
@media (min-width: 640px) { .modal-back { align-items: center; padding: 20px; } .modal { max-width: 520px; border-radius: 18px; } }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 14px 8px 18px; gap: 10px; }
[dir="rtl"] .modal-head { padding: 14px 18px 8px 14px; }
.modal-body { padding: 8px 18px 18px; overflow-y: auto; }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; padding: 12px 18px 18px; border-top: 1px solid var(--line); }
@keyframes fade { from { opacity: 0; } }
@keyframes rise { from { transform: translateY(24px); opacity: 0; } }

#toasts { position: fixed; z-index: 200; inset-inline: 0; bottom: calc(var(--nav-h) + 16px + env(safe-area-inset-bottom)); display: flex; flex-direction: column; align-items: center; gap: 8px; pointer-events: none; padding: 0 16px; }
@media (min-width: 900px) { #toasts { bottom: 24px; } }
.toast { background: var(--ink); color: var(--on-ink); padding: 11px 18px; border-radius: 12px; font-weight: 500; font-size: .92rem; box-shadow: var(--shadow); animation: rise .2s; max-width: 440px; }
.toast.bad { background: var(--red); color: #fff; }
.toast.out { opacity: 0; transition: opacity .3s; }

/* ---------------- صفحة الدخول ---------------- */
.auth { min-height: 100dvh; display: grid; grid-template-columns: 1fr; }
.auth-hero { padding: 36px 24px 8px; display: flex; flex-direction: column; gap: 14px; }
.auth-hero .brand { padding: 0; }
.auth-hero h1 { font-size: clamp(1.9rem, 6vw, 3rem); line-height: 1.2; max-width: 14ch; }
.auth-hero p { color: var(--ink-2); max-width: 42ch; }
.auth-feats { display: none; }
.auth-card { padding: 16px 24px 40px; }
.auth-card .sheet { padding: 22px; max-width: 460px; margin: 0 auto; }
@media (min-width: 960px) {
  .auth { grid-template-columns: 1.1fr 1fr; align-items: center; }
  .auth-hero { padding: 60px 64px; gap: 22px; }
  .auth-feats { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 26px; margin-top: 12px; color: var(--ink-2); }
  .auth-feats div { display: flex; gap: 10px; align-items: center; }
  .auth-card { padding: 40px; }
}

/* ---------------- الرئيسية ---------------- */
.hello { display: flex; flex-direction: column; gap: 4px; margin-bottom: 22px; }
.hello h2 { font-size: clamp(1.5rem, 4.5vw, 2.1rem); }
.quick { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
@media (min-width: 700px) { .quick { grid-template-columns: repeat(4, 1fr); } }
.quick a, .quick button { display: flex; flex-direction: column; gap: 10px; padding: 16px; border-radius: var(--r-sheet); background: var(--sheet); border: 1px solid var(--line); text-decoration: none; cursor: pointer; text-align: start; font-weight: 600; color: var(--ink); }
.quick a:hover, .quick button:hover { border-color: var(--ink-3); }
.quick small { font-weight: 400; color: var(--ink-3); font-size: .8rem; margin-top: -6px; }
.gpa-strip { display: flex; align-items: center; gap: 18px; padding: 18px 20px; text-decoration: none; }
.gpa-strip .big { font-size: 2.6rem; font-weight: 700; line-height: 1; }
.home-cols { display: grid; gap: 0 26px; }
@media (min-width: 900px) { .home-cols { grid-template-columns: 1.3fr 1fr; } }

/* ---------------- الحضور ---------------- */
.session-card { padding: 18px; display: flex; flex-direction: column; gap: 14px; }
.session-card .top { display: flex; gap: 12px; align-items: flex-start; }
.code-display { font-size: clamp(3rem, 14vw, 5.5rem); font-weight: 700; letter-spacing: .12em; text-align: center; line-height: 1.1; padding: 8px 0; direction: ltr; }
.att-bar { height: 8px; background: var(--sheet-2); border-radius: 4px; overflow: hidden; border: 1px solid var(--line); }
.att-bar i { display: block; height: 100%; background: var(--teal); border-radius: 4px; }
.att-bar.warn i { background: var(--red); }
.counter { font-size: 2.4rem; font-weight: 700; line-height: 1; }

/* ---------------- GPA ---------------- */
.gpa-row { display: grid; grid-template-columns: 1fr 74px 92px 40px; gap: 8px; align-items: center; }
.gpa-row .input { min-height: 44px; padding: 8px 10px; }
@media (max-width: 560px) {
  .gpa-row { grid-template-columns: 1fr 92px 40px; }
  .gpa-row > :first-child { grid-column: 1 / -1; }
  .gpa-row:not(.gpa-head) { padding-bottom: 12px; border-bottom: 1px dashed var(--line); }
  .gpa-head { display: none; }
}
.gpa-head { font-size: .78rem; color: var(--ink-3); font-weight: 600; }
.gpa-result { display: grid; grid-template-columns: 1fr 1fr; gap: 0; }
.gpa-result > div { padding: 18px; display: flex; flex-direction: column; gap: 6px; }
.gpa-result > div + div { border-inline-start: 1px solid var(--line); }
.gpa-big { font-size: clamp(2.8rem, 10vw, 4rem); font-weight: 700; line-height: 1; }
.gpa-mid { font-size: 2rem; font-weight: 700; line-height: 1; }
.gpa-layout { display: grid; gap: 22px; }
@media (min-width: 900px) { .gpa-layout { grid-template-columns: 1.5fr 1fr; align-items: start; } .gpa-side { position: sticky; top: 90px; } }

/* ---------------- الشات ---------------- */
.chat-page .bottom-nav { display: none; }
.chat-page .main { height: 100dvh; display: flex; flex-direction: column; padding-bottom: 0; }
.chat-page .view { padding: 0; max-width: none; width: 100%; flex: 1; min-height: 0; display: flex; }
.chat-wrap { display: flex; flex-direction: column; flex: 1; min-height: 0; min-width: 0; width: 100%; }
.msgs { flex: 1; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 4px; }
.msg { display: flex; gap: 8px; align-items: flex-end; max-width: min(78%, 560px); }
.msg .bubble { background: var(--sheet); border: 1px solid var(--line); padding: 8px 12px; border-radius: 16px; border-end-start-radius: 4px; position: relative; overflow-wrap: anywhere; }
.msg .who { font-size: .76rem; font-weight: 700; color: var(--ink-2); margin-bottom: 2px; }
.msg .when { font-size: .7rem; color: var(--ink-3); margin-inline-start: 8px; white-space: nowrap; }
.msg.me { align-self: flex-end; flex-direction: row-reverse; }
.msg.me .bubble { background: var(--ink); color: var(--on-ink); border-color: var(--ink); border-radius: 16px; border-end-end-radius: 4px; }
.msg.me .bubble a { color: inherit; }
.msg.me .when { color: color-mix(in srgb, var(--on-ink) 65%, transparent); }
.msg.cont { margin-top: -1px; }
.msg.cont .avatar { visibility: hidden; }
.msg .del { opacity: 0; transition: opacity .15s; width: 30px; height: 30px; }
.msg:hover .del, .msg:focus-within .del { opacity: 1; }
.day-sep { align-self: center; font-size: .75rem; color: var(--ink-3); background: var(--sheet); border: 1px solid var(--line); padding: 3px 12px; border-radius: 999px; margin: 12px 0 6px; }
.composer { display: flex; gap: 8px; padding: 10px 12px calc(10px + env(safe-area-inset-bottom)); border-top: 1px solid var(--line); background: var(--sheet); align-items: flex-end; }
.composer textarea { flex: 1; resize: none; min-height: 44px; max-height: 130px; border: 1px solid var(--line); border-radius: 22px; padding: 10px 16px; background: var(--paper); outline: none; }
.composer textarea:focus { border-color: var(--ink); }
.composer .btn { border-radius: 50%; width: 44px; padding: 0; }
[dir="rtl"] .composer .btn .ic { transform: scaleX(-1); }

/* ---------------- الألعاب ---------------- */
.games { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
@media (min-width: 760px) { .games { grid-template-columns: repeat(4, 1fr); } }
.game-tile { padding: 18px; display: flex; flex-direction: column; gap: 10px; text-decoration: none; min-height: 150px; }
.game-tile .art { font-size: 1.6rem; font-weight: 700; height: 52px; display: flex; align-items: center; letter-spacing: .04em; }
.game-tile:hover { border-color: var(--ink-3); }
.board-xo { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0; width: min(100%, 330px); aspect-ratio: 1; margin: 0 auto; }
.board-xo button { border: 0; background: none; font-size: 3rem; font-weight: 700; cursor: pointer; color: var(--ink); border-color: var(--ink-3); }
.board-xo button:nth-child(-n+6) { border-bottom: 2.5px solid var(--ink-3); }
.board-xo button:not(:nth-child(3n)) { border-inline-end: 2.5px solid var(--ink-3); }
.board-xo button.win { background: var(--hl-soft); }
.board-xo .o { color: var(--teal); }
.board-2048 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; padding: 8px; background: var(--line); border-radius: 12px; width: min(100%, 380px); aspect-ratio: 1; margin: 0 auto; touch-action: none; direction: ltr; }
.board-2048 div { border-radius: 8px; background: var(--sheet-2); display: grid; place-items: center; font-weight: 700; font-size: clamp(1.1rem, 6vw, 1.7rem); }
.board-mem { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; width: min(100%, 400px); margin: 0 auto; }
.board-mem button { aspect-ratio: 1; border-radius: 10px; border: 1px solid var(--line); background: var(--ink); color: transparent; font-size: 1.15rem; font-weight: 700; cursor: pointer; transition: transform .25s, background .25s; direction: ltr; }
.board-mem button.open { background: var(--sheet); color: var(--ink); }
.board-mem button.done { background: var(--hl-soft); color: var(--ink); border-color: var(--hl); }
.quiz-q { font-size: clamp(2.2rem, 9vw, 3.4rem); font-weight: 700; text-align: center; direction: ltr; padding: 16px 0; }
.score-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; }

/* ---------------- المواعيد ---------------- */
.slot { display: grid; grid-template-columns: 78px 1fr auto; gap: 12px; align-items: center; padding: 14px 16px; border-top: 1px solid var(--line); }
.slot:first-child { border-top: 0; }
.slot .time { font-weight: 700; font-size: .92rem; direction: ltr; text-align: start; }
.slot.now { background: var(--hl-soft); }
.deadline { display: flex; gap: 14px; align-items: center; padding: 14px 16px; border-top: 1px solid var(--line); }
.deadline:first-child { border-top: 0; }
.deadline .date { width: 52px; text-align: center; flex: none; line-height: 1.1; }
.deadline .date b { font-size: 1.4rem; display: block; }
.deadline .date small { font-size: .74rem; color: var(--ink-3); }
.deadline.soon .date b { background: linear-gradient(transparent 55%, var(--hl-mark) 55%, var(--hl-mark) 92%, transparent 92%); }

/* ---------------- البروفايل ---------------- */
.profile-head { display: flex; align-items: center; gap: 16px; padding: 20px; }
.photo-btn { position: relative; border: 0; background: none; padding: 0; cursor: pointer; border-radius: 50%; }
.photo-btn .cam { position: absolute; bottom: 0; inset-inline-end: 0; width: 28px; height: 28px; border-radius: 50%; background: var(--ink); color: var(--on-ink); display: grid; place-items: center; border: 2px solid var(--sheet); }
.photo-btn .cam .ic { width: 15px; height: 15px; }

.pdf-frame { width: 100%; height: 72dvh; border: 1px solid var(--line); border-radius: 10px; background: var(--sheet-2); }
.progress { height: 6px; background: var(--sheet-2); border-radius: 3px; overflow: hidden; }
.progress i { display: block; height: 100%; width: 0; background: var(--ink); transition: width .2s; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
.chat-page .credit { display: none; }
[dir="rtl"] #backBtn .ic { transform: scaleX(-1); }
.item.file { flex-wrap: wrap; }
.item.file .body { flex-basis: calc(100% - 40px); }
.item.file .actions { display: flex; align-items: center; gap: 2px; margin-inline-start: auto; }
@media (min-width: 700px) { .item.file { flex-wrap: nowrap; } .item.file .body { flex-basis: auto; } }

/* ---------------- الواجهة البسيطة ---------------- */
.tiles { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.tile { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; aspect-ratio: 1; border-radius: 18px; background: var(--sheet); border: 1px solid var(--line); text-decoration: none; font-weight: 600; font-size: .86rem; color: var(--ink); text-align: center; padding: 6px; }
.tile .ic { width: 28px; height: 28px; }
.tile:hover { border-color: var(--ink-3); }
.tile .badge { position: absolute; top: 8px; inset-inline-end: 8px; }
@media (min-width: 700px) { .tiles { gap: 14px; } .tile { aspect-ratio: auto; min-height: 110px; } }
.seg button.on { box-shadow: 0 1px 2px rgba(0,0,0,.12); }
.modal { box-shadow: 0 10px 40px rgba(0,0,0,.25); }

/* ---------------- الشات (زي واتساب) ---------------- */
:root { --chat-bg: #ECEFF3; --mine: #DCE8FB; --mine-ink: #1B2A49; }
:root[data-theme="dark"] { --chat-bg: #0A0F19; --mine: #23395F; --mine-ink: #E8EDF6; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --chat-bg: #0A0F19; --mine: #23395F; --mine-ink: #E8EDF6; } }
.chat-row .body > .row { min-width: 0; }
.ellipsis { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.dot { width: 10px; height: 10px; border-radius: 50%; background: var(--teal); flex: none; }
.chat-wrap { position: relative; background: var(--chat-bg); }
.msgs { background: var(--chat-bg); }
.msg .bubble { border: 0; box-shadow: 0 1px 0 rgba(0,0,0,.06); }
.msg.me .bubble { background: var(--mine); color: var(--mine-ink); border: 0; }
.msg.me .bubble a { color: inherit; }
.msg.me .when { color: var(--ink-3); }
.msg { -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; border-radius: 10px; transition: background .12s; }
.msg.sel { background: color-mix(in srgb, var(--hl) 35%, transparent); }
.msg .bubble.media { padding: 4px; }
.msg .bubble.media .when { position: absolute; bottom: 8px; inset-inline-end: 10px; background: rgba(0,0,0,.45); color: #fff; padding: 1px 7px; border-radius: 9px; margin: 0; }
.msg .bubble.media .who { padding: 4px 8px 2px; }
.m-img { display: block; border: 0; padding: 0; background: none; cursor: zoom-in; border-radius: 12px; overflow: hidden; }
.m-img img { display: block; max-width: min(260px, 62vw); max-height: 320px; width: auto; height: auto; object-fit: cover; }
.m-file { display: flex; align-items: center; gap: 10px; text-decoration: none; padding: 8px; border-radius: 10px; background: color-mix(in srgb, var(--ink) 6%, transparent); min-width: 200px; }
.m-file span { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.m-file b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .9rem; }
.m-file small { color: var(--ink-3); font-size: .75rem; }
.m-loc { display: flex; flex-direction: column; text-decoration: none; }
.m-loc > span:last-child { padding: 6px 8px 2px; font-size: .85rem; font-weight: 600; }
.map { position: relative; display: block; width: 260px; max-width: 62vw; height: 150px; border-radius: 10px; background-color: #dfe5ea; background-repeat: no-repeat; overflow: hidden; }
.map .map-pin { position: absolute; left: 50%; top: 50%; width: 34px; height: 34px; transform: translate(-50%, -92%); color: #C33F37; fill: #fff; stroke-width: 2; }
.map small { position: absolute; bottom: 2px; inset-inline-end: 4px; font-size: .6rem; background: rgba(255,255,255,.8); color: #333; padding: 0 4px; border-radius: 4px; }
.m-poll { display: flex; flex-direction: column; gap: 8px; min-width: min(260px, 62vw); }
.m-poll > small { color: var(--ink-3); font-size: .75rem; }
.poll-opt { position: relative; display: flex; align-items: center; gap: 10px; padding: 9px 10px; border: 1px solid var(--line); border-radius: 10px; background: var(--sheet); cursor: pointer; text-align: start; overflow: hidden; color: var(--ink); }
.poll-opt i { position: absolute; inset-block: 0; inset-inline-start: 0; background: color-mix(in srgb, var(--teal) 16%, transparent); z-index: 0; transition: width .3s; }
.poll-opt > * { position: relative; z-index: 1; }
.poll-check { width: 20px; height: 20px; border-radius: 50%; border: 2px solid var(--ink-3); display: grid; place-items: center; flex: none; }
.poll-opt.on .poll-check { background: var(--teal); border-color: var(--teal); color: #fff; }
.poll-check .ic { width: 14px; height: 14px; stroke-width: 3; }
.m-call { display: flex; align-items: center; gap: 10px; min-width: 180px; }
.m-call span { display: flex; flex-direction: column; flex: 1; }
.m-call small { color: var(--ink-3); font-size: .75rem; }
.m-deleted { display: inline-flex; align-items: center; gap: 6px; font-style: italic; color: var(--ink-3); }
.m-deleted .ic { width: 15px; height: 15px; }
.sel-bar { position: absolute; top: 0; inset-inline: 0; z-index: 5; display: flex; align-items: center; gap: 6px; padding: 6px 10px; background: var(--sheet); border-bottom: 1px solid var(--line); }
.meet-banner { display: flex; align-items: center; gap: 10px; padding: 10px 14px; background: var(--teal-soft); color: var(--teal); font-weight: 600; }
.attach-menu { position: absolute; bottom: 70px; inset-inline-start: 10px; z-index: 6; display: grid; grid-template-columns: repeat(5, 1fr); gap: 4px; padding: 10px; background: var(--sheet); border: 1px solid var(--line); border-radius: 16px; box-shadow: 0 8px 30px rgba(0,0,0,.18); animation: rise .15s; }
.attach-menu button { display: flex; flex-direction: column; align-items: center; gap: 6px; border: 0; background: none; padding: 8px 6px; border-radius: 12px; cursor: pointer; font-size: .76rem; font-weight: 600; color: var(--ink); min-width: 58px; }
.attach-menu button .ic { width: 44px; height: 44px; padding: 11px; border-radius: 50%; background: var(--sheet-2); border: 1px solid var(--line); }
.attach-menu button:hover .ic { background: var(--hl-soft); }
.upload-line { display: flex; align-items: center; gap: 10px; padding: 8px 14px; background: var(--sheet); border-top: 1px solid var(--line); font-size: .85rem; }
.lightbox { position: fixed; inset: 0; z-index: 300; background: rgba(0,0,0,.92); display: flex; flex-direction: column; animation: fade .15s; }
.lightbox .lb-top { display: flex; align-items: center; gap: 6px; padding: calc(8px + env(safe-area-inset-top)) 12px 8px; color: #fff; }
.lightbox .lb-top span { display: flex; flex-direction: column; min-width: 0; }
.lightbox .lb-top small { opacity: .7; font-size: .78rem; }
.lightbox .icon-btn { color: #fff; }
.lightbox img { flex: 1; min-height: 0; width: 100%; object-fit: contain; }

/* ---------------- المكالمات ---------------- */
.call { position: fixed; inset: 0; z-index: 400; background: #0B1220; color: #fff; display: flex; flex-direction: column; animation: fade .2s; }
.call-top { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: calc(16px + env(safe-area-inset-top)) 16px 10px; text-align: center; }
.call-top b { font-size: 1.15rem; }
.call-top small { opacity: .75; }
.call-grid { flex: 1; min-height: 0; display: grid; gap: 6px; padding: 6px; grid-template-columns: 1fr; }
.call-grid[data-n="2"] { grid-template-rows: 1fr 1fr; }
.call-grid[data-n="3"], .call-grid[data-n="4"], .call-grid[data-n="5"] { grid-template-columns: 1fr 1fr; }
@media (min-width: 800px) { .call-grid[data-n="2"] { grid-template-columns: 1fr 1fr; grid-template-rows: none; } .call-grid[data-n="5"] { grid-template-columns: 1fr 1fr 1fr; } }
.call-tile { position: relative; background: #16213A; border-radius: 16px; overflow: hidden; display: grid; place-items: center; min-height: 0; }
.call-tile video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.call.voice .call-tile video { opacity: 0; }
.call-tile .ct-av { position: relative; z-index: 0; }
.call:not(.voice) .call-tile:has(video[data-live]) .ct-av { display: none; }
.call-tile .ct-name { position: absolute; bottom: 10px; inset-inline-start: 12px; background: rgba(0,0,0,.45); padding: 2px 10px; border-radius: 10px; font-size: .85rem; z-index: 1; }
.call-tile .ct-state { position: absolute; top: 10px; inset-inline-start: 12px; font-size: .78rem; opacity: .8; z-index: 1; }
.call.voice .call-tile .ct-name { position: static; background: none; margin-top: 8px; display: block; }
.call.voice .call-tile { display: flex; flex-direction: column; align-items: center; justify-content: center; }
.call-wait { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; }
.call-self { position: absolute; bottom: calc(110px + env(safe-area-inset-bottom)); inset-inline-end: 14px; width: 110px; aspect-ratio: 3 / 4; object-fit: cover; border-radius: 14px; border: 2px solid rgba(255,255,255,.25); background: #000; z-index: 2; }
.call-self.mirror { transform: scaleX(-1); }
.call-ctrls { display: flex; justify-content: center; gap: 18px; padding: 16px 16px calc(22px + env(safe-area-inset-bottom)); }
.cbtn { width: 60px; height: 60px; border-radius: 50%; border: 0; background: rgba(255,255,255,.14); color: #fff; display: grid; place-items: center; cursor: pointer; }
.cbtn .ic { width: 26px; height: 26px; }
.cbtn.off { background: #fff; color: #0B1220; }
.cbtn.end { background: #E5484D; }
.cbtn.accept { background: #2FB36B; }
.call.incoming .call-ctrls { gap: 80px; padding-bottom: calc(60px + env(safe-area-inset-bottom)); }
.call.incoming .cbtn { width: 70px; height: 70px; }
.in-call #toasts { z-index: 500; }
.code-box { border-radius: 12px; }
.code-box:fullscreen { background: var(--sheet); display: flex; flex-direction: column; justify-content: center; padding: 6vw; }
.code-box:fullscreen .code-display { font-size: min(32vw, 40vh); }
.code-box:fullscreen .tiny { font-size: 1.4rem; }

/* ---------------- قفل التطبيق ---------------- */
.lock { position: fixed; inset: 0; z-index: 600; background: var(--paper); display: grid; place-items: center; padding: 24px 16px calc(24px + env(safe-area-inset-bottom)); overflow-y: auto; animation: fade .15s; }
.lock-card { width: 100%; max-width: 360px; display: flex; flex-direction: column; align-items: center; gap: 10px; text-align: center; }
.lock-card h2 { margin-top: 6px; }
.lock-card .form { width: 100%; text-align: start; }
.lock-bio { min-height: 54px; font-size: 1.05rem; margin-top: 10px; }
.lock-bio .ic { width: 26px; height: 26px; }
.lock-or { width: 100%; display: flex; align-items: center; gap: 10px; color: var(--ink-3); font-size: .85rem; }
.lock-or::before, .lock-or::after { content: ''; flex: 1; height: 1px; background: var(--line); }
body.locked { overflow: hidden; }
.bio-offer { position: fixed; z-index: 250; inset-inline: 12px; bottom: calc(var(--nav-h) + 14px + env(safe-area-inset-bottom)); display: flex; align-items: center; gap: 10px; padding: 12px 14px; background: var(--sheet); border: 1px solid var(--line); border-radius: 14px; box-shadow: 0 8px 30px rgba(0,0,0,.18); animation: rise .2s; max-width: 560px; margin: 0 auto; }
@media (min-width: 900px) { .bio-offer { bottom: 24px; } }
.switch { position: relative; display: inline-block; width: 48px; height: 28px; flex: none; }
.switch input { position: absolute; opacity: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; z-index: 1; }
.switch span { position: absolute; inset: 0; border-radius: 14px; background: var(--line); transition: background .15s; }
.switch span::after { content: ''; position: absolute; top: 3px; inset-inline-start: 3px; width: 22px; height: 22px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.25); transition: transform .15s; }
.switch input:checked + span { background: var(--teal); }
.switch input:checked + span::after { transform: translateX(20px); }
[dir="rtl"] .switch input:checked + span::after { transform: translateX(-20px); }
.switch input:focus-visible + span { outline: 2.5px solid var(--ink); outline-offset: 2px; }

/* ---------------- الصور في كل حتة ---------------- */
.av-live { position: relative; flex: none; display: inline-flex; }
.av-live .live-dot { position: absolute; bottom: 0; inset-inline-end: 0; border: 2px solid var(--sheet); width: 13px; height: 13px; }
.who-cell { display: inline-flex; align-items: center; gap: 10px; }
.msg .avatar { flex: none; }
.checkin-pop { position: fixed; z-index: 260; bottom: calc(var(--nav-h) + 16px + env(safe-area-inset-bottom)); left: 50%; transform: translateX(-50%); display: flex; align-items: center; gap: 14px; padding: 12px 20px 12px 14px; background: var(--sheet); border: 1px solid var(--line); border-radius: 18px; box-shadow: 0 10px 40px rgba(0,0,0,.2); animation: popin .25s ease-out; min-width: 240px; max-width: calc(100vw - 32px); }
[dir="rtl"] .checkin-pop { padding: 12px 14px 12px 20px; }
.checkin-pop b { display: block; font-size: 1.05rem; }
.checkin-pop small { color: var(--teal); font-weight: 600; }
.checkin-pop.out { opacity: 0; transition: opacity .3s; }
@keyframes popin { from { opacity: 0; transform: translate(-50%, 12px) scale(.96); } }
@media (min-width: 900px) { .checkin-pop { bottom: 28px; } }

/* ---------- المحاولات الفاشلة ---------- */
.checkin-pop.bad { border-color: var(--red); background: var(--red-soft); cursor: pointer; }
.checkin-pop.bad small { color: var(--red); }
.bad-h { display: flex; align-items: center; gap: 8px; color: var(--red); }
.bad-h .ic { width: 20px; height: 20px; }
.att-list { border-color: var(--red); }
.att-row { align-items: flex-start; }
.att-row .body { flex: 1; min-width: 0; }
.att-row > .icon-btn { align-self: flex-start; flex-shrink: 0; }
.att-row .meta { white-space: normal; line-height: 1.6; }
.att-row .meta .tag { margin-inline-end: 4px; }
.att-acts { margin-top: 8px; gap: 6px; flex-wrap: wrap; }
.att-acts .btn { padding-inline: 10px; }
.att-row > .icon-btn { width: 30px; height: 30px; margin-inline-start: -6px; }
.att-map-head { display: flex; gap: 12px; align-items: flex-start; margin-bottom: 12px; }
.att-map-head .small { line-height: 1.7; }
.att-map { height: 340px; border-radius: 14px; overflow: hidden; border: 1px solid var(--line); background: var(--bg-2, #eee); display: grid; place-items: center; direction: ltr; }
.att-map .leaflet-container, .att-map.leaflet-container { width: 100%; height: 100%; font: inherit; }
.att-legend { display: flex; flex-wrap: wrap; gap: 6px 16px; margin: 10px 0; }
.att-legend span { display: inline-flex; align-items: center; gap: 6px; }
.att-legend .dot { width: 12px; height: 12px; border-radius: 50%; display: inline-block; border: 2px solid #fff; box-shadow: 0 0 0 1px var(--line); }
.att-legend .dot.red { background: #D33; } .att-legend .dot.teal { background: #0E7A72; }
.att-legend .dot.ring { background: transparent; border: 2px dashed #0E7A72; box-shadow: none; }
.att-tip { color: #B22; font-weight: 700; }

/* ---------- الدعم الفني ---------- */
.support-top { display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-bottom: 1px solid var(--line); background: var(--sheet); }
.support-top .btn { flex-shrink: 0; }
.bot-av { display: inline-grid; place-items: center; background: var(--ink); color: var(--on-ink); border-radius: 50%; flex-shrink: 0; }
.bot-av .ic { width: 18px; height: 18px; }
.support-chips { padding: 8px 12px; flex-wrap: nowrap; min-width: 0; max-width: 100%; flex: none; }
.support-chips .chip { white-space: nowrap; }
.bubble.typing { display: inline-flex; gap: 4px; align-items: center; min-height: 34px; }
.bubble.typing i { width: 7px; height: 7px; border-radius: 50%; background: var(--ink-3); animation: tdot 1s infinite ease-in-out; }
.bubble.typing i:nth-child(2) { animation-delay: .15s; }
.bubble.typing i:nth-child(3) { animation-delay: .3s; }
@keyframes tdot { 0%, 80%, 100% { opacity: .3; transform: translateY(0); } 40% { opacity: 1; transform: translateY(-3px); } }
@media (prefers-reduced-motion: reduce) { .bubble.typing i { animation: none; } }
.dev-card { display: flex; flex-direction: column; gap: 10px; }
.dev-card p { margin: 0; }

/* ---------- صورتك فوق ---------- */
.top-me { display: inline-flex; border-radius: 50%; text-decoration: none; flex: none; }
.top-me .avatar { box-shadow: 0 0 0 2px var(--sheet), 0 0 0 3.5px var(--line); }
.home-page .top-me { display: none; }
@media (min-width: 900px) { .top-me { display: none; } }

/* ---------- الرئيسية ---------- */
.hero {
  position: relative; overflow: hidden; border-radius: 24px; padding: 20px 20px 16px; margin-bottom: 22px;
  background:
    linear-gradient(var(--hero-grid) 1px, transparent 1px) 0 0 / 22px 22px,
    linear-gradient(90deg, var(--hero-grid) 1px, transparent 1px) 0 0 / 22px 22px,
    linear-gradient(150deg, #22355C 0%, #1B2A49 55%, #142039 100%);
  color: #fff; --hero-grid: rgba(255, 255, 255, .06);
}
.hero::after { content: ''; position: absolute; inset-inline-start: -80px; bottom: -110px; width: 260px; height: 260px; border-radius: 50%; background: radial-gradient(circle, rgba(120, 160, 255, .22), transparent 70%); pointer-events: none; }
.hero-top { display: flex; align-items: center; gap: 14px; position: relative; z-index: 1; }
.hero-av { display: inline-flex; border-radius: 50%; flex: none; }
.hero-av .avatar { box-shadow: 0 0 0 3px rgba(255, 255, 255, .9); }
.hero-hi { min-width: 0; }
.hero-hi small { display: block; color: rgba(255, 255, 255, .72); font-size: .82rem; margin-bottom: 2px; }
.hero-hi h2 { font-size: clamp(1.3rem, 5.4vw, 1.75rem); line-height: 1.3; color: #fff; overflow-wrap: anywhere; }
.hero-name { box-shadow: inset 0 -.28em 0 rgba(255, 225, 77, .9); color: #fff; padding-inline: 2px; border-radius: 2px; }
.hero-clock { display: flex; align-items: flex-end; gap: 8px; margin: 18px 0 14px; direction: ltr; justify-content: flex-start; position: relative; z-index: 1; }
[dir="rtl"] .hero-clock { justify-content: flex-end; }
.hero-clock #clk { font-size: clamp(3.2rem, 17vw, 4.6rem); font-weight: 700; line-height: .9; letter-spacing: -.02em; }
.hero-sec { display: flex; flex-direction: column; gap: 2px; padding-bottom: 4px; font-size: .9rem; color: rgba(255, 255, 255, .75); }
.hero-sec #clkS { font-size: 1.1rem; font-weight: 600; color: #FFE14D; }
.hero-next { display: flex; align-items: center; gap: 10px; min-height: 46px; padding: 10px 12px; border-radius: 14px; background: rgba(255, 255, 255, .1); font-size: .9rem; position: relative; z-index: 1; }
.hero-next:empty { display: none; }
.hero-next .ic { width: 20px; height: 20px; opacity: .85; }
.hero-next b { font-weight: 700; }
.hero-nx { display: flex; flex-direction: column; gap: 1px; flex: 1; min-width: 0; }
.hero-nx small { font-size: .74rem; color: rgba(255, 255, 255, .7); }
.hero-nx b { text-align: start; unicode-bidi: plaintext; font-size: .98rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hero-next .pill { flex: none; font-size: .76rem; font-weight: 600; padding: 4px 10px; border-radius: 999px; background: rgba(255, 255, 255, .16); white-space: nowrap; }
.hero-next .pill.live { background: #FFE14D; color: #1B2A49; }

.home-cta { min-height: 56px; margin-bottom: 16px; font-size: 1rem; }
.home-sec { margin-bottom: 22px; }
.home-sec > h3 { font-size: .95rem; color: var(--ink-2); margin: 0 4px 10px; font-weight: 700; }
.hcards { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.hcard {
  position: relative; display: flex; flex-direction: column; gap: 12px; min-height: 124px; padding: 16px 14px 14px;
  border-radius: 20px; background: var(--sheet); border: 1px solid var(--line); text-decoration: none; color: var(--ink);
  transition: transform .15s ease, border-color .15s ease;
}
.hcard:hover { border-color: color-mix(in srgb, var(--c) 45%, var(--line)); }
.hcard:active { transform: scale(.97); }
.hcard-ic { display: inline-grid; place-items: center; width: 50px; height: 50px; border-radius: 50%; flex: none;
  background: var(--c); color: #fff; box-shadow: 0 6px 14px color-mix(in srgb, var(--c) 35%, transparent); }
.hcard-ic .ic { width: 25px; height: 25px; stroke-width: 2.3; }
.hcard-ic.sm { width: 40px; height: 40px; border-radius: 50%; box-shadow: 0 4px 10px color-mix(in srgb, var(--c) 30%, transparent); }
.hcard-ic.sm .ic { width: 21px; height: 21px; }
.hcard-txt { display: flex; flex-direction: column; gap: 3px; min-width: 0; margin-top: auto; }
.hcard-txt b { font-size: 1.02rem; line-height: 1.3; }
.hcard-txt small { font-size: .8rem; color: var(--ink-3); line-height: 1.35; }
.hcard .badge { position: absolute; top: 12px; inset-inline-end: 12px; }
:root[data-theme="dark"] .hcard-ic { box-shadow: none; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .hcard-ic { box-shadow: none; } }
@media (min-width: 700px) { .hcards { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; } .hero { padding: 26px 28px 20px; } }
@media (prefers-reduced-motion: reduce) { .hcard { transition: none; } .hcard:active { transform: none; } }

/* ---------- المزيد ---------- */
.me-card {
  display: flex; align-items: center; gap: 16px; padding: 18px; margin-bottom: 24px; border-radius: 22px; text-decoration: none; color: #fff;
  background:
    linear-gradient(rgba(255,255,255,.06) 1px, transparent 1px) 0 0 / 22px 22px,
    linear-gradient(90deg, rgba(255,255,255,.06) 1px, transparent 1px) 0 0 / 22px 22px,
    linear-gradient(150deg, #22355C 0%, #1B2A49 55%, #142039 100%);
}
.me-av { position: relative; flex: none; display: inline-flex; border-radius: 50%; }
.me-av .avatar { box-shadow: 0 0 0 3px rgba(255,255,255,.9); }
.me-edit { position: absolute; bottom: 0; inset-inline-end: -2px; width: 28px; height: 28px; border-radius: 50%; background: #FFE14D; color: #1B2A49; display: grid; place-items: center; box-shadow: 0 0 0 3px #1B2A49; }
.me-edit .ic { width: 15px; height: 15px; stroke-width: 2.2; }
.me-txt { display: flex; flex-direction: column; gap: 6px; flex: 1; min-width: 0; }
.me-txt b { font-size: 1.2rem; line-height: 1.3; overflow-wrap: anywhere; }
.me-txt small { font-size: .8rem; color: rgba(255,255,255,.72); }
.me-tags { display: flex; gap: 6px; flex-wrap: wrap; }
.me-card .tag { background: rgba(255,255,255,.14); border-color: transparent; color: #fff; }
.me-card .tag.mark { background: #FFE14D; color: #1B2A49; }
.me-card > .chev { color: rgba(255,255,255,.7); }
.more-row { min-height: 68px; }
.more-row .body b { font-size: 1rem; }
.ic.chev { width: 18px; height: 18px; color: var(--ink-3); flex: none; }
[dir="ltr"] .ic.fwd { transform: scaleX(-1); }

/* ---------- صفحة المطوّر ---------- */
.dev-hero {
  display: flex; flex-direction: column; align-items: center; text-align: center; gap: 6px; padding: 28px 20px 22px; margin-bottom: 24px; border-radius: 24px; color: #fff;
  background:
    linear-gradient(rgba(255,255,255,.06) 1px, transparent 1px) 0 0 / 22px 22px,
    linear-gradient(90deg, rgba(255,255,255,.06) 1px, transparent 1px) 0 0 / 22px 22px,
    linear-gradient(150deg, #22355C 0%, #1B2A49 55%, #142039 100%);
}
.dev-hero-av { display: inline-flex; border-radius: 50%; margin-bottom: 8px; }
.dev-hero-av .avatar { box-shadow: 0 0 0 4px rgba(255,255,255,.95), 0 0 0 10px rgba(255,255,255,.12); }
.dev-hero h2 { font-size: 1.45rem; color: #fff; }
.dev-role { font-size: .86rem; color: #FFE14D; font-weight: 600; }
.dev-bio { font-size: .92rem; color: rgba(255,255,255,.82); max-width: 420px; line-height: 1.7; margin-top: 4px; }
.dev-hero .btn.dev-msg { margin-top: 12px; min-height: 50px; padding-inline: 26px; background: #FFE14D; color: #1B2A49; border-color: #FFE14D; font-weight: 700; }
.dev-hero .notice { text-align: start; color: #1B2A49; }

/* صورة الحساب أكبر */
.profile-head .photo-btn .avatar { box-shadow: 0 0 0 3px var(--sheet), 0 0 0 5px var(--line); }

/* ---------- اختيار القسم ---------- */
.dept-pick { display: flex; flex-direction: column; gap: 8px; }
.dept-opt { position: relative; display: block; }
.dept-opt input { position: absolute; opacity: 0; inset: 0; margin: 0; }
.dept-opt span { display: flex; align-items: center; gap: 10px; min-height: 50px; padding: 12px 14px; border: 1.5px solid var(--line); border-radius: 14px; background: var(--sheet); font-weight: 600; cursor: pointer; }
.dept-opt span::before { content: ''; width: 18px; height: 18px; border-radius: 50%; border: 2px solid var(--ink-3); flex: none; }
.dept-opt input:checked + span { border-color: var(--ink); background: var(--hl-soft); }
.dept-opt input:checked + span::before { border-color: var(--ink); background: radial-gradient(circle, var(--ink) 45%, transparent 50%); }
.dept-opt input:focus-visible + span { outline: 2.5px solid var(--ink); outline-offset: 2px; }
.dept-list { margin-bottom: 4px; }

/* ---------- قص الصورة ---------- */
.crop { position: fixed; inset: 0; z-index: 400; background: rgba(8, 12, 22, .82); display: grid; place-items: center; padding: 16px; animation: fade .15s; }
.crop-card { width: min(100%, 360px); background: var(--sheet); border-radius: 22px; padding: 18px 16px 14px; display: flex; flex-direction: column; align-items: center; gap: 14px; }
.crop-head { text-align: center; display: flex; flex-direction: column; gap: 2px; }
.crop-head small { color: var(--ink-3); font-size: .8rem; }
.crop-stage { position: relative; overflow: hidden; border-radius: 16px; background: #111; touch-action: none; cursor: grab; max-width: 100%; }
.crop-stage:active { cursor: grabbing; }
.crop-stage img { position: absolute; top: 50%; left: 50%; max-width: none; user-select: none; -webkit-user-drag: none; pointer-events: none; }
.crop-mask { position: absolute; inset: 0; border-radius: 50%; box-shadow: 0 0 0 999px rgba(0, 0, 0, .55); outline: 2px solid rgba(255, 255, 255, .9); pointer-events: none; }
.crop-zoom { display: flex; align-items: center; gap: 8px; width: 100%; }
.crop-zoom input { flex: 1; accent-color: var(--ink); }
.crop-zoom .icon-btn { font-size: 1.3rem; font-weight: 700; }
.crop-actions { display: flex; align-items: center; gap: 8px; width: 100%; flex-wrap: wrap; }

/* ---------- عرض الصورة كبيرة ---------- */
img.avatar { -webkit-touch-callout: none; user-select: none; -webkit-user-select: none; }
.dev-hero-av img { cursor: zoom-in; }
.photo-view { position: fixed; inset: 0; z-index: 400; background: rgba(8, 12, 22, .9); display: grid; place-items: center; padding: 24px; animation: fade .15s; }
.photo-view.out { opacity: 0; transition: opacity .15s; }
.photo-view figure { margin: 0; display: flex; flex-direction: column; align-items: center; gap: 14px; }
.photo-view img { width: min(82vw, 380px); aspect-ratio: 1; object-fit: cover; border-radius: 50%; box-shadow: 0 0 0 4px rgba(255,255,255,.9), 0 20px 60px rgba(0,0,0,.5); animation: pv-pop .2s ease-out; }
.photo-view figcaption { color: #fff; font-weight: 700; font-size: 1.15rem; text-align: center; }
.photo-view .pv-x { position: absolute; top: calc(12px + env(safe-area-inset-top)); inset-inline-end: 12px; color: #fff; }
@keyframes pv-pop { from { transform: scale(.85); opacity: .4; } to { transform: none; opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .photo-view img { animation: none; } }

/* ---------- تثبيت التطبيق ---------- */
.inst-banner { display: flex; align-items: center; gap: 12px; padding: 12px 12px 12px 14px; margin-bottom: 22px; border-radius: 18px; background: var(--hl-soft); border: 1px solid color-mix(in srgb, var(--hl) 60%, var(--line)); }
.inst-banner img { width: 44px; height: 44px; border-radius: 11px; flex: none; }
.inst-banner b { display: block; font-size: .95rem; }
.inst-banner small { font-size: .78rem; color: var(--ink-2); }
.inst-banner .btn { flex: none; }
.inst-app { display: flex; align-items: center; gap: 12px; padding: 12px; border-radius: 16px; background: var(--sheet-2); border: 1px solid var(--line); margin-bottom: 14px; }
.inst-app img { width: 56px; height: 56px; border-radius: 14px; flex: none; }
.inst-app b { display: block; font-size: 1.05rem; }
.inst-app small { color: var(--ink-3); font-size: .8rem; line-height: 1.5; }
.inst-steps { list-style: none; margin: 0 0 14px; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.inst-steps li { display: flex; align-items: center; gap: 10px; padding: 12px; border-radius: 14px; border: 1px solid var(--line); background: var(--sheet); line-height: 1.6; font-size: .93rem; }
.inst-n { width: 26px; height: 26px; border-radius: 50%; background: var(--ink); color: var(--on-ink); display: grid; place-items: center; font-weight: 700; font-size: .85rem; flex: none; }
.inst-ic { width: 40px; height: 40px; border-radius: 12px; background: color-mix(in srgb, #0A84FF 14%, var(--sheet)); color: #0A84FF; display: grid; place-items: center; flex: none; }
.inst-ic .ic { width: 22px; height: 22px; }
.inst-arrow { display: flex; align-items: center; justify-content: center; gap: 8px; padding: 10px; color: #0A84FF; font-weight: 700; font-size: .88rem; border-top: 1px dashed var(--line); }
.inst-arrow .ic { animation: inst-bob 1.2s ease-in-out infinite; }
@keyframes inst-bob { 50% { transform: translateY(4px); } }
@media (prefers-reduced-motion: reduce) { .inst-arrow .ic { animation: none; } }
.inst-link { margin-top: 8px; }

/* ---------- تجربة NFC ---------- */
.nfc-box { display: flex; flex-direction: column; align-items: center; gap: 10px; text-align: center; padding: 22px 14px; border-radius: 16px; background: var(--sheet-2); border: 1px solid var(--line); margin-bottom: 12px; line-height: 1.6; }
.nfc-box .ic { width: 40px; height: 40px; }
.nfc-box.wait .ic { animation: inst-bob 1s ease-in-out infinite; color: #0A84FF; }
.nfc-box.ok { background: var(--teal-soft); border-color: var(--teal); color: var(--teal); }
.nfc-box.bad { background: var(--red-soft); border-color: var(--red); color: var(--red); }
.nfc-log { display: flex; flex-direction: column; gap: 4px; margin-bottom: 10px; font-size: .9rem; }
.nfc-log .ok { color: var(--teal); font-weight: 700; } .nfc-log .bad { color: var(--red); font-weight: 700; }
button.item.nfc-row { width: 100%; background: none; border: 0; border-top: 1px solid var(--line); text-align: start; font: inherit; color: inherit; cursor: pointer; }
button.item.nfc-row:hover { background: var(--sheet-2); }
.how-pick { display: flex; flex-direction: column; gap: 10px; }
.how-opt { display: grid; grid-template-columns: 44px 1fr; grid-template-rows: auto auto; column-gap: 12px; align-items: center; text-align: start; padding: 14px; border-radius: 16px; border: 1.5px solid var(--line); background: var(--sheet); color: var(--ink); font: inherit; cursor: pointer; }
.how-opt .ic { grid-row: span 2; width: 44px; height: 44px; padding: 10px; border-radius: 14px; background: var(--hl-soft); }
.how-opt b { font-size: 1.02rem; }
.how-opt small { color: var(--ink-3); font-size: .8rem; }
.how-opt:hover, .how-opt:focus-visible { border-color: var(--ink); }

/* ---------- الإعلانات والإشعارات والغياب ---------- */
.home-sec-h { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.home-sec-h a { color: var(--teal); font-weight: 600; }
.ann-row { align-items: flex-start; }
.ann-row .body { flex: 1; min-width: 0; }
.ann-top { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.ann-top .tag { font-size: .75rem; }
.ann-title { display: block; margin-top: 4px; }
.ann-text { margin-top: 4px; line-height: 1.7; overflow-wrap: anywhere; white-space: pre-line; }
.push-banner .icon-btn { width: 32px; height: 32px; flex-shrink: 0; }
.att-bar.abs i { background: var(--teal); }
.att-bar.abs.near i { background: var(--amber); }
.att-bar.abs.over i { background: var(--red); }
.t-bad { color: var(--red); } .t-warn { color: var(--amber); }
.term-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-bottom: 14px; }
.term-stats > div { background: var(--sheet-2); border: 1px solid var(--line); border-radius: 12px; padding: 10px; text-align: center; }
.term-stats b { display: block; font-size: 1.5rem; }
.term-stats small { color: var(--ink-3); font-size: .78rem; }
.term-stats .bad b { color: var(--red); } .term-stats .warn b { color: var(--amber); }
.home-cta + .home-cta { margin-top: -6px; }
.home-sec-h h3 { font-size: .95rem; color: var(--ink-2); margin: 0 4px 10px; font-weight: 700; }
button.more-row { width: 100%; text-align: start; background: none; border: 0; border-top: 1px solid var(--line); font: inherit; color: inherit; cursor: pointer; }
.list > button.more-row:first-child { border-top: 0; }
button.more-row:hover { background: var(--sheet-2); }

.cbtn small { display: block; font-size: .62rem; line-height: 1; margin-top: 2px; }
@media (max-width: 420px) { .call-ctrls { gap: 10px; } .cbtn { width: 56px; height: 56px; } }

.slot .tiny .ic { width: 14px; height: 14px; vertical-align: -2px; }
.hero-add { color: inherit; font-weight: 600; text-decoration: underline; text-underline-offset: 3px; }
.push-ask { text-align: center; }
.push-ask > .ic { width: 44px; height: 44px; color: var(--amber); margin: 0 auto 8px; display: block; }
.push-ask ul { text-align: start; margin: 10px auto; padding-inline-start: 22px; line-height: 1.9; max-width: 280px; }
.bubble code { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: .86em; background: color-mix(in srgb, var(--ink) 8%, transparent); padding: 1px 5px; border-radius: 5px; direction: ltr; unicode-bidi: isolate; }
.bubble .ai-code { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: .8rem; line-height: 1.5; background: #0F1A30; color: #E6EDF7; padding: 10px 12px; border-radius: 10px; margin: 6px 0; overflow-x: auto; white-space: pre; text-align: left; max-width: 100%; }
