:root{
  --ec-bg:#0b1020;
  --ec-panel:rgba(18,26,46,.92);
  --ec-border:rgba(255,255,255,.10);
  --ec-text:#eef2ff;
  --ec-muted:rgba(238,242,255,.68);
  --ec-brand:#7c3aed;
  --ec-brand2:#5b21b6;
  --ec-r:16px;
  --ec-t:180ms cubic-bezier(.4,0,.2,1);
  --ec-drawer:320px;
}

/* Shell base */
body[data-admin-shell]{
  margin:0;
  font-family:system-ui,-apple-system,Segoe UI,Roboto,Inter,sans-serif;
  background:
    radial-gradient(1200px 600px at 15% 0%,rgba(124,58,237,.35),transparent 55%),
    radial-gradient(900px 500px at 90% 10%,rgba(16,185,129,.22),transparent 55%),
    var(--ec-bg);
  color:var(--ec-text);
}

.ec-admin-shell{min-height:100vh;}

.ec-topbar{
  position:sticky; top:0; z-index:50;
  display:flex; align-items:center; justify-content:space-between; gap:12px;
  padding:12px 14px;
  border-bottom:1px solid var(--ec-border);
  background:rgba(11,16,32,.75);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}
.ec-topbar .left{display:flex; align-items:center; gap:12px; min-width:0;}
.ec-topbar .title{display:flex; align-items:baseline; gap:8px; min-width:0;}
.ec-topbar .title .crumb{font-weight:950;}
.ec-topbar .title .page{font-weight:900; color:rgba(238,242,255,.90); white-space:nowrap; overflow:hidden; text-overflow:ellipsis; max-width:55vw;}
.ec-topbar .meta{display:flex; gap:10px; align-items:center; flex-wrap:wrap; justify-content:flex-end;}
.ec-topbar .who{color:var(--ec-muted); font-weight:800; font-size:.9rem; max-width:22ch; white-space:nowrap; overflow:hidden; text-overflow:ellipsis;}
.ec-topbar .clock{color:var(--ec-muted); font-weight:900; font-variant-numeric:tabular-nums;}

.ec-btn{
  border:1px solid var(--ec-border);
  background:rgba(255,255,255,.06);
  color:var(--ec-text);
  padding:10px 12px;
  border-radius:12px;
  cursor:pointer;
  display:inline-flex; align-items:center; gap:8px;
  font-weight:900;
  transition:var(--ec-t);
  user-select:none;
  text-decoration:none;
}
.ec-btn:hover{transform:translateY(-1px)}
.ec-btn.primary{background:linear-gradient(135deg,var(--ec-brand),var(--ec-brand2)); border-color:rgba(124,58,237,.35)}
.ec-btn.ghost{background:transparent}

/* Drawer */
.ec-backdrop{
  position:fixed; inset:0;
  background:rgba(0,0,0,.45);
  opacity:0; pointer-events:none;
  transition:opacity var(--ec-t);
  z-index:80;
}
.ec-drawer{
  position:fixed; top:0; left:0;
  height:100vh;
  width:var(--ec-drawer);
  max-width:86vw;
  transform:translateX(-110%);
  transition:transform var(--ec-t);
  background:linear-gradient(180deg,rgba(18,26,46,.96),rgba(15,22,42,.96));
  border-right:1px solid var(--ec-border);
  z-index:90;
  overflow:auto;
  box-shadow:0 18px 60px rgba(0,0,0,.45);
}
body.ec-nav-open .ec-backdrop{opacity:1; pointer-events:auto;}
body.ec-nav-open .ec-drawer{transform:translateX(0)}

.ec-brand{
  display:flex; align-items:center; gap:12px;
  padding:16px 14px 12px;
  border-bottom:1px solid var(--ec-border);
}
.ec-brand img{width:auto; height:32px; max-width:32px; border-radius:10px; object-fit:cover; background:rgba(255,255,255,.08)}
.ec-brand .t{line-height:1.1}
.ec-brand .t b{display:block; font-size:1.05rem}
.ec-brand .t span{display:block; font-size:.78rem; color:var(--ec-muted)}

