:root{
  --ec-bg:#17120d;
  --ec-panel:rgba(37,28,20,.92);
  --ec-border:rgba(255,255,255,.10);
  --ec-text:#eef2ff;
  --ec-muted:rgba(238,242,255,.68);
  --ec-brand:#7b4b2a;
  --ec-brand2:#5d7c45;
  --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(123,75,42,.32),transparent 55%),
    radial-gradient(900px 500px at 90% 10%,rgba(93,124,69,.20),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;}

/* Readability patch: warmer admin text contrast */
body[data-admin-shell] a{color:#f1d19a;}
body[data-admin-shell] a:hover{color:#ffe3b7;}
body[data-admin-shell] h1,
body[data-admin-shell] h2,
body[data-admin-shell] h3,
body[data-admin-shell] h4,
body[data-admin-shell] b,
body[data-admin-shell] strong{color:#f6f7fb !important;}
body[data-admin-shell] .card .mut,
body[data-admin-shell] .card .muted,
body[data-admin-shell] small{color:#b8c2e0 !important;}
body[data-admin-shell] input::placeholder,
body[data-admin-shell] textarea::placeholder{color:#97a7ce !important;opacity:1;}


/* Admin shell stability patch */
html, body[data-admin-shell]{
  direction:ltr !important;
}
body[data-admin-shell], body[data-admin-shell] *{
  box-sizing:border-box;
}
body[data-admin-shell] .ec-shell,
body[data-admin-shell] .ec-right,
body[data-admin-shell] .ec-main,
body[data-admin-shell] .ec-topbar,
body[data-admin-shell] .ec-drawer,
body[data-admin-shell] .ec-nav,
body[data-admin-shell] .ec-nav-list{
  direction:ltr !important;
}
body[data-admin-shell] .ec-main{
  overflow-x:auto;
}
body[data-admin-shell] .ec-main > .ec-shared-brand-shell,
body[data-admin-shell] .ec-main > .ec-shared-invoice-brand,
body[data-admin-shell] .ec-right > .ec-shared-brand-shell,
body[data-admin-shell] .ec-right > .ec-shared-invoice-brand,
body[data-admin-shell] .ec-shell > .ec-shared-brand-shell,
body[data-admin-shell] .ec-shell > .ec-shared-invoice-brand{
  display:none !important;
}
body[data-admin-shell] table,
body[data-admin-shell] .table,
body[data-admin-shell] [class*="table"]{
  direction:ltr !important;
}
@media (max-width: 959px){
  .ec-shell{
    width:100% !important;
    max-width:100% !important;
    overflow-x:hidden !important;
  }
  .ec-right{
    width:100% !important;
    max-width:100% !important;
  }
  .ec-main{
    padding:12px !important;
    width:100% !important;
    max-width:100% !important;
  }
  .ec-topbar{
    padding:10px 12px !important;
  }
  .ec-topbar .title .page{
    max-width:42vw;
  }
}

/* 2026-06-09 fix: admin should use only the real admin drawer, not the global role sidebar */
body[data-admin-shell].ec-dashboard-shell{
  padding-left:0 !important;
  background:#0b1020 !important;
}
body[data-admin-shell] > aside.sidebar,
body[data-admin-shell] > aside.ec-unified-sidebar,
body[data-admin-shell] > .ec-dashboard-mobilebar,
body[data-admin-shell] > .ec-dashboard-backdrop,
body[data-admin-shell] .ec-main > aside.sidebar,
body[data-admin-shell] .ec-main > aside.ec-unified-sidebar,
body[data-admin-shell] .ec-main > .ec-dashboard-mobilebar,
body[data-admin-shell] .ec-main > .ec-dashboard-backdrop{
  display:none !important;
}
body[data-admin-shell] .ec-shell{
  background:#0b1020 !important;
}
body[data-admin-shell] .ec-right,
body[data-admin-shell] .ec-main{
  background:
    radial-gradient(900px 420px at 12% 0%, rgba(201,151,65,.10), transparent 55%),
    radial-gradient(800px 420px at 92% 10%, rgba(76,122,74,.12), transparent 58%),
    #0b1020 !important;
  color:#eef2ff !important;
}
body[data-admin-shell] .ec-main *{
  text-shadow:none;
}
body[data-admin-shell] .wrap,
body[data-admin-shell] .card,
body[data-admin-shell] .kpi,
body[data-admin-shell] .panel,
body[data-admin-shell] .box,
body[data-admin-shell] section,
body[data-admin-shell] article{
  color:#eef2ff !important;
}
body[data-admin-shell] .wrap p,
body[data-admin-shell] .card p,
body[data-admin-shell] .muted,
body[data-admin-shell] small{
  color:#b8c2e0 !important;
}


/* =========================================================
   2026-06 Admin regroup + full-width workflow patch
   Goal: all real admin pages stay in the grouped menu, while
   forms/evaluations/reports use the full available width.
   ========================================================= */
:root{--ec-drawer:280px;}
body[data-admin-shell] .ec-drawer{width:var(--ec-drawer);}
body[data-admin-shell] .ec-main{
  width:100% !important;
  max-width:none !important;
  padding:22px clamp(14px,2vw,28px) 56px !important;
  overflow-x:hidden !important;
}
body[data-admin-shell].ec-workflow-page .ec-main,
body[data-admin-shell] .ec-main.workflow,
body[data-admin-shell] .ec-main.full-width{
  padding:18px clamp(12px,1.6vw,24px) 48px !important;
}
body[data-admin-shell].ec-workflow-page .ec-main > *,
body[data-admin-shell].ec-workflow-page .container,
body[data-admin-shell].ec-workflow-page .container-fluid,
body[data-admin-shell].ec-workflow-page .page-container,
body[data-admin-shell].ec-workflow-page .wrap,
body[data-admin-shell].ec-workflow-page .shell,
body[data-admin-shell].ec-workflow-page main,
body[data-admin-shell].ec-workflow-page section{
  max-width:none !important;
}
body[data-admin-shell].ec-workflow-page .ec-main > main,
body[data-admin-shell].ec-workflow-page .ec-main > .wrap,
body[data-admin-shell].ec-workflow-page .ec-main > .container,
body[data-admin-shell].ec-workflow-page .ec-main > .page-container{
  width:100% !important;
  margin-left:0 !important;
  margin-right:0 !important;
}
body[data-admin-shell] .admin-frame{
  display:block !important;
  width:100% !important;
  min-height:calc(100vh - 112px) !important;
  height:calc(100vh - 112px) !important;
  border-radius:18px !important;
  background:#fffaf3 !important;
}
body[data-admin-shell].ec-workflow-page h1,
body[data-admin-shell].ec-workflow-page .hint{
  max-width:none !important;
}
body[data-admin-shell] .ec-nav-list{padding-bottom:88px;}
body[data-admin-shell] .ec-sec{
  min-height:38px;
  background:#142038 !important;
  border-color:rgba(255,255,255,.11) !important;
}
body[data-admin-shell] .ec-sec-body{margin:7px 0 12px;}
body[data-admin-shell] .ec-link{
  min-height:34px;
  padding:8px 10px;
  font-size:.92rem;
}
body[data-admin-shell] .ec-link.active{
  background:linear-gradient(90deg,rgba(221,163,70,.28),rgba(124,58,237,.16)) !important;
  border-color:rgba(221,163,70,.42) !important;
  color:#fff7e8 !important;
}
/* Remove duplicate quick navigation blocks on admin overview; sidebar is the navigation. */
body[data-admin-shell] .quick-navigation,
body[data-admin-shell] #quickNavigation,
body[data-admin-shell] [data-quick-navigation],
body[data-admin-shell] .quick-nav,
body[data-admin-shell] .admin-quick-nav{
  display:none !important;
}
/* Make common grids responsive without squeezing desktop workflow pages. */
body[data-admin-shell] .layout,
body[data-admin-shell] .grid,
body[data-admin-shell] .cards,
body[data-admin-shell] .dashboard-grid,
body[data-admin-shell] .admin-grid{
  max-width:100%;
}
@media (min-width: 1280px){
  body[data-admin-shell].ec-workflow-page .layout.two-col,
  body[data-admin-shell].ec-workflow-page .layout-2,
  body[data-admin-shell].ec-workflow-page .split,
  body[data-admin-shell].ec-workflow-page .main-grid{
    grid-template-columns:minmax(760px,1fr) minmax(320px,420px) !important;
  }
}
@media (max-width: 959px){
  :root{--ec-drawer:300px;}
  body[data-admin-shell] .ec-main{padding:14px 12px 42px !important;}
  body[data-admin-shell] .ec-topbar{position:sticky;top:0;}
  body[data-admin-shell] .ec-drawer{position:fixed !important;transform:translateX(-110%) !important;}
  body[data-admin-shell].ec-nav-open .ec-drawer{transform:translateX(0) !important;}
  body[data-admin-shell] .admin-frame{height:calc(100vh - 92px) !important;min-height:720px !important;}
  body[data-admin-shell] .ec-topbar .title .page{max-width:36vw;}
}
@media (max-width: 640px){
  body[data-admin-shell] .ec-topbar{gap:8px;}
  body[data-admin-shell] .ec-topbar .title{display:none;}
  body[data-admin-shell] .ec-main{padding:10px 10px 36px !important;}
  body[data-admin-shell] .ec-drawer{max-width:92vw;}
  body[data-admin-shell] .ec-link{font-size:.9rem;}
}


/* Equity clean platform patch import */
@import url("/assets/css/equity_clean_platform_patch.css");
