/* ============================================================
   التقويم العائلي — الإصدار 21
   نخيل أخضر للمواعيد، وذهب صحراوي لكل ما هو هجري/قمري
   ============================================================ */
:root{
  --bg:#EEF2EF;
  --surface:#FFFFFF;
  --surface-2:#F5F8F6;
  --ink:#13221D;
  --ink-2:#4D5D56;
  --ink-3:#71807A;
  --line:#DCE3DF;
  --primary:#11624F;
  --primary-ink:#FFFFFF;
  --primary-soft:#DCEDE6;
  --gold:#946510;
  --gold-soft:#F5EAD3;
  --shared:#2F5797;
  --shared-soft:#E1E9F6;
  --danger:#AE3528;
  --danger-soft:#F8E2DF;
  --moon-lit:#E9C46A;
  --moon-dark:#D5DDD9;
  --shadow:0 1px 2px rgba(19,34,29,.06), 0 8px 24px rgba(19,34,29,.07);
  --font:"IBM Plex Sans Arabic", -apple-system, "SF Arabic", "Geeza Pro", Tahoma, sans-serif;
  --display:"Reem Kufi", "IBM Plex Sans Arabic", "Geeza Pro", sans-serif;
  --r-sheet:22px;
  --r-group:16px;
  --r-tile:11px;
  --tabbar-h:64px;
  color-scheme:light;
}
@media (prefers-color-scheme: dark){
  :root{
    --bg:#0C1512;
    --surface:#15211D;
    --surface-2:#1B2924;
    --ink:#E6EEEA;
    --ink-2:#A3B3AC;
    --ink-3:#80918A;
    --line:#26372F;
    --primary:#5FC6A6;
    --primary-ink:#04241B;
    --primary-soft:#173B31;
    --gold:#E3B95F;
    --gold-soft:#372C14;
    --shared:#93B3EA;
    --shared-soft:#1C2A42;
    --danger:#F28C80;
    --danger-soft:#3D201C;
    --moon-lit:#F0D58C;
    --moon-dark:#22332C;
    --shadow:0 1px 2px rgba(0,0,0,.35), 0 10px 28px rgba(0,0,0,.35);
    color-scheme:dark;
  }
}

*{ box-sizing:border-box; }
html{ -webkit-text-size-adjust:100%; text-size-adjust:100%; }
body{
  margin:0;
  font-family:var(--font);
  font-size:16px;
  line-height:1.6;
  color:var(--ink);
  background:var(--bg);
  -webkit-tap-highlight-color:transparent;
  min-height:100dvh;
}
[hidden]{ display:none !important; }
button, input, select, textarea{ font:inherit; color:inherit; }
button{ cursor:pointer; }
:focus-visible{ outline:2.5px solid var(--primary); outline-offset:2px; border-radius:8px; }
.ico{ width:22px; height:22px; fill:none; stroke:currentColor; stroke-width:1.8; stroke-linecap:round; stroke-linejoin:round; flex:none; }

/* ---------- القمر ---------- */
.moon .moon-dark{ fill:var(--moon-dark); }
.moon .moon-lit{ fill:var(--moon-lit); }
.moon .moon-ring{ stroke:color-mix(in srgb, var(--gold) 35%, transparent); stroke-width:1; }

/* ---------- شاشة البدء ---------- */
.boot{ position:fixed; inset:0; display:grid; place-items:center; background:var(--bg); z-index:50; transition:opacity .3s; }
.boot.out{ opacity:0; pointer-events:none; }
.boot-moon{ animation:breathe 1.6s ease-in-out infinite; }
@keyframes breathe{ 50%{ opacity:.45; transform:scale(.94); } }