.ec-search{padding:12px 14px; border-bottom:1px solid rgba(255,255,255,.06)}
.ec-search .box{display:flex; align-items:center; gap:10px; padding:10px 12px; border:1px solid rgba(255,255,255,.10); background:rgba(255,255,255,.04); border-radius:12px}
.ec-search input{width:100%; border:0; outline:0; background:transparent; color:var(--ec-text); font-weight:900}
.ec-search .hint{margin-top:6px; color:var(--ec-muted); font-size:.78rem; font-weight:800}

.ec-nav{padding:10px 10px 18px}
.ec-group{margin:10px 4px}
.ec-group-btn{
  width:100%;
  display:flex; align-items:center; justify-content:space-between;
  padding:10px 12px;
  border-radius:12px;
  border:1px solid rgba(255,255,255,.08);
  background:rgba(255,255,255,.03);
  color:rgba(238,242,255,.90);
  cursor:pointer;
  font-weight:950;
}
.ec-group-btn:hover{background:rgba(255,255,255,.05)}
.ec-group-btn .chev{opacity:.8; transition:transform var(--ec-t)}
.ec-group-btn[aria-expanded="false"] .chev{transform:rotate(-90deg)}
.ec-group-body{margin-top:8px}
.ec-group-btn[aria-expanded="false"] + .ec-group-body{display:none}

.ec-link{
  display:flex; align-items:center; gap:10px;
  padding:10px 12px;
  margin:4px 0;
  border-radius:12px;
  color:rgba(238,242,255,.84);
  border:1px solid transparent;
  text-decoration:none;
  font-weight:900;
}
.ec-link:hover{background:rgba(255,255,255,.05); border-color:rgba(255,255,255,.08); color:var(--ec-text)}
.ec-link.active{background:rgba(124,58,237,.15); border-color:rgba(124,58,237,.25); color:var(--ec-text)}
.ec-link i{width:18px; text-align:center; opacity:.92}
.ec-badge{margin-left:auto; font-size:.72rem; font-weight:950; padding:4px 8px; border-radius:999px; border:1px solid rgba(255,255,255,.12); background:rgba(255,255,255,.05); color:rgba(238,242,255,.86)}

.ec-main{padding:16px;}

/* Make legacy pages not feel cramped */
.ec-main > *{max-width:1400px}

@media (max-width: 720px){
  .ec-topbar .clock{display:none}
  .ec-topbar .who{display:none}
}

/* =============================
   FIXPACK: Admin shell layout
   - prevents 'half page' layouts
   - styles injected shell classes from admin-shell.js
   ============================= */

/* Root shell wrapper built by admin-shell.js */
.ec-shell{
  display:flex;
  min-height:100vh;
  width:100vw;
}

.ec-right{
  flex:1;
  min-width:0;
  display:flex;
  flex-direction:column;
}

/* Ensure drawer is stable on desktop */
@media (min-width: 960px){
  .ec-backdrop{display:none;}
  .ec-drawer{
    position:sticky;
    top:0;
    transform:none !important;
    height:100vh;
  }
  body.ec-nav-open .ec-drawer{transform:none}
}

/* Main content should take full remaining width */
.ec-main{
  flex:1;
  width:auto;
  max-width:none;
  box-sizing:border-box;
}

/* Remove legacy 'container' constraints inside admin */
body[data-admin-shell] .container,
body[data-admin-shell] .container-fluid,
body[data-admin-shell] .page-container,
body[data-admin-shell] .wrap,
body[data-admin-shell] .content,
body[data-admin-shell] .main,
body[data-admin-shell] .ec-page{
  max-width:none !important;
  width:100% !important;
}

