:root{
  --ice-50:#f0f9fb;
  --ice-100:#dbeff4;
  --teal-600:#0e7c8c;
  --teal-700:#0b6472;
  --teal-800:#0a4f5c;
  --navy-900:#0f2b38;
  --steel-500:#5b7f8f;
  --ink:#1c313a;
  --muted:#6b8391;
  --border:#dce8ec;
  --card:#ffffff;
  --bg:#eef6f8;
  --danger:#d64545;
  --warn:#e08a2b;
  --ok:#1f9d6f;
  --radius:14px;
  --shadow:0 2px 10px rgba(15,43,56,.06), 0 1px 2px rgba(15,43,56,.08);
  /* متغيرات نصوص منفصلة عن ألوان التدرجات (navy-900/teal-800 تبقى ثابتة للهدر والبانرات دايمًا،
     بينما هذي تتغير مع الوضع الداكن حتى يضل النص واضح) */
  --heading:#0f2b38;
  --accent-text:#0a4f5c;
  --input-bg:#ffffff;
}
[data-theme="dark"]{
  --ice-50:#132a30;
  --ice-100:#183740;
  --teal-600:#19a6bc;
  --teal-700:#2bbdd1;
  --steel-500:#8fa9b3;
  --ink:#dbe9ec;
  --muted:#84a0aa;
  --border:#24414b;
  --card:#132229;
  --bg:#0b1519;
  --danger:#ff7373;
  --warn:#ffb268;
  --ok:#3fe0a0;
  --shadow:0 2px 10px rgba(0,0,0,.45), 0 1px 2px rgba(0,0,0,.35);
  --heading:#eaf6f8;
  --accent-text:#3ecbdf;
  --input-bg:#0d1a20;
}
*{box-sizing:border-box}
body{
  margin:0;
  font-family:'Tajawal','Segoe UI',Tahoma,sans-serif;
  background:var(--bg);
  color:var(--ink);
  direction:rtl;
}
a{color:var(--teal-700); text-decoration:none}
.container{max-width:1180px; margin:0 auto; padding:0 18px}

