
/* Phase 108 – certified responsive shell and surface-head cleanup
   This is the final responsive guard layer and must load last. */
html.admin-ui-active{
  --adm108-line:rgba(148,163,184,.095);
  --adm108-line-soft:rgba(148,163,184,.055);
  --adm108-bg:#07111f;
  --adm108-panel:#102038;
  --adm108-panel2:#0d1a2e;
  --adm108-text:#f8fbff;
  --adm108-muted:#9fb2c8;
}

/* Global overflow guard: prevents accidental two-column bleed on smaller screens */
html.admin-ui-active,
html.admin-ui-active body,
html.admin-ui-active body.admin-shell-body,
html.admin-ui-active .main-container,
html.admin-ui-active .admin-app-v91,
html.admin-ui-active .admin-app-v91__workspace,
html.admin-ui-active .admin-content-v91{
  max-width:100%!important;
  overflow-x:hidden!important;
}

/* Remove the requested .surface-head border everywhere in admin */
html.admin-ui-active .admin-content-v91 .surface-head,
html.admin-ui-active .admin-content-v91 .surface-head *,
html.admin-ui-active .surface-head{
  border-top:0!important;
  border-right:0!important;
  border-bottom:0!important;
  border-left:0!important;
  box-shadow:none!important;
}
html.admin-ui-active .admin-content-v91 .surface-head{
  background:transparent!important;
  border-radius:0!important;
  margin-bottom:14px!important;
  padding-bottom:0!important;
}

/* Keep other headers clean but still structured */
html.admin-ui-active .admin-content-v91 :where(.module-header,.admin-section-header,.card-header){
  border-bottom:1px solid var(--adm108-line-soft)!important;
}

/* Main shell: desktop stays 2-column; mobile becomes true 1-column block */
html.admin-ui-active .admin-app-v91{
  width:100%!important;
  min-width:0!important;
}
@media (min-width: 992px){
  html.admin-ui-active .admin-app-v91{
    display:flex!important;
    align-items:stretch!important;
    flex-wrap:nowrap!important;
  }
  html.admin-ui-active .admin-mobile-bar{
    display:none!important;
  }
  html.admin-ui-active .admin-app-v91__workspace{
    min-width:0!important;
    flex:1 1 auto!important;
  }
}

/* Critical fix: mobile bar must not become a side column */
@media (max-width: 991.98px){
  html.admin-ui-active .admin-app-v91{
    display:block!important;
    width:100%!important;
    min-width:0!important;
  }
  html.admin-ui-active .admin-mobile-bar{
    display:grid!important;
    grid-template-columns:1fr!important;
    width:100%!important;
    max-width:100%!important;
    min-width:0!important;
    left:auto!important;
    right:auto!important;
    margin:0!important;
    padding:10px 12px!important;
    position:sticky!important;
    top:0!important;
    z-index:1200!important;
    background:#07111f!important;
    border:0!important;
    border-bottom:1px solid var(--adm108-line)!important;
    box-shadow:0 10px 30px rgba(0,0,0,.18)!important;
    transform:none!important;
  }
  html.admin-ui-active .admin-mobile-bar > *{
    width:100%!important;
    min-width:0!important;
    max-width:100%!important;
  }
  html.admin-ui-active .admin-mobile-bar .admin-sidebar-toggle,
  html.admin-ui-active .admin-mobile-bar .admin-mobile-current,
  html.admin-ui-active .admin-mobile-bar .admin-mobile-jump-wrap,
  html.admin-ui-active .admin-mobile-bar .admin-mobile-jump{
    width:100%!important;
    max-width:100%!important;
    min-width:0!important;
  }
  html.admin-ui-active .admin-app-v91__workspace{
    display:block!important;
    width:100%!important;
    max-width:100%!important;
    min-width:0!important;
    margin-left:0!important;
  }
  html.admin-ui-active .admin-sidebar{
    position:fixed!important;
    inset:0 auto 0 0!important;
    width:min(86vw,320px)!important;
    max-width:min(86vw,320px)!important;
    transform:translateX(-110%)!important;
    transition:transform .22s ease!important;
    z-index:1250!important;
  }
  html.admin-ui-active.admin-sidebar-open .admin-sidebar,
  html.admin-ui-active .admin-sidebar.is-open{
    transform:translateX(0)!important;
  }
  html.admin-ui-active .admin-topbar-v91{
    position:relative!important;
    top:auto!important;
    display:grid!important;
    grid-template-columns:1fr!important;
    gap:12px!important;
    width:100%!important;
    max-width:100%!important;
    padding:14px!important;
  }
  html.admin-ui-active .admin-topbar-v91__actions{
    display:grid!important;
    grid-template-columns:1fr 1fr!important;
    gap:10px!important;
    width:100%!important;
    max-width:100%!important;
  }
  html.admin-ui-active .admin-topbar-v91__actions .btn{
    width:100%!important;
  }
  html.admin-ui-active .admin-content-v91{
    width:100%!important;
    max-width:100%!important;
    padding:14px!important;
  }
}

