/* شاشة الإعدادات + معالج البدء + زر واتساب للسكان (شاشة فقط) */
@media screen{

.nav-settings{--ico:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='3'/%3E%3Cpath d='M19.4 15a1.7 1.7 0 0 0 .3 1.8l.1.1a2 2 0 1 1-2.8 2.8l-.1-.1a1.7 1.7 0 0 0-1.8-.3 1.7 1.7 0 0 0-1 1.5V21a2 2 0 1 1-4 0v-.1a1.7 1.7 0 0 0-1.1-1.5 1.7 1.7 0 0 0-1.8.3l-.1.1a2 2 0 1 1-2.8-2.8l.1-.1a1.7 1.7 0 0 0 .3-1.8 1.7 1.7 0 0 0-1.5-1H3a2 2 0 1 1 0-4h.1a1.7 1.7 0 0 0 1.5-1.1 1.7 1.7 0 0 0-.3-1.8l-.1-.1a2 2 0 1 1 2.8-2.8l.1.1a1.7 1.7 0 0 0 1.8.3H9a1.7 1.7 0 0 0 1-1.5V3a2 2 0 1 1 4 0v.1a1.7 1.7 0 0 0 1 1.5 1.7 1.7 0 0 0 1.8-.3l.1-.1a2 2 0 1 1 2.8 2.8l-.1.1a1.7 1.7 0 0 0-.3 1.8V9a1.7 1.7 0 0 0 1.5 1H21a2 2 0 1 1 0 4h-.1a1.7 1.7 0 0 0-1.5 1z'/%3E%3C/svg%3E");}

/* ---------- بطاقات الإعدادات ---------- */
#ssbSettingsRoot{display:grid;gap:14px;margin-top:14px;}
.set-card{padding:16px 18px;border-radius:20px;background:var(--surface);border:1px solid var(--hair);box-shadow:var(--shadow-sm);}
.set-head{display:flex;align-items:flex-start;gap:12px;margin-bottom:12px;}
.set-head h3{margin:0;font-size:17px;font-weight:800;color:var(--ink);}
.set-head p{margin:3px 0 0;font-size:12.5px;font-weight:600;color:var(--muted-ink);line-height:1.7;}
.set-ico{flex:0 0 auto;width:40px;height:40px;border-radius:12px;background:var(--pine-50);border:1px solid var(--hair);position:relative;}
.set-ico::after{content:"";position:absolute;inset:9px;background:var(--pine-700);-webkit-mask:var(--i) center/contain no-repeat;mask:var(--i) center/contain no-repeat;}
.ico-building{--i:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4 21V5l8-3v19M12 21V8l8 3v10M2 21h20M7 8h2M7 12h2M7 16h2M15 13h2M15 17h2'/%3E%3C/svg%3E");}
.ico-money{--i:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='2' y='6' width='20' height='12' rx='2'/%3E%3Ccircle cx='12' cy='12' r='2.5'/%3E%3Cpath d='M6 12h.01M18 12h.01'/%3E%3C/svg%3E");}
.ico-people{--i:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='9' cy='8' r='3.5'/%3E%3Cpath d='M2.5 20a6.5 6.5 0 0 1 13 0M16 4.5a3.5 3.5 0 0 1 0 7M18 14a6 6 0 0 1 3.5 6'/%3E%3C/svg%3E");}
.ico-gear{--i:var(--ico-x);}
.ico-gear{--i:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.8' stroke-linecap='round'%3E%3Cpath d='M4 6h10M18 6h2M4 12h4M12 12h8M4 18h12M20 18h0'/%3E%3Ccircle cx='16' cy='6' r='2'/%3E%3Ccircle cx='10' cy='12' r='2'/%3E%3Ccircle cx='18' cy='18' r='2'/%3E%3C/svg%3E");}
.set-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:10px 14px;}
.set-grid.one{grid-template-columns:1fr;}
.set-grid .span2{grid-column:1/-1;}
.set-grid label,.set-res label{display:flex;flex-direction:column;gap:5px;font-size:13px;font-weight:800;color:var(--ink-2);}
.set-grid input,.set-res input,.wiz-res input,.wiz-res-tools textarea{height:46px;margin:0!important;padding:0 12px!important;border-radius:12px!important;border:1.5px solid var(--hair-2)!important;background:var(--surface)!important;font-size:15px!important;font-weight:700;text-align:start!important;color:var(--ink);}
.set-grid input:focus,.set-res input:focus,.wiz-res input:focus{border-color:var(--pine-600)!important;box-shadow:0 0 0 3px rgba(28,106,96,.15)!important;outline:0;}
.set-grid small{font-size:11.5px;font-weight:600;color:var(--muted-ink);}
.set-note{display:flex;flex-direction:column;gap:6px;padding:10px 12px;border-radius:12px;background:var(--surface-2);border:1px dashed var(--hair-2);}
.set-note b{font-size:14px;color:var(--ink);} .set-note span{font-size:12.5px;font-weight:600;color:var(--muted-ink);line-height:1.7;}
.set-actions{display:flex;flex-wrap:wrap;gap:8px;justify-content:flex-end;margin-top:12px;}
.set-primary,.set-secondary{height:44px!important;min-height:44px;padding:0 18px!important;border-radius:12px!important;font-size:14.5px!important;font-weight:800!important;box-shadow:none!important;}
.set-primary{background:linear-gradient(180deg,#1f5a51,#123d37)!important;color:#fff!important;border:1px solid #0e322d!important;}
.set-secondary{background:var(--surface)!important;color:var(--pine-800)!important;border:1.5px solid #c9d8d1!important;}
html[data-theme="dark"] .set-secondary{background:var(--surface-2)!important;color:var(--ink)!important;border-color:var(--hair-2)!important;}

/* السكان */
.set-res-list{display:grid;gap:8px;}
.set-res{display:grid;grid-template-columns:30px minmax(150px,2fr) minmax(130px,1.4fr) repeat(3,minmax(70px,.8fr)) auto;gap:8px;align-items:end;padding:10px;border-radius:14px;background:var(--surface-2);border:1px solid var(--hair);}
.set-res-n{align-self:center;width:28px;height:28px;border-radius:50%;display:grid;place-items:center;background:var(--pine-700);color:#fff;font-size:12px;font-weight:800;}
.set-res input{height:42px;font-size:14px!important;}
.set-res-act{display:flex;gap:6px;align-items:center;}
.set-del{width:42px;height:42px!important;min-height:42px;padding:0!important;border-radius:12px!important;background:var(--bad-50)!important;color:var(--bad)!important;border:1.5px solid #ecc4ba!important;font-size:20px!important;font-weight:800;box-shadow:none!important;}
@media (max-width:760px){
  .set-grid{grid-template-columns:1fr;}
  .set-res{grid-template-columns:repeat(3,minmax(0,1fr));grid-template-areas:"n n n" "p p p" "f a fee" "act act act";}
  .set-res-n{display:none;}
  .set-res .w-name{grid-area:n;} .set-res .w-phone{grid-area:p;}
  .set-res .w-sm:nth-of-type(3){grid-area:f;} .set-res .w-sm:nth-of-type(4){grid-area:a;} .set-res .w-sm:nth-of-type(5){grid-area:fee;}
  .set-res-act{grid-area:act;justify-content:flex-end;}
  .set-actions>button{flex:1 1 auto;}
}

/* ---------- زر واتساب بجانب اسم الساكن ---------- */
.ssb-wa-mini{
  flex:0 0 auto;display:inline-grid;place-items:center;width:26px;height:26px!important;min-height:26px!important;padding:0!important;border-radius:8px!important;
  background:#1fa855!important;color:#fff!important;border:0!important;box-shadow:none!important;cursor:pointer;
}
.ssb-wa-mini .wa-i{display:block;width:17px;height:17px;background:currentColor;-webkit-mask:var(--ico-wa) center/contain no-repeat;mask:var(--ico-wa) center/contain no-repeat;}
.ssb-wa-mini.lg{width:42px;height:42px!important;min-height:42px!important;border-radius:12px!important;}
.ssb-wa-mini.lg .wa-i{width:22px;height:22px;}
#paymentsWrap .resident-name-wrap{display:flex;align-items:center;gap:4px;}
#paymentsWrap .name-cell{position:relative;}
.ssb-res-meta{display:block;font-size:10.5px;font-weight:700;color:var(--muted-ink);text-align:center;line-height:1.2;margin-top:1px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;}

/* ---------- معالج البدء ---------- */
#setupWizardModal .setup-box{position:relative;width:min(640px,96vw);padding:22px 22px 18px;border-radius:24px;background:var(--surface);}
.wiz-close{position:absolute;top:12px;left:12px;right:auto;z-index:2;width:36px;height:36px!important;min-height:36px;padding:0!important;border-radius:11px!important;background:rgba(255,255,255,.15)!important;color:#fff!important;border:1px solid rgba(255,255,255,.3)!important;font-size:20px!important;box-shadow:none!important;}
.wiz-hero{margin:-22px -22px 16px;border-radius:24px 24px 0 0;overflow:hidden;color:#fff;
  background:radial-gradient(420px 200px at 0% 0%,rgba(184,134,47,.35),transparent 65%),linear-gradient(140deg,#1c6a60,#082220);}
.wiz-hero-art{height:150px;background:linear-gradient(0deg,rgba(8,34,32,.85),rgba(8,34,32,0) 70%),url("../img/login-building.svg") center bottom/cover no-repeat;}
.wiz-hero-text{padding:4px 22px 20px;display:flex;flex-direction:column;gap:6px;}
.wiz-kicker{font-size:12px;font-weight:800;color:#ecd6a8;}
.wiz-hero h2{margin:0;font-size:22px;font-weight:800;color:#fff;}
.wiz-hero p{margin:0;font-size:14px;font-weight:600;line-height:1.8;color:#d6e8e1;}
.wiz-feats{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:10px;margin-bottom:16px;}
.wiz-feats>div{display:flex;flex-direction:column;align-items:center;text-align:center;gap:6px;padding:12px 8px;border-radius:14px;background:var(--surface-2);border:1px solid var(--hair);}
.wiz-feats b{width:32px;height:32px;border-radius:50%;display:grid;place-items:center;background:linear-gradient(180deg,#c99a42,#a3741f);color:#fff;font-size:15px;}
.wiz-feats span{font-size:13.5px;font-weight:800;color:var(--ink);line-height:1.5;}
.wiz-feats small{font-size:11.5px;font-weight:600;color:var(--muted-ink);}
.wiz-progress{display:flex;justify-content:space-between;gap:4px;margin:4px 0 16px;padding-inline-end:40px;}
.wiz-progress span{flex:1;display:flex;flex-direction:column;align-items:center;gap:4px;position:relative;}
.wiz-progress span::before{content:"";position:absolute;top:14px;inset-inline-start:50%;width:100%;height:3px;background:var(--hair);z-index:0;}
.wiz-progress span:last-child::before{display:none;}
.wiz-progress span.done::before{background:var(--pine-600);}
.wiz-progress i{position:relative;z-index:1;width:30px;height:30px;border-radius:50%;display:grid;place-items:center;font-style:normal;font-size:13px;font-weight:800;background:var(--surface-2);color:var(--muted-ink);border:2px solid var(--hair-2);}
.wiz-progress .on i{background:var(--brass,#b8862f);color:#fff;border-color:var(--brass,#b8862f);box-shadow:0 0 0 4px rgba(184,134,47,.2);}
.wiz-progress .done i{background:var(--pine-600);color:#fff;border-color:var(--pine-600);}
.wiz-progress em{font-style:normal;font-size:11px;font-weight:800;color:var(--muted-ink);}
.wiz-progress .on em{color:var(--ink);}
.wiz-title{margin:0 0 4px;font-size:19px;font-weight:800;color:var(--ink);}
.wiz-lead{margin:0 0 14px;font-size:13px;font-weight:600;color:var(--muted-ink);line-height:1.8;}
.wiz-nav{display:flex;justify-content:space-between;gap:10px;margin-top:18px;}
.wiz-nav button{flex:1;}
.wiz-res{display:grid;gap:8px;max-height:42vh;overflow:auto;padding:2px;}
.wiz-res-row{display:grid;grid-template-columns:minmax(0,2fr) minmax(0,1.5fr) minmax(0,.8fr) minmax(0,.8fr) 42px;gap:6px;}
.wiz-res-row input{height:42px;font-size:14px!important;padding:0 10px!important;}
.wiz-res-tools{display:flex;flex-wrap:wrap;gap:8px;align-items:flex-start;margin-top:10px;}
.wiz-res-tools details{flex:1 1 220px;}
.wiz-res-tools summary{cursor:pointer;font-size:13px;font-weight:800;color:var(--pine-700);padding:10px 0;}
.wiz-res-tools textarea{width:100%;height:auto!important;min-height:90px;padding:10px!important;margin:4px 0 8px!important;}
.wiz-done{text-align:center;}
.wiz-check{width:64px;height:64px;margin:4px auto 10px;border-radius:50%;background:linear-gradient(180deg,#25b064,#178a4b);position:relative;box-shadow:0 12px 26px -12px rgba(19,119,63,.8);}
.wiz-check::after{content:"";position:absolute;inset:18px;background:#fff;-webkit-mask:var(--ico-check) center/contain no-repeat;mask:var(--ico-check) center/contain no-repeat;}
.wiz-summary{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:8px;}
.wiz-summary>div{padding:10px 12px;border-radius:12px;background:var(--surface-2);border:1px solid var(--hair);display:flex;flex-direction:column;gap:2px;}
.wiz-summary span{font-size:11.5px;font-weight:700;color:var(--muted-ink);}
.wiz-summary b{font-size:15px;font-weight:800;color:var(--ink);overflow:hidden;text-overflow:ellipsis;white-space:nowrap;}
@media (max-width:620px){
  #setupWizardModal{padding:0!important;align-items:stretch!important;}
  #setupWizardModal .setup-box{width:100vw;max-width:100vw;min-height:100dvh;max-height:100dvh;border-radius:0;padding:18px 16px calc(16px + var(--sa-bottom,0px));overflow:auto;}
  .wiz-hero{margin:-18px -16px 14px;border-radius:0;padding-top:var(--sa-top,0px);}
  .wiz-close{top:calc(10px + var(--sa-top,0px));}
  .wiz-feats{grid-template-columns:1fr;}
  .wiz-feats>div{flex-direction:row;text-align:start;}
  .wiz-res-row{grid-template-columns:repeat(4,minmax(0,1fr)) 42px;grid-template-areas:"n n n n d" "p p f a d";}
  .wiz-res-row [data-wf="name"]{grid-area:n;} .wiz-res-row [data-wf="phone"]{grid-area:p;} .wiz-res-row [data-wf="floor"]{grid-area:f;} .wiz-res-row [data-wf="apartment"]{grid-area:a;} .wiz-res-row .set-del{grid-area:d;height:auto!important;}
  .wiz-progress em{font-size:10px;}
}
html[data-theme="dark"] #setupWizardModal .setup-box{background:var(--surface)!important;}
html[data-theme="dark"] .set-grid input,html[data-theme="dark"] .set-res input,html[data-theme="dark"] .wiz-res input,html[data-theme="dark"] .wiz-res-tools textarea{background:#0f1c19!important;color:var(--ink)!important;}
html[data-theme="dark"] .set-ico::after{background:#9fd8c6;}
html.is-native-app .set-card{padding:12px!important;border-radius:16px!important;}
html.is-native-app .set-head h3{font-size:15px!important;}
html.is-native-app .set-head p{font-size:11.5px!important;}
html.is-native-app .set-grid input{height:40px!important;font-size:14px!important;}
html.is-native-app .set-primary,html.is-native-app .set-secondary{height:40px!important;min-height:40px!important;font-size:13px!important;}
}
@media screen{
.set-res-toolbar{display:flex;justify-content:flex-start;margin:0 0 10px;}
.set-res-toolbar .set-add-btn{min-width:170px;}
.set-add-form{margin:0 0 12px;padding:14px;border-radius:16px;background:linear-gradient(180deg,#f3f8f5,#fbf8f1);border:1.5px solid #cfe0d8;box-shadow:0 10px 24px -18px rgba(11,43,40,.6);animation:setAddIn .18s ease-out;}
.set-add-form.hidden,.set-res-toolbar .hidden{display:none!important;}
@keyframes setAddIn{from{opacity:0;transform:translateY(-6px)}to{opacity:1;transform:none}}
.set-add-title{font-size:var(--fs-h,17px);font-weight:700;color:var(--t-strong,#10201b);margin-bottom:10px;}
.set-add-grid{display:grid;grid-template-columns:minmax(0,2fr) minmax(0,1.4fr) repeat(3,minmax(0,.8fr));gap:10px;}
.set-add-grid label{display:flex;flex-direction:column;gap:5px;font-size:var(--fs-label,14px);font-weight:700;color:var(--t-body,#22332d);}
.set-add-grid input{height:46px;margin:0!important;padding:0 12px!important;border-radius:12px!important;border:1.5px solid var(--hair-2)!important;background:#fff!important;font-size:var(--fs-body,15px)!important;font-weight:700;text-align:start!important;color:var(--t-strong);}
.set-add-grid input:focus{border-color:var(--pine-600)!important;box-shadow:0 0 0 3px rgba(28,106,96,.15)!important;outline:0;}
.set-res.set-res-new{border-color:#2b7a4b!important;box-shadow:0 0 0 3px rgba(43,122,75,.22)!important;transition:box-shadow .3s;}
html[data-theme="dark"] .set-add-form{background:linear-gradient(180deg,#15302b,#172723);border-color:#2c5a51;}
html[data-theme="dark"] .set-add-grid input{background:#0f1c19!important;}
@media (max-width:760px){.set-add-grid{grid-template-columns:repeat(2,minmax(0,1fr));}.set-add-grid .w-name,.set-add-grid .w-phone{grid-column:1/-1;}.set-res-toolbar .set-add-btn{width:100%;}}
}
