/* الأنماط العامة — الجوال أولًا. الهيدر على نمط weekly-tasks-web/admin-header.ejs */
:root{
  --primary:#1d4ed8;--primary-dark:#1741a6;--primary-soft:#dbeafe;--teal:#0f766e;
  --navy:#0f172a;--text:#1e293b;--muted:#64748b;--border:#e2e8f0;--bg:#f1f5f9;--card:#fff;
  --success:#15803d;--success-soft:#dcfce7;--danger:#b91c1c;--danger-soft:#fee2e2;--warning:#a16207;--warning-soft:#fef9c3;
  --radius:14px;--tap:46px;
}
*{box-sizing:border-box}
html{-webkit-text-size-adjust:100%}
body{margin:0;background:var(--bg);color:var(--text);font-family:Tajawal,Tahoma,Arial,sans-serif;font-size:17px;line-height:1.7}
a{color:var(--primary)}
.dev-ribbon{background:#f59e0b;color:#451a03;text-align:center;font-size:14px;font-weight:700;padding:3px 8px}

/* الهيدر */
.ah-wrap{width:calc(100% - 16px);max-width:2400px;margin:8px auto 0}
.ah-header{background:linear-gradient(135deg,#1741a6 0%,#1d4ed8 45%,#0f766e 100%);border-radius:20px;padding:12px 14px;box-shadow:0 12px 30px rgba(15,23,42,.14);position:relative;overflow:hidden}
.ah-header:before{content:"";position:absolute;inset:0;background:radial-gradient(560px 220px at 8% -20%,rgba(255,255,255,.16),transparent 60%);pointer-events:none}
.ah-toggle{position:absolute;opacity:0;pointer-events:none}
.ah-top{display:flex;align-items:center;justify-content:space-between;gap:10px;position:relative}
.ah-brand{color:#fff;text-decoration:none;font-size:20px;font-weight:900;line-height:1.3;display:block}
.ah-sub{color:#dbeafe;font-size:13.5px;font-weight:700}
.ah-actions{display:flex;gap:8px;flex-shrink:0}
.ah-icon-btn{position:relative;display:inline-flex;align-items:center;justify-content:center;width:40px;height:40px;border-radius:50%;background:rgba(255,255,255,.18);color:#fff;border:0;cursor:pointer;text-decoration:none;font:inherit}
.ah-icon-btn:hover{background:rgba(255,255,255,.3)}
.ah-badge{position:absolute;top:-3px;inset-inline-end:-3px;min-width:19px;height:19px;padding:0 5px;border-radius:999px;background:#ef4444;color:#fff;font-size:12.5px;font-weight:900;line-height:19px;text-align:center}
.ah-panel{display:none;position:relative;margin-top:12px}
.ah-toggle:checked ~ .ah-panel{display:block}
.ah-toggle:focus-visible ~ .ah-top .ah-menu-btn{outline:2px solid #fff;outline-offset:2px}
.ah-user{display:flex;align-items:center;gap:10px;background:rgba(255,255,255,.14);border:1px solid rgba(255,255,255,.22);border-radius:999px;padding:5px 6px 5px 12px;margin-bottom:10px}
.ah-avatar{width:34px;height:34px;border-radius:50%;background:#fff;color:#1d4ed8;display:flex;align-items:center;justify-content:center;font-weight:900;font-size:14.5px;flex-shrink:0}
.ah-user-meta{display:flex;flex-direction:column;line-height:1.3;flex:1;min-width:0}
.ah-user-name{color:#fff;font-weight:900;font-size:15px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.ah-user-role{color:#dbeafe;font-size:13px;font-weight:700}
.ah-logout{margin:0}
.ah-logout .ah-icon-btn{width:34px;height:34px}
.ah-nav{display:flex;flex-direction:column;gap:8px}
.ah-group{background:rgba(255,255,255,.1);border:1px solid rgba(255,255,255,.16);border-radius:14px;padding:8px 10px 10px}
.ah-group-title{display:flex;align-items:center;gap:6px;color:#eff6ff;font-size:13px;font-weight:900;margin-bottom:7px}
.ah-group-dot{width:7px;height:7px;border-radius:50%}
.ah-group-links{display:grid;grid-template-columns:repeat(2,1fr);gap:6px}
.ah-link{display:flex;align-items:center;justify-content:center;text-align:center;min-height:40px;background:#fff;color:#1e3a8a;text-decoration:none;font-weight:800;font-size:14.5px;padding:6px;border-radius:10px;box-shadow:0 2px 6px rgba(15,23,42,.08)}
.ah-link.is-active{background:#0f172a;color:#fff}
@media(min-width:900px){
  .ah-wrap{width:calc(100% - 48px);margin-top:18px}
  .ah-header{padding:20px 24px;border-radius:26px}
  .ah-brand{font-size:27px}
  .ah-menu-btn{display:none}
  .ah-panel{display:flex;align-items:flex-start;gap:10px;flex-direction:row-reverse;margin-top:16px}
  .ah-user{order:2;margin:0;align-self:center}
  .ah-nav{flex-direction:row;flex:1}
  .ah-group{flex:1 1 0}
}

/* الصفحة */
.page{width:calc(100% - 16px);max-width:2400px;margin:14px auto 24px}
@media(min-width:900px){.page{width:calc(100% - 48px)}}
.page-title{font-size:22.5px;font-weight:900;color:var(--navy);margin:4px 4px 12px}
.card{background:var(--card);border:1px solid var(--border);border-radius:var(--radius);padding:16px;margin-bottom:12px;box-shadow:0 1px 3px rgba(15,23,42,.05)}
.card-title{font-size:19px;font-weight:900;color:var(--navy);margin:0 0 12px}
.muted{color:var(--muted)}
.empty-state{text-align:center;padding:28px 16px}
.empty-title{font-size:19px;font-weight:900;color:var(--navy);margin-bottom:4px}
.empty-state p{color:var(--muted);margin:0 0 12px}

/* النماذج والأزرار */
.field{display:block;margin-bottom:14px}
.field>span{display:block;font-weight:700;font-size:15.5px;margin-bottom:5px;color:var(--navy)}
.field small{display:block;color:var(--muted);font-size:14px;margin-top:4px}
input,select,textarea{width:100%;min-height:var(--tap);font:inherit;font-size:18px;padding:8px 12px;border:1px solid #cbd5e1;border-radius:10px;background:#fff;color:var(--text)}
input:focus,select:focus,textarea:focus{outline:2px solid var(--primary-soft);border-color:var(--primary)}
.btn{display:inline-flex;align-items:center;justify-content:center;gap:6px;min-height:var(--tap);padding:8px 18px;border-radius:12px;border:1px solid #cbd5e1;background:#fff;color:var(--navy);font:inherit;font-weight:800;cursor:pointer;text-decoration:none}
.btn-primary{background:var(--primary);border-color:var(--primary);color:#fff}
.btn-primary:hover{background:var(--primary-dark)}
.btn-block{width:100%}
.btn-link{background:none;border:0;color:var(--muted);font:inherit;text-decoration:underline;cursor:pointer;padding:8px}
.alert{border-radius:10px;padding:10px 12px;margin-bottom:14px;font-size:15.5px;font-weight:700}
.alert-danger{background:var(--danger-soft);color:var(--danger)}
.alert-success{background:var(--success-soft);color:var(--success)}
.alert-info{background:var(--primary-soft);color:var(--primary-dark)}
.form-card{max-width:560px}

/* صفحات الدخول */
.auth-wrap{width:min(420px,calc(100% - 32px));margin:0 auto;padding:8vh 0 24px}
.auth-brand{text-align:center;font-size:24.5px;font-weight:900;color:var(--primary-dark);margin-bottom:14px}
.auth-card{padding:20px}
.auth-alt{text-align:center}

/* سجل التحديثات */
.cl-timeline{position:relative;padding-inline-start:24px;border-inline-start:2px solid var(--border)}
.cl-item{position:relative;padding-bottom:22px}
.cl-item:last-child{padding-bottom:0}
.cl-dot{position:absolute;inset-inline-start:-32px;top:5px;width:16px;height:16px;border-radius:50%;background:var(--primary);border:3px solid var(--primary-soft)}
.cl-item.is-latest .cl-dot{background:var(--success);border-color:var(--success-soft)}
.cl-head{display:flex;align-items:baseline;gap:8px;flex-wrap:wrap}
.cl-num{background:var(--primary-soft);color:var(--primary-dark);font-weight:800;font-size:14px;border-radius:999px;padding:1px 10px}
.cl-title{margin:0;font-size:17.5px;color:var(--navy)}
.cl-date{color:var(--muted);font-size:14px;margin-inline-start:auto}
.cl-points{margin:6px 0 0;padding-inline-start:20px;font-size:15.5px}

.foot{text-align:center;color:var(--muted);font-size:13.5px;padding:10px 0 calc(16px + env(safe-area-inset-bottom))}

/* القوائم */
.toolbar{display:flex;gap:8px;flex-wrap:wrap;align-items:center;margin-bottom:12px}
.inline-filter{margin:0;flex:1;min-width:180px}
.list{display:flex;flex-direction:column;gap:8px}
.row-card{background:var(--card);border:1px solid var(--border);border-radius:var(--radius);padding:12px 14px;display:flex;flex-wrap:wrap;gap:10px;align-items:center;justify-content:space-between}
.row-card.is-off{background:#f8fafc;opacity:.75}
.row-main{flex:1 1 240px;min-width:0}
.row-title{font-weight:800;color:var(--navy);display:flex;flex-wrap:wrap;gap:6px;align-items:center}
.row-meta{color:var(--muted);font-size:14.5px;margin-top:2px}
.row-actions{display:flex;gap:6px;flex-wrap:wrap}
.row-actions form{margin:0}
.btn-sm{min-height:38px;padding:4px 12px;font-size:15px;border-radius:10px}
.btn-warn{color:var(--danger);border-color:#fecaca}
.text-warn{color:var(--warning);font-weight:700}
.small{font-size:14.5px}

/* الشارات (ألوان الأولويات والأدوار) */
.badge{display:inline-block;font-size:13.5px;font-weight:800;padding:1px 10px;border-radius:999px;line-height:1.8;background:#f1f5f9;color:#475569}
.badge.red{background:#fee2e2;color:#b91c1c}
.badge.amber{background:#fef3c7;color:#b45309}
.badge.blue{background:#dbeafe;color:#1d4ed8}
.badge.green{background:#dcfce7;color:#15803d}
.badge.gray{background:#f1f5f9;color:#475569}
.badge.outline{background:transparent;border:1px solid #cbd5e1;color:#475569}

/* الاختيارات */
.choice-group{display:flex;flex-wrap:wrap;gap:8px}
.choice{display:inline-flex;align-items:center;gap:6px;border:1px solid #cbd5e1;border-radius:10px;padding:6px 12px;min-height:var(--tap);cursor:pointer;background:#fff}
.choice input{width:auto;min-height:0;margin:0}
.choice:has(input:checked){border-color:var(--primary);background:var(--primary-soft)}
.check{display:flex;align-items:flex-start;gap:10px;margin-bottom:14px;cursor:pointer}
.check input{width:20px;height:20px;min-height:0;margin-top:4px;flex-shrink:0}
.form-actions{display:flex;gap:8px;flex-wrap:wrap;margin-top:6px}
[hidden]{display:none !important}
.cred{display:grid;gap:10px;margin:12px 0;background:#f8fafc;border:1px dashed #cbd5e1;border-radius:12px;padding:12px}
.cred div{display:flex;justify-content:space-between;gap:10px;align-items:center;flex-wrap:wrap}
.cred code{font-size:19px;font-weight:700;background:#fff;border:1px solid var(--border);border-radius:8px;padding:2px 10px;user-select:all}

/* شريط الأسبوع */
.week-strip{display:flex;flex-wrap:wrap;gap:4px 12px;align-items:baseline;background:#fff;border:1px solid var(--border);border-radius:var(--radius);padding:10px 14px;margin-bottom:12px;font-size:15.5px}
.week-title{font-weight:900;color:var(--primary-dark)}

/* خطة التطوير */
.ah-link-badge{display:inline-block;min-width:18px;padding:0 5px;margin-inline-start:4px;border-radius:999px;background:#ef4444;color:#fff;font-size:12.5px;line-height:18px}
.rm-intro p{margin:0;font-size:15.5px;color:var(--muted)}
.rm-chips{display:flex;gap:6px;overflow-x:auto;padding-bottom:6px;margin-bottom:6px;-webkit-overflow-scrolling:touch}
.chip{display:inline-flex;align-items:center;gap:6px;white-space:nowrap;min-height:38px;padding:4px 12px;border:1px solid var(--border);border-radius:999px;background:#fff;color:var(--navy);text-decoration:none;font-size:15px;font-weight:700}
.chip b{font-weight:900;color:var(--muted)}
.chip.is-on{background:var(--navy);border-color:var(--navy);color:#fff}
.chip.is-on b{color:#cbd5e1}
.chip-new:not(.is-on) b{color:#b91c1c}
.chip-wait:not(.is-on) b{color:#b45309}
.rm-filter{display:flex;gap:6px;flex-wrap:wrap;margin:6px 0 4px}
.rm-filter select{flex:1 1 140px;width:auto}
.rm-filter input[type=search]{flex:2 1 180px;width:auto}
.rm-seen{margin:0 0 10px;text-align:end}
.rm-phase-head{display:flex;justify-content:space-between;align-items:baseline;gap:8px}
.rm-phase-head .card-title{margin-bottom:6px}
.rm-progress{height:6px;background:#eef2f7;border-radius:9px;overflow:hidden;margin-bottom:10px}
.rm-progress span{display:block;height:100%;background:#22c55e;border-radius:9px}
.rm-items{display:flex;flex-direction:column;gap:6px}
.rm-item{border:1px solid var(--border);border-radius:12px;background:#fff}
.rm-item.is-new{border-color:#fca5a5;box-shadow:inset 3px 0 0 #ef4444}
.rm-item summary{list-style:none;cursor:pointer;padding:10px 12px;display:flex;flex-wrap:wrap;gap:6px 8px;align-items:center}
.rm-item summary::-webkit-details-marker{display:none}
.rm-item summary .badge{flex-shrink:0}
.rm-text{flex:1 1 220px;font-weight:700;color:var(--navy);font-size:16px}
.rm-flags{display:flex;gap:6px;flex-wrap:wrap;align-items:center}
.rm-body{border-top:1px dashed var(--border);padding:10px 12px 12px}
.rm-details{margin:0 0 10px;font-size:15.5px}
.rm-image{display:block;max-width:100%;height:auto;border:1px solid var(--border);border-radius:10px;margin-bottom:10px}
.rm-history{margin:0 0 10px;padding-inline-start:18px;font-size:14px;color:var(--muted)}
.rm-notes{display:flex;flex-direction:column;gap:6px;margin-bottom:10px}
.rm-note{background:#fffbeb;border:1px solid #fde68a;border-radius:10px;padding:8px 10px}
.rm-note.is-done{background:#f8fafc;border-color:var(--border)}
.rm-note-head{display:flex;gap:6px;flex-wrap:wrap;align-items:baseline}
.rm-note-body{white-space:pre-wrap;font-size:15.5px;margin-top:2px}
.rm-note-act{margin:0}
.rm-note-act .btn-link{padding:2px 0;font-size:14px}
.rm-add-note textarea{min-height:64px;resize:vertical}
.rm-actions{display:flex;justify-content:flex-end;margin-top:6px}
.rm-approve{margin-top:8px}
.rm-approve form{margin:0}
.btn.is-approved{background:var(--success-soft);border-color:#86efac;color:var(--success)}
