/* خلفية الكمبيوتر الكحلية تبعت صفحة التطبيق كانت بتخفي عناوين اللوحة */
body.admin { background: var(--bg); }
.admin .wrap { max-width: 880px; margin: 0 auto; }
.admin .top-row.wrap { padding: 12px 20px; }
.admin main { padding: 28px 20px 60px; }
.top-acts { display: flex; gap: 8px; }
.ghost { display: inline-flex; align-items: center; justify-content: center; min-height: 40px; padding: 0 14px; border: 1px solid var(--line); background: var(--surface); border-radius: var(--r); text-decoration: none; cursor: pointer; font-size: 14px; }
.ghost.danger { color: #b42318; border-color: color-mix(in srgb, #b42318 35%, transparent); }
:root[data-theme="dark"] .ghost.danger { color: #ff8a80; }
.muted { color: var(--muted); }
.err { color: #b42318; font-size: 14px; margin: 8px 0 0; min-height: 1em; }
:root[data-theme="dark"] .err { color: #ff8a80; }

.login { max-width: 360px; margin: 40px auto; }
.login h1 { font-size: 24px; margin: 0; }
.login p { color: var(--muted); margin: 4px 0 18px; }
.login form { display: grid; gap: 10px; }
.login input { height: 50px; font-size: 20px; text-align: center; letter-spacing: 0.3em; }

input, select { font: inherit; color: var(--text); background: var(--surface); border: 1px solid var(--line-strong); border-radius: var(--r); height: 46px; padding: 0 12px; width: 100%; font-size: 16px; }
input[dir="ltr"] { font-family: "FT", "NS", sans-serif; text-align: left; }
input[dir="ltr"]::placeholder { text-align: right; font-family: "NS", "FT", sans-serif; }

.panel-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 18px; }
.panel-head h1 { margin: 0; font-size: 24px; }
.panel-head p { margin: 2px 0 0; font-size: 14px; }
.panel-head .btn { height: 44px; }
.days button.day { font: inherit; color: inherit; }
.days button.day[aria-current="true"] { color: var(--btn-ink); }
.admin .days { padding: 0; margin-bottom: 14px; }
@media (min-width: 700px) { .admin .days { grid-template-columns: repeat(8, minmax(0, 1fr)); } }
/* العميل 23 نوفمبر (رسمة): بحث وزر إضافة صغير بسطر، وتحتهم مستطيلات السنين ملونة وبس */
.a-tools { display: flex; gap: 8px; align-items: flex-start; }
.a-tools .a-q { flex: 1; width: auto; min-width: 0; }
#evAdd { flex: none; height: 46px; margin-bottom: 12px; padding: 0 18px; background: #b1302a; border-color: #b1302a; color: #fff; }
#evAdd[hidden] { display: none; }
#years { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin-bottom: 14px; }
#years[hidden] { display: none; }
#years button { height: 48px; padding: 0 4px; border: 0; border-radius: var(--r); background: #182a56; color: #f4eee3; font-size: 16px; font-weight: 700; cursor: pointer; }
@media (min-width: 700px) { #years { grid-template-columns: repeat(6, minmax(0, 1fr)); } }

.a-list { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); }
.a-row { display: grid; grid-template-columns: 1fr auto; gap: 12px; align-items: center; padding: 14px 16px; border-top: 1px solid var(--line); }
.a-row:first-child { border-top: 0; }
.a-row b { display: block; font-size: 16px; }
.a-row .sub { color: var(--muted); font-size: 13px; line-height: 1.6; }
.a-row .flags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.flag { font-size: 12px; border: 1px solid var(--line); padding: 1px 8px; border-radius: 4px; color: var(--muted); }
.flag.warn { color: #9a5b00; border-color: color-mix(in srgb, #9a5b00 40%, transparent); }
:root[data-theme="dark"] .flag.warn { color: #f5c26b; }
.a-acts { display: flex; gap: 6px; }
.a-acts .icon-btn:disabled { opacity: 0.35; cursor: default; }
.a-acts .ghost { min-height: 40px; }

dialog { border: 1px solid var(--line-strong); border-radius: 10px; padding: 0; width: min(560px, calc(100vw - 24px)); max-height: calc(100dvh - 24px); background: var(--surface); color: var(--text); }
dialog::backdrop { background: rgba(10, 14, 22, 0.45); }
dialog form { display: flex; flex-direction: column; max-height: calc(100dvh - 26px); }
.dlg-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.dlg-head h2 { margin: 0; font-size: 18px; }
.dlg-body { padding: 16px 18px; overflow-y: auto; display: grid; gap: 14px; }
.dlg-foot { display: flex; gap: 10px; justify-content: space-between; padding: 14px 18px; border-top: 1px solid var(--line); }
.dlg-foot .btn { min-width: 140px; }
.f { display: grid; gap: 6px; }
.f > span, .f > label { font-size: 13.5px; color: var(--muted); }
.chips-a { display: flex; flex-wrap: wrap; gap: 6px; }
.chips-a button { border: 1px solid var(--line); background: var(--surface-2); border-radius: 4px; padding: 4px 10px; font-size: 13px; cursor: pointer; }
.phone { display: grid; grid-template-columns: auto 1fr; direction: ltr; }
.phone .num { display: grid; place-items: center; padding: 0 12px; border: 1px solid var(--line-strong); border-right: 0; border-radius: var(--r) 0 0 var(--r); background: var(--surface-2); color: var(--muted); }
.phone input { border-radius: 0 var(--r) var(--r) 0; }
.loc-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.loc-row .muted { font-size: 13px; }
.loc-row a { color: var(--accent); }
.check { display: flex; align-items: center; gap: 10px; font-size: 14px; }
.check input { width: 18px; height: 18px; }

.toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); background: var(--text); color: var(--bg); padding: 10px 18px; border-radius: var(--r); font-size: 14px; opacity: 0; pointer-events: none; transition: opacity 0.2s; }
.toast.show { opacity: 1; }
@media (hover: hover) { .ghost:hover, .chips-a button:hover { border-color: var(--line-strong); } }
@media (max-width: 560px) { .a-row { grid-template-columns: 1fr; } .a-acts { justify-content: flex-start; } }
/* العميل 21 نوفمبر: زر «تعديل» يضل جنب العنصر على الجوال، مش نازل تحته (الأقسام اللي فيها أسهم ترتيب بتضل متل ما هي) */
@media (max-width: 560px) { .a-row:not(:has([data-up])):not(:has(> .sw)) { grid-template-columns: minmax(0, 1fr) auto; gap: 10px; padding: 12px; } .a-row:not(:has([data-up])) .a-acts { justify-content: center; } .a-row:not(:has([data-up])) .a-acts .ghost { padding-inline: 12px; white-space: nowrap; } .a-main { gap: 10px; } .a-main > div { min-width: 0; } }

.inbox { margin-bottom: 22px; }
.inbox h2 { font-size: 17px; margin: 0 0 10px; display: flex; gap: 8px; align-items: center; }
.inbox h2 .num { background: var(--accent); color: #fff; border-radius: 4px; padding: 0 8px; font-size: 13px; }
.inbox .a-row .sub b { color: var(--text); font-size: 13px; display: inline; }

/* الأقسام والصور */
.stabs { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 6px; margin-bottom: 18px; scrollbar-width: none; }
.stabs::-webkit-scrollbar { display: none; }
.stabs button { flex: none; display: inline-flex; align-items: center; gap: 6px; height: 40px; padding: 0 14px; border: 1px solid var(--line); background: var(--surface); border-radius: var(--r); cursor: pointer; font-size: 14px; }
.stabs button .num { font-size: 12px; color: var(--muted); }
.stabs button[aria-current="true"] { background: var(--btn); color: var(--btn-ink); border-color: var(--btn); }
.stabs button[aria-current="true"] .num { color: inherit; opacity: 0.75; }
.stabs button.hot { border-color: var(--accent); color: var(--accent); }
.stabs button.hot[aria-current="true"] { background: var(--accent); color: #fff; }
.a-main { display: flex; gap: 12px; align-items: center; min-width: 0; }
.a-th { flex: none; width: 52px; height: 52px; border-radius: 4px; background: var(--surface-2) center / cover; }
.up-btn { width: fit-content; cursor: pointer; }
.up-one, .up-many { display: flex; flex-wrap: wrap; gap: 8px; }
.up-th { position: relative; width: 84px; height: 84px; border-radius: 4px; background: var(--surface-2) center / cover; border: 1px solid var(--line); }
.up-th button { position: absolute; top: 4px; left: 4px; width: 26px; height: 26px; border: 0; border-radius: 4px; background: rgba(0, 0, 0, 0.65); color: #fff; font-size: 16px; line-height: 1; cursor: pointer; }
.f textarea { font: inherit; color: var(--text); background: var(--surface); border: 1px solid var(--line-strong); border-radius: var(--r); padding: 10px 12px; width: 100%; font-size: 16px; line-height: 1.7; resize: vertical; }

/* التحكم بالأقسام والأشهر */
.stabs .ctl { margin-inline-start: auto; }
.ctl-h { padding: 12px 16px 8px; font-weight: 700; font-size: 14px; color: var(--muted); border-top: 1px solid var(--line); background: var(--bg); }
.ctl-h:first-child { border-top: 0; }
.sw { display: inline-flex; align-items: center; gap: 10px; min-height: 44px; padding: 0 4px; background: none; border: 0; cursor: pointer; font: inherit; color: var(--text); }
.sw .knob { position: relative; width: 50px; height: 28px; border-radius: 14px; background: #b9b2a6; transition: background .2s; flex: none; }
.sw .knob::after { content: ""; position: absolute; top: 3px; inset-inline-start: 3px; width: 22px; height: 22px; border-radius: 50%; background: #fff; transition: transform .2s; box-shadow: 0 1px 2px rgba(0,0,0,.25); }
.sw[aria-checked="true"] .knob { background: #2e7d4f; }
.sw[aria-checked="true"] .knob::after { transform: translateX(-22px); }
.sw-t { min-width: 46px; font-size: 14px; font-weight: 600; }
.sw[aria-checked="false"] .sw-t { color: #b3261e; }
.a-row:has(> .sw) { grid-template-columns: 1fr auto !important; }
.a-row:has(> .sw) > .sw { grid-column: auto !important; }

/* 16 نوفمبر: بحث سريع وعرض المزيد بعد نقل التطبيق القديم */
.a-q { display: block; width: 100%; height: 46px; margin: 0 0 12px; padding: 0 14px; border: 1px solid var(--line); border-radius: var(--r); background: var(--surface); color: inherit; font: inherit; font-size: 16px; }
.a-more { display: block; width: calc(100% - 32px); margin: 12px 16px 14px; }
/* الأخبار: خانة «النوع» تحت وصغيرة (18 نوفمبر) */
.f.f-sm { margin-top: 6px; padding-top: 12px; border-top: 1px dashed var(--line); }
.f.f-sm > span { font-size: 12px; }
.f.f-sm select { height: 40px; width: 160px; max-width: 100%; justify-self: start; align-self: flex-start; }
/* الصور: الاسم والأب والجد والعائلة مربعين مربعين (18 نوفمبر) */
.f-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 10px; }
.f-grid > .f { min-width: 0; }
.f-grid { align-items: start; }
.f-grid small { display: none; }
.f-note { display: block; margin: -4px 0 14px; font-size: 12.5px; line-height: 1.6; }
/* المناسبات: المعرس بسطر واحد، الاسم والأب والجد والعائلة (رسمة العميل 19 نوفمبر) */
.f-name .nr { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; }
.f-name .nr input { padding: 0 8px; min-width: 0; }
.f-more { margin: 4px 0 12px; border-top: 1px dashed var(--line); padding-top: 10px; }
.f-more > summary { cursor: pointer; color: var(--muted); font-size: 14px; margin-bottom: 10px; }
/* التاريخ يوم / شهر / سنة (19 نوفمبر) */
.f-dmy .dmy { direction: rtl; /* العميل 21 نوفمبر: اليوم يمين والشهر بالنص والسنة يسار */ display: grid; grid-template-columns: 1fr auto 1fr auto 1.5fr; align-items: center; gap: 4px; }
.f-dmy .dmy input { text-align: center; padding: 0 4px; min-width: 0; }
.f-dmy .dmy b { color: var(--muted); font-weight: 400; }

/* العميل 21 نوفمبر: خانات التاريخ على الآيفون كانت طالعة عن عرض النموذج */
dialog input[type="date"], .f input[type="date"] { -webkit-appearance: none; appearance: none; display: block; width: 100%; max-width: 100%; min-width: 0; box-sizing: border-box; }
dialog .f { min-width: 0; max-width: 100%; }

/* العميل 21 نوفمبر: شاشة الأقسام أول ما تفتح اللوحة */
.stabs[hidden] { display: none; }
.a-list:has(> .home-grid) { background: transparent; border: 0; }
.home-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.home-tile { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; min-height: 96px; padding: 12px; font: inherit; color: var(--text); background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); cursor: pointer; }
.home-tile b { font-size: 18px; }
.home-tile span { font-size: 13px; color: var(--muted); }
.home-tile.hot { border-color: var(--accent); }
.home-tile.hot b { color: var(--accent); }
@media (min-width: 700px) { .home-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); } }

/* العميل 21 نوفمبر: أزرار الأيام كلها بنفس اللون، بدون أزرق وخط أحمر */
.admin .days button.day, .admin .days button.day.area, .admin .days button.day.today, .admin .days button.day[aria-current="true"], .admin .days button.day.area[aria-current="true"] { background: var(--surface); color: var(--text); border-color: var(--line); box-shadow: none; }
.admin .days button.day[aria-current="true"], .admin .days button.day.area[aria-current="true"] { border-color: var(--text); box-shadow: inset 0 0 0 1px var(--text); }
.admin .days button.day::before { display: none; }
.admin .days button.day small, .admin .days button.day.today small, .admin .days button.day[aria-current="true"] small { color: var(--muted); }

/* العميل 21 نوفمبر: مربعات العوائل بقسم الصور */
.a-list:has(> .fam-wrap) { background: transparent; border: 0; }
.fam-a { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.fam-t { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; min-height: 68px; padding: 6px 3px; font: inherit; color: var(--text); background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); cursor: pointer; min-width: 0; }
.fam-t b { font-size: 13.5px; line-height: 1.35; overflow-wrap: anywhere; }
.fam-t small { font-size: 12px; color: var(--muted); }
.fam-t.off { background: var(--accent); border-color: var(--accent); color: #fff; }
.fam-t.off small { color: #fff; }
.fam-h { margin: 22px 0 10px; font-size: 18px; }
.fam-add { display: block; width: 100%; margin: 0 0 14px; } /* العميل 21 نوفمبر: فوق المربعات عشان تنلقى بسرعة */
.fam-bar { display: flex; justify-content: space-between; gap: 8px; padding: 10px 12px; border-bottom: 1px solid var(--line); }
@media (min-width: 700px) { .fam-a { grid-template-columns: repeat(6, minmax(0, 1fr)); } }

/* العميل 21 نوفمبر: تبويبات الأرشيف */
.arch-tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; padding: 10px 12px; border-bottom: 1px solid var(--line); }
.arch-tabs .ghost { display: inline-flex; align-items: center; justify-content: center; gap: 6px; }
.arch-tabs .ghost.on { border-color: var(--text); box-shadow: inset 0 0 0 1px var(--text); }

/* العميل 21 نوفمبر: إخفاء العائلة من داخلها */
.fam-bar-l { display: inline-flex; gap: 6px; }
.fam-bar .ghost { white-space: nowrap; padding-inline: 10px; }
.fam-bar .ghost.fam-off { background: var(--accent); border-color: var(--accent); color: #fff; }

/* العميل 21 نوفمبر: اسم فوق الرقم بنفس الخانة */
.f-contact { display: grid; gap: 6px; min-width: 0; }
.f-contact input { width: 100%; min-width: 0; box-sizing: border-box; }

/* العميل 22 نوفمبر: كل «إضافة» و«تعديل» بالأحمر عشان يتميزوا */
.admin #addBtn, .admin .fam-add { background: #b1302a; border-color: #b1302a; color: #fff; }
.admin [data-edit], .admin [data-arch-edit], .admin [data-fam-edit], .admin .up-btn:has([data-upn]) { color: var(--accent); border-color: color-mix(in srgb, var(--accent) 55%, transparent); font-weight: 700; }

/* العميل 22 نوفمبر: علامة دائرية حمرا بعد الحفظ أو الإضافة */
.done-mark { position: fixed; inset: 0; z-index: 4000; display: grid; place-items: center; pointer-events: none; opacity: 0; visibility: hidden; transition: opacity .18s ease, visibility .18s; }
.done-mark.show { opacity: 1; visibility: visible; }
.done-mark > div { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; width: 168px; height: 168px; padding: 12px; border-radius: 50%; background: #b1302a; color: #fff; text-align: center; box-shadow: 0 14px 40px rgba(10, 14, 22, .35); }
.done-mark svg { width: 52px; height: 52px; }
.done-mark b { font-size: 18px; line-height: 1.4; font-weight: 700; }

/* العميل 22 نوفمبر: اختيار كويتي أو سعودي فوق خانة الرقم */
.ph-box { display: grid; gap: 6px; min-width: 0; }
.ph-seg { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; padding: 3px; background: var(--surface-2); border-radius: var(--r); }
.ph-seg button { height: 36px; border: 0; border-radius: 4px; background: transparent; color: var(--muted); font: inherit; font-size: 14px; cursor: pointer; }
.ph-seg button[aria-pressed="true"] { background: var(--btn); color: var(--btn-ink); font-weight: 700; }
.ph-in { display: grid; grid-template-columns: auto minmax(0, 1fr); }
.ph-code { display: grid; place-items: center; min-width: 68px; padding: 0 10px; border: 1px solid var(--line-strong); border-right: 0; border-radius: var(--r) 0 0 var(--r); background: var(--surface-2); color: var(--text); font-family: "FT", "NS", sans-serif; font-size: 16px; font-weight: 600; }
.ph-in input { border-radius: 0 var(--r) var(--r) 0; min-width: 0; }
.ph-box[data-mode="other"] .ph-in { grid-template-columns: minmax(0, 1fr); }
.ph-box[data-mode="other"] .ph-code { display: none; }
.ph-box[data-mode="other"] .ph-in input { border-radius: var(--r); }