/* ---------- الأزرار والحقول ---------- */
.btn{
  display:inline-flex; align-items:center; justify-content:center; gap:8px;
  min-height:46px; padding:0 18px; border-radius:13px; border:1px solid transparent;
  font-weight:600; font-size:15.5px; background:var(--surface-2); color:var(--ink);
  transition:transform .12s, background .15s, opacity .15s;
}
.btn:active{ transform:scale(.97); }
.btn:disabled{ opacity:.55; pointer-events:none; }
.btn-primary{ background:var(--primary); color:var(--primary-ink); }
.btn-soft{ background:var(--primary-soft); color:var(--primary); }
.btn-line{ background:transparent; border-color:var(--line); }
.btn-danger{ background:var(--danger-soft); color:var(--danger); }
.btn-danger-solid{ background:var(--danger); color:#fff; }
.btn-block{ width:100%; }
.btn .ico{ width:20px; height:20px; }
.link-btn{ background:none; border:0; padding:8px 4px; color:var(--primary); font-weight:600; font-size:14.5px; }
.icon-btn{ width:44px; height:44px; display:grid; place-items:center; border-radius:12px; border:0; background:transparent; color:var(--ink-2); }
.icon-btn:active{ background:var(--surface-2); }
.chip-btn{ border:1px solid var(--line); background:var(--surface); border-radius:999px; padding:6px 14px; font-weight:600; font-size:14px; min-height:36px; }

.field{ display:flex; flex-direction:column; gap:6px; }
.field > span{ font-size:14px; font-weight:600; color:var(--ink-2); }
.field input, .field select, .field textarea, .input{
  width:100%; min-height:48px; padding:10px 14px; border-radius:12px;
  border:1px solid var(--line); background:var(--surface); font-size:16px; outline:none;
  transition:border-color .15s, box-shadow .15s;
}
.field textarea{ min-height:88px; resize:vertical; line-height:1.7; }
.field input:focus, .field select:focus, .field textarea:focus, .input:focus{
  border-color:var(--primary); box-shadow:0 0 0 3px color-mix(in srgb, var(--primary) 22%, transparent);
}
input[type="date"], input[type="time"]{ -webkit-appearance:none; appearance:none; text-align:right; }
input[type="date"]::-webkit-date-and-time-value, input[type="time"]::-webkit-date-and-time-value{ text-align:right; }
select{ -webkit-appearance:none; appearance:none;
  background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2371807A' stroke-width='2' stroke-linecap='round'%3E%3Cpath d='m7 10 5 5 5-5'/%3E%3C/svg%3E");
  background-repeat:no-repeat; background-position:left 10px center; background-size:18px; padding-left:34px !important; }
.form-msg{ margin:0; min-height:0; font-size:14px; color:var(--danger); }
.form-msg:empty{ display:none; }
.form-msg.ok{ color:var(--primary); }
.hint{ font-size:13.5px; color:var(--ink-3); margin:0; }

/* مقطع اختيار */
.seg{ display:flex; background:var(--surface-2); border:1px solid var(--line); border-radius:13px; padding:3px; gap:3px; }
.seg button{ flex:1; border:0; background:transparent; border-radius:10px; min-height:38px; font-weight:600; font-size:14.5px; color:var(--ink-2); display:flex; align-items:center; justify-content:center; gap:6px; }
.seg button.on{ background:var(--surface); color:var(--ink); box-shadow:0 1px 3px rgba(0,0,0,.12); }
.seg small{ font-size:12px; color:var(--ink-3); font-weight:500; }
.seg-sm button{ min-height:32px; font-size:13.5px; }

/* مفتاح تشغيل */
.switch-row{ display:flex; align-items:center; justify-content:space-between; gap:12px; min-height:52px; padding:6px 0; }
.switch-row .label{ display:flex; align-items:center; gap:10px; font-weight:600; }
.switch-row .label .ico{ color:var(--ink-3); }
.switch-row .sub{ display:block; font-weight:400; font-size:13px; color:var(--ink-3); }
.switch{ position:relative; width:51px; height:31px; flex:none; }
.switch input{ position:absolute; inset:0; opacity:0; margin:0; cursor:pointer; z-index:1; }
.switch i{ position:absolute; inset:0; background:var(--line); border-radius:99px; transition:background .2s; }
.switch i::after{ content:""; position:absolute; top:2px; right:2px; width:27px; height:27px; background:#fff; border-radius:50%; box-shadow:0 2px 4px rgba(0,0,0,.2); transition:transform .2s; }
.switch input:checked + i{ background:var(--primary); }
.switch input:checked + i::after{ transform:translateX(-20px); }
.switch input:focus-visible + i{ outline:2.5px solid var(--primary); outline-offset:2px; }
.switch input:disabled + i{ opacity:.5; }

/* ---------- تسجيل الدخول ---------- */
.lock{ min-height:100dvh; display:flex; justify-content:center; padding:calc(env(safe-area-inset-top) + 40px) 20px calc(env(safe-area-inset-bottom) + 24px); }
.lock-inner{ width:100%; max-width:400px; }
.lock-head{ text-align:center; margin-bottom:28px; }
.lock-moon{ display:flex; justify-content:center; margin-bottom:14px; }
.lock-title{ font-family:var(--display); font-weight:600; font-size:34px; line-height:1.3; margin:0; }
.lock-date{ margin:6px 0 0; color:var(--ink-2); font-size:15px; }
.auth-form{ background:var(--surface); border-radius:var(--r-sheet); padding:22px 20px; box-shadow:var(--shadow); display:flex; flex-direction:column; gap:14px; }
.auth-title{ margin:0; font-size:19px; font-weight:700; }
.auth-links{ display:flex; justify-content:space-between; flex-wrap:wrap; gap:4px; }

/* ---------- الإطار العام ---------- */
.app{ max-width:640px; margin:0 auto; padding:calc(env(safe-area-inset-top) + 10px) 16px calc(var(--tabbar-h) + env(safe-area-inset-bottom) + 28px); }
.top-bar{ display:flex; align-items:center; justify-content:space-between; gap:10px; min-height:48px; }
.greet{ display:flex; flex-direction:column; line-height:1.35; }
.greet > span{ font-weight:600; font-size:15.5px; }
.sync{ display:inline-flex; align-items:center; gap:6px; background:none; border:0; padding:0; font-size:12.5px; color:var(--ink-3); }
.sync-dot{ width:7px; height:7px; border-radius:50%; background:var(--primary); }
.sync.busy .sync-dot{ background:var(--gold); animation:breathe 1s infinite; }
.sync.warn .sync-dot{ background:var(--danger); }
.avatar{ position:relative; width:44px; height:44px; border-radius:50%; border:0; background:var(--primary-soft); color:var(--primary); font-weight:700; font-size:18px; display:grid; place-items:center; }
.badge{ position:absolute; top:-2px; left:-2px; min-width:19px; height:19px; padding:0 5px; border-radius:99px; background:var(--danger); color:#fff; font-size:11.5px; font-weight:700; display:grid; place-items:center; font-style:normal; border:2px solid var(--bg); line-height:1; }

.today{ display:flex; align-items:center; gap:16px; padding:18px 2px 22px; }
.today-moon{ flex:none; }
.today-hijri{ font-family:var(--display); font-weight:600; font-size:clamp(26px, 7.6vw, 34px); line-height:1.3; color:var(--ink); }
.today-greg{ color:var(--ink-2); font-size:15px; margin-top:2px; }
.today-greg .hy{ color:var(--gold); font-weight:700; }
.today.compact{ padding:6px 2px 12px; gap:12px; }
.today.compact .today-moon svg{ width:40px; height:40px; }
.today.compact .today-hijri{ font-size:21px; }

/* ---------- أدوات القائمة ---------- */
.list-tools{ display:flex; flex-direction:column; gap:10px; margin-bottom:14px; position:sticky; top:0; z-index:5; background:var(--bg); padding:8px 0 4px; }
.search{ display:flex; align-items:center; gap:8px; background:var(--surface); border:1px solid var(--line); border-radius:13px; padding:0 12px; min-height:46px; }
.search .ico{ color:var(--ink-3); width:20px; height:20px; }
.search input{ flex:1; border:0; outline:0; background:transparent; min-height:44px; font-size:16px; }
.search:focus-within{ border-color:var(--primary); }

/* ---------- قائمة المواعيد ---------- */
.group{ margin-bottom:18px; }
.group-h{ display:flex; align-items:baseline; justify-content:space-between; margin:0 4px 8px; font-size:14px; font-weight:700; color:var(--ink-2); }
.group-h small{ font-weight:500; color:var(--ink-3); font-size:12.5px; }
.rows{ background:var(--surface); border-radius:var(--r-group); overflow:hidden; box-shadow:var(--shadow); }
.row{
  width:100%; display:flex; align-items:center; gap:12px; text-align:right;
  padding:11px 12px; background:none; border:0; border-bottom:1px solid var(--line);
  min-height:68px;
}
.row:last-child{ border-bottom:0; }
.row:active{ background:var(--surface-2); }
.tile{
  flex:none; width:52px; height:52px; border-radius:var(--r-tile);
  background:var(--primary-soft); color:var(--primary);
  display:flex; flex-direction:column; align-items:center; justify-content:center; line-height:1.05;
}
.tile b{ font-size:20px; font-weight:700; }
.tile span{ font-size:11px; font-weight:600; margin-top:3px; white-space:nowrap; max-width:50px; overflow:hidden; text-overflow:ellipsis; }
.tile.hijri{ background:var(--gold-soft); color:var(--gold); }
.tile.sa{ background:var(--gold-soft); color:var(--gold); }
.tile.shared{ background:var(--shared-soft); color:var(--shared); }
.row.past .tile{ background:var(--surface-2); color:var(--ink-3); }
.row-main{ flex:1; min-width:0; }
.row-title{ font-weight:600; font-size:16px; line-height:1.4; display:-webkit-box; -webkit-line-clamp:2; -webkit-box-orient:vertical; overflow:hidden; }
.row-meta{ display:flex; flex-wrap:wrap; align-items:center; gap:4px 10px; margin-top:2px; font-size:13px; color:var(--ink-3); }
.row-meta span{ display:inline-flex; align-items:center; gap:4px; }
.row-meta .ico{ width:14px; height:14px; }
.row-meta .shared-from{ color:var(--shared); }
.when{ flex:none; font-size:13px; font-weight:600; color:var(--ink-2); text-align:left; white-space:nowrap; }
.when.today{ background:var(--primary); color:var(--primary-ink); border-radius:99px; padding:3px 11px; }
.when.soon{ color:var(--primary); }
.row.past .when{ color:var(--ink-3); font-weight:500; }

.empty{ text-align:center; padding:44px 20px; color:var(--ink-2); }
.empty .ico{ width:40px; height:40px; color:var(--ink-3); stroke-width:1.4; margin-bottom:8px; }
.empty p{ margin:0 0 16px; }

/* الدعوات */
.invites{ background:var(--shared-soft); border-radius:var(--r-group); padding:14px; margin-bottom:16px; }
.invites h3{ margin:0 0 10px; font-size:15px; display:flex; align-items:center; gap:8px; color:var(--shared); }
.invite{ background:var(--surface); border-radius:12px; padding:12px; display:flex; flex-direction:column; gap:10px; }
.invite + .invite{ margin-top:8px; }
.invite-t{ font-weight:600; }
.invite-m{ font-size:13px; color:var(--ink-3); }
.invite-a{ display:flex; gap:8px; }
.invite-a .btn{ flex:1; min-height:40px; font-size:14.5px; }

/* ---------- العرض الشهري ---------- */
.month-head{ display:flex; align-items:center; justify-content:space-between; gap:8px; margin-bottom:6px; }
.month-title{ text-align:center; flex:1; }
.month-title h2{ margin:0; font-family:var(--display); font-weight:600; font-size:24px; line-height:1.35; }
.month-title p{ margin:0; font-size:13.5px; color:var(--gold); font-weight:600; }
.month-title.hijri-mode h2{ color:var(--ink); }
.month-title.hijri-mode p{ color:var(--ink-3); }
.month-ctrl{ display:flex; align-items:center; justify-content:space-between; gap:10px; margin:10px 0 12px; }
.month-ctrl .seg{ width:170px; }
.grid-week, .grid{ display:grid; grid-template-columns:repeat(7, 1fr); }
.grid-week{ font-size:12px; font-weight:600; color:var(--ink-3); text-align:center; padding-bottom:6px; }
.grid{ background:var(--surface); border-radius:var(--r-group); box-shadow:var(--shadow); padding:6px; gap:2px; }
.cell{
  position:relative; aspect-ratio:1/1.12; min-height:48px; border:0; background:none; border-radius:10px;
  display:flex; flex-direction:column; align-items:center; justify-content:flex-start; padding-top:6px; gap:0;
}
.cell .n{ font-size:17px; font-weight:600; line-height:1.2; }
.cell .s{ font-size:10.5px; color:var(--gold); line-height:1.2; }
.grid.hijri-mode .cell .s{ color:var(--ink-3); }
.cell.out{ visibility:hidden; }
.cell.weekend .n{ color:var(--ink-2); }
.cell.today .n{ color:var(--primary); }
.cell.today::before{ content:""; position:absolute; inset:2px; border:2px solid var(--primary); border-radius:10px; pointer-events:none; }
.cell.sel{ background:var(--primary); }
.cell.sel .n, .cell.sel .s{ color:var(--primary-ink); }
.dots{ display:flex; gap:3px; margin-top:auto; padding-bottom:6px; }
.dots i{ width:5px; height:5px; border-radius:50%; background:var(--primary); }
.dots i.sa{ background:var(--gold); }
.dots i.shared{ background:var(--shared); }
.cell.sel .dots i{ background:var(--primary-ink); }
.day-panel{ margin-top:18px; }
.day-panel .group-h{ align-items:center; }
.day-panel .day-sub{ color:var(--gold); font-weight:600; font-size:13px; }

/* ---------- الشريط السفلي ---------- */
.tabbar{
  position:fixed; inset:auto 0 0 0; z-index:20;
  display:grid; grid-template-columns:repeat(5, 1fr); align-items:center;
  height:calc(var(--tabbar-h) + env(safe-area-inset-bottom));
  padding:0 max(8px, env(safe-area-inset-right)) env(safe-area-inset-bottom) max(8px, env(safe-area-inset-left));
  background:color-mix(in srgb, var(--surface) 88%, transparent);
  -webkit-backdrop-filter:saturate(1.6) blur(16px); backdrop-filter:saturate(1.6) blur(16px);
  border-top:1px solid var(--line);
}
.tab{ border:0; background:none; display:flex; flex-direction:column; align-items:center; gap:2px; color:var(--ink-3); font-size:11.5px; font-weight:600; min-height:52px; justify-content:center; }
.tab.on{ color:var(--primary); }
.tab-add{ justify-self:center; width:54px; height:54px; border-radius:50%; border:0; background:var(--primary); color:var(--primary-ink); display:grid; place-items:center; box-shadow:0 6px 16px color-mix(in srgb, var(--primary) 40%, transparent); transform:translateY(-10px); }
.tab-add .ico{ width:28px; height:28px; stroke-width:2.2; }
.tab-add:active{ transform:translateY(-10px) scale(.94); }

/* ---------- النوافذ (Sheets) ---------- */
dialog.sheet{
  border:0; padding:0; margin:auto auto 0; width:100%; max-width:560px;
  max-height:calc(100dvh - env(safe-area-inset-top) - 18px);
  background:var(--bg); color:var(--ink);
  border-radius:var(--r-sheet) var(--r-sheet) 0 0;
  box-shadow:0 -10px 40px rgba(0,0,0,.25);
  overflow:hidden; display:flex; flex-direction:column;
}
dialog.sheet:not([open]){ display:none; }
dialog.sheet:focus{ outline:none; }
dialog.sheet::backdrop{ background:rgba(8,16,13,.45); }
dialog.sheet[open]{ animation:sheetUp .28s cubic-bezier(.2,.8,.2,1); }
dialog.sheet.closing{ animation:sheetDown .2s ease-in forwards; }
@keyframes sheetUp{ from{ transform:translateY(100%); } }
@keyframes sheetDown{ to{ transform:translateY(100%); } }
.sheet-h{ position:relative; display:flex; align-items:center; justify-content:space-between; gap:10px; padding:14px 16px 10px 10px; flex:none; }
.sheet-h h2{ margin:0; font-size:18px; font-weight:700; }
.sheet-h .grip{ position:absolute; top:6px; left:50%; width:38px; height:5px; border-radius:9px; background:var(--line); transform:translateX(-50%); }
.sheet-b{ flex:1 1 auto; min-height:0; overflow:auto; padding:4px 16px calc(env(safe-area-inset-bottom) + 20px); display:flex; flex-direction:column; gap:16px; -webkit-overflow-scrolling:touch; overscroll-behavior:contain; }
.sheet-b > *{ flex-shrink:0; }
.sheet.small{ max-width:420px; }
.sheet.tall{ height:calc(100dvh - env(safe-area-inset-top) - 18px); }
.sheet-t{ display:flex; align-items:center; gap:2px; min-width:0; }
.sheet-t .back-btn{ margin-inline-start:-8px; color:var(--primary); }
.sheet-f{ flex:none; padding:12px 16px calc(env(safe-area-inset-bottom) + 14px); border-top:1px solid var(--line); background:var(--bg); display:flex; flex-direction:column; gap:8px; }
.sheet:has(.sheet-f) .sheet-b{ padding-bottom:16px; }
.sticky-chips{ position:sticky; top:-4px; box-shadow:0 1px 0 var(--line); z-index:3; background:var(--bg); margin:-4px -16px 0; padding:8px 16px 10px; }
@media (min-width:700px){
  dialog.sheet{ margin:auto; border-radius:var(--r-sheet); max-height:86vh; }
  dialog.sheet[open]{ animation:pop .2s ease-out; }
  dialog.sheet.closing{ animation:fade .15s ease-in forwards; }
  .sheet-h .grip{ display:none; }
  @keyframes pop{ from{ transform:scale(.96); opacity:0; } }
  @keyframes fade{ to{ opacity:0; } }
}
.card{ background:var(--surface); border-radius:var(--r-group); padding:14px 16px; box-shadow:var(--shadow); }
.card.flush{ padding:0 16px; }
.card.flush > .switch-row + .switch-row{ border-top:1px solid var(--line); }
.actions{ display:flex; gap:10px; flex-wrap:wrap; }
.actions .btn{ flex:1 1 140px; }
.stack{ display:flex; flex-direction:column; gap:10px; }

/* قائمة إعدادات */
.menu{ background:var(--surface); border-radius:var(--r-group); overflow:hidden; box-shadow:var(--shadow); }
.menu-item{ width:100%; display:flex; align-items:center; gap:12px; min-height:56px; padding:10px 14px; border:0; border-bottom:1px solid var(--line); background:none; text-align:right; font-weight:600; }
.menu-item:last-child{ border-bottom:0; }
.menu-item:active{ background:var(--surface-2); }
.menu-item .mi{ width:34px; height:34px; border-radius:10px; display:grid; place-items:center; background:var(--primary-soft); color:var(--primary); flex:none; }
.menu-item .mi .ico{ width:19px; height:19px; }
.menu-item .mi.gold{ background:var(--gold-soft); color:var(--gold); }
.menu-item .mi.blue{ background:var(--shared-soft); color:var(--shared); }
.menu-item .mi.red{ background:var(--danger-soft); color:var(--danger); }
.menu-item .txt{ flex:1; }
.menu-item .txt small{ display:block; font-weight:400; color:var(--ink-3); font-size:13px; }
.menu-item .chev{ color:var(--ink-3); width:18px; height:18px; }
.menu-item.danger{ color:var(--danger); }
.menu-item .badge{ position:static; border:0; }

/* تفاصيل الموعد */
.detail-hero{ text-align:center; padding:6px 0 2px; }
.detail-hero .kind{ display:inline-flex; align-items:center; gap:6px; font-size:12.5px; font-weight:600; padding:4px 12px; border-radius:99px; background:var(--primary-soft); color:var(--primary); }
.detail-hero .kind.sa, .detail-hero .kind.hijri{ background:var(--gold-soft); color:var(--gold); }
.detail-hero .kind.shared{ background:var(--shared-soft); color:var(--shared); }
.detail-hero h3{ margin:10px 0 4px; font-size:23px; line-height:1.4; font-weight:700; }
.detail-hero .rel{ font-family:var(--display); font-size:20px; color:var(--primary); font-weight:600; }
.detail-hero .rel.past{ color:var(--ink-3); }
.detail-hero .anniv{ font-size:14px; color:var(--gold); font-weight:600; margin-top:2px; }
.kv{ display:flex; justify-content:space-between; align-items:flex-start; gap:16px; padding:11px 0; border-bottom:1px solid var(--line); font-size:15px; }
.kv:last-child{ border-bottom:0; }
.kv > span:first-child{ color:var(--ink-3); flex:none; }
.kv > span:last-child{ text-align:left; font-weight:600; }
.kv.note{ flex-direction:column; gap:4px; }
.kv.note > span:last-child{ text-align:right; font-weight:400; white-space:pre-wrap; line-height:1.8; }

/* منتقي التاريخ */
.datepick{ display:flex; flex-direction:column; gap:10px; }
.hijri-row{ display:grid; grid-template-columns:1fr 1.7fr 1.3fr; gap:8px; }
.conv{ font-size:13.5px; color:var(--ink-2); display:flex; align-items:center; gap:6px; }
.conv b{ font-weight:600; color:var(--gold); }
.conv.g b{ color:var(--primary); }

/* المدة */
.result{ text-align:center; padding:18px 14px; }
.result .big{ font-family:var(--display); font-weight:600; font-size:24px; line-height:1.5; color:var(--primary); }
.result .sub{ color:var(--ink-2); font-size:14.5px; margin-top:6px; }
.result .dir{ color:var(--ink-3); font-size:13px; margin-top:4px; }

/* المستخدمون */
.pick{ display:flex; align-items:center; gap:12px; min-height:54px; padding:8px 14px; border-bottom:1px solid var(--line); cursor:pointer; }
.pick:last-child{ border-bottom:0; }
.pick input{ width:22px; height:22px; accent-color:var(--primary); flex:none; }
.pick .who{ flex:1; font-weight:600; }
.pick .who small{ display:block; color:var(--ink-3); font-weight:400; font-size:13px; }
.chips{ display:flex; gap:8px; overflow-x:auto; padding-bottom:2px; scrollbar-width:none; }
.chips::-webkit-scrollbar{ display:none; }
.chip{ flex:none; border:1px solid var(--line); background:var(--surface); border-radius:99px; padding:6px 13px; font-size:13.5px; font-weight:600; display:inline-flex; gap:6px; align-items:center; }
.chip b{ font-weight:700; color:var(--primary); }
.chip.on{ background:var(--primary); border-color:var(--primary); color:var(--primary-ink); }
.chip.on b{ color:var(--primary-ink); }
.user-card{ background:var(--surface); border-radius:var(--r-group); padding:14px; box-shadow:var(--shadow); display:flex; flex-direction:column; gap:10px; }
.user-card .uh{ display:flex; justify-content:space-between; gap:10px; }
.user-card .un{ font-weight:700; }
.user-card .ue{ font-size:13px; color:var(--ink-3); direction:ltr; text-align:right; word-break:break-all; }
.status{ font-size:12px; font-weight:600; padding:3px 10px; border-radius:99px; background:var(--surface-2); color:var(--ink-2); height:fit-content; white-space:nowrap; }
.status.pending{ background:var(--gold-soft); color:var(--gold); }
.status.approved{ background:var(--primary-soft); color:var(--primary); }
.status.disabled, .status.rejected, .status.deleted{ background:var(--danger-soft); color:var(--danger); }
.user-card .ua{ display:flex; gap:8px; flex-wrap:wrap; align-items:center; }
.user-card .ua .btn{ min-height:38px; font-size:14px; padding:0 14px; }
.user-card select{ min-height:40px; font-size:14.5px; padding:6px 12px; border-radius:10px; border:1px solid var(--line); background:var(--surface); flex:1; }

.bk{ display:flex; align-items:center; gap:10px; padding:12px 14px; border-bottom:1px solid var(--line); }
.bk:last-child{ border-bottom:0; }
.bk .bt{ flex:1; }
.bk .bt small{ display:block; color:var(--ink-3); font-size:12.5px; }
.bk .btn{ min-height:36px; padding:0 12px; font-size:13.5px; }

.sa-opt{ display:flex; align-items:flex-start; gap:12px; padding:12px 14px; border-bottom:1px solid var(--line); cursor:pointer; }
.sa-opt:last-child{ border-bottom:0; }
.sa-opt input{ width:22px; height:22px; margin-top:2px; accent-color:var(--primary); flex:none; }
.sa-opt .t{ font-weight:600; }
.sa-opt .t small{ display:block; font-weight:400; font-size:13px; color:var(--ink-3); }
.sa-opt .count{ margin-inline-start:auto; font-size:12px; color:var(--primary); font-weight:600; white-space:nowrap; }

/* التنبيه */
.toast{
  position:fixed; z-index:100; left:50%; bottom:calc(var(--tabbar-h) + env(safe-area-inset-bottom) + 18px);
  transform:translate(-50%, 20px); opacity:0; pointer-events:none;
  background:var(--ink); color:var(--bg); padding:11px 18px; border-radius:14px; font-weight:600; font-size:14.5px;
  max-width:calc(100vw - 32px); width:max-content; text-align:center; transition:opacity .2s, transform .2s;
}
.toast.show{ opacity:1; transform:translate(-50%, 0); }
.toast.err{ background:var(--danger); color:#fff; }
body:has(dialog[open]) .toast{ bottom:calc(env(safe-area-inset-bottom) + 24px); }

@media (prefers-reduced-motion: reduce){
  *, *::before, *::after{ animation-duration:.01ms !important; transition-duration:.01ms !important; }
}

/* تعيين كلمة مرور جديدة */
.reset-for{ margin:0; color:var(--ink-2); font-size:14px; }
.reset-for b{ color:inherit; font-weight:700; }
.field .pw-toggle{ float:left; padding:0 4px; font-size:13px; }
.form-msg{ white-space:pre-line; }

/* النوافذ: الصفحة الخلفية لا تتحرك */
html.modal-open, html.modal-open body{ overflow:hidden; overscroll-behavior:none; }
dialog.sheet{ overscroll-behavior:contain; }
/* أزرار تصفية الإدارة تلتف لسطرين بدل أن يختفي آخرها */
.sticky-chips{ flex-wrap:wrap; overflow:visible; }