/* Responsive grids: certify common screen classes */
@media (max-width: 1536px){
  html.admin-ui-active .admin-content-v91 :where(.section-grid,.section-grid--balanced,.admin-grid-v90,.panel-grid-v67){
    grid-template-columns:1fr!important;
  }
  html.admin-ui-active .admin-content-v91 .aside-stack{
    display:grid!important;
    grid-template-columns:repeat(auto-fit,minmax(260px,1fr))!important;
    gap:18px!important;
  }
}
@media (max-width: 1024px){
  html.admin-ui-active .admin-content-v91 :where(.metric-grid,.stats-grid,.admin-stat-grid,.cards-grid,.module-grid){
    grid-template-columns:repeat(auto-fit,minmax(220px,1fr))!important;
  }
}
@media (max-width: 820px){
  html.admin-ui-active .admin-content-v91 :where(.metric-grid,.stats-grid,.admin-stat-grid,.cards-grid,.module-grid),
  html.admin-ui-active .admin-content-v91 .aside-stack{
    grid-template-columns:1fr!important;
  }
  html.admin-ui-active .admin-content-v91 :where(.workspace-hero__actions,.admin-topbar-v91__actions){
    grid-template-columns:1fr!important;
  }
}

/* Tables: keep desktop scroll safe and phone card safe */
html.admin-ui-active .admin-content-v91 :where(.table-shell,.admin-readable-table-shell,.table-responsive,.dataTables_wrapper,.dataTables_scroll,.dataTables_scrollHead,.dataTables_scrollBody){
  max-width:100%!important;
  overflow-x:auto!important;
  overflow-y:visible!important;
  border:0!important;
  box-shadow:none!important;
  background:transparent!important;
}
html.admin-ui-active .admin-content-v91 :where(table,.table,table.dataTable,.admin-readable-table){
  max-width:100%!important;
}

/* Phone screens */
@media (max-width: 767.98px){
  html.admin-ui-active .admin-mobile-bar{
    gap:10px!important;
  }
  html.admin-ui-active .admin-content-v91{
    padding:12px!important;
  }
  html.admin-ui-active .admin-content-v91 :where(.workspace-hero,.admin-module-hero,.surface,.card,.panel,.module-card,.settings-card,.content-card){
    border-radius:18px!important;
  }
  html.admin-ui-active .admin-content-v91 :where(table,.table,table.dataTable,.admin-readable-table){
    border:0!important;
    background:transparent!important;
  }
  html.admin-ui-active .admin-content-v91 :where(table:not(.no-mobile-cards),.table:not(.no-mobile-cards),.admin-readable-table:not(.no-mobile-cards)) thead{
    display:none!important;
  }
  html.admin-ui-active .admin-content-v91 :where(table:not(.no-mobile-cards),.table:not(.no-mobile-cards),.admin-readable-table:not(.no-mobile-cards)),
  html.admin-ui-active .admin-content-v91 :where(table:not(.no-mobile-cards),.table:not(.no-mobile-cards),.admin-readable-table:not(.no-mobile-cards)) tbody,
  html.admin-ui-active .admin-content-v91 :where(table:not(.no-mobile-cards),.table:not(.no-mobile-cards),.admin-readable-table:not(.no-mobile-cards)) tr,
  html.admin-ui-active .admin-content-v91 :where(table:not(.no-mobile-cards),.table:not(.no-mobile-cards),.admin-readable-table:not(.no-mobile-cards)) td{
    display:block!important;
    width:100%!important;
    min-width:0!important;
  }
  html.admin-ui-active .admin-content-v91 :where(table:not(.no-mobile-cards),.table:not(.no-mobile-cards),.admin-readable-table:not(.no-mobile-cards)) tr{
    border:1px solid var(--adm108-line)!important;
    border-radius:16px!important;
    margin:0 0 12px!important;
    overflow:hidden!important;
    background:#0c192c!important;
  }
  html.admin-ui-active .admin-content-v91 :where(table:not(.no-mobile-cards),.table:not(.no-mobile-cards),.admin-readable-table:not(.no-mobile-cards)) td{
    display:flex!important;
    justify-content:space-between!important;
    align-items:flex-start!important;
    gap:12px!important;
    padding:12px 14px!important;
    border-bottom:1px solid var(--adm108-line-soft)!important;
    text-align:right!important;
    background:#0c192c!important;
  }
  html.admin-ui-active .admin-content-v91 :where(table:not(.no-mobile-cards),.table:not(.no-mobile-cards),.admin-readable-table:not(.no-mobile-cards)) td::before{
    content:attr(data-label)!important;
    flex:0 0 44%!important;
    max-width:44%!important;
    text-align:left!important;
    color:#fff!important;
    font-weight:850!important;
  }
  html.admin-ui-active .admin-content-v91 :where(table:not(.no-mobile-cards),.table:not(.no-mobile-cards),.admin-readable-table:not(.no-mobile-cards)) td:last-child{
    border-bottom:0!important;
  }
}
@media (max-width: 430px){
  html.admin-ui-active .admin-topbar-v91__title h1,
  html.admin-ui-active .workspace-hero__title{
    font-size:clamp(1.45rem,7vw,1.95rem)!important;
    line-height:1.08!important;
  }
  html.admin-ui-active .admin-content-v91{
    padding:10px!important;
  }
}
@media (max-width: 360px){
  html.admin-ui-active .admin-mobile-bar{
    padding:8px!important;
  }
  html.admin-ui-active .admin-content-v91{
    padding:8px!important;
  }
  html.admin-ui-active .admin-content-v91 :where(.btn,.form-control,.form-select){
    min-height:42px!important;
  }
}
