/* ALDEEB V135.05 — Smart Control clean single-surface architecture
   Techno red / black / white / gray. One viewport, one scroll owner, no legacy overlap. */
/* ALDEEB V135.02 — Smart Control Techno Red / Black / White / Gray
   Clean visual contract. No orange/legacy light modal surfaces. */
:root{
  --aldeeb-red:#D71920;
  --aldeeb-red-dark:#A80F15;
  --aldeeb-black:#07090C;
  --aldeeb-bg:#0D1014;
  --aldeeb-panel:#15191E;
  --aldeeb-panel-2:#1B2026;
  --aldeeb-gray:#2B3138;
  --aldeeb-line:#414851;
  --aldeeb-text:#FFFFFF;
  --aldeeb-muted:#B8BEC7;
  --aldeeb-soft:#8F98A2;
  --aldeeb-success:#FFFFFF;
  --aldeeb-danger:#FF7B80;
}
.v13462-smart-shell{width:min(1180px,100%);margin:0 auto;padding:18px 18px 34px;box-sizing:border-box;position:relative;z-index:1}
.v13462-smart-hero,.v13462-smart-card,.v13462-list-wrap,.v13462-smart-kpi,.v13462-smart-box,.v13462-smart-panel>div{background:linear-gradient(145deg,var(--aldeeb-panel-2),var(--aldeeb-panel))!important;border:1px solid var(--aldeeb-line)!important;color:var(--aldeeb-text)!important;border-radius:18px;box-shadow:0 14px 34px rgba(0,0,0,.30)}
.v13462-smart-hero{padding:18px;display:flex;gap:20px;justify-content:space-between;align-items:center;overflow:hidden}
.v13462-smart-brand{display:flex;align-items:center;gap:14px;min-width:0}
.v13462-smart-brand h2,.v13462-smart-card h3,.v13462-smart-kpi b,.v13462-smart-list-title h3,.v13462-modal h3,.v13462-modal h4{color:#fff!important}
.v13462-smart-brand p,.v13462-small-muted,.v13462-smart-card small,.v13462-smart-kpi small{color:var(--aldeeb-muted)!important}
.v13462-smart-brand-icon{width:64px!important;height:64px!important;min-width:64px!important;overflow:hidden!important;display:grid!important;place-items:center!important;border-radius:16px!important;background:#fff!important;border:2px solid var(--aldeeb-red)!important}
.v13462-smart-brand-icon img{width:52px!important;height:52px!important;max-width:52px!important;max-height:52px!important;object-fit:contain!important;border-radius:8px!important;background:#fff!important}
.v13462-smart-account{display:flex;align-items:center;gap:10px;flex-wrap:wrap;justify-content:flex-end}
.v13462-smart-badge{background:var(--aldeeb-red)!important;color:#fff!important;padding:7px 10px;border-radius:999px;font-weight:900}
.v13462-smart-account-name{color:#fff!important;font-weight:900}
.v13462-smart-tabs{display:grid;grid-template-columns:repeat(5,minmax(0,1fr));gap:8px;margin:14px 0}
.v13462-smart-tab{min-height:44px;border:1px solid var(--aldeeb-line)!important;background:var(--aldeeb-panel)!important;color:#fff!important;border-radius:12px!important;font-weight:900;cursor:pointer}
.v13462-smart-tab.active{background:var(--aldeeb-red)!important;border-color:var(--aldeeb-red)!important;color:#fff!important;box-shadow:0 0 20px rgba(215,25,32,.25)}
.v13462-smart-panel{display:none!important}.v13462-smart-panel.active{display:block!important}
.v13462-smart-kpis{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:12px}
.v13462-smart-kpi{padding:16px}.v13462-smart-kpi b{display:block;font-size:24px;margin-top:5px}.v13462-toolbar{display:flex;gap:8px;flex-wrap:wrap;align-items:center}
.v13462-smart-btn{appearance:none;border:1px solid var(--aldeeb-line)!important;background:var(--aldeeb-gray)!important;color:#fff!important;border-radius:10px!important;min-height:42px;padding:9px 14px;font-weight:900;cursor:pointer;transition:.16s ease}
.v13462-smart-btn.primary,.v13462-smart-btn.success{background:var(--aldeeb-red)!important;border-color:var(--aldeeb-red)!important;color:#fff!important}.v13462-smart-btn.danger{background:#000!important;border-color:var(--aldeeb-line)!important;color:#fff!important}.v13462-smart-btn:hover{transform:translateY(-1px);border-color:var(--aldeeb-red)!important;background:#3A414A!important}.v13462-smart-btn.primary:hover,.v13462-smart-btn.success:hover{background:var(--aldeeb-red-dark)!important}.v13462-smart-btn:focus-visible,.v13462-smart-tab:focus-visible,input:focus-visible,select:focus-visible,textarea:focus-visible{outline:3px solid rgba(215,25,32,.45)!important;outline-offset:2px}
.v13462-list-title{display:flex;align-items:center;justify-content:space-between;gap:10px;margin-bottom:10px}.v13462-list-wrap{padding:16px}.v13462-smart-card{padding:16px}.v13462-smart-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:14px}.v13462-smart-device-head{display:flex;justify-content:space-between;gap:12px;align-items:flex-start}.v13462-smart-meta{display:grid;grid-template-columns:1fr 1fr;gap:8px;margin:12px 0}.v13462-smart-meta>div{background:#0E1216;border:1px solid var(--aldeeb-line);border-radius:10px;padding:10px}.v13462-smart-meta small{display:block;color:var(--aldeeb-muted)!important;margin-bottom:3px}.v13462-smart-meta b{color:#fff!important}.v13462-outlet{display:flex;justify-content:space-between;align-items:center;gap:10px;border-top:1px solid var(--aldeeb-line);padding:12px 0}.v13462-outlet-title{display:block;color:#fff!important;font-weight:900}.v13462-outlet-sub{display:block;color:var(--aldeeb-muted)!important;font-size:11px}.v13462-toggle{width:52px;height:30px;border-radius:20px;border:1px solid #67717C!important;background:#252A30!important;position:relative;cursor:pointer}.v13462-toggle:after{content:"";position:absolute;top:4px;left:4px;width:20px;height:20px;border-radius:50%;background:#fff}.v13462-toggle.on{background:var(--aldeeb-red)!important;border-color:var(--aldeeb-red)!important}.v13462-toggle.on:after{left:26px}
.v13462-status{display:inline-flex;align-items:center;gap:5px;border:1px solid var(--aldeeb-line);border-radius:999px;padding:6px 9px;font-size:11px;font-weight:900}.v13462-status.online{background:#171B20!important;color:#fff!important;border-color:var(--aldeeb-red)!important}.v13462-status.offline{background:#101317!important;color:var(--aldeeb-muted)!important}
.v13462-note,.v13462-success,.v13462-danger,.v13462-empty,.v13462-protocol-note{background:#11151A!important;border:1px solid var(--aldeeb-line)!important;color:#fff!important;border-radius:12px;padding:12px 14px;line-height:1.85}.v13462-success{border-color:var(--aldeeb-red)!important}.v13462-danger{border-color:#6B2B2F!important;color:#fff!important}.v13462-note b,.v13462-success b,.v13462-danger b,.v13462-empty b{color:#fff!important}
.v13462-form{display:grid;gap:12px}.v13462-form label{display:grid;gap:6px;color:#fff!important;font-weight:900}.v13462-form input,.v13462-form select,.v13462-form textarea{width:100%;box-sizing:border-box;border:1px solid var(--aldeeb-line)!important;border-radius:10px;padding:11px 12px;background:#0E1216!important;color:#fff!important;caret-color:#fff!important;font:inherit}.v13462-form input::placeholder,.v13462-form textarea::placeholder{color:#8F98A2!important;opacity:1}.v13462-form-grid{display:grid;grid-template-columns:1fr 1fr;gap:12px}
.v13462-modal-backdrop{position:fixed;inset:0;background:rgba(0,0,0,.80)!important;backdrop-filter:blur(8px);z-index:2147483600;display:none;align-items:center;justify-content:center;padding:16px}.v13462-modal-backdrop.open{display:flex}.v13462-modal{width:min(720px,100%);max-height:92vh;overflow:auto;background:linear-gradient(145deg,#1A1F25,#0D1014)!important;color:#fff!important;border:1px solid #4B535C!important;border-radius:22px!important;padding:20px!important;box-shadow:0 30px 80px rgba(0,0,0,.60)!important;direction:rtl}.v13462-modal-head{display:flex;align-items:center;justify-content:space-between;gap:12px;padding-bottom:12px;border-bottom:1px solid var(--aldeeb-line)}.v13462-close{width:40px!important;height:40px!important;border:1px solid var(--aldeeb-line)!important;border-radius:10px!important;background:#101419!important;color:#fff!important;font-size:25px!important;cursor:pointer}.v13462-modal h3{margin:0}.v13462-modal p,.v13462-modal span,.v13462-modal div{color:inherit}.v13502-error-card{display:flex;gap:14px;align-items:flex-start;background:#14181D;border:1px solid #5B2529;border-right:4px solid var(--aldeeb-red);padding:15px;border-radius:14px;margin-top:14px}.v13502-error-icon{width:34px;height:34px;min-width:34px;border-radius:50%;display:grid;place-items:center;background:var(--aldeeb-red);color:#fff;font-weight:900}.v13502-error-card h4{margin:0 0 6px;color:#fff!important}.v13502-error-card p{margin:0;color:#D9DEE4!important;line-height:1.8}.v13502-steps{display:grid;gap:6px;margin-top:10px;padding:10px;background:#0E1216;border:1px solid var(--aldeeb-line);border-radius:10px;color:#fff!important}.v13502-steps span{color:#D7DCE2!important}.v13502-steps code{direction:ltr;unicode-bidi:isolate;background:#000;color:#fff;padding:2px 5px;border-radius:5px}.v13502-modal-actions{display:flex;justify-content:flex-start;gap:8px;flex-wrap:wrap;margin-top:14px}
.v13502-agent-status{display:flex;align-items:center;gap:10px;flex-wrap:wrap;margin:12px 0;padding:10px 12px;background:#11151A;border:1px solid var(--aldeeb-line);border-radius:12px;color:#fff!important}.v13502-agent-status.online{border-color:var(--aldeeb-red)}.v13502-agent-status.offline{border-color:#6B2B2F}.v13502-dot{width:9px;height:9px;border-radius:50%;background:var(--aldeeb-red);box-shadow:0 0 10px rgba(215,25,32,.5)}.v13502-agent-status span:not(.v13502-dot){color:var(--aldeeb-muted)!important}.v13502-agent-refresh{margin-right:auto}
.v13502-generic-error{background:#11151A;border:1px solid var(--aldeeb-line);border-radius:12px;padding:14px}.v13502-generic-error b{color:#fff}.v13502-generic-error p{margin:8px 0 0;color:#D9DEE4!important;line-height:1.8}
.v13462-live-toast{position:fixed;right:18px;bottom:18px;z-index:2147483646;max-width:min(420px,calc(100vw - 36px));background:var(--aldeeb-red)!important;color:#fff!important;border:1px solid #fff!important;border-radius:12px;padding:12px 16px;font-weight:900;line-height:1.6;direction:rtl;text-align:right;box-shadow:0 16px 40px rgba(0,0,0,.45)}
.v13462-table{width:100%;border-collapse:collapse}.v13462-table th,.v13462-table td{padding:9px 8px;border-bottom:1px solid var(--aldeeb-line);text-align:right;color:#fff!important}.v13462-table th{background:#1B2026!important}.v13462-energy-chart{display:grid;grid-template-columns:repeat(12,1fr);gap:6px;align-items:end;height:220px;padding:18px;background:#0E1216!important;border:1px solid var(--aldeeb-line);border-radius:16px}.v13462-energy-bar{background:var(--aldeeb-red)!important;border-radius:8px 8px 2px 2px;min-height:5px;position:relative}.v13462-energy-bar span{position:absolute;top:-18px;right:50%;transform:translateX(50%);font-size:9px;color:#fff!important}
@media(max-width:900px){.v13462-smart-grid{grid-template-columns:1fr}.v13462-smart-tabs{grid-template-columns:repeat(2,minmax(0,1fr))}.v13462-smart-kpis{grid-template-columns:repeat(2,minmax(0,1fr))}}
@media(max-width:620px){.v13462-smart-shell{padding:10px}.v13462-smart-hero{flex-direction:column;align-items:stretch}.v13462-smart-account{justify-content:flex-start}.v13462-smart-kpis{grid-template-columns:1fr}.v13462-form-grid{grid-template-columns:1fr}.v13462-smart-meta{grid-template-columns:1fr}.v13462-smart-tabs{grid-template-columns:1fr}.v13462-live-toast{right:12px;left:12px;max-width:none}}

/* ---------- Surface lifecycle / stacking ---------- */
.v13462-smart-page{
  display:none!important;
  visibility:hidden!important;
  pointer-events:none!important;
  position:fixed!important;
  inset:0!important;
  width:100%!important;
  height:100%!important;
  min-width:0!important;
  min-height:0!important;
  max-width:none!important;
  max-height:none!important;
  margin:0!important;
  padding:0!important;
  box-sizing:border-box!important;
  overflow:hidden!important;
  isolation:isolate!important;
  z-index:2147483000!important;
  background:var(--aldeeb-bg)!important;
  color:var(--aldeeb-text)!important;
  font-family:"Segoe UI",Tahoma,Arial,sans-serif;
}
body.v13462-smart-open{
  overflow:hidden!important;
  height:100%!important;
  min-height:100%!important;
}
body.v13462-smart-open .aldeeb-brand-header,
body.v13462-smart-open .role-banner,
body.v13462-smart-open nav,
body.v13462-smart-open .footer{
  visibility:hidden!important;
  pointer-events:none!important;
}
body.v13462-smart-open #smartControlPage.v13462-smart-page{
  display:block!important;
  visibility:visible!important;
  pointer-events:auto!important;
}

/* ---------- Single viewport / scroll owner ---------- */
#smartControlPage.v13462-smart-page > .v13462-smart-scroll{
  position:absolute!important;
  inset:0!important;
  width:100%!important;
  height:100%!important;
  min-width:0!important;
  min-height:0!important;
  max-width:none!important;
  max-height:none!important;
  margin:0!important;
  padding:0!important;
  box-sizing:border-box!important;
  overflow-x:hidden!important;
  overflow-y:auto!important;
  -webkit-overflow-scrolling:touch!important;
  overscroll-behavior-y:contain!important;
  touch-action:pan-y!important;
  scrollbar-gutter:stable!important;
  background:var(--aldeeb-bg)!important;
}
#smartControlPage.v13462-smart-page > .v13462-smart-scroll > .v13462-smart-shell{
  position:relative!important;
  display:block!important;
  width:100%!important;
  min-width:0!important;
  min-height:100%!important;
  max-width:1180px!important;
  margin:0 auto!important;
  padding:18px clamp(12px,2vw,24px) 120px!important;
  box-sizing:border-box!important;
}

/* The background belongs to the viewport, never to a parent page behind it. */
#smartControlPage.v13462-smart-page > .v13462-smart-scroll:before{
  content:"";
  position:fixed;
  inset:0;
  pointer-events:none;
  z-index:-1;
  opacity:.26;
  background-image:
    linear-gradient(120deg,transparent 0 46%,rgba(215,25,32,.22) 47%,transparent 48%),
    linear-gradient(30deg,transparent 0 47%,rgba(255,255,255,.08) 48%,transparent 49%),
    linear-gradient(90deg,transparent 49.5%,rgba(255,255,255,.035) 50%,transparent 50.5%);
  background-size:180px 180px,140px 140px,220px 220px;
}

/* ---------- Stable responsive behavior ---------- */
@media(max-width:900px){
  #smartControlPage.v13462-smart-page > .v13462-smart-scroll > .v13462-smart-shell{
    padding-left:12px!important;padding-right:12px!important;padding-bottom:110px!important;
  }
}
@media(max-width:620px){
  html,body{min-height:100%;}
  #smartControlPage.v13462-smart-page > .v13462-smart-scroll{
    overflow-y:scroll!important;
    -webkit-overflow-scrolling:touch!important;
    overscroll-behavior-y:auto!important;
  }
  #smartControlPage.v13462-smart-page > .v13462-smart-scroll > .v13462-smart-shell{
    width:100%!important;
    min-height:100%!important;
    padding:10px 10px calc(40px + env(safe-area-inset-bottom))!important;
  }
}