/* Topbar */
.topbar{
  background:linear-gradient(135deg, var(--navy-900), var(--teal-800));
  color:#fff;
  box-shadow:var(--shadow);
  position:sticky; top:0; z-index:50;
}
.topbar-row{display:flex; align-items:center; gap:18px; padding:13px 0; position:relative}
.brand{display:flex; align-items:center; gap:10px; font-weight:800; font-size:18px; flex-shrink:0; color:#fff}
.brand .ico{
  width:34px;height:34px;border-radius:10px;
  background:radial-gradient(circle at 30% 30%, #7fe3ef, var(--teal-600));
  display:flex;align-items:center;justify-content:center;font-size:18px; flex-shrink:0;
}

/* Nav (desktop: inline row) */
.nav{display:flex; align-items:center; gap:3px; flex:1; flex-wrap:wrap}
.nav a{
  display:inline-flex; align-items:center; gap:6px;
  color:#dbeef2; padding:8px 12px; border-radius:9px; font-size:13.5px; font-weight:600;
  transition:.15s; white-space:nowrap;
}
.nav a:hover{background:rgba(255,255,255,.10); color:#fff}
.nav a.active{background:rgba(255,255,255,.18); color:#fff}
.nav-ico{font-size:14px; line-height:1}

/* مجموعات القائمة (أقسام) — بقائمة منسدلة تظهر بالتحويم على سطح المكتب، وتتحول لعناوين أقسام ثابتة على الجوال */
.nav-group{position:relative}
.nav-group-label{
  display:inline-flex; align-items:center; gap:6px; cursor:default; user-select:none;
  color:#dbeef2; padding:8px 12px; border-radius:9px; font-size:13.5px; font-weight:600; transition:.15s; white-space:nowrap;
}
.nav-group-label .chevron{font-size:9px; opacity:.75; transition:transform .15s}
.nav-group:hover .nav-group-label, .nav-group-label.active{background:rgba(255,255,255,.14); color:#fff}
.nav-group:hover .nav-group-label .chevron{transform:rotate(180deg)}
.nav-dropdown{
  position:absolute; top:100%; right:0; min-width:220px; z-index:70;
  background:linear-gradient(165deg, var(--teal-800), var(--navy-900));
  border-radius:14px; box-shadow:0 16px 36px rgba(0,0,0,.35); padding:8px;
  display:flex; flex-direction:column; gap:1px;
  opacity:0; visibility:hidden; transform:translateY(-6px);
  transition:opacity .15s ease, transform .15s ease, visibility 0s linear .15s;
}
.nav-group:hover .nav-dropdown{
  opacity:1; visibility:visible; transform:translateY(0);
  transition:opacity .15s ease, transform .15s ease, visibility 0s linear 0s;
}
.nav-dropdown a{width:100%; border-radius:9px}
.nav-user-mobile, .nav-logout-mobile{display:none}

/* User box (desktop) */
.userbox{display:flex; align-items:center; gap:10px; flex-shrink:0}
.avatar{
  width:32px; height:32px; border-radius:50%; background:rgba(255,255,255,.18);
  display:flex; align-items:center; justify-content:center; font-weight:800; font-size:14px; flex-shrink:0;
}
.user-meta{display:flex; flex-direction:column; line-height:1.3}
.user-meta .uname{font-size:13px; font-weight:700; color:#fff}
.userbox .role-pill{
  background:rgba(255,255,255,.15); padding:2px 9px; border-radius:20px; font-size:11px; color:#cfe9ee; width:fit-content;
}
.logout-btn{
  color:#ffd7d7 !important; font-size:18px; width:32px; height:32px; border-radius:9px;
  display:flex; align-items:center; justify-content:center; transition:.15s;
  appearance:none; background:none; border:none; cursor:pointer; font-family:inherit; text-decoration:none; padding:0;
}
.logout-btn:hover{background:rgba(255,80,80,.15)}

/* Hamburger (hidden on desktop) — الآن <label> مرتبط بـ checkbox بدل <button>،
   يعمل التبديل بـ CSS خالص حتى لو JavaScript ما اشتغل لأي سبب على الاستضافة */
.nav-toggle-checkbox{position:absolute; width:0; height:0; opacity:0; pointer-events:none}
.menu-toggle{
  display:none; flex-direction:column; justify-content:center; align-items:center; gap:5px;
  width:38px; height:38px; border-radius:9px; border:none; background:rgba(255,255,255,.12); cursor:pointer; flex-shrink:0;
  margin-right:auto;
}
.menu-toggle span{width:18px; height:2px; background:#fff; border-radius:2px; transition:.2s}
.menu-toggle.open span:nth-child(1){transform:translateY(7px) rotate(45deg)}
.menu-toggle.open span:nth-child(2){opacity:0}
.menu-toggle.open span:nth-child(3){transform:translateY(-7px) rotate(-45deg)}
/* قاعدة :has() منفصلة تمامًا — لو المتصفح ما يفهم :has() يتجاهل هذي القاعدة بس ويطبّق اللي فوقها عادي
   (تجميعهم بفاصلة بنفس القاعدة يلغي القاعدة كاملة لو جزء منها غير مفهوم) */
.nav-toggle-checkbox:checked + .menu-toggle span:nth-child(1){transform:translateY(7px) rotate(45deg)}
.nav-toggle-checkbox:checked + .menu-toggle span:nth-child(2){opacity:0}
.nav-toggle-checkbox:checked + .menu-toggle span:nth-child(3){transform:translateY(-7px) rotate(-45deg)}

/* خلفية معتمة خلف القائمة المنسدلة على الجوال (وسم <label> نفسه يقفل القائمة عند الضغط عليه، بدون JS) */
/* مهم: pointer-events دايمًا نفس حالة الـ checkbox بالضبط وبدون أي تأخير — حتى لو opacity يتلاشى بهدوء،
   القفل عن الضغط يصير فورًا لحظة إلغاء التحديد، عشان ما تنضغط خلفية وهمية فوق محتوى الصفحة الجديدة بالغلط */
.nav-backdrop{
  position:fixed; inset:0; background:rgba(8,16,20,.5);
  opacity:0; pointer-events:none; transition:opacity .2s ease; z-index:45;
}
.nav-toggle-checkbox:checked ~ .nav-backdrop,
.topbar-row:has(.nav-toggle-checkbox:checked) ~ .nav-backdrop{opacity:1; pointer-events:auto}

@media(max-width:820px){
  .topbar-row{padding:10px 0}
  .brand{font-size:16px}
  .brand-text{display:none}
  .userbox{display:none}
  .menu-toggle{display:flex}

  /* القائمة تصير بطاقة عائمة تحت الهدر بدل الاعتماد على ترتيب flex (أكثر ثباتًا بين المتصفحات) */
  .nav{
    display:flex;
    position:absolute; top:calc(100% + 8px); right:0; left:0;
    background:linear-gradient(165deg, var(--teal-800), var(--navy-900));
    border-radius:16px; box-shadow:0 16px 40px rgba(0,0,0,.4);
    flex-direction:column; align-items:stretch; gap:2px; flex-wrap:nowrap;
    padding:10px 8px 12px; max-height:75vh; overflow-y:auto;
    z-index:60;
    opacity:0; visibility:hidden; transform:translateY(-8px);
    /* pointer-events بدون أي تأخير إطلاقًا — القفل عن الضغط يصير فورًا لحظة الإقفال،
       حتى لو opacity/visibility لسا بانيميشن الإخفاء (كانت تفضل قابلة للضغط لجزء من ثانية، وهذا كان يسبب
       ضغطة توصل لعنصر قائمة قديم بدل محتوى الصفحة الجديدة اللي تحته) */
    pointer-events:none;
    transition:opacity .18s ease, transform .18s ease, visibility 0s linear .18s;
  }
  .nav.open{
    opacity:1; visibility:visible; transform:translateY(0); pointer-events:auto;
    transition:opacity .18s ease, transform .18s ease, visibility 0s linear 0s;
  }
  .topbar-row:has(.nav-toggle-checkbox:checked) .nav{
    opacity:1; visibility:visible; transform:translateY(0); pointer-events:auto;
    transition:opacity .18s ease, transform .18s ease, visibility 0s linear 0s;
  }
  .nav a{width:100%; padding:12px 14px; font-size:14.5px; border-radius:11px}
  .nav a.active{background:rgba(255,255,255,.2)}
  .nav a + a{margin-top:1px}

  /* على الجوال: القسم يتحول لعنوان ثابت والقائمة المنسدلة تصير جزء طبيعي من التدفق (دايمًا ظاهرة، بدون تحويم) */
  .nav-group{width:100%}
  .nav-group-label{width:100%; padding:10px 14px 4px; font-size:11.5px; color:#9fd3d6; pointer-events:none}
  .nav-group-label .chevron{display:none}
  .nav-dropdown{
    position:static; opacity:1; visibility:visible; transform:none; box-shadow:none; background:none;
    padding:0; min-width:0; transition:none;
  }
  .nav-dropdown a{padding:12px 14px; font-size:14.5px; border-radius:11px}

  .nav-user-mobile{
    display:flex; align-items:center; gap:10px; padding:12px; margin-top:8px;
    border-top:1px solid rgba(255,255,255,.14); border-bottom:1px solid rgba(255,255,255,.14);
  }
  .nav-user-meta{display:flex; flex-direction:column; gap:3px}
  .nav-user-meta .uname{font-weight:700; font-size:14px}
  .nav-user-mobile .role-pill{background:rgba(255,255,255,.15); padding:2px 9px; border-radius:20px; font-size:11px; width:fit-content}
  .nav-logout-mobile{
    display:flex; color:#ffd7d7; font-weight:700; padding:12px 14px; margin-top:2px; border-radius:11px;
    appearance:none; background:none; border:none; cursor:pointer; font-family:inherit; font-size:14.5px;
    text-align:right; width:100%; text-decoration:none;
  }
  .nav-logout-mobile:hover{background:rgba(255,80,80,.15)}
}

/* Layout */
.page{padding:26px 0 60px}
.page-head{display:flex; align-items:center; justify-content:space-between; margin-bottom:18px; flex-wrap:wrap; gap:10px}
.page-head h1{font-size:22px; margin:0; color:var(--heading)}
.page-head .sub{color:var(--muted); font-size:13px; margin-top:3px}

/* Cards */
.card{background:var(--card); border-radius:var(--radius); box-shadow:var(--shadow); padding:20px; border:1px solid var(--border)}
.grid{display:grid; gap:16px}
.grid-4{grid-template-columns:repeat(4,1fr)}
.grid-3{grid-template-columns:repeat(3,1fr)}
.grid-2{grid-template-columns:repeat(2,1fr)}
@media(max-width:900px){.grid-4{grid-template-columns:repeat(2,1fr)} .grid-3{grid-template-columns:repeat(2,1fr)}}
@media(max-width:600px){.grid-4,.grid-3,.grid-2{grid-template-columns:1fr}}

.stat{display:flex; flex-direction:column; gap:6px; transition:transform .15s ease, box-shadow .15s ease}
.stat .num{font-size:28px; font-weight:800; color:var(--accent-text)}
.stat .label{color:var(--muted); font-size:13px}
.stat.warn .num{color:var(--warn)}
.stat.danger .num{color:var(--danger)}
.stat.ok .num{color:var(--ok)}
.stat-icon{font-size:22px; line-height:1; margin-bottom:2px}
.card.clickable{cursor:pointer; text-decoration:none; display:block; color:inherit}
.card.clickable:hover{transform:translateY(-2px); box-shadow:0 8px 22px rgba(15,43,56,.12)}

/* Alert chips (dashboard) */
.alert-strip{display:flex; gap:10px; flex-wrap:wrap; margin-bottom:20px}
.alert-chip{
  display:flex; align-items:center; gap:10px; padding:12px 16px; border-radius:14px;
  background:var(--card); border:1px solid var(--border); border-right:4px solid var(--teal-600);
  box-shadow:var(--shadow); text-decoration:none; color:var(--ink); flex:1; min-width:200px;
  transition:transform .15s ease;
}
.alert-chip:hover{transform:translateY(-2px)}
.alert-chip.sev-danger{border-right-color:var(--danger)}
.alert-chip.sev-warn{border-right-color:var(--warn)}
.alert-chip.sev-info{border-right-color:var(--teal-600)}
.alert-chip .chip-ico{font-size:22px}
.alert-chip .chip-num{font-size:19px; font-weight:800}
.alert-chip .chip-label{font-size:12.5px; color:var(--muted)}
@media(max-width:560px){
  .alert-chip{min-width:100%}
}

/* Hero greeting */
.dash-hero{
  background:linear-gradient(120deg, var(--navy-900), var(--teal-700));
  color:#fff; border-radius:18px; padding:22px 24px; margin-bottom:20px;
  display:flex; justify-content:space-between; align-items:center; flex-wrap:wrap; gap:14px;
}
.dash-hero h1{margin:0; font-size:22px}
.dash-hero .sub{color:#cfe9ee; font-size:13.5px; margin-top:4px}

/* Technician workload */
.workload-row{display:flex; align-items:center; gap:10px; padding:10px 0; border-bottom:1px solid var(--border)}
.workload-row:last-child{border-bottom:none}
.workload-name{font-weight:700; font-size:13.5px; min-width:90px; display:flex; align-items:center; gap:6px}
.live-dot{
  width:8px; height:8px; border-radius:50%; background:var(--ok); flex-shrink:0;
  box-shadow:0 0 0 0 rgba(31,157,111,.6); animation:livePulse 1.6s infinite;
}
@keyframes livePulse{
  0%{box-shadow:0 0 0 0 rgba(31,157,111,.55)}
  70%{box-shadow:0 0 0 7px rgba(31,157,111,0)}
  100%{box-shadow:0 0 0 0 rgba(31,157,111,0)}
}
.workload-bar-wrap{flex:1; background:var(--ice-100); border-radius:20px; height:10px; overflow:hidden}
.workload-bar{height:100%; background:linear-gradient(90deg, var(--teal-600), var(--teal-800)); border-radius:20px}
.workload-count{font-size:12px; color:var(--muted); min-width:70px; text-align:left}

/* Buttons */
.btn{
  display:inline-flex; align-items:center; gap:6px; padding:9px 16px; border-radius:10px;
  font-weight:700; font-size:14px; border:1px solid transparent; cursor:pointer;
}
.btn-primary{background:var(--teal-600); color:#fff}
.btn-primary:hover{background:var(--teal-700)}
.btn-outline{background:var(--card); border-color:var(--teal-600); color:var(--teal-700)}
.btn-outline:hover{background:var(--ice-50)}
.btn-danger{background:#fdecec; color:var(--danger); border-color:#f6c9c9}
#stopBtn{animation:recPulse 1.4s ease-in-out infinite}
@keyframes recPulse{0%,100%{box-shadow:0 0 0 0 rgba(214,69,69,.35)} 50%{box-shadow:0 0 0 6px rgba(214,69,69,0)}}
.btn-sm{padding:5px 10px; font-size:12px; border-radius:8px}
.btn:disabled{opacity:.5; cursor:not-allowed}

/* Forms */
label{display:block; font-size:13px; font-weight:700; color:var(--heading); margin-bottom:5px}
input, select, textarea{
  width:100%; padding:10px 12px; border:1px solid var(--border); border-radius:10px;
  font-family:inherit; font-size:14px; background:var(--input-bg); color:var(--ink);
}
input:focus, select:focus, textarea:focus{outline:none; border-color:var(--teal-600); box-shadow:0 0 0 3px rgba(14,124,140,.12)}
.form-row{margin-bottom:14px}
.form-grid{display:grid; grid-template-columns:repeat(2,1fr); gap:14px}
@media(max-width:700px){.form-grid{grid-template-columns:1fr}}
fieldset{border:1px solid var(--border); border-radius:12px; padding:14px; margin-bottom:16px}
legend{font-weight:800; color:var(--accent-text); padding:0 8px}

/* Tables */
.table-wrap{width:100%; overflow-x:auto; -webkit-overflow-scrolling:touch}
table{width:100%; border-collapse:collapse; font-size:14px}
th, td{padding:10px 12px; text-align:right; border-bottom:1px solid var(--border)}
th{color:var(--muted); font-weight:700; font-size:12.5px; background:var(--ice-50); white-space:nowrap}
tr:hover td{background:#fafdfd}
@media(max-width:700px){
  .table-wrap table{width:max-content; min-width:100%}
  .table-wrap th, .table-wrap td{white-space:nowrap; font-size:13px; padding:9px 10px}
}

/* Badges */
.badge{display:inline-block; padding:4px 11px; border-radius:20px; font-size:12px; font-weight:700}
.badge-new{background:#e6f0ff; color:#2954a6}
.badge-scheduled{background:#eaf6f5; color:var(--teal-700)}
.badge-progress{background:#fff3e0; color:var(--warn)}
.badge-done{background:#e5f8ef; color:var(--ok)}
.badge-postponed{background:#f1eefc; color:#6b46c1}
.badge-waiting{background:#fdf1e3; color:#b06a12}
.badge-cancelled{background:#fdecec; color:var(--danger)}
.priority-urgent{color:var(--danger); font-weight:800}
.priority-normal{color:var(--muted)}
tr.row-urgent td:first-child{border-right:3px solid var(--danger); padding-right:9px}
tr.row-urgent{background:rgba(214,69,69,.06)}

/* ظهور تدريجي خفيف لصفوف الجداول والبطاقات عند تحميل الصفحة */
@keyframes fadeInUp{from{opacity:0; transform:translateY(4px)} to{opacity:1; transform:translateY(0)}}
.table-wrap tbody tr, .table-wrap tr{animation:fadeInUp .25s ease both}
.badge{transition:background-color .25s ease, color .25s ease}

/* Quick service chips */
.chip-list{display:flex; flex-wrap:wrap; gap:8px; margin-bottom:6px}
.chip{
  padding:7px 13px; border:1px solid var(--border); border-radius:20px; font-size:13px;
  cursor:pointer; background:var(--card); font-weight:600; color:var(--ink);
}
.chip.selected{background:var(--teal-600); color:#fff; border-color:var(--teal-600)}

/* لوحة ترتيب أداء الفنيين — منصة تتويج + مقارنة إيراد */
.podium{display:flex; align-items:flex-end; justify-content:center; gap:16px; margin-top:6px; flex-wrap:wrap}
.podium-card{
  background:var(--card); border-radius:16px; padding:20px 16px; text-align:center;
  box-shadow:var(--shadow); min-width:150px; position:relative; transition:transform .2s ease;
  animation:fadeInUp .35s ease both;
}
.podium-card:hover{transform:translateY(-4px)}
.podium-1{order:2; padding-top:28px; padding-bottom:28px; background:linear-gradient(160deg, #fff9e8, var(--card)); border:2px solid #f0c14b; min-width:175px}
.podium-2{order:1; background:linear-gradient(160deg, #f4f7f9, var(--card)); border:2px solid #b8c4cc}
.podium-3{order:3; background:linear-gradient(160deg, #fdf0e6, var(--card)); border:2px solid #d9a266}
[data-theme="dark"] .podium-1{background:linear-gradient(160deg, #2b2410, var(--card))}
[data-theme="dark"] .podium-2{background:linear-gradient(160deg, #202a2e, var(--card))}
[data-theme="dark"] .podium-3{background:linear-gradient(160deg, #2b2015, var(--card))}
.podium-medal{font-size:34px; margin-bottom:4px}
.podium-1 .podium-medal{font-size:42px}
.podium-avatar{
  width:54px; height:54px; border-radius:50%; background:linear-gradient(135deg, var(--teal-600), var(--teal-800));
  color:#fff; display:flex; align-items:center; justify-content:center; font-weight:800; font-size:19px;
  margin:0 auto 10px;
}
.podium-1 .podium-avatar{width:66px; height:66px; font-size:23px}
.podium-name{font-weight:800; font-size:15px; color:var(--heading); margin-bottom:4px}
.podium-metric{font-weight:800; font-size:18px; color:var(--accent-text)}
.podium-sub{font-size:11.5px; color:var(--muted); margin-top:4px}

.lb-bar-row{display:flex; align-items:center; gap:10px; padding:8px 0; border-bottom:1px solid var(--border)}
.lb-bar-row:last-child{border-bottom:none}
.lb-bar-rank{font-weight:800; color:var(--muted); min-width:28px; font-size:13px}
.lb-bar-name{font-weight:700; font-size:13.5px; min-width:90px}
.lb-bar-wrap{flex:1; background:var(--ice-100); border-radius:20px; height:12px; overflow:hidden}
.lb-bar-fill{height:100%; background:linear-gradient(90deg, var(--teal-600), var(--accent-text)); border-radius:20px; transition:width .6s ease}
.lb-bar-value{font-size:12.5px; color:var(--muted); min-width:80px; text-align:left}

@media(max-width:640px){
  .podium{align-items:stretch}
  .podium-1, .podium-2, .podium-3{order:initial; min-width:0; width:100%}
  .lb-bar-name{min-width:70px; font-size:12.5px}
  .lb-bar-value{min-width:66px; font-size:11.5px}
}

/* لوحة الربح الصافي */
.profit-hero{
  background:linear-gradient(135deg, var(--navy-900), var(--teal-700));
  border-radius:20px; padding:32px 24px; text-align:center; color:#fff;
  box-shadow:0 12px 30px rgba(10,79,92,.25); margin-bottom:20px;
}
.profit-hero-loss{background:linear-gradient(135deg, #3a1414, #7a2626)}
.profit-hero-label{font-size:13px; opacity:.85; letter-spacing:.5px}
.profit-hero-num{font-size:44px; font-weight:800; margin:6px 0; direction:ltr; unicode-bidi:embed}
.profit-hero-sub{font-size:12.5px; opacity:.75; margin-bottom:14px}
.profit-trend{
  display:inline-flex; align-items:center; gap:6px; padding:7px 16px; border-radius:20px;
  font-size:13px; font-weight:700; flex-wrap:wrap; justify-content:center;
}
.trend-up{background:rgba(63,224,160,.18); color:#7cf0bf}
.trend-down{background:rgba(255,115,115,.18); color:#ffabab}

.profit-funnel{display:flex; flex-direction:column; gap:10px}
.funnel-step{display:flex; align-items:center; gap:12px; flex-wrap:wrap}
.funnel-label{min-width:150px; font-weight:700; font-size:13.5px; color:var(--heading)}
.funnel-bar{
  color:#fff; font-weight:700; font-size:13px; padding:10px 14px; border-radius:10px;
  white-space:nowrap; transition:width .6s ease; min-width:fit-content;
}
@media(max-width:560px){
  .profit-hero-num{font-size:34px}
  .funnel-label{min-width:110px; font-size:12.5px}
}

/* صفحة التنبيهات */
.notif-list{display:flex; flex-direction:column; gap:6px}
.notif-row{
  display:flex; justify-content:space-between; align-items:center; gap:10px;
  padding:10px 12px; background:var(--ice-50); border-radius:10px; text-decoration:none; color:var(--ink);
  transition:background .15s ease;
}
.notif-row:hover{background:var(--ice-100)}
.notif-row-title{font-weight:700; font-size:13.5px}
.notif-row-sub{font-size:12px; color:var(--muted); white-space:nowrap}

/* شبكة التقويم الشهري */
.month-grid{display:grid; grid-template-columns:repeat(7, 1fr); gap:6px}
.month-grid-head{text-align:center; font-weight:700; font-size:12.5px; color:var(--muted); padding:6px 0}
.month-grid-cell{
  aspect-ratio:1; display:flex; flex-direction:column; align-items:center; justify-content:center; gap:4px;
  border:1px solid var(--border); border-radius:10px; text-decoration:none; color:var(--ink);
  transition:background .15s ease;
}
.month-grid-cell:hover{background:var(--ice-50)}
.month-grid-empty{border:none; background:none; pointer-events:none}
.month-grid-today{border-color:var(--teal-600); border-width:2px; background:var(--ice-50)}
.month-grid-daynum{font-weight:700; font-size:14px}
.month-grid-count{background:var(--teal-600); color:#fff; font-size:11px; font-weight:700; padding:1px 7px; border-radius:10px}
.month-grid-count-urgent{background:var(--danger)}
@media(max-width:640px){
  .month-grid{gap:4px}
  .month-grid-daynum{font-size:11.5px}
  .month-grid-count{font-size:9.5px; padding:1px 5px}
  .month-grid-head{font-size:11px; padding:4px 0}
}

/* Device blocks (requests/create.php) */
.method-fields{display:none; margin-top:10px}
.device-block{
  border:1px solid var(--border); border-radius:12px; padding:14px; margin-bottom:12px; background:var(--ice-50);
}
.device-block-head{display:flex; justify-content:space-between; align-items:center; margin-bottom:10px}
.fault-chip{cursor:pointer; user-select:none}
.fault-chip.selected{background:var(--teal-600); color:#fff; border-color:var(--teal-600)}

/* User list rows (admin/users.php) — cards instead of a cramped table on mobile */
.user-rows{display:flex; flex-direction:column}
.user-row{
  display:flex; align-items:center; justify-content:space-between; flex-wrap:wrap; gap:10px 16px;
  padding:13px 4px; border-bottom:1px solid var(--border);
}
.user-rows .user-row:last-child{border-bottom:none}
.user-row-info{min-width:160px}
.user-row-name{font-weight:700; font-size:14.5px; display:flex; align-items:center; gap:8px; flex-wrap:wrap}
.user-row-meta{color:var(--muted); font-size:12.5px; margin-top:3px}
.user-row-actions{display:flex; gap:8px; flex-wrap:wrap}
.user-row-actions form{display:flex}
.pw-reset-form{
  display:none; gap:8px; width:100%; margin-top:2px; padding-top:10px;
  border-top:1px dashed var(--border); flex-wrap:wrap;
}
.pw-reset-form input[type="text"]{flex:1; min-width:160px}
@media(max-width:480px){
  .user-row{padding:13px 2px}
  .user-row-actions{width:100%}
  .user-row-actions form, .user-row-actions button{flex:1}
}

/* Login */
.login-wrap{min-height:100vh; display:flex; align-items:center; justify-content:center; background:linear-gradient(135deg, var(--navy-900), var(--teal-800))}
.login-card{background:#fff; border-radius:18px; padding:36px 32px; width:100%; max-width:380px; box-shadow:0 20px 50px rgba(0,0,0,.25)}
.login-card h1{text-align:center; color:var(--heading); font-size:20px; margin-bottom:4px}
.login-card .sub{text-align:center; color:var(--muted); font-size:13px; margin-bottom:22px}
.error-box{background:#fdecec; color:var(--danger); padding:10px 14px; border-radius:10px; font-size:13.5px; margin-bottom:14px}

/* Timeline */
.timeline{list-style:none; margin:0; padding:0; border-right:2px solid var(--border); margin-right:8px}
.timeline li{position:relative; padding:0 22px 18px 0; margin-right:-2px}
.timeline li::before{content:''; position:absolute; right:-6px; top:3px; width:10px; height:10px; border-radius:50%; background:var(--teal-600)}
.timeline .t-when{font-size:12px; color:var(--muted)}
.timeline .t-what{font-weight:700; font-size:14px}

/* Print */
@media print{
  .no-print{display:none !important}
  body{background:#fff}
  .card{box-shadow:none; border:1px solid #ccc}
}

/* Small screens */
@media(max-width:600px){
  .container{padding:0 12px}
  .page{padding:16px 0 40px}
  .card{padding:14px; border-radius:12px}
  .page-head h1{font-size:19px}
  .page-head{flex-direction:column; align-items:stretch}
  .page-head > *:last-child{align-self:flex-start}
  .btn{padding:9px 14px; font-size:13.5px}
  .stat .num{font-size:22px}
  fieldset{padding:12px}
  .login-card{padding:26px 22px}
}