/* Buttons used by injected topbar */
.btn{
  border:1px solid var(--ec-border);
  background:rgba(255,255,255,.06);
  color:var(--ec-text);
  padding:10px 12px;
  border-radius:12px;
  cursor:pointer;
  display:inline-flex;
  align-items:center;
  gap:8px;
  font-weight:900;
  transition:var(--ec-t);
  user-select:none;
  text-decoration:none;
}
.btn:hover{transform:translateY(-1px)}
.btn.ghost{background:transparent}

.hide-sm{display:inline}
@media (max-width: 720px){
  .hide-sm{display:none}
}

/* Collapsible section styles */
.ec-sec{
  width:100%;
  display:flex;
  align-items:center;
  justify-content:space-between;
  padding:10px 12px;
  border-radius:12px;
  border:1px solid rgba(255,255,255,.08);
  background:rgba(255,255,255,.03);
  color:rgba(238,242,255,.90);
  cursor:pointer;
  font-weight:950;
}
.ec-sec:hover{background:rgba(255,255,255,.05)}
.ec-sec i{opacity:.92}
.ec-sec .chev{opacity:.8; transition:transform var(--ec-t)}

.ec-sec-body{margin:8px 0 12px; padding:0 4px}

.badge{
  margin-left:auto;
  font-size:.72rem;
  font-weight:950;
  padding:4px 8px;
  border-radius:999px;
  border:1px solid rgba(255,255,255,.12);
  background:rgba(255,255,255,.05);
  color:rgba(238,242,255,.86);
}

.ec-empty{padding:10px 12px; color:var(--ec-muted); font-weight:900}

/* Ensure legacy pages don't get squeezed */
.ec-main > *{max-width:none}


/* Contrast patch: solid admin surfaces, no milky blur */
body[data-admin-shell]{
  background:#0b1020 !important;
  color:#eef2ff !important;
}
body[data-admin-shell] .ec-topbar,
body[data-admin-shell] .ec-drawer,
body[data-admin-shell] .ec-group-btn,
body[data-admin-shell] .ec-sec,
body[data-admin-shell] .ec-btn,
body[data-admin-shell] .btn,
body[data-admin-shell] .card,
body[data-admin-shell] .panel,
body[data-admin-shell] .tile,
body[data-admin-shell] .box,
body[data-admin-shell] table,
body[data-admin-shell] thead,
body[data-admin-shell] tbody,
body[data-admin-shell] th,
body[data-admin-shell] td,
body[data-admin-shell] input,
body[data-admin-shell] select,
body[data-admin-shell] textarea{
  backdrop-filter:none !important;
  -webkit-backdrop-filter:none !important;
}
body[data-admin-shell] .ec-topbar{background:#10182b !important;}
body[data-admin-shell] .ec-drawer{background:#0f1728 !important;}
body[data-admin-shell] .ec-group-btn,
body[data-admin-shell] .ec-sec,
body[data-admin-shell] .ec-btn,
body[data-admin-shell] .btn,
body[data-admin-shell] input,
body[data-admin-shell] select,
body[data-admin-shell] textarea{background:#152033 !important;border-color:rgba(255,255,255,.10) !important;color:#eef2ff !important;}
body[data-admin-shell] .card,
body[data-admin-shell] .panel,
body[data-admin-shell] .tile,
body[data-admin-shell] .box,
body[data-admin-shell] table{background:#121a2e !important;border-color:rgba(255,255,255,.10) !important;color:#eef2ff !important;}
body[data-admin-shell] th{background:#162036 !important;color:#c9d4f2 !important;}
body[data-admin-shell] td{color:#eef2ff !important;}
body[data-admin-shell] .muted,
body[data-admin-shell] .hint,
body[data-admin-shell] .sub,
body[data-admin-shell] .small,
body[data-admin-shell] .meta,
body[data-admin-shell] .ec-muted,
body[data-admin-shell] .ec-topbar .who,
body[data-admin-shell] .ec-topbar .clock{color:#b8c2e0 !important;opacity:1 !important;}
