:root {
    color-scheme: light;
    --blue: #0F4C8A;
    --blue-deep: #0A3A6B;
    --blue-tint: #E8F0F9;
    --gold: #C9A227;
    --gold-soft: #E7C77A;
    --ink: #101828;
    --body: #475467;
    --muted: #667085;
    --faint: #98A2B3;
    --line: #E4E7EC;
    --hair: #F2F4F7;
    --page: #F3F6FA;
    --card: #FFFFFF;
    --amber: #B45309;
    --amber-ink: #8A5A11;
    --amber-bg: #FEF6E7;
    --amber-line: #F5E0B7;
    --green: #067647;
    --green-bg: #ECFDF3;
    --green-line: #ABEFC6;
    --red: #B42318;
    --backdrop: #0B2E52;
    --display: 'Noto Kufi Arabic', 'Segoe UI', Tahoma, sans-serif;
    --text: 'Readex Pro', 'Segoe UI', Tahoma, sans-serif;
  }

  * { box-sizing: border-box; }

  body {
    margin: 0;
    direction: rtl;
    background: var(--page);
    color: var(--ink);
    font-family: var(--text);
    -webkit-font-smoothing: antialiased;
  }

  .stage { min-height: 100vh; min-height: 100dvh; display: flex; }

  .device {
    position: relative;
    width: 100%;
    height: 100vh;
    height: 100dvh;
    background: var(--page);
    display: flex;
    flex-direction: column;
    overflow: hidden;
  }

  .screen { display: none; flex-direction: column; flex: 1 1 auto; min-height: 0; }
  .screen.on { display: flex; animation: rise .28s ease both; }

  @keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
  @media (prefers-reduced-motion: reduce) { .screen.on { animation: none; } }

  .scroll { flex: 1 1 auto; min-height: 0; overflow-y: auto; -webkit-overflow-scrolling: touch; }

  /* ---------- blue headers ---------- */
  .bluehead { position: relative; background: var(--blue); padding: 26px 20px 24px; overflow: hidden; flex-shrink: 0; }
  .bluehead > * { position: relative; }
  .bluehead .mesh { position: absolute; inset: -20px -60px auto auto; opacity: 1; }

  .brandrow { display: flex; align-items: center; gap: 12px; }
  .marktile {
    width: 44px; height: 44px; border-radius: 13px; flex-shrink: 0;
    background: rgba(255,255,255,.13); border: 1px solid rgba(255,255,255,.24);
    display: flex; align-items: center; justify-content: center;
  }
  .wordmark { font-family: var(--display); font-size: 20px; font-weight: 700; color: #fff; line-height: 1.2; }
  .tagline { font-size: 11.5px; color: #B9D2EC; }

  .ghostbtn {
    margin-right: auto; display: inline-flex; align-items: center; gap: 7px;
    background: rgba(255,255,255,.14); border: 1px solid rgba(255,255,255,.22);
    border-radius: 9px; padding: 8px 12px; color: #fff;
    font-family: inherit; font-size: 11.5px; font-weight: 500; cursor: pointer;
  }
  .ghostbtn:hover { background: rgba(255,255,255,.22); }

  .hero-h1 { margin: 24px 0 10px; font-family: var(--display); font-size: 24px; font-weight: 600; line-height: 1.55; color: #fff; text-wrap: balance; }
  .hero-p { margin: 0; font-size: 12.5px; line-height: 1.9; color: #C6DAF0; }

  /* ---------- white headers ---------- */
  .bar { background: var(--card); border-bottom: 1px solid var(--line); padding: 22px 20px 15px; flex-shrink: 0; }
  .barrow { display: flex; align-items: center; gap: 12px; }
  .bartitle { font-family: var(--display); font-size: 16px; font-weight: 600; }
  .step { margin-right: auto; font-size: 11.5px; font-weight: 500; color: var(--blue); background: var(--blue-tint); border-radius: 999px; padding: 5px 11px; }
  .track { display: flex; gap: 5px; padding-top: 15px; }
  .track i { height: 4px; flex: 1; border-radius: 2px; background: var(--line); }
  .track i.done { background: var(--blue); }

  .icon-btn { background: none; border: 0; padding: 0; cursor: pointer; line-height: 0; color: inherit; }

  /* ---------- content ---------- */
  .pad { padding: 16px 18px; display: flex; flex-direction: column; gap: 16px; }
  .card { background: var(--card); border: 1px solid var(--line); border-radius: 16px; box-shadow: 0 4px 14px rgba(16,24,40,.05); }
  .card.pad-in { padding: 18px; }
  .card.list { padding: 2px 16px; }
  .sectitle { font-size: 13px; font-weight: 600; color: var(--body); padding-right: 4px; }

  .rowlink { display: flex; align-items: center; gap: 14px; width: 100%; text-align: right; background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 18px; box-shadow: 0 6px 18px rgba(16,24,40,.07); font-family: inherit; color: inherit; cursor: pointer; }
  .rowlink:hover { border-color: #C7D6E6; }
  .sq { width: 46px; height: 46px; border-radius: 13px; background: var(--blue-tint); display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
  .rowlink b { font-size: 15px; font-weight: 600; }
  .rowlink span { font-size: 12px; color: var(--muted); }

  .steprow { display: flex; align-items: center; gap: 14px; padding: 14px 0; border-bottom: 1px solid var(--hair); }
  .steprow:last-child { border-bottom: 0; }
  .num { width: 26px; height: 26px; border-radius: 8px; background: var(--blue); color: #fff; font-size: 12.5px; font-weight: 600; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
  .steprow b { font-size: 13.5px; font-weight: 500; display: block; }
  .steprow span { font-size: 11.5px; color: var(--muted); }

  .note { display: flex; align-items: flex-start; gap: 11px; border-radius: 14px; padding: 13px; font-size: 11.5px; line-height: 1.8; }
  .note.amber { background: var(--amber-bg); border: 1px solid var(--amber-line); color: var(--amber-ink); }
  .note.blue { background: #F4F7FB; border: 1px solid #E7EDF5; color: var(--body); }
  .note.green { background: var(--green-bg); border: 1px solid var(--green-line); color: var(--green); font-weight: 600; align-items: center; }
  .note svg { flex-shrink: 0; }

  .chips { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .chip { background: #F4F7FB; border: 1px solid #E7EDF5; border-radius: 9px; padding: 8px 11px; font-size: 11.5px; color: #344054; }
  .chip.warn { background: var(--amber-bg); border-color: var(--amber-line); color: var(--amber-ink); }

  .fields { display: flex; flex-direction: column; gap: 18px; }
  .field { display: flex; flex-direction: column; gap: 7px; }
  .field label { font-size: 12.5px; font-weight: 600; color: #344054; }
  .duo { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }

  input, select {
    height: 50px; width: 100%; border: 1px solid #D0D5DD; border-radius: 11px;
    background: var(--card); padding: 0 14px; font-family: inherit; font-size: 14px; color: var(--ink);
  }
  input:focus, select:focus, .pill:focus-visible, button:focus-visible, .agree:focus-visible {
    outline: none; border-color: var(--blue); box-shadow: 0 0 0 3px rgba(15,76,138,.16);
  }
  input::placeholder { color: var(--faint); }
  select { appearance: none; -webkit-appearance: none; }
  .sel { position: relative; }
  .sel svg { position: absolute; left: 13px; top: 17px; pointer-events: none; }

  .pills { display: flex; gap: 9px; }
  .pills.quad { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .pill {
    flex: 1; min-height: 48px; border-radius: 11px; border: 1.5px solid #D0D5DD;
    background: var(--card); color: var(--body);
    font-family: inherit; font-size: 13.5px; font-weight: 600; cursor: pointer;
    transition: background .15s ease, color .15s ease, border-color .15s ease;
  }
  .pill[aria-pressed="true"] { background: var(--blue); border-color: var(--blue); color: #fff; box-shadow: 0 4px 12px rgba(15,76,138,.22); }

  .phone { display: flex; align-items: center; height: 50px; border: 1px solid #D0D5DD; border-radius: 11px; background: var(--card); padding: 0 13px; gap: 10px; }
  .phone span { font-size: 13.5px; color: var(--muted); letter-spacing: .5px; }
  .phone i { width: 1px; height: 22px; background: var(--line); }
  .phone input {
    flex: 1; width: auto; min-width: 0;
    border: 0; height: auto; padding: 0; background: transparent;
    direction: ltr; text-align: right; letter-spacing: .5px;
  }
  .phone input:focus { box-shadow: none; border: 0; }
  .phone input::placeholder { letter-spacing: normal; }
  .hint { display: flex; align-items: center; gap: 7px; font-size: 11px; color: var(--amber); }

  .foot { padding: 14px 18px 24px; background: var(--card); border-top: 1px solid var(--line); display: flex; flex-direction: column; gap: 12px; flex-shrink: 0; }
  .cta { height: 54px; border: 0; border-radius: 12px; background: var(--blue); color: #fff; font-family: inherit; font-size: 15.5px; font-weight: 600; cursor: pointer; box-shadow: 0 6px 16px rgba(15,76,138,.28); }
  .cta:hover { background: var(--blue-deep); }
  .cta[disabled] { background: var(--line); color: var(--faint); box-shadow: none; cursor: not-allowed; }
  .footnote { margin: 0; font-size: 11px; text-align: center; color: var(--faint); }

  .agree { display: flex; align-items: flex-start; gap: 12px; cursor: pointer; background: none; border: 0; padding: 0; text-align: right; font-family: inherit; }
  .box { width: 22px; height: 22px; flex-shrink: 0; border-radius: 6px; border: 1.5px solid #CFD4DC; background: var(--card); display: flex; align-items: center; justify-content: center; }
  .agree[aria-pressed="true"] .box { background: var(--blue); border-color: var(--blue); }
  .agree[aria-pressed="true"] .box svg { display: block; }
  .box svg { display: none; }
  .agree p { margin: 0; font-size: 12.5px; line-height: 1.75; color: #344054; }

  .kv { display: flex; align-items: center; justify-content: space-between; padding: 14px 0; border-bottom: 1px solid var(--hair); }
  .kv:last-child { border-bottom: 0; }
  .kv dt { font-size: 12px; color: var(--muted); }
  .kv dd { margin: 0; font-size: 13.5px; font-weight: 600; display: flex; align-items: center; gap: 7px; }
  dl { margin: 0; }

  .statuscard { margin-top: 20px; background: rgba(255,255,255,.12); border: 1px solid rgba(255,255,255,.2); border-radius: 16px; padding: 17px; }
  .statustop { display: flex; align-items: center; justify-content: space-between; }
  .reqno { font-family: var(--display); font-size: 23px; font-weight: 700; color: #fff; letter-spacing: 1px; }
  .badge { display: flex; align-items: center; gap: 7px; background: #fff; border-radius: 999px; padding: 7px 13px; font-size: 12px; font-weight: 600; color: var(--amber-ink); }
  .badge i { width: 7px; height: 7px; border-radius: 50%; background: var(--amber); }
  .hr { height: 1px; background: rgba(255,255,255,.18); margin: 14px 0; }

  .tl { display: flex; gap: 14px; }
  .tl .rail { display: flex; flex-direction: column; align-items: center; width: 24px; flex-shrink: 0; }
  .tl .dot { width: 24px; height: 24px; border-radius: 50%; background: var(--card); border: 2px solid #D0D5DD; }
  .tl .dot.now { border: 3px solid var(--blue); }
  .tl .dot.done { background: var(--blue); border: 0; display: flex; align-items: center; justify-content: center; }
  .tl .line { width: 2px; flex: 1; background: var(--line); }
  .tl .line.done { background: var(--blue); }
  .tl .txt { padding-bottom: 22px; }
  .tl .txt b { font-size: 14px; font-weight: 600; display: block; }
  .tl .txt span { font-size: 11.5px; color: var(--muted); }
  .tl.future .txt b { color: var(--faint); }
  .tl.future .txt span { color: #A9B0BC; }
  .tl:last-child .txt { padding-bottom: 0; }

  .danger { display: flex; align-items: center; justify-content: space-between; background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 15px 16px; }
  .danger b { font-size: 13.5px; font-weight: 600; color: var(--red); display: flex; align-items: center; gap: 11px; }

  .tabs { margin-top: auto; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); background: var(--card); border-top: 1px solid var(--line); padding: 10px 8px 20px; box-shadow: 0 -4px 16px rgba(16,24,40,.05); flex-shrink: 0; }
  .tab { display: flex; flex-direction: column; align-items: center; gap: 5px; padding: 6px 0; background: none; border: 0; font-family: inherit; font-size: 10.5px; color: var(--faint); cursor: pointer; }
  .tab[aria-current="page"] { color: var(--blue); font-weight: 600; }

  /* ---------- committee ---------- */
  .stats { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .stat { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 14px; display: flex; flex-direction: column; gap: 4px; }
  .stat span { font-size: 11.5px; color: var(--muted); }
  .stat b { font-family: var(--display); font-size: 20px; font-weight: 700; font-variant-numeric: tabular-nums; }

  .filters { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 2px; }
  .fchip { flex-shrink: 0; height: 38px; padding: 0 16px; border-radius: 10px; border: 1px solid #D0D5DD; background: var(--card); color: var(--body); font-family: inherit; font-size: 12.5px; font-weight: 600; cursor: pointer; }
  .fchip[aria-pressed="true"] { background: var(--blue); border-color: var(--blue); color: #fff; }

  .req { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 15px 16px; display: flex; flex-direction: column; gap: 11px; }
  .reqtop { display: flex; align-items: center; gap: 9px; }
  .reqtop b { font-size: 14px; font-weight: 600; }
  .reqid { font-size: 11.5px; color: var(--muted); letter-spacing: .5px; font-variant-numeric: tabular-nums; }
  .tag { display: inline-flex; align-items: center; height: 25px; padding: 0 10px; border-radius: 7px; font-size: 11.5px; font-weight: 600; }
  .tag.man { background: #EEF2F6; color: #3E4C5A; border: 1px solid #DDE3E9; }
  .tag.woman { background: #F6F1F8; color: #5C4468; border: 1px solid #EADFEE; }
  .tag.new { background: var(--blue-tint); color: var(--blue); border: 1px solid #CFE0F1; margin-right: auto; }
  .tag.study { background: var(--amber-bg); color: var(--amber-ink); border: 1px solid var(--amber-line); margin-right: auto; }
  .tag.ok { background: #F2F4F7; color: var(--body); border: 1px solid var(--line); margin-right: auto; }
  .reqgrid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px 12px; }
  .reqgrid div { font-size: 11.5px; color: var(--muted); }
  .reqgrid div b { display: block; font-size: 12.5px; font-weight: 500; color: #344054; }
  .hidden-num { display: flex; align-items: center; gap: 6px; font-size: 11.5px; color: var(--amber); border-top: 1px solid var(--hair); padding-top: 10px; }

  /* ---------- wide screens: full-screen app, centred content ---------- */
  @media (min-width: 900px) {
    .bluehead { padding: 30px 32px 30px; }
    .bluehead > *:not(.mesh),
    .bar > *,
    .foot > *,
    .tabs,
    .pad { max-width: 780px; margin-inline: auto; }

    .bar { padding: 22px 32px 15px; }
    .foot { padding: 16px 32px 22px; }
    .tabs { width: 100%; padding: 10px 32px 14px; }

    .hero-h1 { font-size: 30px; margin-top: 26px; }
    .hero-p { font-size: 13.5px; max-width: 620px; }
    .wordmark { font-size: 22px; }

    .pad { padding: 22px 32px 26px; gap: 18px; }
    .rowlink { padding: 20px 22px; }
    .rowlink b { font-size: 16px; }
    .stats { grid-template-columns: repeat(4, minmax(0, 1fr)); }
    .reqgrid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  }

  /* ---------- إضافات التطبيق الحقيقي ---------- */
  .toast { position: fixed; inset-inline: 16px; bottom: 22px; z-index: 50; background: var(--ink); color: #fff;
           border-radius: 12px; padding: 14px 16px; font-size: 13px; box-shadow: 0 12px 30px rgba(16,24,40,.28); display: none; }
  .toast.err { background: var(--red); }
  .toast.show { display: block; animation: rise .2s ease both; }

  .err-msg { font-size: 11.5px; color: var(--red); display: none; }
  .field.bad input, .field.bad select { border-color: var(--red); }
  .field.bad .err-msg { display: block; }

  .cta.busy { opacity: .7; pointer-events: none; }

  .center-box { flex: 1; display: flex; align-items: center; justify-content: center; padding: 24px; }
  .login { width: 100%; max-width: 380px; background: var(--card); border: 1px solid var(--line); border-radius: 18px;
           padding: 28px; display: flex; flex-direction: column; gap: 16px; box-shadow: 0 10px 30px rgba(16,24,40,.08); }
  .login h1 { margin: 0; font-family: var(--display); font-size: 20px; font-weight: 600; }
  .login p { margin: 0; font-size: 12.5px; color: var(--muted); line-height: 1.8; }

  .adminbar { display: flex; align-items: center; gap: 14px; padding: 16px 22px; background: var(--blue); flex-shrink: 0; }
  .adminbar .who { margin-inline-start: auto; display: flex; align-items: center; gap: 10px; font-size: 12.5px; color: #DCE9F6; }
  .linkbtn { background: none; border: 0; font-family: inherit; font-size: 12.5px; font-weight: 600; color: #fff;
             text-decoration: underline; cursor: pointer; padding: 0; }

  .sheet { position: fixed; inset: 0; z-index: 60; background: rgba(16,24,40,.45); display: none; align-items: flex-end; justify-content: center; }
  .sheet.open { display: flex; }
  .sheet-inner { width: 100%; max-width: 560px; max-height: 88vh; overflow-y: auto; background: var(--page);
                 border-radius: 20px 20px 0 0; padding: 20px 20px 28px; }
  @media (min-width: 700px) { .sheet { align-items: center; } .sheet-inner { border-radius: 20px; } }

  .revealed { font-variant-numeric: tabular-nums; letter-spacing: 1px; font-weight: 600; }
  .muted-note { font-size: 11px; color: var(--faint); text-align: center; margin: 0; }

  /* ---------- أرقام لاتينية ومحاذاة ---------- */
  .num-ltr { direction: ltr; unicode-bidi: isolate; font-variant-numeric: tabular-nums; }
  .triple { display: grid; grid-template-columns: 1fr 1.5fr 1.1fr; gap: 10px; }
  .phone .pfx { direction: ltr; unicode-bidi: isolate; }

  /* ---------- طلبات العضوية ---------- */
  .pending { background: var(--card); border: 1px solid var(--amber-line); border-radius: 14px;
             padding: 14px 16px; display: flex; align-items: center; gap: 12px; }
  .pending .info { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
  .pending .info b { font-size: 13.5px; font-weight: 600; }
  .pending .info span { font-size: 11.5px; color: var(--muted); overflow-wrap: anywhere; }
  .pending .acts { margin-inline-start: auto; display: flex; gap: 8px; flex-shrink: 0; }
  .btn-sm { height: 36px; padding: 0 14px; border-radius: 9px; font-family: inherit;
            font-size: 12.5px; font-weight: 600; cursor: pointer; border: 1px solid var(--line); background: var(--card); color: var(--body); }
  .btn-sm.primary { background: var(--blue); border-color: var(--blue); color: #fff; }
  .btn-sm.danger { color: var(--red); border-color: #F3C6C2; }

  /* ---------- دخول Google وإنشاء حساب ---------- */
  .or { display: flex; align-items: center; gap: 12px; font-size: 11.5px; color: var(--faint); }
  .or::before, .or::after { content: ""; flex: 1; height: 1px; background: var(--line); }
  .btn-google {
    height: 50px; width: 100%; display: flex; align-items: center; justify-content: center; gap: 10px;
    border: 1px solid #D0D5DD; border-radius: 12px; background: var(--card);
    font-family: inherit; font-size: 14px; font-weight: 600; color: #344054; cursor: pointer;
  }
  .btn-google:hover { background: #F8FAFC; }
  .switch-mode { background: none; border: 0; font-family: inherit; font-size: 12.5px;
                 font-weight: 600; color: var(--blue); cursor: pointer; padding: 4px; }
